@swmansion/argent 0.33.1-next.2 → 0.33.1-next.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/argent-android-devtools-0.4.0.apk +0 -0
- package/bin/darwin/argent-macos-helper +0 -0
- package/bin/darwin/ax-service +0 -0
- package/bin/darwin/tvos-ax-service +0 -0
- package/bin/darwin/tvos-hid-daemon +0 -0
- package/bin/network-inspector/network-inspector.jar +0 -0
- package/bin/tcp/ax-service +0 -0
- package/dist/cli-cmds.mjs +267 -70
- package/dist/client.js +253 -56
- package/dist/flow-script-runner.mjs +148 -5
- package/dist/installer.mjs +52 -26
- package/dist/ios-device-runner/ArgentRunner/ArgentRunnerUITests/ArgentRunnerSession+Snapshot.swift +110 -4
- package/dist/mcp-server.mjs +257 -60
- package/dist/tool-args.generated.d.ts +3 -1
- package/dist/tool-server.cjs +1366 -697
- package/dylibs/libArgentInjectionBootstrap.dylib +0 -0
- package/dylibs/libKeyboardPatch.dylib +0 -0
- package/dylibs/libNativeDevtoolsIos.dylib +0 -0
- package/dylibs/macos/libArgentInjectionBootstrap.dylib +0 -0
- package/dylibs/macos/libNativeDevtoolsMacos.dylib +0 -0
- package/dylibs/tcp/libArgentInjectionBootstrap.dylib +0 -0
- package/dylibs/tcp/libKeyboardPatch.dylib +0 -0
- package/dylibs/tcp/libNativeDevtoolsIos.dylib +0 -0
- package/dylibs/tvos/libArgentInjectionBootstrap.dylib +0 -0
- package/dylibs/tvos/libKeyboardPatch.dylib +0 -0
- package/dylibs/tvos/libNativeDevtoolsIos.dylib +0 -0
- package/package.json +2 -3
- package/skills/argent-create-e2e/references/e2e-yaml.md +11 -1
- package/skills/argent-create-e2e/references/reliability-and-recovery.md +1 -1
- package/skills/argent-device-interact/SKILL.md +1 -1
- package/skills/argent-device-interact/references/harmonyos.md +1 -1
- package/skills/argent-react-native-app-workflow/SKILL.md +1 -1
- package/skills/argent-test-ui-flow/SKILL.md +6 -8
- package/assets/trace-processor/SHA256SUMS +0 -4
- package/assets/trace-processor/engine.mjs +0 -42423
package/dist/mcp-server.mjs
CHANGED
|
@@ -17450,7 +17450,7 @@ function handleIntersectionResults(result, left, right) {
|
|
|
17450
17450
|
const unrecKeys = /* @__PURE__ */ new Map();
|
|
17451
17451
|
let unrecIssue;
|
|
17452
17452
|
const keyIssues = /* @__PURE__ */ new Map();
|
|
17453
|
-
const
|
|
17453
|
+
const collect2 = (iss, side) => {
|
|
17454
17454
|
let keys;
|
|
17455
17455
|
if (iss.code === "unrecognized_keys" && !iss.path?.length) {
|
|
17456
17456
|
unrecIssue ?? (unrecIssue = iss);
|
|
@@ -17471,11 +17471,11 @@ function handleIntersectionResults(result, left, right) {
|
|
|
17471
17471
|
return true;
|
|
17472
17472
|
};
|
|
17473
17473
|
for (const iss of left.issues) {
|
|
17474
|
-
if (!
|
|
17474
|
+
if (!collect2(iss, "l"))
|
|
17475
17475
|
result.issues.push(iss);
|
|
17476
17476
|
}
|
|
17477
17477
|
for (const iss of right.issues) {
|
|
17478
|
-
if (!
|
|
17478
|
+
if (!collect2(iss, "r"))
|
|
17479
17479
|
result.issues.push(iss);
|
|
17480
17480
|
}
|
|
17481
17481
|
const bothKeys = [...unrecKeys].filter(([, f]) => f.l && f.r).map(([k]) => k);
|
|
@@ -24574,7 +24574,7 @@ function spawnToolsServer(paths, port, options = {}) {
|
|
|
24574
24574
|
"error",
|
|
24575
24575
|
(err) => reject(
|
|
24576
24576
|
new Error(
|
|
24577
|
-
err.code === "ENOENT" && nodeBin === "node" ? "Could not start the argent tool-server: `node` was not found on PATH. Install Node.js
|
|
24577
|
+
err.code === "ENOENT" && nodeBin === "node" ? "Could not start the argent tool-server: `node` was not found on PATH. Install Node.js 22.18+ or add it to PATH." : `Could not start the argent tool-server: ${err.message}`
|
|
24578
24578
|
)
|
|
24579
24579
|
)
|
|
24580
24580
|
);
|
|
@@ -25490,7 +25490,10 @@ import { basename, extname } from "node:path";
|
|
|
25490
25490
|
var FLOW_NAME_CHARSET = "[A-Za-z0-9_-]+";
|
|
25491
25491
|
var FLOW_NAME_PATTERN = new RegExp(`^${FLOW_NAME_CHARSET}$`);
|
|
25492
25492
|
var FLOW_FILE_NAME_PATTERN = new RegExp(`^${FLOW_NAME_CHARSET}\\.yaml$`);
|
|
25493
|
-
var
|
|
25493
|
+
var SCRIPT_FILE_EXTENSIONS = [".mjs", ".mts", ".js", ".ts"];
|
|
25494
|
+
var SCRIPT_FILE_NAME_PATTERN = new RegExp(
|
|
25495
|
+
`^${FLOW_NAME_CHARSET}(?:${SCRIPT_FILE_EXTENSIONS.map((ext) => `\\${ext}`).join("|")})$`
|
|
25496
|
+
);
|
|
25494
25497
|
function interpolateFileInputPath(template, args) {
|
|
25495
25498
|
let missing = false;
|
|
25496
25499
|
const out = template.replace(/\$\{([A-Za-z0-9_]+)\}/g, (_m, name) => {
|
|
@@ -26010,6 +26013,8 @@ var FAILURE_CODES = {
|
|
|
26010
26013
|
FLOW_DEVICE_RESOLUTION: "FLOW_DEVICE_RESOLUTION",
|
|
26011
26014
|
// The target does not satisfy the test's `requires:` block; a directory run skips it.
|
|
26012
26015
|
FLOW_REQUIREMENTS_UNMET: "FLOW_REQUIREMENTS_UNMET",
|
|
26016
|
+
// The tool-server's Node.js cannot run a TypeScript `script:` step the test holds.
|
|
26017
|
+
FLOW_SCRIPT_TYPESCRIPT_UNSUPPORTED: "FLOW_SCRIPT_TYPESCRIPT_UNSUPPORTED",
|
|
26013
26018
|
PROFILER_QUERY_MODE_INVALID: "PROFILER_QUERY_MODE_INVALID",
|
|
26014
26019
|
PROFILER_QUERY_REQUIRED_PARAM_MISSING: "PROFILER_QUERY_REQUIRED_PARAM_MISSING",
|
|
26015
26020
|
PROFILER_DATA_NOT_LOADED: "PROFILER_DATA_NOT_LOADED",
|
|
@@ -26270,7 +26275,7 @@ async function getResolvedToolsUrl() {
|
|
|
26270
26275
|
|
|
26271
26276
|
// ../argent-tools-client/src/file-inputs.ts
|
|
26272
26277
|
import { createHash as createHash2, randomUUID as randomUUID4 } from "node:crypto";
|
|
26273
|
-
import { createReadStream, rmSync as rmSync2 } from "node:fs";
|
|
26278
|
+
import { createReadStream as createReadStream2, rmSync as rmSync2 } from "node:fs";
|
|
26274
26279
|
import {
|
|
26275
26280
|
chmod as chmod3,
|
|
26276
26281
|
lstat,
|
|
@@ -26286,50 +26291,234 @@ import { constants, tmpdir } from "node:os";
|
|
|
26286
26291
|
import * as path10 from "node:path";
|
|
26287
26292
|
|
|
26288
26293
|
// ../archive/src/index.ts
|
|
26289
|
-
import {
|
|
26290
|
-
import {
|
|
26291
|
-
import {
|
|
26292
|
-
import {
|
|
26293
|
-
|
|
26294
|
+
import { spawn as spawn2 } from "node:child_process";
|
|
26295
|
+
import { once } from "node:events";
|
|
26296
|
+
import { createReadStream, createWriteStream } from "node:fs";
|
|
26297
|
+
import { open as open2, rm, readdir as readdir3 } from "node:fs/promises";
|
|
26298
|
+
import { basename as basename4, dirname as dirname5, join as join9, resolve as resolve6, sep as sep2 } from "node:path";
|
|
26299
|
+
import { Writable } from "node:stream";
|
|
26300
|
+
import { pipeline } from "node:stream/promises";
|
|
26301
|
+
import zlib from "node:zlib";
|
|
26294
26302
|
var ArchiveError = class extends Error {
|
|
26295
26303
|
};
|
|
26296
|
-
function
|
|
26297
|
-
|
|
26304
|
+
var ARCHIVE_FORMATS = typeof zlib.createZstdCompress === "function" ? ["zstd", "gzip"] : ["gzip"];
|
|
26305
|
+
var ARCHIVE_CONTENT_TYPES = {
|
|
26306
|
+
zstd: "application/zstd",
|
|
26307
|
+
gzip: "application/gzip"
|
|
26308
|
+
};
|
|
26309
|
+
function pickArchiveFormat(peerFormats) {
|
|
26310
|
+
return ARCHIVE_FORMATS.find((f) => peerFormats?.includes(f)) ?? "gzip";
|
|
26311
|
+
}
|
|
26312
|
+
var CHUNK_BYTES = 1 << 20;
|
|
26313
|
+
function createCompressor(format) {
|
|
26314
|
+
return format === "zstd" ? zlib.createZstdCompress({
|
|
26315
|
+
chunkSize: CHUNK_BYTES,
|
|
26316
|
+
// Lets the decoder detect corruption.
|
|
26317
|
+
params: { [zlib.constants.ZSTD_c_checksumFlag]: 1 }
|
|
26318
|
+
}) : zlib.createGzip({ chunkSize: CHUNK_BYTES });
|
|
26319
|
+
}
|
|
26320
|
+
function createTarArgs(sourcePath) {
|
|
26321
|
+
const name = basename4(sourcePath);
|
|
26322
|
+
return ["-cf", "-", "-C", dirname5(sourcePath), /^[-@]/.test(name) ? `./${name}` : name];
|
|
26323
|
+
}
|
|
26324
|
+
var MAX_LISTING_BYTES = 32 << 20;
|
|
26325
|
+
var MAX_LISTING_LINES = 1 << 18;
|
|
26326
|
+
var MAX_STDERR_BYTES = 16 << 10;
|
|
26327
|
+
var MAX_UNREAD_BYTES = 16 << 20;
|
|
26328
|
+
function collect(stream, maxBytes, { maxLines = Infinity, onOverflow } = {}) {
|
|
26329
|
+
const chunks = [];
|
|
26330
|
+
let bytes = 0;
|
|
26331
|
+
let lines = 0;
|
|
26332
|
+
let overflowed = false;
|
|
26333
|
+
stream?.on("data", (chunk) => {
|
|
26334
|
+
if (overflowed) return;
|
|
26335
|
+
chunks.push(chunk.subarray(0, maxBytes - bytes));
|
|
26336
|
+
bytes += chunk.length;
|
|
26337
|
+
for (let i = chunk.indexOf(10); i !== -1 && lines <= maxLines; i = chunk.indexOf(10, i + 1)) {
|
|
26338
|
+
lines++;
|
|
26339
|
+
}
|
|
26340
|
+
if (bytes > maxBytes || lines > maxLines) {
|
|
26341
|
+
overflowed = true;
|
|
26342
|
+
onOverflow?.();
|
|
26343
|
+
}
|
|
26344
|
+
});
|
|
26345
|
+
return {
|
|
26346
|
+
overflowed: () => overflowed,
|
|
26347
|
+
text: () => Buffer.concat(chunks).toString("utf8") + (overflowed ? "\u2026" : "")
|
|
26348
|
+
};
|
|
26298
26349
|
}
|
|
26299
|
-
async function
|
|
26350
|
+
async function createArchiveFile(sourcePath, archivePath, format, signal) {
|
|
26351
|
+
const out = createWriteStream(archivePath);
|
|
26352
|
+
await once(out, "ready");
|
|
26300
26353
|
try {
|
|
26301
|
-
await
|
|
26354
|
+
await archiveInto(out, sourcePath, format, signal);
|
|
26302
26355
|
} catch (err) {
|
|
26303
|
-
|
|
26356
|
+
out.destroy();
|
|
26357
|
+
await rm(archivePath, { force: true }).catch(() => {
|
|
26304
26358
|
});
|
|
26359
|
+
signal?.throwIfAborted();
|
|
26305
26360
|
throw err;
|
|
26306
26361
|
}
|
|
26307
26362
|
}
|
|
26363
|
+
async function archiveInto(out, sourcePath, format, signal) {
|
|
26364
|
+
const child = spawn2("tar", createTarArgs(sourcePath), {
|
|
26365
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
26366
|
+
signal
|
|
26367
|
+
});
|
|
26368
|
+
const exited = new Promise((res, rej) => {
|
|
26369
|
+
child.on("error", rej);
|
|
26370
|
+
child.on("close", res);
|
|
26371
|
+
});
|
|
26372
|
+
const stderr = collect(child.stderr, MAX_STDERR_BYTES);
|
|
26373
|
+
const [written, closed] = await Promise.allSettled([
|
|
26374
|
+
pipeline(child.stdout, createCompressor(format), out),
|
|
26375
|
+
exited
|
|
26376
|
+
]);
|
|
26377
|
+
if (closed.status === "rejected") throw closed.reason;
|
|
26378
|
+
if (written.status === "rejected") throw written.reason;
|
|
26379
|
+
if (closed.value !== 0) {
|
|
26380
|
+
throw new Error(`tar exited with code ${closed.value}: ${stderr.text().trim()}`);
|
|
26381
|
+
}
|
|
26382
|
+
}
|
|
26383
|
+
async function sniffFormat(archivePath) {
|
|
26384
|
+
const fh = await open2(archivePath, "r");
|
|
26385
|
+
try {
|
|
26386
|
+
const { buffer, bytesRead } = await fh.read(Buffer.alloc(4), 0, 4, 0);
|
|
26387
|
+
const magic = buffer.subarray(0, bytesRead).toString("hex");
|
|
26388
|
+
if (magic.startsWith("1f8b")) return "gzip";
|
|
26389
|
+
if (magic === "28b52ffd" && ARCHIVE_FORMATS.includes("zstd")) return "zstd";
|
|
26390
|
+
throw new ArchiveError("unrecognized compression");
|
|
26391
|
+
} finally {
|
|
26392
|
+
await fh.close();
|
|
26393
|
+
}
|
|
26394
|
+
}
|
|
26395
|
+
var ZSTD_FRAME_MAGIC = 4247762216;
|
|
26396
|
+
async function assertSingleCompleteZstdFrame(archivePath) {
|
|
26397
|
+
const fh = await open2(archivePath, "r");
|
|
26398
|
+
try {
|
|
26399
|
+
const { size } = await fh.stat();
|
|
26400
|
+
const window = Buffer.alloc(4096);
|
|
26401
|
+
let windowStart = 0;
|
|
26402
|
+
let windowEnd = 0;
|
|
26403
|
+
let pos = 0;
|
|
26404
|
+
const read = async (n) => {
|
|
26405
|
+
if (pos < windowStart || pos + n > windowEnd) {
|
|
26406
|
+
const { bytesRead } = await fh.read(window, 0, window.length, pos);
|
|
26407
|
+
windowStart = pos;
|
|
26408
|
+
windowEnd = pos + bytesRead;
|
|
26409
|
+
if (bytesRead < n) throw new ArchiveError("truncated zstd frame");
|
|
26410
|
+
}
|
|
26411
|
+
return window.subarray(pos - windowStart, pos - windowStart + n);
|
|
26412
|
+
};
|
|
26413
|
+
for (let frame = 0; pos < size; frame++) {
|
|
26414
|
+
const header = await read(5);
|
|
26415
|
+
if (header.readUInt32LE(0) !== ZSTD_FRAME_MAGIC) throw new ArchiveError("bad zstd frame");
|
|
26416
|
+
const descriptor = header[4];
|
|
26417
|
+
const singleSegment = descriptor >> 5 & 1;
|
|
26418
|
+
pos += 5 + (singleSegment ? 0 : 1) + // window descriptor
|
|
26419
|
+
[0, 1, 2, 4][descriptor & 3] + // dictionary id
|
|
26420
|
+
[singleSegment, 2, 4, 8][descriptor >> 6];
|
|
26421
|
+
let hasData = false;
|
|
26422
|
+
for (let last = 0; !last; ) {
|
|
26423
|
+
const block = (await read(3)).readUIntLE(0, 3);
|
|
26424
|
+
last = block & 1;
|
|
26425
|
+
const type = block >> 1 & 3;
|
|
26426
|
+
const blockSize = block >> 3;
|
|
26427
|
+
if (blockSize > 0) hasData = true;
|
|
26428
|
+
pos += 3 + (type === 1 ? 1 : blockSize);
|
|
26429
|
+
}
|
|
26430
|
+
if (descriptor >> 2 & 1) pos += 4;
|
|
26431
|
+
if (hasData && frame > 0) throw new ArchiveError("multi-frame zstd");
|
|
26432
|
+
}
|
|
26433
|
+
if (pos !== size) throw new ArchiveError("truncated zstd frame");
|
|
26434
|
+
} finally {
|
|
26435
|
+
await fh.close();
|
|
26436
|
+
}
|
|
26437
|
+
}
|
|
26438
|
+
var TAR_LOCALE = process.platform === "darwin" ? "en_US.UTF-8" : "C.UTF-8";
|
|
26439
|
+
function tarEnv(env) {
|
|
26440
|
+
const characterType = env.LC_ALL || env.LC_CTYPE || env.LANG || "";
|
|
26441
|
+
return /utf-?8/i.test(characterType) ? env : { ...env, LC_ALL: TAR_LOCALE };
|
|
26442
|
+
}
|
|
26443
|
+
async function runTar(archive, args) {
|
|
26444
|
+
const child = spawn2("tar", [...args, "-f", "-"], {
|
|
26445
|
+
env: tarEnv(process.env)
|
|
26446
|
+
});
|
|
26447
|
+
const exited = new Promise((res, rej) => {
|
|
26448
|
+
child.on("error", rej);
|
|
26449
|
+
child.on("close", res);
|
|
26450
|
+
});
|
|
26451
|
+
const stdout = collect(child.stdout, MAX_LISTING_BYTES, {
|
|
26452
|
+
maxLines: MAX_LISTING_LINES,
|
|
26453
|
+
onOverflow: () => child.kill()
|
|
26454
|
+
});
|
|
26455
|
+
const stderr = collect(child.stderr, MAX_STDERR_BYTES);
|
|
26456
|
+
child.stdin?.on("error", () => {
|
|
26457
|
+
});
|
|
26458
|
+
const unreadLimit = new Error("unread limit");
|
|
26459
|
+
let unread = 0;
|
|
26460
|
+
const fed = pipeline(
|
|
26461
|
+
createReadStream(archive.path, { highWaterMark: CHUNK_BYTES }),
|
|
26462
|
+
archive.format === "zstd" ? zlib.createZstdDecompress({ chunkSize: CHUNK_BYTES }) : zlib.createGunzip({ chunkSize: CHUNK_BYTES }),
|
|
26463
|
+
new Writable({
|
|
26464
|
+
write(chunk, _encoding, done) {
|
|
26465
|
+
if (child.stdin?.writable) return void child.stdin.write(chunk, () => done());
|
|
26466
|
+
unread += chunk.length;
|
|
26467
|
+
done(unread > MAX_UNREAD_BYTES ? unreadLimit : null);
|
|
26468
|
+
},
|
|
26469
|
+
final(done) {
|
|
26470
|
+
child.stdin?.end();
|
|
26471
|
+
done();
|
|
26472
|
+
},
|
|
26473
|
+
destroy(err, done) {
|
|
26474
|
+
if (err) child.stdin?.destroy();
|
|
26475
|
+
done(err);
|
|
26476
|
+
}
|
|
26477
|
+
})
|
|
26478
|
+
).then(
|
|
26479
|
+
() => null,
|
|
26480
|
+
(err) => err
|
|
26481
|
+
);
|
|
26482
|
+
const [code, feedError] = await Promise.all([exited, fed]);
|
|
26483
|
+
if (stdout.overflowed()) {
|
|
26484
|
+
throw new Error(
|
|
26485
|
+
`tar ${args.join(" ")} listed more than ${MAX_LISTING_LINES} members or ${MAX_LISTING_BYTES >> 20} MiB`
|
|
26486
|
+
);
|
|
26487
|
+
}
|
|
26488
|
+
if (feedError && feedError !== unreadLimit) throw feedError;
|
|
26489
|
+
if (code !== 0)
|
|
26490
|
+
throw new Error(`tar ${args.join(" ")} exited with code ${code}: ${stderr.text().trim()}`);
|
|
26491
|
+
return stdout.text();
|
|
26492
|
+
}
|
|
26308
26493
|
function normalizeTarMemberPath(memberPath) {
|
|
26309
26494
|
return memberPath.replace(/^\.\//, "").replace(/\\/g, "/");
|
|
26310
26495
|
}
|
|
26496
|
+
function isContainedPath(path17, windows = process.platform === "win32") {
|
|
26497
|
+
const slashed = path17.replace(/\\/g, "/");
|
|
26498
|
+
const drive = windows ? /^[A-Za-z]:/ : /^[A-Za-z]:\//;
|
|
26499
|
+
return !slashed.startsWith("/") && !drive.test(slashed) && !slashed.split("/").includes("..");
|
|
26500
|
+
}
|
|
26311
26501
|
function isSafeTarMember(memberPath, destDir) {
|
|
26312
26502
|
const normalized = normalizeTarMemberPath(memberPath);
|
|
26313
|
-
if (!normalized
|
|
26314
|
-
if (normalized.startsWith("/") || /^[A-Za-z]:[\\/]/.test(normalized)) return false;
|
|
26315
|
-
const relative2 = posix2.normalize(normalized);
|
|
26316
|
-
if (relative2 === ".." || relative2.startsWith("../") || relative2.split("/").includes("..")) {
|
|
26317
|
-
return false;
|
|
26318
|
-
}
|
|
26503
|
+
if (!isContainedPath(normalized)) return false;
|
|
26319
26504
|
const root = resolve6(destDir);
|
|
26320
|
-
|
|
26321
|
-
return resolved === root || resolved.startsWith(root + sep2);
|
|
26505
|
+
return resolve6(destDir, normalized).startsWith(root + sep2);
|
|
26322
26506
|
}
|
|
26323
|
-
async function
|
|
26324
|
-
|
|
26325
|
-
|
|
26507
|
+
async function readListing(archive, args) {
|
|
26508
|
+
try {
|
|
26509
|
+
return await runTar(archive, args);
|
|
26510
|
+
} catch (err) {
|
|
26511
|
+
throw new ArchiveError(
|
|
26512
|
+
`Could not read archive: ${err instanceof Error ? err.message : String(err)}`
|
|
26513
|
+
);
|
|
26514
|
+
}
|
|
26326
26515
|
}
|
|
26327
|
-
function
|
|
26328
|
-
|
|
26329
|
-
return
|
|
26516
|
+
async function listTarMembers(archive) {
|
|
26517
|
+
const stdout = await readListing(archive, ["-t"]);
|
|
26518
|
+
return stdout.split("\n").map((line) => line.trim()).filter((line) => line.length > 0);
|
|
26330
26519
|
}
|
|
26331
|
-
async function assertSafeMemberTypes(
|
|
26332
|
-
const
|
|
26520
|
+
async function assertSafeMemberTypes(archive) {
|
|
26521
|
+
const stdout = await readListing(archive, ["-tv"]);
|
|
26333
26522
|
for (const line of stdout.split("\n")) {
|
|
26334
26523
|
if (!line.trim()) continue;
|
|
26335
26524
|
const type = line[0];
|
|
@@ -26337,7 +26526,7 @@ async function assertSafeMemberTypes(tarPath) {
|
|
|
26337
26526
|
if (type === "l") {
|
|
26338
26527
|
const parts = line.split(" -> ");
|
|
26339
26528
|
const target = parts.length === 2 ? parts[1].trim() : "";
|
|
26340
|
-
if (parts.length !== 2 || !target ||
|
|
26529
|
+
if (parts.length !== 2 || !target || !isContainedPath(target)) {
|
|
26341
26530
|
throw new ArchiveError(
|
|
26342
26531
|
`Archive contains a symlink whose target could not be confirmed safe: "${line.trim()}".`
|
|
26343
26532
|
);
|
|
@@ -26349,15 +26538,8 @@ async function assertSafeMemberTypes(tarPath) {
|
|
|
26349
26538
|
);
|
|
26350
26539
|
}
|
|
26351
26540
|
}
|
|
26352
|
-
async function assertSafeArchive(
|
|
26353
|
-
|
|
26354
|
-
try {
|
|
26355
|
-
members2 = await listTarMembers(tarPath);
|
|
26356
|
-
} catch (err) {
|
|
26357
|
-
throw new ArchiveError(
|
|
26358
|
-
`Could not read archive: ${err instanceof Error ? err.message : String(err)}`
|
|
26359
|
-
);
|
|
26360
|
-
}
|
|
26541
|
+
async function assertSafeArchive(archive, destDir) {
|
|
26542
|
+
const members2 = await listTarMembers(archive);
|
|
26361
26543
|
if (members2.length === 0) {
|
|
26362
26544
|
throw new ArchiveError("Archive is empty.");
|
|
26363
26545
|
}
|
|
@@ -26366,7 +26548,7 @@ async function assertSafeArchive(tarPath, destDir) {
|
|
|
26366
26548
|
throw new ArchiveError(`Archive contains an unsafe path "${member}" \u2014 refusing extraction.`);
|
|
26367
26549
|
}
|
|
26368
26550
|
}
|
|
26369
|
-
await assertSafeMemberTypes(
|
|
26551
|
+
await assertSafeMemberTypes(archive);
|
|
26370
26552
|
}
|
|
26371
26553
|
async function resolveMember(destDir, expectedName) {
|
|
26372
26554
|
const entries = await readdir3(destDir);
|
|
@@ -26381,9 +26563,18 @@ async function resolveMember(destDir, expectedName) {
|
|
|
26381
26563
|
}
|
|
26382
26564
|
return join9(destDir, real[0]);
|
|
26383
26565
|
}
|
|
26384
|
-
async function
|
|
26385
|
-
|
|
26386
|
-
|
|
26566
|
+
async function safeExtractArchive(archivePath, destDir, expectedName) {
|
|
26567
|
+
let archive;
|
|
26568
|
+
try {
|
|
26569
|
+
archive = { path: archivePath, format: await sniffFormat(archivePath) };
|
|
26570
|
+
if (archive.format === "zstd") await assertSingleCompleteZstdFrame(archivePath);
|
|
26571
|
+
} catch (err) {
|
|
26572
|
+
throw new ArchiveError(
|
|
26573
|
+
`Could not read archive: ${err instanceof Error ? err.message : String(err)}`
|
|
26574
|
+
);
|
|
26575
|
+
}
|
|
26576
|
+
await assertSafeArchive(archive, destDir);
|
|
26577
|
+
await runTar(archive, ["-x", "-C", destDir]);
|
|
26387
26578
|
return resolveMember(destDir, expectedName);
|
|
26388
26579
|
}
|
|
26389
26580
|
|
|
@@ -26464,7 +26655,7 @@ function untrackArchive(archive) {
|
|
|
26464
26655
|
function sha256File(filePath) {
|
|
26465
26656
|
return new Promise((resolve10, reject) => {
|
|
26466
26657
|
const hash = createHash2("sha256");
|
|
26467
|
-
|
|
26658
|
+
createReadStream2(filePath).on("data", (chunk) => hash.update(chunk)).on("end", () => resolve10(hash.digest("hex"))).on("error", reject);
|
|
26468
26659
|
});
|
|
26469
26660
|
}
|
|
26470
26661
|
function toolServerError(text) {
|
|
@@ -26490,15 +26681,15 @@ function uploadFailure(url, res, text, bytes) {
|
|
|
26490
26681
|
errorKind: "validation"
|
|
26491
26682
|
});
|
|
26492
26683
|
}
|
|
26493
|
-
async function uploadTar(tarPath, endpoint, signal) {
|
|
26684
|
+
async function uploadTar(tarPath, format, endpoint, signal) {
|
|
26494
26685
|
const { size } = await stat3(tarPath);
|
|
26495
26686
|
const init = {
|
|
26496
26687
|
method: "POST",
|
|
26497
26688
|
headers: {
|
|
26498
|
-
"content-type":
|
|
26689
|
+
"content-type": ARCHIVE_CONTENT_TYPES[format],
|
|
26499
26690
|
...endpoint.token ? { Authorization: `Bearer ${endpoint.token}` } : {}
|
|
26500
26691
|
},
|
|
26501
|
-
body:
|
|
26692
|
+
body: createReadStream2(tarPath),
|
|
26502
26693
|
duplex: "half",
|
|
26503
26694
|
signal
|
|
26504
26695
|
};
|
|
@@ -26515,12 +26706,13 @@ async function uploadTar(tarPath, endpoint, signal) {
|
|
|
26515
26706
|
return json.uploadId;
|
|
26516
26707
|
}
|
|
26517
26708
|
async function uploadFile(sourcePath, endpoint, signal) {
|
|
26709
|
+
const format = pickArchiveFormat(endpoint.formats);
|
|
26518
26710
|
const tarPath = path10.join(tmpdir(), `argent-upload-${randomUUID4()}.tar.gz`);
|
|
26519
26711
|
trackArchive(tarPath);
|
|
26520
26712
|
try {
|
|
26521
|
-
await
|
|
26713
|
+
await createArchiveFile(await realpath2(sourcePath), tarPath, format, signal);
|
|
26522
26714
|
const contentHash = await sha256File(tarPath);
|
|
26523
|
-
return { uploadId: await uploadTar(tarPath, endpoint, signal), contentHash };
|
|
26715
|
+
return { uploadId: await uploadTar(tarPath, format, endpoint, signal), contentHash };
|
|
26524
26716
|
} finally {
|
|
26525
26717
|
untrackArchive(tarPath);
|
|
26526
26718
|
await rm2(tarPath, { force: true }).catch(() => {
|
|
@@ -27375,7 +27567,7 @@ function createToolsClient(options = {}) {
|
|
|
27375
27567
|
const { url, token } = await route();
|
|
27376
27568
|
return { url, token };
|
|
27377
27569
|
}
|
|
27378
|
-
async function
|
|
27570
|
+
async function fetchToolList(opts) {
|
|
27379
27571
|
opts?.signal?.throwIfAborted();
|
|
27380
27572
|
const { url, token } = await baseUrl();
|
|
27381
27573
|
const res = await doFetch(
|
|
@@ -27384,8 +27576,10 @@ function createToolsClient(options = {}) {
|
|
|
27384
27576
|
{ longRunning: false, carriesUpload: false }
|
|
27385
27577
|
);
|
|
27386
27578
|
if (!res.ok) throw new Error(`GET /tools failed: ${res.status} ${res.statusText}`);
|
|
27387
|
-
|
|
27388
|
-
|
|
27579
|
+
return await res.json();
|
|
27580
|
+
}
|
|
27581
|
+
async function fetchTools(opts) {
|
|
27582
|
+
return (await fetchToolList(opts)).tools;
|
|
27389
27583
|
}
|
|
27390
27584
|
async function fetchTool(name, opts) {
|
|
27391
27585
|
return findTool(await fetchTools(opts), name);
|
|
@@ -27394,7 +27588,7 @@ function createToolsClient(options = {}) {
|
|
|
27394
27588
|
opts?.signal?.throwIfAborted();
|
|
27395
27589
|
const { url, token, remote } = await route();
|
|
27396
27590
|
let finalArgs = canonicalToolArgs(name, args);
|
|
27397
|
-
const tools = await
|
|
27591
|
+
const { tools, uploadFormats } = await fetchToolList({ signal: opts?.signal });
|
|
27398
27592
|
const meta2 = findTool(tools, name);
|
|
27399
27593
|
const olderServer = meta2 !== null && !tools.some((t) => t.name === canonicalToolId(meta2.name));
|
|
27400
27594
|
if (meta2) {
|
|
@@ -27411,7 +27605,7 @@ function createToolsClient(options = {}) {
|
|
|
27411
27605
|
if (remote) assertRequiredPresent(meta2, finalArgs);
|
|
27412
27606
|
finalArgs = await prepareFileInputs(meta2.fileInputs, finalArgs ?? {}, {
|
|
27413
27607
|
includeContent: remote,
|
|
27414
|
-
uploadEndpoint: remote ? { url, token } : void 0,
|
|
27608
|
+
uploadEndpoint: remote ? { url, token, formats: uploadFormats } : void 0,
|
|
27415
27609
|
log: diagnose,
|
|
27416
27610
|
baselineDirs,
|
|
27417
27611
|
collectMembers: collectFlowMembers,
|
|
@@ -27708,7 +27902,7 @@ async function downloadAndExtractArchive(handle, data, dir) {
|
|
|
27708
27902
|
const tarball = join13(dir, `${sanitizeSegment(handle.filename)}.tar.gz`);
|
|
27709
27903
|
try {
|
|
27710
27904
|
await writeFile4(tarball, data);
|
|
27711
|
-
return await
|
|
27905
|
+
return await safeExtractArchive(tarball, dir, handle.filename);
|
|
27712
27906
|
} catch {
|
|
27713
27907
|
return null;
|
|
27714
27908
|
} finally {
|
|
@@ -27787,7 +27981,10 @@ async function materializeArtifacts(result, ctx) {
|
|
|
27787
27981
|
}
|
|
27788
27982
|
try {
|
|
27789
27983
|
const res = await fetchFn(`${ctx.toolsUrl}/artifacts/${value.id}`, {
|
|
27790
|
-
headers:
|
|
27984
|
+
headers: value.archive ? {
|
|
27985
|
+
...authHeaders3,
|
|
27986
|
+
Accept: ARCHIVE_FORMATS.map((f) => ARCHIVE_CONTENT_TYPES[f]).join(", ")
|
|
27987
|
+
} : authHeaders3,
|
|
27791
27988
|
signal: ctx.signal
|
|
27792
27989
|
});
|
|
27793
27990
|
if (!res.ok) return null;
|
|
@@ -28536,7 +28733,7 @@ import * as fs8 from "node:fs";
|
|
|
28536
28733
|
import * as path14 from "node:path";
|
|
28537
28734
|
|
|
28538
28735
|
// ../telemetry/src/fingerprint.ts
|
|
28539
|
-
import { execFileSync as execFileSync2, spawn as
|
|
28736
|
+
import { execFileSync as execFileSync2, spawn as spawn3 } from "node:child_process";
|
|
28540
28737
|
|
|
28541
28738
|
// ../native-devtools-ios/src/index.ts
|
|
28542
28739
|
import * as path15 from "node:path";
|
|
@@ -209,7 +209,7 @@ export interface ArgentToolArgs {
|
|
|
209
209
|
name: string;
|
|
210
210
|
/** Absolute project root passed to e2e-start-recording. */
|
|
211
211
|
project_root: string;
|
|
212
|
-
/** Path to the .mjs
|
|
212
|
+
/** Path to the script file (.mjs, .mts, .js or .ts), relative to the e2e test YAML. For example: "../../scripts/seed-order.mjs". */
|
|
213
213
|
path: string;
|
|
214
214
|
/** Time limit in milliseconds. The default is 30000 and the minimum is 100. */
|
|
215
215
|
timeout?: number;
|
|
@@ -598,6 +598,8 @@ export interface ArgentToolArgs {
|
|
|
598
598
|
skipClassPrefixes?: Array<string>;
|
|
599
599
|
/** Maximum depth for returned child/ancestor serialization (default 150) */
|
|
600
600
|
maxDepth?: number;
|
|
601
|
+
/** true returns the view that would receive a touch at the point: it respects userInteractionEnabled, close to UIKit hit-testing. Default false: the deepest visible view. */
|
|
602
|
+
hitTest?: boolean;
|
|
601
603
|
};
|
|
602
604
|
"open-url": {
|
|
603
605
|
/** Target device id from `list-devices` (iOS UDID, Android serial, HarmonyOS id, or Chromium id). */
|