@swmansion/argent 0.31.2-next.10 → 0.31.2-next.11
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 +2 -0
- package/dist/client.js +2 -0
- package/dist/installer.mjs +2 -0
- package/dist/mcp-server.mjs +2 -0
- package/dist/tool-server.cjs +305 -227
- package/package.json +1 -1
package/dist/cli-cmds.mjs
CHANGED
|
@@ -10456,6 +10456,8 @@ var FAILURE_CODES = {
|
|
|
10456
10456
|
TOOL_CAPABILITY_UNSUPPORTED_OPERATION: "TOOL_CAPABILITY_UNSUPPORTED_OPERATION",
|
|
10457
10457
|
TOOL_PLATFORM_NOT_IMPLEMENTED: "TOOL_PLATFORM_NOT_IMPLEMENTED",
|
|
10458
10458
|
TOOL_DEPENDENCY_MISSING: "TOOL_DEPENDENCY_MISSING",
|
|
10459
|
+
// Xcode's simctl or devicectl wrapper would start its component install and wait for a password.
|
|
10460
|
+
TOOL_XCODE_FIRST_LAUNCH_PENDING: "TOOL_XCODE_FIRST_LAUNCH_PENDING",
|
|
10459
10461
|
TOOL_INPUT_INVALID: "TOOL_INPUT_INVALID",
|
|
10460
10462
|
TOOLSERVER_UNHANDLED_REJECTION: "TOOLSERVER_UNHANDLED_REJECTION",
|
|
10461
10463
|
TOOLSERVER_UNCAUGHT_EXCEPTION: "TOOLSERVER_UNCAUGHT_EXCEPTION",
|
package/dist/client.js
CHANGED
|
@@ -9029,6 +9029,8 @@ var FAILURE_CODES = {
|
|
|
9029
9029
|
TOOL_CAPABILITY_UNSUPPORTED_OPERATION: "TOOL_CAPABILITY_UNSUPPORTED_OPERATION",
|
|
9030
9030
|
TOOL_PLATFORM_NOT_IMPLEMENTED: "TOOL_PLATFORM_NOT_IMPLEMENTED",
|
|
9031
9031
|
TOOL_DEPENDENCY_MISSING: "TOOL_DEPENDENCY_MISSING",
|
|
9032
|
+
// Xcode's simctl or devicectl wrapper would start its component install and wait for a password.
|
|
9033
|
+
TOOL_XCODE_FIRST_LAUNCH_PENDING: "TOOL_XCODE_FIRST_LAUNCH_PENDING",
|
|
9032
9034
|
TOOL_INPUT_INVALID: "TOOL_INPUT_INVALID",
|
|
9033
9035
|
TOOLSERVER_UNHANDLED_REJECTION: "TOOLSERVER_UNHANDLED_REJECTION",
|
|
9034
9036
|
TOOLSERVER_UNCAUGHT_EXCEPTION: "TOOLSERVER_UNCAUGHT_EXCEPTION",
|
package/dist/installer.mjs
CHANGED
|
@@ -15793,6 +15793,8 @@ var FAILURE_CODES = {
|
|
|
15793
15793
|
TOOL_CAPABILITY_UNSUPPORTED_OPERATION: "TOOL_CAPABILITY_UNSUPPORTED_OPERATION",
|
|
15794
15794
|
TOOL_PLATFORM_NOT_IMPLEMENTED: "TOOL_PLATFORM_NOT_IMPLEMENTED",
|
|
15795
15795
|
TOOL_DEPENDENCY_MISSING: "TOOL_DEPENDENCY_MISSING",
|
|
15796
|
+
// Xcode's simctl or devicectl wrapper would start its component install and wait for a password.
|
|
15797
|
+
TOOL_XCODE_FIRST_LAUNCH_PENDING: "TOOL_XCODE_FIRST_LAUNCH_PENDING",
|
|
15796
15798
|
TOOL_INPUT_INVALID: "TOOL_INPUT_INVALID",
|
|
15797
15799
|
TOOLSERVER_UNHANDLED_REJECTION: "TOOLSERVER_UNHANDLED_REJECTION",
|
|
15798
15800
|
TOOLSERVER_UNCAUGHT_EXCEPTION: "TOOLSERVER_UNCAUGHT_EXCEPTION",
|
package/dist/mcp-server.mjs
CHANGED
|
@@ -25739,6 +25739,8 @@ var FAILURE_CODES = {
|
|
|
25739
25739
|
TOOL_CAPABILITY_UNSUPPORTED_OPERATION: "TOOL_CAPABILITY_UNSUPPORTED_OPERATION",
|
|
25740
25740
|
TOOL_PLATFORM_NOT_IMPLEMENTED: "TOOL_PLATFORM_NOT_IMPLEMENTED",
|
|
25741
25741
|
TOOL_DEPENDENCY_MISSING: "TOOL_DEPENDENCY_MISSING",
|
|
25742
|
+
// Xcode's simctl or devicectl wrapper would start its component install and wait for a password.
|
|
25743
|
+
TOOL_XCODE_FIRST_LAUNCH_PENDING: "TOOL_XCODE_FIRST_LAUNCH_PENDING",
|
|
25742
25744
|
TOOL_INPUT_INVALID: "TOOL_INPUT_INVALID",
|
|
25743
25745
|
TOOLSERVER_UNHANDLED_REJECTION: "TOOLSERVER_UNHANDLED_REJECTION",
|
|
25744
25746
|
TOOLSERVER_UNCAUGHT_EXCEPTION: "TOOLSERVER_UNCAUGHT_EXCEPTION",
|
package/dist/tool-server.cjs
CHANGED
|
@@ -1499,6 +1499,8 @@ var init_failure_codes = __esm({
|
|
|
1499
1499
|
TOOL_CAPABILITY_UNSUPPORTED_OPERATION: "TOOL_CAPABILITY_UNSUPPORTED_OPERATION",
|
|
1500
1500
|
TOOL_PLATFORM_NOT_IMPLEMENTED: "TOOL_PLATFORM_NOT_IMPLEMENTED",
|
|
1501
1501
|
TOOL_DEPENDENCY_MISSING: "TOOL_DEPENDENCY_MISSING",
|
|
1502
|
+
// Xcode's simctl or devicectl wrapper would start its component install and wait for a password.
|
|
1503
|
+
TOOL_XCODE_FIRST_LAUNCH_PENDING: "TOOL_XCODE_FIRST_LAUNCH_PENDING",
|
|
1502
1504
|
TOOL_INPUT_INVALID: "TOOL_INPUT_INVALID",
|
|
1503
1505
|
TOOLSERVER_UNHANDLED_REJECTION: "TOOLSERVER_UNHANDLED_REJECTION",
|
|
1504
1506
|
TOOLSERVER_UNCAUGHT_EXCEPTION: "TOOLSERVER_UNCAUGHT_EXCEPTION",
|
|
@@ -79279,7 +79281,7 @@ function resolveHomeDir2() {
|
|
|
79279
79281
|
return trimmed ? raw : os3.homedir();
|
|
79280
79282
|
}
|
|
79281
79283
|
function providersDirectory() {
|
|
79282
|
-
return
|
|
79284
|
+
return path13.join(resolveHomeDir2(), ".argent", "providers");
|
|
79283
79285
|
}
|
|
79284
79286
|
function discoveryDisabled() {
|
|
79285
79287
|
const raw = process.env[DISABLE_ENV];
|
|
@@ -79294,7 +79296,7 @@ function warnOnce(key2, message) {
|
|
|
79294
79296
|
function readProviderFile(file2) {
|
|
79295
79297
|
let raw;
|
|
79296
79298
|
try {
|
|
79297
|
-
raw =
|
|
79299
|
+
raw = fs13.readFileSync(file2, "utf8");
|
|
79298
79300
|
} catch {
|
|
79299
79301
|
return void 0;
|
|
79300
79302
|
}
|
|
@@ -79344,7 +79346,7 @@ function discoverProviders() {
|
|
|
79344
79346
|
function descriptorFiles() {
|
|
79345
79347
|
const directory = providersDirectory();
|
|
79346
79348
|
try {
|
|
79347
|
-
return
|
|
79349
|
+
return fs13.readdirSync(directory).filter((name) => name.endsWith(".json")).sort().map((name) => path13.join(directory, name));
|
|
79348
79350
|
} catch {
|
|
79349
79351
|
return [];
|
|
79350
79352
|
}
|
|
@@ -79405,13 +79407,13 @@ function readProviderDevices(record2, classify) {
|
|
|
79405
79407
|
}
|
|
79406
79408
|
return out;
|
|
79407
79409
|
}
|
|
79408
|
-
var
|
|
79410
|
+
var fs13, os3, path13, DISABLE_ENV, OVERRIDE_ENV, warnedOnce;
|
|
79409
79411
|
var init_read = __esm({
|
|
79410
79412
|
"../device-providers/src/read.ts"() {
|
|
79411
79413
|
"use strict";
|
|
79412
|
-
|
|
79414
|
+
fs13 = __toESM(require("node:fs"));
|
|
79413
79415
|
os3 = __toESM(require("node:os"));
|
|
79414
|
-
|
|
79416
|
+
path13 = __toESM(require("node:path"));
|
|
79415
79417
|
init_contract();
|
|
79416
79418
|
DISABLE_ENV = "ARGENT_DISABLE_DEVICE_PROVIDERS";
|
|
79417
79419
|
OVERRIDE_ENV = "ARGENT_DEVICE_PROVIDERS";
|
|
@@ -83945,7 +83947,7 @@ async function adbShellInput(serial, shellCommand, input2, options = {}) {
|
|
|
83945
83947
|
const adbPath = await resolveAdbOrThrow();
|
|
83946
83948
|
const argv = adbArgv(["-s", serial, "shell", shellCommand]);
|
|
83947
83949
|
return new Promise((resolve17, reject) => {
|
|
83948
|
-
const child = (0,
|
|
83950
|
+
const child = (0, import_node_child_process16.execFile)(
|
|
83949
83951
|
adbPath,
|
|
83950
83952
|
argv,
|
|
83951
83953
|
{
|
|
@@ -84257,11 +84259,11 @@ async function hasDefaultBootSnapshot(avdName) {
|
|
|
84257
84259
|
return false;
|
|
84258
84260
|
}
|
|
84259
84261
|
}
|
|
84260
|
-
var
|
|
84262
|
+
var import_node_child_process16, import_node_util13, import_node_os5, import_node_path9, import_ini, execFileAsync13, emulatorFlagSupportCache, ADB_KILL_SIGNAL, ADB_DEVICE_STATES, ADB_DEVICES_TIMEOUT_MS, ENRICH_TIMEOUT_MS, androidRuntimeKindCache, TERMINAL_ADB_ERROR_PATTERNS, AVD_NAME_PATTERN;
|
|
84261
84263
|
var init_adb = __esm({
|
|
84262
84264
|
"../tool-server/src/utils/adb.ts"() {
|
|
84263
84265
|
"use strict";
|
|
84264
|
-
|
|
84266
|
+
import_node_child_process16 = require("node:child_process");
|
|
84265
84267
|
import_node_util13 = require("node:util");
|
|
84266
84268
|
import_node_os5 = require("node:os");
|
|
84267
84269
|
import_node_path9 = require("node:path");
|
|
@@ -84270,7 +84272,7 @@ var init_adb = __esm({
|
|
|
84270
84272
|
init_android_binary();
|
|
84271
84273
|
init_subprocess_error();
|
|
84272
84274
|
init_external_devices();
|
|
84273
|
-
execFileAsync13 = (0, import_node_util13.promisify)(
|
|
84275
|
+
execFileAsync13 = (0, import_node_util13.promisify)(import_node_child_process16.execFile);
|
|
84274
84276
|
emulatorFlagSupportCache = /* @__PURE__ */ new Map();
|
|
84275
84277
|
ADB_KILL_SIGNAL = "SIGKILL";
|
|
84276
84278
|
ADB_DEVICE_STATES = /* @__PURE__ */ new Set([
|
|
@@ -102013,7 +102015,6 @@ function createIdleTimer(timeoutMs, onIdle) {
|
|
|
102013
102015
|
}
|
|
102014
102016
|
|
|
102015
102017
|
// ../tool-server/src/utils/check-deps.ts
|
|
102016
|
-
init_src2();
|
|
102017
102018
|
init_android_binary();
|
|
102018
102019
|
|
|
102019
102020
|
// ../tool-server/src/utils/vega-cli.ts
|
|
@@ -102633,6 +102634,135 @@ async function hdcFileRecv(connectKey, remotePath, localPath, timeoutMs = DEFAUL
|
|
|
102633
102634
|
|
|
102634
102635
|
// ../tool-server/src/utils/check-deps.ts
|
|
102635
102636
|
init_command_on_path();
|
|
102637
|
+
|
|
102638
|
+
// ../tool-server/src/utils/dependency-errors.ts
|
|
102639
|
+
init_src2();
|
|
102640
|
+
|
|
102641
|
+
// ../tool-server/src/utils/xcode-first-launch.ts
|
|
102642
|
+
var fs11 = __toESM(require("node:fs"));
|
|
102643
|
+
var path11 = __toESM(require("node:path"));
|
|
102644
|
+
var import_node_child_process7 = require("node:child_process");
|
|
102645
|
+
var WRAPPER_DEVICES = {
|
|
102646
|
+
simctl: "local iOS simulators",
|
|
102647
|
+
devicectl: "physical iPhones"
|
|
102648
|
+
};
|
|
102649
|
+
var BUNDLED_DEVELOPER_DIR = path11.join("/Contents", "Developer");
|
|
102650
|
+
function shellWord(word) {
|
|
102651
|
+
return /^[\w@%+=:,./-]+$/.test(word) ? word : `'${word.replaceAll("'", `'\\''`)}'`;
|
|
102652
|
+
}
|
|
102653
|
+
function activeXcode() {
|
|
102654
|
+
const developerDir2 = activeDeveloperDir();
|
|
102655
|
+
const xcode = developerDir2?.endsWith(BUNDLED_DEVELOPER_DIR) ? developerDir2.slice(0, -BUNDLED_DEVELOPER_DIR.length) : developerDir2;
|
|
102656
|
+
const xcodebuild = developerDir2 ? shellWord(path11.join(developerDir2, "usr", "bin", "xcodebuild")) : "xcodebuild";
|
|
102657
|
+
return { xcode, xcodebuild };
|
|
102658
|
+
}
|
|
102659
|
+
function xcodeInstallInstruction() {
|
|
102660
|
+
const { xcode, xcodebuild } = activeXcode();
|
|
102661
|
+
return `open ${xcode ? `the Xcode at ${xcode}` : "Xcode"} once, or run \`sudo ${xcodebuild} -runFirstLaunch\``;
|
|
102662
|
+
}
|
|
102663
|
+
function xcodeFirstLaunchHint(wrappers) {
|
|
102664
|
+
const { xcode, xcodebuild } = activeXcode();
|
|
102665
|
+
const names = wrappers.map((wrapper) => `\`${wrapper}\``);
|
|
102666
|
+
const commands = wrappers.map((wrapper) => `\`xcrun ${wrapper}\``);
|
|
102667
|
+
return (xcode ? `The Xcode at ${xcode}` : "Xcode") + ` has not finished installing its system components since it was installed or updated. Until it has, Xcode's ${names.join(" and ")} ${wrappers.length === 1 ? "waits" : "wait"} for an administrator password on every call, so \`list-devices\` does not show ${wrappers.map((wrapper) => WRAPPER_DEVICES[wrapper]).join(" or ")}. Tools that need ${names.join(" or ")} fail until then. Ask the user to open ${xcode ? "that Xcode" : "Xcode"} once and let it install the components, or to run \`sudo ${xcodebuild} -runFirstLaunch\`, then retry. Do not run that command${commands.length === 1 ? " or " : ", "}${commands.join(" or ")} yourself.`;
|
|
102668
|
+
}
|
|
102669
|
+
var XCODE_LOCATIONS = {
|
|
102670
|
+
/** What `xcode-select -s` writes. */
|
|
102671
|
+
selectLink: "/var/db/xcode_select_link",
|
|
102672
|
+
/** What `xcode-select -p` answers without the link. */
|
|
102673
|
+
defaultDeveloperDir: "/Applications/Xcode.app/Contents/Developer"
|
|
102674
|
+
};
|
|
102675
|
+
var locations = XCODE_LOCATIONS;
|
|
102676
|
+
function activeDeveloperDir() {
|
|
102677
|
+
let dir = process.env.DEVELOPER_DIR || null;
|
|
102678
|
+
if (!dir) {
|
|
102679
|
+
try {
|
|
102680
|
+
dir = fs11.readlinkSync(locations.selectLink);
|
|
102681
|
+
} catch {
|
|
102682
|
+
dir = fs11.existsSync(locations.defaultDeveloperDir) ? locations.defaultDeveloperDir : null;
|
|
102683
|
+
}
|
|
102684
|
+
}
|
|
102685
|
+
if (!dir) return null;
|
|
102686
|
+
const bundled = [
|
|
102687
|
+
path11.resolve(dir, "Contents", "Developer"),
|
|
102688
|
+
path11.resolve(dir, "Xcode.app", "Contents", "Developer")
|
|
102689
|
+
].find(isDirectory);
|
|
102690
|
+
return bundled ?? path11.resolve(dir);
|
|
102691
|
+
}
|
|
102692
|
+
function isDirectory(file2) {
|
|
102693
|
+
try {
|
|
102694
|
+
return fs11.statSync(file2).isDirectory();
|
|
102695
|
+
} catch {
|
|
102696
|
+
return false;
|
|
102697
|
+
}
|
|
102698
|
+
}
|
|
102699
|
+
var INSTALL_CALL = /^[ \t]*"\$\{DEVELOPER_DIR\}\/usr\/bin\/xcodebuild" -runFirstLaunch\b/m;
|
|
102700
|
+
var OLDER_RULE = /version_is_older "\$\{CURRENT_VERSION\}" "\$\{EXPECTED_VERSION\}"/;
|
|
102701
|
+
var DIFFERENT_RULE = /\[\[ "\$\{EXPECTED_VERSION\}" != "\$\{CURRENT_VERSION\}" \]\]/;
|
|
102702
|
+
function parseWrapper(file2) {
|
|
102703
|
+
let text;
|
|
102704
|
+
try {
|
|
102705
|
+
text = fs11.readFileSync(file2, "utf8");
|
|
102706
|
+
} catch {
|
|
102707
|
+
return null;
|
|
102708
|
+
}
|
|
102709
|
+
const expected = /^EXPECTED_VERSION="([^"$]+)"$/m.exec(text)?.[1];
|
|
102710
|
+
const plistPath = /Print :CFBundleVersion" "(\/[^"$]+)"/.exec(text)?.[1];
|
|
102711
|
+
const rule = OLDER_RULE.test(text) ? "older" : DIFFERENT_RULE.test(text) ? "different" : null;
|
|
102712
|
+
if (!expected || !plistPath || !rule || !INSTALL_CALL.test(text)) return null;
|
|
102713
|
+
return { expected, plistPath, rule };
|
|
102714
|
+
}
|
|
102715
|
+
function readBundleVersion(plistPath) {
|
|
102716
|
+
let data;
|
|
102717
|
+
try {
|
|
102718
|
+
data = fs11.readFileSync(plistPath);
|
|
102719
|
+
} catch (err) {
|
|
102720
|
+
return err.code === "ENOENT" ? "missing" : null;
|
|
102721
|
+
}
|
|
102722
|
+
if (data.toString("latin1", 0, 6) === "bplist") return readBinaryPlistVersion(plistPath);
|
|
102723
|
+
const text = data.toString("utf8");
|
|
102724
|
+
return /<key>CFBundleVersion<\/key>\s*<string>([^<]+)<\/string>/.exec(text)?.[1] ?? null;
|
|
102725
|
+
}
|
|
102726
|
+
var PLUTIL_TIMEOUT_MS = 1e3;
|
|
102727
|
+
function readBinaryPlistVersion(plistPath) {
|
|
102728
|
+
try {
|
|
102729
|
+
const version3 = (0, import_node_child_process7.execFileSync)(
|
|
102730
|
+
"/usr/bin/plutil",
|
|
102731
|
+
["-extract", "CFBundleVersion", "raw", "-o", "-", plistPath],
|
|
102732
|
+
{
|
|
102733
|
+
encoding: "utf8",
|
|
102734
|
+
timeout: PLUTIL_TIMEOUT_MS,
|
|
102735
|
+
killSignal: "SIGKILL",
|
|
102736
|
+
stdio: ["ignore", "pipe", "ignore"]
|
|
102737
|
+
}
|
|
102738
|
+
);
|
|
102739
|
+
return version3.trim() || null;
|
|
102740
|
+
} catch {
|
|
102741
|
+
return null;
|
|
102742
|
+
}
|
|
102743
|
+
}
|
|
102744
|
+
function isOlder(a, b) {
|
|
102745
|
+
if (![a, b].every((version3) => /^\d+(\.\d+)*$/.test(version3))) return false;
|
|
102746
|
+
const x = a.split(".").map(Number);
|
|
102747
|
+
const y = b.split(".").map(Number);
|
|
102748
|
+
for (let i = 0; i < Math.max(x.length, y.length); i++) {
|
|
102749
|
+
const d = (x[i] ?? 0) - (y[i] ?? 0);
|
|
102750
|
+
if (d !== 0) return d < 0;
|
|
102751
|
+
}
|
|
102752
|
+
return false;
|
|
102753
|
+
}
|
|
102754
|
+
function xcodeFirstLaunchPending(wrapper) {
|
|
102755
|
+
if (process.platform !== "darwin") return false;
|
|
102756
|
+
const devDir = activeDeveloperDir();
|
|
102757
|
+
if (!devDir) return false;
|
|
102758
|
+
const check3 = parseWrapper(path11.join(devDir, "usr", "bin", wrapper));
|
|
102759
|
+
if (!check3) return false;
|
|
102760
|
+
const installed = readBundleVersion(check3.plistPath);
|
|
102761
|
+
if (installed === null) return false;
|
|
102762
|
+
return installed === "missing" ? check3.rule === "different" : isOlder(installed, check3.expected);
|
|
102763
|
+
}
|
|
102764
|
+
|
|
102765
|
+
// ../tool-server/src/utils/dependency-errors.ts
|
|
102636
102766
|
var DependencyMissingError = class extends Error {
|
|
102637
102767
|
missing;
|
|
102638
102768
|
constructor(missing, message) {
|
|
@@ -102647,6 +102777,23 @@ var DependencyMissingError = class extends Error {
|
|
|
102647
102777
|
});
|
|
102648
102778
|
}
|
|
102649
102779
|
};
|
|
102780
|
+
var XcodeFirstLaunchPendingError = class extends DependencyMissingError {
|
|
102781
|
+
constructor(wrapper) {
|
|
102782
|
+
super(["xcrun"], xcodeFirstLaunchHint([wrapper]));
|
|
102783
|
+
this.name = "XcodeFirstLaunchPendingError";
|
|
102784
|
+
withFailureSignal(this, {
|
|
102785
|
+
error_code: FAILURE_CODES.TOOL_XCODE_FIRST_LAUNCH_PENDING,
|
|
102786
|
+
failure_stage: "xcode_first_launch_check",
|
|
102787
|
+
failure_area: "tool_server",
|
|
102788
|
+
error_kind: "dependency_missing"
|
|
102789
|
+
});
|
|
102790
|
+
}
|
|
102791
|
+
};
|
|
102792
|
+
function assertXcodeFirstLaunchDone(wrapper) {
|
|
102793
|
+
if (xcodeFirstLaunchPending(wrapper)) throw new XcodeFirstLaunchPendingError(wrapper);
|
|
102794
|
+
}
|
|
102795
|
+
|
|
102796
|
+
// ../tool-server/src/utils/check-deps.ts
|
|
102650
102797
|
var CACHE_TTL_MS2 = 6e4;
|
|
102651
102798
|
var cache3 = /* @__PURE__ */ new Map();
|
|
102652
102799
|
var INSTALL_HINTS = {
|
|
@@ -102916,10 +103063,10 @@ function buildScreenRecordingNote(recordings2, nowMs) {
|
|
|
102916
103063
|
}
|
|
102917
103064
|
|
|
102918
103065
|
// ../tool-server/src/utils/ios-device/team-detect.ts
|
|
102919
|
-
var
|
|
103066
|
+
var import_node_child_process8 = require("node:child_process");
|
|
102920
103067
|
var import_node_util6 = require("node:util");
|
|
102921
103068
|
var import_node_crypto5 = require("node:crypto");
|
|
102922
|
-
var execFileAsync6 = (0, import_node_util6.promisify)(
|
|
103069
|
+
var execFileAsync6 = (0, import_node_util6.promisify)(import_node_child_process8.execFile);
|
|
102923
103070
|
var SIGNING_CERT_COMMON_NAMES = ["Apple Development", "iPhone Developer"];
|
|
102924
103071
|
var SECURITY_TIMEOUT_MS = 15e3;
|
|
102925
103072
|
async function listCertificatePem(commonName) {
|
|
@@ -103064,14 +103211,14 @@ var import_express = __toESM(require_express2());
|
|
|
103064
103211
|
init_src();
|
|
103065
103212
|
|
|
103066
103213
|
// ../tool-server/src/blueprints/simulator-server.ts
|
|
103067
|
-
var
|
|
103214
|
+
var import_node_child_process15 = require("node:child_process");
|
|
103068
103215
|
var readline = __toESM(require("node:readline"));
|
|
103069
103216
|
init_src2();
|
|
103070
103217
|
init_src();
|
|
103071
103218
|
|
|
103072
103219
|
// ../tool-server/src/blueprints/ax-service.ts
|
|
103073
103220
|
var net = __toESM(require("node:net"));
|
|
103074
|
-
var
|
|
103221
|
+
var fs17 = __toESM(require("node:fs"));
|
|
103075
103222
|
|
|
103076
103223
|
// ../tool-server/src/utils/ndjson-socket.ts
|
|
103077
103224
|
init_src2();
|
|
@@ -103220,10 +103367,10 @@ init_src2();
|
|
|
103220
103367
|
init_external_devices();
|
|
103221
103368
|
|
|
103222
103369
|
// ../tool-server/src/utils/ios-host.ts
|
|
103223
|
-
var
|
|
103370
|
+
var import_node_child_process13 = require("node:child_process");
|
|
103224
103371
|
var import_node_events = require("node:events");
|
|
103225
|
-
var
|
|
103226
|
-
var
|
|
103372
|
+
var fs16 = __toESM(require("node:fs"));
|
|
103373
|
+
var path16 = __toESM(require("node:path"));
|
|
103227
103374
|
var import_node_util11 = require("node:util");
|
|
103228
103375
|
|
|
103229
103376
|
// ../tool-server/src/utils/simctl-config.ts
|
|
@@ -103231,13 +103378,13 @@ var SIMCTL_SPAWN_TIMEOUT_MS = 1e4;
|
|
|
103231
103378
|
var SIMCTL_KILL_SIGNAL = "SIGKILL";
|
|
103232
103379
|
|
|
103233
103380
|
// ../tool-server/src/utils/ios-device-sets.ts
|
|
103234
|
-
var
|
|
103235
|
-
var
|
|
103381
|
+
var fs14 = __toESM(require("node:fs"));
|
|
103382
|
+
var import_node_child_process9 = require("node:child_process");
|
|
103236
103383
|
var import_node_util7 = require("node:util");
|
|
103237
103384
|
init_src2();
|
|
103238
103385
|
init_src();
|
|
103239
103386
|
init_external_devices();
|
|
103240
|
-
var execFileAsync7 = (0, import_node_util7.promisify)(
|
|
103387
|
+
var execFileAsync7 = (0, import_node_util7.promisify)(import_node_child_process9.execFile);
|
|
103241
103388
|
var deviceSetByUdid = /* @__PURE__ */ new Map();
|
|
103242
103389
|
function configuredAdditionalDeviceSets() {
|
|
103243
103390
|
try {
|
|
@@ -103250,7 +103397,7 @@ function rememberDeviceSet(udid, deviceSet) {
|
|
|
103250
103397
|
deviceSetByUdid.set(udid, deviceSet);
|
|
103251
103398
|
}
|
|
103252
103399
|
async function setContainsUdid(deviceSet, udid) {
|
|
103253
|
-
if (deviceSet && !
|
|
103400
|
+
if (deviceSet && !fs14.existsSync(deviceSet)) return false;
|
|
103254
103401
|
try {
|
|
103255
103402
|
const { stdout } = await execFileAsync7(
|
|
103256
103403
|
"xcrun",
|
|
@@ -103288,6 +103435,7 @@ function externalDeviceSet(udid) {
|
|
|
103288
103435
|
return claim2 ? claim2.deviceSet ?? null : void 0;
|
|
103289
103436
|
}
|
|
103290
103437
|
function simctlPrefix(deviceSet) {
|
|
103438
|
+
assertXcodeFirstLaunchDone("simctl");
|
|
103291
103439
|
return deviceSet ? ["simctl", "--set", deviceSet] : ["simctl"];
|
|
103292
103440
|
}
|
|
103293
103441
|
async function simctlArgsForUdid(udid, args, options) {
|
|
@@ -103331,15 +103479,15 @@ function nativeArgs(udid, args) {
|
|
|
103331
103479
|
}
|
|
103332
103480
|
|
|
103333
103481
|
// ../tool-server/src/utils/ios-devices.ts
|
|
103334
|
-
var
|
|
103335
|
-
var
|
|
103336
|
-
var
|
|
103482
|
+
var fs15 = __toESM(require("node:fs"));
|
|
103483
|
+
var path14 = __toESM(require("node:path"));
|
|
103484
|
+
var import_node_child_process10 = require("node:child_process");
|
|
103337
103485
|
var import_node_util8 = require("node:util");
|
|
103338
103486
|
init_external_devices();
|
|
103339
103487
|
init_device_info();
|
|
103340
|
-
var execFileAsync8 = (0, import_node_util8.promisify)(
|
|
103488
|
+
var execFileAsync8 = (0, import_node_util8.promisify)(import_node_child_process10.execFile);
|
|
103341
103489
|
async function listDeviceSetSimulators(deviceSet) {
|
|
103342
|
-
if (deviceSet && !
|
|
103490
|
+
if (deviceSet && !fs15.existsSync(deviceSet)) return [];
|
|
103343
103491
|
try {
|
|
103344
103492
|
const { stdout } = await execFileAsync8(
|
|
103345
103493
|
"xcrun",
|
|
@@ -103374,7 +103522,8 @@ async function listDeviceSetSimulators(deviceSet) {
|
|
|
103374
103522
|
})
|
|
103375
103523
|
);
|
|
103376
103524
|
return out;
|
|
103377
|
-
} catch {
|
|
103525
|
+
} catch (err) {
|
|
103526
|
+
if (err instanceof XcodeFirstLaunchPendingError) throw err;
|
|
103378
103527
|
return [];
|
|
103379
103528
|
}
|
|
103380
103529
|
}
|
|
@@ -103420,10 +103569,11 @@ var deviceTypeBundlePaths = null;
|
|
|
103420
103569
|
var foldableCache = /* @__PURE__ */ new Map();
|
|
103421
103570
|
async function listDeviceTypeBundlePaths() {
|
|
103422
103571
|
try {
|
|
103423
|
-
const { stdout } = await execFileAsync8(
|
|
103424
|
-
|
|
103425
|
-
|
|
103426
|
-
|
|
103572
|
+
const { stdout } = await execFileAsync8(
|
|
103573
|
+
"xcrun",
|
|
103574
|
+
[...simctlPrefix(null), "list", "devicetypes", "--json"],
|
|
103575
|
+
{ timeout: 1e4, killSignal: SIMCTL_KILL_SIGNAL }
|
|
103576
|
+
);
|
|
103427
103577
|
const data = JSON.parse(stdout);
|
|
103428
103578
|
const out = /* @__PURE__ */ new Map();
|
|
103429
103579
|
for (const t of data.devicetypes ?? []) {
|
|
@@ -103445,8 +103595,8 @@ async function deviceTypeBundlePath(identifier) {
|
|
|
103445
103595
|
return paths.get(identifier);
|
|
103446
103596
|
}
|
|
103447
103597
|
async function countIntegratedDisplays(bundlePath) {
|
|
103448
|
-
const plist =
|
|
103449
|
-
if (!
|
|
103598
|
+
const plist = path14.join(bundlePath, "Contents", "Resources", "capabilities.plist");
|
|
103599
|
+
if (!fs15.existsSync(plist)) return 0;
|
|
103450
103600
|
try {
|
|
103451
103601
|
const { stdout } = await execFileAsync8(
|
|
103452
103602
|
"plutil",
|
|
@@ -103482,10 +103632,10 @@ async function isFoldableSimulator(udid) {
|
|
|
103482
103632
|
// ../tool-server/src/utils/ax-prefs.ts
|
|
103483
103633
|
var fsAsync = __toESM(require("node:fs/promises"));
|
|
103484
103634
|
var os4 = __toESM(require("node:os"));
|
|
103485
|
-
var
|
|
103486
|
-
var
|
|
103635
|
+
var path15 = __toESM(require("node:path"));
|
|
103636
|
+
var import_node_child_process11 = require("node:child_process");
|
|
103487
103637
|
var import_node_util9 = require("node:util");
|
|
103488
|
-
var execFileAsync9 = (0, import_node_util9.promisify)(
|
|
103638
|
+
var execFileAsync9 = (0, import_node_util9.promisify)(import_node_child_process11.execFile);
|
|
103489
103639
|
async function ensureAutomationEnabled(udid) {
|
|
103490
103640
|
await execFileAsync9(
|
|
103491
103641
|
"xcrun",
|
|
@@ -103535,12 +103685,12 @@ async function isEntitlementBypassActive(udid) {
|
|
|
103535
103685
|
}
|
|
103536
103686
|
}
|
|
103537
103687
|
async function accessibilityPlistPath(udid) {
|
|
103538
|
-
const deviceSet = await deviceSetForUdid(udid) ??
|
|
103539
|
-
return
|
|
103688
|
+
const deviceSet = await deviceSetForUdid(udid) ?? path15.join(os4.homedir(), "Library/Developer/CoreSimulator/Devices");
|
|
103689
|
+
return path15.join(deviceSet, udid, "data/Library/Preferences/com.apple.Accessibility.plist");
|
|
103540
103690
|
}
|
|
103541
103691
|
async function setAccessibilityPrefsPreBoot(udid) {
|
|
103542
103692
|
const plistPath = await accessibilityPlistPath(udid);
|
|
103543
|
-
await fsAsync.mkdir(
|
|
103693
|
+
await fsAsync.mkdir(path15.dirname(plistPath), { recursive: true });
|
|
103544
103694
|
const exists3 = await fsAsync.access(plistPath).then(() => true).catch(() => false);
|
|
103545
103695
|
if (!exists3) {
|
|
103546
103696
|
await execFileAsync9("plutil", ["-create", "binary1", plistPath]);
|
|
@@ -103556,10 +103706,10 @@ async function setAccessibilityPrefsPreBoot(udid) {
|
|
|
103556
103706
|
}
|
|
103557
103707
|
|
|
103558
103708
|
// ../tool-server/src/utils/sim-remote.ts
|
|
103559
|
-
var
|
|
103709
|
+
var import_node_child_process12 = require("node:child_process");
|
|
103560
103710
|
var import_node_util10 = require("node:util");
|
|
103561
103711
|
init_device_info();
|
|
103562
|
-
var execFileAsync10 = (0, import_node_util10.promisify)(
|
|
103712
|
+
var execFileAsync10 = (0, import_node_util10.promisify)(import_node_child_process12.execFile);
|
|
103563
103713
|
var DEFAULT_TIMEOUT_MS2 = 3e4;
|
|
103564
103714
|
async function run(args, options) {
|
|
103565
103715
|
try {
|
|
@@ -103733,7 +103883,7 @@ async function moqInfo(udid) {
|
|
|
103733
103883
|
}
|
|
103734
103884
|
|
|
103735
103885
|
// ../tool-server/src/utils/ios-host.ts
|
|
103736
|
-
var execFileAsync11 = (0, import_node_util11.promisify)(
|
|
103886
|
+
var execFileAsync11 = (0, import_node_util11.promisify)(import_node_child_process13.execFile);
|
|
103737
103887
|
var ARGENT_BOOTSTRAP_DYLIB_BASENAMES = /* @__PURE__ */ new Set(["libArgentInjectionBootstrap.dylib"]);
|
|
103738
103888
|
var RECOGNISED_BOOTSTRAP_DYLIB_BASENAMES = /* @__PURE__ */ new Set([
|
|
103739
103889
|
...ARGENT_BOOTSTRAP_DYLIB_BASENAMES,
|
|
@@ -103759,13 +103909,13 @@ function shouldPreserveDyldInsertLibrariesEntry(entry, bootstrapPath) {
|
|
|
103759
103909
|
if (entry === bootstrapPath) {
|
|
103760
103910
|
return false;
|
|
103761
103911
|
}
|
|
103762
|
-
if (ARGENT_BOOTSTRAP_DYLIB_BASENAMES.has(
|
|
103912
|
+
if (ARGENT_BOOTSTRAP_DYLIB_BASENAMES.has(path16.basename(entry))) {
|
|
103763
103913
|
return false;
|
|
103764
103914
|
}
|
|
103765
103915
|
if (entry.startsWith("@")) {
|
|
103766
103916
|
return true;
|
|
103767
103917
|
}
|
|
103768
|
-
return
|
|
103918
|
+
return fs16.existsSync(entry);
|
|
103769
103919
|
}
|
|
103770
103920
|
function preservedDyldInsertLibraries(currentValue, bootstrapPath) {
|
|
103771
103921
|
return splitDyldInsertLibraries(currentValue).filter(
|
|
@@ -103964,7 +104114,7 @@ function spawnAxDaemonLocal(udid, endpoint) {
|
|
|
103964
104114
|
}
|
|
103965
104115
|
const endpointArgs = endpoint.transport === "tcp" ? ["--port", String(endpoint.port)] : ["--socket", endpoint.socketPath];
|
|
103966
104116
|
const axTarget = simctlTargetForUdidSync(udid, { granted: "ax-service" });
|
|
103967
|
-
const proc = (0,
|
|
104117
|
+
const proc = (0, import_node_child_process13.execFile)(
|
|
103968
104118
|
"xcrun",
|
|
103969
104119
|
[
|
|
103970
104120
|
...axTarget.prefix,
|
|
@@ -104081,7 +104231,7 @@ function startListener(endpoint, onConnection) {
|
|
|
104081
104231
|
return new Promise((resolve17, reject) => {
|
|
104082
104232
|
if (endpoint.transport === "unix") {
|
|
104083
104233
|
try {
|
|
104084
|
-
|
|
104234
|
+
fs17.unlinkSync(endpoint.socketPath);
|
|
104085
104235
|
} catch {
|
|
104086
104236
|
}
|
|
104087
104237
|
}
|
|
@@ -104315,7 +104465,7 @@ var axServiceBlueprint = {
|
|
|
104315
104465
|
server.close();
|
|
104316
104466
|
if (endpoint.transport === "unix") {
|
|
104317
104467
|
try {
|
|
104318
|
-
|
|
104468
|
+
fs17.unlinkSync(endpoint.socketPath);
|
|
104319
104469
|
} catch {
|
|
104320
104470
|
}
|
|
104321
104471
|
}
|
|
@@ -104480,7 +104630,7 @@ var axServiceBlueprint = {
|
|
|
104480
104630
|
server.close();
|
|
104481
104631
|
if (endpoint.transport === "unix") {
|
|
104482
104632
|
try {
|
|
104483
|
-
|
|
104633
|
+
fs17.unlinkSync(endpoint.socketPath);
|
|
104484
104634
|
} catch {
|
|
104485
104635
|
}
|
|
104486
104636
|
}
|
|
@@ -105252,11 +105402,11 @@ __export(path_exports, {
|
|
|
105252
105402
|
encode: () => encode3,
|
|
105253
105403
|
from: () => from,
|
|
105254
105404
|
hasPrefix: () => hasPrefix,
|
|
105255
|
-
join: () =>
|
|
105405
|
+
join: () => join17,
|
|
105256
105406
|
normalizeRelative: () => normalizeRelative,
|
|
105257
105407
|
parts: () => parts,
|
|
105258
105408
|
relative: () => relative,
|
|
105259
|
-
resolve: () =>
|
|
105409
|
+
resolve: () => resolve7,
|
|
105260
105410
|
stripPrefix: () => stripPrefix,
|
|
105261
105411
|
tryResolve: () => tryResolve
|
|
105262
105412
|
});
|
|
@@ -105302,7 +105452,7 @@ function stripPrefix(prefix, path58) {
|
|
|
105302
105452
|
}
|
|
105303
105453
|
return path58.slice(prefix.length + 1);
|
|
105304
105454
|
}
|
|
105305
|
-
function
|
|
105455
|
+
function join17(path58, other) {
|
|
105306
105456
|
if (path58 === "") {
|
|
105307
105457
|
return other;
|
|
105308
105458
|
} else if (other === "") {
|
|
@@ -105319,7 +105469,7 @@ function normalizeRelative(rel) {
|
|
|
105319
105469
|
const normalized = raw.filter((s) => s !== "" && s !== ".").join("/");
|
|
105320
105470
|
return normalized === "" && raw.includes(".") ? "." : normalized;
|
|
105321
105471
|
}
|
|
105322
|
-
function
|
|
105472
|
+
function resolve7(base, rel) {
|
|
105323
105473
|
if (rel === "")
|
|
105324
105474
|
return base;
|
|
105325
105475
|
const segments = base === "" ? [] : base.split("/");
|
|
@@ -114069,7 +114219,7 @@ var Publisher = class {
|
|
|
114069
114219
|
}
|
|
114070
114220
|
const advertise2 = async (suffix) => {
|
|
114071
114221
|
if (legacy) {
|
|
114072
|
-
return await this.#advertise(
|
|
114222
|
+
return await this.#advertise(join17(prefix, suffix), requests, refused);
|
|
114073
114223
|
}
|
|
114074
114224
|
await stream.writer.u53(SubscribeNamespaceEntry.id);
|
|
114075
114225
|
await new SubscribeNamespaceEntry({ suffix, cluster: this.#advert }).encode(stream.writer, version3);
|
|
@@ -114077,7 +114227,7 @@ var Publisher = class {
|
|
|
114077
114227
|
};
|
|
114078
114228
|
const withdraw = async (suffix) => {
|
|
114079
114229
|
if (legacy) {
|
|
114080
|
-
await this.#withdraw(
|
|
114230
|
+
await this.#withdraw(join17(prefix, suffix), requests);
|
|
114081
114231
|
} else {
|
|
114082
114232
|
await stream.writer.u53(SubscribeNamespaceEntryDone.id);
|
|
114083
114233
|
await new SubscribeNamespaceEntryDone({ suffix }).encode(stream.writer, version3);
|
|
@@ -114103,7 +114253,7 @@ var Publisher = class {
|
|
|
114103
114253
|
continue;
|
|
114104
114254
|
updated.set(suffix, producer);
|
|
114105
114255
|
}
|
|
114106
|
-
const live = new Set([...updated.keys()].map((suffix) =>
|
|
114256
|
+
const live = new Set([...updated.keys()].map((suffix) => join17(prefix, suffix)));
|
|
114107
114257
|
for (const path58 of [...refused.keys()]) {
|
|
114108
114258
|
if (!live.has(path58))
|
|
114109
114259
|
refused.delete(path58);
|
|
@@ -114118,13 +114268,13 @@ var Publisher = class {
|
|
|
114118
114268
|
for (const [suffix, producer] of updated) {
|
|
114119
114269
|
if (active.get(suffix) === producer)
|
|
114120
114270
|
continue;
|
|
114121
|
-
if (this.#offerable(
|
|
114271
|
+
if (this.#offerable(join17(prefix, suffix), refused)) {
|
|
114122
114272
|
if (await advertise2(suffix))
|
|
114123
114273
|
held.set(suffix, producer);
|
|
114124
114274
|
}
|
|
114125
114275
|
}
|
|
114126
114276
|
active = held;
|
|
114127
|
-
const outstanding = [...updated].some(([suffix, producer]) => active.get(suffix) !== producer && this.#pending(
|
|
114277
|
+
const outstanding = [...updated].some(([suffix, producer]) => active.get(suffix) !== producer && this.#pending(join17(prefix, suffix), refused));
|
|
114128
114278
|
retry = outstanding ? Math.min(retry ? retry * 2 : RETRY_BASE, RETRY_MAX) : 0;
|
|
114129
114279
|
const next = await (retry ? Promise.race([changed, stream.reader.closed, retryAfter(retry).then(() => broadcasts)]) : Promise.race([changed, stream.reader.closed]));
|
|
114130
114280
|
dispose();
|
|
@@ -114770,7 +114920,7 @@ var Subscriber2 = class {
|
|
|
114770
114920
|
const entry = await SubscribeNamespaceEntry.decode(stream.reader, version3, negotiated(this.#cluster));
|
|
114771
114921
|
if (released)
|
|
114772
114922
|
break;
|
|
114773
|
-
const path58 =
|
|
114923
|
+
const path58 = join17(prefix, entry.suffix);
|
|
114774
114924
|
if (this.#reflected(entry.cluster)) {
|
|
114775
114925
|
console.debug(`dropping reflected namespace: broadcast=${path58}`);
|
|
114776
114926
|
if (live.delete(path58))
|
|
@@ -114785,7 +114935,7 @@ var Subscriber2 = class {
|
|
|
114785
114935
|
const entry = await SubscribeNamespaceEntryDone.decode(stream.reader, version3);
|
|
114786
114936
|
if (released)
|
|
114787
114937
|
break;
|
|
114788
|
-
const path58 =
|
|
114938
|
+
const path58 = join17(prefix, entry.suffix);
|
|
114789
114939
|
if (live.delete(path58)) {
|
|
114790
114940
|
this.#detachAnnounce(path58);
|
|
114791
114941
|
}
|
|
@@ -117580,7 +117730,7 @@ var Subscriber3 = class {
|
|
|
117580
117730
|
case Version2.DRAFT_02: {
|
|
117581
117731
|
const init2 = await AnnounceInit.decode(stream.reader, this.version);
|
|
117582
117732
|
for (const suffix of init2.suffixes) {
|
|
117583
|
-
const path58 =
|
|
117733
|
+
const path58 = join17(prefix, suffix);
|
|
117584
117734
|
if (advertised.has(suffix)) {
|
|
117585
117735
|
throw new ProtocolViolation(`duplicate announce for ${path58}`);
|
|
117586
117736
|
}
|
|
@@ -117639,7 +117789,7 @@ var Subscriber3 = class {
|
|
|
117639
117789
|
break;
|
|
117640
117790
|
}
|
|
117641
117791
|
}
|
|
117642
|
-
const path58 =
|
|
117792
|
+
const path58 = join17(prefix, suffix);
|
|
117643
117793
|
const duplicateIsRestart = restartSupported(this.version) && !hasAnnounceId(this.version);
|
|
117644
117794
|
if (announce.status === "active" && !duplicateIsRestart && advertised.has(suffix)) {
|
|
117645
117795
|
throw new ProtocolViolation(`duplicate announce for ${path58}`);
|
|
@@ -122630,11 +122780,11 @@ function captureOnDemandDropped(deviceId, endpoint) {
|
|
|
122630
122780
|
}
|
|
122631
122781
|
|
|
122632
122782
|
// ../tool-server/src/utils/foldable.ts
|
|
122633
|
-
var
|
|
122634
|
-
var
|
|
122783
|
+
var import_node_child_process14 = require("node:child_process");
|
|
122784
|
+
var fs18 = __toESM(require("node:fs"));
|
|
122635
122785
|
var import_node_util12 = require("node:util");
|
|
122636
122786
|
init_external_devices();
|
|
122637
|
-
var execFileAsync12 = (0, import_node_util12.promisify)(
|
|
122787
|
+
var execFileAsync12 = (0, import_node_util12.promisify)(import_node_child_process14.execFile);
|
|
122638
122788
|
var MAIN_SCREEN_ID = 1;
|
|
122639
122789
|
var AX_LIVE_PANEL_TIMEOUT_MS = 2e3;
|
|
122640
122790
|
var DEVICECTL_TIMEOUT_MS = 5e3;
|
|
@@ -122710,7 +122860,13 @@ async function readCoreDeviceDisplays(udid) {
|
|
|
122710
122860
|
const args = ["device", "info", "displays", "--device", nativeUdid, "--json-output", "-"];
|
|
122711
122861
|
const dir = await developerDir();
|
|
122712
122862
|
const env = dir ? { ...process.env, DEVELOPER_DIR: dir } : process.env;
|
|
122713
|
-
const [bin, argv] =
|
|
122863
|
+
const [bin, argv] = fs18.existsSync(DEVICECTL_BIN) ? [DEVICECTL_BIN, args] : ["xcrun", ["devicectl", ...args]];
|
|
122864
|
+
if (bin === "xcrun" && xcodeFirstLaunchPending("devicectl")) {
|
|
122865
|
+
return {
|
|
122866
|
+
displays: null,
|
|
122867
|
+
reason: "Xcode has not finished installing its components, so devicectl would wait for an administrator password"
|
|
122868
|
+
};
|
|
122869
|
+
}
|
|
122714
122870
|
let stdout;
|
|
122715
122871
|
try {
|
|
122716
122872
|
({ stdout } = await execFileAsync12(bin, argv, {
|
|
@@ -122847,7 +123003,11 @@ function postureForSize(size, panels) {
|
|
|
122847
123003
|
return panel.screenId === MAIN_SCREEN_ID ? "the cover panel (closed)" : "the inner panel (half-open or open)";
|
|
122848
123004
|
}
|
|
122849
123005
|
async function foldablePostureHint(udid, expected, actual) {
|
|
122850
|
-
|
|
123006
|
+
const foldable = await isFoldableSimulator(udid).catch((err) => {
|
|
123007
|
+
if (err instanceof XcodeFirstLaunchPendingError) return false;
|
|
123008
|
+
throw err;
|
|
123009
|
+
});
|
|
123010
|
+
if (!foldable) return void 0;
|
|
122851
123011
|
const panels = (await readCoreDeviceDisplays(udid)).displays?.panels;
|
|
122852
123012
|
const base = "This simulator is foldable: a baseline belongs to the posture that produced it, and the cover and inner panels differ in size, so a capture in another posture can never match.";
|
|
122853
123013
|
if (!panels) return `${base} Take the baseline in the posture under test.`;
|
|
@@ -122858,8 +123018,8 @@ async function foldablePostureHint(udid, expected, actual) {
|
|
|
122858
123018
|
}
|
|
122859
123019
|
|
|
122860
123020
|
// ../tool-server/src/utils/simulator-client.ts
|
|
122861
|
-
var
|
|
122862
|
-
var
|
|
123021
|
+
var fs19 = __toESM(require("node:fs/promises"));
|
|
123022
|
+
var path17 = __toESM(require("node:path"));
|
|
122863
123023
|
var os5 = __toESM(require("node:os"));
|
|
122864
123024
|
var import_node_crypto6 = require("node:crypto");
|
|
122865
123025
|
var import_node_url = require("node:url");
|
|
@@ -123340,11 +123500,11 @@ function routeViaTransport(transport, cmd) {
|
|
|
123340
123500
|
}
|
|
123341
123501
|
}
|
|
123342
123502
|
function createMoqTransport(moq, options) {
|
|
123343
|
-
const screenshotDir =
|
|
123503
|
+
const screenshotDir = path17.join(os5.tmpdir(), "argent-remote-screenshots");
|
|
123344
123504
|
const writeScreenshotToDisk = async (bytes) => {
|
|
123345
|
-
await
|
|
123346
|
-
const file2 =
|
|
123347
|
-
await
|
|
123505
|
+
await fs19.mkdir(screenshotDir, { recursive: true });
|
|
123506
|
+
const file2 = path17.join(screenshotDir, `${(0, import_node_crypto6.randomUUID)()}.png`);
|
|
123507
|
+
await fs19.writeFile(file2, bytes);
|
|
123348
123508
|
return { url: (0, import_node_url.pathToFileURL)(file2).toString(), path: file2 };
|
|
123349
123509
|
};
|
|
123350
123510
|
return {
|
|
@@ -123510,7 +123670,7 @@ async function spawnSimulatorServerProcess(udid, subcommand) {
|
|
|
123510
123670
|
if (sdkRoot)
|
|
123511
123671
|
process.stderr.write(`[sim ${udid.slice(0, 8)}] android.sdkRoot \u2192 ANDROID_HOME=${sdkRoot}
|
|
123512
123672
|
`);
|
|
123513
|
-
const proc = (0,
|
|
123673
|
+
const proc = (0, import_node_child_process15.spawn)(BINARY_PATH, args, {
|
|
123514
123674
|
cwd: RUN_DIR,
|
|
123515
123675
|
stdio: ["pipe", "pipe", "pipe"],
|
|
123516
123676
|
...sdkRoot ? { env: { ...process.env, ANDROID_HOME: sdkRoot } } : {}
|
|
@@ -123786,11 +123946,11 @@ function classifyDeviceForTelemetry(deviceId) {
|
|
|
123786
123946
|
}
|
|
123787
123947
|
|
|
123788
123948
|
// ../tool-server/src/utils/device-shutdown.ts
|
|
123789
|
-
var
|
|
123949
|
+
var import_node_child_process17 = require("node:child_process");
|
|
123790
123950
|
var import_node_util14 = require("node:util");
|
|
123791
123951
|
init_device_info();
|
|
123792
123952
|
init_android_binary();
|
|
123793
|
-
var execFileAsync14 = (0, import_node_util14.promisify)(
|
|
123953
|
+
var execFileAsync14 = (0, import_node_util14.promisify)(import_node_child_process17.execFile);
|
|
123794
123954
|
var SHUTDOWN_EXEC_OPTIONS = { timeout: 3e4, killSignal: "SIGKILL" };
|
|
123795
123955
|
async function shutdownOwnedDevice(id) {
|
|
123796
123956
|
let platform;
|
|
@@ -123800,11 +123960,7 @@ async function shutdownOwnedDevice(id) {
|
|
|
123800
123960
|
return;
|
|
123801
123961
|
}
|
|
123802
123962
|
if (platform === "ios") {
|
|
123803
|
-
await execFileAsync14(
|
|
123804
|
-
"xcrun",
|
|
123805
|
-
await simctlArgsForUdid(id, ["shutdown", id]),
|
|
123806
|
-
SHUTDOWN_EXEC_OPTIONS
|
|
123807
|
-
).catch(() => {
|
|
123963
|
+
await simctlArgsForUdid(id, ["shutdown", id]).then((args) => execFileAsync14("xcrun", args, SHUTDOWN_EXEC_OPTIONS)).catch(() => {
|
|
123808
123964
|
});
|
|
123809
123965
|
} else if (platform === "android") {
|
|
123810
123966
|
const adb = await resolveAndroidBinary("adb") ?? "adb";
|
|
@@ -123944,11 +124100,11 @@ function adbCommandPrefix(env) {
|
|
|
123944
124100
|
}
|
|
123945
124101
|
|
|
123946
124102
|
// ../tool-server/src/utils/ios-device/devicectl.ts
|
|
123947
|
-
var
|
|
124103
|
+
var import_node_child_process18 = require("node:child_process");
|
|
123948
124104
|
var import_node_util15 = require("node:util");
|
|
123949
|
-
var
|
|
124105
|
+
var fs20 = __toESM(require("node:fs/promises"));
|
|
123950
124106
|
var os6 = __toESM(require("node:os"));
|
|
123951
|
-
var
|
|
124107
|
+
var path18 = __toESM(require("node:path"));
|
|
123952
124108
|
var import_node_crypto7 = require("node:crypto");
|
|
123953
124109
|
init_src2();
|
|
123954
124110
|
|
|
@@ -124208,7 +124364,7 @@ function invalidXmlError(detail) {
|
|
|
124208
124364
|
}
|
|
124209
124365
|
|
|
124210
124366
|
// ../tool-server/src/utils/ios-device/devicectl.ts
|
|
124211
|
-
var execFileAsync15 = (0, import_node_util15.promisify)(
|
|
124367
|
+
var execFileAsync15 = (0, import_node_util15.promisify)(import_node_child_process18.execFile);
|
|
124212
124368
|
var DEVICECTL_TIMEOUT_MS2 = 2e4;
|
|
124213
124369
|
var DEVICECTL_INSTALL_TIMEOUT_MS = 12e4;
|
|
124214
124370
|
var DEVICECTL_LIST_TIMEOUT_MS = 8e3;
|
|
@@ -124248,11 +124404,12 @@ function resolveDevicectlHint(output2, bundleId) {
|
|
|
124248
124404
|
return "Ensure the device is unlocked, trusted, and visible in Xcode > Devices, then retry.";
|
|
124249
124405
|
}
|
|
124250
124406
|
async function runDevicectl(args, action, opts = {}) {
|
|
124407
|
+
assertXcodeFirstLaunchDone("devicectl");
|
|
124251
124408
|
const timeoutMs = opts.timeoutMs ?? DEVICECTL_TIMEOUT_MS2;
|
|
124252
124409
|
let jsonPath = null;
|
|
124253
124410
|
const argv = ["devicectl", ...args];
|
|
124254
124411
|
if (opts.json) {
|
|
124255
|
-
jsonPath =
|
|
124412
|
+
jsonPath = path18.join(os6.tmpdir(), `argent-devicectl-${process.pid}-${(0, import_node_crypto7.randomUUID)()}.json`);
|
|
124256
124413
|
argv.push("--json-output", jsonPath);
|
|
124257
124414
|
}
|
|
124258
124415
|
try {
|
|
@@ -124264,7 +124421,7 @@ async function runDevicectl(args, action, opts = {}) {
|
|
|
124264
124421
|
let json2 = null;
|
|
124265
124422
|
if (jsonPath) {
|
|
124266
124423
|
try {
|
|
124267
|
-
json2 = JSON.parse(await
|
|
124424
|
+
json2 = JSON.parse(await fs20.readFile(jsonPath, "utf8"));
|
|
124268
124425
|
} catch {
|
|
124269
124426
|
json2 = null;
|
|
124270
124427
|
}
|
|
@@ -124276,7 +124433,7 @@ async function runDevicectl(args, action, opts = {}) {
|
|
|
124276
124433
|
let errorJson = null;
|
|
124277
124434
|
if (jsonPath) {
|
|
124278
124435
|
try {
|
|
124279
|
-
errorJson = JSON.parse(await
|
|
124436
|
+
errorJson = JSON.parse(await fs20.readFile(jsonPath, "utf8"));
|
|
124280
124437
|
} catch {
|
|
124281
124438
|
errorJson = null;
|
|
124282
124439
|
}
|
|
@@ -124295,7 +124452,7 @@ async function runDevicectl(args, action, opts = {}) {
|
|
|
124295
124452
|
}
|
|
124296
124453
|
);
|
|
124297
124454
|
} finally {
|
|
124298
|
-
if (jsonPath) await
|
|
124455
|
+
if (jsonPath) await fs20.rm(jsonPath, { force: true }).catch(() => {
|
|
124299
124456
|
});
|
|
124300
124457
|
}
|
|
124301
124458
|
}
|
|
@@ -124433,124 +124590,6 @@ async function ensureDeviceReady(udid) {
|
|
|
124433
124590
|
readyMemo.set(udid, Date.now());
|
|
124434
124591
|
}
|
|
124435
124592
|
|
|
124436
|
-
// ../tool-server/src/utils/xcode-first-launch.ts
|
|
124437
|
-
var fs20 = __toESM(require("node:fs"));
|
|
124438
|
-
var path18 = __toESM(require("node:path"));
|
|
124439
|
-
var import_node_child_process18 = require("node:child_process");
|
|
124440
|
-
var BUNDLED_DEVELOPER_DIR = path18.join("/Contents", "Developer");
|
|
124441
|
-
function shellWord(word) {
|
|
124442
|
-
return /^[\w@%+=:,./-]+$/.test(word) ? word : `'${word.replaceAll("'", `'\\''`)}'`;
|
|
124443
|
-
}
|
|
124444
|
-
function activeXcode() {
|
|
124445
|
-
const developerDir2 = activeDeveloperDir();
|
|
124446
|
-
const xcode = developerDir2?.endsWith(BUNDLED_DEVELOPER_DIR) ? developerDir2.slice(0, -BUNDLED_DEVELOPER_DIR.length) : developerDir2;
|
|
124447
|
-
const xcodebuild = developerDir2 ? shellWord(path18.join(developerDir2, "usr", "bin", "xcodebuild")) : "xcodebuild";
|
|
124448
|
-
return { xcode, xcodebuild };
|
|
124449
|
-
}
|
|
124450
|
-
function xcodeInstallInstruction() {
|
|
124451
|
-
const { xcode, xcodebuild } = activeXcode();
|
|
124452
|
-
return `open ${xcode ? `the Xcode at ${xcode}` : "Xcode"} once, or run \`sudo ${xcodebuild} -runFirstLaunch\``;
|
|
124453
|
-
}
|
|
124454
|
-
function xcodeFirstLaunchHint() {
|
|
124455
|
-
const { xcode, xcodebuild } = activeXcode();
|
|
124456
|
-
return (xcode ? `The Xcode at ${xcode}` : "Xcode") + ` has not finished installing its system components since it was installed or updated. Until it has, Xcode's \`simctl\` waits for an administrator password on every call, so \`list-devices\` does not show local iOS simulators. Ask the user to open ${xcode ? "that Xcode" : "Xcode"} once and let it install the components, or to run \`sudo ${xcodebuild} -runFirstLaunch\`, then retry. Do not run that command or \`xcrun simctl\` yourself.`;
|
|
124457
|
-
}
|
|
124458
|
-
var XCODE_LOCATIONS = {
|
|
124459
|
-
/** What `xcode-select -s` writes. */
|
|
124460
|
-
selectLink: "/var/db/xcode_select_link",
|
|
124461
|
-
/** What `xcode-select -p` answers without the link. */
|
|
124462
|
-
defaultDeveloperDir: "/Applications/Xcode.app/Contents/Developer"
|
|
124463
|
-
};
|
|
124464
|
-
var locations = XCODE_LOCATIONS;
|
|
124465
|
-
function activeDeveloperDir() {
|
|
124466
|
-
let dir = process.env.DEVELOPER_DIR || null;
|
|
124467
|
-
if (!dir) {
|
|
124468
|
-
try {
|
|
124469
|
-
dir = fs20.readlinkSync(locations.selectLink);
|
|
124470
|
-
} catch {
|
|
124471
|
-
dir = fs20.existsSync(locations.defaultDeveloperDir) ? locations.defaultDeveloperDir : null;
|
|
124472
|
-
}
|
|
124473
|
-
}
|
|
124474
|
-
if (!dir) return null;
|
|
124475
|
-
const bundled = [
|
|
124476
|
-
path18.resolve(dir, "Contents", "Developer"),
|
|
124477
|
-
path18.resolve(dir, "Xcode.app", "Contents", "Developer")
|
|
124478
|
-
].find(isDirectory);
|
|
124479
|
-
return bundled ?? path18.resolve(dir);
|
|
124480
|
-
}
|
|
124481
|
-
function isDirectory(file2) {
|
|
124482
|
-
try {
|
|
124483
|
-
return fs20.statSync(file2).isDirectory();
|
|
124484
|
-
} catch {
|
|
124485
|
-
return false;
|
|
124486
|
-
}
|
|
124487
|
-
}
|
|
124488
|
-
var INSTALL_CALL = /^[ \t]*"\$\{DEVELOPER_DIR\}\/usr\/bin\/xcodebuild" -runFirstLaunch\b/m;
|
|
124489
|
-
var OLDER_RULE = /version_is_older "\$\{CURRENT_VERSION\}" "\$\{EXPECTED_VERSION\}"/;
|
|
124490
|
-
var DIFFERENT_RULE = /\[\[ "\$\{EXPECTED_VERSION\}" != "\$\{CURRENT_VERSION\}" \]\]/;
|
|
124491
|
-
function parseWrapper(file2) {
|
|
124492
|
-
let text;
|
|
124493
|
-
try {
|
|
124494
|
-
text = fs20.readFileSync(file2, "utf8");
|
|
124495
|
-
} catch {
|
|
124496
|
-
return null;
|
|
124497
|
-
}
|
|
124498
|
-
const expected = /^EXPECTED_VERSION="([^"$]+)"$/m.exec(text)?.[1];
|
|
124499
|
-
const plistPath = /Print :CFBundleVersion" "(\/[^"$]+)"/.exec(text)?.[1];
|
|
124500
|
-
const rule = OLDER_RULE.test(text) ? "older" : DIFFERENT_RULE.test(text) ? "different" : null;
|
|
124501
|
-
if (!expected || !plistPath || !rule || !INSTALL_CALL.test(text)) return null;
|
|
124502
|
-
return { expected, plistPath, rule };
|
|
124503
|
-
}
|
|
124504
|
-
function readBundleVersion(plistPath) {
|
|
124505
|
-
let data;
|
|
124506
|
-
try {
|
|
124507
|
-
data = fs20.readFileSync(plistPath);
|
|
124508
|
-
} catch (err) {
|
|
124509
|
-
return err.code === "ENOENT" ? "missing" : null;
|
|
124510
|
-
}
|
|
124511
|
-
if (data.toString("latin1", 0, 6) === "bplist") return readBinaryPlistVersion(plistPath);
|
|
124512
|
-
const text = data.toString("utf8");
|
|
124513
|
-
return /<key>CFBundleVersion<\/key>\s*<string>([^<]+)<\/string>/.exec(text)?.[1] ?? null;
|
|
124514
|
-
}
|
|
124515
|
-
var PLUTIL_TIMEOUT_MS = 1e3;
|
|
124516
|
-
function readBinaryPlistVersion(plistPath) {
|
|
124517
|
-
try {
|
|
124518
|
-
const version3 = (0, import_node_child_process18.execFileSync)(
|
|
124519
|
-
"/usr/bin/plutil",
|
|
124520
|
-
["-extract", "CFBundleVersion", "raw", "-o", "-", plistPath],
|
|
124521
|
-
{
|
|
124522
|
-
encoding: "utf8",
|
|
124523
|
-
timeout: PLUTIL_TIMEOUT_MS,
|
|
124524
|
-
killSignal: "SIGKILL",
|
|
124525
|
-
stdio: ["ignore", "pipe", "ignore"]
|
|
124526
|
-
}
|
|
124527
|
-
);
|
|
124528
|
-
return version3.trim() || null;
|
|
124529
|
-
} catch {
|
|
124530
|
-
return null;
|
|
124531
|
-
}
|
|
124532
|
-
}
|
|
124533
|
-
function isOlder(a, b) {
|
|
124534
|
-
if (![a, b].every((version3) => /^\d+(\.\d+)*$/.test(version3))) return false;
|
|
124535
|
-
const x = a.split(".").map(Number);
|
|
124536
|
-
const y = b.split(".").map(Number);
|
|
124537
|
-
for (let i = 0; i < Math.max(x.length, y.length); i++) {
|
|
124538
|
-
const d = (x[i] ?? 0) - (y[i] ?? 0);
|
|
124539
|
-
if (d !== 0) return d < 0;
|
|
124540
|
-
}
|
|
124541
|
-
return false;
|
|
124542
|
-
}
|
|
124543
|
-
function xcodeFirstLaunchPending() {
|
|
124544
|
-
if (process.platform !== "darwin") return false;
|
|
124545
|
-
const devDir = activeDeveloperDir();
|
|
124546
|
-
if (!devDir) return false;
|
|
124547
|
-
const check3 = parseWrapper(path18.join(devDir, "usr", "bin", "simctl"));
|
|
124548
|
-
if (!check3) return false;
|
|
124549
|
-
const installed = readBundleVersion(check3.plistPath);
|
|
124550
|
-
if (installed === null) return false;
|
|
124551
|
-
return installed === "missing" ? check3.rule === "different" : isOlder(installed, check3.expected);
|
|
124552
|
-
}
|
|
124553
|
-
|
|
124554
124593
|
// ../tool-server/src/tools/devices/list-devices.ts
|
|
124555
124594
|
init_device_info();
|
|
124556
124595
|
|
|
@@ -126629,7 +126668,7 @@ Booted/ready devices are listed first. Platforms whose CLI is unavailable are si
|
|
|
126629
126668
|
services: () => ({}),
|
|
126630
126669
|
async execute(_services, _params) {
|
|
126631
126670
|
const harmonyEnabled = isHarmonyEnabled();
|
|
126632
|
-
const
|
|
126671
|
+
const xcodeInstallPending = ["simctl", "devicectl"].filter(xcodeFirstLaunchPending);
|
|
126633
126672
|
const [
|
|
126634
126673
|
ios,
|
|
126635
126674
|
iosPhysical,
|
|
@@ -126642,7 +126681,7 @@ Booted/ready devices are listed first. Platforms whose CLI is unavailable are si
|
|
|
126642
126681
|
harmonyTargets,
|
|
126643
126682
|
external
|
|
126644
126683
|
] = await Promise.all([
|
|
126645
|
-
|
|
126684
|
+
xcodeInstallPending.includes("simctl") ? [] : withDeadline(listIosSimulators(), [], "ios"),
|
|
126646
126685
|
withDeadline(
|
|
126647
126686
|
listIosPhysicalDevices().catch(() => []),
|
|
126648
126687
|
[],
|
|
@@ -126763,7 +126802,7 @@ Booted/ready devices are listed first. Platforms whose CLI is unavailable are si
|
|
|
126763
126802
|
);
|
|
126764
126803
|
const adbPrefix = adbCommandPrefix(process.env);
|
|
126765
126804
|
const hints = [
|
|
126766
|
-
...
|
|
126805
|
+
...xcodeInstallPending.length > 0 ? [xcodeFirstLaunchHint(xcodeInstallPending)] : [],
|
|
126767
126806
|
...external.length > 0 ? [EXTERNAL_DEVICES_HINT] : [],
|
|
126768
126807
|
...adbPrefix ? [adbServerHint(adbPrefix)] : []
|
|
126769
126808
|
];
|
|
@@ -127249,6 +127288,9 @@ var VariantProposalStore = class {
|
|
|
127249
127288
|
};
|
|
127250
127289
|
var variantProposalStore = new VariantProposalStore();
|
|
127251
127290
|
|
|
127291
|
+
// ../tool-server/src/tools/describe/platforms/ios/index.ts
|
|
127292
|
+
init_src2();
|
|
127293
|
+
|
|
127252
127294
|
// ../tool-server/src/blueprints/native-devtools.ts
|
|
127253
127295
|
var net3 = __toESM(require("node:net"));
|
|
127254
127296
|
var fs24 = __toESM(require("node:fs"));
|
|
@@ -127325,7 +127367,11 @@ async function precheckNativeDevtools(api, udid, bundleId) {
|
|
|
127325
127367
|
if (existing?.givenUp) return buildInitFailedResult(udid, existing);
|
|
127326
127368
|
try {
|
|
127327
127369
|
await api.ensureEnvReady();
|
|
127328
|
-
} catch {
|
|
127370
|
+
} catch (err) {
|
|
127371
|
+
if (err instanceof XcodeFirstLaunchPendingError) {
|
|
127372
|
+
if (bundleId !== void 0 && api.isConnected(bundleId)) return null;
|
|
127373
|
+
throw err;
|
|
127374
|
+
}
|
|
127329
127375
|
const failure2 = api.getInitFailure();
|
|
127330
127376
|
if (failure2) return buildInitFailedResult(udid, failure2);
|
|
127331
127377
|
return buildInitFailedResult(udid, {
|
|
@@ -127335,7 +127381,8 @@ async function precheckNativeDevtools(api, udid, bundleId) {
|
|
|
127335
127381
|
});
|
|
127336
127382
|
}
|
|
127337
127383
|
if (bundleId === void 0) return null;
|
|
127338
|
-
const state3 = await api.appConnectionState(bundleId).catch(() => {
|
|
127384
|
+
const state3 = await api.appConnectionState(bundleId).catch((err) => {
|
|
127385
|
+
if (err instanceof XcodeFirstLaunchPendingError) throw err;
|
|
127339
127386
|
const failure2 = api.getInitFailure();
|
|
127340
127387
|
return failure2 ? buildInitFailedResult(udid, failure2) : "indeterminate";
|
|
127341
127388
|
});
|
|
@@ -127458,6 +127505,7 @@ var nativeDevtoolsBlueprint = {
|
|
|
127458
127505
|
const activatedBundleIds = /* @__PURE__ */ new Set();
|
|
127459
127506
|
const events = new TypedEventEmitter();
|
|
127460
127507
|
const noteInitFailure = (err) => {
|
|
127508
|
+
if (err instanceof XcodeFirstLaunchPendingError) return;
|
|
127461
127509
|
const lastError = err instanceof Error ? err.message : String(err);
|
|
127462
127510
|
const attempts = (initFailure?.attempts ?? 0) + 1;
|
|
127463
127511
|
const givenUp = attempts >= MAX_NATIVE_DEVTOOLS_INIT_ATTEMPTS;
|
|
@@ -128142,6 +128190,7 @@ async function describeIos(registry2, device, params, options = {}) {
|
|
|
128142
128190
|
axApi = await registry2.resolveService(axRef.urn, axRef.options);
|
|
128143
128191
|
degraded = axApi.degraded;
|
|
128144
128192
|
} catch (err) {
|
|
128193
|
+
if (isFirstLaunchRefusal(err)) throw err;
|
|
128145
128194
|
resolverHint = tcpArtifactHint(err);
|
|
128146
128195
|
degraded = resolverHint === void 0;
|
|
128147
128196
|
}
|
|
@@ -128180,7 +128229,10 @@ async function describeIos(registry2, device, params, options = {}) {
|
|
|
128180
128229
|
}
|
|
128181
128230
|
try {
|
|
128182
128231
|
const target = await resolveNativeTargetApp(nativeApi, params.bundleId);
|
|
128183
|
-
const state3 = await nativeApi.appConnectionState(target.bundleId).catch(() =>
|
|
128232
|
+
const state3 = await nativeApi.appConnectionState(target.bundleId).catch((err) => {
|
|
128233
|
+
if (isFirstLaunchRefusal(err)) throw err;
|
|
128234
|
+
return "indeterminate";
|
|
128235
|
+
});
|
|
128184
128236
|
if (state3 !== "connected") {
|
|
128185
128237
|
const diagnosis = buildAppStateMessage(target.bundleId, state3);
|
|
128186
128238
|
const merged = hint ? `${hint} ${diagnosis}` : diagnosis;
|
|
@@ -128200,6 +128252,9 @@ async function describeIos(registry2, device, params, options = {}) {
|
|
|
128200
128252
|
return { tree, source: "ax-service", hint: unexplainedHint(hint, errMsg(err), params) };
|
|
128201
128253
|
}
|
|
128202
128254
|
}
|
|
128255
|
+
function isFirstLaunchRefusal(err) {
|
|
128256
|
+
return getFailureSignal(err)?.error_code === FAILURE_CODES.TOOL_XCODE_FIRST_LAUNCH_PENDING;
|
|
128257
|
+
}
|
|
128203
128258
|
function errMsg(err) {
|
|
128204
128259
|
return err instanceof Error ? err.message : String(err);
|
|
128205
128260
|
}
|
|
@@ -133948,8 +134003,7 @@ async function sendJson(socketPath, command, timeoutMs) {
|
|
|
133948
134003
|
throw new Error(`tv-control got non-JSON reply to "${command}": ${raw.slice(0, 200)}`);
|
|
133949
134004
|
}
|
|
133950
134005
|
}
|
|
133951
|
-
function spawnAxDaemon(udid, socketPath) {
|
|
133952
|
-
const axTarget = simctlTargetForUdidSync(udid, { granted: "ax-service" });
|
|
134006
|
+
function spawnAxDaemon(udid, socketPath, axTarget) {
|
|
133953
134007
|
const proc = (0, import_node_child_process27.execFile)(
|
|
133954
134008
|
"xcrun",
|
|
133955
134009
|
[
|
|
@@ -134059,7 +134113,8 @@ var tvControlBlueprint = {
|
|
|
134059
134113
|
const hidSock = hidSocketPath(udid);
|
|
134060
134114
|
let disposed = false;
|
|
134061
134115
|
await ensureAutomationEnabled(udid);
|
|
134062
|
-
|
|
134116
|
+
const axTarget = () => simctlTargetForUdidSync(udid, { granted: "ax-service" });
|
|
134117
|
+
let axProc = spawnAxDaemon(udid, axSock, axTarget());
|
|
134063
134118
|
const hidProc = spawnHidDaemon(udid, hidSock);
|
|
134064
134119
|
let axExited = false;
|
|
134065
134120
|
const onAxExit = (_code) => {
|
|
@@ -134105,6 +134160,7 @@ var tvControlBlueprint = {
|
|
|
134105
134160
|
}
|
|
134106
134161
|
let axRespawn = null;
|
|
134107
134162
|
async function spawnFreshAx() {
|
|
134163
|
+
const target = axTarget();
|
|
134108
134164
|
if (axProc && !axProc.killed) {
|
|
134109
134165
|
axProc.removeListener("exit", onAxExit);
|
|
134110
134166
|
axProc.removeListener("error", onAxError);
|
|
@@ -134115,10 +134171,10 @@ var tvControlBlueprint = {
|
|
|
134115
134171
|
fs33.unlinkSync(axSock);
|
|
134116
134172
|
} catch {
|
|
134117
134173
|
}
|
|
134118
|
-
axProc = spawnAxDaemon(udid, axSock);
|
|
134119
|
-
axProc.on("exit", onAxExit);
|
|
134120
|
-
axProc.on("error", onAxError);
|
|
134121
134174
|
try {
|
|
134175
|
+
axProc = spawnAxDaemon(udid, axSock, target);
|
|
134176
|
+
axProc.on("exit", onAxExit);
|
|
134177
|
+
axProc.on("error", onAxError);
|
|
134122
134178
|
await waitForSocket(axSock, axProc, 15e3);
|
|
134123
134179
|
} catch (err) {
|
|
134124
134180
|
axExited = true;
|
|
@@ -136216,7 +136272,7 @@ var zodSchema2 = external_exports.object({
|
|
|
136216
136272
|
bundleId: external_exports.string().describe("Bundle ID of the app to check (e.g. com.example.MyApp)")
|
|
136217
136273
|
});
|
|
136218
136274
|
function envSetupReading(api, connected) {
|
|
136219
|
-
return api.isEnvSetup() &&
|
|
136275
|
+
return connected || api.isEnvSetup() && api.getInitFailure() === null;
|
|
136220
136276
|
}
|
|
136221
136277
|
var nativeDevtoolsStatusTool = {
|
|
136222
136278
|
id: "native-devtools-status",
|
|
@@ -136266,6 +136322,7 @@ Fails if the simulator server is not running for the given UDID.`,
|
|
|
136266
136322
|
try {
|
|
136267
136323
|
appRunning2 = await api.isAppRunning(params.bundleId);
|
|
136268
136324
|
} catch (err) {
|
|
136325
|
+
if (err instanceof XcodeFirstLaunchPendingError) throw err;
|
|
136269
136326
|
const failure2 = api.getInitFailure();
|
|
136270
136327
|
if (failure2) return buildInitFailedResult(params.udid, failure2);
|
|
136271
136328
|
throw err;
|
|
@@ -136279,9 +136336,20 @@ Fails if the simulator server is not running for the given UDID.`,
|
|
|
136279
136336
|
injectable: false
|
|
136280
136337
|
};
|
|
136281
136338
|
}
|
|
136282
|
-
|
|
136339
|
+
let blocked;
|
|
136340
|
+
try {
|
|
136341
|
+
blocked = await precheckNativeDevtools(api, params.udid);
|
|
136342
|
+
} catch (err) {
|
|
136343
|
+
if (!(err instanceof XcodeFirstLaunchPendingError) || !api.isConnected(params.bundleId)) {
|
|
136344
|
+
throw err;
|
|
136345
|
+
}
|
|
136346
|
+
blocked = null;
|
|
136347
|
+
}
|
|
136283
136348
|
if (blocked) return blocked;
|
|
136284
|
-
const measured = await api.appConnectionState(params.bundleId).catch(() =>
|
|
136349
|
+
const measured = await api.appConnectionState(params.bundleId).catch((err) => {
|
|
136350
|
+
if (err instanceof XcodeFirstLaunchPendingError) throw err;
|
|
136351
|
+
return "indeterminate";
|
|
136352
|
+
});
|
|
136285
136353
|
const connected = measured === "connected";
|
|
136286
136354
|
let appRunning;
|
|
136287
136355
|
let state3 = measured;
|
|
@@ -141785,6 +141853,7 @@ function makeIosImpl(registry2) {
|
|
|
141785
141853
|
])
|
|
141786
141854
|
);
|
|
141787
141855
|
} catch (err) {
|
|
141856
|
+
if (err instanceof XcodeFirstLaunchPendingError) throw err;
|
|
141788
141857
|
throw new FailureError(
|
|
141789
141858
|
`Failed to launch iOS app ${params.bundleId} on ${params.udid}.`,
|
|
141790
141859
|
{
|
|
@@ -142286,6 +142355,7 @@ function makeIosImpl2(registry2) {
|
|
|
142286
142355
|
await simctlArgsForUdid(udid, ["launch", udid, bundleId, ...params.launchArgs ?? []])
|
|
142287
142356
|
);
|
|
142288
142357
|
} catch (err) {
|
|
142358
|
+
if (err instanceof XcodeFirstLaunchPendingError) throw err;
|
|
142289
142359
|
throw new FailureError(
|
|
142290
142360
|
`Failed to restart iOS app ${bundleId} on ${udid}.`,
|
|
142291
142361
|
{
|
|
@@ -143079,6 +143149,7 @@ function buildIosHandler(backend) {
|
|
|
143079
143149
|
await backend.run(udid, SIMCTL_ACTION[action], service, bundleId);
|
|
143080
143150
|
applied.push(service);
|
|
143081
143151
|
} catch (err) {
|
|
143152
|
+
if (err instanceof XcodeFirstLaunchPendingError) throw err;
|
|
143082
143153
|
if (!isPrimary) continue;
|
|
143083
143154
|
const detail = err instanceof Error ? err.message : String(err);
|
|
143084
143155
|
const shutdownHint = /current state:\s*shutdown/i.test(detail) ? " The simulator must be booted first \u2014 use boot-device." : "";
|
|
@@ -143331,6 +143402,7 @@ var iosImpl3 = {
|
|
|
143331
143402
|
await simctlArgsForUdid(params.udid, ["openurl", params.udid, params.url])
|
|
143332
143403
|
);
|
|
143333
143404
|
} catch (err) {
|
|
143405
|
+
if (err instanceof XcodeFirstLaunchPendingError) throw err;
|
|
143334
143406
|
throw new FailureError(
|
|
143335
143407
|
`Failed to open URL on iOS simulator ${params.udid}.`,
|
|
143336
143408
|
{
|
|
@@ -147702,6 +147774,7 @@ init_adb();
|
|
|
147702
147774
|
init_capability();
|
|
147703
147775
|
|
|
147704
147776
|
// ../tool-server/src/utils/poll-describe-tree.ts
|
|
147777
|
+
init_src2();
|
|
147705
147778
|
async function pollDescribeTree(args) {
|
|
147706
147779
|
const { fetchTree, timeoutMs, pollIntervalMs, signal, onSample } = args;
|
|
147707
147780
|
const start2 = Date.now();
|
|
@@ -147733,6 +147806,9 @@ async function pollDescribeTree(args) {
|
|
|
147733
147806
|
break;
|
|
147734
147807
|
}
|
|
147735
147808
|
if (settled.type === "error") {
|
|
147809
|
+
if (getFailureSignal(settled.cause)?.error_code === FAILURE_CODES.TOOL_XCODE_FIRST_LAUNCH_PENDING) {
|
|
147810
|
+
throw settled.cause;
|
|
147811
|
+
}
|
|
147736
147812
|
lastError = settled.error;
|
|
147737
147813
|
} else {
|
|
147738
147814
|
lastData = settled.value;
|
|
@@ -157876,7 +157952,7 @@ async function androidSerials() {
|
|
|
157876
157952
|
}
|
|
157877
157953
|
}
|
|
157878
157954
|
async function bootedSimulators() {
|
|
157879
|
-
const simulators = await listIosSimulators();
|
|
157955
|
+
const simulators = await listIosSimulators().catch(() => []);
|
|
157880
157956
|
return simulators.filter((s) => s.state === "Booted").map((s) => s.udid);
|
|
157881
157957
|
}
|
|
157882
157958
|
async function logcatHolds(serial, marker) {
|
|
@@ -162826,6 +162902,7 @@ function enumerateRunningUserApps(udid) {
|
|
|
162826
162902
|
}
|
|
162827
162903
|
);
|
|
162828
162904
|
} catch (err) {
|
|
162905
|
+
if (err instanceof XcodeFirstLaunchPendingError) throw err;
|
|
162829
162906
|
const msg = err instanceof Error ? err.message : String(err);
|
|
162830
162907
|
throw new FailureError(
|
|
162831
162908
|
`Failed to enumerate running processes on simulator ${udid} within ${DETECT_RUNNING_APP_TIMEOUT_MS} ms. Verify the simulator is booted and responsive, then retry. Underlying error: ${msg}`,
|
|
@@ -162906,7 +162983,8 @@ function resolveExplicitApp(udid, name) {
|
|
|
162906
162983
|
let runningUserApps;
|
|
162907
162984
|
try {
|
|
162908
162985
|
runningUserApps = enumerateRunningUserApps(udid);
|
|
162909
|
-
} catch {
|
|
162986
|
+
} catch (err) {
|
|
162987
|
+
if (err instanceof XcodeFirstLaunchPendingError) throw err;
|
|
162910
162988
|
return { executable: name, pid: null };
|
|
162911
162989
|
}
|
|
162912
162990
|
const matched = runningUserApps.find(
|
|
@@ -162936,6 +163014,7 @@ function getInstalledApps(udid) {
|
|
|
162936
163014
|
maxBuffer: DEFAULT_EXEC_MAX_BUFFER
|
|
162937
163015
|
});
|
|
162938
163016
|
} catch (err) {
|
|
163017
|
+
if (err instanceof XcodeFirstLaunchPendingError) throw err;
|
|
162939
163018
|
const msg = err instanceof Error ? err.message : String(err);
|
|
162940
163019
|
throw new FailureError(
|
|
162941
163020
|
`Failed to list installed apps on simulator ${udid} within ${DETECT_RUNNING_APP_TIMEOUT_MS} ms. Verify the simulator is booted and responsive, then retry. Underlying error: ${msg}`,
|
|
@@ -181574,7 +181653,7 @@ function startSimulatorWatcher(registry2) {
|
|
|
181574
181653
|
let ticksToSkip = 0;
|
|
181575
181654
|
let firstLaunchReported = false;
|
|
181576
181655
|
function simctlWouldStartInstall() {
|
|
181577
|
-
if (!xcodeFirstLaunchPending()) {
|
|
181656
|
+
if (!xcodeFirstLaunchPending("simctl")) {
|
|
181578
181657
|
firstLaunchReported = false;
|
|
181579
181658
|
return false;
|
|
181580
181659
|
}
|
|
@@ -181661,8 +181740,7 @@ function startSimulatorWatcher(registry2) {
|
|
|
181661
181740
|
);
|
|
181662
181741
|
for (const [udid, service] of trackedServices) {
|
|
181663
181742
|
if (!booted.has(udid)) continue;
|
|
181664
|
-
|
|
181665
|
-
if (failure2 && !failure2.givenUp) {
|
|
181743
|
+
if (!service.isEnvSetup() && !service.getInitFailure()?.givenUp) {
|
|
181666
181744
|
pendingAttempts.push(service.ensureEnvReady().catch(() => {
|
|
181667
181745
|
}));
|
|
181668
181746
|
}
|
package/package.json
CHANGED