@massa-ai/mcp-client 1.59.0 → 1.60.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/config-cli.js +657 -433
  2. package/dist/index.js +701 -477
  3. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -25502,13 +25502,33 @@ var init_inference_providers = __esm(() => {
25502
25502
  },
25503
25503
  knownDimensions: {
25504
25504
  "text-embedding-nomic-embed-text-v1.5": 768,
25505
- "text-embedding-qwen3-embedding-0.6b": 1024
25505
+ "text-embedding-qwen3-embedding-0.6b": 1024,
25506
+ "qwen3-embedding-0.6b-dwq": 1024
25506
25507
  },
25507
25508
  defaultModels: {
25508
25509
  embedding: "text-embedding-qwen3-embedding-0.6b",
25509
25510
  instruct: "qwen3-vl-8b-instruct",
25510
25511
  coding: "qwen2.5-coder-7b-instruct"
25511
25512
  },
25513
+ mlxModels: {
25514
+ embedding: {
25515
+ repo: "mlx-community/Qwen3-Embedding-0.6B-4bit-DWQ",
25516
+ model: "qwen3-embedding-0.6b-dwq"
25517
+ },
25518
+ instruct: {
25519
+ repo: "mlx-community/Qwen3-VL-8B-Instruct-4bit",
25520
+ model: "qwen3-vl-8b-instruct"
25521
+ },
25522
+ coding: {
25523
+ repo: "mlx-community/Qwen2.5-Coder-7B-Instruct-4bit",
25524
+ model: "qwen2.5-coder-7b-instruct"
25525
+ }
25526
+ },
25527
+ ggufRepos: {
25528
+ embedding: "Qwen/Qwen3-Embedding-0.6B-GGUF",
25529
+ instruct: "lmstudio-community/Qwen3-VL-8B-Instruct-GGUF",
25530
+ coding: "lmstudio-community/Qwen2.5-Coder-7B-Instruct-GGUF"
25531
+ },
25512
25532
  appliesContextPerRequest: false,
25513
25533
  embedBatchSize: 64,
25514
25534
  supportsOllamaVersionProbe: false,
@@ -27656,12 +27676,13 @@ function selectRecord(records) {
27656
27676
  }
27657
27677
  return best ?? pool[pool.length - 1];
27658
27678
  }
