@funnycode/myclaude 0.1.165 → 0.1.167

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/myclaude.mjs CHANGED
@@ -4,8 +4,8 @@
4
4
  // MACRO - build-time constants (injected by build.ts)
5
5
  // MACRO injected by build script
6
6
  globalThis.MACRO = {
7
- VERSION: "0.1.165",
8
- BUILD_TIME: "2026-07-31T00:20:09.749Z",
7
+ VERSION: "0.1.167",
8
+ BUILD_TIME: "2026-07-31T15:47:37.502Z",
9
9
  PACKAGE_URL: "@funnycode/myclaude",
10
10
  NATIVE_PACKAGE_URL: "@funnycode/myclaude",
11
11
  VERSION_CHANGELOG: '',
@@ -61328,30 +61328,6 @@ function updateSettingsForSource(source, settings) {
61328
61328
  }
61329
61329
  return { error: null };
61330
61330
  }
61331
- function deleteSettingsField(source, field) {
61332
- if (source === "policySettings" || source === "flagSettings") {
61333
- return { error: null };
61334
- }
61335
- const filePath = getSettingsFilePathForSource(source);
61336
- if (!filePath) {
61337
- return { error: null };
61338
- }
61339
- try {
61340
- getFsImplementation().mkdirSync(dirname13(filePath));
61341
- let existingSettings = getSettingsForSourceUncached(source);
61342
- if (!existingSettings) {
61343
- return { error: null };
61344
- }
61345
- delete existingSettings[field];
61346
- writeFileSyncAndFlush_DEPRECATED(filePath, jsonStringify(existingSettings));
61347
- resetSettingsCache();
61348
- return { error: null };
61349
- } catch (e) {
61350
- const error49 = new Error(`Failed to delete field ${field} from settings source ${source}: ${e}`);
61351
- logError2(error49);
61352
- return { error: error49 };
61353
- }
61354
- }
61355
61331
  function mergeArrays(targetArray, sourceArray) {
61356
61332
  return uniq([...targetArray, ...sourceArray]);
61357
61333
  }
