@swmansion/argent 0.15.0 → 0.15.1-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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",
@@ -16367,6 +16376,10 @@ var FAILURE_SPAWN_CODE = oneOf(FAILURE_SPAWN_CODES);
16367
16376
  var NETWORK_FAILURE = oneOf(NETWORK_FAILURES);
16368
16377
  var AI_CLIENT = oneOf(AI_CLIENTS);
16369
16378
  var INSTALL_MODE = oneOf(["global", "local"]);
16379
+ var ERROR_NAME = matches(/^[A-Za-z][A-Za-z0-9_]{0,63}$/, 64);
16380
+ var ERROR_SYSCALL = matches(/^E[A-Z0-9_]{1,31}$/, 32);
16381
+ var CRASH_FINGERPRINT = matches(/^[0-9a-f]{16}$/, 16);
16382
+ var CRASH_PHASE = oneOf(["startup", "serving"]);
16370
16383
  var AI_TELEMETRY = {
16371
16384
  ai_client: AI_CLIENT
16372
16385
  };
@@ -16497,7 +16510,44 @@ var ALLOWED = {
16497
16510
  reason: oneOf(["idle", "signal", "crash"]),
16498
16511
  uptime_ms: DURATION_MS,
16499
16512
  total_tool_calls: COUNT,
16500
- ...FAILURE_SIGNAL
16513
+ ...FAILURE_SIGNAL,
16514
+ error_name: ERROR_NAME,
16515
+ error_syscall: ERROR_SYSCALL,
16516
+ crash_fingerprint: CRASH_FINGERPRINT,
16517
+ crash_phase: CRASH_PHASE
16518
+ },
16519
+ "lens:preview_opened": {
16520
+ round: COUNT,
16521
+ element_count: COUNT,
16522
+ variant_count: COUNT,
16523
+ is_cli_session: bool,
16524
+ platform: PLATFORM
16525
+ },
16526
+ "lens:round_completed": {
16527
+ round: COUNT,
16528
+ element_count: COUNT,
16529
+ variant_count: COUNT,
16530
+ annotation_count: COUNT,
16531
+ element_comment_count: COUNT,
16532
+ skipped_comment_count: COUNT,
16533
+ has_global_comment: bool,
16534
+ inspector_used: bool,
16535
+ offscreen_revealed: bool,
16536
+ is_cli_session: bool,
16537
+ had_parked_await: bool,
16538
+ round_duration_ms: DURATION_MS,
16539
+ platform: PLATFORM
16540
+ },
16541
+ "lens:round_abandoned": {
16542
+ round: COUNT,
16543
+ element_count: COUNT,
16544
+ variant_count: COUNT,
16545
+ had_parked_await: bool,
16546
+ is_cli_session: bool,
16547
+ platform: PLATFORM
16548
+ },
16549
+ "lens:cli_session_started": {
16550
+ agent_choice_count: COUNT
16501
16551
  }
16502
16552
  };
16503
16553
  function sanitize(event, raw) {
@@ -17418,12 +17468,12 @@ function resolveHostFingerprint() {
17418
17468
  }
17419
17469
  }
