@swmansion/argent 0.33.1-next.9 → 0.34.0

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.
Files changed (39) hide show
  1. package/assets/Argent.tracetemplate +0 -0
  2. package/bin/argent-android-devtools-0.4.0.apk +0 -0
  3. package/bin/darwin/argent-macos-helper +0 -0
  4. package/bin/darwin/ax-service +0 -0
  5. package/bin/darwin/tvos-ax-service +0 -0
  6. package/bin/darwin/tvos-hid-daemon +0 -0
  7. package/bin/network-inspector/network-inspector.jar +0 -0
  8. package/bin/tcp/ax-service +0 -0
  9. package/dist/cli-cmds.mjs +338 -95
  10. package/dist/client.js +256 -56
  11. package/dist/flow-script-runner.mjs +148 -5
  12. package/dist/installer.mjs +40 -24
  13. package/dist/ios-device-runner/ArgentRunner/ArgentRunnerUITests/ArgentRunnerSession+Snapshot.swift +110 -4
  14. package/dist/mcp-server.mjs +330 -68
  15. package/dist/tool-args.generated.d.ts +22 -20
  16. package/dist/tool-server.cjs +3763 -2146
  17. package/dylibs/libArgentInjectionBootstrap.dylib +0 -0
  18. package/dylibs/libKeyboardPatch.dylib +0 -0
  19. package/dylibs/libNativeDevtoolsIos.dylib +0 -0
  20. package/dylibs/macos/libArgentInjectionBootstrap.dylib +0 -0
  21. package/dylibs/macos/libNativeDevtoolsMacos.dylib +0 -0
  22. package/dylibs/tcp/libArgentInjectionBootstrap.dylib +0 -0
  23. package/dylibs/tcp/libKeyboardPatch.dylib +0 -0
  24. package/dylibs/tcp/libNativeDevtoolsIos.dylib +0 -0
  25. package/dylibs/tvos/libArgentInjectionBootstrap.dylib +0 -0
  26. package/dylibs/tvos/libKeyboardPatch.dylib +0 -0
  27. package/dylibs/tvos/libNativeDevtoolsIos.dylib +0 -0
  28. package/package.json +2 -3
  29. package/rules/argent.md +1 -1
  30. package/skills/argent-create-e2e/references/e2e-yaml.md +11 -1
  31. package/skills/argent-create-e2e/references/reliability-and-recovery.md +1 -1
  32. package/skills/argent-device-interact/SKILL.md +2 -2
  33. package/skills/argent-device-interact/references/harmonyos.md +1 -1
  34. package/skills/argent-macos-app-interact/SKILL.md +5 -1
  35. package/skills/argent-native-profiler/SKILL.md +14 -5
  36. package/skills/argent-react-native-profiler/SKILL.md +7 -0
  37. package/skills/argent-test-ui-flow/SKILL.md +1 -1
  38. package/assets/trace-processor/SHA256SUMS +0 -4
  39. package/assets/trace-processor/engine.mjs +0 -42423