@@ -101034,12 +101010,18 @@ var require_protocols2 = __commonJS((exports) => {
101034
101010
  const reviver = needsReviver(schema) ? jsonReviver : undefined;
101035
101011
  let parsed;
101036
101012
  if (typeof data === "string") {
101013
+ if (data.length === 0) {
101014
+ return {};
101015
+ }
101037
101016
  parsed = JSON.parse(data, reviver);
101038
101017
  } else if (data instanceof Uint8Array && detectBufferParsing()) {
101018
+ if (data.byteLength === 0) {
101019
+ return {};
101020
+ }
101039
101021
  const buf = Buffer.isBuffer(data) ? data : Buffer.from(data.buffer, data.byteOffset, data.byteLength);
101040
101022
  parsed = JSON.parse(buf, reviver);
101041
101023
  } else {
101042
- parsed = await parseJsonBody(data, this.serdeContext);
101024
+ parsed = await parseJsonBody(data, this.serdeContext, schema);
101043
101025
  }
101044
101026
  return this._read(schema, parsed);
101045
101027
  }
@@ -101055,19 +101037,23 @@ var require_protocols2 = __commonJS((exports) => {
101055
101037
  }
101056
101038
  if (Array.isArray(value) && ns.isListSchema()) {
101057
101039
  const listMember = ns.getValueSchema();
101058
- for (let i2 = 0;i2 < value.length; ++i2) {
101059
- value[i2] = this._read(listMember, value[i2]);
101040
+ if (this.needsTransform(listMember)) {
101041
+ for (let i2 = 0;i2 < value.length; ++i2) {
101042
+ value[i2] = this._read(listMember, value[i2]);
101043
+ }
101060
101044
  }
101061
101045
  return value;
101062
101046
  }
101063
101047
  if (ns.isMapSchema()) {
101064
101048
  const mapMember = ns.getValueSchema();
101065
101049
  const map2 = value;
101066
- for (const k in map2) {
101067
- if (k === "__proto__") {
101068
- writeKey(map2);
101050
+ if (this.needsTransform(mapMember)) {
101051
+ for (const k in map2) {
101052
+ if (k === "__proto__") {
101053
+ writeKey(map2);
101054
+ }
101055
+ map2[k] = this._read(mapMember, map2[k]);
101069
101056
  }
101070
- map2[k] = this._read(mapMember, map2[k]);
101071
101057
  }
101072
101058
  return map2;
101073
101059
  }
@@ -101142,9 +101128,6 @@ var require_protocols2 = __commonJS((exports) => {
101142
101128
  }
101143
101129
  }
101144
101130
  }
101145
- return value;
101146
- } else {
101147
- return value;
101148
101131
  }
101149
101132
  }
101150
101133
  return value;
@@ -101152,9 +101135,10 @@ var require_protocols2 = __commonJS((exports) => {
101152
101135
  _readStruct(ns, record2) {
101153
101136
  const union2 = ns.isUnionSchema();
101154
101137
  const out = {};
101155
- let nameMap = undefined;
101138
+ let nameMap;
101139
+ const hasType = typeof record2.__type === "string";
101156
101140
  const { jsonName } = this.settings;
101157
- if (jsonName) {
101141
+ if (jsonName && hasType) {
101158
101142
  nameMap = {};
101159
101143
  }
101160
101144
  let unionSerde;
@@ -101165,7 +101149,9 @@ var require_protocols2 = __commonJS((exports) => {
101165
101149
  let fromKey = memberName;
101166
101150
  if (jsonName) {
101167
101151
  fromKey = memberSchema.getMergedTraits().jsonName ?? fromKey;
101168
- nameMap[fromKey] = memberName;
101152
+ if (hasType) {
101153
+ nameMap[fromKey] = memberName;
101154
+ }
101169
101155
  }
101170
101156
  if (union2) {
101171
101157
  unionSerde.mark(fromKey);
@@ -101176,7 +101162,7 @@ var require_protocols2 = __commonJS((exports) => {
101176
101162
  }
101177
101163
  if (union2) {
101178
101164
  unionSerde.writeUnknown();
101179
- } else if (typeof record2.__type === "string") {
101165
+ } else if (hasType) {
101180
101166
  for (const k in record2) {
101181
101167
  const v = record2[k];
101182
101168
  const t = jsonName ? nameMap[k] ?? k : k;
@@ -101187,7 +101173,121 @@ var require_protocols2 = __commonJS((exports) => {
101187
101173
  }
101188
101174
  return out;
101189
101175
  }
101176
+ needsTransform(ns) {
101177
+ if (ns.isBlobSchema() || ns.isTimestampSchema() || ns.isBigIntegerSchema() || ns.isBigDecimalSchema()) {
101178
+ return true;
101179
+ }
101180
+ if (ns.isDocumentSchema() || ns.isStructSchema() || ns.isListSchema() || ns.isMapSchema()) {
101181
+ return true;
101182
+ }
101183
+ if (ns.isStringSchema() && ns.getMergedTraits().mediaType) {
101184
+ return true;
101185
+ }
101186
+ return false;
101187
+ }
101190
101188
  }
101189
+
101190
+ class JsonBytesStringAdapter extends Uint8Array {
101191
+ string = null;
101192
+ static allocUnsafe(bytes) {
101193
+ if (typeof Buffer === "function") {
101194
+ const buffer = Buffer.allocUnsafe(bytes);
101195
+ return new JsonBytesStringAdapter(buffer.buffer, buffer.byteOffset, buffer.byteLength);
101196
+ }
101197
+ return new JsonBytesStringAdapter(bytes);
101198
+ }
101199
+ toString() {
101200
+ return this.s();
101201
+ }
101202
+ valueOf() {
101203
+ return this.s();
101204
+ }
101205
+ includes(searchString, position) {
101206
+ if (typeof searchString === "string") {
101207
+ return this.s().includes(searchString, position);
101208
+ }
101209
+ return Uint8Array.prototype.includes.call(this, searchString, position);
101210
+ }
101211
+ indexOf(searchString, position) {
101212
+ if (typeof searchString === "string") {
101213
+ return this.s().indexOf(searchString, position);
101214
+ }
101215
+ return Uint8Array.prototype.indexOf.call(this, searchString, position);
101216
+ }
101217
+ lastIndexOf(searchString, position) {
101218
+ if (typeof searchString === "string") {
101219
+ return this.s().lastIndexOf(searchString, position);
101220
+ }
101221
+ const fn = Uint8Array.prototype.lastIndexOf;
101222
+ if (position !== undefined) {
101223
+ return fn.call(this, searchString, position);
101224
+ }
101225
+ return fn.call(this, searchString);
101226
+ }
101227
+ startsWith(searchString, position) {
101228
+ return this.s().startsWith(searchString, position);
101229
+ }
101230
+ endsWith(searchString, endPosition) {
101231
+ return this.s().endsWith(searchString, endPosition);
101232
+ }
101233
+ match(regexp) {
101234
+ return this.s().match(regexp);
101235
+ }
101236
+ replace(searchValue, replaceValue) {
101237
+ return this.s().replace(searchValue, replaceValue);
101238
+ }
101239
+ search(regexp) {
101240
+ return this.s().search(regexp);
101241
+ }
101242
+ split(separator, limit2) {
101243
+ return this.s().split(separator, limit2);
101244
+ }
101245
+ substring(start, end) {
101246
+ return this.s().substring(start, end);
101247
+ }
101248
+ trim() {
101249
+ return this.s().trim();
101250
+ }
101251
+ trimStart() {
101252
+ return this.s().trimStart();
101253
+ }
101254
+ trimEnd() {
101255
+ return this.s().trimEnd();
101256
+ }
101257
+ charAt(pos) {
101258
+ return this.s().charAt(pos);
101259
+ }
101260
+ charCodeAt(index) {
101261
+ return this.s().charCodeAt(index);
101262
+ }
101263
+ padStart(maxLength, fillString) {
101264
+ return this.s().padStart(maxLength, fillString);
101265
+ }
101266
+ padEnd(maxLength, fillString) {
101267
+ return this.s().padEnd(maxLength, fillString);
101268
+ }
101269
+ repeat(count3) {
101270
+ return this.s().repeat(count3);
101271
+ }
101272
+ toUpperCase() {
101273
+ return this.s().toUpperCase();
101274
+ }
101275
+ toLowerCase() {
101276
+ return this.s().toLowerCase();
101277
+ }
101278
+ s() {
101279
+ if (this.string == null) {
101280
+ const n2 = Date.now();
101281
+ if (n2 > warned + 60000) {
101282
+ console.warn("@aws-sdk/core/protocols - WARN - JsonCodec2: you have called a string method on a Uint8Array request body. " + "It has been automatically converted to string. In a future version this will throw an error.");
101283
+ warned = n2;
101284
+ }
101285
+ this.string = toUtf8(this);
101286
+ }
101287
+ return this.string;
101288
+ }
101289
+ }
101290
+ var warned = 0;
101191
101291
  var encoder2 = new TextEncoder;
101192
101292
  var OPEN_BRACE = 123;
101193
101293
  var CLOSE_BRACE = 125;
@@ -101215,7 +101315,7 @@ var require_protocols2 = __commonJS((exports) => {
101215
101315
  }
101216
101316
  var INITIAL_BUFFER_SIZE = 2048;
101217
101317
  function alloc(size) {
101218
- return typeof Buffer !== "undefined" ? Buffer.allocUnsafe(size) : new Uint8Array(size);
101318
+ return JsonBytesStringAdapter.allocUnsafe(size);
101219
101319
  }
101220
101320
 
101221
101321
  class JsonShapeSerializer2 extends SerdeContextConfig {
@@ -101234,7 +101334,7 @@ var require_protocols2 = __commonJS((exports) => {
101234
101334
  this.i = 0;
101235
101335
  this.rawValue = value;
101236
101336
  this.rootSchema = NormalizedSchema.of(schema);
101237
- this.passthrough = !this.rootSchema.isStructSchema() && !this.rootSchema.isDocumentSchema() && (this.rootSchema.isBlobSchema() || this.rootSchema.isStringSchema());
101337
+ this.passthrough = this.rootSchema.isBlobSchema() || this.rootSchema.isStringSchema();
101238
101338
  if (!this.passthrough) {
101239
101339
  this.writeValue(this.rootSchema, value, undefined);
101240
101340
  }
@@ -101244,30 +101344,13 @@ var require_protocols2 = __commonJS((exports) => {
101244
101344
  this.rootSchema = NormalizedSchema.of(schema);
101245
101345
  const ns = this.rootSchema;
101246
101346
  if (ns.isStructSchema() && value != null && typeof value === "object") {
101247
- this.ensure(2);
101248
- this.json[this.i++] = OPEN_BRACE;
101249
- this.writeAsciiQuoted("__type");
101250
- this.json[this.i++] = COLON;
101251
- this.writeAsciiQuoted(ns.getName(true) ?? "Unknown");
101252
- let wroteAny = true;
101253
- const { jsonName } = this.settings;
101254
- for (const [memberName, memberSchema] of ns.structIterator()) {
101255
- const item = value[memberName];
101256
- if (item == null && !memberSchema.isIdempotencyToken()) {
101257
- continue;
101258
- }
101259
- if (wroteAny) {
101260
- this.ensure(1);
101261
- this.json[this.i++] = COMMA;
101262
- }
101263
- const targetKey = jsonName ? memberSchema.getMergedTraits().jsonName ?? memberName : memberName;
101264
- this.writeAsciiQuoted(targetKey);
101265
- this.json[this.i++] = COLON;
101266
- this.writeValue(memberSchema, item, ns);
101267
- wroteAny = true;
101268
- }
101269
- this.ensure(1);
101270
- this.json[this.i++] = CLOSE_BRACE;
101347
+ this.writeValue(ns, value, undefined);
101348
+ const prefix = `"__type":"${ns.getName(true) ?? "Unknown"}",`;
101349
+ const z3 = prefix.length;
101350
+ this.ensure(z3);
101351
+ this.json.copyWithin(1 + z3, 1, this.i);
101352
+ encoder2.encodeInto(prefix, this.json.subarray(1));
101353
+ this.i += z3;
101271
101354
  } else {
101272
101355
  this.writeValue(ns, value, undefined);
101273
101356
  }
@@ -101319,7 +101402,7 @@ var require_protocols2 = __commonJS((exports) => {
101319
101402
  this.i = i2;
101320
101403
  }
101321
101404
  writeJsonString(s) {
101322
- this.ensure(s.length * 2 + 2);
101405
+ this.ensure(s.length * 3 + 2);
101323
101406
  this.json[this.i++] = QUOTE;
101324
101407
  const z3 = s.length;
101325
101408
  for (let j = 0;j < z3; ++j) {
@@ -101343,7 +101426,7 @@ var require_protocols2 = __commonJS((exports) => {
101343
101426
  this.ensure(4);
101344
101427
  const { written } = encoder2.encodeInto(s.substring(j, j + 2), this.json.subarray(this.i));
101345
101428
  this.i += written;
101346
- j++;
101429
+ ++j;
101347
101430
  } else {
101348
101431
  this.ensure(6);
101349
101432
  this.writeUnicodeEscape(c5);
@@ -101379,8 +101462,9 @@ var require_protocols2 = __commonJS((exports) => {
101379
101462
  static B64 = (() => {
101380
101463
  const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
101381
101464
  const table = new Uint8Array(64);
101382
- for (let i2 = 0;i2 < 64; i2++)
101465
+ for (let i2 = 0;i2 < 64; ++i2) {
101383
101466
  table[i2] = chars.charCodeAt(i2);
101467
+ }
101384
101468
  return table;
101385
101469
  })();
101386
101470
  writeBase64(data) {
@@ -101505,13 +101589,15 @@ var require_protocols2 = __commonJS((exports) => {
101505
101589
  }
101506
101590
  if (typeof value === "boolean") {
101507
101591
  this.ensure(5);
101592
+ let { i: i2, json: json2 } = this;
101508
101593
  if (value) {
101509
- this.json.set(TRUE, this.i);
101510
- this.i += 4;
101594
+ json2.set(TRUE, i2);
101595
+ i2 += 4;
101511
101596
  } else {
101512
- this.json.set(FALSE, this.i);
101513
- this.i += 5;
101597
+ json2.set(FALSE, i2);
101598
+ i2 += 5;
101514
101599
  }
101600
+ this.i = i2;
101515
101601
  return;
101516
101602
  }
101517
101603
  if (typeof value === "bigint") {
@@ -101523,7 +101609,6 @@ var require_protocols2 = __commonJS((exports) => {
101523
101609
  writeStruct(ns, value) {
101524
101610
  this.ensure(2);
101525
101611
  this.json[this.i++] = OPEN_BRACE;
101526
- let first = true;
101527
101612
  let wroteAny = false;
101528
101613
  const hasType = typeof value.__type === "string";
101529
101614
  let writtenKeys;
@@ -101532,13 +101617,13 @@ var require_protocols2 = __commonJS((exports) => {
101532
101617
  }
101533
101618
  for (const [memberName, memberSchema] of ns.structIterator()) {
101534
101619
  const item = value[memberName];
101535
- if (item == null && !memberSchema.isIdempotencyToken())
101620
+ if (item == null && !memberSchema.isIdempotencyToken()) {
101536
101621
  continue;
101537
- if (!first) {
101622
+ }
101623
+ if (wroteAny) {
101538
101624
  this.ensure(1);
101539
101625
  this.json[this.i++] = COMMA;
101540
101626
  }
101541
- first = false;
101542
101627
  wroteAny = true;
101543
101628
  const targetKey = this.settings.jsonName ? memberSchema.getMergedTraits().jsonName ?? memberName : memberName;
101544
101629
  if (writtenKeys) {
@@ -101560,17 +101645,17 @@ var require_protocols2 = __commonJS((exports) => {
101560
101645
  }
101561
101646
  } else if (hasType) {
101562
101647
  for (const k in value) {
101563
- const targetKey = this.settings.jsonName ? writtenKeys.has(k) ? k : k : k;
101564
- if (writtenKeys.has(targetKey))
101648
+ if (writtenKeys.has(k)) {
101565
101649
  continue;
101566
- writtenKeys.add(targetKey);
101650
+ }
101651
+ writtenKeys.add(k);
101567
101652
  const v = value[k];
101568
- if (!first) {
101653
+ if (wroteAny) {
101569
101654
  this.ensure(1);
101570
101655
  this.json[this.i++] = COMMA;
101571
101656
  }
101572
- first = false;
101573
- this.writeAsciiQuoted(targetKey);
101657
+ wroteAny = true;
101658
+ this.writeAsciiQuoted(k);
101574
101659
  this.ensure(1);
101575
101660
  this.json[this.i++] = COLON;
101576
101661
  this.writeValue(15, v, undefined);
@@ -101580,20 +101665,30 @@ var require_protocols2 = __commonJS((exports) => {
101580
101665
  this.json[this.i++] = CLOSE_BRACE;
101581
101666
  }
101582
101667
  writeList(ns, value, isDocument) {
101583
- this.ensure(2);
101584
- this.json[this.i++] = OPEN_BRACKET;
101585
101668
  const sparse = !!ns.getMergedTraits().sparse;
101586
101669
  const valueSchema = ns.getValueSchema();
101670
+ if (!isDocument) {
101671
+ if (valueSchema.isStringSchema() || valueSchema.isNumericSchema() || valueSchema.isBooleanSchema()) {
101672
+ const json2 = sparse ? JSON.stringify(value) : JSON.stringify(value.filter((_) => _ != null));
101673
+ this.ensure(json2.length * 3);
101674
+ this.i += encoder2.encodeInto(json2, this.json.subarray(this.i)).written;
101675
+ return;
101676
+ }
101677
+ }
101678
+ this.ensure(2);
101679
+ this.json[this.i++] = OPEN_BRACKET;
101680
+ let wroteFirstItem = false;
101587
101681
  for (let i2 = 0;i2 < value.length; ++i2) {
101588
101682
  const item = value[i2];
101589
101683
  if (isDocument ? item === undefined : item == null && !sparse) {
101590
101684
  continue;
101591
101685
  }
101592
- if (i2 !== 0) {
101686
+ if (wroteFirstItem) {
101593
101687
  this.ensure(1);
101594
101688
  this.json[this.i++] = COMMA;
101595
101689
  }
101596
101690
  this.writeValue(valueSchema, item, undefined);
101691
+ wroteFirstItem = true;
101597
101692
  }
101598
101693
  this.ensure(1);
101599
101694
  this.json[this.i++] = CLOSE_BRACKET;
@@ -101615,8 +101710,7 @@ var require_protocols2 = __commonJS((exports) => {
101615
101710
  }
101616
101711
  const json2 = JSON.stringify(input);
101617
101712
  this.ensure(json2.length * 3);
101618
- const { written } = encoder2.encodeInto(json2, this.json.subarray(this.i));
101619
- this.i += written;
101713
+ this.i += encoder2.encodeInto(json2, this.json.subarray(this.i)).written;
101620
101714
  return;
101621
101715
  }
101622
101716
  }
@@ -102728,7 +102822,7 @@ var require_sso_oidc = __commonJS((exports) => {
102728
102822
  Region: { type: "builtInParams", name: "region" },
102729
102823
  UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" }
102730
102824
  };
102731
- var version2 = "3.997.37";
102825
+ var version2 = "3.997.38";
102732
102826
  var packageInfo = {
102733
102827
  version: version2
102734
102828
  };
@@ -103625,7 +103719,7 @@ var require_sso = __commonJS((exports) => {
103625
103719
  Region: { type: "builtInParams", name: "region" },
103626
103720
  UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" }
103627
103721
  };
103628
- var version2 = "3.997.37";
103722
+ var version2 = "3.997.38";
103629
103723
  var packageInfo = {
103630
103724
  version: version2
103631
103725
  };
@@ -104719,7 +104813,7 @@ var require_sts = __commonJS((exports) => {
104719
104813
  Region: { type: "builtInParams", name: "region" },
104720
104814
  UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" }
104721
104815
  };
104722
- var version2 = "3.997.37";
104816
+ var version2 = "3.997.38";
104723
104817
  var packageInfo = {
104724
104818
  version: version2
104725
104819
  };
@@ -105488,7 +105582,7 @@ var require_signin = __commonJS((exports) => {
105488
105582
  Region: { type: "builtInParams", name: "region" },
105489
105583
  UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" }
105490
105584
  };
105491
- var version2 = "3.997.37";
105585
+ var version2 = "3.997.38";
105492
105586
  var packageInfo = {
105493
105587
  version: version2
105494
105588
  };
@@ -119853,7 +119947,7 @@ var package_default;
119853
119947
  var init_package = __esm(() => {
119854
119948
  package_default = {
119855
119949
  name: "@funnycode/myclaude",
119856
- version: "0.1.165",
119950
+ version: "0.1.167",
119857
119951
  private: false,
119858
119952
  description: "An open-source AI coding assistant in your terminal - powered by Claude",
119859
119953
  license: "MIT",
@@ -275643,7 +275737,12 @@ var require_fast_uri = __commonJS((exports, module) => {
275643
275737
  }
275644
275738
  function resolve26(baseURI, relativeURI, options) {
275645
275739
  const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
275646
- const resolved = resolveComponent(parse9(baseURI, schemelessOptions), parse9(relativeURI, schemelessOptions), schemelessOptions, true);
275740
+ const { parsed: baseParsed, malformedAuthorityOrPort: baseMalformed } = parseWithStatus(baseURI, schemelessOptions);
275741
+ const { parsed: relativeParsed, malformedAuthorityOrPort: relativeMalformed } = parseWithStatus(relativeURI, schemelessOptions);
275742
+ if (baseMalformed || relativeMalformed) {
275743
+ throw new Error(baseParsed.error || relativeParsed.error || "URI is malformed.");
275744
+ }
275745
+ const resolved = resolveComponent(baseParsed, relativeParsed, schemelessOptions, true);
275647
275746
  schemelessOptions.skipEscape = true;
275648
275747
  return serialize2(resolved, schemelessOptions);
275649
275748
  }
@@ -275770,6 +275869,7 @@ var require_fast_uri = __commonJS((exports, module) => {
275770
275869
  }
275771
275870
  var URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
275772
275871
  var AUTHORITY_PREFIX = /^(?:[^#/:?]+:)?\/\/([^/?#]*)/;
275872
+ var AUTHORITY_INTRODUCER_REGION = /^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;
275773
275873
  function getParseError2(parsed, matches) {
275774
275874
  if (matches[2] !== undefined && parsed.path && parsed.path[0] !== "/") {
275775
275875
  return 'URI path must start with "/" when authority is present.';
@@ -275804,6 +275904,20 @@ var require_fast_uri = __commonJS((exports, module) => {
275804
275904
  parsed.error = "URI authority must not contain a literal backslash.";
275805
275905
  malformedAuthorityOrPort = true;
275806
275906
  }
275907
+ const introducerMatch = uri.match(AUTHORITY_INTRODUCER_REGION);
275908
+ if (introducerMatch !== null) {
275909
+ const region = introducerMatch[1];
275910
+ const normalizedRegion = region.replace(/[\t\n\r]/g, "");
275911
+ if (normalizedRegion.length >= 2) {
275912
+ if (normalizedRegion.slice(0, 2) !== "//") {
275913
+ parsed.error = parsed.error || "URI authority must not contain a literal backslash.";
275914
+ malformedAuthorityOrPort = true;
275915
+ } else if (region.length !== normalizedRegion.length) {
275916
+ parsed.error = parsed.error || "URI authority introducer must not contain whitespace.";
275917
+ malformedAuthorityOrPort = true;
275918
+ }
275919
+ }
275920
+ }
275807
275921
  const matches = uri.match(URI_PARSE);
275808
275922
  if (matches) {
275809
275923
  parsed.scheme = matches[1];
@@ -410037,20 +410151,32 @@ function isInputModeCharacter(input) {
410037
410151
  import { join as join105 } from "path";
410038
410152
  function getDirectoryFingerprint(dirPath) {
410039
410153
  const fs13 = getFsImplementation();
410040
- const entries = fs13.readdirStringSync(dirPath);
410154
+ let entries;
410155
+ try {
410156
+ entries = fs13.readdirStringSync(dirPath);
410157
+ } catch {
410158
+ return "";
410159
+ }
410041
410160
  const sortedEntries = entries.sort();
410042
410161
  const fingerprintParts = [];
410043
410162
  for (const entry of sortedEntries) {
410044
410163
  const fullPath = join105(dirPath, entry);
410045
- const stat37 = fs13.statSync(fullPath);
410046
- if (stat37.isDirectory()) {
410047
- if (entry === "node_modules" || entry === ".git" || entry === "dist" || entry === "build" || entry === ".next" || entry === "out" || entry === "coverage") {
410164
+ try {
410165
+ const lstat7 = fs13.lstatSync(fullPath);
410166
+ if (lstat7.isSymbolicLink()) {
410048
410167
  continue;
410049
410168
  }
410050
- fingerprintParts.push(entry + "/");
410051
- fingerprintParts.push(getDirectoryFingerprint(fullPath));
410052
- } else {
410053
- fingerprintParts.push(entry);
410169
+ if (lstat7.isDirectory()) {
410170
+ if (entry === "node_modules" || entry === ".git" || entry === "dist" || entry === "build" || entry === ".next" || entry === "out" || entry === "coverage") {
410171
+ continue;
410172
+ }
410173
+ fingerprintParts.push(entry + "/");
410174
+ fingerprintParts.push(getDirectoryFingerprint(fullPath));
410175
+ } else {
410176
+ fingerprintParts.push(entry);
410177
+ }
410178
+ } catch {
410179
+ continue;
410054
410180
  }
410055
410181
  }
410056
410182
  return fingerprintParts.join(`
@@ -410060,6 +410186,7 @@ function clearCachedSteps() {
410060
410186
  cachedSteps = null;
410061
410187
  cachedClaudeMdMtime = -1;
410062
410188
  cachedDirFingerprint = "";
410189
+ cachedRootMtime = -1;
410063
410190
  cachedAt = null;
410064
410191
  }
410065
410192
  function isCacheValid() {
@@ -410076,9 +410203,10 @@ function isCacheValid() {
410076
410203
  return false;
410077
410204
  }
410078
410205
  try {
410079
- const currentFingerprint = getDirectoryFingerprint(cwd2);
410080
- if (currentFingerprint !== cachedDirFingerprint)
410206
+ const currentRootMtime = Math.floor(fs13.statSync(cwd2).mtimeMs);
410207
+ if (currentRootMtime !== cachedRootMtime) {
410081
410208
  return false;
410209
+ }
410082
410210
  } catch {
410083
410211
  return false;
410084
410212
  }
@@ -410101,6 +410229,11 @@ function getSteps() {
410101
410229
  } catch {
410102
410230
  cachedClaudeMdMtime = -1;
410103
410231
  }
410232
+ try {
410233
+ cachedRootMtime = Math.floor(fs13.statSync(cwd2).mtimeMs);
410234
+ } catch {
410235
+ cachedRootMtime = -1;
410236
+ }
410104
410237
  try {
410105
410238
  cachedDirFingerprint = getDirectoryFingerprint(cwd2);
410106
410239
  } catch {
@@ -410152,7 +410285,7 @@ function incrementProjectOnboardingSeenCount() {
410152
410285
  projectOnboardingSeenCount: current.projectOnboardingSeenCount + 1
410153
410286
  }));
410154
410287
  }
410155
- var cachedSteps = null, cachedClaudeMdMtime = -1, cachedDirFingerprint = "", cachedAt = null, CACHE_MAX_AGE_MS = 300000;
410288
+ var cachedSteps = null, cachedClaudeMdMtime = -1, cachedDirFingerprint = "", cachedRootMtime = -1, cachedAt = null, CACHE_MAX_AGE_MS = 300000;
410156
410289
  var init_projectOnboardingState = __esm(() => {
410157
410290
  init_config();
410158
410291
  init_cwd2();
@@ -566425,125 +566558,71 @@ function migrateEnableAllProjectMcpServersToSettings() {
566425
566558
  saveGlobalConfig((c6) => ({ ...c6, hasCompletedMcpServerMigration: true }));
566426
566559
  return;
566427
566560
  }
566428
- const originalSettings = getSettingsForSource("localSettings") || {};
566429
- const originalProjectConfig = { ...projectConfig };
566430
- const originalSettingsHash = JSON.stringify(originalSettings);
566431
- const migratedFields = [];
566432
566561
  const updates = {};
566433
- try {
566434
- const existingSettings = originalSettings;
566435
- if (hasEnableAll) {
566436
- updates.enableAllProjectMcpServers = projectConfig.enableAllProjectMcpServers;
566437
- migratedFields.push("enableAllProjectMcpServers");
566438
- }
566439
- const existingEnabledServers = Array.isArray(existingSettings.enabledMcpjsonServers) ? [...existingSettings.enabledMcpjsonServers] : [];
566440
- const existingDisabledServers = Array.isArray(existingSettings.disabledMcpjsonServers) ? [...existingSettings.disabledMcpjsonServers] : [];
566441
- if (hasEnabledServers) {
566442
- if (Array.isArray(projectConfig.enabledMcpjsonServers) && projectConfig.enabledMcpjsonServers.length > 0) {
566443
- const seen = new Set(existingEnabledServers);
566444
- for (const server of projectConfig.enabledMcpjsonServers) {
566445
- if (!seen.has(server)) {
566446
- existingEnabledServers.push(server);
566447
- seen.add(server);
566448
- }
566562
+ const existingSettings = getSettingsForSource("localSettings") || {};
566563
+ if (hasEnableAll) {
566564
+ updates.enableAllProjectMcpServers = projectConfig.enableAllProjectMcpServers;
566565
+ }
566566
+ const existingEnabledServers = Array.isArray(existingSettings.enabledMcpjsonServers) ? [...existingSettings.enabledMcpjsonServers] : [];
566567
+ const existingDisabledServers = Array.isArray(existingSettings.disabledMcpjsonServers) ? [...existingSettings.disabledMcpjsonServers] : [];
566568
+ if (hasEnabledServers) {
566569
+ if (Array.isArray(projectConfig.enabledMcpjsonServers) && projectConfig.enabledMcpjsonServers.length > 0) {
566570
+ const seen = new Set(existingEnabledServers);
566571
+ for (const server of projectConfig.enabledMcpjsonServers) {
566572
+ if (!seen.has(server)) {
566573
+ existingEnabledServers.push(server);
566574
+ seen.add(server);
566449
566575
  }
566450
566576
  }
566451
- migratedFields.push("enabledMcpjsonServers");
566452
566577
  }
566453
- if (hasDisabledServers) {
566454
- if (Array.isArray(projectConfig.disabledMcpjsonServers) && projectConfig.disabledMcpjsonServers.length > 0) {
566455
- const seen = new Set(existingDisabledServers);
566456
- for (const server of projectConfig.disabledMcpjsonServers) {
566457
- if (!seen.has(server)) {
566458
- existingDisabledServers.push(server);
566459
- seen.add(server);
566460
- }
566578
+ }
566579
+ if (hasDisabledServers) {
566580
+ if (Array.isArray(projectConfig.disabledMcpjsonServers) && projectConfig.disabledMcpjsonServers.length > 0) {
566581
+ const seen = new Set(existingDisabledServers);
566582
+ for (const server of projectConfig.disabledMcpjsonServers) {
566583
+ if (!seen.has(server)) {
566584
+ existingDisabledServers.push(server);
566585
+ seen.add(server);
566461
566586
  }
566462
566587
  }
566463
- migratedFields.push("disabledMcpjsonServers");
566464
566588
  }
566465
- const enabledSet = new Set(existingEnabledServers);
566466
- const overlappingServers = existingDisabledServers.filter((server) => enabledSet.has(server));
566467
- for (const server of overlappingServers) {
566468
- const index = existingDisabledServers.indexOf(server);
566469
- if (index !== -1) {
566470
- existingDisabledServers.splice(index, 1);
566471
- }
566472
- }
566473
- if (overlappingServers.length > 0) {
566474
- logEvent("tengu_migrate_mcp_server_overlap_in_both_lists", {
566475
- overlappingServers: overlappingServers.join(",")
566476
- });
566477
- }
566478
- const existingHadEnabledServers = Array.isArray(existingSettings.enabledMcpjsonServers);
566479
- const existingHadDisabledServers = Array.isArray(existingSettings.disabledMcpjsonServers);
566480
- const hasEnabledServersArray = hasEnabledServers && Array.isArray(projectConfig.enabledMcpjsonServers);
566481
- const hasDisabledServersArray = hasDisabledServers && Array.isArray(projectConfig.disabledMcpjsonServers);
566482
- if (existingHadEnabledServers || hasEnabledServersArray) {
566483
- updates.enabledMcpjsonServers = existingEnabledServers;
566484
- }
566485
- if (existingHadDisabledServers || hasDisabledServersArray) {
566486
- updates.disabledMcpjsonServers = existingDisabledServers;
566487
- }
566488
- saveCurrentProjectConfig((config5) => {
566489
- const updated = { ...config5 };
566490
- for (const field of migratedFields) {
566491
- delete updated[field];
566492
- }
566493
- return updated;
566589
+ }
566590
+ const overlappingServers = existingEnabledServers.filter((server) => existingDisabledServers.includes(server));
566591
+ if (overlappingServers.length > 0) {
566592
+ logEvent("tengu_migrate_mcp_server_conflict_resolved", {
566593
+ overlappingServers: overlappingServers.join(","),
566594
+ conflictResolution: "removed_from_disabled"
566494
566595
  });
566495
- const currentSettings = getSettingsForSource("localSettings") || {};
566496
- const currentSettingsHash = JSON.stringify(currentSettings);
566497
- if (currentSettingsHash !== originalSettingsHash) {
566498
- logError2("MIGRATION WARNING: Settings file was modified concurrently during migration. " + "The migration will overwrite concurrent changes, potentially causing data loss. " + "Original settings hash: " + originalSettingsHash + ", Current settings hash: " + currentSettingsHash);
566499
- }
566596
+ }
566597
+ const finalDisabledServers = existingDisabledServers.filter((server) => !existingEnabledServers.includes(server));
566598
+ if (hasEnabledServers) {
566599
+ updates.enabledMcpjsonServers = existingEnabledServers;
566600
+ }
566601
+ if (hasDisabledServers || existingSettings.disabledMcpjsonServers !== undefined) {
566602
+ updates.disabledMcpjsonServers = finalDisabledServers;
566603
+ }
566604
+ try {
566500
566605
  updateSettingsForSource("localSettings", updates);
566501
- saveGlobalConfig((c6) => ({ ...c6, hasCompletedMcpServerMigration: true }));
566502
- logEvent("tengu_migrate_enable_all_project_mcp_servers_to_settings", {
566503
- migration: "enableAllProjectMcpServersToSettings",
566504
- fieldsMigrated: migratedFields.join(",")
566505
- });
566506
566606
  } catch (error49) {
566507
- logError2("Failed to migrate MCP server settings, rolling back", error49);
566508
- let rollbackFailed = false;
566509
- try {
566510
- const currentSettings = getSettingsForSource("localSettings") || {};
566511
- const currentSettingsHash = JSON.stringify(currentSettings);
566512
- if (currentSettingsHash !== originalSettingsHash) {
566513
- logError2("MIGRATION WARNING: Settings file was modified concurrently. " + "The rollback will overwrite concurrent changes, potentially causing data loss. " + "Original settings hash: " + originalSettingsHash + ", Current settings hash: " + currentSettingsHash);
566514
- }
566515
- const rollbackUpdates = {};
566516
- for (const field of migratedFields) {
566517
- if (field in originalSettings) {
566518
- rollbackUpdates[field] = originalSettings[field];
566519
- } else {
566520
- deleteSettingsField("localSettings", field);
566521
- }
566522
- }
566523
- updateSettingsForSource("localSettings", rollbackUpdates);
566524
- } catch (rollbackError) {
566525
- logError2("Rollback of settings failed", rollbackError);
566526
- rollbackFailed = true;
566527
- }
566528
- try {
566529
- saveCurrentProjectConfig((config5) => {
566530
- const updated = { ...config5 };
566531
- for (const field of migratedFields) {
566532
- updated[field] = originalProjectConfig[field];
566533
- }
566534
- return updated;
566535
- });
566536
- } catch (rollbackError) {
566537
- logError2("Rollback of project config failed", rollbackError);
566538
- rollbackFailed = true;
566539
- }
566540
- if (rollbackFailed) {
566541
- logError2("MIGRATION WARNING: Rollback was incomplete. The system may be in an inconsistent " + "state with duplicate or conflicting MCP server configuration. Manual intervention " + "may be required to restore consistency between project config and settings.", new Error("Migration failed and rollback was incomplete. The system may be in an inconsistent state. " + "Original error: " + (error49 instanceof Error ? error49.message : String(error49))));
566542
- throw new Error("Migration failed and rollback was incomplete. The system may be in an inconsistent state. " + "Original error: " + (error49 instanceof Error ? error49.message : String(error49)));
566543
- } else {
566544
- logError2("Rollback completed successfully: original MCP server settings restored", error49);
566545
- }
566607
+ logError2("Failed to migrate MCP server settings to local config", error49);
566608
+ throw error49;
566546
566609
  }
566610
+ saveCurrentProjectConfig((config5) => {
566611
+ const updated = { ...config5 };
566612
+ delete updated.enableAllProjectMcpServers;
566613
+ delete updated.enabledMcpjsonServers;
566614
+ delete updated.disabledMcpjsonServers;
566615
+ return updated;
566616
+ });
566617
+ saveGlobalConfig((c6) => ({ ...c6, hasCompletedMcpServerMigration: true }));
566618
+ logEvent("tengu_migrate_enable_all_project_mcp_servers_to_settings", {
566619
+ migration: "enableAllProjectMcpServersToSettings",
566620
+ fieldsMigrated: [
566621
+ hasEnableAll && "enableAllProjectMcpServers",
566622
+ hasEnabledServers && "enabledMcpjsonServers",
566623
+ hasDisabledServers && "disabledMcpjsonServers"
566624
+ ].filter(Boolean).join(",")
566625
+ });
566547
566626
  }
566548
566627
  var init_migrateEnableAllProjectMcpServersToSettings = __esm(() => {
566549
566628
  init_analytics();
@@ -566631,7 +566710,8 @@ function migrateReplBridgeEnabledToRemoteControlAtStartup() {
566631
566710
  replBridgeEnabled: undefined
566632
566711
  };
566633
566712
  }
566634
- const { replBridgeEnabled: _2, ...next } = prev;
566713
+ const next = { ...prev };
566714
+ delete next.replBridgeEnabled;
566635
566715
  return next;
566636
566716
  });
566637
566717
  }