27659
- function resolveClaudeMarketplaceRoot(opts = {}) {
27679
+ function resolveClaudeMarketplaceInstall(opts = {}) {
27660
27680
  const targetHome = opts.targetHome ?? os5.homedir();
27661
27681
  const pluginKey = opts.pluginKey ?? DEFAULT_PLUGIN_KEY;
27662
27682
  const directoryResult = resolveDirectorySourceRoot(targetHome, pluginKey);
27663
- if (directoryResult !== undefined)
27664
- return directoryResult;
27683
+ if (directoryResult !== undefined) {
27684
+ return directoryResult === null ? null : { root: directoryResult, route: "directory-source" };
27685
+ }
27665
27686
  const registryPath = path9.join(targetHome, ".claude", "plugins", "installed_plugins.json");
27666
27687
  let records;
27667
27688
  try {
@@ -27683,15 +27704,197 @@ function resolveClaudeMarketplaceRoot(opts = {}) {
27683
27704
  } catch {
27684
27705
  return null;
27685
27706
  }
27686
- return installPath;
27707
+ return { root: installPath, route: "registry-cache" };
27708
+ }
27709
+ function resolveClaudeMarketplaceRoot(opts = {}) {
27710
+ return resolveClaudeMarketplaceInstall(opts)?.root ?? null;
27711
+ }
27712
+ function readInstalledPluginVersion(opts = {}) {
27713
+ const targetHome = opts.targetHome ?? os5.homedir();
27714
+ const pluginKey = opts.pluginKey ?? DEFAULT_PLUGIN_KEY;
27715
+ const registryPath = path9.join(targetHome, ".claude", "plugins", "installed_plugins.json");
27716
+ let records;
27717
+ try {
27718
+ const parsed = JSON.parse(fs5.readFileSync(registryPath, "utf8"));
27719
+ records = parsed?.plugins?.[pluginKey];
27720
+ } catch {
27721
+ return null;
27722
+ }
27723
+ if (!Array.isArray(records) || records.length === 0)
27724
+ return null;
27725
+ return selectRecord(records)?.version ?? null;
27687
27726
  }
27688
27727
  var DEFAULT_PLUGIN_KEY = "massa-ai@massa-ai";
27689
27728
  var init_claude_marketplace = () => {};
27690
27729
 
27691
- // ../../packages/shared/dist/profile-switch/engine.js
27730
+ // ../../packages/shared/dist/profile-switch/frontmatter.js
27731
+ function parseFrontmatter(raw2) {
27732
+ const match = /^---\r?\n([\s\S]*?)\r?\n---\r?\n([\s\S]*)$/.exec(raw2);
27733
+ if (!match) {
27734
+ throw new Error("charter missing YAML frontmatter (--- ... ---) block");
27735
+ }
27736
+ const yamlText = match[1] ?? "";
27737
+ const body = (match[2] ?? "").replace(/^\r?\n/, "");
27738
+ const frontmatter = parseSimpleYaml(yamlText);
27739
+ return { frontmatter, body };
27740
+ }
27741
+ function parseSimpleYaml(text) {
27742
+ const result = {};
27743
+ const lines = text.split(/\r?\n/);
27744
+ let i = 0;
27745
+ while (i < lines.length) {
27746
+ const line = lines[i] ?? "";
27747
+ if (line.trim() === "" || line.trim().startsWith("#")) {
27748
+ i++;
27749
+ continue;
27750
+ }
27751
+ const m = /^([A-Za-z_][A-Za-z0-9_]*):\s*(.*)$/.exec(line);
27752
+ if (!m) {
27753
+ i++;
27754
+ continue;
27755
+ }
27756
+ const key = m[1];
27757
+ const rest = (m[2] ?? "").trim();
27758
+ if (rest !== "") {
27759
+ result[key] = unquoteScalar(rest);
27760
+ i++;
27761
+ continue;
27762
+ }
27763
+ const nested = {};
27764
+ i++;
27765
+ while (i < lines.length) {
27766
+ const nestedLine = lines[i] ?? "";
27767
+ if (/^\s{2,}\S/.test(nestedLine) === false)
27768
+ break;
27769
+ const nm = /^\s{2,}([A-Za-z_][A-Za-z0-9_]*):\s*(.*)$/.exec(nestedLine);
27770
+ if (!nm)
27771
+ break;
27772
+ nested[nm[1]] = unquoteScalar((nm[2] ?? "").trim());
27773
+ i++;
27774
+ }
27775
+ result[key] = nested;
27776
+ }
27777
+ return result;
27778
+ }
27779
+ function unquoteScalar(s) {
27780
+ if (s.startsWith('"') && s.endsWith('"') || s.startsWith("'") && s.endsWith("'")) {
27781
+ return s.slice(1, -1);
27782
+ }
27783
+ return s;
27784
+ }
27785
+
27786
+ // ../../packages/shared/dist/profile-switch/doctor.js
27692
27787
  import fs6 from "fs";
27693
- import path10 from "path";
27694
27788
  import os6 from "os";
27789
+ import path10 from "path";
27790
+ function readTextFile(filePath) {
27791
+ try {
27792
+ return fs6.readFileSync(filePath, "utf8");
27793
+ } catch {
27794
+ return null;
27795
+ }
27796
+ }
27797
+ function readJsonFile(filePath) {
27798
+ const raw2 = readTextFile(filePath);
27799
+ if (raw2 === null)
27800
+ return null;
27801
+ try {
27802
+ return JSON.parse(raw2);
27803
+ } catch {
27804
+ return null;
27805
+ }
27806
+ }
27807
+ function readPluginVersion(pluginRoot) {
27808
+ const manifest = readJsonFile(path10.join(pluginRoot, ".claude-plugin", "plugin.json"));
27809
+ return typeof manifest?.version === "string" ? manifest.version : null;
27810
+ }
27811
+ function detectEnvOverride(env) {
27812
+ for (const name of ENV_OVERRIDE_VARS) {
27813
+ const value = env[name];
27814
+ if (typeof value === "string" && value.trim()) {
27815
+ return { name, value: value.trim() };
27816
+ }
27817
+ }
27818
+ return null;
27819
+ }
27820
+ function readRoles(liveRoot, activeProfile) {
27821
+ const agentsDir = path10.join(liveRoot, "agents");
27822
+ let entries;
27823
+ try {
27824
+ entries = fs6.readdirSync(agentsDir, { withFileTypes: true });
27825
+ } catch {
27826
+ return [];
27827
+ }
27828
+ const roles = [];
27829
+ for (const entry of entries) {
27830
+ if (!entry.isFile() || !entry.name.startsWith("massa-ai-") || !entry.name.endsWith(".md")) {
27831
+ continue;
27832
+ }
27833
+ const activeRaw = readTextFile(path10.join(agentsDir, entry.name));
27834
+ let model = null;
27835
+ let effort = null;
27836
+ if (activeRaw !== null) {
27837
+ try {
27838
+ const { frontmatter } = parseFrontmatter(activeRaw);
27839
+ model = typeof frontmatter.model === "string" ? frontmatter.model : null;
27840
+ effort = typeof frontmatter.effort === "string" ? frontmatter.effort : null;
27841
+ } catch {}
27842
+ }
27843
+ let staleVariant = false;
27844
+ if (activeProfile && activeRaw !== null) {
27845
+ const variantRaw = readTextFile(path10.join(liveRoot, "agent-profiles", activeProfile, entry.name));
27846
+ if (variantRaw !== null) {
27847
+ staleVariant = variantRaw !== activeRaw;
27848
+ }
27849
+ }
27850
+ roles.push({ name: entry.name, model, effort, staleVariant });
27851
+ }
27852
+ return roles.sort((a, b) => a.name.localeCompare(b.name));
27853
+ }
27854
+ function runtimeDriftReport(opts = {}) {
27855
+ const targetHome = opts.targetHome ?? os6.homedir();
27856
+ const stateFilePath = opts.stateFilePath ?? path10.join(targetHome, ".config", "massa-ai", "install-state.json");
27857
+ let state = opts.state ?? null;
27858
+ if (state === null) {
27859
+ try {
27860
+ state = readInstallState(stateFilePath);
27861
+ } catch {
27862
+ state = null;
27863
+ }
27864
+ }
27865
+ const platform = state?.platforms?.claude;
27866
+ const stateVersion = typeof platform?.plugin?.version === "string" ? platform.plugin.version : null;
27867
+ const activeProfile = platform?.modelProfile?.profile ?? null;
27868
+ const install = resolveClaudeMarketplaceInstall({ targetHome, pluginKey: opts.pluginKey });
27869
+ const liveRoot = install?.root ?? null;
27870
+ const sourceVersion = liveRoot === null ? null : readPluginVersion(liveRoot);
27871
+ const pinnedVersion = readInstalledPluginVersion({ targetHome, pluginKey: opts.pluginKey });
27872
+ const roles = liveRoot === null ? [] : readRoles(liveRoot, activeProfile);
27873
+ return {
27874
+ host: "claude",
27875
+ route: install?.route ?? "unresolved",
27876
+ liveRoot,
27877
+ sourceVersion,
27878
+ stateVersion,
27879
+ pinnedVersion,
27880
+ activeProfile,
27881
+ roles,
27882
+ envOverride: detectEnvOverride(opts.env ?? process.env),
27883
+ versionDrift: sourceVersion !== null && stateVersion !== null && sourceVersion !== stateVersion,
27884
+ profileMaterialized: roles.some((role) => role.staleVariant)
27885
+ };
27886
+ }
27887
+ var ENV_OVERRIDE_VARS;
27888
+ var init_doctor = __esm(() => {
27889
+ init_claude_marketplace();
27890
+ init_state();
27891
+ ENV_OVERRIDE_VARS = ["CLAUDE_CODE_SUBAGENT_MODEL"];
27892
+ });
27893
+
27894
+ // ../../packages/shared/dist/profile-switch/engine.js
27895
+ import fs7 from "fs";
27896
+ import path11 from "path";
27897
+ import os7 from "os";
27695
27898
  import crypto4 from "crypto";
27696
27899
  import { execFileSync as execFileSync2 } from "child_process";
27697
27900
  function namedError3(name, message) {
@@ -27700,10 +27903,10 @@ function namedError3(name, message) {
27700
27903
  return err;
27701
27904
  }
27702
27905
  function defaultStatePath(targetHome) {
27703
- return path10.join(targetHome, ".config", "massa-ai", "install-state.json");
27906
+ return path11.join(targetHome, ".config", "massa-ai", "install-state.json");
27704
27907
  }
27705
27908
  function resolveCommon(opts) {
27706
- const targetHome = opts.targetHome ?? os6.homedir();
27909
+ const targetHome = opts.targetHome ?? os7.homedir();
27707
27910
  const stateFilePath = opts.stateFilePath ?? defaultStatePath(targetHome);
27708
27911
  return { targetHome, stateFilePath };
27709
27912
  }
@@ -27711,7 +27914,7 @@ function marketplaceRoots(targetHome, state) {
27711
27914
  return state.platforms.claude?.installRoute === "marketplace" ? { claude: resolveClaudeMarketplaceRoot({ targetHome }) ?? undefined } : {};
27712
27915
  }
27713
27916
  function claudeMarketplaceUnresolvedReason(targetHome) {
27714
- const registryPath = path10.join(targetHome, ".claude", "plugins", "installed_plugins.json");
27917
+ const registryPath = path11.join(targetHome, ".claude", "plugins", "installed_plugins.json");
27715
27918
  return `claude installRoute is "marketplace" but no install root could be resolved from ${registryPath} ` + "\u2014 re-run the Claude plugin installer, or verify the plugin registry file";
27716
27919
  }
27717
27920
  function listProfiles(opts = {}) {
@@ -27719,6 +27922,12 @@ function listProfiles(opts = {}) {
27719
27922
  const state = readInstallState(stateFilePath);
27720
27923
  const roots = marketplaceRoots(targetHome, state);
27721
27924
  const universe = opts.hosts ?? HOSTS;
27925
+ const claudeDrift = universe.includes("claude") ? runtimeDriftReport({ targetHome, stateFilePath, state, env: opts.env }) : null;
27926
+ const claudeDriftFields = (host) => host === "claude" && claudeDrift !== null ? {
27927
+ liveRoot: claudeDrift.liveRoot,
27928
+ sourceVersion: claudeDrift.sourceVersion,
27929
+ envOverride: claudeDrift.envOverride ? `${claudeDrift.envOverride.name}=${claudeDrift.envOverride.value}` : null
27930
+ } : { liveRoot: null, sourceVersion: null, envOverride: null };
27722
27931
  const hosts = universe.map((host) => {
27723
27932
  if (host === "claude" && state.platforms.claude?.installRoute === "marketplace" && roots.claude === undefined) {
27724
27933
  const platform2 = state.platforms.claude;
@@ -27729,7 +27938,8 @@ function listProfiles(opts = {}) {
27729
27938
  skipReason: null,
27730
27939
  activeProfile: platform2.modelProfile?.profile ?? opts.hostDefaults?.[host] ?? "balanced",
27731
27940
  bundleVersion: platform2.plugin?.version ?? null,
27732
- availableProfiles: []
27941
+ availableProfiles: [],
27942
+ ...claudeDriftFields(host)
27733
27943
  };
27734
27944
  }
27735
27945
  const layout = resolveHostLayout(host, { targetHome, projectRoot: opts.projectRoot, marketplaceRoot: roots });
@@ -27741,10 +27951,11 @@ function listProfiles(opts = {}) {
27741
27951
  skipReason: layout.reason,
27742
27952
  activeProfile: null,
27743
27953
  bundleVersion: null,
27744
- availableProfiles: []
27954
+ availableProfiles: [],
27955
+ ...claudeDriftFields(host)
27745
27956
  };
27746
27957
  }
27747
- const installed = fs6.existsSync(layout.activeDir);
27958
+ const installed = fs7.existsSync(layout.activeDir);
27748
27959
  const availableProfiles = listVariantProfiles(layout);
27749
27960
  const platform = state.platforms[host];
27750
27961
  return {
@@ -27754,15 +27965,16 @@ function listProfiles(opts = {}) {
27754
27965
  skipReason: null,
27755
27966
  activeProfile: platform?.modelProfile?.profile ?? opts.hostDefaults?.[host] ?? "balanced",
27756
27967
  bundleVersion: platform?.plugin?.version ?? null,
27757
- availableProfiles
27968
+ availableProfiles,
27969
+ ...claudeDriftFields(host)
27758
27970
  };
27759
27971
  });
27760
27972
  return { hosts };
27761
27973
  }
27762
27974
  function listVariantProfiles(layout) {
27763
- if (!fs6.existsSync(layout.variantsRoot))
27975
+ if (!fs7.existsSync(layout.variantsRoot))
27764
27976
  return [];
27765
- return fs6.readdirSync(layout.variantsRoot, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => e.name).sort();
27977
+ return fs7.readdirSync(layout.variantsRoot, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => e.name).sort();
27766
27978
  }
27767
27979
  function matchesGlob(filename, glob) {
27768
27980
  const starIdx = glob.indexOf("*");
@@ -27773,7 +27985,7 @@ function matchesGlob(filename, glob) {
27773
27985
  return filename.length >= prefix.length + suffix.length && filename.startsWith(prefix) && filename.endsWith(suffix);
27774
27986
  }
27775
27987
  function matchingFileNames(dir, glob) {
27776
- return fs6.readdirSync(dir, { withFileTypes: true }).filter((e) => e.isFile() && matchesGlob(e.name, glob)).map((e) => e.name);
27988
+ return fs7.readdirSync(dir, { withFileTypes: true }).filter((e) => e.isFile() && matchesGlob(e.name, glob)).map((e) => e.name);
27777
27989
  }
27778
27990
  function detectGitAvailability(dir) {
27779
27991
  try {
@@ -27799,7 +28011,7 @@ function gitTrackedFileNames(dir, filenames) {
27799
28011
  }
27800
28012
  }
27801
28013
  function checkTrackedPathGuard(activeDir, filenames) {
27802
- if (filenames.length === 0 || !fs6.existsSync(activeDir))
28014
+ if (filenames.length === 0 || !fs7.existsSync(activeDir))
27803
28015
  return GUARD_PASS;
27804
28016
  const availability = detectGitAvailability(activeDir);
27805
28017
  if (availability === "no-git")
@@ -27810,53 +28022,53 @@ function checkTrackedPathGuard(activeDir, filenames) {
27810
28022
  if (tracked.size === 0)
27811
28023
  return GUARD_PASS;
27812
28024
  const offending = filenames.find((name) => tracked.has(name));
27813
- return { blocked: true, path: path10.join(activeDir, offending), unchecked: false };
28025
+ return { blocked: true, path: path11.join(activeDir, offending), unchecked: false };
27814
28026
  }
27815
28027
  function assertStateWritable(stateFilePath) {
27816
- const dir = path10.dirname(stateFilePath);
28028
+ const dir = path11.dirname(stateFilePath);
27817
28029
  try {
27818
- fs6.mkdirSync(dir, { recursive: true });
28030
+ fs7.mkdirSync(dir, { recursive: true });
27819
28031
  } catch (err) {
27820
28032
  throw UnwritableInstallStateError(stateFilePath, err.message);
27821
28033
  }
27822
- const checkPath = fs6.existsSync(stateFilePath) ? stateFilePath : dir;
28034
+ const checkPath = fs7.existsSync(stateFilePath) ? stateFilePath : dir;
27823
28035
  try {
27824
- fs6.accessSync(checkPath, fs6.constants.W_OK);
28036
+ fs7.accessSync(checkPath, fs7.constants.W_OK);
27825
28037
  } catch (err) {
27826
28038
  throw UnwritableInstallStateError(stateFilePath, err.message);
27827
28039
  }
27828
28040
  }
27829
28041
  function copyFileRouteVariant(layout, variantDir) {
27830
- fs6.mkdirSync(layout.activeDir, { recursive: true });
28042
+ fs7.mkdirSync(layout.activeDir, { recursive: true });
27831
28043
  let changed = 0;
27832
- for (const entry of fs6.readdirSync(variantDir, { withFileTypes: true })) {
28044
+ for (const entry of fs7.readdirSync(variantDir, { withFileTypes: true })) {
27833
28045
  if (!entry.isFile() || !matchesGlob(entry.name, layout.activeGlob))
27834
28046
  continue;
27835
- fs6.copyFileSync(path10.join(variantDir, entry.name), path10.join(layout.activeDir, entry.name));
28047
+ fs7.copyFileSync(path11.join(variantDir, entry.name), path11.join(layout.activeDir, entry.name));
27836
28048
  changed++;
27837
28049
  }
27838
28050
  return changed;
27839
28051
  }
27840
28052
  function repointOpencodeVariant(layout, variantDir) {
27841
- fs6.mkdirSync(layout.activeDir, { recursive: true });
28053
+ fs7.mkdirSync(layout.activeDir, { recursive: true });
27842
28054
  let changed = 0;
27843
- for (const entry of fs6.readdirSync(variantDir, { withFileTypes: true })) {
28055
+ for (const entry of fs7.readdirSync(variantDir, { withFileTypes: true })) {
27844
28056
  if (!entry.isFile() || !matchesGlob(entry.name, layout.activeGlob))
27845
28057
  continue;
27846
- const dest = path10.join(layout.activeDir, entry.name);
27847
- const target = path10.resolve(path10.join(variantDir, entry.name));
28058
+ const dest = path11.join(layout.activeDir, entry.name);
28059
+ const target = path11.resolve(path11.join(variantDir, entry.name));
27848
28060
  let destExists = true;
27849
28061
  let destIsSymlink = false;
27850
28062
  try {
27851
- destIsSymlink = fs6.lstatSync(dest).isSymbolicLink();
28063
+ destIsSymlink = fs7.lstatSync(dest).isSymbolicLink();
27852
28064
  } catch {
27853
28065
  destExists = false;
27854
28066
  }
27855
28067
  if (destExists && !destIsSymlink)
27856
28068
  continue;
27857
28069
  const tmp = `${dest}.massa-ai-switch.${crypto4.randomUUID()}`;
27858
- fs6.symlinkSync(target, tmp);
27859
- fs6.renameSync(tmp, dest);
28070
+ fs7.symlinkSync(target, tmp);
28071
+ fs7.renameSync(tmp, dest);
27860
28072
  changed++;
27861
28073
  }
27862
28074
  return changed;
@@ -27896,13 +28108,13 @@ function switchProfile(opts) {
27896
28108
  if (fileHosts.length === 0) {
27897
28109
  return { profile: opts.profile, dryRun, hosts: orderRows(universe, skipRows), restartRequired: false };
27898
28110
  }
27899
- const installedFileHosts = fileHosts.filter((h) => fs6.existsSync(h.layout.activeDir));
28111
+ const installedFileHosts = fileHosts.filter((h) => fs7.existsSync(h.layout.activeDir));
27900
28112
  if (installedFileHosts.length === 0)
27901
28113
  throw NoHostsDetectedError();
27902
28114
  const withAvailability = fileHosts.map((h) => {
27903
- const variantsRootExists = fs6.existsSync(h.layout.variantsRoot);
28115
+ const variantsRootExists = fs7.existsSync(h.layout.variantsRoot);
27904
28116
  const variantDir = h.layout.variantDir(opts.profile);
27905
- const available = variantsRootExists && fs6.existsSync(variantDir) && fs6.statSync(variantDir).isDirectory();
28117
+ const available = variantsRootExists && fs7.existsSync(variantDir) && fs7.statSync(variantDir).isDirectory();
27906
28118
  return { ...h, variantsRootExists, variantDir, available };
27907
28119
  });
27908
28120
  if (!withAvailability.some((h) => h.available)) {
@@ -27938,7 +28150,7 @@ function switchProfile(opts) {
27938
28150
  continue;
27939
28151
  }
27940
28152
  if (dryRun) {
27941
- rows.push({ host: h.host, status: "switched" });
28153
+ rows.push({ host: h.host, status: "would-switch" });
27942
28154
  continue;
27943
28155
  }
27944
28156
  const candidateNames = matchingFileNames(h.variantDir, h.layout.activeGlob);
@@ -27983,6 +28195,7 @@ var init_engine = __esm(() => {
27983
28195
  init_state();
27984
28196
  init_lock();
27985
28197
  init_claude_marketplace();
28198
+ init_doctor();
27986
28199
  SwitchEngineError = class SwitchEngineError extends Error {
27987
28200
  constructor(message) {
27988
28201
  super(message);
@@ -27995,29 +28208,29 @@ var init_engine = __esm(() => {
27995
28208
 
27996
28209
  // ../../packages/shared/dist/profile-switch/report.js
27997
28210
  function reportSucceeded(report) {
27998
- return report.hosts.every((h) => h.status === "switched" || h.status === "skipped");
28211
+ return report.hosts.every((h) => h.status === "switched" || h.status === "would-switch" || h.status === "skipped");
27999
28212
  }
28000
28213
 
28001
28214
  // ../../packages/shared/dist/profile-switch/variant-sync.js
28002
- import fs7 from "fs";
28003
- import path11 from "path";
28004
- import os7 from "os";
28215
+ import fs8 from "fs";
28216
+ import path12 from "path";
28217
+ import os8 from "os";
28005
28218
  import crypto5 from "crypto";
28006
28219
  function defaultStatePath2(targetHome) {
28007
- return path11.join(targetHome, ".config", "massa-ai", "install-state.json");
28220
+ return path12.join(targetHome, ".config", "massa-ai", "install-state.json");
28008
28221
  }
28009
28222
  function marketplaceRoots2(targetHome, state) {
28010
28223
  return state.platforms.claude?.installRoute === "marketplace" ? { claude: resolveClaudeMarketplaceRoot({ targetHome }) ?? undefined } : {};
28011
28224
  }
28012
28225
  function writeFileIntoDirAtomically(destDir, destName, content) {
28013
28226
  const unique = `${process.pid}.${++tempFileCounter2}.${crypto5.randomBytes(6).toString("hex")}`;
28014
- const tempFile = path11.join(destDir, `.${destName}.${unique}.tmp`);
28227
+ const tempFile = path12.join(destDir, `.${destName}.${unique}.tmp`);
28015
28228
  try {
28016
- fs7.writeFileSync(tempFile, content);
28017
- fs7.renameSync(tempFile, path11.join(destDir, destName));
28229
+ fs8.writeFileSync(tempFile, content);
28230
+ fs8.renameSync(tempFile, path12.join(destDir, destName));
28018
28231
  } catch (error51) {
28019
28232
  try {
28020
- fs7.unlinkSync(tempFile);
28233
+ fs8.unlinkSync(tempFile);
28021
28234
  } catch {}
28022
28235
  throw error51;
28023
28236
  }
@@ -28025,20 +28238,20 @@ function writeFileIntoDirAtomically(destDir, destName, content) {
28025
28238
  function isSafeDirName(name) {
28026
28239
  if (name === "." || name === "..")
28027
28240
  return false;
28028
- if (name.includes("/") || name.includes("\\") || name.includes(path11.sep))
28241
+ if (name.includes("/") || name.includes("\\") || name.includes(path12.sep))
28029
28242
  return false;
28030
- return path11.basename(name) === name;
28243
+ return path12.basename(name) === name;
28031
28244
  }
28032
28245
  function syncHost(host, sourceRoot, targetHome, marketplaceRoot) {
28033
28246
  const layout = resolveHostLayout(host, { targetHome, marketplaceRoot });
28034
28247
  if (layout.route === "skip") {
28035
28248
  return { host, status: "skipped", profiles: [], retained: [], files: 0, reason: layout.reason };
28036
28249
  }
28037
- const srcDir = path11.join(sourceRoot, "apps", `${host}-plugin`, "agent-profiles");
28038
- if (!fs7.existsSync(srcDir) || !fs7.statSync(srcDir).isDirectory()) {
28250
+ const srcDir = path12.join(sourceRoot, "apps", `${host}-plugin`, "agent-profiles");
28251
+ if (!fs8.existsSync(srcDir) || !fs8.statSync(srcDir).isDirectory()) {
28039
28252
  return { host, status: "skipped", profiles: [], retained: [], files: 0, reason: "no generated variants for this host" };
28040
28253
  }
28041
- if (!fs7.existsSync(layout.variantsRoot)) {
28254
+ if (!fs8.existsSync(layout.variantsRoot)) {
28042
28255
  return {
28043
28256
  host,
28044
28257
  status: "skipped",
@@ -28050,24 +28263,24 @@ function syncHost(host, sourceRoot, targetHome, marketplaceRoot) {
28050
28263
  }
28051
28264
  const profiles = [];
28052
28265
  let files = 0;
28053
- for (const entry of fs7.readdirSync(srcDir, { withFileTypes: true })) {
28266
+ for (const entry of fs8.readdirSync(srcDir, { withFileTypes: true })) {
28054
28267
  if (!entry.isDirectory())
28055
28268
  continue;
28056
28269
  if (!isSafeDirName(entry.name))
28057
28270
  continue;
28058
- const srcProfileDir = path11.join(srcDir, entry.name);
28059
- const destProfileDir = path11.join(layout.variantsRoot, entry.name);
28060
- fs7.mkdirSync(destProfileDir, { recursive: true });
28061
- for (const fileEntry of fs7.readdirSync(srcProfileDir, { withFileTypes: true })) {
28271
+ const srcProfileDir = path12.join(srcDir, entry.name);
28272
+ const destProfileDir = path12.join(layout.variantsRoot, entry.name);
28273
+ fs8.mkdirSync(destProfileDir, { recursive: true });
28274
+ for (const fileEntry of fs8.readdirSync(srcProfileDir, { withFileTypes: true })) {
28062
28275
  if (!fileEntry.isFile())
28063
28276
  continue;
28064
- const content = fs7.readFileSync(path11.join(srcProfileDir, fileEntry.name));
28277
+ const content = fs8.readFileSync(path12.join(srcProfileDir, fileEntry.name));
28065
28278
  writeFileIntoDirAtomically(destProfileDir, fileEntry.name, content);
28066
28279
  files++;
28067
28280
  }
28068
28281
  profiles.push(entry.name);
28069
28282
  }
28070
- const retained = fs7.readdirSync(layout.variantsRoot, { withFileTypes: true }).filter((e) => e.isDirectory() && !profiles.includes(e.name)).map((e) => e.name).sort();
28283
+ const retained = fs8.readdirSync(layout.variantsRoot, { withFileTypes: true }).filter((e) => e.isDirectory() && !profiles.includes(e.name)).map((e) => e.name).sort();
28071
28284
  return { host, status: "synced", profiles: profiles.sort(), retained, files };
28072
28285
  }
28073
28286
  function syncGeneratedVariants(opts) {
@@ -28083,7 +28296,7 @@ function syncGeneratedVariants(opts) {
28083
28296
  }));
28084
28297
  }
28085
28298
  const sourceRoot = opts.sourceRoot;
28086
- const targetHome = opts.targetHome ?? os7.homedir();
28299
+ const targetHome = opts.targetHome ?? os8.homedir();
28087
28300
  const state = readInstallState(defaultStatePath2(targetHome));
28088
28301
  const roots = marketplaceRoots2(targetHome, state);
28089
28302
  return hosts.map((host) => {
@@ -28102,14 +28315,14 @@ var init_variant_sync = __esm(() => {
28102
28315
  });
28103
28316
 
28104
28317
  // ../../packages/shared/dist/profile-switch/repo-root.js
28105
- import fs8 from "fs";
28106
- import path12 from "path";
28318
+ import fs9 from "fs";
28319
+ import path13 from "path";
28107
28320
  function findRepoRootWithMarker(startDir, marker, maxLevels) {
28108
28321
  let dir = startDir;
28109
28322
  for (let i = 0;i <= maxLevels; i++) {
28110
- if (fs8.existsSync(path12.join(dir, marker)))
28323
+ if (fs9.existsSync(path13.join(dir, marker)))
28111
28324
  return dir;
28112
- const parent = path12.dirname(dir);
28325
+ const parent = path13.dirname(dir);
28113
28326
  if (parent === dir)
28114
28327
  break;
28115
28328
  dir = parent;
@@ -28207,7 +28420,7 @@ var init_rules = __esm(() => {
28207
28420
  });
28208
28421
 
28209
28422
  // ../../packages/shared/dist/bootstrap/state.js
28210
- import fs9 from "fs";
28423
+ import fs10 from "fs";
28211
28424
  function isPlainObject4(value) {
28212
28425
  return typeof value === "object" && value !== null && !Array.isArray(value);
28213
28426
  }
@@ -28238,7 +28451,7 @@ function resolveBootstrapState(doc2) {
28238
28451
  }
28239
28452
  function readConfigBytes() {
28240
28453
  try {
28241
- return fs9.readFileSync(getConfigPath(), "utf-8");
28454
+ return fs10.readFileSync(getConfigPath(), "utf-8");
28242
28455
  } catch (error51) {
28243
28456
  if (error51?.code === "ENOENT")
28244
28457
  return "";
@@ -28293,7 +28506,7 @@ var init_state2 = __esm(() => {
28293
28506
  });
28294
28507
 
28295
28508
  // ../../packages/shared/dist/bootstrap/render.js
28296
- import path13 from "path";
28509
+ import path14 from "path";
28297
28510
  function wrapBootstrapBlock(body) {
28298
28511
  return `${BOOTSTRAP_BLOCK_START}
28299
28512
  ${body.replace(/\n+$/, "")}
@@ -28306,19 +28519,19 @@ function ruleMarker(id, suffix) {
28306
28519
  function resolveHostRoot(host, targetHome, hostRoot) {
28307
28520
  requireAbsoluteTargetHome(targetHome);
28308
28521
  if (hostRoot === undefined)
28309
- return path13.join(targetHome, ...HOST_CONFIG_DIR[host]);
28310
- const relative = path13.relative(targetHome, hostRoot);
28311
- if (!path13.isAbsolute(hostRoot) || relative === "" || relative.startsWith("..") || path13.isAbsolute(relative)) {
28522
+ return path14.join(targetHome, ...HOST_CONFIG_DIR[host]);
28523
+ const relative = path14.relative(targetHome, hostRoot);
28524
+ if (!path14.isAbsolute(hostRoot) || relative === "" || relative.startsWith("..") || path14.isAbsolute(relative)) {
28312
28525
  throw new BootstrapRenderError("HostRootOutsideTargetHomeError", `hostRoot must be an absolute directory inside targetHome, got "${hostRoot}" for targetHome "${targetHome}"`, [hostRoot, targetHome]);
28313
28526
  }
28314
28527
  return hostRoot;
28315
28528
  }
28316
28529
  function bootstrapContractPath(host, targetHome, hostRoot) {
28317
- return path13.join(resolveHostRoot(host, targetHome, hostRoot), CONTRACT_FILENAME);
28530
+ return path14.join(resolveHostRoot(host, targetHome, hostRoot), CONTRACT_FILENAME);
28318
28531
  }
28319
28532
  function bootstrapStateFilePath(targetHome) {
28320
28533
  requireAbsoluteTargetHome(targetHome);
28321
- return path13.join(targetHome, ".config", "massa-ai", "config.json");
28534
+ return path14.join(targetHome, ".config", "massa-ai", "config.json");
28322
28535
  }
28323
28536
  function renderBootstrap(options) {
28324
28537
  const { source, state, host, targetHome, hostRoot } = options;
@@ -28341,7 +28554,7 @@ ${body}`;
28341
28554
  return { contract, pointer };
28342
28555
  }
28343
28556
  function requireAbsoluteTargetHome(targetHome) {
28344
- if (!path13.isAbsolute(targetHome)) {
28557
+ if (!path14.isAbsolute(targetHome)) {
28345
28558
  throw new BootstrapRenderError("TargetHomeNotAbsoluteError", `targetHome must be an absolute path, got "${targetHome}"`, [targetHome]);
28346
28559
  }
28347
28560
  }
@@ -28518,14 +28731,14 @@ var init_report = __esm(() => {
28518
28731
  });
28519
28732
 
28520
28733
  // ../../packages/shared/dist/bootstrap/engine.js
28521
- import fs10 from "fs";
28522
- import path14 from "path";
28734
+ import fs11 from "fs";
28735
+ import path15 from "path";
28523
28736
  function applyBootstrapState(options) {
28524
28737
  const { targetHome } = options;
28525
28738
  const dryRun = options.dryRun ?? false;
28526
28739
  const warn = options.onWarning ?? ((message) => console.warn(message));
28527
28740
  const configPath = bootstrapStateFilePath(targetHome);
28528
- const installStatePath = path14.join(path14.dirname(configPath), INSTALL_STATE_FILENAME);
28741
+ const installStatePath = path15.join(path15.dirname(configPath), INSTALL_STATE_FILENAME);
28529
28742
  const { platforms } = readInstallState(installStatePath);
28530
28743
  const installed = HOSTS.filter((host) => platforms[host] !== undefined);
28531
28744
  if (installed.length === 0) {
@@ -28618,22 +28831,22 @@ function applyHost(input) {
28618
28831
  }
28619
28832
  function wiringArtifact(host, targetHome, hostRoot) {
28620
28833
  const root = resolveHostRoot(host, targetHome, hostRoot);
28621
- const contractPath = path14.join(root, CONTRACT_FILENAME);
28834
+ const contractPath = path15.join(root, CONTRACT_FILENAME);
28622
28835
  switch (host) {
28623
28836
  case "claude":
28624
- return { file: path14.join(root, "CLAUDE.md"), token: `@${CONTRACT_FILENAME}` };
28837
+ return { file: path15.join(root, "CLAUDE.md"), token: `@${CONTRACT_FILENAME}` };
28625
28838
  case "codex":
28626
28839
  case "cursor":
28627
- return { file: path14.join(root, "AGENTS.md"), token: contractPath };
28840
+ return { file: path15.join(root, "AGENTS.md"), token: contractPath };
28628
28841
  case "opencode":
28629
28842
  return { file: openCodeConfigPath(root), token: `"${contractPath}"` };
28630
28843
  }
28631
28844
  }
28632
28845
  function openCodeConfigPath(root) {
28633
- const json2 = path14.join(root, "opencode.json");
28634
- if (fs10.existsSync(json2))
28846
+ const json2 = path15.join(root, "opencode.json");
28847
+ if (fs11.existsSync(json2))
28635
28848
  return json2;
28636
- return path14.join(root, "opencode.jsonc");
28849
+ return path15.join(root, "opencode.jsonc");
28637
28850
  }
28638
28851
  function isWired(host, targetHome, hostRoot) {
28639
28852
  const artifact = wiringArtifact(host, targetHome, hostRoot);
@@ -28646,7 +28859,7 @@ function notWiredReason(host, targetHome, hostRoot) {
28646
28859
  }
28647
28860
  function readFileOrNull(filePath) {
28648
28861
  try {
28649
- return fs10.readFileSync(filePath, "utf-8");
28862
+ return fs11.readFileSync(filePath, "utf-8");
28650
28863
  } catch {
28651
28864
  return null;
28652
28865
  }
@@ -30252,7 +30465,7 @@ var import_brace_expansion, minimatch = (p, pattern, options = {}) => {
30252
30465
  }, qmarksTestNoExtDot = ([$0]) => {
30253
30466
  const len = $0.length;
30254
30467
  return (f) => f.length === len && f !== "." && f !== "..";
30255
- }, defaultPlatform, path15, 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) => {
30468
+ }, defaultPlatform, path16, 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) => {
30256
30469
  if (!def || typeof def !== "object" || !Object.keys(def).length) {
30257
30470
  return minimatch;
30258
30471
  }
@@ -30310,11 +30523,11 @@ var init_esm = __esm(() => {
30310
30523
  starRE = /^\*+$/;
30311
30524
  qmarksRE = /^\?+([^+@!?\*\[\(]*)?$/;
30312
30525
  defaultPlatform = typeof process === "object" && process ? typeof process.env === "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
30313
- path15 = {
30526
+ path16 = {
30314
30527
  win32: { sep: "\\" },
30315
30528
  posix: { sep: "/" }
30316
30529
  };
30317
- sep = defaultPlatform === "win32" ? path15.win32.sep : path15.posix.sep;
30530
+ sep = defaultPlatform === "win32" ? path16.win32.sep : path16.posix.sep;
30318
30531
  minimatch.sep = sep;
30319
30532
  GLOBSTAR = Symbol("globstar **");
30320
30533
  minimatch.GLOBSTAR = GLOBSTAR;
@@ -32280,12 +32493,12 @@ var init_esm4 = __esm(() => {
32280
32493
  childrenCache() {
32281
32494
  return this.#children;
32282
32495
  }
32283
- resolve(path16) {
32284
- if (!path16) {
32496
+ resolve(path17) {
32497
+ if (!path17) {
32285
32498
  return this;
32286
32499
  }
32287
- const rootPath = this.getRootString(path16);
32288
- const dir = path16.substring(rootPath.length);
32500
+ const rootPath = this.getRootString(path17);
32501
+ const dir = path17.substring(rootPath.length);
32289
32502
  const dirParts = dir.split(this.splitSep);
32290
32503
  const result = rootPath ? this.getRoot(rootPath).#resolveParts(dirParts) : this.#resolveParts(dirParts);
32291
32504
  return result;
@@ -32813,8 +33026,8 @@ var init_esm4 = __esm(() => {
32813
33026
  newChild(name, type = UNKNOWN, opts = {}) {
32814
33027
  return new PathWin32(name, type, this.root, this.roots, this.nocase, this.childrenCache(), opts);
32815
33028
  }
32816
- getRootString(path16) {
32817
- return win32.parse(path16).root;
33029
+ getRootString(path17) {
33030
+ return win32.parse(path17).root;
32818
33031
  }
32819
33032
  getRoot(rootPath) {
32820
33033
  rootPath = uncToDrive(rootPath.toUpperCase());
@@ -32839,8 +33052,8 @@ var init_esm4 = __esm(() => {
32839
33052
  constructor(name, type = UNKNOWN, root, roots, nocase, children, opts) {
32840
33053
  super(name, type, root, roots, nocase, children, opts);
32841
33054
  }
32842
- getRootString(path16) {
32843
- return path16.startsWith("/") ? "/" : "";
33055
+ getRootString(path17) {
33056
+ return path17.startsWith("/") ? "/" : "";
32844
33057
  }
32845
33058
  getRoot(_rootPath) {
32846
33059
  return this.root;
@@ -32859,8 +33072,8 @@ var init_esm4 = __esm(() => {
32859
33072
  #children;
32860
33073
  nocase;
32861
33074
  #fs;
32862
- constructor(cwd = process.cwd(), pathImpl, sep2, { nocase, childrenCacheSize = 16 * 1024, fs: fs11 = defaultFS } = {}) {
32863
- this.#fs = fsFromOption(fs11);
33075
+ constructor(cwd = process.cwd(), pathImpl, sep2, { nocase, childrenCacheSize = 16 * 1024, fs: fs12 = defaultFS } = {}) {
33076
+ this.#fs = fsFromOption(fs12);
32864
33077
  if (cwd instanceof URL || cwd.startsWith("file://")) {
32865
33078
  cwd = fileURLToPath(cwd);
32866
33079
  }
@@ -32896,11 +33109,11 @@ var init_esm4 = __esm(() => {
32896
33109
  }
32897
33110
  this.cwd = prev;
32898
33111
  }
32899
- depth(path16 = this.cwd) {
32900
- if (typeof path16 === "string") {
32901
- path16 = this.cwd.resolve(path16);
33112
+ depth(path17 = this.cwd) {
33113
+ if (typeof path17 === "string") {
33114
+ path17 = this.cwd.resolve(path17);
32902
33115
  }
32903
- return path16.depth();
33116
+ return path17.depth();
32904
33117
  }
32905
33118
  childrenCache() {
32906
33119
  return this.#children;
@@ -33316,9 +33529,9 @@ var init_esm4 = __esm(() => {
33316
33529
  process4();
33317
33530
  return results;
33318
33531
  }
33319
- chdir(path16 = this.cwd) {
33532
+ chdir(path17 = this.cwd) {
33320
33533
  const oldCwd = this.cwd;
33321
- this.cwd = typeof path16 === "string" ? this.cwd.resolve(path16) : path16;
33534
+ this.cwd = typeof path17 === "string" ? this.cwd.resolve(path17) : path17;
33322
33535
  this.cwd[setAsCwd](oldCwd);
33323
33536
  }
33324
33537
  };
@@ -33335,8 +33548,8 @@ var init_esm4 = __esm(() => {
33335
33548
  parseRootPath(dir) {
33336
33549
  return win32.parse(dir).root.toUpperCase();
33337
33550
  }
33338
- newRoot(fs11) {
33339
- return new PathWin32(this.rootPath, IFDIR, undefined, this.roots, this.nocase, this.childrenCache(), { fs: fs11 });
33551
+ newRoot(fs12) {
33552
+ return new PathWin32(this.rootPath, IFDIR, undefined, this.roots, this.nocase, this.childrenCache(), { fs: fs12 });
33340
33553
  }
33341
33554
  isAbsolute(p) {
33342
33555
  return p.startsWith("/") || p.startsWith("\\") || /^[a-z]:(\/|\\)/i.test(p);
@@ -33352,8 +33565,8 @@ var init_esm4 = __esm(() => {
33352
33565
  parseRootPath(_dir) {
33353
33566
  return "/";
33354
33567
  }
33355
- newRoot(fs11) {
33356
- return new PathPosix(this.rootPath, IFDIR, undefined, this.roots, this.nocase, this.childrenCache(), { fs: fs11 });
33568
+ newRoot(fs12) {
33569
+ return new PathPosix(this.rootPath, IFDIR, undefined, this.roots, this.nocase, this.childrenCache(), { fs: fs12 });
33357
33570
  }
33358
33571
  isAbsolute(p) {
33359
33572
  return p.startsWith("/");
@@ -33610,8 +33823,8 @@ class MatchRecord {
33610
33823
  this.store.set(target, current === undefined ? n : n & current);
33611
33824
  }
33612
33825
  entries() {
33613
- return [...this.store.entries()].map(([path16, n]) => [
33614
- path16,
33826
+ return [...this.store.entries()].map(([path17, n]) => [
33827
+ path17,
33615
33828
  !!(n & 2),
33616
33829
  !!(n & 1)
33617
33830
  ]);
@@ -33815,9 +34028,9 @@ class GlobUtil {
33815
34028
  signal;
33816
34029
  maxDepth;
33817
34030
  includeChildMatches;
33818
- constructor(patterns, path16, opts) {
34031
+ constructor(patterns, path17, opts) {
33819
34032
  this.patterns = patterns;
33820
- this.path = path16;
34033
+ this.path = path17;
33821
34034
  this.opts = opts;
33822
34035
  this.#sep = !opts.posix && opts.platform === "win32" ? "\\" : "/";
33823
34036
  this.includeChildMatches = opts.includeChildMatches !== false;
@@ -33836,11 +34049,11 @@ class GlobUtil {
33836
34049
  });
33837
34050
  }
33838
34051
  }
33839
- #ignored(path16) {
33840
- return this.seen.has(path16) || !!this.#ignore?.ignored?.(path16);
34052
+ #ignored(path17) {
34053
+ return this.seen.has(path17) || !!this.#ignore?.ignored?.(path17);
33841
34054
  }
33842
- #childrenIgnored(path16) {
33843
- return !!this.#ignore?.childrenIgnored?.(path16);
34055
+ #childrenIgnored(path17) {
34056
+ return !!this.#ignore?.childrenIgnored?.(path17);
33844
34057
  }
33845
34058
  pause() {
33846
34059
  this.paused = true;
@@ -34057,8 +34270,8 @@ var init_walker = __esm(() => {
34057
34270
  init_processor();
34058
34271
  GlobWalker = class GlobWalker extends GlobUtil {
34059
34272
  matches = new Set;
34060
- constructor(patterns, path16, opts) {
34061
- super(patterns, path16, opts);
34273
+ constructor(patterns, path17, opts) {
34274
+ super(patterns, path17, opts);
34062
34275
  }
34063
34276
  matchEmit(e) {
34064
34277
  this.matches.add(e);
@@ -34095,8 +34308,8 @@ var init_walker = __esm(() => {
34095
34308
  };
34096
34309
  GlobStream = class GlobStream extends GlobUtil {
34097
34310
  results;
34098
- constructor(patterns, path16, opts) {
34099
- super(patterns, path16, opts);
34311
+ constructor(patterns, path17, opts) {
34312
+ super(patterns, path17, opts);
34100
34313
  this.results = new Minipass({
34101
34314
  signal: this.signal,
34102
34315
  objectMode: true
@@ -34524,20 +34737,20 @@ var require_ignore = __commonJS((exports, module) => {
34524
34737
  var throwError = (message, Ctor) => {
34525
34738
  throw new Ctor(message);
34526
34739
  };
34527
- var checkPath = (path16, originalPath, doThrow) => {
34528
- if (!isString(path16)) {
34740
+ var checkPath = (path17, originalPath, doThrow) => {
34741
+ if (!isString(path17)) {
34529
34742
  return doThrow(`path must be a string, but got \`${originalPath}\``, TypeError);
34530
34743
  }
34531
- if (!path16) {
34744
+ if (!path17) {
34532
34745
  return doThrow(`path must not be empty`, TypeError);
34533
34746
  }
34534
- if (checkPath.isNotRelative(path16)) {
34747
+ if (checkPath.isNotRelative(path17)) {
34535
34748
  const r = "`path.relative()`d";
34536
34749
  return doThrow(`path should be a ${r} string, but got "${originalPath}"`, RangeError);
34537
34750
  }
34538
34751
  return true;
34539
34752
  };
34540
- var isNotRelative = (path16) => REGEX_TEST_INVALID_PATH.test(path16);
34753
+ var isNotRelative = (path17) => REGEX_TEST_INVALID_PATH.test(path17);
34541
34754
  checkPath.isNotRelative = isNotRelative;
34542
34755
  checkPath.convert = (p) => p;
34543
34756
 
@@ -34580,7 +34793,7 @@ var require_ignore = __commonJS((exports, module) => {
34580
34793
  addPattern(pattern) {
34581
34794
  return this.add(pattern);
34582
34795
  }
34583
- _testOne(path16, checkUnignored) {
34796
+ _testOne(path17, checkUnignored) {
34584
34797
  let ignored = false;
34585
34798
  let unignored = false;
34586
34799
  this._rules.forEach((rule) => {
@@ -34588,7 +34801,7 @@ var require_ignore = __commonJS((exports, module) => {
34588
34801
  if (unignored === negative && ignored !== unignored || negative && !ignored && !unignored && !checkUnignored) {
34589
34802
  return;
34590
34803
  }
34591
- const matched = rule.regex.test(path16);
34804
+ const matched = rule.regex.test(path17);
34592
34805
  if (matched) {
34593
34806
  ignored = !negative;
34594
34807
  unignored = negative;
@@ -34600,39 +34813,39 @@ var require_ignore = __commonJS((exports, module) => {
34600
34813
  };
34601
34814
  }
34602
34815
  _test(originalPath, cache, checkUnignored, slices) {
34603
- const path16 = originalPath && checkPath.convert(originalPath);
34604
- checkPath(path16, originalPath, this._allowRelativePaths ? RETURN_FALSE : throwError);
34605
- return this._t(path16, cache, checkUnignored, slices);
34816
+ const path17 = originalPath && checkPath.convert(originalPath);
34817
+ checkPath(path17, originalPath, this._allowRelativePaths ? RETURN_FALSE : throwError);
34818
+ return this._t(path17, cache, checkUnignored, slices);
34606
34819
  }
34607
- _t(path16, cache, checkUnignored, slices) {
34608
- if (path16 in cache) {
34609
- return cache[path16];
34820
+ _t(path17, cache, checkUnignored, slices) {
34821
+ if (path17 in cache) {
34822
+ return cache[path17];
34610
34823
  }
34611
34824
  if (!slices) {
34612
- slices = path16.split(SLASH2);
34825
+ slices = path17.split(SLASH2);
34613
34826
  }
34614
34827
  slices.pop();
34615
34828
  if (!slices.length) {
34616
- return cache[path16] = this._testOne(path16, checkUnignored);
34829
+ return cache[path17] = this._testOne(path17, checkUnignored);
34617
34830
  }
34618
34831
  const parent = this._t(slices.join(SLASH2) + SLASH2, cache, checkUnignored, slices);
34619
- return cache[path16] = parent.ignored ? parent : this._testOne(path16, checkUnignored);
34832
+ return cache[path17] = parent.ignored ? parent : this._testOne(path17, checkUnignored);
34620
34833
  }
34621
- ignores(path16) {
34622
- return this._test(path16, this._ignoreCache, false).ignored;
34834
+ ignores(path17) {
34835
+ return this._test(path17, this._ignoreCache, false).ignored;
34623
34836
  }
34624
34837
  createFilter() {
34625
- return (path16) => !this.ignores(path16);
34838
+ return (path17) => !this.ignores(path17);
34626
34839
  }
34627
34840
  filter(paths) {
34628
34841
  return makeArray(paths).filter(this.createFilter());
34629
34842
  }
34630
- test(path16) {
34631
- return this._test(path16, this._testCache, true);
34843
+ test(path17) {
34844
+ return this._test(path17, this._testCache, true);
34632
34845
  }
34633
34846
  }
34634
34847
  var factory = (options) => new Ignore2(options);
34635
- var isPathValid = (path16) => checkPath(path16 && checkPath.convert(path16), path16, RETURN_FALSE);
34848
+ var isPathValid = (path17) => checkPath(path17 && checkPath.convert(path17), path17, RETURN_FALSE);
34636
34849
  factory.isPathValid = isPathValid;
34637
34850
  factory.default = factory;
34638
34851
  module.exports = factory;
@@ -34640,7 +34853,7 @@ var require_ignore = __commonJS((exports, module) => {
34640
34853
  const makePosix = (str) => /^\\\\\?\\/.test(str) || /["<>|\u0000-\u001F]+/u.test(str) ? str : str.replace(/\\/g, "/");
34641
34854
  checkPath.convert = makePosix;
34642
34855
  const REGIX_IS_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i;
34643
- checkPath.isNotRelative = (path16) => REGIX_IS_WINDOWS_PATH_ABSOLUTE.test(path16) || isNotRelative(path16);
34856
+ checkPath.isNotRelative = (path17) => REGIX_IS_WINDOWS_PATH_ABSOLUTE.test(path17) || isNotRelative(path17);
34644
34857
  }
34645
34858
  });
34646
34859
 
@@ -34702,13 +34915,13 @@ function validatePolicy(policy, opts = {}) {
34702
34915
  }
34703
34916
  }
34704
34917
  }
34705
- function matchesGlob2(path16, pattern) {
34918
+ function matchesGlob2(path17, pattern) {
34706
34919
  let re = regexCache.get(pattern);
34707
34920
  if (!re) {
34708
34921
  re = globToRegex(pattern);
34709
34922
  regexCache.set(pattern, re);
34710
34923
  }
34711
- return re.test(path16);
34924
+ return re.test(path17);
34712
34925
  }
34713
34926
  var DEFAULT_POLICY, applyPolicy = (filePath, policy) => {
34714
34927
  const normalized = filePath.trim();
@@ -34725,8 +34938,8 @@ var init_capture_policy = __esm(() => {
34725
34938
  });
34726
34939
 
34727
34940
  // ../../packages/core/dist/services/search/ignore-patterns.js
34728
- import fs11 from "fs/promises";
34729
- import path16 from "path";
34941
+ import fs12 from "fs/promises";
34942
+ import path17 from "path";
34730
34943
  function buildExtensionGlob(extensions) {
34731
34944
  return extensions.map((ext2) => `**/*${ext2}`);
34732
34945
  }
@@ -34749,8 +34962,8 @@ async function loadProjectIgnore(projectPath) {
34749
34962
  const ig = ignore();
34750
34963
  ig.add(DEFAULT_IGNORES);
34751
34964
  try {
34752
- const gitignorePath = path16.join(projectPath, ".gitignore");
34753
- const gitignoreContent = await fs11.readFile(gitignorePath, "utf8");
34965
+ const gitignorePath = path17.join(projectPath, ".gitignore");
34966
+ const gitignoreContent = await fs12.readFile(gitignorePath, "utf8");
34754
34967
  const rules = gitignoreContent.split(`
34755
34968
  `).map((line) => line.trim()).filter((line) => line && !line.startsWith("#"));
34756
34969
  ig.add(rules);
@@ -36349,15 +36562,15 @@ var require_pg_connection_string = __commonJS((exports, module) => {
36349
36562
  if (config3.sslnegotiation === "direct" && config3.ssl === undefined) {
36350
36563
  config3.ssl = true;
36351
36564
  }
36352
- const fs12 = config3.sslcert || config3.sslkey || config3.sslrootcert ? __require("fs") : null;
36565
+ const fs13 = config3.sslcert || config3.sslkey || config3.sslrootcert ? __require("fs") : null;
36353
36566
  if (config3.sslcert) {
36354
- config3.ssl.cert = fs12.readFileSync(config3.sslcert).toString();
36567
+ config3.ssl.cert = fs13.readFileSync(config3.sslcert).toString();
36355
36568
  }
36356
36569
  if (config3.sslkey) {
36357
- config3.ssl.key = fs12.readFileSync(config3.sslkey).toString();
36570
+ config3.ssl.key = fs13.readFileSync(config3.sslkey).toString();
36358
36571
  }
36359
36572
  if (config3.sslrootcert) {
36360
- config3.ssl.ca = fs12.readFileSync(config3.sslrootcert).toString();
36573
+ config3.ssl.ca = fs13.readFileSync(config3.sslrootcert).toString();
36361
36574
  }
36362
36575
  if (options.useLibpqCompat && config3.uselibpqcompat) {
36363
36576
  throw new Error("Both useLibpqCompat and uselibpqcompat are set. Please use only one of them.");
@@ -38071,7 +38284,7 @@ var require_split2 = __commonJS((exports, module) => {
38071
38284
 
38072
38285
  // ../../node_modules/pgpass/lib/helper.js
38073
38286
  var require_helper = __commonJS((exports, module) => {
38074
- var path17 = __require("path");
38287
+ var path18 = __require("path");
38075
38288
  var Stream2 = __require("stream").Stream;
38076
38289
  var split = require_split2();
38077
38290
  var util3 = __require("util");
@@ -38111,7 +38324,7 @@ var require_helper = __commonJS((exports, module) => {
38111
38324
  };
38112
38325
  exports.getFileName = function(rawEnv) {
38113
38326
  var env = rawEnv || process.env;
38114
- var file2 = env.PGPASSFILE || (isWin ? path17.join(env.APPDATA || "./", "postgresql", "pgpass.conf") : path17.join(env.HOME || "./", ".pgpass"));
38327
+ var file2 = env.PGPASSFILE || (isWin ? path18.join(env.APPDATA || "./", "postgresql", "pgpass.conf") : path18.join(env.HOME || "./", ".pgpass"));
38115
38328
  return file2;
38116
38329
  };
38117
38330
  exports.usePgPass = function(stats, fname) {
@@ -38235,16 +38448,16 @@ var require_helper = __commonJS((exports, module) => {
38235
38448
 
38236
38449
  // ../../node_modules/pgpass/lib/index.js
38237
38450
  var require_lib = __commonJS((exports, module) => {
38238
- var path17 = __require("path");
38239
- var fs12 = __require("fs");
38451
+ var path18 = __require("path");
38452
+ var fs13 = __require("fs");
38240
38453
  var helper = require_helper();
38241
38454
  module.exports = function(connInfo, cb) {
38242
38455
  var file2 = helper.getFileName();
38243
- fs12.stat(file2, function(err, stat) {
38456
+ fs13.stat(file2, function(err, stat) {
38244
38457
  if (err || !helper.usePgPass(stat, file2)) {
38245
38458
  return cb(undefined);
38246
38459
  }
38247
- var st = fs12.createReadStream(file2);
38460
+ var st = fs13.createReadStream(file2);
38248
38461
  helper.getPassword(connInfo, st, cb);
38249
38462
  });
38250
38463
  };
@@ -39943,8 +40156,8 @@ var init_alias_resolver = __esm(() => {
39943
40156
  });
39944
40157
 
39945
40158
  // ../../packages/core/dist/services/search/index-manager.js
39946
- import fs12 from "fs";
39947
- import path17 from "path";
40159
+ import fs13 from "fs";
40160
+ import path18 from "path";
39948
40161
 
39949
40162
  class IndexManager {
39950
40163
  metadataCache = new Map;
@@ -40037,9 +40250,9 @@ class IndexManager {
40037
40250
  const fileMetadata = {};
40038
40251
  let totalSize = 0;
40039
40252
  for (const filePath of indexedFiles) {
40040
- const fullPath = path17.join(projectPath, filePath);
40253
+ const fullPath = path18.join(projectPath, filePath);
40041
40254
  try {
40042
- const stat = await fs12.promises.stat(fullPath);
40255
+ const stat = await fs13.promises.stat(fullPath);
40043
40256
  fileMetadata[filePath] = {
40044
40257
  path: filePath,
40045
40258
  mtime: stat.mtimeMs,
@@ -40090,9 +40303,9 @@ class IndexManager {
40090
40303
  if (ig.ignores(match2)) {
40091
40304
  continue;
40092
40305
  }
40093
- const fullPath = path17.join(projectPath, match2);
40306
+ const fullPath = path18.join(projectPath, match2);
40094
40307
  try {
40095
- const stat = await fs12.promises.stat(fullPath);
40308
+ const stat = await fs13.promises.stat(fullPath);
40096
40309
  files.set(match2, {
40097
40310
  path: match2,
40098
40311
  mtime: stat.mtimeMs,
@@ -43345,23 +43558,23 @@ var require_auth_config = __commonJS((exports, module) => {
43345
43558
  writeAuthConfig: () => writeAuthConfig
43346
43559
  });
43347
43560
  module.exports = __toCommonJS2(auth_config_exports);
43348
- var fs13 = __toESM2(__require("fs"));
43349
- var path18 = __toESM2(__require("path"));
43561
+ var fs14 = __toESM2(__require("fs"));
43562
+ var path19 = __toESM2(__require("path"));
43350
43563
  var import_token_util = require_token_util();
43351
43564
  function getAuthConfigPath() {
43352
43565
  const dataDir = (0, import_token_util.getVercelDataDir)();
43353
43566
  if (!dataDir) {
43354
43567
  throw new Error(`Unable to find Vercel CLI data directory. Your platform: ${process.platform}. Supported: darwin, linux, win32.`);
43355
43568
  }
43356
- return path18.join(dataDir, "auth.json");
43569
+ return path19.join(dataDir, "auth.json");
43357
43570
  }
43358
43571
  function readAuthConfig() {
43359
43572
  try {
43360
43573
  const authPath = getAuthConfigPath();
43361
- if (!fs13.existsSync(authPath)) {
43574
+ if (!fs14.existsSync(authPath)) {
43362
43575
  return null;
43363
43576
  }
43364
- const content = fs13.readFileSync(authPath, "utf8");
43577
+ const content = fs14.readFileSync(authPath, "utf8");
43365
43578
  if (!content) {
43366
43579
  return null;
43367
43580
  }
@@ -43372,11 +43585,11 @@ var require_auth_config = __commonJS((exports, module) => {
43372
43585
  }
43373
43586
  function writeAuthConfig(config3) {
43374
43587
  const authPath = getAuthConfigPath();
43375
- const authDir = path18.dirname(authPath);
43376
- if (!fs13.existsSync(authDir)) {
43377
- fs13.mkdirSync(authDir, { mode: 504, recursive: true });
43588
+ const authDir = path19.dirname(authPath);
43589
+ if (!fs14.existsSync(authDir)) {
43590
+ fs14.mkdirSync(authDir, { mode: 504, recursive: true });
43378
43591
  }
43379
- fs13.writeFileSync(authPath, JSON.stringify(config3, null, 2), { mode: 384 });
43592
+ fs14.writeFileSync(authPath, JSON.stringify(config3, null, 2), { mode: 384 });
43380
43593
  }
43381
43594
  function isValidAccessToken(authConfig, expirationBufferMs = 0) {
43382
43595
  if (!authConfig.token)
@@ -43551,8 +43764,8 @@ var require_token_util = __commonJS((exports, module) => {
43551
43764
  saveToken: () => saveToken
43552
43765
  });
43553
43766
  module.exports = __toCommonJS2(token_util_exports);
43554
- var path18 = __toESM2(__require("path"));
43555
- var fs13 = __toESM2(__require("fs"));
43767
+ var path19 = __toESM2(__require("path"));
43768
+ var fs14 = __toESM2(__require("fs"));
43556
43769
  var import_token_error = require_token_error();
43557
43770
  var import_token_io = require_token_io();
43558
43771
  var import_auth_config = require_auth_config();
@@ -43564,7 +43777,7 @@ var require_token_util = __commonJS((exports, module) => {
43564
43777
  if (!dataDir) {
43565
43778
  return null;
43566
43779
  }
43567
- return path18.join(dataDir, vercelFolder);
43780
+ return path19.join(dataDir, vercelFolder);
43568
43781
  }
43569
43782
  async function getVercelToken2(options) {
43570
43783
  const authConfig = (0, import_auth_config.readAuthConfig)();
@@ -43632,11 +43845,11 @@ var require_token_util = __commonJS((exports, module) => {
43632
43845
  if (!dir) {
43633
43846
  throw new import_token_error.VercelOidcTokenError("Unable to find project root directory. Have you linked your project with `vc link?`");
43634
43847
  }
43635
- const prjPath = path18.join(dir, ".vercel", "project.json");
43636
- if (!fs13.existsSync(prjPath)) {
43848
+ const prjPath = path19.join(dir, ".vercel", "project.json");
43849
+ if (!fs14.existsSync(prjPath)) {
43637
43850
  throw new import_token_error.VercelOidcTokenError("project.json not found, have you linked your project with `vc link?`");
43638
43851
  }
43639
- const prj = JSON.parse(fs13.readFileSync(prjPath, "utf8"));
43852
+ const prj = JSON.parse(fs14.readFileSync(prjPath, "utf8"));
43640
43853
  if (typeof prj.projectId !== "string" && typeof prj.orgId !== "string") {
43641
43854
  throw new TypeError("Expected a string-valued projectId property. Try running `vc link` to re-link your project.");
43642
43855
  }
@@ -43647,11 +43860,11 @@ var require_token_util = __commonJS((exports, module) => {
43647
43860
  if (!dir) {
43648
43861
  throw new import_token_error.VercelOidcTokenError("Unable to find user data directory. Please reach out to Vercel support.");
43649
43862
  }
43650
- const tokenPath = path18.join(dir, "com.vercel.token", `${projectId}.json`);
43863
+ const tokenPath = path19.join(dir, "com.vercel.token", `${projectId}.json`);
43651
43864
  const tokenJson = JSON.stringify(token);
43652
- fs13.mkdirSync(path18.dirname(tokenPath), { mode: 504, recursive: true });
43653
- fs13.writeFileSync(tokenPath, tokenJson);
43654
- fs13.chmodSync(tokenPath, 432);
43865
+ fs14.mkdirSync(path19.dirname(tokenPath), { mode: 504, recursive: true });
43866
+ fs14.writeFileSync(tokenPath, tokenJson);
43867
+ fs14.chmodSync(tokenPath, 432);
43655
43868
  return;
43656
43869
  }
43657
43870
  function loadToken(projectId) {
@@ -43659,11 +43872,11 @@ var require_token_util = __commonJS((exports, module) => {
43659
43872
  if (!dir) {
43660
43873
  throw new import_token_error.VercelOidcTokenError("Unable to find user data directory. Please reach out to Vercel support.");
43661
43874
  }
43662
- const tokenPath = path18.join(dir, "com.vercel.token", `${projectId}.json`);
43663
- if (!fs13.existsSync(tokenPath)) {
43875
+ const tokenPath = path19.join(dir, "com.vercel.token", `${projectId}.json`);
43876
+ if (!fs14.existsSync(tokenPath)) {
43664
43877
  return null;
43665
43878
  }
43666
- const token = JSON.parse(fs13.readFileSync(tokenPath, "utf8"));
43879
+ const token = JSON.parse(fs14.readFileSync(tokenPath, "utf8"));
43667
43880
  assertVercelOidcTokenResponse(token);
43668
43881
  return token;
43669
43882
  }
@@ -54505,37 +54718,37 @@ function createOpenAI(options = {}) {
54505
54718
  }, `ai-sdk/openai/${VERSION4}`);
54506
54719
  const createChatModel = (modelId) => new OpenAIChatLanguageModel(modelId, {
54507
54720
  provider: `${providerName}.chat`,
54508
- url: ({ path: path18 }) => `${baseURL}${path18}`,
54721
+ url: ({ path: path19 }) => `${baseURL}${path19}`,
54509
54722
  headers: getHeaders,
54510
54723
  fetch: options.fetch
54511
54724
  });
54512
54725
  const createCompletionModel = (modelId) => new OpenAICompletionLanguageModel(modelId, {
54513
54726
  provider: `${providerName}.completion`,
54514
- url: ({ path: path18 }) => `${baseURL}${path18}`,
54727
+ url: ({ path: path19 }) => `${baseURL}${path19}`,
54515
54728
  headers: getHeaders,
54516
54729
  fetch: options.fetch
54517
54730
  });
54518
54731
  const createEmbeddingModel = (modelId) => new OpenAIEmbeddingModel(modelId, {
54519
54732
  provider: `${providerName}.embedding`,
54520
- url: ({ path: path18 }) => `${baseURL}${path18}`,
54733
+ url: ({ path: path19 }) => `${baseURL}${path19}`,
54521
54734
  headers: getHeaders,
54522
54735
  fetch: options.fetch
54523
54736
  });
54524
54737
  const createImageModel = (modelId) => new OpenAIImageModel(modelId, {
54525
54738
  provider: `${providerName}.image`,
54526
- url: ({ path: path18 }) => `${baseURL}${path18}`,
54739
+ url: ({ path: path19 }) => `${baseURL}${path19}`,
54527
54740
  headers: getHeaders,
54528
54741
  fetch: options.fetch
54529
54742
  });
54530
54743
  const createTranscriptionModel = (modelId) => new OpenAITranscriptionModel(modelId, {
54531
54744
  provider: `${providerName}.transcription`,
54532
- url: ({ path: path18 }) => `${baseURL}${path18}`,
54745
+ url: ({ path: path19 }) => `${baseURL}${path19}`,
54533
54746
  headers: getHeaders,
54534
54747
  fetch: options.fetch
54535
54748
  });
54536
54749
  const createSpeechModel = (modelId) => new OpenAISpeechModel(modelId, {
54537
54750
  provider: `${providerName}.speech`,
54538
- url: ({ path: path18 }) => `${baseURL}${path18}`,
54751
+ url: ({ path: path19 }) => `${baseURL}${path19}`,
54539
54752
  headers: getHeaders,
54540
54753
  fetch: options.fetch
54541
54754
  });
@@ -54548,7 +54761,7 @@ function createOpenAI(options = {}) {
54548
54761
  const createResponsesModel = (modelId) => {
54549
54762
  return new OpenAIResponsesLanguageModel(modelId, {
54550
54763
  provider: `${providerName}.responses`,
54551
- url: ({ path: path18 }) => `${baseURL}${path18}`,
54764
+ url: ({ path: path19 }) => `${baseURL}${path19}`,
54552
54765
  headers: getHeaders,
54553
54766
  fetch: options.fetch,
54554
54767
  fileIdPrefixes: ["file-"]
@@ -71160,26 +71373,26 @@ var require_process = __commonJS((exports, module) => {
71160
71373
 
71161
71374
  // ../../node_modules/detect-libc/lib/filesystem.js
71162
71375
  var require_filesystem = __commonJS((exports, module) => {
71163
- var fs13 = __require("fs");
71376
+ var fs14 = __require("fs");
71164
71377
  var LDD_PATH = "/usr/bin/ldd";
71165
71378
  var SELF_PATH = "/proc/self/exe";
71166
71379
  var MAX_LENGTH = 2048;
71167
- var readFileSync2 = (path18) => {
71168
- const fd = fs13.openSync(path18, "r");
71380
+ var readFileSync2 = (path19) => {
71381
+ const fd = fs14.openSync(path19, "r");
71169
71382
  const buffer = Buffer.alloc(MAX_LENGTH);
71170
- const bytesRead = fs13.readSync(fd, buffer, 0, MAX_LENGTH, 0);
71171
- fs13.close(fd, () => {});
71383
+ const bytesRead = fs14.readSync(fd, buffer, 0, MAX_LENGTH, 0);
71384
+ fs14.close(fd, () => {});
71172
71385
  return buffer.subarray(0, bytesRead);
71173
71386
  };
71174
- var readFile = (path18) => new Promise((resolve4, reject) => {
71175
- fs13.open(path18, "r", (err, fd) => {
71387
+ var readFile = (path19) => new Promise((resolve4, reject) => {
71388
+ fs14.open(path19, "r", (err, fd) => {
71176
71389
  if (err) {
71177
71390
  reject(err);
71178
71391
  } else {
71179
71392
  const buffer = Buffer.alloc(MAX_LENGTH);
71180
- fs13.read(fd, buffer, 0, MAX_LENGTH, 0, (_, bytesRead) => {
71393
+ fs14.read(fd, buffer, 0, MAX_LENGTH, 0, (_, bytesRead) => {
71181
71394
  resolve4(buffer.subarray(0, bytesRead));
71182
- fs13.close(fd, () => {});
71395
+ fs14.close(fd, () => {});
71183
71396
  });
71184
71397
  }
71185
71398
  });
@@ -71284,11 +71497,11 @@ var require_detect_libc = __commonJS((exports, module) => {
71284
71497
  }
71285
71498
  return null;
71286
71499
  };
71287
- var familyFromInterpreterPath = (path18) => {
71288
- if (path18) {
71289
- if (path18.includes("/ld-musl-")) {
71500
+ var familyFromInterpreterPath = (path19) => {
71501
+ if (path19) {
71502
+ if (path19.includes("/ld-musl-")) {
71290
71503
  return MUSL;
71291
- } else if (path18.includes("/ld-linux-")) {
71504
+ } else if (path19.includes("/ld-linux-")) {
71292
71505
  return GLIBC;
71293
71506
  }
71294
71507
  }
@@ -71333,8 +71546,8 @@ var require_detect_libc = __commonJS((exports, module) => {
71333
71546
  cachedFamilyInterpreter = null;
71334
71547
  try {
71335
71548
  const selfContent = await readFile(SELF_PATH);
71336
- const path18 = interpreterPath(selfContent);
71337
- cachedFamilyInterpreter = familyFromInterpreterPath(path18);
71549
+ const path19 = interpreterPath(selfContent);
71550
+ cachedFamilyInterpreter = familyFromInterpreterPath(path19);
71338
71551
  } catch (e) {}
71339
71552
  return cachedFamilyInterpreter;
71340
71553
  };
@@ -71345,8 +71558,8 @@ var require_detect_libc = __commonJS((exports, module) => {
71345
71558
  cachedFamilyInterpreter = null;
71346
71559
  try {
71347
71560
  const selfContent = readFileSync2(SELF_PATH);
71348
- const path18 = interpreterPath(selfContent);
71349
- cachedFamilyInterpreter = familyFromInterpreterPath(path18);
71561
+ const path19 = interpreterPath(selfContent);
71562
+ cachedFamilyInterpreter = familyFromInterpreterPath(path19);
71350
71563
  } catch (e) {}
71351
71564
  return cachedFamilyInterpreter;
71352
71565
  };
@@ -73008,18 +73221,18 @@ var require_sharp = __commonJS((exports, module) => {
73008
73221
  `@img/sharp-${runtimePlatform}/sharp.node`,
73009
73222
  "@img/sharp-wasm32/sharp.node"
73010
73223
  ];
73011
- var path18;
73224
+ var path19;
73012
73225
  var sharp;
73013
73226
  var errors4 = [];
73014
- for (path18 of paths) {
73227
+ for (path19 of paths) {
73015
73228
  try {
73016
- sharp = __require(path18);
73229
+ sharp = __require(path19);
73017
73230
  break;
73018
73231
  } catch (err) {
73019
73232
  errors4.push(err);
73020
73233
  }
73021
73234
  }
73022
- if (sharp && path18.startsWith("@img/sharp-linux-x64") && !sharp._isUsingX64V2()) {
73235
+ if (sharp && path19.startsWith("@img/sharp-linux-x64") && !sharp._isUsingX64V2()) {
73023
73236
  const err = new Error("Prebuilt binaries for linux-x64 require v2 microarchitecture");
73024
73237
  err.code = "Unsupported CPU";
73025
73238
  errors4.push(err);
@@ -73028,7 +73241,7 @@ var require_sharp = __commonJS((exports, module) => {
73028
73241
  if (sharp) {
73029
73242
  module.exports = sharp;
73030
73243
  } else {
73031
- const [isLinux, isMacOs, isWindows] = ["linux", "darwin", "win32"].map((os8) => runtimePlatform.startsWith(os8));
73244
+ const [isLinux, isMacOs, isWindows] = ["linux", "darwin", "win32"].map((os9) => runtimePlatform.startsWith(os9));
73032
73245
  const help = [`Could not load the "sharp" module using the ${runtimePlatform} runtime`];
73033
73246
  errors4.forEach((err) => {
73034
73247
  if (err.code !== "MODULE_NOT_FOUND") {
@@ -73041,9 +73254,9 @@ var require_sharp = __commonJS((exports, module) => {
73041
73254
  const { found, expected } = isUnsupportedNodeRuntime();
73042
73255
  help.push("- Please upgrade Node.js:", ` Found ${found}`, ` Requires ${expected}`);
73043
73256
  } else if (prebuiltPlatforms.includes(runtimePlatform)) {
73044
- const [os8, cpu] = runtimePlatform.split("-");
73045
- const libc = os8.endsWith("musl") ? " --libc=musl" : "";
73046
- help.push("- Ensure optional dependencies can be installed:", " npm install --include=optional sharp", "- Ensure your package manager supports multi-platform installation:", " See https://sharp.pixelplumbing.com/install#cross-platform", "- Add platform-specific dependencies:", ` npm install --os=${os8.replace("musl", "")}${libc} --cpu=${cpu} sharp`);
73257
+ const [os9, cpu] = runtimePlatform.split("-");
73258
+ const libc = os9.endsWith("musl") ? " --libc=musl" : "";
73259
+ help.push("- Ensure optional dependencies can be installed:", " npm install --include=optional sharp", "- Ensure your package manager supports multi-platform installation:", " See https://sharp.pixelplumbing.com/install#cross-platform", "- Add platform-specific dependencies:", ` npm install --os=${os9.replace("musl", "")}${libc} --cpu=${cpu} sharp`);
73047
73260
  } else {
73048
73261
  help.push(`- Manually install libvips >= ${minimumLibvipsVersion}`, "- Add experimental WebAssembly-based dependencies:", " npm install --cpu=wasm32 sharp", " npm install @img/sharp-wasm32");
73049
73262
  }
@@ -75881,15 +76094,15 @@ var require_color = __commonJS((exports, module) => {
75881
76094
  };
75882
76095
  }
75883
76096
  function wrapConversion(toModel, graph) {
75884
- const path18 = [graph[toModel].parent, toModel];
76097
+ const path19 = [graph[toModel].parent, toModel];
75885
76098
  let fn = conversions_default[graph[toModel].parent][toModel];
75886
76099
  let cur = graph[toModel].parent;
75887
76100
  while (graph[cur].parent) {
75888
- path18.unshift(graph[cur].parent);
76101
+ path19.unshift(graph[cur].parent);
75889
76102
  fn = link(conversions_default[graph[cur].parent][cur], fn);
75890
76103
  cur = graph[cur].parent;
75891
76104
  }
75892
- fn.conversion = path18;
76105
+ fn.conversion = path19;
75893
76106
  return fn;
75894
76107
  }
75895
76108
  function route(fromModel) {
@@ -76494,7 +76707,7 @@ var require_output = __commonJS((exports, module) => {
76494
76707
  Copyright 2013 Lovell Fuller and others.
76495
76708
  SPDX-License-Identifier: Apache-2.0
76496
76709
  */
76497
- var path18 = __require("path");
76710
+ var path19 = __require("path");
76498
76711
  var is = require_is();
76499
76712
  var sharp = require_sharp();
76500
76713
  var formats = new Map([
@@ -76525,9 +76738,9 @@ var require_output = __commonJS((exports, module) => {
76525
76738
  let err;
76526
76739
  if (!is.string(fileOut)) {
76527
76740
  err = new Error("Missing output file path");
76528
- } else if (is.string(this.options.input.file) && path18.resolve(this.options.input.file) === path18.resolve(fileOut)) {
76741
+ } else if (is.string(this.options.input.file) && path19.resolve(this.options.input.file) === path19.resolve(fileOut)) {
76529
76742
  err = new Error("Cannot use same file for input and output");
76530
- } else if (jp2Regex.test(path18.extname(fileOut)) && !this.constructor.format.jp2k.output.file) {
76743
+ } else if (jp2Regex.test(path19.extname(fileOut)) && !this.constructor.format.jp2k.output.file) {
76531
76744
  err = errJp2Save();
76532
76745
  }
76533
76746
  if (err) {
@@ -83774,11 +83987,11 @@ var init_transformers_node = __esm(() => {
83774
83987
  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}).`);
83775
83988
  }
83776
83989
  for (let i = 0;i < num_chunks; ++i) {
83777
- const path18 = `${baseName}_data${i === 0 ? "" : "_" + i}`;
83778
- const fullPath = `${options.subfolder ?? ""}/${path18}`;
83990
+ const path19 = `${baseName}_data${i === 0 ? "" : "_" + i}`;
83991
+ const fullPath = `${options.subfolder ?? ""}/${path19}`;
83779
83992
  externalDataPromises.push(new Promise(async (resolve4, reject) => {
83780
83993
  const data = await (0, _utils_hub_js__WEBPACK_IMPORTED_MODULE_5__.getModelFile)(pretrained_model_name_or_path, fullPath, true, options, return_path);
83781
- resolve4(data instanceof Uint8Array ? { path: path18, data } : path18);
83994
+ resolve4(data instanceof Uint8Array ? { path: path19, data } : path19);
83782
83995
  }));
83783
83996
  }
83784
83997
  } else if (session_options.externalData !== undefined) {
@@ -96842,7 +97055,7 @@ ${fake_token_around_image}` + `${global_img_token}` + image_token.repeat(image_s
96842
97055
  const blob = new Blob([wav], { type: "audio/wav" });
96843
97056
  return blob;
96844
97057
  }
96845
- async save(path18) {
97058
+ async save(path19) {
96846
97059
  let fn;
96847
97060
  if (_env_js__WEBPACK_IMPORTED_MODULE_3__.apis.IS_BROWSER_ENV) {
96848
97061
  if (_env_js__WEBPACK_IMPORTED_MODULE_3__.apis.IS_WEBWORKER_ENV) {
@@ -96850,14 +97063,14 @@ ${fake_token_around_image}` + `${global_img_token}` + image_token.repeat(image_s
96850
97063
  }
96851
97064
  fn = _core_js__WEBPACK_IMPORTED_MODULE_2__.saveBlob;
96852
97065
  } else if (_env_js__WEBPACK_IMPORTED_MODULE_3__.apis.IS_FS_AVAILABLE) {
96853
- fn = async (path19, blob) => {
97066
+ fn = async (path20, blob) => {
96854
97067
  let buffer = await blob.arrayBuffer();
96855
- node_fs__WEBPACK_IMPORTED_MODULE_5__["default"].writeFileSync(path19, Buffer.from(buffer));
97068
+ node_fs__WEBPACK_IMPORTED_MODULE_5__["default"].writeFileSync(path20, Buffer.from(buffer));
96856
97069
  };
96857
97070
  } else {
96858
97071
  throw new Error("Unable to save because filesystem is disabled in this environment.");
96859
97072
  }
96860
- await fn(path18, this.toBlob());
97073
+ await fn(path19, this.toBlob());
96861
97074
  }
96862
97075
  }
96863
97076
  },
@@ -96953,11 +97166,11 @@ ${fake_token_around_image}` + `${global_img_token}` + image_token.repeat(image_s
96953
97166
  function calculateReflectOffset(i, w) {
96954
97167
  return Math.abs((i + w) % (2 * w) - w);
96955
97168
  }
96956
- function saveBlob(path18, blob) {
97169
+ function saveBlob(path19, blob) {
96957
97170
  const dataURL = URL.createObjectURL(blob);
96958
97171
  const downloadLink = document.createElement("a");
96959
97172
  downloadLink.href = dataURL;
96960
- downloadLink.download = path18;
97173
+ downloadLink.download = path19;
96961
97174
  downloadLink.click();
96962
97175
  downloadLink.remove();
96963
97176
  URL.revokeObjectURL(dataURL);
@@ -97558,8 +97771,8 @@ ${fake_token_around_image}` + `${global_img_token}` + image_token.repeat(image_s
97558
97771
  }
97559
97772
 
97560
97773
  class FileCache {
97561
- constructor(path18) {
97562
- this.path = path18;
97774
+ constructor(path19) {
97775
+ this.path = path19;
97563
97776
  }
97564
97777
  async match(request) {
97565
97778
  let filePath = node_path__WEBPACK_IMPORTED_MODULE_1__["default"].join(this.path, request);
@@ -98315,20 +98528,20 @@ ${fake_token_around_image}` + `${global_img_token}` + image_token.repeat(image_s
98315
98528
  }
98316
98529
  return this;
98317
98530
  }
98318
- async save(path18) {
98531
+ async save(path19) {
98319
98532
  if (IS_BROWSER_OR_WEBWORKER) {
98320
98533
  if (_env_js__WEBPACK_IMPORTED_MODULE_2__.apis.IS_WEBWORKER_ENV) {
98321
98534
  throw new Error("Unable to save an image from a Web Worker.");
98322
98535
  }
98323
- const extension = path18.split(".").pop().toLowerCase();
98536
+ const extension = path19.split(".").pop().toLowerCase();
98324
98537
  const mime = CONTENT_TYPE_MAP.get(extension) ?? "image/png";
98325
98538
  const blob = await this.toBlob(mime);
98326
- (0, _core_js__WEBPACK_IMPORTED_MODULE_0__.saveBlob)(path18, blob);
98539
+ (0, _core_js__WEBPACK_IMPORTED_MODULE_0__.saveBlob)(path19, blob);
98327
98540
  } else if (!_env_js__WEBPACK_IMPORTED_MODULE_2__.apis.IS_FS_AVAILABLE) {
98328
98541
  throw new Error("Unable to save the image because filesystem is disabled in this environment.");
98329
98542
  } else {
98330
98543
  const img = this.toSharp();
98331
- return await img.toFile(path18);
98544
+ return await img.toFile(path19);
98332
98545
  }
98333
98546
  }
98334
98547
  toSharp() {
@@ -107557,7 +107770,7 @@ Note that ${s.bold("include")} statements only accept relation fields.`, a;
107557
107770
  function ns(e = Yo, t = Yo) {
107558
107771
  return (r) => e(t(r));
107559
107772
  }
107560
- function os8({ dataPath: e, modelName: t, args: r, runtimeDataModel: n }) {
107773
+ function os9({ dataPath: e, modelName: t, args: r, runtimeDataModel: n }) {
107561
107774
  let i = { modelName: t, args: r ?? {} }, o = dp(e);
107562
107775
  if (!o || o.length === 0)
107563
107776
  return i;
@@ -107862,10 +108075,10 @@ Note that ${s.bold("include")} statements only accept relation fields.`, a;
107862
108075
  super(t, "P2023", r);
107863
108076
  }
107864
108077
  };
107865
- var fs13 = new WeakMap;
108078
+ var fs14 = new WeakMap;
107866
108079
  function Ep(e) {
107867
- let t = fs13.get(e);
107868
- return t || (t = Object.entries(e), fs13.set(e, t)), t;
108080
+ let t = fs14.get(e);
108081
+ return t || (t = Object.entries(e), fs14.set(e, t)), t;
107869
108082
  }
107870
108083
  function hs(e, t, r) {
107871
108084
  switch (t.type) {
@@ -111430,7 +111643,7 @@ new PrismaClient({
111430
111643
  let m = await es(this, d);
111431
111644
  if (!d.model)
111432
111645
  return m;
111433
- let g = os8({ dataPath: d.dataPath, modelName: d.model, args: d.args, runtimeDataModel: this._runtimeDataModel });
111646
+ let g = os9({ dataPath: d.dataPath, modelName: d.model, args: d.args, runtimeDataModel: this._runtimeDataModel });
111434
111647
  return Wo({ result: m, modelName: g.modelName, args: g.args, extensions: this._extensions, runtimeDataModel: this._runtimeDataModel, globalOmit: this._globalOmit });
111435
111648
  };
111436
111649
  return this._tracingHelper.runInChildSpan(s.operation, () => new zl.AsyncResource("prisma-client-request").runInAsyncScope(() => a(o)));
@@ -111833,7 +112046,7 @@ var require_prisma = __commonJS((exports) => {
111833
112046
  Prisma.JsonNull = JsonNull2;
111834
112047
  Prisma.AnyNull = AnyNull2;
111835
112048
  Prisma.NullTypes = NullTypes2;
111836
- var path18 = __require("path");
112049
+ var path19 = __require("path");
111837
112050
  exports.Prisma.TransactionIsolationLevel = makeStrictEnum2({
111838
112051
  ReadUncommitted: "ReadUncommitted",
111839
112052
  ReadCommitted: "ReadCommitted",
@@ -123531,10 +123744,10 @@ var init_chunker_code = __esm(() => {
123531
123744
  });
123532
123745
 
123533
123746
  // ../../packages/core/dist/services/search/smart-chunker.js
123534
- import path18 from "path";
123747
+ import path19 from "path";
123535
123748
  function smartChunk(content, filePath, config3 = {}) {
123536
123749
  const cfg = { ...DEFAULT_CONFIG, ...config3 };
123537
- const ext2 = path18.extname(filePath).toLowerCase();
123750
+ const ext2 = path19.extname(filePath).toLowerCase();
123538
123751
  const relativePath = filePath;
123539
123752
  const fileImports = isCodeFile(ext2) ? extractFileImports(content, ext2) : undefined;
123540
123753
  let chunks;
@@ -123872,8 +124085,8 @@ var init_embedding_freshness = __esm(() => {
123872
124085
  });
123873
124086
 
123874
124087
  // ../../packages/core/dist/services/search/project-indexer.js
123875
- import fs13 from "fs/promises";
123876
- import path19 from "path";
124088
+ import fs14 from "fs/promises";
124089
+ import path20 from "path";
123877
124090
  import { randomUUID as randomUUID3 } from "crypto";
123878
124091
  async function runWithIndexLock(lockMap, projectId, work) {
123879
124092
  const prevLock = lockMap.get(projectId);
@@ -123916,7 +124129,7 @@ async function indexProjectInternal(deps, projectPath, projectId, options = {})
123916
124129
  dot: false
123917
124130
  });
123918
124131
  const filteredFiles = files.filter((file2) => {
123919
- const relativePath = path19.relative(projectPath, file2);
124132
+ const relativePath = path20.relative(projectPath, file2);
123920
124133
  const shouldIgnore = ig.ignores(relativePath);
123921
124134
  if (shouldIgnore) {
123922
124135
  logger.debug("Ignoring file per .gitignore during indexing", {
@@ -123956,7 +124169,7 @@ async function indexProjectInternal(deps, projectPath, projectId, options = {})
123956
124169
  });
123957
124170
  }
123958
124171
  }
123959
- const indexedFilesList = filteredFiles.map((f) => path19.relative(projectPath, f));
124172
+ const indexedFilesList = filteredFiles.map((f) => path20.relative(projectPath, f));
123960
124173
  await deps.indexManager.updateIndexMetadata(projectId, projectPath, indexedFilesList);
123961
124174
  logger.info("Project indexing completed", {
123962
124175
  projectId,
@@ -124086,7 +124299,7 @@ async function ensureFreshIndex(deps, projectId, projectPath, options = {}) {
124086
124299
  let errors4 = 0;
124087
124300
  for (const relativeFilePath of filesToReindex) {
124088
124301
  try {
124089
- const fullPath = path19.join(projectPath, relativeFilePath);
124302
+ const fullPath = path20.join(projectPath, relativeFilePath);
124090
124303
  const result = await deps.indexFile(fullPath, projectId, projectPath, centralityMap);
124091
124304
  filesIndexed++;
124092
124305
  chunksIndexed += result.chunks;
@@ -124146,8 +124359,8 @@ async function checkSearchAdmission(deps, projectId, projectPath) {
124146
124359
  }
124147
124360
  async function indexFile(deps, filePath, projectId, projectRoot, centralityMap) {
124148
124361
  projectId = await getProjectIdentityAliasResolver().resolve(projectId);
124149
- const content = await fs13.readFile(filePath, "utf-8");
124150
- const relativePath = path19.relative(projectRoot, filePath);
124362
+ const content = await fs14.readFile(filePath, "utf-8");
124363
+ const relativePath = path20.relative(projectRoot, filePath);
124151
124364
  const maxFileSize = config2.get("security").maxFileSize || 1024 * 1024;
124152
124365
  if (content.length > maxFileSize) {
124153
124366
  logger.warn("File too large, skipping", {
@@ -124167,7 +124380,7 @@ async function indexFile(deps, filePath, projectId, projectRoot, centralityMap)
124167
124380
  chunkIndex: i,
124168
124381
  totalChunks: chunks.length,
124169
124382
  type: chunk.type,
124170
- language: path19.extname(filePath).slice(1),
124383
+ language: path20.extname(filePath).slice(1),
124171
124384
  lineStart: chunk.lineStart,
124172
124385
  lineEnd: chunk.lineEnd,
124173
124386
  label: chunk.label,
@@ -126232,8 +126445,8 @@ function stripNul(content) {
126232
126445
  }
126233
126446
 
126234
126447
  // ../../packages/core/dist/services/etl/stages/discover.js
126235
- import fs14 from "fs/promises";
126236
- import path20 from "path";
126448
+ import fs15 from "fs/promises";
126449
+ import path21 from "path";
126237
126450
  import { createHash as createHash5 } from "crypto";
126238
126451
 
126239
126452
  class DiscoverStage {
@@ -126259,7 +126472,7 @@ class DiscoverStage {
126259
126472
  dot: false,
126260
126473
  absolute: false
126261
126474
  });
126262
- relPaths = found.map((p) => path20.isAbsolute(p) ? path20.relative(ctx.projectPath, p) : p).filter((p) => !ig.ignores(p) && applyPolicy(p, policy) !== "Drop");
126475
+ relPaths = found.map((p) => path21.isAbsolute(p) ? path21.relative(ctx.projectPath, p) : p).filter((p) => !ig.ignores(p) && applyPolicy(p, policy) !== "Drop");
126263
126476
  }
126264
126477
  if (ctx.resumeCursor?.path) {
126265
126478
  const cursorPath = ctx.resumeCursor.path;
@@ -126318,10 +126531,10 @@ class DiscoverStage {
126318
126531
  return discovered;
126319
126532
  }
126320
126533
  async processFile(ctx, relativePath, forceReindex) {
126321
- const absolutePath = path20.join(ctx.projectPath, relativePath);
126534
+ const absolutePath = path21.join(ctx.projectPath, relativePath);
126322
126535
  try {
126323
- const stat = await fs14.stat(absolutePath);
126324
- const content = stripNul(await fs14.readFile(absolutePath, "utf-8"));
126536
+ const stat = await fs15.stat(absolutePath);
126537
+ const content = stripNul(await fs15.readFile(absolutePath, "utf-8"));
126325
126538
  const contentHash = createHash5("sha256").update(content).digest("hex");
126326
126539
  let needsReparse = forceReindex;
126327
126540
  if (!forceReindex) {
@@ -126364,8 +126577,8 @@ class DiscoverStage {
126364
126577
  ig.add(pattern);
126365
126578
  }
126366
126579
  try {
126367
- const gitignorePath = path20.join(projectPath, ".gitignore");
126368
- const gitignoreContent = await fs14.readFile(gitignorePath, "utf8");
126580
+ const gitignorePath = path21.join(projectPath, ".gitignore");
126581
+ const gitignoreContent = await fs15.readFile(gitignorePath, "utf8");
126369
126582
  const rules = gitignoreContent.split(`
126370
126583
  `).map((line) => line.trim()).filter((line) => line && !line.startsWith("#"));
126371
126584
  ig.add(rules);
@@ -127720,8 +127933,8 @@ function rustUseLeaves(node, source, prefix = []) {
127720
127933
  }
127721
127934
  if (node.type === "use_wildcard")
127722
127935
  return [{ path: [...prefix, "*"], glob: true }];
127723
- const path21 = rustPathSegments(node, source);
127724
- return path21.length ? [{ path: [...prefix, ...path21] }] : [];
127936
+ const path22 = rustPathSegments(node, source);
127937
+ return path22.length ? [{ path: [...prefix, ...path22] }] : [];
127725
127938
  }
127726
127939
  function functionalCaptures(captures, source, family) {
127727
127940
  if (family !== "clojure")
@@ -128693,8 +128906,8 @@ var init_structural_runtime = __esm(() => {
128693
128906
  });
128694
128907
 
128695
128908
  // ../../packages/core/dist/services/etl/stages/parse.js
128696
- import path21 from "path";
128697
- import fs15 from "fs/promises";
128909
+ import path22 from "path";
128910
+ import fs16 from "fs/promises";
128698
128911
  function resolveChunkerMaxChars() {
128699
128912
  const global2 = Number(process.env.EMBEDDING_MAX_CHARS);
128700
128913
  if (Number.isFinite(global2) && global2 > 0)
@@ -128722,8 +128935,8 @@ class ParseStage {
128722
128935
  const results = new Map;
128723
128936
  let processed = 0;
128724
128937
  const phases = [
128725
- files.filter((file2) => path21.extname(file2.relativePath).toLowerCase() !== ".h"),
128726
- files.filter((file2) => path21.extname(file2.relativePath).toLowerCase() === ".h")
128938
+ files.filter((file2) => path22.extname(file2.relativePath).toLowerCase() !== ".h"),
128939
+ files.filter((file2) => path22.extname(file2.relativePath).toLowerCase() === ".h")
128727
128940
  ];
128728
128941
  const batches = phases.flatMap((phase) => Array.from({ length: Math.ceil(phase.length / BATCH_SIZE) }, (_, index) => phase.slice(index * BATCH_SIZE, (index + 1) * BATCH_SIZE)));
128729
128942
  for (const batch of batches) {
@@ -128761,19 +128974,19 @@ class ParseStage {
128761
128974
  return files.map((file2) => results.get(file2.relativePath));
128762
128975
  }
128763
128976
  recordHeaderImporterEvidence(ctx, files, parsedFiles) {
128764
- const knownHeaders = new Set(files.filter((file2) => path21.extname(file2.relativePath).toLowerCase() === ".h").map((file2) => path21.posix.normalize(file2.relativePath)));
128977
+ const knownHeaders = new Set(files.filter((file2) => path22.extname(file2.relativePath).toLowerCase() === ".h").map((file2) => path22.posix.normalize(file2.relativePath)));
128765
128978
  const mutable = {
128766
128979
  ...ctx.structuralHeaderEvidenceByFile
128767
128980
  };
128768
128981
  for (const parsed of parsedFiles) {
128769
- const extension = path21.extname(parsed.file.relativePath).toLowerCase();
128982
+ const extension = path22.extname(parsed.file.relativePath).toLowerCase();
128770
128983
  const key = extension === ".c" ? "cImporters" : [".cpp", ".hpp"].includes(extension) ? "cppImporters" : undefined;
128771
128984
  if (!key)
128772
128985
  continue;
128773
128986
  for (const imported of parsed.rawImports) {
128774
128987
  if (!["c_include", "cpp_include"].includes(imported.form) || imported.specifier.startsWith("<"))
128775
128988
  continue;
128776
- const header = path21.posix.normalize(path21.posix.join(path21.posix.dirname(parsed.file.relativePath), imported.specifier));
128989
+ const header = path22.posix.normalize(path22.posix.join(path22.posix.dirname(parsed.file.relativePath), imported.specifier));
128777
128990
  if (!knownHeaders.has(header))
128778
128991
  continue;
128779
128992
  const existing = mutable[header] ?? {};
@@ -128784,9 +128997,9 @@ class ParseStage {
128784
128997
  }
128785
128998
  async parseFile(ctx, file2) {
128786
128999
  if (!file2.needsReparse) {
128787
- const extension = path21.extname(file2.relativePath).toLowerCase();
129000
+ const extension = path22.extname(file2.relativePath).toLowerCase();
128788
129001
  if ([".c", ".cpp", ".hpp"].includes(extension)) {
128789
- const content = file2.snapshotContent ?? await fs15.readFile(file2.absolutePath, "utf8");
129002
+ const content = file2.snapshotContent ?? await fs16.readFile(file2.absolutePath, "utf8");
128790
129003
  const outcome = await this.runtime.parse({ extension, source: Buffer.from(content) });
128791
129004
  if (outcome.status === "failed")
128792
129005
  throw new StructuralEtlParseError(file2.relativePath, outcome.failureKind, `Structural evidence parse failed (${outcome.failureKind})`, outcome.diagnosticCount, outcome.diagnostics.slice(0, 10));
@@ -128798,8 +129011,8 @@ class ParseStage {
128798
129011
  return { file: file2, chunks: [], symbols: [], rawImports: [], rawEdges: [] };
128799
129012
  }
128800
129013
  try {
128801
- const content = file2.snapshotContent ?? await fs15.readFile(file2.absolutePath, "utf-8");
128802
- const ext2 = path21.extname(file2.relativePath).toLowerCase();
129014
+ const content = file2.snapshotContent ?? await fs16.readFile(file2.absolutePath, "utf-8");
129015
+ const ext2 = path22.extname(file2.relativePath).toLowerCase();
128803
129016
  const chunkerMaxChars = resolveChunkerMaxChars();
128804
129017
  const chunks = smartChunk(content, file2.relativePath, chunkerMaxChars ? { maxChunkChars: chunkerMaxChars } : {});
128805
129018
  let symbols;
@@ -129353,7 +129566,7 @@ var init_resolver = __esm(() => {
129353
129566
  });
129354
129567
 
129355
129568
  // ../../packages/core/dist/services/structural/resolvers/typescript.js
129356
- import path22 from "path";
129569
+ import path23 from "path";
129357
129570
  function candidates(identities) {
129358
129571
  return Object.freeze(identities.map((identity) => Object.freeze({
129359
129572
  fqn: identity.fqn,
@@ -129448,7 +129661,7 @@ function probe(base, known, dialect = "typescript") {
129448
129661
  const bases = /\.[cm]?jsx?$/u.test(base) ? [base.replace(/\.[cm]?jsx?$/u, ".ts"), base.replace(/\.[cm]?jsx?$/u, ".tsx"), base] : [base];
129449
129662
  for (const candidateBase of bases)
129450
129663
  for (const suffix of DIALECT_PROBES[dialect] ?? [""]) {
129451
- const value = path22.posix.normalize(`${candidateBase}${suffix}`);
129664
+ const value = path23.posix.normalize(`${candidateBase}${suffix}`);
129452
129665
  if (!value.startsWith("../") && value !== ".." && known.has(value))
129453
129666
  return value;
129454
129667
  }
@@ -129457,7 +129670,7 @@ function probe(base, known, dialect = "typescript") {
129457
129670
  function resolveStructuralSpecifier(specifier, fromFile, build, dialect = "typescript") {
129458
129671
  const known = new Set(build.knownFiles.map(normalizeStructuralFile));
129459
129672
  if (specifier.startsWith("./") || specifier.startsWith("../")) {
129460
- return probe(path22.posix.join(path22.posix.dirname(fromFile), specifier), known, dialect);
129673
+ return probe(path23.posix.join(path23.posix.dirname(fromFile), specifier), known, dialect);
129461
129674
  }
129462
129675
  const aliases = build.pathAliasesByFile?.[normalizeStructuralFile(fromFile)] ?? build.pathAliases ?? [];
129463
129676
  for (const alias of aliases) {
@@ -129721,7 +129934,7 @@ var init_scripting2 = __esm(() => {
129721
129934
  });
129722
129935
 
129723
129936
  // ../../packages/core/dist/services/structural/resolvers/systems.js
129724
- import path23 from "path";
129937
+ import path24 from "path";
129725
129938
  var DIALECTS, SYSTEMS_LANGUAGE_RESOLVER;
129726
129939
  var init_systems2 = __esm(() => {
129727
129940
  init_typescript2();
@@ -129740,7 +129953,7 @@ var init_systems2 = __esm(() => {
129740
129953
  const bindings = item.bindings.map((binding) => binding.imported === "*" && binding.local === "*" && unresolvedTarget && !unresolvedTarget.qualifier ? { ...binding, imported: unresolvedTarget.name, local: unresolvedTarget.name } : binding);
129741
129954
  if (item.specifier === "crate" || item.specifier.startsWith("crate/")) {
129742
129955
  const crateRoot = file2.file.startsWith("src/") ? "src" : "";
129743
- return { ...item, bindings, specifier: `./${path23.posix.relative(path23.posix.dirname(file2.file), path23.posix.join(crateRoot, item.specifier.replace(/^crate\/?/u, "")))}` };
129956
+ return { ...item, bindings, specifier: `./${path24.posix.relative(path24.posix.dirname(file2.file), path24.posix.join(crateRoot, item.specifier.replace(/^crate\/?/u, "")))}` };
129744
129957
  }
129745
129958
  if (item.specifier === "self" || item.specifier.startsWith("self/"))
129746
129959
  return { ...item, bindings, specifier: `./${item.specifier.replace(/^self\/?/u, "")}` };
@@ -129838,8 +130051,8 @@ var init_data_document2 = __esm(() => {
129838
130051
  });
129839
130052
 
129840
130053
  // ../../packages/core/dist/services/etl/stages/resolve.js
129841
- import path24 from "path";
129842
- import fs16 from "fs";
130054
+ import path25 from "path";
130055
+ import fs17 from "fs";
129843
130056
 
129844
130057
  class ResolveStage {
129845
130058
  symbolRepository;
@@ -129863,7 +130076,7 @@ class ResolveStage {
129863
130076
  const structuralDocuments = files.flatMap((file2) => {
129864
130077
  if (!file2.structure)
129865
130078
  return [];
129866
- const language = resolveStructuralLanguage(path24.extname(file2.file.relativePath));
130079
+ const language = resolveStructuralLanguage(path25.extname(file2.file.relativePath));
129867
130080
  if (language.status !== "supported")
129868
130081
  throw new Error(`structural_manifest_missing:${file2.file.relativePath}`);
129869
130082
  return [{
@@ -129875,13 +130088,13 @@ class ResolveStage {
129875
130088
  }];
129876
130089
  });
129877
130090
  const currentStructuralFiles = new Set(structuralDocuments.map((document2) => document2.file));
129878
- const skippedStructuralFiles = new Set(files.filter((item) => !item.file.needsReparse && STRUCTURAL_SEED_EXTENSIONS.has(path24.extname(item.file.relativePath).toLowerCase())).map((item) => item.file.relativePath));
130091
+ const skippedStructuralFiles = new Set(files.filter((item) => !item.file.needsReparse && STRUCTURAL_SEED_EXTENSIONS.has(path25.extname(item.file.relativePath).toLowerCase())).map((item) => item.file.relativePath));
129879
130092
  const pathAliasesByFile = Object.fromEntries([...knownRelPaths].map((file2) => [
129880
130093
  file2,
129881
130094
  this.structuralAliasesFor(file2, rootAliases, monorepoPackages)
129882
130095
  ]));
129883
130096
  const buildMetadata = { knownFiles: [...knownRelPaths], pathAliasesByFile };
129884
- const seedRows = repositoryDefinitions.filter((definition) => STRUCTURAL_SEED_EXTENSIONS.has(path24.extname(definition.file_path).toLowerCase())).filter((definition) => knownRelPaths.has(definition.file_path) && skippedStructuralFiles.has(definition.file_path)).filter((definition) => !currentStructuralFiles.has(definition.file_path));
130097
+ const seedRows = repositoryDefinitions.filter((definition) => STRUCTURAL_SEED_EXTENSIONS.has(path25.extname(definition.file_path).toLowerCase())).filter((definition) => knownRelPaths.has(definition.file_path) && skippedStructuralFiles.has(definition.file_path)).filter((definition) => !currentStructuralFiles.has(definition.file_path));
129885
130098
  const seedIds = new Set;
129886
130099
  for (const definition of seedRows) {
129887
130100
  if (seedIds.has(definition.id))
@@ -129974,7 +130187,7 @@ class ResolveStage {
129974
130187
  if (parsed.file !== definition.file_path) {
129975
130188
  throw new Error(`structural_repository_seed_file_mismatch:${definition.id}`);
129976
130189
  }
129977
- const language = resolveStructuralLanguage(path24.extname(definition.file_path));
130190
+ const language = resolveStructuralLanguage(path25.extname(definition.file_path));
129978
130191
  if (language.status !== "supported")
129979
130192
  throw new Error(`structural_repository_seed_language:${definition.id}`);
129980
130193
  let identity;
@@ -130026,7 +130239,7 @@ class ResolveStage {
130026
130239
  });
130027
130240
  }
130028
130241
  resolveFile(parsed, projectPath, knownRelPaths, rootAliases, monorepoPackages, symbolIndex, knownFqns) {
130029
- const fromDir = path24.dirname(path24.join(projectPath, parsed.file.relativePath));
130242
+ const fromDir = path25.dirname(path25.join(projectPath, parsed.file.relativePath));
130030
130243
  const packageAliases = this.getPackageAliases(parsed.file.relativePath, monorepoPackages);
130031
130244
  const allAliases = [...packageAliases, ...rootAliases];
130032
130245
  const resolvedImports = parsed.rawImports.map((raw2) => {
@@ -130097,7 +130310,7 @@ class ResolveStage {
130097
130310
  index.set(def.name, `${def.file_path}#${def.name}`);
130098
130311
  }
130099
130312
  } catch (err) {
130100
- const skippedStructural = files.some((file2) => !file2.file.needsReparse && STRUCTURAL_SEED_EXTENSIONS.has(path24.extname(file2.file.relativePath).toLowerCase()));
130313
+ const skippedStructural = files.some((file2) => !file2.file.needsReparse && STRUCTURAL_SEED_EXTENSIONS.has(path25.extname(file2.file.relativePath).toLowerCase()));
130101
130314
  if (skippedStructural)
130102
130315
  throw new Error("structural_repository_seed_failed", { cause: err });
130103
130316
  logger.warn("buildSymbolIndex: repo seed failed, in-batch only", {
@@ -130121,7 +130334,7 @@ class ResolveStage {
130121
130334
  }
130122
130335
  resolveSpecifier(specifier, fromDir, projectPath, knownRelPaths, aliases) {
130123
130336
  if (specifier.startsWith("./") || specifier.startsWith("../")) {
130124
- const resolved = this.probeExtensions(path24.resolve(fromDir, specifier), projectPath, knownRelPaths);
130337
+ const resolved = this.probeExtensions(path25.resolve(fromDir, specifier), projectPath, knownRelPaths);
130125
130338
  return { resolvedPath: resolved, external: false };
130126
130339
  }
130127
130340
  for (const alias of aliases) {
@@ -130129,8 +130342,8 @@ class ResolveStage {
130129
130342
  const suffix = specifier.slice(alias.prefix.length);
130130
130343
  for (const target of alias.targets) {
130131
130344
  const cleanTarget = target.replace(/\/\*$/, "");
130132
- const basePath = alias.packagePath ? path24.join(projectPath, alias.packagePath) : projectPath;
130133
- const absPath = path24.join(basePath, cleanTarget + suffix);
130345
+ const basePath = alias.packagePath ? path25.join(projectPath, alias.packagePath) : projectPath;
130346
+ const absPath = path25.join(basePath, cleanTarget + suffix);
130134
130347
  const resolved = this.probeExtensions(absPath, projectPath, knownRelPaths);
130135
130348
  if (resolved)
130136
130349
  return { resolvedPath: resolved, external: false };
@@ -130146,7 +130359,7 @@ class ResolveStage {
130146
130359
  ...TS_EXTENSIONS.map((ext2) => absPath.replace(/\.[^.]+$/, ext2))
130147
130360
  ];
130148
130361
  for (const candidate2 of candidates2) {
130149
- const rel = path24.relative(projectPath, candidate2).replace(/\\/g, "/");
130362
+ const rel = path25.relative(projectPath, candidate2).replace(/\\/g, "/");
130150
130363
  if (knownRelPaths.has(rel))
130151
130364
  return rel;
130152
130365
  }
@@ -130154,9 +130367,9 @@ class ResolveStage {
130154
130367
  }
130155
130368
  loadTsConfigPaths(projectPath, packageBase) {
130156
130369
  const aliases = [];
130157
- const tsconfigPath = path24.join(projectPath, "tsconfig.json");
130370
+ const tsconfigPath = path25.join(projectPath, "tsconfig.json");
130158
130371
  try {
130159
- const raw2 = fs16.readFileSync(tsconfigPath, "utf-8");
130372
+ const raw2 = fs17.readFileSync(tsconfigPath, "utf-8");
130160
130373
  const stripped = raw2.replace(/\/\/[^\n]*/g, "").replace(/\/\*[\s\S]*?\*\//g, "");
130161
130374
  const tsconfig = JSON.parse(stripped);
130162
130375
  const paths = tsconfig?.compilerOptions?.paths ?? {};
@@ -130185,7 +130398,7 @@ class ResolveStage {
130185
130398
  }
130186
130399
  }
130187
130400
  for (const packageRelPath of packagePaths) {
130188
- const absPackagePath = path24.join(projectPath, packageRelPath);
130401
+ const absPackagePath = path25.join(projectPath, packageRelPath);
130189
130402
  const aliases = this.loadTsConfigPaths(absPackagePath, packageRelPath);
130190
130403
  if (aliases.length > 0) {
130191
130404
  packages.push({
@@ -130215,7 +130428,7 @@ class ResolveStage {
130215
130428
  structuralAliasesFor(filePath, rootAliases, packages) {
130216
130429
  return [...this.getPackageAliases(filePath, packages), ...rootAliases].map((alias) => ({
130217
130430
  pattern: alias.prefix + (alias.targets.some((target) => target.includes("*")) ? "/*" : ""),
130218
- targets: alias.targets.map((target) => alias.packagePath ? path24.posix.join(alias.packagePath, target) : target)
130431
+ targets: alias.targets.map((target) => alias.packagePath ? path25.posix.join(alias.packagePath, target) : target)
130219
130432
  }));
130220
130433
  }
130221
130434
  }
@@ -130279,7 +130492,7 @@ var init_with_deadlock_retry = __esm(() => {
130279
130492
  });
130280
130493
 
130281
130494
  // ../../packages/core/dist/services/etl/stages/load.js
130282
- import path25 from "path";
130495
+ import path26 from "path";
130283
130496
  function formatDuration(ms) {
130284
130497
  const totalSec = Math.max(0, Math.round(ms / 1000));
130285
130498
  if (totalSec < 60)
@@ -130556,7 +130769,7 @@ class LoadStage {
130556
130769
  const filePath = file2.file.relativePath;
130557
130770
  const batch = buildSymbolPersistenceBatch(ctx.projectId, file2);
130558
130771
  if (ctx.graphGenerationLease) {
130559
- const manifest = getLanguageManifestEntry(path25.extname(filePath));
130772
+ const manifest = getLanguageManifestEntry(path26.extname(filePath));
130560
130773
  const diagnostics2 = (file2.structuralDiagnostics ?? []).slice(0, 10).map((diagnostic2) => ({
130561
130774
  code: diagnostic2.code,
130562
130775
  severity: diagnostic2.severity,
@@ -131013,9 +131226,9 @@ var init_graph_generation_coordinator = __esm(() => {
131013
131226
  // ../../packages/core/dist/services/etl/pipeline.js
131014
131227
  import { createHash as createHash7 } from "crypto";
131015
131228
  import { setTimeout as delay2 } from "timers/promises";
131016
- import path26 from "path";
131229
+ import path27 from "path";
131017
131230
  function buildHeaderLanguageEvidence(files) {
131018
- const headers = new Set(files.filter((file2) => path26.posix.extname(file2.relativePath).toLowerCase() === ".h").map((file2) => path26.posix.normalize(file2.relativePath)));
131231
+ const headers = new Set(files.filter((file2) => path27.posix.extname(file2.relativePath).toLowerCase() === ".h").map((file2) => path27.posix.normalize(file2.relativePath)));
131019
131232
  const mutable = new Map;
131020
131233
  const entry2 = (header) => {
131021
131234
  let value = mutable.get(header);
@@ -131026,7 +131239,7 @@ function buildHeaderLanguageEvidence(files) {
131026
131239
  return value;
131027
131240
  };
131028
131241
  for (const file2 of files) {
131029
- if (path26.posix.basename(file2.relativePath) !== "compile_commands.json" || file2.snapshotContent === undefined)
131242
+ if (path27.posix.basename(file2.relativePath) !== "compile_commands.json" || file2.snapshotContent === undefined)
131030
131243
  continue;
131031
131244
  let commands;
131032
131245
  try {
@@ -131042,11 +131255,11 @@ function buildHeaderLanguageEvidence(files) {
131042
131255
  const record3 = command;
131043
131256
  if (typeof record3.file !== "string")
131044
131257
  continue;
131045
- const projectRoot = path26.resolve(file2.absolutePath, ...file2.relativePath.split("/").map(() => ".."));
131046
- const commandDirectory = typeof record3.directory === "string" ? path26.resolve(projectRoot, record3.directory) : projectRoot;
131047
- const absoluteInput = path26.resolve(commandDirectory, record3.file);
131048
- const relative2 = path26.relative(projectRoot, absoluteInput);
131049
- const header = path26.posix.normalize(relative2.replaceAll(path26.sep, "/"));
131258
+ const projectRoot = path27.resolve(file2.absolutePath, ...file2.relativePath.split("/").map(() => ".."));
131259
+ const commandDirectory = typeof record3.directory === "string" ? path27.resolve(projectRoot, record3.directory) : projectRoot;
131260
+ const absoluteInput = path27.resolve(commandDirectory, record3.file);
131261
+ const relative2 = path27.relative(projectRoot, absoluteInput);
131262
+ const header = path27.posix.normalize(relative2.replaceAll(path27.sep, "/"));
131050
131263
  if (!headers.has(header))
131051
131264
  continue;
131052
131265
  const invocation = typeof record3.command === "string" ? record3.command : Array.isArray(record3.arguments) ? record3.arguments.join(" ") : "";
@@ -131593,9 +131806,9 @@ var init_acquire_indexing_lease = __esm(() => {
131593
131806
 
131594
131807
  // ../../packages/core/dist/services/project-identity/project-root-identity.js
131595
131808
  import { realpath as realpath2 } from "fs/promises";
131596
- import path27 from "path";
131809
+ import path28 from "path";
131597
131810
  async function canonicalizeProjectRoot(projectPath, canonicalize = realpath2) {
131598
- return canonicalize(path27.resolve(projectPath));
131811
+ return canonicalize(path28.resolve(projectPath));
131599
131812
  }
131600
131813
  async function assertProjectRootReuse(options) {
131601
131814
  if (!options.storedProjectPath || options.forceReindex)
@@ -131603,9 +131816,9 @@ async function assertProjectRootReuse(options) {
131603
131816
  const canonicalize = options.canonicalize ?? realpath2;
131604
131817
  let storedCanonical;
131605
131818
  try {
131606
- storedCanonical = await canonicalize(path27.resolve(options.storedProjectPath));
131819
+ storedCanonical = await canonicalize(path28.resolve(options.storedProjectPath));
131607
131820
  } catch {
131608
- storedCanonical = path27.resolve(options.storedProjectPath);
131821
+ storedCanonical = path28.resolve(options.storedProjectPath);
131609
131822
  }
131610
131823
  if (storedCanonical !== options.canonicalProjectPath) {
131611
131824
  throw new Error(`Project ID "${options.projectId}" already indexes canonical root ` + `"${storedCanonical}", not "${options.canonicalProjectPath}"; ` + "use forceReindex only after verifying ownership of the existing project");
@@ -132348,16 +132561,16 @@ function detectRoutes(httpEdges, defs, opts = {}) {
132348
132561
  const seen = new Set;
132349
132562
  const out = [];
132350
132563
  for (const e of httpEdges) {
132351
- const path28 = e.route;
132352
- if (!path28)
132564
+ const path29 = e.route;
132565
+ if (!path29)
132353
132566
  continue;
132354
132567
  const method = (e.method ?? "ANY").toUpperCase();
132355
- const key = method + " " + path28;
132568
+ const key = method + " " + path29;
132356
132569
  if (seen.has(key))
132357
132570
  continue;
132358
132571
  seen.add(key);
132359
132572
  out.push({
132360
- path: path28,
132573
+ path: path29,
132361
132574
  method: e.method,
132362
132575
  file: e.fromFile,
132363
132576
  handler: e.targetFqn ?? e.symbolName
@@ -132368,12 +132581,12 @@ function detectRoutes(httpEdges, defs, opts = {}) {
132368
132581
  continue;
132369
132582
  const parsed = parseRouteName(d.name);
132370
132583
  const method = parsed?.method ?? "ANY";
132371
- const path28 = parsed?.path ?? d.name;
132372
- const key = method + " " + path28;
132584
+ const path29 = parsed?.path ?? d.name;
132585
+ const key = method + " " + path29;
132373
132586
  if (seen.has(key))
132374
132587
  continue;
132375
132588
  seen.add(key);
132376
- out.push({ path: path28, method: parsed?.method, file: d.filePath, handler: d.name });
132589
+ out.push({ path: path29, method: parsed?.method, file: d.filePath, handler: d.name });
132377
132590
  }
132378
132591
  for (const d of defs) {
132379
132592
  const parsed = parseRouteName(d.name);
@@ -132594,8 +132807,8 @@ __export(exports_symbol_graph_service, {
132594
132807
  symbolGraphService: () => symbolGraphService,
132595
132808
  SymbolGraphService: () => SymbolGraphService
132596
132809
  });
132597
- import path28 from "path";
132598
- import fs17 from "fs/promises";
132810
+ import path29 from "path";
132811
+ import fs18 from "fs/promises";
132599
132812
 
132600
132813
  class SymbolGraphService {
132601
132814
  identityLookup;
@@ -132923,7 +133136,7 @@ class SymbolGraphService {
132923
133136
  async readSnippet(relativePath, lineStart, lineEnd, projectId) {
132924
133137
  try {
132925
133138
  const absolutePath = await this.resolveToAbsolute(relativePath, projectId);
132926
- const content = await fs17.readFile(absolutePath, "utf-8");
133139
+ const content = await fs18.readFile(absolutePath, "utf-8");
132927
133140
  const lines = content.split(`
132928
133141
  `);
132929
133142
  return lines.slice(Math.max(0, lineStart - 1), Math.min(lines.length, lineEnd)).join(`
@@ -132935,7 +133148,7 @@ class SymbolGraphService {
132935
133148
  async readContext(relativePath, lineNumber, contextLines, projectId) {
132936
133149
  try {
132937
133150
  const absolutePath = await this.resolveToAbsolute(relativePath, projectId);
132938
- const content = await fs17.readFile(absolutePath, "utf-8");
133151
+ const content = await fs18.readFile(absolutePath, "utf-8");
132939
133152
  const lines = content.split(`
132940
133153
  `);
132941
133154
  const start = Math.max(0, lineNumber - contextLines - 1);
@@ -132948,7 +133161,7 @@ class SymbolGraphService {
132948
133161
  }
132949
133162
  async resolveToAbsolute(relativePath, projectId) {
132950
133163
  const root = await this.getProjectRoot(projectId);
132951
- return root ? path28.resolve(root, relativePath) : relativePath;
133164
+ return root ? path29.resolve(root, relativePath) : relativePath;
132952
133165
  }
132953
133166
  async getProjectRoot(projectId) {
132954
133167
  const cached2 = this.projectRootCache.get(projectId);
@@ -133091,7 +133304,7 @@ var init_workspace_manager = __esm(() => {
133091
133304
  });
133092
133305
 
133093
133306
  // ../../packages/core/dist/tools/index_project.js
133094
- import path29 from "path";
133307
+ import path30 from "path";
133095
133308
 
133096
133309
  class IndexProjectTool {
133097
133310
  name = "index_project";
@@ -133139,7 +133352,7 @@ class IndexProjectTool {
133139
133352
  try {
133140
133353
  await assertParserReadyForIndexing();
133141
133354
  const canonicalProjectPath = await canonicalizeProjectRoot(projectPath);
133142
- const finalProjectId = projectId || path29.basename(canonicalProjectPath) || "default";
133355
+ const finalProjectId = projectId || path30.basename(canonicalProjectPath) || "default";
133143
133356
  const existing = await workspaceManager.getWorkspace(finalProjectId);
133144
133357
  await assertProjectRootReuse({
133145
133358
  projectId: finalProjectId,
@@ -133692,17 +133905,17 @@ function applyReplacer(root, replacer) {
133692
133905
  return transformChildren(root, replacer, []);
133693
133906
  return transformChildren(normalizeValue(replacedRoot), replacer, []);
133694
133907
  }
133695
- function transformChildren(value, replacer, path30) {
133908
+ function transformChildren(value, replacer, path31) {
133696
133909
  if (isJsonObject(value))
133697
- return transformObject(value, replacer, path30);
133910
+ return transformObject(value, replacer, path31);
133698
133911
  if (isJsonArray(value))
133699
- return transformArray(value, replacer, path30);
133912
+ return transformArray(value, replacer, path31);
133700
133913
  return value;
133701
133914
  }
133702
- function transformObject(obj, replacer, path30) {
133915
+ function transformObject(obj, replacer, path31) {
133703
133916
  const result = {};
133704
133917
  for (const [key, value] of Object.entries(obj)) {
133705
- const childPath = [...path30, key];
133918
+ const childPath = [...path31, key];
133706
133919
  const replacedValue = replacer(key, value, childPath);
133707
133920
  if (replacedValue === undefined)
133708
133921
  continue;
@@ -133710,11 +133923,11 @@ function transformObject(obj, replacer, path30) {
133710
133923
  }
133711
133924
  return result;
133712
133925
  }
133713
- function transformArray(arr, replacer, path30) {
133926
+ function transformArray(arr, replacer, path31) {
133714
133927
  const result = [];
133715
133928
  for (let i = 0;i < arr.length; i++) {
133716
133929
  const value = arr[i];
133717
- const childPath = [...path30, i];
133930
+ const childPath = [...path31, i];
133718
133931
  const replacedValue = replacer(String(i), value, childPath);
133719
133932
  if (replacedValue === undefined)
133720
133933
  continue;
@@ -138101,6 +138314,7 @@ class PgObservationStore {
138101
138314
  mirror = new Map;
138102
138315
  hydrated = false;
138103
138316
  hydrating = null;
138317
+ inflight = new Map;
138104
138318
  hydrateFailedAt = 0;
138105
138319
  static HYDRATE_RETRY_MS = 30000;
138106
138320
  getClient() {
@@ -138152,46 +138366,53 @@ class PgObservationStore {
138152
138366
  const cachedCanonical = getProjectIdentityAliasResolver().resolveCached(obs.projectId);
138153
138367
  this.mirror.set(obs.id, cachedCanonical && cachedCanonical !== obs.projectId ? { ...obs, projectId: cachedCanonical } : obs);
138154
138368
  this.ensureHydrated();
138155
- (async () => {
138156
- try {
138157
- const prisma2 = this.getClient();
138158
- const canonicalProjectId = await getProjectIdentityAliasResolver().resolve(obs.projectId);
138159
- if (canonicalProjectId !== obs.projectId) {
138160
- this.mirror.set(obs.id, { ...obs, projectId: canonicalProjectId });
138161
- }
138162
- await prisma2.$executeRaw`
138163
- INSERT INTO observations (
138164
- id, project_id, session_id, source, category, payload_json, importance, created_at, agent_id, attribution_source
138165
- ) VALUES (
138166
- ${obs.id},
138167
- ${canonicalProjectId},
138168
- ${obs.sessionId},
138169
- ${obs.source},
138170
- ${obs.category ?? null},
138171
- ${obs.payloadJson},
138172
- ${obs.importance},
138173
- ${obs.createdAt}::bigint,
138174
- ${obs.agentId ?? null},
138175
- ${obs.attributionSource ?? null}
138176
- )
138177
- ON CONFLICT (id) DO UPDATE SET
138178
- project_id = EXCLUDED.project_id,
138179
- session_id = EXCLUDED.session_id,
138180
- source = EXCLUDED.source,
138181
- category = EXCLUDED.category,
138182
- payload_json = EXCLUDED.payload_json,
138183
- importance = EXCLUDED.importance,
138184
- created_at = EXCLUDED.created_at,
138185
- agent_id = EXCLUDED.agent_id,
138186
- attribution_source = EXCLUDED.attribution_source
138187
- `;
138188
- } catch (e) {
138189
- logger.warn("PgObservationStore.insert failed (best-effort)", {
138190
- id: obs.id,
138191
- error: e.message
138192
- });
138369
+ this.chainWrite(obs.id, async () => {
138370
+ const prisma2 = this.getClient();
138371
+ const canonicalProjectId = await getProjectIdentityAliasResolver().resolve(obs.projectId);
138372
+ if (canonicalProjectId !== obs.projectId) {
138373
+ this.mirror.set(obs.id, { ...obs, projectId: canonicalProjectId });
138193
138374
  }
138194
- })();
138375
+ await prisma2.$executeRaw`
138376
+ INSERT INTO observations (
138377
+ id, project_id, session_id, source, category, payload_json, importance, created_at, agent_id, attribution_source
138378
+ ) VALUES (
138379
+ ${obs.id},
138380
+ ${canonicalProjectId},
138381
+ ${obs.sessionId},
138382
+ ${obs.source},
138383
+ ${obs.category ?? null},
138384
+ ${obs.payloadJson},
138385
+ ${obs.importance},
138386
+ ${obs.createdAt}::bigint,
138387
+ ${obs.agentId ?? null},
138388
+ ${obs.attributionSource ?? null}
138389
+ )
138390
+ ON CONFLICT (id) DO UPDATE SET
138391
+ project_id = EXCLUDED.project_id,
138392
+ session_id = EXCLUDED.session_id,
138393
+ source = EXCLUDED.source,
138394
+ category = EXCLUDED.category,
138395
+ payload_json = EXCLUDED.payload_json,
138396
+ importance = EXCLUDED.importance,
138397
+ created_at = EXCLUDED.created_at,
138398
+ agent_id = EXCLUDED.agent_id,
138399
+ attribution_source = EXCLUDED.attribution_source
138400
+ `;
138401
+ });
138402
+ }
138403
+ chainWrite(key, fn) {
138404
+ const prev = this.inflight.get(key) ?? Promise.resolve();
138405
+ const next = prev.then(fn).catch((e) => {
138406
+ logger.warn("PgObservationStore.insert failed (best-effort)", {
138407
+ id: key,
138408
+ error: e.message
138409
+ });
138410
+ });
138411
+ this.inflight.set(key, next);
138412
+ next.then(() => {
138413
+ if (this.inflight.get(key) === next)
138414
+ this.inflight.delete(key);
138415
+ });
138195
138416
  }
138196
138417
  listRecent(projectId, limit) {
138197
138418
  this.ensureHydrated();
@@ -138218,6 +138439,9 @@ class PgObservationStore {
138218
138439
  await this.ensureHydrated();
138219
138440
  }
138220
138441
  async __drain() {
138442
+ const pending = Array.from(this.inflight.values());
138443
+ if (pending.length > 0)
138444
+ await Promise.allSettled(pending);
138221
138445
  await new Promise((r) => setTimeout(r, 10));
138222
138446
  }
138223
138447
  }
@@ -138784,9 +139008,9 @@ var init_session_pin_store = __esm(() => {
138784
139008
  });
138785
139009
 
138786
139010
  // ../../packages/core/dist/services/hooks/attribution-resolver.js
138787
- import fs18 from "fs";
138788
- import os8 from "os";
138789
- import path30 from "path";
139011
+ import fs19 from "fs";
139012
+ import os9 from "os";
139013
+ import path31 from "path";
138790
139014
 
138791
139015
  class PgWorkspaceRootProvider {
138792
139016
  cache = null;
@@ -138835,8 +139059,8 @@ class AttributionResolver {
138835
139059
  this.aliasResolver = options.aliasResolver ?? getProjectIdentityAliasResolver();
138836
139060
  this.pins = options.pins ?? new SessionPinStore;
138837
139061
  this.canonicalize = options.canonicalize ?? defaultCanonicalize;
138838
- this.homedir = options.homedir ?? os8.homedir;
138839
- this.fsRoot = options.fsRoot ?? (() => path30.parse(path30.sep).root);
139062
+ this.homedir = options.homedir ?? os9.homedir;
139063
+ this.fsRoot = options.fsRoot ?? (() => path31.parse(path31.sep).root);
138840
139064
  }
138841
139065
  async resolve(input) {
138842
139066
  const caller = input.callerProjectId;
@@ -138887,7 +139111,7 @@ class AttributionResolver {
138887
139111
  }
138888
139112
  let bestPath = null;
138889
139113
  for (const candidate2 of byPath.keys()) {
138890
- if (canonicalCwd === candidate2 || canonicalCwd.startsWith(candidate2.endsWith(path30.sep) ? candidate2 : candidate2 + path30.sep)) {
139114
+ if (canonicalCwd === candidate2 || canonicalCwd.startsWith(candidate2.endsWith(path31.sep) ? candidate2 : candidate2 + path31.sep)) {
138891
139115
  if (bestPath === null || candidate2.length > bestPath.length) {
138892
139116
  bestPath = candidate2;
138893
139117
  }
@@ -138910,7 +139134,7 @@ class AttributionResolver {
138910
139134
  return projectPath2;
138911
139135
  const fsRoot = this.fsRoot();
138912
139136
  let normalized = projectPath2;
138913
- while (normalized.length > fsRoot.length && normalized.endsWith(path30.sep)) {
139137
+ while (normalized.length > fsRoot.length && normalized.endsWith(path31.sep)) {
138914
139138
  normalized = normalized.slice(0, -1);
138915
139139
  }
138916
139140
  return normalized;
@@ -138918,10 +139142,10 @@ class AttributionResolver {
138918
139142
  }
138919
139143
  function defaultCanonicalize(cwd) {
138920
139144
  try {
138921
- return fs18.realpathSync(cwd);
139145
+ return fs19.realpathSync(cwd);
138922
139146
  } catch {
138923
139147
  try {
138924
- return path30.resolve(cwd);
139148
+ return path31.resolve(cwd);
138925
139149
  } catch {
138926
139150
  return;
138927
139151
  }
@@ -139669,31 +139893,31 @@ class TracePathService {
139669
139893
  const chains = [];
139670
139894
  const seen = new Set;
139671
139895
  let walks = 0;
139672
- const walk = (fqn, path31) => {
139896
+ const walk = (fqn, path32) => {
139673
139897
  if (chains.length >= CHAIN_CAP)
139674
139898
  return;
139675
139899
  if (walks >= MAX_WALKS)
139676
139900
  return;
139677
139901
  walks++;
139678
- const key = path31.join("\u2192");
139902
+ const key = path32.join("\u2192");
139679
139903
  if (seen.has(key))
139680
139904
  return;
139681
139905
  seen.add(key);
139682
139906
  const next = adj.get(fqn);
139683
139907
  if (!next || next.length === 0 || !whoHasChild.has(fqn)) {
139684
- if (path31.length > 1)
139685
- chains.push(path31.map((n) => this.fqnToName(n)).join(" \u2192 "));
139908
+ if (path32.length > 1)
139909
+ chains.push(path32.map((n) => this.fqnToName(n)).join(" \u2192 "));
139686
139910
  return;
139687
139911
  }
139688
139912
  for (const child of next) {
139689
139913
  if (chains.length >= CHAIN_CAP || walks >= MAX_WALKS)
139690
139914
  return;
139691
- if (path31.includes(child)) {
139692
- const cycled = [...path31, `${this.fqnToName(child)}\u21BA`];
139915
+ if (path32.includes(child)) {
139916
+ const cycled = [...path32, `${this.fqnToName(child)}\u21BA`];
139693
139917
  chains.push(cycled.map((n) => n).join(" \u2192 "));
139694
139918
  continue;
139695
139919
  }
139696
- walk(child, [...path31, child]);
139920
+ walk(child, [...path32, child]);
139697
139921
  }
139698
139922
  };
139699
139923
  for (const seed of seeds) {
@@ -140526,7 +140750,7 @@ var init_get_architecture = __esm(() => {
140526
140750
  });
140527
140751
 
140528
140752
  // ../../packages/core/dist/services/file-read/file-content-cache.js
140529
- import fs19 from "fs/promises";
140753
+ import fs20 from "fs/promises";
140530
140754
 
140531
140755
  class FileContentCache {
140532
140756
  extractMetadata;
@@ -140559,7 +140783,7 @@ class FileContentCache {
140559
140783
  metadata: cached2.metadata
140560
140784
  };
140561
140785
  }
140562
- const content = await fs19.readFile(filePath, "utf-8");
140786
+ const content = await fs20.readFile(filePath, "utf-8");
140563
140787
  const metadata = await this.extractMetadata(content, filePath, options);
140564
140788
  evictOldest(this.fileCache, this.FILE_CACHE_MAX_ENTRIES - 1);
140565
140789
  this.fileCache.set(cacheKey, {
@@ -140576,7 +140800,7 @@ var init_file_content_cache = __esm(() => {
140576
140800
  });
140577
140801
 
140578
140802
  // ../../packages/core/dist/services/file-read/file-metadata.js
140579
- import path31 from "path";
140803
+ import path32 from "path";
140580
140804
 
140581
140805
  class FileMetadataExtractor {
140582
140806
  symbolGraph;
@@ -140612,7 +140836,7 @@ class FileMetadataExtractor {
140612
140836
  return metadata;
140613
140837
  }
140614
140838
  detectLanguage(filePath) {
140615
- const ext2 = path31.extname(filePath).toLowerCase();
140839
+ const ext2 = path32.extname(filePath).toLowerCase();
140616
140840
  const languageMap2 = {
140617
140841
  ".ts": "TypeScript",
140618
140842
  ".tsx": "TypeScript",
@@ -140734,7 +140958,7 @@ var init_line_range = __esm(() => {
140734
140958
  });
140735
140959
 
140736
140960
  // ../../packages/core/dist/services/file-read/path-containment.js
140737
- import path32 from "path";
140961
+ import path33 from "path";
140738
140962
 
140739
140963
  class PathContainment {
140740
140964
  projectRoots;
@@ -140742,14 +140966,14 @@ class PathContainment {
140742
140966
  this.projectRoots = projectRoots;
140743
140967
  }
140744
140968
  async resolveFilePath(filePath, projectId) {
140745
- if (path32.isAbsolute(filePath)) {
140746
- return path32.resolve(filePath);
140969
+ if (path33.isAbsolute(filePath)) {
140970
+ return path33.resolve(filePath);
140747
140971
  }
140748
140972
  if (projectId) {
140749
140973
  const root = await this.projectRoots.getProjectRoot(projectId);
140750
140974
  if (root) {
140751
140975
  const cleaned = sanitizeFilePath(filePath);
140752
- return path32.resolve(root, cleaned);
140976
+ return path33.resolve(root, cleaned);
140753
140977
  }
140754
140978
  return null;
140755
140979
  }
@@ -140760,17 +140984,17 @@ class PathContainment {
140760
140984
  if (projectId) {
140761
140985
  const root = await this.projectRoots.getProjectRoot(projectId);
140762
140986
  if (root)
140763
- roots.push(path32.resolve(root));
140987
+ roots.push(path33.resolve(root));
140764
140988
  }
140765
- roots.push(path32.resolve(process.cwd()));
140989
+ roots.push(path33.resolve(process.cwd()));
140766
140990
  const envRoots = (process.env.MASSA_AI_READ_FILE_ROOTS ?? "").split(":").map((s) => s.trim()).filter((s) => s.length > 0);
140767
140991
  for (const extra of envRoots) {
140768
- roots.push(path32.resolve(extra));
140992
+ roots.push(path33.resolve(extra));
140769
140993
  }
140770
- const target = path32.resolve(absoluteFilePath);
140994
+ const target = path33.resolve(absoluteFilePath);
140771
140995
  for (const root of roots) {
140772
- const rel = path32.relative(root, target);
140773
- if (rel !== "" && !rel.startsWith("..") && !path32.isAbsolute(rel)) {
140996
+ const rel = path33.relative(root, target);
140997
+ if (rel !== "" && !rel.startsWith("..") && !path33.isAbsolute(rel)) {
140774
140998
  return { allowed: true };
140775
140999
  }
140776
141000
  if (rel === "")
@@ -144013,9 +144237,9 @@ var init_inference_probe = __esm(() => {
144013
144237
  });
144014
144238
 
144015
144239
  // ../../packages/core/dist/services/health/local-health-checker.js
144016
- import fs20 from "fs/promises";
144240
+ import fs21 from "fs/promises";
144017
144241
  import { existsSync as existsSync3 } from "fs";
144018
- import path33 from "path";
144242
+ import path34 from "path";
144019
144243
 
144020
144244
  class LocalHealthChecker {
144021
144245
  dataDir = config2.get("dataDir");
@@ -144093,10 +144317,10 @@ class LocalHealthChecker {
144093
144317
  const start = Date.now();
144094
144318
  try {
144095
144319
  if (!existsSync3(this.dataDir))
144096
- await fs20.mkdir(this.dataDir, { recursive: true });
144097
- const probe2 = path33.join(this.dataDir, ".health-check-test");
144098
- await fs20.writeFile(probe2, "ok");
144099
- await fs20.unlink(probe2);
144320
+ await fs21.mkdir(this.dataDir, { recursive: true });
144321
+ const probe2 = path34.join(this.dataDir, ".health-check-test");
144322
+ await fs21.writeFile(probe2, "ok");
144323
+ await fs21.unlink(probe2);
144100
144324
  return { available: true, latency: Date.now() - start, details: { path: this.dataDir, writable: true } };
144101
144325
  } catch (error51) {
144102
144326
  return { available: false, latency: Date.now() - start, error: `Data directory error: ${error51.message}` };
@@ -146230,9 +146454,9 @@ var init_scheduler2 = __esm(() => {
146230
146454
  });
146231
146455
 
146232
146456
  // ../../packages/core/dist/services/pricing/models-dev-client.js
146233
- import fs21 from "fs/promises";
146457
+ import fs22 from "fs/promises";
146234
146458
  import { existsSync as existsSync4 } from "fs";
146235
- import path34 from "path";
146459
+ import path35 from "path";
146236
146460
  function getModelsDevClient() {
146237
146461
  if (!clientInstance) {
146238
146462
  clientInstance = new ModelsDevClient;
@@ -146252,7 +146476,7 @@ var init_models_dev_client = __esm(() => {
146252
146476
  memoryCacheTimestamp = 0;
146253
146477
  getLocalCachePath() {
146254
146478
  const dataDir = config2.get("dataDir");
146255
- return path34.join(dataDir, ModelsDevClient.LOCAL_CACHE_FILE);
146479
+ return path35.join(dataDir, ModelsDevClient.LOCAL_CACHE_FILE);
146256
146480
  }
146257
146481
  async loadLocalCache() {
146258
146482
  const cachePath = this.getLocalCachePath();
@@ -146260,7 +146484,7 @@ var init_models_dev_client = __esm(() => {
146260
146484
  if (!existsSync4(cachePath)) {
146261
146485
  return null;
146262
146486
  }
146263
- const content = await fs21.readFile(cachePath, "utf-8");
146487
+ const content = await fs22.readFile(cachePath, "utf-8");
146264
146488
  const data = JSON.parse(content);
146265
146489
  const age = Date.now() - data.timestamp;
146266
146490
  if (age > ModelsDevClient.LOCAL_CACHE_TTL) {
@@ -146287,14 +146511,14 @@ var init_models_dev_client = __esm(() => {
146287
146511
  async saveLocalCache(models) {
146288
146512
  const cachePath = this.getLocalCachePath();
146289
146513
  try {
146290
- const dir = path34.dirname(cachePath);
146291
- await fs21.mkdir(dir, { recursive: true });
146514
+ const dir = path35.dirname(cachePath);
146515
+ await fs22.mkdir(dir, { recursive: true });
146292
146516
  const data = {
146293
146517
  timestamp: Date.now(),
146294
146518
  version: "1.0.0",
146295
146519
  models: Object.fromEntries(models)
146296
146520
  };
146297
- await fs21.writeFile(cachePath, JSON.stringify(data), "utf-8");
146521
+ await fs22.writeFile(cachePath, JSON.stringify(data), "utf-8");
146298
146522
  logger.debug("Saved pricing to local cache", {
146299
146523
  models: models.size,
146300
146524
  path: cachePath
@@ -146623,7 +146847,7 @@ var init_models_dev_client = __esm(() => {
146623
146847
  const cachePath = this.getLocalCachePath();
146624
146848
  try {
146625
146849
  if (existsSync4(cachePath)) {
146626
- await fs21.unlink(cachePath);
146850
+ await fs22.unlink(cachePath);
146627
146851
  logger.debug("Local pricing cache file deleted");
146628
146852
  }
146629
146853
  } catch (error51) {
@@ -152178,33 +152402,33 @@ var require_URL = __commonJS((exports, module) => {
152178
152402
  else
152179
152403
  return basepath.substring(0, lastslash + 1) + refpath;
152180
152404
  }
152181
- function remove_dot_segments(path35) {
152182
- if (!path35)
152183
- return path35;
152405
+ function remove_dot_segments(path36) {
152406
+ if (!path36)
152407
+ return path36;
152184
152408
  var output = "";
152185
- while (path35.length > 0) {
152186
- if (path35 === "." || path35 === "..") {
152187
- path35 = "";
152409
+ while (path36.length > 0) {
152410
+ if (path36 === "." || path36 === "..") {
152411
+ path36 = "";
152188
152412
  break;
152189
152413
  }
152190
- var twochars = path35.substring(0, 2);
152191
- var threechars = path35.substring(0, 3);
152192
- var fourchars = path35.substring(0, 4);
152414
+ var twochars = path36.substring(0, 2);
152415
+ var threechars = path36.substring(0, 3);
152416
+ var fourchars = path36.substring(0, 4);
152193
152417
  if (threechars === "../") {
152194
- path35 = path35.substring(3);
152418
+ path36 = path36.substring(3);
152195
152419
  } else if (twochars === "./") {
152196
- path35 = path35.substring(2);
152420
+ path36 = path36.substring(2);
152197
152421
  } else if (threechars === "/./") {
152198
- path35 = "/" + path35.substring(3);
152199
- } else if (twochars === "/." && path35.length === 2) {
152200
- path35 = "/";
152201
- } else if (fourchars === "/../" || threechars === "/.." && path35.length === 3) {
152202
- path35 = "/" + path35.substring(4);
152422
+ path36 = "/" + path36.substring(3);
152423
+ } else if (twochars === "/." && path36.length === 2) {
152424
+ path36 = "/";
152425
+ } else if (fourchars === "/../" || threechars === "/.." && path36.length === 3) {
152426
+ path36 = "/" + path36.substring(4);
152203
152427
  output = output.replace(/\/?[^\/]*$/, "");
152204
152428
  } else {
152205
- var segment = path35.match(/(\/?([^\/]*))/)[0];
152429
+ var segment = path36.match(/(\/?([^\/]*))/)[0];
152206
152430
  output += segment;
152207
- path35 = path35.substring(segment.length);
152431
+ path36 = path36.substring(segment.length);
152208
152432
  }
152209
152433
  }
152210
152434
  return output;
@@ -164274,21 +164498,21 @@ function jsonToKeyPathChunks(value, label = "$") {
164274
164498
  walk(value, label, out);
164275
164499
  return out;
164276
164500
  }
164277
- function walk(val, path35, out) {
164501
+ function walk(val, path36, out) {
164278
164502
  if (val === null || val === undefined)
164279
164503
  return;
164280
164504
  if (Array.isArray(val)) {
164281
164505
  if (val.length === 0) {
164282
- out.push({ path: path35, content: `**${path35}** = _[]_` });
164506
+ out.push({ path: path36, content: `**${path36}** = _[]_` });
164283
164507
  return;
164284
164508
  }
164285
164509
  if (val.every((v) => v !== null && typeof v === "object")) {
164286
- val.forEach((v, i) => walk(v, `${path35}[${i}]`, out));
164510
+ val.forEach((v, i) => walk(v, `${path36}[${i}]`, out));
164287
164511
  return;
164288
164512
  }
164289
164513
  const items = val.map((v) => `- \`${String(v)}\``).join(`
164290
164514
  `);
164291
- out.push({ path: path35, content: `**${path35}**
164515
+ out.push({ path: path36, content: `**${path36}**
164292
164516
 
164293
164517
  ${items}` });
164294
164518
  return;
@@ -164296,16 +164520,16 @@ ${items}` });
164296
164520
  if (typeof val === "object") {
164297
164521
  const entries = Object.entries(val);
164298
164522
  if (entries.length === 0) {
164299
- out.push({ path: path35, content: `**${path35}** = _{}_` });
164523
+ out.push({ path: path36, content: `**${path36}** = _{}_` });
164300
164524
  return;
164301
164525
  }
164302
164526
  for (const [k, v] of entries) {
164303
164527
  const safeKey = /^[A-Za-z_$][\w$]*$/.test(k) ? k : JSON.stringify(k);
164304
- walk(v, `${path35}.${safeKey}`, out);
164528
+ walk(v, `${path36}.${safeKey}`, out);
164305
164529
  }
164306
164530
  return;
164307
164531
  }
164308
- out.push({ path: path35, content: `**${path35}** = \`${String(val)}\`` });
164532
+ out.push({ path: path36, content: `**${path36}** = \`${String(val)}\`` });
164309
164533
  }
164310
164534
  var gfm, STRIP_SELECTORS, tdCache = null;
164311
164535
  var init_html_to_md = __esm(() => {
@@ -165068,8 +165292,8 @@ var init_hook_service = __esm(() => {
165068
165292
 
165069
165293
  // ../../packages/core/dist/services/bootstrap/bootstrap-service.js
165070
165294
  import { randomUUID as randomUUID9 } from "crypto";
165071
- import fs22 from "fs";
165072
- import path35 from "path";
165295
+ import fs23 from "fs";
165296
+ import path36 from "path";
165073
165297
  import { spawn as spawn2 } from "child_process";
165074
165298
  function readBootstrapConfig() {
165075
165299
  try {
@@ -165229,9 +165453,9 @@ async function scanSignals(_projectId, projectRoot, caps, symbolGraph, gitRunner
165229
165453
  }
165230
165454
  try {
165231
165455
  for (const name26 of README_CANDIDATES) {
165232
- const p = path35.join(projectRoot, name26);
165233
- if (fs22.existsSync(p) && fs22.statSync(p).isFile()) {
165234
- const buf = fs22.readFileSync(p);
165456
+ const p = path36.join(projectRoot, name26);
165457
+ if (fs23.existsSync(p) && fs23.statSync(p).isFile()) {
165458
+ const buf = fs23.readFileSync(p);
165235
165459
  signals.readme = buf.slice(0, MAX_README_BYTES).toString("utf8");
165236
165460
  break;
165237
165461
  }
@@ -165240,14 +165464,14 @@ async function scanSignals(_projectId, projectRoot, caps, symbolGraph, gitRunner
165240
165464
  logger.debug("bootstrap scan: README read failed", { error: e.message });
165241
165465
  }
165242
165466
  try {
165243
- const docsDir = path35.join(projectRoot, "docs");
165244
- if (fs22.existsSync(docsDir) && fs22.statSync(docsDir).isDirectory()) {
165467
+ const docsDir = path36.join(projectRoot, "docs");
165468
+ if (fs23.existsSync(docsDir) && fs23.statSync(docsDir).isDirectory()) {
165245
165469
  const entries = walkMarkdown(docsDir).slice(0, MAX_DOCS);
165246
165470
  for (const rel of entries) {
165247
165471
  try {
165248
- const buf = fs22.readFileSync(rel);
165472
+ const buf = fs23.readFileSync(rel);
165249
165473
  signals.docs.push({
165250
- path: path35.relative(projectRoot, rel),
165474
+ path: path36.relative(projectRoot, rel),
165251
165475
  snippet: buf.slice(0, MAX_DOC_BYTES).toString("utf8")
165252
165476
  });
165253
165477
  } catch {}
@@ -165258,10 +165482,10 @@ async function scanSignals(_projectId, projectRoot, caps, symbolGraph, gitRunner
165258
165482
  }
165259
165483
  try {
165260
165484
  for (const name26 of MANIFEST_FILES) {
165261
- const p = path35.join(projectRoot, name26);
165262
- if (!fs22.existsSync(p) || !fs22.statSync(p).isFile())
165485
+ const p = path36.join(projectRoot, name26);
165486
+ if (!fs23.existsSync(p) || !fs23.statSync(p).isFile())
165263
165487
  continue;
165264
- const raw2 = fs22.readFileSync(p).slice(0, MAX_MANIFEST_BYTES).toString("utf8");
165488
+ const raw2 = fs23.readFileSync(p).slice(0, MAX_MANIFEST_BYTES).toString("utf8");
165265
165489
  const kind = name26;
165266
165490
  if (name26 === "package.json") {
165267
165491
  try {
@@ -165301,12 +165525,12 @@ function walkMarkdown(dir) {
165301
165525
  const cur = stack.pop();
165302
165526
  let entries;
165303
165527
  try {
165304
- entries = fs22.readdirSync(cur, { withFileTypes: true });
165528
+ entries = fs23.readdirSync(cur, { withFileTypes: true });
165305
165529
  } catch {
165306
165530
  continue;
165307
165531
  }
165308
165532
  for (const e of entries) {
165309
- const full = path35.join(cur, e.name);
165533
+ const full = path36.join(cur, e.name);
165310
165534
  if (e.isDirectory()) {
165311
165535
  if (e.name === "node_modules" || e.name.startsWith("."))
165312
165536
  continue;
@@ -168836,7 +169060,7 @@ class StdioServerTransport {
168836
169060
  }
168837
169061
 
168838
169062
  // src/index.ts
168839
- import fs25 from "fs/promises";
169063
+ import fs26 from "fs/promises";
168840
169064
 
168841
169065
  // src/api-client.ts
168842
169066
  init_config();
@@ -168946,8 +169170,8 @@ init_dist();
168946
169170
  init_dist();
168947
169171
  init_dist15();
168948
169172
  init_dist();
168949
- import fs23 from "fs/promises";
168950
- import path36 from "path";
169173
+ import fs24 from "fs/promises";
169174
+ import path37 from "path";
168951
169175
  var _indexProjectTool = null;
168952
169176
  function indexProjectTool() {
168953
169177
  if (!_indexProjectTool)
@@ -169250,8 +169474,8 @@ class EmbeddedApiClient {
169250
169474
  } else {
169251
169475
  end = start + 20;
169252
169476
  }
169253
- const absolutePath = path36.join(workspace.project_path, file2);
169254
- const content = await fs23.readFile(absolutePath, "utf-8");
169477
+ const absolutePath = path37.join(workspace.project_path, file2);
169478
+ const content = await fs24.readFile(absolutePath, "utf-8");
169255
169479
  const lines = content.split(/\r?\n/);
169256
169480
  const slice = lines.slice(start - 1, Math.min(lines.length, end));
169257
169481
  const formatted = slice.map((text3, idx) => ({ lineNumber: start + idx, content: text3 }));
@@ -169506,22 +169730,22 @@ class EmbeddedApiClient {
169506
169730
  async uploadAndIndex(params) {
169507
169731
  const rawBase = params.projectId || params.projectPath.replace(/\\/g, "/").split("/").filter(Boolean).pop() || "default";
169508
169732
  const finalProjectId = rawBase.replace(/[^a-zA-Z0-9_.-]/g, "_").slice(0, 128);
169509
- const uploadRoot = process.env.MASSA_AI_UPLOAD_DIR || path36.join(getGlobalDataDir(), "uploads");
169510
- const stagingDir = path36.resolve(uploadRoot, finalProjectId);
169511
- await fs23.rm(stagingDir, { recursive: true, force: true });
169512
- await fs23.mkdir(stagingDir, { recursive: true });
169733
+ const uploadRoot = process.env.MASSA_AI_UPLOAD_DIR || path37.join(getGlobalDataDir(), "uploads");
169734
+ const stagingDir = path37.resolve(uploadRoot, finalProjectId);
169735
+ await fs24.rm(stagingDir, { recursive: true, force: true });
169736
+ await fs24.mkdir(stagingDir, { recursive: true });
169513
169737
  const WRITE_BATCH = 20;
169514
169738
  for (let i = 0;i < params.files.length; i += WRITE_BATCH) {
169515
169739
  await Promise.all(params.files.slice(i, i + WRITE_BATCH).map(async (file2) => {
169516
- if (path36.isAbsolute(file2.relativePath) || file2.relativePath.includes("..")) {
169740
+ if (path37.isAbsolute(file2.relativePath) || file2.relativePath.includes("..")) {
169517
169741
  throw new Error(`Invalid file path: ${file2.relativePath}`);
169518
169742
  }
169519
- const dest = path36.resolve(stagingDir, file2.relativePath.replace(/\//g, path36.sep));
169520
- if (!dest.startsWith(stagingDir + path36.sep)) {
169743
+ const dest = path37.resolve(stagingDir, file2.relativePath.replace(/\//g, path37.sep));
169744
+ if (!dest.startsWith(stagingDir + path37.sep)) {
169521
169745
  throw new Error(`Path escapes staging directory: ${file2.relativePath}`);
169522
169746
  }
169523
- await fs23.mkdir(path36.dirname(dest), { recursive: true });
169524
- await fs23.writeFile(dest, file2.content, "utf-8");
169747
+ await fs24.mkdir(path37.dirname(dest), { recursive: true });
169748
+ await fs24.writeFile(dest, file2.content, "utf-8");
169525
169749
  }));
169526
169750
  }
169527
169751
  return await indexProjectTool().handle({
@@ -170018,8 +170242,8 @@ class EmbeddedApiClient {
170018
170242
 
170019
170243
  // src/file-collector.ts
170020
170244
  init_config();
170021
- import fs24 from "fs/promises";
170022
- import path37 from "path";
170245
+ import fs25 from "fs/promises";
170246
+ import path38 from "path";
170023
170247
  var SKIP_DIRS = new Set([
170024
170248
  "node_modules",
170025
170249
  ".git",
@@ -170060,7 +170284,7 @@ async function walk2(root2, dir, files, state, allowed) {
170060
170284
  return;
170061
170285
  let entries;
170062
170286
  try {
170063
- entries = await fs24.readdir(dir, { withFileTypes: true });
170287
+ entries = await fs25.readdir(dir, { withFileTypes: true });
170064
170288
  } catch {
170065
170289
  return;
170066
170290
  }
@@ -170069,22 +170293,22 @@ async function walk2(root2, dir, files, state, allowed) {
170069
170293
  break;
170070
170294
  if (entry2.isDirectory()) {
170071
170295
  if (!SKIP_DIRS.has(entry2.name) && !entry2.name.startsWith(".")) {
170072
- await walk2(root2, path37.join(dir, entry2.name), files, state, allowed);
170296
+ await walk2(root2, path38.join(dir, entry2.name), files, state, allowed);
170073
170297
  }
170074
170298
  } else if (entry2.isFile()) {
170075
- const ext2 = path37.extname(entry2.name).toLowerCase();
170299
+ const ext2 = path38.extname(entry2.name).toLowerCase();
170076
170300
  if (!allowed.has(ext2))
170077
170301
  continue;
170078
- const fullPath = path37.join(dir, entry2.name);
170302
+ const fullPath = path38.join(dir, entry2.name);
170079
170303
  try {
170080
- const stat = await fs24.stat(fullPath);
170304
+ const stat = await fs25.stat(fullPath);
170081
170305
  if (stat.size > MAX_FILE_BYTES)
170082
170306
  continue;
170083
170307
  if (state.totalBytes + stat.size > MAX_TOTAL_BYTES)
170084
170308
  continue;
170085
- const content = await fs24.readFile(fullPath, "utf-8");
170309
+ const content = await fs25.readFile(fullPath, "utf-8");
170086
170310
  state.totalBytes += stat.size;
170087
- const relativePath = path37.relative(root2, fullPath).split(path37.sep).join("/");
170311
+ const relativePath = path38.relative(root2, fullPath).split(path38.sep).join("/");
170088
170312
  files.push({ relativePath, content });
170089
170313
  } catch {}
170090
170314
  }
@@ -171322,7 +171546,7 @@ var PROJECT_TOOL_DEFINITIONS = [
171322
171546
  },
171323
171547
  {
171324
171548
  name: "profile_list",
171325
- description: "List shipped model profiles and, per detected host, the currently active profile (from recorded state; " + "'balanced' shown when unrecorded) and bundle version. Offline \u2014 reads on-disk variant directories only, " + "never the registry.",
171549
+ description: "List shipped model profiles and, per detected host, the currently active profile (from recorded state; " + "'balanced' shown when unrecorded) and bundle version. Offline \u2014 reads on-disk variant directories only, " + "never the registry. The claude row also carries agent-runtime-drift fields: liveRoot + sourceVersion " + "(the live tree the host actually loads, beside the recorded bundleVersion) and envOverride (a host env " + "var such as CLAUDE_CODE_SUBAGENT_MODEL that overrides every per-agent model at runtime).",
171326
171550
  apiEndpoint: "/api/v1/profiles",
171327
171551
  apiMethod: "GET",
171328
171552
  inputSchema: {
@@ -172067,7 +172291,7 @@ class McpProxyServer {
172067
172291
  return textContent(JSON.stringify({ success: false, error: "projectPath is required" }));
172068
172292
  }
172069
172293
  try {
172070
- if (!(await fs25.stat(projectPath2)).isDirectory()) {
172294
+ if (!(await fs26.stat(projectPath2)).isDirectory()) {
172071
172295
  return textContent(JSON.stringify({ success: false, error: `${projectPath2} is not a directory` }));
172072
172296
  }
172073
172297
  } catch {