@swmansion/argent 0.34.1-next.1 → 0.34.1-next.10

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.
@@ -15203,31 +15203,6 @@ function readConfigObject(scope = "global", options = {}) {
15203
15203
  }
15204
15204
  return {};
15205
15205
  }
15206
- var FORBIDDEN_SEGMENTS = /* @__PURE__ */ new Set(["__proto__", "prototype", "constructor"]);
15207
- function splitKey(dottedKey) {
15208
- const parts = dottedKey.split(".");
15209
- if (parts.length === 0 || parts.some((p) => p === "")) {
15210
- throw new Error(`Invalid config key "${dottedKey}": empty path segment`);
15211
- }
15212
- for (const p of parts) {
15213
- if (FORBIDDEN_SEGMENTS.has(p)) {
15214
- throw new Error(`Invalid config key "${dottedKey}": forbidden segment "${p}"`);
15215
- }
15216
- }
15217
- return parts;
15218
- }
15219
- function isPlainObject(value) {
15220
- return !!value && typeof value === "object" && !Array.isArray(value);
15221
- }
15222
- function getAtPath(obj, dottedKey) {
15223
- const parts = splitKey(dottedKey);
15224
- let cur = obj;
15225
- for (const part of parts) {
15226
- if (!isPlainObject(cur)) return void 0;
15227
- cur = cur[part];
15228
- }
15229
- return cur;
15230
- }
15231
15206
  var LOCK_STALE_MS = 1e4;
15232
15207
  var LOCK_MAX_WAIT_MS = 2e3;
15233
15208
  var LOCK_RETRY_MS = 25;
@@ -15305,57 +15280,6 @@ var import_dotenv = __toESM(require_dist(), 1);
15305
15280
  import * as fs4 from "node:fs";
15306
15281
  import * as path5 from "node:path";
15307
15282
 
15308
- // ../configuration-core/src/merge.ts
15309
- function mergeRestrictive(local, global2) {
15310
- if (local === void 0) return global2;
15311
- if (global2 === void 0) return local;
15312
- if (typeof local === "boolean" && typeof global2 === "boolean") {
15313
- return local && global2;
15314
- }
15315
- if (typeof local === "number" && typeof global2 === "number") {
15316
- return Math.min(local, global2);
15317
- }
15318
- return local;
15319
- }
15320
- function toArray(value) {
15321
- return Array.isArray(value) ? value : null;
15322
- }
15323
- function mergeUnion(local, global2) {
15324
- const l2 = toArray(local);
15325
- const g = toArray(global2);
15326
- if (l2 === null && g === null) return local ?? global2;
15327
- const merged = [...g ?? [], ...l2 ?? []];
15328
- return Array.from(new Set(merged));
15329
- }
15330
- function mergeIntersection(local, global2) {
15331
- const l2 = toArray(local);
15332
- const g = toArray(global2);
15333
- if (l2 === null && g === null) return local ?? global2;
15334
- if (l2 === null) return global2;
15335
- if (g === null) return local;
15336
- const globalSet = new Set(g);
15337
- return l2.filter((item) => globalSet.has(item));
15338
- }
15339
- function applyMergePolicy(policy, local, global2) {
15340
- if (typeof policy === "function") return policy({ local, global: global2 });
15341
- switch (policy) {
15342
- case "prioritize-local":
15343
- return local ?? global2;
15344
- case "prioritize-global":
15345
- return global2 ?? local;
15346
- case "prioritize-restrictive":
15347
- return mergeRestrictive(local, global2);
15348
- case "union":
15349
- return mergeUnion(local, global2);
15350
- case "intersection":
15351
- return mergeIntersection(local, global2);
15352
- default: {
15353
- const _exhaustive = policy;
15354
- return _exhaustive;
15355
- }
15356
- }
15357
- }
15358
-
15359
15283
  // ../configuration-core/src/config-schema.ts
15360
15284
  import { isAbsolute } from "node:path";