package/dist/cli-cmds.mjs CHANGED
@@ -8794,9 +8794,9 @@ var require_picocolors = __commonJS({
8794
8794
  var argv = p.argv || [];
8795
8795
  var env = p.env || {};
8796
8796
  var isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
8797
- var formatter = (open2, close, replace = open2) => (input2) => {
8798
- let string4 = "" + input2, index = string4.indexOf(close, open2.length);
8799
- return ~index ? open2 + replaceClose(string4, close, replace, index) + close : open2 + string4 + close;
8797
+ var formatter = (open3, close, replace = open3) => (input2) => {
8798
+ let string4 = "" + input2, index = string4.indexOf(close, open3.length);
8799
+ return ~index ? open3 + replaceClose(string4, close, replace, index) + close : open3 + string4 + close;
8800
8800
  };
8801
8801
  var replaceClose = (string4, close, replace, index) => {
8802
8802
  let result = "", cursor3 = 0;
@@ -9093,7 +9093,7 @@ function spawnToolsServer(paths, port, options = {}) {
9093
9093
  "error",
9094
9094
  (err) => reject(
9095
9095
  new Error(
9096
- err.code === "ENOENT" && nodeBin === "node" ? "Could not start the argent tool-server: `node` was not found on PATH. Install Node.js 20+ or add it to PATH." : `Could not start the argent tool-server: ${err.message}`
9096
+ 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}`
9097
9097
  )
9098
9098
  )
9099
9099
  );
@@ -10204,7 +10204,10 @@ import { basename, extname } from "node:path";
10204
10204
  var FLOW_NAME_CHARSET = "[A-Za-z0-9_-]+";
10205
10205
  var FLOW_NAME_PATTERN = new RegExp(`^${FLOW_NAME_CHARSET}$`);
10206
10206
  var FLOW_FILE_NAME_PATTERN = new RegExp(`^${FLOW_NAME_CHARSET}\\.yaml$`);
10207
- var SCRIPT_FILE_NAME_PATTERN = new RegExp(`^${FLOW_NAME_CHARSET}\\.mjs$`);
10207
+ var SCRIPT_FILE_EXTENSIONS = [".mjs", ".mts", ".js", ".ts"];
10208
+ var SCRIPT_FILE_NAME_PATTERN = new RegExp(
10209
+ `^${FLOW_NAME_CHARSET}(?:${SCRIPT_FILE_EXTENSIONS.map((ext) => `\\${ext}`).join("|")})$`
10210
+ );
10208
10211
  function interpolateFileInputPath(template, args) {
10209
10212
  let missing = false;
10210
10213
  const out = template.replace(/\$\{([A-Za-z0-9_]+)\}/g, (_m, name) => {
@@ -10698,6 +10701,9 @@ var FAILURE_CODES = {
10698
10701
  NATIVE_PROFILER_SESSION_TORN_DOWN: "NATIVE_PROFILER_SESSION_TORN_DOWN",
10699
10702
  NATIVE_PROFILER_APP_PROCESS_NOT_FOUND: "NATIVE_PROFILER_APP_PROCESS_NOT_FOUND",
10700
10703
  NATIVE_PROFILER_NO_EXPORTED_TRACE: "NATIVE_PROFILER_NO_EXPORTED_TRACE",
10704
+ NATIVE_PROFILER_APP_NOT_DEBUGGABLE: "NATIVE_PROFILER_APP_NOT_DEBUGGABLE",
10705
+ NATIVE_PROFILER_APP_HAS_WEBKIT_HEAP: "NATIVE_PROFILER_APP_HAS_WEBKIT_HEAP",
10706
+ NATIVE_PROFILER_APP_HEAP_CHECK_FAILED: "NATIVE_PROFILER_APP_HEAP_CHECK_FAILED",
10701
10707
  // Android perfetto start failures, mirroring the iOS xctrace set above.
10702
10708
  NATIVE_PROFILER_PERFETTO_PROCESS_ERROR: "NATIVE_PROFILER_PERFETTO_PROCESS_ERROR",
10703
10709
  NATIVE_PROFILER_PERFETTO_READY_TIMEOUT: "NATIVE_PROFILER_PERFETTO_READY_TIMEOUT",
@@ -10727,6 +10733,8 @@ var FAILURE_CODES = {
10727
10733
  FLOW_DEVICE_RESOLUTION: "FLOW_DEVICE_RESOLUTION",
10728
10734
  // The target does not satisfy the test's `requires:` block; a directory run skips it.
10729
10735
  FLOW_REQUIREMENTS_UNMET: "FLOW_REQUIREMENTS_UNMET",
10736
+ // The tool-server's Node.js cannot run a TypeScript `script:` step the test holds.
10737
+ FLOW_SCRIPT_TYPESCRIPT_UNSUPPORTED: "FLOW_SCRIPT_TYPESCRIPT_UNSUPPORTED",
10730
10738
  PROFILER_QUERY_MODE_INVALID: "PROFILER_QUERY_MODE_INVALID",
10731
10739
  PROFILER_QUERY_REQUIRED_PARAM_MISSING: "PROFILER_QUERY_REQUIRED_PARAM_MISSING",
10732
10740
  PROFILER_DATA_NOT_LOADED: "PROFILER_DATA_NOT_LOADED",
@@ -14899,7 +14907,7 @@ function handleIntersectionResults(result, left, right) {
14899
14907
  const unrecKeys = /* @__PURE__ */ new Map();
14900
14908
  let unrecIssue;
14901
14909
  const keyIssues = /* @__PURE__ */ new Map();
14902
- const collect = (iss, side) => {
14910
+ const collect2 = (iss, side) => {
14903
14911
  let keys;
14904
14912
  if (iss.code === "unrecognized_keys" && !iss.path?.length) {
14905
14913
  unrecIssue ?? (unrecIssue = iss);
@@ -14920,11 +14928,11 @@ function handleIntersectionResults(result, left, right) {
14920
14928
  return true;
14921
14929
  };
14922
14930
  for (const iss of left.issues) {
14923
- if (!collect(iss, "l"))
14931
+ if (!collect2(iss, "l"))
14924
14932
  result.issues.push(iss);
14925
14933
  }
14926
14934
  for (const iss of right.issues) {
14927
- if (!collect(iss, "r"))
14935
+ if (!collect2(iss, "r"))
14928
14936
  result.issues.push(iss);
14929
14937
  }
14930
14938
  const bothKeys = [...unrecKeys].filter(([, f]) => f.l && f.r).map(([k]) => k);
@@ -30770,7 +30778,7 @@ function parseLinkTarget(input2) {
30770
30778
 
30771
30779
  // ../argent-tools-client/src/file-inputs.ts
30772
30780
  import { createHash as createHash2, randomUUID as randomUUID4 } from "node:crypto";
30773
- import { createReadStream, rmSync as rmSync2 } from "node:fs";
30781
+ import { createReadStream as createReadStream2, rmSync as rmSync2 } from "node:fs";
30774
30782
  import {
30775
30783
  chmod as chmod3,
30776
30784
  lstat,
@@ -30786,50 +30794,234 @@ import { constants, tmpdir } from "node:os";
30786
30794
  import * as path10 from "node:path";
30787
30795
 
30788
30796
  // ../archive/src/index.ts
30789
- import { execFile } from "node:child_process";
30790
- import { rm, readdir as readdir3 } from "node:fs/promises";
30791
- import { basename as basename4, dirname as dirname5, join as join9, posix as posix2, resolve as resolve6, sep as sep2 } from "node:path";
30792
- import { promisify } from "node:util";
30793
- var execFileAsync = promisify(execFile);
30797
+ import { spawn as spawn2 } from "node:child_process";
30798
+ import { once } from "node:events";
30799
+ import { createReadStream, createWriteStream } from "node:fs";
30800
+ import { open as open2, rm, readdir as readdir3 } from "node:fs/promises";
30801
+ import { basename as basename4, dirname as dirname5, join as join9, resolve as resolve6, sep as sep2 } from "node:path";
30802
+ import { Writable } from "node:stream";
30803
+ import { pipeline } from "node:stream/promises";
30804
+ import zlib from "node:zlib";
30794
30805
  var ArchiveError = class extends Error {
30795
30806
  };
30796
- function createTarGzArgs(sourcePath, target) {
30797
- return ["-czf", target, "-C", dirname5(sourcePath), basename4(sourcePath)];
30807
+ var ARCHIVE_FORMATS = typeof zlib.createZstdCompress === "function" ? ["zstd", "gzip"] : ["gzip"];
30808
+ var ARCHIVE_CONTENT_TYPES = {
30809
+ zstd: "application/zstd",
30810
+ gzip: "application/gzip"
30811
+ };
30812
+ function pickArchiveFormat(peerFormats) {
30813
+ return ARCHIVE_FORMATS.find((f) => peerFormats?.includes(f)) ?? "gzip";
30814
+ }
30815
+ var CHUNK_BYTES = 1 << 20;
30816
+ function createCompressor(format) {
30817
+ return format === "zstd" ? zlib.createZstdCompress({
30818
+ chunkSize: CHUNK_BYTES,
30819
+ // Lets the decoder detect corruption.
30820
+ params: { [zlib.constants.ZSTD_c_checksumFlag]: 1 }
30821
+ }) : zlib.createGzip({ chunkSize: CHUNK_BYTES });
30822
+ }
30823
+ function createTarArgs(sourcePath) {
30824
+ const name = basename4(sourcePath);
30825
+ return ["-cf", "-", "-C", dirname5(sourcePath), /^[-@]/.test(name) ? `./${name}` : name];
30826
+ }
30827
+ var MAX_LISTING_BYTES = 32 << 20;
30828
+ var MAX_LISTING_LINES = 1 << 18;
30829
+ var MAX_STDERR_BYTES = 16 << 10;
30830
+ var MAX_UNREAD_BYTES = 16 << 20;
30831
+ function collect(stream, maxBytes, { maxLines = Infinity, onOverflow } = {}) {
30832
+ const chunks = [];
30833
+ let bytes = 0;
30834
+ let lines = 0;
30835
+ let overflowed = false;
30836
+ stream?.on("data", (chunk) => {
30837
+ if (overflowed) return;
30838
+ chunks.push(chunk.subarray(0, maxBytes - bytes));
30839
+ bytes += chunk.length;
30840
+ for (let i2 = chunk.indexOf(10); i2 !== -1 && lines <= maxLines; i2 = chunk.indexOf(10, i2 + 1)) {
30841
+ lines++;
30842
+ }
30843
+ if (bytes > maxBytes || lines > maxLines) {
30844
+ overflowed = true;
30845
+ onOverflow?.();
30846
+ }
30847
+ });
30848
+ return {
30849
+ overflowed: () => overflowed,
30850
+ text: () => Buffer.concat(chunks).toString("utf8") + (overflowed ? "\u2026" : "")
30851
+ };
30798
30852
  }
30799
- async function createTarGzFile(sourcePath, tarPath) {
30853
+ async function createArchiveFile(sourcePath, archivePath, format, signal) {
30854
+ const out = createWriteStream(archivePath);
30855
+ await once(out, "ready");
30800
30856
  try {
30801
- await execFileAsync("tar", createTarGzArgs(sourcePath, tarPath));
30857
+ await archiveInto(out, sourcePath, format, signal);
30802
30858
  } catch (err) {
30803
- await rm(tarPath, { force: true }).catch(() => {
30859
+ out.destroy();
30860
+ await rm(archivePath, { force: true }).catch(() => {
30804
30861
  });
30862
+ signal?.throwIfAborted();
30805
30863
  throw err;
30806
30864
  }
30807
30865
  }
30866
+ async function archiveInto(out, sourcePath, format, signal) {
30867
+ const child = spawn2("tar", createTarArgs(sourcePath), {
30868
+ stdio: ["ignore", "pipe", "pipe"],
30869
+ signal
30870
+ });
30871
+ const exited = new Promise((res, rej) => {
30872
+ child.on("error", rej);
30873
+ child.on("close", res);
30874
+ });
30875
+ const stderr = collect(child.stderr, MAX_STDERR_BYTES);
30876
+ const [written, closed] = await Promise.allSettled([
30877
+ pipeline(child.stdout, createCompressor(format), out),
30878
+ exited
30879
+ ]);
30880
+ if (closed.status === "rejected") throw closed.reason;
30881
+ if (written.status === "rejected") throw written.reason;
30882
+ if (closed.value !== 0) {
30883
+ throw new Error(`tar exited with code ${closed.value}: ${stderr.text().trim()}`);
30884
+ }
30885
+ }
30886
+ async function sniffFormat(archivePath) {
30887
+ const fh = await open2(archivePath, "r");
30888
+ try {
30889
+ const { buffer, bytesRead } = await fh.read(Buffer.alloc(4), 0, 4, 0);
30890
+ const magic = buffer.subarray(0, bytesRead).toString("hex");
30891
+ if (magic.startsWith("1f8b")) return "gzip";
30892
+ if (magic === "28b52ffd" && ARCHIVE_FORMATS.includes("zstd")) return "zstd";
30893
+ throw new ArchiveError("unrecognized compression");
30894
+ } finally {
30895
+ await fh.close();
30896
+ }
30897
+ }
30898
+ var ZSTD_FRAME_MAGIC = 4247762216;
30899
+ async function assertSingleCompleteZstdFrame(archivePath) {
30900
+ const fh = await open2(archivePath, "r");
30901
+ try {
30902
+ const { size } = await fh.stat();
30903
+ const window2 = Buffer.alloc(4096);
30904
+ let windowStart = 0;
30905
+ let windowEnd = 0;
30906
+ let pos = 0;
30907
+ const read = async (n3) => {
30908
+ if (pos < windowStart || pos + n3 > windowEnd) {
30909
+ const { bytesRead } = await fh.read(window2, 0, window2.length, pos);
30910
+ windowStart = pos;
30911
+ windowEnd = pos + bytesRead;
30912
+ if (bytesRead < n3) throw new ArchiveError("truncated zstd frame");
30913
+ }
30914
+ return window2.subarray(pos - windowStart, pos - windowStart + n3);
30915
+ };
30916
+ for (let frame = 0; pos < size; frame++) {
30917
+ const header = await read(5);
30918
+ if (header.readUInt32LE(0) !== ZSTD_FRAME_MAGIC) throw new ArchiveError("bad zstd frame");
30919
+ const descriptor = header[4];
30920
+ const singleSegment = descriptor >> 5 & 1;
30921
+ pos += 5 + (singleSegment ? 0 : 1) + // window descriptor
30922
+ [0, 1, 2, 4][descriptor & 3] + // dictionary id
30923
+ [singleSegment, 2, 4, 8][descriptor >> 6];
30924
+ let hasData = false;
30925
+ for (let last = 0; !last; ) {
30926
+ const block2 = (await read(3)).readUIntLE(0, 3);
30927
+ last = block2 & 1;
30928
+ const type = block2 >> 1 & 3;
30929
+ const blockSize = block2 >> 3;
30930
+ if (blockSize > 0) hasData = true;
30931
+ pos += 3 + (type === 1 ? 1 : blockSize);
30932
+ }
30933
+ if (descriptor >> 2 & 1) pos += 4;
30934
+ if (hasData && frame > 0) throw new ArchiveError("multi-frame zstd");
30935
+ }
30936
+ if (pos !== size) throw new ArchiveError("truncated zstd frame");
30937
+ } finally {
30938
+ await fh.close();
30939
+ }
30940
+ }
30941
+ var TAR_LOCALE = process.platform === "darwin" ? "en_US.UTF-8" : "C.UTF-8";
30942
+ function tarEnv(env) {
30943
+ const characterType = env.LC_ALL || env.LC_CTYPE || env.LANG || "";
30944
+ return /utf-?8/i.test(characterType) ? env : { ...env, LC_ALL: TAR_LOCALE };
30945
+ }
30946
+ async function runTar(archive, args) {
30947
+ const child = spawn2("tar", [...args, "-f", "-"], {
30948
+ env: tarEnv(process.env)
30949
+ });
30950
+ const exited = new Promise((res, rej) => {
30951
+ child.on("error", rej);
30952
+ child.on("close", res);
30953
+ });
30954
+ const stdout2 = collect(child.stdout, MAX_LISTING_BYTES, {
30955
+ maxLines: MAX_LISTING_LINES,
30956
+ onOverflow: () => child.kill()
30957
+ });
30958
+ const stderr = collect(child.stderr, MAX_STDERR_BYTES);
30959
+ child.stdin?.on("error", () => {
30960
+ });
30961
+ const unreadLimit = new Error("unread limit");
30962
+ let unread = 0;
30963
+ const fed = pipeline(
30964
+ createReadStream(archive.path, { highWaterMark: CHUNK_BYTES }),
30965
+ archive.format === "zstd" ? zlib.createZstdDecompress({ chunkSize: CHUNK_BYTES }) : zlib.createGunzip({ chunkSize: CHUNK_BYTES }),
30966
+ new Writable({
30967
+ write(chunk, _encoding, done) {
30968
+ if (child.stdin?.writable) return void child.stdin.write(chunk, () => done());
30969
+ unread += chunk.length;
30970
+ done(unread > MAX_UNREAD_BYTES ? unreadLimit : null);
30971
+ },
30972
+ final(done) {
30973
+ child.stdin?.end();
30974
+ done();
30975
+ },
30976
+ destroy(err, done) {
30977
+ if (err) child.stdin?.destroy();
30978
+ done(err);
30979
+ }
30980
+ })
30981
+ ).then(
30982
+ () => null,
30983
+ (err) => err
30984
+ );
30985
+ const [code, feedError] = await Promise.all([exited, fed]);
30986
+ if (stdout2.overflowed()) {
30987
+ throw new Error(
30988
+ `tar ${args.join(" ")} listed more than ${MAX_LISTING_LINES} members or ${MAX_LISTING_BYTES >> 20} MiB`
30989
+ );
30990
+ }
30991
+ if (feedError && feedError !== unreadLimit) throw feedError;
30992
+ if (code !== 0)
30993
+ throw new Error(`tar ${args.join(" ")} exited with code ${code}: ${stderr.text().trim()}`);
30994
+ return stdout2.text();
30995
+ }
30808
30996
  function normalizeTarMemberPath(memberPath) {
30809
30997
  return memberPath.replace(/^\.\//, "").replace(/\\/g, "/");
30810
30998
  }
30999
+ function isContainedPath(path25, windows = process.platform === "win32") {
31000
+ const slashed = path25.replace(/\\/g, "/");
31001
+ const drive = windows ? /^[A-Za-z]:/ : /^[A-Za-z]:\//;
31002
+ return !slashed.startsWith("/") && !drive.test(slashed) && !slashed.split("/").includes("..");
31003
+ }
30811
31004
  function isSafeTarMember(memberPath, destDir) {
30812
31005
  const normalized = normalizeTarMemberPath(memberPath);
30813
- if (!normalized || normalized === "." || normalized === "./") return false;
30814
- if (normalized.startsWith("/") || /^[A-Za-z]:[\\/]/.test(normalized)) return false;
30815
- const relative3 = posix2.normalize(normalized);
30816
- if (relative3 === ".." || relative3.startsWith("../") || relative3.split("/").includes("..")) {
30817
- return false;
30818
- }
31006
+ if (!isContainedPath(normalized)) return false;
30819
31007
  const root = resolve6(destDir);
30820
- const resolved = resolve6(destDir, relative3);
30821
- return resolved === root || resolved.startsWith(root + sep2);
31008
+ return resolve6(destDir, normalized).startsWith(root + sep2);
30822
31009
  }
30823
- async function listTarMembers(tarPath) {
30824
- const { stdout: stdout2 } = await execFileAsync("tar", ["-tzf", tarPath]);
30825
- return stdout2.split("\n").map((line) => line.trim()).filter((line) => line.length > 0);
31010
+ async function readListing(archive, args) {
31011
+ try {
31012
+ return await runTar(archive, args);
31013
+ } catch (err) {
31014
+ throw new ArchiveError(
31015
+ `Could not read archive: ${err instanceof Error ? err.message : String(err)}`
31016
+ );
31017
+ }
30826
31018
  }
30827
- function isEscapingLinkTarget(target) {
30828
- if (target.startsWith("/") || /^[A-Za-z]:[\\/]/.test(target)) return true;
30829
- return posix2.normalize(target.replace(/\\/g, "/")).split("/").includes("..");
31019
+ async function listTarMembers(archive) {
31020
+ const stdout2 = await readListing(archive, ["-t"]);
31021
+ return stdout2.split("\n").map((line) => line.trim()).filter((line) => line.length > 0);
30830
31022
  }
30831
- async function assertSafeMemberTypes(tarPath) {
30832
- const { stdout: stdout2 } = await execFileAsync("tar", ["-tzvf", tarPath]);
31023
+ async function assertSafeMemberTypes(archive) {
31024
+ const stdout2 = await readListing(archive, ["-tv"]);
30833
31025
  for (const line of stdout2.split("\n")) {
30834
31026
  if (!line.trim()) continue;
30835
31027
  const type = line[0];
@@ -30837,7 +31029,7 @@ async function assertSafeMemberTypes(tarPath) {
30837
31029
  if (type === "l") {
30838
31030
  const parts = line.split(" -> ");
30839
31031
  const target = parts.length === 2 ? parts[1].trim() : "";
30840
- if (parts.length !== 2 || !target || isEscapingLinkTarget(target)) {
31032
+ if (parts.length !== 2 || !target || !isContainedPath(target)) {
30841
31033
  throw new ArchiveError(
30842
31034
  `Archive contains a symlink whose target could not be confirmed safe: "${line.trim()}".`
30843
31035
  );
@@ -30849,15 +31041,8 @@ async function assertSafeMemberTypes(tarPath) {
30849
31041
  );
30850
31042
  }
30851
31043
  }
30852
- async function assertSafeArchive(tarPath, destDir) {
30853
- let members2;
30854
- try {
30855
- members2 = await listTarMembers(tarPath);
30856
- } catch (err) {
30857
- throw new ArchiveError(
30858
- `Could not read archive: ${err instanceof Error ? err.message : String(err)}`
30859
- );
30860
- }
31044
+ async function assertSafeArchive(archive, destDir) {
31045
+ const members2 = await listTarMembers(archive);
30861
31046
  if (members2.length === 0) {
30862
31047
  throw new ArchiveError("Archive is empty.");
30863
31048
  }
@@ -30866,7 +31051,7 @@ async function assertSafeArchive(tarPath, destDir) {
30866
31051
  throw new ArchiveError(`Archive contains an unsafe path "${member}" \u2014 refusing extraction.`);
30867
31052
  }
30868
31053
  }
30869
- await assertSafeMemberTypes(tarPath);
31054
+ await assertSafeMemberTypes(archive);
30870
31055
  }
30871
31056
  async function resolveMember(destDir, expectedName) {
30872
31057
  const entries = await readdir3(destDir);
@@ -30881,9 +31066,18 @@ async function resolveMember(destDir, expectedName) {
30881
31066
  }
30882
31067
  return join9(destDir, real[0]);
30883
31068
  }
30884
- async function safeExtractTarGz(tarPath, destDir, expectedName) {
30885
- await assertSafeArchive(tarPath, destDir);
30886
- await execFileAsync("tar", ["-xzf", tarPath, "-C", destDir]);
31069
+ async function safeExtractArchive(archivePath, destDir, expectedName) {
31070
+ let archive;
31071
+ try {
31072
+ archive = { path: archivePath, format: await sniffFormat(archivePath) };
31073
+ if (archive.format === "zstd") await assertSingleCompleteZstdFrame(archivePath);
31074
+ } catch (err) {
31075
+ throw new ArchiveError(
31076
+ `Could not read archive: ${err instanceof Error ? err.message : String(err)}`
31077
+ );
31078
+ }
31079
+ await assertSafeArchive(archive, destDir);
31080
+ await runTar(archive, ["-x", "-C", destDir]);
30887
31081
  return resolveMember(destDir, expectedName);
30888
31082
  }
30889
31083
 
@@ -30964,7 +31158,7 @@ function untrackArchive(archive) {
30964
31158
  function sha256File(filePath) {
30965
31159
  return new Promise((resolve13, reject) => {
30966
31160
  const hash2 = createHash2("sha256");
30967
- createReadStream(filePath).on("data", (chunk) => hash2.update(chunk)).on("end", () => resolve13(hash2.digest("hex"))).on("error", reject);
31161
+ createReadStream2(filePath).on("data", (chunk) => hash2.update(chunk)).on("end", () => resolve13(hash2.digest("hex"))).on("error", reject);
30968
31162
  });
30969
31163
  }
30970
31164
  function toolServerError(text2) {
@@ -30990,15 +31184,15 @@ function uploadFailure(url2, res, text2, bytes) {
30990
31184
  errorKind: "validation"
30991
31185
  });
30992
31186
  }
30993
- async function uploadTar(tarPath, endpoint, signal) {
31187
+ async function uploadTar(tarPath, format, endpoint, signal) {
30994
31188
  const { size } = await stat3(tarPath);
30995
31189
  const init2 = {
30996
31190
  method: "POST",
30997
31191
  headers: {
30998
- "content-type": "application/gzip",
31192
+ "content-type": ARCHIVE_CONTENT_TYPES[format],
30999
31193
  ...endpoint.token ? { Authorization: `Bearer ${endpoint.token}` } : {}
31000
31194
  },
31001
- body: createReadStream(tarPath),
31195
+ body: createReadStream2(tarPath),
31002
31196
  duplex: "half",
31003
31197
  signal
31004
31198
  };
@@ -31015,12 +31209,13 @@ async function uploadTar(tarPath, endpoint, signal) {
31015
31209
  return json2.uploadId;
31016
31210
  }
31017
31211
  async function uploadFile(sourcePath, endpoint, signal) {
31212
+ const format = pickArchiveFormat(endpoint.formats);
31018
31213
  const tarPath = path10.join(tmpdir(), `argent-upload-${randomUUID4()}.tar.gz`);
31019
31214
  trackArchive(tarPath);
31020
31215
  try {
31021
- await createTarGzFile(await realpath2(sourcePath), tarPath);
31216
+ await createArchiveFile(await realpath2(sourcePath), tarPath, format, signal);
31022
31217
  const contentHash = await sha256File(tarPath);
31023
- return { uploadId: await uploadTar(tarPath, endpoint, signal), contentHash };
31218
+ return { uploadId: await uploadTar(tarPath, format, endpoint, signal), contentHash };
31024
31219
  } finally {
31025
31220
  untrackArchive(tarPath);
31026
31221
  await rm2(tarPath, { force: true }).catch(() => {
@@ -31875,7 +32070,7 @@ function createToolsClient(options = {}) {
31875
32070
  const { url: url2, token } = await route();
31876
32071
  return { url: url2, token };
31877
32072
  }
31878
- async function fetchTools(opts) {
32073
+ async function fetchToolList(opts) {
31879
32074
  opts?.signal?.throwIfAborted();
31880
32075
  const { url: url2, token } = await baseUrl();
31881
32076
  const res = await doFetch(
@@ -31884,8 +32079,10 @@ function createToolsClient(options = {}) {
31884
32079
  { longRunning: false, carriesUpload: false }
31885
32080
  );
31886
32081
  if (!res.ok) throw new Error(`GET /tools failed: ${res.status} ${res.statusText}`);
31887
- const json2 = await res.json();
31888
- return json2.tools;
32082
+ return await res.json();
32083
+ }
32084
+ async function fetchTools(opts) {
32085
+ return (await fetchToolList(opts)).tools;
31889
32086
  }
31890
32087
  async function fetchTool(name, opts) {
31891
32088
  return findTool(await fetchTools(opts), name);
@@ -31894,7 +32091,7 @@ function createToolsClient(options = {}) {
31894
32091
  opts?.signal?.throwIfAborted();
31895
32092
  const { url: url2, token, remote } = await route();
31896
32093
  let finalArgs = canonicalToolArgs(name, args);
31897
- const tools2 = await fetchTools({ signal: opts?.signal });
32094
+ const { tools: tools2, uploadFormats } = await fetchToolList({ signal: opts?.signal });
31898
32095
  const meta3 = findTool(tools2, name);
31899
32096
  const olderServer = meta3 !== null && !tools2.some((t2) => t2.name === canonicalToolId(meta3.name));
31900
32097
  if (meta3) {
@@ -31911,7 +32108,7 @@ function createToolsClient(options = {}) {
31911
32108
  if (remote) assertRequiredPresent(meta3, finalArgs);
31912
32109
  finalArgs = await prepareFileInputs(meta3.fileInputs, finalArgs ?? {}, {
31913
32110
  includeContent: remote,
31914
- uploadEndpoint: remote ? { url: url2, token } : void 0,
32111
+ uploadEndpoint: remote ? { url: url2, token, formats: uploadFormats } : void 0,
31915
32112
  log: diagnose,
31916
32113
  baselineDirs,
31917
32114
  collectMembers: collectFlowMembers,
@@ -32208,7 +32405,7 @@ async function downloadAndExtractArchive(handle, data, dir) {
32208
32405
  const tarball = join13(dir, `${sanitizeSegment(handle.filename)}.tar.gz`);
32209
32406
  try {
32210
32407
  await writeFile4(tarball, data);
32211
- return await safeExtractTarGz(tarball, dir, handle.filename);
32408
+ return await safeExtractArchive(tarball, dir, handle.filename);
32212
32409
  } catch {
32213
32410
  return null;
32214
32411
  } finally {
@@ -32287,7 +32484,10 @@ async function materializeArtifacts(result, ctx) {
32287
32484
  }
32288
32485
  try {
32289
32486
  const res = await fetchFn(`${ctx.toolsUrl}/artifacts/${value.id}`, {
32290
- headers: authHeaders3,
32487
+ headers: value.archive ? {
32488
+ ...authHeaders3,
32489
+ Accept: ARCHIVE_FORMATS.map((f) => ARCHIVE_CONTENT_TYPES[f]).join(", ")
32490
+ } : authHeaders3,
32291
32491
  signal: ctx.signal
32292
32492
  });
32293
32493
  if (!res.ok) return null;
@@ -34437,7 +34637,7 @@ function getNodeHttpConfigurationDefaults(requiredHeaders, signalResourcePath) {
34437
34637
  }
34438
34638
 
34439
34639
  // ../../node_modules/@opentelemetry/otlp-exporter-base/build/esm/transport/http-transport-utils.js
34440
- import * as zlib from "zlib";
34640
+ import * as zlib2 from "zlib";
34441
34641
  import { Readable } from "stream";
34442
34642
 
34443
34643
  // ../../node_modules/@opentelemetry/otlp-exporter-base/build/esm/is-export-retryable.js
@@ -34558,7 +34758,7 @@ function compressAndSend(req, compression, data, onError) {
34558
34758
  let dataStream = readableFromUint8Array(data);
34559
34759
  if (compression === "gzip") {
34560
34760
  req.setHeader("Content-Encoding", "gzip");
34561
- dataStream = dataStream.on("error", onError).pipe(zlib.createGzip()).on("error", onError);
34761
+ dataStream = dataStream.on("error", onError).pipe(zlib2.createGzip()).on("error", onError);
34562
34762
  }
34563
34763
  dataStream.pipe(req).on("error", onError);
34564
34764
  }
@@ -35872,7 +36072,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
35872
36072
  var SESSION_ID2 = randomUUID5();
35873
36073
  function readCliVersion() {
35874
36074
  if (true) {
35875
- return "0.33.1-next.9";
36075
+ return "0.34.0";
35876
36076
  }
35877
36077
  return "0.0.0";
35878
36078
  }
@@ -36127,7 +36327,7 @@ function tryReadId(filePath) {
36127
36327
  }
36128
36328
 
36129
36329
  // ../telemetry/src/fingerprint.ts
36130
- import { execFileSync as execFileSync2, spawn as spawn2 } from "node:child_process";
36330
+ import { execFileSync as execFileSync2, spawn as spawn3 } from "node:child_process";
36131
36331
 
36132
36332
  // ../native-devtools-ios/src/index.ts
36133
36333
  import * as path16 from "node:path";
@@ -36205,7 +36405,7 @@ function resolveHostFingerprintAsync() {
36205
36405
  const watchdog = setTimeout(() => finish(null), FINGERPRINT_TIMEOUT_MS);
36206
36406
  watchdog.unref?.();
36207
36407
  try {
36208
- child = spawn2(binary, ["fingerprint"], { stdio: ["ignore", "pipe", "ignore"] });
36408
+ child = spawn3(binary, ["fingerprint"], { stdio: ["ignore", "pipe", "ignore"] });
36209
36409
  } catch {
36210
36410
  finish(null);
36211
36411
  return;
@@ -36983,8 +37183,10 @@ Subcommands:
36983
37183
  run <test|test.yaml|dir> Run a saved e2e test by name, a YAML file by path,
36984
37184
  or every test in a directory, and report pass/fail
36985
37185
  (exit reflects result)
36986
- list List runnable YAML paths in .argent/e2e and
36987
- .argent/flows (legacy); notes go to stderr
37186
+ list [--json] List runnable YAML paths in .argent/e2e and
37187
+ .argent/flows (legacy); notes go to stderr.
37188
+ --json prints { "e2eTests": [...] } instead, with
37189
+ path, name, legacy and shadowedBy per entry
36988
37190
 
36989
37191
  Options (run):
36990
37192
  --device <id> Device id to run against (auto-detected when omitted)
@@ -37026,6 +37228,7 @@ var RUN_OPTIONS = {
37026
37228
  "platform": { kind: "value" },
37027
37229
  "output": { kind: "value" }
37028
37230
  };
37231
+ var LIST_OPTIONS = { json: { kind: "boolean" } };
37029
37232
  function parseRunArgs(argv) {
37030
37233
  let parsed;
37031
37234
  try {
@@ -37698,43 +37901,84 @@ async function e2e(argv, options) {
37698
37901
  await printHelp();
37699
37902
  return;
37700
37903
  }
37904
+ const flagGiven = (flag) => rest.some((tok) => tok === flag || tok.startsWith(`${flag}=`));
37701
37905
  if (sub === "list") {
37702
- const lines = [];
37703
- const notes = [];
37704
- let legacyCount = 0;
37906
+ if (rest.includes("--help") || rest.includes("-h")) {
37907
+ await printHelp();
37908
+ return;
37909
+ }
37910
+ let json3;
37911
+ try {
37912
+ const parsed = parseCommandArgs(rest, LIST_OPTIONS);
37913
+ if (parsed.positionals.length > 0) {
37914
+ throw new UsageError(
37915
+ `unexpected argument ${JSON.stringify(parsed.positionals[0])}; e2e list takes no arguments`
37916
+ );
37917
+ }
37918
+ json3 = parsed.options.json === true;
37919
+ } catch (err) {
37920
+ if (!(err instanceof UsageError)) throw err;
37921
+ console.error(
37922
+ flagGiven("--json") ? JSON.stringify(errorRecord(err.message)) : `Error: ${err.message}
37923
+ Run \`argent e2e --help\`.`
37924
+ );
37925
+ return exitAfterFlush(2);
37926
+ }
37927
+ const listFail = (message) => {
37928
+ console.error(json3 ? JSON.stringify(errorRecord(message)) : message);
37929
+ return exitAfterFlush(2);
37930
+ };
37931
+ const entries = [];
37705
37932
  const byName = /* @__PURE__ */ new Map();
37706
37933
  let anyDir = false;
37707
37934
  for (const dir of E2E_DIRS) {
37708
37935
  let rels;
37709
37936
  try {
37710
37937
  rels = (await collectRunnableFlowPaths(path17.join(process.cwd(), dir))).sort();
37711
- } catch {
37712
- continue;
37938
+ } catch (err) {
37939
+ const code = err.code;
37940
+ if (code === "ENOENT" || code === "ENOTDIR") continue;
37941
+ return listFail(`Could not read e2e test directory: ${dir}`);
37713
37942
  }
37714
37943
  anyDir = true;
37715
37944
  for (const rel of rels) {
37716
37945
  const shown = path17.join(dir, rel);
37717
37946
  const name = path17.dirname(rel) === "." ? path17.basename(rel, ".yaml") : void 0;
37718
- const usedByName = name === void 0 ? void 0 : byName.get(name);
37719
- if (name !== void 0 && usedByName === void 0) byName.set(name, shown);
37720
- lines.push(shown);
37721
- if (dir === E2E_DIR) continue;
37722
- legacyCount++;
37723
- if (usedByName)
37724
- notes.push(`warning: ${shown} is shadowed by ${usedByName} when run by name`);
37725
- }
37726
- }
37727
- if (legacyCount > 0) {
37728
- notes.push(
37729
- `note: ${legacyCount} test${legacyCount === 1 ? "" : "s"} listed from .argent/flows (legacy); move ${legacyCount === 1 ? "it" : "them"} to .argent/e2e`
37730
- );
37947
+ const shadowedBy = name === void 0 ? void 0 : byName.get(name);
37948
+ if (name !== void 0 && shadowedBy === void 0) byName.set(name, shown);
37949
+ entries.push({
37950
+ path: shown,
37951
+ ...name !== void 0 && { name },
37952
+ legacy: dir !== E2E_DIR,
37953
+ ...shadowedBy !== void 0 && { shadowedBy }
37954
+ });
37955
+ }
37956
+ }
37957
+ if (json3) {
37958
+ const doc = { e2eTests: entries, ...!anyDir && { warning: "no-e2e-directory" } };
37959
+ console.log(JSON.stringify(doc, null, 2));
37960
+ return;
37731
37961
  }
37732
37962
  if (!anyDir) {
37733
- console.log(`No ${E2E_DIRS.join(" or ")} directory in the current working directory.`);
37734
- } else if (lines.length === 0) console.log(`No e2e tests found in ${E2E_DIRS.join(" or ")}`);
37963
+ console.error(
37964
+ `warning: no ${E2E_DIRS.join(" or ")} directory in the current working directory`
37965
+ );
37966
+ } else if (entries.length === 0)
37967
+ console.error(`No e2e tests found in ${E2E_DIRS.join(" or ")}`);
37735
37968
  else {
37736
- console.log(lines.join("\n"));
37737
- for (const note of notes) console.error(note);
37969
+ console.log(entries.map((entry) => entry.path).join("\n"));
37970
+ for (const entry of entries) {
37971
+ if (entry.shadowedBy !== void 0)
37972
+ console.error(
37973
+ `warning: ${entry.path} is shadowed by ${entry.shadowedBy} when run by name`
37974
+ );
37975
+ }
37976
+ const legacyCount = entries.filter((entry) => entry.legacy).length;
37977
+ if (legacyCount > 0) {
37978
+ console.error(
37979
+ `note: ${legacyCount} test${legacyCount === 1 ? "" : "s"} listed from .argent/flows (legacy); move ${legacyCount === 1 ? "it" : "them"} to .argent/e2e`
37980
+ );
37981
+ }
37738
37982
  }
37739
37983
  return;
37740
37984
  }
@@ -37742,7 +37986,6 @@ async function e2e(argv, options) {
37742
37986
  console.error(`Unknown e2e subcommand "${sub}". Run \`argent e2e --help\`.`);
37743
37987
  return exitAfterFlush(2);
37744
37988
  }
37745
- const flagGiven = (flag) => rest.some((tok) => tok === flag || tok.startsWith(`${flag}=`));
37746
37989
  const jsonStream = flagGiven("--json-stream");
37747
37990
  const json2 = !jsonStream && flagGiven("--json");
37748
37991
  if (rest.includes("--help") || rest.includes("-h")) {
@@ -38365,7 +38608,7 @@ Listing tools contacts the argent tool-server, starting one if none is running.
38365
38608
  import * as fs13 from "node:fs";
38366
38609
  import * as path19 from "node:path";
38367
38610
  import { constants as constants2, homedir as homedir5, networkInterfaces } from "node:os";
38368
- import { spawn as spawn3 } from "node:child_process";
38611
+ import { spawn as spawn4 } from "node:child_process";
38369
38612
  var STATE_DIR2 = path19.join(homedir5(), ".argent");
38370
38613
  var LOG_FILE2 = path19.join(STATE_DIR2, "tool-server.log");
38371
38614
  async function describeForeignServers(ownBundlePath) {
@@ -38439,7 +38682,7 @@ function logsCmd(follow) {
38439
38682
  process.stdout.write(fs13.readFileSync(LOG_FILE2, "utf8"));
38440
38683
  return;
38441
38684
  }
38442
- const child = spawn3("tail", ["-f", LOG_FILE2], { stdio: "inherit" });
38685
+ const child = spawn4("tail", ["-f", LOG_FILE2], { stdio: "inherit" });
38443
38686
  child.on(
38444
38687
  "exit",
38445
38688
  (code, signal) => process.exit(code ?? (signal ? 128 + (signalNumber(signal) ?? 0) : 0))
@@ -38663,7 +38906,7 @@ async function runForeground(paths, port, host, idleTimeoutMinutes, token) {
38663
38906
  idleTimeoutMinutes,
38664
38907
  token
38665
38908
  });
38666
- const child = spawn3("node", [paths.bundlePath, "start"], {
38909
+ const child = spawn4("node", [paths.bundlePath, "start"], {
38667
38910
  stdio: "inherit",
38668
38911
  env
38669
38912
  });