@swmansion/argent 0.35.1-next.80 → 0.35.1-next.82

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli-cmds.mjs CHANGED
@@ -7320,14 +7320,14 @@ var require_parser = __commonJS({
7320
7320
  case "scalar":
7321
7321
  case "single-quoted-scalar":
7322
7322
  case "double-quoted-scalar": {
7323
- const fs36 = this.flowScalar(this.type);
7323
+ const fs37 = this.flowScalar(this.type);
7324
7324
  if (atNextItem || it.value) {
7325
- map2.items.push({ start, key: fs36, sep: [] });
7325
+ map2.items.push({ start, key: fs37, sep: [] });
7326
7326
  this.onKeyLine = true;
7327
7327
  } else if (it.sep) {
7328
- this.stack.push(fs36);
7328
+ this.stack.push(fs37);
7329
7329
  } else {
7330
- Object.assign(it, { key: fs36, sep: [] });
7330
+ Object.assign(it, { key: fs37, sep: [] });
7331
7331
  this.onKeyLine = true;
7332
7332
  }
7333
7333
  return;
@@ -7455,13 +7455,13 @@ var require_parser = __commonJS({
7455
7455
  case "scalar":
7456
7456
  case "single-quoted-scalar":
7457
7457
  case "double-quoted-scalar": {
7458
- const fs36 = this.flowScalar(this.type);
7458
+ const fs37 = this.flowScalar(this.type);
7459
7459
  if (!it || it.value)
7460
- fc.items.push({ start: [], key: fs36, sep: [] });
7460
+ fc.items.push({ start: [], key: fs37, sep: [] });
7461
7461
  else if (it.sep)
7462
- this.stack.push(fs36);
7462
+ this.stack.push(fs37);
7463
7463
  else
7464
- Object.assign(it, { key: fs36, sep: [] });
7464
+ Object.assign(it, { key: fs37, sep: [] });
7465
7465
  return;
7466
7466
  }
7467
7467
  case "flow-map-end":
@@ -9765,10 +9765,10 @@ var require_truncate = __commonJS({
9765
9765
  "../../node_modules/semver/functions/truncate.js"(exports, module) {
9766
9766
  "use strict";
9767
9767
  var parse8 = require_parse();
9768
- var constants7 = require_constants();
9768
+ var constants8 = require_constants();
9769
9769
  var SemVer = require_semver();
9770
9770
  var truncate = (version2, truncation, options) => {
9771
- if (!constants7.RELEASE_TYPES.includes(truncation)) {
9771
+ if (!constants8.RELEASE_TYPES.includes(truncation)) {
9772
9772
  return null;
9773
9773
  }
9774
9774
  const clonedVersion = cloneInputVersion(version2, options);
@@ -10817,7 +10817,7 @@ var require_semver2 = __commonJS({
10817
10817
  "../../node_modules/semver/index.js"(exports, module) {
10818
10818
  "use strict";
10819
10819
  var internalRe = require_re();
10820
- var constants7 = require_constants();
10820
+ var constants8 = require_constants();
10821
10821
  var SemVer = require_semver();
10822
10822
  var identifiers = require_identifiers();
10823
10823
  var parse8 = require_parse();
@@ -10901,8 +10901,8 @@ var require_semver2 = __commonJS({
10901
10901
  re: internalRe.re,
10902
10902
  src: internalRe.src,
10903
10903
  tokens: internalRe.t,
10904
- SEMVER_SPEC_VERSION: constants7.SEMVER_SPEC_VERSION,
10905
- RELEASE_TYPES: constants7.RELEASE_TYPES,
10904
+ SEMVER_SPEC_VERSION: constants8.SEMVER_SPEC_VERSION,
10905
+ RELEASE_TYPES: constants8.RELEASE_TYPES,
10906
10906
  compareIdentifiers: identifiers.compareIdentifiers,
10907
10907
  rcompareIdentifiers: identifiers.rcompareIdentifiers
10908
10908
  };
@@ -11193,21 +11193,21 @@ var require_dist3 = __commonJS({
11193
11193
  });
11194
11194
 
11195
11195
  // ../argent-cli/src/run.ts
11196
- import * as fs15 from "node:fs";
11196
+ import * as fs16 from "node:fs";
11197
11197
  import * as path22 from "node:path";
11198
11198
 
11199
11199
  // ../argent-tools-client/src/launcher.ts
11200
11200
  import * as net from "node:net";
11201
11201
  import * as os3 from "node:os";
11202
- import * as fs7 from "node:fs";
11202
+ import * as fs8 from "node:fs";
11203
11203
  import * as path8 from "node:path";
11204
11204
  import * as readline from "node:readline";
11205
11205
  import { spawn, execFileSync } from "node:child_process";
11206
- import { createHash, randomBytes } from "node:crypto";
11206
+ import { createHash, randomBytes as randomBytes2 } from "node:crypto";
11207
11207
  import { readFile, readdir, unlink } from "node:fs/promises";
11208
11208
 
11209
11209
  // ../configuration-core/src/flags.ts
11210
- import * as fs from "node:fs";
11210
+ import * as fs2 from "node:fs";
11211
11211
  import * as path2 from "node:path";
11212
11212
 
11213
11213
  // ../configuration-core/src/home.ts
@@ -11228,6 +11228,43 @@ function argentHomeDir(options = {}) {
11228
11228
  return override ? path.resolve(override.trim()) : path.join(resolveHomeDir(options), ".argent");
11229
11229
  }
11230
11230
 
11231
+ // ../configuration-core/src/write-file.ts
11232
+ import * as fs from "node:fs";
11233
+ import { randomBytes } from "node:crypto";
11234
+ function writeFileAtomicSync(file2, data, mode = 438) {
11235
+ const tmp = `${file2}.${randomBytes(8).toString("hex")}.tmp`;
11236
+ try {
11237
+ fs.writeFileSync(tmp, data, { flag: "wx", mode });
11238
+ fs.renameSync(tmp, file2);
11239
+ } catch (err) {
11240
+ fs.rmSync(tmp, { force: true });
11241
+ if (err.code !== "EBUSY" || !writeOwnFileInPlace(file2, data, mode)) {
11242
+ throw err;
11243
+ }
11244
+ }
11245
+ }
11246
+ var IN_PLACE_FLAGS = fs.constants.O_WRONLY | fs.constants.O_NOFOLLOW | fs.constants.O_NONBLOCK;
11247
+ function writeOwnFileInPlace(file2, data, mode) {
11248
+ const uid = process.getuid?.();
11249
+ if (uid === void 0) return false;
11250
+ let fd;
11251
+ try {
11252
+ fd = fs.openSync(file2, IN_PLACE_FLAGS);
11253
+ } catch {
11254
+ return false;
11255
+ }
11256
+ try {
11257
+ const stat7 = fs.fstatSync(fd);
11258
+ if (!stat7.isFile() || stat7.uid !== uid && uid !== 0) return false;
11259
+ fs.fchmodSync(fd, stat7.mode & mode & 511);
11260
+ fs.ftruncateSync(fd);
11261
+ fs.writeFileSync(fd, data);
11262
+ return true;
11263
+ } finally {
11264
+ fs.closeSync(fd);
11265
+ }
11266
+ }
11267
+
11231
11268
  // ../configuration-core/src/flags.ts
11232
11269
  var FLAG_REGISTRY = [
11233
11270
  {
@@ -11295,7 +11332,7 @@ function findProjectRoot(startDir) {
11295
11332
  let current = path2.resolve(startDir);
11296
11333
  while (true) {
11297
11334
  for (const marker of PROJECT_MARKERS) {
11298
- if (fs.existsSync(path2.join(current, marker))) return current;
11335
+ if (fs2.existsSync(path2.join(current, marker))) return current;
11299
11336
  }
11300
11337
  const parent = path2.dirname(current);
11301
11338
  if (parent === current) return null;
@@ -11315,7 +11352,7 @@ function getFlagsPath(scope, options = {}) {
11315
11352
  function readFlagsFile(filePath) {
11316
11353
  let raw;
11317
11354
  try {
11318
- raw = fs.readFileSync(filePath, "utf8");
11355
+ raw = fs2.readFileSync(filePath, "utf8");
11319
11356
  } catch {
11320
11357
  return {};
11321
11358
  }
@@ -11336,20 +11373,18 @@ function readFlagsFile(filePath) {
11336
11373
  }
11337
11374
  function writeFlagsFile(filePath, flags2) {
11338
11375
  if (Object.keys(flags2).length === 0) {
11339
- if (fs.existsSync(filePath)) fs.rmSync(filePath, { force: true });
11376
+ if (fs2.existsSync(filePath)) fs2.rmSync(filePath, { force: true });
11340
11377
  const parent = path2.dirname(filePath);
11341
11378
  try {
11342
- if (fs.existsSync(parent) && fs.readdirSync(parent).length === 0) {
11343
- fs.rmdirSync(parent);
11379
+ if (fs2.existsSync(parent) && fs2.readdirSync(parent).length === 0) {
11380
+ fs2.rmdirSync(parent);
11344
11381
  }
11345
11382
  } catch {
11346
11383
  }
11347
11384
  return;
11348
11385
  }
11349
- fs.mkdirSync(path2.dirname(filePath), { recursive: true });
11350
- const tmp = `${filePath}.${process.pid}.tmp`;
11351
- fs.writeFileSync(tmp, JSON.stringify({ flags: flags2 }, null, 2) + "\n");
11352
- fs.renameSync(tmp, filePath);
11386
+ fs2.mkdirSync(path2.dirname(filePath), { recursive: true });
11387
+ writeFileAtomicSync(filePath, JSON.stringify({ flags: flags2 }, null, 2) + "\n");
11353
11388
  }
11354
11389
  function readFlags(scope, options = {}) {
11355
11390
  return readFlagsFile(getFlagsPath(scope, options));
@@ -11383,14 +11418,14 @@ function isFeatureEnabled(name, options = {}, registry2 = FLAG_REGISTRY) {
11383
11418
  }
11384
11419
 
11385
11420
  // ../configuration-core/src/paths.ts
11386
- import * as fs2 from "node:fs";
11421
+ import * as fs3 from "node:fs";
11387
11422
  import * as path3 from "node:path";
11388
11423
  function isHomeDir(dir, options = {}) {
11389
11424
  return canonicalPath(dir) === canonicalPath(resolveHomeDir(options));
11390
11425
  }
11391
11426
  function canonicalPath(p) {
11392
11427
  try {
11393
- return fs2.realpathSync.native(p);
11428
+ return fs3.realpathSync.native(p);
11394
11429
  } catch {
11395
11430
  return path3.resolve(p);
11396
11431
  }
@@ -11406,11 +11441,11 @@ function configFilePath(scope = "global", options = {}) {
11406
11441
 
11407
11442
  // ../configuration-core/src/config.ts
11408
11443
  import * as crypto from "node:crypto";
11409
- import * as fs3 from "node:fs";
11444
+ import * as fs4 from "node:fs";
11410
11445
  import * as path4 from "node:path";
11411
11446
  function readConfigObject(scope = "global", options = {}) {
11412
11447
  try {
11413
- const raw = fs3.readFileSync(configFilePath(scope, options), "utf8");
11448
+ const raw = fs4.readFileSync(configFilePath(scope, options), "utf8");
11414
11449
  const json2 = JSON.parse(raw);
11415
11450
  if (json2 && typeof json2 === "object" && !Array.isArray(json2)) {
11416
11451
  return json2;
@@ -11486,9 +11521,9 @@ function acquireConfigLock(finalPath) {
11486
11521
  const deadline = Date.now() + LOCK_MAX_WAIT_MS;
11487
11522
  for (; ; ) {
11488
11523
  try {
11489
- const fd = fs3.openSync(lockPath, "wx", 384);
11524
+ const fd = fs4.openSync(lockPath, "wx", 384);
11490
11525
  try {
11491
- fs3.writeSync(fd, `${process.pid}
11526
+ fs4.writeSync(fd, `${process.pid}
11492
11527
  `);
11493
11528
  } catch {
11494
11529
  }
@@ -11496,8 +11531,8 @@ function acquireConfigLock(finalPath) {
11496
11531
  } catch (err) {
11497
11532
  if (err.code !== "EEXIST") return null;
11498
11533
  try {
11499
- if (Date.now() - fs3.statSync(lockPath).mtimeMs > LOCK_STALE_MS) {
11500
- fs3.unlinkSync(lockPath);
11534
+ if (Date.now() - fs4.statSync(lockPath).mtimeMs > LOCK_STALE_MS) {
11535
+ fs4.unlinkSync(lockPath);
11501
11536
  continue;
11502
11537
  }
11503
11538
  } catch {
@@ -11509,35 +11544,35 @@ function acquireConfigLock(finalPath) {
11509
11544
  }
11510
11545
  function releaseConfigLock(lock) {
11511
11546
  try {
11512
- fs3.closeSync(lock.fd);
11547
+ fs4.closeSync(lock.fd);
11513
11548
  } catch {
11514
11549
  }
11515
11550
  try {
11516
- fs3.unlinkSync(lock.lockPath);
11551
+ fs4.unlinkSync(lock.lockPath);
11517
11552
  } catch {
11518
11553
  }
11519
11554
  }
11520
11555
  function updateConfig(mutate, scope = "global", options = {}) {
11521
11556
  const dir = configDir(scope, options);
11522
- fs3.mkdirSync(dir, { recursive: true });
11557
+ fs4.mkdirSync(dir, { recursive: true });
11523
11558
  const finalPath = configFilePath(scope, options);
11524
11559
  const lock = acquireConfigLock(finalPath);
11525
11560
  try {
11526
11561
  const next = readConfigObject(scope, options);
11527
11562
  mutate(next);
11528
11563
  const tmpPath = path4.join(dir, `.config.tmp.${process.pid}.${crypto.randomUUID()}`);
11529
- const fd = fs3.openSync(tmpPath, "wx", 384);
11564
+ const fd = fs4.openSync(tmpPath, "wx", 384);
11530
11565
  try {
11531
- fs3.writeSync(fd, JSON.stringify(next, null, 2) + "\n");
11532
- fs3.fsyncSync(fd);
11566
+ fs4.writeSync(fd, JSON.stringify(next, null, 2) + "\n");
11567
+ fs4.fsyncSync(fd);
11533
11568
  } finally {
11534
- fs3.closeSync(fd);
11569
+ fs4.closeSync(fd);
11535
11570
  }
11536
11571
  try {
11537
- fs3.renameSync(tmpPath, finalPath);
11572
+ fs4.renameSync(tmpPath, finalPath);
11538
11573
  } catch (err) {
11539
11574
  try {
11540
- fs3.unlinkSync(tmpPath);
11575
+ fs4.unlinkSync(tmpPath);
11541
11576
  } catch {
11542
11577
  }
11543
11578
  throw err;
@@ -11549,7 +11584,7 @@ function updateConfig(mutate, scope = "global", options = {}) {
11549
11584
 
11550
11585
  // ../configuration-core/src/secrets.ts
11551
11586
  var import_dotenv = __toESM(require_dist(), 1);
11552
- import * as fs4 from "node:fs";
11587
+ import * as fs5 from "node:fs";
11553
11588
  import * as path5 from "node:path";
11554
11589
  var SECRET_ENV_PREFIX = "ARGENT_SECRET_";
11555
11590
  var SECRETS_FILE_NAME = "secrets.env";
@@ -11579,10 +11614,10 @@ function fileSource(filePath, exposure) {
11579
11614
  names: [],
11580
11615
  values: /* @__PURE__ */ new Map()
11581
11616
  };
11582
- if (!fs4.statSync(filePath, { throwIfNoEntry: false })) return absent;
11617
+ if (!fs5.statSync(filePath, { throwIfNoEntry: false })) return absent;
11583
11618
  let content;
11584
11619
  try {
11585
- content = fs4.readFileSync(filePath, "utf8");
11620
+ content = fs5.readFileSync(filePath, "utf8");
11586
11621
  } catch {
11587
11622
  return absent;
11588
11623
  }
@@ -11592,7 +11627,7 @@ function secretsFileSource(filePath) {
11592
11627
  const resolved = path5.resolve(filePath);
11593
11628
  let content;
11594
11629
  try {
11595
- content = fs4.readFileSync(resolved, "utf8");
11630
+ content = fs5.readFileSync(resolved, "utf8");
11596
11631
  } catch (err) {
11597
11632
  const code = err.code;
11598
11633
  const reason = code === "ENOENT" ? "no such file" : code === "EISDIR" ? "it is a directory" : code === "EACCES" ? "permission denied" : err instanceof Error ? err.message : String(err);
@@ -11892,7 +11927,7 @@ function getConfigDefinition(key, registry2 = CONFIG_SCHEMA) {
11892
11927
  }
11893
11928
 
11894
11929
  // ../configuration-core/src/config-access.ts
11895
- import * as fs5 from "node:fs";
11930
+ import * as fs6 from "node:fs";
11896
11931
  import * as path6 from "node:path";
11897
11932
  function readScopeValue(def, scope, options) {
11898
11933
  if (!def.scopes.includes(scope)) return void 0;
@@ -12026,7 +12061,7 @@ function clearRememberedAgent(options = {}) {
12026
12061
  }
12027
12062
 
12028
12063
  // ../configuration-core/src/cloud-android.ts
12029
- import * as fs6 from "node:fs";
12064
+ import * as fs7 from "node:fs";
12030
12065
  import * as os2 from "node:os";
12031
12066
  import * as path7 from "node:path";
12032
12067
  var CLOUD_URL_ENV = "ARGENT_CLOUD_URL";
@@ -12078,8 +12113,8 @@ function untrusted(dir) {
12078
12113
  let stat7;
12079
12114
  let parent;
12080
12115
  try {
12081
- stat7 = fs6.lstatSync(dir);
12082
- parent = fs6.statSync(path7.dirname(dir));
12116
+ stat7 = fs7.lstatSync(dir);
12117
+ parent = fs7.statSync(path7.dirname(dir));
12083
12118
  } catch {
12084
12119
  return "it cannot be read";
12085
12120
  }
@@ -12098,14 +12133,14 @@ function trustedCloudAndroidMarkersDir() {
12098
12133
  var CLOUD_ANDROID_MARKER_TTL_MS = 2 * 6e4;
12099
12134
  function readCloudAndroidMarker(file2) {
12100
12135
  try {
12101
- const raw = JSON.parse(fs6.readFileSync(file2, "utf8"));
12136
+ const raw = JSON.parse(fs7.readFileSync(file2, "utf8"));
12102
12137
  if (typeof raw.pid !== "number" || typeof raw.lease !== "string") return null;
12103
12138
  if (typeof raw.serial !== "string") return null;
12104
12139
  return {
12105
12140
  serial: raw.serial,
12106
12141
  pid: raw.pid,
12107
12142
  lease: raw.lease,
12108
- refreshedAt: fs6.statSync(file2).mtimeMs
12143
+ refreshedAt: fs7.statSync(file2).mtimeMs
12109
12144
  };
12110
12145
  } catch {
12111
12146
  return null;
@@ -12115,7 +12150,7 @@ function readCloudAndroidMarkers(dir = trustedCloudAndroidMarkersDir()) {
12115
12150
  if (!dir) return [];
12116
12151
  let names;
12117
12152
  try {
12118
- names = fs6.readdirSync(dir);
12153
+ names = fs7.readdirSync(dir);
12119
12154
  } catch {
12120
12155
  return [];
12121
12156
  }
@@ -12185,7 +12220,7 @@ function buildToolsServerEnv(paths, port, baseEnv = process.env, options = {}) {
12185
12220
  return env;
12186
12221
  }
12187
12222
  function generateToken() {
12188
- return randomBytes(AUTH_TOKEN_BYTES).toString("hex");
12223
+ return randomBytes2(AUTH_TOKEN_BYTES).toString("hex");
12189
12224
  }
12190
12225
  function generateAuthToken() {
12191
12226
  return generateToken();
@@ -12244,7 +12279,7 @@ function isVersionNewer(a2, b) {
12244
12279
  function readBundlePackageVersion(bundlePath) {
12245
12280
  try {
12246
12281
  const pkg = JSON.parse(
12247
- fs7.readFileSync(path8.join(path8.dirname(bundlePath), "..", "package.json"), "utf8")
12282
+ fs8.readFileSync(path8.join(path8.dirname(bundlePath), "..", "package.json"), "utf8")
12248
12283
  );
12249
12284
  return typeof pkg.version === "string" ? pkg.version : void 0;
12250
12285
  } catch {
@@ -12304,7 +12339,7 @@ function killSpawnedChild(child, pid) {
12304
12339
  }
12305
12340
  function resolveToolsServerNode() {
12306
12341
  const { bun, deno, electron } = process.versions;
12307
- return !(bun || deno || electron) && fs7.existsSync(process.execPath) ? process.execPath : "node";
12342
+ return !(bun || deno || electron) && fs8.existsSync(process.execPath) ? process.execPath : "node";
12308
12343
  }
12309
12344
  function parseListeningPort(line) {
12310
12345
  const match = line.match(/Tools server listening on http:\/\/.+:(\d+)/);
@@ -12314,10 +12349,10 @@ function spawnToolsServer(paths, port, options = {}) {
12314
12349
  return new Promise((resolve26, reject) => {
12315
12350
  let logFd;
12316
12351
  try {
12317
- fs7.mkdirSync(STATE_DIR, { recursive: true });
12318
- logFd = fs7.openSync(LOG_FILE, "a");
12352
+ fs8.mkdirSync(STATE_DIR, { recursive: true });
12353
+ logFd = fs8.openSync(LOG_FILE, "a");
12319
12354
  } catch {
12320
- logFd = fs7.openSync("/dev/null", "w");
12355
+ logFd = fs8.openSync("/dev/null", "w");
12321
12356
  }
12322
12357
  const nodeBin = resolveToolsServerNode();
12323
12358
  const child = spawn(nodeBin, [paths.bundlePath, "start"], {
@@ -12325,7 +12360,7 @@ function spawnToolsServer(paths, port, options = {}) {
12325
12360
  stdio: ["ignore", "pipe", logFd],
12326
12361
  env: buildToolsServerEnv(paths, port, process.env, options)
12327
12362
  });
12328
- fs7.closeSync(logFd);
12363
+ fs8.closeSync(logFd);
12329
12364
  const pid = child.pid;
12330
12365
  if (!pid) {
12331
12366
  child.once(
@@ -12410,19 +12445,19 @@ var UnsafeArgentHomeError = class extends Error {
12410
12445
  };
12411
12446
  function statHome() {
12412
12447
  try {
12413
- fs7.mkdirSync(path8.dirname(STATE_DIR), { recursive: true });
12414
- fs7.mkdirSync(STATE_DIR, { mode: 448 });
12448
+ fs8.mkdirSync(path8.dirname(STATE_DIR), { recursive: true });
12449
+ fs8.mkdirSync(STATE_DIR, { mode: 448 });
12415
12450
  } catch {
12416
12451
  }
12417
12452
  try {
12418
- return fs7.statSync(STATE_DIR);
12453
+ return fs8.statSync(STATE_DIR);
12419
12454
  } catch {
12420
12455
  return null;
12421
12456
  }
12422
12457
  }
12423
12458
  function isWritable(dir) {
12424
12459
  try {
12425
- fs7.accessSync(dir, fs7.constants.W_OK);
12460
+ fs8.accessSync(dir, fs8.constants.W_OK);
12426
12461
  return true;
12427
12462
  } catch {
12428
12463
  return false;
@@ -12450,16 +12485,12 @@ async function writeToolsServerState(state2) {
12450
12485
  writeToolsServerStateSync(state2);
12451
12486
  }
12452
12487
  function writeToolsServerStateSync(state2) {
12453
- const target = stateFileForBundle(state2.bundlePath, state2.cloudProfile);
12454
- fs7.mkdirSync(STATE_DIR, { recursive: true });
12455
- const tmp = `${target}.${randomBytes(8).toString("hex")}.tmp`;
12456
- try {
12457
- fs7.writeFileSync(tmp, JSON.stringify(state2, null, 2) + "\n", { flag: "wx", mode: 384 });
12458
- fs7.renameSync(tmp, target);
12459
- } catch (err) {
12460
- fs7.rmSync(tmp, { force: true });
12461
- throw err;
12462
- }
12488
+ fs8.mkdirSync(STATE_DIR, { recursive: true });
12489
+ writeFileAtomicSync(
12490
+ stateFileForBundle(state2.bundlePath, state2.cloudProfile),
12491
+ JSON.stringify(state2, null, 2) + "\n",
12492
+ 384
12493
+ );
12463
12494
  }
12464
12495
  async function clearToolsServerState(bundlePath, cloudProfile) {
12465
12496
  const files = [STATE_FILE];
@@ -12504,7 +12535,7 @@ async function sweepDeadStateFiles() {
12504
12535
  });
12505
12536
  continue;
12506
12537
  }
12507
- if (fs7.existsSync(fresh.bundlePath)) continue;
12538
+ if (fs8.existsSync(fresh.bundlePath)) continue;
12508
12539
  if (!couldBeOurToolServer(fresh.pid, fresh.bundlePath)) continue;
12509
12540
  await unlink(file2).catch(() => {
12510
12541
  });
@@ -12560,7 +12591,7 @@ async function otherToolServersOfBundle(bundlePath, cloudProfile) {
12560
12591
  (state2) => state2.bundlePath === bundlePath && state2.cloudProfile !== cloudProfile && isProcessAlive(state2.pid)
12561
12592
  );
12562
12593
  }
12563
- var PS_BIN = ["/bin/ps", "/usr/bin/ps"].find((p) => fs7.existsSync(p)) ?? "ps";
12594
+ var PS_BIN = ["/bin/ps", "/usr/bin/ps"].find((p) => fs8.existsSync(p)) ?? "ps";
12564
12595
  var PS_WIDTH_FLAGS = ["-ww"];
12565
12596
  var PS_LOCALE = process.platform === "darwin" ? "en_US.UTF-8" : "C.UTF-8";
12566
12597
  function readProcessCommandLine(pid, flags2 = PS_WIDTH_FLAGS, env = { ...process.env, LC_ALL: PS_LOCALE }) {
@@ -12607,13 +12638,13 @@ var LOCK_STALE_MS2 = 45e3;
12607
12638
  var LOCK_POLL_MS = 100;
12608
12639
  function spawnLockIsStale() {
12609
12640
  try {
12610
- const { pid, ts } = JSON.parse(fs7.readFileSync(LOCK_FILE, "utf8"));
12641
+ const { pid, ts } = JSON.parse(fs8.readFileSync(LOCK_FILE, "utf8"));
12611
12642
  if (typeof pid === "number" && pid > 0 && !isProcessAlive(pid)) return true;
12612
12643
  if (typeof ts === "number" && Date.now() - ts > LOCK_STALE_MS2) return true;
12613
12644
  return false;
12614
12645
  } catch {
12615
12646
  try {
12616
- return Date.now() - fs7.statSync(LOCK_FILE).mtimeMs > LOCK_STALE_MS2;
12647
+ return Date.now() - fs8.statSync(LOCK_FILE).mtimeMs > LOCK_STALE_MS2;
12617
12648
  } catch {
12618
12649
  return true;
12619
12650
  }
@@ -12621,19 +12652,19 @@ function spawnLockIsStale() {
12621
12652
  }
12622
12653
  async function acquireSpawnLock() {
12623
12654
  try {
12624
- fs7.mkdirSync(STATE_DIR, { recursive: true });
12655
+ fs8.mkdirSync(STATE_DIR, { recursive: true });
12625
12656
  } catch {
12626
12657
  return null;
12627
12658
  }
12628
- const nonce = randomBytes(8).toString("hex");
12659
+ const nonce = randomBytes2(8).toString("hex");
12629
12660
  const deadline = Date.now() + LOCK_WAIT_TIMEOUT_MS;
12630
12661
  for (; ; ) {
12631
12662
  try {
12632
- const fd = fs7.openSync(LOCK_FILE, "wx");
12663
+ const fd = fs8.openSync(LOCK_FILE, "wx");
12633
12664
  try {
12634
- fs7.writeSync(fd, JSON.stringify({ pid: process.pid, nonce, ts: Date.now() }));
12665
+ fs8.writeSync(fd, JSON.stringify({ pid: process.pid, nonce, ts: Date.now() }));
12635
12666
  } finally {
12636
- fs7.closeSync(fd);
12667
+ fs8.closeSync(fd);
12637
12668
  }
12638
12669
  let released = false;
12639
12670
  return {
@@ -12641,8 +12672,8 @@ async function acquireSpawnLock() {
12641
12672
  if (released) return;
12642
12673
  released = true;
12643
12674
  try {
12644
- const cur = JSON.parse(fs7.readFileSync(LOCK_FILE, "utf8"));
12645
- if (cur.pid === process.pid && cur.nonce === nonce) fs7.unlinkSync(LOCK_FILE);
12675
+ const cur = JSON.parse(fs8.readFileSync(LOCK_FILE, "utf8"));
12676
+ if (cur.pid === process.pid && cur.nonce === nonce) fs8.unlinkSync(LOCK_FILE);
12646
12677
  } catch {
12647
12678
  }
12648
12679
  }
@@ -12651,10 +12682,10 @@ async function acquireSpawnLock() {
12651
12682
  if (err.code !== "EEXIST") return null;
12652
12683
  if (spawnLockIsStale()) {
12653
12684
  try {
12654
- fs7.unlinkSync(LOCK_FILE);
12685
+ fs8.unlinkSync(LOCK_FILE);
12655
12686
  } catch {
12656
12687
  }
12657
- if (!fs7.existsSync(LOCK_FILE)) continue;
12688
+ if (!fs8.existsSync(LOCK_FILE)) continue;
12658
12689
  }
12659
12690
  if (Date.now() >= deadline) return null;
12660
12691
  await new Promise((r2) => setTimeout(r2, LOCK_POLL_MS));
@@ -12695,7 +12726,7 @@ async function ensureToolsServer(paths, env = process.env) {
12695
12726
  }
12696
12727
  await clearToolsServerState(paths.bundlePath, cloudProfile);
12697
12728
  await sweepDeadStateFiles();
12698
- if (!fs7.existsSync(paths.bundlePath)) {
12729
+ if (!fs8.existsSync(paths.bundlePath)) {
12699
12730
  throw new Error(
12700
12731
  `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.`
12701
12732
  );
@@ -12802,11 +12833,11 @@ var LAUNCH_PLATFORMS = ["ios", "android", "chromium", "vega", "macos"];
12802
12833
  var SELECTABLE_PLATFORMS = [...LAUNCH_PLATFORMS, "ios-remote"];
12803
12834
 
12804
12835
  // ../registry/src/flow-file-refs.ts
12805
- import * as fs9 from "node:fs/promises";
12836
+ import * as fs10 from "node:fs/promises";
12806
12837
  import * as path10 from "node:path";
12807
12838
 
12808
12839
  // ../registry/src/e2e-dirs.ts
12809
- import * as fs8 from "node:fs/promises";
12840
+ import * as fs9 from "node:fs/promises";
12810
12841
  import * as path9 from "node:path";
12811
12842
  var E2E_DIR = path9.join(".argent", "e2e");
12812
12843
  var LEGACY_E2E_DIRS = Object.freeze([path9.join(".argent", "flows")]);
@@ -12821,7 +12852,7 @@ function e2eFileCandidates(projectRoot, name) {
12821
12852
  return e2eDirsFor(projectRoot).map((dir) => path9.join(dir, `${name}.yaml`));
12822
12853
  }
12823
12854
  async function exists(file2) {
12824
- return fs8.stat(file2).then(
12855
+ return fs9.stat(file2).then(
12825
12856
  () => true,
12826
12857
  () => false
12827
12858
  );
@@ -12915,10 +12946,10 @@ function canonicalToolArgs(tool, args) {
12915
12946
  // ../registry/src/flow-file-refs.ts
12916
12947
  async function canonicalFlowPath(p) {
12917
12948
  try {
12918
- return await fs9.realpath(p);
12949
+ return await fs10.realpath(p);
12919
12950
  } catch {
12920
12951
  try {
12921
- return path10.join(await fs9.realpath(path10.dirname(p)), path10.basename(p));
12952
+ return path10.join(await fs10.realpath(path10.dirname(p)), path10.basename(p));
12922
12953
  } catch {
12923
12954
  return p;
12924
12955
  }
@@ -12978,7 +13009,7 @@ function flowMemberKey(anchorDir, target) {
12978
13009
  return `${anchorDir}\0${target}`;
12979
13010
  }
12980
13011
  async function classifyOnDiskSpelling(dir, base, addressable = FLOW_FILE_NAME_PATTERN) {
12981
- const entries = await fs9.readdir(dir).catch(() => null);
13012
+ const entries = await fs10.readdir(dir).catch(() => null);
12982
13013
  if (entries === null || entries.includes(base)) return { state: "listed" };
12983
13014
  const actual = entries.find((entry) => entry.toLowerCase() === base.toLowerCase());
12984
13015
  if (actual === void 0) return { state: "absent" };
@@ -33313,7 +33344,7 @@ function describeParamIssues(error63, params) {
33313
33344
 
33314
33345
  // ../argent-tools-client/src/link-config.ts
33315
33346
  import * as path11 from "node:path";
33316
- import { mkdir, writeFile, readFile as readFile2, unlink as unlink2, chmod } from "node:fs/promises";
33347
+ import { mkdir, readFile as readFile2, unlink as unlink2 } from "node:fs/promises";
33317
33348
  var LINK_DIR = argentHomeDir();
33318
33349
  var LINK_FILE = path11.join(LINK_DIR, "link.json");
33319
33350
  async function readLinkConfig() {
@@ -33336,11 +33367,7 @@ async function readLinkConfig() {
33336
33367
  }
33337
33368
  async function writeLinkConfig(cfg) {
33338
33369
  await mkdir(LINK_DIR, { recursive: true });
33339
- await writeFile(LINK_FILE, JSON.stringify(cfg, null, 2) + "\n", {
33340
- encoding: "utf8",
33341
- mode: 384
33342
- });
33343
- await chmod(LINK_FILE, 384);
33370
+ writeFileAtomicSync(LINK_FILE, JSON.stringify(cfg, null, 2) + "\n", 384);
33344
33371
  }
33345
33372
  async function clearLinkConfig() {
33346
33373
  try {
@@ -33423,7 +33450,7 @@ function parseLinkTarget(input2) {
33423
33450
  import { createHash as createHash2, randomUUID as randomUUID4 } from "node:crypto";
33424
33451
  import { createReadStream as createReadStream2, rmSync as rmSync3 } from "node:fs";
33425
33452
  import {
33426
- chmod as chmod2,
33453
+ chmod,
33427
33454
  lstat,
33428
33455
  mkdir as mkdir2,
33429
33456
  readFile as readFile3,
@@ -33431,9 +33458,9 @@ import {
33431
33458
  rename,
33432
33459
  rm as rm2,
33433
33460
  stat as stat3,
33434
- writeFile as writeFile2
33461
+ writeFile
33435
33462
  } from "node:fs/promises";
33436
- import { constants as constants2, tmpdir } from "node:os";
33463
+ import { constants as constants3, tmpdir } from "node:os";
33437
33464
  import * as path12 from "node:path";
33438
33465
 
33439
33466
  // ../archive/src/index.ts
@@ -33811,7 +33838,7 @@ function removeArchivesOnSignal(signal) {
33811
33838
  try {
33812
33839
  process.kill(process.pid, signal);
33813
33840
  } catch {
33814
- process.exit(128 + constants2.signals[signal]);
33841
+ process.exit(128 + constants3.signals[signal]);
33815
33842
  }
33816
33843
  }
33817
33844
  function trackArchive(archive) {
@@ -33986,8 +34013,8 @@ function isClientFileDirective2(value) {
33986
34013
  async function replaceFile(target, bytes, mode) {
33987
34014
  const temp = path12.join(path12.dirname(target), `.baseline-${randomUUID4()}.tmp`);
33988
34015
  try {
33989
- await writeFile2(temp, bytes, { flag: "wx" });
33990
- if (mode !== void 0) await chmod2(temp, mode & 511);
34016
+ await writeFile(temp, bytes, { flag: "wx" });
34017
+ if (mode !== void 0) await chmod(temp, mode & 511);
33991
34018
  await rename(temp, target);
33992
34019
  } catch (err) {
33993
34020
  await rm2(temp, { force: true });
@@ -34042,7 +34069,7 @@ async function applyClientFileDirectives(result, opts = {}) {
34042
34069
  if (!isAllowedClientFilePath(value.path)) return null;
34043
34070
  try {
34044
34071
  await mkdir2(path12.dirname(value.path), { recursive: true });
34045
- await writeFile2(value.path, value.content, "utf8");
34072
+ await writeFile(value.path, value.content, "utf8");
34046
34073
  written.push(value.path);
34047
34074
  return value.path;
34048
34075
  } catch {
@@ -35081,7 +35108,7 @@ import {
35081
35108
  realpath as realpath4,
35082
35109
  rm as rm3,
35083
35110
  stat as stat5,
35084
- writeFile as writeFile3
35111
+ writeFile as writeFile2
35085
35112
  } from "node:fs/promises";
35086
35113
  import { constants as fsConstants } from "node:fs";
35087
35114
  import { tmpdir as tmpdir2 } from "node:os";
@@ -35232,7 +35259,7 @@ async function downloadAndExtractArchive(handle, data, dir, signal) {
35232
35259
  const tarball = join15(attemptDir, "download.tar");
35233
35260
  const extractDir = join15(attemptDir, "files");
35234
35261
  try {
35235
- await writeFile3(tarball, data, { signal });
35262
+ await writeFile2(tarball, data, { signal });
35236
35263
  await mkdir3(extractDir);
35237
35264
  const member = await safeExtractArchive(tarball, extractDir, handle.filename, signal);
35238
35265
  await rm3(tarball);
@@ -35296,7 +35323,7 @@ async function materializeArtifacts(result, ctx) {
35296
35323
  const finalPath = await writeDurableUnique(
35297
35324
  saveTarget.dir,
35298
35325
  filename,
35299
- (p) => writeFile3(p, data, { flag: "wx" })
35326
+ (p) => writeFile2(p, data, { flag: "wx" })
35300
35327
  );
35301
35328
  if (!finalPath) return null;
35302
35329
  if (value.mimeType.startsWith("image/")) {
@@ -35331,7 +35358,7 @@ async function materializeArtifacts(result, ctx) {
35331
35358
  }
35332
35359
  if (value.size > 0 && data.length !== value.size) return null;
35333
35360
  const downloadedPath = join15(dir, sanitizeSegment(value.filename));
35334
- await writeFile3(downloadedPath, data);
35361
+ await writeFile2(downloadedPath, data);
35335
35362
  if (value.mimeType.startsWith("image/")) {
35336
35363
  images.push({ localPath: downloadedPath, data, mimeType: value.mimeType });
35337
35364
  }
@@ -37785,7 +37812,7 @@ function getSharedConfigurationFromEnvironment(signalIdentifier) {
37785
37812
  init_esm();
37786
37813
 
37787
37814
  // ../../node_modules/@opentelemetry/otlp-exporter-base/build/esm/configuration/otlp-node-http-env-configuration.js
37788
- import * as fs10 from "fs";
37815
+ import * as fs11 from "fs";
37789
37816
  import * as path15 from "path";
37790
37817
  init_esm();
37791
37818
  function getStaticHeadersFromEnv(signalIdentifier) {
@@ -37846,7 +37873,7 @@ function readFileFromEnv(signalSpecificEnvVar, nonSignalSpecificEnvVar, warningM
37846
37873
  const filePath = signalSpecificPath ?? nonSignalSpecificPath;
37847
37874
  if (filePath != null) {
37848
37875
  try {
37849
- return fs10.readFileSync(path15.resolve(process.cwd(), filePath));
37876
+ return fs11.readFileSync(path15.resolve(process.cwd(), filePath));
37850
37877
  } catch {
37851
37878
  diag2.warn(warningMessage);
37852
37879
  return void 0;
@@ -37932,7 +37959,7 @@ var OTLPLogExporter = class extends OTLPExporterBase {
37932
37959
  init_esm();
37933
37960
 
37934
37961
  // ../telemetry/src/debug.ts
37935
- import * as fs11 from "node:fs";
37962
+ import * as fs12 from "node:fs";
37936
37963
 
37937
37964
  // ../telemetry/src/paths.ts
37938
37965
  import * as path16 from "node:path";
@@ -37970,8 +37997,8 @@ function emitDebugPayload(payload) {
37970
37997
  } catch {
37971
37998
  }
37972
37999
  try {
37973
- fs11.mkdirSync(argentHomeDir(), { recursive: true });
37974
- fs11.appendFileSync(debugLogPath(), line + "\n");
38000
+ fs12.mkdirSync(argentHomeDir(), { recursive: true });
38001
+ fs12.appendFileSync(debugLogPath(), line + "\n");
37975
38002
  } catch {
37976
38003
  }
37977
38004
  }
@@ -38906,7 +38933,7 @@ function isCi(env = process.env) {
38906
38933
  var SESSION_ID2 = randomUUID5();
38907
38934
  function readCliVersion() {
38908
38935
  if (true) {
38909
- return "0.35.1-next.78";
38936
+ return "0.35.1-next.81";
38910
38937
  }
38911
38938
  return "0.0.0";
38912
38939
  }
@@ -38939,7 +38966,7 @@ function getBaseProps(runtime) {
38939
38966
 
38940
38967
  // ../telemetry/src/identity.ts
38941
38968
  import * as crypto2 from "node:crypto";
38942
- import * as fs12 from "node:fs";
38969
+ import * as fs13 from "node:fs";
38943
38970
  import * as path17 from "node:path";
38944
38971
  var FINGERPRINT_PATTERN = /^[0-9a-f]{64}$/;
38945
38972
  var cached2 = null;
@@ -39036,17 +39063,17 @@ function resolveFingerprintOnce(resolveFingerprint) {
39036
39063
  function isCorruptIdFile(filePath) {
39037
39064
  let isRegularFile;
39038
39065
  try {
39039
- isRegularFile = fs12.lstatSync(filePath).isFile();
39066
+ isRegularFile = fs13.lstatSync(filePath).isFile();
39040
39067
  } catch {
39041
39068
  return false;
39042
39069
  }
39043
39070
  return isRegularFile && tryReadId(filePath) === null;
39044
39071
  }
39045
39072
  function writeIdFileAtomic(finalPath, id) {
39046
- fs12.mkdirSync(argentHomeDir(), { recursive: true });
39073
+ fs13.mkdirSync(argentHomeDir(), { recursive: true });
39047
39074
  let occupant;
39048
39075
  try {
39049
- occupant = fs12.lstatSync(finalPath);
39076
+ occupant = fs13.lstatSync(finalPath);
39050
39077
  } catch (err) {
39051
39078
  if (err.code !== "ENOENT") throw err;
39052
39079
  }
@@ -39057,24 +39084,24 @@ function writeIdFileAtomic(finalPath, id) {
39057
39084
  argentHomeDir(),
39058
39085
  `.telemetry-id.tmp.${process.pid}.${crypto2.randomUUID()}`
39059
39086
  );
39060
- const fd = fs12.openSync(tmpPath, "wx", 384);
39087
+ const fd = fs13.openSync(tmpPath, "wx", 384);
39061
39088
  try {
39062
39089
  try {
39063
- fs12.writeSync(fd, id);
39064
- fs12.fsyncSync(fd);
39090
+ fs13.writeSync(fd, id);
39091
+ fs13.fsyncSync(fd);
39065
39092
  } finally {
39066
- fs12.closeSync(fd);
39093
+ fs13.closeSync(fd);
39067
39094
  }
39068
- fs12.renameSync(tmpPath, finalPath);
39095
+ fs13.renameSync(tmpPath, finalPath);
39069
39096
  } finally {
39070
39097
  try {
39071
- fs12.unlinkSync(tmpPath);
39098
+ fs13.unlinkSync(tmpPath);
39072
39099
  } catch {
39073
39100
  }
39074
39101
  }
39075
39102
  }
39076
39103
  function mintRandomId(finalPath) {
39077
- fs12.mkdirSync(argentHomeDir(), { recursive: true });
39104
+ fs13.mkdirSync(argentHomeDir(), { recursive: true });
39078
39105
  let value = crypto2.randomUUID();
39079
39106
  for (let attempt = 0; attempt < 3; attempt++) {
39080
39107
  const tmpPath = path17.join(
@@ -39083,19 +39110,19 @@ function mintRandomId(finalPath) {
39083
39110
  );
39084
39111
  let fd;
39085
39112
  try {
39086
- fd = fs12.openSync(tmpPath, "wx", 384);
39113
+ fd = fs13.openSync(tmpPath, "wx", 384);
39087
39114
  } catch (err) {
39088
39115
  if (err.code === "EEXIST") continue;
39089
39116
  throw err;
39090
39117
  }
39091
39118
  try {
39092
39119
  try {
39093
- fs12.writeSync(fd, value);
39094
- fs12.fsyncSync(fd);
39120
+ fs13.writeSync(fd, value);
39121
+ fs13.fsyncSync(fd);
39095
39122
  } finally {
39096
- fs12.closeSync(fd);
39123
+ fs13.closeSync(fd);
39097
39124
  }
39098
- fs12.linkSync(tmpPath, finalPath);
39125
+ fs13.linkSync(tmpPath, finalPath);
39099
39126
  cached2 = { path: finalPath, id: value };
39100
39127
  return value;
39101
39128
  } catch (err) {
@@ -39114,7 +39141,7 @@ function mintRandomId(finalPath) {
39114
39141
  throw err;
39115
39142
  } finally {
39116
39143
  try {
39117
- fs12.unlinkSync(tmpPath);
39144
+ fs13.unlinkSync(tmpPath);
39118
39145
  } catch {
39119
39146
  }
39120
39147
  }
@@ -39127,7 +39154,7 @@ function claimCorruptOccupant(finalPath) {
39127
39154
  `.telemetry-id.corrupt.${process.pid}.${crypto2.randomUUID()}`
39128
39155
  );
39129
39156
  try {
39130
- fs12.renameSync(finalPath, claimed);
39157
+ fs13.renameSync(finalPath, claimed);
39131
39158
  } catch {
39132
39159
  return null;
39133
39160
  }
@@ -39136,7 +39163,7 @@ function claimCorruptOccupant(finalPath) {
39136
39163
  grabbed = tryReadId(claimed);
39137
39164
  } finally {
39138
39165
  try {
39139
- fs12.unlinkSync(claimed);
39166
+ fs13.unlinkSync(claimed);
39140
39167
  } catch {
39141
39168
  }
39142
39169
  }
@@ -39148,9 +39175,9 @@ function peekAnonId() {
39148
39175
  function tryReadId(filePath) {
39149
39176
  let raw;
39150
39177
  try {
39151
- const stats = fs12.lstatSync(filePath);
39178
+ const stats = fs13.lstatSync(filePath);
39152
39179
  if (!stats.isFile()) return null;
39153
- raw = fs12.readFileSync(filePath, "utf8");
39180
+ raw = fs13.readFileSync(filePath, "utf8");
39154
39181
  } catch (err) {
39155
39182
  if (err.code === "ENOENT") return null;
39156
39183
  return null;
@@ -39165,7 +39192,7 @@ import { execFileSync as execFileSync2, spawn as spawn3 } from "node:child_proce
39165
39192
 
39166
39193
  // ../native-devtools-ios/src/index.ts
39167
39194
  import * as path18 from "node:path";
39168
- import * as fs13 from "node:fs";
39195
+ import * as fs14 from "node:fs";
39169
39196
  var DYLIB_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_DIR ?? path18.join(__dirname, "..", "dylibs");
39170
39197
  var BIN_DIR = process.env.ARGENT_SIMULATOR_SERVER_DIR ?? path18.join(__dirname, "..", "bin");
39171
39198
  var DYLIB_TCP_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_TCP_DIR ?? path18.join(DYLIB_DIR, "tcp");
@@ -39185,9 +39212,9 @@ function platformBinDir() {
39185
39212
  function simulatorServerBinaryPath() {
39186
39213
  const binaryName = simulatorServerBinaryName();
39187
39214
  const p = path18.join(platformBinDir(), binaryName);
39188
- if (!fs13.existsSync(p)) {
39215
+ if (!fs14.existsSync(p)) {
39189
39216
  const flat = path18.join(BIN_DIR, binaryName);
39190
- const migrationHint = fs13.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.` : "";
39217
+ const migrationHint = fs14.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.` : "";
39191
39218
  throw new Error(
39192
39219
  `simulator-server binary not found for platform "${hostPlatformKey()}" at ${p}. Supported hosts today: darwin, linux (x86_64 and arm64), win32.${migrationHint}`
39193
39220
  );
@@ -39267,7 +39294,7 @@ function resolveHostFingerprintAsync() {
39267
39294
  }
39268
39295
 
39269
39296
  // ../telemetry/src/consent.ts
39270
- import * as fs14 from "node:fs";
39297
+ import * as fs15 from "node:fs";
39271
39298
  import * as path19 from "node:path";
39272
39299
  var cache = /* @__PURE__ */ new Map();
39273
39300
  var sessionOverride = null;
@@ -39275,7 +39302,7 @@ function readConfigOverrideAt(filePath) {
39275
39302
  const miss = { mtimeMs: null, fingerprint: null, enabledOverride: null };
39276
39303
  let stats;
39277
39304
  try {
39278
- stats = fs14.lstatSync(filePath);
39305
+ stats = fs15.lstatSync(filePath);
39279
39306
  } catch {
39280
39307
  cache.set(filePath, miss);
39281
39308
  return null;
@@ -39292,7 +39319,7 @@ function readConfigOverrideAt(filePath) {
39292
39319
  }
39293
39320
  let parsedEnabled = null;
39294
39321
  try {
39295
- const raw = fs14.readFileSync(filePath, "utf8");
39322
+ const raw = fs15.readFileSync(filePath, "utf8");
39296
39323
  const json2 = JSON.parse(raw);
39297
39324
  if (json2 && typeof json2 === "object") {
39298
39325
  const t2 = json2.telemetry;
@@ -41694,8 +41721,8 @@ async function fetchImageToFile(result, outPath) {
41694
41721
  const res = await fetch(url2);
41695
41722
  if (!res.ok) throw new Error(`Failed to download image: ${res.status} ${res.statusText}`);
41696
41723
  const buf = Buffer.from(await res.arrayBuffer());
41697
- fs15.mkdirSync(path22.dirname(path22.resolve(outPath)), { recursive: true });
41698
- fs15.writeFileSync(outPath, buf);
41724
+ fs16.mkdirSync(path22.dirname(path22.resolve(outPath)), { recursive: true });
41725
+ fs16.writeFileSync(outPath, buf);
41699
41726
  }
41700
41727
  function renderResult(result, outputHint, images, json2) {
41701
41728
  if (json2) return JSON.stringify(result, null, 2);
@@ -41923,8 +41950,8 @@ settled=false or debugger-status's not_connected.
41923
41950
  if (outPath && meta3.outputHint === "image") {
41924
41951
  try {
41925
41952
  if (images.length > 0) {
41926
- fs15.mkdirSync(path22.dirname(path22.resolve(outPath)), { recursive: true });
41927
- fs15.writeFileSync(outPath, images[0].data);
41953
+ fs16.mkdirSync(path22.dirname(path22.resolve(outPath)), { recursive: true });
41954
+ fs16.writeFileSync(outPath, images[0].data);
41928
41955
  } else if (result && typeof result === "object") {
41929
41956
  await fetchImageToFile(result, outPath);
41930
41957
  }
@@ -42056,9 +42083,9 @@ Listing tools contacts the argent tool-server, starting one if none is running.
42056
42083
  }
42057
42084
 
42058
42085
  // ../argent-cli/src/server.ts
42059
- import * as fs16 from "node:fs";
42086
+ import * as fs17 from "node:fs";
42060
42087
  import * as readline2 from "node:readline";
42061
- import { constants as constants3, networkInterfaces } from "node:os";
42088
+ import { constants as constants4, networkInterfaces } from "node:os";
42062
42089
  import { spawn as spawn4 } from "node:child_process";
42063
42090
  var { LOG_FILE: LOG_FILE2 } = STATE_PATHS;
42064
42091
  async function describeForeignServers(ownBundlePath) {
@@ -42159,12 +42186,12 @@ Stop one with: kill <pid>`);
42159
42186
  }
42160
42187
  }
42161
42188
  function logsCmd(follow) {
42162
- if (!fs16.existsSync(LOG_FILE2)) {
42189
+ if (!fs17.existsSync(LOG_FILE2)) {
42163
42190
  console.log(`No log file at ${LOG_FILE2}`);
42164
42191
  return;
42165
42192
  }
42166
42193
  if (!follow) {
42167
- process.stdout.write(fs16.readFileSync(LOG_FILE2, "utf8"));
42194
+ process.stdout.write(fs17.readFileSync(LOG_FILE2, "utf8"));
42168
42195
  return;
42169
42196
  }
42170
42197
  const cannotFollow = (err) => {
@@ -42503,8 +42530,8 @@ async function runForeground(paths, { port, host, idleTimeoutMinutes, token }, j
42503
42530
  if (stateWritten) {
42504
42531
  const file2 = stateFileForBundle(paths.bundlePath);
42505
42532
  try {
42506
- const cur = JSON.parse(fs16.readFileSync(file2, "utf8"));
42507
- if (cur.pid === childPid) fs16.unlinkSync(file2);
42533
+ const cur = JSON.parse(fs17.readFileSync(file2, "utf8"));
42534
+ if (cur.pid === childPid) fs17.unlinkSync(file2);
42508
42535
  } catch {
42509
42536
  }
42510
42537
  }
@@ -42525,7 +42552,7 @@ async function runForeground(paths, { port, host, idleTimeoutMinutes, token }, j
42525
42552
  });
42526
42553
  }
42527
42554
  function signalNumber(signal) {
42528
- return constants3.signals[signal] ?? null;
42555
+ return constants4.signals[signal] ?? null;
42529
42556
  }
42530
42557
  var SUBCOMMAND_HELP = {
42531
42558
  status: `Usage: argent server status [--json]
@@ -42614,7 +42641,7 @@ async function server(argv, options) {
42614
42641
  }
42615
42642
 
42616
42643
  // ../argent-cli/src/lens.ts
42617
- import * as fs17 from "node:fs";
42644
+ import * as fs18 from "node:fs";
42618
42645
  import * as os4 from "node:os";
42619
42646
  import * as path23 from "node:path";
42620
42647
 
@@ -43371,11 +43398,11 @@ async function lens(argv, options) {
43371
43398
  process.exit(1);
43372
43399
  }
43373
43400
  const seedFile = path23.join(os4.tmpdir(), `argent-lens-seed-${process.pid}-${Date.now()}.txt`);
43374
- fs17.writeFileSync(seedFile, buildSeedPrompt(), "utf8");
43401
+ fs18.writeFileSync(seedFile, buildSeedPrompt(), "utf8");
43375
43402
  const launchCmd = agent.launch(shellQuote(process.cwd()), shellQuote(seedFile));
43376
43403
  const removeSeedFile = () => {
43377
43404
  try {
43378
- fs17.rmSync(seedFile, { force: true });
43405
+ fs18.rmSync(seedFile, { force: true });
43379
43406
  } catch {
43380
43407
  }
43381
43408
  };
@@ -43804,6 +43831,7 @@ function runToggle(argv, command, registry2) {
43804
43831
  );
43805
43832
  process.exit(2);
43806
43833
  }
43834
+ if (parsed.scope === "global") assertPrivateArgentHome();
43807
43835
  const filePath = getFlagsPath(parsed.scope);
43808
43836
  const warning = degenerateProjectScopeWarning(parsed.scope, filePath);
43809
43837
  let wrote = true;
@@ -45680,6 +45708,7 @@ async function link(argv) {
45680
45708
  printLinkHelp();
45681
45709
  return;
45682
45710
  }
45711
+ assertPrivateArgentHome();
45683
45712
  if (flags2.yes && flags2.host === null) {
45684
45713
  console.error("Error: --yes requires --host (port defaults to 3001).\n");
45685
45714
  printLinkHelp();
@@ -45773,7 +45802,14 @@ async function link(argv) {
45773
45802
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
45774
45803
  ...token ? { token } : {}
45775
45804
  };
45776
- await writeLinkConfig(cfg);
45805
+ try {
45806
+ await writeLinkConfig(cfg);
45807
+ } catch (err) {
45808
+ const linkFile = path27.join(argentHomeDir(), "link.json");
45809
+ const reason = err.code ?? err.message;
45810
+ console.error(`argent: cannot write ${linkFile}: ${reason}`);
45811
+ process.exit(1);
45812
+ }
45777
45813
  if (existing && existing.url !== url2) {
45778
45814
  console.log(`${import_picocolors4.default.green("\u2713")} Link updated: ${import_picocolors4.default.dim(existing.url)} \u2192 ${import_picocolors4.default.cyan(url2)}`);
45779
45815
  } else {
@@ -45965,7 +46001,7 @@ async function cmdDisable(scope) {
45965
46001
 
45966
46002
  // ../argent-cli/src/providers.ts
45967
46003
  var import_picocolors7 = __toESM(require_picocolors(), 1);
45968
- import * as fs21 from "node:fs";
46004
+ import * as fs22 from "node:fs";
45969
46005
  import * as path31 from "node:path";
45970
46006
 
45971
46007
  // ../device-providers/src/contract.ts
@@ -46111,7 +46147,7 @@ var providerEnvelopeSchema = providerRecordSchema.extend({
46111
46147
  });
46112
46148
 
46113
46149
  // ../device-providers/src/read.ts
46114
- import * as fs18 from "node:fs";
46150
+ import * as fs19 from "node:fs";
46115
46151
  import * as os5 from "node:os";
46116
46152
  import * as path29 from "node:path";
46117
46153
  var DISABLE_ENV = "ARGENT_DISABLE_DEVICE_PROVIDERS";
@@ -46140,7 +46176,7 @@ function warnOnce(key, message) {
46140
46176
  function readProviderFile(file2) {
46141
46177
  let raw;
46142
46178
  try {
46143
- raw = fs18.readFileSync(file2, "utf8");
46179
+ raw = fs19.readFileSync(file2, "utf8");
46144
46180
  } catch {
46145
46181
  return void 0;
46146
46182
  }
@@ -46190,14 +46226,15 @@ function discoverProviders() {
46190
46226
  function descriptorFiles() {
46191
46227
  const directory = providersDirectory();
46192
46228
  try {
46193
- return fs18.readdirSync(directory).filter((name) => name.endsWith(".json")).sort().map((name) => path29.join(directory, name));
46229
+ return fs19.readdirSync(directory).filter((name) => name.endsWith(".json")).sort().map((name) => path29.join(directory, name));
46194
46230
  } catch {
46195
46231
  return [];
46196
46232
  }
46197
46233
  }
46198
46234
 
46199
46235
  // ../device-providers/src/write.ts
46200
- import * as fs19 from "node:fs";
46236
+ import * as fs20 from "node:fs";
46237
+ import { randomBytes as randomBytes3 } from "node:crypto";
46201
46238
  import * as path30 from "node:path";
46202
46239
  var ProviderValidationError = class extends Error {
46203
46240
  /** One line per problem, `path: message`, in the order zod reported them. */
@@ -46253,17 +46290,17 @@ function publishProvider(record2, options = {}) {
46253
46290
  const file2 = path30.join(directory, `${validated.id}.json`);
46254
46291
  const body = JSON.stringify(canonicalize(candidate), null, 2) + "\n";
46255
46292
  try {
46256
- if (fs19.readFileSync(file2, "utf8") === body) return { changed: false, path: file2 };
46293
+ if (fs20.readFileSync(file2, "utf8") === body) return { changed: false, path: file2 };
46257
46294
  } catch {
46258
46295
  }
46259
- fs19.mkdirSync(directory, { recursive: true });
46260
- const temporary = `${file2}.${process.pid}.tmp`;
46296
+ fs20.mkdirSync(directory, { recursive: true });
46297
+ const temporary = `${file2}.${randomBytes3(8).toString("hex")}.tmp`;
46261
46298
  try {
46262
- fs19.writeFileSync(temporary, body);
46263
- fs19.renameSync(temporary, file2);
46299
+ fs20.writeFileSync(temporary, body, { flag: "wx" });
46300
+ fs20.renameSync(temporary, file2);
46264
46301
  } catch (error63) {
46265
46302
  try {
46266
- fs19.rmSync(temporary, { force: true });
46303
+ fs20.rmSync(temporary, { force: true });
46267
46304
  } catch {
46268
46305
  }
46269
46306
  throw error63;
@@ -46276,7 +46313,7 @@ function withdrawProvider(id) {
46276
46313
  }
46277
46314
  const file2 = path30.join(providersDirectory(), `${id}.json`);
46278
46315
  try {
46279
- fs19.unlinkSync(file2);
46316
+ fs20.unlinkSync(file2);
46280
46317
  return true;
46281
46318
  } catch (e) {
46282
46319
  if (e.code === "ENOENT") return false;
@@ -46306,7 +46343,7 @@ function pruneOrphanedProviders(options = {}) {
46306
46343
  continue;
46307
46344
  }
46308
46345
  try {
46309
- fs19.unlinkSync(file2);
46346
+ fs20.unlinkSync(file2);
46310
46347
  removed.push(entry);
46311
46348
  } catch {
46312
46349
  }
@@ -46316,7 +46353,7 @@ function pruneOrphanedProviders(options = {}) {
46316
46353
 
46317
46354
  // ../argent-cli/src/providers-check.ts
46318
46355
  var import_picocolors6 = __toESM(require_picocolors(), 1);
46319
- import * as fs20 from "node:fs";
46356
+ import * as fs21 from "node:fs";
46320
46357
  var KNOWN_CAPABILITIES = new Set(EXTERNAL_CAPABILITIES);
46321
46358
  var PROBE_TIMEOUT_MS = 5e3;
46322
46359
  function error62(message) {
@@ -46382,7 +46419,7 @@ async function checkDevices(devices, findings) {
46382
46419
  );
46383
46420
  } else {
46384
46421
  try {
46385
- fs20.accessSync(device.deviceSet, fs20.constants.R_OK);
46422
+ fs21.accessSync(device.deviceSet, fs21.constants.R_OK);
46386
46423
  } catch {
46387
46424
  findings.push(
46388
46425
  error62(`${label}: deviceSet '${device.deviceSet}' is not readable by this user`)
@@ -46439,7 +46476,7 @@ async function checkDevices(devices, findings) {
46439
46476
  );
46440
46477
  } else {
46441
46478
  try {
46442
- fs20.accessSync(device.nativeDevtools.socketPath, fs20.constants.R_OK | fs20.constants.W_OK);
46479
+ fs21.accessSync(device.nativeDevtools.socketPath, fs21.constants.R_OK | fs21.constants.W_OK);
46443
46480
  } catch {
46444
46481
  findings.push(
46445
46482
  error62(
@@ -46510,7 +46547,7 @@ async function checkDescriptorFile(file2, expectedVersion) {
46510
46547
  const report = { deviceCount: 0, findings, source: file2 };
46511
46548
  let raw;
46512
46549
  try {
46513
- raw = fs20.readFileSync(file2, "utf8");
46550
+ raw = fs21.readFileSync(file2, "utf8");
46514
46551
  } catch (e) {
46515
46552
  findings.push(error62(`unreadable: ${e instanceof Error ? e.message : String(e)}`));
46516
46553
  return report;
@@ -46655,7 +46692,7 @@ async function readDocument(args) {
46655
46692
  }
46656
46693
  if (args.file) {
46657
46694
  try {
46658
- return { raw: fs21.readFileSync(args.file, "utf8"), source: args.file };
46695
+ return { raw: fs22.readFileSync(args.file, "utf8"), source: args.file };
46659
46696
  } catch (e) {
46660
46697
  throw new UsageError2(
46661
46698
  `cannot read ${args.file}: ${e instanceof Error ? e.message : String(e)}`
@@ -46732,6 +46769,7 @@ async function runPublish(args) {
46732
46769
  const parsed = parseDescriptorDocument(raw, args.schemaVersion);
46733
46770
  if (!parsed.ok) reportFailure(args.json, source, parsed.findings);
46734
46771
  const pid = args.pid ?? parsed.record.pid;
46772
+ assertPrivateArgentHome();
46735
46773
  const pruned = pruneOrphanedProviders({
46736
46774
  filter: (candidate) => vendorOf(candidate.id) === vendorOf(parsed.record.id)
46737
46775
  });
@@ -47003,14 +47041,14 @@ async function providers(argv) {
47003
47041
 
47004
47042
  // ../argent-cli/src/doctor.ts
47005
47043
  var import_picocolors8 = __toESM(require_picocolors(), 1);
47006
- import * as fs35 from "node:fs";
47044
+ import * as fs36 from "node:fs";
47007
47045
  import * as path47 from "node:path";
47008
47046
  import { execFile } from "node:child_process";
47009
47047
  import { promisify } from "node:util";
47010
47048
  import { homedir as homedir9 } from "node:os";
47011
47049
 
47012
47050
  // ../argent-installer/src/mcp-configs.ts
47013
- import * as fs28 from "node:fs";
47051
+ import * as fs29 from "node:fs";
47014
47052
  import * as path38 from "node:path";
47015
47053
  import { execFileSync as execFileSync8 } from "node:child_process";
47016
47054
  import { homedir as homedir6 } from "node:os";
@@ -47025,7 +47063,7 @@ var CURSOR_ALLOWLIST_PATTERN = "argent:*";
47025
47063
 
47026
47064
  // ../argent-installer/src/utils.ts
47027
47065
  var import_semver3 = __toESM(require_semver2(), 1);
47028
- import * as fs27 from "node:fs";
47066
+ import * as fs28 from "node:fs";
47029
47067
  import * as path37 from "node:path";
47030
47068
  import * as dns from "node:dns";
47031
47069
  import { createHash as createHash6 } from "node:crypto";
@@ -49349,12 +49387,12 @@ function applyEdits(text2, edits) {
49349
49387
  }
49350
49388
 
49351
49389
  // ../argent-installer/src/package-root.ts
49352
- import * as fs22 from "node:fs";
49390
+ import * as fs23 from "node:fs";
49353
49391
  import * as path32 from "node:path";
49354
49392
  function resolvePackageRoot(dirname28) {
49355
49393
  let current = path32.resolve(dirname28);
49356
49394
  while (true) {
49357
- if (fs22.existsSync(path32.join(current, "package.json"))) return current;
49395
+ if (fs23.existsSync(path32.join(current, "package.json"))) return current;
49358
49396
  const parent = path32.dirname(current);
49359
49397
  if (parent === current) return path32.resolve(dirname28);
49360
49398
  current = parent;
@@ -49363,22 +49401,22 @@ function resolvePackageRoot(dirname28) {
49363
49401
 
49364
49402
  // ../argent-installer/src/package-manager.ts
49365
49403
  import { execFileSync as execFileSync6 } from "node:child_process";
49366
- import * as fs25 from "node:fs";
49404
+ import * as fs26 from "node:fs";
49367
49405
  import * as os6 from "node:os";
49368
49406
  import * as path35 from "node:path";
49369
49407
 
49370
49408
  // ../argent-installer/src/topology.ts
49371
49409
  var import_semver2 = __toESM(require_semver2(), 1);
49372
- import * as fs24 from "node:fs";
49410
+ import * as fs25 from "node:fs";
49373
49411
  import * as path34 from "node:path";
49374
49412
  import { createRequire as createRequire2 } from "node:module";
49375
49413
  import { execFileSync as execFileSync5 } from "node:child_process";
49376
49414
 
49377
49415
  // ../argent-installer/src/preflight.ts
49378
- import * as fs23 from "node:fs";
49416
+ import * as fs24 from "node:fs";
49379
49417
  import * as path33 from "node:path";
49380
49418
  function isYarnPnp(projectRoot) {
49381
- return fs23.existsSync(path33.join(projectRoot, ".pnp.cjs")) || fs23.existsSync(path33.join(projectRoot, ".pnp.loader.mjs"));
49419
+ return fs24.existsSync(path33.join(projectRoot, ".pnp.cjs")) || fs24.existsSync(path33.join(projectRoot, ".pnp.loader.mjs"));
49382
49420
  }
49383
49421
 
49384
49422
  // ../argent-installer/src/topology.ts
@@ -49447,8 +49485,8 @@ function getGloballyInstalledPackageRoot() {
49447
49485
  }
49448
49486
  function readShimScript(binaryPath) {
49449
49487
  try {
49450
- if (fs24.statSync(binaryPath).size > 64 * 1024) return null;
49451
- return fs24.readFileSync(binaryPath, "utf8");
49488
+ if (fs25.statSync(binaryPath).size > 64 * 1024) return null;
49489
+ return fs25.readFileSync(binaryPath, "utf8");
49452
49490
  } catch {
49453
49491
  return null;
49454
49492
  }
@@ -49469,9 +49507,9 @@ function globalPackageRootOf(binaryPath) {
49469
49507
  }
49470
49508
  function packageRootOf(binaryPath) {
49471
49509
  try {
49472
- const realPath = fs24.realpathSync(binaryPath);
49510
+ const realPath = fs25.realpathSync(binaryPath);
49473
49511
  const root = resolvePackageRoot(path34.dirname(realPath));
49474
- const pkg = JSON.parse(fs24.readFileSync(path34.join(root, "package.json"), "utf8"));
49512
+ const pkg = JSON.parse(fs25.readFileSync(path34.join(root, "package.json"), "utf8"));
49475
49513
  return pkg.name === PACKAGE_NAME ? root : null;
49476
49514
  } catch {
49477
49515
  return null;
@@ -49481,7 +49519,7 @@ function getGloballyInstalledVersion() {
49481
49519
  const pkgRoot = getGloballyInstalledPackageRoot();
49482
49520
  if (!pkgRoot) return null;
49483
49521
  try {
49484
- const pkg = JSON.parse(fs24.readFileSync(path34.join(pkgRoot, "package.json"), "utf8"));
49522
+ const pkg = JSON.parse(fs25.readFileSync(path34.join(pkgRoot, "package.json"), "utf8"));
49485
49523
  return pkg.version ?? null;
49486
49524
  } catch {
49487
49525
  return null;
@@ -49490,7 +49528,7 @@ function getGloballyInstalledVersion() {
49490
49528
  function readManifestDeclaration(projectRoot) {
49491
49529
  try {
49492
49530
  const pkg = JSON.parse(
49493
- fs24.readFileSync(path34.join(projectRoot, "package.json"), "utf8")
49531
+ fs25.readFileSync(path34.join(projectRoot, "package.json"), "utf8")
49494
49532
  );
49495
49533
  const spec = pkg.devDependencies?.[PACKAGE_NAME] ?? pkg.dependencies?.[PACKAGE_NAME] ?? pkg.optionalDependencies?.[PACKAGE_NAME];
49496
49534
  return typeof spec === "string" ? spec : null;
@@ -49507,7 +49545,7 @@ function resolveLocalArgentDir(projectRoot) {
49507
49545
  return path34.dirname(req.resolve(`${PACKAGE_NAME}/package.json`));
49508
49546
  } catch {
49509
49547
  const plain = path34.join(projectRoot, "node_modules", PACKAGE_NAME);
49510
- return fs24.existsSync(path34.join(plain, "package.json")) ? plain : null;
49548
+ return fs25.existsSync(path34.join(plain, "package.json")) ? plain : null;
49511
49549
  }
49512
49550
  }
49513
49551
  function probeLocalInstall(projectRoot) {
@@ -49515,7 +49553,7 @@ function probeLocalInstall(projectRoot) {
49515
49553
  if (packageDir) {
49516
49554
  let version2;
49517
49555
  try {
49518
- const pkg = JSON.parse(fs24.readFileSync(path34.join(packageDir, "package.json"), "utf8"));
49556
+ const pkg = JSON.parse(fs25.readFileSync(path34.join(packageDir, "package.json"), "utf8"));
49519
49557
  version2 = pkg.version ?? null;
49520
49558
  } catch {
49521
49559
  version2 = null;
@@ -49558,10 +49596,10 @@ function detectGlobalPackageManager() {
49558
49596
  return BUN_GLOBAL_ROOT.test(root) ? "bun" : lockfileOwnerOf(root) ?? "yarn";
49559
49597
  }
49560
49598
  if (process.platform === "win32") {
49561
- if (fs25.existsSync(path35.join(npmCopyBeside(path35.dirname(binaryPath)), "package.json"))) {
49599
+ if (fs26.existsSync(path35.join(npmCopyBeside(path35.dirname(binaryPath)), "package.json"))) {
49562
49600
  return "npm";
49563
49601
  }
49564
- if (fs25.existsSync(binaryPath.replace(/\.exe$/i, "") + ".bunx")) return "bun";
49602
+ if (fs26.existsSync(binaryPath.replace(/\.exe$/i, "") + ".bunx")) return "bun";
49565
49603
  }
49566
49604
  const shim = readShimScript(binaryPath);
49567
49605
  if (shim === null || !/node_modules[\\/]/.test(shim)) return "npm";
@@ -49586,7 +49624,7 @@ function isInNpmLayout(binaryPath, root) {
49586
49624
  const binDir = canonicalPath(path35.dirname(link2));
49587
49625
  if (canonicalPath(npmCopyBeside(binDir)) === realRoot) return true;
49588
49626
  try {
49589
- link2 = path35.resolve(binDir, fs25.readlinkSync(link2));
49627
+ link2 = path35.resolve(binDir, fs26.readlinkSync(link2));
49590
49628
  } catch {
49591
49629
  return false;
49592
49630
  }
@@ -49602,7 +49640,7 @@ function asKnownPm(name) {
49602
49640
  }
49603
49641
  function pmFromPackageManagerField(dir) {
49604
49642
  try {
49605
- const pkg = JSON.parse(fs25.readFileSync(path35.join(dir, "package.json"), "utf8"));
49643
+ const pkg = JSON.parse(fs26.readFileSync(path35.join(dir, "package.json"), "utf8"));
49606
49644
  if (typeof pkg.packageManager === "string") {
49607
49645
  return asKnownPm(pkg.packageManager.split("@")[0]);
49608
49646
  }
@@ -49613,7 +49651,7 @@ function pmFromPackageManagerField(dir) {
49613
49651
  }
49614
49652
  function pmFromDevEngines(dir) {
49615
49653
  try {
49616
- const pkg = JSON.parse(fs25.readFileSync(path35.join(dir, "package.json"), "utf8"));
49654
+ const pkg = JSON.parse(fs26.readFileSync(path35.join(dir, "package.json"), "utf8"));
49617
49655
  const devEnginesPm = pkg.devEngines?.packageManager;
49618
49656
  const names = /* @__PURE__ */ new Set();
49619
49657
  for (const entry of Array.isArray(devEnginesPm) ? devEnginesPm : [devEnginesPm]) {
@@ -49626,7 +49664,7 @@ function pmFromDevEngines(dir) {
49626
49664
  }
49627
49665
  }
49628
49666
  function pmFromLockfile(dir) {
49629
- const has = (file2) => fs25.existsSync(path35.join(dir, file2));
49667
+ const has = (file2) => fs26.existsSync(path35.join(dir, file2));
49630
49668
  if (has("pnpm-lock.yaml")) return "pnpm";
49631
49669
  if (has("yarn.lock")) return "yarn";
49632
49670
  if (has("bun.lock") || has("bun.lockb")) return "bun";
@@ -49634,14 +49672,14 @@ function pmFromLockfile(dir) {
49634
49672
  return null;
49635
49673
  }
49636
49674
  function pmFromWorkspaceMarker(dir) {
49637
- return fs25.existsSync(path35.join(dir, "pnpm-workspace.yaml")) ? "pnpm" : null;
49675
+ return fs26.existsSync(path35.join(dir, "pnpm-workspace.yaml")) ? "pnpm" : null;
49638
49676
  }
49639
49677
  function detectProjectPackageManager(projectRoot) {
49640
49678
  let dir = path35.resolve(projectRoot);
49641
49679
  for (; ; ) {
49642
49680
  const pm = pmFromPackageManagerField(dir) ?? pmFromLockfile(dir) ?? pmFromDevEngines(dir) ?? pmFromWorkspaceMarker(dir);
49643
49681
  if (pm) return pm;
49644
- if (fs25.existsSync(path35.join(dir, ".git"))) break;
49682
+ if (fs26.existsSync(path35.join(dir, ".git"))) break;
49645
49683
  const parent = path35.dirname(dir);
49646
49684
  if (parent === dir) break;
49647
49685
  dir = parent;
@@ -49674,7 +49712,7 @@ function projectInstallCommand(pm) {
49674
49712
  }
49675
49713
 
49676
49714
  // ../argent-installer/src/install-record.ts
49677
- import * as fs26 from "node:fs";
49715
+ import * as fs27 from "node:fs";
49678
49716
  import * as path36 from "node:path";
49679
49717
  function getInstallRecordPath(projectRoot) {
49680
49718
  return path36.join(projectRoot, ".argent", "install.json");
@@ -49682,7 +49720,7 @@ function getInstallRecordPath(projectRoot) {
49682
49720
  function readInstallRecord(projectRoot) {
49683
49721
  try {
49684
49722
  const parsed = JSON.parse(
49685
- fs26.readFileSync(getInstallRecordPath(projectRoot), "utf8")
49723
+ fs27.readFileSync(getInstallRecordPath(projectRoot), "utf8")
49686
49724
  );
49687
49725
  if (parsed && (parsed.mode === "local" || parsed.mode === "global")) return parsed;
49688
49726
  return null;
@@ -49700,7 +49738,7 @@ function resolveInstallMode(projectRoot) {
49700
49738
  var PACKAGE_ROOT = resolvePackageRoot(import.meta.dirname);
49701
49739
  function resolveBundledDir(dirName) {
49702
49740
  const packagedDir = path37.join(PACKAGE_ROOT, dirName);
49703
- if (fs27.existsSync(packagedDir)) return packagedDir;
49741
+ if (fs28.existsSync(packagedDir)) return packagedDir;
49704
49742
  return path37.resolve(PACKAGE_ROOT, "..", "skills", dirName);
49705
49743
  }
49706
49744
  var SKILLS_DIR = resolveBundledDir("skills");
@@ -49708,7 +49746,7 @@ var RULES_DIR = resolveBundledDir("rules");
49708
49746
  var AGENTS_DIR = resolveBundledDir("agents");
49709
49747
  function listBundledSkills(skillsDir = SKILLS_DIR) {
49710
49748
  try {
49711
- return fs27.readdirSync(skillsDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name).filter((name) => fs27.existsSync(path37.join(skillsDir, name, "SKILL.md"))).sort();
49749
+ return fs28.readdirSync(skillsDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name).filter((name) => fs28.existsSync(path37.join(skillsDir, name, "SKILL.md"))).sort();
49712
49750
  } catch {
49713
49751
  return [];
49714
49752
  }
@@ -49770,10 +49808,10 @@ function resolveProjectRoot2(startDir, homeDir = os7.homedir()) {
49770
49808
  if (currentDir !== initialDir && canonicalPath(currentDir) === home2) {
49771
49809
  return initialDir;
49772
49810
  }
49773
- if (PROJECT_ROOT_MARKERS.some((marker) => fs27.existsSync(path37.join(currentDir, marker)))) {
49811
+ if (PROJECT_ROOT_MARKERS.some((marker) => fs28.existsSync(path37.join(currentDir, marker)))) {
49774
49812
  return currentDir;
49775
49813
  }
49776
- if (fs27.existsSync(path37.join(currentDir, ".git"))) {
49814
+ if (fs28.existsSync(path37.join(currentDir, ".git"))) {
49777
49815
  return currentDir;
49778
49816
  }
49779
49817
  const parentDir = path37.dirname(currentDir);
@@ -49784,20 +49822,20 @@ function resolveProjectRoot2(startDir, homeDir = os7.homedir()) {
49784
49822
  }
49785
49823
  }
49786
49824
  function readToml(filePath) {
49787
- if (!fs27.existsSync(filePath)) return {};
49825
+ if (!fs28.existsSync(filePath)) return {};
49788
49826
  try {
49789
- return parse5(fs27.readFileSync(filePath, "utf8"));
49827
+ return parse5(fs28.readFileSync(filePath, "utf8"));
49790
49828
  } catch {
49791
49829
  return {};
49792
49830
  }
49793
49831
  }
49794
49832
  function writeToml(filePath, data) {
49795
- fs27.mkdirSync(path37.dirname(filePath), { recursive: true });
49796
- fs27.writeFileSync(filePath, stringify(data) + "\n");
49833
+ fs28.mkdirSync(path37.dirname(filePath), { recursive: true });
49834
+ fs28.writeFileSync(filePath, stringify(data) + "\n");
49797
49835
  }
49798
49836
  function readYaml(filePath) {
49799
- if (!fs27.existsSync(filePath)) return new import_yaml5.Document({});
49800
- const text2 = fs27.readFileSync(filePath, "utf8");
49837
+ if (!fs28.existsSync(filePath)) return new import_yaml5.Document({});
49838
+ const text2 = fs28.readFileSync(filePath, "utf8");
49801
49839
  const doc = (0, import_yaml5.parseDocument)(text2);
49802
49840
  if (doc.errors.length > 0) {
49803
49841
  const messages = doc.errors.map((e) => e.message).join("; ");
@@ -49806,20 +49844,20 @@ function readYaml(filePath) {
49806
49844
  return doc;
49807
49845
  }
49808
49846
  function writeYaml(filePath, doc) {
49809
- fs27.mkdirSync(path37.dirname(filePath), { recursive: true });
49810
- fs27.writeFileSync(filePath, doc.toString({ lineWidth: 0 }));
49847
+ fs28.mkdirSync(path37.dirname(filePath), { recursive: true });
49848
+ fs28.writeFileSync(filePath, doc.toString({ lineWidth: 0 }));
49811
49849
  }
49812
49850
  function readJson(filePath) {
49813
- if (!fs27.existsSync(filePath)) return {};
49851
+ if (!fs28.existsSync(filePath)) return {};
49814
49852
  try {
49815
- return JSON.parse(fs27.readFileSync(filePath, "utf8"));
49853
+ return JSON.parse(fs28.readFileSync(filePath, "utf8"));
49816
49854
  } catch {
49817
49855
  return {};
49818
49856
  }
49819
49857
  }
49820
49858
  function writeJson(filePath, data) {
49821
- fs27.mkdirSync(path37.dirname(filePath), { recursive: true });
49822
- fs27.writeFileSync(filePath, JSON.stringify(data, null, 2) + "\n");
49859
+ fs28.mkdirSync(path37.dirname(filePath), { recursive: true });
49860
+ fs28.writeFileSync(filePath, JSON.stringify(data, null, 2) + "\n");
49823
49861
  }
49824
49862
  var JSONC_FORMATTING = { tabSize: 2, insertSpaces: true };
49825
49863
  function setJsoncIn(text2, jsonPath, value) {
@@ -49827,8 +49865,8 @@ function setJsoncIn(text2, jsonPath, value) {
49827
49865
  return applyEdits(text2, edits);
49828
49866
  }
49829
49867
  function readJsoncFileRaw(filePath) {
49830
- if (!fs27.existsSync(filePath)) return { text: "{}", hadBom: false, wasEmpty: true };
49831
- let text2 = fs27.readFileSync(filePath, "utf8");
49868
+ if (!fs28.existsSync(filePath)) return { text: "{}", hadBom: false, wasEmpty: true };
49869
+ let text2 = fs28.readFileSync(filePath, "utf8");
49832
49870
  const hadBom = text2.charCodeAt(0) === 65279;
49833
49871
  if (hadBom) text2 = text2.slice(1);
49834
49872
  const wasEmpty = text2.trim() === "";
@@ -49848,18 +49886,18 @@ function isEmptyPlainObject(value) {
49848
49886
  }
49849
49887
  function rmEmptyDir(dirPath) {
49850
49888
  try {
49851
- if (!fs27.existsSync(dirPath)) return false;
49852
- if (!fs27.statSync(dirPath).isDirectory()) return false;
49853
- if (fs27.readdirSync(dirPath).length > 0) return false;
49854
- fs27.rmdirSync(dirPath);
49889
+ if (!fs28.existsSync(dirPath)) return false;
49890
+ if (!fs28.statSync(dirPath).isDirectory()) return false;
49891
+ if (fs28.readdirSync(dirPath).length > 0) return false;
49892
+ fs28.rmdirSync(dirPath);
49855
49893
  return true;
49856
49894
  } catch {
49857
49895
  return false;
49858
49896
  }
49859
49897
  }
49860
49898
  function readJsonc(filePath) {
49861
- if (!fs27.existsSync(filePath)) return {};
49862
- let raw = fs27.readFileSync(filePath, "utf8");
49899
+ if (!fs28.existsSync(filePath)) return {};
49900
+ let raw = fs28.readFileSync(filePath, "utf8");
49863
49901
  if (raw.charCodeAt(0) === 65279) raw = raw.slice(1);
49864
49902
  if (raw.trim() === "") return {};
49865
49903
  const parsed = parse7(raw, [], { allowTrailingComma: true });
@@ -49880,7 +49918,7 @@ function yamlSyntaxErrorLine(raw) {
49880
49918
  function findConfigSyntaxErrorLine(filePath, jsonOptions) {
49881
49919
  let raw;
49882
49920
  try {
49883
- raw = fs27.readFileSync(filePath, "utf8");
49921
+ raw = fs28.readFileSync(filePath, "utf8");
49884
49922
  } catch {
49885
49923
  return null;
49886
49924
  }
@@ -49906,17 +49944,17 @@ function editJsoncFile(filePath, jsonPath, value) {
49906
49944
  }
49907
49945
  const parsed = parse7(text2, [], { allowTrailingComma: true });
49908
49946
  if (isEmptyPlainObject(parsed)) {
49909
- fs27.rmSync(filePath, { force: true });
49947
+ fs28.rmSync(filePath, { force: true });
49910
49948
  rmEmptyDir(path37.dirname(filePath));
49911
49949
  return;
49912
49950
  }
49913
- fs27.mkdirSync(path37.dirname(filePath), { recursive: true });
49951
+ fs28.mkdirSync(path37.dirname(filePath), { recursive: true });
49914
49952
  const out = wasEmpty && !text2.endsWith("\n") ? text2 + "\n" : text2;
49915
- fs27.writeFileSync(filePath, (hadBom ? "\uFEFF" : "") + out);
49953
+ fs28.writeFileSync(filePath, (hadBom ? "\uFEFF" : "") + out);
49916
49954
  }
49917
49955
  function dirExists(p) {
49918
49956
  try {
49919
- return fs27.statSync(p).isDirectory();
49957
+ return fs28.statSync(p).isDirectory();
49920
49958
  } catch {
49921
49959
  return false;
49922
49960
  }
@@ -49924,7 +49962,7 @@ function dirExists(p) {
49924
49962
  function getInstalledVersion() {
49925
49963
  try {
49926
49964
  const pkgPath = path37.join(PACKAGE_ROOT, "package.json");
49927
- const pkg = JSON.parse(fs27.readFileSync(pkgPath, "utf8"));
49965
+ const pkg = JSON.parse(fs28.readFileSync(pkgPath, "utf8"));
49928
49966
  return pkg.version ?? null;
49929
49967
  } catch {
49930
49968
  return null;
@@ -49969,10 +50007,10 @@ function hasEnv(entry) {
49969
50007
  }
49970
50008
  function removeDirIfEmpty(dirPath) {
49971
50009
  try {
49972
- if (!fs28.existsSync(dirPath)) return;
49973
- if (!fs28.statSync(dirPath).isDirectory()) return;
49974
- if (fs28.readdirSync(dirPath).length > 0) return;
49975
- fs28.rmdirSync(dirPath);
50010
+ if (!fs29.existsSync(dirPath)) return;
50011
+ if (!fs29.statSync(dirPath).isDirectory()) return;
50012
+ if (fs29.readdirSync(dirPath).length > 0) return;
50013
+ fs29.rmdirSync(dirPath);
49976
50014
  } catch {
49977
50015
  }
49978
50016
  }
@@ -50007,7 +50045,7 @@ function isPinnedGlobalEntry(entry) {
50007
50045
  }
50008
50046
  function writeTomlOrRemove(filePath, data) {
50009
50047
  if (Object.keys(data).length === 0) {
50010
- fs28.rmSync(filePath, { force: true });
50048
+ fs29.rmSync(filePath, { force: true });
50011
50049
  removeDirIfEmpty(path38.dirname(filePath));
50012
50050
  return;
50013
50051
  }
@@ -50017,12 +50055,12 @@ function dirHasEditorEvidence(dir, looksArgentOnly) {
50017
50055
  return dirExists(dir) && !looksArgentOnly(dir);
50018
50056
  }
50019
50057
  function fileHasEditorEvidence(filePath, looksArgentOnly) {
50020
- return fs28.existsSync(filePath) && !looksArgentOnly(filePath);
50058
+ return fs29.existsSync(filePath) && !looksArgentOnly(filePath);
50021
50059
  }
50022
50060
  function parseJsoncStrict(filePath) {
50023
50061
  let raw;
50024
50062
  try {
50025
- raw = fs28.readFileSync(filePath, "utf8");
50063
+ raw = fs29.readFileSync(filePath, "utf8");
50026
50064
  } catch {
50027
50065
  return null;
50028
50066
  }
@@ -50035,14 +50073,14 @@ function parseJsoncStrict(filePath) {
50035
50073
  }
50036
50074
  function parseTomlStrict(filePath) {
50037
50075
  try {
50038
- return parse5(fs28.readFileSync(filePath, "utf8"));
50076
+ return parse5(fs29.readFileSync(filePath, "utf8"));
50039
50077
  } catch {
50040
50078
  return null;
50041
50079
  }
50042
50080
  }
50043
50081
  function parseYamlStrict(filePath) {
50044
50082
  try {
50045
- const parsed = (0, import_yaml6.parse)(fs28.readFileSync(filePath, "utf8"));
50083
+ const parsed = (0, import_yaml6.parse)(fs29.readFileSync(filePath, "utf8"));
50046
50084
  if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) return null;
50047
50085
  return parsed;
50048
50086
  } catch {
@@ -50065,7 +50103,7 @@ function bundledManagedNames(kind) {
50065
50103
  if (cached3) return cached3;
50066
50104
  let names;
50067
50105
  try {
50068
- names = new Set(fs28.readdirSync(kind === "rules" ? RULES_DIR : AGENTS_DIR));
50106
+ names = new Set(fs29.readdirSync(kind === "rules" ? RULES_DIR : AGENTS_DIR));
50069
50107
  } catch {
50070
50108
  names = /* @__PURE__ */ new Set();
50071
50109
  }
@@ -50076,7 +50114,7 @@ function bundledManagedNames(kind) {
50076
50114
  function managedDirLooksArgentOnly(dir, kind) {
50077
50115
  let entries;
50078
50116
  try {
50079
- entries = fs28.readdirSync(dir);
50117
+ entries = fs29.readdirSync(dir);
50080
50118
  } catch {
50081
50119
  return false;
50082
50120
  }
@@ -50088,7 +50126,7 @@ function managedDirLooksArgentOnly(dir, kind) {
50088
50126
  function cursorDirLooksArgentOnly(dir) {
50089
50127
  let entries;
50090
50128
  try {
50091
- entries = fs28.readdirSync(dir);
50129
+ entries = fs29.readdirSync(dir);
50092
50130
  } catch {
50093
50131
  return false;
50094
50132
  }
@@ -50127,7 +50165,7 @@ function claudeSettingsLooksArgentOnly(filePath) {
50127
50165
  function claudeDirLooksArgentOnly(dir) {
50128
50166
  let entries;
50129
50167
  try {
50130
- entries = fs28.readdirSync(dir);
50168
+ entries = fs29.readdirSync(dir);
50131
50169
  } catch {
50132
50170
  return false;
50133
50171
  }
@@ -50144,7 +50182,7 @@ function claudeDirLooksArgentOnly(dir) {
50144
50182
  function vscodeDirLooksArgentOnly(dir) {
50145
50183
  let entries;
50146
50184
  try {
50147
- entries = fs28.readdirSync(dir);
50185
+ entries = fs29.readdirSync(dir);
50148
50186
  } catch {
50149
50187
  return false;
50150
50188
  }
@@ -50156,7 +50194,7 @@ function vscodeDirLooksArgentOnly(dir) {
50156
50194
  function windsurfDirLooksArgentOnly(dir) {
50157
50195
  let entries;
50158
50196
  try {
50159
- entries = fs28.readdirSync(dir);
50197
+ entries = fs29.readdirSync(dir);
50160
50198
  } catch {
50161
50199
  return false;
50162
50200
  }
@@ -50193,7 +50231,7 @@ function zedSettingsLooksArgentOnly(filePath) {
50193
50231
  function zedDirLooksArgentOnly(dir) {
50194
50232
  let entries;
50195
50233
  try {
50196
- entries = fs28.readdirSync(dir);
50234
+ entries = fs29.readdirSync(dir);
50197
50235
  } catch {
50198
50236
  return false;
50199
50237
  }
@@ -50205,7 +50243,7 @@ function zedDirLooksArgentOnly(dir) {
50205
50243
  function geminiDirLooksArgentOnly(dir) {
50206
50244
  let entries;
50207
50245
  try {
50208
- entries = fs28.readdirSync(dir);
50246
+ entries = fs29.readdirSync(dir);
50209
50247
  } catch {
50210
50248
  return false;
50211
50249
  }
@@ -50230,7 +50268,7 @@ function hermesConfigLooksArgentOnly(filePath) {
50230
50268
  function hermesDirLooksArgentOnly(dir) {
50231
50269
  let entries;
50232
50270
  try {
50233
- entries = fs28.readdirSync(dir);
50271
+ entries = fs29.readdirSync(dir);
50234
50272
  } catch {
50235
50273
  return false;
50236
50274
  }
@@ -50242,7 +50280,7 @@ function hermesDirLooksArgentOnly(dir) {
50242
50280
  function kiroDirLooksArgentOnly(dir) {
50243
50281
  let entries;
50244
50282
  try {
50245
- entries = fs28.readdirSync(dir);
50283
+ entries = fs29.readdirSync(dir);
50246
50284
  } catch {
50247
50285
  return false;
50248
50286
  }
@@ -50252,7 +50290,7 @@ function kiroDirLooksArgentOnly(dir) {
50252
50290
  const settingsDir = path38.join(dir, entry);
50253
50291
  let settingsEntries;
50254
50292
  try {
50255
- settingsEntries = fs28.readdirSync(settingsDir);
50293
+ settingsEntries = fs29.readdirSync(settingsDir);
50256
50294
  } catch {
50257
50295
  return false;
50258
50296
  }
@@ -50265,7 +50303,7 @@ function kiroDirLooksArgentOnly(dir) {
50265
50303
  function codexDirLooksArgentOnly(dir) {
50266
50304
  let entries;
50267
50305
  try {
50268
- entries = fs28.readdirSync(dir);
50306
+ entries = fs29.readdirSync(dir);
50269
50307
  } catch {
50270
50308
  return false;
50271
50309
  }
@@ -50323,7 +50361,7 @@ var cursorAdapter = {
50323
50361
  });
50324
50362
  },
50325
50363
  remove(configPath) {
50326
- if (!fs28.existsSync(configPath)) return false;
50364
+ if (!fs29.existsSync(configPath)) return false;
50327
50365
  const config3 = readJsonc(configPath);
50328
50366
  const servers = config3.mcpServers;
50329
50367
  if (!servers?.[MCP_SERVER_KEY]) return false;
@@ -50331,7 +50369,7 @@ var cursorAdapter = {
50331
50369
  return true;
50332
50370
  },
50333
50371
  getArgentEntry(configPath) {
50334
- if (!fs28.existsSync(configPath)) return null;
50372
+ if (!fs29.existsSync(configPath)) return null;
50335
50373
  const config3 = readJsonc(configPath);
50336
50374
  const servers = config3.mcpServers;
50337
50375
  return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
@@ -50356,7 +50394,7 @@ var cursorAdapter = {
50356
50394
  removeAllowlist(_root, scope) {
50357
50395
  if (scope !== "global") return;
50358
50396
  const permPath = cursorPermissionsPath();
50359
- if (!fs28.existsSync(permPath)) return;
50397
+ if (!fs29.existsSync(permPath)) return;
50360
50398
  const config3 = readJsonc(permPath);
50361
50399
  const list = Array.isArray(config3.mcpAllowlist) ? config3.mcpAllowlist : void 0;
50362
50400
  if (!list || !list.includes(CURSOR_ALLOWLIST_PATTERN)) return;
@@ -50369,7 +50407,7 @@ function claudeProjectKeysForRoot(projects, root) {
50369
50407
  return Object.keys(projects).filter((key) => key === root || canonicalPath(key) === target);
50370
50408
  }
50371
50409
  function claudeDisabledListFinding(settingsPath, label, projectConfined) {
50372
- if (!fs28.existsSync(settingsPath)) return null;
50410
+ if (!fs29.existsSync(settingsPath)) return null;
50373
50411
  const disabled = readJson(settingsPath).disabledMcpjsonServers;
50374
50412
  if (!Array.isArray(disabled) || !disabled.includes(MCP_SERVER_KEY)) return null;
50375
50413
  return {
@@ -50416,7 +50454,7 @@ var claudeAdapter = {
50416
50454
  });
50417
50455
  },
50418
50456
  remove(configPath) {
50419
- if (!fs28.existsSync(configPath)) return false;
50457
+ if (!fs29.existsSync(configPath)) return false;
50420
50458
  const config3 = readJsonc(configPath);
50421
50459
  const servers = config3.mcpServers;
50422
50460
  if (!servers?.[MCP_SERVER_KEY]) return false;
@@ -50430,7 +50468,7 @@ var claudeAdapter = {
50430
50468
  return true;
50431
50469
  },
50432
50470
  getArgentEntry(configPath) {
50433
- if (!fs28.existsSync(configPath)) return null;
50471
+ if (!fs29.existsSync(configPath)) return null;
50434
50472
  const config3 = readJsonc(configPath);
50435
50473
  const servers = config3.mcpServers;
50436
50474
  return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
@@ -50520,7 +50558,7 @@ var vscodeAdapter = {
50520
50558
  });
50521
50559
  },
50522
50560
  remove(configPath) {
50523
- if (!fs28.existsSync(configPath)) return false;
50561
+ if (!fs29.existsSync(configPath)) return false;
50524
50562
  const config3 = readJsonc(configPath);
50525
50563
  const servers = config3.servers;
50526
50564
  if (!servers?.[MCP_SERVER_KEY]) return false;
@@ -50528,7 +50566,7 @@ var vscodeAdapter = {
50528
50566
  return true;
50529
50567
  },
50530
50568
  getArgentEntry(configPath) {
50531
- if (!fs28.existsSync(configPath)) return null;
50569
+ if (!fs29.existsSync(configPath)) return null;
50532
50570
  const config3 = readJsonc(configPath);
50533
50571
  const servers = config3.servers;
50534
50572
  return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
@@ -50606,7 +50644,7 @@ var windsurfAdapter = {
50606
50644
  });
50607
50645
  },
50608
50646
  remove(configPath) {
50609
- if (!fs28.existsSync(configPath)) return false;
50647
+ if (!fs29.existsSync(configPath)) return false;
50610
50648
  const config3 = readJsonc(configPath);
50611
50649
  const servers = config3.mcpServers;
50612
50650
  if (!servers?.[MCP_SERVER_KEY]) return false;
@@ -50614,7 +50652,7 @@ var windsurfAdapter = {
50614
50652
  return true;
50615
50653
  },
50616
50654
  getArgentEntry(configPath) {
50617
- if (!fs28.existsSync(configPath)) return null;
50655
+ if (!fs29.existsSync(configPath)) return null;
50618
50656
  const config3 = readJsonc(configPath);
50619
50657
  const servers = config3.mcpServers;
50620
50658
  return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
@@ -50637,7 +50675,7 @@ var windsurfAdapter = {
50637
50675
  if (scope !== "global") return;
50638
50676
  removeAllowRule(devinUserConfigPath(), DEVIN_PERMISSION_RULE);
50639
50677
  const configPath = path38.join(homedir6(), ".codeium", "windsurf", "mcp_config.json");
50640
- if (!fs28.existsSync(configPath)) return;
50678
+ if (!fs29.existsSync(configPath)) return;
50641
50679
  const config3 = readJsonc(configPath);
50642
50680
  const servers = config3.mcpServers;
50643
50681
  const entry = servers?.[MCP_SERVER_KEY];
@@ -50667,7 +50705,7 @@ var zedAdapter = {
50667
50705
  });
50668
50706
  },
50669
50707
  remove(configPath) {
50670
- if (!fs28.existsSync(configPath)) return false;
50708
+ if (!fs29.existsSync(configPath)) return false;
50671
50709
  const config3 = readJsonc(configPath);
50672
50710
  const servers = config3.context_servers;
50673
50711
  if (!servers?.[MCP_SERVER_KEY]) return false;
@@ -50675,7 +50713,7 @@ var zedAdapter = {
50675
50713
  return true;
50676
50714
  },
50677
50715
  getArgentEntry(configPath) {
50678
- if (!fs28.existsSync(configPath)) return null;
50716
+ if (!fs29.existsSync(configPath)) return null;
50679
50717
  const config3 = readJsonc(configPath);
50680
50718
  const servers = config3.context_servers;
50681
50719
  return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
@@ -50691,7 +50729,7 @@ var zedAdapter = {
50691
50729
  },
50692
50730
  removeAllowlist(root, scope) {
50693
50731
  const settingsPath = scope === "global" ? path38.join(homedir6(), ".config", "zed", "settings.json") : path38.join(root, ".zed", "settings.json");
50694
- if (!fs28.existsSync(settingsPath)) return;
50732
+ if (!fs29.existsSync(settingsPath)) return;
50695
50733
  const config3 = readJsonc(settingsPath);
50696
50734
  const perms = config3.agent?.tool_permissions;
50697
50735
  if (!perms || perms.default !== "allow") return;
@@ -50719,7 +50757,7 @@ var geminiAdapter = {
50719
50757
  });
50720
50758
  },
50721
50759
  remove(configPath) {
50722
- if (!fs28.existsSync(configPath)) return false;
50760
+ if (!fs29.existsSync(configPath)) return false;
50723
50761
  const config3 = readJsonc(configPath);
50724
50762
  const servers = config3.mcpServers;
50725
50763
  if (!servers?.[MCP_SERVER_KEY]) return false;
@@ -50727,7 +50765,7 @@ var geminiAdapter = {
50727
50765
  return true;
50728
50766
  },
50729
50767
  getArgentEntry(configPath) {
50730
- if (!fs28.existsSync(configPath)) return null;
50768
+ if (!fs29.existsSync(configPath)) return null;
50731
50769
  const config3 = readJsonc(configPath);
50732
50770
  const servers = config3.mcpServers;
50733
50771
  return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
@@ -50749,7 +50787,7 @@ var geminiAdapter = {
50749
50787
  },
50750
50788
  removeAllowlist(root, scope) {
50751
50789
  const configPath = scope === "global" ? this.globalPath() : this.projectPath(root);
50752
- if (!configPath || !fs28.existsSync(configPath)) {
50790
+ if (!configPath || !fs29.existsSync(configPath)) {
50753
50791
  return;
50754
50792
  }
50755
50793
  const config3 = readJsonc(configPath);
@@ -50785,7 +50823,7 @@ var codexAdapter = {
50785
50823
  writeToml(configPath, config3);
50786
50824
  },
50787
50825
  remove(configPath) {
50788
- if (!fs28.existsSync(configPath)) return false;
50826
+ if (!fs29.existsSync(configPath)) return false;
50789
50827
  const config3 = readToml(configPath);
50790
50828
  const servers = config3.mcp_servers;
50791
50829
  if (!servers?.[MCP_SERVER_KEY]) return false;
@@ -50795,7 +50833,7 @@ var codexAdapter = {
50795
50833
  return true;
50796
50834
  },
50797
50835
  getArgentEntry(configPath) {
50798
- if (!fs28.existsSync(configPath)) return null;
50836
+ if (!fs29.existsSync(configPath)) return null;
50799
50837
  const config3 = readToml(configPath);
50800
50838
  const servers = config3.mcp_servers;
50801
50839
  return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
@@ -50827,7 +50865,7 @@ var codexAdapter = {
50827
50865
  // them, and an emptied or removed table stays as it is.
50828
50866
  refreshAllowlist(root, scope) {
50829
50867
  const configPath = scope === "global" ? this.globalPath() : this.projectPath(root);
50830
- if (!configPath || !fs28.existsSync(configPath)) return;
50868
+ if (!configPath || !fs29.existsSync(configPath)) return;
50831
50869
  const config3 = readToml(configPath);
50832
50870
  const toolsConfig = config3.mcp_servers?.argent?.tools;
50833
50871
  if (!toolsConfig) return;
@@ -50889,7 +50927,7 @@ var hermesAdapter = {
50889
50927
  writeYaml(configPath, doc);
50890
50928
  },
50891
50929
  remove(configPath) {
50892
- if (!fs28.existsSync(configPath)) return false;
50930
+ if (!fs29.existsSync(configPath)) return false;
50893
50931
  const doc = readYaml(configPath);
50894
50932
  const servers = doc.get("mcp_servers");
50895
50933
  if (!(0, import_yaml6.isMap)(servers)) return false;
@@ -50902,7 +50940,7 @@ var hermesAdapter = {
50902
50940
  return true;
50903
50941
  },
50904
50942
  getArgentEntry(configPath) {
50905
- if (!fs28.existsSync(configPath)) return null;
50943
+ if (!fs29.existsSync(configPath)) return null;
50906
50944
  const doc = readYaml(configPath);
50907
50945
  const servers = doc.get("mcp_servers");
50908
50946
  if (!(0, import_yaml6.isMap)(servers)) return null;
@@ -50930,7 +50968,7 @@ function hasOpenCodeBinary() {
50930
50968
  function pickOpencodeConfig(dir, candidates) {
50931
50969
  for (const name of candidates) {
50932
50970
  const candidate = path38.join(dir, name);
50933
- if (fs28.existsSync(candidate)) return candidate;
50971
+ if (fs29.existsSync(candidate)) return candidate;
50934
50972
  }
50935
50973
  return path38.join(dir, "opencode.json");
50936
50974
  }
@@ -50954,7 +50992,7 @@ var openCodeAdapter = {
50954
50992
  });
50955
50993
  },
50956
50994
  remove(configPath) {
50957
- if (!fs28.existsSync(configPath)) return false;
50995
+ if (!fs29.existsSync(configPath)) return false;
50958
50996
  const config3 = readJsonc(configPath);
50959
50997
  const servers = config3.mcp;
50960
50998
  if (!servers?.[MCP_SERVER_KEY]) return false;
@@ -50962,7 +51000,7 @@ var openCodeAdapter = {
50962
51000
  return true;
50963
51001
  },
50964
51002
  getArgentEntry(configPath) {
50965
- if (!fs28.existsSync(configPath)) return null;
51003
+ if (!fs29.existsSync(configPath)) return null;
50966
51004
  const config3 = readJsonc(configPath);
50967
51005
  const servers = config3.mcp;
50968
51006
  return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
@@ -50977,7 +51015,7 @@ var openCodeAdapter = {
50977
51015
  },
50978
51016
  removeAllowlist(root, scope) {
50979
51017
  const configPath = scope === "global" ? this.globalPath() : this.projectPath(root);
50980
- if (!configPath || !fs28.existsSync(configPath)) return;
51018
+ if (!configPath || !fs29.existsSync(configPath)) return;
50981
51019
  const config3 = readJsonc(configPath);
50982
51020
  const tools2 = config3.tools;
50983
51021
  if (!tools2 || !(OPENCODE_ALLOWLIST_PATTERN in tools2)) return;
@@ -51007,7 +51045,7 @@ var kiroAdapter = {
51007
51045
  });
51008
51046
  },
51009
51047
  remove(configPath) {
51010
- if (!fs28.existsSync(configPath)) return false;
51048
+ if (!fs29.existsSync(configPath)) return false;
51011
51049
  const config3 = readJsonc(configPath);
51012
51050
  const servers = config3.mcpServers;
51013
51051
  if (!servers?.[MCP_SERVER_KEY]) return false;
@@ -51015,7 +51053,7 @@ var kiroAdapter = {
51015
51053
  return true;
51016
51054
  },
51017
51055
  getArgentEntry(configPath) {
51018
- if (!fs28.existsSync(configPath)) return null;
51056
+ if (!fs29.existsSync(configPath)) return null;
51019
51057
  const config3 = readJsonc(configPath);
51020
51058
  const servers = config3.mcpServers;
51021
51059
  return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
@@ -51039,7 +51077,7 @@ var kiroAdapter = {
51039
51077
  },
51040
51078
  removeAllowlist(root, scope) {
51041
51079
  const configPath = scope === "global" ? this.globalPath() : this.projectPath(root);
51042
- if (!configPath || !fs28.existsSync(configPath)) return;
51080
+ if (!configPath || !fs29.existsSync(configPath)) return;
51043
51081
  const config3 = readJsonc(configPath);
51044
51082
  const servers = config3.mcpServers;
51045
51083
  const entry = servers?.[MCP_SERVER_KEY];
@@ -51091,7 +51129,7 @@ function addAllowRule(settingsPath, rule) {
51091
51129
  editJsoncFile(settingsPath, ["permissions", "allow"], [...allow, rule]);
51092
51130
  }
51093
51131
  function removeAllowRule(settingsPath, rule) {
51094
- if (!fs28.existsSync(settingsPath)) return;
51132
+ if (!fs29.existsSync(settingsPath)) return;
51095
51133
  const config3 = readJsonc(settingsPath);
51096
51134
  const permissions = config3?.permissions;
51097
51135
  const allow = permissions?.allow;
@@ -51215,7 +51253,7 @@ import * as path39 from "node:path";
51215
51253
 
51216
51254
  // ../argent-installer/src/cli-record.ts
51217
51255
  var import_semver4 = __toESM(require_semver2(), 1);
51218
- import * as fs29 from "node:fs";
51256
+ import * as fs30 from "node:fs";
51219
51257
  import * as path40 from "node:path";
51220
51258
 
51221
51259
  // ../argent-installer/src/init-telemetry.ts
@@ -51269,7 +51307,7 @@ var INSTALL_UNCLASSIFIED_FAILED = {
51269
51307
  };
51270
51308
 
51271
51309
  // ../argent-installer/src/install-runner.ts
51272
- import * as fs32 from "node:fs";
51310
+ import * as fs33 from "node:fs";
51273
51311
  import * as path43 from "node:path";
51274
51312
 
51275
51313
  // ../argent-installer/src/shell.ts
@@ -51277,12 +51315,12 @@ import { execFileSync as execFileSync9, spawn as spawn5 } from "node:child_proce
51277
51315
 
51278
51316
  // ../argent-installer/src/skills.ts
51279
51317
  import { execFileSync as execFileSync11 } from "node:child_process";
51280
- import * as fs31 from "node:fs";
51318
+ import * as fs32 from "node:fs";
51281
51319
  import * as path42 from "node:path";
51282
51320
 
51283
51321
  // ../argent-installer/src/skills-runner.ts
51284
51322
  import { execFileSync as execFileSync10 } from "node:child_process";
51285
- import * as fs30 from "node:fs";
51323
+ import * as fs31 from "node:fs";
51286
51324
  import * as path41 from "node:path";
51287
51325
 
51288
51326
  // ../argent-installer/src/init-scope.ts
@@ -51296,7 +51334,7 @@ import * as path44 from "node:path";
51296
51334
 
51297
51335
  // ../argent-installer/src/update.ts
51298
51336
  var import_semver5 = __toESM(require_semver2(), 1);
51299
- import * as fs33 from "node:fs";
51337
+ import * as fs34 from "node:fs";
51300
51338
  import * as os9 from "node:os";
51301
51339
  import * as path45 from "node:path";
51302
51340
 
@@ -51343,7 +51381,7 @@ var UPDATE_UNCLASSIFIED_FAILED = {
51343
51381
 
51344
51382
  // ../argent-installer/src/uninstall.ts
51345
51383
  var import_yaml7 = __toESM(require_dist2(), 1);
51346
- import * as fs34 from "node:fs";
51384
+ import * as fs35 from "node:fs";
51347
51385
  import * as path46 from "node:path";
51348
51386
  var UNINSTALL_TOOLSERVER_STOP_FAILED = {
51349
51387
  error_code: FAILURE_CODES.UNINSTALL_TOOLSERVER_STOP_FAILED,
@@ -51433,14 +51471,14 @@ function classifyNodeScript(entry, ctx) {
51433
51471
  const script = entry.args.find((arg) => !arg.startsWith("-"));
51434
51472
  if (!script) return entryCheck("info", entry, "custom command, not checked");
51435
51473
  if (path47.isAbsolute(script)) {
51436
- return fs35.existsSync(script) ? entryCheck("ok", entry) : entryCheck("error", entry, `${script} does not exist`, {
51474
+ return fs36.existsSync(script) ? entryCheck("ok", entry) : entryCheck("error", entry, `${script} does not exist`, {
51437
51475
  fix: `${ctx.argentCommand} init`
51438
51476
  });
51439
51477
  }
51440
- if (!fs35.existsSync(path47.resolve(ctx.projectRoot, script))) {
51478
+ if (!fs36.existsSync(path47.resolve(ctx.projectRoot, script))) {
51441
51479
  return entryCheck("error", entry, `${script} does not exist`, { fix: ctx.projectInstallFix });
51442
51480
  }
51443
- if (!fs35.existsSync(path47.resolve(ctx.cwd, script))) {
51481
+ if (!fs36.existsSync(path47.resolve(ctx.cwd, script))) {
51444
51482
  return entryCheck("error", entry, `${script} is relative to ${home(ctx.projectRoot)}`, {
51445
51483
  detail: "an editor started in this folder cannot find it",
51446
51484
  fix: `Start the editor in ${home(ctx.projectRoot)}`
@@ -51449,13 +51487,13 @@ function classifyNodeScript(entry, ctx) {
51449
51487
  return entryCheck("ok", entry);
51450
51488
  }
51451
51489
  function classifyPinnedEntry(entry, initFix) {
51452
- const missing = [entry.command, entry.args[0]].find((p) => !fs35.existsSync(p));
51490
+ const missing = [entry.command, entry.args[0]].find((p) => !fs36.existsSync(p));
51453
51491
  return missing ? entryCheck("error", entry, `${missing} does not exist`, { fix: initFix }) : entryCheck("ok", entry);
51454
51492
  }
51455
51493
  function isRunnableFile(file2) {
51456
51494
  try {
51457
- if (!fs35.statSync(file2).isFile()) return false;
51458
- if (process.platform !== "win32") fs35.accessSync(file2, fs35.constants.X_OK);
51495
+ if (!fs36.statSync(file2).isFile()) return false;
51496
+ if (process.platform !== "win32") fs36.accessSync(file2, fs36.constants.X_OK);
51459
51497
  return true;
51460
51498
  } catch {
51461
51499
  return false;
@@ -51498,7 +51536,7 @@ function classifyMcpEntry(entry, ctx) {
51498
51536
  if (entry.command === MCP_BINARY_NAME) return classifyArgentOnPath(entry, ctx);
51499
51537
  if (Object.hasOwn(RUNNER_PACKAGES, entry.command)) return classifyPackageRunner(entry, ctx);
51500
51538
  if (isPinnedGlobalEntry(entry)) return classifyPinnedEntry(entry, initFix);
51501
- if (path47.isAbsolute(entry.command) && !fs35.existsSync(entry.command)) {
51539
+ if (path47.isAbsolute(entry.command) && !fs36.existsSync(entry.command)) {
51502
51540
  return entryCheck("error", entry, `${entry.command} does not exist`, { fix: initFix });
51503
51541
  }
51504
51542
  return entryCheck("info", entry, "custom command, not checked");
@@ -51549,7 +51587,7 @@ function brokenUnconfiguredConfigs({ projectRoot, cwd }, configured) {
51549
51587
  function mayHoldArgentEntry({ scope, configPath }) {
51550
51588
  if (scope === "project") return true;
51551
51589
  try {
51552
- return fs35.readFileSync(configPath, "utf8").includes(MCP_SERVER_KEY);
51590
+ return fs36.readFileSync(configPath, "utf8").includes(MCP_SERVER_KEY);
51553
51591
  } catch {
51554
51592
  return false;
51555
51593
  }
@@ -51589,7 +51627,7 @@ function editorsSection(ctx) {
51589
51627
  }
51590
51628
  function listRuleFiles(rulesDir = RULES_DIR) {
51591
51629
  try {
51592
- return fs35.readdirSync(rulesDir).filter((f) => f.endsWith(".md"));
51630
+ return fs36.readdirSync(rulesDir).filter((f) => f.endsWith(".md"));
51593
51631
  } catch {
51594
51632
  return [];
51595
51633
  }
@@ -51610,7 +51648,7 @@ function summarizeList(items, shown = 5) {
51610
51648
  function localContentDir(ctx, name) {
51611
51649
  if (!ctx.localPackageDir) return void 0;
51612
51650
  const dir = path47.join(ctx.localPackageDir, name);
51613
- return fs35.existsSync(dir) ? dir : void 0;
51651
+ return fs36.existsSync(dir) ? dir : void 0;
51614
51652
  }
51615
51653
  function skillsSection(ctx) {
51616
51654
  const checks = [];
@@ -51618,7 +51656,7 @@ function skillsSection(ctx) {
51618
51656
  const initFix = `${ctx.argentCommand} init`;
51619
51657
  const bundled = listBundledSkills(localContentDir(ctx, "skills"));
51620
51658
  const missing = bundled.filter(
51621
- (skill) => !skillDirs.some((dir) => fs35.existsSync(path47.join(dir, skill)))
51659
+ (skill) => !skillDirs.some((dir) => fs36.existsSync(path47.join(dir, skill)))
51622
51660
  );
51623
51661
  if (bundled.length > 0 && missing.length === bundled.length) {
51624
51662
  checks.push(check2("warn", "No argent skills installed", { fix: initFix }));
@@ -51638,7 +51676,7 @@ function skillsSection(ctx) {
51638
51676
  }
51639
51677
  const ruleFiles = listRuleFiles(localContentDir(ctx, "rules"));
51640
51678
  for (const dir of ruleDirs) {
51641
- const absent = ruleFiles.filter((f) => !fs35.existsSync(path47.join(dir, f)));
51679
+ const absent = ruleFiles.filter((f) => !fs36.existsSync(path47.join(dir, f)));
51642
51680
  checks.push(
51643
51681
  absent.length === 0 ? check2("ok", `Rules present in ${home(dir)}`) : check2("warn", `Rules missing in ${home(dir)}`, {
51644
51682
  detail: absent.join(", "),
@@ -51665,7 +51703,7 @@ async function probeHostDeps(paths) {
51665
51703
  }
51666
51704
  function xcodesIn(dir) {
51667
51705
  try {
51668
- return fs35.readdirSync(dir).filter((name) => /^Xcode(?:[-_ ].*)?\.app$/.test(name)).map((name) => path47.join(dir, name));
51706
+ return fs36.readdirSync(dir).filter((name) => /^Xcode(?:[-_ ].*)?\.app$/.test(name)).map((name) => path47.join(dir, name));
51669
51707
  } catch {
51670
51708
  return [];
51671
51709
  }
@@ -51738,7 +51776,7 @@ function hasClaudeProjectConfig(dir) {
51738
51776
  }
51739
51777
  function ancestorsInRepo(dir, homeDir) {
51740
51778
  const ancestors = ancestorsBelowHome(dir, homeDir);
51741
- const repoIndex = [dir, ...ancestors].findIndex((d) => fs35.existsSync(path47.join(d, ".git")));
51779
+ const repoIndex = [dir, ...ancestors].findIndex((d) => fs36.existsSync(path47.join(d, ".git")));
51742
51780
  return repoIndex === -1 ? ancestors : ancestors.slice(0, repoIndex);
51743
51781
  }
51744
51782
  function ancestorsBelowHome(dir, homeDir) {
@@ -51759,7 +51797,7 @@ function resolveDoctorRoot(cwd, homeDir = homedir9()) {
51759
51797
  function crossesGitRoot(cwd, projectRoot) {
51760
51798
  const dirs = [cwd, ...ancestorsBelowHome(cwd, path47.resolve(homedir9()))];
51761
51799
  const rootIndex = dirs.indexOf(projectRoot);
51762
- return rootIndex > 0 && dirs.slice(0, rootIndex).some((d) => fs35.existsSync(path47.join(d, ".git")));
51800
+ return rootIndex > 0 && dirs.slice(0, rootIndex).some((d) => fs36.existsSync(path47.join(d, ".git")));
51763
51801
  }
51764
51802
  function readsConfigAt(editor, aboveRepo) {
51765
51803
  return !aboveRepo || editor === "Claude Code";