@swmansion/argent 0.35.1-next.3 → 0.35.1-next.4
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 +2 -0
- package/dist/tool-server.cjs +319 -307
- package/package.json +2 -2
package/dist/cli-cmds.mjs
CHANGED
|
@@ -38575,7 +38575,7 @@ function isCi(env = process.env) {
|
|
|
38575
38575
|
var SESSION_ID2 = randomUUID5();
|
|
38576
38576
|
function readCliVersion() {
|
|
38577
38577
|
if (true) {
|
|
38578
|
-
return "0.35.1-next.
|
|
38578
|
+
return "0.35.1-next.4";
|
|
38579
38579
|
}
|
|
38580
38580
|
return "0.0.0";
|
|
38581
38581
|
}
|
package/dist/installer.mjs
CHANGED
|
@@ -16998,7 +16998,7 @@ function isCi(env = process.env) {
|
|
|
16998
16998
|
var SESSION_ID = randomUUID4();
|
|
16999
16999
|
function readCliVersion() {
|
|
17000
17000
|
if (true) {
|
|
17001
|
-
return "0.35.1-next.
|
|
17001
|
+
return "0.35.1-next.4";
|
|
17002
17002
|
}
|
|
17003
17003
|
return "0.0.0";
|
|
17004
17004
|
}
|
|
@@ -95,6 +95,8 @@ export interface ArgentToolArgs {
|
|
|
95
95
|
readOnly?: boolean;
|
|
96
96
|
/** Android only: the emulator's console port, an even number from 5554 to 5584 (`emulator -port`), the range adb finds emulators in; its serial is `emulator-<port>`. Without it the emulator takes the first free port from 5554 up, as Android Studio does. The gRPC server Argent needs for screenshots and gestures goes on the port plus 3000, which must be free too. Given a port, the tool reuses only the emulator on that port and fails if another emulator holds it, or if this AVD runs there writable on a read-only boot and `force` is not set. A read-only emulator started with `-port` belongs to the calls that give that port: a call without `port` never reuses or shuts it down. Where the process list cannot be read (Windows, or a failed `ps`), Argent knows only the pinned emulators it booted itself, so a writable call without `port` can reuse, or with `force` shut down, one that someone else pinned. A writable one is still reused, or with `force` shut down, by a writable call without `port`, since the AVD runs one writable emulator at a time. `force` shuts nothing down when another emulator of the AVD would still block the boot. Ignored on other platforms. */
|
|
97
97
|
port?: number;
|
|
98
|
+
/** Local iOS simulator only: apply accessibility preferences and leave the simulator shut down for a pool manager to boot. Requires Shutdown state. Cannot be combined with force: true. */
|
|
99
|
+
prepareOnly?: boolean;
|
|
98
100
|
/** iOS only: boot the simulator core WITHOUT opening its GUI window (Simulator.app, or Device Hub on Xcode 27+). The device still streams via simulator-server. The `ARGENT_SIMULATOR_NO_WINDOW` env var (1/true/yes) forces this host-wide. */
|
|
99
101
|
headless?: boolean;
|
|
100
102
|
/** Electron: path to the Electron app to launch. Either a packaged .app bundle / executable, or a project directory whose package.json points the Electron binary at the entry script. */
|
package/dist/tool-server.cjs
CHANGED
|
@@ -72948,7 +72948,7 @@ function isCi(env = process.env) {
|
|
|
72948
72948
|
var SESSION_ID = (0, import_node_crypto3.randomUUID)();
|
|
72949
72949
|
function readCliVersion() {
|
|
72950
72950
|
if (true) {
|
|
72951
|
-
return "0.35.1-next.
|
|
72951
|
+
return "0.35.1-next.4";
|
|
72952
72952
|
}
|
|
72953
72953
|
return "0.0.0";
|
|
72954
72954
|
}
|
|
@@ -75448,7 +75448,267 @@ function nativeArgs(udid, args) {
|
|
|
75448
75448
|
return args.map((argument) => argument === udid ? nativeId : argument);
|
|
75449
75449
|
}
|
|
75450
75450
|
|
|
75451
|
+
// ../tool-server/src/utils/ios-device/usbmux-protocol.ts
|
|
75452
|
+
var USBMUX_HEADER_BYTES = 16;
|
|
75453
|
+
var USBMUX_PROTOCOL_VERSION = 1;
|
|
75454
|
+
var USBMUX_MESSAGE_TYPE_PLIST = 8;
|
|
75455
|
+
var USBMUX_MAX_PACKET_BYTES = 4 * 1024 * 1024;
|
|
75456
|
+
function appendHintToMessage(message, hint) {
|
|
75457
|
+
if (!hint || message.includes(hint)) {
|
|
75458
|
+
return message;
|
|
75459
|
+
}
|
|
75460
|
+
return `${message}${/[.!?]$/.test(message) ? "" : "."} Hint: ${hint}`;
|
|
75461
|
+
}
|
|
75462
|
+
var IosDeviceTransportError = class extends Error {
|
|
75463
|
+
kind;
|
|
75464
|
+
retryable;
|
|
75465
|
+
hint;
|
|
75466
|
+
constructor(kind, message, options = { retryable: false }) {
|
|
75467
|
+
super(
|
|
75468
|
+
appendHintToMessage(message, options.hint),
|
|
75469
|
+
options.cause !== void 0 ? { cause: options.cause } : void 0
|
|
75470
|
+
);
|
|
75471
|
+
this.name = "IosDeviceTransportError";
|
|
75472
|
+
this.kind = kind;
|
|
75473
|
+
this.retryable = options.retryable;
|
|
75474
|
+
if (options.hint !== void 0) {
|
|
75475
|
+
this.hint = options.hint;
|
|
75476
|
+
}
|
|
75477
|
+
}
|
|
75478
|
+
};
|
|
75479
|
+
function isIosDeviceTransportError(error63) {
|
|
75480
|
+
return error63 instanceof IosDeviceTransportError;
|
|
75481
|
+
}
|
|
75482
|
+
function encodeUsbmuxPacket(tag3, payloadXml) {
|
|
75483
|
+
const payload = Buffer.from(payloadXml, "utf8");
|
|
75484
|
+
const packet = Buffer.alloc(USBMUX_HEADER_BYTES + payload.length);
|
|
75485
|
+
packet.writeUInt32LE(packet.length, 0);
|
|
75486
|
+
packet.writeUInt32LE(USBMUX_PROTOCOL_VERSION, 4);
|
|
75487
|
+
packet.writeUInt32LE(USBMUX_MESSAGE_TYPE_PLIST, 8);
|
|
75488
|
+
packet.writeUInt32LE(tag3, 12);
|
|
75489
|
+
payload.copy(packet, USBMUX_HEADER_BYTES);
|
|
75490
|
+
return packet;
|
|
75491
|
+
}
|
|
75492
|
+
function decodeUsbmuxPacket(buffer) {
|
|
75493
|
+
if (buffer.length < USBMUX_HEADER_BYTES) {
|
|
75494
|
+
return null;
|
|
75495
|
+
}
|
|
75496
|
+
const totalLength = buffer.readUInt32LE(0);
|
|
75497
|
+
if (totalLength < USBMUX_HEADER_BYTES || totalLength > USBMUX_MAX_PACKET_BYTES) {
|
|
75498
|
+
throw new IosDeviceTransportError(
|
|
75499
|
+
"protocol",
|
|
75500
|
+
`Invalid usbmuxd packet length ${totalLength} (must be between ${USBMUX_HEADER_BYTES} and ${USBMUX_MAX_PACKET_BYTES} bytes)`,
|
|
75501
|
+
{ retryable: false }
|
|
75502
|
+
);
|
|
75503
|
+
}
|
|
75504
|
+
if (buffer.length < totalLength) {
|
|
75505
|
+
return null;
|
|
75506
|
+
}
|
|
75507
|
+
return {
|
|
75508
|
+
version: buffer.readUInt32LE(4),
|
|
75509
|
+
messageType: buffer.readUInt32LE(8),
|
|
75510
|
+
tag: buffer.readUInt32LE(12),
|
|
75511
|
+
payload: buffer.subarray(USBMUX_HEADER_BYTES, totalLength),
|
|
75512
|
+
bytesConsumed: totalLength
|
|
75513
|
+
};
|
|
75514
|
+
}
|
|
75515
|
+
function hostToNetworkPort(port) {
|
|
75516
|
+
if (!Number.isInteger(port) || port < 0 || port > 65535) {
|
|
75517
|
+
throw new IosDeviceTransportError("protocol", `Invalid TCP port ${port}`, {
|
|
75518
|
+
retryable: false
|
|
75519
|
+
});
|
|
75520
|
+
}
|
|
75521
|
+
return (port & 255) << 8 | port >>> 8 & 255;
|
|
75522
|
+
}
|
|
75523
|
+
function escapeXmlText(value) {
|
|
75524
|
+
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
75525
|
+
}
|
|
75526
|
+
function buildUsbmuxPlistMessage(messageType, fields = {}) {
|
|
75527
|
+
const entries = [
|
|
75528
|
+
["BundleID", "com.argent.tool-server"],
|
|
75529
|
+
["ClientVersionString", "argent"],
|
|
75530
|
+
["MessageType", messageType],
|
|
75531
|
+
["ProgName", "argent"],
|
|
75532
|
+
["kLibUSBMuxVersion", 3],
|
|
75533
|
+
...Object.entries(fields)
|
|
75534
|
+
];
|
|
75535
|
+
const body = entries.map(
|
|
75536
|
+
([key2, value]) => typeof value === "number" ? `<key>${escapeXmlText(key2)}</key><integer>${value}</integer>` : `<key>${escapeXmlText(key2)}</key><string>${escapeXmlText(value)}</string>`
|
|
75537
|
+
).join("");
|
|
75538
|
+
return `<?xml version="1.0" encoding="UTF-8"?><plist version="1.0"><dict>${body}</dict></plist>`;
|
|
75539
|
+
}
|
|
75540
|
+
function parsePlist(xml) {
|
|
75541
|
+
const elements = parseXmlElements(xml);
|
|
75542
|
+
const plist = elements.find((element) => element.name === "plist");
|
|
75543
|
+
const root = plist ? plist.children[0] : elements[0];
|
|
75544
|
+
if (!root) {
|
|
75545
|
+
throw new IosDeviceTransportError("protocol", "Empty plist document from usbmuxd", {
|
|
75546
|
+
retryable: false
|
|
75547
|
+
});
|
|
75548
|
+
}
|
|
75549
|
+
return convertPlistElement(root);
|
|
75550
|
+
}
|
|
75551
|
+
function readUsbmuxResultCode(xml) {
|
|
75552
|
+
const root = parsePlistOrUndefined(xml);
|
|
75553
|
+
if (!isPlistDict(root)) {
|
|
75554
|
+
return void 0;
|
|
75555
|
+
}
|
|
75556
|
+
const value = root["Number"];
|
|
75557
|
+
return typeof value === "number" && Number.isSafeInteger(value) ? value : void 0;
|
|
75558
|
+
}
|
|
75559
|
+
function readUsbmuxDeviceIdForSerial(xml, serial) {
|
|
75560
|
+
const root = parsePlistOrUndefined(xml);
|
|
75561
|
+
if (!isPlistDict(root)) {
|
|
75562
|
+
return void 0;
|
|
75563
|
+
}
|
|
75564
|
+
const list = root["DeviceList"];
|
|
75565
|
+
if (!Array.isArray(list)) {
|
|
75566
|
+
return void 0;
|
|
75567
|
+
}
|
|
75568
|
+
let fallbackDeviceId;
|
|
75569
|
+
for (const entry of list) {
|
|
75570
|
+
if (!isPlistDict(entry)) {
|
|
75571
|
+
continue;
|
|
75572
|
+
}
|
|
75573
|
+
const properties = entry["Properties"];
|
|
75574
|
+
if (!isPlistDict(properties)) {
|
|
75575
|
+
continue;
|
|
75576
|
+
}
|
|
75577
|
+
if (properties["SerialNumber"] !== serial) {
|
|
75578
|
+
continue;
|
|
75579
|
+
}
|
|
75580
|
+
const deviceId = entry["DeviceID"];
|
|
75581
|
+
if (typeof deviceId !== "number" || !Number.isSafeInteger(deviceId) || deviceId <= 0) {
|
|
75582
|
+
continue;
|
|
75583
|
+
}
|
|
75584
|
+
if (properties["ConnectionType"] === "USB") {
|
|
75585
|
+
return deviceId;
|
|
75586
|
+
}
|
|
75587
|
+
fallbackDeviceId ??= deviceId;
|
|
75588
|
+
}
|
|
75589
|
+
return fallbackDeviceId;
|
|
75590
|
+
}
|
|
75591
|
+
function parsePlistOrUndefined(xml) {
|
|
75592
|
+
try {
|
|
75593
|
+
return parsePlist(xml);
|
|
75594
|
+
} catch {
|
|
75595
|
+
return void 0;
|
|
75596
|
+
}
|
|
75597
|
+
}
|
|
75598
|
+
function isPlistDict(value) {
|
|
75599
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
75600
|
+
}
|
|
75601
|
+
function parseXmlElements(xml) {
|
|
75602
|
+
const source = xml.replace(/<\?xml[\s\S]*?\?>/g, "").replace(/<!DOCTYPE[^>]*>/gi, "");
|
|
75603
|
+
const tokenPattern = /<(\/?)([A-Za-z][\w.-]*)((?:\s[^<>]*?)?)(\/?)>|([^<]+)/g;
|
|
75604
|
+
const root = { name: "#root", text: "", children: [] };
|
|
75605
|
+
const stack = [root];
|
|
75606
|
+
let consumed = 0;
|
|
75607
|
+
for (let match = tokenPattern.exec(source); match !== null; match = tokenPattern.exec(source)) {
|
|
75608
|
+
if (match.index !== consumed) {
|
|
75609
|
+
break;
|
|
75610
|
+
}
|
|
75611
|
+
consumed = tokenPattern.lastIndex;
|
|
75612
|
+
const [, closing, name, , selfClosing, textChunk] = match;
|
|
75613
|
+
const top = stack[stack.length - 1];
|
|
75614
|
+
if (textChunk !== void 0) {
|
|
75615
|
+
top.text += decodeXmlEntities(textChunk);
|
|
75616
|
+
continue;
|
|
75617
|
+
}
|
|
75618
|
+
if (closing) {
|
|
75619
|
+
if (stack.length < 2 || top.name !== name) {
|
|
75620
|
+
throw invalidXmlError(`unexpected closing tag </${name}>`);
|
|
75621
|
+
}
|
|
75622
|
+
stack.pop();
|
|
75623
|
+
continue;
|
|
75624
|
+
}
|
|
75625
|
+
const element = { name, text: "", children: [] };
|
|
75626
|
+
top.children.push(element);
|
|
75627
|
+
if (!selfClosing) {
|
|
75628
|
+
stack.push(element);
|
|
75629
|
+
}
|
|
75630
|
+
}
|
|
75631
|
+
if (consumed !== source.length) {
|
|
75632
|
+
throw invalidXmlError("malformed markup");
|
|
75633
|
+
}
|
|
75634
|
+
if (stack.length !== 1) {
|
|
75635
|
+
throw invalidXmlError(`unclosed tag <${stack[stack.length - 1].name}>`);
|
|
75636
|
+
}
|
|
75637
|
+
return root.children;
|
|
75638
|
+
}
|
|
75639
|
+
function convertPlistElement(element) {
|
|
75640
|
+
switch (element.name) {
|
|
75641
|
+
case "dict":
|
|
75642
|
+
return convertPlistDict(element);
|
|
75643
|
+
case "array":
|
|
75644
|
+
return element.children.map(convertPlistElement);
|
|
75645
|
+
case "string":
|
|
75646
|
+
return element.text;
|
|
75647
|
+
case "integer":
|
|
75648
|
+
case "real": {
|
|
75649
|
+
const parsed2 = Number(element.text.trim());
|
|
75650
|
+
if (!Number.isFinite(parsed2)) {
|
|
75651
|
+
throw invalidXmlError(`non-numeric <${element.name}> value "${element.text}"`);
|
|
75652
|
+
}
|
|
75653
|
+
return parsed2;
|
|
75654
|
+
}
|
|
75655
|
+
case "true":
|
|
75656
|
+
return true;
|
|
75657
|
+
case "false":
|
|
75658
|
+
return false;
|
|
75659
|
+
case "data":
|
|
75660
|
+
case "date":
|
|
75661
|
+
return element.text.trim();
|
|
75662
|
+
default:
|
|
75663
|
+
throw invalidXmlError(`unsupported plist node <${element.name}>`);
|
|
75664
|
+
}
|
|
75665
|
+
}
|
|
75666
|
+
function convertPlistDict(element) {
|
|
75667
|
+
const dict = {};
|
|
75668
|
+
for (let index = 0; index < element.children.length - 1; index += 1) {
|
|
75669
|
+
const key2 = element.children[index];
|
|
75670
|
+
if (key2.name !== "key") {
|
|
75671
|
+
continue;
|
|
75672
|
+
}
|
|
75673
|
+
const value = element.children[index + 1];
|
|
75674
|
+
if (value.name === "key") {
|
|
75675
|
+
continue;
|
|
75676
|
+
}
|
|
75677
|
+
dict[key2.text] = convertPlistElement(value);
|
|
75678
|
+
index += 1;
|
|
75679
|
+
}
|
|
75680
|
+
return dict;
|
|
75681
|
+
}
|
|
75682
|
+
function decodeXmlEntities(text) {
|
|
75683
|
+
return text.replace(/&(#x?[0-9a-fA-F]+|[a-z]+);/g, (entity, body) => {
|
|
75684
|
+
if (body.startsWith("#x") || body.startsWith("#X")) {
|
|
75685
|
+
return String.fromCodePoint(Number.parseInt(body.slice(2), 16));
|
|
75686
|
+
}
|
|
75687
|
+
if (body.startsWith("#")) {
|
|
75688
|
+
return String.fromCodePoint(Number.parseInt(body.slice(1), 10));
|
|
75689
|
+
}
|
|
75690
|
+
const named = {
|
|
75691
|
+
amp: "&",
|
|
75692
|
+
lt: "<",
|
|
75693
|
+
gt: ">",
|
|
75694
|
+
quot: '"',
|
|
75695
|
+
apos: "'"
|
|
75696
|
+
};
|
|
75697
|
+
return named[body] ?? entity;
|
|
75698
|
+
});
|
|
75699
|
+
}
|
|
75700
|
+
function invalidXmlError(detail) {
|
|
75701
|
+
return new IosDeviceTransportError("protocol", `Invalid plist XML from usbmuxd: ${detail}`, {
|
|
75702
|
+
retryable: false
|
|
75703
|
+
});
|
|
75704
|
+
}
|
|
75705
|
+
|
|
75451
75706
|
// ../tool-server/src/utils/ax-prefs.ts
|
|
75707
|
+
var PRE_BOOT_ACCESSIBILITY_KEYS = [
|
|
75708
|
+
"IgnoreAXServerEntitlements",
|
|
75709
|
+
"AccessibilityEnabled",
|
|
75710
|
+
"ApplicationAccessibilityEnabled"
|
|
75711
|
+
];
|
|
75452
75712
|
var execFileAsync8 = (0, import_node_util8.promisify)(import_node_child_process11.execFile);
|
|
75453
75713
|
async function accessibilityDefaults(udid, verb, ...args) {
|
|
75454
75714
|
const { stdout } = await execFileAsync8(
|
|
@@ -75469,16 +75729,15 @@ async function accessibilityDefaults(udid, verb, ...args) {
|
|
|
75469
75729
|
async function ensureAutomationEnabled(udid) {
|
|
75470
75730
|
await accessibilityDefaults(udid, "write", "AutomationEnabled", "-bool", "true");
|
|
75471
75731
|
}
|
|
75472
|
-
|
|
75473
|
-
const plist = await accessibilityDefaults(udid, "export", "-");
|
|
75732
|
+
function hasAutomationEnabled(plist) {
|
|
75474
75733
|
return plist.includes("<key>AutomationEnabled</key>");
|
|
75475
75734
|
}
|
|
75476
|
-
async function clearAutomationEnabled(udid) {
|
|
75477
|
-
if (!await
|
|
75735
|
+
async function clearAutomationEnabled(udid, plist) {
|
|
75736
|
+
if (!hasAutomationEnabled(plist ?? await accessibilityDefaults(udid, "export", "-"))) return;
|
|
75478
75737
|
try {
|
|
75479
75738
|
await accessibilityDefaults(udid, "delete", "AutomationEnabled");
|
|
75480
75739
|
} catch (err) {
|
|
75481
|
-
if (await
|
|
75740
|
+
if (hasAutomationEnabled(await accessibilityDefaults(udid, "export", "-"))) throw err;
|
|
75482
75741
|
}
|
|
75483
75742
|
}
|
|
75484
75743
|
async function clearAutomationEnabledOrWarn(udid) {
|
|
@@ -75489,26 +75748,12 @@ async function clearAutomationEnabledOrWarn(udid) {
|
|
|
75489
75748
|
);
|
|
75490
75749
|
});
|
|
75491
75750
|
}
|
|
75492
|
-
async function
|
|
75751
|
+
async function prepareLocalAxPrefs(udid) {
|
|
75752
|
+
const plist = await accessibilityDefaults(udid, "export", "-");
|
|
75753
|
+
await clearAutomationEnabled(udid, plist);
|
|
75493
75754
|
try {
|
|
75494
|
-
const
|
|
75495
|
-
|
|
75496
|
-
/** Same reasoning as {@linkcode accessibilityDefaults}. */
|
|
75497
|
-
await simctlArgsForUdid(
|
|
75498
|
-
udid,
|
|
75499
|
-
[
|
|
75500
|
-
"spawn",
|
|
75501
|
-
udid,
|
|
75502
|
-
"defaults",
|
|
75503
|
-
"read",
|
|
75504
|
-
"com.apple.Accessibility",
|
|
75505
|
-
"IgnoreAXServerEntitlements"
|
|
75506
|
-
],
|
|
75507
|
-
{ granted: "ax-service" }
|
|
75508
|
-
),
|
|
75509
|
-
{ timeout: SIMCTL_SPAWN_TIMEOUT_MS, killSignal: SIMCTL_KILL_SIGNAL }
|
|
75510
|
-
);
|
|
75511
|
-
return stdout.trim() === "1";
|
|
75755
|
+
const prefs = parsePlist(plist);
|
|
75756
|
+
return typeof prefs === "object" && !Array.isArray(prefs) && PRE_BOOT_ACCESSIBILITY_KEYS.every((key2) => prefs[key2] === true || prefs[key2] === 1);
|
|
75512
75757
|
} catch {
|
|
75513
75758
|
return false;
|
|
75514
75759
|
}
|
|
@@ -75524,12 +75769,7 @@ async function setAccessibilityPrefsPreBoot(udid, { isTvOs }) {
|
|
|
75524
75769
|
if (!exists3) {
|
|
75525
75770
|
await execFileAsync8("plutil", ["-create", "binary1", plistPath]);
|
|
75526
75771
|
}
|
|
75527
|
-
const keys = [
|
|
75528
|
-
"IgnoreAXServerEntitlements",
|
|
75529
|
-
"AccessibilityEnabled",
|
|
75530
|
-
"ApplicationAccessibilityEnabled"
|
|
75531
|
-
];
|
|
75532
|
-
if (isTvOs) keys.unshift("AutomationEnabled");
|
|
75772
|
+
const keys = isTvOs ? ["AutomationEnabled", ...PRE_BOOT_ACCESSIBILITY_KEYS] : PRE_BOOT_ACCESSIBILITY_KEYS;
|
|
75533
75773
|
for (const key2 of keys) {
|
|
75534
75774
|
await execFileAsync8("plutil", ["-replace", key2, "-bool", "true", plistPath]);
|
|
75535
75775
|
}
|
|
@@ -96182,8 +96422,7 @@ var localIosHost = {
|
|
|
96182
96422
|
listRunningBundleIds: listRunningUIKitApplicationBundleIds,
|
|
96183
96423
|
inspectRunningApp: inspectRunningAppLocal,
|
|
96184
96424
|
async bootstrapAx(udid) {
|
|
96185
|
-
await
|
|
96186
|
-
return { entitlementBypassActive: await isEntitlementBypassActive(udid) };
|
|
96425
|
+
return { accessibilityPrefsEnabled: await prepareLocalAxPrefs(udid) };
|
|
96187
96426
|
},
|
|
96188
96427
|
spawnAxDaemon: spawnAxDaemonLocal,
|
|
96189
96428
|
async startProxy() {
|
|
@@ -96225,7 +96464,7 @@ var remoteIosHost = {
|
|
|
96225
96464
|
args: ["defaults", "write", "com.apple.Accessibility", flag, "-bool", "true"]
|
|
96226
96465
|
});
|
|
96227
96466
|
}
|
|
96228
|
-
return {
|
|
96467
|
+
return { accessibilityPrefsEnabled: true };
|
|
96229
96468
|
},
|
|
96230
96469
|
spawnAxDaemon: spawnAxDaemonRemote,
|
|
96231
96470
|
startProxy: proxyStart,
|
|
@@ -98664,263 +98903,6 @@ var path22 = __toESM(require("node:path"));
|
|
|
98664
98903
|
var import_node_crypto8 = require("node:crypto");
|
|
98665
98904
|
var import_node_net = require("node:net");
|
|
98666
98905
|
init_src2();
|
|
98667
|
-
|
|
98668
|
-
// ../tool-server/src/utils/ios-device/usbmux-protocol.ts
|
|
98669
|
-
var USBMUX_HEADER_BYTES = 16;
|
|
98670
|
-
var USBMUX_PROTOCOL_VERSION = 1;
|
|
98671
|
-
var USBMUX_MESSAGE_TYPE_PLIST = 8;
|
|
98672
|
-
var USBMUX_MAX_PACKET_BYTES = 4 * 1024 * 1024;
|
|
98673
|
-
function appendHintToMessage(message, hint) {
|
|
98674
|
-
if (!hint || message.includes(hint)) {
|
|
98675
|
-
return message;
|
|
98676
|
-
}
|
|
98677
|
-
return `${message}${/[.!?]$/.test(message) ? "" : "."} Hint: ${hint}`;
|
|
98678
|
-
}
|
|
98679
|
-
var IosDeviceTransportError = class extends Error {
|
|
98680
|
-
kind;
|
|
98681
|
-
retryable;
|
|
98682
|
-
hint;
|
|
98683
|
-
constructor(kind, message, options = { retryable: false }) {
|
|
98684
|
-
super(
|
|
98685
|
-
appendHintToMessage(message, options.hint),
|
|
98686
|
-
options.cause !== void 0 ? { cause: options.cause } : void 0
|
|
98687
|
-
);
|
|
98688
|
-
this.name = "IosDeviceTransportError";
|
|
98689
|
-
this.kind = kind;
|
|
98690
|
-
this.retryable = options.retryable;
|
|
98691
|
-
if (options.hint !== void 0) {
|
|
98692
|
-
this.hint = options.hint;
|
|
98693
|
-
}
|
|
98694
|
-
}
|
|
98695
|
-
};
|
|
98696
|
-
function isIosDeviceTransportError(error63) {
|
|
98697
|
-
return error63 instanceof IosDeviceTransportError;
|
|
98698
|
-
}
|
|
98699
|
-
function encodeUsbmuxPacket(tag3, payloadXml) {
|
|
98700
|
-
const payload = Buffer.from(payloadXml, "utf8");
|
|
98701
|
-
const packet = Buffer.alloc(USBMUX_HEADER_BYTES + payload.length);
|
|
98702
|
-
packet.writeUInt32LE(packet.length, 0);
|
|
98703
|
-
packet.writeUInt32LE(USBMUX_PROTOCOL_VERSION, 4);
|
|
98704
|
-
packet.writeUInt32LE(USBMUX_MESSAGE_TYPE_PLIST, 8);
|
|
98705
|
-
packet.writeUInt32LE(tag3, 12);
|
|
98706
|
-
payload.copy(packet, USBMUX_HEADER_BYTES);
|
|
98707
|
-
return packet;
|
|
98708
|
-
}
|
|
98709
|
-
function decodeUsbmuxPacket(buffer) {
|
|
98710
|
-
if (buffer.length < USBMUX_HEADER_BYTES) {
|
|
98711
|
-
return null;
|
|
98712
|
-
}
|
|
98713
|
-
const totalLength = buffer.readUInt32LE(0);
|
|
98714
|
-
if (totalLength < USBMUX_HEADER_BYTES || totalLength > USBMUX_MAX_PACKET_BYTES) {
|
|
98715
|
-
throw new IosDeviceTransportError(
|
|
98716
|
-
"protocol",
|
|
98717
|
-
`Invalid usbmuxd packet length ${totalLength} (must be between ${USBMUX_HEADER_BYTES} and ${USBMUX_MAX_PACKET_BYTES} bytes)`,
|
|
98718
|
-
{ retryable: false }
|
|
98719
|
-
);
|
|
98720
|
-
}
|
|
98721
|
-
if (buffer.length < totalLength) {
|
|
98722
|
-
return null;
|
|
98723
|
-
}
|
|
98724
|
-
return {
|
|
98725
|
-
version: buffer.readUInt32LE(4),
|
|
98726
|
-
messageType: buffer.readUInt32LE(8),
|
|
98727
|
-
tag: buffer.readUInt32LE(12),
|
|
98728
|
-
payload: buffer.subarray(USBMUX_HEADER_BYTES, totalLength),
|
|
98729
|
-
bytesConsumed: totalLength
|
|
98730
|
-
};
|
|
98731
|
-
}
|
|
98732
|
-
function hostToNetworkPort(port) {
|
|
98733
|
-
if (!Number.isInteger(port) || port < 0 || port > 65535) {
|
|
98734
|
-
throw new IosDeviceTransportError("protocol", `Invalid TCP port ${port}`, {
|
|
98735
|
-
retryable: false
|
|
98736
|
-
});
|
|
98737
|
-
}
|
|
98738
|
-
return (port & 255) << 8 | port >>> 8 & 255;
|
|
98739
|
-
}
|
|
98740
|
-
function escapeXmlText(value) {
|
|
98741
|
-
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
98742
|
-
}
|
|
98743
|
-
function buildUsbmuxPlistMessage(messageType, fields = {}) {
|
|
98744
|
-
const entries = [
|
|
98745
|
-
["BundleID", "com.argent.tool-server"],
|
|
98746
|
-
["ClientVersionString", "argent"],
|
|
98747
|
-
["MessageType", messageType],
|
|
98748
|
-
["ProgName", "argent"],
|
|
98749
|
-
["kLibUSBMuxVersion", 3],
|
|
98750
|
-
...Object.entries(fields)
|
|
98751
|
-
];
|
|
98752
|
-
const body = entries.map(
|
|
98753
|
-
([key2, value]) => typeof value === "number" ? `<key>${escapeXmlText(key2)}</key><integer>${value}</integer>` : `<key>${escapeXmlText(key2)}</key><string>${escapeXmlText(value)}</string>`
|
|
98754
|
-
).join("");
|
|
98755
|
-
return `<?xml version="1.0" encoding="UTF-8"?><plist version="1.0"><dict>${body}</dict></plist>`;
|
|
98756
|
-
}
|
|
98757
|
-
function parsePlist(xml) {
|
|
98758
|
-
const elements = parseXmlElements(xml);
|
|
98759
|
-
const plist = elements.find((element) => element.name === "plist");
|
|
98760
|
-
const root = plist ? plist.children[0] : elements[0];
|
|
98761
|
-
if (!root) {
|
|
98762
|
-
throw new IosDeviceTransportError("protocol", "Empty plist document from usbmuxd", {
|
|
98763
|
-
retryable: false
|
|
98764
|
-
});
|
|
98765
|
-
}
|
|
98766
|
-
return convertPlistElement(root);
|
|
98767
|
-
}
|
|
98768
|
-
function readUsbmuxResultCode(xml) {
|
|
98769
|
-
const root = parsePlistOrUndefined(xml);
|
|
98770
|
-
if (!isPlistDict(root)) {
|
|
98771
|
-
return void 0;
|
|
98772
|
-
}
|
|
98773
|
-
const value = root["Number"];
|
|
98774
|
-
return typeof value === "number" && Number.isSafeInteger(value) ? value : void 0;
|
|
98775
|
-
}
|
|
98776
|
-
function readUsbmuxDeviceIdForSerial(xml, serial) {
|
|
98777
|
-
const root = parsePlistOrUndefined(xml);
|
|
98778
|
-
if (!isPlistDict(root)) {
|
|
98779
|
-
return void 0;
|
|
98780
|
-
}
|
|
98781
|
-
const list = root["DeviceList"];
|
|
98782
|
-
if (!Array.isArray(list)) {
|
|
98783
|
-
return void 0;
|
|
98784
|
-
}
|
|
98785
|
-
let fallbackDeviceId;
|
|
98786
|
-
for (const entry of list) {
|
|
98787
|
-
if (!isPlistDict(entry)) {
|
|
98788
|
-
continue;
|
|
98789
|
-
}
|
|
98790
|
-
const properties = entry["Properties"];
|
|
98791
|
-
if (!isPlistDict(properties)) {
|
|
98792
|
-
continue;
|
|
98793
|
-
}
|
|
98794
|
-
if (properties["SerialNumber"] !== serial) {
|
|
98795
|
-
continue;
|
|
98796
|
-
}
|
|
98797
|
-
const deviceId = entry["DeviceID"];
|
|
98798
|
-
if (typeof deviceId !== "number" || !Number.isSafeInteger(deviceId) || deviceId <= 0) {
|
|
98799
|
-
continue;
|
|
98800
|
-
}
|
|
98801
|
-
if (properties["ConnectionType"] === "USB") {
|
|
98802
|
-
return deviceId;
|
|
98803
|
-
}
|
|
98804
|
-
fallbackDeviceId ??= deviceId;
|
|
98805
|
-
}
|
|
98806
|
-
return fallbackDeviceId;
|
|
98807
|
-
}
|
|
98808
|
-
function parsePlistOrUndefined(xml) {
|
|
98809
|
-
try {
|
|
98810
|
-
return parsePlist(xml);
|
|
98811
|
-
} catch {
|
|
98812
|
-
return void 0;
|
|
98813
|
-
}
|
|
98814
|
-
}
|
|
98815
|
-
function isPlistDict(value) {
|
|
98816
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
98817
|
-
}
|
|
98818
|
-
function parseXmlElements(xml) {
|
|
98819
|
-
const source = xml.replace(/<\?xml[\s\S]*?\?>/g, "").replace(/<!DOCTYPE[^>]*>/gi, "");
|
|
98820
|
-
const tokenPattern = /<(\/?)([A-Za-z][\w.-]*)((?:\s[^<>]*?)?)(\/?)>|([^<]+)/g;
|
|
98821
|
-
const root = { name: "#root", text: "", children: [] };
|
|
98822
|
-
const stack = [root];
|
|
98823
|
-
let consumed = 0;
|
|
98824
|
-
for (let match = tokenPattern.exec(source); match !== null; match = tokenPattern.exec(source)) {
|
|
98825
|
-
if (match.index !== consumed) {
|
|
98826
|
-
break;
|
|
98827
|
-
}
|
|
98828
|
-
consumed = tokenPattern.lastIndex;
|
|
98829
|
-
const [, closing, name, , selfClosing, textChunk] = match;
|
|
98830
|
-
const top = stack[stack.length - 1];
|
|
98831
|
-
if (textChunk !== void 0) {
|
|
98832
|
-
top.text += decodeXmlEntities(textChunk);
|
|
98833
|
-
continue;
|
|
98834
|
-
}
|
|
98835
|
-
if (closing) {
|
|
98836
|
-
if (stack.length < 2 || top.name !== name) {
|
|
98837
|
-
throw invalidXmlError(`unexpected closing tag </${name}>`);
|
|
98838
|
-
}
|
|
98839
|
-
stack.pop();
|
|
98840
|
-
continue;
|
|
98841
|
-
}
|
|
98842
|
-
const element = { name, text: "", children: [] };
|
|
98843
|
-
top.children.push(element);
|
|
98844
|
-
if (!selfClosing) {
|
|
98845
|
-
stack.push(element);
|
|
98846
|
-
}
|
|
98847
|
-
}
|
|
98848
|
-
if (consumed !== source.length) {
|
|
98849
|
-
throw invalidXmlError("malformed markup");
|
|
98850
|
-
}
|
|
98851
|
-
if (stack.length !== 1) {
|
|
98852
|
-
throw invalidXmlError(`unclosed tag <${stack[stack.length - 1].name}>`);
|
|
98853
|
-
}
|
|
98854
|
-
return root.children;
|
|
98855
|
-
}
|
|
98856
|
-
function convertPlistElement(element) {
|
|
98857
|
-
switch (element.name) {
|
|
98858
|
-
case "dict":
|
|
98859
|
-
return convertPlistDict(element);
|
|
98860
|
-
case "array":
|
|
98861
|
-
return element.children.map(convertPlistElement);
|
|
98862
|
-
case "string":
|
|
98863
|
-
return element.text;
|
|
98864
|
-
case "integer":
|
|
98865
|
-
case "real": {
|
|
98866
|
-
const parsed2 = Number(element.text.trim());
|
|
98867
|
-
if (!Number.isFinite(parsed2)) {
|
|
98868
|
-
throw invalidXmlError(`non-numeric <${element.name}> value "${element.text}"`);
|
|
98869
|
-
}
|
|
98870
|
-
return parsed2;
|
|
98871
|
-
}
|
|
98872
|
-
case "true":
|
|
98873
|
-
return true;
|
|
98874
|
-
case "false":
|
|
98875
|
-
return false;
|
|
98876
|
-
case "data":
|
|
98877
|
-
case "date":
|
|
98878
|
-
return element.text.trim();
|
|
98879
|
-
default:
|
|
98880
|
-
throw invalidXmlError(`unsupported plist node <${element.name}>`);
|
|
98881
|
-
}
|
|
98882
|
-
}
|
|
98883
|
-
function convertPlistDict(element) {
|
|
98884
|
-
const dict = {};
|
|
98885
|
-
for (let index = 0; index < element.children.length - 1; index += 1) {
|
|
98886
|
-
const key2 = element.children[index];
|
|
98887
|
-
if (key2.name !== "key") {
|
|
98888
|
-
continue;
|
|
98889
|
-
}
|
|
98890
|
-
const value = element.children[index + 1];
|
|
98891
|
-
if (value.name === "key") {
|
|
98892
|
-
continue;
|
|
98893
|
-
}
|
|
98894
|
-
dict[key2.text] = convertPlistElement(value);
|
|
98895
|
-
index += 1;
|
|
98896
|
-
}
|
|
98897
|
-
return dict;
|
|
98898
|
-
}
|
|
98899
|
-
function decodeXmlEntities(text) {
|
|
98900
|
-
return text.replace(/&(#x?[0-9a-fA-F]+|[a-z]+);/g, (entity, body) => {
|
|
98901
|
-
if (body.startsWith("#x") || body.startsWith("#X")) {
|
|
98902
|
-
return String.fromCodePoint(Number.parseInt(body.slice(2), 16));
|
|
98903
|
-
}
|
|
98904
|
-
if (body.startsWith("#")) {
|
|
98905
|
-
return String.fromCodePoint(Number.parseInt(body.slice(1), 10));
|
|
98906
|
-
}
|
|
98907
|
-
const named = {
|
|
98908
|
-
amp: "&",
|
|
98909
|
-
lt: "<",
|
|
98910
|
-
gt: ">",
|
|
98911
|
-
quot: '"',
|
|
98912
|
-
apos: "'"
|
|
98913
|
-
};
|
|
98914
|
-
return named[body] ?? entity;
|
|
98915
|
-
});
|
|
98916
|
-
}
|
|
98917
|
-
function invalidXmlError(detail) {
|
|
98918
|
-
return new IosDeviceTransportError("protocol", `Invalid plist XML from usbmuxd: ${detail}`, {
|
|
98919
|
-
retryable: false
|
|
98920
|
-
});
|
|
98921
|
-
}
|
|
98922
|
-
|
|
98923
|
-
// ../tool-server/src/utils/ios-device/devicectl.ts
|
|
98924
98906
|
var execFileAsync15 = (0, import_node_util15.promisify)(import_node_child_process20.execFile);
|
|
98925
98907
|
var DEVICECTL_TIMEOUT_MS2 = 2e4;
|
|
98926
98908
|
var DEVICECTL_INSTALL_TIMEOUT_MS = 12e4;
|
|
@@ -103332,9 +103314,9 @@ var axServiceBlueprint = {
|
|
|
103332
103314
|
failPending(err);
|
|
103333
103315
|
events.emit("terminated", err);
|
|
103334
103316
|
};
|
|
103335
|
-
const {
|
|
103317
|
+
const { accessibilityPrefsEnabled } = await host.bootstrapAx(udid);
|
|
103336
103318
|
const startFailed = (err) => {
|
|
103337
|
-
if (err instanceof Error) startFailureDegraded.set(err, !
|
|
103319
|
+
if (err instanceof Error) startFailureDegraded.set(err, !accessibilityPrefsEnabled);
|
|
103338
103320
|
return err;
|
|
103339
103321
|
};
|
|
103340
103322
|
const server = await startListener(endpoint, (socket) => {
|
|
@@ -103476,7 +103458,7 @@ var axServiceBlueprint = {
|
|
|
103476
103458
|
}
|
|
103477
103459
|
let lacksOrientationCommand = false;
|
|
103478
103460
|
const api = {
|
|
103479
|
-
degraded: !
|
|
103461
|
+
degraded: !accessibilityPrefsEnabled,
|
|
103480
103462
|
async describe() {
|
|
103481
103463
|
const result = await query("describe", 1e4);
|
|
103482
103464
|
if (result.error) {
|
|
@@ -103880,8 +103862,8 @@ function adaptAXDescribeToDescribeResult(response) {
|
|
|
103880
103862
|
}
|
|
103881
103863
|
|
|
103882
103864
|
// ../tool-server/src/tools/describe/platforms/ios/index.ts
|
|
103883
|
-
var DEGRADED_BLIND_HINT = "The accessibility read returned no elements
|
|
103884
|
-
var DEGRADED_STANDING_HINT = "
|
|
103865
|
+
var DEGRADED_BLIND_HINT = "The accessibility read returned no elements. Argent could not verify all pre-boot accessibility settings. If you expect elements on this screen, boot-device with force=true restarts the simulator with those settings";
|
|
103866
|
+
var DEGRADED_STANDING_HINT = "Argent could not verify all pre-boot accessibility settings. System dialogs and native modals may be missing. If you need them, boot-device with force=true restarts the simulator with those settings";
|
|
103885
103867
|
function externalCaveat(deviceId, body) {
|
|
103886
103868
|
return `${externalSupportHint(deviceId) ?? "This device is supplied by an external provider."} ${body}`;
|
|
103887
103869
|
}
|
|
@@ -103892,12 +103874,12 @@ function isStandingCaveat(hint) {
|
|
|
103892
103874
|
return hint === DEGRADED_STANDING_HINT || Boolean(hint?.endsWith(EXTERNAL_STANDING_BODY));
|
|
103893
103875
|
}
|
|
103894
103876
|
function isBlindCaveat(hint) {
|
|
103895
|
-
return hint
|
|
103877
|
+
return Boolean(hint?.endsWith(DEGRADED_BLIND_HINT) || hint?.endsWith(EXTERNAL_BLIND_BODY));
|
|
103896
103878
|
}
|
|
103897
103879
|
function startFailure(err) {
|
|
103898
103880
|
return `The accessibility service failed to start (${errMsg(err)})`;
|
|
103899
103881
|
}
|
|
103900
|
-
var DEGRADED_START_FAILED_TAIL = "
|
|
103882
|
+
var DEGRADED_START_FAILED_TAIL = ". Check the simulator's pre-boot accessibility settings. Call boot-device with force=true to restart the simulator with those settings. If the service fails to start again, do not reboot again: the boot was not the cause.";
|
|
103901
103883
|
function axCrashHint(signal) {
|
|
103902
103884
|
return `The accessibility service (ax-service) crashed with ${signal}, so the accessibility tree could not be read. Every describe starts the service again. If this hint repeats, the crash is in the service on this host: rebooting the simulator (boot-device with force=true) or restarting the tool-server will not fix it, because both start the same binary again. While it crashes, system dialogs and SpringBoard chrome cannot be read through describe. describe continues on the app's native view hierarchy where that is available, and \`screenshot\` shows the rest.`;
|
|
103903
103885
|
}
|
|
@@ -104059,7 +104041,13 @@ async function readIos(registry2, device, params, options, facts) {
|
|
|
104059
104041
|
}
|
|
104060
104042
|
const parsed2 = parseNativeDescribeScreenResult(rawResult);
|
|
104061
104043
|
const nativeTree = adaptNativeDescribeToDescribeResult(parsed2);
|
|
104062
|
-
|
|
104044
|
+
const scope = "This app-only tree omits system dialogs, including permission prompts.";
|
|
104045
|
+
return {
|
|
104046
|
+
tree: nativeTree,
|
|
104047
|
+
source: "native-devtools",
|
|
104048
|
+
partial: true,
|
|
104049
|
+
hint: crashHint ?? (hint ? `${scope} ${hint}` : scope)
|
|
104050
|
+
};
|
|
104063
104051
|
} catch (err) {
|
|
104064
104052
|
return { tree, source: "ax-service", hint: unexplainedHint(hint, errMsg(err), params) };
|
|
104065
104053
|
}
|
|
@@ -120636,14 +120624,15 @@ function darkTailToleranceMs(pollIntervalMs) {
|
|
|
120636
120624
|
// ../tool-server/src/tools/await-ui-element/index.ts
|
|
120637
120625
|
var WAIT_CANCELLED_NOTE = "wait was cancelled before the condition was met";
|
|
120638
120626
|
var TREE_FETCH_FAILED_NOTE_PREFIX = "last tree fetch failed: ";
|
|
120639
|
-
var
|
|
120627
|
+
var HIDDEN_UNCONFIRMED = "could not confirm the element is hidden";
|
|
120628
|
+
var HIDDEN_UNREADABLE_NOTE = `${HIDDEN_UNCONFIRMED} \u2014 the UI tree was empty or unreadable at timeout`;
|
|
120640
120629
|
function unmetUiWaitCause(result) {
|
|
120641
120630
|
const carried = result?.cause;
|
|
120642
120631
|
if (carried === "unmet" || carried === "unreadable" || carried === "cancelled") return carried;
|
|
120643
120632
|
const note = result?.note;
|
|
120644
120633
|
if (typeof note !== "string") return "unmet";
|
|
120645
120634
|
if (note === WAIT_CANCELLED_NOTE) return "cancelled";
|
|
120646
|
-
if (note.startsWith(TREE_FETCH_FAILED_NOTE_PREFIX) || note.startsWith(
|
|
120635
|
+
if (note.startsWith(TREE_FETCH_FAILED_NOTE_PREFIX) || note.startsWith(HIDDEN_UNCONFIRMED)) {
|
|
120647
120636
|
return "unreadable";
|
|
120648
120637
|
}
|
|
120649
120638
|
return "unmet";
|
|
@@ -120719,7 +120708,13 @@ function timeoutNote(params, lastTree, fetchError, lastData) {
|
|
|
120719
120708
|
break;
|
|
120720
120709
|
}
|
|
120721
120710
|
case "hidden":
|
|
120722
|
-
|
|
120711
|
+
if (matches2.some(isVisible)) {
|
|
120712
|
+
base = "an element matching the selector was still visible at timeout";
|
|
120713
|
+
} else if (lastData?.partial && lastData.source === "native-devtools") {
|
|
120714
|
+
base = HIDDEN_UNCONFIRMED;
|
|
120715
|
+
} else {
|
|
120716
|
+
base = HIDDEN_UNREADABLE_NOTE;
|
|
120717
|
+
}
|
|
120723
120718
|
break;
|
|
120724
120719
|
case "visible":
|
|
120725
120720
|
base = matches2.length > 0 ? "element(s) matched but none was visible (zero-area frame) before timeout" : "no element matched the selector before timeout";
|
|
@@ -130553,7 +130548,7 @@ async function bootSimctl(prefix, [sub, udid, ...rest], timeoutMs) {
|
|
|
130553
130548
|
);
|
|
130554
130549
|
}
|
|
130555
130550
|
}
|
|
130556
|
-
async function bootIos(udid, registry2, force, headless) {
|
|
130551
|
+
async function bootIos(udid, registry2, force, headless, prepareOnly) {
|
|
130557
130552
|
if (process.platform !== "darwin") {
|
|
130558
130553
|
throw new FailureError(
|
|
130559
130554
|
`iOS Simulator is unavailable on ${process.platform}: it requires a macOS host. Pass \`avdName\` (Android) instead of \`udid\` (iOS) to boot a device from this host.`,
|
|
@@ -130581,6 +130576,15 @@ async function bootIos(udid, registry2, force, headless) {
|
|
|
130581
130576
|
}
|
|
130582
130577
|
const simState = simMatch?.state;
|
|
130583
130578
|
const isTvOs = simMatch?.runtimeKind === "tv";
|
|
130579
|
+
if (prepareOnly) {
|
|
130580
|
+
if (simState !== "Shutdown") {
|
|
130581
|
+
throw new InvalidToolInputError(
|
|
130582
|
+
`prepareOnly requires a Shutdown simulator. State of ${udid}: ${simState ?? "unknown"}.`
|
|
130583
|
+
);
|
|
130584
|
+
}
|
|
130585
|
+
await setAccessibilityPrefsPreBoot(udid, { isTvOs });
|
|
130586
|
+
return { platform: "ios", udid, booted: false, prepared: true };
|
|
130587
|
+
}
|
|
130584
130588
|
const deviceSet = await deviceSetForUdid(udid);
|
|
130585
130589
|
const prefix = simctlPrefix(deviceSet);
|
|
130586
130590
|
const booting = simState === "Booting";
|
|
@@ -131872,6 +131876,9 @@ var zodSchema10 = external_exports.object({
|
|
|
131872
131876
|
port: external_exports.number().int().optional().describe(
|
|
131873
131877
|
"Android only: the emulator's console port, an even number from 5554 to 5584 (`emulator -port`), the range adb finds emulators in; its serial is `emulator-<port>`. Without it the emulator takes the first free port from 5554 up, as Android Studio does. The gRPC server Argent needs for screenshots and gestures goes on the port plus 3000, which must be free too. Given a port, the tool reuses only the emulator on that port and fails if another emulator holds it, or if this AVD runs there writable on a read-only boot and `force` is not set. A read-only emulator started with `-port` belongs to the calls that give that port: a call without `port` never reuses or shuts it down. Where the process list cannot be read (Windows, or a failed `ps`), Argent knows only the pinned emulators it booted itself, so a writable call without `port` can reuse, or with `force` shut down, one that someone else pinned. A writable one is still reused, or with `force` shut down, by a writable call without `port`, since the AVD runs one writable emulator at a time. `force` shuts nothing down when another emulator of the AVD would still block the boot. Ignored on other platforms."
|
|
131874
131878
|
),
|
|
131879
|
+
prepareOnly: external_exports.boolean().optional().describe(
|
|
131880
|
+
"Local iOS simulator only: apply accessibility preferences and leave the simulator shut down for a pool manager to boot. Requires Shutdown state. Cannot be combined with force: true."
|
|
131881
|
+
),
|
|
131875
131882
|
headless: external_exports.boolean().optional().describe(
|
|
131876
131883
|
"iOS only: boot the simulator core WITHOUT opening its GUI window (Simulator.app, or Device Hub on Xcode 27+). The device still streams via simulator-server. The `ARGENT_SIMULATOR_NO_WINDOW` env var (1/true/yes) forces this host-wide."
|
|
131877
131884
|
),
|
|
@@ -131907,9 +131914,9 @@ HarmonyOS hands the instance to DevEco Studio's Emulator manager, then waits for
|
|
|
131907
131914
|
alwaysLoad: true,
|
|
131908
131915
|
searchHint: "boot start launch simulator emulator avd device session ios android vega vvd firetv <flag:harmonyos>harmony harmonyos deveco </flag:harmonyos>cold hot",
|
|
131909
131916
|
interaction: {
|
|
131910
|
-
startedMsg: ({ params }) =>
|
|
131911
|
-
completedMsg: ({ params }) =>
|
|
131912
|
-
failedMsg: ({ params, failureSignal: failureSignal2 }) => `Failed to start ${bootTarget(params)}: ${failureSignal2.error_code}`
|
|
131917
|
+
startedMsg: ({ params }) => `${params.prepareOnly ? "Preparing" : "Starting"} ${bootTarget(params)}`,
|
|
131918
|
+
completedMsg: ({ params }) => `${params.prepareOnly ? "Prepared" : "Started"} ${bootTarget(params)}`,
|
|
131919
|
+
failedMsg: ({ params, failureSignal: failureSignal2 }) => `Failed to ${params.prepareOnly ? "prepare" : "start"} ${bootTarget(params)}: ${failureSignal2.error_code}`
|
|
131913
131920
|
},
|
|
131914
131921
|
capability: capability2,
|
|
131915
131922
|
services: () => ({}),
|
|
@@ -131935,6 +131942,11 @@ HarmonyOS hands the instance to DevEco Studio's Emulator manager, then waits for
|
|
|
131935
131942
|
}
|
|
131936
131943
|
);
|
|
131937
131944
|
}
|
|
131945
|
+
if (params.prepareOnly && (!params.udid || classifyDevice(params.udid) !== "ios" || params.force)) {
|
|
131946
|
+
throw new InvalidToolInputError(
|
|
131947
|
+
"prepareOnly requires a local iOS simulator UDID and cannot be combined with force: true."
|
|
131948
|
+
);
|
|
131949
|
+
}
|
|
131938
131950
|
if (hasMacos || hasUdid && classifyDevice(params.udid) === "macos") {
|
|
131939
131951
|
return bootMacosApp(registry2, {
|
|
131940
131952
|
appPath: params.macosAppPath,
|
|
@@ -131987,7 +131999,7 @@ HarmonyOS hands the instance to DevEco Studio's Emulator manager, then waits for
|
|
|
131987
131999
|
}
|
|
131988
132000
|
);
|
|
131989
132001
|
}
|
|
131990
|
-
return bootIos(params.udid, registry2, params.force, params.headless);
|
|
132002
|
+
return bootIos(params.udid, registry2, params.force, params.headless, params.prepareOnly);
|
|
131991
132003
|
}
|
|
131992
132004
|
if (hasAvd) {
|
|
131993
132005
|
if (params.port !== void 0) {
|
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.4",
|
|
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": "3b96d7b4964cf5938872a30c7dbd78e71af76c17"
|
|
102
102
|
}
|