@massa-ai/mcp-client 1.42.0 → 1.44.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 +462 -337
  2. package/dist/index.js +498 -384
  3. package/package.json +3 -3
@@ -552,6 +552,7 @@ var init_massa_ai_config = __esm(() => {
552
552
  // ../../packages/shared/dist/config/config-loader.js
553
553
  var exports_config_loader = {};
554
554
  __export(exports_config_loader, {
555
+ writeFileAtomically: () => writeFileAtomically,
555
556
  saveConfig: () => saveConfig,
556
557
  migrateDataDirOnce: () => migrateDataDirOnce,
557
558
  loadConfigSafe: () => loadConfigSafe,
@@ -636,15 +637,17 @@ function migrateDataDirOnce() {
636
637
  function __resetMigrationForTests() {
637
638
  migrationAttempted = false;
638
639
  }
639
- function saveConfig(config) {
640
- if (!fs.existsSync(CONFIG_DIR)) {
641
- fs.mkdirSync(CONFIG_DIR, { recursive: true });
640
+ function writeFileAtomically(targetPath, content) {
641
+ const dir = path3.dirname(targetPath);
642
+ if (!fs.existsSync(dir)) {
643
+ fs.mkdirSync(dir, { recursive: true });
642
644
  }
643
645
  const unique = `${process.pid}.${++tempFileCounter}.${crypto2.randomBytes(6).toString("hex")}`;
644
- const tempFile = path3.join(CONFIG_DIR, `.config.json.${unique}.tmp`);
646
+ const tempFile = path3.join(dir, `.${path3.basename(targetPath)}.${unique}.tmp`);
645
647
  try {
646
- fs.writeFileSync(tempFile, JSON.stringify(config, null, 2));
647
- fs.renameSync(tempFile, CONFIG_FILE);
648
+ fs.writeFileSync(tempFile, content, { mode: 384 });
649
+ fs.chmodSync(tempFile, 384);
650
+ fs.renameSync(tempFile, targetPath);
648
651
  } catch (error) {
649
652
  try {
650
653
  fs.unlinkSync(tempFile);
@@ -652,6 +655,9 @@ function saveConfig(config) {
652
655
  throw error;
653
656
  }
654
657
  }
658
+ function saveConfig(config) {
659
+ writeFileAtomically(CONFIG_FILE, JSON.stringify(config, null, 2));
660
+ }
655
661
  function initConfig() {
656
662
  if (!fs.existsSync(CONFIG_FILE)) {
657
663
  saveConfig(defaultMassaAiConfig);
@@ -2018,7 +2024,7 @@ function listProfiles(opts = {}) {
2018
2024
  installed,
2019
2025
  skipped: false,
2020
2026
  skipReason: null,
2021
- activeProfile: platform?.modelProfile?.profile ?? "balanced",
2027
+ activeProfile: platform?.modelProfile?.profile ?? opts.hostDefaults?.[host] ?? "balanced",
2022
2028
  bundleVersion: platform?.plugin?.version ?? null,
2023
2029
  availableProfiles
2024
2030
  };
@@ -2188,6 +2194,114 @@ function reportSucceeded(report) {
2188
2194
  return report.hosts.every((h) => h.status === "switched" || h.status === "skipped");
2189
2195
  }
2190
2196
 
2197
+ // ../../packages/shared/dist/profile-switch/variant-sync.js
2198
+ import fs6 from "fs";
2199
+ import path9 from "path";
2200
+ import crypto5 from "crypto";
2201
+ function writeFileIntoDirAtomically(destDir, destName, content) {
2202
+ const unique = `${process.pid}.${++tempFileCounter2}.${crypto5.randomBytes(6).toString("hex")}`;
2203
+ const tempFile = path9.join(destDir, `.${destName}.${unique}.tmp`);
2204
+ try {
2205
+ fs6.writeFileSync(tempFile, content);
2206
+ fs6.renameSync(tempFile, path9.join(destDir, destName));
2207
+ } catch (error) {
2208
+ try {
2209
+ fs6.unlinkSync(tempFile);
2210
+ } catch {}
2211
+ throw error;
2212
+ }
2213
+ }
2214
+ function isSafeDirName(name) {
2215
+ if (name === "." || name === "..")
2216
+ return false;
2217
+ if (name.includes("/") || name.includes("\\") || name.includes(path9.sep))
2218
+ return false;
2219
+ return path9.basename(name) === name;
2220
+ }
2221
+ function syncHost(host, sourceRoot, targetHome) {
2222
+ const layout = resolveHostLayout(host, { targetHome });
2223
+ if (layout.route === "skip") {
2224
+ return { host, status: "skipped", profiles: [], retained: [], files: 0, reason: layout.reason };
2225
+ }
2226
+ const srcDir = path9.join(sourceRoot, "apps", `${host}-plugin`, "agent-profiles");
2227
+ if (!fs6.existsSync(srcDir) || !fs6.statSync(srcDir).isDirectory()) {
2228
+ return { host, status: "skipped", profiles: [], retained: [], files: 0, reason: "no generated variants for this host" };
2229
+ }
2230
+ if (!fs6.existsSync(layout.variantsRoot)) {
2231
+ return {
2232
+ host,
2233
+ status: "skipped",
2234
+ profiles: [],
2235
+ retained: [],
2236
+ files: 0,
2237
+ reason: `variant tree not present at ${layout.variantsRoot} \u2014 run the plugin installer ` + "or an initial profile switch"
2238
+ };
2239
+ }
2240
+ const profiles = [];
2241
+ let files = 0;
2242
+ for (const entry of fs6.readdirSync(srcDir, { withFileTypes: true })) {
2243
+ if (!entry.isDirectory())
2244
+ continue;
2245
+ if (!isSafeDirName(entry.name))
2246
+ continue;
2247
+ const srcProfileDir = path9.join(srcDir, entry.name);
2248
+ const destProfileDir = path9.join(layout.variantsRoot, entry.name);
2249
+ fs6.mkdirSync(destProfileDir, { recursive: true });
2250
+ for (const fileEntry of fs6.readdirSync(srcProfileDir, { withFileTypes: true })) {
2251
+ if (!fileEntry.isFile())
2252
+ continue;
2253
+ const content = fs6.readFileSync(path9.join(srcProfileDir, fileEntry.name));
2254
+ writeFileIntoDirAtomically(destProfileDir, fileEntry.name, content);
2255
+ files++;
2256
+ }
2257
+ profiles.push(entry.name);
2258
+ }
2259
+ const retained = fs6.readdirSync(layout.variantsRoot, { withFileTypes: true }).filter((e) => e.isDirectory() && !profiles.includes(e.name)).map((e) => e.name).sort();
2260
+ return { host, status: "synced", profiles: profiles.sort(), retained, files };
2261
+ }
2262
+ function syncGeneratedVariants(opts) {
2263
+ const hosts = opts.hosts ?? HOSTS;
2264
+ if (!opts.sourceRoot) {
2265
+ return hosts.map((host) => ({
2266
+ host,
2267
+ status: "skipped",
2268
+ profiles: [],
2269
+ retained: [],
2270
+ files: 0,
2271
+ reason: "no source checkout \u2014 nothing to sync"
2272
+ }));
2273
+ }
2274
+ const sourceRoot = opts.sourceRoot;
2275
+ return hosts.map((host) => {
2276
+ try {
2277
+ return syncHost(host, sourceRoot, opts.targetHome);
2278
+ } catch (err) {
2279
+ return { host, status: "failed", profiles: [], retained: [], files: 0, error: err.message };
2280
+ }
2281
+ });
2282
+ }
2283
+ var tempFileCounter2 = 0;
2284
+ var init_variant_sync = __esm(() => {
2285
+ init_hosts();
2286
+ });
2287
+
2288
+ // ../../packages/shared/dist/profile-switch/repo-root.js
2289
+ import fs7 from "fs";
2290
+ import path10 from "path";
2291
+ function findRepoRootWithMarker(startDir, marker, maxLevels) {
2292
+ let dir = startDir;
2293
+ for (let i = 0;i <= maxLevels; i++) {
2294
+ if (fs7.existsSync(path10.join(dir, marker)))
2295
+ return dir;
2296
+ const parent = path10.dirname(dir);
2297
+ if (parent === dir)
2298
+ break;
2299
+ dir = parent;
2300
+ }
2301
+ return null;
2302
+ }
2303
+ var init_repo_root = () => {};
2304
+
2191
2305
  // ../../packages/shared/dist/index.js
2192
2306
  var init_dist = __esm(() => {
2193
2307
  init_env();
@@ -2196,6 +2310,8 @@ var init_dist = __esm(() => {
2196
2310
  init_state();
2197
2311
  init_lock();
2198
2312
  init_engine();
2313
+ init_variant_sync();
2314
+ init_repo_root();
2199
2315
  init_types();
2200
2316
  init_interfaces();
2201
2317
  init_utils();
@@ -3717,7 +3833,7 @@ var import_brace_expansion, minimatch = (p, pattern, options = {}) => {
3717
3833
  }, qmarksTestNoExtDot = ([$0]) => {
3718
3834
  const len = $0.length;
3719
3835
  return (f) => f.length === len && f !== "." && f !== "..";
3720
- }, defaultPlatform, path9, sep, GLOBSTAR, qmark2 = "[^/]", star2, twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?", twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?", filter = (pattern, options = {}) => (p) => minimatch(p, pattern, options), ext = (a, b = {}) => Object.assign({}, a, b), defaults = (def) => {
3836
+ }, defaultPlatform, path11, sep, GLOBSTAR, qmark2 = "[^/]", star2, twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?", twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?", filter = (pattern, options = {}) => (p) => minimatch(p, pattern, options), ext = (a, b = {}) => Object.assign({}, a, b), defaults = (def) => {
3721
3837
  if (!def || typeof def !== "object" || !Object.keys(def).length) {
3722
3838
  return minimatch;
3723
3839
  }
@@ -3775,11 +3891,11 @@ var init_esm = __esm(() => {
3775
3891
  starRE = /^\*+$/;
3776
3892
  qmarksRE = /^\?+([^+@!?\*\[\(]*)?$/;
3777
3893
  defaultPlatform = typeof process === "object" && process ? typeof process.env === "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
3778
- path9 = {
3894
+ path11 = {
3779
3895
  win32: { sep: "\\" },
3780
3896
  posix: { sep: "/" }
3781
3897
  };
3782
- sep = defaultPlatform === "win32" ? path9.win32.sep : path9.posix.sep;
3898
+ sep = defaultPlatform === "win32" ? path11.win32.sep : path11.posix.sep;
3783
3899
  minimatch.sep = sep;
3784
3900
  GLOBSTAR = Symbol("globstar **");
3785
3901
  minimatch.GLOBSTAR = GLOBSTAR;
@@ -5745,12 +5861,12 @@ var init_esm4 = __esm(() => {
5745
5861
  childrenCache() {
5746
5862
  return this.#children;
5747
5863
  }
5748
- resolve(path10) {
5749
- if (!path10) {
5864
+ resolve(path12) {
5865
+ if (!path12) {
5750
5866
  return this;
5751
5867
  }
5752
- const rootPath = this.getRootString(path10);
5753
- const dir = path10.substring(rootPath.length);
5868
+ const rootPath = this.getRootString(path12);
5869
+ const dir = path12.substring(rootPath.length);
5754
5870
  const dirParts = dir.split(this.splitSep);
5755
5871
  const result = rootPath ? this.getRoot(rootPath).#resolveParts(dirParts) : this.#resolveParts(dirParts);
5756
5872
  return result;
@@ -6278,8 +6394,8 @@ var init_esm4 = __esm(() => {
6278
6394
  newChild(name, type = UNKNOWN, opts = {}) {
6279
6395
  return new PathWin32(name, type, this.root, this.roots, this.nocase, this.childrenCache(), opts);
6280
6396
  }
6281
- getRootString(path10) {
6282
- return win32.parse(path10).root;
6397
+ getRootString(path12) {
6398
+ return win32.parse(path12).root;
6283
6399
  }
6284
6400
  getRoot(rootPath) {
6285
6401
  rootPath = uncToDrive(rootPath.toUpperCase());
@@ -6304,8 +6420,8 @@ var init_esm4 = __esm(() => {
6304
6420
  constructor(name, type = UNKNOWN, root, roots, nocase, children, opts) {
6305
6421
  super(name, type, root, roots, nocase, children, opts);
6306
6422
  }
6307
- getRootString(path10) {
6308
- return path10.startsWith("/") ? "/" : "";
6423
+ getRootString(path12) {
6424
+ return path12.startsWith("/") ? "/" : "";
6309
6425
  }
6310
6426
  getRoot(_rootPath) {
6311
6427
  return this.root;
@@ -6324,8 +6440,8 @@ var init_esm4 = __esm(() => {
6324
6440
  #children;
6325
6441
  nocase;
6326
6442
  #fs;
6327
- constructor(cwd = process.cwd(), pathImpl, sep2, { nocase, childrenCacheSize = 16 * 1024, fs: fs6 = defaultFS } = {}) {
6328
- this.#fs = fsFromOption(fs6);
6443
+ constructor(cwd = process.cwd(), pathImpl, sep2, { nocase, childrenCacheSize = 16 * 1024, fs: fs8 = defaultFS } = {}) {
6444
+ this.#fs = fsFromOption(fs8);
6329
6445
  if (cwd instanceof URL || cwd.startsWith("file://")) {
6330
6446
  cwd = fileURLToPath(cwd);
6331
6447
  }
@@ -6361,11 +6477,11 @@ var init_esm4 = __esm(() => {
6361
6477
  }
6362
6478
  this.cwd = prev;
6363
6479
  }
6364
- depth(path10 = this.cwd) {
6365
- if (typeof path10 === "string") {
6366
- path10 = this.cwd.resolve(path10);
6480
+ depth(path12 = this.cwd) {
6481
+ if (typeof path12 === "string") {
6482
+ path12 = this.cwd.resolve(path12);
6367
6483
  }
6368
- return path10.depth();
6484
+ return path12.depth();
6369
6485
  }
6370
6486
  childrenCache() {
6371
6487
  return this.#children;
@@ -6781,9 +6897,9 @@ var init_esm4 = __esm(() => {
6781
6897
  process2();
6782
6898
  return results;
6783
6899
  }
6784
- chdir(path10 = this.cwd) {
6900
+ chdir(path12 = this.cwd) {
6785
6901
  const oldCwd = this.cwd;
6786
- this.cwd = typeof path10 === "string" ? this.cwd.resolve(path10) : path10;
6902
+ this.cwd = typeof path12 === "string" ? this.cwd.resolve(path12) : path12;
6787
6903
  this.cwd[setAsCwd](oldCwd);
6788
6904
  }
6789
6905
  };
@@ -6800,8 +6916,8 @@ var init_esm4 = __esm(() => {
6800
6916
  parseRootPath(dir) {
6801
6917
  return win32.parse(dir).root.toUpperCase();
6802
6918
  }
6803
- newRoot(fs6) {
6804
- return new PathWin32(this.rootPath, IFDIR, undefined, this.roots, this.nocase, this.childrenCache(), { fs: fs6 });
6919
+ newRoot(fs8) {
6920
+ return new PathWin32(this.rootPath, IFDIR, undefined, this.roots, this.nocase, this.childrenCache(), { fs: fs8 });
6805
6921
  }
6806
6922
  isAbsolute(p) {
6807
6923
  return p.startsWith("/") || p.startsWith("\\") || /^[a-z]:(\/|\\)/i.test(p);
@@ -6817,8 +6933,8 @@ var init_esm4 = __esm(() => {
6817
6933
  parseRootPath(_dir) {
6818
6934
  return "/";
6819
6935
  }
6820
- newRoot(fs6) {
6821
- return new PathPosix(this.rootPath, IFDIR, undefined, this.roots, this.nocase, this.childrenCache(), { fs: fs6 });
6936
+ newRoot(fs8) {
6937
+ return new PathPosix(this.rootPath, IFDIR, undefined, this.roots, this.nocase, this.childrenCache(), { fs: fs8 });
6822
6938
  }
6823
6939
  isAbsolute(p) {
6824
6940
  return p.startsWith("/");
@@ -7075,8 +7191,8 @@ class MatchRecord {
7075
7191
  this.store.set(target, current === undefined ? n : n & current);
7076
7192
  }
7077
7193
  entries() {
7078
- return [...this.store.entries()].map(([path10, n]) => [
7079
- path10,
7194
+ return [...this.store.entries()].map(([path12, n]) => [
7195
+ path12,
7080
7196
  !!(n & 2),
7081
7197
  !!(n & 1)
7082
7198
  ]);
@@ -7280,9 +7396,9 @@ class GlobUtil {
7280
7396
  signal;
7281
7397
  maxDepth;
7282
7398
  includeChildMatches;
7283
- constructor(patterns, path10, opts) {
7399
+ constructor(patterns, path12, opts) {
7284
7400
  this.patterns = patterns;
7285
- this.path = path10;
7401
+ this.path = path12;
7286
7402
  this.opts = opts;
7287
7403
  this.#sep = !opts.posix && opts.platform === "win32" ? "\\" : "/";
7288
7404
  this.includeChildMatches = opts.includeChildMatches !== false;
@@ -7301,11 +7417,11 @@ class GlobUtil {
7301
7417
  });
7302
7418
  }
7303
7419
  }
7304
- #ignored(path10) {
7305
- return this.seen.has(path10) || !!this.#ignore?.ignored?.(path10);
7420
+ #ignored(path12) {
7421
+ return this.seen.has(path12) || !!this.#ignore?.ignored?.(path12);
7306
7422
  }
7307
- #childrenIgnored(path10) {
7308
- return !!this.#ignore?.childrenIgnored?.(path10);
7423
+ #childrenIgnored(path12) {
7424
+ return !!this.#ignore?.childrenIgnored?.(path12);
7309
7425
  }
7310
7426
  pause() {
7311
7427
  this.paused = true;
@@ -7522,8 +7638,8 @@ var init_walker = __esm(() => {
7522
7638
  init_processor();
7523
7639
  GlobWalker = class GlobWalker extends GlobUtil {
7524
7640
  matches = new Set;
7525
- constructor(patterns, path10, opts) {
7526
- super(patterns, path10, opts);
7641
+ constructor(patterns, path12, opts) {
7642
+ super(patterns, path12, opts);
7527
7643
  }
7528
7644
  matchEmit(e) {
7529
7645
  this.matches.add(e);
@@ -7560,8 +7676,8 @@ var init_walker = __esm(() => {
7560
7676
  };
7561
7677
  GlobStream = class GlobStream extends GlobUtil {
7562
7678
  results;
7563
- constructor(patterns, path10, opts) {
7564
- super(patterns, path10, opts);
7679
+ constructor(patterns, path12, opts) {
7680
+ super(patterns, path12, opts);
7565
7681
  this.results = new Minipass({
7566
7682
  signal: this.signal,
7567
7683
  objectMode: true
@@ -7989,20 +8105,20 @@ var require_ignore = __commonJS((exports, module) => {
7989
8105
  var throwError = (message, Ctor) => {
7990
8106
  throw new Ctor(message);
7991
8107
  };
7992
- var checkPath = (path10, originalPath, doThrow) => {
7993
- if (!isString(path10)) {
8108
+ var checkPath = (path12, originalPath, doThrow) => {
8109
+ if (!isString(path12)) {
7994
8110
  return doThrow(`path must be a string, but got \`${originalPath}\``, TypeError);
7995
8111
  }
7996
- if (!path10) {
8112
+ if (!path12) {
7997
8113
  return doThrow(`path must not be empty`, TypeError);
7998
8114
  }
7999
- if (checkPath.isNotRelative(path10)) {
8115
+ if (checkPath.isNotRelative(path12)) {
8000
8116
  const r = "`path.relative()`d";
8001
8117
  return doThrow(`path should be a ${r} string, but got "${originalPath}"`, RangeError);
8002
8118
  }
8003
8119
  return true;
8004
8120
  };
8005
- var isNotRelative = (path10) => REGEX_TEST_INVALID_PATH.test(path10);
8121
+ var isNotRelative = (path12) => REGEX_TEST_INVALID_PATH.test(path12);
8006
8122
  checkPath.isNotRelative = isNotRelative;
8007
8123
  checkPath.convert = (p) => p;
8008
8124
 
@@ -8045,7 +8161,7 @@ var require_ignore = __commonJS((exports, module) => {
8045
8161
  addPattern(pattern) {
8046
8162
  return this.add(pattern);
8047
8163
  }
8048
- _testOne(path10, checkUnignored) {
8164
+ _testOne(path12, checkUnignored) {
8049
8165
  let ignored = false;
8050
8166
  let unignored = false;
8051
8167
  this._rules.forEach((rule) => {
@@ -8053,7 +8169,7 @@ var require_ignore = __commonJS((exports, module) => {
8053
8169
  if (unignored === negative && ignored !== unignored || negative && !ignored && !unignored && !checkUnignored) {
8054
8170
  return;
8055
8171
  }
8056
- const matched = rule.regex.test(path10);
8172
+ const matched = rule.regex.test(path12);
8057
8173
  if (matched) {
8058
8174
  ignored = !negative;
8059
8175
  unignored = negative;
@@ -8065,39 +8181,39 @@ var require_ignore = __commonJS((exports, module) => {
8065
8181
  };
8066
8182
  }
8067
8183
  _test(originalPath, cache, checkUnignored, slices) {
8068
- const path10 = originalPath && checkPath.convert(originalPath);
8069
- checkPath(path10, originalPath, this._allowRelativePaths ? RETURN_FALSE : throwError);
8070
- return this._t(path10, cache, checkUnignored, slices);
8184
+ const path12 = originalPath && checkPath.convert(originalPath);
8185
+ checkPath(path12, originalPath, this._allowRelativePaths ? RETURN_FALSE : throwError);
8186
+ return this._t(path12, cache, checkUnignored, slices);
8071
8187
  }
8072
- _t(path10, cache, checkUnignored, slices) {
8073
- if (path10 in cache) {
8074
- return cache[path10];
8188
+ _t(path12, cache, checkUnignored, slices) {
8189
+ if (path12 in cache) {
8190
+ return cache[path12];
8075
8191
  }
8076
8192
  if (!slices) {
8077
- slices = path10.split(SLASH);
8193
+ slices = path12.split(SLASH);
8078
8194
  }
8079
8195
  slices.pop();
8080
8196
  if (!slices.length) {
8081
- return cache[path10] = this._testOne(path10, checkUnignored);
8197
+ return cache[path12] = this._testOne(path12, checkUnignored);
8082
8198
  }
8083
8199
  const parent = this._t(slices.join(SLASH) + SLASH, cache, checkUnignored, slices);
8084
- return cache[path10] = parent.ignored ? parent : this._testOne(path10, checkUnignored);
8200
+ return cache[path12] = parent.ignored ? parent : this._testOne(path12, checkUnignored);
8085
8201
  }
8086
- ignores(path10) {
8087
- return this._test(path10, this._ignoreCache, false).ignored;
8202
+ ignores(path12) {
8203
+ return this._test(path12, this._ignoreCache, false).ignored;
8088
8204
  }
8089
8205
  createFilter() {
8090
- return (path10) => !this.ignores(path10);
8206
+ return (path12) => !this.ignores(path12);
8091
8207
  }
8092
8208
  filter(paths) {
8093
8209
  return makeArray(paths).filter(this.createFilter());
8094
8210
  }
8095
- test(path10) {
8096
- return this._test(path10, this._testCache, true);
8211
+ test(path12) {
8212
+ return this._test(path12, this._testCache, true);
8097
8213
  }
8098
8214
  }
8099
8215
  var factory = (options) => new Ignore2(options);
8100
- var isPathValid = (path10) => checkPath(path10 && checkPath.convert(path10), path10, RETURN_FALSE);
8216
+ var isPathValid = (path12) => checkPath(path12 && checkPath.convert(path12), path12, RETURN_FALSE);
8101
8217
  factory.isPathValid = isPathValid;
8102
8218
  factory.default = factory;
8103
8219
  module.exports = factory;
@@ -8105,7 +8221,7 @@ var require_ignore = __commonJS((exports, module) => {
8105
8221
  const makePosix = (str) => /^\\\\\?\\/.test(str) || /["<>|\u0000-\u001F]+/u.test(str) ? str : str.replace(/\\/g, "/");
8106
8222
  checkPath.convert = makePosix;
8107
8223
  const REGIX_IS_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i;
8108
- checkPath.isNotRelative = (path10) => REGIX_IS_WINDOWS_PATH_ABSOLUTE.test(path10) || isNotRelative(path10);
8224
+ checkPath.isNotRelative = (path12) => REGIX_IS_WINDOWS_PATH_ABSOLUTE.test(path12) || isNotRelative(path12);
8109
8225
  }
8110
8226
  });
8111
8227
 
@@ -8167,13 +8283,13 @@ function validatePolicy(policy, opts = {}) {
8167
8283
  }
8168
8284
  }
8169
8285
  }
8170
- function matchesGlob2(path10, pattern) {
8286
+ function matchesGlob2(path12, pattern) {
8171
8287
  let re = regexCache.get(pattern);
8172
8288
  if (!re) {
8173
8289
  re = globToRegex(pattern);
8174
8290
  regexCache.set(pattern, re);
8175
8291
  }
8176
- return re.test(path10);
8292
+ return re.test(path12);
8177
8293
  }
8178
8294
  var MAX_MATCH_WORK = 1e5, MAX_IGNORE_PATTERNS2 = 1024, DEFAULT_POLICY, applyPolicy = (filePath, policy) => {
8179
8295
  const normalized = filePath.trim();
@@ -8224,8 +8340,8 @@ var init_capture_policy = __esm(() => {
8224
8340
  });
8225
8341
 
8226
8342
  // ../../packages/core/dist/services/search/ignore-patterns.js
8227
- import fs6 from "fs/promises";
8228
- import path10 from "path";
8343
+ import fs8 from "fs/promises";
8344
+ import path12 from "path";
8229
8345
  function buildExtensionGlob(extensions) {
8230
8346
  return extensions.map((ext2) => `**/*${ext2}`);
8231
8347
  }
@@ -8248,8 +8364,8 @@ async function loadProjectIgnore(projectPath) {
8248
8364
  const ig = ignore();
8249
8365
  ig.add(DEFAULT_IGNORES);
8250
8366
  try {
8251
- const gitignorePath = path10.join(projectPath, ".gitignore");
8252
- const gitignoreContent = await fs6.readFile(gitignorePath, "utf8");
8367
+ const gitignorePath = path12.join(projectPath, ".gitignore");
8368
+ const gitignoreContent = await fs8.readFile(gitignorePath, "utf8");
8253
8369
  const rules = gitignoreContent.split(`
8254
8370
  `).map((line) => line.trim()).filter((line) => line && !line.startsWith("#"));
8255
8371
  ig.add(rules);
@@ -9577,7 +9693,7 @@ var require_cert_signatures = __commonJS((exports, module) => {
9577
9693
 
9578
9694
  // ../../node_modules/pg/lib/crypto/sasl.js
9579
9695
  var require_sasl = __commonJS((exports, module) => {
9580
- var crypto5 = require_utils2();
9696
+ var crypto6 = require_utils2();
9581
9697
  var { signatureAlgorithmHashFromCertificate } = require_cert_signatures();
9582
9698
  function saslprep(password) {
9583
9699
  const nonAsciiSpace = /[\u00A0\u1680\u2000-\u200B\u202F\u205F\u3000]/g;
@@ -9596,7 +9712,7 @@ var require_sasl = __commonJS((exports, module) => {
9596
9712
  if (mechanism === "SCRAM-SHA-256-PLUS" && typeof stream2.getPeerCertificate !== "function") {
9597
9713
  throw new Error("SASL: Mechanism SCRAM-SHA-256-PLUS requires a certificate");
9598
9714
  }
9599
- const clientNonce = crypto5.randomBytes(18).toString("base64");
9715
+ const clientNonce = crypto6.randomBytes(18).toString("base64");
9600
9716
  const gs2Header = mechanism === "SCRAM-SHA-256-PLUS" ? "p=tls-server-end-point" : stream2 ? "y" : "n";
9601
9717
  return {
9602
9718
  mechanism,
@@ -9637,20 +9753,20 @@ var require_sasl = __commonJS((exports, module) => {
9637
9753
  let hashName = signatureAlgorithmHashFromCertificate(peerCert);
9638
9754
  if (hashName === "MD5" || hashName === "SHA-1")
9639
9755
  hashName = "SHA-256";
9640
- const certHash = await crypto5.hashByName(hashName, peerCert);
9756
+ const certHash = await crypto6.hashByName(hashName, peerCert);
9641
9757
  const bindingData = Buffer.concat([Buffer.from("p=tls-server-end-point,,"), Buffer.from(certHash)]);
9642
9758
  channelBinding = bindingData.toString("base64");
9643
9759
  }
9644
9760
  const clientFinalMessageWithoutProof = "c=" + channelBinding + ",r=" + sv.nonce;
9645
9761
  const authMessage = clientFirstMessageBare + "," + serverFirstMessage + "," + clientFinalMessageWithoutProof;
9646
9762
  const saltBytes = Buffer.from(sv.salt, "base64");
9647
- const saltedPassword = await crypto5.deriveKey(saslprep(password), saltBytes, sv.iteration);
9648
- const clientKey = await crypto5.hmacSha256(saltedPassword, "Client Key");
9649
- const storedKey = await crypto5.sha256(clientKey);
9650
- const clientSignature = await crypto5.hmacSha256(storedKey, authMessage);
9763
+ const saltedPassword = await crypto6.deriveKey(saslprep(password), saltBytes, sv.iteration);
9764
+ const clientKey = await crypto6.hmacSha256(saltedPassword, "Client Key");
9765
+ const storedKey = await crypto6.sha256(clientKey);
9766
+ const clientSignature = await crypto6.hmacSha256(storedKey, authMessage);
9651
9767
  const clientProof = xorBuffers(Buffer.from(clientKey), Buffer.from(clientSignature)).toString("base64");
9652
- const serverKey = await crypto5.hmacSha256(saltedPassword, "Server Key");
9653
- const serverSignatureBytes = await crypto5.hmacSha256(serverKey, authMessage);
9768
+ const serverKey = await crypto6.hmacSha256(saltedPassword, "Server Key");
9769
+ const serverSignatureBytes = await crypto6.hmacSha256(serverKey, authMessage);
9654
9770
  session.message = "SASLResponse";
9655
9771
  session.serverSignature = Buffer.from(serverSignatureBytes).toString("base64");
9656
9772
  session.response = clientFinalMessageWithoutProof + ",p=" + clientProof;
@@ -9845,15 +9961,15 @@ var require_pg_connection_string = __commonJS((exports, module) => {
9845
9961
  if (config2.sslnegotiation === "direct" && config2.ssl === undefined) {
9846
9962
  config2.ssl = true;
9847
9963
  }
9848
- const fs7 = config2.sslcert || config2.sslkey || config2.sslrootcert ? __require("fs") : null;
9964
+ const fs9 = config2.sslcert || config2.sslkey || config2.sslrootcert ? __require("fs") : null;
9849
9965
  if (config2.sslcert) {
9850
- config2.ssl.cert = fs7.readFileSync(config2.sslcert).toString();
9966
+ config2.ssl.cert = fs9.readFileSync(config2.sslcert).toString();
9851
9967
  }
9852
9968
  if (config2.sslkey) {
9853
- config2.ssl.key = fs7.readFileSync(config2.sslkey).toString();
9969
+ config2.ssl.key = fs9.readFileSync(config2.sslkey).toString();
9854
9970
  }
9855
9971
  if (config2.sslrootcert) {
9856
- config2.ssl.ca = fs7.readFileSync(config2.sslrootcert).toString();
9972
+ config2.ssl.ca = fs9.readFileSync(config2.sslrootcert).toString();
9857
9973
  }
9858
9974
  if (options.useLibpqCompat && config2.uselibpqcompat) {
9859
9975
  throw new Error("Both useLibpqCompat and uselibpqcompat are set. Please use only one of them.");
@@ -11567,7 +11683,7 @@ var require_split2 = __commonJS((exports, module) => {
11567
11683
 
11568
11684
  // ../../node_modules/pgpass/lib/helper.js
11569
11685
  var require_helper = __commonJS((exports, module) => {
11570
- var path11 = __require("path");
11686
+ var path13 = __require("path");
11571
11687
  var Stream2 = __require("stream").Stream;
11572
11688
  var split = require_split2();
11573
11689
  var util = __require("util");
@@ -11607,7 +11723,7 @@ var require_helper = __commonJS((exports, module) => {
11607
11723
  };
11608
11724
  exports.getFileName = function(rawEnv) {
11609
11725
  var env = rawEnv || process.env;
11610
- var file = env.PGPASSFILE || (isWin ? path11.join(env.APPDATA || "./", "postgresql", "pgpass.conf") : path11.join(env.HOME || "./", ".pgpass"));
11726
+ var file = env.PGPASSFILE || (isWin ? path13.join(env.APPDATA || "./", "postgresql", "pgpass.conf") : path13.join(env.HOME || "./", ".pgpass"));
11611
11727
  return file;
11612
11728
  };
11613
11729
  exports.usePgPass = function(stats, fname) {
@@ -11731,16 +11847,16 @@ var require_helper = __commonJS((exports, module) => {
11731
11847
 
11732
11848
  // ../../node_modules/pgpass/lib/index.js
11733
11849
  var require_lib = __commonJS((exports, module) => {
11734
- var path11 = __require("path");
11735
- var fs7 = __require("fs");
11850
+ var path13 = __require("path");
11851
+ var fs9 = __require("fs");
11736
11852
  var helper = require_helper();
11737
11853
  module.exports = function(connInfo, cb) {
11738
11854
  var file = helper.getFileName();
11739
- fs7.stat(file, function(err, stat) {
11855
+ fs9.stat(file, function(err, stat) {
11740
11856
  if (err || !helper.usePgPass(stat, file)) {
11741
11857
  return cb(undefined);
11742
11858
  }
11743
- var st = fs7.createReadStream(file);
11859
+ var st = fs9.createReadStream(file);
11744
11860
  helper.getPassword(connInfo, st, cb);
11745
11861
  });
11746
11862
  };
@@ -11758,7 +11874,7 @@ var require_client = __commonJS((exports, module) => {
11758
11874
  var Query = require_query();
11759
11875
  var defaults2 = require_defaults();
11760
11876
  var Connection = require_connection();
11761
- var crypto5 = require_utils2();
11877
+ var crypto6 = require_utils2();
11762
11878
  var activeQueryDeprecationNotice = nodeUtils.deprecate(() => {}, "Client.activeQuery is deprecated and will be removed in pg@9.0");
11763
11879
  var queryQueueDeprecationNotice = nodeUtils.deprecate(() => {}, "Client.queryQueue is deprecated and will be removed in pg@9.0.");
11764
11880
  var pgPassDeprecationNotice = nodeUtils.deprecate(() => {}, "pgpass support is deprecated and will be removed in pg@9.0. " + "You can provide an async function as the password property to the Client/Pool constructor that returns a password instead. Within this function you can call the pgpass module in your own code.");
@@ -11990,7 +12106,7 @@ var require_client = __commonJS((exports, module) => {
11990
12106
  _handleAuthMD5Password(msg) {
11991
12107
  this._getPassword(async () => {
11992
12108
  try {
11993
- const hashedPassword = await crypto5.postgresMd5PasswordHash(this.user, this.password, msg.salt);
12109
+ const hashedPassword = await crypto6.postgresMd5PasswordHash(this.user, this.password, msg.salt);
11994
12110
  this.connection.password(hashedPassword);
11995
12111
  } catch (e) {
11996
12112
  this.emit("error", e);
@@ -13439,8 +13555,8 @@ var init_alias_resolver = __esm(() => {
13439
13555
  });
13440
13556
 
13441
13557
  // ../../packages/core/dist/services/search/index-manager.js
13442
- import fs7 from "fs";
13443
- import path11 from "path";
13558
+ import fs9 from "fs";
13559
+ import path13 from "path";
13444
13560
 
13445
13561
  class IndexManager {
13446
13562
  metadataCache = new Map;
@@ -13533,9 +13649,9 @@ class IndexManager {
13533
13649
  const fileMetadata = {};
13534
13650
  let totalSize = 0;
13535
13651
  for (const filePath of indexedFiles) {
13536
- const fullPath = path11.join(projectPath, filePath);
13652
+ const fullPath = path13.join(projectPath, filePath);
13537
13653
  try {
13538
- const stat = await fs7.promises.stat(fullPath);
13654
+ const stat = await fs9.promises.stat(fullPath);
13539
13655
  fileMetadata[filePath] = {
13540
13656
  path: filePath,
13541
13657
  mtime: stat.mtimeMs,
@@ -13586,9 +13702,9 @@ class IndexManager {
13586
13702
  if (ig.ignores(match2)) {
13587
13703
  continue;
13588
13704
  }
13589
- const fullPath = path11.join(projectPath, match2);
13705
+ const fullPath = path13.join(projectPath, match2);
13590
13706
  try {
13591
- const stat = await fs7.promises.stat(fullPath);
13707
+ const stat = await fs9.promises.stat(fullPath);
13592
13708
  files.set(match2, {
13593
13709
  path: match2,
13594
13710
  mtime: stat.mtimeMs,
@@ -14039,10 +14155,10 @@ function mergeDefs(...defs) {
14039
14155
  function cloneDef(schema) {
14040
14156
  return mergeDefs(schema._zod.def);
14041
14157
  }
14042
- function getElementAtPath(obj, path12) {
14043
- if (!path12)
14158
+ function getElementAtPath(obj, path14) {
14159
+ if (!path14)
14044
14160
  return obj;
14045
- return path12.reduce((acc, key) => acc?.[key], obj);
14161
+ return path14.reduce((acc, key) => acc?.[key], obj);
14046
14162
  }
14047
14163
  function promiseAllObject(promisesObj) {
14048
14164
  const keys = Object.keys(promisesObj);
@@ -14370,11 +14486,11 @@ function explicitlyAborted(x, startIndex = 0) {
14370
14486
  }
14371
14487
  return false;
14372
14488
  }
14373
- function prefixIssues(path12, issues) {
14489
+ function prefixIssues(path14, issues) {
14374
14490
  return issues.map((iss) => {
14375
14491
  var _a3;
14376
14492
  (_a3 = iss).path ?? (_a3.path = []);
14377
- iss.path.unshift(path12);
14493
+ iss.path.unshift(path14);
14378
14494
  return iss;
14379
14495
  });
14380
14496
  }
@@ -14587,16 +14703,16 @@ function flattenError(error, mapper = (issue2) => issue2.message) {
14587
14703
  }
14588
14704
  function formatError(error, mapper = (issue2) => issue2.message) {
14589
14705
  const fieldErrors = { _errors: [] };
14590
- const processError = (error2, path12 = []) => {
14706
+ const processError = (error2, path14 = []) => {
14591
14707
  for (const issue2 of error2.issues) {
14592
14708
  if (issue2.code === "invalid_union" && issue2.errors.length) {
14593
- issue2.errors.map((issues) => processError({ issues }, [...path12, ...issue2.path]));
14709
+ issue2.errors.map((issues) => processError({ issues }, [...path14, ...issue2.path]));
14594
14710
  } else if (issue2.code === "invalid_key") {
14595
- processError({ issues: issue2.issues }, [...path12, ...issue2.path]);
14711
+ processError({ issues: issue2.issues }, [...path14, ...issue2.path]);
14596
14712
  } else if (issue2.code === "invalid_element") {
14597
- processError({ issues: issue2.issues }, [...path12, ...issue2.path]);
14713
+ processError({ issues: issue2.issues }, [...path14, ...issue2.path]);
14598
14714
  } else {
14599
- const fullpath = [...path12, ...issue2.path];
14715
+ const fullpath = [...path14, ...issue2.path];
14600
14716
  if (fullpath.length === 0) {
14601
14717
  fieldErrors._errors.push(mapper(issue2));
14602
14718
  } else {
@@ -14623,17 +14739,17 @@ function formatError(error, mapper = (issue2) => issue2.message) {
14623
14739
  }
14624
14740
  function treeifyError(error, mapper = (issue2) => issue2.message) {
14625
14741
  const result = { errors: [] };
14626
- const processError = (error2, path12 = []) => {
14742
+ const processError = (error2, path14 = []) => {
14627
14743
  var _a3, _b;
14628
14744
  for (const issue2 of error2.issues) {
14629
14745
  if (issue2.code === "invalid_union" && issue2.errors.length) {
14630
- issue2.errors.map((issues) => processError({ issues }, [...path12, ...issue2.path]));
14746
+ issue2.errors.map((issues) => processError({ issues }, [...path14, ...issue2.path]));
14631
14747
  } else if (issue2.code === "invalid_key") {
14632
- processError({ issues: issue2.issues }, [...path12, ...issue2.path]);
14748
+ processError({ issues: issue2.issues }, [...path14, ...issue2.path]);
14633
14749
  } else if (issue2.code === "invalid_element") {
14634
- processError({ issues: issue2.issues }, [...path12, ...issue2.path]);
14750
+ processError({ issues: issue2.issues }, [...path14, ...issue2.path]);
14635
14751
  } else {
14636
- const fullpath = [...path12, ...issue2.path];
14752
+ const fullpath = [...path14, ...issue2.path];
14637
14753
  if (fullpath.length === 0) {
14638
14754
  result.errors.push(mapper(issue2));
14639
14755
  continue;
@@ -14665,8 +14781,8 @@ function treeifyError(error, mapper = (issue2) => issue2.message) {
14665
14781
  }
14666
14782
  function toDotPath(_path) {
14667
14783
  const segs = [];
14668
- const path12 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
14669
- for (const seg of path12) {
14784
+ const path14 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
14785
+ for (const seg of path14) {
14670
14786
  if (typeof seg === "number")
14671
14787
  segs.push(`[${seg}]`);
14672
14788
  else if (typeof seg === "symbol")
@@ -27669,13 +27785,13 @@ function resolveRef(ref, ctx) {
27669
27785
  if (!ref.startsWith("#")) {
27670
27786
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
27671
27787
  }
27672
- const path12 = ref.slice(1).split("/").filter(Boolean);
27673
- if (path12.length === 0) {
27788
+ const path14 = ref.slice(1).split("/").filter(Boolean);
27789
+ if (path14.length === 0) {
27674
27790
  return ctx.rootSchema;
27675
27791
  }
27676
27792
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
27677
- if (path12[0] === defsKey) {
27678
- const key = path12[1];
27793
+ if (path14[0] === defsKey) {
27794
+ const key = path14[1];
27679
27795
  if (!key || !ctx.defs[key]) {
27680
27796
  throw new Error(`Reference not found: ${ref}`);
27681
27797
  }
@@ -29164,8 +29280,8 @@ class ParseStatus {
29164
29280
  }
29165
29281
  }
29166
29282
  var makeIssue = (params) => {
29167
- const { data, path: path12, errorMaps, issueData } = params;
29168
- const fullPath = [...path12, ...issueData.path || []];
29283
+ const { data, path: path14, errorMaps, issueData } = params;
29284
+ const fullPath = [...path14, ...issueData.path || []];
29169
29285
  const fullIssue = {
29170
29286
  ...issueData,
29171
29287
  path: fullPath
@@ -29210,11 +29326,11 @@ var init_errorUtil = __esm(() => {
29210
29326
 
29211
29327
  // ../../node_modules/zod/v3/types.js
29212
29328
  class ParseInputLazyPath {
29213
- constructor(parent, value, path12, key) {
29329
+ constructor(parent, value, path14, key) {
29214
29330
  this._cachedPath = [];
29215
29331
  this.parent = parent;
29216
29332
  this.data = value;
29217
- this._path = path12;
29333
+ this._path = path14;
29218
29334
  this._key = key;
29219
29335
  }
29220
29336
  get path() {
@@ -35279,23 +35395,23 @@ var require_auth_config = __commonJS((exports, module) => {
35279
35395
  writeAuthConfig: () => writeAuthConfig
35280
35396
  });
35281
35397
  module.exports = __toCommonJS2(auth_config_exports);
35282
- var fs8 = __toESM2(__require("fs"));
35283
- var path12 = __toESM2(__require("path"));
35398
+ var fs10 = __toESM2(__require("fs"));
35399
+ var path14 = __toESM2(__require("path"));
35284
35400
  var import_token_util = require_token_util();
35285
35401
  function getAuthConfigPath() {
35286
35402
  const dataDir = (0, import_token_util.getVercelDataDir)();
35287
35403
  if (!dataDir) {
35288
35404
  throw new Error(`Unable to find Vercel CLI data directory. Your platform: ${process.platform}. Supported: darwin, linux, win32.`);
35289
35405
  }
35290
- return path12.join(dataDir, "auth.json");
35406
+ return path14.join(dataDir, "auth.json");
35291
35407
  }
35292
35408
  function readAuthConfig() {
35293
35409
  try {
35294
35410
  const authPath = getAuthConfigPath();
35295
- if (!fs8.existsSync(authPath)) {
35411
+ if (!fs10.existsSync(authPath)) {
35296
35412
  return null;
35297
35413
  }
35298
- const content = fs8.readFileSync(authPath, "utf8");
35414
+ const content = fs10.readFileSync(authPath, "utf8");
35299
35415
  if (!content) {
35300
35416
  return null;
35301
35417
  }
@@ -35306,11 +35422,11 @@ var require_auth_config = __commonJS((exports, module) => {
35306
35422
  }
35307
35423
  function writeAuthConfig(config3) {
35308
35424
  const authPath = getAuthConfigPath();
35309
- const authDir = path12.dirname(authPath);
35310
- if (!fs8.existsSync(authDir)) {
35311
- fs8.mkdirSync(authDir, { mode: 504, recursive: true });
35425
+ const authDir = path14.dirname(authPath);
35426
+ if (!fs10.existsSync(authDir)) {
35427
+ fs10.mkdirSync(authDir, { mode: 504, recursive: true });
35312
35428
  }
35313
- fs8.writeFileSync(authPath, JSON.stringify(config3, null, 2), { mode: 384 });
35429
+ fs10.writeFileSync(authPath, JSON.stringify(config3, null, 2), { mode: 384 });
35314
35430
  }
35315
35431
  function isValidAccessToken(authConfig, expirationBufferMs = 0) {
35316
35432
  if (!authConfig.token)
@@ -35485,8 +35601,8 @@ var require_token_util = __commonJS((exports, module) => {
35485
35601
  saveToken: () => saveToken
35486
35602
  });
35487
35603
  module.exports = __toCommonJS2(token_util_exports);
35488
- var path12 = __toESM2(__require("path"));
35489
- var fs8 = __toESM2(__require("fs"));
35604
+ var path14 = __toESM2(__require("path"));
35605
+ var fs10 = __toESM2(__require("fs"));
35490
35606
  var import_token_error = require_token_error();
35491
35607
  var import_token_io = require_token_io();
35492
35608
  var import_auth_config = require_auth_config();
@@ -35498,7 +35614,7 @@ var require_token_util = __commonJS((exports, module) => {
35498
35614
  if (!dataDir) {
35499
35615
  return null;
35500
35616
  }
35501
- return path12.join(dataDir, vercelFolder);
35617
+ return path14.join(dataDir, vercelFolder);
35502
35618
  }
35503
35619
  async function getVercelToken2(options) {
35504
35620
  const authConfig = (0, import_auth_config.readAuthConfig)();
@@ -35566,11 +35682,11 @@ var require_token_util = __commonJS((exports, module) => {
35566
35682
  if (!dir) {
35567
35683
  throw new import_token_error.VercelOidcTokenError("Unable to find project root directory. Have you linked your project with `vc link?`");
35568
35684
  }
35569
- const prjPath = path12.join(dir, ".vercel", "project.json");
35570
- if (!fs8.existsSync(prjPath)) {
35685
+ const prjPath = path14.join(dir, ".vercel", "project.json");
35686
+ if (!fs10.existsSync(prjPath)) {
35571
35687
  throw new import_token_error.VercelOidcTokenError("project.json not found, have you linked your project with `vc link?`");
35572
35688
  }
35573
- const prj = JSON.parse(fs8.readFileSync(prjPath, "utf8"));
35689
+ const prj = JSON.parse(fs10.readFileSync(prjPath, "utf8"));
35574
35690
  if (typeof prj.projectId !== "string" && typeof prj.orgId !== "string") {
35575
35691
  throw new TypeError("Expected a string-valued projectId property. Try running `vc link` to re-link your project.");
35576
35692
  }
@@ -35581,11 +35697,11 @@ var require_token_util = __commonJS((exports, module) => {
35581
35697
  if (!dir) {
35582
35698
  throw new import_token_error.VercelOidcTokenError("Unable to find user data directory. Please reach out to Vercel support.");
35583
35699
  }
35584
- const tokenPath = path12.join(dir, "com.vercel.token", `${projectId}.json`);
35700
+ const tokenPath = path14.join(dir, "com.vercel.token", `${projectId}.json`);
35585
35701
  const tokenJson = JSON.stringify(token);
35586
- fs8.mkdirSync(path12.dirname(tokenPath), { mode: 504, recursive: true });
35587
- fs8.writeFileSync(tokenPath, tokenJson);
35588
- fs8.chmodSync(tokenPath, 432);
35702
+ fs10.mkdirSync(path14.dirname(tokenPath), { mode: 504, recursive: true });
35703
+ fs10.writeFileSync(tokenPath, tokenJson);
35704
+ fs10.chmodSync(tokenPath, 432);
35589
35705
  return;
35590
35706
  }
35591
35707
  function loadToken(projectId) {
@@ -35593,11 +35709,11 @@ var require_token_util = __commonJS((exports, module) => {
35593
35709
  if (!dir) {
35594
35710
  throw new import_token_error.VercelOidcTokenError("Unable to find user data directory. Please reach out to Vercel support.");
35595
35711
  }
35596
- const tokenPath = path12.join(dir, "com.vercel.token", `${projectId}.json`);
35597
- if (!fs8.existsSync(tokenPath)) {
35712
+ const tokenPath = path14.join(dir, "com.vercel.token", `${projectId}.json`);
35713
+ if (!fs10.existsSync(tokenPath)) {
35598
35714
  return null;
35599
35715
  }
35600
- const token = JSON.parse(fs8.readFileSync(tokenPath, "utf8"));
35716
+ const token = JSON.parse(fs10.readFileSync(tokenPath, "utf8"));
35601
35717
  assertVercelOidcTokenResponse(token);
35602
35718
  return token;
35603
35719
  }
@@ -46439,37 +46555,37 @@ function createOpenAI(options = {}) {
46439
46555
  }, `ai-sdk/openai/${VERSION4}`);
46440
46556
  const createChatModel = (modelId) => new OpenAIChatLanguageModel(modelId, {
46441
46557
  provider: `${providerName}.chat`,
46442
- url: ({ path: path12 }) => `${baseURL}${path12}`,
46558
+ url: ({ path: path14 }) => `${baseURL}${path14}`,
46443
46559
  headers: getHeaders,
46444
46560
  fetch: options.fetch
46445
46561
  });
46446
46562
  const createCompletionModel = (modelId) => new OpenAICompletionLanguageModel(modelId, {
46447
46563
  provider: `${providerName}.completion`,
46448
- url: ({ path: path12 }) => `${baseURL}${path12}`,
46564
+ url: ({ path: path14 }) => `${baseURL}${path14}`,
46449
46565
  headers: getHeaders,
46450
46566
  fetch: options.fetch
46451
46567
  });
46452
46568
  const createEmbeddingModel = (modelId) => new OpenAIEmbeddingModel(modelId, {
46453
46569
  provider: `${providerName}.embedding`,
46454
- url: ({ path: path12 }) => `${baseURL}${path12}`,
46570
+ url: ({ path: path14 }) => `${baseURL}${path14}`,
46455
46571
  headers: getHeaders,
46456
46572
  fetch: options.fetch
46457
46573
  });
46458
46574
  const createImageModel = (modelId) => new OpenAIImageModel(modelId, {
46459
46575
  provider: `${providerName}.image`,
46460
- url: ({ path: path12 }) => `${baseURL}${path12}`,
46576
+ url: ({ path: path14 }) => `${baseURL}${path14}`,
46461
46577
  headers: getHeaders,
46462
46578
  fetch: options.fetch
46463
46579
  });
46464
46580
  const createTranscriptionModel = (modelId) => new OpenAITranscriptionModel(modelId, {
46465
46581
  provider: `${providerName}.transcription`,
46466
- url: ({ path: path12 }) => `${baseURL}${path12}`,
46582
+ url: ({ path: path14 }) => `${baseURL}${path14}`,
46467
46583
  headers: getHeaders,
46468
46584
  fetch: options.fetch
46469
46585
  });
46470
46586
  const createSpeechModel = (modelId) => new OpenAISpeechModel(modelId, {
46471
46587
  provider: `${providerName}.speech`,
46472
- url: ({ path: path12 }) => `${baseURL}${path12}`,
46588
+ url: ({ path: path14 }) => `${baseURL}${path14}`,
46473
46589
  headers: getHeaders,
46474
46590
  fetch: options.fetch
46475
46591
  });
@@ -46482,7 +46598,7 @@ function createOpenAI(options = {}) {
46482
46598
  const createResponsesModel = (modelId) => {
46483
46599
  return new OpenAIResponsesLanguageModel(modelId, {
46484
46600
  provider: `${providerName}.responses`,
46485
- url: ({ path: path12 }) => `${baseURL}${path12}`,
46601
+ url: ({ path: path14 }) => `${baseURL}${path14}`,
46486
46602
  headers: getHeaders,
46487
46603
  fetch: options.fetch,
46488
46604
  fileIdPrefixes: ["file-"]
@@ -63027,26 +63143,26 @@ var require_process = __commonJS((exports, module) => {
63027
63143
 
63028
63144
  // ../../node_modules/detect-libc/lib/filesystem.js
63029
63145
  var require_filesystem = __commonJS((exports, module) => {
63030
- var fs8 = __require("fs");
63146
+ var fs10 = __require("fs");
63031
63147
  var LDD_PATH = "/usr/bin/ldd";
63032
63148
  var SELF_PATH = "/proc/self/exe";
63033
63149
  var MAX_LENGTH = 2048;
63034
- var readFileSync2 = (path12) => {
63035
- const fd = fs8.openSync(path12, "r");
63150
+ var readFileSync2 = (path14) => {
63151
+ const fd = fs10.openSync(path14, "r");
63036
63152
  const buffer = Buffer.alloc(MAX_LENGTH);
63037
- const bytesRead = fs8.readSync(fd, buffer, 0, MAX_LENGTH, 0);
63038
- fs8.close(fd, () => {});
63153
+ const bytesRead = fs10.readSync(fd, buffer, 0, MAX_LENGTH, 0);
63154
+ fs10.close(fd, () => {});
63039
63155
  return buffer.subarray(0, bytesRead);
63040
63156
  };
63041
- var readFile = (path12) => new Promise((resolve4, reject) => {
63042
- fs8.open(path12, "r", (err, fd) => {
63157
+ var readFile = (path14) => new Promise((resolve4, reject) => {
63158
+ fs10.open(path14, "r", (err, fd) => {
63043
63159
  if (err) {
63044
63160
  reject(err);
63045
63161
  } else {
63046
63162
  const buffer = Buffer.alloc(MAX_LENGTH);
63047
- fs8.read(fd, buffer, 0, MAX_LENGTH, 0, (_, bytesRead) => {
63163
+ fs10.read(fd, buffer, 0, MAX_LENGTH, 0, (_, bytesRead) => {
63048
63164
  resolve4(buffer.subarray(0, bytesRead));
63049
- fs8.close(fd, () => {});
63165
+ fs10.close(fd, () => {});
63050
63166
  });
63051
63167
  }
63052
63168
  });
@@ -63151,11 +63267,11 @@ var require_detect_libc = __commonJS((exports, module) => {
63151
63267
  }
63152
63268
  return null;
63153
63269
  };
63154
- var familyFromInterpreterPath = (path12) => {
63155
- if (path12) {
63156
- if (path12.includes("/ld-musl-")) {
63270
+ var familyFromInterpreterPath = (path14) => {
63271
+ if (path14) {
63272
+ if (path14.includes("/ld-musl-")) {
63157
63273
  return MUSL;
63158
- } else if (path12.includes("/ld-linux-")) {
63274
+ } else if (path14.includes("/ld-linux-")) {
63159
63275
  return GLIBC;
63160
63276
  }
63161
63277
  }
@@ -63200,8 +63316,8 @@ var require_detect_libc = __commonJS((exports, module) => {
63200
63316
  cachedFamilyInterpreter = null;
63201
63317
  try {
63202
63318
  const selfContent = await readFile(SELF_PATH);
63203
- const path12 = interpreterPath(selfContent);
63204
- cachedFamilyInterpreter = familyFromInterpreterPath(path12);
63319
+ const path14 = interpreterPath(selfContent);
63320
+ cachedFamilyInterpreter = familyFromInterpreterPath(path14);
63205
63321
  } catch (e) {}
63206
63322
  return cachedFamilyInterpreter;
63207
63323
  };
@@ -63212,8 +63328,8 @@ var require_detect_libc = __commonJS((exports, module) => {
63212
63328
  cachedFamilyInterpreter = null;
63213
63329
  try {
63214
63330
  const selfContent = readFileSync2(SELF_PATH);
63215
- const path12 = interpreterPath(selfContent);
63216
- cachedFamilyInterpreter = familyFromInterpreterPath(path12);
63331
+ const path14 = interpreterPath(selfContent);
63332
+ cachedFamilyInterpreter = familyFromInterpreterPath(path14);
63217
63333
  } catch (e) {}
63218
63334
  return cachedFamilyInterpreter;
63219
63335
  };
@@ -64875,18 +64991,18 @@ var require_sharp = __commonJS((exports, module) => {
64875
64991
  `@img/sharp-${runtimePlatform}/sharp.node`,
64876
64992
  "@img/sharp-wasm32/sharp.node"
64877
64993
  ];
64878
- var path12;
64994
+ var path14;
64879
64995
  var sharp;
64880
64996
  var errors4 = [];
64881
- for (path12 of paths) {
64997
+ for (path14 of paths) {
64882
64998
  try {
64883
- sharp = __require(path12);
64999
+ sharp = __require(path14);
64884
65000
  break;
64885
65001
  } catch (err) {
64886
65002
  errors4.push(err);
64887
65003
  }
64888
65004
  }
64889
- if (sharp && path12.startsWith("@img/sharp-linux-x64") && !sharp._isUsingX64V2()) {
65005
+ if (sharp && path14.startsWith("@img/sharp-linux-x64") && !sharp._isUsingX64V2()) {
64890
65006
  const err = new Error("Prebuilt binaries for linux-x64 require v2 microarchitecture");
64891
65007
  err.code = "Unsupported CPU";
64892
65008
  errors4.push(err);
@@ -67748,15 +67864,15 @@ var require_color = __commonJS((exports, module) => {
67748
67864
  };
67749
67865
  }
67750
67866
  function wrapConversion(toModel, graph) {
67751
- const path12 = [graph[toModel].parent, toModel];
67867
+ const path14 = [graph[toModel].parent, toModel];
67752
67868
  let fn = conversions_default[graph[toModel].parent][toModel];
67753
67869
  let cur = graph[toModel].parent;
67754
67870
  while (graph[cur].parent) {
67755
- path12.unshift(graph[cur].parent);
67871
+ path14.unshift(graph[cur].parent);
67756
67872
  fn = link(conversions_default[graph[cur].parent][cur], fn);
67757
67873
  cur = graph[cur].parent;
67758
67874
  }
67759
- fn.conversion = path12;
67875
+ fn.conversion = path14;
67760
67876
  return fn;
67761
67877
  }
67762
67878
  function route(fromModel) {
@@ -68361,7 +68477,7 @@ var require_output = __commonJS((exports, module) => {
68361
68477
  Copyright 2013 Lovell Fuller and others.
68362
68478
  SPDX-License-Identifier: Apache-2.0
68363
68479
  */
68364
- var path12 = __require("path");
68480
+ var path14 = __require("path");
68365
68481
  var is = require_is();
68366
68482
  var sharp = require_sharp();
68367
68483
  var formats = new Map([
@@ -68392,9 +68508,9 @@ var require_output = __commonJS((exports, module) => {
68392
68508
  let err;
68393
68509
  if (!is.string(fileOut)) {
68394
68510
  err = new Error("Missing output file path");
68395
- } else if (is.string(this.options.input.file) && path12.resolve(this.options.input.file) === path12.resolve(fileOut)) {
68511
+ } else if (is.string(this.options.input.file) && path14.resolve(this.options.input.file) === path14.resolve(fileOut)) {
68396
68512
  err = new Error("Cannot use same file for input and output");
68397
- } else if (jp2Regex.test(path12.extname(fileOut)) && !this.constructor.format.jp2k.output.file) {
68513
+ } else if (jp2Regex.test(path14.extname(fileOut)) && !this.constructor.format.jp2k.output.file) {
68398
68514
  err = errJp2Save();
68399
68515
  }
68400
68516
  if (err) {
@@ -75641,11 +75757,11 @@ var init_transformers_node = __esm(() => {
75641
75757
  throw new Error(`The number of external data chunks (${num_chunks}) exceeds the maximum allowed value (${_utils_hub_js__WEBPACK_IMPORTED_MODULE_5__.MAX_EXTERNAL_DATA_CHUNKS}).`);
75642
75758
  }
75643
75759
  for (let i = 0;i < num_chunks; ++i) {
75644
- const path12 = `${baseName}_data${i === 0 ? "" : "_" + i}`;
75645
- const fullPath = `${options.subfolder ?? ""}/${path12}`;
75760
+ const path14 = `${baseName}_data${i === 0 ? "" : "_" + i}`;
75761
+ const fullPath = `${options.subfolder ?? ""}/${path14}`;
75646
75762
  externalDataPromises.push(new Promise(async (resolve4, reject) => {
75647
75763
  const data = await (0, _utils_hub_js__WEBPACK_IMPORTED_MODULE_5__.getModelFile)(pretrained_model_name_or_path, fullPath, true, options, return_path);
75648
- resolve4(data instanceof Uint8Array ? { path: path12, data } : path12);
75764
+ resolve4(data instanceof Uint8Array ? { path: path14, data } : path14);
75649
75765
  }));
75650
75766
  }
75651
75767
  } else if (session_options.externalData !== undefined) {
@@ -88709,7 +88825,7 @@ ${fake_token_around_image}` + `${global_img_token}` + image_token.repeat(image_s
88709
88825
  const blob = new Blob([wav], { type: "audio/wav" });
88710
88826
  return blob;
88711
88827
  }
88712
- async save(path12) {
88828
+ async save(path14) {
88713
88829
  let fn;
88714
88830
  if (_env_js__WEBPACK_IMPORTED_MODULE_3__.apis.IS_BROWSER_ENV) {
88715
88831
  if (_env_js__WEBPACK_IMPORTED_MODULE_3__.apis.IS_WEBWORKER_ENV) {
@@ -88717,14 +88833,14 @@ ${fake_token_around_image}` + `${global_img_token}` + image_token.repeat(image_s
88717
88833
  }
88718
88834
  fn = _core_js__WEBPACK_IMPORTED_MODULE_2__.saveBlob;
88719
88835
  } else if (_env_js__WEBPACK_IMPORTED_MODULE_3__.apis.IS_FS_AVAILABLE) {
88720
- fn = async (path13, blob) => {
88836
+ fn = async (path15, blob) => {
88721
88837
  let buffer = await blob.arrayBuffer();
88722
- node_fs__WEBPACK_IMPORTED_MODULE_5__["default"].writeFileSync(path13, Buffer.from(buffer));
88838
+ node_fs__WEBPACK_IMPORTED_MODULE_5__["default"].writeFileSync(path15, Buffer.from(buffer));
88723
88839
  };
88724
88840
  } else {
88725
88841
  throw new Error("Unable to save because filesystem is disabled in this environment.");
88726
88842
  }
88727
- await fn(path12, this.toBlob());
88843
+ await fn(path14, this.toBlob());
88728
88844
  }
88729
88845
  }
88730
88846
  },
@@ -88820,11 +88936,11 @@ ${fake_token_around_image}` + `${global_img_token}` + image_token.repeat(image_s
88820
88936
  function calculateReflectOffset(i, w) {
88821
88937
  return Math.abs((i + w) % (2 * w) - w);
88822
88938
  }
88823
- function saveBlob(path12, blob) {
88939
+ function saveBlob(path14, blob) {
88824
88940
  const dataURL = URL.createObjectURL(blob);
88825
88941
  const downloadLink = document.createElement("a");
88826
88942
  downloadLink.href = dataURL;
88827
- downloadLink.download = path12;
88943
+ downloadLink.download = path14;
88828
88944
  downloadLink.click();
88829
88945
  downloadLink.remove();
88830
88946
  URL.revokeObjectURL(dataURL);
@@ -89425,8 +89541,8 @@ ${fake_token_around_image}` + `${global_img_token}` + image_token.repeat(image_s
89425
89541
  }
89426
89542
 
89427
89543
  class FileCache {
89428
- constructor(path12) {
89429
- this.path = path12;
89544
+ constructor(path14) {
89545
+ this.path = path14;
89430
89546
  }
89431
89547
  async match(request) {
89432
89548
  let filePath = node_path__WEBPACK_IMPORTED_MODULE_1__["default"].join(this.path, request);
@@ -90182,20 +90298,20 @@ ${fake_token_around_image}` + `${global_img_token}` + image_token.repeat(image_s
90182
90298
  }
90183
90299
  return this;
90184
90300
  }
90185
- async save(path12) {
90301
+ async save(path14) {
90186
90302
  if (IS_BROWSER_OR_WEBWORKER) {
90187
90303
  if (_env_js__WEBPACK_IMPORTED_MODULE_2__.apis.IS_WEBWORKER_ENV) {
90188
90304
  throw new Error("Unable to save an image from a Web Worker.");
90189
90305
  }
90190
- const extension = path12.split(".").pop().toLowerCase();
90306
+ const extension = path14.split(".").pop().toLowerCase();
90191
90307
  const mime = CONTENT_TYPE_MAP.get(extension) ?? "image/png";
90192
90308
  const blob = await this.toBlob(mime);
90193
- (0, _core_js__WEBPACK_IMPORTED_MODULE_0__.saveBlob)(path12, blob);
90309
+ (0, _core_js__WEBPACK_IMPORTED_MODULE_0__.saveBlob)(path14, blob);
90194
90310
  } else if (!_env_js__WEBPACK_IMPORTED_MODULE_2__.apis.IS_FS_AVAILABLE) {
90195
90311
  throw new Error("Unable to save the image because filesystem is disabled in this environment.");
90196
90312
  } else {
90197
90313
  const img = this.toSharp();
90198
- return await img.toFile(path12);
90314
+ return await img.toFile(path14);
90199
90315
  }
90200
90316
  }
90201
90317
  toSharp() {
@@ -99726,10 +99842,10 @@ Note that ${s.bold("include")} statements only accept relation fields.`, a;
99726
99842
  super(t, "P2023", r);
99727
99843
  }
99728
99844
  };
99729
- var fs8 = new WeakMap;
99845
+ var fs10 = new WeakMap;
99730
99846
  function Ep(e) {
99731
- let t = fs8.get(e);
99732
- return t || (t = Object.entries(e), fs8.set(e, t)), t;
99847
+ let t = fs10.get(e);
99848
+ return t || (t = Object.entries(e), fs10.set(e, t)), t;
99733
99849
  }
99734
99850
  function hs(e, t, r) {
99735
99851
  switch (t.type) {
@@ -103697,7 +103813,7 @@ var require_prisma = __commonJS((exports) => {
103697
103813
  Prisma.JsonNull = JsonNull2;
103698
103814
  Prisma.AnyNull = AnyNull2;
103699
103815
  Prisma.NullTypes = NullTypes2;
103700
- var path12 = __require("path");
103816
+ var path14 = __require("path");
103701
103817
  exports.Prisma.TransactionIsolationLevel = makeStrictEnum2({
103702
103818
  ReadUncommitted: "ReadUncommitted",
103703
103819
  ReadCommitted: "ReadCommitted",
@@ -109241,9 +109357,7 @@ var init_postgres_vector_store = __esm(() => {
109241
109357
  floatsToBit(v) {
109242
109358
  return v.map((x) => x >= 0 ? "1" : "0").join("");
109243
109359
  }
109244
- async ensureInitialized() {
109245
- if (this.pool && this.initialized)
109246
- return this.pool;
109360
+ async createPool() {
109247
109361
  const pg2 = await Promise.resolve().then(() => (init_esm6(), exports_esm));
109248
109362
  const PgPool = pg2.default?.Pool ?? pg2.Pool;
109249
109363
  const poolConfig = {
@@ -109252,7 +109366,12 @@ var init_postgres_vector_store = __esm(() => {
109252
109366
  idleTimeoutMillis: 30000,
109253
109367
  connectionTimeoutMillis: 5000
109254
109368
  };
109255
- const pool = new PgPool(poolConfig);
109369
+ return new PgPool(poolConfig);
109370
+ }
109371
+ async ensureInitialized() {
109372
+ if (this.pool && this.initialized)
109373
+ return this.pool;
109374
+ const pool = this.pool ?? await this.createPool();
109256
109375
  this.pool = pool;
109257
109376
  const client = await pool.connect();
109258
109377
  try {
@@ -109643,28 +109762,23 @@ var init_postgres_vector_store = __esm(() => {
109643
109762
  async getPool() {
109644
109763
  if (this.pool)
109645
109764
  return this.pool;
109646
- const pg2 = await Promise.resolve().then(() => (init_esm6(), exports_esm));
109647
- const PgPool = pg2.default?.Pool ?? pg2.Pool;
109648
- const poolConfig = {
109649
- connectionString: this.config.connectionString,
109650
- max: this.config.poolSize,
109651
- idleTimeoutMillis: 30000,
109652
- connectionTimeoutMillis: 5000
109653
- };
109654
- this.pool = new PgPool(poolConfig);
109765
+ this.pool = await this.createPool();
109655
109766
  return this.pool;
109656
109767
  }
109657
109768
  async listAllProjectsAcrossDimensions() {
109658
109769
  const pool = await this.getPool();
109659
109770
  const { rows: tables } = await pool.query(`
109660
- SELECT tablename FROM pg_tables
109661
- WHERE tablename = 'vector_documents'
109662
- OR tablename ~ '^vector_documents_[0-9]+d$'
109771
+ SELECT schemaname, tablename FROM pg_tables
109772
+ WHERE schemaname = current_schema()
109773
+ AND (tablename = 'vector_documents' OR tablename ~ '^vector_documents_[0-9]+d$')
109663
109774
  ORDER BY tablename
109664
109775
  `);
109665
109776
  if (tables.length === 0)
109666
109777
  return [];
109667
- const unionParts = tables.map((t) => `SELECT project_id, COUNT(*)::int AS doc_count, MAX(updated_at) AS last_updated, SUM(LENGTH(content))::bigint AS total_size FROM ${t.tablename} WHERE id NOT LIKE '_metadata:%' GROUP BY project_id`).join(" UNION ALL ");
109778
+ const unionParts = tables.map((t) => {
109779
+ const qualified = `"${t.schemaname}"."${t.tablename}"`;
109780
+ return `SELECT project_id, COUNT(*)::int AS doc_count, MAX(updated_at) AS last_updated, SUM(LENGTH(content))::bigint AS total_size FROM ${qualified} WHERE id NOT LIKE '_metadata:%' GROUP BY project_id`;
109781
+ }).join(" UNION ALL ");
109668
109782
  const { rows } = await pool.query(`
109669
109783
  SELECT project_id,
109670
109784
  SUM(doc_count)::int AS doc_count,
@@ -109773,7 +109887,7 @@ var init_vector_store_factory = __esm(() => {
109773
109887
  });
109774
109888
 
109775
109889
  // ../../packages/core/dist/services/search/search-cache-pg.js
109776
- import crypto5 from "crypto";
109890
+ import crypto6 from "crypto";
109777
109891
 
109778
109892
  class SearchCachePg {
109779
109893
  pool = null;
@@ -109830,7 +109944,7 @@ class SearchCachePg {
109830
109944
  projectId,
109831
109945
  options: this.normalizeOptions(options)
109832
109946
  });
109833
- return crypto5.createHash("sha256").update(payload).digest("hex");
109947
+ return crypto6.createHash("sha256").update(payload).digest("hex");
109834
109948
  }
109835
109949
  normalizeOptions(options) {
109836
109950
  const searchAffectingParams = [
@@ -116566,10 +116680,10 @@ var init_chunker_code = __esm(() => {
116566
116680
  });
116567
116681
 
116568
116682
  // ../../packages/core/dist/services/search/smart-chunker.js
116569
- import path12 from "path";
116683
+ import path14 from "path";
116570
116684
  function smartChunk(content, filePath, config3 = {}) {
116571
116685
  const cfg = { ...DEFAULT_CONFIG, ...config3 };
116572
- const ext2 = path12.extname(filePath).toLowerCase();
116686
+ const ext2 = path14.extname(filePath).toLowerCase();
116573
116687
  const relativePath = filePath;
116574
116688
  const fileImports = isCodeFile(ext2) ? extractFileImports(content, ext2) : undefined;
116575
116689
  let chunks;
@@ -116876,8 +116990,8 @@ var init_managed_run_repository_pg = __esm(() => {
116876
116990
  });
116877
116991
 
116878
116992
  // ../../packages/core/dist/services/search/project-indexer.js
116879
- import fs8 from "fs/promises";
116880
- import path13 from "path";
116993
+ import fs10 from "fs/promises";
116994
+ import path15 from "path";
116881
116995
  import { randomUUID as randomUUID3 } from "crypto";
116882
116996
  async function runWithIndexLock(lockMap, projectId, work) {
116883
116997
  const prevLock = lockMap.get(projectId);
@@ -116920,7 +117034,7 @@ async function indexProjectInternal(deps, projectPath, projectId, options = {})
116920
117034
  dot: false
116921
117035
  });
116922
117036
  const filteredFiles = files.filter((file2) => {
116923
- const relativePath = path13.relative(projectPath, file2);
117037
+ const relativePath = path15.relative(projectPath, file2);
116924
117038
  const shouldIgnore = ig.ignores(relativePath);
116925
117039
  if (shouldIgnore) {
116926
117040
  logger.debug("Ignoring file per .gitignore during indexing", {
@@ -116960,7 +117074,7 @@ async function indexProjectInternal(deps, projectPath, projectId, options = {})
116960
117074
  });
116961
117075
  }
116962
117076
  }
116963
- const indexedFilesList = filteredFiles.map((f) => path13.relative(projectPath, f));
117077
+ const indexedFilesList = filteredFiles.map((f) => path15.relative(projectPath, f));
116964
117078
  await deps.indexManager.updateIndexMetadata(projectId, projectPath, indexedFilesList);
116965
117079
  logger.info("Project indexing completed", {
116966
117080
  projectId,
@@ -117085,7 +117199,7 @@ async function ensureFreshIndex(deps, projectId, projectPath, options = {}) {
117085
117199
  let errors4 = 0;
117086
117200
  for (const relativeFilePath of filesToReindex) {
117087
117201
  try {
117088
- const fullPath = path13.join(projectPath, relativeFilePath);
117202
+ const fullPath = path15.join(projectPath, relativeFilePath);
117089
117203
  const result = await deps.indexFile(fullPath, projectId, projectPath, centralityMap);
117090
117204
  filesIndexed++;
117091
117205
  chunksIndexed += result.chunks;
@@ -117136,8 +117250,8 @@ async function checkSearchAdmission(deps, projectId, projectPath) {
117136
117250
  }
117137
117251
  async function indexFile(deps, filePath, projectId, projectRoot, centralityMap) {
117138
117252
  projectId = await getProjectIdentityAliasResolver().resolve(projectId);
117139
- const content = await fs8.readFile(filePath, "utf-8");
117140
- const relativePath = path13.relative(projectRoot, filePath);
117253
+ const content = await fs10.readFile(filePath, "utf-8");
117254
+ const relativePath = path15.relative(projectRoot, filePath);
117141
117255
  const maxFileSize = config.get("security").maxFileSize || 1024 * 1024;
117142
117256
  if (content.length > maxFileSize) {
117143
117257
  logger.warn("File too large, skipping", {
@@ -117157,7 +117271,7 @@ async function indexFile(deps, filePath, projectId, projectRoot, centralityMap)
117157
117271
  chunkIndex: i,
117158
117272
  totalChunks: chunks.length,
117159
117273
  type: chunk.type,
117160
- language: path13.extname(filePath).slice(1),
117274
+ language: path15.extname(filePath).slice(1),
117161
117275
  lineStart: chunk.lineStart,
117162
117276
  lineEnd: chunk.lineEnd,
117163
117277
  label: chunk.label,
@@ -120488,16 +120602,16 @@ function detectRoutes(httpEdges, defs, opts = {}) {
120488
120602
  const seen = new Set;
120489
120603
  const out = [];
120490
120604
  for (const e of httpEdges) {
120491
- const path14 = e.route;
120492
- if (!path14)
120605
+ const path16 = e.route;
120606
+ if (!path16)
120493
120607
  continue;
120494
120608
  const method = (e.method ?? "ANY").toUpperCase();
120495
- const key = method + " " + path14;
120609
+ const key = method + " " + path16;
120496
120610
  if (seen.has(key))
120497
120611
  continue;
120498
120612
  seen.add(key);
120499
120613
  out.push({
120500
- path: path14,
120614
+ path: path16,
120501
120615
  method: e.method,
120502
120616
  file: e.fromFile,
120503
120617
  handler: e.targetFqn ?? e.symbolName
@@ -120508,12 +120622,12 @@ function detectRoutes(httpEdges, defs, opts = {}) {
120508
120622
  continue;
120509
120623
  const parsed = parseRouteName(d.name);
120510
120624
  const method = parsed?.method ?? "ANY";
120511
- const path14 = parsed?.path ?? d.name;
120512
- const key = method + " " + path14;
120625
+ const path16 = parsed?.path ?? d.name;
120626
+ const key = method + " " + path16;
120513
120627
  if (seen.has(key))
120514
120628
  continue;
120515
120629
  seen.add(key);
120516
- out.push({ path: path14, method: parsed?.method, file: d.filePath, handler: d.name });
120630
+ out.push({ path: path16, method: parsed?.method, file: d.filePath, handler: d.name });
120517
120631
  }
120518
120632
  for (const d of defs) {
120519
120633
  const parsed = parseRouteName(d.name);
@@ -120734,8 +120848,8 @@ __export(exports_symbol_graph_service, {
120734
120848
  symbolGraphService: () => symbolGraphService,
120735
120849
  SymbolGraphService: () => SymbolGraphService
120736
120850
  });
120737
- import path14 from "path";
120738
- import fs9 from "fs/promises";
120851
+ import path16 from "path";
120852
+ import fs11 from "fs/promises";
120739
120853
 
120740
120854
  class SymbolGraphService {
120741
120855
  identityLookup;
@@ -121063,7 +121177,7 @@ class SymbolGraphService {
121063
121177
  async readSnippet(relativePath, lineStart, lineEnd, projectId) {
121064
121178
  try {
121065
121179
  const absolutePath = await this.resolveToAbsolute(relativePath, projectId);
121066
- const content = await fs9.readFile(absolutePath, "utf-8");
121180
+ const content = await fs11.readFile(absolutePath, "utf-8");
121067
121181
  const lines = content.split(`
121068
121182
  `);
121069
121183
  return lines.slice(Math.max(0, lineStart - 1), Math.min(lines.length, lineEnd)).join(`
@@ -121075,7 +121189,7 @@ class SymbolGraphService {
121075
121189
  async readContext(relativePath, lineNumber, contextLines, projectId) {
121076
121190
  try {
121077
121191
  const absolutePath = await this.resolveToAbsolute(relativePath, projectId);
121078
- const content = await fs9.readFile(absolutePath, "utf-8");
121192
+ const content = await fs11.readFile(absolutePath, "utf-8");
121079
121193
  const lines = content.split(`
121080
121194
  `);
121081
121195
  const start = Math.max(0, lineNumber - contextLines - 1);
@@ -121088,7 +121202,7 @@ class SymbolGraphService {
121088
121202
  }
121089
121203
  async resolveToAbsolute(relativePath, projectId) {
121090
121204
  const root = await this.getProjectRoot(projectId);
121091
- return root ? path14.resolve(root, relativePath) : relativePath;
121205
+ return root ? path16.resolve(root, relativePath) : relativePath;
121092
121206
  }
121093
121207
  async getProjectRoot(projectId) {
121094
121208
  const cached2 = this.projectRootCache.get(projectId);
@@ -122866,31 +122980,31 @@ class TracePathService {
122866
122980
  const chains = [];
122867
122981
  const seen = new Set;
122868
122982
  let walks = 0;
122869
- const walk = (fqn, path15) => {
122983
+ const walk = (fqn, path17) => {
122870
122984
  if (chains.length >= CHAIN_CAP)
122871
122985
  return;
122872
122986
  if (walks >= MAX_WALKS)
122873
122987
  return;
122874
122988
  walks++;
122875
- const key = path15.join("\u2192");
122989
+ const key = path17.join("\u2192");
122876
122990
  if (seen.has(key))
122877
122991
  return;
122878
122992
  seen.add(key);
122879
122993
  const next = adj.get(fqn);
122880
122994
  if (!next || next.length === 0 || !whoHasChild.has(fqn)) {
122881
- if (path15.length > 1)
122882
- chains.push(path15.map((n) => this.fqnToName(n)).join(" \u2192 "));
122995
+ if (path17.length > 1)
122996
+ chains.push(path17.map((n) => this.fqnToName(n)).join(" \u2192 "));
122883
122997
  return;
122884
122998
  }
122885
122999
  for (const child of next) {
122886
123000
  if (chains.length >= CHAIN_CAP || walks >= MAX_WALKS)
122887
123001
  return;
122888
- if (path15.includes(child)) {
122889
- const cycled = [...path15, `${this.fqnToName(child)}\u21BA`];
123002
+ if (path17.includes(child)) {
123003
+ const cycled = [...path17, `${this.fqnToName(child)}\u21BA`];
122890
123004
  chains.push(cycled.map((n) => n).join(" \u2192 "));
122891
123005
  continue;
122892
123006
  }
122893
- walk(child, [...path15, child]);
123007
+ walk(child, [...path17, child]);
122894
123008
  }
122895
123009
  };
122896
123010
  for (const seed of seeds) {
@@ -124884,9 +124998,9 @@ var init_l1_memory_cache = __esm(() => {
124884
124998
  });
124885
124999
 
124886
125000
  // ../../packages/core/dist/services/health/local-health-checker.js
124887
- import fs10 from "fs/promises";
125001
+ import fs12 from "fs/promises";
124888
125002
  import { existsSync as existsSync3 } from "fs";
124889
- import path15 from "path";
125003
+ import path17 from "path";
124890
125004
 
124891
125005
  class LocalHealthChecker {
124892
125006
  ollamaBaseUrl = process.env.OLLAMA_BASE_URL || "http://localhost:11434";
@@ -124920,10 +125034,10 @@ class LocalHealthChecker {
124920
125034
  const start = Date.now();
124921
125035
  try {
124922
125036
  if (!existsSync3(this.dataDir))
124923
- await fs10.mkdir(this.dataDir, { recursive: true });
124924
- const probe = path15.join(this.dataDir, ".health-check-test");
124925
- await fs10.writeFile(probe, "ok");
124926
- await fs10.unlink(probe);
125037
+ await fs12.mkdir(this.dataDir, { recursive: true });
125038
+ const probe = path17.join(this.dataDir, ".health-check-test");
125039
+ await fs12.writeFile(probe, "ok");
125040
+ await fs12.unlink(probe);
124927
125041
  return { available: true, latency: Date.now() - start, details: { path: this.dataDir, writable: true } };
124928
125042
  } catch (error51) {
124929
125043
  return { available: false, latency: Date.now() - start, error: `Data directory error: ${error51.message}` };
@@ -128022,9 +128136,9 @@ var init_scheduler2 = __esm(() => {
128022
128136
  });
128023
128137
 
128024
128138
  // ../../packages/core/dist/services/pricing/models-dev-client.js
128025
- import fs11 from "fs/promises";
128139
+ import fs13 from "fs/promises";
128026
128140
  import { existsSync as existsSync4 } from "fs";
128027
- import path16 from "path";
128141
+ import path18 from "path";
128028
128142
  function getModelsDevClient() {
128029
128143
  if (!clientInstance) {
128030
128144
  clientInstance = new ModelsDevClient;
@@ -128044,7 +128158,7 @@ var init_models_dev_client = __esm(() => {
128044
128158
  memoryCacheTimestamp = 0;
128045
128159
  getLocalCachePath() {
128046
128160
  const dataDir = config.get("dataDir");
128047
- return path16.join(dataDir, ModelsDevClient.LOCAL_CACHE_FILE);
128161
+ return path18.join(dataDir, ModelsDevClient.LOCAL_CACHE_FILE);
128048
128162
  }
128049
128163
  async loadLocalCache() {
128050
128164
  const cachePath = this.getLocalCachePath();
@@ -128052,7 +128166,7 @@ var init_models_dev_client = __esm(() => {
128052
128166
  if (!existsSync4(cachePath)) {
128053
128167
  return null;
128054
128168
  }
128055
- const content = await fs11.readFile(cachePath, "utf-8");
128169
+ const content = await fs13.readFile(cachePath, "utf-8");
128056
128170
  const data = JSON.parse(content);
128057
128171
  const age = Date.now() - data.timestamp;
128058
128172
  if (age > ModelsDevClient.LOCAL_CACHE_TTL) {
@@ -128079,14 +128193,14 @@ var init_models_dev_client = __esm(() => {
128079
128193
  async saveLocalCache(models) {
128080
128194
  const cachePath = this.getLocalCachePath();
128081
128195
  try {
128082
- const dir = path16.dirname(cachePath);
128083
- await fs11.mkdir(dir, { recursive: true });
128196
+ const dir = path18.dirname(cachePath);
128197
+ await fs13.mkdir(dir, { recursive: true });
128084
128198
  const data = {
128085
128199
  timestamp: Date.now(),
128086
128200
  version: "1.0.0",
128087
128201
  models: Object.fromEntries(models)
128088
128202
  };
128089
- await fs11.writeFile(cachePath, JSON.stringify(data), "utf-8");
128203
+ await fs13.writeFile(cachePath, JSON.stringify(data), "utf-8");
128090
128204
  logger.debug("Saved pricing to local cache", {
128091
128205
  models: models.size,
128092
128206
  path: cachePath
@@ -128415,7 +128529,7 @@ var init_models_dev_client = __esm(() => {
128415
128529
  const cachePath = this.getLocalCachePath();
128416
128530
  try {
128417
128531
  if (existsSync4(cachePath)) {
128418
- await fs11.unlink(cachePath);
128532
+ await fs13.unlink(cachePath);
128419
128533
  logger.debug("Local pricing cache file deleted");
128420
128534
  }
128421
128535
  } catch (error51) {
@@ -129018,8 +129132,8 @@ function stripNul(content) {
129018
129132
  }
129019
129133
 
129020
129134
  // ../../packages/core/dist/services/etl/stages/discover.js
129021
- import fs12 from "fs/promises";
129022
- import path17 from "path";
129135
+ import fs14 from "fs/promises";
129136
+ import path19 from "path";
129023
129137
  import { createHash as createHash8 } from "crypto";
129024
129138
 
129025
129139
  class DiscoverStage {
@@ -129045,7 +129159,7 @@ class DiscoverStage {
129045
129159
  dot: false,
129046
129160
  absolute: false
129047
129161
  });
129048
- relPaths = found.map((p) => path17.isAbsolute(p) ? path17.relative(ctx.projectPath, p) : p).filter((p) => !ig.ignores(p) && applyPolicy(p, policy) !== "Drop");
129162
+ relPaths = found.map((p) => path19.isAbsolute(p) ? path19.relative(ctx.projectPath, p) : p).filter((p) => !ig.ignores(p) && applyPolicy(p, policy) !== "Drop");
129049
129163
  }
129050
129164
  if (ctx.resumeCursor?.path) {
129051
129165
  const cursorPath = ctx.resumeCursor.path;
@@ -129104,10 +129218,10 @@ class DiscoverStage {
129104
129218
  return discovered;
129105
129219
  }
129106
129220
  async processFile(ctx, relativePath, forceReindex) {
129107
- const absolutePath = path17.join(ctx.projectPath, relativePath);
129221
+ const absolutePath = path19.join(ctx.projectPath, relativePath);
129108
129222
  try {
129109
- const stat = await fs12.stat(absolutePath);
129110
- const content = stripNul(await fs12.readFile(absolutePath, "utf-8"));
129223
+ const stat = await fs14.stat(absolutePath);
129224
+ const content = stripNul(await fs14.readFile(absolutePath, "utf-8"));
129111
129225
  const contentHash = createHash8("sha256").update(content).digest("hex");
129112
129226
  let needsReparse = forceReindex;
129113
129227
  if (!forceReindex) {
@@ -129150,8 +129264,8 @@ class DiscoverStage {
129150
129264
  ig.add(pattern);
129151
129265
  }
129152
129266
  try {
129153
- const gitignorePath = path17.join(projectPath, ".gitignore");
129154
- const gitignoreContent = await fs12.readFile(gitignorePath, "utf8");
129267
+ const gitignorePath = path19.join(projectPath, ".gitignore");
129268
+ const gitignoreContent = await fs14.readFile(gitignorePath, "utf8");
129155
129269
  const rules = gitignoreContent.split(`
129156
129270
  `).map((line) => line.trim()).filter((line) => line && !line.startsWith("#"));
129157
129271
  ig.add(rules);
@@ -130506,8 +130620,8 @@ function rustUseLeaves(node, source, prefix = []) {
130506
130620
  }
130507
130621
  if (node.type === "use_wildcard")
130508
130622
  return [{ path: [...prefix, "*"], glob: true }];
130509
- const path18 = rustPathSegments(node, source);
130510
- return path18.length ? [{ path: [...prefix, ...path18] }] : [];
130623
+ const path20 = rustPathSegments(node, source);
130624
+ return path20.length ? [{ path: [...prefix, ...path20] }] : [];
130511
130625
  }
130512
130626
  function functionalCaptures(captures, source, family) {
130513
130627
  if (family !== "clojure")
@@ -131479,8 +131593,8 @@ var init_structural_runtime = __esm(() => {
131479
131593
  });
131480
131594
 
131481
131595
  // ../../packages/core/dist/services/etl/stages/parse.js
131482
- import path18 from "path";
131483
- import fs13 from "fs/promises";
131596
+ import path20 from "path";
131597
+ import fs15 from "fs/promises";
131484
131598
  function resolveChunkerMaxChars() {
131485
131599
  const global2 = Number(process.env.EMBEDDING_MAX_CHARS);
131486
131600
  if (Number.isFinite(global2) && global2 > 0)
@@ -131508,8 +131622,8 @@ class ParseStage {
131508
131622
  const results = new Map;
131509
131623
  let processed = 0;
131510
131624
  const phases = [
131511
- files.filter((file2) => path18.extname(file2.relativePath).toLowerCase() !== ".h"),
131512
- files.filter((file2) => path18.extname(file2.relativePath).toLowerCase() === ".h")
131625
+ files.filter((file2) => path20.extname(file2.relativePath).toLowerCase() !== ".h"),
131626
+ files.filter((file2) => path20.extname(file2.relativePath).toLowerCase() === ".h")
131513
131627
  ];
131514
131628
  const batches = phases.flatMap((phase) => Array.from({ length: Math.ceil(phase.length / BATCH_SIZE) }, (_, index) => phase.slice(index * BATCH_SIZE, (index + 1) * BATCH_SIZE)));
131515
131629
  for (const batch of batches) {
@@ -131547,19 +131661,19 @@ class ParseStage {
131547
131661
  return files.map((file2) => results.get(file2.relativePath));
131548
131662
  }
131549
131663
  recordHeaderImporterEvidence(ctx, files, parsedFiles) {
131550
- const knownHeaders = new Set(files.filter((file2) => path18.extname(file2.relativePath).toLowerCase() === ".h").map((file2) => path18.posix.normalize(file2.relativePath)));
131664
+ const knownHeaders = new Set(files.filter((file2) => path20.extname(file2.relativePath).toLowerCase() === ".h").map((file2) => path20.posix.normalize(file2.relativePath)));
131551
131665
  const mutable = {
131552
131666
  ...ctx.structuralHeaderEvidenceByFile
131553
131667
  };
131554
131668
  for (const parsed of parsedFiles) {
131555
- const extension = path18.extname(parsed.file.relativePath).toLowerCase();
131669
+ const extension = path20.extname(parsed.file.relativePath).toLowerCase();
131556
131670
  const key = extension === ".c" ? "cImporters" : [".cpp", ".hpp"].includes(extension) ? "cppImporters" : undefined;
131557
131671
  if (!key)
131558
131672
  continue;
131559
131673
  for (const imported of parsed.rawImports) {
131560
131674
  if (!["c_include", "cpp_include"].includes(imported.form) || imported.specifier.startsWith("<"))
131561
131675
  continue;
131562
- const header = path18.posix.normalize(path18.posix.join(path18.posix.dirname(parsed.file.relativePath), imported.specifier));
131676
+ const header = path20.posix.normalize(path20.posix.join(path20.posix.dirname(parsed.file.relativePath), imported.specifier));
131563
131677
  if (!knownHeaders.has(header))
131564
131678
  continue;
131565
131679
  const existing = mutable[header] ?? {};
@@ -131570,9 +131684,9 @@ class ParseStage {
131570
131684
  }
131571
131685
  async parseFile(ctx, file2) {
131572
131686
  if (!file2.needsReparse) {
131573
- const extension = path18.extname(file2.relativePath).toLowerCase();
131687
+ const extension = path20.extname(file2.relativePath).toLowerCase();
131574
131688
  if ([".c", ".cpp", ".hpp"].includes(extension)) {
131575
- const content = file2.snapshotContent ?? await fs13.readFile(file2.absolutePath, "utf8");
131689
+ const content = file2.snapshotContent ?? await fs15.readFile(file2.absolutePath, "utf8");
131576
131690
  const outcome = await this.runtime.parse({ extension, source: Buffer.from(content) });
131577
131691
  if (outcome.status === "failed")
131578
131692
  throw new StructuralEtlParseError(file2.relativePath, outcome.failureKind, `Structural evidence parse failed (${outcome.failureKind})`, outcome.diagnosticCount, outcome.diagnostics.slice(0, 10));
@@ -131584,8 +131698,8 @@ class ParseStage {
131584
131698
  return { file: file2, chunks: [], symbols: [], rawImports: [], rawEdges: [] };
131585
131699
  }
131586
131700
  try {
131587
- const content = file2.snapshotContent ?? await fs13.readFile(file2.absolutePath, "utf-8");
131588
- const ext2 = path18.extname(file2.relativePath).toLowerCase();
131701
+ const content = file2.snapshotContent ?? await fs15.readFile(file2.absolutePath, "utf-8");
131702
+ const ext2 = path20.extname(file2.relativePath).toLowerCase();
131589
131703
  const chunkerMaxChars = resolveChunkerMaxChars();
131590
131704
  const chunks = smartChunk(content, file2.relativePath, chunkerMaxChars ? { maxChunkChars: chunkerMaxChars } : {});
131591
131705
  let symbols;
@@ -132139,7 +132253,7 @@ var init_resolver = __esm(() => {
132139
132253
  });
132140
132254
 
132141
132255
  // ../../packages/core/dist/services/structural/resolvers/typescript.js
132142
- import path19 from "path";
132256
+ import path21 from "path";
132143
132257
  function candidates(identities) {
132144
132258
  return Object.freeze(identities.map((identity) => Object.freeze({
132145
132259
  fqn: identity.fqn,
@@ -132234,7 +132348,7 @@ function probe(base, known, dialect = "typescript") {
132234
132348
  const bases = /\.[cm]?jsx?$/u.test(base) ? [base.replace(/\.[cm]?jsx?$/u, ".ts"), base.replace(/\.[cm]?jsx?$/u, ".tsx"), base] : [base];
132235
132349
  for (const candidateBase of bases)
132236
132350
  for (const suffix of DIALECT_PROBES[dialect] ?? [""]) {
132237
- const value = path19.posix.normalize(`${candidateBase}${suffix}`);
132351
+ const value = path21.posix.normalize(`${candidateBase}${suffix}`);
132238
132352
  if (!value.startsWith("../") && value !== ".." && known.has(value))
132239
132353
  return value;
132240
132354
  }
@@ -132243,7 +132357,7 @@ function probe(base, known, dialect = "typescript") {
132243
132357
  function resolveStructuralSpecifier(specifier, fromFile, build, dialect = "typescript") {
132244
132358
  const known = new Set(build.knownFiles.map(normalizeStructuralFile));
132245
132359
  if (specifier.startsWith("./") || specifier.startsWith("../")) {
132246
- return probe(path19.posix.join(path19.posix.dirname(fromFile), specifier), known, dialect);
132360
+ return probe(path21.posix.join(path21.posix.dirname(fromFile), specifier), known, dialect);
132247
132361
  }
132248
132362
  const aliases = build.pathAliasesByFile?.[normalizeStructuralFile(fromFile)] ?? build.pathAliases ?? [];
132249
132363
  for (const alias of aliases) {
@@ -132507,7 +132621,7 @@ var init_scripting2 = __esm(() => {
132507
132621
  });
132508
132622
 
132509
132623
  // ../../packages/core/dist/services/structural/resolvers/systems.js
132510
- import path20 from "path";
132624
+ import path22 from "path";
132511
132625
  var DIALECTS, SYSTEMS_LANGUAGE_RESOLVER;
132512
132626
  var init_systems2 = __esm(() => {
132513
132627
  init_typescript2();
@@ -132526,7 +132640,7 @@ var init_systems2 = __esm(() => {
132526
132640
  const bindings = item.bindings.map((binding) => binding.imported === "*" && binding.local === "*" && unresolvedTarget && !unresolvedTarget.qualifier ? { ...binding, imported: unresolvedTarget.name, local: unresolvedTarget.name } : binding);
132527
132641
  if (item.specifier === "crate" || item.specifier.startsWith("crate/")) {
132528
132642
  const crateRoot = file2.file.startsWith("src/") ? "src" : "";
132529
- return { ...item, bindings, specifier: `./${path20.posix.relative(path20.posix.dirname(file2.file), path20.posix.join(crateRoot, item.specifier.replace(/^crate\/?/u, "")))}` };
132643
+ return { ...item, bindings, specifier: `./${path22.posix.relative(path22.posix.dirname(file2.file), path22.posix.join(crateRoot, item.specifier.replace(/^crate\/?/u, "")))}` };
132530
132644
  }
132531
132645
  if (item.specifier === "self" || item.specifier.startsWith("self/"))
132532
132646
  return { ...item, bindings, specifier: `./${item.specifier.replace(/^self\/?/u, "")}` };
@@ -132624,8 +132738,8 @@ var init_data_document2 = __esm(() => {
132624
132738
  });
132625
132739
 
132626
132740
  // ../../packages/core/dist/services/etl/stages/resolve.js
132627
- import path21 from "path";
132628
- import fs14 from "fs";
132741
+ import path23 from "path";
132742
+ import fs16 from "fs";
132629
132743
 
132630
132744
  class ResolveStage {
132631
132745
  symbolRepository;
@@ -132649,7 +132763,7 @@ class ResolveStage {
132649
132763
  const structuralDocuments = files.flatMap((file2) => {
132650
132764
  if (!file2.structure)
132651
132765
  return [];
132652
- const language = resolveStructuralLanguage(path21.extname(file2.file.relativePath));
132766
+ const language = resolveStructuralLanguage(path23.extname(file2.file.relativePath));
132653
132767
  if (language.status !== "supported")
132654
132768
  throw new Error(`structural_manifest_missing:${file2.file.relativePath}`);
132655
132769
  return [{
@@ -132661,13 +132775,13 @@ class ResolveStage {
132661
132775
  }];
132662
132776
  });
132663
132777
  const currentStructuralFiles = new Set(structuralDocuments.map((document2) => document2.file));
132664
- const skippedStructuralFiles = new Set(files.filter((item) => !item.file.needsReparse && STRUCTURAL_SEED_EXTENSIONS.has(path21.extname(item.file.relativePath).toLowerCase())).map((item) => item.file.relativePath));
132778
+ const skippedStructuralFiles = new Set(files.filter((item) => !item.file.needsReparse && STRUCTURAL_SEED_EXTENSIONS.has(path23.extname(item.file.relativePath).toLowerCase())).map((item) => item.file.relativePath));
132665
132779
  const pathAliasesByFile = Object.fromEntries([...knownRelPaths].map((file2) => [
132666
132780
  file2,
132667
132781
  this.structuralAliasesFor(file2, rootAliases, monorepoPackages)
132668
132782
  ]));
132669
132783
  const buildMetadata = { knownFiles: [...knownRelPaths], pathAliasesByFile };
132670
- const seedRows = repositoryDefinitions.filter((definition) => STRUCTURAL_SEED_EXTENSIONS.has(path21.extname(definition.file_path).toLowerCase())).filter((definition) => knownRelPaths.has(definition.file_path) && skippedStructuralFiles.has(definition.file_path)).filter((definition) => !currentStructuralFiles.has(definition.file_path));
132784
+ const seedRows = repositoryDefinitions.filter((definition) => STRUCTURAL_SEED_EXTENSIONS.has(path23.extname(definition.file_path).toLowerCase())).filter((definition) => knownRelPaths.has(definition.file_path) && skippedStructuralFiles.has(definition.file_path)).filter((definition) => !currentStructuralFiles.has(definition.file_path));
132671
132785
  const seedIds = new Set;
132672
132786
  for (const definition of seedRows) {
132673
132787
  if (seedIds.has(definition.id))
@@ -132760,7 +132874,7 @@ class ResolveStage {
132760
132874
  if (parsed.file !== definition.file_path) {
132761
132875
  throw new Error(`structural_repository_seed_file_mismatch:${definition.id}`);
132762
132876
  }
132763
- const language = resolveStructuralLanguage(path21.extname(definition.file_path));
132877
+ const language = resolveStructuralLanguage(path23.extname(definition.file_path));
132764
132878
  if (language.status !== "supported")
132765
132879
  throw new Error(`structural_repository_seed_language:${definition.id}`);
132766
132880
  let identity;
@@ -132812,7 +132926,7 @@ class ResolveStage {
132812
132926
  });
132813
132927
  }
132814
132928
  resolveFile(parsed, projectPath, knownRelPaths, rootAliases, monorepoPackages, symbolIndex, knownFqns) {
132815
- const fromDir = path21.dirname(path21.join(projectPath, parsed.file.relativePath));
132929
+ const fromDir = path23.dirname(path23.join(projectPath, parsed.file.relativePath));
132816
132930
  const packageAliases = this.getPackageAliases(parsed.file.relativePath, monorepoPackages);
132817
132931
  const allAliases = [...packageAliases, ...rootAliases];
132818
132932
  const resolvedImports = parsed.rawImports.map((raw2) => {
@@ -132883,7 +132997,7 @@ class ResolveStage {
132883
132997
  index.set(def.name, `${def.file_path}#${def.name}`);
132884
132998
  }
132885
132999
  } catch (err) {
132886
- const skippedStructural = files.some((file2) => !file2.file.needsReparse && STRUCTURAL_SEED_EXTENSIONS.has(path21.extname(file2.file.relativePath).toLowerCase()));
133000
+ const skippedStructural = files.some((file2) => !file2.file.needsReparse && STRUCTURAL_SEED_EXTENSIONS.has(path23.extname(file2.file.relativePath).toLowerCase()));
132887
133001
  if (skippedStructural)
132888
133002
  throw new Error("structural_repository_seed_failed", { cause: err });
132889
133003
  logger.warn("buildSymbolIndex: repo seed failed, in-batch only", {
@@ -132907,7 +133021,7 @@ class ResolveStage {
132907
133021
  }
132908
133022
  resolveSpecifier(specifier, fromDir, projectPath, knownRelPaths, aliases) {
132909
133023
  if (specifier.startsWith("./") || specifier.startsWith("../")) {
132910
- const resolved = this.probeExtensions(path21.resolve(fromDir, specifier), projectPath, knownRelPaths);
133024
+ const resolved = this.probeExtensions(path23.resolve(fromDir, specifier), projectPath, knownRelPaths);
132911
133025
  return { resolvedPath: resolved, external: false };
132912
133026
  }
132913
133027
  for (const alias of aliases) {
@@ -132915,8 +133029,8 @@ class ResolveStage {
132915
133029
  const suffix = specifier.slice(alias.prefix.length);
132916
133030
  for (const target of alias.targets) {
132917
133031
  const cleanTarget = target.replace(/\/\*$/, "");
132918
- const basePath = alias.packagePath ? path21.join(projectPath, alias.packagePath) : projectPath;
132919
- const absPath = path21.join(basePath, cleanTarget + suffix);
133032
+ const basePath = alias.packagePath ? path23.join(projectPath, alias.packagePath) : projectPath;
133033
+ const absPath = path23.join(basePath, cleanTarget + suffix);
132920
133034
  const resolved = this.probeExtensions(absPath, projectPath, knownRelPaths);
132921
133035
  if (resolved)
132922
133036
  return { resolvedPath: resolved, external: false };
@@ -132932,7 +133046,7 @@ class ResolveStage {
132932
133046
  ...TS_EXTENSIONS.map((ext2) => absPath.replace(/\.[^.]+$/, ext2))
132933
133047
  ];
132934
133048
  for (const candidate2 of candidates2) {
132935
- const rel = path21.relative(projectPath, candidate2).replace(/\\/g, "/");
133049
+ const rel = path23.relative(projectPath, candidate2).replace(/\\/g, "/");
132936
133050
  if (knownRelPaths.has(rel))
132937
133051
  return rel;
132938
133052
  }
@@ -132940,9 +133054,9 @@ class ResolveStage {
132940
133054
  }
132941
133055
  loadTsConfigPaths(projectPath, packageBase) {
132942
133056
  const aliases = [];
132943
- const tsconfigPath = path21.join(projectPath, "tsconfig.json");
133057
+ const tsconfigPath = path23.join(projectPath, "tsconfig.json");
132944
133058
  try {
132945
- const raw2 = fs14.readFileSync(tsconfigPath, "utf-8");
133059
+ const raw2 = fs16.readFileSync(tsconfigPath, "utf-8");
132946
133060
  const stripped = raw2.replace(/\/\/[^\n]*/g, "").replace(/\/\*[\s\S]*?\*\//g, "");
132947
133061
  const tsconfig = JSON.parse(stripped);
132948
133062
  const paths = tsconfig?.compilerOptions?.paths ?? {};
@@ -132971,7 +133085,7 @@ class ResolveStage {
132971
133085
  }
132972
133086
  }
132973
133087
  for (const packageRelPath of packagePaths) {
132974
- const absPackagePath = path21.join(projectPath, packageRelPath);
133088
+ const absPackagePath = path23.join(projectPath, packageRelPath);
132975
133089
  const aliases = this.loadTsConfigPaths(absPackagePath, packageRelPath);
132976
133090
  if (aliases.length > 0) {
132977
133091
  packages.push({
@@ -133001,7 +133115,7 @@ class ResolveStage {
133001
133115
  structuralAliasesFor(filePath, rootAliases, packages) {
133002
133116
  return [...this.getPackageAliases(filePath, packages), ...rootAliases].map((alias) => ({
133003
133117
  pattern: alias.prefix + (alias.targets.some((target) => target.includes("*")) ? "/*" : ""),
133004
- targets: alias.targets.map((target) => alias.packagePath ? path21.posix.join(alias.packagePath, target) : target)
133118
+ targets: alias.targets.map((target) => alias.packagePath ? path23.posix.join(alias.packagePath, target) : target)
133005
133119
  }));
133006
133120
  }
133007
133121
  }
@@ -133065,7 +133179,7 @@ var init_with_deadlock_retry = __esm(() => {
133065
133179
  });
133066
133180
 
133067
133181
  // ../../packages/core/dist/services/etl/stages/load.js
133068
- import path22 from "path";
133182
+ import path24 from "path";
133069
133183
  function formatDuration(ms) {
133070
133184
  const totalSec = Math.max(0, Math.round(ms / 1000));
133071
133185
  if (totalSec < 60)
@@ -133342,7 +133456,7 @@ class LoadStage {
133342
133456
  const filePath = file2.file.relativePath;
133343
133457
  const batch = buildSymbolPersistenceBatch(ctx.projectId, file2);
133344
133458
  if (ctx.graphGenerationLease) {
133345
- const manifest = getLanguageManifestEntry(path22.extname(filePath));
133459
+ const manifest = getLanguageManifestEntry(path24.extname(filePath));
133346
133460
  const diagnostics2 = (file2.structuralDiagnostics ?? []).slice(0, 10).map((diagnostic2) => ({
133347
133461
  code: diagnostic2.code,
133348
133462
  severity: diagnostic2.severity,
@@ -133799,9 +133913,9 @@ var init_graph_generation_coordinator = __esm(() => {
133799
133913
  // ../../packages/core/dist/services/etl/pipeline.js
133800
133914
  import { createHash as createHash10 } from "crypto";
133801
133915
  import { setTimeout as delay2 } from "timers/promises";
133802
- import path23 from "path";
133916
+ import path25 from "path";
133803
133917
  function buildHeaderLanguageEvidence(files) {
133804
- const headers = new Set(files.filter((file2) => path23.posix.extname(file2.relativePath).toLowerCase() === ".h").map((file2) => path23.posix.normalize(file2.relativePath)));
133918
+ const headers = new Set(files.filter((file2) => path25.posix.extname(file2.relativePath).toLowerCase() === ".h").map((file2) => path25.posix.normalize(file2.relativePath)));
133805
133919
  const mutable = new Map;
133806
133920
  const entry2 = (header) => {
133807
133921
  let value = mutable.get(header);
@@ -133812,7 +133926,7 @@ function buildHeaderLanguageEvidence(files) {
133812
133926
  return value;
133813
133927
  };
133814
133928
  for (const file2 of files) {
133815
- if (path23.posix.basename(file2.relativePath) !== "compile_commands.json" || file2.snapshotContent === undefined)
133929
+ if (path25.posix.basename(file2.relativePath) !== "compile_commands.json" || file2.snapshotContent === undefined)
133816
133930
  continue;
133817
133931
  let commands;
133818
133932
  try {
@@ -133828,11 +133942,11 @@ function buildHeaderLanguageEvidence(files) {
133828
133942
  const record2 = command;
133829
133943
  if (typeof record2.file !== "string")
133830
133944
  continue;
133831
- const projectRoot = path23.resolve(file2.absolutePath, ...file2.relativePath.split("/").map(() => ".."));
133832
- const commandDirectory = typeof record2.directory === "string" ? path23.resolve(projectRoot, record2.directory) : projectRoot;
133833
- const absoluteInput = path23.resolve(commandDirectory, record2.file);
133834
- const relative3 = path23.relative(projectRoot, absoluteInput);
133835
- const header = path23.posix.normalize(relative3.replaceAll(path23.sep, "/"));
133945
+ const projectRoot = path25.resolve(file2.absolutePath, ...file2.relativePath.split("/").map(() => ".."));
133946
+ const commandDirectory = typeof record2.directory === "string" ? path25.resolve(projectRoot, record2.directory) : projectRoot;
133947
+ const absoluteInput = path25.resolve(commandDirectory, record2.file);
133948
+ const relative3 = path25.relative(projectRoot, absoluteInput);
133949
+ const header = path25.posix.normalize(relative3.replaceAll(path25.sep, "/"));
133836
133950
  if (!headers.has(header))
133837
133951
  continue;
133838
133952
  const invocation = typeof record2.command === "string" ? record2.command : Array.isArray(record2.arguments) ? record2.arguments.join(" ") : "";
@@ -139698,33 +139812,33 @@ var require_URL = __commonJS((exports, module) => {
139698
139812
  else
139699
139813
  return basepath.substring(0, lastslash + 1) + refpath;
139700
139814
  }
139701
- function remove_dot_segments(path24) {
139702
- if (!path24)
139703
- return path24;
139815
+ function remove_dot_segments(path26) {
139816
+ if (!path26)
139817
+ return path26;
139704
139818
  var output = "";
139705
- while (path24.length > 0) {
139706
- if (path24 === "." || path24 === "..") {
139707
- path24 = "";
139819
+ while (path26.length > 0) {
139820
+ if (path26 === "." || path26 === "..") {
139821
+ path26 = "";
139708
139822
  break;
139709
139823
  }
139710
- var twochars = path24.substring(0, 2);
139711
- var threechars = path24.substring(0, 3);
139712
- var fourchars = path24.substring(0, 4);
139824
+ var twochars = path26.substring(0, 2);
139825
+ var threechars = path26.substring(0, 3);
139826
+ var fourchars = path26.substring(0, 4);
139713
139827
  if (threechars === "../") {
139714
- path24 = path24.substring(3);
139828
+ path26 = path26.substring(3);
139715
139829
  } else if (twochars === "./") {
139716
- path24 = path24.substring(2);
139830
+ path26 = path26.substring(2);
139717
139831
  } else if (threechars === "/./") {
139718
- path24 = "/" + path24.substring(3);
139719
- } else if (twochars === "/." && path24.length === 2) {
139720
- path24 = "/";
139721
- } else if (fourchars === "/../" || threechars === "/.." && path24.length === 3) {
139722
- path24 = "/" + path24.substring(4);
139832
+ path26 = "/" + path26.substring(3);
139833
+ } else if (twochars === "/." && path26.length === 2) {
139834
+ path26 = "/";
139835
+ } else if (fourchars === "/../" || threechars === "/.." && path26.length === 3) {
139836
+ path26 = "/" + path26.substring(4);
139723
139837
  output = output.replace(/\/?[^\/]*$/, "");
139724
139838
  } else {
139725
- var segment = path24.match(/(\/?([^\/]*))/)[0];
139839
+ var segment = path26.match(/(\/?([^\/]*))/)[0];
139726
139840
  output += segment;
139727
- path24 = path24.substring(segment.length);
139841
+ path26 = path26.substring(segment.length);
139728
139842
  }
139729
139843
  }
139730
139844
  return output;
@@ -151794,21 +151908,21 @@ function jsonToKeyPathChunks(value, label = "$") {
151794
151908
  walk(value, label, out);
151795
151909
  return out;
151796
151910
  }
151797
- function walk(val, path24, out) {
151911
+ function walk(val, path26, out) {
151798
151912
  if (val === null || val === undefined)
151799
151913
  return;
151800
151914
  if (Array.isArray(val)) {
151801
151915
  if (val.length === 0) {
151802
- out.push({ path: path24, content: `**${path24}** = _[]_` });
151916
+ out.push({ path: path26, content: `**${path26}** = _[]_` });
151803
151917
  return;
151804
151918
  }
151805
151919
  if (val.every((v) => v !== null && typeof v === "object")) {
151806
- val.forEach((v, i) => walk(v, `${path24}[${i}]`, out));
151920
+ val.forEach((v, i) => walk(v, `${path26}[${i}]`, out));
151807
151921
  return;
151808
151922
  }
151809
151923
  const items = val.map((v) => `- \`${String(v)}\``).join(`
151810
151924
  `);
151811
- out.push({ path: path24, content: `**${path24}**
151925
+ out.push({ path: path26, content: `**${path26}**
151812
151926
 
151813
151927
  ${items}` });
151814
151928
  return;
@@ -151816,16 +151930,16 @@ ${items}` });
151816
151930
  if (typeof val === "object") {
151817
151931
  const entries = Object.entries(val);
151818
151932
  if (entries.length === 0) {
151819
- out.push({ path: path24, content: `**${path24}** = _{}_` });
151933
+ out.push({ path: path26, content: `**${path26}** = _{}_` });
151820
151934
  return;
151821
151935
  }
151822
151936
  for (const [k, v] of entries) {
151823
151937
  const safeKey = /^[A-Za-z_$][\w$]*$/.test(k) ? k : JSON.stringify(k);
151824
- walk(v, `${path24}.${safeKey}`, out);
151938
+ walk(v, `${path26}.${safeKey}`, out);
151825
151939
  }
151826
151940
  return;
151827
151941
  }
151828
- out.push({ path: path24, content: `**${path24}** = \`${String(val)}\`` });
151942
+ out.push({ path: path26, content: `**${path26}** = \`${String(val)}\`` });
151829
151943
  }
151830
151944
  var gfm, STRIP_SELECTORS, tdCache = null;
151831
151945
  var init_html_to_md = __esm(() => {
@@ -152249,6 +152363,15 @@ var init_recover_project = __esm(() => {
152249
152363
  // src/config-cli.ts
152250
152364
  init_config();
152251
152365
  init_dist();
152366
+ var GENERATOR_MARKER = "scripts/generate-subagent-artifacts.ts";
152367
+ var GENERATOR_MARKER_MAX_LEVELS = 6;
152368
+ function formatVariantSync(results) {
152369
+ for (const r of results) {
152370
+ if (r.status === "synced") {
152371
+ console.log(` synced ${r.host}: ${r.files} file(s) across ${r.profiles.length} profile(s)`);
152372
+ }
152373
+ }
152374
+ }
152252
152375
  function help() {
152253
152376
  console.log(`
152254
152377
  massa-ai-config - Configuration manager for massa-ai
@@ -152493,6 +152616,8 @@ Using defaults:`);
152493
152616
  return 1;
152494
152617
  }
152495
152618
  try {
152619
+ const sourceRoot = findRepoRootWithMarker(import.meta.dirname, GENERATOR_MARKER, GENERATOR_MARKER_MAX_LEVELS);
152620
+ formatVariantSync(syncGeneratedVariants({ sourceRoot }));
152496
152621
  const report = switchProfile({
152497
152622
  profile: name26,
152498
152623
  host: hostOpt,