@massa-ai/mcp-client 1.36.0 → 1.38.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/config-cli.js +688 -562
  2. package/dist/index.js +335 -274
  3. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -26159,7 +26159,8 @@ var init_config = __esm(() => {
26159
26159
  },
26160
26160
  logging: {
26161
26161
  level: process.env.LOG_LEVEL || fileConfig.logging?.level || "info",
26162
- enableMetrics: process.env.ENABLE_METRICS === "true" || process.env.ENABLE_METRICS === undefined && !!fileConfig.logging?.enableMetrics
26162
+ enableMetrics: process.env.ENABLE_METRICS === "true" || process.env.ENABLE_METRICS === undefined && !!fileConfig.logging?.enableMetrics,
26163
+ file: process.env.MASSA_AI_LOG_FILE || fileConfig.logging?.file || undefined
26163
26164
  },
26164
26165
  synapse: {
26165
26166
  enabled: process.env.SYNAPSE_ENABLED !== "false",
@@ -26313,20 +26314,25 @@ var init_types2 = __esm(() => {
26313
26314
  var init_interfaces = () => {};
26314
26315
 
26315
26316
  // ../../packages/shared/dist/utils/logger.js
26317
+ import fs2 from "fs";
26318
+
26316
26319
  class Logger {
26317
26320
  _level;
26318
26321
  _enableMetrics;
26322
+ _logFilePath;
26319
26323
  _initialized = false;
26320
26324
  constructor() {}
26321
26325
  ensureInitialized() {
26322
26326
  if (!this._initialized) {
26323
26327
  try {
26324
- const configLevel = config2.get("logging").level;
26325
- this._level = this.parseLogLevel(configLevel);
26326
- this._enableMetrics = config2.get("logging").enableMetrics;
26328
+ const loggingConfig = config2.get("logging");
26329
+ this._level = this.parseLogLevel(loggingConfig.level);
26330
+ this._enableMetrics = loggingConfig.enableMetrics;
26331
+ this._logFilePath = loggingConfig.file;
26327
26332
  } catch {
26328
26333
  this._level = LogLevel.INFO;
26329
26334
  this._enableMetrics = false;
26335
+ this._logFilePath = undefined;
26330
26336
  }
26331
26337
  this._initialized = true;
26332
26338
  }
@@ -26339,6 +26345,10 @@ class Logger {
26339
26345
  this.ensureInitialized();
26340
26346
  return this._enableMetrics;
26341
26347
  }
26348
+ get logFilePath() {
26349
+ this.ensureInitialized();
26350
+ return this._logFilePath;
26351
+ }
26342
26352
  parseLogLevel(level) {
26343
26353
  const levels = {
26344
26354
  debug: LogLevel.DEBUG,
@@ -26358,6 +26368,13 @@ class Logger {
26358
26368
  }
26359
26369
  write(message, _level) {
26360
26370
  console.error(message);
26371
+ const filePath = this.logFilePath;
26372
+ if (filePath) {
26373
+ try {
26374
+ fs2.appendFileSync(filePath, message + `
26375
+ `);
26376
+ } catch {}
26377
+ }
26361
26378
  }
26362
26379
  debug(message, meta3) {
26363
26380
  if (this.shouldLog(LogLevel.DEBUG)) {
@@ -26767,7 +26784,7 @@ var init_hosts = __esm(() => {
26767
26784
  });
26768
26785
 
26769
26786
  // ../../packages/shared/dist/profile-switch/state.js
26770
- import fs2 from "fs";
26787
+ import fs3 from "fs";
26771
26788
  import path6 from "path";
26772
26789
  function namedError(name, message) {
26773
26790
  const err = new InstallStateError(message);
@@ -26794,7 +26811,7 @@ function validateShape(raw2, filePath) {
26794
26811
  function readInstallState(filePath) {
26795
26812
  let text;
26796
26813
  try {
26797
- text = fs2.readFileSync(filePath, "utf-8");
26814
+ text = fs3.readFileSync(filePath, "utf-8");
26798
26815
  } catch (err) {
26799
26816
  const code = err.code;
26800
26817
  if (code === "ENOENT")
@@ -26814,8 +26831,8 @@ function writeInstallState(filePath, state) {
26814
26831
  const text = `${JSON.stringify(validated, null, 2)}
26815
26832
  `;
26816
26833
  try {
26817
- fs2.mkdirSync(path6.dirname(filePath), { recursive: true });
26818
- fs2.writeFileSync(filePath, text);
26834
+ fs3.mkdirSync(path6.dirname(filePath), { recursive: true });
26835
+ fs3.writeFileSync(filePath, text);
26819
26836
  } catch (err) {
26820
26837
  throw UnwritableInstallStateError(filePath, err.message);
26821
26838
  }
@@ -26842,7 +26859,7 @@ var init_state = __esm(() => {
26842
26859
  });
26843
26860
 
26844
26861
  // ../../packages/shared/dist/profile-switch/lock.js
26845
- import fs3 from "fs";
26862
+ import fs4 from "fs";
26846
26863
  import path7 from "path";
26847
26864
  import os4 from "os";
26848
26865
  import crypto3 from "crypto";
@@ -26855,7 +26872,7 @@ function namedError2(name, message) {
26855
26872
  function readOwner(ownerPath) {
26856
26873
  let raw2;
26857
26874
  try {
26858
- raw2 = JSON.parse(fs3.readFileSync(ownerPath, "utf-8"));
26875
+ raw2 = JSON.parse(fs4.readFileSync(ownerPath, "utf-8"));
26859
26876
  } catch {
26860
26877
  return null;
26861
26878
  }
@@ -26871,7 +26888,7 @@ function releaseIfOwned(lockDir, ownerPath, token) {
26871
26888
  const owner = readOwner(ownerPath);
26872
26889
  if (owner === null || owner.token !== token)
26873
26890
  return;
26874
- fs3.rmSync(lockDir, { recursive: true, force: true });
26891
+ fs4.rmSync(lockDir, { recursive: true, force: true });
26875
26892
  }
26876
26893
  function acquireLock(stateFilePath, options = {}) {
26877
26894
  const lockDir = `${stateFilePath}.switch.lock`;
@@ -26880,11 +26897,11 @@ function acquireLock(stateFilePath, options = {}) {
26880
26897
  const identity = options.identity ?? DEFAULT_IDENTITY;
26881
26898
  const staleAfterMs = options.staleAfterMs ?? DEFAULT_STALE_AFTER_MS;
26882
26899
  const createFresh = () => {
26883
- fs3.mkdirSync(lockDir);
26900
+ fs4.mkdirSync(lockDir);
26884
26901
  const pid = identity.pid();
26885
26902
  const startedAt = identity.processStart(pid);
26886
26903
  if (startedAt == null) {
26887
- fs3.rmSync(lockDir, { recursive: true, force: true });
26904
+ fs4.rmSync(lockDir, { recursive: true, force: true });
26888
26905
  throw LockAcquireError(lockDir, "could not determine this process's start-time identity");
26889
26906
  }
26890
26907
  const token = crypto3.randomUUID();
@@ -26895,8 +26912,8 @@ function acquireLock(stateFilePath, options = {}) {
26895
26912
  token,
26896
26913
  timestamp: clock.now()
26897
26914
  };
26898
- fs3.mkdirSync(path7.dirname(ownerPath), { recursive: true });
26899
- fs3.writeFileSync(ownerPath, JSON.stringify(record3));
26915
+ fs4.mkdirSync(path7.dirname(ownerPath), { recursive: true });
26916
+ fs4.writeFileSync(ownerPath, JSON.stringify(record3));
26900
26917
  return { lockDir, release: () => releaseIfOwned(lockDir, ownerPath, token) };
26901
26918
  };
26902
26919
  try {
@@ -26911,11 +26928,11 @@ function acquireLock(stateFilePath, options = {}) {
26911
26928
  throw LockHeldError(lockDir);
26912
26929
  const reclaimDir = `${lockDir}.reclaim.${owner.token}`;
26913
26930
  try {
26914
- fs3.renameSync(lockDir, reclaimDir);
26931
+ fs4.renameSync(lockDir, reclaimDir);
26915
26932
  } catch {
26916
26933
  throw LockHeldError(lockDir);
26917
26934
  }
26918
- fs3.rmSync(reclaimDir, { recursive: true, force: true });
26935
+ fs4.rmSync(reclaimDir, { recursive: true, force: true });
26919
26936
  try {
26920
26937
  return createFresh();
26921
26938
  } catch {
@@ -26949,7 +26966,7 @@ var init_lock = __esm(() => {
26949
26966
  });
26950
26967
 
26951
26968
  // ../../packages/shared/dist/profile-switch/engine.js
26952
- import fs4 from "fs";
26969
+ import fs5 from "fs";
26953
26970
  import path8 from "path";
26954
26971
  import os5 from "os";
26955
26972
  import crypto4 from "crypto";
@@ -26983,7 +27000,7 @@ function listProfiles(opts = {}) {
26983
27000
  availableProfiles: []
26984
27001
  };
26985
27002
  }
26986
- const installed = fs4.existsSync(layout.activeDir);
27003
+ const installed = fs5.existsSync(layout.activeDir);
26987
27004
  const availableProfiles = listVariantProfiles(layout);
26988
27005
  const platform = state.platforms[host];
26989
27006
  return {
@@ -26999,9 +27016,9 @@ function listProfiles(opts = {}) {
26999
27016
  return { hosts };
27000
27017
  }
27001
27018
  function listVariantProfiles(layout) {
27002
- if (!fs4.existsSync(layout.variantsRoot))
27019
+ if (!fs5.existsSync(layout.variantsRoot))
27003
27020
  return [];
27004
- return fs4.readdirSync(layout.variantsRoot, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => e.name).sort();
27021
+ return fs5.readdirSync(layout.variantsRoot, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => e.name).sort();
27005
27022
  }
27006
27023
  function matchesGlob(filename, glob) {
27007
27024
  const starIdx = glob.indexOf("*");
@@ -27014,32 +27031,32 @@ function matchesGlob(filename, glob) {
27014
27031
  function assertStateWritable(stateFilePath) {
27015
27032
  const dir = path8.dirname(stateFilePath);
27016
27033
  try {
27017
- fs4.mkdirSync(dir, { recursive: true });
27034
+ fs5.mkdirSync(dir, { recursive: true });
27018
27035
  } catch (err) {
27019
27036
  throw UnwritableInstallStateError(stateFilePath, err.message);
27020
27037
  }
27021
- const checkPath = fs4.existsSync(stateFilePath) ? stateFilePath : dir;
27038
+ const checkPath = fs5.existsSync(stateFilePath) ? stateFilePath : dir;
27022
27039
  try {
27023
- fs4.accessSync(checkPath, fs4.constants.W_OK);
27040
+ fs5.accessSync(checkPath, fs5.constants.W_OK);
27024
27041
  } catch (err) {
27025
27042
  throw UnwritableInstallStateError(stateFilePath, err.message);
27026
27043
  }
27027
27044
  }
27028
27045
  function copyFileRouteVariant(layout, variantDir) {
27029
- fs4.mkdirSync(layout.activeDir, { recursive: true });
27046
+ fs5.mkdirSync(layout.activeDir, { recursive: true });
27030
27047
  let changed = 0;
27031
- for (const entry of fs4.readdirSync(variantDir, { withFileTypes: true })) {
27048
+ for (const entry of fs5.readdirSync(variantDir, { withFileTypes: true })) {
27032
27049
  if (!entry.isFile() || !matchesGlob(entry.name, layout.activeGlob))
27033
27050
  continue;
27034
- fs4.copyFileSync(path8.join(variantDir, entry.name), path8.join(layout.activeDir, entry.name));
27051
+ fs5.copyFileSync(path8.join(variantDir, entry.name), path8.join(layout.activeDir, entry.name));
27035
27052
  changed++;
27036
27053
  }
27037
27054
  return changed;
27038
27055
  }
27039
27056
  function repointOpencodeVariant(layout, variantDir) {
27040
- fs4.mkdirSync(layout.activeDir, { recursive: true });
27057
+ fs5.mkdirSync(layout.activeDir, { recursive: true });
27041
27058
  let changed = 0;
27042
- for (const entry of fs4.readdirSync(variantDir, { withFileTypes: true })) {
27059
+ for (const entry of fs5.readdirSync(variantDir, { withFileTypes: true })) {
27043
27060
  if (!entry.isFile() || !matchesGlob(entry.name, layout.activeGlob))
27044
27061
  continue;
27045
27062
  const dest = path8.join(layout.activeDir, entry.name);
@@ -27047,15 +27064,15 @@ function repointOpencodeVariant(layout, variantDir) {
27047
27064
  let destExists = true;
27048
27065
  let destIsSymlink = false;
27049
27066
  try {
27050
- destIsSymlink = fs4.lstatSync(dest).isSymbolicLink();
27067
+ destIsSymlink = fs5.lstatSync(dest).isSymbolicLink();
27051
27068
  } catch {
27052
27069
  destExists = false;
27053
27070
  }
27054
27071
  if (destExists && !destIsSymlink)
27055
27072
  continue;
27056
27073
  const tmp = `${dest}.massa-ai-switch.${crypto4.randomUUID()}`;
27057
- fs4.symlinkSync(target, tmp);
27058
- fs4.renameSync(tmp, dest);
27074
+ fs5.symlinkSync(target, tmp);
27075
+ fs5.renameSync(tmp, dest);
27059
27076
  changed++;
27060
27077
  }
27061
27078
  return changed;
@@ -27077,13 +27094,13 @@ function switchProfile(opts) {
27077
27094
  if (fileHosts.length === 0) {
27078
27095
  return { profile: opts.profile, dryRun, hosts: orderRows(universe, skipRows), restartRequired: false };
27079
27096
  }
27080
- const installedFileHosts = fileHosts.filter((h) => fs4.existsSync(h.layout.activeDir));
27097
+ const installedFileHosts = fileHosts.filter((h) => fs5.existsSync(h.layout.activeDir));
27081
27098
  if (installedFileHosts.length === 0)
27082
27099
  throw NoHostsDetectedError();
27083
27100
  const withAvailability = fileHosts.map((h) => {
27084
- const variantsRootExists = fs4.existsSync(h.layout.variantsRoot);
27101
+ const variantsRootExists = fs5.existsSync(h.layout.variantsRoot);
27085
27102
  const variantDir = h.layout.variantDir(opts.profile);
27086
- const available = variantsRootExists && fs4.existsSync(variantDir) && fs4.statSync(variantDir).isDirectory();
27103
+ const available = variantsRootExists && fs5.existsSync(variantDir) && fs5.statSync(variantDir).isDirectory();
27087
27104
  return { ...h, variantsRootExists, variantDir, available };
27088
27105
  });
27089
27106
  if (!withAvailability.some((h) => h.available)) {
@@ -31297,8 +31314,8 @@ var init_esm4 = __esm(() => {
31297
31314
  #children;
31298
31315
  nocase;
31299
31316
  #fs;
31300
- constructor(cwd = process.cwd(), pathImpl, sep2, { nocase, childrenCacheSize = 16 * 1024, fs: fs5 = defaultFS } = {}) {
31301
- this.#fs = fsFromOption(fs5);
31317
+ constructor(cwd = process.cwd(), pathImpl, sep2, { nocase, childrenCacheSize = 16 * 1024, fs: fs6 = defaultFS } = {}) {
31318
+ this.#fs = fsFromOption(fs6);
31302
31319
  if (cwd instanceof URL || cwd.startsWith("file://")) {
31303
31320
  cwd = fileURLToPath(cwd);
31304
31321
  }
@@ -31773,8 +31790,8 @@ var init_esm4 = __esm(() => {
31773
31790
  parseRootPath(dir) {
31774
31791
  return win32.parse(dir).root.toUpperCase();
31775
31792
  }
31776
- newRoot(fs5) {
31777
- return new PathWin32(this.rootPath, IFDIR, undefined, this.roots, this.nocase, this.childrenCache(), { fs: fs5 });
31793
+ newRoot(fs6) {
31794
+ return new PathWin32(this.rootPath, IFDIR, undefined, this.roots, this.nocase, this.childrenCache(), { fs: fs6 });
31778
31795
  }
31779
31796
  isAbsolute(p) {
31780
31797
  return p.startsWith("/") || p.startsWith("\\") || /^[a-z]:(\/|\\)/i.test(p);
@@ -31790,8 +31807,8 @@ var init_esm4 = __esm(() => {
31790
31807
  parseRootPath(_dir) {
31791
31808
  return "/";
31792
31809
  }
31793
- newRoot(fs5) {
31794
- return new PathPosix(this.rootPath, IFDIR, undefined, this.roots, this.nocase, this.childrenCache(), { fs: fs5 });
31810
+ newRoot(fs6) {
31811
+ return new PathPosix(this.rootPath, IFDIR, undefined, this.roots, this.nocase, this.childrenCache(), { fs: fs6 });
31795
31812
  }
31796
31813
  isAbsolute(p) {
31797
31814
  return p.startsWith("/");
@@ -33197,7 +33214,7 @@ var init_capture_policy = __esm(() => {
33197
33214
  });
33198
33215
 
33199
33216
  // ../../packages/core/dist/services/search/ignore-patterns.js
33200
- import fs5 from "fs/promises";
33217
+ import fs6 from "fs/promises";
33201
33218
  import path10 from "path";
33202
33219
  function buildExtensionGlob(extensions) {
33203
33220
  return extensions.map((ext2) => `**/*${ext2}`);
@@ -33222,7 +33239,7 @@ async function loadProjectIgnore(projectPath) {
33222
33239
  ig.add(DEFAULT_IGNORES);
33223
33240
  try {
33224
33241
  const gitignorePath = path10.join(projectPath, ".gitignore");
33225
- const gitignoreContent = await fs5.readFile(gitignorePath, "utf8");
33242
+ const gitignoreContent = await fs6.readFile(gitignorePath, "utf8");
33226
33243
  const rules = gitignoreContent.split(`
33227
33244
  `).map((line) => line.trim()).filter((line) => line && !line.startsWith("#"));
33228
33245
  ig.add(rules);
@@ -34818,15 +34835,15 @@ var require_pg_connection_string = __commonJS((exports, module) => {
34818
34835
  if (config3.sslnegotiation === "direct" && config3.ssl === undefined) {
34819
34836
  config3.ssl = true;
34820
34837
  }
34821
- const fs6 = config3.sslcert || config3.sslkey || config3.sslrootcert ? __require("fs") : null;
34838
+ const fs7 = config3.sslcert || config3.sslkey || config3.sslrootcert ? __require("fs") : null;
34822
34839
  if (config3.sslcert) {
34823
- config3.ssl.cert = fs6.readFileSync(config3.sslcert).toString();
34840
+ config3.ssl.cert = fs7.readFileSync(config3.sslcert).toString();
34824
34841
  }
34825
34842
  if (config3.sslkey) {
34826
- config3.ssl.key = fs6.readFileSync(config3.sslkey).toString();
34843
+ config3.ssl.key = fs7.readFileSync(config3.sslkey).toString();
34827
34844
  }
34828
34845
  if (config3.sslrootcert) {
34829
- config3.ssl.ca = fs6.readFileSync(config3.sslrootcert).toString();
34846
+ config3.ssl.ca = fs7.readFileSync(config3.sslrootcert).toString();
34830
34847
  }
34831
34848
  if (options.useLibpqCompat && config3.uselibpqcompat) {
34832
34849
  throw new Error("Both useLibpqCompat and uselibpqcompat are set. Please use only one of them.");
@@ -36705,15 +36722,15 @@ var require_helper = __commonJS((exports, module) => {
36705
36722
  // ../../node_modules/pgpass/lib/index.js
36706
36723
  var require_lib = __commonJS((exports, module) => {
36707
36724
  var path11 = __require("path");
36708
- var fs6 = __require("fs");
36725
+ var fs7 = __require("fs");
36709
36726
  var helper = require_helper();
36710
36727
  module.exports = function(connInfo, cb) {
36711
36728
  var file2 = helper.getFileName();
36712
- fs6.stat(file2, function(err, stat) {
36729
+ fs7.stat(file2, function(err, stat) {
36713
36730
  if (err || !helper.usePgPass(stat, file2)) {
36714
36731
  return cb(undefined);
36715
36732
  }
36716
- var st = fs6.createReadStream(file2);
36733
+ var st = fs7.createReadStream(file2);
36717
36734
  helper.getPassword(connInfo, st, cb);
36718
36735
  });
36719
36736
  };
@@ -38243,6 +38260,89 @@ var init_db_connection = __esm(() => {
38243
38260
  init_config();
38244
38261
  });
38245
38262
 
38263
+ // ../../packages/core/dist/kernel/sanitize/credential-scrub.js
38264
+ function markerFor(id) {
38265
+ return `[REDACTED:${id}]`;
38266
+ }
38267
+ function fullMatchRule(id, pattern) {
38268
+ const marker = markerFor(id);
38269
+ return {
38270
+ id,
38271
+ replace(text) {
38272
+ let count = 0;
38273
+ const replaced = text.replace(pattern, () => {
38274
+ count++;
38275
+ return marker;
38276
+ });
38277
+ return { text: replaced, count };
38278
+ }
38279
+ };
38280
+ }
38281
+ function scrubCredentials(payloadJson) {
38282
+ const redactions = {};
38283
+ for (const id of RULE_IDS)
38284
+ redactions[id] = 0;
38285
+ let text = payloadJson;
38286
+ for (const rule of RULES) {
38287
+ const { text: next, count } = rule.replace(text);
38288
+ text = next;
38289
+ redactions[rule.id] += count;
38290
+ }
38291
+ const total = Object.values(redactions).reduce((sum, n) => sum + n, 0);
38292
+ return {
38293
+ sanitized: text,
38294
+ redactions,
38295
+ total
38296
+ };
38297
+ }
38298
+ var PEM_PATTERN, JWT_PATTERN, AWS_KEY_PATTERN, SK_KEY_PATTERN, GITHUB_TOKEN_PATTERN, SLACK_TOKEN_PATTERN, BEARER_PATTERN, RULES, RULE_IDS;
38299
+ var init_credential_scrub = __esm(() => {
38300
+ PEM_PATTERN = /-----BEGIN [A-Z ]{0,32}PRIVATE KEY-----[\s\S]{0,8192}?-----END [A-Z ]{0,32}PRIVATE KEY-----/g;
38301
+ JWT_PATTERN = /\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g;
38302
+ AWS_KEY_PATTERN = /\b(?:AKIA|ASIA|ABIA|ACCA)[A-Z0-9]{16}\b/g;
38303
+ SK_KEY_PATTERN = /\bsk-[A-Za-z0-9_-]{20,}\b/g;
38304
+ GITHUB_TOKEN_PATTERN = /\bgh[pousr]_[A-Za-z0-9]{36,}\b|\bgithub_pat_[A-Za-z0-9_]{22,}\b/g;
38305
+ SLACK_TOKEN_PATTERN = /\bxox[baprs]-[A-Za-z0-9-]{18,}\b/g;
38306
+ BEARER_PATTERN = /(Bearer\s+)([A-Za-z0-9._~+/=-]{20,})/g;
38307
+ RULES = [
38308
+ fullMatchRule("pem", PEM_PATTERN),
38309
+ fullMatchRule("jwt", JWT_PATTERN),
38310
+ fullMatchRule("aws-key", AWS_KEY_PATTERN),
38311
+ fullMatchRule("sk-key", SK_KEY_PATTERN),
38312
+ fullMatchRule("github-token", GITHUB_TOKEN_PATTERN),
38313
+ fullMatchRule("slack-token", SLACK_TOKEN_PATTERN),
38314
+ {
38315
+ id: "bearer",
38316
+ replace(text) {
38317
+ let count = 0;
38318
+ const replaced = text.replace(BEARER_PATTERN, (_m, prefix) => {
38319
+ count++;
38320
+ return `${prefix}${markerFor("bearer")}`;
38321
+ });
38322
+ return { text: replaced, count };
38323
+ }
38324
+ }
38325
+ ];
38326
+ RULE_IDS = RULES.map((r) => r.id);
38327
+ });
38328
+
38329
+ // ../../packages/core/dist/kernel/sanitize/safe-error-summary.js
38330
+ function safeErrorSummary(error51) {
38331
+ if (error51 instanceof Error) {
38332
+ return {
38333
+ name: error51.name,
38334
+ message: scrubCredentials(error51.message).sanitized
38335
+ };
38336
+ }
38337
+ return {
38338
+ name: "UnknownError",
38339
+ message: scrubCredentials(String(error51)).sanitized
38340
+ };
38341
+ }
38342
+ var init_safe_error_summary = __esm(() => {
38343
+ init_credential_scrub();
38344
+ });
38345
+
38246
38346
  // ../../packages/core/dist/kernel/alias-resolver.js
38247
38347
  class ProjectIdentityAliasResolver {
38248
38348
  ttlMs;
@@ -38268,9 +38368,7 @@ class ProjectIdentityAliasResolver {
38268
38368
  this.cache.set(projectId, { canonical, expiresAt: this.now() + this.ttlMs });
38269
38369
  return canonical;
38270
38370
  } catch (error51) {
38271
- logger.warn("[project-identity] alias resolution failed; using original id (sanitized)", {
38272
- name: error51 instanceof Error ? error51.name : "unknown"
38273
- });
38371
+ logger.warn("[project-identity] alias resolution failed; using original id", safeErrorSummary(error51));
38274
38372
  return projectId;
38275
38373
  }
38276
38374
  }
@@ -38327,10 +38425,11 @@ var DEFAULT_TTL_MS = 30000, DEFAULT_RESOLVE_TIMEOUT_MS = 250, sharedResolver = n
38327
38425
  var init_alias_resolver = __esm(() => {
38328
38426
  init_dist();
38329
38427
  init_db_connection();
38428
+ init_safe_error_summary();
38330
38429
  });
38331
38430
 
38332
38431
  // ../../packages/core/dist/services/search/index-manager.js
38333
- import fs6 from "fs";
38432
+ import fs7 from "fs";
38334
38433
  import path11 from "path";
38335
38434
 
38336
38435
  class IndexManager {
@@ -38426,7 +38525,7 @@ class IndexManager {
38426
38525
  for (const filePath of indexedFiles) {
38427
38526
  const fullPath = path11.join(projectPath, filePath);
38428
38527
  try {
38429
- const stat = await fs6.promises.stat(fullPath);
38528
+ const stat = await fs7.promises.stat(fullPath);
38430
38529
  fileMetadata[filePath] = {
38431
38530
  path: filePath,
38432
38531
  mtime: stat.mtimeMs,
@@ -38479,7 +38578,7 @@ class IndexManager {
38479
38578
  }
38480
38579
  const fullPath = path11.join(projectPath, match2);
38481
38580
  try {
38482
- const stat = await fs6.promises.stat(fullPath);
38581
+ const stat = await fs7.promises.stat(fullPath);
38483
38582
  files.set(match2, {
38484
38583
  path: match2,
38485
38584
  mtime: stat.mtimeMs,
@@ -41732,7 +41831,7 @@ var require_auth_config = __commonJS((exports, module) => {
41732
41831
  writeAuthConfig: () => writeAuthConfig
41733
41832
  });
41734
41833
  module.exports = __toCommonJS2(auth_config_exports);
41735
- var fs7 = __toESM2(__require("fs"));
41834
+ var fs8 = __toESM2(__require("fs"));
41736
41835
  var path12 = __toESM2(__require("path"));
41737
41836
  var import_token_util = require_token_util();
41738
41837
  function getAuthConfigPath() {
@@ -41745,10 +41844,10 @@ var require_auth_config = __commonJS((exports, module) => {
41745
41844
  function readAuthConfig() {
41746
41845
  try {
41747
41846
  const authPath = getAuthConfigPath();
41748
- if (!fs7.existsSync(authPath)) {
41847
+ if (!fs8.existsSync(authPath)) {
41749
41848
  return null;
41750
41849
  }
41751
- const content = fs7.readFileSync(authPath, "utf8");
41850
+ const content = fs8.readFileSync(authPath, "utf8");
41752
41851
  if (!content) {
41753
41852
  return null;
41754
41853
  }
@@ -41760,10 +41859,10 @@ var require_auth_config = __commonJS((exports, module) => {
41760
41859
  function writeAuthConfig(config3) {
41761
41860
  const authPath = getAuthConfigPath();
41762
41861
  const authDir = path12.dirname(authPath);
41763
- if (!fs7.existsSync(authDir)) {
41764
- fs7.mkdirSync(authDir, { mode: 504, recursive: true });
41862
+ if (!fs8.existsSync(authDir)) {
41863
+ fs8.mkdirSync(authDir, { mode: 504, recursive: true });
41765
41864
  }
41766
- fs7.writeFileSync(authPath, JSON.stringify(config3, null, 2), { mode: 384 });
41865
+ fs8.writeFileSync(authPath, JSON.stringify(config3, null, 2), { mode: 384 });
41767
41866
  }
41768
41867
  function isValidAccessToken(authConfig, expirationBufferMs = 0) {
41769
41868
  if (!authConfig.token)
@@ -41939,7 +42038,7 @@ var require_token_util = __commonJS((exports, module) => {
41939
42038
  });
41940
42039
  module.exports = __toCommonJS2(token_util_exports);
41941
42040
  var path12 = __toESM2(__require("path"));
41942
- var fs7 = __toESM2(__require("fs"));
42041
+ var fs8 = __toESM2(__require("fs"));
41943
42042
  var import_token_error = require_token_error();
41944
42043
  var import_token_io = require_token_io();
41945
42044
  var import_auth_config = require_auth_config();
@@ -42020,10 +42119,10 @@ var require_token_util = __commonJS((exports, module) => {
42020
42119
  throw new import_token_error.VercelOidcTokenError("Unable to find project root directory. Have you linked your project with `vc link?`");
42021
42120
  }
42022
42121
  const prjPath = path12.join(dir, ".vercel", "project.json");
42023
- if (!fs7.existsSync(prjPath)) {
42122
+ if (!fs8.existsSync(prjPath)) {
42024
42123
  throw new import_token_error.VercelOidcTokenError("project.json not found, have you linked your project with `vc link?`");
42025
42124
  }
42026
- const prj = JSON.parse(fs7.readFileSync(prjPath, "utf8"));
42125
+ const prj = JSON.parse(fs8.readFileSync(prjPath, "utf8"));
42027
42126
  if (typeof prj.projectId !== "string" && typeof prj.orgId !== "string") {
42028
42127
  throw new TypeError("Expected a string-valued projectId property. Try running `vc link` to re-link your project.");
42029
42128
  }
@@ -42036,9 +42135,9 @@ var require_token_util = __commonJS((exports, module) => {
42036
42135
  }
42037
42136
  const tokenPath = path12.join(dir, "com.vercel.token", `${projectId}.json`);
42038
42137
  const tokenJson = JSON.stringify(token);
42039
- fs7.mkdirSync(path12.dirname(tokenPath), { mode: 504, recursive: true });
42040
- fs7.writeFileSync(tokenPath, tokenJson);
42041
- fs7.chmodSync(tokenPath, 432);
42138
+ fs8.mkdirSync(path12.dirname(tokenPath), { mode: 504, recursive: true });
42139
+ fs8.writeFileSync(tokenPath, tokenJson);
42140
+ fs8.chmodSync(tokenPath, 432);
42042
42141
  return;
42043
42142
  }
42044
42143
  function loadToken(projectId) {
@@ -42047,10 +42146,10 @@ var require_token_util = __commonJS((exports, module) => {
42047
42146
  throw new import_token_error.VercelOidcTokenError("Unable to find user data directory. Please reach out to Vercel support.");
42048
42147
  }
42049
42148
  const tokenPath = path12.join(dir, "com.vercel.token", `${projectId}.json`);
42050
- if (!fs7.existsSync(tokenPath)) {
42149
+ if (!fs8.existsSync(tokenPath)) {
42051
42150
  return null;
42052
42151
  }
42053
- const token = JSON.parse(fs7.readFileSync(tokenPath, "utf8"));
42152
+ const token = JSON.parse(fs8.readFileSync(tokenPath, "utf8"));
42054
42153
  assertVercelOidcTokenResponse(token);
42055
42154
  return token;
42056
42155
  }
@@ -69480,26 +69579,26 @@ var require_process = __commonJS((exports, module) => {
69480
69579
 
69481
69580
  // ../../node_modules/detect-libc/lib/filesystem.js
69482
69581
  var require_filesystem = __commonJS((exports, module) => {
69483
- var fs7 = __require("fs");
69582
+ var fs8 = __require("fs");
69484
69583
  var LDD_PATH = "/usr/bin/ldd";
69485
69584
  var SELF_PATH = "/proc/self/exe";
69486
69585
  var MAX_LENGTH = 2048;
69487
69586
  var readFileSync2 = (path12) => {
69488
- const fd = fs7.openSync(path12, "r");
69587
+ const fd = fs8.openSync(path12, "r");
69489
69588
  const buffer = Buffer.alloc(MAX_LENGTH);
69490
- const bytesRead = fs7.readSync(fd, buffer, 0, MAX_LENGTH, 0);
69491
- fs7.close(fd, () => {});
69589
+ const bytesRead = fs8.readSync(fd, buffer, 0, MAX_LENGTH, 0);
69590
+ fs8.close(fd, () => {});
69492
69591
  return buffer.subarray(0, bytesRead);
69493
69592
  };
69494
69593
  var readFile = (path12) => new Promise((resolve4, reject) => {
69495
- fs7.open(path12, "r", (err, fd) => {
69594
+ fs8.open(path12, "r", (err, fd) => {
69496
69595
  if (err) {
69497
69596
  reject(err);
69498
69597
  } else {
69499
69598
  const buffer = Buffer.alloc(MAX_LENGTH);
69500
- fs7.read(fd, buffer, 0, MAX_LENGTH, 0, (_, bytesRead) => {
69599
+ fs8.read(fd, buffer, 0, MAX_LENGTH, 0, (_, bytesRead) => {
69501
69600
  resolve4(buffer.subarray(0, bytesRead));
69502
- fs7.close(fd, () => {});
69601
+ fs8.close(fd, () => {});
69503
69602
  });
69504
69603
  }
69505
69604
  });
@@ -106162,10 +106261,10 @@ Note that ${s.bold("include")} statements only accept relation fields.`, a;
106162
106261
  super(t, "P2023", r);
106163
106262
  }
106164
106263
  };
106165
- var fs7 = new WeakMap;
106264
+ var fs8 = new WeakMap;
106166
106265
  function Ep(e) {
106167
- let t = fs7.get(e);
106168
- return t || (t = Object.entries(e), fs7.set(e, t)), t;
106266
+ let t = fs8.get(e);
106267
+ return t || (t = Object.entries(e), fs8.set(e, t)), t;
106169
106268
  }
106170
106269
  function hs(e, t, r) {
106171
106270
  switch (t.type) {
@@ -114691,6 +114790,7 @@ var init_registry = __esm(() => {
114691
114790
  search_analytics: { storeId: "search_analytics", identityColumn: "project_id", mutable: true },
114692
114791
  search_events: { storeId: "search_events", identityColumn: "project_id", mutable: true },
114693
114792
  synapse_sessions: { storeId: "synapse_sessions", identityColumn: "workspace_id", mutable: true },
114793
+ managed_runs: { storeId: "managed_runs", identityColumn: "project_id", mutable: true },
114694
114794
  operation_log: { storeId: "operation_log", identityColumn: "project_id", mutable: false },
114695
114795
  project_identity_operations: {
114696
114796
  storeId: "project_identity_operations",
@@ -120974,6 +121074,89 @@ var init_reranker = __esm(() => {
120974
121074
  });
120975
121075
  });
120976
121076
 
121077
+ // ../../packages/core/dist/kernel/search-diagnostics.js
121078
+ function searchBackendUnavailable(component, cause) {
121079
+ return cause instanceof SearchServiceError ? cause : new SearchServiceError("SEARCH_BACKEND_UNAVAILABLE", component, { cause });
121080
+ }
121081
+ function storeCorruption(component, cause) {
121082
+ return cause instanceof SearchServiceError ? cause : new SearchServiceError("STORE_CORRUPTION", component, {
121083
+ cause,
121084
+ statusCode: 500
121085
+ });
121086
+ }
121087
+ function projectNotIndexed(projectId, message) {
121088
+ return new SearchServiceError("PROJECT_NOT_INDEXED", projectId, {
121089
+ message,
121090
+ statusCode: 404
121091
+ });
121092
+ }
121093
+ function recordSearchDegradation(code, component, projectId) {
121094
+ const degradation = {
121095
+ code,
121096
+ component,
121097
+ message: DEGRADATION_MESSAGES[code]
121098
+ };
121099
+ diagnostics.push({
121100
+ kind: "degradation",
121101
+ ...degradation,
121102
+ projectId,
121103
+ timestamp: new Date().toISOString()
121104
+ });
121105
+ if (diagnostics.length > MAX_DIAGNOSTICS) {
121106
+ diagnostics.splice(0, diagnostics.length - MAX_DIAGNOSTICS);
121107
+ }
121108
+ return degradation;
121109
+ }
121110
+ function recordSearchFailure(error51, projectId) {
121111
+ if (recordedFailures.has(error51))
121112
+ return;
121113
+ recordedFailures.add(error51);
121114
+ diagnostics.push({
121115
+ kind: "failure",
121116
+ code: error51.code,
121117
+ component: error51.component,
121118
+ message: error51.message,
121119
+ projectId,
121120
+ timestamp: new Date().toISOString()
121121
+ });
121122
+ if (diagnostics.length > MAX_DIAGNOSTICS) {
121123
+ diagnostics.splice(0, diagnostics.length - MAX_DIAGNOSTICS);
121124
+ }
121125
+ }
121126
+ function getSearchDiagnostics() {
121127
+ return diagnostics.map((diagnostic) => ({ ...diagnostic }));
121128
+ }
121129
+ function resetSearchDiagnosticsForTests() {
121130
+ diagnostics.length = 0;
121131
+ }
121132
+ var MAX_DIAGNOSTICS = 100, diagnostics, recordedFailures, DEGRADATION_MESSAGES, SearchServiceError;
121133
+ var init_search_diagnostics = __esm(() => {
121134
+ diagnostics = [];
121135
+ recordedFailures = new WeakSet;
121136
+ DEGRADATION_MESSAGES = {
121137
+ QUERY_UNDERSTANDING_UNAVAILABLE: "Query understanding was unavailable; original query used",
121138
+ TRIGRAM_UNAVAILABLE: "Trigram enrichment was unavailable",
121139
+ FUZZY_SEARCH_UNAVAILABLE: "Fuzzy enrichment was unavailable",
121140
+ PROXIMITY_RERANK_UNAVAILABLE: "Proximity reranking was unavailable; fused order preserved",
121141
+ GRAPH_AUGMENTATION_UNAVAILABLE: "Graph augmentation was unavailable",
121142
+ SYNAPSE_UNAVAILABLE: "Synapse enrichment was unavailable; stateless results used",
121143
+ SEARCH_AUDIT_UNAVAILABLE: "Search event auditing was unavailable",
121144
+ SEARCH_ANALYTICS_UNAVAILABLE: "Search analytics were unavailable"
121145
+ };
121146
+ SearchServiceError = class SearchServiceError extends Error {
121147
+ code;
121148
+ component;
121149
+ statusCode;
121150
+ constructor(code, component, options) {
121151
+ super(options?.message ?? (code === "STORE_CORRUPTION" ? "Stored data is invalid" : "A required search backend is unavailable"), options?.cause === undefined ? undefined : { cause: options.cause });
121152
+ this.code = code;
121153
+ this.component = component;
121154
+ this.name = "SearchServiceError";
121155
+ this.statusCode = options?.statusCode ?? 503;
121156
+ }
121157
+ };
121158
+ });
121159
+
120977
121160
  // ../../packages/core/dist/kernel/enum-validation.js
120978
121161
  function validateEnum(paramName, value, validValues) {
120979
121162
  if (typeof value !== "string" || !validValues.includes(value)) {
@@ -121082,7 +121265,7 @@ class SearchController {
121082
121265
  });
121083
121266
  const admission = await this.contextualSearch.checkSearchAdmission(projectId, projectPath);
121084
121267
  if (!admission.admitted) {
121085
- throw new Error(admission.error ?? `Project '${projectId}' is not indexed`);
121268
+ throw projectNotIndexed(projectId, admission.error ?? `Project '${projectId}' is not indexed`);
121086
121269
  }
121087
121270
  const staleWarning = admission.stale ?? null;
121088
121271
  let reindexInfo = null;
@@ -121306,6 +121489,7 @@ var init_search_controller = __esm(() => {
121306
121489
  init_contextual_search_rlm();
121307
121490
  init_event_bus();
121308
121491
  init_reranker();
121492
+ init_search_diagnostics();
121309
121493
  init_esm();
121310
121494
  init_filter_validation();
121311
121495
  });
@@ -121791,83 +121975,6 @@ var init_session_bias = __esm(() => {
121791
121975
  init_synapse();
121792
121976
  });
121793
121977
 
121794
- // ../../packages/core/dist/kernel/search-diagnostics.js
121795
- function searchBackendUnavailable(component, cause) {
121796
- return cause instanceof SearchServiceError ? cause : new SearchServiceError("SEARCH_BACKEND_UNAVAILABLE", component, { cause });
121797
- }
121798
- function storeCorruption(component, cause) {
121799
- return cause instanceof SearchServiceError ? cause : new SearchServiceError("STORE_CORRUPTION", component, {
121800
- cause,
121801
- statusCode: 500
121802
- });
121803
- }
121804
- function recordSearchDegradation(code, component, projectId) {
121805
- const degradation = {
121806
- code,
121807
- component,
121808
- message: DEGRADATION_MESSAGES[code]
121809
- };
121810
- diagnostics.push({
121811
- kind: "degradation",
121812
- ...degradation,
121813
- projectId,
121814
- timestamp: new Date().toISOString()
121815
- });
121816
- if (diagnostics.length > MAX_DIAGNOSTICS) {
121817
- diagnostics.splice(0, diagnostics.length - MAX_DIAGNOSTICS);
121818
- }
121819
- return degradation;
121820
- }
121821
- function recordSearchFailure(error51, projectId) {
121822
- if (recordedFailures.has(error51))
121823
- return;
121824
- recordedFailures.add(error51);
121825
- diagnostics.push({
121826
- kind: "failure",
121827
- code: error51.code,
121828
- component: error51.component,
121829
- message: error51.message,
121830
- projectId,
121831
- timestamp: new Date().toISOString()
121832
- });
121833
- if (diagnostics.length > MAX_DIAGNOSTICS) {
121834
- diagnostics.splice(0, diagnostics.length - MAX_DIAGNOSTICS);
121835
- }
121836
- }
121837
- function getSearchDiagnostics() {
121838
- return diagnostics.map((diagnostic) => ({ ...diagnostic }));
121839
- }
121840
- function resetSearchDiagnosticsForTests() {
121841
- diagnostics.length = 0;
121842
- }
121843
- var MAX_DIAGNOSTICS = 100, diagnostics, recordedFailures, DEGRADATION_MESSAGES, SearchServiceError;
121844
- var init_search_diagnostics = __esm(() => {
121845
- diagnostics = [];
121846
- recordedFailures = new WeakSet;
121847
- DEGRADATION_MESSAGES = {
121848
- QUERY_UNDERSTANDING_UNAVAILABLE: "Query understanding was unavailable; original query used",
121849
- TRIGRAM_UNAVAILABLE: "Trigram enrichment was unavailable",
121850
- FUZZY_SEARCH_UNAVAILABLE: "Fuzzy enrichment was unavailable",
121851
- PROXIMITY_RERANK_UNAVAILABLE: "Proximity reranking was unavailable; fused order preserved",
121852
- GRAPH_AUGMENTATION_UNAVAILABLE: "Graph augmentation was unavailable",
121853
- SYNAPSE_UNAVAILABLE: "Synapse enrichment was unavailable; stateless results used",
121854
- SEARCH_AUDIT_UNAVAILABLE: "Search event auditing was unavailable",
121855
- SEARCH_ANALYTICS_UNAVAILABLE: "Search analytics were unavailable"
121856
- };
121857
- SearchServiceError = class SearchServiceError extends Error {
121858
- code;
121859
- component;
121860
- statusCode;
121861
- constructor(code, component, options) {
121862
- super(code === "STORE_CORRUPTION" ? "Stored data is invalid" : "A required search backend is unavailable", options?.cause === undefined ? undefined : { cause: options.cause });
121863
- this.code = code;
121864
- this.component = component;
121865
- this.name = "SearchServiceError";
121866
- this.statusCode = options?.statusCode ?? 503;
121867
- }
121868
- };
121869
- });
121870
-
121871
121978
  // ../../packages/core/dist/services/search/hybrid-search.js
121872
121979
  async function search(deps, query, projectId, options = {}) {
121873
121980
  const maxResults = options.maxResults ?? 10;
@@ -123224,7 +123331,7 @@ var init_managed_run_repository_pg = __esm(() => {
123224
123331
  });
123225
123332
 
123226
123333
  // ../../packages/core/dist/services/search/project-indexer.js
123227
- import fs7 from "fs/promises";
123334
+ import fs8 from "fs/promises";
123228
123335
  import path13 from "path";
123229
123336
  import { randomUUID as randomUUID3 } from "crypto";
123230
123337
  async function runWithIndexLock(lockMap, projectId, work) {
@@ -123484,7 +123591,7 @@ async function checkSearchAdmission(deps, projectId, projectPath) {
123484
123591
  }
123485
123592
  async function indexFile(deps, filePath, projectId, projectRoot, centralityMap) {
123486
123593
  projectId = await getProjectIdentityAliasResolver().resolve(projectId);
123487
- const content = await fs7.readFile(filePath, "utf-8");
123594
+ const content = await fs8.readFile(filePath, "utf-8");
123488
123595
  const relativePath = path13.relative(projectRoot, filePath);
123489
123596
  const maxFileSize = config2.get("security").maxFileSize || 1024 * 1024;
123490
123597
  if (content.length > maxFileSize) {
@@ -124350,7 +124457,7 @@ function stripNul(content) {
124350
124457
  }
124351
124458
 
124352
124459
  // ../../packages/core/dist/services/etl/stages/discover.js
124353
- import fs8 from "fs/promises";
124460
+ import fs9 from "fs/promises";
124354
124461
  import path14 from "path";
124355
124462
  import { createHash as createHash5 } from "crypto";
124356
124463
 
@@ -124438,8 +124545,8 @@ class DiscoverStage {
124438
124545
  async processFile(ctx, relativePath, forceReindex) {
124439
124546
  const absolutePath = path14.join(ctx.projectPath, relativePath);
124440
124547
  try {
124441
- const stat = await fs8.stat(absolutePath);
124442
- const content = stripNul(await fs8.readFile(absolutePath, "utf-8"));
124548
+ const stat = await fs9.stat(absolutePath);
124549
+ const content = stripNul(await fs9.readFile(absolutePath, "utf-8"));
124443
124550
  const contentHash = createHash5("sha256").update(content).digest("hex");
124444
124551
  let needsReparse = forceReindex;
124445
124552
  if (!forceReindex) {
@@ -124483,7 +124590,7 @@ class DiscoverStage {
124483
124590
  }
124484
124591
  try {
124485
124592
  const gitignorePath = path14.join(projectPath, ".gitignore");
124486
- const gitignoreContent = await fs8.readFile(gitignorePath, "utf8");
124593
+ const gitignoreContent = await fs9.readFile(gitignorePath, "utf8");
124487
124594
  const rules = gitignoreContent.split(`
124488
124595
  `).map((line) => line.trim()).filter((line) => line && !line.startsWith("#"));
124489
124596
  ig.add(rules);
@@ -126812,7 +126919,7 @@ var init_structural_runtime = __esm(() => {
126812
126919
 
126813
126920
  // ../../packages/core/dist/services/etl/stages/parse.js
126814
126921
  import path15 from "path";
126815
- import fs9 from "fs/promises";
126922
+ import fs10 from "fs/promises";
126816
126923
  function resolveChunkerMaxChars() {
126817
126924
  const global2 = Number(process.env.EMBEDDING_MAX_CHARS);
126818
126925
  if (Number.isFinite(global2) && global2 > 0)
@@ -126904,7 +127011,7 @@ class ParseStage {
126904
127011
  if (!file2.needsReparse) {
126905
127012
  const extension = path15.extname(file2.relativePath).toLowerCase();
126906
127013
  if ([".c", ".cpp", ".hpp"].includes(extension)) {
126907
- const content = file2.snapshotContent ?? await fs9.readFile(file2.absolutePath, "utf8");
127014
+ const content = file2.snapshotContent ?? await fs10.readFile(file2.absolutePath, "utf8");
126908
127015
  const outcome = await this.runtime.parse({ extension, source: Buffer.from(content) });
126909
127016
  if (outcome.status === "failed")
126910
127017
  throw new StructuralEtlParseError(file2.relativePath, outcome.failureKind, `Structural evidence parse failed (${outcome.failureKind})`, outcome.diagnosticCount, outcome.diagnostics.slice(0, 10));
@@ -126916,7 +127023,7 @@ class ParseStage {
126916
127023
  return { file: file2, chunks: [], symbols: [], rawImports: [], rawEdges: [] };
126917
127024
  }
126918
127025
  try {
126919
- const content = file2.snapshotContent ?? await fs9.readFile(file2.absolutePath, "utf-8");
127026
+ const content = file2.snapshotContent ?? await fs10.readFile(file2.absolutePath, "utf-8");
126920
127027
  const ext2 = path15.extname(file2.relativePath).toLowerCase();
126921
127028
  const chunkerMaxChars = resolveChunkerMaxChars();
126922
127029
  const chunks = smartChunk(content, file2.relativePath, chunkerMaxChars ? { maxChunkChars: chunkerMaxChars } : {});
@@ -127957,7 +128064,7 @@ var init_data_document2 = __esm(() => {
127957
128064
 
127958
128065
  // ../../packages/core/dist/services/etl/stages/resolve.js
127959
128066
  import path18 from "path";
127960
- import fs10 from "fs";
128067
+ import fs11 from "fs";
127961
128068
 
127962
128069
  class ResolveStage {
127963
128070
  symbolRepository;
@@ -128274,7 +128381,7 @@ class ResolveStage {
128274
128381
  const aliases = [];
128275
128382
  const tsconfigPath = path18.join(projectPath, "tsconfig.json");
128276
128383
  try {
128277
- const raw2 = fs10.readFileSync(tsconfigPath, "utf-8");
128384
+ const raw2 = fs11.readFileSync(tsconfigPath, "utf-8");
128278
128385
  const stripped = raw2.replace(/\/\/[^\n]*/g, "").replace(/\/\*[\s\S]*?\*\//g, "");
128279
128386
  const tsconfig = JSON.parse(stripped);
128280
128387
  const paths = tsconfig?.compilerOptions?.paths ?? {};
@@ -130697,7 +130804,7 @@ __export(exports_symbol_graph_service, {
130697
130804
  SymbolGraphService: () => SymbolGraphService
130698
130805
  });
130699
130806
  import path22 from "path";
130700
- import fs11 from "fs/promises";
130807
+ import fs12 from "fs/promises";
130701
130808
 
130702
130809
  class SymbolGraphService {
130703
130810
  identityLookup;
@@ -131025,7 +131132,7 @@ class SymbolGraphService {
131025
131132
  async readSnippet(relativePath, lineStart, lineEnd, projectId) {
131026
131133
  try {
131027
131134
  const absolutePath = await this.resolveToAbsolute(relativePath, projectId);
131028
- const content = await fs11.readFile(absolutePath, "utf-8");
131135
+ const content = await fs12.readFile(absolutePath, "utf-8");
131029
131136
  const lines = content.split(`
131030
131137
  `);
131031
131138
  return lines.slice(Math.max(0, lineStart - 1), Math.min(lines.length, lineEnd)).join(`
@@ -131037,7 +131144,7 @@ class SymbolGraphService {
131037
131144
  async readContext(relativePath, lineNumber, contextLines, projectId) {
131038
131145
  try {
131039
131146
  const absolutePath = await this.resolveToAbsolute(relativePath, projectId);
131040
- const content = await fs11.readFile(absolutePath, "utf-8");
131147
+ const content = await fs12.readFile(absolutePath, "utf-8");
131041
131148
  const lines = content.split(`
131042
131149
  `);
131043
131150
  const start = Math.max(0, lineNumber - contextLines - 1);
@@ -135754,6 +135861,10 @@ var init_checkpoint_store_pg = __esm(() => {
135754
135861
  });
135755
135862
 
135756
135863
  // ../../packages/core/dist/services/checkpoint/checkpoint-manager.js
135864
+ var exports_checkpoint_manager = {};
135865
+ __export(exports_checkpoint_manager, {
135866
+ CheckpointManager: () => CheckpointManager
135867
+ });
135757
135868
  var CheckpointManager;
135758
135869
  var init_checkpoint_manager = __esm(() => {
135759
135870
  init_config();
@@ -136882,7 +136993,7 @@ var init_session_pin_store = __esm(() => {
136882
136993
  });
136883
136994
 
136884
136995
  // ../../packages/core/dist/services/hooks/attribution-resolver.js
136885
- import fs12 from "fs";
136996
+ import fs13 from "fs";
136886
136997
  import os6 from "os";
136887
136998
  import path24 from "path";
136888
136999
 
@@ -136909,9 +137020,7 @@ class PgWorkspaceRootProvider {
136909
137020
  this.cache = { roots, expiresAt: this.now() + PROVIDER_TTL_MS };
136910
137021
  return roots;
136911
137022
  } catch (error51) {
136912
- logger.warn("[hook-attribution] workspace roots lookup failed; containment disabled (sanitized)", {
136913
- name: error51 instanceof Error ? error51.name : "unknown"
136914
- });
137023
+ logger.warn("[hook-attribution] workspace roots lookup failed; containment disabled", safeErrorSummary(error51));
136915
137024
  return [];
136916
137025
  } finally {
136917
137026
  if (timer)
@@ -137020,7 +137129,7 @@ class AttributionResolver {
137020
137129
  }
137021
137130
  function defaultCanonicalize(cwd) {
137022
137131
  try {
137023
- return fs12.realpathSync(cwd);
137132
+ return fs13.realpathSync(cwd);
137024
137133
  } catch {
137025
137134
  try {
137026
137135
  return path24.resolve(cwd);
@@ -137039,75 +137148,10 @@ var init_attribution_resolver = __esm(() => {
137039
137148
  init_dist();
137040
137149
  init_db_connection();
137041
137150
  init_alias_resolver();
137151
+ init_safe_error_summary();
137042
137152
  init_session_pin_store();
137043
137153
  });
137044
137154
 
137045
- // ../../packages/core/dist/kernel/sanitize/credential-scrub.js
137046
- function markerFor(id) {
137047
- return `[REDACTED:${id}]`;
137048
- }
137049
- function fullMatchRule(id, pattern) {
137050
- const marker26 = markerFor(id);
137051
- return {
137052
- id,
137053
- replace(text3) {
137054
- let count = 0;
137055
- const replaced = text3.replace(pattern, () => {
137056
- count++;
137057
- return marker26;
137058
- });
137059
- return { text: replaced, count };
137060
- }
137061
- };
137062
- }
137063
- function scrubCredentials(payloadJson) {
137064
- const redactions = {};
137065
- for (const id of RULE_IDS)
137066
- redactions[id] = 0;
137067
- let text3 = payloadJson;
137068
- for (const rule of RULES) {
137069
- const { text: next, count } = rule.replace(text3);
137070
- text3 = next;
137071
- redactions[rule.id] += count;
137072
- }
137073
- const total = Object.values(redactions).reduce((sum, n) => sum + n, 0);
137074
- return {
137075
- sanitized: text3,
137076
- redactions,
137077
- total
137078
- };
137079
- }
137080
- var PEM_PATTERN, JWT_PATTERN, AWS_KEY_PATTERN, SK_KEY_PATTERN, GITHUB_TOKEN_PATTERN, SLACK_TOKEN_PATTERN, BEARER_PATTERN, RULES, RULE_IDS;
137081
- var init_credential_scrub = __esm(() => {
137082
- PEM_PATTERN = /-----BEGIN [A-Z ]{0,32}PRIVATE KEY-----[\s\S]{0,8192}?-----END [A-Z ]{0,32}PRIVATE KEY-----/g;
137083
- JWT_PATTERN = /\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g;
137084
- AWS_KEY_PATTERN = /\b(?:AKIA|ASIA|ABIA|ACCA)[A-Z0-9]{16}\b/g;
137085
- SK_KEY_PATTERN = /\bsk-[A-Za-z0-9_-]{20,}\b/g;
137086
- GITHUB_TOKEN_PATTERN = /\bgh[pousr]_[A-Za-z0-9]{36,}\b|\bgithub_pat_[A-Za-z0-9_]{22,}\b/g;
137087
- SLACK_TOKEN_PATTERN = /\bxox[baprs]-[A-Za-z0-9-]{18,}\b/g;
137088
- BEARER_PATTERN = /(Bearer\s+)([A-Za-z0-9._~+/=-]{20,})/g;
137089
- RULES = [
137090
- fullMatchRule("pem", PEM_PATTERN),
137091
- fullMatchRule("jwt", JWT_PATTERN),
137092
- fullMatchRule("aws-key", AWS_KEY_PATTERN),
137093
- fullMatchRule("sk-key", SK_KEY_PATTERN),
137094
- fullMatchRule("github-token", GITHUB_TOKEN_PATTERN),
137095
- fullMatchRule("slack-token", SLACK_TOKEN_PATTERN),
137096
- {
137097
- id: "bearer",
137098
- replace(text3) {
137099
- let count = 0;
137100
- const replaced = text3.replace(BEARER_PATTERN, (_m, prefix) => {
137101
- count++;
137102
- return `${prefix}${markerFor("bearer")}`;
137103
- });
137104
- return { text: replaced, count };
137105
- }
137106
- }
137107
- ];
137108
- RULE_IDS = RULES.map((r) => r.id);
137109
- });
137110
-
137111
137155
  // ../../packages/core/dist/tools/compact_snapshot.js
137112
137156
  class CompactSnapshotTool {
137113
137157
  name = "compact_snapshot";
@@ -138693,7 +138737,7 @@ var init_get_architecture = __esm(() => {
138693
138737
  });
138694
138738
 
138695
138739
  // ../../packages/core/dist/services/file-read/file-content-cache.js
138696
- import fs13 from "fs/promises";
138740
+ import fs14 from "fs/promises";
138697
138741
 
138698
138742
  class FileContentCache {
138699
138743
  extractMetadata;
@@ -138726,7 +138770,7 @@ class FileContentCache {
138726
138770
  metadata: cached2.metadata
138727
138771
  };
138728
138772
  }
138729
- const content = await fs13.readFile(filePath, "utf-8");
138773
+ const content = await fs14.readFile(filePath, "utf-8");
138730
138774
  const metadata = await this.extractMetadata(content, filePath, options);
138731
138775
  evictOldest(this.fileCache, this.FILE_CACHE_MAX_ENTRIES - 1);
138732
138776
  this.fileCache.set(cacheKey, {
@@ -142151,7 +142195,7 @@ var init_l1_memory_cache = __esm(() => {
142151
142195
  });
142152
142196
 
142153
142197
  // ../../packages/core/dist/services/health/local-health-checker.js
142154
- import fs14 from "fs/promises";
142198
+ import fs15 from "fs/promises";
142155
142199
  import { existsSync as existsSync3 } from "fs";
142156
142200
  import path27 from "path";
142157
142201
 
@@ -142187,10 +142231,10 @@ class LocalHealthChecker {
142187
142231
  const start = Date.now();
142188
142232
  try {
142189
142233
  if (!existsSync3(this.dataDir))
142190
- await fs14.mkdir(this.dataDir, { recursive: true });
142234
+ await fs15.mkdir(this.dataDir, { recursive: true });
142191
142235
  const probe2 = path27.join(this.dataDir, ".health-check-test");
142192
- await fs14.writeFile(probe2, "ok");
142193
- await fs14.unlink(probe2);
142236
+ await fs15.writeFile(probe2, "ok");
142237
+ await fs15.unlink(probe2);
142194
142238
  return { available: true, latency: Date.now() - start, details: { path: this.dataDir, writable: true } };
142195
142239
  } catch (error51) {
142196
142240
  return { available: false, latency: Date.now() - start, error: `Data directory error: ${error51.message}` };
@@ -144054,6 +144098,11 @@ function registerDefaultJobs(scheduler) {
144054
144098
  const projectId = job.payload?.projectId ?? "default";
144055
144099
  await observationConsolidationJob2.runOnce(projectId);
144056
144100
  });
144101
+ scheduler.registerHandler("checkpoint-purge", async () => {
144102
+ const { CheckpointManager: CheckpointManager2 } = await Promise.resolve().then(() => (init_checkpoint_manager(), exports_checkpoint_manager));
144103
+ const count = CheckpointManager2.getInstance().purgeExpired();
144104
+ logger.info("Scheduled checkpoint purge completed", { count });
144105
+ });
144057
144106
  for (const rawDef of DEFAULT_SCHEDULED_JOBS) {
144058
144107
  const def = applySafeDefaults(rawDef);
144059
144108
  const enabled2 = envBool2(def.enableEnvVar, def.defaultEnabled);
@@ -144115,6 +144164,15 @@ var init_scheduler_defaults = __esm(() => {
144115
144164
  defaultEnabled: false,
144116
144165
  enableEnvVar: "MASSA_AI_SCHEDULER_OBSERVATION_BRIDGE_ENABLED",
144117
144166
  intervalEnvVar: "MASSA_AI_SCHEDULER_OBSERVATION_BRIDGE_INTERVAL_MS"
144167
+ },
144168
+ {
144169
+ id: "scheduled-checkpoint-purge",
144170
+ name: "Checkpoint Purge (clock)",
144171
+ jobKind: "checkpoint-purge",
144172
+ schedule: { type: "interval", intervalMs: ONE_HOUR },
144173
+ defaultEnabled: false,
144174
+ enableEnvVar: "MASSA_AI_SCHEDULER_CHECKPOINT_PURGE_ENABLED",
144175
+ intervalEnvVar: "MASSA_AI_SCHEDULER_CHECKPOINT_PURGE_INTERVAL_MS"
144118
144176
  }
144119
144177
  ];
144120
144178
  });
@@ -144129,7 +144187,7 @@ var init_scheduler2 = __esm(() => {
144129
144187
  });
144130
144188
 
144131
144189
  // ../../packages/core/dist/services/pricing/models-dev-client.js
144132
- import fs15 from "fs/promises";
144190
+ import fs16 from "fs/promises";
144133
144191
  import { existsSync as existsSync4 } from "fs";
144134
144192
  import path28 from "path";
144135
144193
  function getModelsDevClient() {
@@ -144159,7 +144217,7 @@ var init_models_dev_client = __esm(() => {
144159
144217
  if (!existsSync4(cachePath)) {
144160
144218
  return null;
144161
144219
  }
144162
- const content = await fs15.readFile(cachePath, "utf-8");
144220
+ const content = await fs16.readFile(cachePath, "utf-8");
144163
144221
  const data = JSON.parse(content);
144164
144222
  const age = Date.now() - data.timestamp;
144165
144223
  if (age > ModelsDevClient.LOCAL_CACHE_TTL) {
@@ -144187,13 +144245,13 @@ var init_models_dev_client = __esm(() => {
144187
144245
  const cachePath = this.getLocalCachePath();
144188
144246
  try {
144189
144247
  const dir = path28.dirname(cachePath);
144190
- await fs15.mkdir(dir, { recursive: true });
144248
+ await fs16.mkdir(dir, { recursive: true });
144191
144249
  const data = {
144192
144250
  timestamp: Date.now(),
144193
144251
  version: "1.0.0",
144194
144252
  models: Object.fromEntries(models)
144195
144253
  };
144196
- await fs15.writeFile(cachePath, JSON.stringify(data), "utf-8");
144254
+ await fs16.writeFile(cachePath, JSON.stringify(data), "utf-8");
144197
144255
  logger.debug("Saved pricing to local cache", {
144198
144256
  models: models.size,
144199
144257
  path: cachePath
@@ -144522,7 +144580,7 @@ var init_models_dev_client = __esm(() => {
144522
144580
  const cachePath = this.getLocalCachePath();
144523
144581
  try {
144524
144582
  if (existsSync4(cachePath)) {
144525
- await fs15.unlink(cachePath);
144583
+ await fs16.unlink(cachePath);
144526
144584
  logger.debug("Local pricing cache file deleted");
144527
144585
  }
144528
144586
  } catch (error51) {
@@ -162529,6 +162587,7 @@ var init_services = __esm(() => {
162529
162587
  init_search_analytics_pg();
162530
162588
  init_index_manager();
162531
162589
  init_search_diagnostics();
162590
+ init_safe_error_summary();
162532
162591
  init_memory_controller();
162533
162592
  init_llm_client();
162534
162593
  init_search_controller();
@@ -162966,7 +163025,7 @@ var init_hook_service = __esm(() => {
162966
163025
 
162967
163026
  // ../../packages/core/dist/services/bootstrap/bootstrap-service.js
162968
163027
  import { randomUUID as randomUUID9 } from "crypto";
162969
- import fs16 from "fs";
163028
+ import fs17 from "fs";
162970
163029
  import path29 from "path";
162971
163030
  import { spawn as spawn2 } from "child_process";
162972
163031
  function readBootstrapConfig() {
@@ -163128,8 +163187,8 @@ async function scanSignals(_projectId, projectRoot, caps, symbolGraph, gitRunner
163128
163187
  try {
163129
163188
  for (const name26 of README_CANDIDATES) {
163130
163189
  const p = path29.join(projectRoot, name26);
163131
- if (fs16.existsSync(p) && fs16.statSync(p).isFile()) {
163132
- const buf = fs16.readFileSync(p);
163190
+ if (fs17.existsSync(p) && fs17.statSync(p).isFile()) {
163191
+ const buf = fs17.readFileSync(p);
163133
163192
  signals.readme = buf.slice(0, MAX_README_BYTES).toString("utf8");
163134
163193
  break;
163135
163194
  }
@@ -163139,11 +163198,11 @@ async function scanSignals(_projectId, projectRoot, caps, symbolGraph, gitRunner
163139
163198
  }
163140
163199
  try {
163141
163200
  const docsDir = path29.join(projectRoot, "docs");
163142
- if (fs16.existsSync(docsDir) && fs16.statSync(docsDir).isDirectory()) {
163201
+ if (fs17.existsSync(docsDir) && fs17.statSync(docsDir).isDirectory()) {
163143
163202
  const entries = walkMarkdown(docsDir).slice(0, MAX_DOCS);
163144
163203
  for (const rel of entries) {
163145
163204
  try {
163146
- const buf = fs16.readFileSync(rel);
163205
+ const buf = fs17.readFileSync(rel);
163147
163206
  signals.docs.push({
163148
163207
  path: path29.relative(projectRoot, rel),
163149
163208
  snippet: buf.slice(0, MAX_DOC_BYTES).toString("utf8")
@@ -163157,9 +163216,9 @@ async function scanSignals(_projectId, projectRoot, caps, symbolGraph, gitRunner
163157
163216
  try {
163158
163217
  for (const name26 of MANIFEST_FILES) {
163159
163218
  const p = path29.join(projectRoot, name26);
163160
- if (!fs16.existsSync(p) || !fs16.statSync(p).isFile())
163219
+ if (!fs17.existsSync(p) || !fs17.statSync(p).isFile())
163161
163220
  continue;
163162
- const raw2 = fs16.readFileSync(p).slice(0, MAX_MANIFEST_BYTES).toString("utf8");
163221
+ const raw2 = fs17.readFileSync(p).slice(0, MAX_MANIFEST_BYTES).toString("utf8");
163163
163222
  const kind = name26;
163164
163223
  if (name26 === "package.json") {
163165
163224
  try {
@@ -163199,7 +163258,7 @@ function walkMarkdown(dir) {
163199
163258
  const cur = stack.pop();
163200
163259
  let entries;
163201
163260
  try {
163202
- entries = fs16.readdirSync(cur, { withFileTypes: true });
163261
+ entries = fs17.readdirSync(cur, { withFileTypes: true });
163203
163262
  } catch {
163204
163263
  continue;
163205
163264
  }
@@ -163934,6 +163993,7 @@ __export(exports_dist, {
163934
163993
  searchSessionHook: () => searchSessionHook,
163935
163994
  searchBackendUnavailable: () => searchBackendUnavailable,
163936
163995
  scanSignals: () => scanSignals,
163996
+ safeErrorSummary: () => safeErrorSummary,
163937
163997
  runPool: () => runPool,
163938
163998
  ruleBasedSeed: () => ruleBasedSeed,
163939
163999
  resolveStructuralParseLanguage: () => resolveStructuralParseLanguage,
@@ -163957,6 +164017,7 @@ __export(exports_dist, {
163957
164017
  recordSearchFailure: () => recordSearchFailure,
163958
164018
  recordSearchDegradation: () => recordSearchDegradation,
163959
164019
  quoteDiscoveredIdentifier: () => quoteDiscoveredIdentifier,
164020
+ projectNotIndexed: () => projectNotIndexed,
163960
164021
  payloadStorePolicies: () => payloadStorePolicies,
163961
164022
  parseStructuralFqn: () => parseStructuralFqn,
163962
164023
  parseProjectIdentityPreviewRequest: () => parseProjectIdentityPreviewRequest,
@@ -166614,7 +166675,7 @@ class StdioServerTransport {
166614
166675
  }
166615
166676
 
166616
166677
  // src/index.ts
166617
- import fs19 from "fs/promises";
166678
+ import fs20 from "fs/promises";
166618
166679
 
166619
166680
  // src/api-client.ts
166620
166681
  init_config();
@@ -166724,7 +166785,7 @@ init_dist();
166724
166785
  init_dist();
166725
166786
  init_dist15();
166726
166787
  init_dist();
166727
- import fs17 from "fs/promises";
166788
+ import fs18 from "fs/promises";
166728
166789
  import path30 from "path";
166729
166790
  var _indexProjectTool = null;
166730
166791
  function indexProjectTool() {
@@ -167009,7 +167070,7 @@ class EmbeddedApiClient {
167009
167070
  end = start + 20;
167010
167071
  }
167011
167072
  const absolutePath = path30.join(workspace.project_path, file2);
167012
- const content = await fs17.readFile(absolutePath, "utf-8");
167073
+ const content = await fs18.readFile(absolutePath, "utf-8");
167013
167074
  const lines = content.split(/\r?\n/);
167014
167075
  const slice = lines.slice(start - 1, Math.min(lines.length, end));
167015
167076
  const formatted = slice.map((text3, idx) => ({ lineNumber: start + idx, content: text3 }));
@@ -167248,8 +167309,8 @@ class EmbeddedApiClient {
167248
167309
  const finalProjectId = rawBase.replace(/[^a-zA-Z0-9_.-]/g, "_").slice(0, 128);
167249
167310
  const uploadRoot = process.env.MASSA_AI_UPLOAD_DIR || path30.join(getGlobalDataDir(), "uploads");
167250
167311
  const stagingDir = path30.resolve(uploadRoot, finalProjectId);
167251
- await fs17.rm(stagingDir, { recursive: true, force: true });
167252
- await fs17.mkdir(stagingDir, { recursive: true });
167312
+ await fs18.rm(stagingDir, { recursive: true, force: true });
167313
+ await fs18.mkdir(stagingDir, { recursive: true });
167253
167314
  const WRITE_BATCH = 20;
167254
167315
  for (let i = 0;i < params.files.length; i += WRITE_BATCH) {
167255
167316
  await Promise.all(params.files.slice(i, i + WRITE_BATCH).map(async (file2) => {
@@ -167260,8 +167321,8 @@ class EmbeddedApiClient {
167260
167321
  if (!dest.startsWith(stagingDir + path30.sep)) {
167261
167322
  throw new Error(`Path escapes staging directory: ${file2.relativePath}`);
167262
167323
  }
167263
- await fs17.mkdir(path30.dirname(dest), { recursive: true });
167264
- await fs17.writeFile(dest, file2.content, "utf-8");
167324
+ await fs18.mkdir(path30.dirname(dest), { recursive: true });
167325
+ await fs18.writeFile(dest, file2.content, "utf-8");
167265
167326
  }));
167266
167327
  }
167267
167328
  return await indexProjectTool().handle({
@@ -167605,7 +167666,7 @@ class EmbeddedApiClient {
167605
167666
 
167606
167667
  // src/file-collector.ts
167607
167668
  init_config();
167608
- import fs18 from "fs/promises";
167669
+ import fs19 from "fs/promises";
167609
167670
  import path31 from "path";
167610
167671
  var SKIP_DIRS = new Set([
167611
167672
  "node_modules",
@@ -167647,7 +167708,7 @@ async function walk2(root2, dir, files, state, allowed) {
167647
167708
  return;
167648
167709
  let entries;
167649
167710
  try {
167650
- entries = await fs18.readdir(dir, { withFileTypes: true });
167711
+ entries = await fs19.readdir(dir, { withFileTypes: true });
167651
167712
  } catch {
167652
167713
  return;
167653
167714
  }
@@ -167664,12 +167725,12 @@ async function walk2(root2, dir, files, state, allowed) {
167664
167725
  continue;
167665
167726
  const fullPath = path31.join(dir, entry2.name);
167666
167727
  try {
167667
- const stat = await fs18.stat(fullPath);
167728
+ const stat = await fs19.stat(fullPath);
167668
167729
  if (stat.size > MAX_FILE_BYTES)
167669
167730
  continue;
167670
167731
  if (state.totalBytes + stat.size > MAX_TOTAL_BYTES)
167671
167732
  continue;
167672
- const content = await fs18.readFile(fullPath, "utf-8");
167733
+ const content = await fs19.readFile(fullPath, "utf-8");
167673
167734
  state.totalBytes += stat.size;
167674
167735
  const relativePath = path31.relative(root2, fullPath).split(path31.sep).join("/");
167675
167736
  files.push({ relativePath, content });
@@ -169572,7 +169633,7 @@ class McpProxyServer {
169572
169633
  return textContent(JSON.stringify({ success: false, error: "projectPath is required" }));
169573
169634
  }
169574
169635
  try {
169575
- if (!(await fs19.stat(projectPath2)).isDirectory()) {
169636
+ if (!(await fs20.stat(projectPath2)).isDirectory()) {
169576
169637
  return textContent(JSON.stringify({ success: false, error: `${projectPath2} is not a directory` }));
169577
169638
  }
169578
169639
  } catch {