@swmansion/argent 0.35.1-next.76 → 0.35.1-next.78
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/bin/argent-android-devtools-0.4.0.apk +0 -0
- package/bin/darwin/argent-macos-helper +0 -0
- package/bin/darwin/ax-service +0 -0
- package/bin/darwin/tvos-ax-service +0 -0
- package/bin/darwin/tvos-hid-daemon +0 -0
- package/bin/network-inspector/network-inspector.jar +0 -0
- package/bin/tcp/ax-service +0 -0
- package/dist/cli-cmds.mjs +1 -1
- package/dist/installer.mjs +1 -1
- package/dist/mcp-server.mjs +1 -1
- package/dist/tool-server.cjs +262 -120
- package/dylibs/libArgentAudio.dylib +0 -0
- package/dylibs/libArgentInjectionBootstrap.dylib +0 -0
- package/dylibs/libKeyboardPatch.dylib +0 -0
- package/dylibs/libNativeDevtoolsIos.dylib +0 -0
- package/dylibs/macos/libArgentInjectionBootstrap.dylib +0 -0
- package/dylibs/macos/libNativeDevtoolsMacos.dylib +0 -0
- package/dylibs/tcp/argent-audio-feeder +0 -0
- package/dylibs/tcp/libArgentAudio.dylib +0 -0
- package/dylibs/tcp/libArgentInjectionBootstrap.dylib +0 -0
- package/dylibs/tcp/libKeyboardPatch.dylib +0 -0
- package/dylibs/tcp/libNativeDevtoolsIos.dylib +0 -0
- package/dylibs/tvos/libArgentInjectionBootstrap.dylib +0 -0
- package/dylibs/tvos/libKeyboardPatch.dylib +0 -0
- package/dylibs/tvos/libNativeDevtoolsIos.dylib +0 -0
- package/package.json +2 -2
|
Binary file
|
|
Binary file
|
package/bin/darwin/ax-service
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/bin/tcp/ax-service
CHANGED
|
Binary file
|
package/dist/cli-cmds.mjs
CHANGED
|
@@ -38906,7 +38906,7 @@ function isCi(env = process.env) {
|
|
|
38906
38906
|
var SESSION_ID2 = randomUUID5();
|
|
38907
38907
|
function readCliVersion() {
|
|
38908
38908
|
if (true) {
|
|
38909
|
-
return "0.35.1-next.
|
|
38909
|
+
return "0.35.1-next.78";
|
|
38910
38910
|
}
|
|
38911
38911
|
return "0.0.0";
|
|
38912
38912
|
}
|
package/dist/installer.mjs
CHANGED
|
@@ -17138,7 +17138,7 @@ function isCi(env = process.env) {
|
|
|
17138
17138
|
var SESSION_ID = randomUUID4();
|
|
17139
17139
|
function readCliVersion() {
|
|
17140
17140
|
if (true) {
|
|
17141
|
-
return "0.35.1-next.
|
|
17141
|
+
return "0.35.1-next.78";
|
|
17142
17142
|
}
|
|
17143
17143
|
return "0.0.0";
|
|
17144
17144
|
}
|
package/dist/mcp-server.mjs
CHANGED
|
@@ -38473,7 +38473,7 @@ async function startMcpServer(options) {
|
|
|
38473
38473
|
const autoDescribeOn = autoDescribeEnabled();
|
|
38474
38474
|
const whatsNewOn = whatsNewEnabled();
|
|
38475
38475
|
const installedVersion = getInstalledVersion();
|
|
38476
|
-
const highlightsVersion = true ? "0.35.1-next.
|
|
38476
|
+
const highlightsVersion = true ? "0.35.1-next.78" : installedVersion;
|
|
38477
38477
|
const captureTimeoutMs = options.captureTimeoutMs ?? CAPTURE_TIMEOUT_MS;
|
|
38478
38478
|
const trees = createTreeMemory();
|
|
38479
38479
|
const screenshots = createScreenshotMemory();
|
package/dist/tool-server.cjs
CHANGED
|
@@ -52134,13 +52134,18 @@ function findExternalDevice(id) {
|
|
|
52134
52134
|
if (!record2) return void 0;
|
|
52135
52135
|
return readProviderDevices2(record2).find((device) => device.nativeId === parsed2.nativeId);
|
|
52136
52136
|
}
|
|
52137
|
+
function sameNativeId(a, b) {
|
|
52138
|
+
return a === b || SIMULATOR_UDID.test(a) && a.toUpperCase() === b.toUpperCase();
|
|
52139
|
+
}
|
|
52137
52140
|
function externalClaimForNativeId(nativeId) {
|
|
52138
52141
|
const providers = discoverProviders();
|
|
52139
52142
|
if (providers.length === 0) return void 0;
|
|
52140
52143
|
if (isExternalId(nativeId)) return void 0;
|
|
52141
52144
|
for (const record2 of providers) {
|
|
52142
52145
|
if (record2.pid !== void 0 && !isProcessAlive(record2.pid)) continue;
|
|
52143
|
-
const device = readProviderDevices2(record2).find(
|
|
52146
|
+
const device = readProviderDevices2(record2).find(
|
|
52147
|
+
(device2) => sameNativeId(device2.nativeId, nativeId)
|
|
52148
|
+
);
|
|
52144
52149
|
if (device) return device;
|
|
52145
52150
|
}
|
|
52146
52151
|
return void 0;
|
|
@@ -52239,7 +52244,7 @@ function externalSupportHint(id) {
|
|
|
52239
52244
|
const where = record2.supportUrl ? ` Report issues at ${record2.supportUrl}.` : "";
|
|
52240
52245
|
return `This device is provided by ${record2.name}.${where}`;
|
|
52241
52246
|
}
|
|
52242
|
-
var ALLOWED_ENDPOINT_SET, PROBE_TIMEOUT_MS, lastSeenCapabilities, inFlightRevocations;
|
|
52247
|
+
var ALLOWED_ENDPOINT_SET, PROBE_TIMEOUT_MS, SIMULATOR_UDID, lastSeenCapabilities, inFlightRevocations;
|
|
52243
52248
|
var init_external_devices = __esm({
|
|
52244
52249
|
"../tool-server/src/utils/external-devices.ts"() {
|
|
52245
52250
|
"use strict";
|
|
@@ -52249,6 +52254,7 @@ var init_external_devices = __esm({
|
|
|
52249
52254
|
init_src3();
|
|
52250
52255
|
ALLOWED_ENDPOINT_SET = new Set(ALLOWED_SIM_SERVER_ENDPOINTS);
|
|
52251
52256
|
PROBE_TIMEOUT_MS = 800;
|
|
52257
|
+
SIMULATOR_UDID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
52252
52258
|
lastSeenCapabilities = /* @__PURE__ */ new Map();
|
|
52253
52259
|
inFlightRevocations = /* @__PURE__ */ new Map();
|
|
52254
52260
|
}
|
|
@@ -73359,7 +73365,7 @@ function isCi(env = process.env) {
|
|
|
73359
73365
|
var SESSION_ID = (0, import_node_crypto3.randomUUID)();
|
|
73360
73366
|
function readCliVersion() {
|
|
73361
73367
|
if (true) {
|
|
73362
|
-
return "0.35.1-next.
|
|
73368
|
+
return "0.35.1-next.78";
|
|
73363
73369
|
}
|
|
73364
73370
|
return "0.0.0";
|
|
73365
73371
|
}
|
|
@@ -81767,9 +81773,17 @@ async function scanIosSimulators() {
|
|
|
81767
81773
|
return { simulators: out, timedOut: perSet.some((set2) => set2.timedOut) };
|
|
81768
81774
|
}
|
|
81769
81775
|
var runtimeKindCache = /* @__PURE__ */ new Map();
|
|
81776
|
+
var runtimeKindLookups = /* @__PURE__ */ new Map();
|
|
81770
81777
|
async function getSimulatorRuntimeKind(udid) {
|
|
81771
81778
|
const cached3 = runtimeKindCache.get(udid);
|
|
81772
81779
|
if (cached3) return cached3;
|
|
81780
|
+
const inFlight5 = runtimeKindLookups.get(udid);
|
|
81781
|
+
if (inFlight5) return inFlight5;
|
|
81782
|
+
const lookup = lookUpRuntimeKind(udid).finally(() => runtimeKindLookups.delete(udid));
|
|
81783
|
+
runtimeKindLookups.set(udid, lookup);
|
|
81784
|
+
return lookup;
|
|
81785
|
+
}
|
|
81786
|
+
async function lookUpRuntimeKind(udid) {
|
|
81773
81787
|
const kind = (await findIosSimulator(udid))?.runtimeKind;
|
|
81774
81788
|
if (kind) runtimeKindCache.set(udid, kind);
|
|
81775
81789
|
return kind;
|
|
@@ -101582,6 +101596,7 @@ init_external_devices();
|
|
|
101582
101596
|
|
|
101583
101597
|
// ../tool-server/src/utils/simulator-watcher.ts
|
|
101584
101598
|
var fs29 = __toESM(require("node:fs"));
|
|
101599
|
+
init_src2();
|
|
101585
101600
|
|
|
101586
101601
|
// ../tool-server/src/blueprints/native-devtools.ts
|
|
101587
101602
|
var net3 = __toESM(require("node:net"));
|
|
@@ -102279,14 +102294,34 @@ async function ensureAccessibilityEnabled(udid) {
|
|
|
102279
102294
|
);
|
|
102280
102295
|
}
|
|
102281
102296
|
async function setupNativeDevtoolsEnvLocal(udid, endpoint) {
|
|
102282
|
-
const tvOs = await isTvOsSimulator(udid);
|
|
102283
|
-
const bootstrapPath = await bootstrapPathFor(udid, endpoint);
|
|
102284
102297
|
const { nativeId, prefix } = await simctlTargetForUdid(udid, { granted: "native-devtools" });
|
|
102285
|
-
const
|
|
102286
|
-
"
|
|
102287
|
-
|
|
102288
|
-
|
|
102289
|
-
|
|
102298
|
+
const launchctl = (args) => execFileAsync14("xcrun", [...prefix, "spawn", nativeId, "launchctl", ...args], {
|
|
102299
|
+
encoding: "utf8",
|
|
102300
|
+
timeout: SIMCTL_SPAWN_TIMEOUT_MS,
|
|
102301
|
+
killSignal: SIMCTL_KILL_SIGNAL
|
|
102302
|
+
});
|
|
102303
|
+
await settleAllOrThrow([
|
|
102304
|
+
insertInjectionDylibs(udid, endpoint, nativeId, launchctl),
|
|
102305
|
+
setEndpointEnv(endpoint, launchctl),
|
|
102306
|
+
ensureAccessibilityEnabled(udid)
|
|
102307
|
+
]);
|
|
102308
|
+
}
|
|
102309
|
+
async function settleAllOrThrow(steps) {
|
|
102310
|
+
const results = await Promise.allSettled(steps);
|
|
102311
|
+
const failure3 = results.find((r) => r.status === "rejected");
|
|
102312
|
+
if (failure3) throw failure3.reason;
|
|
102313
|
+
}
|
|
102314
|
+
async function insertInjectionDylibs(udid, endpoint, nativeId, launchctl) {
|
|
102315
|
+
const [tvOs, bootstrapPath, result] = await Promise.all([
|
|
102316
|
+
isTvOsSimulator(udid),
|
|
102317
|
+
bootstrapPathFor(udid, endpoint),
|
|
102318
|
+
// Read launchctl inside the simulator rather than `simctl getenv`: the latter
|
|
102319
|
+
// silently truncates past 127 bytes, corrupting the colon-separated path list
|
|
102320
|
+
// and accumulating stale entries on every pass.
|
|
102321
|
+
launchctl(["getenv", "DYLD_INSERT_LIBRARIES"]).catch((e) => ({
|
|
102322
|
+
stdout: e.stdout ?? ""
|
|
102323
|
+
}))
|
|
102324
|
+
]);
|
|
102290
102325
|
const existing = (result.stdout ?? "").trim();
|
|
102291
102326
|
if (!tvOs && endpoint.transport === "unix") {
|
|
102292
102327
|
await clearAudioLeftovers(audioDir(nativeId)).catch(() => {
|
|
@@ -102295,67 +102330,30 @@ async function setupNativeDevtoolsEnvLocal(udid, endpoint) {
|
|
|
102295
102330
|
let updated = buildDyldInsertLibraries(existing, bootstrapPath);
|
|
102296
102331
|
const audioDylib = !tvOs && endpoint.transport === "unix" && audioAlwaysInserted() ? installedAudioDylib() : null;
|
|
102297
102332
|
if (audioDylib) updated = appendDyldInsertLibrary(updated, audioDylib);
|
|
102298
|
-
|
|
102299
|
-
|
|
102300
|
-
|
|
102301
|
-
|
|
102302
|
-
|
|
102303
|
-
|
|
102333
|
+
await Promise.all([
|
|
102334
|
+
updated !== existing ? launchctl(["setenv", "DYLD_INSERT_LIBRARIES", updated]) : void 0,
|
|
102335
|
+
audioDylib ? setAudioDirEnv(nativeId, launchctl) : void 0
|
|
102336
|
+
]);
|
|
102337
|
+
}
|
|
102338
|
+
function setEndpointEnv(endpoint, launchctl) {
|
|
102339
|
+
if (endpoint.transport === "unix") {
|
|
102340
|
+
return launchctl(["setenv", "NATIVE_DEVTOOLS_IOS_CDP_SOCKET", endpoint.socketPath]);
|
|
102304
102341
|
}
|
|
102305
|
-
if (endpoint.
|
|
102306
|
-
|
|
102307
|
-
|
|
102308
|
-
}
|
|
102309
|
-
await execFileAsync14(
|
|
102310
|
-
"xcrun",
|
|
102311
|
-
[
|
|
102312
|
-
...prefix,
|
|
102313
|
-
"spawn",
|
|
102314
|
-
nativeId,
|
|
102315
|
-
"launchctl",
|
|
102316
|
-
"setenv",
|
|
102317
|
-
"NATIVE_DEVTOOLS_IOS_CDP_PORT",
|
|
102318
|
-
String(endpoint.port)
|
|
102319
|
-
],
|
|
102320
|
-
{ timeout: SIMCTL_SPAWN_TIMEOUT_MS, killSignal: SIMCTL_KILL_SIGNAL }
|
|
102321
|
-
);
|
|
102322
|
-
} else {
|
|
102323
|
-
await execFileAsync14(
|
|
102324
|
-
"xcrun",
|
|
102325
|
-
[
|
|
102326
|
-
...prefix,
|
|
102327
|
-
"spawn",
|
|
102328
|
-
nativeId,
|
|
102329
|
-
"launchctl",
|
|
102330
|
-
"setenv",
|
|
102331
|
-
"NATIVE_DEVTOOLS_IOS_CDP_SOCKET",
|
|
102332
|
-
endpoint.socketPath
|
|
102333
|
-
],
|
|
102334
|
-
{ timeout: SIMCTL_SPAWN_TIMEOUT_MS, killSignal: SIMCTL_KILL_SIGNAL }
|
|
102342
|
+
if (endpoint.port === void 0) {
|
|
102343
|
+
return Promise.reject(
|
|
102344
|
+
new Error("native-devtools TCP endpoint reached host setup before its port was bound")
|
|
102335
102345
|
);
|
|
102336
102346
|
}
|
|
102337
|
-
|
|
102338
|
-
|
|
102339
|
-
|
|
102340
|
-
|
|
102341
|
-
|
|
102342
|
-
|
|
102343
|
-
|
|
102344
|
-
|
|
102345
|
-
nativeId,
|
|
102346
|
-
"launchctl",
|
|
102347
|
-
"setenv",
|
|
102348
|
-
"ARGENT_AUDIO_DIR",
|
|
102349
|
-
audioDir(nativeId)
|
|
102350
|
-
],
|
|
102351
|
-
{ timeout: SIMCTL_SPAWN_TIMEOUT_MS, killSignal: SIMCTL_KILL_SIGNAL }
|
|
102352
|
-
);
|
|
102353
|
-
} catch (err) {
|
|
102354
|
-
process.stderr.write(`[ios-host] audio setup failed for ${nativeId}: ${String(err)}
|
|
102347
|
+
return launchctl(["setenv", "NATIVE_DEVTOOLS_IOS_CDP_PORT", String(endpoint.port)]);
|
|
102348
|
+
}
|
|
102349
|
+
async function setAudioDirEnv(nativeId, launchctl) {
|
|
102350
|
+
try {
|
|
102351
|
+
fs27.mkdirSync(audioDir(nativeId), { recursive: true, mode: 448 });
|
|
102352
|
+
await launchctl(["setenv", "ARGENT_AUDIO_DIR", audioDir(nativeId)]);
|
|
102353
|
+
} catch (err) {
|
|
102354
|
+
process.stderr.write(`[ios-host] audio setup failed for ${nativeId}: ${String(err)}
|
|
102355
102355
|
`);
|
|
102356
|
-
}
|
|
102357
102356
|
}
|
|
102358
|
-
await ensureAccessibilityEnabled(udid);
|
|
102359
102357
|
}
|
|
102360
102358
|
async function bootstrapPathFor(udid, endpoint) {
|
|
102361
102359
|
if (await isTvOsSimulator(udid)) return bootstrapDylibPathTvos();
|
|
@@ -103029,6 +103027,7 @@ function isInjectableBundleId(bundleId) {
|
|
|
103029
103027
|
var NON_INJECTABLE_NATIVE_WARNING = "Do not fall back to the native-devtools feature tools (native-find-views, native-full-hierarchy, native-network-logs, native-view-at-point): they run the same injection precheck and fail with the same non-injectable error.";
|
|
103030
103028
|
var NON_INJECTABLE_RECOVERY = "Use the standard `describe` tool (its accessibility path reads the screen without injection) or `screenshot` (then interact by coordinate). " + NON_INJECTABLE_NATIVE_WARNING;
|
|
103031
103029
|
var MAX_NATIVE_DEVTOOLS_INIT_ATTEMPTS = 3;
|
|
103030
|
+
var NATIVE_DEVTOOLS_INIT_RETRY_COOLDOWN_MS = 3e4;
|
|
103032
103031
|
var NATIVE_DEVTOOLS_AGE_SLOP_MS = 3e3;
|
|
103033
103032
|
var NATIVE_DEVTOOLS_CONNECT_BUDGET_MS = 15e3;
|
|
103034
103033
|
var LENT_RELEASE_TIMEOUT_MS = 1e3;
|
|
@@ -103048,10 +103047,12 @@ function buildAppStateMessage(bundleId, state3) {
|
|
|
103048
103047
|
return `Native devtools here are an external provider's agent, which serves only the app that provider chose to lend. ${bundleId} is either not that app or its connection has not landed yet. argent did not launch this process and cannot re-point it, so restarting anything is the provider's call rather than argent's. Retry if the app has just started; otherwise read the screen with describe or screenshot and drive it by coordinate.`;
|
|
103049
103048
|
}
|
|
103050
103049
|
}
|
|
103051
|
-
function buildInitFailedResult(udid, failure3) {
|
|
103050
|
+
function buildInitFailedResult(udid, failure3, { afterBoot = false } = {}) {
|
|
103052
103051
|
return {
|
|
103053
103052
|
status: "init_failed",
|
|
103054
|
-
message: `Native devtools failed to initialize for ${udid} after ${failure3.attempts} attempts. Last error: ${failure3.lastError}.
|
|
103053
|
+
message: `Native devtools failed to initialize for ${udid} after ${failure3.attempts} attempts. Last error: ${failure3.lastError}. ` + // boot-device has just booted the simulator and retried, so its own
|
|
103054
|
+
// answer must not send the agent back to boot-device: that would loop.
|
|
103055
|
+
(afterBoot ? `boot-device already retried the setup on the booted simulator, so calling it again does not help on its own. Restart CoreSimulatorService, then call boot-device again.` : `Try shutting down and re-booting the simulator, or restart CoreSimulatorService.`) + (failure3.givenUp ? ` Argent retries the setup in the background at most every ${NATIVE_DEVTOOLS_INIT_RETRY_COOLDOWN_MS / 1e3} s, and a later call picks up a success.` : ""),
|
|
103055
103056
|
attempts: failure3.attempts
|
|
103056
103057
|
};
|
|
103057
103058
|
}
|
|
@@ -103090,12 +103091,26 @@ function nonInjectableError(bundleId) {
|
|
|
103090
103091
|
}
|
|
103091
103092
|
);
|
|
103092
103093
|
}
|
|
103094
|
+
var CONNECT_PENDING_WAIT_MS = 4e3;
|
|
103095
|
+
var CONNECT_PENDING_POLL_MS = 100;
|
|
103096
|
+
async function waitForAppConnection(api, bundleId) {
|
|
103097
|
+
const deadline = Date.now() + CONNECT_PENDING_WAIT_MS;
|
|
103098
|
+
while (!api.isConnected(bundleId)) {
|
|
103099
|
+
if (Date.now() >= deadline) return false;
|
|
103100
|
+
await new Promise((resolve24) => setTimeout(resolve24, CONNECT_PENDING_POLL_MS));
|
|
103101
|
+
}
|
|
103102
|
+
return true;
|
|
103103
|
+
}
|
|
103093
103104
|
async function precheckNativeDevtools(api, udid, bundleId) {
|
|
103094
103105
|
if (bundleId !== void 0 && !isInjectableBundleId(bundleId)) {
|
|
103095
103106
|
throw nonInjectableError(bundleId);
|
|
103096
103107
|
}
|
|
103097
103108
|
const existing = api.getInitFailure();
|
|
103098
|
-
if (existing?.givenUp)
|
|
103109
|
+
if (existing?.givenUp) {
|
|
103110
|
+
void api.ensureEnvReady().catch(() => {
|
|
103111
|
+
});
|
|
103112
|
+
return buildInitFailedResult(udid, existing);
|
|
103113
|
+
}
|
|
103099
103114
|
try {
|
|
103100
103115
|
await api.ensureEnvReady();
|
|
103101
103116
|
} catch (err) {
|
|
@@ -103120,6 +103135,7 @@ async function precheckNativeDevtools(api, udid, bundleId) {
|
|
|
103120
103135
|
if (typeof state3 !== "string") return state3;
|
|
103121
103136
|
if (state3 === "connected") return null;
|
|
103122
103137
|
if (state3 === "provider_attached") return null;
|
|
103138
|
+
if (state3 === "connecting" && await waitForAppConnection(api, bundleId)) return null;
|
|
103123
103139
|
return {
|
|
103124
103140
|
// Neither `unregistered` (a relaunch provably cannot fix it) nor
|
|
103125
103141
|
// `connecting` (a relaunch aborts the handshake and resets the age the
|
|
@@ -103146,6 +103162,9 @@ var LENT_HANDSHAKE_PROMPT_MS = 1e3;
|
|
|
103146
103162
|
var WAITING_FOR_ENABLE = "waiting for the agent to acknowledge Network.enable";
|
|
103147
103163
|
var WAITING_FOR_CAPTURE_STATE = "waiting for the agent to say whether capture is on";
|
|
103148
103164
|
var PROVIDER_CAPTURE_OFF = "the device provider has capture off for the app; argent does not turn it on, because that resets the provider's network settings: turn capture on in the provider";
|
|
103165
|
+
function simulatorNotBooted(message) {
|
|
103166
|
+
return /device is not booted|current state:\s*(shutdown|booting)/i.test(message);
|
|
103167
|
+
}
|
|
103149
103168
|
function closedBeforeRequest(bundleId, method) {
|
|
103150
103169
|
return new FailureError(
|
|
103151
103170
|
`native-devtools ${bundleId}: the connection closed before ${method} was answered`,
|
|
@@ -103258,6 +103277,7 @@ var nativeDevtoolsBlueprint = {
|
|
|
103258
103277
|
let nextRpcId = 1;
|
|
103259
103278
|
let envSetup = false;
|
|
103260
103279
|
let initFailure = null;
|
|
103280
|
+
let initRetryAt = 0;
|
|
103261
103281
|
let inFlight5 = null;
|
|
103262
103282
|
let envRetired = false;
|
|
103263
103283
|
const activatedBundleIds = /* @__PURE__ */ new Set();
|
|
@@ -103278,10 +103298,12 @@ var nativeDevtoolsBlueprint = {
|
|
|
103278
103298
|
const noteInitFailure = (err) => {
|
|
103279
103299
|
if (err instanceof XcodeFirstLaunchPendingError) return;
|
|
103280
103300
|
const lastError = err instanceof Error ? err.message : String(err);
|
|
103281
|
-
const
|
|
103301
|
+
const counted = initFailure && !simulatorNotBooted(initFailure.lastError) ? initFailure.attempts : 0;
|
|
103302
|
+
const attempts = simulatorNotBooted(lastError) ? 1 : counted + 1;
|
|
103282
103303
|
const givenUp = attempts >= MAX_NATIVE_DEVTOOLS_INIT_ATTEMPTS;
|
|
103283
103304
|
initFailure = { attempts, lastError, givenUp };
|
|
103284
|
-
|
|
103305
|
+
if (givenUp) initRetryAt = performance.now() + NATIVE_DEVTOOLS_INIT_RETRY_COOLDOWN_MS;
|
|
103306
|
+
const message = givenUp ? `[native-devtools] giving up on ${udid} after ${attempts} attempts, retrying in ${NATIVE_DEVTOOLS_INIT_RETRY_COOLDOWN_MS / 1e3}s: ${lastError}
|
|
103285
103307
|
` : `[native-devtools] init attempt ${attempts}/${MAX_NATIVE_DEVTOOLS_INIT_ATTEMPTS} failed for ${udid}: ${lastError}
|
|
103286
103308
|
`;
|
|
103287
103309
|
process.stderr.write(message);
|
|
@@ -103300,12 +103322,18 @@ var nativeDevtoolsBlueprint = {
|
|
|
103300
103322
|
});
|
|
103301
103323
|
return inFlight5;
|
|
103302
103324
|
};
|
|
103325
|
+
const retryInBackground = () => {
|
|
103326
|
+
if (!inFlight5 && performance.now() >= initRetryAt) void runEnsureEnv().catch(() => {
|
|
103327
|
+
});
|
|
103328
|
+
return Promise.resolve();
|
|
103329
|
+
};
|
|
103303
103330
|
const ensureEnvReady = () => {
|
|
103304
|
-
if (envSetup
|
|
103331
|
+
if (envSetup) return Promise.resolve();
|
|
103332
|
+
if (initFailure?.givenUp) return retryInBackground();
|
|
103305
103333
|
return runEnsureEnv();
|
|
103306
103334
|
};
|
|
103307
103335
|
const reverifyEnv = () => {
|
|
103308
|
-
if (initFailure?.givenUp) return
|
|
103336
|
+
if (initFailure?.givenUp) return retryInBackground();
|
|
103309
103337
|
return runEnsureEnv();
|
|
103310
103338
|
};
|
|
103311
103339
|
const writeMessage = (socket, type, payload) => {
|
|
@@ -103810,6 +103838,7 @@ var nativeDevtoolsBlueprint = {
|
|
|
103810
103838
|
socketPath: lentSocketPath ?? socketPath,
|
|
103811
103839
|
ensureEnvReady: lentSocketPath ? () => Promise.resolve() : ensureEnvReady,
|
|
103812
103840
|
reverifyEnv: lentSocketPath ? () => Promise.resolve() : reverifyEnv,
|
|
103841
|
+
retryEnvNow: lentSocketPath ? () => Promise.resolve() : runEnsureEnv,
|
|
103813
103842
|
armsEnv: !lentSocketPath,
|
|
103814
103843
|
withdrawEnv: lentSocketPath ? () => Promise.resolve() : async () => {
|
|
103815
103844
|
envRetired = true;
|
|
@@ -104213,10 +104242,16 @@ function execSimctl(args, options = {}) {
|
|
|
104213
104242
|
// ../tool-server/src/utils/simulator-watcher.ts
|
|
104214
104243
|
var POLL_INTERVAL_MS = 1e4;
|
|
104215
104244
|
var MAX_BACKOFF_TICKS = 29;
|
|
104216
|
-
var
|
|
104217
|
-
var
|
|
104218
|
-
|
|
104219
|
-
|
|
104245
|
+
var ARM_WAIT_MS = 15e3;
|
|
104246
|
+
var NATIVE_DEVTOOLS_URN_PREFIX = `${NATIVE_DEVTOOLS_NAMESPACE}:`;
|
|
104247
|
+
var armTarget = () => Promise.resolve();
|
|
104248
|
+
var forgetTarget = () => {
|
|
104249
|
+
};
|
|
104250
|
+
function armSimulator(udid) {
|
|
104251
|
+
return armTarget(udid);
|
|
104252
|
+
}
|
|
104253
|
+
function forgetSimulatorTarget(urn) {
|
|
104254
|
+
forgetTarget(urn);
|
|
104220
104255
|
}
|
|
104221
104256
|
async function getBootedUdidsInSet(deviceSet, signal) {
|
|
104222
104257
|
const stdout = await execSimctl([...simctlPrefix(deviceSet), "list", "devices", "--json"], {
|
|
@@ -104247,27 +104282,66 @@ async function getBootedUdids(signal) {
|
|
|
104247
104282
|
return new Set(perSet.flatMap((r) => r.status === "fulfilled" ? [...r.value] : []));
|
|
104248
104283
|
}
|
|
104249
104284
|
async function initUdid(registry2, udid, trackedServices) {
|
|
104250
|
-
const
|
|
104285
|
+
const started = await runningNativeDevtools(registry2, udid);
|
|
104286
|
+
const service = started ?? await resolveNativeDevtools(registry2, udid);
|
|
104287
|
+
if (!service) return;
|
|
104288
|
+
trackedServices.set(udid, service);
|
|
104289
|
+
await started?.reverifyEnv().catch(() => {
|
|
104290
|
+
});
|
|
104291
|
+
}
|
|
104292
|
+
function simulatorNativeDevtoolsRef(udid) {
|
|
104293
|
+
return nativeDevtoolsRef({ id: udid, platform: "ios", kind: "simulator" });
|
|
104294
|
+
}
|
|
104295
|
+
async function resolveNativeDevtools(registry2, udid) {
|
|
104296
|
+
const ndRef = simulatorNativeDevtoolsRef(udid);
|
|
104297
|
+
try {
|
|
104298
|
+
return await registry2.resolveService(ndRef.urn, ndRef.options);
|
|
104299
|
+
} catch {
|
|
104300
|
+
return null;
|
|
104301
|
+
}
|
|
104302
|
+
}
|
|
104303
|
+
async function armNow(registry2, udid) {
|
|
104304
|
+
if (externalClaimForAnyId(udid)) return;
|
|
104305
|
+
const running = await runningNativeDevtools(registry2, udid);
|
|
104306
|
+
if (running) {
|
|
104307
|
+
await running.ensureEnvReady().catch(() => {
|
|
104308
|
+
});
|
|
104309
|
+
return;
|
|
104310
|
+
}
|
|
104311
|
+
await resolveNativeDevtools(registry2, udid);
|
|
104312
|
+
}
|
|
104313
|
+
async function runningNativeDevtools(registry2, udid) {
|
|
104314
|
+
const urn = simulatorNativeDevtoolsRef(udid).urn;
|
|
104251
104315
|
try {
|
|
104252
|
-
|
|
104253
|
-
trackedServices.set(udid, service);
|
|
104316
|
+
if (registry2.getServiceState(urn) !== "RUNNING" /* RUNNING */) return null;
|
|
104254
104317
|
} catch {
|
|
104318
|
+
return null;
|
|
104319
|
+
}
|
|
104320
|
+
return resolveNativeDevtools(registry2, udid);
|
|
104321
|
+
}
|
|
104322
|
+
async function armWithinCap(registry2, udid) {
|
|
104323
|
+
let timer;
|
|
104324
|
+
const cap2 = new Promise((resolve24) => {
|
|
104325
|
+
timer = setTimeout(resolve24, ARM_WAIT_MS);
|
|
104326
|
+
timer.unref();
|
|
104327
|
+
});
|
|
104328
|
+
try {
|
|
104329
|
+
await Promise.race([armNow(registry2, udid), cap2]);
|
|
104330
|
+
} finally {
|
|
104331
|
+
clearTimeout(timer);
|
|
104255
104332
|
}
|
|
104256
104333
|
}
|
|
104257
104334
|
function startSimulatorWatcher(registry2) {
|
|
104258
104335
|
const configuredUdids = process.env.ARGENT_SIMULATOR_WATCH_UDIDS;
|
|
104259
104336
|
const allowedUdids = configuredUdids === void 0 ? void 0 : new Set(configuredUdids.split(",").map((id) => id.trim().toUpperCase()));
|
|
104337
|
+
const isWatched = (udid) => !allowedUdids || allowedUdids.has(udid.toUpperCase());
|
|
104260
104338
|
const trackedServices = /* @__PURE__ */ new Map();
|
|
104339
|
+
const targetedUdids = /* @__PURE__ */ new Map();
|
|
104340
|
+
const watcherDisposals = /* @__PURE__ */ new Set();
|
|
104261
104341
|
const reportedSkips = /* @__PURE__ */ new Set();
|
|
104262
104342
|
const stopController = new AbortController();
|
|
104263
104343
|
let consecutiveTimeouts = 0;
|
|
104264
104344
|
let ticksToSkip = 0;
|
|
104265
|
-
let markArmed;
|
|
104266
|
-
const armed = new Promise((resolve24) => markArmed = resolve24);
|
|
104267
|
-
firstPollSettled = Promise.race([
|
|
104268
|
-
armed,
|
|
104269
|
-
new Promise((resolve24) => setTimeout(resolve24, FIRST_POLL_WAIT_MS).unref())
|
|
104270
|
-
]);
|
|
104271
104345
|
let firstLaunchReported = false;
|
|
104272
104346
|
function simctlWouldStartInstall() {
|
|
104273
104347
|
if (!xcodeFirstLaunchPending("simctl")) {
|
|
@@ -104276,7 +104350,6 @@ function startSimulatorWatcher(registry2) {
|
|
|
104276
104350
|
}
|
|
104277
104351
|
consecutiveTimeouts = 0;
|
|
104278
104352
|
ticksToSkip = 0;
|
|
104279
|
-
markArmed();
|
|
104280
104353
|
if (!firstLaunchReported) {
|
|
104281
104354
|
firstLaunchReported = true;
|
|
104282
104355
|
process.stderr.write(
|
|
@@ -104290,7 +104363,7 @@ function startSimulatorWatcher(registry2) {
|
|
|
104290
104363
|
const ours = /* @__PURE__ */ new Set();
|
|
104291
104364
|
const claimed = /* @__PURE__ */ new Set();
|
|
104292
104365
|
for (const udid of booted) {
|
|
104293
|
-
if (
|
|
104366
|
+
if (!isWatched(udid)) continue;
|
|
104294
104367
|
const claim2 = externalClaimForNativeId(udid);
|
|
104295
104368
|
if (!claim2) {
|
|
104296
104369
|
reportedSkips.delete(udid);
|
|
@@ -104318,7 +104391,7 @@ function startSimulatorWatcher(registry2) {
|
|
|
104318
104391
|
}
|
|
104319
104392
|
async function handBackClaimed(claimed) {
|
|
104320
104393
|
for (const udid of claimed) {
|
|
104321
|
-
const service = trackedServices.get(udid);
|
|
104394
|
+
const service = trackedServices.get(udid) ?? await runningNativeDevtools(registry2, udid);
|
|
104322
104395
|
if (!service?.armsEnv) continue;
|
|
104323
104396
|
trackedServices.delete(udid);
|
|
104324
104397
|
await service.withdrawEnv().catch((err) => {
|
|
@@ -104327,8 +104400,30 @@ function startSimulatorWatcher(registry2) {
|
|
|
104327
104400
|
`
|
|
104328
104401
|
);
|
|
104329
104402
|
});
|
|
104330
|
-
await
|
|
104331
|
-
|
|
104403
|
+
await disposeAsWatcher(udid);
|
|
104404
|
+
}
|
|
104405
|
+
}
|
|
104406
|
+
async function disposeAsWatcher(udid) {
|
|
104407
|
+
watcherDisposals.add(udid);
|
|
104408
|
+
try {
|
|
104409
|
+
await registry2.disposeService(simulatorNativeDevtoolsRef(udid).urn);
|
|
104410
|
+
} catch {
|
|
104411
|
+
} finally {
|
|
104412
|
+
watcherDisposals.delete(udid);
|
|
104413
|
+
}
|
|
104414
|
+
}
|
|
104415
|
+
function onlyTargeted(booted) {
|
|
104416
|
+
return new Set([...booted].flatMap((udid) => targetedUdids.get(udid.toUpperCase()) ?? []));
|
|
104417
|
+
}
|
|
104418
|
+
function noteTargeted(urn, _from, to) {
|
|
104419
|
+
if (!urn.startsWith(NATIVE_DEVTOOLS_URN_PREFIX)) return;
|
|
104420
|
+
const udid = urn.slice(NATIVE_DEVTOOLS_URN_PREFIX.length);
|
|
104421
|
+
const key2 = udid.toUpperCase();
|
|
104422
|
+
if (to === "RUNNING" /* RUNNING */) {
|
|
104423
|
+
if (!targetedUdids.has(key2)) targetedUdids.set(key2, udid);
|
|
104424
|
+
} else if (to === "IDLE" /* IDLE */ && !watcherDisposals.has(udid)) {
|
|
104425
|
+
if (targetedUdids.get(key2) === udid) targetedUdids.delete(key2);
|
|
104426
|
+
trackedServices.delete(udid);
|
|
104332
104427
|
}
|
|
104333
104428
|
}
|
|
104334
104429
|
async function poll(shouldBlockUntilSettled) {
|
|
@@ -104336,7 +104431,7 @@ function startSimulatorWatcher(registry2) {
|
|
|
104336
104431
|
let claimed;
|
|
104337
104432
|
try {
|
|
104338
104433
|
({ ours: booted, claimed } = withoutForeignSimulators(
|
|
104339
|
-
await getBootedUdids(stopController.signal)
|
|
104434
|
+
onlyTargeted(await getBootedUdids(stopController.signal))
|
|
104340
104435
|
));
|
|
104341
104436
|
} catch (err) {
|
|
104342
104437
|
if (err instanceof SimctlTimeoutError) {
|
|
@@ -104353,26 +104448,45 @@ function startSimulatorWatcher(registry2) {
|
|
|
104353
104448
|
}
|
|
104354
104449
|
consecutiveTimeouts = 0;
|
|
104355
104450
|
await handBackClaimed(claimed);
|
|
104356
|
-
const newUdids = [...booted].filter(
|
|
104451
|
+
const newUdids = [...booted].filter(
|
|
104452
|
+
(udid) => targetedUdids.has(udid.toUpperCase()) && !trackedServices.has(udid)
|
|
104453
|
+
);
|
|
104357
104454
|
const pendingAttempts = newUdids.map(
|
|
104358
104455
|
(udid) => initUdid(registry2, udid, trackedServices)
|
|
104359
104456
|
);
|
|
104360
104457
|
for (const [udid, service] of trackedServices) {
|
|
104361
104458
|
if (!booted.has(udid)) continue;
|
|
104362
|
-
if (!service.isEnvSetup()
|
|
104459
|
+
if (!service.isEnvSetup()) {
|
|
104363
104460
|
pendingAttempts.push(service.ensureEnvReady().catch(() => {
|
|
104364
104461
|
}));
|
|
104365
104462
|
}
|
|
104366
104463
|
}
|
|
104367
|
-
|
|
104368
|
-
if (shouldBlockUntilSettled) await attempted;
|
|
104464
|
+
if (shouldBlockUntilSettled) await Promise.all(pendingAttempts);
|
|
104369
104465
|
for (const udid of [...trackedServices.keys()]) {
|
|
104370
104466
|
if (booted.has(udid)) continue;
|
|
104371
104467
|
trackedServices.delete(udid);
|
|
104372
|
-
|
|
104373
|
-
});
|
|
104468
|
+
void disposeAsWatcher(udid);
|
|
104374
104469
|
}
|
|
104375
104470
|
}
|
|
104471
|
+
registry2.events.on("serviceStateChange", noteTargeted);
|
|
104472
|
+
const armsInFlight = /* @__PURE__ */ new Map();
|
|
104473
|
+
const armThisWatcher = (udid) => {
|
|
104474
|
+
if (!isWatched(udid)) return Promise.resolve();
|
|
104475
|
+
const key2 = udid.toUpperCase();
|
|
104476
|
+
const existing = armsInFlight.get(key2);
|
|
104477
|
+
if (existing) return existing;
|
|
104478
|
+
const spelling = targetedUdids.get(key2) ?? udid;
|
|
104479
|
+
const arming = armWithinCap(registry2, spelling).finally(() => armsInFlight.delete(key2));
|
|
104480
|
+
armsInFlight.set(key2, arming);
|
|
104481
|
+
return arming;
|
|
104482
|
+
};
|
|
104483
|
+
armTarget = armThisWatcher;
|
|
104484
|
+
const forgetThisWatcher = (urn) => {
|
|
104485
|
+
for (const [key2, udid] of targetedUdids) {
|
|
104486
|
+
if (simulatorNativeDevtoolsRef(udid).urn === urn) targetedUdids.delete(key2);
|
|
104487
|
+
}
|
|
104488
|
+
};
|
|
104489
|
+
forgetTarget = forgetThisWatcher;
|
|
104376
104490
|
const ready2 = simctlWouldStartInstall() ? Promise.resolve() : poll(true);
|
|
104377
104491
|
let inFlight5 = ready2.catch(() => {
|
|
104378
104492
|
}).finally(() => inFlight5 = null);
|
|
@@ -104388,6 +104502,10 @@ function startSimulatorWatcher(registry2) {
|
|
|
104388
104502
|
}, POLL_INTERVAL_MS);
|
|
104389
104503
|
return {
|
|
104390
104504
|
stop: () => {
|
|
104505
|
+
registry2.events.off("serviceStateChange", noteTargeted);
|
|
104506
|
+
if (armTarget === armThisWatcher) armTarget = () => Promise.resolve();
|
|
104507
|
+
if (forgetTarget === forgetThisWatcher) forgetTarget = () => {
|
|
104508
|
+
};
|
|
104391
104509
|
clearInterval(interval2);
|
|
104392
104510
|
stopController.abort();
|
|
104393
104511
|
},
|
|
@@ -104499,8 +104617,12 @@ var STDERR_DRAIN_MS = 250;
|
|
|
104499
104617
|
var STDERR_TAIL_LINES = 10;
|
|
104500
104618
|
var STDERR_MAX_LINE_CHARS = 500;
|
|
104501
104619
|
var ROUTINE_LOG_LINE = /^\[\S+\s+(?:INFO|DEBUG|TRACE)\s/;
|
|
104620
|
+
function describeExit(code, signal) {
|
|
104621
|
+
if (typeof code === "number") return `exited with code ${code}`;
|
|
104622
|
+
return signal ? `was killed by ${signal}` : "exited";
|
|
104623
|
+
}
|
|
104502
104624
|
function exitedBeforeReadyMessage(code, signal, stderrTail) {
|
|
104503
|
-
const how =
|
|
104625
|
+
const how = describeExit(code, signal);
|
|
104504
104626
|
const reason2 = stderrTail.join("\n");
|
|
104505
104627
|
return `simulator-server ${how} before becoming ready${reason2 ? `:
|
|
104506
104628
|
${reason2}` : ""}`;
|
|
@@ -104857,6 +104979,7 @@ var simulatorServerBlueprint = {
|
|
|
104857
104979
|
if (device.platform === "ios-remote") {
|
|
104858
104980
|
return withHeldTouchTeardown(device.id, await buildRemoteInstance(device));
|
|
104859
104981
|
}
|
|
104982
|
+
let arming = Promise.resolve();
|
|
104860
104983
|
if (device.platform === "ios") {
|
|
104861
104984
|
if (await isTvOsSimulator(device.id)) {
|
|
104862
104985
|
throw new UnsupportedOperationError(
|
|
@@ -104865,7 +104988,8 @@ var simulatorServerBlueprint = {
|
|
|
104865
104988
|
"this is an Apple TV (tvOS) simulator \u2014 touch, paste and rotate input are not available. Use `describe` to read focus, `tv-remote` for remote presses, and `keyboard` to type (see the argent-tv-interact skill)"
|
|
104866
104989
|
);
|
|
104867
104990
|
}
|
|
104868
|
-
|
|
104991
|
+
arming = armSimulator(device.id);
|
|
104992
|
+
await clearAutomationEnabledOrWarn(device.id);
|
|
104869
104993
|
} else if (device.platform === "android") {
|
|
104870
104994
|
await ensureDep("adb");
|
|
104871
104995
|
} else {
|
|
@@ -104875,10 +104999,14 @@ var simulatorServerBlueprint = {
|
|
|
104875
104999
|
}
|
|
104876
105000
|
const { proc, apiUrl, streamUrl, agentSocket } = await spawnWithEmulatorFallback(device);
|
|
104877
105001
|
const events = new TypedEventEmitter();
|
|
104878
|
-
|
|
104879
|
-
|
|
104880
|
-
|
|
104881
|
-
|
|
105002
|
+
let exited;
|
|
105003
|
+
const terminate = (error63) => {
|
|
105004
|
+
exited = error63;
|
|
105005
|
+
events.emit("terminated", error63);
|
|
105006
|
+
};
|
|
105007
|
+
proc.on("exit", (code, signal) => {
|
|
105008
|
+
terminate(
|
|
105009
|
+
new FailureError(`simulator-server ${describeExit(code, signal)}`, {
|
|
104882
105010
|
error_code: FAILURE_CODES.SIMULATOR_SERVER_TERMINATED,
|
|
104883
105011
|
failure_stage: "simulator_server_process_exit",
|
|
104884
105012
|
failure_area: "tool_server",
|
|
@@ -104886,9 +105014,9 @@ var simulatorServerBlueprint = {
|
|
|
104886
105014
|
})
|
|
104887
105015
|
);
|
|
104888
105016
|
});
|
|
104889
|
-
proc.on("error",
|
|
104890
|
-
|
|
104891
|
-
|
|
105017
|
+
proc.on("error", terminate);
|
|
105018
|
+
await arming;
|
|
105019
|
+
if (exited) throw exited;
|
|
104892
105020
|
const api = {
|
|
104893
105021
|
apiUrl,
|
|
104894
105022
|
streamUrl,
|
|
@@ -116897,7 +117025,7 @@ var tvControlBlueprint = {
|
|
|
116897
117025
|
const axSock = axSocketPath(udid);
|
|
116898
117026
|
const hidSock = hidSocketPath(udid);
|
|
116899
117027
|
let disposed = false;
|
|
116900
|
-
await Promise.all([ensureAutomationEnabled(udid),
|
|
117028
|
+
await Promise.all([ensureAutomationEnabled(udid), armSimulator(udid)]);
|
|
116901
117029
|
await Promise.all([reapDaemons(axSock), reapDaemons(hidSock)]);
|
|
116902
117030
|
const axTarget = () => simctlTargetForUdidSync(udid, { granted: "ax-service" });
|
|
116903
117031
|
let axProc = spawnAxDaemon(udid, axSock, axTarget());
|
|
@@ -129293,7 +129421,7 @@ var DEVICE_PORT_SPAN = 1e4;
|
|
|
129293
129421
|
var DEVICE_PORT_ATTEMPTS = 8;
|
|
129294
129422
|
var NEW_PROCESS_WAIT_MS = 3e3;
|
|
129295
129423
|
var PROCESS_POLL_INTERVAL_MS = 250;
|
|
129296
|
-
var
|
|
129424
|
+
var ARM_WAIT_MS2 = 5e3;
|
|
129297
129425
|
var ARM_PROCESS_CHECK_MS = 500;
|
|
129298
129426
|
var RECHECK_DELAYS_MS = [500, 1e3, 2e3, 4e3, 8e3];
|
|
129299
129427
|
var ENABLE_TIMEOUT_MS = 6e4;
|
|
@@ -130559,7 +130687,7 @@ function createInspector(serial, packageName, initialMetroPort) {
|
|
|
130559
130687
|
};
|
|
130560
130688
|
}
|
|
130561
130689
|
const key2 = processKey(attached.current);
|
|
130562
|
-
await waitForArmed(key2,
|
|
130690
|
+
await waitForArmed(key2, ARM_WAIT_MS2);
|
|
130563
130691
|
if (disposed) return { armed: false, reason: "capture was disposed" };
|
|
130564
130692
|
if (stopped) return { armed: false, reason: STOPPED_NOTE };
|
|
130565
130693
|
const conn = connections3.find((c) => c.armed && !c.closed && c.processKey === key2);
|
|
@@ -130650,7 +130778,7 @@ function createInspector(serial, packageName, initialMetroPort) {
|
|
|
130650
130778
|
if (err instanceof InspectorStopped) return stoppedLaunchNote(packageName);
|
|
130651
130779
|
return `native network capture could not follow this launch of ${packageName}: ${firstLine3(isOwnFailure(err) ? errorMessage3(err) : adbFailureDetail(err))}`;
|
|
130652
130780
|
}
|
|
130653
|
-
if (outcome.kind === "attached") await waitForArmed(processKey(outcome.proc),
|
|
130781
|
+
if (outcome.kind === "attached") await waitForArmed(processKey(outcome.proc), ARM_WAIT_MS2);
|
|
130654
130782
|
const reason2 = "proc" in outcome && !armedFor(processKey(outcome.proc)) ? await refreshAgentReason(outcome.proc) : void 0;
|
|
130655
130783
|
if (disposed) return void 0;
|
|
130656
130784
|
if (stopped) return stoppedLaunchNote(packageName);
|
|
@@ -137128,11 +137256,11 @@ async function bootIos(udid, registry2, force, headless, prepareOnly) {
|
|
|
137128
137256
|
else await clearAutomationEnabledOrWarn(udid);
|
|
137129
137257
|
const ndRef = nativeDevtoolsRef({ id: udid, platform: "ios", kind: "simulator" });
|
|
137130
137258
|
const ndApi = await registry2.resolveService(ndRef.urn, ndRef.options);
|
|
137131
|
-
await ndApi.
|
|
137259
|
+
await ndApi.retryEnvNow().catch(() => {
|
|
137132
137260
|
});
|
|
137133
137261
|
const initFailure = ndApi.getInitFailure();
|
|
137134
137262
|
if (initFailure?.givenUp) {
|
|
137135
|
-
return buildInitFailedResult(udid, initFailure);
|
|
137263
|
+
return buildInitFailedResult(udid, initFailure, { afterBoot: true });
|
|
137136
137264
|
}
|
|
137137
137265
|
if (!deviceSet) {
|
|
137138
137266
|
await execFileAsync27("defaults", [
|
|
@@ -137197,9 +137325,11 @@ async function bootIosRemote(id, registry2, force) {
|
|
|
137197
137325
|
await simctlBootstatus(id, { boot: true });
|
|
137198
137326
|
const ndRef = nativeDevtoolsRef({ id, platform: "ios-remote", kind: "simulator" });
|
|
137199
137327
|
const ndApi = await registry2.resolveService(ndRef.urn, ndRef.options);
|
|
137328
|
+
if (ndApi.getInitFailure()?.givenUp) await ndApi.retryEnvNow().catch(() => {
|
|
137329
|
+
});
|
|
137200
137330
|
const initFailure = ndApi.getInitFailure();
|
|
137201
137331
|
if (initFailure?.givenUp) {
|
|
137202
|
-
return buildInitFailedResult(id, initFailure);
|
|
137332
|
+
return buildInitFailedResult(id, initFailure, { afterBoot: true });
|
|
137203
137333
|
}
|
|
137204
137334
|
return { platform: "ios-remote", udid: id, booted: true };
|
|
137205
137335
|
}
|
|
@@ -138586,6 +138716,7 @@ function dispatchByPlatform(opts) {
|
|
|
138586
138716
|
if (opts.ios.requires?.length) {
|
|
138587
138717
|
await ensureDeps(opts.ios.requires);
|
|
138588
138718
|
}
|
|
138719
|
+
void armSimulator(device.id);
|
|
138589
138720
|
return opts.ios.handler(services, params, device, invokeOptions);
|
|
138590
138721
|
}
|
|
138591
138722
|
if (device.platform === "ios-remote") {
|
|
@@ -138636,6 +138767,14 @@ init_external_devices();
|
|
|
138636
138767
|
// ../tool-server/src/utils/ios-front-app.ts
|
|
138637
138768
|
var IN_FRONT_TIMEOUT_MS = 5e3;
|
|
138638
138769
|
var IN_FRONT_POLL_MS = 100;
|
|
138770
|
+
function startIosFrontAppReader(registry2, device) {
|
|
138771
|
+
void isTvOsSimulator(device.id).then((tv) => {
|
|
138772
|
+
if (tv) return;
|
|
138773
|
+
const ref = axServiceRef(device);
|
|
138774
|
+
return registry2.resolveService(ref.urn, ref.options);
|
|
138775
|
+
}).catch(() => {
|
|
138776
|
+
});
|
|
138777
|
+
}
|
|
138639
138778
|
async function awaitIosAppInFront(registry2, device, bundleId, signal) {
|
|
138640
138779
|
const deadline = Date.now() + IN_FRONT_TIMEOUT_MS;
|
|
138641
138780
|
const remaining = () => deadline - Date.now();
|
|
@@ -138668,6 +138807,7 @@ function makeIosImpl(registry2) {
|
|
|
138668
138807
|
return {
|
|
138669
138808
|
requires: ["xcrun"],
|
|
138670
138809
|
handler: async (_services, params, device, options) => {
|
|
138810
|
+
startIosFrontAppReader(registry2, device);
|
|
138671
138811
|
let nativeDevtools;
|
|
138672
138812
|
let accessibility;
|
|
138673
138813
|
if (!externalClaimForAnyId(device.id)) {
|
|
@@ -139220,6 +139360,7 @@ function makeIosImpl2(registry2) {
|
|
|
139220
139360
|
return {
|
|
139221
139361
|
requires: ["xcrun"],
|
|
139222
139362
|
handler: async (_services, params, device, options) => {
|
|
139363
|
+
startIosFrontAppReader(registry2, device);
|
|
139223
139364
|
const { udid, bundleId } = params;
|
|
139224
139365
|
let nativeDevtools;
|
|
139225
139366
|
let accessibility;
|
|
@@ -140403,7 +140544,7 @@ var execFileAsync34 = (0, import_node_util35.promisify)(import_node_child_proces
|
|
|
140403
140544
|
var iosImpl3 = {
|
|
140404
140545
|
requires: ["xcrun"],
|
|
140405
140546
|
handler: async (_services, params) => {
|
|
140406
|
-
await
|
|
140547
|
+
await armSimulator(params.udid);
|
|
140407
140548
|
try {
|
|
140408
140549
|
await execFileAsync34(
|
|
140409
140550
|
"xcrun",
|
|
@@ -140629,8 +140770,8 @@ var zodSchema17 = external_exports.object({
|
|
|
140629
140770
|
});
|
|
140630
140771
|
var openUrlTool = {
|
|
140631
140772
|
id: "open-url",
|
|
140632
|
-
// On iOS it first waits up to 15s for
|
|
140633
|
-
//
|
|
140773
|
+
// On iOS it first waits up to 15s for its simulator to be armed, so a slow
|
|
140774
|
+
// openurl can pass the MCP fetch timeout, whose replay would open the URL twice.
|
|
140634
140775
|
longRunning: true,
|
|
140635
140776
|
description: `Open a URL or deep-link scheme on the device.
|
|
140636
140777
|
Use when navigating to a web page or deep-linking into an app (prefer custom schemes or \`launch-app\` over \`https://\` Universal/App Links). On Chromium, navigates the primary page (non-page schemes like \`tel:\`/\`mailto:\` fail). On physical iOS, the receiving app becomes active for automation.<flag:harmonyos> HarmonyOS opens URIs via \`aa start -U\`.</flag:harmonyos>
|
|
@@ -158448,7 +158589,7 @@ async function startNativeProfilerIos(api, params) {
|
|
|
158448
158589
|
throw mallocNonDeviceStrategyError(captureDecision.reason);
|
|
158449
158590
|
}
|
|
158450
158591
|
const info = resolveAppForLaunch(params.device_id, params.app_process);
|
|
158451
|
-
await
|
|
158592
|
+
await armSimulator(params.device_id);
|
|
158452
158593
|
appProcess = info.CFBundleExecutable;
|
|
158453
158594
|
launchBundlePath = getAppBundlePath(params.device_id, info.CFBundleIdentifier);
|
|
158454
158595
|
try {
|
|
@@ -166900,6 +167041,7 @@ Returns \`{ stopped, unmatched?, left_running?, aborted? }\` (\`left_running\` n
|
|
|
166900
167041
|
const matchedId = scoped ? deviceIdOwningUrn(urn, DEVICE_OWNED_NAMESPACES, devices2) : void 0;
|
|
166901
167042
|
const matches2 = scoped ? matchedId !== void 0 : isDeviceServiceUrn(urn, DEVICE_OWNED_NAMESPACES);
|
|
166902
167043
|
if (matchedId !== void 0) matchedIds.add(matchedId.toLowerCase());
|
|
167044
|
+
if (matches2) forgetSimulatorTarget(urn);
|
|
166903
167045
|
if (matches2 && entry.state !== "IDLE" /* IDLE */) {
|
|
166904
167046
|
const wasLive = isLiveServiceState(entry.state);
|
|
166905
167047
|
await registry2.disposeService(urn);
|
|
@@ -167683,7 +167825,7 @@ function classifyOutcome(input2) {
|
|
|
167683
167825
|
if (!input2.startedSeen) {
|
|
167684
167826
|
return failed2(
|
|
167685
167827
|
"protocol",
|
|
167686
|
-
`The script runner exited before it started the script (${
|
|
167828
|
+
`The script runner exited before it started the script (${describeExit2(exit)}).`
|
|
167687
167829
|
);
|
|
167688
167830
|
}
|
|
167689
167831
|
if (exit.signal) {
|
|
@@ -167864,7 +168006,7 @@ function isHeapAbort(exit, heapFatalSeen) {
|
|
|
167864
168006
|
return process.platform === "win32" && exit.code !== null && WINDOWS_ABORT_CODES.has(exit.code);
|
|
167865
168007
|
}
|
|
167866
168008
|
var WINDOWS_ABORT_CODES = /* @__PURE__ */ new Set([3, 3221226505]);
|
|
167867
|
-
function
|
|
168009
|
+
function describeExit2(exit) {
|
|
167868
168010
|
if (exit.signal) return `signal ${exit.signal}`;
|
|
167869
168011
|
return `exit code ${exit.code ?? 0}`;
|
|
167870
168012
|
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@swmansion/argent",
|
|
3
|
-
"version": "0.35.1-next.
|
|
3
|
+
"version": "0.35.1-next.78",
|
|
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",
|
|
@@ -98,5 +98,5 @@
|
|
|
98
98
|
"vitest": "^5.0.5",
|
|
99
99
|
"yaml": "^2.9.1"
|
|
100
100
|
},
|
|
101
|
-
"gitHead": "
|
|
101
|
+
"gitHead": "709a5954ebd6f40571229964089eed5c847da20f"
|
|
102
102
|
}
|