@swmansion/argent 0.15.0 → 0.15.1-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6122,10 +6122,10 @@ var require_resolve_block_map = __commonJS({
6122
6122
  let offset = bm.offset;
6123
6123
  let commentEnd = null;
6124
6124
  for (const collItem of bm.items) {
6125
- const { start, key, sep: sep6, value } = collItem;
6125
+ const { start, key, sep: sep7, value } = collItem;
6126
6126
  const keyProps = resolveProps.resolveProps(start, {
6127
6127
  indicator: "explicit-key-ind",
6128
- next: key ?? sep6?.[0],
6128
+ next: key ?? sep7?.[0],
6129
6129
  offset,
6130
6130
  onError,
6131
6131
  parentIndent: bm.indent,
@@ -6139,7 +6139,7 @@ var require_resolve_block_map = __commonJS({
6139
6139
  else if ("indent" in key && key.indent !== bm.indent)
6140
6140
  onError(offset, "BAD_INDENT", startColMsg);
6141
6141
  }
6142
- if (!keyProps.anchor && !keyProps.tag && !sep6) {
6142
+ if (!keyProps.anchor && !keyProps.tag && !sep7) {
6143
6143
  commentEnd = keyProps.end;
6144
6144
  if (keyProps.comment) {
6145
6145
  if (map.comment)
@@ -6163,7 +6163,7 @@ var require_resolve_block_map = __commonJS({
6163
6163
  ctx.atKey = false;
6164
6164
  if (utilMapIncludes.mapIncludes(ctx, map.items, keyNode))
6165
6165
  onError(keyStart, "DUPLICATE_KEY", "Map keys must be unique");
6166
- const valueProps = resolveProps.resolveProps(sep6 ?? [], {
6166
+ const valueProps = resolveProps.resolveProps(sep7 ?? [], {
6167
6167
  indicator: "map-value-ind",
6168
6168
  next: value,
6169
6169
  offset: keyNode.range[2],
@@ -6179,7 +6179,7 @@ var require_resolve_block_map = __commonJS({
6179
6179
  if (ctx.options.strict && keyProps.start < valueProps.found.offset - 1024)
6180
6180
  onError(keyNode.range, "KEY_OVER_1024_CHARS", "The : indicator must be at most 1024 chars after the start of an implicit block mapping key");
6181
6181
  }
6182
- const valueNode = value ? composeNode(ctx, value, valueProps, onError) : composeEmptyNode(ctx, offset, sep6, null, valueProps, onError);
6182
+ const valueNode = value ? composeNode(ctx, value, valueProps, onError) : composeEmptyNode(ctx, offset, sep7, null, valueProps, onError);
6183
6183
  if (ctx.schema.compat)
6184
6184
  utilFlowIndentCheck.flowIndentCheck(bm.indent, value, onError);
6185
6185
  offset = valueNode.range[2];
@@ -6270,7 +6270,7 @@ var require_resolve_end = __commonJS({
6270
6270
  let comment = "";
6271
6271
  if (end) {
6272
6272
  let hasSpace = false;
6273
- let sep6 = "";
6273
+ let sep7 = "";
6274
6274
  for (const token of end) {
6275
6275
  const { source, type } = token;
6276
6276
  switch (type) {
@@ -6284,13 +6284,13 @@ var require_resolve_end = __commonJS({
6284
6284
  if (!comment)
6285
6285
  comment = cb;
6286
6286
  else
6287
- comment += sep6 + cb;
6288
- sep6 = "";
6287
+ comment += sep7 + cb;
6288
+ sep7 = "";
6289
6289
  break;
6290
6290
  }
6291
6291
  case "newline":
6292
6292
  if (comment)
6293
- sep6 += source;
6293
+ sep7 += source;
6294
6294
  hasSpace = true;
6295
6295
  break;
6296
6296
  default:
@@ -6333,18 +6333,18 @@ var require_resolve_flow_collection = __commonJS({
6333
6333
  let offset = fc.offset + fc.start.source.length;
6334
6334
  for (let i2 = 0; i2 < fc.items.length; ++i2) {
6335
6335
  const collItem = fc.items[i2];
6336
- const { start, key, sep: sep6, value } = collItem;
6336
+ const { start, key, sep: sep7, value } = collItem;
6337
6337
  const props = resolveProps.resolveProps(start, {
6338
6338
  flow: fcName,
6339
6339
  indicator: "explicit-key-ind",
6340
- next: key ?? sep6?.[0],
6340
+ next: key ?? sep7?.[0],
6341
6341
  offset,
6342
6342
  onError,
6343
6343
  parentIndent: fc.indent,
6344
6344
  startOnNewline: false
6345
6345
  });
6346
6346
  if (!props.found) {
6347
- if (!props.anchor && !props.tag && !sep6 && !value) {
6347
+ if (!props.anchor && !props.tag && !sep7 && !value) {
6348
6348
  if (i2 === 0 && props.comma)
6349
6349
  onError(props.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${fcName}`);
6350
6350
  else if (i2 < fc.items.length - 1)
@@ -6398,8 +6398,8 @@ var require_resolve_flow_collection = __commonJS({
6398
6398
  }
6399
6399
  }
6400
6400
  }
6401
- if (!isMap2 && !sep6 && !props.found) {
6402
- const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end, sep6, null, props, onError);
6401
+ if (!isMap2 && !sep7 && !props.found) {
6402
+ const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end, sep7, null, props, onError);
6403
6403
  coll.items.push(valueNode);
6404
6404
  offset = valueNode.range[2];
6405
6405
  if (isBlock(value))
@@ -6411,7 +6411,7 @@ var require_resolve_flow_collection = __commonJS({
6411
6411
  if (isBlock(key))
6412
6412
  onError(keyNode.range, "BLOCK_IN_FLOW", blockMsg);
6413
6413
  ctx.atKey = false;
6414
- const valueProps = resolveProps.resolveProps(sep6 ?? [], {
6414
+ const valueProps = resolveProps.resolveProps(sep7 ?? [], {
6415
6415
  flow: fcName,
6416
6416
  indicator: "map-value-ind",
6417
6417
  next: value,
@@ -6422,8 +6422,8 @@ var require_resolve_flow_collection = __commonJS({
6422
6422
  });
6423
6423
  if (valueProps.found) {
6424
6424
  if (!isMap2 && !props.found && ctx.options.strict) {
6425
- if (sep6)
6426
- for (const st of sep6) {
6425
+ if (sep7)
6426
+ for (const st of sep7) {
6427
6427
  if (st === valueProps.found)
6428
6428
  break;
6429
6429
  if (st.type === "newline") {
@@ -6440,7 +6440,7 @@ var require_resolve_flow_collection = __commonJS({
6440
6440
  else
6441
6441
  onError(valueProps.start, "MISSING_CHAR", `Missing , or : between ${fcName} items`);
6442
6442
  }
6443
- const valueNode = value ? composeNode(ctx, value, valueProps, onError) : valueProps.found ? composeEmptyNode(ctx, valueProps.end, sep6, null, valueProps, onError) : null;
6443
+ const valueNode = value ? composeNode(ctx, value, valueProps, onError) : valueProps.found ? composeEmptyNode(ctx, valueProps.end, sep7, null, valueProps, onError) : null;
6444
6444
  if (valueNode) {
6445
6445
  if (isBlock(value))
6446
6446
  onError(valueNode.range, "BLOCK_IN_FLOW", blockMsg);
@@ -6620,7 +6620,7 @@ var require_resolve_block_scalar = __commonJS({
6620
6620
  chompStart = i2 + 1;
6621
6621
  }
6622
6622
  let value = "";
6623
- let sep6 = "";
6623
+ let sep7 = "";
6624
6624
  let prevMoreIndented = false;
6625
6625
  for (let i2 = 0; i2 < contentStart; ++i2)
6626
6626
  value += lines[i2][0].slice(trimIndent) + "\n";
@@ -6637,24 +6637,24 @@ var require_resolve_block_scalar = __commonJS({
6637
6637
  indent = "";
6638
6638
  }
6639
6639
  if (type === Scalar.Scalar.BLOCK_LITERAL) {
6640
- value += sep6 + indent.slice(trimIndent) + content;
6641
- sep6 = "\n";
6640
+ value += sep7 + indent.slice(trimIndent) + content;
6641
+ sep7 = "\n";
6642
6642
  } else if (indent.length > trimIndent || content[0] === " ") {
6643
- if (sep6 === " ")
6644
- sep6 = "\n";
6645
- else if (!prevMoreIndented && sep6 === "\n")
6646
- sep6 = "\n\n";
6647
- value += sep6 + indent.slice(trimIndent) + content;
6648
- sep6 = "\n";
6643
+ if (sep7 === " ")
6644
+ sep7 = "\n";
6645
+ else if (!prevMoreIndented && sep7 === "\n")
6646
+ sep7 = "\n\n";
6647
+ value += sep7 + indent.slice(trimIndent) + content;
6648
+ sep7 = "\n";
6649
6649
  prevMoreIndented = true;
6650
6650
  } else if (content === "") {
6651
- if (sep6 === "\n")
6651
+ if (sep7 === "\n")
6652
6652
  value += "\n";
6653
6653
  else
6654
- sep6 = "\n";
6654
+ sep7 = "\n";
6655
6655
  } else {
6656
- value += sep6 + content;
6657
- sep6 = " ";
6656
+ value += sep7 + content;
6657
+ sep7 = " ";
6658
6658
  prevMoreIndented = false;
6659
6659
  }
6660
6660
  }
@@ -6836,25 +6836,25 @@ var require_resolve_flow_scalar = __commonJS({
6836
6836
  if (!match)
6837
6837
  return source;
6838
6838
  let res = match[1];
6839
- let sep6 = " ";
6839
+ let sep7 = " ";
6840
6840
  let pos = first.lastIndex;
6841
6841
  line.lastIndex = pos;
6842
6842
  while (match = line.exec(source)) {
6843
6843
  if (match[1] === "") {
6844
- if (sep6 === "\n")
6845
- res += sep6;
6844
+ if (sep7 === "\n")
6845
+ res += sep7;
6846
6846
  else
6847
- sep6 = "\n";
6847
+ sep7 = "\n";
6848
6848
  } else {
6849
- res += sep6 + match[1];
6850
- sep6 = " ";
6849
+ res += sep7 + match[1];
6850
+ sep7 = " ";
6851
6851
  }
6852
6852
  pos = line.lastIndex;
6853
6853
  }
6854
6854
  const last = /[ \t]*(.*)/sy;
6855
6855
  last.lastIndex = pos;
6856
6856
  match = last.exec(source);
6857
- return res + sep6 + (match?.[1] ?? "");
6857
+ return res + sep7 + (match?.[1] ?? "");
6858
6858
  }
6859
6859
  function doubleQuotedValue(source, onError) {
6860
6860
  let res = "";
@@ -7664,14 +7664,14 @@ var require_cst_stringify = __commonJS({
7664
7664
  }
7665
7665
  }
7666
7666
  }
7667
- function stringifyItem({ start, key, sep: sep6, value }) {
7667
+ function stringifyItem({ start, key, sep: sep7, value }) {
7668
7668
  let res = "";
7669
7669
  for (const st of start)
7670
7670
  res += st.source;
7671
7671
  if (key)
7672
7672
  res += stringifyToken(key);
7673
- if (sep6)
7674
- for (const st of sep6)
7673
+ if (sep7)
7674
+ for (const st of sep7)
7675
7675
  res += st.source;
7676
7676
  if (value)
7677
7677
  res += stringifyToken(value);
@@ -8838,18 +8838,18 @@ var require_parser = __commonJS({
8838
8838
  if (this.type === "map-value-ind") {
8839
8839
  const prev = getPrevProps(this.peek(2));
8840
8840
  const start = getFirstKeyStartProps(prev);
8841
- let sep6;
8841
+ let sep7;
8842
8842
  if (scalar.end) {
8843
- sep6 = scalar.end;
8844
- sep6.push(this.sourceToken);
8843
+ sep7 = scalar.end;
8844
+ sep7.push(this.sourceToken);
8845
8845
  delete scalar.end;
8846
8846
  } else
8847
- sep6 = [this.sourceToken];
8847
+ sep7 = [this.sourceToken];
8848
8848
  const map = {
8849
8849
  type: "block-map",
8850
8850
  offset: scalar.offset,
8851
8851
  indent: scalar.indent,
8852
- items: [{ start, key: scalar, sep: sep6 }]
8852
+ items: [{ start, key: scalar, sep: sep7 }]
8853
8853
  };
8854
8854
  this.onKeyLine = true;
8855
8855
  this.stack[this.stack.length - 1] = map;
@@ -9002,15 +9002,15 @@ var require_parser = __commonJS({
9002
9002
  } else if (isFlowToken(it.key) && !includesToken(it.sep, "newline")) {
9003
9003
  const start2 = getFirstKeyStartProps(it.start);
9004
9004
  const key = it.key;
9005
- const sep6 = it.sep;
9006
- sep6.push(this.sourceToken);
9005
+ const sep7 = it.sep;
9006
+ sep7.push(this.sourceToken);
9007
9007
  delete it.key;
9008
9008
  delete it.sep;
9009
9009
  this.stack.push({
9010
9010
  type: "block-map",
9011
9011
  offset: this.offset,
9012
9012
  indent: this.indent,
9013
- items: [{ start: start2, key, sep: sep6 }]
9013
+ items: [{ start: start2, key, sep: sep7 }]
9014
9014
  });
9015
9015
  } else if (start.length > 0) {
9016
9016
  it.sep = it.sep.concat(start, this.sourceToken);
@@ -9204,13 +9204,13 @@ var require_parser = __commonJS({
9204
9204
  const prev = getPrevProps(parent);
9205
9205
  const start = getFirstKeyStartProps(prev);
9206
9206
  fixFlowSeqItems(fc);
9207
- const sep6 = fc.end.splice(1, fc.end.length);
9208
- sep6.push(this.sourceToken);
9207
+ const sep7 = fc.end.splice(1, fc.end.length);
9208
+ sep7.push(this.sourceToken);
9209
9209
  const map = {
9210
9210
  type: "block-map",
9211
9211
  offset: fc.offset,
9212
9212
  indent: fc.indent,
9213
- items: [{ start, key: fc, sep: sep6 }]
9213
+ items: [{ start, key: fc, sep: sep7 }]
9214
9214
  };
9215
9215
  this.onKeyLine = true;
9216
9216
  this.stack[this.stack.length - 1] = map;
@@ -9593,13 +9593,13 @@ var require_min_release_age = __commonJS({
9593
9593
  return Number.isFinite(days) && days > 0 ? days * config_parse_1.DAY_MS : 0;
9594
9594
  }
9595
9595
  function probe(p) {
9596
- return new Promise((resolve9) => {
9596
+ return new Promise((resolve10) => {
9597
9597
  (0, node_child_process_1.exec)(p.command, { timeout: PROBE_TIMEOUT_MS2, windowsHide: true }, (err, stdout2) => {
9598
9598
  if (err) {
9599
- resolve9(0);
9599
+ resolve10(0);
9600
9600
  return;
9601
9601
  }
9602
- resolve9(p.parse(stdout2));
9602
+ resolve10(p.parse(stdout2));
9603
9603
  });
9604
9604
  });
9605
9605
  }
@@ -9632,12 +9632,12 @@ var require_registry = __commonJS({
9632
9632
  var node_https_1 = __importDefault(__require("node:https"));
9633
9633
  var REQUEST_TIMEOUT_MS = 1e4;
9634
9634
  function fetchRegistryInfo2(url) {
9635
- return new Promise((resolve9) => {
9635
+ return new Promise((resolve10) => {
9636
9636
  let resolved = false;
9637
9637
  const safeResolve = (value) => {
9638
9638
  if (!resolved) {
9639
9639
  resolved = true;
9640
- resolve9(value);
9640
+ resolve10(value);
9641
9641
  }
9642
9642
  };
9643
9643
  const req = node_https_1.default.get(url, { timeout: REQUEST_TIMEOUT_MS }, (res) => {
@@ -13702,14 +13702,14 @@ async function addSourceContext(frames) {
13702
13702
  return frames;
13703
13703
  }
13704
13704
  function getContextLinesFromFile(path19, ranges, output) {
13705
- return new Promise((resolve9) => {
13705
+ return new Promise((resolve10) => {
13706
13706
  const stream = createReadStream(path19);
13707
13707
  const lineReaded = createInterface2({
13708
13708
  input: stream
13709
13709
  });
13710
13710
  function destroyStreamAndResolve() {
13711
13711
  stream.destroy();
13712
- resolve9();
13712
+ resolve10();
13713
13713
  }
13714
13714
  let lineNumber = 0;
13715
13715
  let currentRangeIndex = 0;
@@ -15006,9 +15006,9 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
15006
15006
  if (!waitUntil) return;
15007
15007
  if (this.disabled || this.optedOut) return;
15008
15008
  if (!this._waitUntilCycle) {
15009
- let resolve9;
15009
+ let resolve10;
15010
15010
  const promise = new Promise((r2) => {
15011
- resolve9 = r2;
15011
+ resolve10 = r2;
15012
15012
  });
15013
15013
  try {
15014
15014
  waitUntil(promise);
@@ -15016,7 +15016,7 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
15016
15016
  return;
15017
15017
  }
15018
15018
  this._waitUntilCycle = {
15019
- resolve: resolve9,
15019
+ resolve: resolve10,
15020
15020
  startedAt: Date.now(),
15021
15021
  timer: void 0
15022
15022
  };
@@ -15040,12 +15040,12 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
15040
15040
  return cycle?.resolve;
15041
15041
  }
15042
15042
  async resolveWaitUntilFlush() {
15043
- const resolve9 = this._consumeWaitUntilCycle();
15043
+ const resolve10 = this._consumeWaitUntilCycle();
15044
15044
  try {
15045
15045
  await super.flush();
15046
15046
  } catch {
15047
15047
  } finally {
15048
- resolve9?.();
15048
+ resolve10?.();
15049
15049
  }
15050
15050
  }
15051
15051
  getPersistedProperty(key) {
@@ -15166,15 +15166,15 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
15166
15166
  async waitForLocalEvaluationReady(timeoutMs = THIRTY_SECONDS) {
15167
15167
  if (this.isLocalEvaluationReady()) return true;
15168
15168
  if (void 0 === this.featureFlagsPoller) return false;
15169
- return new Promise((resolve9) => {
15169
+ return new Promise((resolve10) => {
15170
15170
  const timeout = setTimeout(() => {
15171
15171
  cleanup();
15172
- resolve9(false);
15172
+ resolve10(false);
15173
15173
  }, timeoutMs);
15174
15174
  const cleanup = this._events.on("localEvaluationFlagsLoaded", (count) => {
15175
15175
  clearTimeout(timeout);
15176
15176
  cleanup();
15177
- resolve9(count > 0);
15177
+ resolve10(count > 0);
15178
15178
  });
15179
15179
  });
15180
15180
  }
@@ -15629,14 +15629,14 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
15629
15629
  this.context?.enter(data, options);
15630
15630
  }
15631
15631
  async _shutdown(shutdownTimeoutMs) {
15632
- const resolve9 = this._consumeWaitUntilCycle();
15632
+ const resolve10 = this._consumeWaitUntilCycle();
15633
15633
  await this.featureFlagsPoller?.stopPoller(shutdownTimeoutMs);
15634
15634
  this.errorTracking.shutdown();
15635
15635
  try {
15636
15636
  return await super._shutdown(shutdownTimeoutMs);
15637
15637
  } finally {
15638
15638
  this.distinctIdHasSentFlagCalls = {};
15639
- resolve9?.();
15639
+ resolve10?.();
15640
15640
  }
15641
15641
  }
15642
15642
  async _requestRemoteConfigPayload(flagKey) {
@@ -16039,6 +16039,7 @@ var FAILURE_CODES = {
16039
16039
  TOOL_CAPABILITY_UNSUPPORTED_OPERATION: "TOOL_CAPABILITY_UNSUPPORTED_OPERATION",
16040
16040
  TOOL_PLATFORM_NOT_IMPLEMENTED: "TOOL_PLATFORM_NOT_IMPLEMENTED",
16041
16041
  TOOL_DEPENDENCY_MISSING: "TOOL_DEPENDENCY_MISSING",
16042
+ TOOL_INPUT_INVALID: "TOOL_INPUT_INVALID",
16042
16043
  TOOLSERVER_UNHANDLED_REJECTION: "TOOLSERVER_UNHANDLED_REJECTION",
16043
16044
  TOOLSERVER_UNCAUGHT_EXCEPTION: "TOOLSERVER_UNCAUGHT_EXCEPTION",
16044
16045
  INSTALL_GLOBAL_PACKAGE_FAILED: "INSTALL_GLOBAL_PACKAGE_FAILED",
@@ -16111,6 +16112,7 @@ var FAILURE_CODES = {
16111
16112
  NATIVE_DEVTOOLS_FIND_VIEWS_ERROR: "NATIVE_DEVTOOLS_FIND_VIEWS_ERROR",
16112
16113
  NATIVE_DEVTOOLS_FACTORY_OPTIONS_MISSING: "NATIVE_DEVTOOLS_FACTORY_OPTIONS_MISSING",
16113
16114
  NATIVE_DEVTOOLS_WRONG_PLATFORM: "NATIVE_DEVTOOLS_WRONG_PLATFORM",
16115
+ NATIVE_DEVTOOLS_NOT_INJECTABLE: "NATIVE_DEVTOOLS_NOT_INJECTABLE",
16114
16116
  NATIVE_DEVTOOLS_NOT_CONNECTED: "NATIVE_DEVTOOLS_NOT_CONNECTED",
16115
16117
  NATIVE_DEVTOOLS_RPC_TIMEOUT: "NATIVE_DEVTOOLS_RPC_TIMEOUT",
16116
16118
  NATIVE_DEVTOOLS_RPC_ERROR: "NATIVE_DEVTOOLS_RPC_ERROR",
@@ -16173,6 +16175,11 @@ var FAILURE_CODES = {
16173
16175
  NATIVE_PROFILER_NO_RUNNING_APPS: "NATIVE_PROFILER_NO_RUNNING_APPS",
16174
16176
  NATIVE_PROFILER_NO_RUNNING_USER_APPS: "NATIVE_PROFILER_NO_RUNNING_USER_APPS",
16175
16177
  NATIVE_PROFILER_MULTIPLE_RUNNING_USER_APPS: "NATIVE_PROFILER_MULTIPLE_RUNNING_USER_APPS",
16178
+ NATIVE_PROFILER_MALLOC_DEGRADED_XCODE: "NATIVE_PROFILER_MALLOC_DEGRADED_XCODE",
16179
+ NATIVE_PROFILER_MALLOC_STRATEGY_OVERRIDE: "NATIVE_PROFILER_MALLOC_STRATEGY_OVERRIDE",
16180
+ NATIVE_PROFILER_APP_BUNDLE_PATH_FAILED: "NATIVE_PROFILER_APP_BUNDLE_PATH_FAILED",
16181
+ NATIVE_PROFILER_LAUNCH_APP_NOT_FOUND: "NATIVE_PROFILER_LAUNCH_APP_NOT_FOUND",
16182
+ NATIVE_PROFILER_LAUNCH_APP_AMBIGUOUS: "NATIVE_PROFILER_LAUNCH_APP_AMBIGUOUS",
16176
16183
  NATIVE_PROFILER_SESSION_ALREADY_RUNNING: "NATIVE_PROFILER_SESSION_ALREADY_RUNNING",
16177
16184
  NATIVE_PROFILER_XCTRACE_NO_PID: "NATIVE_PROFILER_XCTRACE_NO_PID",
16178
16185
  NATIVE_PROFILER_XCTRACE_PROCESS_NOT_FOUND: "NATIVE_PROFILER_XCTRACE_PROCESS_NOT_FOUND",
@@ -16195,6 +16202,8 @@ var FAILURE_CODES = {
16195
16202
  FLOW_NO_ACTIVE_RECORDING: "FLOW_NO_ACTIVE_RECORDING",
16196
16203
  FLOW_FILE_INVALID: "FLOW_FILE_INVALID",
16197
16204
  FLOW_ENTRY_UNRECOGNIZED: "FLOW_ENTRY_UNRECOGNIZED",
16205
+ FLOW_E2E_HAS_PREREQUISITE: "FLOW_E2E_HAS_PREREQUISITE",
16206
+ FLOW_DEVICE_RESOLUTION: "FLOW_DEVICE_RESOLUTION",
16198
16207
  PROFILER_QUERY_MODE_INVALID: "PROFILER_QUERY_MODE_INVALID",
16199
16208
  PROFILER_QUERY_REQUIRED_PARAM_MISSING: "PROFILER_QUERY_REQUIRED_PARAM_MISSING",
16200
16209
  PROFILER_DATA_NOT_LOADED: "PROFILER_DATA_NOT_LOADED",
@@ -16498,6 +16507,39 @@ var ALLOWED = {
16498
16507
  uptime_ms: DURATION_MS,
16499
16508
  total_tool_calls: COUNT,
16500
16509
  ...FAILURE_SIGNAL
16510
+ },
16511
+ "lens:preview_opened": {
16512
+ round: COUNT,
16513
+ element_count: COUNT,
16514
+ variant_count: COUNT,
16515
+ is_cli_session: bool,
16516
+ platform: PLATFORM
16517
+ },
16518
+ "lens:round_completed": {
16519
+ round: COUNT,
16520
+ element_count: COUNT,
16521
+ variant_count: COUNT,
16522
+ annotation_count: COUNT,
16523
+ element_comment_count: COUNT,
16524
+ skipped_comment_count: COUNT,
16525
+ has_global_comment: bool,
16526
+ inspector_used: bool,
16527
+ offscreen_revealed: bool,
16528
+ is_cli_session: bool,
16529
+ had_parked_await: bool,
16530
+ round_duration_ms: DURATION_MS,
16531
+ platform: PLATFORM
16532
+ },
16533
+ "lens:round_abandoned": {
16534
+ round: COUNT,
16535
+ element_count: COUNT,
16536
+ variant_count: COUNT,
16537
+ had_parked_await: bool,
16538
+ is_cli_session: bool,
16539
+ platform: PLATFORM
16540
+ },
16541
+ "lens:cli_session_started": {
16542
+ agent_choice_count: COUNT
16501
16543
  }
16502
16544
  };
16503
16545
  function sanitize(event, raw) {
@@ -17418,12 +17460,12 @@ function resolveHostFingerprint() {
17418
17460
  }
17419
17461
  }
17420
17462
  function resolveHostFingerprintAsync() {
17421
- return new Promise((resolve9) => {
17463
+ return new Promise((resolve10) => {
17422
17464
  let binary;
17423
17465
  try {
17424
17466
  binary = simulatorServerBinaryPath();
17425
17467
  } catch {
17426
- resolve9(null);
17468
+ resolve10(null);
17427
17469
  return;
17428
17470
  }
17429
17471
  let settled = false;
@@ -17436,7 +17478,7 @@ function resolveHostFingerprintAsync() {
17436
17478
  child?.kill("SIGKILL");
17437
17479
  } catch {
17438
17480
  }
17439
- resolve9(value);
17481
+ resolve10(value);
17440
17482
  };
17441
17483
  const watchdog = setTimeout(() => finish(null), FINGERPRINT_TIMEOUT_MS);
17442
17484
  watchdog.unref?.();
@@ -17731,7 +17773,7 @@ async function shutdown(timeoutMs = SHORT_FLUSH_TIMEOUT_MS) {
17731
17773
  try {
17732
17774
  await Promise.race([
17733
17775
  client2.shutdown(timeoutMs),
17734
- new Promise((resolve9) => setTimeout(resolve9, timeoutMs + 250).unref())
17776
+ new Promise((resolve10) => setTimeout(resolve10, timeoutMs + 250).unref())
17735
17777
  ]);
17736
17778
  } catch (err) {
17737
17779
  emitDebugError("shutdown failed", err);
@@ -18088,7 +18130,7 @@ function skipVoid(str, ptr, banNewLines, banComments) {
18088
18130
  }
18089
18131
  return ptr;
18090
18132
  }
18091
- function skipUntil(str, ptr, sep6, end, banNewLines = false) {
18133
+ function skipUntil(str, ptr, sep7, end, banNewLines = false) {
18092
18134
  if (!end) {
18093
18135
  ptr = indexOfNewline(str, ptr);
18094
18136
  return ptr < 0 ? str.length : ptr;
@@ -18097,7 +18139,7 @@ function skipUntil(str, ptr, sep6, end, banNewLines = false) {
18097
18139
  let c2 = str[i2];
18098
18140
  if (c2 === "#") {
18099
18141
  i2 = indexOfNewline(str, i2);
18100
- } else if (c2 === sep6) {
18142
+ } else if (c2 === sep7) {
18101
18143
  return i2 + 1;
18102
18144
  } else if (c2 === end || banNewLines && (c2 === "\n" || c2 === "\r" && str[i2 + 1] === "\n")) {
18103
18145
  return i2;
@@ -19363,11 +19405,11 @@ function parseTree(text2, errors = [], options = ParseOptions.DEFAULT) {
19363
19405
  onValue({ type: getNodeType(value), offset, length, parent: currentParent, value });
19364
19406
  ensurePropertyComplete(offset + length);
19365
19407
  },
19366
- onSeparator: (sep6, offset, length) => {
19408
+ onSeparator: (sep7, offset, length) => {
19367
19409
  if (currentParent.type === "property") {
19368
- if (sep6 === ":") {
19410
+ if (sep7 === ":") {
19369
19411
  currentParent.colonOffset = offset;
19370
- } else if (sep6 === ",") {
19412
+ } else if (sep7 === ",") {
19371
19413
  ensurePropertyComplete(offset);
19372
19414
  }
19373
19415
  }
@@ -19962,12 +20004,12 @@ function applyEdits(text2, edits) {
19962
20004
  // ../argent-installer/src/package-root.ts
19963
20005
  import * as fs7 from "node:fs";
19964
20006
  import * as path7 from "node:path";
19965
- function resolvePackageRoot(dirname13) {
19966
- let current = path7.resolve(dirname13);
20007
+ function resolvePackageRoot(dirname14) {
20008
+ let current = path7.resolve(dirname14);
19967
20009
  while (true) {
19968
20010
  if (fs7.existsSync(path7.join(current, "package.json"))) return current;
19969
20011
  const parent = path7.dirname(current);
19970
- if (parent === current) return path7.resolve(dirname13);
20012
+ if (parent === current) return path7.resolve(dirname14);
19971
20013
  current = parent;
19972
20014
  }
19973
20015
  }
@@ -20442,12 +20484,13 @@ function setJsoncIn(text2, jsonPath, value) {
20442
20484
  return applyEdits(text2, edits);
20443
20485
  }
20444
20486
  function readJsoncFileRaw(filePath) {
20445
- if (!fs12.existsSync(filePath)) return { text: "{}", hadBom: false };
20487
+ if (!fs12.existsSync(filePath)) return { text: "{}", hadBom: false, wasEmpty: true };
20446
20488
  let text2 = fs12.readFileSync(filePath, "utf8");
20447
20489
  const hadBom = text2.charCodeAt(0) === 65279;
20448
20490
  if (hadBom) text2 = text2.slice(1);
20449
- if (text2.trim() === "") text2 = "{}";
20450
- return { text: text2, hadBom };
20491
+ const wasEmpty = text2.trim() === "";
20492
+ if (wasEmpty) text2 = "{}";
20493
+ return { text: text2, hadBom, wasEmpty };
20451
20494
  }
20452
20495
  function getAtJsoncPath(value, jsonPath) {
20453
20496
  let cur = value;
@@ -20478,7 +20521,7 @@ function readJsonc(filePath) {
20478
20521
  return parsed ?? {};
20479
20522
  }
20480
20523
  function editJsoncFile(filePath, jsonPath, value) {
20481
- const { text: initial, hadBom } = readJsoncFileRaw(filePath);
20524
+ const { text: initial, hadBom, wasEmpty } = readJsoncFileRaw(filePath);
20482
20525
  let text2 = setJsoncIn(initial, jsonPath, value);
20483
20526
  if (value === void 0) {
20484
20527
  for (let i2 = jsonPath.length - 1; i2 > 0; i2--) {
@@ -20495,7 +20538,8 @@ function editJsoncFile(filePath, jsonPath, value) {
20495
20538
  return;
20496
20539
  }
20497
20540
  fs12.mkdirSync(path12.dirname(filePath), { recursive: true });
20498
- fs12.writeFileSync(filePath, (hadBom ? "\uFEFF" : "") + text2);
20541
+ const out = wasEmpty && !text2.endsWith("\n") ? text2 + "\n" : text2;
20542
+ fs12.writeFileSync(filePath, (hadBom ? "\uFEFF" : "") + out);
20499
20543
  }
20500
20544
  function dirExists(p) {
20501
20545
  try {
@@ -20546,12 +20590,12 @@ async function isOnline(timeoutMs = PROBE_TIMEOUT_MS) {
20546
20590
  } catch {
20547
20591
  return false;
20548
20592
  }
20549
- return new Promise((resolve9) => {
20550
- const timer = setTimeout(() => resolve9(false), timeoutMs);
20593
+ return new Promise((resolve10) => {
20594
+ const timer = setTimeout(() => resolve10(false), timeoutMs);
20551
20595
  timer.unref();
20552
20596
  dns.lookup(host, (err) => {
20553
20597
  clearTimeout(timer);
20554
- resolve9(!err);
20598
+ resolve10(!err);
20555
20599
  });
20556
20600
  });
20557
20601
  }
@@ -20614,23 +20658,15 @@ function removeDirIfEmpty(dirPath) {
20614
20658
  } catch {
20615
20659
  }
20616
20660
  }
20617
- function pruneEmptyConfig(value) {
20618
- if (Array.isArray(value)) {
20619
- return value.length > 0 ? value : void 0;
20620
- }
20621
- if (value && typeof value === "object") {
20622
- const cleaned = {};
20623
- for (const [key, entry] of Object.entries(value)) {
20624
- const next = pruneEmptyConfig(entry);
20625
- if (next !== void 0) cleaned[key] = next;
20626
- }
20627
- return Object.keys(cleaned).length > 0 ? cleaned : void 0;
20628
- }
20629
- return value;
20630
- }
20631
20661
  function isRecord(value) {
20632
20662
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
20633
20663
  }
20664
+ function deleteIfEmpty(parent, key) {
20665
+ const value = parent[key];
20666
+ if (isRecord(value) && Object.keys(value).length === 0) {
20667
+ delete parent[key];
20668
+ }
20669
+ }
20634
20670
  function normalizeServerEntry(raw) {
20635
20671
  if (raw === void 0 || raw === null) return null;
20636
20672
  if (isRecord(raw)) {
@@ -20667,23 +20703,13 @@ function isArgentManagedEntry(entry) {
20667
20703
  return false;
20668
20704
  }
20669
20705
  }
20670
- function writeJsonOrRemove(filePath, data) {
20671
- const cleaned = pruneEmptyConfig(data);
20672
- if (!isRecord(cleaned)) {
20673
- fs13.rmSync(filePath, { force: true });
20674
- removeDirIfEmpty(path13.dirname(filePath));
20675
- return;
20676
- }
20677
- writeJson(filePath, cleaned);
20678
- }
20679
20706
  function writeTomlOrRemove(filePath, data) {
20680
- const cleaned = pruneEmptyConfig(data);
20681
- if (!isRecord(cleaned)) {
20707
+ if (Object.keys(data).length === 0) {
20682
20708
  fs13.rmSync(filePath, { force: true });
20683
20709
  removeDirIfEmpty(path13.dirname(filePath));
20684
20710
  return;
20685
20711
  }
20686
- writeToml(filePath, cleaned);
20712
+ writeToml(filePath, data);
20687
20713
  }
20688
20714
  var cursorAdapter = {
20689
20715
  name: "Cursor",
@@ -20696,57 +20722,60 @@ var cursorAdapter = {
20696
20722
  globalPath() {
20697
20723
  return path13.join(homedir4(), ".cursor", "mcp.json");
20698
20724
  },
20725
+ // Cursor is a VS Code fork: .cursor/mcp.json is JSONC (line/block comments,
20726
+ // trailing commas). Routing write/remove/hasArgentEntry through readJsonc /
20727
+ // editJsoncFile applies path-targeted text edits that preserve comments and
20728
+ // foreign servers. The old readJson → writeJson path ran commented files
20729
+ // through readJson's `catch { return {} }`, then persisted only the argent
20730
+ // entry — destroying every pre-existing server and comment. Matches VS Code.
20699
20731
  write(configPath, entry) {
20700
- const config = readJson(configPath);
20701
- const servers = config.mcpServers ?? {};
20702
- servers[MCP_SERVER_KEY] = {
20732
+ editJsoncFile(configPath, ["mcpServers", MCP_SERVER_KEY], {
20703
20733
  command: entry.command,
20704
20734
  args: entry.args,
20705
20735
  ...hasEnv(entry) ? { env: entry.env } : {}
20706
- };
20707
- config.mcpServers = servers;
20708
- writeJson(configPath, config);
20736
+ });
20709
20737
  },
20710
20738
  remove(configPath) {
20711
20739
  if (!fs13.existsSync(configPath)) return false;
20712
- const config = readJson(configPath);
20740
+ const config = readJsonc(configPath);
20713
20741
  const servers = config.mcpServers;
20714
20742
  if (!servers?.[MCP_SERVER_KEY]) return false;
20715
- delete servers[MCP_SERVER_KEY];
20716
- writeJsonOrRemove(configPath, config);
20743
+ editJsoncFile(configPath, ["mcpServers", MCP_SERVER_KEY], void 0);
20717
20744
  return true;
20718
20745
  },
20719
20746
  getArgentEntry(configPath) {
20720
20747
  if (!fs13.existsSync(configPath)) return null;
20721
- const config = readJson(configPath);
20748
+ const config = readJsonc(configPath);
20722
20749
  const servers = config.mcpServers;
20723
20750
  return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
20724
20751
  },
20725
20752
  hasArgentEntry(configPath) {
20726
20753
  return this.getArgentEntry(configPath) !== null;
20727
20754
  },
20755
+ // Cursor's allowlist lives in a separate ~/.cursor/permissions.json, which —
20756
+ // like every Cursor config — is JSONC (comments, trailing commas) and may
20757
+ // carry the user's own unrelated rules. Route through readJsonc / editJsoncFile
20758
+ // so a hand-commented or multi-rule permissions.json survives: the old readJson
20759
+ // path ran it through `catch { return {} }` and rewrote the whole file with
20760
+ // only { mcpAllowlist }, dropping every foreign rule and comment. Newly matters
20761
+ // because `hasArgentEntry` now reads mcp.json with readJsonc, so `update`
20762
+ // detects a commented config as configured and calls this.
20728
20763
  addAllowlist() {
20729
20764
  const permPath = path13.join(homedir4(), ".cursor", "permissions.json");
20730
- const config = readJson(permPath);
20731
- const list = config.mcpAllowlist ?? [];
20732
- if (!list.includes(CURSOR_ALLOWLIST_PATTERN)) {
20733
- list.push(CURSOR_ALLOWLIST_PATTERN);
20734
- config.mcpAllowlist = list;
20735
- writeJson(permPath, config);
20736
- }
20765
+ const config = readJsonc(permPath);
20766
+ const list = Array.isArray(config.mcpAllowlist) ? config.mcpAllowlist : [];
20767
+ if (list.includes(CURSOR_ALLOWLIST_PATTERN)) return;
20768
+ editJsoncFile(permPath, ["mcpAllowlist"], [...list, CURSOR_ALLOWLIST_PATTERN]);
20737
20769
  },
20738
20770
  removeAllowlist(_root, scope) {
20739
20771
  if (scope !== "global") return;
20740
20772
  const permPath = path13.join(homedir4(), ".cursor", "permissions.json");
20741
20773
  if (!fs13.existsSync(permPath)) return;
20742
- const config = readJson(permPath);
20743
- const list = config.mcpAllowlist;
20744
- if (!Array.isArray(list)) return;
20745
- const idx = list.indexOf(CURSOR_ALLOWLIST_PATTERN);
20746
- if (idx === -1) return;
20747
- list.splice(idx, 1);
20748
- config.mcpAllowlist = list;
20749
- writeJsonOrRemove(permPath, config);
20774
+ const config = readJsonc(permPath);
20775
+ const list = Array.isArray(config.mcpAllowlist) ? config.mcpAllowlist : void 0;
20776
+ if (!list || !list.includes(CURSOR_ALLOWLIST_PATTERN)) return;
20777
+ const next = list.filter((rule) => rule !== CURSOR_ALLOWLIST_PATTERN);
20778
+ editJsoncFile(permPath, ["mcpAllowlist"], next.length > 0 ? next : void 0);
20750
20779
  }
20751
20780
  };
20752
20781
  function claudeProjectKeysForRoot(projects, root) {
@@ -20797,35 +20826,34 @@ var claudeAdapter = {
20797
20826
  globalPath() {
20798
20827
  return path13.join(homedir4(), ".claude.json");
20799
20828
  },
20829
+ // JSONC is a superset of JSON, so routing through readJsonc / editJsoncFile is
20830
+ // safe for this strict-JSON config and keeps every MCP-entry write on the one
20831
+ // comment- and foreign-server-preserving path (see the Cursor adapter).
20800
20832
  write(configPath, entry) {
20801
- const config = readJson(configPath);
20802
- const servers = config.mcpServers ?? {};
20803
- servers[MCP_SERVER_KEY] = {
20833
+ editJsoncFile(configPath, ["mcpServers", MCP_SERVER_KEY], {
20804
20834
  type: "stdio",
20805
20835
  command: entry.command,
20806
20836
  args: entry.args,
20807
20837
  ...hasEnv(entry) ? { env: entry.env } : {}
20808
- };
20809
- config.mcpServers = servers;
20810
- writeJson(configPath, config);
20838
+ });
20811
20839
  },
20812
20840
  remove(configPath) {
20813
20841
  if (!fs13.existsSync(configPath)) return false;
20814
- const config = readJson(configPath);
20842
+ const config = readJsonc(configPath);
20815
20843
  const servers = config.mcpServers;
20816
20844
  if (!servers?.[MCP_SERVER_KEY]) return false;
20817
- delete servers[MCP_SERVER_KEY];
20818
20845
  if (configPath === this.globalPath()) {
20846
+ delete servers[MCP_SERVER_KEY];
20819
20847
  if (Object.keys(servers).length === 0) delete config.mcpServers;
20820
20848
  writeJson(configPath, config);
20821
20849
  } else {
20822
- writeJsonOrRemove(configPath, config);
20850
+ editJsoncFile(configPath, ["mcpServers", MCP_SERVER_KEY], void 0);
20823
20851
  }
20824
20852
  return true;
20825
20853
  },
20826
20854
  getArgentEntry(configPath) {
20827
20855
  if (!fs13.existsSync(configPath)) return null;
20828
- const config = readJson(configPath);
20856
+ const config = readJsonc(configPath);
20829
20857
  const servers = config.mcpServers;
20830
20858
  return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
20831
20859
  },
@@ -20906,30 +20934,32 @@ var vscodeAdapter = {
20906
20934
  globalPath() {
20907
20935
  return null;
20908
20936
  },
20937
+ // .vscode/mcp.json is JSONC — VS Code allows line/block comments and trailing
20938
+ // commas. The previous JSON.parse → mutate → JSON.stringify path ran through
20939
+ // readJson, whose `catch { return {} }` turned any commented file into {} and
20940
+ // then persisted only { servers: { argent } }, destroying every pre-existing
20941
+ // user server (and their comments). All four entry points now go through
20942
+ // readJsonc / editJsoncFile — path-targeted text edits that preserve comments
20943
+ // and foreign servers — matching the Zed and opencode adapters.
20909
20944
  write(configPath, entry) {
20910
- const config = readJson(configPath);
20911
- const servers = config.servers ?? {};
20912
- servers[MCP_SERVER_KEY] = {
20945
+ editJsoncFile(configPath, ["servers", MCP_SERVER_KEY], {
20913
20946
  type: "stdio",
20914
20947
  command: entry.command,
20915
20948
  args: entry.args,
20916
20949
  ...hasEnv(entry) ? { env: entry.env } : {}
20917
- };
20918
- config.servers = servers;
20919
- writeJson(configPath, config);
20950
+ });
20920
20951
  },
20921
20952
  remove(configPath) {
20922
20953
  if (!fs13.existsSync(configPath)) return false;
20923
- const config = readJson(configPath);
20954
+ const config = readJsonc(configPath);
20924
20955
  const servers = config.servers;
20925
20956
  if (!servers?.[MCP_SERVER_KEY]) return false;
20926
- delete servers[MCP_SERVER_KEY];
20927
- writeJsonOrRemove(configPath, config);
20957
+ editJsoncFile(configPath, ["servers", MCP_SERVER_KEY], void 0);
20928
20958
  return true;
20929
20959
  },
20930
20960
  getArgentEntry(configPath) {
20931
20961
  if (!fs13.existsSync(configPath)) return null;
20932
- const config = readJson(configPath);
20962
+ const config = readJsonc(configPath);
20933
20963
  const servers = config.servers;
20934
20964
  return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
20935
20965
  },
@@ -20987,54 +21017,53 @@ var windsurfAdapter = {
20987
21017
  globalPath() {
20988
21018
  return path13.join(homedir4(), ".codeium", "windsurf", "mcp_config.json");
20989
21019
  },
21020
+ // JSONC-safe MCP-entry writes (see the Cursor adapter): editJsoncFile
21021
+ // preserves comments and pre-existing foreign servers on this JSON config.
20990
21022
  write(configPath, entry) {
20991
- const config = readJson(configPath);
20992
- const servers = config.mcpServers ?? {};
20993
- servers[MCP_SERVER_KEY] = {
21023
+ editJsoncFile(configPath, ["mcpServers", MCP_SERVER_KEY], {
20994
21024
  command: entry.command,
20995
21025
  args: entry.args,
20996
21026
  ...hasEnv(entry) ? { env: entry.env } : {}
20997
- };
20998
- config.mcpServers = servers;
20999
- writeJson(configPath, config);
21027
+ });
21000
21028
  },
21001
21029
  remove(configPath) {
21002
21030
  if (!fs13.existsSync(configPath)) return false;
21003
- const config = readJson(configPath);
21031
+ const config = readJsonc(configPath);
21004
21032
  const servers = config.mcpServers;
21005
21033
  if (!servers?.[MCP_SERVER_KEY]) return false;
21006
- delete servers[MCP_SERVER_KEY];
21007
- writeJsonOrRemove(configPath, config);
21034
+ editJsoncFile(configPath, ["mcpServers", MCP_SERVER_KEY], void 0);
21008
21035
  return true;
21009
21036
  },
21010
21037
  getArgentEntry(configPath) {
21011
21038
  if (!fs13.existsSync(configPath)) return null;
21012
- const config = readJson(configPath);
21039
+ const config = readJsonc(configPath);
21013
21040
  const servers = config.mcpServers;
21014
21041
  return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
21015
21042
  },
21016
21043
  hasArgentEntry(configPath) {
21017
21044
  return this.getArgentEntry(configPath) !== null;
21018
21045
  },
21046
+ // JSONC-safe allowlist edits (see the Cursor adapter): the argent entry lives
21047
+ // in this same mcp_config.json, and `init` runs write() (comment-preserving)
21048
+ // before addAllowlist(). The old readJson path choked on any user comment and
21049
+ // silently skipped the toggle; editJsoncFile targets just the argent entry's
21050
+ // alwaysAllow key so comments and foreign servers survive.
21019
21051
  addAllowlist() {
21020
21052
  const configPath = path13.join(homedir4(), ".codeium", "windsurf", "mcp_config.json");
21021
- const config = readJson(configPath);
21022
- const servers = config.mcpServers ?? {};
21023
- const entry = servers[MCP_SERVER_KEY];
21024
- if (!entry) return;
21025
- entry.alwaysAllow = ["*"];
21026
- writeJson(configPath, config);
21053
+ const config = readJsonc(configPath);
21054
+ const servers = config.mcpServers;
21055
+ if (!servers?.[MCP_SERVER_KEY]) return;
21056
+ editJsoncFile(configPath, ["mcpServers", MCP_SERVER_KEY, "alwaysAllow"], ["*"]);
21027
21057
  },
21028
21058
  removeAllowlist(_root, scope) {
21029
21059
  if (scope !== "global") return;
21030
21060
  const configPath = path13.join(homedir4(), ".codeium", "windsurf", "mcp_config.json");
21031
21061
  if (!fs13.existsSync(configPath)) return;
21032
- const config = readJson(configPath);
21033
- const servers = config.mcpServers ?? {};
21034
- const entry = servers[MCP_SERVER_KEY];
21062
+ const config = readJsonc(configPath);
21063
+ const servers = config.mcpServers;
21064
+ const entry = servers?.[MCP_SERVER_KEY];
21035
21065
  if (!entry?.alwaysAllow) return;
21036
- delete entry.alwaysAllow;
21037
- writeJsonOrRemove(configPath, config);
21066
+ editJsoncFile(configPath, ["mcpServers", MCP_SERVER_KEY, "alwaysAllow"], void 0);
21038
21067
  }
21039
21068
  };
21040
21069
  var zedAdapter = {
@@ -21106,58 +21135,57 @@ var geminiAdapter = {
21106
21135
  globalPath() {
21107
21136
  return path13.join(homedir4(), ".gemini", "settings.json");
21108
21137
  },
21138
+ // JSONC-safe MCP-entry writes (see the Cursor adapter): editJsoncFile
21139
+ // preserves comments and pre-existing foreign servers on this JSON config.
21109
21140
  write(configPath, entry) {
21110
- const config = readJson(configPath);
21111
- const servers = config.mcpServers ?? {};
21112
- servers[MCP_SERVER_KEY] = {
21141
+ editJsoncFile(configPath, ["mcpServers", MCP_SERVER_KEY], {
21113
21142
  command: entry.command,
21114
21143
  args: entry.args,
21115
21144
  ...hasEnv(entry) ? { env: entry.env } : {}
21116
- };
21117
- config.mcpServers = servers;
21118
- writeJson(configPath, config);
21145
+ });
21119
21146
  },
21120
21147
  remove(configPath) {
21121
21148
  if (!fs13.existsSync(configPath)) return false;
21122
- const config = readJson(configPath);
21149
+ const config = readJsonc(configPath);
21123
21150
  const servers = config.mcpServers;
21124
21151
  if (!servers?.[MCP_SERVER_KEY]) return false;
21125
- delete servers[MCP_SERVER_KEY];
21126
- writeJsonOrRemove(configPath, config);
21152
+ editJsoncFile(configPath, ["mcpServers", MCP_SERVER_KEY], void 0);
21127
21153
  return true;
21128
21154
  },
21129
21155
  getArgentEntry(configPath) {
21130
21156
  if (!fs13.existsSync(configPath)) return null;
21131
- const config = readJson(configPath);
21157
+ const config = readJsonc(configPath);
21132
21158
  const servers = config.mcpServers;
21133
21159
  return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
21134
21160
  },
21135
21161
  hasArgentEntry(configPath) {
21136
21162
  return this.getArgentEntry(configPath) !== null;
21137
21163
  },
21164
+ // JSONC-safe allowlist edits (see the Cursor adapter): the argent entry lives
21165
+ // in this same settings.json, and `init` runs write() (comment-preserving)
21166
+ // before addAllowlist(). The old readJson path choked on any user comment and
21167
+ // silently skipped the toggle; editJsoncFile targets just the argent entry's
21168
+ // trust key so comments and foreign servers survive.
21138
21169
  addAllowlist(root, scope) {
21139
21170
  const configPath = scope === "global" ? this.globalPath() : this.projectPath(root);
21140
21171
  if (!configPath) {
21141
21172
  return;
21142
21173
  }
21143
- const config = readJson(configPath);
21144
- const servers = config.mcpServers ?? {};
21145
- const entry = servers[MCP_SERVER_KEY];
21146
- if (!entry) return;
21147
- entry.trust = true;
21148
- writeJson(configPath, config);
21174
+ const config = readJsonc(configPath);
21175
+ const servers = config.mcpServers;
21176
+ if (!servers?.[MCP_SERVER_KEY]) return;
21177
+ editJsoncFile(configPath, ["mcpServers", MCP_SERVER_KEY, "trust"], true);
21149
21178
  },
21150
21179
  removeAllowlist(root, scope) {
21151
21180
  const configPath = scope === "global" ? this.globalPath() : this.projectPath(root);
21152
21181
  if (!configPath || !fs13.existsSync(configPath)) {
21153
21182
  return;
21154
21183
  }
21155
- const config = readJson(configPath);
21184
+ const config = readJsonc(configPath);
21156
21185
  const servers = config.mcpServers;
21157
21186
  const entry = servers?.[MCP_SERVER_KEY];
21158
21187
  if (!entry?.trust) return;
21159
- delete entry.trust;
21160
- writeJsonOrRemove(configPath, config);
21188
+ editJsoncFile(configPath, ["mcpServers", MCP_SERVER_KEY, "trust"], void 0);
21161
21189
  }
21162
21190
  };
21163
21191
  var CODEX_FILENAME = ".codex";
@@ -21189,6 +21217,7 @@ var codexAdapter = {
21189
21217
  const servers = config.mcp_servers;
21190
21218
  if (!servers?.[MCP_SERVER_KEY]) return false;
21191
21219
  delete servers[MCP_SERVER_KEY];
21220
+ deleteIfEmpty(config, "mcp_servers");
21192
21221
  writeTomlOrRemove(configPath, config);
21193
21222
  return true;
21194
21223
  },
@@ -21373,54 +21402,59 @@ var kiroAdapter = {
21373
21402
  globalPath() {
21374
21403
  return path13.join(homedir4(), ".kiro", "settings", "mcp.json");
21375
21404
  },
21405
+ // Kiro is a VS Code fork: .kiro/settings/mcp.json is JSONC. As with Cursor,
21406
+ // route write/remove/hasArgentEntry through readJsonc / editJsoncFile so
21407
+ // comments and foreign servers survive instead of being flattened away by the
21408
+ // old readJson → writeJson path.
21376
21409
  write(configPath, entry) {
21377
- const config = readJson(configPath);
21378
- const servers = config.mcpServers ?? {};
21379
- servers[MCP_SERVER_KEY] = {
21410
+ editJsoncFile(configPath, ["mcpServers", MCP_SERVER_KEY], {
21380
21411
  command: entry.command,
21381
21412
  args: entry.args,
21382
21413
  ...hasEnv(entry) ? { env: entry.env } : {}
21383
- };
21384
- config.mcpServers = servers;
21385
- writeJson(configPath, config);
21414
+ });
21386
21415
  },
21387
21416
  remove(configPath) {
21388
21417
  if (!fs13.existsSync(configPath)) return false;
21389
- const config = readJson(configPath);
21418
+ const config = readJsonc(configPath);
21390
21419
  const servers = config.mcpServers;
21391
21420
  if (!servers?.[MCP_SERVER_KEY]) return false;
21392
- delete servers[MCP_SERVER_KEY];
21393
- writeJsonOrRemove(configPath, config);
21421
+ editJsoncFile(configPath, ["mcpServers", MCP_SERVER_KEY], void 0);
21394
21422
  return true;
21395
21423
  },
21396
21424
  getArgentEntry(configPath) {
21397
21425
  if (!fs13.existsSync(configPath)) return null;
21398
- const config = readJson(configPath);
21426
+ const config = readJsonc(configPath);
21399
21427
  const servers = config.mcpServers;
21400
21428
  return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
21401
21429
  },
21402
21430
  hasArgentEntry(configPath) {
21403
21431
  return this.getArgentEntry(configPath) !== null;
21404
21432
  },
21433
+ // JSONC-safe allowlist edits (see the Cursor adapter): .kiro/settings/mcp.json
21434
+ // is JSONC, the argent entry lives in it, and `init` runs write() (comment-
21435
+ // preserving) before addAllowlist(). The old readJson path choked on any user
21436
+ // comment and silently skipped the toggle; editJsoncFile targets just the
21437
+ // argent entry's autoApprove key so comments and foreign servers survive.
21405
21438
  addAllowlist(root, scope) {
21406
21439
  const configPath = scope === "global" ? this.globalPath() : this.projectPath(root);
21407
21440
  if (!configPath) return;
21408
- const config = readJson(configPath);
21409
- const servers = config.mcpServers ?? {};
21410
- const entry = servers[MCP_SERVER_KEY];
21411
- if (!entry) return;
21412
- entry.autoApprove = [...KIRO_AUTO_APPROVE_ALL];
21413
- writeJson(configPath, config);
21441
+ const config = readJsonc(configPath);
21442
+ const servers = config.mcpServers;
21443
+ if (!servers?.[MCP_SERVER_KEY]) return;
21444
+ editJsoncFile(
21445
+ configPath,
21446
+ ["mcpServers", MCP_SERVER_KEY, "autoApprove"],
21447
+ [...KIRO_AUTO_APPROVE_ALL]
21448
+ );
21414
21449
  },
21415
21450
  removeAllowlist(root, scope) {
21416
21451
  const configPath = scope === "global" ? this.globalPath() : this.projectPath(root);
21417
21452
  if (!configPath || !fs13.existsSync(configPath)) return;
21418
- const config = readJson(configPath);
21453
+ const config = readJsonc(configPath);
21419
21454
  const servers = config.mcpServers;
21420
21455
  const entry = servers?.[MCP_SERVER_KEY];
21421
21456
  if (!entry?.autoApprove) return;
21422
- delete entry.autoApprove;
21423
- writeJsonOrRemove(configPath, config);
21457
+ editJsoncFile(configPath, ["mcpServers", MCP_SERVER_KEY, "autoApprove"], void 0);
21424
21458
  }
21425
21459
  };
21426
21460
  var ALL_ADAPTERS = [
@@ -21461,26 +21495,22 @@ function findConfiguredAdapterScopes(adapters, projectRoot) {
21461
21495
  }
21462
21496
  function addClaudePermission(root, scope) {
21463
21497
  const settingsPath = scope === "global" ? path13.join(homedir4(), ".claude", "settings.json") : path13.join(root, ".claude", "settings.json");
21464
- const config = readJson(settingsPath);
21498
+ const config = readJsonc(settingsPath);
21465
21499
  const permissions = config.permissions ?? {};
21466
- const allow = permissions.allow ?? [];
21467
- if (!allow.includes(PERMISSION_RULE)) {
21468
- allow.push(PERMISSION_RULE);
21469
- permissions.allow = allow;
21470
- config.permissions = permissions;
21471
- writeJson(settingsPath, config);
21472
- }
21500
+ const allow = Array.isArray(permissions.allow) ? permissions.allow : [];
21501
+ if (allow.includes(PERMISSION_RULE)) return;
21502
+ editJsoncFile(settingsPath, ["permissions", "allow"], [...allow, PERMISSION_RULE]);
21473
21503
  }
21474
21504
  function removeClaudePermission(root, scope) {
21475
21505
  const settingsPath = scope === "global" ? path13.join(homedir4(), ".claude", "settings.json") : path13.join(root, ".claude", "settings.json");
21476
21506
  if (!fs13.existsSync(settingsPath)) return;
21477
- const config = readJson(settingsPath);
21478
- const allow = config?.permissions?.allow;
21479
- if (!Array.isArray(allow)) return;
21480
- const idx = allow.indexOf(PERMISSION_RULE);
21481
- if (idx === -1) return;
21482
- allow.splice(idx, 1);
21483
- writeJsonOrRemove(settingsPath, config);
21507
+ const config = readJsonc(settingsPath);
21508
+ const permissions = config?.permissions;
21509
+ const allow = permissions?.allow;
21510
+ if (!permissions || !Array.isArray(allow)) return;
21511
+ if (!allow.includes(PERMISSION_RULE)) return;
21512
+ const next = allow.filter((rule) => rule !== PERMISSION_RULE);
21513
+ editJsoncFile(settingsPath, ["permissions", "allow"], next.length > 0 ? next : void 0);
21484
21514
  }
21485
21515
  function formatManagedPathLabel(targetPath, root) {
21486
21516
  const home = homedir4();
@@ -21886,7 +21916,7 @@ function execShellCommandSync(cmd, opts = {}) {
21886
21916
  });
21887
21917
  }
21888
21918
  function runShellCommand(cmd, opts = {}) {
21889
- return new Promise((resolve9, reject) => {
21919
+ return new Promise((resolve10, reject) => {
21890
21920
  const child = spawn2(cmd.bin, cmd.args, {
21891
21921
  stdio: ["ignore", "pipe", "pipe"],
21892
21922
  shell: process.platform === "win32",
@@ -21897,7 +21927,7 @@ function runShellCommand(cmd, opts = {}) {
21897
21927
  stderr += chunk.toString();
21898
21928
  });
21899
21929
  child.on("close", (code) => {
21900
- if (code === 0) resolve9();
21930
+ if (code === 0) resolve10();
21901
21931
  else reject(new Error(stderr.trim() || `Command exited with code ${code}`));
21902
21932
  });
21903
21933
  child.on("error", reject);
@@ -22720,7 +22750,7 @@ async function runSkillsStep(args) {
22720
22750
  return skillsMethod;
22721
22751
  }
22722
22752
  function runNpxSkills(args, interactive, cwd) {
22723
- return new Promise((resolve9, reject) => {
22753
+ return new Promise((resolve10, reject) => {
22724
22754
  const npxCmd = process.platform === "win32" ? "npx.cmd" : "npx";
22725
22755
  const child = spawn3(npxCmd, args, {
22726
22756
  stdio: interactive ? "inherit" : ["ignore", "pipe", "pipe"],
@@ -22739,7 +22769,7 @@ function runNpxSkills(args, interactive, cwd) {
22739
22769
  }
22740
22770
  child.on("close", (code) => {
22741
22771
  if (code === 0) {
22742
- resolve9();
22772
+ resolve10();
22743
22773
  } else {
22744
22774
  const output = [stderr, stdout2].filter(Boolean).join("\n").trim();
22745
22775
  reject(new Error(output || `npx skills exited with code ${code}`));
@@ -23192,20 +23222,28 @@ var LINK_DIR = path15.join(homedir6(), ".argent");
23192
23222
  var LINK_FILE = path15.join(LINK_DIR, "link.json");
23193
23223
 
23194
23224
  // ../argent-tools-client/src/file-inputs.ts
23195
- import { mkdir as mkdir3, stat as stat2, writeFile as writeFile3 } from "node:fs/promises";
23196
- import { readFile as readFile3 } from "node:fs/promises";
23225
+ import { createHash as createHash2, randomUUID as randomUUID6 } from "node:crypto";
23226
+ import { createReadStream as createReadStream2 } from "node:fs";
23227
+ import { mkdir as mkdir3, readFile as readFile3, rm as rm2, stat as stat2, writeFile as writeFile3 } from "node:fs/promises";
23228
+ import { tmpdir } from "node:os";
23197
23229
  import * as path16 from "node:path";
23198
- var MAX_CONTENT_BYTES = 32 * 1024 * 1024;
23199
23230
 
23200
- // ../argent-tools-client/src/artifacts.ts
23201
- import { mkdir as mkdir4, readFile as readFile4, rm, stat as stat3, writeFile as writeFile4 } from "node:fs/promises";
23202
- import { tmpdir } from "node:os";
23203
- import { basename as basename2, join as join17 } from "node:path";
23204
- import { createHash as createHash2 } from "node:crypto";
23231
+ // ../archive/src/index.ts
23205
23232
  import { execFile } from "node:child_process";
23233
+ import { rm, readdir as readdir2 } from "node:fs/promises";
23234
+ import { basename as basename2, dirname as dirname11, join as join17, posix as posix2, resolve as resolve8, sep as sep5 } from "node:path";
23206
23235
  import { promisify } from "node:util";
23207
23236
  var execFileAsync = promisify(execFile);
23208
23237
 
23238
+ // ../argent-tools-client/src/file-inputs.ts
23239
+ var MAX_CONTENT_BYTES = 32 * 1024 * 1024;
23240
+
23241
+ // ../argent-tools-client/src/artifacts.ts
23242
+ import { mkdir as mkdir4, readFile as readFile4, rm as rm3, stat as stat3, writeFile as writeFile4 } from "node:fs/promises";
23243
+ import { tmpdir as tmpdir2 } from "node:os";
23244
+ import { basename as basename4, join as join19 } from "node:path";
23245
+ import { createHash as createHash3 } from "node:crypto";
23246
+
23209
23247
  // ../argent-installer/src/update.ts
23210
23248
  function getRequestedVersion(args) {
23211
23249
  for (let i2 = 0; i2 < args.length; i2 += 1) {