@swmansion/argent 0.34.1-next.3 → 0.34.1-next.30

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 (50) hide show
  1. package/LICENSE +1 -0
  2. package/assets/ios-screen-stream/Info.plist +12 -0
  3. package/assets/ios-screen-stream/ios-screen-stream.swift +321 -0
  4. package/bin/argent-android-devtools-0.4.0.apk +0 -0
  5. package/bin/darwin/argent-macos-helper +0 -0
  6. package/bin/darwin/ax-service +0 -0
  7. package/bin/darwin/simulator-server +0 -0
  8. package/bin/darwin/tvos-ax-service +0 -0
  9. package/bin/darwin/tvos-hid-daemon +0 -0
  10. package/bin/linux/simulator-server +0 -0
  11. package/bin/linux-arm64/simulator-server +0 -0
  12. package/bin/network-inspector/network-inspector.jar +0 -0
  13. package/bin/tcp/ax-service +0 -0
  14. package/bin/win32/simulator-server.exe +0 -0
  15. package/dist/cli-cmds.mjs +710 -412
  16. package/dist/client.js +202 -107
  17. package/dist/installer-help.js +4 -0
  18. package/dist/installer-help.js.map +1 -1
  19. package/dist/installer.mjs +1070 -837
  20. package/dist/ios-device-runner/ArgentRunner/ArgentRunnerUITests/ArgentLaunchPerformanceTests.swift +21 -0
  21. package/dist/ios-device-runner/ArgentRunner/ArgentRunnerUITests/ArgentRunnerSession+Commands.swift +9 -3
  22. package/dist/mcp-server.mjs +384 -621
  23. package/dist/preview-ui/index.html +28 -2
  24. package/dist/tool-args.generated.d.ts +38 -8
  25. package/dist/tool-server.cjs +6821 -3369
  26. package/dylibs/libArgentAudio.dylib +0 -0
  27. package/dylibs/libArgentInjectionBootstrap.dylib +0 -0
  28. package/dylibs/libKeyboardPatch.dylib +0 -0
  29. package/dylibs/libNativeDevtoolsIos.dylib +0 -0
  30. package/dylibs/macos/libArgentInjectionBootstrap.dylib +0 -0
  31. package/dylibs/macos/libNativeDevtoolsMacos.dylib +0 -0
  32. package/dylibs/tcp/libArgentInjectionBootstrap.dylib +0 -0
  33. package/dylibs/tcp/libKeyboardPatch.dylib +0 -0
  34. package/dylibs/tcp/libNativeDevtoolsIos.dylib +0 -0
  35. package/dylibs/tvos/libArgentInjectionBootstrap.dylib +0 -0
  36. package/dylibs/tvos/libKeyboardPatch.dylib +0 -0
  37. package/dylibs/tvos/libNativeDevtoolsIos.dylib +0 -0
  38. package/package.json +1 -1
  39. package/rules/argent.md +6 -23
  40. package/skills/argent-create-e2e/references/e2e-yaml.md +2 -2
  41. package/skills/argent-create-e2e/references/live-authoring.md +1 -1
  42. package/skills/argent-device-interact/references/foldables.md +22 -0
  43. package/skills/argent-ios-device-interact/SKILL.md +2 -2
  44. package/skills/argent-macos-app-interact/SKILL.md +15 -5
  45. package/skills/argent-macos-app-interact/references/e2e.md +1 -1
  46. package/skills/argent-native-profiler/SKILL.md +14 -2
  47. package/skills/argent-react-native-app-workflow/SKILL.md +1 -1
  48. package/skills/argent-react-native-optimization/SKILL.md +10 -1
  49. package/skills/argent-react-native-profiler/SKILL.md +4 -3
  50. package/skills/argent-screen-recording/SKILL.md +3 -2
