@swmansion/argent 0.18.0 → 0.18.1-next.1

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.
Binary file
Binary file
Binary file
Binary file
package/dist/cli-cmds.mjs CHANGED
@@ -163,7 +163,7 @@ var require_src = __commonJS({
163
163
 
164
164
  // ../argent-cli/src/run.ts
165
165
  import * as fs8 from "node:fs";
166
- import * as path10 from "node:path";
166
+ import * as path11 from "node:path";
167
167
 
168
168
  // ../argent-tools-client/src/launcher.ts
169
169
  import * as net from "node:net";
@@ -204,7 +204,7 @@ function generateAuthToken() {
204
204
  return generateToken();
205
205
  }
206
206
  function findFreePort() {
207
- return new Promise((resolve7, reject) => {
207
+ return new Promise((resolve9, reject) => {
208
208
  const srv = net.createServer();
209
209
  srv.listen(0, "127.0.0.1", () => {
210
210
  const addr = srv.address();
@@ -215,7 +215,7 @@ function findFreePort() {
215
215
  const port = addr.port;
216
216
  srv.close((err) => {
217
217
  if (err) reject(err);
218
- else resolve7(port);
218
+ else resolve9(port);
219
219
  });
220
220
  });
221
221
  srv.on("error", reject);
@@ -316,7 +316,7 @@ function killSpawnedChild(child, pid) {
316
316
  }
317
317
  }
318
318
  function spawnToolsServer(paths, port, options = {}) {
319
- return new Promise((resolve7, reject) => {
319
+ return new Promise((resolve9, reject) => {
320
320
  let logFd;
321
321
  try {
322
322
  fs.mkdirSync(STATE_DIR, { recursive: true });
@@ -353,7 +353,7 @@ function spawnToolsServer(paths, port, options = {}) {
353
353
  rl.close();
354
354
  child.stdout?.resume();
355
355
  child.stdout?.unref?.();
356
- settle(() => resolve7({ port: actualPort, pid }));
356
+ settle(() => resolve9({ port: actualPort, pid }));
357
357
  }
358
358
  });
359
359
  child.on("error", (err) => {
@@ -742,8 +742,8 @@ function parseLinkTarget(input) {
742
742
  const host = u3.hostname.startsWith("[") ? u3.hostname.slice(1, -1) : u3.hostname;
743
743
  if (!host) throw new Error(`URL "${input}" is missing a host.`);
744
744
  const port = u3.port ? Number(u3.port) : u3.protocol === "https:" ? 443 : 80;
745
- const path15 = u3.pathname === "/" ? "" : u3.pathname.replace(/\/+$/, "");
746
- const url = `${u3.protocol}//${u3.host}${path15}`;
745
+ const path16 = u3.pathname === "/" ? "" : u3.pathname.replace(/\/+$/, "");
746
+ const url = `${u3.protocol}//${u3.host}${path16}`;
747
747
  const token = u3.username ? decodeURIComponent(u3.username) : void 0;
748
748
  return { url, host, port, ...token ? { token } : {} };
749
749
  }
@@ -879,9 +879,9 @@ async function tarball(sourcePath) {
879
879
  return tarPath;
880
880
  }
881
881
  function sha256File(filePath) {
882
- return new Promise((resolve7, reject) => {
882
+ return new Promise((resolve9, reject) => {
883
883
  const hash = createHash2("sha256");
884
- createReadStream(filePath).on("data", (chunk) => hash.update(chunk)).on("end", () => resolve7(hash.digest("hex"))).on("error", reject);
884
+ createReadStream(filePath).on("data", (chunk) => hash.update(chunk)).on("end", () => resolve9(hash.digest("hex"))).on("error", reject);
885
885
  });
886
886
  }
887
887
  async function uploadTar(tarPath, endpoint) {
@@ -1103,7 +1103,7 @@ function createToolsClient(options = {}) {
1103
1103
  import { copyFile, mkdir as mkdir4, readFile as readFile4, realpath, rm as rm3, stat as stat2, writeFile as writeFile4 } from "node:fs/promises";
1104
1104
  import { constants as fsConstants } from "node:fs";
1105
1105
  import { tmpdir as tmpdir2 } from "node:os";
1106
- import { basename as basename3, dirname as dirname5, extname, isAbsolute as isAbsolute3, join as join8, normalize, sep as sep2 } from "node:path";
1106
+ import { basename as basename3, dirname as dirname5, extname, isAbsolute as isAbsolute3, join as join8, normalize, resolve as resolve5, sep as sep2 } from "node:path";
1107
1107
  import { createHash as createHash3 } from "node:crypto";
1108
1108
 
1109
1109
  // ../configuration-core/src/flags.ts
@@ -1231,13 +1231,16 @@ function nonEmpty(value) {
1231
1231
  const trimmed = value.trim();
1232
1232
  return trimmed === "" ? null : value;
1233
1233
  }
1234
+ function resolveHomeDir(options = {}) {
1235
+ if (options.homeDir) return options.homeDir;
1236
+ return process.platform === "win32" ? nonEmpty(process.env.USERPROFILE) ?? os.homedir() : nonEmpty(process.env.HOME) ?? os.homedir();
1237
+ }
1234
1238
  function argentHomeDir() {
1235
- const home = process.platform === "win32" ? nonEmpty(process.env.USERPROFILE) ?? os.homedir() : nonEmpty(process.env.HOME) ?? os.homedir();
1236
- return path5.join(home, ".argent");
1239
+ return path5.join(resolveHomeDir(), ".argent");
1237
1240
  }
1238
1241
  function configDir(scope = "global", options = {}) {
1239
1242
  if (scope === "global") {
1240
- return options.homeDir ? path5.join(options.homeDir, ".argent") : argentHomeDir();
1243
+ return path5.join(resolveHomeDir(options), ".argent");
1241
1244
  }
1242
1245
  const cwd = options.cwd ?? process.cwd();
1243
1246
  return path5.join(resolveProjectRoot(cwd), ".argent");
@@ -1444,6 +1447,14 @@ function asString(raw) {
1444
1447
  const trimmed = raw.trim();
1445
1448
  return trimmed === "" ? void 0 : trimmed;
1446
1449
  }
1450
+ function asStringArray(raw) {
1451
+ if (!Array.isArray(raw)) return void 0;
1452
+ const out = [];
1453
+ for (const item of raw) {
1454
+ if (typeof item === "string" && item.trim() !== "") out.push(item.trim());
1455
+ }
1456
+ return out;
1457
+ }
1447
1458
  var CONFIG_SCHEMA = [
1448
1459
  {
1449
1460
  key: "telemetry.enabled",
@@ -1469,6 +1480,31 @@ var CONFIG_SCHEMA = [
1469
1480
  // user's global remembered choice.
1470
1481
  merge: "prioritize-local",
1471
1482
  example: "claude"
1483
+ },
1484
+ {
1485
+ key: "ios.additionalDeviceSets",
1486
+ description: "Additional CoreSimulator device-set directories whose simulators argent should see alongside the default set. Absolute paths (or ~/\u2026); relative entries resolve against the project root (project scope) or home (global scope).",
1487
+ scopes: ["project", "global"],
1488
+ parse: asStringArray,
1489
+ // Additive: the scopes extend each other rather than shadow — a repo's
1490
+ // committed device sets are appended to the user's global ones (global
1491
+ // baseline first, project extras after, deduplicated). Note that
1492
+ // `getAdditionalIosDeviceSets` re-implements this union (path resolution
1493
+ // must precede dedup) and guards on the preset staying "union".
1494
+ merge: "union",
1495
+ example: '["~/DeviceSets/ci"]'
1496
+ },
1497
+ {
1498
+ key: "recordings.directory",
1499
+ description: "Directory where finished screen recordings (mp4) are saved on the client host. Absolute, `~`-prefixed, or relative to the project root (home dir when not in a project). Unset \u21D2 `.argent/recordings` under the project root.",
1500
+ scopes: ["project", "global"],
1501
+ parse: asString,
1502
+ // A repo can pin where its recordings land; falls back to the user's global
1503
+ // preference. Resolution happens on the client (the machine the mp4 is
1504
+ // persisted to), so with a remote `argent link` tool-server it is the
1505
+ // *client's* config that decides.
1506
+ merge: "prioritize-local",
1507
+ example: "~/Movies/argent"
1472
1508
  }
1473
1509
  ];
1474
1510
  function getConfigDefinition(key, registry = CONFIG_SCHEMA) {
@@ -1476,6 +1512,7 @@ function getConfigDefinition(key, registry = CONFIG_SCHEMA) {
1476
1512
  }
1477
1513
 
1478
1514
  // ../configuration-core/src/config-access.ts
1515
+ import * as path7 from "node:path";
1479
1516
  function readScopeValue(def, scope, options) {
1480
1517
  if (!def.scopes.includes(scope)) return void 0;
1481
1518
  const raw = getAtPath(readConfigObject(scope, options), def.key);
@@ -1629,6 +1666,21 @@ function durableBaseDir() {
1629
1666
  return projectRoot ?? dirname5(argentHomeDir());
1630
1667
  }
1631
1668
  var ALLOWED_SAVE_DIRS = /* @__PURE__ */ new Set([normalize(".argent/recordings")]);
1669
+ var RECORDINGS_SAVE_DIR = normalize(".argent/recordings");
1670
+ function configuredRecordingsDir() {
1671
+ let value;
1672
+ try {
1673
+ value = getConfigValueByKey("recordings.directory");
1674
+ } catch {
1675
+ return null;
1676
+ }
1677
+ if (typeof value !== "string") return null;
1678
+ const trimmed = value.trim();
1679
+ if (trimmed === "") return null;
1680
+ const home = dirname5(argentHomeDir());
1681
+ const expanded = trimmed === "~" ? home : trimmed.startsWith("~/") || trimmed.startsWith(`~${sep2}`) ? join8(home, trimmed.slice(2)) : trimmed;
1682
+ return resolve5(durableBaseDir(), expanded);
1683
+ }
1632
1684
  var MAX_DURABLE_BYTES = 2 * 1024 * 1024 * 1024;
1633
1685
  async function readCapped(res, cap) {
1634
1686
  const headers = res.headers;
@@ -1660,10 +1712,10 @@ async function writeDurableUnique(dir, filename, write) {
1660
1712
  const stem = filename.slice(0, filename.length - ext.length);
1661
1713
  for (let i2 = 1; i2 <= 1e3; i2++) {
1662
1714
  const candidate = i2 === 1 ? filename : `${stem} (${i2})${ext}`;
1663
- const path15 = join8(dir, candidate);
1715
+ const path16 = join8(dir, candidate);
1664
1716
  try {
1665
- await write(path15);
1666
- return path15;
1717
+ await write(path16);
1718
+ return path16;
1667
1719
  } catch (err) {
1668
1720
  if (err?.code === "EEXIST") continue;
1669
1721
  throw err;
@@ -1678,6 +1730,17 @@ function durableSaveTarget(handle) {
1678
1730
  return null;
1679
1731
  }
1680
1732
  if (!ALLOWED_SAVE_DIRS.has(rel)) return null;
1733
+ if (rel === RECORDINGS_SAVE_DIR) {
1734
+ const configured = configuredRecordingsDir();
1735
+ if (configured) {
1736
+ return {
1737
+ dir: configured,
1738
+ path: join8(configured, sanitizeSegment(handle.filename)),
1739
+ base: configured,
1740
+ rel: ""
1741
+ };
1742
+ }
1743
+ }
1681
1744
  const base = durableBaseDir();
1682
1745
  const dir = join8(base, rel);
1683
1746
  return { dir, path: join8(dir, sanitizeSegment(handle.filename)), base, rel };
@@ -1859,8 +1922,8 @@ function createGetModuleFromFilename(basePath = process.argv[1] ? dirname6(proce
1859
1922
  return decodedFile;
1860
1923
  };
1861
1924
  }
1862
- function normalizeWindowsPath(path15) {
1863
- return path15.replace(/^[A-Z]:/, "").replace(/\\/g, "/");
1925
+ function normalizeWindowsPath(path16) {
1926
+ return path16.replace(/^[A-Z]:/, "").replace(/\\/g, "/");
1864
1927
  }
1865
1928
 
1866
1929
  // ../../node_modules/@posthog/core/dist/featureFlagUtils.mjs
@@ -4412,15 +4475,15 @@ async function addSourceContext(frames) {
4412
4475
  LRU_FILE_CONTENTS_CACHE.reduce();
4413
4476
  return frames;
4414
4477
  }
4415
- function getContextLinesFromFile(path15, ranges, output) {
4416
- return new Promise((resolve7) => {
4417
- const stream = createReadStream2(path15);
4478
+ function getContextLinesFromFile(path16, ranges, output) {
4479
+ return new Promise((resolve9) => {
4480
+ const stream = createReadStream2(path16);
4418
4481
  const lineReaded = createInterface2({
4419
4482
  input: stream
4420
4483
  });
4421
4484
  function destroyStreamAndResolve() {
4422
4485
  stream.destroy();
4423
- resolve7();
4486
+ resolve9();
4424
4487
  }
4425
4488
  let lineNumber = 0;
4426
4489
  let currentRangeIndex = 0;
@@ -4429,7 +4492,7 @@ function getContextLinesFromFile(path15, ranges, output) {
4429
4492
  let rangeStart = range[0];
4430
4493
  let rangeEnd = range[1];
4431
4494
  function onStreamError() {
4432
- LRU_FILE_CONTENTS_FS_READ_FAILED.set(path15, 1);
4495
+ LRU_FILE_CONTENTS_FS_READ_FAILED.set(path16, 1);
4433
4496
  lineReaded.close();
4434
4497
  lineReaded.removeAllListeners();
4435
4498
  destroyStreamAndResolve();
@@ -4490,8 +4553,8 @@ function clearLineContext(frame) {
4490
4553
  delete frame.context_line;
4491
4554
  delete frame.post_context;
4492
4555
  }
4493
- function shouldSkipContextLinesForFile(path15) {
4494
- return path15.startsWith("node:") || path15.endsWith(".min.js") || path15.endsWith(".min.cjs") || path15.endsWith(".min.mjs") || path15.startsWith("data:");
4556
+ function shouldSkipContextLinesForFile(path16) {
4557
+ return path16.startsWith("node:") || path16.endsWith(".min.js") || path16.endsWith(".min.cjs") || path16.endsWith(".min.mjs") || path16.startsWith("data:");
4495
4558
  }
4496
4559
  function shouldSkipContextLinesForFrame(frame) {
4497
4560
  if (void 0 !== frame.lineno && frame.lineno > MAX_CONTEXTLINES_LINENO) return true;
@@ -5717,9 +5780,9 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
5717
5780
  if (!waitUntil) return;
5718
5781
  if (this.disabled || this.optedOut) return;
5719
5782
  if (!this._waitUntilCycle) {
5720
- let resolve7;
5783
+ let resolve9;
5721
5784
  const promise = new Promise((r2) => {
5722
- resolve7 = r2;
5785
+ resolve9 = r2;
5723
5786
  });
5724
5787
  try {
5725
5788
  waitUntil(promise);
@@ -5727,7 +5790,7 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
5727
5790
  return;
5728
5791
  }
5729
5792
  this._waitUntilCycle = {
5730
- resolve: resolve7,
5793
+ resolve: resolve9,
5731
5794
  startedAt: Date.now(),
5732
5795
  timer: void 0
5733
5796
  };
@@ -5751,12 +5814,12 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
5751
5814
  return cycle?.resolve;
5752
5815
  }
5753
5816
  async resolveWaitUntilFlush() {
5754
- const resolve7 = this._consumeWaitUntilCycle();
5817
+ const resolve9 = this._consumeWaitUntilCycle();
5755
5818
  try {
5756
5819
  await super.flush();
5757
5820
  } catch {
5758
5821
  } finally {
5759
- resolve7?.();
5822
+ resolve9?.();
5760
5823
  }
5761
5824
  }
5762
5825
  getPersistedProperty(key) {
@@ -5877,15 +5940,15 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
5877
5940
  async waitForLocalEvaluationReady(timeoutMs = THIRTY_SECONDS) {
5878
5941
  if (this.isLocalEvaluationReady()) return true;
5879
5942
  if (void 0 === this.featureFlagsPoller) return false;
5880
- return new Promise((resolve7) => {
5943
+ return new Promise((resolve9) => {
5881
5944
  const timeout = setTimeout(() => {
5882
5945
  cleanup();
5883
- resolve7(false);
5946
+ resolve9(false);
5884
5947
  }, timeoutMs);
5885
5948
  const cleanup = this._events.on("localEvaluationFlagsLoaded", (count) => {
5886
5949
  clearTimeout(timeout);
5887
5950
  cleanup();
5888
- resolve7(count > 0);
5951
+ resolve9(count > 0);
5889
5952
  });
5890
5953
  });
5891
5954
  }
@@ -6340,14 +6403,14 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
6340
6403
  this.context?.enter(data, options);
6341
6404
  }
6342
6405
  async _shutdown(shutdownTimeoutMs) {
6343
- const resolve7 = this._consumeWaitUntilCycle();
6406
+ const resolve9 = this._consumeWaitUntilCycle();
6344
6407
  await this.featureFlagsPoller?.stopPoller(shutdownTimeoutMs);
6345
6408
  this.errorTracking.shutdown();
6346
6409
  try {
6347
6410
  return await super._shutdown(shutdownTimeoutMs);
6348
6411
  } finally {
6349
6412
  this.distinctIdHasSentFlagCalls = {};
6350
- resolve7?.();
6413
+ resolve9?.();
6351
6414
  }
6352
6415
  }
6353
6416
  async _requestRemoteConfigPayload(flagKey) {
@@ -7332,9 +7395,9 @@ function isReplitAgent(env) {
7332
7395
  }
7333
7396
  var DEVIN_MARKER_PATH = "/opt/.devin";
7334
7397
  var JULES_MARKER_PATH = "/opt/environment_summary.sh";
7335
- function safeExists(fileExists, path15) {
7398
+ function safeExists(fileExists, path16) {
7336
7399
  try {
7337
- return fileExists(path15);
7400
+ return fileExists(path16);
7338
7401
  } catch {
7339
7402
  return false;
7340
7403
  }
@@ -7790,15 +7853,15 @@ function getBaseProps(runtime) {
7790
7853
  // ../telemetry/src/identity.ts
7791
7854
  import * as crypto2 from "node:crypto";
7792
7855
  import * as fs4 from "node:fs";
7793
- import * as path8 from "node:path";
7856
+ import * as path9 from "node:path";
7794
7857
 
7795
7858
  // ../telemetry/src/paths.ts
7796
- import * as path7 from "node:path";
7859
+ import * as path8 from "node:path";
7797
7860
  function identityFilePath() {
7798
- return path7.join(argentHomeDir(), "telemetry-id");
7861
+ return path8.join(argentHomeDir(), "telemetry-id");
7799
7862
  }
7800
7863
  function debugLogPath() {
7801
- return path7.join(argentHomeDir(), "telemetry-debug.log");
7864
+ return path8.join(argentHomeDir(), "telemetry-debug.log");
7802
7865
  }
7803
7866
 
7804
7867
  // ../telemetry/src/identity.ts
@@ -7914,7 +7977,7 @@ function writeIdFileAtomic(finalPath, id) {
7914
7977
  if (occupant && !occupant.isFile()) {
7915
7978
  throw new Error("telemetry: refusing to replace a non-regular file at the identity path");
7916
7979
  }
7917
- const tmpPath = path8.join(
7980
+ const tmpPath = path9.join(
7918
7981
  argentHomeDir(),
7919
7982
  `.telemetry-id.tmp.${process.pid}.${crypto2.randomUUID()}`
7920
7983
  );
@@ -7938,7 +8001,7 @@ function mintRandomId(finalPath) {
7938
8001
  fs4.mkdirSync(argentHomeDir(), { recursive: true });
7939
8002
  let value = crypto2.randomUUID();
7940
8003
  for (let attempt = 0; attempt < 3; attempt++) {
7941
- const tmpPath = path8.join(
8004
+ const tmpPath = path9.join(
7942
8005
  argentHomeDir(),
7943
8006
  `.telemetry-id.tmp.${process.pid}.${crypto2.randomUUID()}`
7944
8007
  );
@@ -7983,7 +8046,7 @@ function mintRandomId(finalPath) {
7983
8046
  throw new Error("telemetry: failed to create identity after retries");
7984
8047
  }
7985
8048
  function claimCorruptOccupant(finalPath) {
7986
- const claimed = path8.join(
8049
+ const claimed = path9.join(
7987
8050
  argentHomeDir(),
7988
8051
  `.telemetry-id.corrupt.${process.pid}.${crypto2.randomUUID()}`
7989
8052
  );
@@ -8025,12 +8088,12 @@ function tryReadId(filePath) {
8025
8088
  import { execFileSync as execFileSync2, spawn as spawn2 } from "node:child_process";
8026
8089
 
8027
8090
  // ../native-devtools-ios/src/index.ts
8028
- import * as path9 from "node:path";
8091
+ import * as path10 from "node:path";
8029
8092
  import * as fs5 from "node:fs";
8030
- var DYLIB_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_DIR ?? path9.join(__dirname, "..", "dylibs");
8031
- var BIN_DIR = process.env.ARGENT_SIMULATOR_SERVER_DIR ?? path9.join(__dirname, "..", "bin");
8032
- var DYLIB_TCP_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_TCP_DIR ?? path9.join(DYLIB_DIR, "tcp");
8033
- var DYLIB_TVOS_DIR = path9.join(DYLIB_DIR, "tvos");
8093
+ var DYLIB_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_DIR ?? path10.join(__dirname, "..", "dylibs");
8094
+ var BIN_DIR = process.env.ARGENT_SIMULATOR_SERVER_DIR ?? path10.join(__dirname, "..", "bin");
8095
+ var DYLIB_TCP_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_TCP_DIR ?? path10.join(DYLIB_DIR, "tcp");
8096
+ var DYLIB_TVOS_DIR = path10.join(DYLIB_DIR, "tvos");
8034
8097
  function hostPlatformKey() {
8035
8098
  if (process.platform === "linux" && process.arch === "arm64") {
8036
8099
  return "linux-arm64";
@@ -8041,13 +8104,13 @@ function simulatorServerBinaryName() {
8041
8104
  return process.platform === "win32" ? "simulator-server.exe" : "simulator-server";
8042
8105
  }
8043
8106
  function platformBinDir() {
8044
- return path9.join(BIN_DIR, hostPlatformKey());
8107
+ return path10.join(BIN_DIR, hostPlatformKey());
8045
8108
  }
8046
8109
  function simulatorServerBinaryPath() {
8047
8110
  const binaryName = simulatorServerBinaryName();
8048
- const p = path9.join(platformBinDir(), binaryName);
8111
+ const p = path10.join(platformBinDir(), binaryName);
8049
8112
  if (!fs5.existsSync(p)) {
8050
- const flat = path9.join(BIN_DIR, binaryName);
8113
+ const flat = path10.join(BIN_DIR, binaryName);
8051
8114
  const migrationHint = fs5.existsSync(flat) ? ` Found a binary at the old flat path ${flat}; move it to ${p} or update ARGENT_SIMULATOR_SERVER_DIR to point at the parent of the platform subdirectory.` : "";
8052
8115
  throw new Error(
8053
8116
  `simulator-server binary not found for platform "${hostPlatformKey()}" at ${p}. Supported hosts today: darwin, linux (x86_64 and arm64), win32.${migrationHint}`
@@ -8081,12 +8144,12 @@ function resolveHostFingerprint() {
8081
8144
  }
8082
8145
  }
8083
8146
  function resolveHostFingerprintAsync() {
8084
- return new Promise((resolve7) => {
8147
+ return new Promise((resolve9) => {
8085
8148
  let binary;
8086
8149
  try {
8087
8150
  binary = simulatorServerBinaryPath();
8088
8151
  } catch {
8089
- resolve7(null);
8152
+ resolve9(null);
8090
8153
  return;
8091
8154
  }
8092
8155
  let settled = false;
@@ -8099,7 +8162,7 @@ function resolveHostFingerprintAsync() {
8099
8162
  child?.kill("SIGKILL");
8100
8163
  } catch {
8101
8164
  }
8102
- resolve7(value);
8165
+ resolve9(value);
8103
8166
  };
8104
8167
  const watchdog = setTimeout(() => finish(null), FINGERPRINT_TIMEOUT_MS);
8105
8168
  watchdog.unref?.();
@@ -8341,7 +8404,7 @@ async function shutdown(timeoutMs = SHORT_FLUSH_TIMEOUT_MS) {
8341
8404
  try {
8342
8405
  await Promise.race([
8343
8406
  client2.shutdown(timeoutMs),
8344
- new Promise((resolve7) => setTimeout(resolve7, timeoutMs + 250).unref())
8407
+ new Promise((resolve9) => setTimeout(resolve9, timeoutMs + 250).unref())
8345
8408
  ]);
8346
8409
  } catch (err) {
8347
8410
  emitDebugError("shutdown failed", err);
@@ -8361,7 +8424,7 @@ async function markDisabled() {
8361
8424
  try {
8362
8425
  await Promise.race([
8363
8426
  client2.shutdown(SHORT_FLUSH_TIMEOUT_MS),
8364
- new Promise((resolve7) => setTimeout(resolve7, SHORT_FLUSH_TIMEOUT_MS).unref())
8427
+ new Promise((resolve9) => setTimeout(resolve9, SHORT_FLUSH_TIMEOUT_MS).unref())
8365
8428
  ]);
8366
8429
  } catch {
8367
8430
  }
@@ -8603,13 +8666,13 @@ function splitOptions(argv) {
8603
8666
  return { json, outPath, argvForFlags: rest };
8604
8667
  }
8605
8668
  async function readStdin() {
8606
- return new Promise((resolve7, reject) => {
8669
+ return new Promise((resolve9, reject) => {
8607
8670
  let data = "";
8608
8671
  process.stdin.setEncoding("utf8");
8609
8672
  process.stdin.on("data", (chunk) => {
8610
8673
  data += chunk;
8611
8674
  });
8612
- process.stdin.on("end", () => resolve7(data));
8675
+ process.stdin.on("end", () => resolve9(data));
8613
8676
  process.stdin.on("error", reject);
8614
8677
  });
8615
8678
  }
@@ -8641,7 +8704,7 @@ async function fetchImageToFile(result, outPath) {
8641
8704
  const res = await fetch(url);
8642
8705
  if (!res.ok) throw new Error(`Failed to download image: ${res.status} ${res.statusText}`);
8643
8706
  const buf = Buffer.from(await res.arrayBuffer());
8644
- fs8.mkdirSync(path10.dirname(path10.resolve(outPath)), { recursive: true });
8707
+ fs8.mkdirSync(path11.dirname(path11.resolve(outPath)), { recursive: true });
8645
8708
  fs8.writeFileSync(outPath, buf);
8646
8709
  }
8647
8710
  function renderResult(result, outputHint, images, json) {
@@ -8781,7 +8844,7 @@ Examples:
8781
8844
  if (outPath && meta.outputHint === "image") {
8782
8845
  try {
8783
8846
  if (images.length > 0) {
8784
- fs8.mkdirSync(path10.dirname(path10.resolve(outPath)), { recursive: true });
8847
+ fs8.mkdirSync(path11.dirname(path11.resolve(outPath)), { recursive: true });
8785
8848
  fs8.writeFileSync(outPath, images[0].data);
8786
8849
  } else if (result && typeof result === "object") {
8787
8850
  await fetchImageToFile(result, outPath);
@@ -8806,7 +8869,7 @@ Examples:
8806
8869
 
8807
8870
  // ../argent-cli/src/flow.ts
8808
8871
  import * as fsp from "node:fs/promises";
8809
- import * as path11 from "node:path";
8872
+ import * as path12 from "node:path";
8810
8873
  var STATUS_GLYPH = {
8811
8874
  pass: "\u2713",
8812
8875
  fail: "\u2717",
@@ -8938,12 +9001,12 @@ async function exportFailureArtifacts(report, outputDir, ctx) {
8938
9001
  if (!key || !SAFE_ARTIFACT_NAME.test(key)) continue;
8939
9002
  const { result } = await materializeArtifacts(s.artifacts, ctx);
8940
9003
  s.artifacts = result;
8941
- const dir = path11.join(outputDir, report.flow);
9004
+ const dir = path12.join(outputDir, report.flow);
8942
9005
  for (const [role, value] of Object.entries(s.artifacts)) {
8943
9006
  if (typeof value !== "string") continue;
8944
- const dest = path11.join(dir, `${key}-${role}.png`);
8945
- const rel = path11.relative(outputDir, dest);
8946
- if (rel.startsWith("..") || path11.isAbsolute(rel)) continue;
9007
+ const dest = path12.join(dir, `${key}-${role}.png`);
9008
+ const rel = path12.relative(outputDir, dest);
9009
+ if (rel.startsWith("..") || path12.isAbsolute(rel)) continue;
8947
9010
  try {
8948
9011
  await fsp.mkdir(dir, { recursive: true });
8949
9012
  await fsp.copyFile(value, dest);
@@ -8959,7 +9022,7 @@ async function exportFailureArtifacts(report, outputDir, ctx) {
8959
9022
  function keyFromBaselinePath(artifacts) {
8960
9023
  const baseline = artifacts.baseline;
8961
9024
  if (typeof baseline !== "string") return null;
8962
- return path11.basename(baseline).replace(/\.png$/, "");
9025
+ return path12.basename(baseline).replace(/\.png$/, "");
8963
9026
  }
8964
9027
  function resolveArtifactDisplayPaths(report) {
8965
9028
  for (const s of report.steps) {
@@ -8971,7 +9034,7 @@ function resolveArtifactDisplayPaths(report) {
8971
9034
  }
8972
9035
  function exitAfterFlush(code, streams = [process.stdout, process.stderr]) {
8973
9036
  return Promise.all(
8974
- streams.map((s) => new Promise((resolve7) => s.write("", () => resolve7())))
9037
+ streams.map((s) => new Promise((resolve9) => s.write("", () => resolve9())))
8975
9038
  ).then(() => process.exit(code));
8976
9039
  }
8977
9040
  function renderReport(report) {
@@ -9008,7 +9071,7 @@ async function flow(argv, options) {
9008
9071
  }
9009
9072
  const { callTool, baseUrl } = createToolsClient({ paths: options.paths });
9010
9073
  if (sub === "list") {
9011
- const dir = path11.join(process.cwd(), ".argent", "flows");
9074
+ const dir = path12.join(process.cwd(), ".argent", "flows");
9012
9075
  try {
9013
9076
  const entries = await fsp.readdir(dir);
9014
9077
  const names = entries.filter((f) => f.endsWith(".yaml")).map((f) => f.replace(/\.yaml$/, ""));
@@ -9087,7 +9150,7 @@ async function flow(argv, options) {
9087
9150
  }
9088
9151
  if (args.output) {
9089
9152
  const { url, token } = await baseUrl();
9090
- await exportFailureArtifacts(report, path11.resolve(args.output), {
9153
+ await exportFailureArtifacts(report, path12.resolve(args.output), {
9091
9154
  toolsUrl: url,
9092
9155
  authToken: token
9093
9156
  });
@@ -9185,11 +9248,11 @@ Options:
9185
9248
 
9186
9249
  // ../argent-cli/src/server.ts
9187
9250
  import * as fs9 from "node:fs";
9188
- import * as path12 from "node:path";
9251
+ import * as path13 from "node:path";
9189
9252
  import { homedir as homedir5, networkInterfaces } from "node:os";
9190
9253
  import { spawn as spawn3 } from "node:child_process";
9191
- var STATE_DIR2 = path12.join(homedir5(), ".argent");
9192
- var LOG_FILE2 = path12.join(STATE_DIR2, "tool-server.log");
9254
+ var STATE_DIR2 = path13.join(homedir5(), ".argent");
9255
+ var LOG_FILE2 = path13.join(STATE_DIR2, "tool-server.log");
9193
9256
  async function describeForeignServers(ownBundlePath) {
9194
9257
  const others = (await readAllToolsServerStates()).filter(
9195
9258
  ({ state: state2 }) => state2.bundlePath !== ownBundlePath && isToolsServerProcessAlive(state2.pid)
@@ -9598,7 +9661,7 @@ async function server(argv, options) {
9598
9661
  // ../argent-cli/src/lens.ts
9599
9662
  import * as fs10 from "node:fs";
9600
9663
  import * as os2 from "node:os";
9601
- import * as path13 from "node:path";
9664
+ import * as path14 from "node:path";
9602
9665
 
9603
9666
  // ../argent-cli/src/lens-terminal.ts
9604
9667
  import { execFileSync as execFileSync3 } from "node:child_process";
@@ -9856,7 +9919,7 @@ function ptyInjectBeats(text2) {
9856
9919
  ];
9857
9920
  }
9858
9921
  function sleep(ms) {
9859
- return new Promise((resolve7) => setTimeout(resolve7, ms));
9922
+ return new Promise((resolve9) => setTimeout(resolve9, ms));
9860
9923
  }
9861
9924
  var DEFAULT_COLS = 80;
9862
9925
  var DEFAULT_ROWS = 24;
@@ -10077,7 +10140,7 @@ var SPAWN_GRACE_MS = 8e3;
10077
10140
  var DEATH_CONFIRMATIONS = 3;
10078
10141
  var SSE_RECONNECT_MS = 1e3;
10079
10142
  function sleep2(ms) {
10080
- return new Promise((resolve7) => setTimeout(resolve7, ms));
10143
+ return new Promise((resolve9) => setTimeout(resolve9, ms));
10081
10144
  }
10082
10145
  var TRUST_PROMPT_RE = /trust this folder|do you trust|yes,? i trust|trust the files in this/i;
10083
10146
  async function dismissTrustPrompt(session) {
@@ -10350,7 +10413,7 @@ async function lens(argv, options) {
10350
10413
  await endSession(baseUrl);
10351
10414
  process.exit(1);
10352
10415
  }
10353
- const seedFile = path13.join(os2.tmpdir(), `argent-lens-seed-${process.pid}-${Date.now()}.txt`);
10416
+ const seedFile = path14.join(os2.tmpdir(), `argent-lens-seed-${process.pid}-${Date.now()}.txt`);
10354
10417
  fs10.writeFileSync(seedFile, buildSeedPrompt(), "utf8");
10355
10418
  const launchCmd = agent.launch(shellQuote(process.cwd()), shellQuote(seedFile));
10356
10419
  const removeSeedFile = () => {
@@ -10745,7 +10808,7 @@ Options:
10745
10808
 
10746
10809
  // ../argent-cli/src/config.ts
10747
10810
  var import_picocolors2 = __toESM(require_picocolors(), 1);
10748
- import * as path14 from "node:path";
10811
+ import * as path15 from "node:path";
10749
10812
  function config(argv) {
10750
10813
  if (argv.length === 0 || argv[0] === "--help" || argv[0] === "-h") {
10751
10814
  printUsage();
@@ -10928,16 +10991,16 @@ function wantsHelp(argv) {
10928
10991
  }
10929
10992
  function scopeLabel(scope) {
10930
10993
  if (scope === "global") return "global";
10931
- return `project: ${path14.dirname(configDir("project"))}`;
10994
+ return `project: ${path15.dirname(configDir("project"))}`;
10932
10995
  }
10933
10996
  function degenerateProjectScopeWarning(scope) {
10934
10997
  if (scope !== "project") return null;
10935
10998
  const projDir = configDir("project");
10936
- if (path14.resolve(projDir) === path14.resolve(configDir("global"))) {
10937
- return `WARNING: no project found between ${process.cwd()} and your home directory \u2014 "project" scope resolved to the home directory, so this writes the GLOBAL config file (${path14.join(projDir, "config.json")}).`;
10999
+ if (path15.resolve(projDir) === path15.resolve(configDir("global"))) {
11000
+ return `WARNING: no project found between ${process.cwd()} and your home directory \u2014 "project" scope resolved to the home directory, so this writes the GLOBAL config file (${path15.join(projDir, "config.json")}).`;
10938
11001
  }
10939
11002
  if (findProjectRoot(process.cwd()) === null) {
10940
- return `WARNING: no project markers (.argent, .git, package.json) found above ${process.cwd()} \u2014 treating it as the project root and creating ${path14.join(projDir, "config.json")}.`;
11003
+ return `WARNING: no project markers (.argent, .git, package.json) found above ${process.cwd()} \u2014 treating it as the project root and creating ${path15.join(projDir, "config.json")}.`;
10941
11004
  }
10942
11005
  return null;
10943
11006
  }