17420
17470
  function resolveHostFingerprintAsync() {
17421
- return new Promise((resolve9) => {
17471
+ return new Promise((resolve10) => {
17422
17472
  let binary;
17423
17473
  try {
17424
17474
  binary = simulatorServerBinaryPath();
17425
17475
  } catch {
17426
- resolve9(null);
17476
+ resolve10(null);
17427
17477
  return;
17428
17478
  }
17429
17479
  let settled = false;
@@ -17436,7 +17486,7 @@ function resolveHostFingerprintAsync() {
17436
17486
  child?.kill("SIGKILL");
17437
17487
  } catch {
17438
17488
  }
17439
- resolve9(value);
17489
+ resolve10(value);
17440
17490
  };
17441
17491
  const watchdog = setTimeout(() => finish(null), FINGERPRINT_TIMEOUT_MS);
17442
17492
  watchdog.unref?.();
@@ -17658,6 +17708,9 @@ async function resetLocalTelemetryState() {
17658
17708
  return { localIdRemoved, noticeReset };
17659
17709
  }
17660
17710
 
17711
+ // ../telemetry/src/crash-diagnostics.ts
17712
+ import { createHash } from "node:crypto";
17713
+
17661
17714
  // ../telemetry/src/index.ts
17662
17715
  var SHORT_FLUSH_TIMEOUT_MS = 1500;
17663
17716
  var state = null;
@@ -17731,7 +17784,7 @@ async function shutdown(timeoutMs = SHORT_FLUSH_TIMEOUT_MS) {
17731
17784
  try {
17732
17785
  await Promise.race([
17733
17786
  client2.shutdown(timeoutMs),
17734
- new Promise((resolve9) => setTimeout(resolve9, timeoutMs + 250).unref())
17787
+ new Promise((resolve10) => setTimeout(resolve10, timeoutMs + 250).unref())
17735
17788
  ]);
17736
17789
  } catch (err) {
17737
17790
  emitDebugError("shutdown failed", err);
@@ -18088,7 +18141,7 @@ function skipVoid(str, ptr, banNewLines, banComments) {
18088
18141
  }
18089
18142
  return ptr;
18090
18143
  }
18091
- function skipUntil(str, ptr, sep6, end, banNewLines = false) {
18144
+ function skipUntil(str, ptr, sep7, end, banNewLines = false) {
18092
18145
  if (!end) {
18093
18146
  ptr = indexOfNewline(str, ptr);
18094
18147
  return ptr < 0 ? str.length : ptr;
@@ -18097,7 +18150,7 @@ function skipUntil(str, ptr, sep6, end, banNewLines = false) {
18097
18150
  let c2 = str[i2];
18098
18151
  if (c2 === "#") {
18099
18152
  i2 = indexOfNewline(str, i2);
18100
- } else if (c2 === sep6) {
18153
+ } else if (c2 === sep7) {
18101
18154
  return i2 + 1;
18102
18155
  } else if (c2 === end || banNewLines && (c2 === "\n" || c2 === "\r" && str[i2 + 1] === "\n")) {
18103
18156
  return i2;
@@ -19363,11 +19416,11 @@ function parseTree(text2, errors = [], options = ParseOptions.DEFAULT) {
19363
19416
  onValue({ type: getNodeType(value), offset, length, parent: currentParent, value });
19364
19417
  ensurePropertyComplete(offset + length);
19365
19418
  },
19366
- onSeparator: (sep6, offset, length) => {
19419
+ onSeparator: (sep7, offset, length) => {
19367
19420
  if (currentParent.type === "property") {
19368
- if (sep6 === ":") {
19421
+ if (sep7 === ":") {
19369
19422
  currentParent.colonOffset = offset;
19370
- } else if (sep6 === ",") {
19423
+ } else if (sep7 === ",") {
19371
19424
  ensurePropertyComplete(offset);
19372
19425
  }
19373
19426
  }
@@ -19962,12 +20015,12 @@ function applyEdits(text2, edits) {
19962
20015
  // ../argent-installer/src/package-root.ts
19963
20016
  import * as fs7 from "node:fs";
19964
20017
  import * as path7 from "node:path";
19965
- function resolvePackageRoot(dirname13) {
19966
- let current = path7.resolve(dirname13);
20018
+ function resolvePackageRoot(dirname14) {
20019
+ let current = path7.resolve(dirname14);
19967
20020
  while (true) {
19968
20021
  if (fs7.existsSync(path7.join(current, "package.json"))) return current;
19969
20022
  const parent = path7.dirname(current);
19970
- if (parent === current) return path7.resolve(dirname13);
20023
+ if (parent === current) return path7.resolve(dirname14);
19971
20024
  current = parent;
19972
20025
  }
19973
20026
  }
@@ -20442,12 +20495,13 @@ function setJsoncIn(text2, jsonPath, value) {
20442
20495
  return applyEdits(text2, edits);
20443
20496
  }
20444
20497
  function readJsoncFileRaw(filePath) {
20445
- if (!fs12.existsSync(filePath)) return { text: "{}", hadBom: false };
20498
+ if (!fs12.existsSync(filePath)) return { text: "{}", hadBom: false, wasEmpty: true };
20446
20499
  let text2 = fs12.readFileSync(filePath, "utf8");
20447
20500
  const hadBom = text2.charCodeAt(0) === 65279;
20448
20501
  if (hadBom) text2 = text2.slice(1);
20449
- if (text2.trim() === "") text2 = "{}";
20450
- return { text: text2, hadBom };
20502
+ const wasEmpty = text2.trim() === "";
20503
+ if (wasEmpty) text2 = "{}";
20504
+ return { text: text2, hadBom, wasEmpty };
20451
20505
  }
20452
20506
  function getAtJsoncPath(value, jsonPath) {
20453
20507
  let cur = value;
@@ -20478,7 +20532,7 @@ function readJsonc(filePath) {
20478
20532
  return parsed ?? {};
20479
20533
  }
20480
20534
  function editJsoncFile(filePath, jsonPath, value) {
20481
- const { text: initial, hadBom } = readJsoncFileRaw(filePath);
20535
+ const { text: initial, hadBom, wasEmpty } = readJsoncFileRaw(filePath);
20482
20536
  let text2 = setJsoncIn(initial, jsonPath, value);
20483
20537
  if (value === void 0) {
20484
20538
  for (let i2 = jsonPath.length - 1; i2 > 0; i2--) {
@@ -20495,7 +20549,8 @@ function editJsoncFile(filePath, jsonPath, value) {
20495
20549
  return;
20496
20550
  }
20497
20551
  fs12.mkdirSync(path12.dirname(filePath), { recursive: true });
20498
- fs12.writeFileSync(filePath, (hadBom ? "\uFEFF" : "") + text2);
20552
+ const out = wasEmpty && !text2.endsWith("\n") ? text2 + "\n" : text2;
20553
+ fs12.writeFileSync(filePath, (hadBom ? "\uFEFF" : "") + out);
20499
20554
  }
20500
20555
  function dirExists(p) {
20501
20556
  try {
@@ -20546,12 +20601,12 @@ async function isOnline(timeoutMs = PROBE_TIMEOUT_MS) {
20546
20601
  } catch {
20547
20602
  return false;
20548
20603
  }
20549
- return new Promise((resolve9) => {
20550
- const timer = setTimeout(() => resolve9(false), timeoutMs);
20604
+ return new Promise((resolve10) => {
20605
+ const timer = setTimeout(() => resolve10(false), timeoutMs);
20551
20606
  timer.unref();
20552
20607
  dns.lookup(host, (err) => {
20553
20608
  clearTimeout(timer);
20554
- resolve9(!err);
20609
+ resolve10(!err);
20555
20610
  });
20556
20611
  });
20557
20612
  }
@@ -20614,23 +20669,15 @@ function removeDirIfEmpty(dirPath) {
20614
20669
  } catch {
20615
20670
  }
20616
20671
  }
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
20672
  function isRecord(value) {
20632
20673
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
20633
20674
  }
20675
+ function deleteIfEmpty(parent, key) {
20676
+ const value = parent[key];
20677
+ if (isRecord(value) && Object.keys(value).length === 0) {
20678
+ delete parent[key];
20679
+ }
20680
+ }
20634
20681
  function normalizeServerEntry(raw) {
20635
20682
  if (raw === void 0 || raw === null) return null;
20636
20683
  if (isRecord(raw)) {
@@ -20667,23 +20714,13 @@ function isArgentManagedEntry(entry) {
20667
20714
  return false;
20668
20715
  }
20669
20716
  }
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
20717
  function writeTomlOrRemove(filePath, data) {
20680
- const cleaned = pruneEmptyConfig(data);
20681
- if (!isRecord(cleaned)) {
20718
+ if (Object.keys(data).length === 0) {
20682
20719
  fs13.rmSync(filePath, { force: true });
20683
20720
  removeDirIfEmpty(path13.dirname(filePath));
20684
20721
  return;
20685
20722
  }
20686
- writeToml(filePath, cleaned);
20723
+ writeToml(filePath, data);
20687
20724
  }
20688
20725
  var cursorAdapter = {
20689
20726
  name: "Cursor",
@@ -20696,57 +20733,60 @@ var cursorAdapter = {
20696
20733
  globalPath() {
20697
20734
  return path13.join(homedir4(), ".cursor", "mcp.json");
20698
20735
  },
20736
+ // Cursor is a VS Code fork: .cursor/mcp.json is JSONC (line/block comments,
20737
+ // trailing commas). Routing write/remove/hasArgentEntry through readJsonc /
20738
+ // editJsoncFile applies path-targeted text edits that preserve comments and
20739
+ // foreign servers. The old readJson → writeJson path ran commented files
20740
+ // through readJson's `catch { return {} }`, then persisted only the argent
20741
+ // entry — destroying every pre-existing server and comment. Matches VS Code.
20699
20742
  write(configPath, entry) {
20700
- const config = readJson(configPath);
20701
- const servers = config.mcpServers ?? {};
20702
- servers[MCP_SERVER_KEY] = {
20743
+ editJsoncFile(configPath, ["mcpServers", MCP_SERVER_KEY], {
20703
20744
  command: entry.command,
20704
20745
  args: entry.args,
20705
20746
  ...hasEnv(entry) ? { env: entry.env } : {}
20706
- };
20707
- config.mcpServers = servers;
20708
- writeJson(configPath, config);
20747
+ });
20709
20748
  },
20710
20749
  remove(configPath) {
20711
20750
  if (!fs13.existsSync(configPath)) return false;
20712
- const config = readJson(configPath);
20751
+ const config = readJsonc(configPath);
20713
20752
  const servers = config.mcpServers;
20714
20753
  if (!servers?.[MCP_SERVER_KEY]) return false;
20715
- delete servers[MCP_SERVER_KEY];
20716
- writeJsonOrRemove(configPath, config);
20754
+ editJsoncFile(configPath, ["mcpServers", MCP_SERVER_KEY], void 0);
20717
20755
  return true;
20718
20756
  },
20719
20757
  getArgentEntry(configPath) {
20720
20758
  if (!fs13.existsSync(configPath)) return null;
20721
- const config = readJson(configPath);
20759
+ const config = readJsonc(configPath);
20722
20760
  const servers = config.mcpServers;
20723
20761
  return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
20724
20762
  },
20725
20763
  hasArgentEntry(configPath) {
20726
20764
  return this.getArgentEntry(configPath) !== null;
20727
20765
  },
20766
+ // Cursor's allowlist lives in a separate ~/.cursor/permissions.json, which —
20767
+ // like every Cursor config — is JSONC (comments, trailing commas) and may
20768
+ // carry the user's own unrelated rules. Route through readJsonc / editJsoncFile
20769
+ // so a hand-commented or multi-rule permissions.json survives: the old readJson
20770
+ // path ran it through `catch { return {} }` and rewrote the whole file with
20771
+ // only { mcpAllowlist }, dropping every foreign rule and comment. Newly matters
20772
+ // because `hasArgentEntry` now reads mcp.json with readJsonc, so `update`
20773
+ // detects a commented config as configured and calls this.
20728
20774
  addAllowlist() {
20729
20775
  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
- }
20776
+ const config = readJsonc(permPath);
20777
+ const list = Array.isArray(config.mcpAllowlist) ? config.mcpAllowlist : [];
20778
+ if (list.includes(CURSOR_ALLOWLIST_PATTERN)) return;
20779
+ editJsoncFile(permPath, ["mcpAllowlist"], [...list, CURSOR_ALLOWLIST_PATTERN]);
20737
20780
  },
20738
20781
  removeAllowlist(_root, scope) {
20739
20782
  if (scope !== "global") return;
20740
20783
  const permPath = path13.join(homedir4(), ".cursor", "permissions.json");
20741
20784
  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);
20785
+ const config = readJsonc(permPath);
20786
+ const list = Array.isArray(config.mcpAllowlist) ? config.mcpAllowlist : void 0;
20787
+ if (!list || !list.includes(CURSOR_ALLOWLIST_PATTERN)) return;
20788
+ const next = list.filter((rule) => rule !== CURSOR_ALLOWLIST_PATTERN);
20789
+ editJsoncFile(permPath, ["mcpAllowlist"], next.length > 0 ? next : void 0);
20750
20790
  }
20751
20791
  };
20752
20792
  function claudeProjectKeysForRoot(projects, root) {
@@ -20797,35 +20837,34 @@ var claudeAdapter = {
20797
20837
  globalPath() {
20798
20838
  return path13.join(homedir4(), ".claude.json");
20799
20839
  },
20840
+ // JSONC is a superset of JSON, so routing through readJsonc / editJsoncFile is
20841
+ // safe for this strict-JSON config and keeps every MCP-entry write on the one
20842
+ // comment- and foreign-server-preserving path (see the Cursor adapter).
20800
20843
  write(configPath, entry) {
20801
- const config = readJson(configPath);
20802
- const servers = config.mcpServers ?? {};
20803
- servers[MCP_SERVER_KEY] = {
20844
+ editJsoncFile(configPath, ["mcpServers", MCP_SERVER_KEY], {
20804
20845
  type: "stdio",
20805
20846
  command: entry.command,
20806
20847
  args: entry.args,
20807
20848
  ...hasEnv(entry) ? { env: entry.env } : {}
20808
- };
20809
- config.mcpServers = servers;
20810
- writeJson(configPath, config);
20849
+ });
20811
20850
  },
20812
20851
  remove(configPath) {
20813
20852
  if (!fs13.existsSync(configPath)) return false;
20814
- const config = readJson(configPath);
20853
+ const config = readJsonc(configPath);
20815
20854
  const servers = config.mcpServers;
20816
20855
  if (!servers?.[MCP_SERVER_KEY]) return false;
20817
- delete servers[MCP_SERVER_KEY];
20818
20856
  if (configPath === this.globalPath()) {
20857
+ delete servers[MCP_SERVER_KEY];
20819
20858
  if (Object.keys(servers).length === 0) delete config.mcpServers;
20820
20859
  writeJson(configPath, config);
20821
20860
  } else {
20822
- writeJsonOrRemove(configPath, config);
20861
+ editJsoncFile(configPath, ["mcpServers", MCP_SERVER_KEY], void 0);
20823
20862
  }
20824
20863
  return true;
20825
20864
  },
20826
20865
  getArgentEntry(configPath) {
20827
20866
  if (!fs13.existsSync(configPath)) return null;
20828
- const config = readJson(configPath);
20867
+ const config = readJsonc(configPath);
20829
20868
  const servers = config.mcpServers;
20830
20869
  return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
20831
20870
  },
@@ -20906,30 +20945,32 @@ var vscodeAdapter = {
20906
20945
  globalPath() {
20907
20946
  return null;
20908
20947
  },
20948
+ // .vscode/mcp.json is JSONC — VS Code allows line/block comments and trailing
20949
+ // commas. The previous JSON.parse → mutate → JSON.stringify path ran through
20950
+ // readJson, whose `catch { return {} }` turned any commented file into {} and
20951
+ // then persisted only { servers: { argent } }, destroying every pre-existing
20952
+ // user server (and their comments). All four entry points now go through
20953
+ // readJsonc / editJsoncFile — path-targeted text edits that preserve comments
20954
+ // and foreign servers — matching the Zed and opencode adapters.
20909
20955
  write(configPath, entry) {
20910
- const config = readJson(configPath);
20911
- const servers = config.servers ?? {};
20912
- servers[MCP_SERVER_KEY] = {
20956
+ editJsoncFile(configPath, ["servers", MCP_SERVER_KEY], {
20913
20957
  type: "stdio",
20914
20958
  command: entry.command,
20915
20959
  args: entry.args,
20916
20960
  ...hasEnv(entry) ? { env: entry.env } : {}
20917
- };
20918
- config.servers = servers;
20919
- writeJson(configPath, config);
20961
+ });
20920
20962
  },
20921
20963
  remove(configPath) {
20922
20964
  if (!fs13.existsSync(configPath)) return false;
20923
- const config = readJson(configPath);
20965
+ const config = readJsonc(configPath);
20924
20966
  const servers = config.servers;
20925
20967
  if (!servers?.[MCP_SERVER_KEY]) return false;
20926
- delete servers[MCP_SERVER_KEY];
20927
- writeJsonOrRemove(configPath, config);
20968
+ editJsoncFile(configPath, ["servers", MCP_SERVER_KEY], void 0);
20928
20969
  return true;
20929
20970
  },
20930
20971
  getArgentEntry(configPath) {
20931
20972
  if (!fs13.existsSync(configPath)) return null;
20932
- const config = readJson(configPath);
20973
+ const config = readJsonc(configPath);
20933
20974
  const servers = config.servers;
20934
20975
  return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
20935
20976
  },
@@ -20987,54 +21028,53 @@ var windsurfAdapter = {
20987
21028
  globalPath() {
20988
21029
  return path13.join(homedir4(), ".codeium", "windsurf", "mcp_config.json");
20989
21030
  },
21031
+ // JSONC-safe MCP-entry writes (see the Cursor adapter): editJsoncFile
21032
+ // preserves comments and pre-existing foreign servers on this JSON config.
20990
21033
  write(configPath, entry) {
20991
- const config = readJson(configPath);
20992
- const servers = config.mcpServers ?? {};
20993
- servers[MCP_SERVER_KEY] = {
21034
+ editJsoncFile(configPath, ["mcpServers", MCP_SERVER_KEY], {
20994
21035
  command: entry.command,
20995
21036
  args: entry.args,
20996
21037
  ...hasEnv(entry) ? { env: entry.env } : {}
20997
- };
20998
- config.mcpServers = servers;
20999
- writeJson(configPath, config);
21038
+ });
21000
21039
  },
21001
21040
  remove(configPath) {
21002
21041
  if (!fs13.existsSync(configPath)) return false;
21003
- const config = readJson(configPath);
21042
+ const config = readJsonc(configPath);
21004
21043
  const servers = config.mcpServers;
21005
21044
  if (!servers?.[MCP_SERVER_KEY]) return false;
21006
- delete servers[MCP_SERVER_KEY];
21007
- writeJsonOrRemove(configPath, config);
21045
+ editJsoncFile(configPath, ["mcpServers", MCP_SERVER_KEY], void 0);
21008
21046
  return true;
21009
21047
  },
21010
21048
  getArgentEntry(configPath) {
21011
21049
  if (!fs13.existsSync(configPath)) return null;
21012
- const config = readJson(configPath);
21050
+ const config = readJsonc(configPath);
21013
21051
  const servers = config.mcpServers;
21014
21052
  return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
21015
21053
  },
21016
21054
  hasArgentEntry(configPath) {
21017
21055
  return this.getArgentEntry(configPath) !== null;
21018
21056
  },
21057
+ // JSONC-safe allowlist edits (see the Cursor adapter): the argent entry lives
21058
+ // in this same mcp_config.json, and `init` runs write() (comment-preserving)
21059
+ // before addAllowlist(). The old readJson path choked on any user comment and
21060
+ // silently skipped the toggle; editJsoncFile targets just the argent entry's
21061
+ // alwaysAllow key so comments and foreign servers survive.
21019
21062
  addAllowlist() {
21020
21063
  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);
21064
+ const config = readJsonc(configPath);
21065
+ const servers = config.mcpServers;
21066
+ if (!servers?.[MCP_SERVER_KEY]) return;
21067
+ editJsoncFile(configPath, ["mcpServers", MCP_SERVER_KEY, "alwaysAllow"], ["*"]);
21027
21068
  },
21028
21069
  removeAllowlist(_root, scope) {
21029
21070
  if (scope !== "global") return;
21030
21071
  const configPath = path13.join(homedir4(), ".codeium", "windsurf", "mcp_config.json");
21031
21072
  if (!fs13.existsSync(configPath)) return;
21032
- const config = readJson(configPath);
21033
- const servers = config.mcpServers ?? {};
21034
- const entry = servers[MCP_SERVER_KEY];
21073
+ const config = readJsonc(configPath);
21074
+ const servers = config.mcpServers;
21075
+ const entry = servers?.[MCP_SERVER_KEY];
21035
21076
  if (!entry?.alwaysAllow) return;
21036
- delete entry.alwaysAllow;
21037
- writeJsonOrRemove(configPath, config);
21077
+ editJsoncFile(configPath, ["mcpServers", MCP_SERVER_KEY, "alwaysAllow"], void 0);
21038
21078
  }
21039
21079
  };
21040
21080
  var zedAdapter = {
@@ -21106,58 +21146,57 @@ var geminiAdapter = {
21106
21146
  globalPath() {
21107
21147
  return path13.join(homedir4(), ".gemini", "settings.json");
21108
21148
  },
21149
+ // JSONC-safe MCP-entry writes (see the Cursor adapter): editJsoncFile
21150
+ // preserves comments and pre-existing foreign servers on this JSON config.
21109
21151
  write(configPath, entry) {
21110
- const config = readJson(configPath);
21111
- const servers = config.mcpServers ?? {};
21112
- servers[MCP_SERVER_KEY] = {
21152
+ editJsoncFile(configPath, ["mcpServers", MCP_SERVER_KEY], {
21113
21153
  command: entry.command,
21114
21154
  args: entry.args,
21115
21155
  ...hasEnv(entry) ? { env: entry.env } : {}
21116
- };
21117
- config.mcpServers = servers;
21118
- writeJson(configPath, config);
21156
+ });
21119
21157
  },
21120
21158
  remove(configPath) {
21121
21159
  if (!fs13.existsSync(configPath)) return false;
21122
- const config = readJson(configPath);
21160
+ const config = readJsonc(configPath);
21123
21161
  const servers = config.mcpServers;
21124
21162
  if (!servers?.[MCP_SERVER_KEY]) return false;
21125
- delete servers[MCP_SERVER_KEY];
21126
- writeJsonOrRemove(configPath, config);
21163
+ editJsoncFile(configPath, ["mcpServers", MCP_SERVER_KEY], void 0);
21127
21164
  return true;
21128
21165
  },
21129
21166
  getArgentEntry(configPath) {
21130
21167
  if (!fs13.existsSync(configPath)) return null;
21131
- const config = readJson(configPath);
21168
+ const config = readJsonc(configPath);
21132
21169
  const servers = config.mcpServers;
21133
21170
  return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
21134
21171
  },
21135
21172
  hasArgentEntry(configPath) {
21136
21173
  return this.getArgentEntry(configPath) !== null;
21137
21174
  },
21175
+ // JSONC-safe allowlist edits (see the Cursor adapter): the argent entry lives
21176
+ // in this same settings.json, and `init` runs write() (comment-preserving)
21177
+ // before addAllowlist(). The old readJson path choked on any user comment and
21178
+ // silently skipped the toggle; editJsoncFile targets just the argent entry's
21179
+ // trust key so comments and foreign servers survive.
21138
21180
  addAllowlist(root, scope) {
21139
21181
  const configPath = scope === "global" ? this.globalPath() : this.projectPath(root);
21140
21182
  if (!configPath) {
21141
21183
  return;
21142
21184
  }
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);
21185
+ const config = readJsonc(configPath);
21186
+ const servers = config.mcpServers;
21187
+ if (!servers?.[MCP_SERVER_KEY]) return;
21188
+ editJsoncFile(configPath, ["mcpServers", MCP_SERVER_KEY, "trust"], true);
21149
21189
  },
21150
21190
  removeAllowlist(root, scope) {
21151
21191
  const configPath = scope === "global" ? this.globalPath() : this.projectPath(root);
21152
21192
  if (!configPath || !fs13.existsSync(configPath)) {
21153
21193
  return;
21154
21194
  }
21155
- const config = readJson(configPath);
21195
+ const config = readJsonc(configPath);
21156
21196
  const servers = config.mcpServers;
21157
21197
  const entry = servers?.[MCP_SERVER_KEY];
21158
21198
  if (!entry?.trust) return;
21159
- delete entry.trust;
21160
- writeJsonOrRemove(configPath, config);
21199
+ editJsoncFile(configPath, ["mcpServers", MCP_SERVER_KEY, "trust"], void 0);
21161
21200
  }
21162
21201
  };
21163
21202
  var CODEX_FILENAME = ".codex";
@@ -21189,6 +21228,7 @@ var codexAdapter = {
21189
21228
  const servers = config.mcp_servers;
21190
21229
  if (!servers?.[MCP_SERVER_KEY]) return false;
21191
21230
  delete servers[MCP_SERVER_KEY];
21231
+ deleteIfEmpty(config, "mcp_servers");
21192
21232
  writeTomlOrRemove(configPath, config);
21193
21233
  return true;
21194
21234
  },
@@ -21373,54 +21413,59 @@ var kiroAdapter = {
21373
21413
  globalPath() {
21374
21414
  return path13.join(homedir4(), ".kiro", "settings", "mcp.json");
21375
21415
  },
21416
+ // Kiro is a VS Code fork: .kiro/settings/mcp.json is JSONC. As with Cursor,
21417
+ // route write/remove/hasArgentEntry through readJsonc / editJsoncFile so
21418
+ // comments and foreign servers survive instead of being flattened away by the
21419
+ // old readJson → writeJson path.
21376
21420
  write(configPath, entry) {
21377
- const config = readJson(configPath);
21378
- const servers = config.mcpServers ?? {};
21379
- servers[MCP_SERVER_KEY] = {
21421
+ editJsoncFile(configPath, ["mcpServers", MCP_SERVER_KEY], {
21380
21422
  command: entry.command,
21381
21423
  args: entry.args,
21382
21424
  ...hasEnv(entry) ? { env: entry.env } : {}
21383
- };
21384
- config.mcpServers = servers;
21385
- writeJson(configPath, config);
21425
+ });
21386
21426
  },
21387
21427
  remove(configPath) {
21388
21428
  if (!fs13.existsSync(configPath)) return false;
21389
- const config = readJson(configPath);
21429
+ const config = readJsonc(configPath);
21390
21430
  const servers = config.mcpServers;
21391
21431
  if (!servers?.[MCP_SERVER_KEY]) return false;
21392
- delete servers[MCP_SERVER_KEY];
21393
- writeJsonOrRemove(configPath, config);
21432
+ editJsoncFile(configPath, ["mcpServers", MCP_SERVER_KEY], void 0);
21394
21433
  return true;
21395
21434
  },
21396
21435
  getArgentEntry(configPath) {
21397
21436
  if (!fs13.existsSync(configPath)) return null;
21398
- const config = readJson(configPath);
21437
+ const config = readJsonc(configPath);
21399
21438
  const servers = config.mcpServers;
21400
21439
  return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
21401
21440
  },
21402
21441
  hasArgentEntry(configPath) {
21403
21442
  return this.getArgentEntry(configPath) !== null;
21404
21443
  },
21444
+ // JSONC-safe allowlist edits (see the Cursor adapter): .kiro/settings/mcp.json
21445
+ // is JSONC, the argent entry lives in it, and `init` runs write() (comment-
21446
+ // preserving) before addAllowlist(). The old readJson path choked on any user
21447
+ // comment and silently skipped the toggle; editJsoncFile targets just the
21448
+ // argent entry's autoApprove key so comments and foreign servers survive.
21405
21449
  addAllowlist(root, scope) {
21406
21450
  const configPath = scope === "global" ? this.globalPath() : this.projectPath(root);
21407
21451
  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);
21452
+ const config = readJsonc(configPath);
21453
+ const servers = config.mcpServers;
21454
+ if (!servers?.[MCP_SERVER_KEY]) return;
21455
+ editJsoncFile(
21456
+ configPath,
21457
+ ["mcpServers", MCP_SERVER_KEY, "autoApprove"],
21458
+ [...KIRO_AUTO_APPROVE_ALL]
21459
+ );
21414
21460
  },
21415
21461
  removeAllowlist(root, scope) {
21416
21462
  const configPath = scope === "global" ? this.globalPath() : this.projectPath(root);
21417
21463
  if (!configPath || !fs13.existsSync(configPath)) return;
21418
- const config = readJson(configPath);
21464
+ const config = readJsonc(configPath);
21419
21465
  const servers = config.mcpServers;
21420
21466
  const entry = servers?.[MCP_SERVER_KEY];
21421
21467
  if (!entry?.autoApprove) return;
21422
- delete entry.autoApprove;
21423
- writeJsonOrRemove(configPath, config);
21468
+ editJsoncFile(configPath, ["mcpServers", MCP_SERVER_KEY, "autoApprove"], void 0);
21424
21469
  }
21425
21470
  };
21426
21471
  var ALL_ADAPTERS = [
@@ -21461,26 +21506,22 @@ function findConfiguredAdapterScopes(adapters, projectRoot) {
21461
21506
  }
21462
21507
  function addClaudePermission(root, scope) {
21463
21508
  const settingsPath = scope === "global" ? path13.join(homedir4(), ".claude", "settings.json") : path13.join(root, ".claude", "settings.json");
21464
- const config = readJson(settingsPath);
21509
+ const config = readJsonc(settingsPath);
21465
21510
  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
- }
21511
+ const allow = Array.isArray(permissions.allow) ? permissions.allow : [];
21512
+ if (allow.includes(PERMISSION_RULE)) return;
21513
+ editJsoncFile(settingsPath, ["permissions", "allow"], [...allow, PERMISSION_RULE]);
21473
21514
  }
21474
21515
  function removeClaudePermission(root, scope) {
21475
21516
  const settingsPath = scope === "global" ? path13.join(homedir4(), ".claude", "settings.json") : path13.join(root, ".claude", "settings.json");
21476
21517
  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);
21518
+ const config = readJsonc(settingsPath);
21519
+ const permissions = config?.permissions;
21520
+ const allow = permissions?.allow;
21521
+ if (!permissions || !Array.isArray(allow)) return;
21522
+ if (!allow.includes(PERMISSION_RULE)) return;
21523
+ const next = allow.filter((rule) => rule !== PERMISSION_RULE);
21524
+ editJsoncFile(settingsPath, ["permissions", "allow"], next.length > 0 ? next : void 0);
21484
21525
  }
21485
21526
  function formatManagedPathLabel(targetPath, root) {
21486
21527
  const home = homedir4();
@@ -21886,7 +21927,7 @@ function execShellCommandSync(cmd, opts = {}) {
21886
21927
  });
21887
21928
  }
21888
21929
  function runShellCommand(cmd, opts = {}) {
21889
- return new Promise((resolve9, reject) => {
21930
+ return new Promise((resolve10, reject) => {
21890
21931
  const child = spawn2(cmd.bin, cmd.args, {
21891
21932
  stdio: ["ignore", "pipe", "pipe"],
21892
21933
  shell: process.platform === "win32",
@@ -21897,7 +21938,7 @@ function runShellCommand(cmd, opts = {}) {
21897
21938
  stderr += chunk.toString();
21898
21939
  });
21899
21940
  child.on("close", (code) => {
21900
- if (code === 0) resolve9();
21941
+ if (code === 0) resolve10();
21901
21942
  else reject(new Error(stderr.trim() || `Command exited with code ${code}`));
21902
21943
  });
21903
21944
  child.on("error", reject);
@@ -22720,7 +22761,7 @@ async function runSkillsStep(args) {
22720
22761
  return skillsMethod;
22721
22762
  }
22722
22763
  function runNpxSkills(args, interactive, cwd) {
22723
- return new Promise((resolve9, reject) => {
22764
+ return new Promise((resolve10, reject) => {
22724
22765
  const npxCmd = process.platform === "win32" ? "npx.cmd" : "npx";
22725
22766
  const child = spawn3(npxCmd, args, {
22726
22767
  stdio: interactive ? "inherit" : ["ignore", "pipe", "pipe"],
@@ -22739,7 +22780,7 @@ function runNpxSkills(args, interactive, cwd) {
22739
22780
  }
22740
22781
  child.on("close", (code) => {
22741
22782
  if (code === 0) {
22742
- resolve9();
22783
+ resolve10();
22743
22784
  } else {
22744
22785
  const output = [stderr, stdout2].filter(Boolean).join("\n").trim();
22745
22786
  reject(new Error(output || `npx skills exited with code ${code}`));
@@ -23032,7 +23073,7 @@ import * as path14 from "node:path";
23032
23073
  import * as readline from "node:readline";
23033
23074
  import { homedir as homedir5 } from "node:os";
23034
23075
  import { spawn as spawn4, execFileSync as execFileSync5 } from "node:child_process";
23035
- import { createHash, randomBytes } from "node:crypto";
23076
+ import { createHash as createHash2, randomBytes } from "node:crypto";
23036
23077
  import { mkdir, writeFile, readFile, readdir, unlink, rename, chmod } from "node:fs/promises";
23037
23078
  var STATE_DIR = path14.join(homedir5(), ".argent");
23038
23079
  var STATE_FILE = path14.join(STATE_DIR, "tool-server.json");
@@ -23047,7 +23088,7 @@ function isProcessAlive(pid) {
23047
23088
  }
23048
23089
  }
23049
23090
  function stateFileForBundle(bundlePath) {
23050
- const key = createHash("sha256").update(bundlePath).digest("hex").slice(0, 12);
23091
+ const key = createHash2("sha256").update(bundlePath).digest("hex").slice(0, 12);
23051
23092
  return path14.join(STATE_DIR, `tool-server-${key}.json`);
23052
23093
  }
23053
23094
  async function readStateFile(file) {
@@ -23192,20 +23233,28 @@ var LINK_DIR = path15.join(homedir6(), ".argent");
23192
23233
  var LINK_FILE = path15.join(LINK_DIR, "link.json");
23193
23234
 
23194
23235
  // ../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";
23236
+ import { createHash as createHash3, randomUUID as randomUUID6 } from "node:crypto";
23237
+ import { createReadStream as createReadStream2 } from "node:fs";
23238
+ import { mkdir as mkdir3, readFile as readFile3, rm as rm2, stat as stat2, writeFile as writeFile3 } from "node:fs/promises";
23239
+ import { tmpdir } from "node:os";
23197
23240
  import * as path16 from "node:path";
23198
- var MAX_CONTENT_BYTES = 32 * 1024 * 1024;
23199
23241
 
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";
23242
+ // ../archive/src/index.ts
23205
23243
  import { execFile } from "node:child_process";
23244
+ import { rm, readdir as readdir2 } from "node:fs/promises";
23245
+ import { basename as basename2, dirname as dirname11, join as join17, posix as posix2, resolve as resolve8, sep as sep5 } from "node:path";
23206
23246
  import { promisify } from "node:util";
23207
23247
  var execFileAsync = promisify(execFile);
23208
23248
 
23249
+ // ../argent-tools-client/src/file-inputs.ts
23250
+ var MAX_CONTENT_BYTES = 32 * 1024 * 1024;
23251
+
23252
+ // ../argent-tools-client/src/artifacts.ts
23253
+ import { mkdir as mkdir4, readFile as readFile4, rm as rm3, stat as stat3, writeFile as writeFile4 } from "node:fs/promises";
23254
+ import { tmpdir as tmpdir2 } from "node:os";
23255
+ import { basename as basename4, join as join19 } from "node:path";
23256
+ import { createHash as createHash4 } from "node:crypto";
23257
+
23209
23258
  // ../argent-installer/src/update.ts
23210
23259
  function getRequestedVersion(args) {
23211
23260
  for (let i2 = 0; i2 < args.length; i2 += 1) {