@swmansion/argent 0.35.1-next.72 → 0.35.1-next.74
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/mcp-server.mjs +1 -1
- package/dist/tool-server.cjs +566 -389
- package/package.json +2 -2
package/dist/tool-server.cjs
CHANGED
|
@@ -73314,7 +73314,7 @@ function isCi(env = process.env) {
|
|
|
73314
73314
|
var SESSION_ID = (0, import_node_crypto3.randomUUID)();
|
|
73315
73315
|
function readCliVersion() {
|
|
73316
73316
|
if (true) {
|
|
73317
|
-
return "0.35.1-next.
|
|
73317
|
+
return "0.35.1-next.74";
|
|
73318
73318
|
}
|
|
73319
73319
|
return "0.0.0";
|
|
73320
73320
|
}
|
|
@@ -81196,7 +81196,7 @@ function consumePendingSigningDetectionNote(udid) {
|
|
|
81196
81196
|
|
|
81197
81197
|
// ../tool-server/src/preview.ts
|
|
81198
81198
|
var import_node_fs11 = __toESM(require("node:fs"));
|
|
81199
|
-
var
|
|
81199
|
+
var import_node_os8 = __toESM(require("node:os"));
|
|
81200
81200
|
var import_node_path14 = __toESM(require("node:path"));
|
|
81201
81201
|
var import_express = __toESM(require_express2());
|
|
81202
81202
|
init_src();
|
|
@@ -104087,11 +104087,11 @@ function scheduleGroupSigkill(pid, graceMs, opts) {
|
|
|
104087
104087
|
}
|
|
104088
104088
|
async function pollPidsUntilGone(pids, opts) {
|
|
104089
104089
|
const isAlive2 = opts.isAlive ?? pidIsAlive;
|
|
104090
|
-
const
|
|
104090
|
+
const sleep22 = opts.sleep ?? ((ms3) => new Promise((resolve24) => setTimeout(resolve24, ms3)));
|
|
104091
104091
|
const maxPolls = Math.max(1, Math.ceil(opts.timeoutMs / opts.pollIntervalMs));
|
|
104092
104092
|
let remaining = pids.filter((pid) => isAlive2(pid));
|
|
104093
104093
|
for (let poll = 0; poll < maxPolls && remaining.length > 0; poll += 1) {
|
|
104094
|
-
await
|
|
104094
|
+
await sleep22(opts.pollIntervalMs);
|
|
104095
104095
|
remaining = remaining.filter((pid) => isAlive2(pid));
|
|
104096
104096
|
}
|
|
104097
104097
|
return remaining;
|
|
@@ -105294,10 +105294,10 @@ init_harmony_flag();
|
|
|
105294
105294
|
|
|
105295
105295
|
// ../tool-server/src/utils/macos-apps.ts
|
|
105296
105296
|
var import_node_child_process23 = require("node:child_process");
|
|
105297
|
-
var
|
|
105298
|
-
var
|
|
105297
|
+
var import_node_crypto12 = require("node:crypto");
|
|
105298
|
+
var fs32 = __toESM(require("node:fs"));
|
|
105299
105299
|
var os8 = __toESM(require("node:os"));
|
|
105300
|
-
var
|
|
105300
|
+
var path28 = __toESM(require("node:path"));
|
|
105301
105301
|
var import_node_util18 = require("node:util");
|
|
105302
105302
|
init_src();
|
|
105303
105303
|
init_src2();
|
|
@@ -105305,6 +105305,41 @@ init_capability();
|
|
|
105305
105305
|
init_device_info();
|
|
105306
105306
|
init_macos_app_kind();
|
|
105307
105307
|
init_src();
|
|
105308
|
+
|
|
105309
|
+
// ../tool-server/src/utils/argent-home-id.ts
|
|
105310
|
+
var import_node_crypto11 = require("node:crypto");
|
|
105311
|
+
var fs31 = __toESM(require("node:fs"));
|
|
105312
|
+
var import_node_os6 = require("node:os");
|
|
105313
|
+
var path27 = __toESM(require("node:path"));
|
|
105314
|
+
init_src();
|
|
105315
|
+
var ARGENT_HOME_HEADER = "x-argent-home";
|
|
105316
|
+
function canonicalDir(dir) {
|
|
105317
|
+
const resolved = path27.resolve(dir);
|
|
105318
|
+
const parent = path27.dirname(resolved);
|
|
105319
|
+
if (fs31.existsSync(resolved) || parent === resolved) return canonicalPath(resolved);
|
|
105320
|
+
return path27.join(canonicalDir(parent), path27.basename(resolved));
|
|
105321
|
+
}
|
|
105322
|
+
function argentHomeId(dir = argentHomeDir()) {
|
|
105323
|
+
return (0, import_node_crypto11.createHash)("sha256").update(canonicalDir(dir)).digest("hex").slice(0, 12);
|
|
105324
|
+
}
|
|
105325
|
+
function peerArgentHomeId(header) {
|
|
105326
|
+
if (typeof header === "string" && header) return header;
|
|
105327
|
+
return argentHomeId(path27.join(resolveHomeDir(), ".argent"));
|
|
105328
|
+
}
|
|
105329
|
+
var LOOPBACK_ADDRESSES = /* @__PURE__ */ new Set(["127.0.0.1", "::1", "::ffff:127.0.0.1"]);
|
|
105330
|
+
function isOwnAddress(address) {
|
|
105331
|
+
const ip = address.replace(/^::ffff:(?=\d+\.\d+\.\d+\.\d+$)/, "");
|
|
105332
|
+
return Object.values((0, import_node_os6.networkInterfaces)()).some(
|
|
105333
|
+
(list) => list?.some((a) => (a.family === "IPv4" || a.scopeid === 0) && a.address === ip)
|
|
105334
|
+
);
|
|
105335
|
+
}
|
|
105336
|
+
function isLocalConnection(socket) {
|
|
105337
|
+
const remote = socket.remoteAddress;
|
|
105338
|
+
if (remote === void 0) return false;
|
|
105339
|
+
return LOOPBACK_ADDRESSES.has(remote) || remote === socket.localAddress || isOwnAddress(remote);
|
|
105340
|
+
}
|
|
105341
|
+
|
|
105342
|
+
// ../tool-server/src/utils/macos-apps.ts
|
|
105308
105343
|
var execFileAsync17 = (0, import_node_util18.promisify)(import_node_child_process23.execFile);
|
|
105309
105344
|
function isMacosAppsEnabled() {
|
|
105310
105345
|
return isFeatureEnabled(MACOS_APPS_FLAG);
|
|
@@ -105338,56 +105373,78 @@ function assertLaunchTargetsDevice(bundleId, device) {
|
|
|
105338
105373
|
}
|
|
105339
105374
|
);
|
|
105340
105375
|
}
|
|
105341
|
-
function macosArgentDir() {
|
|
105342
|
-
return path27.join(argentHomeDir(), "macos");
|
|
105343
|
-
}
|
|
105344
105376
|
function macosAppLogPath(bundleId) {
|
|
105345
|
-
return
|
|
105377
|
+
return path28.join(argentHomeDir(), "macos", "logs", `${bundleId}.log`);
|
|
105378
|
+
}
|
|
105379
|
+
function macosLibraryRoot() {
|
|
105380
|
+
return path28.join(os8.homedir(), "Library", "Caches", "com.swmansion.argent", "macos-lib");
|
|
105381
|
+
}
|
|
105382
|
+
function macosSocketDir() {
|
|
105383
|
+
try {
|
|
105384
|
+
const cache6 = (0, import_node_child_process23.execFileSync)("/usr/bin/getconf", ["DARWIN_USER_CACHE_DIR"], {
|
|
105385
|
+
encoding: "utf8",
|
|
105386
|
+
timeout: 5e3
|
|
105387
|
+
}).trim();
|
|
105388
|
+
return cache6 ? path28.join(cache6, `argent-${argentHomeId()}`) : null;
|
|
105389
|
+
} catch {
|
|
105390
|
+
return null;
|
|
105391
|
+
}
|
|
105346
105392
|
}
|
|
105347
105393
|
var BOOTSTRAP_NAME = "libArgentInjectionBootstrap.dylib";
|
|
105348
105394
|
var LIBRARY_NAME = "libNativeDevtoolsMacos.dylib";
|
|
105349
105395
|
function stageMacosLibraries(bootstrapPath, libraryPath, teamId) {
|
|
105350
|
-
const bootstrap =
|
|
105351
|
-
const library =
|
|
105396
|
+
const bootstrap = fs32.readFileSync(bootstrapPath);
|
|
105397
|
+
const library = fs32.readFileSync(libraryPath);
|
|
105352
105398
|
const hash2 = libraryHash(bootstrap, library);
|
|
105353
105399
|
const name = teamId ? `${hash2}-${teamId}` : hash2;
|
|
105354
|
-
const libRoot =
|
|
105355
|
-
const
|
|
105356
|
-
|
|
105357
|
-
const isComplete = () => fs31.existsSync(staged) && fs31.existsSync(path27.join(target, LIBRARY_NAME));
|
|
105358
|
-
fs31.mkdirSync(libRoot, { recursive: true, mode: 448 });
|
|
105359
|
-
fs31.chmodSync(macosArgentDir(), 448);
|
|
105400
|
+
const libRoot = macosLibraryRoot();
|
|
105401
|
+
const targets = STAGED_NAME_SUFFIXES.map((suffix) => path28.join(libRoot, name + suffix));
|
|
105402
|
+
fs32.mkdirSync(libRoot, { recursive: true, mode: 448 });
|
|
105360
105403
|
void removeUnusedLibraries(libRoot, hash2);
|
|
105361
|
-
|
|
105362
|
-
|
|
105363
|
-
|
|
105364
|
-
|
|
105365
|
-
|
|
105366
|
-
|
|
105367
|
-
|
|
105404
|
+
void removeUnusedLibraries(path28.join(argentHomeDir(), "macos", "lib"), void 0, hash2);
|
|
105405
|
+
const source = JSON.stringify([path28.resolve(bootstrapPath), path28.resolve(libraryPath)]);
|
|
105406
|
+
const reuse2 = (dir) => {
|
|
105407
|
+
recordLibrarySource(dir, source);
|
|
105408
|
+
return path28.join(dir, BOOTSTRAP_NAME);
|
|
105409
|
+
};
|
|
105410
|
+
const complete = targets.find(isCompleteCopy);
|
|
105411
|
+
if (complete) return reuse2(complete);
|
|
105412
|
+
const temp = fs32.mkdtempSync(path28.join(libRoot, `.tmp-${name}-`));
|
|
105413
|
+
try {
|
|
105414
|
+
fs32.writeFileSync(path28.join(temp, BOOTSTRAP_NAME), bootstrap, { mode: 493 });
|
|
105415
|
+
fs32.writeFileSync(path28.join(temp, LIBRARY_NAME), library, { mode: 493 });
|
|
105416
|
+
fs32.writeFileSync(path28.join(temp, SOURCES_NAME), `${source}
|
|
105417
|
+
`, { mode: 384 });
|
|
105418
|
+
for (const target of targets) {
|
|
105419
|
+
if (tryRename(temp, target)) return path28.join(target, BOOTSTRAP_NAME);
|
|
105420
|
+
if (isCompleteCopy(target)) return reuse2(target);
|
|
105421
|
+
}
|
|
105422
|
+
} finally {
|
|
105423
|
+
fs32.rmSync(temp, { recursive: true, force: true });
|
|
105368
105424
|
}
|
|
105369
|
-
|
|
105425
|
+
throw new Error(`${targets.join(", ")} hold incomplete copies of the library`);
|
|
105426
|
+
}
|
|
105427
|
+
var STAGED_NAME_SUFFIXES = ["", ".2", ".3"];
|
|
105428
|
+
function isCompleteCopy(dir) {
|
|
105429
|
+
return fs32.existsSync(path28.join(dir, BOOTSTRAP_NAME)) && fs32.existsSync(path28.join(dir, LIBRARY_NAME));
|
|
105430
|
+
}
|
|
105431
|
+
function tryRename(from2, to) {
|
|
105370
105432
|
try {
|
|
105371
|
-
|
|
105372
|
-
|
|
105373
|
-
|
|
105374
|
-
|
|
105375
|
-
fs31.renameSync(temp, target);
|
|
105376
|
-
} catch (err) {
|
|
105377
|
-
fs31.rmSync(temp, { recursive: true, force: true });
|
|
105378
|
-
throw err;
|
|
105433
|
+
fs32.renameSync(from2, to);
|
|
105434
|
+
return true;
|
|
105435
|
+
} catch {
|
|
105436
|
+
return false;
|
|
105379
105437
|
}
|
|
105380
|
-
return staged;
|
|
105381
105438
|
}
|
|
105382
105439
|
var SOURCES_NAME = "sources";
|
|
105383
105440
|
function libraryHash(bootstrap, library) {
|
|
105384
|
-
return (0,
|
|
105441
|
+
return (0, import_node_crypto12.createHash)("sha256").update(`${bootstrap.length}:`).update(bootstrap).update(`${library.length}:`).update(library).digest("hex").slice(0, 16);
|
|
105385
105442
|
}
|
|
105386
105443
|
function recordLibrarySource(dir, source) {
|
|
105387
|
-
const file2 =
|
|
105444
|
+
const file2 = path28.join(dir, SOURCES_NAME);
|
|
105388
105445
|
try {
|
|
105389
|
-
const known =
|
|
105390
|
-
if (!known.includes(source))
|
|
105446
|
+
const known = fs32.existsSync(file2) ? fs32.readFileSync(file2, "utf8").split("\n") : [];
|
|
105447
|
+
if (!known.includes(source)) fs32.appendFileSync(file2, `${source}
|
|
105391
105448
|
`, { mode: 384 });
|
|
105392
105449
|
} catch {
|
|
105393
105450
|
}
|
|
@@ -105395,13 +105452,13 @@ function recordLibrarySource(dir, source) {
|
|
|
105395
105452
|
function inPrivacyProtectedFolder(file2) {
|
|
105396
105453
|
const home = os8.homedir();
|
|
105397
105454
|
return ["Desktop", "Documents", "Downloads", "Library/Mobile Documents"].some(
|
|
105398
|
-
(folder) => file2.startsWith(
|
|
105455
|
+
(folder) => file2.startsWith(path28.join(home, folder) + path28.sep)
|
|
105399
105456
|
);
|
|
105400
105457
|
}
|
|
105401
105458
|
async function librarySourceInstalled(dir, name) {
|
|
105402
105459
|
let lines;
|
|
105403
105460
|
try {
|
|
105404
|
-
lines = (await
|
|
105461
|
+
lines = (await fs32.promises.readFile(path28.join(dir, SOURCES_NAME), "utf8")).split("\n");
|
|
105405
105462
|
} catch {
|
|
105406
105463
|
return false;
|
|
105407
105464
|
}
|
|
@@ -105416,7 +105473,7 @@ async function librarySourceInstalled(dir, name) {
|
|
|
105416
105473
|
if (files.some((file2) => inPrivacyProtectedFolder(String(file2)))) return true;
|
|
105417
105474
|
try {
|
|
105418
105475
|
const [bootstrap, library] = await Promise.all(
|
|
105419
|
-
files.map((file2) =>
|
|
105476
|
+
files.map((file2) => fs32.promises.readFile(String(file2)))
|
|
105420
105477
|
);
|
|
105421
105478
|
if (name.startsWith(libraryHash(bootstrap, library))) return true;
|
|
105422
105479
|
} catch (err) {
|
|
@@ -105425,9 +105482,9 @@ async function librarySourceInstalled(dir, name) {
|
|
|
105425
105482
|
}
|
|
105426
105483
|
return false;
|
|
105427
105484
|
}
|
|
105428
|
-
async function removeUnusedLibraries(libRoot, keep) {
|
|
105485
|
+
async function removeUnusedLibraries(libRoot, keep, superseded) {
|
|
105429
105486
|
try {
|
|
105430
|
-
const root =
|
|
105487
|
+
const root = fs32.realpathSync(libRoot);
|
|
105431
105488
|
let open5;
|
|
105432
105489
|
try {
|
|
105433
105490
|
({ stdout: open5 } = await execFileAsync17("lsof", ["-Fn", "+D", root], {
|
|
@@ -105442,15 +105499,25 @@ async function removeUnusedLibraries(libRoot, keep) {
|
|
|
105442
105499
|
const used = new Set(
|
|
105443
105500
|
open5.split("\n").filter((line) => line.startsWith(`n${root}/`)).map((line) => line.slice(root.length + 2).split("/")[0])
|
|
105444
105501
|
);
|
|
105445
|
-
for (const name of
|
|
105446
|
-
|
|
105447
|
-
const
|
|
105448
|
-
if (
|
|
105449
|
-
|
|
105502
|
+
for (const name of fs32.readdirSync(root)) {
|
|
105503
|
+
const dir = path28.join(root, name);
|
|
105504
|
+
const current = keep !== void 0 && name.startsWith(keep);
|
|
105505
|
+
if (used.has(name) || current && isCompleteCopy(dir)) continue;
|
|
105506
|
+
const temporary = name.startsWith(".");
|
|
105507
|
+
if (temporary && isRecent(dir)) continue;
|
|
105508
|
+
const restaged = superseded !== void 0 && name.startsWith(superseded);
|
|
105509
|
+
if (!current && !temporary && !restaged && await librarySourceInstalled(dir, name)) {
|
|
105510
|
+
continue;
|
|
105511
|
+
}
|
|
105512
|
+
fs32.rmSync(dir, { recursive: true, force: true });
|
|
105450
105513
|
}
|
|
105451
105514
|
} catch {
|
|
105452
105515
|
}
|
|
105453
105516
|
}
|
|
105517
|
+
var STAGING_TEMP_MAX_AGE_MS = 10 * 6e4;
|
|
105518
|
+
function isRecent(dir) {
|
|
105519
|
+
return Date.now() - fs32.lstatSync(dir).mtimeMs < STAGING_TEMP_MAX_AGE_MS;
|
|
105520
|
+
}
|
|
105454
105521
|
var EXPORTED_RELEASE_NOTE = "An exported or notarized Release build with the hardened runtime cannot be driven without extra entitlements.";
|
|
105455
105522
|
async function signatureTeam(file2) {
|
|
105456
105523
|
try {
|
|
@@ -105466,7 +105533,7 @@ async function stageLibraryFor(info, shipped, readTeam = signatureTeam) {
|
|
|
105466
105533
|
bootstrap = stageMacosLibraries(shipped.bootstrap, shipped.library, teamId);
|
|
105467
105534
|
} catch (err) {
|
|
105468
105535
|
throw macosFailure(
|
|
105469
|
-
`Could not copy the argent library to
|
|
105536
|
+
`Could not copy the argent library to ${macosLibraryRoot()}: ${errorMessage(err)}`,
|
|
105470
105537
|
FAILURE_CODES.MACOS_APP_LIBRARY_STAGE_FAILED,
|
|
105471
105538
|
"macos_app_stage_library",
|
|
105472
105539
|
"unknown",
|
|
@@ -105474,7 +105541,7 @@ async function stageLibraryFor(info, shipped, readTeam = signatureTeam) {
|
|
|
105474
105541
|
);
|
|
105475
105542
|
}
|
|
105476
105543
|
if (!teamId) return bootstrap;
|
|
105477
|
-
const files = [bootstrap,
|
|
105544
|
+
const files = [bootstrap, path28.join(path28.dirname(bootstrap), LIBRARY_NAME)];
|
|
105478
105545
|
const teams = await Promise.all(files.map((file2) => readTeam(file2)));
|
|
105479
105546
|
if (teams.every((team) => team === teamId)) return bootstrap;
|
|
105480
105547
|
const debug = info.entitlements.getTaskAllow;
|
|
@@ -105490,7 +105557,7 @@ then start the app again. Signing uses the keychain, so the user runs this comma
|
|
|
105490
105557
|
var MAX_SOCKET_PATH_BYTES = 103;
|
|
105491
105558
|
function macosListenSocket(bundleId, sandboxed) {
|
|
105492
105559
|
if (sandboxed) {
|
|
105493
|
-
const containerPath =
|
|
105560
|
+
const containerPath = path28.join(
|
|
105494
105561
|
os8.homedir(),
|
|
105495
105562
|
"Library",
|
|
105496
105563
|
"Containers",
|
|
@@ -105501,12 +105568,27 @@ function macosListenSocket(bundleId, sandboxed) {
|
|
|
105501
105568
|
);
|
|
105502
105569
|
return fitsSocketPath(containerPath) ? { env: "CONTAINER", path: containerPath } : null;
|
|
105503
105570
|
}
|
|
105504
|
-
const
|
|
105571
|
+
const dir = macosSocketDir();
|
|
105572
|
+
if (!dir) return null;
|
|
105573
|
+
const named = path28.join(dir, `${bundleId}.sock`);
|
|
105505
105574
|
if (fitsSocketPath(named)) return { env: named, path: named };
|
|
105506
|
-
const hash2 = (0,
|
|
105507
|
-
const hashed =
|
|
105575
|
+
const hash2 = (0, import_node_crypto12.createHash)("sha256").update(bundleId).digest("hex").slice(0, 16);
|
|
105576
|
+
const hashed = path28.join(dir, `${hash2}.sock`);
|
|
105508
105577
|
return fitsSocketPath(hashed) ? { env: hashed, path: hashed } : null;
|
|
105509
105578
|
}
|
|
105579
|
+
function prepareSocketDir(socketPath) {
|
|
105580
|
+
const dir = path28.dirname(socketPath);
|
|
105581
|
+
fs32.mkdirSync(dir, { recursive: true, mode: 448 });
|
|
105582
|
+
const stat11 = fs32.lstatSync(dir);
|
|
105583
|
+
if (!stat11.isDirectory() || stat11.uid !== process.getuid?.() || (stat11.mode & 63) !== 0) {
|
|
105584
|
+
throw macosFailure(
|
|
105585
|
+
`${dir} belongs to another user or others can open it, so argent cannot keep the app's socket private there.`,
|
|
105586
|
+
FAILURE_CODES.MACOS_APP_SPAWN_FAILED,
|
|
105587
|
+
"macos_app_listen_socket",
|
|
105588
|
+
"validation"
|
|
105589
|
+
);
|
|
105590
|
+
}
|
|
105591
|
+
}
|
|
105510
105592
|
function fitsSocketPath(p) {
|
|
105511
105593
|
return Buffer.byteLength(p, "utf8") <= MAX_SOCKET_PATH_BYTES;
|
|
105512
105594
|
}
|
|
@@ -105524,7 +105606,7 @@ function isTrackedMacosApp(value) {
|
|
|
105524
105606
|
function readTrackedApps() {
|
|
105525
105607
|
let raw;
|
|
105526
105608
|
try {
|
|
105527
|
-
raw = JSON.parse(
|
|
105609
|
+
raw = JSON.parse(fs32.readFileSync(trackedMacosAppsFile(), "utf8"));
|
|
105528
105610
|
} catch {
|
|
105529
105611
|
return [];
|
|
105530
105612
|
}
|
|
@@ -105533,10 +105615,10 @@ function readTrackedApps() {
|
|
|
105533
105615
|
function recordTrackedMacosApp(app) {
|
|
105534
105616
|
const file2 = trackedMacosAppsFile();
|
|
105535
105617
|
const others = readTrackedApps().filter((a) => a.bundleId !== app.bundleId);
|
|
105536
|
-
|
|
105618
|
+
fs32.mkdirSync(path28.dirname(file2), { recursive: true });
|
|
105537
105619
|
const tmp = `${file2}.${process.pid}.tmp`;
|
|
105538
|
-
|
|
105539
|
-
|
|
105620
|
+
fs32.writeFileSync(tmp, JSON.stringify([...others, app], null, 2) + "\n");
|
|
105621
|
+
fs32.renameSync(tmp, file2);
|
|
105540
105622
|
}
|
|
105541
105623
|
function getTrackedMacosApp(bundleId) {
|
|
105542
105624
|
return readTrackedApps().find((a) => a.bundleId === bundleId);
|
|
@@ -105599,7 +105681,7 @@ async function findRunningCopies(bundleId, executable, skipPid) {
|
|
|
105599
105681
|
} catch {
|
|
105600
105682
|
return found;
|
|
105601
105683
|
}
|
|
105602
|
-
const suffix = `/Contents/MacOS/${
|
|
105684
|
+
const suffix = `/Contents/MacOS/${path28.basename(executable)}`;
|
|
105603
105685
|
const bundleIds = /* @__PURE__ */ new Map();
|
|
105604
105686
|
for (const line of stdout.split("\n")) {
|
|
105605
105687
|
const match = /^\s*(\d+)\s+(.*)$/.exec(line);
|
|
@@ -105612,7 +105694,7 @@ async function findRunningCopies(bundleId, executable, skipPid) {
|
|
|
105612
105694
|
if (!command2.endsWith(suffix)) continue;
|
|
105613
105695
|
let resolved;
|
|
105614
105696
|
try {
|
|
105615
|
-
resolved =
|
|
105697
|
+
resolved = fs32.realpathSync(command2);
|
|
105616
105698
|
} catch {
|
|
105617
105699
|
continue;
|
|
105618
105700
|
}
|
|
@@ -105621,7 +105703,7 @@ async function findRunningCopies(bundleId, executable, skipPid) {
|
|
|
105621
105703
|
if (!bundleIds.has(appPath)) {
|
|
105622
105704
|
bundleIds.set(
|
|
105623
105705
|
appPath,
|
|
105624
|
-
await plistValue(
|
|
105706
|
+
await plistValue(path28.join(appPath, "Contents", "Info.plist"), "CFBundleIdentifier")
|
|
105625
105707
|
);
|
|
105626
105708
|
}
|
|
105627
105709
|
if (bundleIds.get(appPath) === bundleId) found.otherBuilds.push({ pid, appPath });
|
|
@@ -105637,16 +105719,16 @@ async function gitWorktreeOf(dir) {
|
|
|
105637
105719
|
);
|
|
105638
105720
|
const [top, common] = stdout.trim().split("\n");
|
|
105639
105721
|
if (!top || !common) return null;
|
|
105640
|
-
return { top:
|
|
105722
|
+
return { top: fs32.realpathSync(top), common: fs32.realpathSync(common) };
|
|
105641
105723
|
} catch {
|
|
105642
105724
|
return null;
|
|
105643
105725
|
}
|
|
105644
105726
|
}
|
|
105645
105727
|
async function otherWorktreeOfBuild(appPath, projectRoot) {
|
|
105646
105728
|
const derivedData = /^(.*)\/Build\/Products\/[^/]+\/[^/]+\.app$/.exec(appPath)?.[1];
|
|
105647
|
-
const workspace = derivedData ? await plistValue(
|
|
105729
|
+
const workspace = derivedData ? await plistValue(path28.join(derivedData, "info.plist"), "WorkspacePath") : null;
|
|
105648
105730
|
const [build2, project] = await Promise.all([
|
|
105649
|
-
gitWorktreeOf(
|
|
105731
|
+
gitWorktreeOf(path28.dirname(workspace ?? appPath)),
|
|
105650
105732
|
gitWorktreeOf(projectRoot)
|
|
105651
105733
|
]);
|
|
105652
105734
|
if (!build2 || !project) return null;
|
|
@@ -105657,7 +105739,7 @@ var CHROMIUM_BROWSER_FRAMEWORK = /\b(chrome|chromium|edge|brave|vivaldi|opera)\b
|
|
|
105657
105739
|
function chromiumKind(appPath) {
|
|
105658
105740
|
let frameworks;
|
|
105659
105741
|
try {
|
|
105660
|
-
frameworks =
|
|
105742
|
+
frameworks = fs32.readdirSync(path28.join(appPath, "Contents", "Frameworks"));
|
|
105661
105743
|
} catch {
|
|
105662
105744
|
return void 0;
|
|
105663
105745
|
}
|
|
@@ -105674,10 +105756,10 @@ var MAX_LOAD_COMMANDS_BYTES = 1024 * 1024;
|
|
|
105674
105756
|
function isCatalystExecutable(executable) {
|
|
105675
105757
|
let fd;
|
|
105676
105758
|
try {
|
|
105677
|
-
fd =
|
|
105759
|
+
fd = fs32.openSync(executable, "r");
|
|
105678
105760
|
const read = (length, position) => {
|
|
105679
105761
|
const buffer = Buffer.alloc(length);
|
|
105680
|
-
return buffer.subarray(0,
|
|
105762
|
+
return buffer.subarray(0, fs32.readSync(fd, buffer, 0, length, position));
|
|
105681
105763
|
};
|
|
105682
105764
|
const header = read(8, 0);
|
|
105683
105765
|
if (header.length < 8) return false;
|
|
@@ -105694,7 +105776,7 @@ function isCatalystExecutable(executable) {
|
|
|
105694
105776
|
} catch {
|
|
105695
105777
|
return false;
|
|
105696
105778
|
} finally {
|
|
105697
|
-
if (fd !== void 0)
|
|
105779
|
+
if (fd !== void 0) fs32.closeSync(fd);
|
|
105698
105780
|
}
|
|
105699
105781
|
}
|
|
105700
105782
|
function isCatalystSlice(read, offset) {
|
|
@@ -105747,7 +105829,7 @@ function parseCodesignDisplay(output2) {
|
|
|
105747
105829
|
}
|
|
105748
105830
|
function isIosAppWrapper(dir) {
|
|
105749
105831
|
try {
|
|
105750
|
-
return
|
|
105832
|
+
return fs32.statSync(path28.join(dir, "Wrapper")).isDirectory() && fs32.lstatSync(path28.join(dir, "WrappedBundle")).isSymbolicLink();
|
|
105751
105833
|
} catch {
|
|
105752
105834
|
return false;
|
|
105753
105835
|
}
|
|
@@ -105788,7 +105870,7 @@ async function inspectMacosApp(appPath) {
|
|
|
105788
105870
|
const badBundle = (message) => invalid3(message, FAILURE_CODES.MACOS_APP_BUNDLE_INVALID);
|
|
105789
105871
|
let resolved;
|
|
105790
105872
|
try {
|
|
105791
|
-
resolved =
|
|
105873
|
+
resolved = fs32.realpathSync(path28.resolve(appPath));
|
|
105792
105874
|
} catch {
|
|
105793
105875
|
throw invalid3(
|
|
105794
105876
|
`No app bundle at ${appPath}.`,
|
|
@@ -105796,8 +105878,8 @@ async function inspectMacosApp(appPath) {
|
|
|
105796
105878
|
"not_found"
|
|
105797
105879
|
);
|
|
105798
105880
|
}
|
|
105799
|
-
const plist =
|
|
105800
|
-
if (!
|
|
105881
|
+
const plist = path28.join(resolved, "Contents", "Info.plist");
|
|
105882
|
+
if (!fs32.statSync(resolved).isDirectory() || !fs32.existsSync(plist)) {
|
|
105801
105883
|
if (isIosAppWrapper(resolved)) {
|
|
105802
105884
|
throw invalid3(
|
|
105803
105885
|
`${appPath} is an iPad or iPhone app that runs on the Mac ("Designed for iPad"). macOS does not let argent load its library into such an app, so argent cannot drive it. Build the app's Mac Catalyst target and boot that, or test the app on an iOS simulator.`,
|
|
@@ -105826,8 +105908,8 @@ async function inspectMacosApp(appPath) {
|
|
|
105826
105908
|
if (!executableName || executableName.includes("/")) {
|
|
105827
105909
|
throw badBundle(`${plist} has no usable CFBundleExecutable.`);
|
|
105828
105910
|
}
|
|
105829
|
-
const executable =
|
|
105830
|
-
if (!
|
|
105911
|
+
const executable = path28.join(resolved, "Contents", "MacOS", executableName);
|
|
105912
|
+
if (!fs32.existsSync(executable)) {
|
|
105831
105913
|
throw badBundle(`The executable ${executable} named by ${plist} does not exist.`);
|
|
105832
105914
|
}
|
|
105833
105915
|
const signature = await readCodeSignature(resolved) ?? parseCodesignDisplay(null);
|
|
@@ -105835,7 +105917,7 @@ async function inspectMacosApp(appPath) {
|
|
|
105835
105917
|
return {
|
|
105836
105918
|
appPath: resolved,
|
|
105837
105919
|
bundleId,
|
|
105838
|
-
name: bundleName ??
|
|
105920
|
+
name: bundleName ?? path28.basename(resolved, ".app"),
|
|
105839
105921
|
executable,
|
|
105840
105922
|
...signature,
|
|
105841
105923
|
...chromium ? { chromium } : {},
|
|
@@ -105888,12 +105970,12 @@ async function findMacosAppByBundleId(bundleId) {
|
|
|
105888
105970
|
for (const line of stdout.split("\n")) {
|
|
105889
105971
|
const appPath = line.trim();
|
|
105890
105972
|
if (!appPath.endsWith(".app")) continue;
|
|
105891
|
-
const contents =
|
|
105892
|
-
const executable = await plistValue(
|
|
105973
|
+
const contents = path28.join(appPath, "Contents");
|
|
105974
|
+
const executable = await plistValue(path28.join(contents, "Info.plist"), "CFBundleExecutable");
|
|
105893
105975
|
if (!executable) continue;
|
|
105894
105976
|
let mtimeMs;
|
|
105895
105977
|
try {
|
|
105896
|
-
mtimeMs =
|
|
105978
|
+
mtimeMs = fs32.statSync(path28.join(contents, "MacOS", executable)).mtimeMs;
|
|
105897
105979
|
} catch {
|
|
105898
105980
|
continue;
|
|
105899
105981
|
}
|
|
@@ -105902,7 +105984,7 @@ async function findMacosAppByBundleId(bundleId) {
|
|
|
105902
105984
|
return best?.appPath ?? null;
|
|
105903
105985
|
}
|
|
105904
105986
|
async function issueSandboxExtension(filePath, opts = {}) {
|
|
105905
|
-
const args = ["issue-extension", "--path",
|
|
105987
|
+
const args = ["issue-extension", "--path", path28.resolve(filePath)];
|
|
105906
105988
|
if (opts.readOnly) args.push("--read-only");
|
|
105907
105989
|
try {
|
|
105908
105990
|
const { stdout } = await execFileAsync17(macosArtifacts().helper, args, { timeout: 1e4 });
|
|
@@ -105922,8 +106004,8 @@ async function issueSandboxExtension(filePath, opts = {}) {
|
|
|
105922
106004
|
}
|
|
105923
106005
|
|
|
105924
106006
|
// ../tool-server/src/utils/chromium-discovery.ts
|
|
105925
|
-
var
|
|
105926
|
-
var
|
|
106007
|
+
var fs35 = __toESM(require("node:fs"));
|
|
106008
|
+
var path31 = __toESM(require("node:path"));
|
|
105927
106009
|
init_src2();
|
|
105928
106010
|
init_device_info();
|
|
105929
106011
|
|
|
@@ -105934,9 +106016,9 @@ init_src2();
|
|
|
105934
106016
|
init_src2();
|
|
105935
106017
|
|
|
105936
106018
|
// ../tool-server/src/chromium-server/cdp-session.ts
|
|
105937
|
-
var
|
|
106019
|
+
var fs33 = __toESM(require("node:fs"));
|
|
105938
106020
|
var os10 = __toESM(require("node:os"));
|
|
105939
|
-
var
|
|
106021
|
+
var path29 = __toESM(require("node:path"));
|
|
105940
106022
|
init_src2();
|
|
105941
106023
|
|
|
105942
106024
|
// ../tool-server/src/utils/debugger/cdp-client.ts
|
|
@@ -106771,8 +106853,8 @@ async function primePageSession(cdp) {
|
|
|
106771
106853
|
}
|
|
106772
106854
|
}
|
|
106773
106855
|
function mediaDir() {
|
|
106774
|
-
const dir =
|
|
106775
|
-
|
|
106856
|
+
const dir = path29.join(os10.tmpdir(), "argent-chromium-media");
|
|
106857
|
+
fs33.mkdirSync(dir, { recursive: true });
|
|
106776
106858
|
return dir;
|
|
106777
106859
|
}
|
|
106778
106860
|
|
|
@@ -107206,8 +107288,8 @@ var ScreencastManager = class {
|
|
|
107206
107288
|
};
|
|
107207
107289
|
|
|
107208
107290
|
// ../tool-server/src/chromium-server/screenshot.ts
|
|
107209
|
-
var
|
|
107210
|
-
var
|
|
107291
|
+
var fs34 = __toESM(require("node:fs"));
|
|
107292
|
+
var path30 = __toESM(require("node:path"));
|
|
107211
107293
|
init_src2();
|
|
107212
107294
|
var sharpCache;
|
|
107213
107295
|
var sharpLoadWarningEmitted = false;
|
|
@@ -107294,8 +107376,8 @@ async function captureScreenshot(ctx, opts = {}) {
|
|
|
107294
107376
|
}
|
|
107295
107377
|
const stem = opts.id ?? `${Date.now()}-${process.pid}`;
|
|
107296
107378
|
const safeDeviceId = ctx.deviceId.replace(/[^A-Za-z0-9_-]/g, "_");
|
|
107297
|
-
const filePath =
|
|
107298
|
-
|
|
107379
|
+
const filePath = path30.join(mediaDir(), `argent-screenshot-${safeDeviceId}-${stem}.png`);
|
|
107380
|
+
fs34.writeFileSync(filePath, bytes);
|
|
107299
107381
|
return {
|
|
107300
107382
|
url: `file://${filePath}`,
|
|
107301
107383
|
path: filePath,
|
|
@@ -107312,7 +107394,7 @@ function readPngSize(buf) {
|
|
|
107312
107394
|
}
|
|
107313
107395
|
async function copyScreenshotToClipboard(ctx, opts = {}) {
|
|
107314
107396
|
const shot = await captureScreenshot(ctx, { rotation: opts.rotation });
|
|
107315
|
-
const bytes =
|
|
107397
|
+
const bytes = fs34.readFileSync(shot.path);
|
|
107316
107398
|
const b64 = bytes.toString("base64");
|
|
107317
107399
|
const script = `(async () => {
|
|
107318
107400
|
const b64 = "${b64}";
|
|
@@ -108019,11 +108101,11 @@ function parsePortList(raw) {
|
|
|
108019
108101
|
}
|
|
108020
108102
|
var TRACKED_PORTS = /* @__PURE__ */ new Set();
|
|
108021
108103
|
function portsFilePath() {
|
|
108022
|
-
return process.env.ARGENT_CHROMIUM_PORTS_FILE ??
|
|
108104
|
+
return process.env.ARGENT_CHROMIUM_PORTS_FILE ?? path31.join(argentHomeDir(), "chromium-cdp-ports.json");
|
|
108023
108105
|
}
|
|
108024
108106
|
function loadPersistedPorts() {
|
|
108025
108107
|
try {
|
|
108026
|
-
const raw = JSON.parse(
|
|
108108
|
+
const raw = JSON.parse(fs35.readFileSync(portsFilePath(), "utf8"));
|
|
108027
108109
|
if (!Array.isArray(raw)) return [];
|
|
108028
108110
|
return raw.filter((p) => typeof p === "number" && p > 0 && p <= 65535);
|
|
108029
108111
|
} catch {
|
|
@@ -108035,8 +108117,8 @@ function persistPorts(mutate) {
|
|
|
108035
108117
|
const file2 = portsFilePath();
|
|
108036
108118
|
const merged = new Set(loadPersistedPorts());
|
|
108037
108119
|
mutate(merged);
|
|
108038
|
-
|
|
108039
|
-
|
|
108120
|
+
fs35.mkdirSync(path31.dirname(file2), { recursive: true });
|
|
108121
|
+
fs35.writeFileSync(file2, JSON.stringify(Array.from(merged)));
|
|
108040
108122
|
} catch {
|
|
108041
108123
|
}
|
|
108042
108124
|
}
|
|
@@ -108100,12 +108182,12 @@ init_src2();
|
|
|
108100
108182
|
// ../tool-server/src/utils/vega-sdk.ts
|
|
108101
108183
|
var import_promises10 = require("node:fs/promises");
|
|
108102
108184
|
var import_node_fs9 = require("node:fs");
|
|
108103
|
-
var
|
|
108185
|
+
var import_node_os7 = require("node:os");
|
|
108104
108186
|
var import_node_path13 = require("node:path");
|
|
108105
108187
|
var import_semver4 = __toESM(require_semver2());
|
|
108106
108188
|
async function readVegaConfig() {
|
|
108107
108189
|
try {
|
|
108108
|
-
const raw = await (0, import_promises10.readFile)((0, import_node_path13.join)((0,
|
|
108190
|
+
const raw = await (0, import_promises10.readFile)((0, import_node_path13.join)((0, import_node_os7.homedir)(), "vega", "config.json"), "utf-8");
|
|
108109
108191
|
return JSON.parse(raw);
|
|
108110
108192
|
} catch {
|
|
108111
108193
|
return {};
|
|
@@ -108117,7 +108199,7 @@ function bareVersion(version3) {
|
|
|
108117
108199
|
function sdkComponentRoots(config2) {
|
|
108118
108200
|
const roots = [
|
|
108119
108201
|
config2.sdkPath && (0, import_node_path13.join)(config2.sdkPath, "vega-sdk"),
|
|
108120
|
-
(0, import_node_path13.join)((0,
|
|
108202
|
+
(0, import_node_path13.join)((0, import_node_os7.homedir)(), "vega", "sdk", "vega-sdk")
|
|
108121
108203
|
].filter((p) => Boolean(p));
|
|
108122
108204
|
return Array.from(new Set(roots));
|
|
108123
108205
|
}
|
|
@@ -109179,7 +109261,7 @@ init_src2();
|
|
|
109179
109261
|
|
|
109180
109262
|
// ../tool-server/src/blueprints/ax-service.ts
|
|
109181
109263
|
var net4 = __toESM(require("node:net"));
|
|
109182
|
-
var
|
|
109264
|
+
var fs36 = __toESM(require("node:fs"));
|
|
109183
109265
|
init_src2();
|
|
109184
109266
|
init_external_devices();
|
|
109185
109267
|
|
|
@@ -109258,7 +109340,7 @@ function startListener(endpoint, onConnection) {
|
|
|
109258
109340
|
return new Promise((resolve24, reject) => {
|
|
109259
109341
|
if (endpoint.transport === "unix") {
|
|
109260
109342
|
try {
|
|
109261
|
-
|
|
109343
|
+
fs36.unlinkSync(endpoint.socketPath);
|
|
109262
109344
|
} catch {
|
|
109263
109345
|
}
|
|
109264
109346
|
}
|
|
@@ -109575,7 +109657,7 @@ var axServiceBlueprint = {
|
|
|
109575
109657
|
server.close();
|
|
109576
109658
|
if (endpoint.transport === "unix") {
|
|
109577
109659
|
try {
|
|
109578
|
-
|
|
109660
|
+
fs36.unlinkSync(endpoint.socketPath);
|
|
109579
109661
|
} catch {
|
|
109580
109662
|
}
|
|
109581
109663
|
}
|
|
@@ -109806,7 +109888,7 @@ var axServiceBlueprint = {
|
|
|
109806
109888
|
server.close();
|
|
109807
109889
|
if (endpoint.transport === "unix") {
|
|
109808
109890
|
try {
|
|
109809
|
-
|
|
109891
|
+
fs36.unlinkSync(endpoint.socketPath);
|
|
109810
109892
|
} catch {
|
|
109811
109893
|
}
|
|
109812
109894
|
}
|
|
@@ -110779,8 +110861,8 @@ var readline2 = __toESM(require("node:readline"));
|
|
|
110779
110861
|
init_src2();
|
|
110780
110862
|
|
|
110781
110863
|
// ../native-devtools-android/src/index.ts
|
|
110782
|
-
var
|
|
110783
|
-
var
|
|
110864
|
+
var path33 = __toESM(require("node:path"));
|
|
110865
|
+
var fs37 = __toESM(require("node:fs"));
|
|
110784
110866
|
|
|
110785
110867
|
// ../native-devtools-android/src/errors.ts
|
|
110786
110868
|
function buildMessage(kind, details) {
|
|
@@ -110813,7 +110895,7 @@ var TraceProcessorUnavailableError = class _TraceProcessorUnavailableError exten
|
|
|
110813
110895
|
// ../native-devtools-android/src/wasm-trace-processor.ts
|
|
110814
110896
|
var import_node_fs10 = require("node:fs");
|
|
110815
110897
|
var import_promises11 = require("node:fs/promises");
|
|
110816
|
-
var
|
|
110898
|
+
var path32 = __toESM(require("node:path"));
|
|
110817
110899
|
var import_node_url2 = require("node:url");
|
|
110818
110900
|
var import_node_vm = __toESM(require("node:vm"));
|
|
110819
110901
|
|
|
@@ -111138,14 +111220,14 @@ function engineGlobals() {
|
|
|
111138
111220
|
return globalThis;
|
|
111139
111221
|
}
|
|
111140
111222
|
function resolveTraceProcessorAssets() {
|
|
111141
|
-
const dir =
|
|
111223
|
+
const dir = path32.join(__dirname, "..", "assets", "trace-processor");
|
|
111142
111224
|
const wasmOverride = process.env.ARGENT_TRACE_PROCESSOR_WASM;
|
|
111143
111225
|
if (wasmOverride && !(0, import_node_fs10.existsSync)(wasmOverride)) {
|
|
111144
111226
|
throw new TraceProcessorUnavailableError("wasm_path_invalid", { path: wasmOverride });
|
|
111145
111227
|
}
|
|
111146
111228
|
return {
|
|
111147
|
-
wasmPath: wasmOverride ??
|
|
111148
|
-
gluePath:
|
|
111229
|
+
wasmPath: wasmOverride ?? path32.join(dir, "trace_processor.wasm"),
|
|
111230
|
+
gluePath: path32.join(dir, "engine_bundle.node.js")
|
|
111149
111231
|
};
|
|
111150
111232
|
}
|
|
111151
111233
|
function patchGlueForNode(src) {
|
|
@@ -111233,7 +111315,7 @@ async function createEngine() {
|
|
|
111233
111315
|
});
|
|
111234
111316
|
try {
|
|
111235
111317
|
const { wasmPath, gluePath } = resolveTraceProcessorAssets();
|
|
111236
|
-
const dir =
|
|
111318
|
+
const dir = path32.dirname(wasmPath);
|
|
111237
111319
|
setupWorkerScope(dir);
|
|
111238
111320
|
const g = engineGlobals();
|
|
111239
111321
|
const wasmModule = await g.WebAssembly.compile(await (0, import_promises11.readFile)(wasmPath));
|
|
@@ -111358,25 +111440,25 @@ async function ensureTraceProcessorReady(tracePath) {
|
|
|
111358
111440
|
|
|
111359
111441
|
// ../native-devtools-android/src/index.ts
|
|
111360
111442
|
function binDir() {
|
|
111361
|
-
return process.env.ARGENT_NATIVE_DEVTOOLS_ANDROID_BIN_DIR ??
|
|
111443
|
+
return process.env.ARGENT_NATIVE_DEVTOOLS_ANDROID_BIN_DIR ?? path33.join(__dirname, "..", "bin");
|
|
111362
111444
|
}
|
|
111363
111445
|
function traceProcessorQueriesDir() {
|
|
111364
|
-
return process.env.ARGENT_NATIVE_DEVTOOLS_ANDROID_QUERIES_DIR ??
|
|
111446
|
+
return process.env.ARGENT_NATIVE_DEVTOOLS_ANDROID_QUERIES_DIR ?? path33.join(__dirname, "..", "assets", "queries");
|
|
111365
111447
|
}
|
|
111366
111448
|
function traceConfigPath() {
|
|
111367
|
-
return process.env.ARGENT_NATIVE_DEVTOOLS_ANDROID_TRACECFG ??
|
|
111449
|
+
return process.env.ARGENT_NATIVE_DEVTOOLS_ANDROID_TRACECFG ?? path33.join(__dirname, "..", "assets", "argent.tracecfg.pbtxt");
|
|
111368
111450
|
}
|
|
111369
111451
|
var cachedManifest = null;
|
|
111370
111452
|
function helperManifest() {
|
|
111371
111453
|
if (cachedManifest) return cachedManifest;
|
|
111372
|
-
const manifestPath =
|
|
111373
|
-
cachedManifest = JSON.parse(
|
|
111454
|
+
const manifestPath = path33.join(__dirname, "..", "assets", "manifest.json");
|
|
111455
|
+
cachedManifest = JSON.parse(fs37.readFileSync(manifestPath, "utf-8"));
|
|
111374
111456
|
return cachedManifest;
|
|
111375
111457
|
}
|
|
111376
111458
|
function bundledHelperApkPath() {
|
|
111377
111459
|
const manifest = helperManifest();
|
|
111378
|
-
const apk =
|
|
111379
|
-
if (!
|
|
111460
|
+
const apk = path33.join(binDir(), `argent-android-devtools-${manifest.versionName}.apk`);
|
|
111461
|
+
if (!fs37.existsSync(apk)) {
|
|
111380
111462
|
throw new Error(
|
|
111381
111463
|
`Bundled Android devtools helper APK not found at ${apk}. Run \`bash packages/native-devtools-android/scripts/build.sh\` to build it.`
|
|
111382
111464
|
);
|
|
@@ -115377,7 +115459,7 @@ data: ${JSON.stringify(data)}
|
|
|
115377
115459
|
const MAX_PREVIEW_BYTES = 25 * 1024 * 1024;
|
|
115378
115460
|
const allowedRoots = (() => {
|
|
115379
115461
|
const roots = /* @__PURE__ */ new Set();
|
|
115380
|
-
for (const r of [
|
|
115462
|
+
for (const r of [import_node_os8.default.tmpdir(), process.cwd(), "/tmp"]) {
|
|
115381
115463
|
try {
|
|
115382
115464
|
roots.add(import_node_fs11.default.realpathSync(r));
|
|
115383
115465
|
} catch {
|
|
@@ -115555,7 +115637,7 @@ function streamDirectoryAsArchive(id, entry, req, res) {
|
|
|
115555
115637
|
|
|
115556
115638
|
// ../tool-server/src/file-inputs.ts
|
|
115557
115639
|
var import_promises13 = require("node:fs/promises");
|
|
115558
|
-
var
|
|
115640
|
+
var import_node_os9 = require("node:os");
|
|
115559
115641
|
var import_node_path15 = require("node:path");
|
|
115560
115642
|
var import_bytes = __toESM(require_bytes());
|
|
115561
115643
|
init_src2();
|
|
@@ -115612,7 +115694,7 @@ function decodeContent(wire) {
|
|
|
115612
115694
|
}
|
|
115613
115695
|
async function materializeUpload(wire) {
|
|
115614
115696
|
const data = decodeContent(wire);
|
|
115615
|
-
const dir = await (0, import_promises13.mkdtemp)((0, import_node_path15.join)((0,
|
|
115697
|
+
const dir = await (0, import_promises13.mkdtemp)((0, import_node_path15.join)((0, import_node_os9.tmpdir)(), "argent-file-input-"));
|
|
115616
115698
|
const filePath = (0, import_node_path15.join)(dir, sanitizeFilename((0, import_node_path15.basename)(wire.path)));
|
|
115617
115699
|
await (0, import_promises13.writeFile)(filePath, data);
|
|
115618
115700
|
return { filePath, dir };
|
|
@@ -115636,7 +115718,7 @@ async function extractTarUpload(wire, uploadId, meta3, tempDirs, lookupUpload) {
|
|
|
115636
115718
|
);
|
|
115637
115719
|
}
|
|
115638
115720
|
const extractDir = await (0, import_promises13.mkdtemp)(
|
|
115639
|
-
(0, import_node_path15.join)((0,
|
|
115721
|
+
(0, import_node_path15.join)((0, import_node_os9.tmpdir)(), `argent-tar-upload-${entry.sha256.slice(0, 16)}-`)
|
|
115640
115722
|
);
|
|
115641
115723
|
tempDirs.push(extractDir);
|
|
115642
115724
|
const uploaded = await safeExtractArchive(entry.tarPath, extractDir, (0, import_node_path15.basename)(wire.path));
|
|
@@ -116076,14 +116158,14 @@ Connection: close\r
|
|
|
116076
116158
|
return wss;
|
|
116077
116159
|
}
|
|
116078
116160
|
function bindWsToServer(ws, server) {
|
|
116079
|
-
const
|
|
116161
|
+
const sendJson = (payload) => {
|
|
116080
116162
|
try {
|
|
116081
116163
|
ws.send(JSON.stringify(payload));
|
|
116082
116164
|
} catch {
|
|
116083
116165
|
}
|
|
116084
116166
|
};
|
|
116085
|
-
const onFps = (report2) =>
|
|
116086
|
-
const onFrame = (frame2) =>
|
|
116167
|
+
const onFps = (report2) => sendJson({ event: "fpsReport", ...report2 });
|
|
116168
|
+
const onFrame = (frame2) => sendJson({ event: "frame", sessionId: frame2.sessionId });
|
|
116087
116169
|
server.events.on("fpsReport", onFps);
|
|
116088
116170
|
server.events.on("frame", onFrame);
|
|
116089
116171
|
ws.on("close", () => {
|
|
@@ -116096,15 +116178,15 @@ function bindWsToServer(ws, server) {
|
|
|
116096
116178
|
try {
|
|
116097
116179
|
msg = JSON.parse(text);
|
|
116098
116180
|
} catch (err) {
|
|
116099
|
-
|
|
116181
|
+
sendJson({ status: "error", message: `parse error: ${err.message}` });
|
|
116100
116182
|
return;
|
|
116101
116183
|
}
|
|
116102
116184
|
const id = msg.id;
|
|
116103
116185
|
try {
|
|
116104
116186
|
const result = await handleWsCommand(msg, server);
|
|
116105
|
-
|
|
116187
|
+
sendJson({ id, status: "ok", ...result });
|
|
116106
116188
|
} catch (err) {
|
|
116107
|
-
|
|
116189
|
+
sendJson({ id, status: "error", message: err instanceof Error ? err.message : String(err) });
|
|
116108
116190
|
}
|
|
116109
116191
|
});
|
|
116110
116192
|
}
|
|
@@ -116364,10 +116446,189 @@ init_device_info();
|
|
|
116364
116446
|
|
|
116365
116447
|
// ../tool-server/src/blueprints/tv-control.ts
|
|
116366
116448
|
var net6 = __toESM(require("node:net"));
|
|
116367
|
-
var
|
|
116449
|
+
var fs39 = __toESM(require("node:fs"));
|
|
116368
116450
|
var import_node_child_process27 = require("node:child_process");
|
|
116369
116451
|
init_src2();
|
|
116370
116452
|
init_capability();
|
|
116453
|
+
|
|
116454
|
+
// ../tool-server/src/blueprints/tvos-typing.ts
|
|
116455
|
+
init_src2();
|
|
116456
|
+
|
|
116457
|
+
// ../tool-server/src/tools/keyboard/key-codes.ts
|
|
116458
|
+
var SHIFT_KEYCODE = 225;
|
|
116459
|
+
var SYMBOL_KEYCODES = {
|
|
116460
|
+
"\n": 40,
|
|
116461
|
+
"\r": 40,
|
|
116462
|
+
" ": 43,
|
|
116463
|
+
" ": 44,
|
|
116464
|
+
"-": 45,
|
|
116465
|
+
"=": 46,
|
|
116466
|
+
"[": 47,
|
|
116467
|
+
"]": 48,
|
|
116468
|
+
"\\": 49,
|
|
116469
|
+
";": 51,
|
|
116470
|
+
"'": 52,
|
|
116471
|
+
"`": 53,
|
|
116472
|
+
",": 54,
|
|
116473
|
+
".": 55,
|
|
116474
|
+
"/": 56
|
|
116475
|
+
};
|
|
116476
|
+
var SHIFTED_SYMBOLS = {
|
|
116477
|
+
"!": "1",
|
|
116478
|
+
"@": "2",
|
|
116479
|
+
"#": "3",
|
|
116480
|
+
"$": "4",
|
|
116481
|
+
"%": "5",
|
|
116482
|
+
"^": "6",
|
|
116483
|
+
"&": "7",
|
|
116484
|
+
"*": "8",
|
|
116485
|
+
"(": "9",
|
|
116486
|
+
")": "0",
|
|
116487
|
+
"_": "-",
|
|
116488
|
+
"+": "=",
|
|
116489
|
+
"{": "[",
|
|
116490
|
+
"}": "]",
|
|
116491
|
+
"|": "\\",
|
|
116492
|
+
":": ";",
|
|
116493
|
+
'"': "'",
|
|
116494
|
+
"~": "`",
|
|
116495
|
+
"<": ",",
|
|
116496
|
+
">": ".",
|
|
116497
|
+
"?": "/"
|
|
116498
|
+
};
|
|
116499
|
+
var NAMED_KEYS = {
|
|
116500
|
+
"enter": 40,
|
|
116501
|
+
"return": 40,
|
|
116502
|
+
"escape": 41,
|
|
116503
|
+
"esc": 41,
|
|
116504
|
+
"backspace": 42,
|
|
116505
|
+
"delete": 42,
|
|
116506
|
+
"tab": 43,
|
|
116507
|
+
"space": 44,
|
|
116508
|
+
"arrow-right": 79,
|
|
116509
|
+
"arrow-left": 80,
|
|
116510
|
+
"arrow-down": 81,
|
|
116511
|
+
"arrow-up": 82,
|
|
116512
|
+
"f1": 58,
|
|
116513
|
+
"f2": 59,
|
|
116514
|
+
"f3": 60,
|
|
116515
|
+
"f4": 61,
|
|
116516
|
+
"f5": 62,
|
|
116517
|
+
"f6": 63,
|
|
116518
|
+
"f7": 64,
|
|
116519
|
+
"f8": 65,
|
|
116520
|
+
"f9": 66,
|
|
116521
|
+
"f10": 67,
|
|
116522
|
+
"f11": 68,
|
|
116523
|
+
"f12": 69
|
|
116524
|
+
};
|
|
116525
|
+
function charToKeyPress(char) {
|
|
116526
|
+
if (char.length !== 1) return void 0;
|
|
116527
|
+
const c = char.charCodeAt(0);
|
|
116528
|
+
if (c >= 97 && c <= 122) return { keyCode: c - 97 + 4, withShift: false };
|
|
116529
|
+
if (c >= 65 && c <= 90) return { keyCode: c - 65 + 4, withShift: true };
|
|
116530
|
+
if (c >= 49 && c <= 57) return { keyCode: c - 49 + 30, withShift: false };
|
|
116531
|
+
if (char === "0") return { keyCode: 39, withShift: false };
|
|
116532
|
+
const base = SHIFTED_SYMBOLS[char];
|
|
116533
|
+
if (base !== void 0) {
|
|
116534
|
+
const basePress = charToKeyPress(base);
|
|
116535
|
+
if (basePress === void 0) return void 0;
|
|
116536
|
+
return { keyCode: basePress.keyCode, withShift: true };
|
|
116537
|
+
}
|
|
116538
|
+
const code = SYMBOL_KEYCODES[char];
|
|
116539
|
+
if (code === void 0) return void 0;
|
|
116540
|
+
return { keyCode: code, withShift: false };
|
|
116541
|
+
}
|
|
116542
|
+
|
|
116543
|
+
// ../tool-server/src/blueprints/tvos-typing.ts
|
|
116544
|
+
init_capability();
|
|
116545
|
+
var LEFT_SHIFT = 225;
|
|
116546
|
+
var LEFT_OPTION = 226;
|
|
116547
|
+
var DEAD_KEYS = {
|
|
116548
|
+
"\u0300": { keyCode: 53, bases: "aeiou" },
|
|
116549
|
+
// grave: Option + `
|
|
116550
|
+
// Not y: the dead key types "´y", not "ý".
|
|
116551
|
+
"\u0301": { keyCode: 8, bases: "aeiou" },
|
|
116552
|
+
// acute: Option + e
|
|
116553
|
+
"\u0302": { keyCode: 12, bases: "aeiou" },
|
|
116554
|
+
// circumflex: Option + i
|
|
116555
|
+
"\u0303": { keyCode: 17, bases: "ano" },
|
|
116556
|
+
// tilde: Option + n
|
|
116557
|
+
"\u0308": { keyCode: 24, bases: "aeiouy" }
|
|
116558
|
+
// diaeresis: Option + u
|
|
116559
|
+
};
|
|
116560
|
+
var OPTION_LETTERS = {
|
|
116561
|
+
\u00E7: { keyCode: 6, shift: false, option: true },
|
|
116562
|
+
\u00C7: { keyCode: 6, shift: true, option: true },
|
|
116563
|
+
\u00DF: { keyCode: 22, shift: false, option: true }
|
|
116564
|
+
};
|
|
116565
|
+
function accentedPresses(char) {
|
|
116566
|
+
const direct = OPTION_LETTERS[char];
|
|
116567
|
+
if (direct) return [direct];
|
|
116568
|
+
const [base, mark, ...rest] = char.normalize("NFD");
|
|
116569
|
+
if (base === void 0 || mark === void 0 || rest.length > 0) return void 0;
|
|
116570
|
+
const dead = DEAD_KEYS[mark];
|
|
116571
|
+
if (!dead || !dead.bases.includes(base.toLowerCase())) return void 0;
|
|
116572
|
+
const basePress = charToKeyPress(base);
|
|
116573
|
+
if (!basePress) return void 0;
|
|
116574
|
+
return [
|
|
116575
|
+
{ keyCode: dead.keyCode, shift: false, option: true },
|
|
116576
|
+
{ keyCode: basePress.keyCode, shift: basePress.withShift, option: false }
|
|
116577
|
+
];
|
|
116578
|
+
}
|
|
116579
|
+
function isPrintableAscii(char) {
|
|
116580
|
+
const cp = char.codePointAt(0);
|
|
116581
|
+
return cp >= 32 && cp <= 126;
|
|
116582
|
+
}
|
|
116583
|
+
function planTvosTyping(text) {
|
|
116584
|
+
const steps = [];
|
|
116585
|
+
let run2 = "";
|
|
116586
|
+
const flushRun = () => {
|
|
116587
|
+
const trimmed = run2.replace(/ +$/, "");
|
|
116588
|
+
if (trimmed) steps.push({ kind: "text", text: trimmed });
|
|
116589
|
+
for (const char of run2.slice(trimmed.length)) {
|
|
116590
|
+
const press = charToKeyPress(char);
|
|
116591
|
+
steps.push({
|
|
116592
|
+
kind: "press",
|
|
116593
|
+
press: { keyCode: press.keyCode, shift: press.withShift, option: false }
|
|
116594
|
+
});
|
|
116595
|
+
}
|
|
116596
|
+
run2 = "";
|
|
116597
|
+
};
|
|
116598
|
+
for (const char of text.normalize("NFC")) {
|
|
116599
|
+
if (isPrintableAscii(char)) {
|
|
116600
|
+
run2 += char;
|
|
116601
|
+
continue;
|
|
116602
|
+
}
|
|
116603
|
+
const tab = charToKeyPress(" ");
|
|
116604
|
+
const presses = char === " " ? [{ keyCode: tab.keyCode, shift: false, option: false }] : accentedPresses(char);
|
|
116605
|
+
if (!presses) {
|
|
116606
|
+
const hex3 = char.codePointAt(0).toString(16).toUpperCase().padStart(4, "0");
|
|
116607
|
+
throw new InvalidToolInputError(
|
|
116608
|
+
`Apple TV keyboard cannot type "${char}" (U+${hex3}), so nothing was typed. It types printable ASCII, tabs, a/e/i/o/u with a grave, acute, circumflex, or diaeresis, y with a diaeresis, a/n/o with a tilde (any case), and \xE7, \xC7, \xDF. Remove or replace the character.`,
|
|
116609
|
+
{
|
|
116610
|
+
error_code: FAILURE_CODES.KEYBOARD_CHARACTER_UNSUPPORTED,
|
|
116611
|
+
failure_stage: "keyboard_char_tvos",
|
|
116612
|
+
error_kind: "unsupported"
|
|
116613
|
+
}
|
|
116614
|
+
);
|
|
116615
|
+
}
|
|
116616
|
+
flushRun();
|
|
116617
|
+
for (const press of presses) steps.push({ kind: "press", press });
|
|
116618
|
+
}
|
|
116619
|
+
flushRun();
|
|
116620
|
+
return steps;
|
|
116621
|
+
}
|
|
116622
|
+
function pressLines(press) {
|
|
116623
|
+
const down = [
|
|
116624
|
+
...press.option ? [LEFT_OPTION] : [],
|
|
116625
|
+
...press.shift ? [LEFT_SHIFT] : [],
|
|
116626
|
+
press.keyCode
|
|
116627
|
+
];
|
|
116628
|
+
return { down, up: [...down].reverse() };
|
|
116629
|
+
}
|
|
116630
|
+
|
|
116631
|
+
// ../tool-server/src/blueprints/tv-control.ts
|
|
116371
116632
|
var TV_CONTROL_NAMESPACE = "TvControl";
|
|
116372
116633
|
function tvControlRef(device) {
|
|
116373
116634
|
return {
|
|
@@ -116412,9 +116673,18 @@ var TYPE_BASE_MS = 1e4;
|
|
|
116412
116673
|
function typeTimeoutMs(textLength) {
|
|
116413
116674
|
return TYPE_BASE_MS + textLength * TYPE_MS_PER_CHAR;
|
|
116414
116675
|
}
|
|
116415
|
-
async function
|
|
116416
|
-
|
|
116676
|
+
async function sendHid(socketPath, verb, command2, timeoutMs) {
|
|
116677
|
+
const reply = parseReply((await sendLine(socketPath, command2, timeoutMs)).trim(), verb);
|
|
116678
|
+
if (reply && typeof reply === "object" && reply.ok === false) {
|
|
116679
|
+
const error63 = reply.error;
|
|
116680
|
+
throw new Error(
|
|
116681
|
+
`tvOS HID daemon refused "${verb}": ${typeof error63 === "string" ? error63 : "no reason given"}`
|
|
116682
|
+
);
|
|
116683
|
+
}
|
|
116417
116684
|
}
|
|
116685
|
+
var KEY_HOLD_MS = 20;
|
|
116686
|
+
var MODIFIER_GAP_MS = 10;
|
|
116687
|
+
var sleep2 = (ms3) => new Promise((r) => setTimeout(r, ms3));
|
|
116418
116688
|
function parseReply(raw, command2) {
|
|
116419
116689
|
if (!raw) return {};
|
|
116420
116690
|
try {
|
|
@@ -116474,7 +116744,7 @@ async function waitForSocket(socketPath, proc, timeoutMs) {
|
|
|
116474
116744
|
if (exited !== void 0) {
|
|
116475
116745
|
throw new Error(`tv daemon exited with code ${exited} before its socket was ready`);
|
|
116476
116746
|
}
|
|
116477
|
-
if (
|
|
116747
|
+
if (fs39.existsSync(socketPath)) {
|
|
116478
116748
|
const ok = await new Promise((resolve24) => {
|
|
116479
116749
|
const s = net6.createConnection(socketPath);
|
|
116480
116750
|
s.on("connect", () => {
|
|
@@ -116578,7 +116848,7 @@ var tvControlBlueprint = {
|
|
|
116578
116848
|
await reapDaemons(axSock);
|
|
116579
116849
|
for (const p of [axSock, hidSock]) {
|
|
116580
116850
|
try {
|
|
116581
|
-
|
|
116851
|
+
fs39.unlinkSync(p);
|
|
116582
116852
|
} catch {
|
|
116583
116853
|
}
|
|
116584
116854
|
}
|
|
@@ -116594,7 +116864,7 @@ var tvControlBlueprint = {
|
|
|
116594
116864
|
}
|
|
116595
116865
|
axExited = false;
|
|
116596
116866
|
try {
|
|
116597
|
-
|
|
116867
|
+
fs39.unlinkSync(axSock);
|
|
116598
116868
|
} catch {
|
|
116599
116869
|
}
|
|
116600
116870
|
await reapDaemons(axSock);
|
|
@@ -116619,7 +116889,7 @@ var tvControlBlueprint = {
|
|
|
116619
116889
|
axProc.kill("SIGKILL");
|
|
116620
116890
|
}
|
|
116621
116891
|
try {
|
|
116622
|
-
|
|
116892
|
+
fs39.unlinkSync(axSock);
|
|
116623
116893
|
} catch {
|
|
116624
116894
|
}
|
|
116625
116895
|
}
|
|
@@ -116661,6 +116931,25 @@ var tvControlBlueprint = {
|
|
|
116661
116931
|
}
|
|
116662
116932
|
}
|
|
116663
116933
|
}
|
|
116934
|
+
async function pressKey2(press) {
|
|
116935
|
+
const { down, up } = pressLines(press);
|
|
116936
|
+
try {
|
|
116937
|
+
for (const keyCode of down) {
|
|
116938
|
+
await sendHid(hidSock, "key_down", `key_down ${keyCode}`);
|
|
116939
|
+
await sleep2(keyCode === press.keyCode ? KEY_HOLD_MS : MODIFIER_GAP_MS);
|
|
116940
|
+
}
|
|
116941
|
+
for (const keyCode of up) {
|
|
116942
|
+
await sendHid(hidSock, "key_up", `key_up ${keyCode}`);
|
|
116943
|
+
await sleep2(MODIFIER_GAP_MS);
|
|
116944
|
+
}
|
|
116945
|
+
} catch (err) {
|
|
116946
|
+
for (const keyCode of up) {
|
|
116947
|
+
await sendHid(hidSock, "key_up", `key_up ${keyCode}`).catch(() => {
|
|
116948
|
+
});
|
|
116949
|
+
}
|
|
116950
|
+
throw err;
|
|
116951
|
+
}
|
|
116952
|
+
}
|
|
116664
116953
|
const api = {
|
|
116665
116954
|
async describe() {
|
|
116666
116955
|
const r = await sendAx("describe", 1e4);
|
|
@@ -116674,13 +116963,19 @@ var tvControlBlueprint = {
|
|
|
116674
116963
|
return await sendAx("hierarchy", 1e4);
|
|
116675
116964
|
},
|
|
116676
116965
|
async navigate(direction) {
|
|
116677
|
-
await
|
|
116966
|
+
await sendHid(hidSock, "navigate", `navigate ${direction}`);
|
|
116678
116967
|
},
|
|
116679
116968
|
async type(text) {
|
|
116680
116969
|
if (/[\n\r]/.test(text)) {
|
|
116681
116970
|
throw new Error("Apple TV keyboard text must not contain newlines");
|
|
116682
116971
|
}
|
|
116683
|
-
|
|
116972
|
+
for (const step of planTvosTyping(text)) {
|
|
116973
|
+
if (step.kind === "text") {
|
|
116974
|
+
await sendHid(hidSock, "type", `type ${step.text}`, typeTimeoutMs(step.text.length));
|
|
116975
|
+
continue;
|
|
116976
|
+
}
|
|
116977
|
+
await pressKey2(step.press);
|
|
116978
|
+
}
|
|
116684
116979
|
},
|
|
116685
116980
|
async recycleAx() {
|
|
116686
116981
|
await recycleAx();
|
|
@@ -116701,7 +116996,7 @@ var tvControlBlueprint = {
|
|
|
116701
116996
|
await reapDaemons(axSock);
|
|
116702
116997
|
for (const p of [axSock, hidSock]) {
|
|
116703
116998
|
try {
|
|
116704
|
-
|
|
116999
|
+
fs39.unlinkSync(p);
|
|
116705
117000
|
} catch {
|
|
116706
117001
|
}
|
|
116707
117002
|
}
|
|
@@ -117223,10 +117518,10 @@ function reserveLaunchMeasurement(udid) {
|
|
|
117223
117518
|
// ../tool-server/src/utils/ios-device/runner-artifact.ts
|
|
117224
117519
|
var import_node_child_process29 = require("node:child_process");
|
|
117225
117520
|
var import_node_util21 = require("node:util");
|
|
117226
|
-
var
|
|
117227
|
-
var
|
|
117521
|
+
var import_node_crypto13 = require("node:crypto");
|
|
117522
|
+
var fs41 = __toESM(require("node:fs"));
|
|
117228
117523
|
var fsp = __toESM(require("node:fs/promises"));
|
|
117229
|
-
var
|
|
117524
|
+
var path36 = __toESM(require("node:path"));
|
|
117230
117525
|
init_src2();
|
|
117231
117526
|
|
|
117232
117527
|
// ../tool-server/src/utils/ios-device/runner-signing.ts
|
|
@@ -117235,13 +117530,13 @@ init_src2();
|
|
|
117235
117530
|
// ../tool-server/src/utils/ios-device/provisioning-profiles.ts
|
|
117236
117531
|
var import_node_child_process28 = require("node:child_process");
|
|
117237
117532
|
var import_node_fs13 = require("node:fs");
|
|
117238
|
-
var
|
|
117239
|
-
var
|
|
117533
|
+
var import_node_os10 = require("node:os");
|
|
117534
|
+
var path35 = __toESM(require("node:path"));
|
|
117240
117535
|
var import_node_util20 = require("node:util");
|
|
117241
117536
|
var execFileAsync19 = (0, import_node_util20.promisify)(import_node_child_process28.execFile);
|
|
117242
117537
|
var PROFILE_DIRECTORIES = [
|
|
117243
|
-
|
|
117244
|
-
|
|
117538
|
+
path35.join("Library", "Developer", "Xcode", "UserData", "Provisioning Profiles"),
|
|
117539
|
+
path35.join("Library", "MobileDevice", "Provisioning Profiles")
|
|
117245
117540
|
];
|
|
117246
117541
|
var PROFILE_DECODE_TIMEOUT_MS = 5e3;
|
|
117247
117542
|
var PROFILE_MAX_BYTES = 16 * 1024 * 1024;
|
|
@@ -117262,9 +117557,9 @@ function parseProvisioningProfile(xml) {
|
|
|
117262
117557
|
async function readInstalledProfiles() {
|
|
117263
117558
|
const files = (await Promise.all(
|
|
117264
117559
|
PROFILE_DIRECTORIES.map(async (directory) => {
|
|
117265
|
-
const absolute =
|
|
117560
|
+
const absolute = path35.join((0, import_node_os10.homedir)(), directory);
|
|
117266
117561
|
const names = await import_node_fs13.promises.readdir(absolute).catch(() => []);
|
|
117267
|
-
return names.filter((name) => name.endsWith(".mobileprovision")).map((name) =>
|
|
117562
|
+
return names.filter((name) => name.endsWith(".mobileprovision")).map((name) => path35.join(absolute, name));
|
|
117268
117563
|
})
|
|
117269
117564
|
)).flat();
|
|
117270
117565
|
const decoded2 = await Promise.all(
|
|
@@ -117355,8 +117650,8 @@ function resolveRunnerProjectPath() {
|
|
|
117355
117650
|
if (override) {
|
|
117356
117651
|
return override;
|
|
117357
117652
|
}
|
|
117358
|
-
const candidate =
|
|
117359
|
-
if (
|
|
117653
|
+
const candidate = path36.resolve(__dirname, PROJECT_SUFFIX);
|
|
117654
|
+
if (fs41.existsSync(candidate)) {
|
|
117360
117655
|
return candidate;
|
|
117361
117656
|
}
|
|
117362
117657
|
throw withFailureSignal(
|
|
@@ -117381,8 +117676,8 @@ var FINGERPRINT_NOISE = /* @__PURE__ */ new Set([
|
|
|
117381
117676
|
".DS_Store"
|
|
117382
117677
|
]);
|
|
117383
117678
|
async function fingerprintRunnerSources(projectPath) {
|
|
117384
|
-
const root =
|
|
117385
|
-
const hash2 = (0,
|
|
117679
|
+
const root = path36.dirname(projectPath);
|
|
117680
|
+
const hash2 = (0, import_node_crypto13.createHash)("sha256");
|
|
117386
117681
|
const walk = async (dir) => {
|
|
117387
117682
|
const entries = (await fsp.readdir(dir, { withFileTypes: true })).sort(
|
|
117388
117683
|
(a, b) => a.name.localeCompare(b.name)
|
|
@@ -117391,12 +117686,12 @@ async function fingerprintRunnerSources(projectPath) {
|
|
|
117391
117686
|
if (FINGERPRINT_NOISE.has(entry.name)) {
|
|
117392
117687
|
continue;
|
|
117393
117688
|
}
|
|
117394
|
-
const full =
|
|
117689
|
+
const full = path36.join(dir, entry.name);
|
|
117395
117690
|
if (entry.isDirectory()) {
|
|
117396
117691
|
await walk(full);
|
|
117397
117692
|
} else if (entry.isFile()) {
|
|
117398
117693
|
const content = await fsp.readFile(full);
|
|
117399
|
-
hash2.update(`${
|
|
117694
|
+
hash2.update(`${path36.relative(root, full)}|${content.length}
|
|
117400
117695
|
`);
|
|
117401
117696
|
hash2.update(content);
|
|
117402
117697
|
}
|
|
@@ -117414,10 +117709,10 @@ async function xcodeVersionFingerprint() {
|
|
|
117414
117709
|
}
|
|
117415
117710
|
}
|
|
117416
117711
|
function derivedRoot() {
|
|
117417
|
-
return
|
|
117712
|
+
return path36.join(argentHomeDir(), "ios-device-runner", "derived");
|
|
117418
117713
|
}
|
|
117419
117714
|
function derivedDirForTeam(teamId) {
|
|
117420
|
-
return
|
|
117715
|
+
return path36.join(derivedRoot(), teamId);
|
|
117421
117716
|
}
|
|
117422
117717
|
var CACHE_KEY_FILE = ".argent-cache-key";
|
|
117423
117718
|
var TEAM_DIRECTORY_RE = /^[A-Z0-9]{10}$/;
|
|
@@ -117425,24 +117720,24 @@ async function removeBuildSharedByAllTeams(currentTeamId) {
|
|
|
117425
117720
|
const root = derivedRoot();
|
|
117426
117721
|
const entries = await fsp.readdir(root).catch(() => []);
|
|
117427
117722
|
await Promise.all(
|
|
117428
|
-
entries.filter((entry) => entry !== currentTeamId && !TEAM_DIRECTORY_RE.test(entry)).map((entry) => fsp.rm(
|
|
117723
|
+
entries.filter((entry) => entry !== currentTeamId && !TEAM_DIRECTORY_RE.test(entry)).map((entry) => fsp.rm(path36.join(root, entry), { recursive: true, force: true }))
|
|
117429
117724
|
);
|
|
117430
117725
|
}
|
|
117431
117726
|
function runnerProductsDir(derivedDataPath) {
|
|
117432
|
-
return
|
|
117727
|
+
return path36.join(derivedDataPath, "Build", "Products");
|
|
117433
117728
|
}
|
|
117434
117729
|
function findBaseXctestrun(derivedDataPath) {
|
|
117435
117730
|
const productsDir = runnerProductsDir(derivedDataPath);
|
|
117436
|
-
if (!
|
|
117731
|
+
if (!fs41.existsSync(productsDir)) {
|
|
117437
117732
|
return null;
|
|
117438
117733
|
}
|
|
117439
|
-
const candidates =
|
|
117734
|
+
const candidates = fs41.readdirSync(productsDir).filter((name) => {
|
|
117440
117735
|
return name.endsWith(".xctestrun") && name.includes("iphoneos");
|
|
117441
117736
|
});
|
|
117442
117737
|
if (candidates.length === 0) {
|
|
117443
117738
|
return null;
|
|
117444
117739
|
}
|
|
117445
|
-
return
|
|
117740
|
+
return path36.join(productsDir, candidates.sort()[0]);
|
|
117446
117741
|
}
|
|
117447
117742
|
function xcodebuildFailureSummary(output2) {
|
|
117448
117743
|
const lines = output2.split("\n");
|
|
@@ -117479,19 +117774,19 @@ function runnerBuildStaticArgs(projectPath, config2) {
|
|
|
117479
117774
|
];
|
|
117480
117775
|
}
|
|
117481
117776
|
function runnerBuildLocationArgs(derivedDataPath) {
|
|
117482
|
-
const root =
|
|
117483
|
-
const intermediatesDir =
|
|
117777
|
+
const root = path36.resolve(derivedDataPath);
|
|
117778
|
+
const intermediatesDir = path36.join(root, "Build", "Intermediates.noindex");
|
|
117484
117779
|
return [
|
|
117485
117780
|
"-derivedDataPath",
|
|
117486
117781
|
derivedDataPath,
|
|
117487
117782
|
`SYMROOT=${runnerProductsDir(root)}`,
|
|
117488
117783
|
`OBJROOT=${intermediatesDir}`,
|
|
117489
117784
|
// Set from the same preference, and OBJROOT does not move it.
|
|
117490
|
-
`SHARED_PRECOMPS_DIR=${
|
|
117785
|
+
`SHARED_PRECOMPS_DIR=${path36.join(intermediatesDir, "PrecompiledHeaders")}`
|
|
117491
117786
|
];
|
|
117492
117787
|
}
|
|
117493
117788
|
function computeRunnerCacheKey(sourcesHash, xcodeVersion2, staticArgs) {
|
|
117494
|
-
return (0,
|
|
117789
|
+
return (0, import_node_crypto13.createHash)("sha256").update([sourcesHash, xcodeVersion2, ...staticArgs].join("\n")).digest("hex").slice(0, 16);
|
|
117495
117790
|
}
|
|
117496
117791
|
function isProfileMissingDeviceFailure(logText) {
|
|
117497
117792
|
return logText.includes("0xe8008012") || /doesn't include the currently selected device/i.test(logText) || /provisioning profile cannot be installed on this device/i.test(logText) || /team has no devices/i.test(logText);
|
|
@@ -117502,7 +117797,7 @@ function isProfileExpiredFailure(logText) {
|
|
|
117502
117797
|
var EXPIRY_RE = /<key>ExpirationDate<\/key>\s*<date>([^<]+)<\/date>/;
|
|
117503
117798
|
var PROFILE_RENEWAL_MARGIN_MS = 60 * 60 * 1e3;
|
|
117504
117799
|
async function readRunnerExpiryDate(derivedDataPath) {
|
|
117505
|
-
const file2 =
|
|
117800
|
+
const file2 = path36.join(
|
|
117506
117801
|
runnerProductsDir(derivedDataPath),
|
|
117507
117802
|
"Debug-iphoneos",
|
|
117508
117803
|
"ArgentRunnerUITests-Runner.app",
|
|
@@ -117532,7 +117827,7 @@ async function ensureRunnerArtifact(config2, opts = {}) {
|
|
|
117532
117827
|
const build2 = opts.build ?? buildRunnerArtifact;
|
|
117533
117828
|
return withRunnerBuildLock(async () => {
|
|
117534
117829
|
await removeBuildSharedByAllTeams(config2.teamId);
|
|
117535
|
-
const stampPath =
|
|
117830
|
+
const stampPath = path36.join(derivedDataPath, CACHE_KEY_FILE);
|
|
117536
117831
|
const stamped = await fsp.readFile(stampPath, "utf8").catch(() => null);
|
|
117537
117832
|
if (!opts.force && stamped === cacheKey2) {
|
|
117538
117833
|
const cached3 = findBaseXctestrun(derivedDataPath);
|
|
@@ -117618,18 +117913,18 @@ ${xcodebuildFailureSummary(output2)}`,
|
|
|
117618
117913
|
// ../tool-server/src/utils/ios-device/runner-launch.ts
|
|
117619
117914
|
var import_node_child_process30 = require("node:child_process");
|
|
117620
117915
|
var import_node_events2 = require("node:events");
|
|
117621
|
-
var
|
|
117916
|
+
var fs42 = __toESM(require("node:fs"));
|
|
117622
117917
|
var fsp2 = __toESM(require("node:fs/promises"));
|
|
117623
|
-
var
|
|
117918
|
+
var path37 = __toESM(require("node:path"));
|
|
117624
117919
|
var import_node_util22 = require("node:util");
|
|
117625
117920
|
init_src2();
|
|
117626
117921
|
init_src();
|
|
117627
117922
|
var execFileAsync21 = (0, import_node_util22.promisify)(import_node_child_process30.execFile);
|
|
117628
117923
|
function logsRoot() {
|
|
117629
|
-
return
|
|
117924
|
+
return path37.join(argentHomeDir(), "ios-device-runner", "logs");
|
|
117630
117925
|
}
|
|
117631
117926
|
function resultsRoot() {
|
|
117632
|
-
return
|
|
117927
|
+
return path37.join(argentHomeDir(), "ios-device-runner", "results");
|
|
117633
117928
|
}
|
|
117634
117929
|
var RUNNER_ATTACHMENT_SETTINGS = [
|
|
117635
117930
|
["PreferredScreenCaptureFormat", "screenshots"],
|
|
@@ -117662,11 +117957,11 @@ async function launchRunner(opts) {
|
|
|
117662
117957
|
fsp2.mkdir(resultsDir, { recursive: true })
|
|
117663
117958
|
]);
|
|
117664
117959
|
const deviceTag = opts.udid.slice(0, 8);
|
|
117665
|
-
const logPath =
|
|
117666
|
-
const resultBundlePath =
|
|
117960
|
+
const logPath = path37.join(logDir, `runner-${deviceTag}.log`);
|
|
117961
|
+
const resultBundlePath = path37.join(resultsDir, `argent-${deviceTag}.xcresult`);
|
|
117667
117962
|
await fsp2.rm(resultBundlePath, { recursive: true, force: true });
|
|
117668
117963
|
await disableRunnerAttachments(opts.xctestrunPath);
|
|
117669
|
-
const logFd =
|
|
117964
|
+
const logFd = fs42.openSync(logPath, "w");
|
|
117670
117965
|
const child = (0, import_node_child_process30.spawn)(
|
|
117671
117966
|
"xcodebuild",
|
|
117672
117967
|
[
|
|
@@ -117703,7 +117998,7 @@ async function launchRunner(opts) {
|
|
|
117703
117998
|
}
|
|
117704
117999
|
);
|
|
117705
118000
|
child.unref();
|
|
117706
|
-
|
|
118001
|
+
fs42.closeSync(logFd);
|
|
117707
118002
|
try {
|
|
117708
118003
|
await (0, import_node_events2.once)(child, "spawn");
|
|
117709
118004
|
} catch (error63) {
|
|
@@ -117754,7 +118049,7 @@ function killRunnerProcess(child) {
|
|
|
117754
118049
|
// ../tool-server/src/utils/ios-device/runner-sweep.ts
|
|
117755
118050
|
var import_node_child_process31 = require("node:child_process");
|
|
117756
118051
|
var import_node_util23 = require("node:util");
|
|
117757
|
-
var
|
|
118052
|
+
var path38 = __toESM(require("node:path"));
|
|
117758
118053
|
init_src();
|
|
117759
118054
|
var execFileAsync22 = (0, import_node_util23.promisify)(import_node_child_process31.execFile);
|
|
117760
118055
|
var PROCESS_TABLE_MAX_BYTES = 16 * 1024 * 1024;
|
|
@@ -117776,7 +118071,7 @@ async function killStaleRunnersForDevice(udid, listProcesses = listProcessTable)
|
|
|
117776
118071
|
const kill = process.kill.bind(process);
|
|
117777
118072
|
const signaled = [];
|
|
117778
118073
|
for (const line of stdout.split("\n")) {
|
|
117779
|
-
if (!line.includes("test-without-building") || !line.includes(`platform=iOS,id=${udid}`) || !line.includes(` ${
|
|
118074
|
+
if (!line.includes("test-without-building") || !line.includes(`platform=iOS,id=${udid}`) || !line.includes(` ${path38.join(argentHomeDir(), "ios-device-runner")}${path38.sep}`)) {
|
|
117780
118075
|
continue;
|
|
117781
118076
|
}
|
|
117782
118077
|
const [pidField, ppidField] = line.trim().split(/\s+/);
|
|
@@ -117804,7 +118099,7 @@ async function killStaleRunnersForDevice(udid, listProcesses = listProcessTable)
|
|
|
117804
118099
|
}
|
|
117805
118100
|
|
|
117806
118101
|
// ../tool-server/src/blueprints/ios-device-runner.ts
|
|
117807
|
-
var
|
|
118102
|
+
var fs44 = __toESM(require("node:fs/promises"));
|
|
117808
118103
|
|
|
117809
118104
|
// ../tool-server/src/utils/ios-device/runner-route.ts
|
|
117810
118105
|
var import_node_net3 = __toESM(require("node:net"));
|
|
@@ -118192,7 +118487,7 @@ function defaultSendViaUsbmux(udid, port, body, deadline) {
|
|
|
118192
118487
|
// ../tool-server/src/utils/ios-device/runner-crash.ts
|
|
118193
118488
|
var import_node_child_process32 = require("node:child_process");
|
|
118194
118489
|
var import_node_util24 = require("node:util");
|
|
118195
|
-
var
|
|
118490
|
+
var fs43 = __toESM(require("node:fs/promises"));
|
|
118196
118491
|
var execFileAsync23 = (0, import_node_util24.promisify)(import_node_child_process32.execFile);
|
|
118197
118492
|
var XCRESULTTOOL_TIMEOUT_MS = 15e3;
|
|
118198
118493
|
var XCRESULTTOOL_MAX_JSON_BYTES = 32 * 1024 * 1024;
|
|
@@ -118212,7 +118507,7 @@ function extractCrashFailureText(summary) {
|
|
|
118212
118507
|
}
|
|
118213
118508
|
async function readRunnerCrashSummary(resultBundlePath) {
|
|
118214
118509
|
try {
|
|
118215
|
-
await
|
|
118510
|
+
await fs43.access(resultBundlePath);
|
|
118216
118511
|
const { stdout } = await execFileAsync23(
|
|
118217
118512
|
"xcrun",
|
|
118218
118513
|
["xcresulttool", "get", "test-results", "summary", "--path", resultBundlePath],
|
|
@@ -118225,7 +118520,7 @@ async function readRunnerCrashSummary(resultBundlePath) {
|
|
|
118225
118520
|
}
|
|
118226
118521
|
|
|
118227
118522
|
// ../tool-server/src/utils/ios-device/runner-client.ts
|
|
118228
|
-
var
|
|
118523
|
+
var import_node_crypto14 = require("node:crypto");
|
|
118229
118524
|
init_src2();
|
|
118230
118525
|
var RUNNER_COMMAND_TIMEOUT_MS = 45e3;
|
|
118231
118526
|
var RUNNER_STATUS_RECOVERY_TIMEOUT_MS = 3e3;
|
|
@@ -118438,7 +118733,7 @@ function withCommandId(command2) {
|
|
|
118438
118733
|
if (command2.command === "status" || typeof command2.commandId === "string") {
|
|
118439
118734
|
return command2;
|
|
118440
118735
|
}
|
|
118441
|
-
return { ...command2, commandId: `argent-${(0,
|
|
118736
|
+
return { ...command2, commandId: `argent-${(0, import_node_crypto14.randomUUID)()}` };
|
|
118442
118737
|
}
|
|
118443
118738
|
function unwrapEnvelope(response, udid) {
|
|
118444
118739
|
const envelope = asEnvelope(response);
|
|
@@ -118585,7 +118880,7 @@ async function startRunner(udid, artifact, tunnelAddress) {
|
|
|
118585
118880
|
launched.child.once("exit", reserveInteractionRunner(udid));
|
|
118586
118881
|
}
|
|
118587
118882
|
killRunnerProcess(launched.child);
|
|
118588
|
-
const logText = await
|
|
118883
|
+
const logText = await fs44.readFile(launched.logPath, "utf8").catch(() => "");
|
|
118589
118884
|
throw Object.assign(
|
|
118590
118885
|
withFailureSignal(
|
|
118591
118886
|
new Error(
|
|
@@ -123566,7 +123861,7 @@ async function describeVega(_serial) {
|
|
|
123566
123861
|
}
|
|
123567
123862
|
|
|
123568
123863
|
// ../tool-server/src/tools/describe/platforms/harmony/index.ts
|
|
123569
|
-
var
|
|
123864
|
+
var import_node_os11 = require("node:os");
|
|
123570
123865
|
var import_node_path16 = require("node:path");
|
|
123571
123866
|
var import_promises15 = require("node:fs/promises");
|
|
123572
123867
|
|
|
@@ -124090,7 +124385,7 @@ function pollHarmonyTree(connectKey, budgetMs) {
|
|
|
124090
124385
|
return describeHarmony(connectKey, budgetMs);
|
|
124091
124386
|
}
|
|
124092
124387
|
async function describeHarmony(connectKey, timeoutMs = HARMONY_INTERACTION_TIMEOUT_MS) {
|
|
124093
|
-
const localPath = (0, import_node_path16.join)((0,
|
|
124388
|
+
const localPath = (0, import_node_path16.join)((0, import_node_os11.tmpdir)(), `argent-harmony-dump-${process.hrtime.bigint()}.json`);
|
|
124094
124389
|
const deadline = Date.now() + timeoutMs;
|
|
124095
124390
|
const display = await harmonyDisplay(
|
|
124096
124391
|
connectKey,
|
|
@@ -124126,12 +124421,12 @@ init_src2();
|
|
|
124126
124421
|
|
|
124127
124422
|
// ../tool-server/src/blueprints/macos-app.ts
|
|
124128
124423
|
var import_node_child_process33 = require("node:child_process");
|
|
124129
|
-
var
|
|
124424
|
+
var import_node_crypto15 = require("node:crypto");
|
|
124130
124425
|
var import_node_events5 = require("node:events");
|
|
124131
|
-
var
|
|
124426
|
+
var fs45 = __toESM(require("node:fs"));
|
|
124132
124427
|
var net9 = __toESM(require("node:net"));
|
|
124133
124428
|
var os12 = __toESM(require("node:os"));
|
|
124134
|
-
var
|
|
124429
|
+
var path39 = __toESM(require("node:path"));
|
|
124135
124430
|
init_src2();
|
|
124136
124431
|
init_device_info();
|
|
124137
124432
|
|
|
@@ -124369,7 +124664,7 @@ async function stopProcesses(pids, executable, group) {
|
|
|
124369
124664
|
}
|
|
124370
124665
|
function readLogTail(logPath) {
|
|
124371
124666
|
try {
|
|
124372
|
-
const lines =
|
|
124667
|
+
const lines = fs45.readFileSync(logPath, "utf8").trimEnd().split("\n");
|
|
124373
124668
|
const tail = lines.slice(-20).join("\n").trim();
|
|
124374
124669
|
return tail ? `
|
|
124375
124670
|
Last lines of ${logPath}:
|
|
@@ -124413,7 +124708,7 @@ function closedByArgentError(bundleId, method) {
|
|
|
124413
124708
|
"unknown"
|
|
124414
124709
|
);
|
|
124415
124710
|
}
|
|
124416
|
-
var nextCdpWireId = (0,
|
|
124711
|
+
var nextCdpWireId = (0, import_node_crypto15.randomInt)(2 ** 47);
|
|
124417
124712
|
var LibraryChannel = class {
|
|
124418
124713
|
/**
|
|
124419
124714
|
* @param expectedPid the app's pid when known; a launch learns it from the helper after the spawn.
|
|
@@ -125074,7 +125369,7 @@ function createMacosAppApi(bundleId) {
|
|
|
125074
125369
|
"not_found"
|
|
125075
125370
|
);
|
|
125076
125371
|
}
|
|
125077
|
-
if (!opts.appPath && tracked && !
|
|
125372
|
+
if (!opts.appPath && tracked && !fs45.existsSync(appPath)) {
|
|
125078
125373
|
throw macosFailure(
|
|
125079
125374
|
`argent last started ${bundleId} from ${appPath}, which no longer exists. Pass the .app path to boot-device as macosAppPath.`,
|
|
125080
125375
|
FAILURE_CODES.MACOS_APP_PATH_INVALID,
|
|
@@ -125134,6 +125429,10 @@ function createMacosAppApi(bundleId) {
|
|
|
125134
125429
|
);
|
|
125135
125430
|
}
|
|
125136
125431
|
const bootstrapPath = await stageLibraryFor(info, artifacts);
|
|
125432
|
+
const listen4 = macosListenSocket(bundleId, info.sandboxed);
|
|
125433
|
+
const logPath = macosAppLogPath(bundleId);
|
|
125434
|
+
fs45.mkdirSync(path39.dirname(logPath), { recursive: true, mode: 448 });
|
|
125435
|
+
if (listen4 && !info.sandboxed) prepareSocketDir(listen4.path);
|
|
125137
125436
|
const forceQuit = own2 ? await terminate(own2) : void 0;
|
|
125138
125437
|
let tookOver;
|
|
125139
125438
|
if (copies.same.length > 0) {
|
|
@@ -125150,11 +125449,8 @@ function createMacosAppApi(bundleId) {
|
|
|
125150
125449
|
tookOver = `argent quit the copy of ${bundleId} that ran without the argent library (pid ${signalled.join(", ")}) and started the app with the library. Unsaved changes in that copy are lost.`;
|
|
125151
125450
|
}
|
|
125152
125451
|
}
|
|
125153
|
-
|
|
125154
|
-
|
|
125155
|
-
fs44.mkdirSync(path38.dirname(logPath), { recursive: true, mode: 448 });
|
|
125156
|
-
if (listen4 && !info.sandboxed) fs44.rmSync(listen4.path, { force: true });
|
|
125157
|
-
fs44.writeFileSync(logPath, "");
|
|
125452
|
+
if (listen4 && !info.sandboxed) fs45.rmSync(listen4.path, { force: true });
|
|
125453
|
+
fs45.writeFileSync(logPath, "");
|
|
125158
125454
|
const args = opts.args ?? (opts.noLastArgs ? void 0 : tracked?.args) ?? [];
|
|
125159
125455
|
const helper = (0, import_node_child_process33.spawn)(
|
|
125160
125456
|
artifacts.helper,
|
|
@@ -125610,7 +125906,7 @@ function scaleDecodedPng(src, scale) {
|
|
|
125610
125906
|
}
|
|
125611
125907
|
|
|
125612
125908
|
// ../tool-server/src/utils/macos-input.ts
|
|
125613
|
-
var
|
|
125909
|
+
var sleep3 = (ms3) => new Promise((r) => setTimeout(r, ms3));
|
|
125614
125910
|
function macosAppServices(device) {
|
|
125615
125911
|
return macosAppsUnavailableReason() === null ? { macosApp: macosAppRef(device) } : {};
|
|
125616
125912
|
}
|
|
@@ -125660,7 +125956,7 @@ async function macosClick(app, x, y, opts = {}) {
|
|
|
125660
125956
|
await macosMouse(app, { ...event2, type: "down" });
|
|
125661
125957
|
await macosMouse(app, { ...event2, type: "up" });
|
|
125662
125958
|
}
|
|
125663
|
-
await
|
|
125959
|
+
await sleep3(MACOS_CLICK_SETTLE_MS);
|
|
125664
125960
|
}
|
|
125665
125961
|
async function macosScroll(app, event2) {
|
|
125666
125962
|
await app.call("Input.scroll", insideMaxEdges(event2));
|
|
@@ -125768,7 +126064,7 @@ async function macosTypeText(app, text, opts = {}) {
|
|
|
125768
126064
|
if (!pending) return;
|
|
125769
126065
|
await macosInsertText(app, pending);
|
|
125770
126066
|
pending = "";
|
|
125771
|
-
await
|
|
126067
|
+
await sleep3(delay4);
|
|
125772
126068
|
};
|
|
125773
126069
|
let afterCr = false;
|
|
125774
126070
|
for (const char of text) {
|
|
@@ -125786,7 +126082,7 @@ async function macosTypeText(app, text, opts = {}) {
|
|
|
125786
126082
|
pending += char;
|
|
125787
126083
|
continue;
|
|
125788
126084
|
}
|
|
125789
|
-
await
|
|
126085
|
+
await sleep3(delay4);
|
|
125790
126086
|
}
|
|
125791
126087
|
await flush();
|
|
125792
126088
|
return count2;
|
|
@@ -126742,8 +127038,8 @@ var SourceMapsRegistry = class {
|
|
|
126742
127038
|
};
|
|
126743
127039
|
|
|
126744
127040
|
// ../tool-server/src/utils/debugger/log-file-writer.ts
|
|
126745
|
-
var
|
|
126746
|
-
var
|
|
127041
|
+
var fs46 = __toESM(require("node:fs"));
|
|
127042
|
+
var path40 = __toESM(require("node:path"));
|
|
126747
127043
|
init_src();
|
|
126748
127044
|
var MAX_ENTRIES = 5e4;
|
|
126749
127045
|
var STALE_LOG_MS = 24 * 60 * 60 * 1e3;
|
|
@@ -126769,19 +127065,19 @@ var LogFileWriter = class {
|
|
|
126769
127065
|
closed = false;
|
|
126770
127066
|
constructor(port) {
|
|
126771
127067
|
const timestamp = lastTimestamp = Math.max(Date.now(), lastTimestamp + 1);
|
|
126772
|
-
const dir =
|
|
127068
|
+
const dir = path40.join(argentHomeDir(), "tmp");
|
|
126773
127069
|
try {
|
|
126774
|
-
|
|
127070
|
+
fs46.mkdirSync(dir, { recursive: true });
|
|
126775
127071
|
} catch {
|
|
126776
127072
|
}
|
|
126777
127073
|
pruneStaleLogs(dir);
|
|
126778
|
-
this.filePath =
|
|
127074
|
+
this.filePath = path40.join(dir, `argent-logs-${port}-${timestamp}-p${process.pid}.log`);
|
|
126779
127075
|
liveLogFiles.add(this.filePath);
|
|
126780
127076
|
this.open();
|
|
126781
127077
|
}
|
|
126782
127078
|
open() {
|
|
126783
127079
|
try {
|
|
126784
|
-
this.fd =
|
|
127080
|
+
this.fd = fs46.openSync(this.filePath, "w");
|
|
126785
127081
|
this.ready = true;
|
|
126786
127082
|
} catch {
|
|
126787
127083
|
}
|
|
@@ -126807,7 +127103,7 @@ var LogFileWriter = class {
|
|
|
126807
127103
|
try {
|
|
126808
127104
|
const bytes = Buffer.from(this.midLine ? `
|
|
126809
127105
|
${line}` : line);
|
|
126810
|
-
const written =
|
|
127106
|
+
const written = fs46.writeSync(this.fd, bytes, 0, bytes.length, this.bytesWritten);
|
|
126811
127107
|
if (written === bytes.length) {
|
|
126812
127108
|
this.bytesWritten += written;
|
|
126813
127109
|
this.midLine = false;
|
|
@@ -126859,7 +127155,7 @@ ${line}` : line);
|
|
|
126859
127155
|
/** A torn line past " | " would parse as a whole entry with its message cut. */
|
|
126860
127156
|
dropTornLine(fd, bytes, written) {
|
|
126861
127157
|
try {
|
|
126862
|
-
|
|
127158
|
+
fs46.ftruncateSync(fd, this.bytesWritten);
|
|
126863
127159
|
} catch {
|
|
126864
127160
|
this.bytesWritten += written;
|
|
126865
127161
|
if (written > 0) this.midLine = bytes[written - 1] !== 10;
|
|
@@ -126873,7 +127169,7 @@ ${line}` : line);
|
|
|
126873
127169
|
return this.fileEntryCount;
|
|
126874
127170
|
}
|
|
126875
127171
|
hasFile() {
|
|
126876
|
-
return
|
|
127172
|
+
return fs46.existsSync(this.filePath);
|
|
126877
127173
|
}
|
|
126878
127174
|
getStats() {
|
|
126879
127175
|
return {
|
|
@@ -126898,7 +127194,7 @@ ${line}` : line);
|
|
|
126898
127194
|
readAll() {
|
|
126899
127195
|
if (this.closed || !this.ready) return [];
|
|
126900
127196
|
try {
|
|
126901
|
-
const content =
|
|
127197
|
+
const content = fs46.readFileSync(this.filePath, "utf-8");
|
|
126902
127198
|
return content.split("\n").filter((line) => line.length > 0).map(parseFlatLine).filter((entry) => entry !== null);
|
|
126903
127199
|
} catch {
|
|
126904
127200
|
return [];
|
|
@@ -126920,7 +127216,7 @@ ${line}` : line);
|
|
|
126920
127216
|
liveLogFiles.delete(this.filePath);
|
|
126921
127217
|
if (this.fd !== null) {
|
|
126922
127218
|
try {
|
|
126923
|
-
|
|
127219
|
+
fs46.closeSync(this.fd);
|
|
126924
127220
|
} catch {
|
|
126925
127221
|
}
|
|
126926
127222
|
this.fd = null;
|
|
@@ -126928,13 +127224,13 @@ ${line}` : line);
|
|
|
126928
127224
|
if (keepFile) {
|
|
126929
127225
|
try {
|
|
126930
127226
|
const now = /* @__PURE__ */ new Date();
|
|
126931
|
-
|
|
127227
|
+
fs46.utimesSync(this.filePath, now, now);
|
|
126932
127228
|
} catch {
|
|
126933
127229
|
}
|
|
126934
127230
|
return;
|
|
126935
127231
|
}
|
|
126936
127232
|
try {
|
|
126937
|
-
|
|
127233
|
+
fs46.unlinkSync(this.filePath);
|
|
126938
127234
|
} catch {
|
|
126939
127235
|
}
|
|
126940
127236
|
}
|
|
@@ -126943,17 +127239,17 @@ function pruneStaleLogs(dir) {
|
|
|
126943
127239
|
const cutoff = Date.now() - STALE_LOG_MS;
|
|
126944
127240
|
let names;
|
|
126945
127241
|
try {
|
|
126946
|
-
names =
|
|
127242
|
+
names = fs46.readdirSync(dir);
|
|
126947
127243
|
} catch {
|
|
126948
127244
|
return;
|
|
126949
127245
|
}
|
|
126950
127246
|
for (const name of names) {
|
|
126951
127247
|
const pid = Number(/^argent-logs-.*-p(\d+)\.log$/.exec(name)?.[1]);
|
|
126952
127248
|
if (!pid) continue;
|
|
126953
|
-
const file2 =
|
|
127249
|
+
const file2 = path40.join(dir, name);
|
|
126954
127250
|
if (pid === process.pid ? liveLogFiles.has(file2) : isAlive(pid)) continue;
|
|
126955
127251
|
try {
|
|
126956
|
-
if (
|
|
127252
|
+
if (fs46.statSync(file2).mtimeMs < cutoff) fs46.unlinkSync(file2);
|
|
126957
127253
|
} catch {
|
|
126958
127254
|
}
|
|
126959
127255
|
}
|
|
@@ -127617,39 +127913,6 @@ function directCallFailure(tool, result) {
|
|
|
127617
127913
|
return toolResultVerdict(tool, result)?.reason;
|
|
127618
127914
|
}
|
|
127619
127915
|
|
|
127620
|
-
// ../tool-server/src/utils/argent-home-id.ts
|
|
127621
|
-
var import_node_crypto15 = require("node:crypto");
|
|
127622
|
-
var fs46 = __toESM(require("node:fs"));
|
|
127623
|
-
var import_node_os11 = require("node:os");
|
|
127624
|
-
var path40 = __toESM(require("node:path"));
|
|
127625
|
-
init_src();
|
|
127626
|
-
var ARGENT_HOME_HEADER = "x-argent-home";
|
|
127627
|
-
function canonicalDir(dir) {
|
|
127628
|
-
const resolved = path40.resolve(dir);
|
|
127629
|
-
const parent = path40.dirname(resolved);
|
|
127630
|
-
if (fs46.existsSync(resolved) || parent === resolved) return canonicalPath(resolved);
|
|
127631
|
-
return path40.join(canonicalDir(parent), path40.basename(resolved));
|
|
127632
|
-
}
|
|
127633
|
-
function argentHomeId(dir = argentHomeDir()) {
|
|
127634
|
-
return (0, import_node_crypto15.createHash)("sha256").update(canonicalDir(dir)).digest("hex").slice(0, 12);
|
|
127635
|
-
}
|
|
127636
|
-
function peerArgentHomeId(header) {
|
|
127637
|
-
if (typeof header === "string" && header) return header;
|
|
127638
|
-
return argentHomeId(path40.join(resolveHomeDir(), ".argent"));
|
|
127639
|
-
}
|
|
127640
|
-
var LOOPBACK_ADDRESSES = /* @__PURE__ */ new Set(["127.0.0.1", "::1", "::ffff:127.0.0.1"]);
|
|
127641
|
-
function isOwnAddress(address) {
|
|
127642
|
-
const ip = address.replace(/^::ffff:(?=\d+\.\d+\.\d+\.\d+$)/, "");
|
|
127643
|
-
return Object.values((0, import_node_os11.networkInterfaces)()).some(
|
|
127644
|
-
(list) => list?.some((a) => (a.family === "IPv4" || a.scopeid === 0) && a.address === ip)
|
|
127645
|
-
);
|
|
127646
|
-
}
|
|
127647
|
-
function isLocalConnection(socket) {
|
|
127648
|
-
const remote = socket.remoteAddress;
|
|
127649
|
-
if (remote === void 0) return false;
|
|
127650
|
-
return LOOPBACK_ADDRESSES.has(remote) || remote === socket.localAddress || isOwnAddress(remote);
|
|
127651
|
-
}
|
|
127652
|
-
|
|
127653
127916
|
// ../tool-server/src/http.ts
|
|
127654
127917
|
var AUTO_SUPPRESS_MS = 30 * 60 * 1e3;
|
|
127655
127918
|
var AUTH_TOKEN_ENV = "ARGENT_AUTH_TOKEN";
|
|
@@ -129743,7 +130006,7 @@ function createInspector(serial, packageName, initialMetroPort) {
|
|
|
129743
130006
|
try {
|
|
129744
130007
|
let step = 0;
|
|
129745
130008
|
while (step < RECHECK_DELAYS_MS.length) {
|
|
129746
|
-
await
|
|
130009
|
+
await sleep4(RECHECK_DELAYS_MS[step]);
|
|
129747
130010
|
if (disposed) return;
|
|
129748
130011
|
if (recheck.restart) {
|
|
129749
130012
|
recheck.restart = false;
|
|
@@ -130212,7 +130475,7 @@ function createInspector(serial, packageName, initialMetroPort) {
|
|
|
130212
130475
|
failOrphans(runningKeys(read));
|
|
130213
130476
|
if (current) return { kind: await attach2(current), proc: current };
|
|
130214
130477
|
if (Date.now() >= deadline) return { kind: "no_process" };
|
|
130215
|
-
await
|
|
130478
|
+
await sleep4(PROCESS_POLL_INTERVAL_MS);
|
|
130216
130479
|
checkpoint();
|
|
130217
130480
|
}
|
|
130218
130481
|
});
|
|
@@ -130475,7 +130738,7 @@ function firstLine3(detail) {
|
|
|
130475
130738
|
function errorMessage3(err) {
|
|
130476
130739
|
return err instanceof Error ? err.message : String(err);
|
|
130477
130740
|
}
|
|
130478
|
-
function
|
|
130741
|
+
function sleep4(ms3) {
|
|
130479
130742
|
return new Promise((resolve24) => {
|
|
130480
130743
|
setTimeout(resolve24, ms3).unref();
|
|
130481
130744
|
});
|
|
@@ -140767,7 +141030,7 @@ async function assertChromiumWindowVisible(chromium, action) {
|
|
|
140767
141030
|
// ../tool-server/src/tools/gesture-tap/index.ts
|
|
140768
141031
|
init_device_info();
|
|
140769
141032
|
init_capability();
|
|
140770
|
-
var
|
|
141033
|
+
var sleep5 = (ms3) => new Promise((r) => setTimeout(r, ms3));
|
|
140771
141034
|
function tapDescription(params, tense) {
|
|
140772
141035
|
const count2 = params.clickCount ?? 1;
|
|
140773
141036
|
const action = count2 === 1 ? tense === "present" ? "Tapping" : "Tapped" : count2 === 2 ? tense === "present" ? "Double-tapping" : "Double-tapped" : `${tense === "present" ? "Tapping" : "Tapped"} ${count2} times`;
|
|
@@ -140791,9 +141054,9 @@ async function tapChromium(api, x, y, clickCount) {
|
|
|
140791
141054
|
const pxY = Math.max(0, Math.min(vp.height, y * vp.height));
|
|
140792
141055
|
await api.dispatchMouseEvent({ type: "mouseMoved", x: pxX, y: pxY });
|
|
140793
141056
|
for (let i = 1; i <= clickCount; i++) {
|
|
140794
|
-
if (i > 1) await
|
|
141057
|
+
if (i > 1) await sleep5(MULTI_TAP_GAP_MS);
|
|
140795
141058
|
await api.dispatchMouseEvent({ type: "mousePressed", x: pxX, y: pxY, clickCount: i });
|
|
140796
|
-
await
|
|
141059
|
+
await sleep5(TAP_HOLD_MS);
|
|
140797
141060
|
await api.dispatchMouseEvent({ type: "mouseReleased", x: pxX, y: pxY, clickCount: i });
|
|
140798
141061
|
}
|
|
140799
141062
|
}
|
|
@@ -140819,7 +141082,7 @@ async function tapHarmony(connectKey, x, y, clickCount, signal) {
|
|
|
140819
141082
|
return;
|
|
140820
141083
|
}
|
|
140821
141084
|
for (let i = 0; i < clickCount; i++) {
|
|
140822
|
-
if (i > 0) await
|
|
141085
|
+
if (i > 0) await sleep5(MULTI_TAP_GAP_MS);
|
|
140823
141086
|
await ui.touch("click", point);
|
|
140824
141087
|
}
|
|
140825
141088
|
},
|
|
@@ -140921,7 +141184,7 @@ Use when tapping a button, link, or control. Returns { tapped: true, timestampMs
|
|
|
140921
141184
|
const api = services.simulatorServer;
|
|
140922
141185
|
let warning;
|
|
140923
141186
|
for (let i = 1; i <= clickCount; i++) {
|
|
140924
|
-
if (i > 1) await
|
|
141187
|
+
if (i > 1) await sleep5(MULTI_TAP_GAP_MS);
|
|
140925
141188
|
const down = await sendCommand(api, {
|
|
140926
141189
|
cmd: "touch",
|
|
140927
141190
|
type: "Down",
|
|
@@ -140931,7 +141194,7 @@ Use when tapping a button, link, or control. Returns { tapped: true, timestampMs
|
|
|
140931
141194
|
second_y: null
|
|
140932
141195
|
});
|
|
140933
141196
|
warning ??= down.warning;
|
|
140934
|
-
await
|
|
141197
|
+
await sleep5(TAP_HOLD_MS);
|
|
140935
141198
|
await sendCommand(api, {
|
|
140936
141199
|
cmd: "touch",
|
|
140937
141200
|
type: "Up",
|
|
@@ -140948,7 +141211,7 @@ Use when tapping a button, link, or control. Returns { tapped: true, timestampMs
|
|
|
140948
141211
|
// ../tool-server/src/tools/gesture-swipe/index.ts
|
|
140949
141212
|
init_zod();
|
|
140950
141213
|
init_device_info();
|
|
140951
|
-
var
|
|
141214
|
+
var sleep6 = (ms3) => new Promise((r) => setTimeout(r, ms3));
|
|
140952
141215
|
var MOMENTUM_FREE_EASE_EXPONENT = 3;
|
|
140953
141216
|
var DEFAULT_DURATION_MS = 300;
|
|
140954
141217
|
var MOMENTUM_FREE_MIN_DURATION_MS = 150;
|
|
@@ -141117,7 +141380,7 @@ Physical iOS: an edge gesture (back-swipe) needs \`fromX: 0\` exactly; \`duratio
|
|
|
141117
141380
|
if (type === "Down") warning = sent.warning;
|
|
141118
141381
|
lastX = x;
|
|
141119
141382
|
lastY = y;
|
|
141120
|
-
if (i < steps) await
|
|
141383
|
+
if (i < steps) await sleep6(16);
|
|
141121
141384
|
}
|
|
141122
141385
|
return { swiped: true, timestampMs, ...warning !== void 0 ? { warning } : {} };
|
|
141123
141386
|
}
|
|
@@ -141126,7 +141389,7 @@ Physical iOS: an edge gesture (back-swipe) needs \`fromX: 0\` exactly; \`duratio
|
|
|
141126
141389
|
// ../tool-server/src/tools/gesture-scroll/index.ts
|
|
141127
141390
|
init_zod();
|
|
141128
141391
|
init_device_info();
|
|
141129
|
-
var
|
|
141392
|
+
var sleep7 = (ms3) => new Promise((r) => setTimeout(r, ms3));
|
|
141130
141393
|
function scrollDirection(params) {
|
|
141131
141394
|
const horizontal = (params.deltaX ?? 0) > 0 ? "right" : "left";
|
|
141132
141395
|
const vertical = (params.deltaY ?? 0) > 0 ? "down" : "up";
|
|
@@ -141193,7 +141456,7 @@ Returns \`{ scrolled: true, timestampMs }\`. Fails if CDP is unreachable<flag:ma
|
|
|
141193
141456
|
const point = { x: params.x, y: params.y };
|
|
141194
141457
|
for (let i = 0; i < steps; i++) {
|
|
141195
141458
|
await chromium.server.sendWheel(point, totalDx / steps, totalDy / steps);
|
|
141196
|
-
if (i < steps - 1) await
|
|
141459
|
+
if (i < steps - 1) await sleep7(16);
|
|
141197
141460
|
}
|
|
141198
141461
|
return { scrolled: true, timestampMs };
|
|
141199
141462
|
}
|
|
@@ -141202,7 +141465,7 @@ Returns \`{ scrolled: true, timestampMs }\`. Fails if CDP is unreachable<flag:ma
|
|
|
141202
141465
|
// ../tool-server/src/tools/gesture-drag/index.ts
|
|
141203
141466
|
init_zod();
|
|
141204
141467
|
init_device_info();
|
|
141205
|
-
var
|
|
141468
|
+
var sleep8 = (ms3) => new Promise((r) => setTimeout(r, ms3));
|
|
141206
141469
|
var MOMENTUM_FREE_EASE_EXPONENT2 = 3;
|
|
141207
141470
|
var MOMENTUM_FREE_MIN_STEPS = 8;
|
|
141208
141471
|
var MAX_DURATION_MS2 = 1e4;
|
|
@@ -141246,7 +141509,7 @@ async function runPointerDrag(from2, to, opts, pointer) {
|
|
|
141246
141509
|
try {
|
|
141247
141510
|
for (let i = 1; i < steps; i++) {
|
|
141248
141511
|
if (opts.signal?.aborted) await releaseAndAbort(i);
|
|
141249
|
-
await
|
|
141512
|
+
await sleep8(Math.max(0, t0 + i * frameMs - Date.now()));
|
|
141250
141513
|
const t = i / steps;
|
|
141251
141514
|
const progress = momentumFree ? 1 - Math.pow(1 - t, MOMENTUM_FREE_EASE_EXPONENT2) : t;
|
|
141252
141515
|
const point = {
|
|
@@ -141257,7 +141520,7 @@ async function runPointerDrag(from2, to, opts, pointer) {
|
|
|
141257
141520
|
last = point;
|
|
141258
141521
|
}
|
|
141259
141522
|
if (opts.signal?.aborted) await releaseAndAbort(steps);
|
|
141260
|
-
await
|
|
141523
|
+
await sleep8(Math.max(0, t0 + durationMs - Date.now()));
|
|
141261
141524
|
if (opts.signal?.aborted) await releaseAndAbort(steps);
|
|
141262
141525
|
await release3(to);
|
|
141263
141526
|
} catch (err) {
|
|
@@ -141341,7 +141604,7 @@ Returns \`{ dragged: true, timestampMs }\`. Fails if the CDP session is unreacha
|
|
|
141341
141604
|
}
|
|
141342
141605
|
}
|
|
141343
141606
|
);
|
|
141344
|
-
await
|
|
141607
|
+
await sleep8(MACOS_CLICK_SETTLE_MS);
|
|
141345
141608
|
return { dragged: true, timestampMs };
|
|
141346
141609
|
}
|
|
141347
141610
|
const chromium = services.chromium;
|
|
@@ -141494,7 +141757,7 @@ function stepTo(finger, point, tMs) {
|
|
|
141494
141757
|
// ../tool-server/src/tools/gesture-custom/index.ts
|
|
141495
141758
|
init_device_info();
|
|
141496
141759
|
init_capability();
|
|
141497
|
-
var
|
|
141760
|
+
var sleep9 = (ms3) => new Promise((r) => setTimeout(r, ms3));
|
|
141498
141761
|
var capability14 = {
|
|
141499
141762
|
apple: { simulator: true, device: true },
|
|
141500
141763
|
appleRemote: { simulator: true },
|
|
@@ -141652,7 +141915,7 @@ async function playTrain(api, deviceId, edge, events) {
|
|
|
141652
141915
|
let warning;
|
|
141653
141916
|
try {
|
|
141654
141917
|
for (const event2 of events) {
|
|
141655
|
-
await
|
|
141918
|
+
await sleep9(event2.delayMs ?? 16);
|
|
141656
141919
|
const sent = await sendCommand(
|
|
141657
141920
|
api,
|
|
141658
141921
|
{
|
|
@@ -141925,7 +142188,7 @@ Returns \`{ rotated: true, timestampMs, reactivated? }\` (on physical iOS, \`rea
|
|
|
141925
142188
|
init_zod();
|
|
141926
142189
|
init_device_info();
|
|
141927
142190
|
init_capability();
|
|
141928
|
-
var
|
|
142191
|
+
var sleep10 = (ms3) => new Promise((r) => setTimeout(r, ms3));
|
|
141929
142192
|
var BUTTONS_BY_PLATFORM = {
|
|
141930
142193
|
"ios": /* @__PURE__ */ new Set(["home", "power", "volumeUp", "volumeDown", "appSwitch", "actionButton"]),
|
|
141931
142194
|
"ios-remote": /* @__PURE__ */ new Set(["home", "power", "volumeUp", "volumeDown", "appSwitch", "actionButton"]),
|
|
@@ -142066,7 +142329,7 @@ Fails if the device backend is not reachable: the simulator-server for iOS, <fla
|
|
|
142066
142329
|
direction: "Down",
|
|
142067
142330
|
button: params.button
|
|
142068
142331
|
});
|
|
142069
|
-
await
|
|
142332
|
+
await sleep10(50);
|
|
142070
142333
|
await sendCommand(api, { cmd: "button", direction: "Up", button: params.button });
|
|
142071
142334
|
return { pressed: params.button };
|
|
142072
142335
|
}
|
|
@@ -142164,96 +142427,10 @@ function unsupportedFieldError(detail, stage) {
|
|
|
142164
142427
|
init_src2();
|
|
142165
142428
|
init_src2();
|
|
142166
142429
|
|
|
142167
|
-
// ../tool-server/src/tools/keyboard/key-codes.ts
|
|
142168
|
-
var SHIFT_KEYCODE = 225;
|
|
142169
|
-
var SYMBOL_KEYCODES = {
|
|
142170
|
-
"\n": 40,
|
|
142171
|
-
"\r": 40,
|
|
142172
|
-
" ": 43,
|
|
142173
|
-
" ": 44,
|
|
142174
|
-
"-": 45,
|
|
142175
|
-
"=": 46,
|
|
142176
|
-
"[": 47,
|
|
142177
|
-
"]": 48,
|
|
142178
|
-
"\\": 49,
|
|
142179
|
-
";": 51,
|
|
142180
|
-
"'": 52,
|
|
142181
|
-
"`": 53,
|
|
142182
|
-
",": 54,
|
|
142183
|
-
".": 55,
|
|
142184
|
-
"/": 56
|
|
142185
|
-
};
|
|
142186
|
-
var SHIFTED_SYMBOLS = {
|
|
142187
|
-
"!": "1",
|
|
142188
|
-
"@": "2",
|
|
142189
|
-
"#": "3",
|
|
142190
|
-
"$": "4",
|
|
142191
|
-
"%": "5",
|
|
142192
|
-
"^": "6",
|
|
142193
|
-
"&": "7",
|
|
142194
|
-
"*": "8",
|
|
142195
|
-
"(": "9",
|
|
142196
|
-
")": "0",
|
|
142197
|
-
"_": "-",
|
|
142198
|
-
"+": "=",
|
|
142199
|
-
"{": "[",
|
|
142200
|
-
"}": "]",
|
|
142201
|
-
"|": "\\",
|
|
142202
|
-
":": ";",
|
|
142203
|
-
'"': "'",
|
|
142204
|
-
"~": "`",
|
|
142205
|
-
"<": ",",
|
|
142206
|
-
">": ".",
|
|
142207
|
-
"?": "/"
|
|
142208
|
-
};
|
|
142209
|
-
var NAMED_KEYS = {
|
|
142210
|
-
"enter": 40,
|
|
142211
|
-
"return": 40,
|
|
142212
|
-
"escape": 41,
|
|
142213
|
-
"esc": 41,
|
|
142214
|
-
"backspace": 42,
|
|
142215
|
-
"delete": 42,
|
|
142216
|
-
"tab": 43,
|
|
142217
|
-
"space": 44,
|
|
142218
|
-
"arrow-right": 79,
|
|
142219
|
-
"arrow-left": 80,
|
|
142220
|
-
"arrow-down": 81,
|
|
142221
|
-
"arrow-up": 82,
|
|
142222
|
-
"f1": 58,
|
|
142223
|
-
"f2": 59,
|
|
142224
|
-
"f3": 60,
|
|
142225
|
-
"f4": 61,
|
|
142226
|
-
"f5": 62,
|
|
142227
|
-
"f6": 63,
|
|
142228
|
-
"f7": 64,
|
|
142229
|
-
"f8": 65,
|
|
142230
|
-
"f9": 66,
|
|
142231
|
-
"f10": 67,
|
|
142232
|
-
"f11": 68,
|
|
142233
|
-
"f12": 69
|
|
142234
|
-
};
|
|
142235
|
-
function charToKeyPress(char) {
|
|
142236
|
-
if (char.length !== 1) return void 0;
|
|
142237
|
-
const c = char.charCodeAt(0);
|
|
142238
|
-
if (c >= 97 && c <= 122) return { keyCode: c - 97 + 4, withShift: false };
|
|
142239
|
-
if (c >= 65 && c <= 90) return { keyCode: c - 65 + 4, withShift: true };
|
|
142240
|
-
if (c >= 49 && c <= 57) return { keyCode: c - 49 + 30, withShift: false };
|
|
142241
|
-
if (char === "0") return { keyCode: 39, withShift: false };
|
|
142242
|
-
const base = SHIFTED_SYMBOLS[char];
|
|
142243
|
-
if (base !== void 0) {
|
|
142244
|
-
const basePress = charToKeyPress(base);
|
|
142245
|
-
if (basePress === void 0) return void 0;
|
|
142246
|
-
return { keyCode: basePress.keyCode, withShift: true };
|
|
142247
|
-
}
|
|
142248
|
-
const code = SYMBOL_KEYCODES[char];
|
|
142249
|
-
if (code === void 0) return void 0;
|
|
142250
|
-
return { keyCode: code, withShift: false };
|
|
142251
|
-
}
|
|
142252
|
-
|
|
142253
142430
|
// ../tool-server/src/tools/keyboard/simulator-server-keys.ts
|
|
142254
142431
|
init_src2();
|
|
142255
142432
|
init_capability();
|
|
142256
|
-
var
|
|
142433
|
+
var sleep11 = (ms3) => new Promise((r) => setTimeout(r, ms3));
|
|
142257
142434
|
var KEY_HOLD = { ms: 20 };
|
|
142258
142435
|
async function typeSimulatorServer(registry2, device, params) {
|
|
142259
142436
|
const ref = simulatorServerRef(device);
|
|
@@ -142263,13 +142440,13 @@ async function typeSimulatorServer(registry2, device, params) {
|
|
|
142263
142440
|
const pressKeyCode = async (keyCode, withShift = false) => {
|
|
142264
142441
|
if (withShift) {
|
|
142265
142442
|
await api.pressKey("Down", SHIFT_KEYCODE);
|
|
142266
|
-
await
|
|
142443
|
+
await sleep11(10);
|
|
142267
142444
|
}
|
|
142268
142445
|
await api.pressKey("Down", keyCode);
|
|
142269
|
-
await
|
|
142446
|
+
await sleep11(KEY_HOLD.ms);
|
|
142270
142447
|
await api.pressKey("Up", keyCode);
|
|
142271
142448
|
if (withShift) {
|
|
142272
|
-
await
|
|
142449
|
+
await sleep11(10);
|
|
142273
142450
|
await api.pressKey("Up", SHIFT_KEYCODE);
|
|
142274
142451
|
}
|
|
142275
142452
|
keysPressed++;
|
|
@@ -142284,7 +142461,7 @@ async function typeSimulatorServer(registry2, device, params) {
|
|
|
142284
142461
|
error_kind: "unsupported"
|
|
142285
142462
|
});
|
|
142286
142463
|
await pressKeyCode(press.keyCode, press.withShift);
|
|
142287
|
-
await
|
|
142464
|
+
await sleep11(delay4);
|
|
142288
142465
|
}
|
|
142289
142466
|
}
|
|
142290
142467
|
if (params.key) {
|
|
@@ -142303,7 +142480,7 @@ async function typeSimulatorServer(registry2, device, params) {
|
|
|
142303
142480
|
const count2 = params.repeat ?? 1;
|
|
142304
142481
|
for (let i = 0; i < count2; i++) {
|
|
142305
142482
|
await pressKeyCode(namedKeyCode);
|
|
142306
|
-
if (i < count2 - 1) await
|
|
142483
|
+
if (i < count2 - 1) await sleep11(delay4);
|
|
142307
142484
|
}
|
|
142308
142485
|
}
|
|
142309
142486
|
return { typed: params.text ?? params.key ?? "", keys: keysPressed };
|
|
@@ -142313,7 +142490,7 @@ async function typeSimulatorServer(registry2, device, params) {
|
|
|
142313
142490
|
var MAX_CLEAR_KEYS = 100;
|
|
142314
142491
|
var XCTEST_DELETE = "\b";
|
|
142315
142492
|
var KEY_TIMING = { holdMs: 20, settleMs: 300, typeDelayMs: 30 };
|
|
142316
|
-
var
|
|
142493
|
+
var sleep12 = (ms3) => new Promise((r) => setTimeout(r, ms3));
|
|
142317
142494
|
function typeableOnSimulator(text) {
|
|
142318
142495
|
for (const char of text) if (!charToKeyPress(char)) return false;
|
|
142319
142496
|
return true;
|
|
@@ -142338,9 +142515,9 @@ async function pressSimulatorBackspace(registry2, device) {
|
|
|
142338
142515
|
const ref = simulatorServerRef(device);
|
|
142339
142516
|
const api = await registry2.resolveService(ref.urn, ref.options);
|
|
142340
142517
|
await api.pressKey("Down", NAMED_KEYS.backspace);
|
|
142341
|
-
await
|
|
142518
|
+
await sleep12(KEY_TIMING.holdMs);
|
|
142342
142519
|
await api.pressKey("Up", NAMED_KEYS.backspace);
|
|
142343
|
-
await
|
|
142520
|
+
await sleep12(KEY_TIMING.settleMs);
|
|
142344
142521
|
}
|
|
142345
142522
|
async function typeOnSimulator(registry2, device, text) {
|
|
142346
142523
|
if (!text) return;
|
|
@@ -143079,7 +143256,7 @@ function charToChromiumKey(char) {
|
|
|
143079
143256
|
}
|
|
143080
143257
|
|
|
143081
143258
|
// ../tool-server/src/tools/keyboard/platforms/chromium.ts
|
|
143082
|
-
var
|
|
143259
|
+
var sleep13 = (ms3) => new Promise((r) => setTimeout(r, ms3));
|
|
143083
143260
|
var isOutsideAscii = (char) => char.codePointAt(0) >= 128;
|
|
143084
143261
|
function assertTypeable(char) {
|
|
143085
143262
|
if (charToChromiumKey(char) || isOutsideAscii(char)) return;
|
|
@@ -143099,7 +143276,7 @@ async function runChromium(api, params) {
|
|
|
143099
143276
|
assertTypeable(char);
|
|
143100
143277
|
await api.cdp.send("Input.insertText", { text: char });
|
|
143101
143278
|
keysPressed++;
|
|
143102
|
-
await
|
|
143279
|
+
await sleep13(delay4);
|
|
143103
143280
|
continue;
|
|
143104
143281
|
}
|
|
143105
143282
|
await api.dispatchKeyEvent({
|
|
@@ -143116,7 +143293,7 @@ async function runChromium(api, params) {
|
|
|
143116
143293
|
windowsVirtualKeyCode: desc.windowsVirtualKeyCode
|
|
143117
143294
|
});
|
|
143118
143295
|
keysPressed++;
|
|
143119
|
-
await
|
|
143296
|
+
await sleep13(delay4);
|
|
143120
143297
|
}
|
|
143121
143298
|
}
|
|
143122
143299
|
if (params.key) {
|
|
@@ -143142,7 +143319,7 @@ async function runChromium(api, params) {
|
|
|
143142
143319
|
code: named.code,
|
|
143143
143320
|
windowsVirtualKeyCode: named.windowsVirtualKeyCode
|
|
143144
143321
|
});
|
|
143145
|
-
await
|
|
143322
|
+
await sleep13(delay4);
|
|
143146
143323
|
await api.dispatchKeyEvent({
|
|
143147
143324
|
type: "keyUp",
|
|
143148
143325
|
key: named.key,
|
|
@@ -143150,7 +143327,7 @@ async function runChromium(api, params) {
|
|
|
143150
143327
|
windowsVirtualKeyCode: named.windowsVirtualKeyCode
|
|
143151
143328
|
});
|
|
143152
143329
|
keysPressed++;
|
|
143153
|
-
if (i < count2 - 1) await
|
|
143330
|
+
if (i < count2 - 1) await sleep13(delay4);
|
|
143154
143331
|
}
|
|
143155
143332
|
}
|
|
143156
143333
|
return { typed: params.text ?? params.key ?? "", keys: keysPressed };
|
|
@@ -143175,7 +143352,7 @@ function makeChromiumImpl(registry2) {
|
|
|
143175
143352
|
|
|
143176
143353
|
// ../tool-server/src/tools/keyboard/platforms/macos.ts
|
|
143177
143354
|
init_capability();
|
|
143178
|
-
var
|
|
143355
|
+
var sleep14 = (ms3) => new Promise((r) => setTimeout(r, ms3));
|
|
143179
143356
|
function makeMacosImpl(registry2) {
|
|
143180
143357
|
return {
|
|
143181
143358
|
handler: async (_services, params, device) => {
|
|
@@ -143196,7 +143373,7 @@ function makeMacosImpl(registry2) {
|
|
|
143196
143373
|
const delay4 = params.delayMs ?? 50;
|
|
143197
143374
|
for (let i = 0; i < count2; i++) {
|
|
143198
143375
|
await macosPressKey(app, params.key);
|
|
143199
|
-
if (i < count2 - 1) await
|
|
143376
|
+
if (i < count2 - 1) await sleep14(delay4);
|
|
143200
143377
|
}
|
|
143201
143378
|
return { typed: params.key, keys: count2 };
|
|
143202
143379
|
}
|
|
@@ -143610,7 +143787,7 @@ init_capability();
|
|
|
143610
143787
|
var LEFT_GUI_KEYCODE = 227;
|
|
143611
143788
|
var V_KEYCODE = charToKeyPress("v").keyCode;
|
|
143612
143789
|
var CHORD_STEP_MS = 50;
|
|
143613
|
-
var
|
|
143790
|
+
var sleep15 = (ms3) => new Promise((r) => setTimeout(r, ms3));
|
|
143614
143791
|
var typesAsText = (char) => !"\n\r ".includes(char) && !!charToKeyPress(char);
|
|
143615
143792
|
function rejectTv(device) {
|
|
143616
143793
|
throw new UnsupportedOperationError(
|
|
@@ -143636,13 +143813,13 @@ async function pasteSimulator(registry2, device, api, params) {
|
|
|
143636
143813
|
return { pasted: true, via: "keyboard" };
|
|
143637
143814
|
}
|
|
143638
143815
|
await api.pressKey("Down", LEFT_GUI_KEYCODE);
|
|
143639
|
-
await
|
|
143816
|
+
await sleep15(CHORD_STEP_MS);
|
|
143640
143817
|
await api.pressKey("Down", V_KEYCODE);
|
|
143641
|
-
await
|
|
143818
|
+
await sleep15(CHORD_STEP_MS);
|
|
143642
143819
|
await api.pressKey("Up", V_KEYCODE);
|
|
143643
|
-
await
|
|
143820
|
+
await sleep15(CHORD_STEP_MS);
|
|
143644
143821
|
await api.pressKey("Up", LEFT_GUI_KEYCODE);
|
|
143645
|
-
await
|
|
143822
|
+
await sleep15(CHORD_STEP_MS);
|
|
143646
143823
|
return { pasted: true };
|
|
143647
143824
|
}
|
|
143648
143825
|
function makeIosImpl4(registry2) {
|
|
@@ -144054,7 +144231,7 @@ async function prepareHostWindowShake(target) {
|
|
|
144054
144231
|
var execFileAsync37 = (0, import_node_util38.promisify)(import_node_child_process49.execFile);
|
|
144055
144232
|
var SHAKE_NOTIFICATION = "com.apple.UIKit.SimulatorShake";
|
|
144056
144233
|
var SHAKE_INTERVAL_MS = 400;
|
|
144057
|
-
var
|
|
144234
|
+
var sleep16 = (ms3) => new Promise((r) => setTimeout(r, ms3));
|
|
144058
144235
|
var NOTIFYUTIL_ARGV = ["notifyutil", "-p", SHAKE_NOTIFICATION];
|
|
144059
144236
|
function rejectTv2(toolId, device) {
|
|
144060
144237
|
throw new UnsupportedOperationError(
|
|
@@ -144090,7 +144267,7 @@ var iosImpl4 = {
|
|
|
144090
144267
|
const args = await simctlArgsForUdid(udid, ["spawn", udid, ...NOTIFYUTIL_ARGV]);
|
|
144091
144268
|
const shaker = await prepareHostWindowShake({ kind: "ios", udid, name: device.name });
|
|
144092
144269
|
for (let i = 0; i < count2; i++) {
|
|
144093
|
-
if (i > 0) await
|
|
144270
|
+
if (i > 0) await sleep16(SHAKE_INTERVAL_MS);
|
|
144094
144271
|
shaker.begin();
|
|
144095
144272
|
try {
|
|
144096
144273
|
await execFileAsync37("xcrun", args, { timeout: 15e3 });
|
|
@@ -144110,7 +144287,7 @@ var iosRemoteImpl6 = {
|
|
|
144110
144287
|
const count2 = params.count ?? 1;
|
|
144111
144288
|
if (await isRemoteTvOsSimulator(udid)) rejectTv2("shake", device);
|
|
144112
144289
|
for (let i = 0; i < count2; i++) {
|
|
144113
|
-
if (i > 0) await
|
|
144290
|
+
if (i > 0) await sleep16(SHAKE_INTERVAL_MS);
|
|
144114
144291
|
let result;
|
|
144115
144292
|
try {
|
|
144116
144293
|
result = await simctlSpawn(udid, { args: NOTIFYUTIL_ARGV });
|
|
@@ -144158,7 +144335,7 @@ function restingVectorFrom(stdout) {
|
|
|
144158
144335
|
return read;
|
|
144159
144336
|
}
|
|
144160
144337
|
var fmt = (v) => `${v.x.toFixed(4)}:${v.y.toFixed(4)}:${v.z.toFixed(4)}`;
|
|
144161
|
-
var
|
|
144338
|
+
var sleep17 = (ms3) => new Promise((r) => setTimeout(r, ms3));
|
|
144162
144339
|
var inFlightByDevice = /* @__PURE__ */ new Map();
|
|
144163
144340
|
function withDeviceLock(serial, fn) {
|
|
144164
144341
|
const previous = inFlightByDevice.get(serial) ?? Promise.resolve();
|
|
@@ -144223,7 +144400,7 @@ var androidImpl6 = {
|
|
|
144223
144400
|
y: rest.y,
|
|
144224
144401
|
z: rest.z
|
|
144225
144402
|
});
|
|
144226
|
-
await
|
|
144403
|
+
await sleep17(SWING_INTERVAL_MS);
|
|
144227
144404
|
}
|
|
144228
144405
|
}
|
|
144229
144406
|
} catch (err) {
|
|
@@ -144588,7 +144765,7 @@ var DISMISS_SPACING_MS = 1e3;
|
|
|
144588
144765
|
var DISMISS_TIMEOUT_MS = 5e3;
|
|
144589
144766
|
var WAKE_GRACE_READS = 2;
|
|
144590
144767
|
var abortReason2 = (signal) => signal.reason instanceof Error ? signal.reason : new Error("The fold was cancelled.");
|
|
144591
|
-
var
|
|
144768
|
+
var sleep18 = (ms3, signal) => new Promise((resolve24, reject) => {
|
|
144592
144769
|
if (signal?.aborted) return reject(abortReason2(signal));
|
|
144593
144770
|
const timer = setTimeout(resolve24, ms3);
|
|
144594
144771
|
signal?.addEventListener(
|
|
@@ -144662,7 +144839,7 @@ async function awaitSettled(serial, expected, wake, signal) {
|
|
|
144662
144839
|
let agreeing = 0;
|
|
144663
144840
|
const deadline = Date.now() + SETTLE_TIMEOUT_MS2;
|
|
144664
144841
|
while (Date.now() < deadline) {
|
|
144665
|
-
await
|
|
144842
|
+
await sleep18(POLL_MS2, signal);
|
|
144666
144843
|
const read = await readSnapshot(serial);
|
|
144667
144844
|
const same = read.state === last?.state && read.awake === last?.awake;
|
|
144668
144845
|
if (!isReady(read, expected)) agreeing = 0;
|
|
@@ -144697,7 +144874,7 @@ async function dismissFoldLockScreen(serial, signal) {
|
|
|
144697
144874
|
await shell(serial, "wm dismiss-keyguard");
|
|
144698
144875
|
}
|
|
144699
144876
|
}
|
|
144700
|
-
await
|
|
144877
|
+
await sleep18(POLL_MS2, signal);
|
|
144701
144878
|
}
|
|
144702
144879
|
return "The fold raised the lock screen and argent could not dismiss it (a PIN or password keeps it up). Unlock the device before the next action.";
|
|
144703
144880
|
}
|
|
@@ -149274,7 +149451,7 @@ function formatDescribeTree(root, opts) {
|
|
|
149274
149451
|
}
|
|
149275
149452
|
|
|
149276
149453
|
// ../tool-server/src/tools/describe/platforms/tv.ts
|
|
149277
|
-
var
|
|
149454
|
+
var sleep19 = (ms3) => new Promise((r) => setTimeout(r, ms3));
|
|
149278
149455
|
var EMPTY_RETRY_ATTEMPTS = 3;
|
|
149279
149456
|
var EMPTY_RETRY_DELAY_MS = 600;
|
|
149280
149457
|
var EMPTY_HINT2 = "No focusable elements after retrying and recycling the read path. Either the app is still loading or mid-transition (after launch-app / restart-app, or a press that opened an app), or the screen has nothing focusable (sleep, screensaver, video playback). Wait ~2-3s and call describe again; a React Native app only exposes focus once its JS bundle has loaded. If it stays empty, take a screenshot to confirm what's actually on screen.";
|
|
@@ -149306,7 +149483,7 @@ async function describeTv(registry2, device, raw) {
|
|
|
149306
149483
|
let res = await api.describe();
|
|
149307
149484
|
if (device.platform !== "android") {
|
|
149308
149485
|
for (let attempt = 1; attempt < EMPTY_RETRY_ATTEMPTS && isEmptyFocus(res); attempt++) {
|
|
149309
|
-
await
|
|
149486
|
+
await sleep19(EMPTY_RETRY_DELAY_MS);
|
|
149310
149487
|
res = await api.describe();
|
|
149311
149488
|
}
|
|
149312
149489
|
}
|
|
@@ -178390,7 +178567,7 @@ var path75 = __toESM(require("node:path"));
|
|
|
178390
178567
|
init_zod();
|
|
178391
178568
|
init_capability();
|
|
178392
178569
|
init_device_info();
|
|
178393
|
-
var
|
|
178570
|
+
var sleep20 = (ms3) => new Promise((r) => setTimeout(r, ms3));
|
|
178394
178571
|
var DEFAULT_PANEL_TIMEOUT_MS = 5e3;
|
|
178395
178572
|
var MAX_PANEL_TIMEOUT_MS = 3e4;
|
|
178396
178573
|
var PANEL_POLL_MS2 = 100;
|
|
@@ -178500,7 +178677,7 @@ async function waitForPanel(app, params, signal) {
|
|
|
178500
178677
|
"file_panel_not_open"
|
|
178501
178678
|
);
|
|
178502
178679
|
}
|
|
178503
|
-
await
|
|
178680
|
+
await sleep20(PANEL_POLL_MS2);
|
|
178504
178681
|
}
|
|
178505
178682
|
}
|
|
178506
178683
|
async function choose(app, params, ctx) {
|
|
@@ -178620,7 +178797,7 @@ Fails if no panel appears within timeoutMs, if more than one panel is open and p
|
|
|
178620
178797
|
init_zod();
|
|
178621
178798
|
init_capability();
|
|
178622
178799
|
init_device_info();
|
|
178623
|
-
var
|
|
178800
|
+
var sleep21 = (ms3) => new Promise((r) => setTimeout(r, ms3));
|
|
178624
178801
|
var MAX_PATH_TITLES = 9;
|
|
178625
178802
|
var capability41 = {
|
|
178626
178803
|
macos: { app: true, catalyst: true }
|
|
@@ -178745,7 +178922,7 @@ Fails if no item matches (the error lists the titles at that level), if the item
|
|
|
178745
178922
|
"Menu.perform",
|
|
178746
178923
|
params.path !== void 0 ? { path: params.path } : { identifier: params.identifier }
|
|
178747
178924
|
);
|
|
178748
|
-
await
|
|
178925
|
+
await sleep21(MACOS_CLICK_SETTLE_MS);
|
|
178749
178926
|
return {
|
|
178750
178927
|
chosen: chosen.path,
|
|
178751
178928
|
...chosen.identifier !== void 0 ? { identifier: chosen.identifier } : {}
|