@funnycode/myclaude 0.1.123 → 0.1.147

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.123",
8
- BUILD_TIME: "2026-07-23T12:48:19.954Z",
7
+ VERSION: "0.1.147",
8
+ BUILD_TIME: "2026-07-27T08:45:06.269Z",
9
9
  PACKAGE_URL: "@funnycode/myclaude",
10
10
  NATIVE_PACKAGE_URL: "@funnycode/myclaude",
11
11
  VERSION_CHANGELOG: '',
@@ -14230,8 +14230,13 @@ var init_fsOperations = __esm(() => {
14230
14230
  let __stack = [];
14231
14231
  try {
14232
14232
  const _ = __using(__stack, slowLogging`fs.isDirEmptySync(${dirPath})`, 0);
14233
- const files = this.readdirSync(dirPath);
14234
- return files.length === 0;
14233
+ const dir = fs4.opendirSync(dirPath);
14234
+ try {
14235
+ const firstEntry = dir.readSync();
14236
+ return firstEntry === null;
14237
+ } finally {
14238
+ dir.closeSync();
14239
+ }
14235
14240
  } catch (_catch) {
14236
14241
  var _err = _catch, _hasErr = 1;
14237
14242
  } finally {
@@ -31338,7 +31343,7 @@ var hasColors, format = (open4, close) => {
31338
31343
  result += string4.slice(lastIndex) + closeCode;
31339
31344
  return result;
31340
31345
  };
31341
- }, reset, bold, dim, italic, underline, overline, inverse, hidden, strikethrough, black, red, green, yellow, blue, magenta, cyan, white, gray, bgBlack, bgRed, bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite, bgGray, redBright, greenBright, yellowBright, blueBright, magentaBright, cyanBright, whiteBright, bgRedBright, bgGreenBright, bgYellowBright, bgBlueBright, bgMagentaBright, bgCyanBright, bgWhiteBright;
31346
+ }, reset, bold, dim, italic, underline, underlineDouble, underlineCurly, underlineDotted, underlineDashed, overline, inverse, hidden, strikethrough, black, red, green, yellow, blue, magenta, cyan, white, gray, bgBlack, bgRed, bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite, bgGray, redBright, greenBright, yellowBright, blueBright, magentaBright, cyanBright, whiteBright, bgRedBright, bgGreenBright, bgYellowBright, bgBlueBright, bgMagentaBright, bgCyanBright, bgWhiteBright, underlineBlack, underlineRed, underlineGreen, underlineYellow, underlineBlue, underlineMagenta, underlineCyan, underlineWhite, underlineGray, underlineRedBright, underlineGreenBright, underlineYellowBright, underlineBlueBright, underlineMagentaBright, underlineCyanBright, underlineWhiteBright;
31342
31347
  var init_base = __esm(() => {
31343
31348
  hasColors = tty2?.WriteStream?.prototype?.hasColors?.() ?? false;
31344
31349
  reset = format(0, 0);
@@ -31346,6 +31351,10 @@ var init_base = __esm(() => {
31346
31351
  dim = format(2, 22);
31347
31352
  italic = format(3, 23);
31348
31353
  underline = format(4, 24);
31354
+ underlineDouble = format("4:2", 24);
31355
+ underlineCurly = format("4:3", 24);
31356
+ underlineDotted = format("4:4", 24);
31357
+ underlineDashed = format("4:5", 24);
31349
31358
  overline = format(53, 55);
31350
31359
  inverse = format(7, 27);
31351
31360
  hidden = format(8, 28);
@@ -31382,6 +31391,22 @@ var init_base = __esm(() => {
31382
31391
  bgMagentaBright = format(105, 49);
31383
31392
  bgCyanBright = format(106, 49);
31384
31393
  bgWhiteBright = format(107, 49);
31394
+ underlineBlack = format("58;5;0", 59);
31395
+ underlineRed = format("58;5;1", 59);
31396
+ underlineGreen = format("58;5;2", 59);
31397
+ underlineYellow = format("58;5;3", 59);
31398
+ underlineBlue = format("58;5;4", 59);
31399
+ underlineMagenta = format("58;5;5", 59);
31400
+ underlineCyan = format("58;5;6", 59);
31401
+ underlineWhite = format("58;5;7", 59);
31402
+ underlineGray = format("58;5;8", 59);
31403
+ underlineRedBright = format("58;5;9", 59);
31404
+ underlineGreenBright = format("58;5;10", 59);
31405
+ underlineYellowBright = format("58;5;11", 59);
31406
+ underlineBlueBright = format("58;5;12", 59);
31407
+ underlineMagentaBright = format("58;5;13", 59);
31408
+ underlineCyanBright = format("58;5;14", 59);
31409
+ underlineWhiteBright = format("58;5;15", 59);
31385
31410
  });
31386
31411
 
31387
31412
  // node_modules/yoctocolors/index.js
@@ -38380,6 +38405,7 @@ var init_log3 = __esm(() => {
38380
38405
  function sequential(fn) {
38381
38406
  const queue = [];
38382
38407
  let processing = false;
38408
+ let depth = 0;
38383
38409
  async function processQueue() {
38384
38410
  if (processing)
38385
38411
  return;
@@ -38401,10 +38427,18 @@ function sequential(fn) {
38401
38427
  }
38402
38428
  }
38403
38429
  return function(...args) {
38404
- return new Promise((resolve5, reject) => {
38405
- queue.push({ args, resolve: resolve5, reject, context: this });
38406
- processQueue();
38407
- });
38430
+ depth++;
38431
+ try {
38432
+ if (depth > 1) {
38433
+ return fn.apply(this, args);
38434
+ }
38435
+ return new Promise((resolve5, reject) => {
38436
+ queue.push({ args, resolve: resolve5, reject, context: this });
38437
+ processQueue();
38438
+ });
38439
+ } finally {
38440
+ depth--;
38441
+ }
38408
38442
  };
38409
38443
  }
38410
38444
 
@@ -61262,11 +61296,19 @@ function updateSettingsForSource(source, settings) {
61262
61296
  }
61263
61297
  }
61264
61298
  }
61265
- const updatedSettings = mergeWith_default(existingSettings || {}, settings, (_objValue, srcValue, key, object2) => {
61266
- if (srcValue === undefined && object2 && typeof key === "string") {
61267
- delete object2[key];
61268
- return;
61299
+ const srcKeys = Object.keys(settings);
61300
+ const nonUndefinedSettings = {};
61301
+ for (const key of srcKeys) {
61302
+ const value = settings[key];
61303
+ if (value === undefined) {
61304
+ if (existingSettings) {
61305
+ delete existingSettings[key];
61306
+ }
61307
+ } else {
61308
+ nonUndefinedSettings[key] = value;
61269
61309
  }
61310
+ }
61311
+ const updatedSettings = mergeWith_default(existingSettings || {}, nonUndefinedSettings, (_objValue, srcValue, key, object2) => {
61270
61312
  if (Array.isArray(srcValue)) {
61271
61313
  return srcValue;
61272
61314
  }
@@ -88559,7 +88601,7 @@ var require_serde = __commonJS((exports) => {
88559
88601
  return v.replace(/\\"/g, '"');
88560
88602
  });
88561
88603
  };
88562
- var format3 = /^-?\d*(\.\d+)?$/;
88604
+ var format3 = /^-?((0|[1-9]\d*)(\.\d+)?|\.\d+)([eE][+-]?\d+)?$/;
88563
88605
 
88564
88606
  class NumericValue {
88565
88607
  string;
@@ -88568,7 +88610,7 @@ var require_serde = __commonJS((exports) => {
88568
88610
  this.string = string4;
88569
88611
  this.type = type;
88570
88612
  if (!format3.test(string4)) {
88571
- throw new Error(`@smithy/core/serde - NumericValue must only contain [0-9], at most one decimal point ".", and an optional negation prefix "-".`);
88613
+ throw new Error(`@smithy/core/serde - NumericValue string must conform to the Smithy bigDecimal format. Received: "${string4}"`);
88572
88614
  }
88573
88615
  }
88574
88616
  toString() {
@@ -92801,6 +92843,7 @@ var require_retry2 = __commonJS((exports) => {
92801
92843
  var { parseRfc7231DateTime, v4 } = require_serde();
92802
92844
  var isStreamingPayload = (request) => request?.body instanceof Readable6 || typeof ReadableStream !== "undefined" && request?.body instanceof ReadableStream;
92803
92845
  var CLOCK_SKEW_ERROR_CODES = [
92846
+ "AccessDeniedException",
92804
92847
  "AuthFailure",
92805
92848
  "InvalidSignatureException",
92806
92849
  "RequestExpired",
@@ -96905,20 +96948,25 @@ ${toHex(hashedRequest)}`;
96905
96948
 
96906
96949
  // node_modules/@aws-sdk/core/dist-cjs/submodules/httpAuthSchemes/index.js
96907
96950
  var require_httpAuthSchemes = __commonJS((exports) => {
96908
- var { HttpResponse, HttpRequest } = require_protocols();
96909
- var { normalizeProvider, memoizeIdentityProvider, isIdentityExpired, doesIdentityRequireRefresh } = require_dist_cjs3();
96910
- var { ProviderError } = require_config();
96951
+ var { ProviderError, booleanSelector, SelectorType, loadConfig } = require_config();
96911
96952
  var { setCredentialFeature } = require_client3();
96953
+ var { normalizeProvider, memoizeIdentityProvider, isIdentityExpired, doesIdentityRequireRefresh } = require_dist_cjs3();
96912
96954
  var { SignatureV4 } = require_dist_cjs7();
96955
+ var { HttpResponse, HttpRequest } = require_protocols();
96913
96956
  var getDateHeader = (response) => HttpResponse.isInstance(response) ? response.headers?.date ?? response.headers?.Date : undefined;
96957
+ var getAgeHeader = (response) => HttpResponse.isInstance(response) ? response.headers?.age ?? response.headers?.Age : undefined;
96914
96958
  var getSkewCorrectedDate = (systemClockOffset) => new Date(Date.now() + systemClockOffset);
96915
- var isClockSkewed = (clockTime, systemClockOffset) => Math.abs(getSkewCorrectedDate(systemClockOffset).getTime() - clockTime) >= 300000;
96916
- var getUpdatedSystemClockOffset = (clockTime, currentSystemClockOffset) => {
96917
- const clockTimeInMs = Date.parse(clockTime);
96918
- if (isClockSkewed(clockTimeInMs, currentSystemClockOffset)) {
96919
- return clockTimeInMs - Date.now();
96959
+ var getUpdatedSystemClockOffset = (clockTime, currentSystemClockOffset, timeRequestSent, ageHeader) => {
96960
+ if (ageHeader !== undefined) {
96961
+ return currentSystemClockOffset;
96920
96962
  }
96921
- return currentSystemClockOffset;
96963
+ const serverTime = Date.parse(clockTime);
96964
+ const timeResponseReceived = Date.now();
96965
+ if (timeRequestSent !== undefined && timeResponseReceived - timeRequestSent > 900000) {
96966
+ return currentSystemClockOffset;
96967
+ }
96968
+ const candidateSkew = timeRequestSent !== undefined ? serverTime - (timeRequestSent + timeResponseReceived) / 2 : serverTime - timeResponseReceived;
96969
+ return candidateSkew;
96922
96970
  };
96923
96971
  var throwSigningPropertyError = (name, property2) => {
96924
96972
  if (!property2) {
@@ -96960,9 +97008,14 @@ var require_httpAuthSchemes = __commonJS((exports) => {
96960
97008
  signingName = second?.signingName ?? signingName;
96961
97009
  }
96962
97010
  }
96963
- signingProperties._preRequestSystemClockOffset = config2.systemClockOffset;
97011
+ const noSkewCorrection = await config2.disableClockSkewCorrection?.() === true;
97012
+ signingProperties._disableClockSkewCorrection = noSkewCorrection;
97013
+ if (!noSkewCorrection) {
97014
+ signingProperties._preRequestSystemClockOffset = config2.systemClockOffset;
97015
+ signingProperties._requestSentAt = Date.now();
97016
+ }
96964
97017
  const signedRequest = await signer.sign(httpRequest, {
96965
- signingDate: getSkewCorrectedDate(config2.systemClockOffset),
97018
+ signingDate: noSkewCorrection ? new Date : getSkewCorrectedDate(config2.systemClockOffset),
96966
97019
  signingRegion,
96967
97020
  signingService: signingName
96968
97021
  });
@@ -96971,27 +97024,36 @@ var require_httpAuthSchemes = __commonJS((exports) => {
96971
97024
  errorHandler(signingProperties) {
96972
97025
  return (error49) => {
96973
97026
  const errorException = error49;
96974
- const serverTime = errorException.ServerTime ?? getDateHeader(errorException.$response);
96975
- if (serverTime) {
96976
- const config2 = throwSigningPropertyError("config", signingProperties.config);
96977
- const preRequestOffset = signingProperties._preRequestSystemClockOffset;
96978
- const newOffset = getUpdatedSystemClockOffset(serverTime, config2.systemClockOffset);
96979
- const isLocalCorrection = newOffset !== config2.systemClockOffset;
96980
- const isConcurrentCorrection = preRequestOffset !== undefined && preRequestOffset !== newOffset;
96981
- const clockSkewCorrected = isLocalCorrection || isConcurrentCorrection;
96982
- if (clockSkewCorrected && errorException.$metadata) {
97027
+ if (!signingProperties._disableClockSkewCorrection) {
97028
+ const serverTime = errorException.ServerTime ?? getDateHeader(errorException.$response);
97029
+ if (serverTime) {
97030
+ const config2 = throwSigningPropertyError("config", signingProperties.config);
97031
+ const preRequestOffset = signingProperties._preRequestSystemClockOffset;
97032
+ const timeRequestSent = signingProperties._requestSentAt;
97033
+ const ageHeader = getAgeHeader(errorException.$response);
97034
+ const newOffset = getUpdatedSystemClockOffset(serverTime, config2.systemClockOffset, timeRequestSent, ageHeader);
96983
97035
  config2.systemClockOffset = newOffset;
96984
- errorException.$metadata.clockSkewCorrected = true;
97036
+ const skewExceedsThreshold = Math.abs(newOffset) >= 240000;
97037
+ const isLocalCorrection = newOffset !== preRequestOffset;
97038
+ const isConcurrentCorrection = preRequestOffset !== undefined && preRequestOffset !== newOffset;
97039
+ if (skewExceedsThreshold && (isLocalCorrection || isConcurrentCorrection) && errorException.$metadata) {
97040
+ errorException.$metadata.clockSkewCorrected = true;
97041
+ }
96985
97042
  }
96986
97043
  }
96987
97044
  throw error49;
96988
97045
  };
96989
97046
  }
96990
97047
  successHandler(httpResponse, signingProperties) {
97048
+ if (signingProperties._disableClockSkewCorrection) {
97049
+ return;
97050
+ }
96991
97051
  const dateHeader = getDateHeader(httpResponse);
96992
97052
  if (dateHeader) {
96993
97053
  const config2 = throwSigningPropertyError("config", signingProperties.config);
96994
- config2.systemClockOffset = getUpdatedSystemClockOffset(dateHeader, config2.systemClockOffset);
97054
+ const timeRequestSent = signingProperties._requestSentAt;
97055
+ const ageHeader = getAgeHeader(httpResponse);
97056
+ config2.systemClockOffset = getUpdatedSystemClockOffset(dateHeader, config2.systemClockOffset, timeRequestSent, ageHeader);
96995
97057
  }
96996
97058
  }
96997
97059
  }
@@ -97005,9 +97067,14 @@ var require_httpAuthSchemes = __commonJS((exports) => {
97005
97067
  const { config: config2, signer, signingRegion, signingRegionSet, signingName } = await validateSigningProperties(signingProperties);
97006
97068
  const configResolvedSigningRegionSet = await config2.sigv4aSigningRegionSet?.();
97007
97069
  const multiRegionOverride = (configResolvedSigningRegionSet ?? signingRegionSet ?? [signingRegion]).join(",");
97008
- signingProperties._preRequestSystemClockOffset = config2.systemClockOffset;
97070
+ const noSkewCorrection = await config2.disableClockSkewCorrection?.() === true;
97071
+ signingProperties._disableClockSkewCorrection = noSkewCorrection;
97072
+ if (!noSkewCorrection) {
97073
+ signingProperties._preRequestSystemClockOffset = config2.systemClockOffset;
97074
+ signingProperties._requestSentAt = Date.now();
97075
+ }
97009
97076
  const signedRequest = await signer.sign(httpRequest, {
97010
- signingDate: getSkewCorrectedDate(config2.systemClockOffset),
97077
+ signingDate: noSkewCorrection ? new Date : getSkewCorrectedDate(config2.systemClockOffset),
97011
97078
  signingRegion: multiRegionOverride,
97012
97079
  signingService: signingName
97013
97080
  });
@@ -97059,7 +97126,7 @@ var require_httpAuthSchemes = __commonJS((exports) => {
97059
97126
  },
97060
97127
  default: undefined
97061
97128
  };
97062
- var resolveAwsSdkSigV4Config = (config2) => {
97129
+ var bindResolveAwsSdkSigV4Config = (defaultDisableClockSkewCorrection) => (config2) => {
97063
97130
  let inputCredentials = config2.credentials;
97064
97131
  let isUserSupplied = !!config2.credentials;
97065
97132
  let resolvedCredentials = undefined;
@@ -97151,11 +97218,11 @@ var require_httpAuthSchemes = __commonJS((exports) => {
97151
97218
  const resolvedConfig = Object.assign(config2, {
97152
97219
  systemClockOffset,
97153
97220
  signingEscapePath,
97154
- signer
97221
+ signer,
97222
+ disableClockSkewCorrection: normalizeProvider(config2.disableClockSkewCorrection ?? defaultDisableClockSkewCorrection)
97155
97223
  });
97156
97224
  return resolvedConfig;
97157
97225
  };
97158
- var resolveAWSSDKSigV4Config = resolveAwsSdkSigV4Config;
97159
97226
  function normalizeCredentialProvider(config2, { credentials, credentialDefaultProvider }) {
97160
97227
  let credentialsProvider;
97161
97228
  if (credentials) {
@@ -97187,6 +97254,16 @@ var require_httpAuthSchemes = __commonJS((exports) => {
97187
97254
  fn.configBound = true;
97188
97255
  return fn;
97189
97256
  }
97257
+ var ENV_DISABLE_CLOCK_SKEW_CORRECTION = "AWS_DISABLE_CLOCK_SKEW_CORRECTION";
97258
+ var CONFIG_DISABLE_CLOCK_SKEW_CORRECTION = "disable_clock_skew_correction";
97259
+ var NODE_DISABLE_CLOCK_SKEW_CORRECTION_CONFIG_OPTIONS = {
97260
+ environmentVariableSelector: (env6) => booleanSelector(env6, ENV_DISABLE_CLOCK_SKEW_CORRECTION, SelectorType.ENV),
97261
+ configFileSelector: (profile) => booleanSelector(profile, CONFIG_DISABLE_CLOCK_SKEW_CORRECTION, SelectorType.CONFIG),
97262
+ default: false
97263
+ };
97264
+ var DEFAULT_DISABLE_CLOCK_SKEW_CORRECTION = loadConfig(NODE_DISABLE_CLOCK_SKEW_CORRECTION_CONFIG_OPTIONS);
97265
+ var resolveAwsSdkSigV4Config = bindResolveAwsSdkSigV4Config(DEFAULT_DISABLE_CLOCK_SKEW_CORRECTION);
97266
+ var resolveAWSSDKSigV4Config = resolveAwsSdkSigV4Config;
97190
97267
  exports.AWSSDKSigV4Signer = AWSSDKSigV4Signer;
97191
97268
  exports.AwsSdkSigV4ASigner = AwsSdkSigV4ASigner;
97192
97269
  exports.AwsSdkSigV4Signer = AwsSdkSigV4Signer;
@@ -97364,7 +97441,7 @@ var require_cbor = __commonJS((exports) => {
97364
97441
  }
97365
97442
  function decodeMap(at, to) {
97366
97443
  const mapDataLength = decodeCount(at, to);
97367
- if (mapDataLength < 15) {
97444
+ if (mapDataLength < 25) {
97368
97445
  return decodeMapSmall(at, to, mapDataLength);
97369
97446
  }
97370
97447
  return decodeMapLarge(at, to, mapDataLength);
@@ -98513,6 +98590,9 @@ var require_dist_cjs8 = __commonJS((exports) => {
98513
98590
  return xmlText += !hasChildren ? "/>" : `>${this.children.map((c5) => c5.toString()).join("")}</${this.name}>`;
98514
98591
  }
98515
98592
  }
98593
+ function writeKey(obj) {
98594
+ Object.defineProperty(obj, "__proto__", { value: undefined, writable: true, enumerable: true, configurable: true });
98595
+ }
98516
98596
  function parseXML(xml) {
98517
98597
  const state = new AwsXmlParser(xml);
98518
98598
  return state.parse();
@@ -98598,7 +98678,7 @@ var require_dist_cjs8 = __commonJS((exports) => {
98598
98678
  tag += p.x[p.i++];
98599
98679
  }
98600
98680
  let hasAttrs = false;
98601
- const attrs = Object.create(null);
98681
+ const attrs = {};
98602
98682
  while (p.i < p.z) {
98603
98683
  p.trim();
98604
98684
  if (">/".includes(p.x[p.i])) {
@@ -98615,6 +98695,9 @@ var require_dist_cjs8 = __commonJS((exports) => {
98615
98695
  }
98616
98696
  ++p.i;
98617
98697
  p.trim();
98698
+ if (name === "__proto__") {
98699
+ writeKey(attrs);
98700
+ }
98618
98701
  attrs[name] = p.readAttrValue();
98619
98702
  hasAttrs = true;
98620
98703
  }
@@ -98627,7 +98710,6 @@ var require_dist_cjs8 = __commonJS((exports) => {
98627
98710
  throw new Error("@aws-sdk XML parse error: expected > at the end of self-closing tag.");
98628
98711
  }
98629
98712
  ++p.i;
98630
- Object.setPrototypeOf(attrs, Object.prototype);
98631
98713
  return { tag, value: hasAttrs ? attrs : "" };
98632
98714
  }
98633
98715
  if (p.x[p.i] !== ">") {
@@ -98680,7 +98762,7 @@ var require_dist_cjs8 = __commonJS((exports) => {
98680
98762
  }
98681
98763
  return { tag, value: text };
98682
98764
  }
98683
- const obj = Object.create(null);
98765
+ const obj = {};
98684
98766
  for (const text of textParts) {
98685
98767
  if (text.trim() === "" && text.includes(`
98686
98768
  `)) {
@@ -98689,6 +98771,9 @@ var require_dist_cjs8 = __commonJS((exports) => {
98689
98771
  obj["#text"] = "#text" in obj ? obj["#text"] + text : text;
98690
98772
  }
98691
98773
  for (const child of childTags) {
98774
+ if (child.tag === "__proto__") {
98775
+ writeKey(obj);
98776
+ }
98692
98777
  if (child.tag in obj) {
98693
98778
  if (Array.isArray(obj[child.tag])) {
98694
98779
  obj[child.tag].push(child.value);
@@ -98700,9 +98785,11 @@ var require_dist_cjs8 = __commonJS((exports) => {
98700
98785
  }
98701
98786
  }
98702
98787
  for (const [k, v] of Object.entries(attrs)) {
98788
+ if (k === "__proto__") {
98789
+ writeKey(obj);
98790
+ }
98703
98791
  obj[k] = v;
98704
98792
  }
98705
- Object.setPrototypeOf(obj, Object.prototype);
98706
98793
  return { tag, value: obj };
98707
98794
  }
98708
98795
  static ENTITIES = {
@@ -99023,11 +99110,17 @@ var require_protocols2 = __commonJS((exports) => {
99023
99110
  if (context?.source) {
99024
99111
  const numericString = context.source;
99025
99112
  if (typeof value === "number") {
99026
- if (value > Number.MAX_SAFE_INTEGER || value < Number.MIN_SAFE_INTEGER || numericString !== String(value)) {
99027
- const isFractional = numericString.includes(".");
99028
- if (isFractional) {
99113
+ const inSafeRange = value <= Number.MAX_SAFE_INTEGER && value >= Number.MIN_SAFE_INTEGER;
99114
+ if (!inSafeRange || numericString !== String(value)) {
99115
+ if (inSafeRange && /[eE]/.test(numericString) && String(Number(numericString)) === String(value)) {
99116
+ return value;
99117
+ }
99118
+ if (isFractionalNumeric(numericString)) {
99029
99119
  return new NumericValue(numericString, "bigDecimal");
99030
99120
  } else {
99121
+ if (/[eE]/.test(numericString)) {
99122
+ return BigInt(Number(numericString));
99123
+ }
99031
99124
  return BigInt(numericString);
99032
99125
  }
99033
99126
  }
@@ -99035,22 +99128,104 @@ var require_protocols2 = __commonJS((exports) => {
99035
99128
  }
99036
99129
  return value;
99037
99130
  }
99131
+ function isFractionalNumeric(s) {
99132
+ const dotIndex = s.indexOf(".");
99133
+ if (dotIndex === -1) {
99134
+ return false;
99135
+ }
99136
+ const eIndex = s.search(/[eE]/);
99137
+ if (eIndex === -1) {
99138
+ return true;
99139
+ }
99140
+ const fracDigits = eIndex - dotIndex - 1;
99141
+ const exp = parseInt(s.slice(eIndex + 1), 10);
99142
+ return exp < fracDigits;
99143
+ }
99144
+ var REVIVER_SYMBOL = Symbol.for("@aws-sdk/reviver");
99145
+ function needsReviver(schema) {
99146
+ const ns = NormalizedSchema.of(schema);
99147
+ const raw = ns.getSchema();
99148
+ if (Array.isArray(raw) && ns.isStructSchema()) {
99149
+ if (REVIVER_SYMBOL in raw) {
99150
+ return raw[REVIVER_SYMBOL];
99151
+ }
99152
+ const result = _check2(ns, new Set);
99153
+ raw[REVIVER_SYMBOL] = result;
99154
+ return result;
99155
+ }
99156
+ return _check2(ns, new Set);
99157
+ }
99158
+ function _check2(ns, seen) {
99159
+ const raw = ns.getSchema();
99160
+ if (seen.has(raw)) {
99161
+ return false;
99162
+ }
99163
+ seen.add(raw);
99164
+ if (ns.isBigIntegerSchema() || ns.isBigDecimalSchema()) {
99165
+ return true;
99166
+ }
99167
+ if (ns.isStructSchema()) {
99168
+ for (const [, memberSchema] of ns.structIterator()) {
99169
+ if (_check2(memberSchema, seen)) {
99170
+ return true;
99171
+ }
99172
+ }
99173
+ } else if (ns.isListSchema() || ns.isMapSchema()) {
99174
+ if (_check2(ns.getValueSchema(), seen)) {
99175
+ return true;
99176
+ }
99177
+ } else if (ns.isDocumentSchema()) {
99178
+ return true;
99179
+ }
99180
+ return false;
99181
+ }
99038
99182
  var collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => (context?.utf8Encoder ?? toUtf8)(body));
99039
- var parseJsonBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
99040
- if (encoded.length) {
99183
+ var canParseBuffer;
99184
+ function detectBufferParsing() {
99185
+ if (canParseBuffer === undefined) {
99041
99186
  try {
99042
- return JSON.parse(encoded);
99043
- } catch (e) {
99044
- if (e?.name === "SyntaxError") {
99045
- Object.defineProperty(e, "$responseBodyText", {
99046
- value: encoded
99047
- });
99187
+ if (typeof Buffer !== "function") {
99188
+ canParseBuffer = false;
99189
+ } else {
99190
+ const result = JSON.parse(Buffer.from([123, 125]));
99191
+ canParseBuffer = result !== null && typeof result === "object";
99048
99192
  }
99049
- throw e;
99193
+ } catch {
99194
+ canParseBuffer = false;
99050
99195
  }
99051
99196
  }
99052
- return {};
99053
- });
99197
+ return canParseBuffer;
99198
+ }
99199
+ async function parseJsonBody(streamBody, context, schema) {
99200
+ let parsingInput;
99201
+ if (detectBufferParsing() && typeof streamBody?.[Symbol.asyncIterator] === "function") {
99202
+ const buffer = await collectBody(streamBody, context);
99203
+ if (typeof Buffer === "function") {
99204
+ if (Buffer.isBuffer(buffer)) {
99205
+ parsingInput = buffer;
99206
+ } else {
99207
+ parsingInput = Buffer.from(buffer.buffer, buffer.byteOffset, buffer.byteLength);
99208
+ }
99209
+ }
99210
+ }
99211
+ if (!parsingInput) {
99212
+ parsingInput = await collectBodyString(streamBody, context);
99213
+ }
99214
+ if (parsingInput.length === 0) {
99215
+ return {};
99216
+ }
99217
+ const reviver = schema && needsReviver(schema) ? jsonReviver : undefined;
99218
+ try {
99219
+ return JSON.parse(parsingInput, reviver);
99220
+ } catch (e) {
99221
+ if (e?.name === "SyntaxError") {
99222
+ Object.defineProperty(e, "$responseBodyText", {
99223
+ value: typeof parsingInput === "string" ? parsingInput : parsingInput.toString("utf8")
99224
+ });
99225
+ }
99226
+ throw e;
99227
+ }
99228
+ }
99054
99229
  var parseJsonErrorBody = async (errorBody, context) => {
99055
99230
  const value = await parseJsonBody(errorBody, context);
99056
99231
  value.message = value.message ?? value.Message;
@@ -99103,6 +99278,9 @@ var require_protocols2 = __commonJS((exports) => {
99103
99278
  }
99104
99279
  }
99105
99280
  };
99281
+ function writeKey(obj) {
99282
+ Object.defineProperty(obj, "__proto__", { value: undefined, writable: true, enumerable: true, configurable: true });
99283
+ }
99106
99284
 
99107
99285
  class JsonShapeDeserializer extends SerdeContextConfig {
99108
99286
  settings;
@@ -99111,7 +99289,8 @@ var require_protocols2 = __commonJS((exports) => {
99111
99289
  this.settings = settings;
99112
99290
  }
99113
99291
  async read(schema, data) {
99114
- return this._read(schema, typeof data === "string" ? JSON.parse(data, jsonReviver) : await parseJsonBody(data, this.serdeContext));
99292
+ const reviver = needsReviver(schema) ? jsonReviver : undefined;
99293
+ return this._read(schema, typeof data === "string" ? JSON.parse(data, reviver) : await parseJsonBody(data, this.serdeContext, schema));
99115
99294
  }
99116
99295
  readObject(schema, data) {
99117
99296
  return this._read(schema, data);
@@ -99171,6 +99350,9 @@ var require_protocols2 = __commonJS((exports) => {
99171
99350
  const mapMember = ns.getValueSchema();
99172
99351
  const out = {};
99173
99352
  for (const _k in value) {
99353
+ if (_k === "__proto__") {
99354
+ writeKey(out);
99355
+ }
99174
99356
  out[_k] = this._read(mapMember, value[_k]);
99175
99357
  }
99176
99358
  return out;
@@ -99229,6 +99411,9 @@ var require_protocols2 = __commonJS((exports) => {
99229
99411
  if (isObject5) {
99230
99412
  const out = Array.isArray(value) ? [] : {};
99231
99413
  for (const k in value) {
99414
+ if (k === "__proto__") {
99415
+ writeKey(out);
99416
+ }
99232
99417
  const v = value[k];
99233
99418
  if (v instanceof NumericValue) {
99234
99419
  out[k] = v;
@@ -99352,6 +99537,9 @@ var require_protocols2 = __commonJS((exports) => {
99352
99537
  const { $unknown } = record2;
99353
99538
  if (Array.isArray($unknown)) {
99354
99539
  const [k, v] = $unknown;
99540
+ if (k === "__proto__") {
99541
+ writeKey(out);
99542
+ }
99355
99543
  out[k] = this._write(15, v);
99356
99544
  }
99357
99545
  } else if (typeof record2.__type === "string") {
@@ -99383,6 +99571,9 @@ var require_protocols2 = __commonJS((exports) => {
99383
99571
  for (const _k in value) {
99384
99572
  const _v = value[_k];
99385
99573
  if (sparse || _v != null) {
99574
+ if (_k === "__proto__") {
99575
+ writeKey(out);
99576
+ }
99386
99577
  out[_k] = this._write(mapMember, _v);
99387
99578
  }
99388
99579
  }
@@ -99448,6 +99639,9 @@ var require_protocols2 = __commonJS((exports) => {
99448
99639
  const out = Array.isArray(value) ? [] : {};
99449
99640
  for (const k in value) {
99450
99641
  const v = value[k];
99642
+ if (k === "__proto__") {
99643
+ writeKey(out);
99644
+ }
99451
99645
  if (v instanceof NumericValue) {
99452
99646
  this.useReplacer = true;
99453
99647
  out[k] = v;
@@ -99762,6 +99956,9 @@ var require_protocols2 = __commonJS((exports) => {
99762
99956
  for (const entry of entries) {
99763
99957
  const key = entry[keyProperty];
99764
99958
  const value2 = entry[valueProperty];
99959
+ if (key === "__proto__") {
99960
+ writeKey(buffer);
99961
+ }
99765
99962
  buffer[key] = this.readSchema(memberNs, value2);
99766
99963
  }
99767
99964
  return buffer;
@@ -100665,7 +100862,7 @@ var require_sso_oidc = __commonJS((exports) => {
100665
100862
  Region: { type: "builtInParams", name: "region" },
100666
100863
  UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" }
100667
100864
  };
100668
- var version2 = "3.997.33";
100865
+ var version2 = "3.997.34";
100669
100866
  var packageInfo = {
100670
100867
  version: version2
100671
100868
  };
@@ -101562,7 +101759,7 @@ var require_sso = __commonJS((exports) => {
101562
101759
  Region: { type: "builtInParams", name: "region" },
101563
101760
  UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" }
101564
101761
  };
101565
- var version2 = "3.997.33";
101762
+ var version2 = "3.997.34";
101566
101763
  var packageInfo = {
101567
101764
  version: version2
101568
101765
  };
@@ -102656,7 +102853,7 @@ var require_sts = __commonJS((exports) => {
102656
102853
  Region: { type: "builtInParams", name: "region" },
102657
102854
  UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" }
102658
102855
  };
102659
- var version2 = "3.997.33";
102856
+ var version2 = "3.997.34";
102660
102857
  var packageInfo = {
102661
102858
  version: version2
102662
102859
  };
@@ -103425,7 +103622,7 @@ var require_signin = __commonJS((exports) => {
103425
103622
  Region: { type: "builtInParams", name: "region" },
103426
103623
  UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" }
103427
103624
  };
103428
- var version2 = "3.997.33";
103625
+ var version2 = "3.997.34";
103429
103626
  var packageInfo = {
103430
103627
  version: version2
103431
103628
  };
@@ -117790,7 +117987,7 @@ var package_default;
117790
117987
  var init_package = __esm(() => {
117791
117988
  package_default = {
117792
117989
  name: "@funnycode/myclaude",
117793
- version: "0.1.123",
117990
+ version: "0.1.147",
117794
117991
  private: false,
117795
117992
  description: "An open-source AI coding assistant in your terminal - powered by Claude",
117796
117993
  license: "MIT",
@@ -210839,13 +211036,27 @@ function createDumpPromptsFetch(agentIdOrSessionId) {
210839
211036
  }
210840
211037
  if (incomplete.length > MAX_BUFFER_SIZE2) {
210841
211038
  logForDebugging("dumpPrompts: incomplete buffer exceeds max size, truncating", { level: "warn" });
210842
- incomplete = incomplete.slice(-MAX_BUFFER_SIZE2);
211039
+ const truncateStart = incomplete.length - MAX_BUFFER_SIZE2;
211040
+ const lastNewline = incomplete.lastIndexOf(`
211041
+ `, truncateStart);
211042
+ if (lastNewline !== -1 && lastNewline > truncateStart - 1000) {
211043
+ incomplete = incomplete.slice(lastNewline + 1);
211044
+ } else {
211045
+ incomplete = incomplete.slice(-MAX_BUFFER_SIZE2);
211046
+ }
210843
211047
  }
210844
211048
  } else {
210845
211049
  incomplete = combined;
210846
211050
  if (incomplete.length > MAX_BUFFER_SIZE2) {
210847
211051
  logForDebugging("dumpPrompts: buffer exceeded max size, truncating", { level: "warn" });
210848
- incomplete = incomplete.slice(-MAX_BUFFER_SIZE2);
211052
+ const truncateStart = incomplete.length - MAX_BUFFER_SIZE2;
211053
+ const lastNewline = incomplete.lastIndexOf(`
211054
+ `, truncateStart);
211055
+ if (lastNewline !== -1 && lastNewline > truncateStart - 1000) {
211056
+ incomplete = incomplete.slice(lastNewline + 1);
211057
+ } else {
211058
+ incomplete = incomplete.slice(-MAX_BUFFER_SIZE2);
211059
+ }
210849
211060
  }
210850
211061
  }
210851
211062
  }
@@ -301593,77 +301804,43 @@ function memoizeWithTTL(fn, ttlMs) {
301593
301804
  let lastCachedAt = 0;
301594
301805
  const memoized = memoize_default(fn);
301595
301806
  const originalClear = memoized.cache.clear.bind(memoized.cache);
301596
- const pendingRefreshes = new Map;
301597
- const keyMutexes = new Map;
301807
+ let pendingRefresh = null;
301598
301808
  const wrapped = async (...args) => {
301599
301809
  const now2 = Date.now();
301600
301810
  const cacheExpired = lastCachedAt === 0 || now2 - lastCachedAt >= ttlMs;
301601
301811
  if (cacheExpired) {
301602
- const key2 = String(args[0] ?? "_default");
301603
- let keyMutex = keyMutexes.get(key2);
301604
- if (!keyMutex) {
301605
- keyMutex = new Mutex;
301606
- keyMutexes.set(key2, keyMutex);
301812
+ if (pendingRefresh) {
301813
+ return pendingRefresh;
301607
301814
  }
301608
- const release = await keyMutex.acquire();
301609
- try {
301610
- const existing = pendingRefreshes.get(key2);
301611
- if (existing) {
301612
- return existing;
301613
- }
301614
- const refreshPromise = (async () => {
301615
- let timeoutId = null;
301616
- try {
301617
- const timeoutMs = GROVE_API_TIMEOUT_MS * 3;
301618
- const timeoutPromise = new Promise((_2, reject2) => {
301619
- timeoutId = setTimeout(() => reject2(new Error(`Refresh timeout after ${timeoutMs}ms for key: ${key2}`)), timeoutMs);
301620
- });
301621
- const now22 = Date.now();
301622
- if (lastCachedAt !== 0 && now22 - lastCachedAt < ttlMs) {
301623
- const cached2 = memoized.cache.get(args[0]);
301624
- if (cached2 !== undefined)
301625
- return cached2;
301626
- return memoized(...args);
301627
- }
301628
- try {
301629
- const freshResult = await Promise.race([fn(...args), timeoutPromise]);
301630
- if (freshResult && typeof freshResult === "object" && "success" in freshResult && freshResult.success === true) {
301631
- memoized.cache.delete(args[0]);
301632
- memoized.cache.set(args[0], freshResult);
301633
- lastCachedAt = Date.now();
301634
- return freshResult;
301635
- }
301636
- if (memoized.cache.has(args[0])) {
301637
- return memoized.cache.get(args[0]);
301638
- }
301639
- return freshResult;
301640
- } catch (error49) {
301641
- if (memoized.cache.has(args[0])) {
301642
- return memoized.cache.get(args[0]);
301643
- }
301644
- return { success: false };
301645
- }
301646
- } finally {
301647
- if (timeoutId) {
301648
- clearTimeout(timeoutId);
301649
- }
301815
+ pendingRefresh = (async () => {
301816
+ try {
301817
+ const freshResult = await fn(...args);
301818
+ if (freshResult && typeof freshResult === "object" && "success" in freshResult && freshResult.success === true) {
301819
+ memoized.cache.delete(args[0]);
301820
+ memoized.cache.set(args[0], freshResult);
301821
+ lastCachedAt = Date.now();
301822
+ return freshResult;
301650
301823
  }
301651
- })();
301652
- pendingRefreshes.set(key2, refreshPromise);
301653
- refreshPromise.finally(() => {
301654
- pendingRefreshes.delete(key2);
301655
- });
301656
- return refreshPromise;
301657
- } finally {
301658
- release();
301659
- keyMutexes.delete(key2);
301660
- }
301824
+ if (memoized.cache.has(args[0])) {
301825
+ return memoized.cache.get(args[0]);
301826
+ }
301827
+ return freshResult;
301828
+ } catch (error49) {
301829
+ if (memoized.cache.has(args[0])) {
301830
+ return memoized.cache.get(args[0]);
301831
+ }
301832
+ return { success: false };
301833
+ } finally {
301834
+ pendingRefresh = null;
301835
+ }
301836
+ })();
301837
+ return pendingRefresh;
301661
301838
  }
301662
301839
  try {
301663
301840
  const result = await memoized(...args);
301664
301841
  if (result && typeof result === "object" && "success" in result && result.success === true) {
301665
301842
  lastCachedAt = Date.now();
301666
- } else if (result && typeof result === "object" && "success" in result && result.success === false) {}
301843
+ }
301667
301844
  return result;
301668
301845
  } catch (error49) {
301669
301846
  logError2(error49);
@@ -301674,7 +301851,7 @@ function memoizeWithTTL(fn, ttlMs) {
301674
301851
  clear: () => {
301675
301852
  originalClear();
301676
301853
  lastCachedAt = 0;
301677
- keyMutexes.clear();
301854
+ pendingRefresh = null;
301678
301855
  }
301679
301856
  };
301680
301857
  return wrapped;
@@ -342900,7 +343077,8 @@ async function appendSessionLogImpl(sessionId, entry, url3, headers) {
342900
343077
  } else {
342901
343078
  let logs2 = null;
342902
343079
  try {
342903
- logs2 = await fetchSessionLogsFromUrl(sessionId, url3, headers);
343080
+ const sequential2 = getOrCreateSequential(sessionId);
343081
+ logs2 = await sequential2(sessionId, url3, headers, true);
342904
343082
  } catch (fetchError) {
342905
343083
  logError2(new Error(`Session 409: fetch failed for session ${sessionId}, entry ${entry.uuid}: ${fetchError instanceof Error ? fetchError.message : String(fetchError)}`));
342906
343084
  logForDiagnosticsNoPII("error", "session_persist_409_fetch_fail");
@@ -407991,10 +408169,58 @@ function isInputModeCharacter(input) {
407991
408169
 
407992
408170
  // src/projectOnboardingState.ts
407993
408171
  import { join as join105 } from "path";
408172
+ function clearCachedSteps() {
408173
+ cachedSteps = null;
408174
+ cachedClaudeMdMtime = null;
408175
+ cachedDirMtime = null;
408176
+ cachedAt = null;
408177
+ }
408178
+ function isCacheValid() {
408179
+ if (!cachedSteps)
408180
+ return false;
408181
+ const cwd2 = getCwd();
408182
+ const claudeMdPath = join105(cwd2, "CLAUDE.md");
408183
+ const fs13 = getFsImplementation();
408184
+ try {
408185
+ const currentClaudeMdMtime = fs13.existsSync(claudeMdPath) ? getFileModificationTime(claudeMdPath) ?? -1 : -1;
408186
+ if (currentClaudeMdMtime !== cachedClaudeMdMtime)
408187
+ return false;
408188
+ } catch {
408189
+ return false;
408190
+ }
408191
+ try {
408192
+ const currentDirMtime = getFileModificationTime(cwd2) ?? -1;
408193
+ if (currentDirMtime !== cachedDirMtime)
408194
+ return false;
408195
+ } catch {
408196
+ return false;
408197
+ }
408198
+ if (cachedAt !== null && Date.now() - cachedAt > CACHE_MAX_AGE_MS) {
408199
+ return false;
408200
+ }
408201
+ return true;
408202
+ }
407994
408203
  function getSteps() {
407995
- const hasClaudeMd = getFsImplementation().existsSync(join105(getCwd(), "CLAUDE.md"));
407996
- const isWorkspaceDirEmpty = isDirEmpty(getCwd());
407997
- return [
408204
+ if (isCacheValid()) {
408205
+ return cachedSteps;
408206
+ }
408207
+ const cwd2 = getCwd();
408208
+ const fs13 = getFsImplementation();
408209
+ const hasClaudeMd = fs13.existsSync(join105(cwd2, "CLAUDE.md"));
408210
+ const isWorkspaceDirEmpty = isDirEmpty(cwd2);
408211
+ const claudeMdPath = join105(cwd2, "CLAUDE.md");
408212
+ try {
408213
+ cachedClaudeMdMtime = hasClaudeMd ? getFileModificationTime(claudeMdPath) : -1;
408214
+ } catch {
408215
+ cachedClaudeMdMtime = -1;
408216
+ }
408217
+ try {
408218
+ cachedDirMtime = getFileModificationTime(cwd2);
408219
+ } catch {
408220
+ cachedDirMtime = -1;
408221
+ }
408222
+ cachedAt = Date.now();
408223
+ cachedSteps = [
407998
408224
  {
407999
408225
  key: "workspace",
408000
408226
  text: "Ask Claude to create a new app or clone a repository",
@@ -408010,6 +408236,7 @@ function getSteps() {
408010
408236
  isEnabled: !isWorkspaceDirEmpty
408011
408237
  }
408012
408238
  ];
408239
+ return cachedSteps;
408013
408240
  }
408014
408241
  function isProjectOnboardingComplete() {
408015
408242
  return getSteps().filter(({ isCompletable, isEnabled: isEnabled2 }) => isCompletable && isEnabled2).every(({ isComplete }) => isComplete);
@@ -408025,26 +408252,25 @@ function maybeMarkProjectOnboardingComplete() {
408025
408252
  }));
408026
408253
  }
408027
408254
  }
408255
+ function shouldShowProjectOnboarding() {
408256
+ const projectConfig = getCurrentProjectConfig();
408257
+ if (projectConfig.hasCompletedProjectOnboarding || projectConfig.projectOnboardingSeenCount >= 4 || process.env.IS_DEMO) {
408258
+ return false;
408259
+ }
408260
+ return !isProjectOnboardingComplete();
408261
+ }
408028
408262
  function incrementProjectOnboardingSeenCount() {
408029
408263
  saveCurrentProjectConfig((current) => ({
408030
408264
  ...current,
408031
408265
  projectOnboardingSeenCount: current.projectOnboardingSeenCount + 1
408032
408266
  }));
408033
408267
  }
408034
- var shouldShowProjectOnboarding;
408268
+ var cachedSteps = null, cachedClaudeMdMtime = null, cachedDirMtime = null, cachedAt = null, CACHE_MAX_AGE_MS = 30000;
408035
408269
  var init_projectOnboardingState = __esm(() => {
408036
- init_memoize();
408037
408270
  init_config();
408038
408271
  init_cwd2();
408039
408272
  init_file();
408040
408273
  init_fsOperations();
408041
- shouldShowProjectOnboarding = memoize_default(() => {
408042
- const projectConfig = getCurrentProjectConfig();
408043
- if (projectConfig.hasCompletedProjectOnboarding || projectConfig.projectOnboardingSeenCount >= 4 || process.env.IS_DEMO) {
408044
- return false;
408045
- }
408046
- return !isProjectOnboardingComplete();
408047
- });
408048
408274
  });
408049
408275
 
408050
408276
  // src/utils/appleTerminalBackup.ts
@@ -429574,6 +429800,7 @@ var init_init2 = __esm(() => {
429574
429800
  progressMessage: "analyzing your codebase",
429575
429801
  source: "builtin",
429576
429802
  async getPromptForCommand() {
429803
+ clearCachedSteps();
429577
429804
  maybeMarkProjectOnboardingComplete();
429578
429805
  return [
429579
429806
  {
@@ -564218,17 +564445,15 @@ function migrateAutoUpdatesToSettings() {
564218
564445
  try {
564219
564446
  const userSettings = getSettingsForSource("userSettings") || {};
564220
564447
  updateSettingsForSource("userSettings", {
564221
- ...userSettings,
564222
564448
  env: {
564223
564449
  ...userSettings.env,
564224
- DISABLE_AUTOUPDATER: "1"
564450
+ DISABLE_AUTOUPDATER: userSettings.env?.DISABLE_AUTOUPDATER ?? "1"
564225
564451
  }
564226
564452
  });
564227
564453
  logEvent("tengu_migrate_autoupdates_to_settings", {
564228
564454
  was_user_preference: true,
564229
564455
  already_had_env_var: !!userSettings.env?.DISABLE_AUTOUPDATER
564230
564456
  });
564231
- process.env.DISABLE_AUTOUPDATER = "1";
564232
564457
  saveGlobalConfig((current) => {
564233
564458
  const {
564234
564459
  autoUpdates: _2,
@@ -564259,9 +564484,12 @@ function migrateBypassPermissionsAcceptedToSettings() {
564259
564484
  }
564260
564485
  try {
564261
564486
  if (!hasSkipDangerousModePermissionPrompt()) {
564262
- updateSettingsForSource("userSettings", {
564263
- skipDangerousModePermissionPrompt: true
564264
- });
564487
+ const userExplicitlyOptedOut = getSettingsForSource("userSettings")?.skipDangerousModePermissionPrompt === false || getSettingsForSource("localSettings")?.skipDangerousModePermissionPrompt === false || getSettingsForSource("flagSettings")?.skipDangerousModePermissionPrompt === false || getSettingsForSource("policySettings")?.skipDangerousModePermissionPrompt === false;
564488
+ if (!userExplicitlyOptedOut) {
564489
+ updateSettingsForSource("userSettings", {
564490
+ skipDangerousModePermissionPrompt: true
564491
+ });
564492
+ }
564265
564493
  }
564266
564494
  logEvent("tengu_migrate_bypass_permissions_accepted", {});
564267
564495
  saveGlobalConfig((current) => {
@@ -564285,8 +564513,8 @@ var init_migrateBypassPermissionsAcceptedToSettings = __esm(() => {
564285
564513
  function migrateEnableAllProjectMcpServersToSettings() {
564286
564514
  const projectConfig = getCurrentProjectConfig();
564287
564515
  const hasEnableAll = projectConfig.enableAllProjectMcpServers !== undefined;
564288
- const hasEnabledServers = projectConfig.enabledMcpjsonServers && projectConfig.enabledMcpjsonServers.length > 0;
564289
- const hasDisabledServers = projectConfig.disabledMcpjsonServers && projectConfig.disabledMcpjsonServers.length > 0;
564516
+ const hasEnabledServers = Array.isArray(projectConfig.enabledMcpjsonServers);
564517
+ const hasDisabledServers = Array.isArray(projectConfig.disabledMcpjsonServers);
564290
564518
  if (!hasEnableAll && !hasEnabledServers && !hasDisabledServers) {
564291
564519
  return;
564292
564520
  }
@@ -564294,50 +564522,71 @@ function migrateEnableAllProjectMcpServersToSettings() {
564294
564522
  const existingSettings = getSettingsForSource("localSettings") || {};
564295
564523
  const updates = {};
564296
564524
  const fieldsToRemove = [];
564297
- if (hasEnableAll && existingSettings.enableAllProjectMcpServers === undefined) {
564525
+ if (hasEnableAll) {
564298
564526
  updates.enableAllProjectMcpServers = projectConfig.enableAllProjectMcpServers;
564299
564527
  fieldsToRemove.push("enableAllProjectMcpServers");
564300
- } else if (hasEnableAll) {
564301
- fieldsToRemove.push("enableAllProjectMcpServers");
564302
564528
  }
564303
- if (hasEnabledServers && projectConfig.enabledMcpjsonServers) {
564304
- const existingEnabledServers = existingSettings.enabledMcpjsonServers || [];
564305
- updates.enabledMcpjsonServers = [
564306
- ...new Set([
564307
- ...existingEnabledServers,
564308
- ...projectConfig.enabledMcpjsonServers
564309
- ])
564310
- ];
564529
+ const existingEnabledServers = Array.isArray(existingSettings.enabledMcpjsonServers) ? [...existingSettings.enabledMcpjsonServers] : [];
564530
+ const existingDisabledServers = Array.isArray(existingSettings.disabledMcpjsonServers) ? [...existingSettings.disabledMcpjsonServers] : [];
564531
+ if (hasEnabledServers) {
564532
+ if (Array.isArray(projectConfig.enabledMcpjsonServers) && projectConfig.enabledMcpjsonServers.length > 0) {
564533
+ const seen = new Set(existingEnabledServers);
564534
+ for (const server of projectConfig.enabledMcpjsonServers) {
564535
+ if (!seen.has(server)) {
564536
+ existingEnabledServers.push(server);
564537
+ seen.add(server);
564538
+ }
564539
+ }
564540
+ }
564311
564541
  fieldsToRemove.push("enabledMcpjsonServers");
564312
564542
  }
564313
- if (hasDisabledServers && projectConfig.disabledMcpjsonServers) {
564314
- const existingDisabledServers = existingSettings.disabledMcpjsonServers || [];
564315
- updates.disabledMcpjsonServers = [
564316
- ...new Set([
564317
- ...existingDisabledServers,
564318
- ...projectConfig.disabledMcpjsonServers
564319
- ])
564320
- ];
564543
+ if (hasDisabledServers) {
564544
+ if (Array.isArray(projectConfig.disabledMcpjsonServers) && projectConfig.disabledMcpjsonServers.length > 0) {
564545
+ const seen = new Set(existingDisabledServers);
564546
+ for (const server of projectConfig.disabledMcpjsonServers) {
564547
+ if (!seen.has(server)) {
564548
+ existingDisabledServers.push(server);
564549
+ seen.add(server);
564550
+ }
564551
+ }
564552
+ }
564321
564553
  fieldsToRemove.push("disabledMcpjsonServers");
564322
564554
  }
564555
+ const enabledSet = new Set(existingEnabledServers);
564556
+ const overlappingServers = existingDisabledServers.filter((server) => enabledSet.has(server));
564557
+ if (overlappingServers.length > 0) {
564558
+ logEvent("tengu_migrate_mcp_server_overlap_in_both_lists", {
564559
+ migration: "enableAllProjectMcpServersToSettings",
564560
+ overlappingServers: overlappingServers.join(","),
564561
+ message: "MCP server(s) appear in both enabled and disabled lists. Preserving original disabled list as configured."
564562
+ });
564563
+ }
564564
+ const existingHadEnabledServers = Array.isArray(existingSettings.enabledMcpjsonServers);
564565
+ const existingHadDisabledServers = Array.isArray(existingSettings.disabledMcpjsonServers);
564566
+ if (existingEnabledServers.length > 0 || existingHadEnabledServers) {
564567
+ updates.enabledMcpjsonServers = existingEnabledServers;
564568
+ }
564569
+ if (existingDisabledServers.length > 0 || existingHadDisabledServers) {
564570
+ updates.disabledMcpjsonServers = existingDisabledServers;
564571
+ }
564323
564572
  if (Object.keys(updates).length > 0) {
564324
564573
  updateSettingsForSource("localSettings", updates);
564325
564574
  }
564326
564575
  if (fieldsToRemove.length > 0) {
564327
564576
  saveCurrentProjectConfig((current) => {
564328
- const configWithoutFields = { ...current };
564577
+ const updated = { ...current };
564329
564578
  for (const field of fieldsToRemove) {
564330
- delete configWithoutFields[field];
564579
+ delete updated[field];
564331
564580
  }
564332
- return configWithoutFields;
564581
+ return updated;
564333
564582
  });
564334
564583
  }
564335
- logEvent("tengu_migrate_mcp_approval_fields_success", {
564336
- migratedCount: fieldsToRemove.length
564584
+ logEvent("tengu_migrate_enable_all_project_mcp_servers_to_settings", {
564585
+ migration: "enableAllProjectMcpServersToSettings",
564586
+ fieldsMigrated: fieldsToRemove.join(",")
564337
564587
  });
564338
- } catch (e) {
564339
- logError2(e);
564340
- logEvent("tengu_migrate_mcp_approval_fields_error", {});
564588
+ } catch (error49) {
564589
+ logError2("Failed to migrate MCP server settings", error49);
564341
564590
  }
564342
564591
  }
564343
564592
  var init_migrateEnableAllProjectMcpServersToSettings = __esm(() => {
@@ -564349,6 +564598,8 @@ var init_migrateEnableAllProjectMcpServersToSettings = __esm(() => {
564349
564598
 
564350
564599
  // src/migrations/migrateFennecToOpus.ts
564351
564600
  var init_migrateFennecToOpus = __esm(() => {
564601
+ init_log3();
564602
+ init_providers();
564352
564603
  init_settings2();
564353
564604
  });
564354
564605
 
@@ -564409,9 +564660,9 @@ function migrateReplBridgeEnabledToRemoteControlAtStartup() {
564409
564660
  return prev;
564410
564661
  if (prev.remoteControlAtStartup !== undefined)
564411
564662
  return prev;
564412
- const next = { ...prev, remoteControlAtStartup: Boolean(oldValue) };
564413
- delete next["replBridgeEnabled"];
564414
- return next;
564663
+ const { replBridgeEnabled: _2, ...next } = prev;
564664
+ const newValue = typeof oldValue === "string" ? oldValue === "true" : Boolean(oldValue);
564665
+ return { ...next, remoteControlAtStartup: newValue };
564415
564666
  });
564416
564667
  }
564417
564668
  var init_migrateReplBridgeEnabledToRemoteControlAtStartup = __esm(() => {
@@ -564424,22 +564675,27 @@ function migrateSonnet1mToSonnet45() {
564424
564675
  if (config5.sonnet1m45MigrationComplete) {
564425
564676
  return;
564426
564677
  }
564427
- const model = getSettingsForSource("userSettings")?.model;
564428
- if (model === "sonnet[1m]") {
564429
- updateSettingsForSource("userSettings", {
564430
- model: "sonnet-4-5-20250929[1m]"
564431
- });
564432
- }
564433
- const override = getMainLoopModelOverride();
564434
- if (override === "sonnet[1m]") {
564435
- setMainLoopModelOverride("sonnet-4-5-20250929[1m]");
564678
+ try {
564679
+ const model = getSettingsForSource("userSettings")?.model;
564680
+ if (model === "sonnet[1m]") {
564681
+ updateSettingsForSource("userSettings", {
564682
+ model: "sonnet-4-5-20250929[1m]"
564683
+ });
564684
+ }
564685
+ const override = getMainLoopModelOverride();
564686
+ if (override === "sonnet[1m]") {
564687
+ setMainLoopModelOverride("sonnet-4-5-20250929[1m]");
564688
+ }
564689
+ saveGlobalConfig((current) => ({
564690
+ ...current,
564691
+ sonnet1m45MigrationComplete: true
564692
+ }));
564693
+ } catch (error49) {
564694
+ logError2(new Error(`Failed to migrate sonnet[1m] to sonnet-4-5-20250929[1m]: ${error49}`));
564436
564695
  }
564437
- saveGlobalConfig((current) => ({
564438
- ...current,
564439
- sonnet1m45MigrationComplete: true
564440
- }));
564441
564696
  }
564442
564697
  var init_migrateSonnet1mToSonnet45 = __esm(() => {
564698
+ init_log3();
564443
564699
  init_state();
564444
564700
  init_config();
564445
564701
  init_settings2();
@@ -564450,32 +564706,29 @@ function migrateSonnet45ToSonnet46() {
564450
564706
  if (getAPIProvider() !== "firstParty") {
564451
564707
  return;
564452
564708
  }
564453
- if (!isProSubscriber() && !isMaxSubscriber() && !isTeamPremiumSubscriber()) {
564709
+ const model = getSettingsForSource("userSettings")?.model;
564710
+ if (typeof model !== "string") {
564454
564711
  return;
564455
564712
  }
564456
- const model = getSettingsForSource("userSettings")?.model;
564457
- if (model !== "claude-sonnet-4-5-20250929" && model !== "claude-sonnet-4-5-20250929[1m]" && model !== "sonnet-4-5-20250929" && model !== "sonnet-4-5-20250929[1m]") {
564713
+ const match = model.match(/^(?:claude-)?(sonnet-4-5-20250929)(?:\[(.+?)\])?$/);
564714
+ if (!match) {
564458
564715
  return;
564459
564716
  }
564460
- const has1m = model.endsWith("[1m]");
564717
+ const suffix = match[2] ? `[${match[2]}]` : "";
564461
564718
  updateSettingsForSource("userSettings", {
564462
- model: has1m ? "sonnet[1m]" : "sonnet"
564719
+ model: suffix ? `sonnet${suffix}` : "sonnet"
564463
564720
  });
564464
- const config5 = getGlobalConfig();
564465
- if (config5.numStartups > 1) {
564466
- saveGlobalConfig((current) => ({
564467
- ...current,
564468
- sonnet45To46MigrationTimestamp: Date.now()
564469
- }));
564470
- }
564721
+ saveGlobalConfig((current) => ({
564722
+ ...current,
564723
+ sonnet45To46MigrationTimestamp: Date.now()
564724
+ }));
564471
564725
  logEvent("tengu_sonnet45_to_46_migration", {
564472
564726
  from_model: model,
564473
- has_1m: has1m
564727
+ has_1m: suffix === "[1m]"
564474
564728
  });
564475
564729
  }
564476
564730
  var init_migrateSonnet45ToSonnet46 = __esm(() => {
564477
564731
  init_analytics();
564478
- init_auth();
564479
564732
  init_config();
564480
564733
  init_providers();
564481
564734
  init_settings2();
@@ -564505,8 +564758,8 @@ function resetProToOpusDefault() {
564505
564758
  logEvent("tengu_reset_pro_to_opus_default", { skipped: true });
564506
564759
  return;
564507
564760
  }
564508
- const settings = getSettings_DEPRECATED();
564509
- if (settings?.model === undefined) {
564761
+ const userSettings = getSettingsForSource("userSettings");
564762
+ if (userSettings?.model === undefined) {
564510
564763
  const opusProMigrationTimestamp = Date.now();
564511
564764
  saveGlobalConfig((current) => ({
564512
564765
  ...current,