package/dist/client.js CHANGED
@@ -7308,14 +7308,14 @@ var require_parser = __commonJS({
7308
7308
  case "scalar":
7309
7309
  case "single-quoted-scalar":
7310
7310
  case "double-quoted-scalar": {
7311
- const fs8 = this.flowScalar(this.type);
7311
+ const fs9 = this.flowScalar(this.type);
7312
7312
  if (atNextItem || it.value) {
7313
- map.items.push({ start, key: fs8, sep: [] });
7313
+ map.items.push({ start, key: fs9, sep: [] });
7314
7314
  this.onKeyLine = true;
7315
7315
  } else if (it.sep) {
7316
- this.stack.push(fs8);
7316
+ this.stack.push(fs9);
7317
7317
  } else {
7318
- Object.assign(it, { key: fs8, sep: [] });
7318
+ Object.assign(it, { key: fs9, sep: [] });
7319
7319
  this.onKeyLine = true;
7320
7320
  }
7321
7321
  return;
@@ -7443,13 +7443,13 @@ var require_parser = __commonJS({
7443
7443
  case "scalar":
7444
7444
  case "single-quoted-scalar":
7445
7445
  case "double-quoted-scalar": {
7446
- const fs8 = this.flowScalar(this.type);
7446
+ const fs9 = this.flowScalar(this.type);
7447
7447
  if (!it || it.value)
7448
- fc.items.push({ start: [], key: fs8, sep: [] });
7448
+ fc.items.push({ start: [], key: fs9, sep: [] });
7449
7449
  else if (it.sep)
7450
- this.stack.push(fs8);
7450
+ this.stack.push(fs9);
7451
7451
  else
7452
- Object.assign(it, { key: fs8, sep: [] });
7452
+ Object.assign(it, { key: fs9, sep: [] });
7453
7453
  return;
7454
7454
  }
7455
7455
  case "flow-map-end":
@@ -7798,6 +7798,11 @@ var FLAG_REGISTRY = [
7798
7798
  name: "forward-secrets",
7799
7799
  description: "Over `argent link` or ARGENT_TOOLS_URL, resolve each `{{secret:NAME}}` a call names on this machine and send the value with the call, so a remote tool-server can type a secret it does not hold. The linked tool-server then receives every secret of this machine that a call names, so link only one you trust with all of them. Values go only over https:// with the certificate checked, or to a loopback address. Off by default."
7800
7800
  },
7801
+ {
7802
+ name: "ios-audio-always-inserted",
7803
+ description: "Insert the iOS audio hook (libArgentAudio.dylib) into every app an armed simulator launches, so audio-input works without restart-app. Dormant until the app opens audio. On by default; `argent disable ios-audio-always-inserted` inserts it only on the first audio tool call, for apps launched after that call.",
7804
+ defaultEnabled: true
7805
+ },
7801
7806
  {
7802
7807
  name: "video-watermark",
7803
7808
  description: "Overlay the argent corner watermark on recorded screen videos. On by default; turn it off with `argent disable video-watermark`.",
@@ -7805,7 +7810,7 @@ var FLAG_REGISTRY = [
7805
7810
  },
7806
7811
  {
7807
7812
  name: "macos-apps",
7808
- description: "Drive native Mac apps (AppKit, SwiftUI, react-native-macos) from inside the app. Adds the macos platform to list-devices and boot-device, and the file-panel and menu-bar tools. On by default; turn it off with `argent disable macos-apps`.",
7813
+ description: "Control native Mac apps, including Mac Catalyst. Adds the macos platform to list-devices and boot-device, and the file-panel and menu-bar tools. On by default; turn it off with `argent disable macos-apps`.",
7809
7814
  defaultEnabled: true
7810
7815
  }
7811
7816
  ];
@@ -7875,6 +7880,7 @@ function isFeatureEnabled(name, options = {}, registry = FLAG_REGISTRY) {
7875
7880
  }
7876
7881
 
7877
7882
  // ../configuration-core/src/paths.ts
7883
+ import * as fs2 from "node:fs";
7878
7884
  import * as os from "node:os";
7879
7885
  import * as path2 from "node:path";
7880
7886
  function nonEmpty(value) {
@@ -7886,6 +7892,16 @@ function resolveHomeDir(options = {}) {
7886
7892
  if (options.homeDir) return options.homeDir;
7887
7893
  return process.platform === "win32" ? nonEmpty(process.env.USERPROFILE) ?? os.homedir() : nonEmpty(process.env.HOME) ?? os.homedir();
7888
7894
  }
7895
+ function isHomeDir(dir, options = {}) {
7896
+ return canonicalPath(dir) === canonicalPath(resolveHomeDir(options));
7897
+ }
7898
+ function canonicalPath(p) {
7899
+ try {
7900
+ return fs2.realpathSync.native(p);
7901
+ } catch {
7902
+ return path2.resolve(p);
7903
+ }
7904
+ }
7889
7905
  function argentHomeDir() {
7890
7906
  return path2.join(resolveHomeDir(), ".argent");
7891
7907
  }
@@ -7902,11 +7918,11 @@ function configFilePath(scope = "global", options = {}) {
7902
7918
 
7903
7919
  // ../configuration-core/src/config.ts
7904
7920
  import * as crypto from "node:crypto";
7905
- import * as fs2 from "node:fs";
7921
+ import * as fs3 from "node:fs";
7906
7922
  import * as path3 from "node:path";
7907
7923
  function readConfigObject(scope = "global", options = {}) {
7908
7924
  try {
7909
- const raw = fs2.readFileSync(configFilePath(scope, options), "utf8");
7925
+ const raw = fs3.readFileSync(configFilePath(scope, options), "utf8");
7910
7926
  const json = JSON.parse(raw);
7911
7927
  if (json && typeof json === "object" && !Array.isArray(json)) {
7912
7928
  return json;
@@ -7943,7 +7959,7 @@ function getAtPath(obj, dottedKey) {
7943
7959
 
7944
7960
  // ../configuration-core/src/secrets.ts
7945
7961
  var import_dotenv = __toESM(require_dist(), 1);
7946
- import * as fs3 from "node:fs";
7962
+ import * as fs4 from "node:fs";
7947
7963
  import * as path4 from "node:path";
7948
7964
  var SECRET_ENV_PREFIX = "ARGENT_SECRET_";
7949
7965
  var SECRETS_FILE_NAME = "secrets.env";
@@ -7973,10 +7989,10 @@ function fileSource(filePath, exposure) {
7973
7989
  names: [],
7974
7990
  values: /* @__PURE__ */ new Map()
7975
7991
  };
7976
- if (!fs3.statSync(filePath, { throwIfNoEntry: false })) return absent;
7992
+ if (!fs4.statSync(filePath, { throwIfNoEntry: false })) return absent;
7977
7993
  let content;
7978
7994
  try {
7979
- content = fs3.readFileSync(filePath, "utf8");
7995
+ content = fs4.readFileSync(filePath, "utf8");
7980
7996
  } catch {
7981
7997
  return absent;
7982
7998
  }
@@ -8002,7 +8018,9 @@ function fileSource(filePath, exposure) {
8002
8018
  }
8003
8019
  function secretSources(options = {}) {
8004
8020
  const sources = [envSource(options.env ?? process.env)];
8005
- const projectRoot = findProjectRoot(options.cwd ?? process.cwd());
8021
+ const home = resolveHomeDir(options);
8022
+ const found = findProjectRoot(options.cwd ?? process.cwd());
8023
+ const projectRoot = found && isHomeDir(found, options) ? home : found;
8006
8024
  const filePaths = [];
8007
8025
  if (projectRoot) {
8008
8026
  filePaths.push({
@@ -8014,7 +8032,7 @@ function secretSources(options = {}) {
8014
8032
  }
8015
8033
  }
8016
8034
  filePaths.push({
8017
- path: path4.join(resolveHomeDir(options), ".argent", SECRETS_FILE_NAME),
8035
+ path: path4.join(home, ".argent", SECRETS_FILE_NAME),
8018
8036
  exposure: "dedicated"
8019
8037
  });
8020
8038
  const seen = /* @__PURE__ */ new Set();
@@ -8136,14 +8154,6 @@ var CONFIG_SCHEMA = [
8136
8154
  // drained/reset, not just the file rewritten.
8137
8155
  manageCommand: "argent telemetry"
8138
8156
  },
8139
- {
8140
- key: "allowlist.enabled",
8141
- description: "Whether `argent update` re-applies editor auto-approve allowlist rules. Unset (the default) keeps the current behavior: update refreshes the rules for editors that already have argent configured. Set to `false` to keep update from touching editor allowlists. `false` in either scope wins, so a committed project opt-out holds for every teammate.",
8142
- scopes: ["project", "global"],
8143
- parse: asBoolean,
8144
- merge: "prioritize-restrictive",
8145
- example: "false"
8146
- },
8147
8157
  {
8148
8158
  key: "lens.agent",
8149
8159
  description: "Coding-agent id remembered by `argent lens` to skip the picker.",
@@ -8266,7 +8276,7 @@ var UnknownConfigKeyError = class extends Error {
8266
8276
 
8267
8277
  // ../argent-tools-client/src/launcher.ts
8268
8278
  import * as net from "node:net";
8269
- import * as fs4 from "node:fs";
8279
+ import * as fs5 from "node:fs";
8270
8280
  import * as path6 from "node:path";
8271
8281
  import * as readline from "node:readline";
8272
8282
  import { homedir as homedir3 } from "node:os";
@@ -8280,6 +8290,7 @@ var LOCK_FILE = path6.join(STATE_DIR, "tool-server.lock");
8280
8290
  var AUTH_TOKEN_BYTES = 32;
8281
8291
  var AUTH_TOKEN_ENV = "ARGENT_AUTH_TOKEN";
8282
8292
  var AUTOSPAWN_IDLE_TIMEOUT_MINUTES = 30;
8293
+ var AUTOSPAWN_HOST = "127.0.0.1";
8283
8294
  function buildToolsServerEnv(paths, port, baseEnv = process.env, options = {}) {
8284
8295
  const env = {
8285
8296
  ...baseEnv,
@@ -8291,7 +8302,7 @@ function buildToolsServerEnv(paths, port, baseEnv = process.env, options = {}) {
8291
8302
  if (options.idleTimeoutMinutes !== void 0) {
8292
8303
  env.ARGENT_IDLE_TIMEOUT_MINUTES = String(options.idleTimeoutMinutes);
8293
8304
  }
8294
- if (options.token) env[AUTH_TOKEN_ENV] = options.token;
8305
+ env[AUTH_TOKEN_ENV] = options.token ?? "";
8295
8306
  if (paths.installKind) env.ARGENT_INSTALL_KIND = paths.installKind;
8296
8307
  if (paths.installProjectRoot) env.ARGENT_PROJECT_ROOT = paths.installProjectRoot;
8297
8308
  return env;
@@ -8300,7 +8311,7 @@ function generateToken() {
8300
8311
  return randomBytes(AUTH_TOKEN_BYTES).toString("hex");
8301
8312
  }
8302
8313
  function findFreePort() {
8303
- return new Promise((resolve9, reject) => {
8314
+ return new Promise((resolve10, reject) => {
8304
8315
  const srv = net.createServer();
8305
8316
  srv.listen(0, "127.0.0.1", () => {
8306
8317
  const addr = srv.address();
@@ -8311,7 +8322,7 @@ function findFreePort() {
8311
8322
  const port = addr.port;
8312
8323
  srv.close((err) => {
8313
8324
  if (err) reject(err);
8314
- else resolve9(port);
8325
+ else resolve10(port);
8315
8326
  });
8316
8327
  });
8317
8328
  srv.on("error", reject);
@@ -8353,7 +8364,7 @@ function isVersionNewer(a, b) {
8353
8364
  function readBundlePackageVersion(bundlePath) {
8354
8365
  try {
8355
8366
  const pkg = JSON.parse(
8356
- fs4.readFileSync(path6.join(path6.dirname(bundlePath), "..", "package.json"), "utf8")
8367
+ fs5.readFileSync(path6.join(path6.dirname(bundlePath), "..", "package.json"), "utf8")
8357
8368
  );
8358
8369
  return typeof pkg.version === "string" ? pkg.version : void 0;
8359
8370
  } catch {
@@ -8408,23 +8419,26 @@ function killSpawnedChild(child, pid) {
8408
8419
  }
8409
8420
  }
8410
8421
  }
8422
+ function resolveToolsServerNode() {
8423
+ const { bun, deno, electron } = process.versions;
8424
+ return !(bun || deno || electron) && fs5.existsSync(process.execPath) ? process.execPath : "node";
8425
+ }
8411
8426
  function spawnToolsServer(paths, port, options = {}) {
8412
- return new Promise((resolve9, reject) => {
8427
+ return new Promise((resolve10, reject) => {
8413
8428
  let logFd;
8414
8429
  try {
8415
- fs4.mkdirSync(STATE_DIR, { recursive: true });
8416
- logFd = fs4.openSync(LOG_FILE, "a");
8430
+ fs5.mkdirSync(STATE_DIR, { recursive: true });
8431
+ logFd = fs5.openSync(LOG_FILE, "a");
8417
8432
  } catch {
8418
- logFd = fs4.openSync("/dev/null", "w");
8433
+ logFd = fs5.openSync("/dev/null", "w");
8419
8434
  }
8420
- const { bun, deno, electron } = process.versions;
8421
- const nodeBin = !(bun || deno || electron) && fs4.existsSync(process.execPath) ? process.execPath : "node";
8435
+ const nodeBin = resolveToolsServerNode();
8422
8436
  const child = spawn(nodeBin, [paths.bundlePath, "start"], {
8423
8437
  detached: true,
8424
8438
  stdio: ["ignore", "pipe", logFd],
8425
8439
  env: buildToolsServerEnv(paths, port, process.env, options)
8426
8440
  });
8427
- fs4.closeSync(logFd);
8441
+ fs5.closeSync(logFd);
8428
8442
  child.unref();
8429
8443
  const pid = child.pid;
8430
8444
  if (!pid) {
@@ -8456,7 +8470,7 @@ function spawnToolsServer(paths, port, options = {}) {
8456
8470
  rl.close();
8457
8471
  child.stdout?.resume();
8458
8472
  child.stdout?.unref?.();
8459
- settle(() => resolve9({ port: actualPort, pid }));
8473
+ settle(() => resolve10({ port: actualPort, pid }));
8460
8474
  }
8461
8475
  });
8462
8476
  child.on("error", (err) => {
@@ -8551,7 +8565,7 @@ async function sweepDeadStateFiles() {
8551
8565
  });
8552
8566
  continue;
8553
8567
  }
8554
- if (fs4.existsSync(fresh.bundlePath)) continue;
8568
+ if (fs5.existsSync(fresh.bundlePath)) continue;
8555
8569
  if (!couldBeOurToolServer(fresh.pid, fresh.bundlePath)) continue;
8556
8570
  await unlink(file).catch(() => {
8557
8571
  });
@@ -8598,7 +8612,7 @@ async function killToolServer(bundlePath) {
8598
8612
  await clearToolsServerState(bundlePath ?? state.bundlePath);
8599
8613
  return alive;
8600
8614
  }
8601
- var PS_BIN = ["/bin/ps", "/usr/bin/ps"].find((p) => fs4.existsSync(p)) ?? "ps";
8615
+ var PS_BIN = ["/bin/ps", "/usr/bin/ps"].find((p) => fs5.existsSync(p)) ?? "ps";
8602
8616
  var PS_WIDTH_FLAGS = ["-ww"];
8603
8617
  var PS_LOCALE = process.platform === "darwin" ? "en_US.UTF-8" : "C.UTF-8";
8604
8618
  function readProcessCommandLine(pid, flags = PS_WIDTH_FLAGS, env = { ...process.env, LC_ALL: PS_LOCALE }) {
@@ -8645,13 +8659,13 @@ var LOCK_STALE_MS = 45e3;
8645
8659
  var LOCK_POLL_MS = 100;
8646
8660
  function spawnLockIsStale() {
8647
8661
  try {
8648
- const { pid, ts } = JSON.parse(fs4.readFileSync(LOCK_FILE, "utf8"));
8662
+ const { pid, ts } = JSON.parse(fs5.readFileSync(LOCK_FILE, "utf8"));
8649
8663
  if (typeof pid === "number" && pid > 0 && !isProcessAlive(pid)) return true;
8650
8664
  if (typeof ts === "number" && Date.now() - ts > LOCK_STALE_MS) return true;
8651
8665
  return false;
8652
8666
  } catch {
8653
8667
  try {
8654
- return Date.now() - fs4.statSync(LOCK_FILE).mtimeMs > LOCK_STALE_MS;
8668
+ return Date.now() - fs5.statSync(LOCK_FILE).mtimeMs > LOCK_STALE_MS;
8655
8669
  } catch {
8656
8670
  return true;
8657
8671
  }
@@ -8659,7 +8673,7 @@ function spawnLockIsStale() {
8659
8673
  }
8660
8674
  async function acquireSpawnLock() {
8661
8675
  try {
8662
- fs4.mkdirSync(STATE_DIR, { recursive: true });
8676
+ fs5.mkdirSync(STATE_DIR, { recursive: true });
8663
8677
  } catch {
8664
8678
  return null;
8665
8679
  }
@@ -8667,11 +8681,11 @@ async function acquireSpawnLock() {
8667
8681
  const deadline = Date.now() + LOCK_WAIT_TIMEOUT_MS;
8668
8682
  for (; ; ) {
8669
8683
  try {
8670
- const fd = fs4.openSync(LOCK_FILE, "wx");
8684
+ const fd = fs5.openSync(LOCK_FILE, "wx");
8671
8685
  try {
8672
- fs4.writeSync(fd, JSON.stringify({ pid: process.pid, nonce, ts: Date.now() }));
8686
+ fs5.writeSync(fd, JSON.stringify({ pid: process.pid, nonce, ts: Date.now() }));
8673
8687
  } finally {
8674
- fs4.closeSync(fd);
8688
+ fs5.closeSync(fd);
8675
8689
  }
8676
8690
  let released = false;
8677
8691
  return {
@@ -8679,8 +8693,8 @@ async function acquireSpawnLock() {
8679
8693
  if (released) return;
8680
8694
  released = true;
8681
8695
  try {
8682
- const cur = JSON.parse(fs4.readFileSync(LOCK_FILE, "utf8"));
8683
- if (cur.pid === process.pid && cur.nonce === nonce) fs4.unlinkSync(LOCK_FILE);
8696
+ const cur = JSON.parse(fs5.readFileSync(LOCK_FILE, "utf8"));
8697
+ if (cur.pid === process.pid && cur.nonce === nonce) fs5.unlinkSync(LOCK_FILE);
8684
8698
  } catch {
8685
8699
  }
8686
8700
  }
@@ -8689,10 +8703,10 @@ async function acquireSpawnLock() {
8689
8703
  if (err.code !== "EEXIST") return null;
8690
8704
  if (spawnLockIsStale()) {
8691
8705
  try {
8692
- fs4.unlinkSync(LOCK_FILE);
8706
+ fs5.unlinkSync(LOCK_FILE);
8693
8707
  } catch {
8694
8708
  }
8695
- if (!fs4.existsSync(LOCK_FILE)) continue;
8709
+ if (!fs5.existsSync(LOCK_FILE)) continue;
8696
8710
  }
8697
8711
  if (Date.now() >= deadline) return null;
8698
8712
  await new Promise((r) => setTimeout(r, LOCK_POLL_MS));
@@ -8732,7 +8746,7 @@ async function ensureToolsServer(paths) {
8732
8746
  }
8733
8747
  await clearToolsServerState(paths.bundlePath);
8734
8748
  await sweepDeadStateFiles();
8735
- if (!fs4.existsSync(paths.bundlePath)) {
8749
+ if (!fs5.existsSync(paths.bundlePath)) {
8736
8750
  throw new Error(
8737
8751
  `The argent install serving this session is gone from disk (${paths.bundlePath}) \u2014 it was likely updated or removed. Restart the editor's MCP connection to reconnect.`
8738
8752
  );
@@ -8742,6 +8756,7 @@ async function ensureToolsServer(paths) {
8742
8756
  const port = await findFreePort();
8743
8757
  const { port: actualPort, pid } = await spawnToolsServer(paths, port, {
8744
8758
  token,
8759
+ host: AUTOSPAWN_HOST,
8745
8760
  idleTimeoutMinutes: AUTOSPAWN_IDLE_TIMEOUT_MINUTES
8746
8761
  });
8747
8762
  await writeState({
@@ -8750,11 +8765,11 @@ async function ensureToolsServer(paths) {
8750
8765
  startedAt: (/* @__PURE__ */ new Date()).toISOString(),
8751
8766
  bundlePath: paths.bundlePath,
8752
8767
  version: diskVersion,
8753
- host: "127.0.0.1",
8768
+ host: AUTOSPAWN_HOST,
8754
8769
  token,
8755
8770
  managed: "autospawn"
8756
8771
  });
8757
- return { url: formatUrl("127.0.0.1", actualPort), token };
8772
+ return { url: formatUrl(AUTOSPAWN_HOST, actualPort), token };
8758
8773
  } finally {
8759
8774
  lock?.release();
8760
8775
  }
@@ -8796,7 +8811,18 @@ function interpolateFileInputPath(template, args) {
8796
8811
  });
8797
8812
  return missing ? null : out;
8798
8813
  }
8799
- var TOOL_FILE_EXTENSIONS = [".png", ".yaml"];
8814
+ var TOOL_FILE_EXTENSIONS = [
8815
+ ".png",
8816
+ ".yaml",
8817
+ ".wav",
8818
+ ".mp3",
8819
+ ".m4a",
8820
+ ".aac",
8821
+ ".caf",
8822
+ ".aif",
8823
+ ".aiff",
8824
+ ".flac"
8825
+ ];
8800
8826
  function hasToolFileExtension(file) {
8801
8827
  const name = file.toLowerCase();
8802
8828
  return TOOL_FILE_EXTENSIONS.some((extension) => name.endsWith(extension));
@@ -8815,11 +8841,11 @@ function isClientFileArgument({ spec, path: path14 }) {
8815
8841
  }
8816
8842
 
8817
8843
  // ../registry/src/flow-file-refs.ts
8818
- import * as fs6 from "node:fs/promises";
8844
+ import * as fs7 from "node:fs/promises";
8819
8845
  import * as path8 from "node:path";
8820
8846
 
8821
8847
  // ../registry/src/e2e-dirs.ts
8822
- import * as fs5 from "node:fs/promises";
8848
+ import * as fs6 from "node:fs/promises";
8823
8849
  import * as path7 from "node:path";
8824
8850
  var E2E_DIR = path7.join(".argent", "e2e");
8825
8851
  var LEGACY_E2E_DIRS = Object.freeze([path7.join(".argent", "flows")]);
@@ -8834,7 +8860,7 @@ function e2eFileCandidates(projectRoot, name) {
8834
8860
  return e2eDirsFor(projectRoot).map((dir) => path7.join(dir, `${name}.yaml`));
8835
8861
  }
8836
8862
  async function exists(file) {
8837
- return fs5.stat(file).then(
8863
+ return fs6.stat(file).then(
8838
8864
  () => true,
8839
8865
  () => false
8840
8866
  );
@@ -8925,10 +8951,10 @@ function canonicalToolArgs(tool, args) {
8925
8951
  // ../registry/src/flow-file-refs.ts
8926
8952
  async function canonicalFlowPath(p) {
8927
8953
  try {
8928
- return await fs6.realpath(p);
8954
+ return await fs7.realpath(p);
8929
8955
  } catch {
8930
8956
  try {
8931
- return path8.join(await fs6.realpath(path8.dirname(p)), path8.basename(p));
8957
+ return path8.join(await fs7.realpath(path8.dirname(p)), path8.basename(p));
8932
8958
  } catch {
8933
8959
  return p;
8934
8960
  }
@@ -8974,15 +9000,15 @@ function collectFlowRequests(doc) {
8974
9000
  if (isRecord(doc)) visit(doc.steps, 0);
8975
9001
  return { runTargets: [...runTargets], snapshots: [...snapshots], toolSteps, nested };
8976
9002
  }
8977
- function baselineKeyFor(canonicalPath, flowName) {
8978
- const stem = path8.basename(canonicalPath, ".yaml");
9003
+ function baselineKeyFor(canonicalPath2, flowName) {
9004
+ const stem = path8.basename(canonicalPath2, ".yaml");
8979
9005
  return FLOW_NAME_PATTERN.test(stem) ? stem : flowName;
8980
9006
  }
8981
9007
  function flowMemberKey(anchorDir, target) {
8982
9008
  return `${anchorDir}\0${target}`;
8983
9009
  }
8984
9010
  async function classifyOnDiskSpelling(dir, base, addressable = FLOW_FILE_NAME_PATTERN) {
8985
- const entries = await fs6.readdir(dir).catch(() => null);
9011
+ const entries = await fs7.readdir(dir).catch(() => null);
8986
9012
  if (entries === null || entries.includes(base)) return { state: "listed" };
8987
9013
  const actual = entries.find((entry) => entry.toLowerCase() === base.toLowerCase());
8988
9014
  if (actual === void 0) return { state: "absent" };
@@ -9211,6 +9237,7 @@ var FAILURE_CODES = {
9211
9237
  DEBUGGER_CDP_PROTOCOL_ERROR: "DEBUGGER_CDP_PROTOCOL_ERROR",
9212
9238
  DEBUGGER_CDP_CONNECT_FAILED: "DEBUGGER_CDP_CONNECT_FAILED",
9213
9239
  DEBUGGER_CDP_SOCKET_CLOSED_BEFORE_OPEN: "DEBUGGER_CDP_SOCKET_CLOSED_BEFORE_OPEN",
9240
+ DEBUGGER_CDP_ORIGIN_REJECTED: "DEBUGGER_CDP_ORIGIN_REJECTED",
9214
9241
  DEBUGGER_CDP_NOT_CONNECTED: "DEBUGGER_CDP_NOT_CONNECTED",
9215
9242
  DEBUGGER_CDP_REQUEST_TIMEOUT: "DEBUGGER_CDP_REQUEST_TIMEOUT",
9216
9243
  DEBUGGER_CDP_CONNECTION_CLOSED: "DEBUGGER_CDP_CONNECTION_CLOSED",
@@ -9285,6 +9312,32 @@ var FAILURE_CODES = {
9285
9312
  NATIVE_PROFILER_PERFETTO_PROCESS_ERROR: "NATIVE_PROFILER_PERFETTO_PROCESS_ERROR",
9286
9313
  NATIVE_PROFILER_PERFETTO_READY_TIMEOUT: "NATIVE_PROFILER_PERFETTO_READY_TIMEOUT",
9287
9314
  NATIVE_PROFILER_PERFETTO_READY_EXITED: "NATIVE_PROFILER_PERFETTO_READY_EXITED",
9315
+ /**
9316
+ * native-profiler-launch-analysis. Input problems use TOOL_INPUT_INVALID and
9317
+ * devicectl steps IOS_DEVICECTL_COMMAND_FAILED.
9318
+ * @see [workflow.ts](../../tool-server/src/utils/ios-launch-time/workflow.ts)
9319
+ */
9320
+ // Not macOS, or an Xcode that cannot record the launch on this target.
9321
+ LAUNCH_ANALYSIS_UNSUPPORTED_HOST: "LAUNCH_ANALYSIS_UNSUPPORTED_HOST",
9322
+ // No usable iPhone or simulator was selected, or Argent's runner holds it.
9323
+ LAUNCH_ANALYSIS_DEVICE_UNAVAILABLE: "LAUNCH_ANALYSIS_DEVICE_UNAVAILABLE",
9324
+ // The bundle_id app is not installed on the selected device.
9325
+ LAUNCH_ANALYSIS_APP_NOT_INSTALLED: "LAUNCH_ANALYSIS_APP_NOT_INSTALLED",
9326
+ // The runner's xcodebuild failed on code signing or provisioning.
9327
+ LAUNCH_ANALYSIS_SIGNING_FAILED: "LAUNCH_ANALYSIS_SIGNING_FAILED",
9328
+ // The iPhone's free developer profile has no slot for Argent's runner.
9329
+ LAUNCH_ANALYSIS_FREE_PROFILE_LIMIT: "LAUNCH_ANALYSIS_FREE_PROFILE_LIMIT",
9330
+ // simctl could not wait for boot, find, launch or terminate the app.
9331
+ LAUNCH_ANALYSIS_SIMCTL_FAILED: "LAUNCH_ANALYSIS_SIMCTL_FAILED",
9332
+ LAUNCH_ANALYSIS_RECORD_FAILED: "LAUNCH_ANALYSIS_RECORD_FAILED",
9333
+ // xctrace could not export the TOC, the CPU samples or the first-frame marker.
9334
+ LAUNCH_ANALYSIS_EXPORT_FAILED: "LAUNCH_ANALYSIS_EXPORT_FAILED",
9335
+ // The App Launch trace has no first frame of the app, so it has no launch window.
9336
+ LAUNCH_ANALYSIS_NO_FIRST_FRAME: "LAUNCH_ANALYSIS_NO_FIRST_FRAME",
9337
+ // The XCTest launch run of Argent's runner failed.
9338
+ LAUNCH_ANALYSIS_RUNNER_TEST_FAILED: "LAUNCH_ANALYSIS_RUNNER_TEST_FAILED",
9339
+ // The launch test ran, but Argent read no launch measurements from its result.
9340
+ LAUNCH_ANALYSIS_NO_SAMPLES: "LAUNCH_ANALYSIS_NO_SAMPLES",
9288
9341
  // iOS and Android share one capture path (simulator-server frames into
9289
9342
  // ffmpeg), so these name the failing stage, not the device family.
9290
9343
  SCREEN_RECORDING_FACTORY_OPTIONS_MISSING: "SCREEN_RECORDING_FACTORY_OPTIONS_MISSING",
@@ -9299,6 +9352,19 @@ var FAILURE_CODES = {
9299
9352
  SCREEN_RECORDING_SERVER_SHUTTING_DOWN: "SCREEN_RECORDING_SERVER_SHUTTING_DOWN",
9300
9353
  SCREEN_RECORDING_STREAM_UNAVAILABLE: "SCREEN_RECORDING_STREAM_UNAVAILABLE",
9301
9354
  SCREEN_RECORDING_FFMPEG_NOT_FOUND: "SCREEN_RECORDING_FFMPEG_NOT_FOUND",
9355
+ // A cabled iPhone has no simulator-server: its frames come from a host-side
9356
+ // CoreMediaIO capture helper, which can fail in ways of its own.
9357
+ SCREEN_RECORDING_DEVICE_HELPER_BUILD_FAILED: "SCREEN_RECORDING_DEVICE_HELPER_BUILD_FAILED",
9358
+ SCREEN_RECORDING_DEVICE_SCREEN_NOT_FOUND: "SCREEN_RECORDING_DEVICE_SCREEN_NOT_FOUND",
9359
+ SCREEN_RECORDING_DEVICE_CAMERA_PERMISSION_DENIED: "SCREEN_RECORDING_DEVICE_CAMERA_PERMISSION_DENIED",
9360
+ SCREEN_RECORDING_DEVICE_HELPER_FAILED: "SCREEN_RECORDING_DEVICE_HELPER_FAILED",
9361
+ AUDIO_CLIP_CONVERSION_FAILED: "AUDIO_CLIP_CONVERSION_FAILED",
9362
+ AUDIO_HOOK_NOT_ACTIVE: "AUDIO_HOOK_NOT_ACTIVE",
9363
+ AUDIO_ENV_SETUP_FAILED: "AUDIO_ENV_SETUP_FAILED",
9364
+ AUDIO_WRONG_PLATFORM: "AUDIO_WRONG_PLATFORM",
9365
+ AUDIO_HOOK_UNAVAILABLE: "AUDIO_HOOK_UNAVAILABLE",
9366
+ AUDIO_INJECTION_NOT_OURS: "AUDIO_INJECTION_NOT_OURS",
9367
+ AUDIO_SIMULATOR_NOT_BOOTED: "AUDIO_SIMULATOR_NOT_BOOTED",
9302
9368
  FLOW_PROJECT_ROOT_INVALID: "FLOW_PROJECT_ROOT_INVALID",
9303
9369
  FLOW_NAME_INVALID: "FLOW_NAME_INVALID",
9304
9370
  FLOW_NO_ACTIVE_RECORDING: "FLOW_NO_ACTIVE_RECORDING",
@@ -9362,6 +9428,8 @@ var FAILURE_CODES = {
9362
9428
  MACOS_APP_BUNDLE_ID_MISMATCH: "MACOS_APP_BUNDLE_ID_MISMATCH",
9363
9429
  MACOS_APP_OPEN_URL_FAILED: "MACOS_APP_OPEN_URL_FAILED",
9364
9430
  MACOS_APP_FILE_ACCESS_FAILED: "MACOS_APP_FILE_ACCESS_FAILED",
9431
+ /** The app's loaded Argent library lacks support for the requested operation. */
9432
+ MACOS_APP_LIBRARY_OUTDATED: "MACOS_APP_LIBRARY_OUTDATED",
9365
9433
  KEYBOARD_KEY_UNSUPPORTED: "KEYBOARD_KEY_UNSUPPORTED",
9366
9434
  KEYBOARD_CHARACTER_UNSUPPORTED: "KEYBOARD_CHARACTER_UNSUPPORTED",
9367
9435
  KEYBOARD_TEXT_AND_KEY_COMBINED: "KEYBOARD_TEXT_AND_KEY_COMBINED",
@@ -9548,7 +9616,7 @@ import { spawn as spawn2 } from "node:child_process";
9548
9616
  import { once } from "node:events";
9549
9617
  import { createReadStream, createWriteStream } from "node:fs";
9550
9618
  import { open, rm, readdir as readdir3 } from "node:fs/promises";
9551
- import { basename as basename4, dirname as dirname5, join as join9, resolve as resolve6, sep as sep2 } from "node:path";
9619
+ import { basename as basename4, dirname as dirname5, join as join9, resolve as resolve7, sep as sep2 } from "node:path";
9552
9620
  import { Writable } from "node:stream";
9553
9621
  import { pipeline } from "node:stream/promises";
9554
9622
  import zlib from "node:zlib";
@@ -9646,7 +9714,7 @@ async function sniffFormat(archivePath) {
9646
9714
  }
9647
9715
  }
9648
9716
  var ZSTD_FRAME_MAGIC = 4247762216;
9649
- async function assertSingleCompleteZstdFrame(archivePath) {
9717
+ async function assertSingleCompleteZstdFrame(archivePath, signal) {
9650
9718
  const fh = await open(archivePath, "r");
9651
9719
  try {
9652
9720
  const { size } = await fh.stat();
@@ -9656,6 +9724,7 @@ async function assertSingleCompleteZstdFrame(archivePath) {
9656
9724
  let pos = 0;
9657
9725
  const read = async (n) => {
9658
9726
  if (pos < windowStart || pos + n > windowEnd) {
9727
+ signal?.throwIfAborted();
9659
9728
  const { bytesRead } = await fh.read(window, 0, window.length, pos);
9660
9729
  windowStart = pos;
9661
9730
  windowEnd = pos + bytesRead;
@@ -9693,14 +9762,16 @@ function tarEnv(env) {
9693
9762
  const characterType = env.LC_ALL || env.LC_CTYPE || env.LANG || "";
9694
9763
  return /utf-?8/i.test(characterType) ? env : { ...env, LC_ALL: TAR_LOCALE };
9695
9764
  }
9696
- async function runTar(archive, args) {
9765
+ async function runTar(archive, args, signal) {
9697
9766
  const child = spawn2("tar", [...args, "-f", "-"], {
9767
+ signal,
9698
9768
  env: tarEnv(process.env)
9699
9769
  });
9700
- const exited = new Promise((res, rej) => {
9701
- child.on("error", rej);
9702
- child.on("close", res);
9770
+ let childError;
9771
+ child.on("error", (err) => {
9772
+ childError = err;
9703
9773
  });
9774
+ const closed = new Promise((resolve10) => child.once("close", resolve10));
9704
9775
  const stdout = collect(child.stdout, MAX_LISTING_BYTES, {
9705
9776
  maxLines: MAX_LISTING_LINES,
9706
9777
  onOverflow: () => child.kill()
@@ -9727,12 +9798,15 @@ async function runTar(archive, args) {
9727
9798
  if (err) child.stdin?.destroy();
9728
9799
  done(err);
9729
9800
  }
9730
- })
9801
+ }),
9802
+ { signal }
9731
9803
  ).then(
9732
9804
  () => null,
9733
9805
  (err) => err
9734
9806
  );
9735
- const [code, feedError] = await Promise.all([exited, fed]);
9807
+ const [code, feedError] = await Promise.all([closed, fed]);
9808
+ signal?.throwIfAborted();
9809
+ if (childError) throw childError;
9736
9810
  if (stdout.overflowed()) {
9737
9811
  throw new Error(
9738
9812
  `tar ${args.join(" ")} listed more than ${MAX_LISTING_LINES} members or ${MAX_LISTING_BYTES >> 20} MiB`
@@ -9754,24 +9828,25 @@ function isContainedPath(path14, windows = process.platform === "win32") {
9754
9828
  function isSafeTarMember(memberPath, destDir) {
9755
9829
  const normalized = normalizeTarMemberPath(memberPath);
9756
9830
  if (!isContainedPath(normalized)) return false;
9757
- const root = resolve6(destDir);
9758
- return resolve6(destDir, normalized).startsWith(root + sep2);
9831
+ const root = resolve7(destDir);
9832
+ return resolve7(destDir, normalized).startsWith(root + sep2);
9759
9833
  }
9760
- async function readListing(archive, args) {
9834
+ async function readListing(archive, args, signal) {
9761
9835
  try {
9762
- return await runTar(archive, args);
9836
+ return await runTar(archive, args, signal);
9763
9837
  } catch (err) {
9838
+ signal?.throwIfAborted();
9764
9839
  throw new ArchiveError(
9765
9840
  `Could not read archive: ${err instanceof Error ? err.message : String(err)}`
9766
9841
  );
9767
9842
  }
9768
9843
  }
9769
- async function listTarMembers(archive) {
9770
- const stdout = await readListing(archive, ["-t"]);
9844
+ async function listTarMembers(archive, signal) {
9845
+ const stdout = await readListing(archive, ["-t"], signal);
9771
9846
  return stdout.split("\n").map((line) => line.trim()).filter((line) => line.length > 0);
9772
9847
  }
9773
- async function assertSafeMemberTypes(archive) {
9774
- const stdout = await readListing(archive, ["-tv"]);
9848
+ async function assertSafeMemberTypes(archive, signal) {
9849
+ const stdout = await readListing(archive, ["-tv"], signal);
9775
9850
  for (const line of stdout.split("\n")) {
9776
9851
  if (!line.trim()) continue;
9777
9852
  const type = line[0];
@@ -9791,8 +9866,8 @@ async function assertSafeMemberTypes(archive) {
9791
9866
  );
9792
9867
  }
9793
9868
  }
9794
- async function assertSafeArchive(archive, destDir) {
9795
- const members = await listTarMembers(archive);
9869
+ async function assertSafeArchive(archive, destDir, signal) {
9870
+ const members = await listTarMembers(archive, signal);
9796
9871
  if (members.length === 0) {
9797
9872
  throw new ArchiveError("Archive is empty.");
9798
9873
  }
@@ -9801,7 +9876,7 @@ async function assertSafeArchive(archive, destDir) {
9801
9876
  throw new ArchiveError(`Archive contains an unsafe path "${member}" \u2014 refusing extraction.`);
9802
9877
  }
9803
9878
  }
9804
- await assertSafeMemberTypes(archive);
9879
+ await assertSafeMemberTypes(archive, signal);
9805
9880
  }
9806
9881
  async function resolveMember(destDir, expectedName) {
9807
9882
  const entries = await readdir3(destDir);
@@ -9816,19 +9891,24 @@ async function resolveMember(destDir, expectedName) {
9816
9891
  }
9817
9892
  return join9(destDir, real[0]);
9818
9893
  }
9819
- async function safeExtractArchive(archivePath, destDir, expectedName) {
9894
+ async function safeExtractArchive(archivePath, destDir, expectedName, signal) {
9895
+ signal?.throwIfAborted();
9820
9896
  let archive;
9821
9897
  try {
9822
9898
  archive = { path: archivePath, format: await sniffFormat(archivePath) };
9823
- if (archive.format === "zstd") await assertSingleCompleteZstdFrame(archivePath);
9899
+ if (archive.format === "zstd") await assertSingleCompleteZstdFrame(archivePath, signal);
9824
9900
  } catch (err) {
9901
+ signal?.throwIfAborted();
9825
9902
  throw new ArchiveError(
9826
9903
  `Could not read archive: ${err instanceof Error ? err.message : String(err)}`
9827
9904
  );
9828
9905
  }
9829
- await assertSafeArchive(archive, destDir);
9830
- await runTar(archive, ["-x", "-C", destDir]);
9831
- return resolveMember(destDir, expectedName);
9906
+ await assertSafeArchive(archive, destDir, signal);
9907
+ signal?.throwIfAborted();
9908
+ await runTar(archive, ["-x", "-C", destDir], signal);
9909
+ const member = await resolveMember(destDir, expectedName);
9910
+ signal?.throwIfAborted();
9911
+ return member;
9832
9912
  }
9833
9913
 
9834
9914
  // ../argent-tools-client/src/errors.ts
@@ -9905,10 +9985,10 @@ function untrackArchive(archive) {
9905
9985
  for (const s of ARCHIVE_SIGNALS) process.removeListener(s, removeArchivesOnSignal);
9906
9986
  process.removeListener("exit", removePendingArchives);
9907
9987
  }
9908
- function sha256File(filePath) {
9909
- return new Promise((resolve9, reject) => {
9988
+ function sha256File(filePath, signal) {
9989
+ return new Promise((resolve10, reject) => {
9910
9990
  const hash = createHash2("sha256");
9911
- createReadStream2(filePath).on("data", (chunk) => hash.update(chunk)).on("end", () => resolve9(hash.digest("hex"))).on("error", reject);
9991
+ createReadStream2(filePath, { signal }).on("data", (chunk) => hash.update(chunk)).on("end", () => resolve10(hash.digest("hex"))).on("error", reject);
9912
9992
  });
9913
9993
  }
9914
9994
  function toolServerError(text) {
@@ -9971,7 +10051,7 @@ async function uploadFile(sourcePath, endpoint, signal) {
9971
10051
  trackArchive(tarPath);
9972
10052
  try {
9973
10053
  await createArchiveFile(await realpath2(sourcePath), tarPath, format, signal);
9974
- const contentHash = await sha256File(tarPath);
10054
+ const contentHash = await sha256File(tarPath, signal);
9975
10055
  return { uploadId: await uploadTar(tarPath, format, endpoint, signal), contentHash };
9976
10056
  } finally {
9977
10057
  untrackArchive(tarPath);
@@ -11014,10 +11094,19 @@ function createToolsClient(options = {}) {
11014
11094
  }
11015
11095
 
11016
11096
  // ../argent-tools-client/src/artifacts.ts
11017
- import { copyFile, mkdir as mkdir4, readFile as readFile6, realpath as realpath4, rm as rm3, stat as stat5, writeFile as writeFile4 } from "node:fs/promises";
11097
+ import {
11098
+ copyFile,
11099
+ mkdir as mkdir4,
11100
+ mkdtemp,
11101
+ readFile as readFile6,
11102
+ realpath as realpath4,
11103
+ rm as rm3,
11104
+ stat as stat5,
11105
+ writeFile as writeFile4
11106
+ } from "node:fs/promises";
11018
11107
  import { constants as fsConstants } from "node:fs";
11019
11108
  import { tmpdir as tmpdir2 } from "node:os";
11020
- import { basename as basename7, dirname as dirname9, extname as extname2, isAbsolute as isAbsolute6, join as join13, normalize as normalize2, resolve as resolve8, sep as sep4 } from "node:path";
11109
+ import { basename as basename7, dirname as dirname9, extname as extname2, isAbsolute as isAbsolute6, join as join13, normalize as normalize2, resolve as resolve9, sep as sep4 } from "node:path";
11021
11110
  import { createHash as createHash3 } from "node:crypto";
11022
11111
  var ARTIFACT_MARKER2 = "__argentArtifact";
11023
11112
  function isArtifactHandle(value) {
@@ -11066,7 +11155,7 @@ function configuredRecordingsDir() {
11066
11155
  if (trimmed === "") return null;
11067
11156
  const home = dirname9(argentHomeDir());
11068
11157
  const expanded = trimmed === "~" ? home : trimmed.startsWith("~/") || trimmed.startsWith(`~${sep4}`) ? join13(home, trimmed.slice(2)) : trimmed;
11069
- return resolve8(durableBaseDir(), expanded);
11158
+ return resolve9(durableBaseDir(), expanded);
11070
11159
  }
11071
11160
  var MAX_ARTIFACT_BYTES = 2 * 1024 * 1024 * 1024;
11072
11161
  async function readCapped(res, cap) {
@@ -11158,16 +11247,22 @@ async function resolveLocalFile(handle) {
11158
11247
  return null;
11159
11248
  }
11160
11249
  }
11161
- async function downloadAndExtractArchive(handle, data, dir) {
11162
- const tarball = join13(dir, `${sanitizeSegment(handle.filename)}.tar.gz`);
11250
+ async function downloadAndExtractArchive(handle, data, dir, signal) {
11251
+ signal?.throwIfAborted();
11252
+ const attemptDir = await mkdtemp(join13(dir, "bundle-"));
11253
+ const tarball = join13(attemptDir, "download.tar");
11254
+ const extractDir = join13(attemptDir, "files");
11163
11255
  try {
11164
- await writeFile4(tarball, data);
11165
- return await safeExtractArchive(tarball, dir, handle.filename);
11256
+ await writeFile4(tarball, data, { signal });
11257
+ await mkdir4(extractDir);
11258
+ const member = await safeExtractArchive(tarball, extractDir, handle.filename, signal);
11259
+ await rm3(tarball);
11260
+ signal?.throwIfAborted();
11261
+ return member;
11166
11262
  } catch {
11167
- return null;
11168
- } finally {
11169
- await rm3(tarball, { force: true }).catch(() => {
11263
+ await rm3(attemptDir, { recursive: true, force: true }).catch(() => {
11170
11264
  });
11265
+ return null;
11171
11266
  }
11172
11267
  }
11173
11268
  async function materializeArtifacts(result, ctx) {
@@ -11253,7 +11348,7 @@ async function materializeArtifacts(result, ctx) {
11253
11348
  if (!data) return null;
11254
11349
  await ensureDir();
11255
11350
  if (value.archive === "tar.gz") {
11256
- return await downloadAndExtractArchive(value, data, dir);
11351
+ return await downloadAndExtractArchive(value, data, dir, ctx.signal);
11257
11352
  }
11258
11353
  if (value.size > 0 && data.length !== value.size) return null;
11259
11354
  const downloadedPath = join13(dir, sanitizeSegment(value.filename));
@@ -11290,12 +11385,12 @@ function getDeviceIdFromArgs(args) {
11290
11385
  }
11291
11386
 
11292
11387
  // src/bundled-paths.ts
11293
- import * as fs7 from "node:fs";
11388
+ import * as fs8 from "node:fs";
11294
11389
  import * as path13 from "node:path";
11295
11390
  function readPackageVersion() {
11296
11391
  try {
11297
11392
  const pkg = JSON.parse(
11298
- fs7.readFileSync(path13.join(import.meta.dirname, "..", "package.json"), "utf8")
11393
+ fs8.readFileSync(path13.join(import.meta.dirname, "..", "package.json"), "utf8")
11299
11394
  );
11300
11395
  return pkg.version;
11301
11396
  } catch {
@@ -11306,9 +11401,9 @@ var PACKAGE_NAME = "@swmansion/argent";
11306
11401
  function findDeclaringRoot(startDir) {
11307
11402
  let dir = startDir;
11308
11403
  for (; ; ) {
11309
- if (fs7.existsSync(path13.join(dir, ".argent", "install.json"))) return dir;
11404
+ if (fs8.existsSync(path13.join(dir, ".argent", "install.json"))) return dir;
11310
11405
  try {
11311
- const manifest = JSON.parse(fs7.readFileSync(path13.join(dir, "package.json"), "utf8"));
11406
+ const manifest = JSON.parse(fs8.readFileSync(path13.join(dir, "package.json"), "utf8"));
11312
11407
  if (manifest.devDependencies?.[PACKAGE_NAME] || manifest.dependencies?.[PACKAGE_NAME] || manifest.optionalDependencies?.[PACKAGE_NAME]) {
11313
11408
  return dir;
11314
11409
  }
@@ -11324,7 +11419,7 @@ function findStablePackageDir(startDir, packageRoot) {
11324
11419
  for (; ; ) {
11325
11420
  const candidate = path13.join(dir, "node_modules", PACKAGE_NAME);
11326
11421
  try {
11327
- if (fs7.realpathSync(candidate) === packageRoot) return candidate;
11422
+ if (fs8.realpathSync(candidate) === packageRoot) return candidate;
11328
11423
  } catch {
11329
11424
  }
11330
11425
  const parent = path13.dirname(dir);
@@ -11337,7 +11432,7 @@ function classifyInstall() {
11337
11432
  let dir;
11338
11433
  let cwd;
11339
11434
  try {
11340
- packageRoot = fs7.realpathSync(path13.join(import.meta.dirname, ".."));
11435
+ packageRoot = fs8.realpathSync(path13.join(import.meta.dirname, ".."));
11341
11436
  cwd = process.cwd();
11342
11437
  dir = cwd;
11343
11438
  } catch {
@@ -11345,7 +11440,7 @@ function classifyInstall() {
11345
11440
  }
11346
11441
  for (; ; ) {
11347
11442
  try {
11348
- const nmReal = fs7.realpathSync(path13.join(dir, "node_modules"));
11443
+ const nmReal = fs8.realpathSync(path13.join(dir, "node_modules"));
11349
11444
  if (packageRoot === nmReal || packageRoot.startsWith(nmReal + path13.sep)) {
11350
11445
  return {
11351
11446
  kind: "local",