15361
15285
  function asBoolean(raw) {
@@ -15393,14 +15317,6 @@ var CONFIG_SCHEMA = [
15393
15317
  // drained/reset, not just the file rewritten.
15394
15318
  manageCommand: "argent telemetry"
15395
15319
  },
15396
- {
15397
- key: "allowlist.enabled",
15398
- description: "Whether `argent update` re-applies editor auto-approve allowlist rules. Unset (the default) keeps the current behavior: update refreshes the rules for editors that already have argent configured. Set to `false` to keep update from touching editor allowlists. `false` in either scope wins, so a committed project opt-out holds for every teammate.",
15399
- scopes: ["project", "global"],
15400
- parse: asBoolean,
15401
- merge: "prioritize-restrictive",
15402
- example: "false"
15403
- },
15404
15320
  {
15405
15321
  key: "lens.agent",
15406
15322
  description: "Coding-agent id remembered by `argent lens` to skip the picker.",
@@ -15484,42 +15400,9 @@ var CONFIG_SCHEMA = [
15484
15400
  example: "512"
15485
15401
  }
15486
15402
  ];
15487
- function getConfigDefinition(key, registry = CONFIG_SCHEMA) {
15488
- return registry.find((def) => def.key === key);
15489
- }
15490
15403
 
15491
15404
  // ../configuration-core/src/config-access.ts
15492
15405
  import * as path6 from "node:path";
15493
- function readScopeValue(def, scope, options) {
15494
- if (!def.scopes.includes(scope)) return void 0;
15495
- const raw = getAtPath(readConfigObject(scope, options), def.key);
15496
- return raw === void 0 ? void 0 : def.parse(raw);
15497
- }
15498
- function getConfigValue(def, options = {}) {
15499
- const local = readScopeValue(def, "project", options);
15500
- const global2 = readScopeValue(def, "global", options);
15501
- const merged = applyMergePolicy(def.merge, local, global2);
15502
- return merged ?? def.default;
15503
- }
15504
- function getConfigValueByKey(key, options = {}, registry = CONFIG_SCHEMA) {
15505
- const def = requireDefinition(key, registry);
15506
- return getConfigValue(def, options);
15507
- }
15508
- function requireDefinition(key, registry = CONFIG_SCHEMA) {
15509
- const def = getConfigDefinition(key, registry);
15510
- if (!def) {
15511
- throw new UnknownConfigKeyError(key);
15512
- }
15513
- return def;
15514
- }
15515
- var UnknownConfigKeyError = class extends Error {
15516
- constructor(key) {
15517
- super(`Unknown configuration key "${key}".`);
15518
- this.key = key;
15519
- this.name = "UnknownConfigKeyError";
15520
- }
15521
- key;
15522
- };
15523
15406
 
15524
15407
  // ../telemetry/src/paths.ts
15525
15408
  function identityFilePath() {
@@ -15884,6 +15767,10 @@ var FAILURE_CODES = {
15884
15767
  AX_DAEMON_READY_TIMEOUT: "AX_DAEMON_READY_TIMEOUT",
15885
15768
  AX_DAEMON_EXITED_BEFORE_READY: "AX_DAEMON_EXITED_BEFORE_READY",
15886
15769
  AX_DAEMON_PROCESS_ERROR: "AX_DAEMON_PROCESS_ERROR",
15770
+ // The daemon died on a fault signal (SIGSEGV, SIGABRT, ...), before or after
15771
+ // it connected. Kept apart from the two codes above so a crash is not read
15772
+ // as an ordinary exit.
15773
+ AX_DAEMON_CRASHED: "AX_DAEMON_CRASHED",
15887
15774
  AX_FACTORY_OPTIONS_MISSING: "AX_FACTORY_OPTIONS_MISSING",
15888
15775
  AX_WRONG_PLATFORM: "AX_WRONG_PLATFORM",
15889
15776
  AX_DEVICE_ID_INVALID: "AX_DEVICE_ID_INVALID",
@@ -16379,7 +16266,8 @@ var ALLOWED = {
16379
16266
  install_mode: INSTALL_MODE
16380
16267
  },
16381
16268
  "installation:allowlist_decision": {
16382
- is_enabled: bool
16269
+ is_enabled: bool,
16270
+ decided_by: oneOf(["flag", "default", "prompt"])
16383
16271
  },
16384
16272
  "installation:stale_config_cleanup": {
16385
16273
  removed_count: COUNT,
@@ -16989,7 +16877,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
16989
16877
  var SESSION_ID = randomUUID4();
16990
16878
  function readCliVersion() {
16991
16879
  if (true) {
16992
- return "0.34.1-next.1";
16880
+ return "0.34.1-next.10";
16993
16881
  }
16994
16882
  return "0.0.0";
16995
16883
  }
@@ -20391,6 +20279,64 @@ var RETIRED_BUNDLED_PATHS = {
20391
20279
  ],
20392
20280
  rules: []
20393
20281
  };
20282
+ var RETIRED_GLOBAL_RULES = [
20283
+ {
20284
+ path: "argent.md",
20285
+ shipped: [
20286
+ "bfb07b5ad949f63ab9b41919f2c24c937b163c7644d6760fa8afda4f68c809f7",
20287
+ "90f6b24882ae077c8d5129652e7630c1b2a5651f5e800474d3b6e223222049f1",
20288
+ "cbf6cb5d898c14cd3460c85a15fd9ceeb7b3fed669df7e0932e61cad93a5a6fe",
20289
+ "ac8d19e2ece55ff6b7c554fd6a4a3eebc5a09af1eb95f6625f96781bb45505e2",
20290
+ "30bbef749f18d4fde7a5501941d58decf1e8abb2ca8c4e51f63e72bab3d863e2",
20291
+ "81663dc2f70aa2111388092e6027d27eddd89e9b5bdfb16043bdc96088d6850d",
20292
+ "5e3143dea13d15a9c80c7e24a1a3e4e1fb3ed34c8a077eccb74cb6e2a8a1c4a3",
20293
+ "51f8360f997c6bfcfb51c4c99d5f8b3a3b632ca4ca43a7f4ba5e7d8e8881798d",
20294
+ "5e27f0ed6dbdb4def30163387485b3c783c702bbc6594bc210d236454b6c5780",
20295
+ "06391305389e958b127a832de9977dc75a2164355a924bddb312b824656a8f72",
20296
+ "09ac21fd92efa4fc877e951475a0488a78ba4dbdfba63d6f1efd761c9f625866",
20297
+ "45fc6a4bf294af60e73ec9ab3c02219627767b5622467f7a57bb5b6976fd4126",
20298
+ "2f4eb998af8b5106b5fb49f19efd282d38366316c4a78f7123bc3d005c5848a4",
20299
+ "e425ebaafba2eeeb02f714d3e0b1ce19e0844fc4d661dbbd25bf6086ffc714b0",
20300
+ "d6cc846c1d3444bf8eaee6aa313a207e8c7a94391041df9d2a2908088c0191a7",
20301
+ "ad0f23a946e9bbc721a16b17a9516bf2570e7529094da0677f33ed63d43e0caa",
20302
+ "b1ce95af4c0e57cb478a148b6b8744ad4f8f15522441e566c0c6f7210c78fc79",
20303
+ "e3dc376ba736cef94de401bd5457c3df0192128164cbb44ac3e2ece57ad1af66",
20304
+ "aa43aeb338a5d0f50c425d8163dc697b9ffd7042539be05a67ed3ed85e8ba60f",
20305
+ "983f29ab70a565367bda4fbed705eb41fbe7b6767c70eb0569d2501f298e72c4",
20306
+ "251487afb2fda1707a27701be7fcc33b481e0176d43a4c946287a35595d26585",
20307
+ "933e657ec8789e57db8164fc2f58a692e9dc889bebd131eaa0f2017ef055add8",
20308
+ "35ea33df169b390d331733ab325dbf23b3804bc25927908e6050977563d7b10c",
20309
+ "7a89d0406784242b03ca187a2740898d4f69ccb7b76508ec373ad2aba5fb0a2c",
20310
+ "fa69c9e943572ab603b1318bc9a5c07f9d0e7c8f2cc208f6e29a6795991dab73",
20311
+ "192013fdee1954ba013985c022d91f37bbc34bf36ae4bcd76ab2cdf2f2b3f341",
20312
+ "4476fd58e33ede9cc938da7e954781fa8d5805f18cd71701cdaa4ec3bcabb085",
20313
+ "db80ca8efbe5dd775153ab39c63d4c387d1b5d864a1e7eae21fbd158f05d9e54",
20314
+ "32f3d3915f04fb43c4e835e076ec26ed7d88232f66963538308233c19055c951",
20315
+ "7aee698f1b8e5ed0399f45a72435961847b96097322e5f3391fd31adf03b8180",
20316
+ "1829b14538d913852bacb82a50d79cade45ea56c78fb2bc85e6e46f0f9ac6439",
20317
+ "c012bec1b6a225a0f03b7fc9133746d2130ce8f45cd1c2c86559bc31cafd81f7",
20318
+ "11f62b29badb21f0489e835975e5fa62b996188ed7194d01590b5eb6f020615b",
20319
+ "b83879ae5540a9e46140c5a1d0f93599e9aa48fbe752aba12db7a93cd8940834",
20320
+ "ec38c5e586782f376daec565302b3548fd22ea3236c384f9bb37b1d16bde3f39",
20321
+ "c40437e8afb99cc4cd6005ae3710d861b6f0af0da0f1de35499f4cb9ac790999",
20322
+ "4d62da692bc8735f3979f54e6c7e2c3b2e9d530e5898958aa41a869b5e9e6f11",
20323
+ "bec052b7cf7668da7f1cdddb5bae4c50b6db87ece0ec6930f1229e6e0bb8f96e",
20324
+ "0fffc00cc3d6fe32c93d857c8b4f8ad9754f7daf76c51cda6acc86aa5487e1e6",
20325
+ "1cb7d1f65d5014954a6d25bde4c9a271910ffed240899178b8dbf9e138ce83f3",
20326
+ "e3bc44c749ba6cecd50d1e4dc45c1dd3d896414982b339f07d62351c396e975d",
20327
+ "db0435ad74da7ba0e3ec362aab60c011ac24caa8aa9630dc77393058710c0deb",
20328
+ "aec395f5fdccc42c13ff39263ab101c5bebe68ed4181ee126a819c3a0a45aa94",
20329
+ "4867ae2b7f8bb207bad663759487b729be8bf58f9523d4589b885e5857966cc1",
20330
+ "5f9efed48536447a7ffc8d68b8a43eb20bceeb2adab884352f20cbbe5be37ac5",
20331
+ "51d5d412d5ff4edbc2dc837c33978d85678b5ff6461c987944469f535dbcc295",
20332
+ "d28de55c47c64bd9f7a7493825e1913f9fbf317976d6981f71ae24fb21631dea",
20333
+ "cb9a8c33b1dc6c1188674a1a846e97d1b3a58b2c386021b63139cfd33c1abe6c",
20334
+ "33bae8d5c6e38a730e15ceab19335145ed06988d475696690302daa1bf1221f3",
20335
+ "5f9b146efdac28c3d67a8b1fcdca3ab5950b69e7c74defa7dca5cbf4e44cc98a",
20336
+ "af428399983712d11e4cfc9999bd600ba5121f17acb1ce97f70e695ef68772b2"
20337
+ ]
20338
+ }
20339
+ ];
20394
20340
  function hashBundledContent(content) {
20395
20341
  return createHash2("sha256").update(content.replace(/\r\n/g, "\n")).digest("hex");
20396
20342
  }
@@ -20608,7 +20554,8 @@ function readRetiredFile(targetDir, relativePath) {
20608
20554
  function findRetiredFiles(retired, bundleDir, targetDir) {
20609
20555
  const found = [];
20610
20556
  for (const { path: relativePath, shipped } of retired) {
20611
- if (fs16.existsSync(path17.join(bundleDir, ...relativePath.split("/")))) continue;
20557
+ if (bundleDir !== null && fs16.existsSync(path17.join(bundleDir, ...relativePath.split("/"))))
20558
+ continue;
20612
20559
  const content = readRetiredFile(targetDir, relativePath);
20613
20560
  if (content === null) continue;
20614
20561
  const sha256 = hashBundledContent(content);
@@ -20735,6 +20682,21 @@ function getAvailableToolIds() {
20735
20682
  const tools = JSON.parse(out);
20736
20683
  return tools.map((t2) => t2.id);
20737
20684
  }
20685
+ function existingEntryKeys(configPath, serversKey, keys) {
20686
+ let entry;
20687
+ try {
20688
+ entry = readJsonc(configPath)[serversKey]?.[MCP_SERVER_KEY];
20689
+ } catch {
20690
+ return {};
20691
+ }
20692
+ if (!entry || typeof entry !== "object" || Array.isArray(entry)) return {};
20693
+ const kept = {};
20694
+ for (const key of keys) {
20695
+ const value = entry[key];
20696
+ if (value !== void 0) kept[key] = value;
20697
+ }
20698
+ return kept;
20699
+ }
20738
20700
  function buildMcpEntry(mode = { kind: "global" }) {
20739
20701
  switch (mode.kind) {
20740
20702
  case "local-node":
@@ -21110,6 +21072,13 @@ function codexDirLooksArgentOnly(dir) {
21110
21072
  return false;
21111
21073
  });
21112
21074
  }
21075
+ function cursorPermissionsPath() {
21076
+ return path18.join(homedir4(), ".cursor", "permissions.json");
21077
+ }
21078
+ function cursorPermissionsList() {
21079
+ const list = readJsonc(cursorPermissionsPath()).mcpAllowlist;
21080
+ return Array.isArray(list) ? list : null;
21081
+ }
21113
21082
  var cursorAdapter = {
21114
21083
  name: "Cursor",
21115
21084
  detect() {
@@ -21149,16 +21118,21 @@ var cursorAdapter = {
21149
21118
  },
21150
21119
  // The allowlist lives in a separate ~/.cursor/permissions.json that may carry
21151
21120
  // the user's own rules, so edit that one key instead of rewriting the file.
21121
+ // Only a file that already has an mcpAllowlist is edited. Once that key is
21122
+ // non-empty, Cursor enforces the file: Run Everything drops to Allowlist, and
21123
+ // the file's list replaces the in-IDE one. Under Run Everything the rule does
21124
+ // nothing anyway, and without the file the user approves argent in Cursor.
21125
+ allowlistSkipReason() {
21126
+ return cursorPermissionsList() === null ? "creating ~/.cursor/permissions.json would turn off Cursor's Run Everything mode; approve argent in Cursor instead" : null;
21127
+ },
21152
21128
  addAllowlist() {
21153
- const permPath = path18.join(homedir4(), ".cursor", "permissions.json");
21154
- const config = readJsonc(permPath);
21155
- const list = Array.isArray(config.mcpAllowlist) ? config.mcpAllowlist : [];
21156
- if (list.includes(CURSOR_ALLOWLIST_PATTERN)) return;
21157
- editJsoncFile(permPath, ["mcpAllowlist"], [...list, CURSOR_ALLOWLIST_PATTERN]);
21129
+ const list = cursorPermissionsList();
21130
+ if (list === null || list.includes(CURSOR_ALLOWLIST_PATTERN)) return;
21131
+ editJsoncFile(cursorPermissionsPath(), ["mcpAllowlist"], [...list, CURSOR_ALLOWLIST_PATTERN]);
21158
21132
  },
21159
21133
  removeAllowlist(_root, scope) {
21160
21134
  if (scope !== "global") return;
21161
- const permPath = path18.join(homedir4(), ".cursor", "permissions.json");
21135
+ const permPath = cursorPermissionsPath();
21162
21136
  if (!fs17.existsSync(permPath)) return;
21163
21137
  const config = readJsonc(permPath);
21164
21138
  const list = Array.isArray(config.mcpAllowlist) ? config.mcpAllowlist : void 0;
@@ -21411,7 +21385,8 @@ var windsurfAdapter = {
21411
21385
  editJsoncFile(configPath, ["mcpServers", MCP_SERVER_KEY], {
21412
21386
  command: entry.command,
21413
21387
  args: entry.args,
21414
- ...hasEnv(entry) ? { env: entry.env } : {}
21388
+ ...hasEnv(entry) ? { env: entry.env } : {},
21389
+ ...existingEntryKeys(configPath, "mcpServers", ["alwaysAllow"])
21415
21390
  });
21416
21391
  },
21417
21392
  remove(configPath) {
@@ -21523,7 +21498,8 @@ var geminiAdapter = {
21523
21498
  editJsoncFile(configPath, ["mcpServers", MCP_SERVER_KEY], {
21524
21499
  command: entry.command,
21525
21500
  args: entry.args,
21526
- ...hasEnv(entry) ? { env: entry.env } : {}
21501
+ ...hasEnv(entry) ? { env: entry.env } : {},
21502
+ ...existingEntryKeys(configPath, "mcpServers", ["trust"])
21527
21503
  });
21528
21504
  },
21529
21505
  remove(configPath) {
@@ -21582,10 +21558,12 @@ var codexAdapter = {
21582
21558
  write(configPath, entry) {
21583
21559
  const config = readToml(configPath);
21584
21560
  const servers = config.mcp_servers ?? {};
21561
+ const previous = servers[MCP_SERVER_KEY];
21585
21562
  servers[MCP_SERVER_KEY] = {
21586
21563
  command: entry.command,
21587
21564
  args: entry.args,
21588
- ...hasEnv(entry) ? { env: entry.env } : {}
21565
+ ...hasEnv(entry) ? { env: entry.env } : {},
21566
+ ...previous?.tools !== void 0 ? { tools: previous.tools } : {}
21589
21567
  };
21590
21568
  config.mcp_servers = servers;
21591
21569
  writeToml(configPath, config);
@@ -21627,6 +21605,27 @@ var codexAdapter = {
21627
21605
  }
21628
21606
  writeToml(configPath, config);
21629
21607
  },
21608
+ // Codex has no wildcard: each tool id is listed. A table with at least one
21609
+ // approved tool means the user kept the allowlist, so tools this version
21610
+ // added are approved too. Tools already listed keep the mode the user gave
21611
+ // them, and an emptied or removed table stays as it is.
21612
+ refreshAllowlist(root, scope) {
21613
+ const configPath = scope === "global" ? this.globalPath() : this.projectPath(root);
21614
+ if (!configPath || !fs17.existsSync(configPath)) return;
21615
+ const config = readToml(configPath);
21616
+ const toolsConfig = config.mcp_servers?.argent?.tools;
21617
+ if (!toolsConfig) return;
21618
+ const optedIn = Object.values(toolsConfig).some(
21619
+ (tool) => tool?.approval_mode === "approve"
21620
+ );
21621
+ if (!optedIn) return;
21622
+ const missing = getAvailableToolIds().filter((tool) => !(tool in toolsConfig));
21623
+ if (missing.length === 0) return;
21624
+ for (const tool of missing) {
21625
+ toolsConfig[tool] = { approval_mode: "approve" };
21626
+ }
21627
+ writeToml(configPath, config);
21628
+ },
21630
21629
  removeAllowlist(root, scope) {
21631
21630
  const configPath = scope === "global" ? this.globalPath() : this.projectPath(root);
21632
21631
  if (!configPath) {
@@ -21787,7 +21786,8 @@ var kiroAdapter = {
21787
21786
  editJsoncFile(configPath, ["mcpServers", MCP_SERVER_KEY], {
21788
21787
  command: entry.command,
21789
21788
  args: entry.args,
21790
- ...hasEnv(entry) ? { env: entry.env } : {}
21789
+ ...hasEnv(entry) ? { env: entry.env } : {},
21790
+ ...existingEntryKeys(configPath, "mcpServers", ["autoApprove"])
21791
21791
  });
21792
21792
  },
21793
21793
  remove(configPath) {
@@ -22051,18 +22051,29 @@ function removeCodexRules(configPath) {
22051
22051
  function findRetiredRulesAndAgents(scans, root, rulesDir, agentsDir) {
22052
22052
  const targets = scans.flatMap(({ adapters, scope }) => {
22053
22053
  const { ruleTargets, agentTargets } = getManagedContentTargets(adapters, root, scope);
22054
+ const globalRules = scope === "global";
22054
22055
  return [
22055
- ...ruleTargets.map((target) => ({ kind: "rules", target, bundleDir: rulesDir })),
22056
- ...agentTargets.map((target) => ({ kind: "agents", target, bundleDir: agentsDir }))
22056
+ ...ruleTargets.map((target) => ({
22057
+ kind: "rules",
22058
+ target,
22059
+ bundleDir: globalRules ? null : rulesDir,
22060
+ retired: globalRules ? [...RETIRED_BUNDLED_PATHS.rules, ...RETIRED_GLOBAL_RULES] : RETIRED_BUNDLED_PATHS.rules
22061
+ })),
22062
+ ...agentTargets.map((target) => ({
22063
+ kind: "agents",
22064
+ target,
22065
+ bundleDir: agentsDir,
22066
+ retired: RETIRED_BUNDLED_PATHS.agents
22067
+ }))
22057
22068
  ];
22058
22069
  });
22059
22070
  const found = [];
22060
22071
  const seen = /* @__PURE__ */ new Set();
22061
- for (const { kind, target, bundleDir } of targets) {
22072
+ for (const { kind, target, bundleDir, retired } of targets) {
22062
22073
  const dir = resolveLinkedDestination(target.targetPath);
22063
22074
  if (seen.has(`${kind}:${realpathOrSelf(dir)}`)) continue;
22064
22075
  seen.add(`${kind}:${realpathOrSelf(dir)}`);
22065
- const files = findRetiredFiles(RETIRED_BUNDLED_PATHS[kind], bundleDir, target.targetPath);
22076
+ const files = findRetiredFiles(retired, bundleDir, target.targetPath);
22066
22077
  if (files.length === 0) continue;
22067
22078
  found.push({ kind, target, location: formatCopyDestination(target, dir, root), files });
22068
22079
  }
@@ -22071,7 +22082,8 @@ function findRetiredRulesAndAgents(scans, root, rulesDir, agentsDir) {
22071
22082
  function copyRulesAndAgents(adapters, root, scope, rulesDir, agentsDir) {
22072
22083
  const results = [];
22073
22084
  const managedTargets = getManagedContentTargets(adapters, root, scope);
22074
- for (const target of managedTargets.ruleTargets) {
22085
+ const globalScope = scope === "global";
22086
+ for (const target of globalScope ? [] : managedTargets.ruleTargets) {
22075
22087
  try {
22076
22088
  const written = copyDir(rulesDir, target.targetPath);
22077
22089
  if (written) {
@@ -22092,6 +22104,16 @@ function copyRulesAndAgents(adapters, root, scope, rulesDir, agentsDir) {
22092
22104
  }
22093
22105
  }
22094
22106
  for (const target of managedTargets.codexConfigTargets) {
22107
+ if (globalScope) {
22108
+ try {
22109
+ if (removeCodexRules(target.targetPath)) {
22110
+ results.push(` Removed argent rules from ${target.targetPath} (developer_instructions)`);
22111
+ }
22112
+ } catch (err) {
22113
+ results.push(` Could not remove argent rules from ${target.targetPath}: ${err}`);
22114
+ }
22115
+ continue;
22116
+ }
22095
22117
  try {
22096
22118
  const injected = injectCodexRules(target.targetPath, rulesDir);
22097
22119
  if (injected) {
@@ -22324,6 +22346,7 @@ function parseInitArgs(args) {
22324
22346
  return {
22325
22347
  nonInteractive: args.includes("--yes") || args.includes("-y"),
22326
22348
  noTelemetry: args.includes("--no-telemetry"),
22349
+ noAllowlist: args.includes("--no-allowlist"),
22327
22350
  fromTar,
22328
22351
  wantsLocal: args.includes("--local"),
22329
22352
  wantsGlobal: args.includes("--global")
@@ -23308,11 +23331,15 @@ async function cleanupStaleMcpConfigs(args) {
23308
23331
  // ../argent-installer/src/init-allowlist.ts
23309
23332
  var import_picocolors9 = __toESM(require_picocolors(), 1);
23310
23333
  async function configureAllowlist(args) {
23311
- const { adapters, effectiveRoot, scope, nonInteractive } = args;
23334
+ const { adapters, effectiveRoot, scope, nonInteractive, noAllowlist = false } = args;
23312
23335
  const adaptersWithAllowlist = adapters.filter((a2) => a2.addAllowlist);
23313
23336
  const adaptersWithoutAllowlist = adapters.filter((a2) => !a2.addAllowlist);
23314
23337
  let enabled = false;
23315
- if (adaptersWithAllowlist.length > 0) {
23338
+ let decidedBy = "default";
23339
+ if (noAllowlist) {
23340
+ decidedBy = "flag";
23341
+ log.info(import_picocolors9.default.dim("Skipped editor auto-approve lists (--no-allowlist)."));
23342
+ } else if (adaptersWithAllowlist.length > 0) {
23316
23343
  log.info(
23317
23344
  `By default, editors ask for confirmation before running each MCP tool.
23318
23345
  Adding Argent to the auto-approve allowlist lets tools run without
@@ -23328,9 +23355,10 @@ async function configureAllowlist(args) {
23328
23355
  });
23329
23356
  if (isCancel(allowlistChoice)) throw new InitCancelled("allowlist");
23330
23357
  enabled = allowlistChoice;
23358
+ decidedBy = "prompt";
23331
23359
  }
23332
23360
  }
23333
- if (!enabled) return { enabled, lines: [] };
23361
+ if (!enabled) return { enabled, decidedBy, lines: [] };
23334
23362
  const lines = [];
23335
23363
  for (const adapter of adaptersWithAllowlist) {
23336
23364
  const hasPath = scope === "global" ? adapter.globalPath() : adapter.projectPath(effectiveRoot);
@@ -23339,6 +23367,11 @@ async function configureAllowlist(args) {
23339
23367
  continue;
23340
23368
  }
23341
23369
  try {
23370
+ const skipReason = adapter.allowlistSkipReason?.(effectiveRoot, scope) ?? null;
23371
+ if (skipReason) {
23372
+ lines.push(`${import_picocolors9.default.yellow("-")} ${adapter.name} ${import_picocolors9.default.dim(`(skipped - ${skipReason})`)}`);
23373
+ continue;
23374
+ }
23342
23375
  adapter.addAllowlist(effectiveRoot, scope);
23343
23376
  lines.push(`${import_picocolors9.default.green("+")} ${adapter.name}`);
23344
23377
  } catch (err) {
@@ -23350,7 +23383,7 @@ async function configureAllowlist(args) {
23350
23383
  `${import_picocolors9.default.yellow("-")} ${adapter.name} ${import_picocolors9.default.dim("(no auto-approve API - configure manually)")}`
23351
23384
  );
23352
23385
  }
23353
- return { enabled, lines };
23386
+ return { enabled, decidedBy, lines };
23354
23387
  }
23355
23388
 
23356
23389
  // ../argent-installer/src/init-skills.ts
@@ -23762,9 +23795,13 @@ async function init2(args) {
23762
23795
  adapters: writtenAdapters,
23763
23796
  effectiveRoot,
23764
23797
  scope: normalizedScope,
23765
- nonInteractive: parsed.nonInteractive
23798
+ nonInteractive: parsed.nonInteractive,
23799
+ noAllowlist: parsed.noAllowlist
23800
+ });
23801
+ track("installation:allowlist_decision", {
23802
+ is_enabled: allowlist.enabled,
23803
+ decided_by: allowlist.decidedBy
23766
23804
  });
23767
- track("installation:allowlist_decision", { is_enabled: allowlist.enabled });
23768
23805
  if (allowlist.enabled && allowlist.lines.length > 0) {
23769
23806
  note(allowlist.lines.join("\n"), "Tool Auto-Approval");
23770
23807
  }
@@ -23803,7 +23840,8 @@ async function init2(args) {
23803
23840
  scope,
23804
23841
  allowlistEnabled: allowlist.enabled,
23805
23842
  skills,
23806
- copiedRules: copyResults.length > 0,
23843
+ // A global install writes no rule, only removes old ones.
23844
+ copiedRules: normalizedScope === "local" && copyResults.length > 0,
23807
23845
  wroteProjectTelemetryOptOut
23808
23846
  });
23809
23847
  const skillsMissing = skillsAreMissing(skills);
@@ -24682,15 +24720,12 @@ async function update(args) {
24682
24720
  )
24683
24721
  );
24684
24722
  }
24685
- const allowlistDisabled = getConfigValueByKey("allowlist.enabled", { cwd: projectRoot }) === false;
24686
- if (!allowlistDisabled) {
24687
- for (const [scope, adapters] of adaptersByScope) {
24688
- for (const adapter of adapters) {
24689
- if (!adapter.addAllowlist) continue;
24690
- try {
24691
- adapter.addAllowlist(projectRoot, scope);
24692
- } catch {
24693
- }
24723
+ for (const [scope, adapters] of adaptersByScope) {
24724
+ for (const adapter of adapters) {
24725
+ if (!adapter.refreshAllowlist) continue;
24726
+ try {
24727
+ adapter.refreshAllowlist(projectRoot, scope);
24728
+ } catch {
24694
24729
  }
24695
24730
  }
24696
24731
  }
@@ -24701,11 +24736,6 @@ async function update(args) {
24701
24736
  ...copyRulesAndAgents(localAdapters, projectRoot, "local", RULES_DIR, AGENTS_DIR)
24702
24737
  ];
24703
24738
  spinner2.stop("Configuration refreshed.");
24704
- if (allowlistDisabled) {
24705
- log.info(
24706
- import_picocolors12.default.dim("Left editor auto-approve allowlists alone (allowlist.enabled is false).")
24707
- );
24708
- }
24709
24739
  if (results.length > 0) {
24710
24740
  note(results.join("\n"), "MCP Configs Updated");
24711
24741
  }
@@ -25348,14 +25348,6 @@ var CONFIG_SCHEMA = [
25348
25348
  // drained/reset, not just the file rewritten.
25349
25349
  manageCommand: "argent telemetry"
25350
25350
  },
25351
- {
25352
- key: "allowlist.enabled",
25353
- description: "Whether `argent update` re-applies editor auto-approve allowlist rules. Unset (the default) keeps the current behavior: update refreshes the rules for editors that already have argent configured. Set to `false` to keep update from touching editor allowlists. `false` in either scope wins, so a committed project opt-out holds for every teammate.",
25354
- scopes: ["project", "global"],
25355
- parse: asBoolean,
25356
- merge: "prioritize-restrictive",
25357
- example: "false"
25358
- },
25359
25351
  {
25360
25352
  key: "lens.agent",
25361
25353
  description: "Coding-agent id remembered by `argent lens` to skip the picker.",
@@ -25835,6 +25827,10 @@ var FAILURE_CODES = {
25835
25827
  AX_DAEMON_READY_TIMEOUT: "AX_DAEMON_READY_TIMEOUT",
25836
25828
  AX_DAEMON_EXITED_BEFORE_READY: "AX_DAEMON_EXITED_BEFORE_READY",
25837
25829
  AX_DAEMON_PROCESS_ERROR: "AX_DAEMON_PROCESS_ERROR",
25830
+ // The daemon died on a fault signal (SIGSEGV, SIGABRT, ...), before or after
25831
+ // it connected. Kept apart from the two codes above so a crash is not read
25832
+ // as an ordinary exit.
25833
+ AX_DAEMON_CRASHED: "AX_DAEMON_CRASHED",
25838
25834
  AX_FACTORY_OPTIONS_MISSING: "AX_FACTORY_OPTIONS_MISSING",
25839
25835
  AX_WRONG_PLATFORM: "AX_WRONG_PLATFORM",
25840
25836
  AX_DEVICE_ID_INVALID: "AX_DEVICE_ID_INVALID",
@@ -26686,17 +26682,24 @@ function uploadFailure(url, res, text, bytes) {
26686
26682
  }
26687
26683
  async function uploadTar(tarPath, format, endpoint, signal) {
26688
26684
  const { size } = await stat3(tarPath);
26685
+ const stream = createReadStream2(tarPath);
26689
26686
  const init = {
26690
26687
  method: "POST",
26691
26688
  headers: {
26692
26689
  "content-type": ARCHIVE_CONTENT_TYPES[format],
26693
26690
  ...endpoint.token ? { Authorization: `Bearer ${endpoint.token}` } : {}
26694
26691
  },
26695
- body: createReadStream2(tarPath),
26692
+ body: stream,
26696
26693
  duplex: "half",
26697
26694
  signal
26698
26695
  };
26699
- const res = await fetch(`${endpoint.url}/upload`, init);
26696
+ let res;
26697
+ try {
26698
+ res = await fetch(`${endpoint.url}/upload`, init);
26699
+ } catch (err) {
26700
+ stream.destroy();
26701
+ throw err;
26702
+ }
26700
26703
  if (!res.ok) {
26701
26704
  let text = "";
26702
26705
  try {
@@ -28215,7 +28218,8 @@ var ALLOWED = {
28215
28218
  install_mode: INSTALL_MODE
28216
28219
  },
28217
28220
  "installation:allowlist_decision": {
28218
- is_enabled: bool
28221
+ is_enabled: bool,
28222
+ decided_by: oneOf(["flag", "default", "prompt"])
28219
28223
  },
28220
28224
  "installation:stale_config_cleanup": {
28221
28225
  removed_count: COUNT,
@@ -29493,7 +29497,7 @@ ${stopped.join("\n")}`;
29493
29497
  }
29494
29498
 
29495
29499
  // ../argent-mcp/src/instructions.ts
29496
- var SERVER_INSTRUCTIONS = "Argent \u2014 iOS Simulator, Android Emulator, and Chromium app control for interacting, testing, profiling and debugging mobile and Chromium applications. Interaction tools return the screen after the action: a screenshot plus the accessibility element tree with normalized tap frames. Take coordinates from that tree; call describe only when no fresh tree is available \u2014 never guess coordinates from pixels. A result names an identical earlier tree by its tree id in place of repeating it. Do not stop simulator servers when a task finishes: the next task reuses them. Call stop-all-simulator-servers when the user asks to clean up or ends the session, or when a skill tells you to recycle a device's services, always with devices: [...] naming the devices this session used. Never stop a Metro the user started unless they ask. One tool-server is shared by every agent using this argent install, so an unscoped call tears down their devices too \u2014 reserve it for a deliberate machine-wide cleanup.";
29500
+ var SERVER_INSTRUCTIONS = "Argent \u2014 iOS Simulator, Android Emulator, and Chromium app control for interacting, testing, profiling and debugging mobile and Chromium applications. Use the platform the user named; otherwise prefer a device list-devices shows already running, and do not default to iOS. In a single-platform project, boot that platform. Prefer these tools over raw xcrun or adb commands, which are a fallback. Prefer launch-app or open-url over tapping home-screen icons. If the task may need a saved e2e test, load the argent-create-e2e skill (argent-qa-e2e for acceptance tests) before the first launch or in-app action: recording is not retroactive. Load the matching argent-* skill before React Native build or debug work, profiling, a physical phone, a Mac app or a TV. Interaction tools return the screen after the action: a screenshot plus the accessibility element tree with normalized tap frames. Take coordinates from that tree; call describe only when no fresh tree is available \u2014 never guess coordinates from pixels. A result names an identical earlier tree by its tree id in place of repeating it. If a tap fails twice, stop retrying and call a discovery tool again. Use await-ui-element to wait for the UI instead of polling with screenshots. Do not stop simulator servers when a task finishes: the next task reuses them. Call stop-all-simulator-servers when the user asks to clean up or ends the session, or when a skill tells you to recycle a device's services, always with devices: [...] naming the devices this session used. Never stop a Metro the user started unless they ask. One tool-server is shared by every agent using this argent install, so an unscoped call tears down their devices too \u2014 reserve it for a deliberate machine-wide cleanup. The argent CLI manages the toolkit: argent --help lists its commands.";
29497
29501
 
29498
29502
  // ../argent-mcp/src/installed-version.ts
29499
29503
  import * as fs11 from "node:fs";