@massa-ai/mcp-client 1.55.0 → 1.57.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/config-cli.js +1067 -318
  2. package/dist/index.js +1042 -360
  3. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -25598,15 +25598,18 @@ var init_massa_ai_config = __esm(() => {
25598
25598
  security: {
25599
25599
  corsOrigins: []
25600
25600
  },
25601
- scheduler: DEFAULT_SCHEDULER_CONFIG
25601
+ scheduler: DEFAULT_SCHEDULER_CONFIG,
25602
+ bootstrap: { rules: {} }
25602
25603
  };
25603
25604
  });
25604
25605
 
25605
25606
  // ../../packages/shared/dist/config/config-loader.js
25606
25607
  var exports_config_loader = {};
25607
25608
  __export(exports_config_loader, {
25609
+ writeRawConfig: () => writeRawConfig,
25608
25610
  writeFileAtomically: () => writeFileAtomically,
25609
25611
  saveConfig: () => saveConfig,
25612
+ readRawConfigStrict: () => readRawConfigStrict,
25610
25613
  migrateDataDirOnce: () => migrateDataDirOnce,
25611
25614
  mergeSchedulerSection: () => mergeSchedulerSection,
25612
25615
  loadRawUserConfig: () => loadRawUserConfig,
@@ -25617,12 +25620,23 @@ __export(exports_config_loader, {
25617
25620
  getConfigForEnv: () => getConfigForEnv,
25618
25621
  getConfigDir: () => getConfigDir,
25619
25622
  configExists: () => configExists,
25620
- __resetMigrationForTests: () => __resetMigrationForTests
25623
+ __resetMigrationForTests: () => __resetMigrationForTests,
25624
+ ConfigWriteConflictError: () => ConfigWriteConflictError,
25625
+ ConfigParseError: () => ConfigParseError
25621
25626
  });
25622
25627
  import fs from "fs";
25623
25628
  import path3 from "path";
25624
25629
  import os2 from "os";
25625
25630
  import crypto2 from "crypto";
25631
+ function readConfigFileOrEmpty() {
25632
+ try {
25633
+ return fs.readFileSync(CONFIG_FILE, "utf-8");
25634
+ } catch (error51) {
25635
+ if (error51?.code === "ENOENT")
25636
+ return "";
25637
+ throw error51;
25638
+ }
25639
+ }
25626
25640
  function getConfigDir() {
25627
25641
  return CONFIG_DIR;
25628
25642
  }
@@ -25689,6 +25703,21 @@ function loadRawUserConfig() {
25689
25703
  return {};
25690
25704
  }
25691
25705
  }
25706
+ function readRawConfigStrict() {
25707
+ const raw2 = readConfigFileOrEmpty();
25708
+ if (raw2 === "")
25709
+ return {};
25710
+ let parsed;
25711
+ try {
25712
+ parsed = JSON.parse(raw2);
25713
+ } catch (error51) {
25714
+ throw new ConfigParseError(CONFIG_FILE, error51);
25715
+ }
25716
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
25717
+ throw new ConfigParseError(CONFIG_FILE, new Error("parsed value is not a JSON object"));
25718
+ }
25719
+ return parsed;
25720
+ }
25692
25721
  function loadConfigSafe() {
25693
25722
  try {
25694
25723
  return loadConfig();
@@ -25743,6 +25772,43 @@ function writeFileAtomically(targetPath, content) {
25743
25772
  function saveConfig(config2) {
25744
25773
  writeFileAtomically(CONFIG_FILE, JSON.stringify(config2, null, 2));
25745
25774
  }
25775
+ function writeRawConfig(doc2, opts) {
25776
+ const onDiskAtStart = readConfigFileOrEmpty();
25777
+ if (onDiskAtStart === opts.expectedBytes) {
25778
+ writeFileAtomically(CONFIG_FILE, JSON.stringify(doc2, null, 2));
25779
+ return;
25780
+ }
25781
+ let original;
25782
+ let current;
25783
+ try {
25784
+ original = opts.expectedBytes === "" ? {} : JSON.parse(opts.expectedBytes);
25785
+ } catch (error51) {
25786
+ throw new ConfigParseError(`${CONFIG_FILE} (caller-supplied expectedBytes)`, error51);
25787
+ }
25788
+ try {
25789
+ current = onDiskAtStart === "" ? {} : JSON.parse(onDiskAtStart);
25790
+ } catch (error51) {
25791
+ throw new ConfigParseError(CONFIG_FILE, error51);
25792
+ }
25793
+ const reapplied = { ...current };
25794
+ const touchedKeys = new Set([...Object.keys(original), ...Object.keys(doc2)]);
25795
+ for (const key of touchedKeys) {
25796
+ const before = JSON.stringify(original[key]);
25797
+ const after = JSON.stringify(doc2[key]);
25798
+ if (before === after)
25799
+ continue;
25800
+ if (Object.prototype.hasOwnProperty.call(doc2, key)) {
25801
+ reapplied[key] = doc2[key];
25802
+ } else {
25803
+ delete reapplied[key];
25804
+ }
25805
+ }
25806
+ const onDiskImmediatelyBeforeWrite = readConfigFileOrEmpty();
25807
+ if (onDiskImmediatelyBeforeWrite !== onDiskAtStart) {
25808
+ throw new ConfigWriteConflictError(CONFIG_FILE);
25809
+ }
25810
+ writeFileAtomically(CONFIG_FILE, JSON.stringify(reapplied, null, 2));
25811
+ }
25746
25812
  function initConfig() {
25747
25813
  if (!fs.existsSync(CONFIG_FILE)) {
25748
25814
  saveConfig(defaultMassaAiConfig);
@@ -25769,12 +25835,25 @@ function getConfigForEnv() {
25769
25835
  env.ENABLE_METRICS = String(config2.logging.enableMetrics);
25770
25836
  return env;
25771
25837
  }
25772
- var CONFIG_DIR, CONFIG_FILE, migrationAttempted = false, tempFileCounter = 0;
25838
+ var CONFIG_DIR, CONFIG_FILE, ConfigParseError, ConfigWriteConflictError, migrationAttempted = false, tempFileCounter = 0;
25773
25839
  var init_config_loader = __esm(() => {
25774
25840
  init_massa_ai_config();
25775
25841
  init_xdg();
25776
25842
  CONFIG_DIR = configDir("massa-ai");
25777
25843
  CONFIG_FILE = path3.join(CONFIG_DIR, "config.json");
25844
+ ConfigParseError = class ConfigParseError extends Error {
25845
+ constructor(filePath, cause) {
25846
+ const reason = cause instanceof Error ? cause.message : String(cause);
25847
+ super(`Failed to parse ${filePath}: ${reason}`);
25848
+ this.name = "ConfigParseError";
25849
+ }
25850
+ };
25851
+ ConfigWriteConflictError = class ConfigWriteConflictError extends Error {
25852
+ constructor(filePath) {
25853
+ super(`${filePath} changed on disk twice while writing \u2014 refusing to overwrite a ` + `concurrent update. Re-read the file and retry.`);
25854
+ this.name = "ConfigWriteConflictError";
25855
+ }
25856
+ };
25778
25857
  });
25779
25858
 
25780
25859
  // ../../packages/shared/dist/env.js
@@ -27907,6 +27986,608 @@ function findRepoRootWithMarker(startDir, marker, maxLevels) {
27907
27986
  }
27908
27987
  var init_repo_root = () => {};
27909
27988
 
27989
+ // ../../packages/shared/dist/bootstrap/rules.js
27990
+ function isBootstrapRuleId(value) {
27991
+ return typeof value === "string" && BOOTSTRAP_RULE_IDS.includes(value);
27992
+ }
27993
+ function bootstrapRuleDefaults() {
27994
+ const defaults = {};
27995
+ for (const rule of BOOTSTRAP_RULES)
27996
+ defaults[rule.id] = rule.defaultEnabled;
27997
+ return defaults;
27998
+ }
27999
+ function namedError4(name, message) {
28000
+ const err = new BootstrapRuleError(message);
28001
+ err.name = name;
28002
+ return err;
28003
+ }
28004
+ function assertKnownRuleId(id) {
28005
+ if (!isBootstrapRuleId(id))
28006
+ throw UnknownRuleError(id, BOOTSTRAP_RULE_IDS);
28007
+ }
28008
+ var BOOTSTRAP_RULE_IDS, BOOTSTRAP_RULES, RULES_BY_ID, BootstrapRuleError, UnknownRuleError = (id, known = BOOTSTRAP_RULE_IDS) => namedError4("UnknownRuleError", `unknown bootstrap rule "${id}" \u2014 valid ids: ${known.join(", ")}`);
28009
+ var init_rules = __esm(() => {
28010
+ BOOTSTRAP_RULE_IDS = [
28011
+ "caveman",
28012
+ "massa-ai-router",
28013
+ "persona-router",
28014
+ "dedupe-guardrails",
28015
+ "plan-challenge",
28016
+ "conversation-feedback",
28017
+ "indexing-hygiene",
28018
+ "english-code",
28019
+ "code-comments"
28020
+ ];
28021
+ BOOTSTRAP_RULES = [
28022
+ {
28023
+ id: "caveman",
28024
+ defaultEnabled: true,
28025
+ description: "Keep communication compressed while preserving technical accuracy."
28026
+ },
28027
+ {
28028
+ id: "massa-ai-router",
28029
+ defaultEnabled: true,
28030
+ description: "Load the massa-ai skill as the workflow router before substantive work."
28031
+ },
28032
+ {
28033
+ id: "persona-router",
28034
+ defaultEnabled: true,
28035
+ description: "Select one cataloged specialist persona after massa-ai context is available."
28036
+ },
28037
+ {
28038
+ id: "dedupe-guardrails",
28039
+ defaultEnabled: true,
28040
+ description: "Reuse already-loaded massa-ai context instead of bulk-loading workflows or references."
28041
+ },
28042
+ {
28043
+ id: "plan-challenge",
28044
+ defaultEnabled: true,
28045
+ description: "Run The Fool as a post-plan challenge gate per the configured policy."
28046
+ },
28047
+ {
28048
+ id: "conversation-feedback",
28049
+ defaultEnabled: true,
28050
+ description: "Emit chat-visible status updates for massa-ai workflow progress."
28051
+ },
28052
+ {
28053
+ id: "indexing-hygiene",
28054
+ defaultEnabled: true,
28055
+ description: "Ignore build output, dependency, and secret paths during indexing and context loading."
28056
+ },
28057
+ {
28058
+ id: "english-code",
28059
+ defaultEnabled: true,
28060
+ description: "Write generated code, identifiers, comments, and commit-facing artifacts in English regardless of conversational language."
28061
+ },
28062
+ {
28063
+ id: "code-comments",
28064
+ defaultEnabled: false,
28065
+ description: "Require API doc blocks and rationale comments on generated code, per code-annotation.md \xA71/\xA72."
28066
+ }
28067
+ ];
28068
+ RULES_BY_ID = new Map(BOOTSTRAP_RULES.map((rule) => [rule.id, rule]));
28069
+ BootstrapRuleError = class BootstrapRuleError extends Error {
28070
+ constructor(message) {
28071
+ super(message);
28072
+ this.name = "BootstrapRuleError";
28073
+ }
28074
+ };
28075
+ });
28076
+
28077
+ // ../../packages/shared/dist/bootstrap/state.js
28078
+ import fs9 from "fs";
28079
+ function isPlainObject4(value) {
28080
+ return typeof value === "object" && value !== null && !Array.isArray(value);
28081
+ }
28082
+ function resolveBootstrapState(doc2) {
28083
+ const document2 = doc2 ?? readRawConfigStrict();
28084
+ const state = bootstrapRuleDefaults();
28085
+ const ignored = [];
28086
+ const bootstrap = document2[BOOTSTRAP_STATE_KEY];
28087
+ if (bootstrap === undefined)
28088
+ return { state, ignoredStateKeys: [] };
28089
+ if (!isPlainObject4(bootstrap)) {
28090
+ return { state, ignoredStateKeys: [BOOTSTRAP_STATE_KEY] };
28091
+ }
28092
+ const rules = bootstrap[BOOTSTRAP_RULES_KEY];
28093
+ if (rules === undefined)
28094
+ return { state, ignoredStateKeys: [] };
28095
+ if (!isPlainObject4(rules)) {
28096
+ return { state, ignoredStateKeys: [BOOTSTRAP_STATE_PATH] };
28097
+ }
28098
+ for (const [key, value] of Object.entries(rules)) {
28099
+ if (!isBootstrapRuleId(key) || typeof value !== "boolean") {
28100
+ ignored.push(key);
28101
+ continue;
28102
+ }
28103
+ state[key] = value;
28104
+ }
28105
+ return { state, ignoredStateKeys: ignored.sort() };
28106
+ }
28107
+ function readConfigBytes() {
28108
+ try {
28109
+ return fs9.readFileSync(getConfigPath(), "utf-8");
28110
+ } catch (error51) {
28111
+ if (error51?.code === "ENOENT")
28112
+ return "";
28113
+ throw error51;
28114
+ }
28115
+ }
28116
+ function setBootstrapRuleEnabled(id, enabled) {
28117
+ assertKnownRuleId(id);
28118
+ const expectedBytes = readConfigBytes();
28119
+ let document2;
28120
+ if (expectedBytes === "") {
28121
+ document2 = {};
28122
+ } else {
28123
+ let parsed;
28124
+ try {
28125
+ parsed = JSON.parse(expectedBytes);
28126
+ } catch (error51) {
28127
+ throw new ConfigParseError(getConfigPath(), error51);
28128
+ }
28129
+ if (!isPlainObject4(parsed)) {
28130
+ throw new ConfigParseError(getConfigPath(), new Error("parsed value is not a JSON object"));
28131
+ }
28132
+ document2 = parsed;
28133
+ }
28134
+ const before = resolveBootstrapState(document2);
28135
+ const bootstrap = document2[BOOTSTRAP_STATE_KEY];
28136
+ const bootstrapSubtree = isPlainObject4(bootstrap) ? bootstrap : {};
28137
+ const rules = bootstrapSubtree[BOOTSTRAP_RULES_KEY];
28138
+ const rulesSubtree = isPlainObject4(rules) ? rules : {};
28139
+ const next = {
28140
+ ...document2,
28141
+ [BOOTSTRAP_STATE_KEY]: {
28142
+ ...bootstrapSubtree,
28143
+ [BOOTSTRAP_RULES_KEY]: { ...rulesSubtree, [id]: enabled }
28144
+ }
28145
+ };
28146
+ writeRawConfig(next, { expectedBytes });
28147
+ const after = resolveBootstrapState(next);
28148
+ return {
28149
+ id,
28150
+ enabled,
28151
+ changed: before.state[id] !== enabled,
28152
+ state: after.state,
28153
+ ignoredStateKeys: after.ignoredStateKeys
28154
+ };
28155
+ }
28156
+ var BOOTSTRAP_STATE_KEY = "bootstrap", BOOTSTRAP_RULES_KEY = "rules", BOOTSTRAP_STATE_PATH;
28157
+ var init_state2 = __esm(() => {
28158
+ init_config_loader();
28159
+ init_rules();
28160
+ BOOTSTRAP_STATE_PATH = `${BOOTSTRAP_STATE_KEY}.${BOOTSTRAP_RULES_KEY}`;
28161
+ });
28162
+
28163
+ // ../../packages/shared/dist/bootstrap/render.js
28164
+ import path13 from "path";
28165
+ function wrapBootstrapBlock(body) {
28166
+ return `${BOOTSTRAP_BLOCK_START}
28167
+ ${body.replace(/\n+$/, "")}
28168
+ ${BOOTSTRAP_BLOCK_END}
28169
+ `;
28170
+ }
28171
+ function ruleMarker(id, suffix) {
28172
+ return `<!-- massa-ai:rule:${id}:${suffix} -->`;
28173
+ }
28174
+ function resolveHostRoot(host, targetHome, hostRoot) {
28175
+ requireAbsoluteTargetHome(targetHome);
28176
+ if (hostRoot === undefined)
28177
+ return path13.join(targetHome, ...HOST_CONFIG_DIR[host]);
28178
+ const relative = path13.relative(targetHome, hostRoot);
28179
+ if (!path13.isAbsolute(hostRoot) || relative === "" || relative.startsWith("..") || path13.isAbsolute(relative)) {
28180
+ throw new BootstrapRenderError("HostRootOutsideTargetHomeError", `hostRoot must be an absolute directory inside targetHome, got "${hostRoot}" for targetHome "${targetHome}"`, [hostRoot, targetHome]);
28181
+ }
28182
+ return hostRoot;
28183
+ }
28184
+ function bootstrapContractPath(host, targetHome, hostRoot) {
28185
+ return path13.join(resolveHostRoot(host, targetHome, hostRoot), CONTRACT_FILENAME);
28186
+ }
28187
+ function bootstrapStateFilePath(targetHome) {
28188
+ requireAbsoluteTargetHome(targetHome);
28189
+ return path13.join(targetHome, ".config", "massa-ai", "config.json");
28190
+ }
28191
+ function renderBootstrap(options) {
28192
+ const { source, state, host, targetHome, hostRoot } = options;
28193
+ requireAbsoluteTargetHome(targetHome);
28194
+ requireTotalState(state);
28195
+ const body = applyRuleState(extractBootstrapBlock(source), state);
28196
+ const contract = `${renderHeader(state, targetHome)}
28197
+
28198
+ ${body}`;
28199
+ const pointer = renderPointer(host, targetHome, hostRoot);
28200
+ const emitted = [
28201
+ ...contract.split(`
28202
+ `).filter((line) => ANY_MASSA_AI_MARKER.test(line)),
28203
+ ...pointer.split(`
28204
+ `).filter((line) => ANY_MASSA_AI_MARKER.test(line))
28205
+ ].map((line) => line.trim());
28206
+ if (emitted.length > 0) {
28207
+ throw new BootstrapRenderError("MarkerInInterpolatedPathError", `rendered output carries a massa-ai marker, which can only have come from an interpolated path: ${emitted.join(", ")}`, emitted);
28208
+ }
28209
+ return { contract, pointer };
28210
+ }
28211
+ function requireAbsoluteTargetHome(targetHome) {
28212
+ if (!path13.isAbsolute(targetHome)) {
28213
+ throw new BootstrapRenderError("TargetHomeNotAbsoluteError", `targetHome must be an absolute path, got "${targetHome}"`, [targetHome]);
28214
+ }
28215
+ }
28216
+ function requireTotalState(state) {
28217
+ const missing = BOOTSTRAP_RULES.filter((rule) => typeof state[rule.id] !== "boolean").map((rule) => rule.id);
28218
+ if (missing.length > 0) {
28219
+ throw new BootstrapRenderError("IncompleteBootstrapStateError", `bootstrap state is missing a boolean for: ${missing.join(", ")} \u2014 pass a state resolved by resolveBootstrapState`, missing);
28220
+ }
28221
+ }
28222
+ function extractBootstrapBlock(source) {
28223
+ const startCount = countOccurrences(source, BOOTSTRAP_BLOCK_START);
28224
+ const endCount = countOccurrences(source, BOOTSTRAP_BLOCK_END);
28225
+ const startIndex = source.indexOf(BOOTSTRAP_BLOCK_START);
28226
+ const endIndex = source.indexOf(BOOTSTRAP_BLOCK_END);
28227
+ if (startCount !== 1 || endCount !== 1 || startIndex > endIndex) {
28228
+ throw new BootstrapRenderError("BootstrapSourceError", `source must contain exactly one well-formed bootstrap block \u2014 found ${startCount} start and ${endCount} end marker(s)`, [`start=${startCount}`, `end=${endCount}`]);
28229
+ }
28230
+ return source.slice(startIndex + BOOTSTRAP_BLOCK_START.length, endIndex);
28231
+ }
28232
+ function findMarker(lines, marker) {
28233
+ let index = -1;
28234
+ let count = 0;
28235
+ for (let i = 0;i < lines.length; i++) {
28236
+ if (lines[i]?.trim() === marker) {
28237
+ if (count === 0)
28238
+ index = i;
28239
+ count++;
28240
+ }
28241
+ }
28242
+ return { index, count };
28243
+ }
28244
+ function countOccurrences(haystack, needle) {
28245
+ let count = 0;
28246
+ let from = 0;
28247
+ for (;; ) {
28248
+ const at = haystack.indexOf(needle, from);
28249
+ if (at === -1)
28250
+ return count;
28251
+ count++;
28252
+ from = at + needle.length;
28253
+ }
28254
+ }
28255
+ function splitOffSpan(inner, id) {
28256
+ const offStart = findMarker(inner, ruleMarker(id, "off"));
28257
+ const offEnd = findMarker(inner, ruleMarker(id, "off-end"));
28258
+ if (offStart.count === 0 && offEnd.count === 0)
28259
+ return { on: inner, off: [] };
28260
+ if (offStart.count !== 1 || offEnd.count !== 1 || offStart.index > offEnd.index) {
28261
+ throw new BootstrapRenderError("MalformedOffSpanError", `rule "${id}" has a malformed off-text span \u2014 found ${offStart.count} ":off" and ${offEnd.count} ":off-end" marker(s)`, [id]);
28262
+ }
28263
+ return {
28264
+ on: [...inner.slice(0, offStart.index), ...inner.slice(offEnd.index + 1)],
28265
+ off: inner.slice(offStart.index + 1, offEnd.index)
28266
+ };
28267
+ }
28268
+ function applyRuleState(block, state) {
28269
+ const lines = block.split(`
28270
+ `);
28271
+ const missingSpans = [];
28272
+ for (const rule of BOOTSTRAP_RULES) {
28273
+ const start = findMarker(lines, ruleMarker(rule.id, "start"));
28274
+ const end = findMarker(lines, ruleMarker(rule.id, "end"));
28275
+ if (start.count !== 1 || end.count !== 1 || start.index > end.index) {
28276
+ missingSpans.push(rule.id);
28277
+ continue;
28278
+ }
28279
+ const span = splitOffSpan(lines.slice(start.index + 1, end.index), rule.id);
28280
+ const replacement = state[rule.id] ? span.on : span.off;
28281
+ lines.splice(start.index, end.index - start.index + 1, ...replacement);
28282
+ }
28283
+ if (missingSpans.length > 0) {
28284
+ throw new BootstrapRenderError("MissingRuleSpanError", `source has no well-formed span for rule(s): ${missingSpans.join(", ")}`, missingSpans);
28285
+ }
28286
+ const leftovers = lines.filter((line) => ANY_MASSA_AI_MARKER.test(line)).map((line) => line.trim());
28287
+ if (leftovers.length > 0) {
28288
+ throw new BootstrapRenderError("UnknownRuleMarkerError", `source carries marker(s) no registry rule consumed: ${leftovers.join(", ")}`, leftovers);
28289
+ }
28290
+ return normalizeBlankLines(lines);
28291
+ }
28292
+ function normalizeBlankLines(lines) {
28293
+ const out = [];
28294
+ let inFence = false;
28295
+ for (const line of lines) {
28296
+ if (line.trimStart().startsWith("```")) {
28297
+ inFence = !inFence;
28298
+ out.push(line);
28299
+ continue;
28300
+ }
28301
+ if (inFence) {
28302
+ out.push(line);
28303
+ continue;
28304
+ }
28305
+ const previous = out[out.length - 1];
28306
+ const isBlank = line.trim() === "";
28307
+ if (isBlank && (previous === undefined || previous.trim() === ""))
28308
+ continue;
28309
+ if (/^#{1,6} /.test(line) && previous !== undefined && previous.trim() !== "")
28310
+ out.push("");
28311
+ out.push(line);
28312
+ }
28313
+ return `${out.join(`
28314
+ `).trimEnd()}
28315
+ `;
28316
+ }
28317
+ function renderHeader(state, targetHome) {
28318
+ const lines = [
28319
+ "> Generated by massa-ai from `skills/AGENTS.md`. Edits made here are lost on",
28320
+ "> the next `scripts/install-skills.sh --apply` or",
28321
+ "> `massa-ai-config bootstrap enable|disable <rule-id>` run.",
28322
+ ">",
28323
+ `> Rule state lives in \`${bootstrapStateFilePath(targetHome)}\` under the`,
28324
+ `> \`${BOOTSTRAP_STATE_PATH}\` key. List every rule and its state with`,
28325
+ "> `massa-ai-config bootstrap list`; switch one back on with",
28326
+ "> `massa-ai-config bootstrap enable <rule-id>`. That command is a binary and",
28327
+ "> not a rule, so it keeps working with every rule below disabled \u2014",
28328
+ "> `massa-ai-config bootstrap enable massa-ai-router` is the way back when the",
28329
+ "> router rule itself is off."
28330
+ ];
28331
+ if (BOOTSTRAP_RULES.every((rule) => !state[rule.id])) {
28332
+ lines.push("", "**Every massa-ai bootstrap rule is disabled.** The contract below carries no", "rule to activate, and nothing in this file changes agent behavior until at", "least one rule is enabled again.");
28333
+ }
28334
+ return lines.join(`
28335
+ `);
28336
+ }
28337
+ function renderPointer(host, targetHome, hostRoot) {
28338
+ return [
28339
+ "## massa-ai Startup Contract",
28340
+ "",
28341
+ "Before substantive work in this session, read",
28342
+ `\`${bootstrapContractPath(host, targetHome, hostRoot)}\``,
28343
+ "with your Read tool and follow it. This block is a pointer only: it states no",
28344
+ "rule of its own, and massa-ai overwrites it on the next install.",
28345
+ ""
28346
+ ].join(`
28347
+ `);
28348
+ }
28349
+ var BOOTSTRAP_BLOCK_START = "<!-- massa-ai:bootstrap:start -->", BOOTSTRAP_BLOCK_END = "<!-- massa-ai:bootstrap:end -->", CONTRACT_FILENAME = "MASSA-AI.md", ANY_MASSA_AI_MARKER, BootstrapRenderError, HOST_CONFIG_DIR;
28350
+ var init_render = __esm(() => {
28351
+ init_rules();
28352
+ init_state2();
28353
+ ANY_MASSA_AI_MARKER = /<!--\s*massa-ai:(?:rule|bootstrap):[^>]*-->/;
28354
+ BootstrapRenderError = class BootstrapRenderError extends Error {
28355
+ details;
28356
+ constructor(name, message, details = []) {
28357
+ super(message);
28358
+ this.name = name;
28359
+ this.details = details;
28360
+ }
28361
+ };
28362
+ HOST_CONFIG_DIR = {
28363
+ claude: [".claude"],
28364
+ codex: [".codex"],
28365
+ cursor: [".cursor"],
28366
+ opencode: [".config", "opencode"]
28367
+ };
28368
+ });
28369
+
28370
+ // ../../packages/shared/dist/bootstrap/report.js
28371
+ function bootstrapReportSucceeded(report) {
28372
+ return report.rows.every((row) => CLEAN_STATUSES.has(row.status));
28373
+ }
28374
+ function buildBootstrapReport(input) {
28375
+ const restartRequired = !input.dryRun && input.rows.some((row) => row.status === "written");
28376
+ return {
28377
+ rows: input.rows,
28378
+ restartRequired,
28379
+ dryRun: input.dryRun,
28380
+ ignoredStateKeys: input.ignoredStateKeys
28381
+ };
28382
+ }
28383
+ var CLEAN_STATUSES;
28384
+ var init_report = __esm(() => {
28385
+ CLEAN_STATUSES = new Set(["written", "skipped"]);
28386
+ });
28387
+
28388
+ // ../../packages/shared/dist/bootstrap/engine.js
28389
+ import fs10 from "fs";
28390
+ import path14 from "path";
28391
+ function applyBootstrapState(options) {
28392
+ const { targetHome } = options;
28393
+ const dryRun = options.dryRun ?? false;
28394
+ const warn = options.onWarning ?? ((message) => console.warn(message));
28395
+ const configPath = bootstrapStateFilePath(targetHome);
28396
+ const installStatePath = path14.join(path14.dirname(configPath), INSTALL_STATE_FILENAME);
28397
+ const { platforms } = readInstallState(installStatePath);
28398
+ const installed = HOSTS.filter((host) => platforms[host] !== undefined);
28399
+ if (installed.length === 0) {
28400
+ return buildBootstrapReport({ rows: [], dryRun, ignoredStateKeys: [] });
28401
+ }
28402
+ const resolved = resolveRuleState(configPath, warn);
28403
+ const source = readSource(options);
28404
+ const rows = installed.map((host) => applyHost({
28405
+ host,
28406
+ source,
28407
+ state: resolved.state,
28408
+ targetHome,
28409
+ hostRoot: recordedHostRoot(platforms[host]),
28410
+ dryRun
28411
+ }));
28412
+ return buildBootstrapReport({
28413
+ rows,
28414
+ dryRun,
28415
+ ignoredStateKeys: resolved.ignoredStateKeys
28416
+ });
28417
+ }
28418
+ function recordedHostRoot(record3) {
28419
+ const root = record3?.root;
28420
+ return typeof root === "string" && root.length > 0 ? root : undefined;
28421
+ }
28422
+ function resolveRuleState(configPath, warn) {
28423
+ const raw2 = readFileOrNull(configPath);
28424
+ if (raw2 === null)
28425
+ return resolveBootstrapState({});
28426
+ let parsed;
28427
+ try {
28428
+ parsed = JSON.parse(raw2);
28429
+ } catch (error51) {
28430
+ warn(degradeWarning(configPath, error51));
28431
+ return resolveBootstrapState({});
28432
+ }
28433
+ if (!isPlainObject5(parsed)) {
28434
+ warn(degradeWarning(configPath, new Error("parsed value is not a JSON object")));
28435
+ return resolveBootstrapState({});
28436
+ }
28437
+ return resolveBootstrapState(parsed);
28438
+ }
28439
+ function degradeWarning(configPath, cause) {
28440
+ const error51 = new ConfigParseError(configPath, cause);
28441
+ return `${error51.name}: ${error51.message} \u2014 rendering the registry bootstrap defaults; ${configPath} was not written`;
28442
+ }
28443
+ function readSource(options) {
28444
+ if (options.source !== undefined)
28445
+ return options.source;
28446
+ if (options.sourcePath !== undefined) {
28447
+ const text = readFileOrNull(options.sourcePath);
28448
+ if (text === null) {
28449
+ throw new BootstrapEngineError("BootstrapSourceUnreadableError", `could not read the bootstrap source at ${options.sourcePath}`, [options.sourcePath]);
28450
+ }
28451
+ return text;
28452
+ }
28453
+ throw new BootstrapEngineError("BootstrapSourceUnavailableError", "no bootstrap source given \u2014 pass `source` (the skills/AGENTS.md text) or `sourcePath`", ["source", "sourcePath"]);
28454
+ }
28455
+ function applyHost(input) {
28456
+ const { host, source, state, targetHome, hostRoot, dryRun } = input;
28457
+ let contractPath;
28458
+ let document2;
28459
+ try {
28460
+ contractPath = bootstrapContractPath(host, targetHome, hostRoot);
28461
+ document2 = wrapBootstrapBlock(renderBootstrap({ source, state, host, targetHome, hostRoot }).contract);
28462
+ } catch (error51) {
28463
+ return { host, status: "failed", reason: error51.message };
28464
+ }
28465
+ const wired = isWired(host, targetHome, hostRoot);
28466
+ const notWired = () => ({
28467
+ host,
28468
+ status: "written-not-wired",
28469
+ reason: notWiredReason(host, targetHome, hostRoot)
28470
+ });
28471
+ if (readFileOrNull(contractPath) === document2) {
28472
+ return wired ? { host, status: "skipped", reason: `${contractPath} is already up to date` } : notWired();
28473
+ }
28474
+ if (!dryRun) {
28475
+ try {
28476
+ writeFileAtomically(contractPath, document2);
28477
+ } catch (error51) {
28478
+ return {
28479
+ host,
28480
+ status: "failed",
28481
+ reason: `could not write ${contractPath}: ${error51.message}`
28482
+ };
28483
+ }
28484
+ }
28485
+ return wired ? { host, status: "written" } : notWired();
28486
+ }
28487
+ function wiringArtifact(host, targetHome, hostRoot) {
28488
+ const root = resolveHostRoot(host, targetHome, hostRoot);
28489
+ const contractPath = path14.join(root, CONTRACT_FILENAME);
28490
+ switch (host) {
28491
+ case "claude":
28492
+ return { file: path14.join(root, "CLAUDE.md"), token: `@${CONTRACT_FILENAME}` };
28493
+ case "codex":
28494
+ case "cursor":
28495
+ return { file: path14.join(root, "AGENTS.md"), token: contractPath };
28496
+ case "opencode":
28497
+ return { file: openCodeConfigPath(root), token: `"${contractPath}"` };
28498
+ }
28499
+ }
28500
+ function openCodeConfigPath(root) {
28501
+ const json2 = path14.join(root, "opencode.json");
28502
+ if (fs10.existsSync(json2))
28503
+ return json2;
28504
+ return path14.join(root, "opencode.jsonc");
28505
+ }
28506
+ function isWired(host, targetHome, hostRoot) {
28507
+ const artifact = wiringArtifact(host, targetHome, hostRoot);
28508
+ const text = readFileOrNull(artifact.file);
28509
+ return text !== null && text.includes(artifact.token);
28510
+ }
28511
+ function notWiredReason(host, targetHome, hostRoot) {
28512
+ const artifact = wiringArtifact(host, targetHome, hostRoot);
28513
+ return `contract written, but ${host} has no artifact that loads it \u2014 expected ${artifact.token} in ${artifact.file}; run ${WIRING_REMEDY} to add the wiring`;
28514
+ }
28515
+ function readFileOrNull(filePath) {
28516
+ try {
28517
+ return fs10.readFileSync(filePath, "utf-8");
28518
+ } catch {
28519
+ return null;
28520
+ }
28521
+ }
28522
+ function isPlainObject5(value) {
28523
+ return typeof value === "object" && value !== null && !Array.isArray(value);
28524
+ }
28525
+ var INSTALL_STATE_FILENAME = "install-state.json", WIRING_REMEDY = "scripts/install-skills.sh --apply", BootstrapEngineError;
28526
+ var init_engine2 = __esm(() => {
28527
+ init_config_loader();
28528
+ init_hosts();
28529
+ init_state();
28530
+ init_render();
28531
+ init_report();
28532
+ init_state2();
28533
+ BootstrapEngineError = class BootstrapEngineError extends Error {
28534
+ details;
28535
+ constructor(name, message, details = []) {
28536
+ super(message);
28537
+ this.name = name;
28538
+ this.details = details;
28539
+ }
28540
+ };
28541
+ });
28542
+
28543
+ // ../../packages/shared/dist/bootstrap/format.js
28544
+ function enabledWord(enabled) {
28545
+ return enabled ? "enabled" : "disabled";
28546
+ }
28547
+ function formatBootstrapInventory(state) {
28548
+ return BOOTSTRAP_RULES.map((rule) => {
28549
+ const current = enabledWord(state[rule.id]);
28550
+ const fallback = enabledWord(rule.defaultEnabled);
28551
+ return ` ${rule.id}: ${current} (default: ${fallback}) \u2014 ${rule.description}`;
28552
+ }).join(`
28553
+ `);
28554
+ }
28555
+ function formatBootstrapReport(report) {
28556
+ const dryRunSuffix = report.dryRun ? " (dry run \u2014 no files changed)" : "";
28557
+ const lines = [];
28558
+ if (report.rows.length === 0) {
28559
+ lines.push(`bootstrap: no host installed${dryRunSuffix}`);
28560
+ } else {
28561
+ lines.push(`bootstrap: ${report.rows.length} host(s)${dryRunSuffix}`);
28562
+ for (const row of report.rows) {
28563
+ const detail = row.reason ? `: ${row.reason}` : "";
28564
+ lines.push(` ${row.host}: ${row.status}${detail}`);
28565
+ }
28566
+ }
28567
+ if (report.ignoredStateKeys.length > 0) {
28568
+ lines.push("", `Ignored persisted rule state: ${report.ignoredStateKeys.join(", ")} \u2014 not a known rule id with a boolean value.`);
28569
+ }
28570
+ if (report.restartRequired) {
28571
+ lines.push("", "A host session restart is required for the change to take effect.");
28572
+ }
28573
+ return lines.join(`
28574
+ `);
28575
+ }
28576
+ var init_format = __esm(() => {
28577
+ init_rules();
28578
+ });
28579
+
28580
+ // ../../packages/shared/dist/bootstrap/index.js
28581
+ var init_bootstrap = __esm(() => {
28582
+ init_rules();
28583
+ init_state2();
28584
+ init_render();
28585
+ init_report();
28586
+ init_engine2();
28587
+ init_format();
28588
+ init_config_loader();
28589
+ });
28590
+
27910
28591
  // ../../packages/shared/dist/index.js
27911
28592
  var init_dist = __esm(() => {
27912
28593
  init_env();
@@ -27917,6 +28598,7 @@ var init_dist = __esm(() => {
27917
28598
  init_engine();
27918
28599
  init_variant_sync();
27919
28600
  init_repo_root();
28601
+ init_bootstrap();
27920
28602
  init_types2();
27921
28603
  init_interfaces();
27922
28604
  init_utils();
@@ -29438,7 +30120,7 @@ var import_brace_expansion, minimatch = (p, pattern, options = {}) => {
29438
30120
  }, qmarksTestNoExtDot = ([$0]) => {
29439
30121
  const len = $0.length;
29440
30122
  return (f) => f.length === len && f !== "." && f !== "..";
29441
- }, defaultPlatform, path13, 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) => {
30123
+ }, 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) => {
29442
30124
  if (!def || typeof def !== "object" || !Object.keys(def).length) {
29443
30125
  return minimatch;
29444
30126
  }
@@ -29496,11 +30178,11 @@ var init_esm = __esm(() => {
29496
30178
  starRE = /^\*+$/;
29497
30179
  qmarksRE = /^\?+([^+@!?\*\[\(]*)?$/;
29498
30180
  defaultPlatform = typeof process === "object" && process ? typeof process.env === "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
29499
- path13 = {
30181
+ path15 = {
29500
30182
  win32: { sep: "\\" },
29501
30183
  posix: { sep: "/" }
29502
30184
  };
29503
- sep = defaultPlatform === "win32" ? path13.win32.sep : path13.posix.sep;
30185
+ sep = defaultPlatform === "win32" ? path15.win32.sep : path15.posix.sep;
29504
30186
  minimatch.sep = sep;
29505
30187
  GLOBSTAR = Symbol("globstar **");
29506
30188
  minimatch.GLOBSTAR = GLOBSTAR;
@@ -31466,12 +32148,12 @@ var init_esm4 = __esm(() => {
31466
32148
  childrenCache() {
31467
32149
  return this.#children;
31468
32150
  }
31469
- resolve(path14) {
31470
- if (!path14) {
32151
+ resolve(path16) {
32152
+ if (!path16) {
31471
32153
  return this;
31472
32154
  }
31473
- const rootPath = this.getRootString(path14);
31474
- const dir = path14.substring(rootPath.length);
32155
+ const rootPath = this.getRootString(path16);
32156
+ const dir = path16.substring(rootPath.length);
31475
32157
  const dirParts = dir.split(this.splitSep);
31476
32158
  const result = rootPath ? this.getRoot(rootPath).#resolveParts(dirParts) : this.#resolveParts(dirParts);
31477
32159
  return result;
@@ -31999,8 +32681,8 @@ var init_esm4 = __esm(() => {
31999
32681
  newChild(name, type = UNKNOWN, opts = {}) {
32000
32682
  return new PathWin32(name, type, this.root, this.roots, this.nocase, this.childrenCache(), opts);
32001
32683
  }
32002
- getRootString(path14) {
32003
- return win32.parse(path14).root;
32684
+ getRootString(path16) {
32685
+ return win32.parse(path16).root;
32004
32686
  }
32005
32687
  getRoot(rootPath) {
32006
32688
  rootPath = uncToDrive(rootPath.toUpperCase());
@@ -32025,8 +32707,8 @@ var init_esm4 = __esm(() => {
32025
32707
  constructor(name, type = UNKNOWN, root, roots, nocase, children, opts) {
32026
32708
  super(name, type, root, roots, nocase, children, opts);
32027
32709
  }
32028
- getRootString(path14) {
32029
- return path14.startsWith("/") ? "/" : "";
32710
+ getRootString(path16) {
32711
+ return path16.startsWith("/") ? "/" : "";
32030
32712
  }
32031
32713
  getRoot(_rootPath) {
32032
32714
  return this.root;
@@ -32045,8 +32727,8 @@ var init_esm4 = __esm(() => {
32045
32727
  #children;
32046
32728
  nocase;
32047
32729
  #fs;
32048
- constructor(cwd = process.cwd(), pathImpl, sep2, { nocase, childrenCacheSize = 16 * 1024, fs: fs9 = defaultFS } = {}) {
32049
- this.#fs = fsFromOption(fs9);
32730
+ constructor(cwd = process.cwd(), pathImpl, sep2, { nocase, childrenCacheSize = 16 * 1024, fs: fs11 = defaultFS } = {}) {
32731
+ this.#fs = fsFromOption(fs11);
32050
32732
  if (cwd instanceof URL || cwd.startsWith("file://")) {
32051
32733
  cwd = fileURLToPath(cwd);
32052
32734
  }
@@ -32082,11 +32764,11 @@ var init_esm4 = __esm(() => {
32082
32764
  }
32083
32765
  this.cwd = prev;
32084
32766
  }
32085
- depth(path14 = this.cwd) {
32086
- if (typeof path14 === "string") {
32087
- path14 = this.cwd.resolve(path14);
32767
+ depth(path16 = this.cwd) {
32768
+ if (typeof path16 === "string") {
32769
+ path16 = this.cwd.resolve(path16);
32088
32770
  }
32089
- return path14.depth();
32771
+ return path16.depth();
32090
32772
  }
32091
32773
  childrenCache() {
32092
32774
  return this.#children;
@@ -32502,9 +33184,9 @@ var init_esm4 = __esm(() => {
32502
33184
  process4();
32503
33185
  return results;
32504
33186
  }
32505
- chdir(path14 = this.cwd) {
33187
+ chdir(path16 = this.cwd) {
32506
33188
  const oldCwd = this.cwd;
32507
- this.cwd = typeof path14 === "string" ? this.cwd.resolve(path14) : path14;
33189
+ this.cwd = typeof path16 === "string" ? this.cwd.resolve(path16) : path16;
32508
33190
  this.cwd[setAsCwd](oldCwd);
32509
33191
  }
32510
33192
  };
@@ -32521,8 +33203,8 @@ var init_esm4 = __esm(() => {
32521
33203
  parseRootPath(dir) {
32522
33204
  return win32.parse(dir).root.toUpperCase();
32523
33205
  }
32524
- newRoot(fs9) {
32525
- return new PathWin32(this.rootPath, IFDIR, undefined, this.roots, this.nocase, this.childrenCache(), { fs: fs9 });
33206
+ newRoot(fs11) {
33207
+ return new PathWin32(this.rootPath, IFDIR, undefined, this.roots, this.nocase, this.childrenCache(), { fs: fs11 });
32526
33208
  }
32527
33209
  isAbsolute(p) {
32528
33210
  return p.startsWith("/") || p.startsWith("\\") || /^[a-z]:(\/|\\)/i.test(p);
@@ -32538,8 +33220,8 @@ var init_esm4 = __esm(() => {
32538
33220
  parseRootPath(_dir) {
32539
33221
  return "/";
32540
33222
  }
32541
- newRoot(fs9) {
32542
- return new PathPosix(this.rootPath, IFDIR, undefined, this.roots, this.nocase, this.childrenCache(), { fs: fs9 });
33223
+ newRoot(fs11) {
33224
+ return new PathPosix(this.rootPath, IFDIR, undefined, this.roots, this.nocase, this.childrenCache(), { fs: fs11 });
32543
33225
  }
32544
33226
  isAbsolute(p) {
32545
33227
  return p.startsWith("/");
@@ -32796,8 +33478,8 @@ class MatchRecord {
32796
33478
  this.store.set(target, current === undefined ? n : n & current);
32797
33479
  }
32798
33480
  entries() {
32799
- return [...this.store.entries()].map(([path14, n]) => [
32800
- path14,
33481
+ return [...this.store.entries()].map(([path16, n]) => [
33482
+ path16,
32801
33483
  !!(n & 2),
32802
33484
  !!(n & 1)
32803
33485
  ]);
@@ -33001,9 +33683,9 @@ class GlobUtil {
33001
33683
  signal;
33002
33684
  maxDepth;
33003
33685
  includeChildMatches;
33004
- constructor(patterns, path14, opts) {
33686
+ constructor(patterns, path16, opts) {
33005
33687
  this.patterns = patterns;
33006
- this.path = path14;
33688
+ this.path = path16;
33007
33689
  this.opts = opts;
33008
33690
  this.#sep = !opts.posix && opts.platform === "win32" ? "\\" : "/";
33009
33691
  this.includeChildMatches = opts.includeChildMatches !== false;
@@ -33022,11 +33704,11 @@ class GlobUtil {
33022
33704
  });
33023
33705
  }
33024
33706
  }
33025
- #ignored(path14) {
33026
- return this.seen.has(path14) || !!this.#ignore?.ignored?.(path14);
33707
+ #ignored(path16) {
33708
+ return this.seen.has(path16) || !!this.#ignore?.ignored?.(path16);
33027
33709
  }
33028
- #childrenIgnored(path14) {
33029
- return !!this.#ignore?.childrenIgnored?.(path14);
33710
+ #childrenIgnored(path16) {
33711
+ return !!this.#ignore?.childrenIgnored?.(path16);
33030
33712
  }
33031
33713
  pause() {
33032
33714
  this.paused = true;
@@ -33243,8 +33925,8 @@ var init_walker = __esm(() => {
33243
33925
  init_processor();
33244
33926
  GlobWalker = class GlobWalker extends GlobUtil {
33245
33927
  matches = new Set;
33246
- constructor(patterns, path14, opts) {
33247
- super(patterns, path14, opts);
33928
+ constructor(patterns, path16, opts) {
33929
+ super(patterns, path16, opts);
33248
33930
  }
33249
33931
  matchEmit(e) {
33250
33932
  this.matches.add(e);
@@ -33281,8 +33963,8 @@ var init_walker = __esm(() => {
33281
33963
  };
33282
33964
  GlobStream = class GlobStream extends GlobUtil {
33283
33965
  results;
33284
- constructor(patterns, path14, opts) {
33285
- super(patterns, path14, opts);
33966
+ constructor(patterns, path16, opts) {
33967
+ super(patterns, path16, opts);
33286
33968
  this.results = new Minipass({
33287
33969
  signal: this.signal,
33288
33970
  objectMode: true
@@ -33710,20 +34392,20 @@ var require_ignore = __commonJS((exports, module) => {
33710
34392
  var throwError = (message, Ctor) => {
33711
34393
  throw new Ctor(message);
33712
34394
  };
33713
- var checkPath = (path14, originalPath, doThrow) => {
33714
- if (!isString(path14)) {
34395
+ var checkPath = (path16, originalPath, doThrow) => {
34396
+ if (!isString(path16)) {
33715
34397
  return doThrow(`path must be a string, but got \`${originalPath}\``, TypeError);
33716
34398
  }
33717
- if (!path14) {
34399
+ if (!path16) {
33718
34400
  return doThrow(`path must not be empty`, TypeError);
33719
34401
  }
33720
- if (checkPath.isNotRelative(path14)) {
34402
+ if (checkPath.isNotRelative(path16)) {
33721
34403
  const r = "`path.relative()`d";
33722
34404
  return doThrow(`path should be a ${r} string, but got "${originalPath}"`, RangeError);
33723
34405
  }
33724
34406
  return true;
33725
34407
  };
33726
- var isNotRelative = (path14) => REGEX_TEST_INVALID_PATH.test(path14);
34408
+ var isNotRelative = (path16) => REGEX_TEST_INVALID_PATH.test(path16);
33727
34409
  checkPath.isNotRelative = isNotRelative;
33728
34410
  checkPath.convert = (p) => p;
33729
34411
 
@@ -33766,7 +34448,7 @@ var require_ignore = __commonJS((exports, module) => {
33766
34448
  addPattern(pattern) {
33767
34449
  return this.add(pattern);
33768
34450
  }
33769
- _testOne(path14, checkUnignored) {
34451
+ _testOne(path16, checkUnignored) {
33770
34452
  let ignored = false;
33771
34453
  let unignored = false;
33772
34454
  this._rules.forEach((rule) => {
@@ -33774,7 +34456,7 @@ var require_ignore = __commonJS((exports, module) => {
33774
34456
  if (unignored === negative && ignored !== unignored || negative && !ignored && !unignored && !checkUnignored) {
33775
34457
  return;
33776
34458
  }
33777
- const matched = rule.regex.test(path14);
34459
+ const matched = rule.regex.test(path16);
33778
34460
  if (matched) {
33779
34461
  ignored = !negative;
33780
34462
  unignored = negative;
@@ -33786,39 +34468,39 @@ var require_ignore = __commonJS((exports, module) => {
33786
34468
  };
33787
34469
  }
33788
34470
  _test(originalPath, cache, checkUnignored, slices) {
33789
- const path14 = originalPath && checkPath.convert(originalPath);
33790
- checkPath(path14, originalPath, this._allowRelativePaths ? RETURN_FALSE : throwError);
33791
- return this._t(path14, cache, checkUnignored, slices);
34471
+ const path16 = originalPath && checkPath.convert(originalPath);
34472
+ checkPath(path16, originalPath, this._allowRelativePaths ? RETURN_FALSE : throwError);
34473
+ return this._t(path16, cache, checkUnignored, slices);
33792
34474
  }
33793
- _t(path14, cache, checkUnignored, slices) {
33794
- if (path14 in cache) {
33795
- return cache[path14];
34475
+ _t(path16, cache, checkUnignored, slices) {
34476
+ if (path16 in cache) {
34477
+ return cache[path16];
33796
34478
  }
33797
34479
  if (!slices) {
33798
- slices = path14.split(SLASH);
34480
+ slices = path16.split(SLASH);
33799
34481
  }
33800
34482
  slices.pop();
33801
34483
  if (!slices.length) {
33802
- return cache[path14] = this._testOne(path14, checkUnignored);
34484
+ return cache[path16] = this._testOne(path16, checkUnignored);
33803
34485
  }
33804
34486
  const parent = this._t(slices.join(SLASH) + SLASH, cache, checkUnignored, slices);
33805
- return cache[path14] = parent.ignored ? parent : this._testOne(path14, checkUnignored);
34487
+ return cache[path16] = parent.ignored ? parent : this._testOne(path16, checkUnignored);
33806
34488
  }
33807
- ignores(path14) {
33808
- return this._test(path14, this._ignoreCache, false).ignored;
34489
+ ignores(path16) {
34490
+ return this._test(path16, this._ignoreCache, false).ignored;
33809
34491
  }
33810
34492
  createFilter() {
33811
- return (path14) => !this.ignores(path14);
34493
+ return (path16) => !this.ignores(path16);
33812
34494
  }
33813
34495
  filter(paths) {
33814
34496
  return makeArray(paths).filter(this.createFilter());
33815
34497
  }
33816
- test(path14) {
33817
- return this._test(path14, this._testCache, true);
34498
+ test(path16) {
34499
+ return this._test(path16, this._testCache, true);
33818
34500
  }
33819
34501
  }
33820
34502
  var factory = (options) => new Ignore2(options);
33821
- var isPathValid = (path14) => checkPath(path14 && checkPath.convert(path14), path14, RETURN_FALSE);
34503
+ var isPathValid = (path16) => checkPath(path16 && checkPath.convert(path16), path16, RETURN_FALSE);
33822
34504
  factory.isPathValid = isPathValid;
33823
34505
  factory.default = factory;
33824
34506
  module.exports = factory;
@@ -33826,7 +34508,7 @@ var require_ignore = __commonJS((exports, module) => {
33826
34508
  const makePosix = (str) => /^\\\\\?\\/.test(str) || /["<>|\u0000-\u001F]+/u.test(str) ? str : str.replace(/\\/g, "/");
33827
34509
  checkPath.convert = makePosix;
33828
34510
  const REGIX_IS_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i;
33829
- checkPath.isNotRelative = (path14) => REGIX_IS_WINDOWS_PATH_ABSOLUTE.test(path14) || isNotRelative(path14);
34511
+ checkPath.isNotRelative = (path16) => REGIX_IS_WINDOWS_PATH_ABSOLUTE.test(path16) || isNotRelative(path16);
33830
34512
  }
33831
34513
  });
33832
34514
 
@@ -33888,13 +34570,13 @@ function validatePolicy(policy, opts = {}) {
33888
34570
  }
33889
34571
  }
33890
34572
  }
33891
- function matchesGlob2(path14, pattern) {
34573
+ function matchesGlob2(path16, pattern) {
33892
34574
  let re = regexCache.get(pattern);
33893
34575
  if (!re) {
33894
34576
  re = globToRegex(pattern);
33895
34577
  regexCache.set(pattern, re);
33896
34578
  }
33897
- return re.test(path14);
34579
+ return re.test(path16);
33898
34580
  }
33899
34581
  var DEFAULT_POLICY, applyPolicy = (filePath, policy) => {
33900
34582
  const normalized = filePath.trim();
@@ -33911,8 +34593,8 @@ var init_capture_policy = __esm(() => {
33911
34593
  });
33912
34594
 
33913
34595
  // ../../packages/core/dist/services/search/ignore-patterns.js
33914
- import fs9 from "fs/promises";
33915
- import path14 from "path";
34596
+ import fs11 from "fs/promises";
34597
+ import path16 from "path";
33916
34598
  function buildExtensionGlob(extensions) {
33917
34599
  return extensions.map((ext2) => `**/*${ext2}`);
33918
34600
  }
@@ -33935,8 +34617,8 @@ async function loadProjectIgnore(projectPath) {
33935
34617
  const ig = ignore();
33936
34618
  ig.add(DEFAULT_IGNORES);
33937
34619
  try {
33938
- const gitignorePath = path14.join(projectPath, ".gitignore");
33939
- const gitignoreContent = await fs9.readFile(gitignorePath, "utf8");
34620
+ const gitignorePath = path16.join(projectPath, ".gitignore");
34621
+ const gitignoreContent = await fs11.readFile(gitignorePath, "utf8");
33940
34622
  const rules = gitignoreContent.split(`
33941
34623
  `).map((line) => line.trim()).filter((line) => line && !line.startsWith("#"));
33942
34624
  ig.add(rules);
@@ -35532,15 +36214,15 @@ var require_pg_connection_string = __commonJS((exports, module) => {
35532
36214
  if (config3.sslnegotiation === "direct" && config3.ssl === undefined) {
35533
36215
  config3.ssl = true;
35534
36216
  }
35535
- const fs10 = config3.sslcert || config3.sslkey || config3.sslrootcert ? __require("fs") : null;
36217
+ const fs12 = config3.sslcert || config3.sslkey || config3.sslrootcert ? __require("fs") : null;
35536
36218
  if (config3.sslcert) {
35537
- config3.ssl.cert = fs10.readFileSync(config3.sslcert).toString();
36219
+ config3.ssl.cert = fs12.readFileSync(config3.sslcert).toString();
35538
36220
  }
35539
36221
  if (config3.sslkey) {
35540
- config3.ssl.key = fs10.readFileSync(config3.sslkey).toString();
36222
+ config3.ssl.key = fs12.readFileSync(config3.sslkey).toString();
35541
36223
  }
35542
36224
  if (config3.sslrootcert) {
35543
- config3.ssl.ca = fs10.readFileSync(config3.sslrootcert).toString();
36225
+ config3.ssl.ca = fs12.readFileSync(config3.sslrootcert).toString();
35544
36226
  }
35545
36227
  if (options.useLibpqCompat && config3.uselibpqcompat) {
35546
36228
  throw new Error("Both useLibpqCompat and uselibpqcompat are set. Please use only one of them.");
@@ -37254,7 +37936,7 @@ var require_split2 = __commonJS((exports, module) => {
37254
37936
 
37255
37937
  // ../../node_modules/pgpass/lib/helper.js
37256
37938
  var require_helper = __commonJS((exports, module) => {
37257
- var path15 = __require("path");
37939
+ var path17 = __require("path");
37258
37940
  var Stream2 = __require("stream").Stream;
37259
37941
  var split = require_split2();
37260
37942
  var util3 = __require("util");
@@ -37294,7 +37976,7 @@ var require_helper = __commonJS((exports, module) => {
37294
37976
  };
37295
37977
  exports.getFileName = function(rawEnv) {
37296
37978
  var env = rawEnv || process.env;
37297
- var file2 = env.PGPASSFILE || (isWin ? path15.join(env.APPDATA || "./", "postgresql", "pgpass.conf") : path15.join(env.HOME || "./", ".pgpass"));
37979
+ var file2 = env.PGPASSFILE || (isWin ? path17.join(env.APPDATA || "./", "postgresql", "pgpass.conf") : path17.join(env.HOME || "./", ".pgpass"));
37298
37980
  return file2;
37299
37981
  };
37300
37982
  exports.usePgPass = function(stats, fname) {
@@ -37418,16 +38100,16 @@ var require_helper = __commonJS((exports, module) => {
37418
38100
 
37419
38101
  // ../../node_modules/pgpass/lib/index.js
37420
38102
  var require_lib = __commonJS((exports, module) => {
37421
- var path15 = __require("path");
37422
- var fs10 = __require("fs");
38103
+ var path17 = __require("path");
38104
+ var fs12 = __require("fs");
37423
38105
  var helper = require_helper();
37424
38106
  module.exports = function(connInfo, cb) {
37425
38107
  var file2 = helper.getFileName();
37426
- fs10.stat(file2, function(err, stat) {
38108
+ fs12.stat(file2, function(err, stat) {
37427
38109
  if (err || !helper.usePgPass(stat, file2)) {
37428
38110
  return cb(undefined);
37429
38111
  }
37430
- var st = fs10.createReadStream(file2);
38112
+ var st = fs12.createReadStream(file2);
37431
38113
  helper.getPassword(connInfo, st, cb);
37432
38114
  });
37433
38115
  };
@@ -39126,8 +39808,8 @@ var init_alias_resolver = __esm(() => {
39126
39808
  });
39127
39809
 
39128
39810
  // ../../packages/core/dist/services/search/index-manager.js
39129
- import fs10 from "fs";
39130
- import path15 from "path";
39811
+ import fs12 from "fs";
39812
+ import path17 from "path";
39131
39813
 
39132
39814
  class IndexManager {
39133
39815
  metadataCache = new Map;
@@ -39220,9 +39902,9 @@ class IndexManager {
39220
39902
  const fileMetadata = {};
39221
39903
  let totalSize = 0;
39222
39904
  for (const filePath of indexedFiles) {
39223
- const fullPath = path15.join(projectPath, filePath);
39905
+ const fullPath = path17.join(projectPath, filePath);
39224
39906
  try {
39225
- const stat = await fs10.promises.stat(fullPath);
39907
+ const stat = await fs12.promises.stat(fullPath);
39226
39908
  fileMetadata[filePath] = {
39227
39909
  path: filePath,
39228
39910
  mtime: stat.mtimeMs,
@@ -39273,9 +39955,9 @@ class IndexManager {
39273
39955
  if (ig.ignores(match2)) {
39274
39956
  continue;
39275
39957
  }
39276
- const fullPath = path15.join(projectPath, match2);
39958
+ const fullPath = path17.join(projectPath, match2);
39277
39959
  try {
39278
- const stat = await fs10.promises.stat(fullPath);
39960
+ const stat = await fs12.promises.stat(fullPath);
39279
39961
  files.set(match2, {
39280
39962
  path: match2,
39281
39963
  mtime: stat.mtimeMs,
@@ -42460,19 +43142,19 @@ var require_token_io = __commonJS((exports, module) => {
42460
43142
  getUserDataDir: () => getUserDataDir
42461
43143
  });
42462
43144
  module.exports = __toCommonJS2(token_io_exports);
42463
- var import_path9 = __toESM2(__require("path"));
42464
- var import_fs6 = __toESM2(__require("fs"));
43145
+ var import_path11 = __toESM2(__require("path"));
43146
+ var import_fs8 = __toESM2(__require("fs"));
42465
43147
  var import_os3 = __toESM2(__require("os"));
42466
43148
  var import_token_error = require_token_error();
42467
43149
  function findRootDir() {
42468
43150
  try {
42469
43151
  let dir = process.cwd();
42470
- while (dir !== import_path9.default.dirname(dir)) {
42471
- const pkgPath = import_path9.default.join(dir, ".vercel");
42472
- if (import_fs6.default.existsSync(pkgPath)) {
43152
+ while (dir !== import_path11.default.dirname(dir)) {
43153
+ const pkgPath = import_path11.default.join(dir, ".vercel");
43154
+ if (import_fs8.default.existsSync(pkgPath)) {
42473
43155
  return dir;
42474
43156
  }
42475
- dir = import_path9.default.dirname(dir);
43157
+ dir = import_path11.default.dirname(dir);
42476
43158
  }
42477
43159
  } catch (e) {
42478
43160
  throw new import_token_error.VercelOidcTokenError("Token refresh only supported in node server environments");
@@ -42485,9 +43167,9 @@ var require_token_io = __commonJS((exports, module) => {
42485
43167
  }
42486
43168
  switch (import_os3.default.platform()) {
42487
43169
  case "darwin":
42488
- return import_path9.default.join(import_os3.default.homedir(), "Library/Application Support");
43170
+ return import_path11.default.join(import_os3.default.homedir(), "Library/Application Support");
42489
43171
  case "linux":
42490
- return import_path9.default.join(import_os3.default.homedir(), ".local/share");
43172
+ return import_path11.default.join(import_os3.default.homedir(), ".local/share");
42491
43173
  case "win32":
42492
43174
  if (process.env.LOCALAPPDATA) {
42493
43175
  return process.env.LOCALAPPDATA;
@@ -42528,23 +43210,23 @@ var require_auth_config = __commonJS((exports, module) => {
42528
43210
  writeAuthConfig: () => writeAuthConfig
42529
43211
  });
42530
43212
  module.exports = __toCommonJS2(auth_config_exports);
42531
- var fs11 = __toESM2(__require("fs"));
42532
- var path16 = __toESM2(__require("path"));
43213
+ var fs13 = __toESM2(__require("fs"));
43214
+ var path18 = __toESM2(__require("path"));
42533
43215
  var import_token_util = require_token_util();
42534
43216
  function getAuthConfigPath() {
42535
43217
  const dataDir = (0, import_token_util.getVercelDataDir)();
42536
43218
  if (!dataDir) {
42537
43219
  throw new Error(`Unable to find Vercel CLI data directory. Your platform: ${process.platform}. Supported: darwin, linux, win32.`);
42538
43220
  }
42539
- return path16.join(dataDir, "auth.json");
43221
+ return path18.join(dataDir, "auth.json");
42540
43222
  }
42541
43223
  function readAuthConfig() {
42542
43224
  try {
42543
43225
  const authPath = getAuthConfigPath();
42544
- if (!fs11.existsSync(authPath)) {
43226
+ if (!fs13.existsSync(authPath)) {
42545
43227
  return null;
42546
43228
  }
42547
- const content = fs11.readFileSync(authPath, "utf8");
43229
+ const content = fs13.readFileSync(authPath, "utf8");
42548
43230
  if (!content) {
42549
43231
  return null;
42550
43232
  }
@@ -42555,11 +43237,11 @@ var require_auth_config = __commonJS((exports, module) => {
42555
43237
  }
42556
43238
  function writeAuthConfig(config3) {
42557
43239
  const authPath = getAuthConfigPath();
42558
- const authDir = path16.dirname(authPath);
42559
- if (!fs11.existsSync(authDir)) {
42560
- fs11.mkdirSync(authDir, { mode: 504, recursive: true });
43240
+ const authDir = path18.dirname(authPath);
43241
+ if (!fs13.existsSync(authDir)) {
43242
+ fs13.mkdirSync(authDir, { mode: 504, recursive: true });
42561
43243
  }
42562
- fs11.writeFileSync(authPath, JSON.stringify(config3, null, 2), { mode: 384 });
43244
+ fs13.writeFileSync(authPath, JSON.stringify(config3, null, 2), { mode: 384 });
42563
43245
  }
42564
43246
  function isValidAccessToken(authConfig, expirationBufferMs = 0) {
42565
43247
  if (!authConfig.token)
@@ -42734,8 +43416,8 @@ var require_token_util = __commonJS((exports, module) => {
42734
43416
  saveToken: () => saveToken
42735
43417
  });
42736
43418
  module.exports = __toCommonJS2(token_util_exports);
42737
- var path16 = __toESM2(__require("path"));
42738
- var fs11 = __toESM2(__require("fs"));
43419
+ var path18 = __toESM2(__require("path"));
43420
+ var fs13 = __toESM2(__require("fs"));
42739
43421
  var import_token_error = require_token_error();
42740
43422
  var import_token_io = require_token_io();
42741
43423
  var import_auth_config = require_auth_config();
@@ -42747,7 +43429,7 @@ var require_token_util = __commonJS((exports, module) => {
42747
43429
  if (!dataDir) {
42748
43430
  return null;
42749
43431
  }
42750
- return path16.join(dataDir, vercelFolder);
43432
+ return path18.join(dataDir, vercelFolder);
42751
43433
  }
42752
43434
  async function getVercelToken2(options) {
42753
43435
  const authConfig = (0, import_auth_config.readAuthConfig)();
@@ -42815,11 +43497,11 @@ var require_token_util = __commonJS((exports, module) => {
42815
43497
  if (!dir) {
42816
43498
  throw new import_token_error.VercelOidcTokenError("Unable to find project root directory. Have you linked your project with `vc link?`");
42817
43499
  }
42818
- const prjPath = path16.join(dir, ".vercel", "project.json");
42819
- if (!fs11.existsSync(prjPath)) {
43500
+ const prjPath = path18.join(dir, ".vercel", "project.json");
43501
+ if (!fs13.existsSync(prjPath)) {
42820
43502
  throw new import_token_error.VercelOidcTokenError("project.json not found, have you linked your project with `vc link?`");
42821
43503
  }
42822
- const prj = JSON.parse(fs11.readFileSync(prjPath, "utf8"));
43504
+ const prj = JSON.parse(fs13.readFileSync(prjPath, "utf8"));
42823
43505
  if (typeof prj.projectId !== "string" && typeof prj.orgId !== "string") {
42824
43506
  throw new TypeError("Expected a string-valued projectId property. Try running `vc link` to re-link your project.");
42825
43507
  }
@@ -42830,11 +43512,11 @@ var require_token_util = __commonJS((exports, module) => {
42830
43512
  if (!dir) {
42831
43513
  throw new import_token_error.VercelOidcTokenError("Unable to find user data directory. Please reach out to Vercel support.");
42832
43514
  }
42833
- const tokenPath = path16.join(dir, "com.vercel.token", `${projectId}.json`);
43515
+ const tokenPath = path18.join(dir, "com.vercel.token", `${projectId}.json`);
42834
43516
  const tokenJson = JSON.stringify(token);
42835
- fs11.mkdirSync(path16.dirname(tokenPath), { mode: 504, recursive: true });
42836
- fs11.writeFileSync(tokenPath, tokenJson);
42837
- fs11.chmodSync(tokenPath, 432);
43517
+ fs13.mkdirSync(path18.dirname(tokenPath), { mode: 504, recursive: true });
43518
+ fs13.writeFileSync(tokenPath, tokenJson);
43519
+ fs13.chmodSync(tokenPath, 432);
42838
43520
  return;
42839
43521
  }
42840
43522
  function loadToken(projectId) {
@@ -42842,11 +43524,11 @@ var require_token_util = __commonJS((exports, module) => {
42842
43524
  if (!dir) {
42843
43525
  throw new import_token_error.VercelOidcTokenError("Unable to find user data directory. Please reach out to Vercel support.");
42844
43526
  }
42845
- const tokenPath = path16.join(dir, "com.vercel.token", `${projectId}.json`);
42846
- if (!fs11.existsSync(tokenPath)) {
43527
+ const tokenPath = path18.join(dir, "com.vercel.token", `${projectId}.json`);
43528
+ if (!fs13.existsSync(tokenPath)) {
42847
43529
  return null;
42848
43530
  }
42849
- const token = JSON.parse(fs11.readFileSync(tokenPath, "utf8"));
43531
+ const token = JSON.parse(fs13.readFileSync(tokenPath, "utf8"));
42850
43532
  assertVercelOidcTokenResponse(token);
42851
43533
  return token;
42852
43534
  }
@@ -53688,37 +54370,37 @@ function createOpenAI(options = {}) {
53688
54370
  }, `ai-sdk/openai/${VERSION4}`);
53689
54371
  const createChatModel = (modelId) => new OpenAIChatLanguageModel(modelId, {
53690
54372
  provider: `${providerName}.chat`,
53691
- url: ({ path: path16 }) => `${baseURL}${path16}`,
54373
+ url: ({ path: path18 }) => `${baseURL}${path18}`,
53692
54374
  headers: getHeaders,
53693
54375
  fetch: options.fetch
53694
54376
  });
53695
54377
  const createCompletionModel = (modelId) => new OpenAICompletionLanguageModel(modelId, {
53696
54378
  provider: `${providerName}.completion`,
53697
- url: ({ path: path16 }) => `${baseURL}${path16}`,
54379
+ url: ({ path: path18 }) => `${baseURL}${path18}`,
53698
54380
  headers: getHeaders,
53699
54381
  fetch: options.fetch
53700
54382
  });
53701
54383
  const createEmbeddingModel = (modelId) => new OpenAIEmbeddingModel(modelId, {
53702
54384
  provider: `${providerName}.embedding`,
53703
- url: ({ path: path16 }) => `${baseURL}${path16}`,
54385
+ url: ({ path: path18 }) => `${baseURL}${path18}`,
53704
54386
  headers: getHeaders,
53705
54387
  fetch: options.fetch
53706
54388
  });
53707
54389
  const createImageModel = (modelId) => new OpenAIImageModel(modelId, {
53708
54390
  provider: `${providerName}.image`,
53709
- url: ({ path: path16 }) => `${baseURL}${path16}`,
54391
+ url: ({ path: path18 }) => `${baseURL}${path18}`,
53710
54392
  headers: getHeaders,
53711
54393
  fetch: options.fetch
53712
54394
  });
53713
54395
  const createTranscriptionModel = (modelId) => new OpenAITranscriptionModel(modelId, {
53714
54396
  provider: `${providerName}.transcription`,
53715
- url: ({ path: path16 }) => `${baseURL}${path16}`,
54397
+ url: ({ path: path18 }) => `${baseURL}${path18}`,
53716
54398
  headers: getHeaders,
53717
54399
  fetch: options.fetch
53718
54400
  });
53719
54401
  const createSpeechModel = (modelId) => new OpenAISpeechModel(modelId, {
53720
54402
  provider: `${providerName}.speech`,
53721
- url: ({ path: path16 }) => `${baseURL}${path16}`,
54403
+ url: ({ path: path18 }) => `${baseURL}${path18}`,
53722
54404
  headers: getHeaders,
53723
54405
  fetch: options.fetch
53724
54406
  });
@@ -53731,7 +54413,7 @@ function createOpenAI(options = {}) {
53731
54413
  const createResponsesModel = (modelId) => {
53732
54414
  return new OpenAIResponsesLanguageModel(modelId, {
53733
54415
  provider: `${providerName}.responses`,
53734
- url: ({ path: path16 }) => `${baseURL}${path16}`,
54416
+ url: ({ path: path18 }) => `${baseURL}${path18}`,
53735
54417
  headers: getHeaders,
53736
54418
  fetch: options.fetch,
53737
54419
  fileIdPrefixes: ["file-"]
@@ -70276,26 +70958,26 @@ var require_process = __commonJS((exports, module) => {
70276
70958
 
70277
70959
  // ../../node_modules/detect-libc/lib/filesystem.js
70278
70960
  var require_filesystem = __commonJS((exports, module) => {
70279
- var fs11 = __require("fs");
70961
+ var fs13 = __require("fs");
70280
70962
  var LDD_PATH = "/usr/bin/ldd";
70281
70963
  var SELF_PATH = "/proc/self/exe";
70282
70964
  var MAX_LENGTH = 2048;
70283
- var readFileSync2 = (path16) => {
70284
- const fd = fs11.openSync(path16, "r");
70965
+ var readFileSync2 = (path18) => {
70966
+ const fd = fs13.openSync(path18, "r");
70285
70967
  const buffer = Buffer.alloc(MAX_LENGTH);
70286
- const bytesRead = fs11.readSync(fd, buffer, 0, MAX_LENGTH, 0);
70287
- fs11.close(fd, () => {});
70968
+ const bytesRead = fs13.readSync(fd, buffer, 0, MAX_LENGTH, 0);
70969
+ fs13.close(fd, () => {});
70288
70970
  return buffer.subarray(0, bytesRead);
70289
70971
  };
70290
- var readFile = (path16) => new Promise((resolve4, reject) => {
70291
- fs11.open(path16, "r", (err, fd) => {
70972
+ var readFile = (path18) => new Promise((resolve4, reject) => {
70973
+ fs13.open(path18, "r", (err, fd) => {
70292
70974
  if (err) {
70293
70975
  reject(err);
70294
70976
  } else {
70295
70977
  const buffer = Buffer.alloc(MAX_LENGTH);
70296
- fs11.read(fd, buffer, 0, MAX_LENGTH, 0, (_, bytesRead) => {
70978
+ fs13.read(fd, buffer, 0, MAX_LENGTH, 0, (_, bytesRead) => {
70297
70979
  resolve4(buffer.subarray(0, bytesRead));
70298
- fs11.close(fd, () => {});
70980
+ fs13.close(fd, () => {});
70299
70981
  });
70300
70982
  }
70301
70983
  });
@@ -70400,11 +71082,11 @@ var require_detect_libc = __commonJS((exports, module) => {
70400
71082
  }
70401
71083
  return null;
70402
71084
  };
70403
- var familyFromInterpreterPath = (path16) => {
70404
- if (path16) {
70405
- if (path16.includes("/ld-musl-")) {
71085
+ var familyFromInterpreterPath = (path18) => {
71086
+ if (path18) {
71087
+ if (path18.includes("/ld-musl-")) {
70406
71088
  return MUSL;
70407
- } else if (path16.includes("/ld-linux-")) {
71089
+ } else if (path18.includes("/ld-linux-")) {
70408
71090
  return GLIBC;
70409
71091
  }
70410
71092
  }
@@ -70449,8 +71131,8 @@ var require_detect_libc = __commonJS((exports, module) => {
70449
71131
  cachedFamilyInterpreter = null;
70450
71132
  try {
70451
71133
  const selfContent = await readFile(SELF_PATH);
70452
- const path16 = interpreterPath(selfContent);
70453
- cachedFamilyInterpreter = familyFromInterpreterPath(path16);
71134
+ const path18 = interpreterPath(selfContent);
71135
+ cachedFamilyInterpreter = familyFromInterpreterPath(path18);
70454
71136
  } catch (e) {}
70455
71137
  return cachedFamilyInterpreter;
70456
71138
  };
@@ -70461,8 +71143,8 @@ var require_detect_libc = __commonJS((exports, module) => {
70461
71143
  cachedFamilyInterpreter = null;
70462
71144
  try {
70463
71145
  const selfContent = readFileSync2(SELF_PATH);
70464
- const path16 = interpreterPath(selfContent);
70465
- cachedFamilyInterpreter = familyFromInterpreterPath(path16);
71146
+ const path18 = interpreterPath(selfContent);
71147
+ cachedFamilyInterpreter = familyFromInterpreterPath(path18);
70466
71148
  } catch (e) {}
70467
71149
  return cachedFamilyInterpreter;
70468
71150
  };
@@ -72124,18 +72806,18 @@ var require_sharp = __commonJS((exports, module) => {
72124
72806
  `@img/sharp-${runtimePlatform}/sharp.node`,
72125
72807
  "@img/sharp-wasm32/sharp.node"
72126
72808
  ];
72127
- var path16;
72809
+ var path18;
72128
72810
  var sharp;
72129
72811
  var errors4 = [];
72130
- for (path16 of paths) {
72812
+ for (path18 of paths) {
72131
72813
  try {
72132
- sharp = __require(path16);
72814
+ sharp = __require(path18);
72133
72815
  break;
72134
72816
  } catch (err) {
72135
72817
  errors4.push(err);
72136
72818
  }
72137
72819
  }
72138
- if (sharp && path16.startsWith("@img/sharp-linux-x64") && !sharp._isUsingX64V2()) {
72820
+ if (sharp && path18.startsWith("@img/sharp-linux-x64") && !sharp._isUsingX64V2()) {
72139
72821
  const err = new Error("Prebuilt binaries for linux-x64 require v2 microarchitecture");
72140
72822
  err.code = "Unsupported CPU";
72141
72823
  errors4.push(err);
@@ -74997,15 +75679,15 @@ var require_color = __commonJS((exports, module) => {
74997
75679
  };
74998
75680
  }
74999
75681
  function wrapConversion(toModel, graph) {
75000
- const path16 = [graph[toModel].parent, toModel];
75682
+ const path18 = [graph[toModel].parent, toModel];
75001
75683
  let fn = conversions_default[graph[toModel].parent][toModel];
75002
75684
  let cur = graph[toModel].parent;
75003
75685
  while (graph[cur].parent) {
75004
- path16.unshift(graph[cur].parent);
75686
+ path18.unshift(graph[cur].parent);
75005
75687
  fn = link(conversions_default[graph[cur].parent][cur], fn);
75006
75688
  cur = graph[cur].parent;
75007
75689
  }
75008
- fn.conversion = path16;
75690
+ fn.conversion = path18;
75009
75691
  return fn;
75010
75692
  }
75011
75693
  function route(fromModel) {
@@ -75610,7 +76292,7 @@ var require_output = __commonJS((exports, module) => {
75610
76292
  Copyright 2013 Lovell Fuller and others.
75611
76293
  SPDX-License-Identifier: Apache-2.0
75612
76294
  */
75613
- var path16 = __require("path");
76295
+ var path18 = __require("path");
75614
76296
  var is = require_is();
75615
76297
  var sharp = require_sharp();
75616
76298
  var formats = new Map([
@@ -75641,9 +76323,9 @@ var require_output = __commonJS((exports, module) => {
75641
76323
  let err;
75642
76324
  if (!is.string(fileOut)) {
75643
76325
  err = new Error("Missing output file path");
75644
- } else if (is.string(this.options.input.file) && path16.resolve(this.options.input.file) === path16.resolve(fileOut)) {
76326
+ } else if (is.string(this.options.input.file) && path18.resolve(this.options.input.file) === path18.resolve(fileOut)) {
75645
76327
  err = new Error("Cannot use same file for input and output");
75646
- } else if (jp2Regex.test(path16.extname(fileOut)) && !this.constructor.format.jp2k.output.file) {
76328
+ } else if (jp2Regex.test(path18.extname(fileOut)) && !this.constructor.format.jp2k.output.file) {
75647
76329
  err = errJp2Save();
75648
76330
  }
75649
76331
  if (err) {
@@ -82890,11 +83572,11 @@ var init_transformers_node = __esm(() => {
82890
83572
  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}).`);
82891
83573
  }
82892
83574
  for (let i = 0;i < num_chunks; ++i) {
82893
- const path16 = `${baseName}_data${i === 0 ? "" : "_" + i}`;
82894
- const fullPath = `${options.subfolder ?? ""}/${path16}`;
83575
+ const path18 = `${baseName}_data${i === 0 ? "" : "_" + i}`;
83576
+ const fullPath = `${options.subfolder ?? ""}/${path18}`;
82895
83577
  externalDataPromises.push(new Promise(async (resolve4, reject) => {
82896
83578
  const data = await (0, _utils_hub_js__WEBPACK_IMPORTED_MODULE_5__.getModelFile)(pretrained_model_name_or_path, fullPath, true, options, return_path);
82897
- resolve4(data instanceof Uint8Array ? { path: path16, data } : path16);
83579
+ resolve4(data instanceof Uint8Array ? { path: path18, data } : path18);
82898
83580
  }));
82899
83581
  }
82900
83582
  } else if (session_options.externalData !== undefined) {
@@ -95958,7 +96640,7 @@ ${fake_token_around_image}` + `${global_img_token}` + image_token.repeat(image_s
95958
96640
  const blob = new Blob([wav], { type: "audio/wav" });
95959
96641
  return blob;
95960
96642
  }
95961
- async save(path16) {
96643
+ async save(path18) {
95962
96644
  let fn;
95963
96645
  if (_env_js__WEBPACK_IMPORTED_MODULE_3__.apis.IS_BROWSER_ENV) {
95964
96646
  if (_env_js__WEBPACK_IMPORTED_MODULE_3__.apis.IS_WEBWORKER_ENV) {
@@ -95966,14 +96648,14 @@ ${fake_token_around_image}` + `${global_img_token}` + image_token.repeat(image_s
95966
96648
  }
95967
96649
  fn = _core_js__WEBPACK_IMPORTED_MODULE_2__.saveBlob;
95968
96650
  } else if (_env_js__WEBPACK_IMPORTED_MODULE_3__.apis.IS_FS_AVAILABLE) {
95969
- fn = async (path17, blob) => {
96651
+ fn = async (path19, blob) => {
95970
96652
  let buffer = await blob.arrayBuffer();
95971
- node_fs__WEBPACK_IMPORTED_MODULE_5__["default"].writeFileSync(path17, Buffer.from(buffer));
96653
+ node_fs__WEBPACK_IMPORTED_MODULE_5__["default"].writeFileSync(path19, Buffer.from(buffer));
95972
96654
  };
95973
96655
  } else {
95974
96656
  throw new Error("Unable to save because filesystem is disabled in this environment.");
95975
96657
  }
95976
- await fn(path16, this.toBlob());
96658
+ await fn(path18, this.toBlob());
95977
96659
  }
95978
96660
  }
95979
96661
  },
@@ -96069,11 +96751,11 @@ ${fake_token_around_image}` + `${global_img_token}` + image_token.repeat(image_s
96069
96751
  function calculateReflectOffset(i, w) {
96070
96752
  return Math.abs((i + w) % (2 * w) - w);
96071
96753
  }
96072
- function saveBlob(path16, blob) {
96754
+ function saveBlob(path18, blob) {
96073
96755
  const dataURL = URL.createObjectURL(blob);
96074
96756
  const downloadLink = document.createElement("a");
96075
96757
  downloadLink.href = dataURL;
96076
- downloadLink.download = path16;
96758
+ downloadLink.download = path18;
96077
96759
  downloadLink.click();
96078
96760
  downloadLink.remove();
96079
96761
  URL.revokeObjectURL(dataURL);
@@ -96674,8 +97356,8 @@ ${fake_token_around_image}` + `${global_img_token}` + image_token.repeat(image_s
96674
97356
  }
96675
97357
 
96676
97358
  class FileCache {
96677
- constructor(path16) {
96678
- this.path = path16;
97359
+ constructor(path18) {
97360
+ this.path = path18;
96679
97361
  }
96680
97362
  async match(request) {
96681
97363
  let filePath = node_path__WEBPACK_IMPORTED_MODULE_1__["default"].join(this.path, request);
@@ -97431,20 +98113,20 @@ ${fake_token_around_image}` + `${global_img_token}` + image_token.repeat(image_s
97431
98113
  }
97432
98114
  return this;
97433
98115
  }
97434
- async save(path16) {
98116
+ async save(path18) {
97435
98117
  if (IS_BROWSER_OR_WEBWORKER) {
97436
98118
  if (_env_js__WEBPACK_IMPORTED_MODULE_2__.apis.IS_WEBWORKER_ENV) {
97437
98119
  throw new Error("Unable to save an image from a Web Worker.");
97438
98120
  }
97439
- const extension = path16.split(".").pop().toLowerCase();
98121
+ const extension = path18.split(".").pop().toLowerCase();
97440
98122
  const mime = CONTENT_TYPE_MAP.get(extension) ?? "image/png";
97441
98123
  const blob = await this.toBlob(mime);
97442
- (0, _core_js__WEBPACK_IMPORTED_MODULE_0__.saveBlob)(path16, blob);
98124
+ (0, _core_js__WEBPACK_IMPORTED_MODULE_0__.saveBlob)(path18, blob);
97443
98125
  } else if (!_env_js__WEBPACK_IMPORTED_MODULE_2__.apis.IS_FS_AVAILABLE) {
97444
98126
  throw new Error("Unable to save the image because filesystem is disabled in this environment.");
97445
98127
  } else {
97446
98128
  const img = this.toSharp();
97447
- return await img.toFile(path16);
98129
+ return await img.toFile(path18);
97448
98130
  }
97449
98131
  }
97450
98132
  toSharp() {
@@ -106975,10 +107657,10 @@ Note that ${s.bold("include")} statements only accept relation fields.`, a;
106975
107657
  super(t, "P2023", r);
106976
107658
  }
106977
107659
  };
106978
- var fs11 = new WeakMap;
107660
+ var fs13 = new WeakMap;
106979
107661
  function Ep(e) {
106980
- let t = fs11.get(e);
106981
- return t || (t = Object.entries(e), fs11.set(e, t)), t;
107662
+ let t = fs13.get(e);
107663
+ return t || (t = Object.entries(e), fs13.set(e, t)), t;
106982
107664
  }
106983
107665
  function hs(e, t, r) {
106984
107666
  switch (t.type) {
@@ -110946,7 +111628,7 @@ var require_prisma = __commonJS((exports) => {
110946
111628
  Prisma.JsonNull = JsonNull2;
110947
111629
  Prisma.AnyNull = AnyNull2;
110948
111630
  Prisma.NullTypes = NullTypes2;
110949
- var path16 = __require("path");
111631
+ var path18 = __require("path");
110950
111632
  exports.Prisma.TransactionIsolationLevel = makeStrictEnum2({
110951
111633
  ReadUncommitted: "ReadUncommitted",
110952
111634
  ReadCommitted: "ReadCommitted",
@@ -123819,10 +124501,10 @@ var init_chunker_code = __esm(() => {
123819
124501
  });
123820
124502
 
123821
124503
  // ../../packages/core/dist/services/search/smart-chunker.js
123822
- import path16 from "path";
124504
+ import path18 from "path";
123823
124505
  function smartChunk(content, filePath, config3 = {}) {
123824
124506
  const cfg = { ...DEFAULT_CONFIG, ...config3 };
123825
- const ext2 = path16.extname(filePath).toLowerCase();
124507
+ const ext2 = path18.extname(filePath).toLowerCase();
123826
124508
  const relativePath = filePath;
123827
124509
  const fileImports = isCodeFile(ext2) ? extractFileImports(content, ext2) : undefined;
123828
124510
  let chunks;
@@ -124129,8 +124811,8 @@ var init_managed_run_repository_pg = __esm(() => {
124129
124811
  });
124130
124812
 
124131
124813
  // ../../packages/core/dist/services/search/project-indexer.js
124132
- import fs11 from "fs/promises";
124133
- import path17 from "path";
124814
+ import fs13 from "fs/promises";
124815
+ import path19 from "path";
124134
124816
  import { randomUUID as randomUUID3 } from "crypto";
124135
124817
  async function runWithIndexLock(lockMap, projectId, work) {
124136
124818
  const prevLock = lockMap.get(projectId);
@@ -124173,7 +124855,7 @@ async function indexProjectInternal(deps, projectPath, projectId, options = {})
124173
124855
  dot: false
124174
124856
  });
124175
124857
  const filteredFiles = files.filter((file2) => {
124176
- const relativePath = path17.relative(projectPath, file2);
124858
+ const relativePath = path19.relative(projectPath, file2);
124177
124859
  const shouldIgnore = ig.ignores(relativePath);
124178
124860
  if (shouldIgnore) {
124179
124861
  logger.debug("Ignoring file per .gitignore during indexing", {
@@ -124213,7 +124895,7 @@ async function indexProjectInternal(deps, projectPath, projectId, options = {})
124213
124895
  });
124214
124896
  }
124215
124897
  }
124216
- const indexedFilesList = filteredFiles.map((f) => path17.relative(projectPath, f));
124898
+ const indexedFilesList = filteredFiles.map((f) => path19.relative(projectPath, f));
124217
124899
  await deps.indexManager.updateIndexMetadata(projectId, projectPath, indexedFilesList);
124218
124900
  logger.info("Project indexing completed", {
124219
124901
  projectId,
@@ -124338,7 +125020,7 @@ async function ensureFreshIndex(deps, projectId, projectPath, options = {}) {
124338
125020
  let errors4 = 0;
124339
125021
  for (const relativeFilePath of filesToReindex) {
124340
125022
  try {
124341
- const fullPath = path17.join(projectPath, relativeFilePath);
125023
+ const fullPath = path19.join(projectPath, relativeFilePath);
124342
125024
  const result = await deps.indexFile(fullPath, projectId, projectPath, centralityMap);
124343
125025
  filesIndexed++;
124344
125026
  chunksIndexed += result.chunks;
@@ -124389,8 +125071,8 @@ async function checkSearchAdmission(deps, projectId, projectPath) {
124389
125071
  }
124390
125072
  async function indexFile(deps, filePath, projectId, projectRoot, centralityMap) {
124391
125073
  projectId = await getProjectIdentityAliasResolver().resolve(projectId);
124392
- const content = await fs11.readFile(filePath, "utf-8");
124393
- const relativePath = path17.relative(projectRoot, filePath);
125074
+ const content = await fs13.readFile(filePath, "utf-8");
125075
+ const relativePath = path19.relative(projectRoot, filePath);
124394
125076
  const maxFileSize = config2.get("security").maxFileSize || 1024 * 1024;
124395
125077
  if (content.length > maxFileSize) {
124396
125078
  logger.warn("File too large, skipping", {
@@ -124410,7 +125092,7 @@ async function indexFile(deps, filePath, projectId, projectRoot, centralityMap)
124410
125092
  chunkIndex: i,
124411
125093
  totalChunks: chunks.length,
124412
125094
  type: chunk.type,
124413
- language: path17.extname(filePath).slice(1),
125095
+ language: path19.extname(filePath).slice(1),
124414
125096
  lineStart: chunk.lineStart,
124415
125097
  lineEnd: chunk.lineEnd,
124416
125098
  label: chunk.label,
@@ -125255,8 +125937,8 @@ function stripNul(content) {
125255
125937
  }
125256
125938
 
125257
125939
  // ../../packages/core/dist/services/etl/stages/discover.js
125258
- import fs12 from "fs/promises";
125259
- import path18 from "path";
125940
+ import fs14 from "fs/promises";
125941
+ import path20 from "path";
125260
125942
  import { createHash as createHash5 } from "crypto";
125261
125943
 
125262
125944
  class DiscoverStage {
@@ -125282,7 +125964,7 @@ class DiscoverStage {
125282
125964
  dot: false,
125283
125965
  absolute: false
125284
125966
  });
125285
- relPaths = found.map((p) => path18.isAbsolute(p) ? path18.relative(ctx.projectPath, p) : p).filter((p) => !ig.ignores(p) && applyPolicy(p, policy) !== "Drop");
125967
+ relPaths = found.map((p) => path20.isAbsolute(p) ? path20.relative(ctx.projectPath, p) : p).filter((p) => !ig.ignores(p) && applyPolicy(p, policy) !== "Drop");
125286
125968
  }
125287
125969
  if (ctx.resumeCursor?.path) {
125288
125970
  const cursorPath = ctx.resumeCursor.path;
@@ -125341,10 +126023,10 @@ class DiscoverStage {
125341
126023
  return discovered;
125342
126024
  }
125343
126025
  async processFile(ctx, relativePath, forceReindex) {
125344
- const absolutePath = path18.join(ctx.projectPath, relativePath);
126026
+ const absolutePath = path20.join(ctx.projectPath, relativePath);
125345
126027
  try {
125346
- const stat = await fs12.stat(absolutePath);
125347
- const content = stripNul(await fs12.readFile(absolutePath, "utf-8"));
126028
+ const stat = await fs14.stat(absolutePath);
126029
+ const content = stripNul(await fs14.readFile(absolutePath, "utf-8"));
125348
126030
  const contentHash = createHash5("sha256").update(content).digest("hex");
125349
126031
  let needsReparse = forceReindex;
125350
126032
  if (!forceReindex) {
@@ -125387,8 +126069,8 @@ class DiscoverStage {
125387
126069
  ig.add(pattern);
125388
126070
  }
125389
126071
  try {
125390
- const gitignorePath = path18.join(projectPath, ".gitignore");
125391
- const gitignoreContent = await fs12.readFile(gitignorePath, "utf8");
126072
+ const gitignorePath = path20.join(projectPath, ".gitignore");
126073
+ const gitignoreContent = await fs14.readFile(gitignorePath, "utf8");
125392
126074
  const rules = gitignoreContent.split(`
125393
126075
  `).map((line) => line.trim()).filter((line) => line && !line.startsWith("#"));
125394
126076
  ig.add(rules);
@@ -126743,8 +127425,8 @@ function rustUseLeaves(node, source, prefix = []) {
126743
127425
  }
126744
127426
  if (node.type === "use_wildcard")
126745
127427
  return [{ path: [...prefix, "*"], glob: true }];
126746
- const path19 = rustPathSegments(node, source);
126747
- return path19.length ? [{ path: [...prefix, ...path19] }] : [];
127428
+ const path21 = rustPathSegments(node, source);
127429
+ return path21.length ? [{ path: [...prefix, ...path21] }] : [];
126748
127430
  }
126749
127431
  function functionalCaptures(captures, source, family) {
126750
127432
  if (family !== "clojure")
@@ -127716,8 +128398,8 @@ var init_structural_runtime = __esm(() => {
127716
128398
  });
127717
128399
 
127718
128400
  // ../../packages/core/dist/services/etl/stages/parse.js
127719
- import path19 from "path";
127720
- import fs13 from "fs/promises";
128401
+ import path21 from "path";
128402
+ import fs15 from "fs/promises";
127721
128403
  function resolveChunkerMaxChars() {
127722
128404
  const global2 = Number(process.env.EMBEDDING_MAX_CHARS);
127723
128405
  if (Number.isFinite(global2) && global2 > 0)
@@ -127745,8 +128427,8 @@ class ParseStage {
127745
128427
  const results = new Map;
127746
128428
  let processed = 0;
127747
128429
  const phases = [
127748
- files.filter((file2) => path19.extname(file2.relativePath).toLowerCase() !== ".h"),
127749
- files.filter((file2) => path19.extname(file2.relativePath).toLowerCase() === ".h")
128430
+ files.filter((file2) => path21.extname(file2.relativePath).toLowerCase() !== ".h"),
128431
+ files.filter((file2) => path21.extname(file2.relativePath).toLowerCase() === ".h")
127750
128432
  ];
127751
128433
  const batches = phases.flatMap((phase) => Array.from({ length: Math.ceil(phase.length / BATCH_SIZE) }, (_, index) => phase.slice(index * BATCH_SIZE, (index + 1) * BATCH_SIZE)));
127752
128434
  for (const batch of batches) {
@@ -127784,19 +128466,19 @@ class ParseStage {
127784
128466
  return files.map((file2) => results.get(file2.relativePath));
127785
128467
  }
127786
128468
  recordHeaderImporterEvidence(ctx, files, parsedFiles) {
127787
- const knownHeaders = new Set(files.filter((file2) => path19.extname(file2.relativePath).toLowerCase() === ".h").map((file2) => path19.posix.normalize(file2.relativePath)));
128469
+ const knownHeaders = new Set(files.filter((file2) => path21.extname(file2.relativePath).toLowerCase() === ".h").map((file2) => path21.posix.normalize(file2.relativePath)));
127788
128470
  const mutable = {
127789
128471
  ...ctx.structuralHeaderEvidenceByFile
127790
128472
  };
127791
128473
  for (const parsed of parsedFiles) {
127792
- const extension = path19.extname(parsed.file.relativePath).toLowerCase();
128474
+ const extension = path21.extname(parsed.file.relativePath).toLowerCase();
127793
128475
  const key = extension === ".c" ? "cImporters" : [".cpp", ".hpp"].includes(extension) ? "cppImporters" : undefined;
127794
128476
  if (!key)
127795
128477
  continue;
127796
128478
  for (const imported of parsed.rawImports) {
127797
128479
  if (!["c_include", "cpp_include"].includes(imported.form) || imported.specifier.startsWith("<"))
127798
128480
  continue;
127799
- const header = path19.posix.normalize(path19.posix.join(path19.posix.dirname(parsed.file.relativePath), imported.specifier));
128481
+ const header = path21.posix.normalize(path21.posix.join(path21.posix.dirname(parsed.file.relativePath), imported.specifier));
127800
128482
  if (!knownHeaders.has(header))
127801
128483
  continue;
127802
128484
  const existing = mutable[header] ?? {};
@@ -127807,9 +128489,9 @@ class ParseStage {
127807
128489
  }
127808
128490
  async parseFile(ctx, file2) {
127809
128491
  if (!file2.needsReparse) {
127810
- const extension = path19.extname(file2.relativePath).toLowerCase();
128492
+ const extension = path21.extname(file2.relativePath).toLowerCase();
127811
128493
  if ([".c", ".cpp", ".hpp"].includes(extension)) {
127812
- const content = file2.snapshotContent ?? await fs13.readFile(file2.absolutePath, "utf8");
128494
+ const content = file2.snapshotContent ?? await fs15.readFile(file2.absolutePath, "utf8");
127813
128495
  const outcome = await this.runtime.parse({ extension, source: Buffer.from(content) });
127814
128496
  if (outcome.status === "failed")
127815
128497
  throw new StructuralEtlParseError(file2.relativePath, outcome.failureKind, `Structural evidence parse failed (${outcome.failureKind})`, outcome.diagnosticCount, outcome.diagnostics.slice(0, 10));
@@ -127821,8 +128503,8 @@ class ParseStage {
127821
128503
  return { file: file2, chunks: [], symbols: [], rawImports: [], rawEdges: [] };
127822
128504
  }
127823
128505
  try {
127824
- const content = file2.snapshotContent ?? await fs13.readFile(file2.absolutePath, "utf-8");
127825
- const ext2 = path19.extname(file2.relativePath).toLowerCase();
128506
+ const content = file2.snapshotContent ?? await fs15.readFile(file2.absolutePath, "utf-8");
128507
+ const ext2 = path21.extname(file2.relativePath).toLowerCase();
127826
128508
  const chunkerMaxChars = resolveChunkerMaxChars();
127827
128509
  const chunks = smartChunk(content, file2.relativePath, chunkerMaxChars ? { maxChunkChars: chunkerMaxChars } : {});
127828
128510
  let symbols;
@@ -128376,7 +129058,7 @@ var init_resolver = __esm(() => {
128376
129058
  });
128377
129059
 
128378
129060
  // ../../packages/core/dist/services/structural/resolvers/typescript.js
128379
- import path20 from "path";
129061
+ import path22 from "path";
128380
129062
  function candidates(identities) {
128381
129063
  return Object.freeze(identities.map((identity) => Object.freeze({
128382
129064
  fqn: identity.fqn,
@@ -128471,7 +129153,7 @@ function probe(base, known, dialect = "typescript") {
128471
129153
  const bases = /\.[cm]?jsx?$/u.test(base) ? [base.replace(/\.[cm]?jsx?$/u, ".ts"), base.replace(/\.[cm]?jsx?$/u, ".tsx"), base] : [base];
128472
129154
  for (const candidateBase of bases)
128473
129155
  for (const suffix of DIALECT_PROBES[dialect] ?? [""]) {
128474
- const value = path20.posix.normalize(`${candidateBase}${suffix}`);
129156
+ const value = path22.posix.normalize(`${candidateBase}${suffix}`);
128475
129157
  if (!value.startsWith("../") && value !== ".." && known.has(value))
128476
129158
  return value;
128477
129159
  }
@@ -128480,7 +129162,7 @@ function probe(base, known, dialect = "typescript") {
128480
129162
  function resolveStructuralSpecifier(specifier, fromFile, build, dialect = "typescript") {
128481
129163
  const known = new Set(build.knownFiles.map(normalizeStructuralFile));
128482
129164
  if (specifier.startsWith("./") || specifier.startsWith("../")) {
128483
- return probe(path20.posix.join(path20.posix.dirname(fromFile), specifier), known, dialect);
129165
+ return probe(path22.posix.join(path22.posix.dirname(fromFile), specifier), known, dialect);
128484
129166
  }
128485
129167
  const aliases = build.pathAliasesByFile?.[normalizeStructuralFile(fromFile)] ?? build.pathAliases ?? [];
128486
129168
  for (const alias of aliases) {
@@ -128744,7 +129426,7 @@ var init_scripting2 = __esm(() => {
128744
129426
  });
128745
129427
 
128746
129428
  // ../../packages/core/dist/services/structural/resolvers/systems.js
128747
- import path21 from "path";
129429
+ import path23 from "path";
128748
129430
  var DIALECTS, SYSTEMS_LANGUAGE_RESOLVER;
128749
129431
  var init_systems2 = __esm(() => {
128750
129432
  init_typescript2();
@@ -128763,7 +129445,7 @@ var init_systems2 = __esm(() => {
128763
129445
  const bindings = item.bindings.map((binding) => binding.imported === "*" && binding.local === "*" && unresolvedTarget && !unresolvedTarget.qualifier ? { ...binding, imported: unresolvedTarget.name, local: unresolvedTarget.name } : binding);
128764
129446
  if (item.specifier === "crate" || item.specifier.startsWith("crate/")) {
128765
129447
  const crateRoot = file2.file.startsWith("src/") ? "src" : "";
128766
- return { ...item, bindings, specifier: `./${path21.posix.relative(path21.posix.dirname(file2.file), path21.posix.join(crateRoot, item.specifier.replace(/^crate\/?/u, "")))}` };
129448
+ return { ...item, bindings, specifier: `./${path23.posix.relative(path23.posix.dirname(file2.file), path23.posix.join(crateRoot, item.specifier.replace(/^crate\/?/u, "")))}` };
128767
129449
  }
128768
129450
  if (item.specifier === "self" || item.specifier.startsWith("self/"))
128769
129451
  return { ...item, bindings, specifier: `./${item.specifier.replace(/^self\/?/u, "")}` };
@@ -128861,8 +129543,8 @@ var init_data_document2 = __esm(() => {
128861
129543
  });
128862
129544
 
128863
129545
  // ../../packages/core/dist/services/etl/stages/resolve.js
128864
- import path22 from "path";
128865
- import fs14 from "fs";
129546
+ import path24 from "path";
129547
+ import fs16 from "fs";
128866
129548
 
128867
129549
  class ResolveStage {
128868
129550
  symbolRepository;
@@ -128886,7 +129568,7 @@ class ResolveStage {
128886
129568
  const structuralDocuments = files.flatMap((file2) => {
128887
129569
  if (!file2.structure)
128888
129570
  return [];
128889
- const language = resolveStructuralLanguage(path22.extname(file2.file.relativePath));
129571
+ const language = resolveStructuralLanguage(path24.extname(file2.file.relativePath));
128890
129572
  if (language.status !== "supported")
128891
129573
  throw new Error(`structural_manifest_missing:${file2.file.relativePath}`);
128892
129574
  return [{
@@ -128898,13 +129580,13 @@ class ResolveStage {
128898
129580
  }];
128899
129581
  });
128900
129582
  const currentStructuralFiles = new Set(structuralDocuments.map((document2) => document2.file));
128901
- const skippedStructuralFiles = new Set(files.filter((item) => !item.file.needsReparse && STRUCTURAL_SEED_EXTENSIONS.has(path22.extname(item.file.relativePath).toLowerCase())).map((item) => item.file.relativePath));
129583
+ 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));
128902
129584
  const pathAliasesByFile = Object.fromEntries([...knownRelPaths].map((file2) => [
128903
129585
  file2,
128904
129586
  this.structuralAliasesFor(file2, rootAliases, monorepoPackages)
128905
129587
  ]));
128906
129588
  const buildMetadata = { knownFiles: [...knownRelPaths], pathAliasesByFile };
128907
- const seedRows = repositoryDefinitions.filter((definition) => STRUCTURAL_SEED_EXTENSIONS.has(path22.extname(definition.file_path).toLowerCase())).filter((definition) => knownRelPaths.has(definition.file_path) && skippedStructuralFiles.has(definition.file_path)).filter((definition) => !currentStructuralFiles.has(definition.file_path));
129589
+ 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));
128908
129590
  const seedIds = new Set;
128909
129591
  for (const definition of seedRows) {
128910
129592
  if (seedIds.has(definition.id))
@@ -128997,7 +129679,7 @@ class ResolveStage {
128997
129679
  if (parsed.file !== definition.file_path) {
128998
129680
  throw new Error(`structural_repository_seed_file_mismatch:${definition.id}`);
128999
129681
  }
129000
- const language = resolveStructuralLanguage(path22.extname(definition.file_path));
129682
+ const language = resolveStructuralLanguage(path24.extname(definition.file_path));
129001
129683
  if (language.status !== "supported")
129002
129684
  throw new Error(`structural_repository_seed_language:${definition.id}`);
129003
129685
  let identity;
@@ -129049,7 +129731,7 @@ class ResolveStage {
129049
129731
  });
129050
129732
  }
129051
129733
  resolveFile(parsed, projectPath, knownRelPaths, rootAliases, monorepoPackages, symbolIndex, knownFqns) {
129052
- const fromDir = path22.dirname(path22.join(projectPath, parsed.file.relativePath));
129734
+ const fromDir = path24.dirname(path24.join(projectPath, parsed.file.relativePath));
129053
129735
  const packageAliases = this.getPackageAliases(parsed.file.relativePath, monorepoPackages);
129054
129736
  const allAliases = [...packageAliases, ...rootAliases];
129055
129737
  const resolvedImports = parsed.rawImports.map((raw2) => {
@@ -129120,7 +129802,7 @@ class ResolveStage {
129120
129802
  index.set(def.name, `${def.file_path}#${def.name}`);
129121
129803
  }
129122
129804
  } catch (err) {
129123
- const skippedStructural = files.some((file2) => !file2.file.needsReparse && STRUCTURAL_SEED_EXTENSIONS.has(path22.extname(file2.file.relativePath).toLowerCase()));
129805
+ const skippedStructural = files.some((file2) => !file2.file.needsReparse && STRUCTURAL_SEED_EXTENSIONS.has(path24.extname(file2.file.relativePath).toLowerCase()));
129124
129806
  if (skippedStructural)
129125
129807
  throw new Error("structural_repository_seed_failed", { cause: err });
129126
129808
  logger.warn("buildSymbolIndex: repo seed failed, in-batch only", {
@@ -129144,7 +129826,7 @@ class ResolveStage {
129144
129826
  }
129145
129827
  resolveSpecifier(specifier, fromDir, projectPath, knownRelPaths, aliases) {
129146
129828
  if (specifier.startsWith("./") || specifier.startsWith("../")) {
129147
- const resolved = this.probeExtensions(path22.resolve(fromDir, specifier), projectPath, knownRelPaths);
129829
+ const resolved = this.probeExtensions(path24.resolve(fromDir, specifier), projectPath, knownRelPaths);
129148
129830
  return { resolvedPath: resolved, external: false };
129149
129831
  }
129150
129832
  for (const alias of aliases) {
@@ -129152,8 +129834,8 @@ class ResolveStage {
129152
129834
  const suffix = specifier.slice(alias.prefix.length);
129153
129835
  for (const target of alias.targets) {
129154
129836
  const cleanTarget = target.replace(/\/\*$/, "");
129155
- const basePath = alias.packagePath ? path22.join(projectPath, alias.packagePath) : projectPath;
129156
- const absPath = path22.join(basePath, cleanTarget + suffix);
129837
+ const basePath = alias.packagePath ? path24.join(projectPath, alias.packagePath) : projectPath;
129838
+ const absPath = path24.join(basePath, cleanTarget + suffix);
129157
129839
  const resolved = this.probeExtensions(absPath, projectPath, knownRelPaths);
129158
129840
  if (resolved)
129159
129841
  return { resolvedPath: resolved, external: false };
@@ -129169,7 +129851,7 @@ class ResolveStage {
129169
129851
  ...TS_EXTENSIONS.map((ext2) => absPath.replace(/\.[^.]+$/, ext2))
129170
129852
  ];
129171
129853
  for (const candidate2 of candidates2) {
129172
- const rel = path22.relative(projectPath, candidate2).replace(/\\/g, "/");
129854
+ const rel = path24.relative(projectPath, candidate2).replace(/\\/g, "/");
129173
129855
  if (knownRelPaths.has(rel))
129174
129856
  return rel;
129175
129857
  }
@@ -129177,9 +129859,9 @@ class ResolveStage {
129177
129859
  }
129178
129860
  loadTsConfigPaths(projectPath, packageBase) {
129179
129861
  const aliases = [];
129180
- const tsconfigPath = path22.join(projectPath, "tsconfig.json");
129862
+ const tsconfigPath = path24.join(projectPath, "tsconfig.json");
129181
129863
  try {
129182
- const raw2 = fs14.readFileSync(tsconfigPath, "utf-8");
129864
+ const raw2 = fs16.readFileSync(tsconfigPath, "utf-8");
129183
129865
  const stripped = raw2.replace(/\/\/[^\n]*/g, "").replace(/\/\*[\s\S]*?\*\//g, "");
129184
129866
  const tsconfig = JSON.parse(stripped);
129185
129867
  const paths = tsconfig?.compilerOptions?.paths ?? {};
@@ -129208,7 +129890,7 @@ class ResolveStage {
129208
129890
  }
129209
129891
  }
129210
129892
  for (const packageRelPath of packagePaths) {
129211
- const absPackagePath = path22.join(projectPath, packageRelPath);
129893
+ const absPackagePath = path24.join(projectPath, packageRelPath);
129212
129894
  const aliases = this.loadTsConfigPaths(absPackagePath, packageRelPath);
129213
129895
  if (aliases.length > 0) {
129214
129896
  packages.push({
@@ -129238,7 +129920,7 @@ class ResolveStage {
129238
129920
  structuralAliasesFor(filePath, rootAliases, packages) {
129239
129921
  return [...this.getPackageAliases(filePath, packages), ...rootAliases].map((alias) => ({
129240
129922
  pattern: alias.prefix + (alias.targets.some((target) => target.includes("*")) ? "/*" : ""),
129241
- targets: alias.targets.map((target) => alias.packagePath ? path22.posix.join(alias.packagePath, target) : target)
129923
+ targets: alias.targets.map((target) => alias.packagePath ? path24.posix.join(alias.packagePath, target) : target)
129242
129924
  }));
129243
129925
  }
129244
129926
  }
@@ -129302,7 +129984,7 @@ var init_with_deadlock_retry = __esm(() => {
129302
129984
  });
129303
129985
 
129304
129986
  // ../../packages/core/dist/services/etl/stages/load.js
129305
- import path23 from "path";
129987
+ import path25 from "path";
129306
129988
  function formatDuration(ms) {
129307
129989
  const totalSec = Math.max(0, Math.round(ms / 1000));
129308
129990
  if (totalSec < 60)
@@ -129579,7 +130261,7 @@ class LoadStage {
129579
130261
  const filePath = file2.file.relativePath;
129580
130262
  const batch = buildSymbolPersistenceBatch(ctx.projectId, file2);
129581
130263
  if (ctx.graphGenerationLease) {
129582
- const manifest = getLanguageManifestEntry(path23.extname(filePath));
130264
+ const manifest = getLanguageManifestEntry(path25.extname(filePath));
129583
130265
  const diagnostics2 = (file2.structuralDiagnostics ?? []).slice(0, 10).map((diagnostic2) => ({
129584
130266
  code: diagnostic2.code,
129585
130267
  severity: diagnostic2.severity,
@@ -130036,9 +130718,9 @@ var init_graph_generation_coordinator = __esm(() => {
130036
130718
  // ../../packages/core/dist/services/etl/pipeline.js
130037
130719
  import { createHash as createHash7 } from "crypto";
130038
130720
  import { setTimeout as delay2 } from "timers/promises";
130039
- import path24 from "path";
130721
+ import path26 from "path";
130040
130722
  function buildHeaderLanguageEvidence(files) {
130041
- const headers = new Set(files.filter((file2) => path24.posix.extname(file2.relativePath).toLowerCase() === ".h").map((file2) => path24.posix.normalize(file2.relativePath)));
130723
+ const headers = new Set(files.filter((file2) => path26.posix.extname(file2.relativePath).toLowerCase() === ".h").map((file2) => path26.posix.normalize(file2.relativePath)));
130042
130724
  const mutable = new Map;
130043
130725
  const entry2 = (header) => {
130044
130726
  let value = mutable.get(header);
@@ -130049,7 +130731,7 @@ function buildHeaderLanguageEvidence(files) {
130049
130731
  return value;
130050
130732
  };
130051
130733
  for (const file2 of files) {
130052
- if (path24.posix.basename(file2.relativePath) !== "compile_commands.json" || file2.snapshotContent === undefined)
130734
+ if (path26.posix.basename(file2.relativePath) !== "compile_commands.json" || file2.snapshotContent === undefined)
130053
130735
  continue;
130054
130736
  let commands;
130055
130737
  try {
@@ -130065,11 +130747,11 @@ function buildHeaderLanguageEvidence(files) {
130065
130747
  const record3 = command;
130066
130748
  if (typeof record3.file !== "string")
130067
130749
  continue;
130068
- const projectRoot = path24.resolve(file2.absolutePath, ...file2.relativePath.split("/").map(() => ".."));
130069
- const commandDirectory = typeof record3.directory === "string" ? path24.resolve(projectRoot, record3.directory) : projectRoot;
130070
- const absoluteInput = path24.resolve(commandDirectory, record3.file);
130071
- const relative2 = path24.relative(projectRoot, absoluteInput);
130072
- const header = path24.posix.normalize(relative2.replaceAll(path24.sep, "/"));
130750
+ const projectRoot = path26.resolve(file2.absolutePath, ...file2.relativePath.split("/").map(() => ".."));
130751
+ const commandDirectory = typeof record3.directory === "string" ? path26.resolve(projectRoot, record3.directory) : projectRoot;
130752
+ const absoluteInput = path26.resolve(commandDirectory, record3.file);
130753
+ const relative2 = path26.relative(projectRoot, absoluteInput);
130754
+ const header = path26.posix.normalize(relative2.replaceAll(path26.sep, "/"));
130073
130755
  if (!headers.has(header))
130074
130756
  continue;
130075
130757
  const invocation = typeof record3.command === "string" ? record3.command : Array.isArray(record3.arguments) ? record3.arguments.join(" ") : "";
@@ -130600,9 +131282,9 @@ var init_acquire_indexing_lease = __esm(() => {
130600
131282
 
130601
131283
  // ../../packages/core/dist/services/project-identity/project-root-identity.js
130602
131284
  import { realpath as realpath2 } from "fs/promises";
130603
- import path25 from "path";
131285
+ import path27 from "path";
130604
131286
  async function canonicalizeProjectRoot(projectPath, canonicalize = realpath2) {
130605
- return canonicalize(path25.resolve(projectPath));
131287
+ return canonicalize(path27.resolve(projectPath));
130606
131288
  }
130607
131289
  async function assertProjectRootReuse(options) {
130608
131290
  if (!options.storedProjectPath || options.forceReindex)
@@ -130610,9 +131292,9 @@ async function assertProjectRootReuse(options) {
130610
131292
  const canonicalize = options.canonicalize ?? realpath2;
130611
131293
  let storedCanonical;
130612
131294
  try {
130613
- storedCanonical = await canonicalize(path25.resolve(options.storedProjectPath));
131295
+ storedCanonical = await canonicalize(path27.resolve(options.storedProjectPath));
130614
131296
  } catch {
130615
- storedCanonical = path25.resolve(options.storedProjectPath);
131297
+ storedCanonical = path27.resolve(options.storedProjectPath);
130616
131298
  }
130617
131299
  if (storedCanonical !== options.canonicalProjectPath) {
130618
131300
  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");
@@ -131355,16 +132037,16 @@ function detectRoutes(httpEdges, defs, opts = {}) {
131355
132037
  const seen = new Set;
131356
132038
  const out = [];
131357
132039
  for (const e of httpEdges) {
131358
- const path26 = e.route;
131359
- if (!path26)
132040
+ const path28 = e.route;
132041
+ if (!path28)
131360
132042
  continue;
131361
132043
  const method = (e.method ?? "ANY").toUpperCase();
131362
- const key = method + " " + path26;
132044
+ const key = method + " " + path28;
131363
132045
  if (seen.has(key))
131364
132046
  continue;
131365
132047
  seen.add(key);
131366
132048
  out.push({
131367
- path: path26,
132049
+ path: path28,
131368
132050
  method: e.method,
131369
132051
  file: e.fromFile,
131370
132052
  handler: e.targetFqn ?? e.symbolName
@@ -131375,12 +132057,12 @@ function detectRoutes(httpEdges, defs, opts = {}) {
131375
132057
  continue;
131376
132058
  const parsed = parseRouteName(d.name);
131377
132059
  const method = parsed?.method ?? "ANY";
131378
- const path26 = parsed?.path ?? d.name;
131379
- const key = method + " " + path26;
132060
+ const path28 = parsed?.path ?? d.name;
132061
+ const key = method + " " + path28;
131380
132062
  if (seen.has(key))
131381
132063
  continue;
131382
132064
  seen.add(key);
131383
- out.push({ path: path26, method: parsed?.method, file: d.filePath, handler: d.name });
132065
+ out.push({ path: path28, method: parsed?.method, file: d.filePath, handler: d.name });
131384
132066
  }
131385
132067
  for (const d of defs) {
131386
132068
  const parsed = parseRouteName(d.name);
@@ -131601,8 +132283,8 @@ __export(exports_symbol_graph_service, {
131601
132283
  symbolGraphService: () => symbolGraphService,
131602
132284
  SymbolGraphService: () => SymbolGraphService
131603
132285
  });
131604
- import path26 from "path";
131605
- import fs15 from "fs/promises";
132286
+ import path28 from "path";
132287
+ import fs17 from "fs/promises";
131606
132288
 
131607
132289
  class SymbolGraphService {
131608
132290
  identityLookup;
@@ -131930,7 +132612,7 @@ class SymbolGraphService {
131930
132612
  async readSnippet(relativePath, lineStart, lineEnd, projectId) {
131931
132613
  try {
131932
132614
  const absolutePath = await this.resolveToAbsolute(relativePath, projectId);
131933
- const content = await fs15.readFile(absolutePath, "utf-8");
132615
+ const content = await fs17.readFile(absolutePath, "utf-8");
131934
132616
  const lines = content.split(`
131935
132617
  `);
131936
132618
  return lines.slice(Math.max(0, lineStart - 1), Math.min(lines.length, lineEnd)).join(`
@@ -131942,7 +132624,7 @@ class SymbolGraphService {
131942
132624
  async readContext(relativePath, lineNumber, contextLines, projectId) {
131943
132625
  try {
131944
132626
  const absolutePath = await this.resolveToAbsolute(relativePath, projectId);
131945
- const content = await fs15.readFile(absolutePath, "utf-8");
132627
+ const content = await fs17.readFile(absolutePath, "utf-8");
131946
132628
  const lines = content.split(`
131947
132629
  `);
131948
132630
  const start = Math.max(0, lineNumber - contextLines - 1);
@@ -131955,7 +132637,7 @@ class SymbolGraphService {
131955
132637
  }
131956
132638
  async resolveToAbsolute(relativePath, projectId) {
131957
132639
  const root = await this.getProjectRoot(projectId);
131958
- return root ? path26.resolve(root, relativePath) : relativePath;
132640
+ return root ? path28.resolve(root, relativePath) : relativePath;
131959
132641
  }
131960
132642
  async getProjectRoot(projectId) {
131961
132643
  const cached2 = this.projectRootCache.get(projectId);
@@ -132098,7 +132780,7 @@ var init_workspace_manager = __esm(() => {
132098
132780
  });
132099
132781
 
132100
132782
  // ../../packages/core/dist/tools/index_project.js
132101
- import path27 from "path";
132783
+ import path29 from "path";
132102
132784
 
132103
132785
  class IndexProjectTool {
132104
132786
  name = "index_project";
@@ -132146,7 +132828,7 @@ class IndexProjectTool {
132146
132828
  try {
132147
132829
  await assertParserReadyForIndexing();
132148
132830
  const canonicalProjectPath = await canonicalizeProjectRoot(projectPath);
132149
- const finalProjectId = projectId || path27.basename(canonicalProjectPath) || "default";
132831
+ const finalProjectId = projectId || path29.basename(canonicalProjectPath) || "default";
132150
132832
  const existing = await workspaceManager.getWorkspace(finalProjectId);
132151
132833
  await assertProjectRootReuse({
132152
132834
  projectId: finalProjectId,
@@ -132326,7 +133008,7 @@ function normalizeValue(value) {
132326
133008
  return Array.from(value).map(normalizeValue);
132327
133009
  if (value instanceof Map)
132328
133010
  return Object.fromEntries(Array.from(value, ([k, v]) => [String(k), normalizeValue(v)]));
132329
- if (isPlainObject4(value)) {
133011
+ if (isPlainObject6(value)) {
132330
133012
  const encodedValues = {};
132331
133013
  for (const key in value)
132332
133014
  if (Object.hasOwn(value, key))
@@ -132347,7 +133029,7 @@ function isJsonObject(value) {
132347
133029
  function isEmptyObject(value) {
132348
133030
  return Object.keys(value).length === 0;
132349
133031
  }
132350
- function isPlainObject4(value) {
133032
+ function isPlainObject6(value) {
132351
133033
  if (value === null || typeof value !== "object")
132352
133034
  return false;
132353
133035
  const prototype = Object.getPrototypeOf(value);
@@ -132699,17 +133381,17 @@ function applyReplacer(root, replacer) {
132699
133381
  return transformChildren(root, replacer, []);
132700
133382
  return transformChildren(normalizeValue(replacedRoot), replacer, []);
132701
133383
  }
132702
- function transformChildren(value, replacer, path28) {
133384
+ function transformChildren(value, replacer, path30) {
132703
133385
  if (isJsonObject(value))
132704
- return transformObject(value, replacer, path28);
133386
+ return transformObject(value, replacer, path30);
132705
133387
  if (isJsonArray(value))
132706
- return transformArray(value, replacer, path28);
133388
+ return transformArray(value, replacer, path30);
132707
133389
  return value;
132708
133390
  }
132709
- function transformObject(obj, replacer, path28) {
133391
+ function transformObject(obj, replacer, path30) {
132710
133392
  const result = {};
132711
133393
  for (const [key, value] of Object.entries(obj)) {
132712
- const childPath = [...path28, key];
133394
+ const childPath = [...path30, key];
132713
133395
  const replacedValue = replacer(key, value, childPath);
132714
133396
  if (replacedValue === undefined)
132715
133397
  continue;
@@ -132717,11 +133399,11 @@ function transformObject(obj, replacer, path28) {
132717
133399
  }
132718
133400
  return result;
132719
133401
  }
132720
- function transformArray(arr, replacer, path28) {
133402
+ function transformArray(arr, replacer, path30) {
132721
133403
  const result = [];
132722
133404
  for (let i = 0;i < arr.length; i++) {
132723
133405
  const value = arr[i];
132724
- const childPath = [...path28, i];
133406
+ const childPath = [...path30, i];
132725
133407
  const replacedValue = replacer(String(i), value, childPath);
132726
133408
  if (replacedValue === undefined)
132727
133409
  continue;
@@ -137791,9 +138473,9 @@ var init_session_pin_store = __esm(() => {
137791
138473
  });
137792
138474
 
137793
138475
  // ../../packages/core/dist/services/hooks/attribution-resolver.js
137794
- import fs16 from "fs";
138476
+ import fs18 from "fs";
137795
138477
  import os8 from "os";
137796
- import path28 from "path";
138478
+ import path30 from "path";
137797
138479
 
137798
138480
  class PgWorkspaceRootProvider {
137799
138481
  cache = null;
@@ -137843,7 +138525,7 @@ class AttributionResolver {
137843
138525
  this.pins = options.pins ?? new SessionPinStore;
137844
138526
  this.canonicalize = options.canonicalize ?? defaultCanonicalize;
137845
138527
  this.homedir = options.homedir ?? os8.homedir;
137846
- this.fsRoot = options.fsRoot ?? (() => path28.parse(path28.sep).root);
138528
+ this.fsRoot = options.fsRoot ?? (() => path30.parse(path30.sep).root);
137847
138529
  }
137848
138530
  async resolve(input) {
137849
138531
  const caller = input.callerProjectId;
@@ -137894,7 +138576,7 @@ class AttributionResolver {
137894
138576
  }
137895
138577
  let bestPath = null;
137896
138578
  for (const candidate2 of byPath.keys()) {
137897
- if (canonicalCwd === candidate2 || canonicalCwd.startsWith(candidate2.endsWith(path28.sep) ? candidate2 : candidate2 + path28.sep)) {
138579
+ if (canonicalCwd === candidate2 || canonicalCwd.startsWith(candidate2.endsWith(path30.sep) ? candidate2 : candidate2 + path30.sep)) {
137898
138580
  if (bestPath === null || candidate2.length > bestPath.length) {
137899
138581
  bestPath = candidate2;
137900
138582
  }
@@ -137917,7 +138599,7 @@ class AttributionResolver {
137917
138599
  return projectPath2;
137918
138600
  const fsRoot = this.fsRoot();
137919
138601
  let normalized = projectPath2;
137920
- while (normalized.length > fsRoot.length && normalized.endsWith(path28.sep)) {
138602
+ while (normalized.length > fsRoot.length && normalized.endsWith(path30.sep)) {
137921
138603
  normalized = normalized.slice(0, -1);
137922
138604
  }
137923
138605
  return normalized;
@@ -137925,10 +138607,10 @@ class AttributionResolver {
137925
138607
  }
137926
138608
  function defaultCanonicalize(cwd) {
137927
138609
  try {
137928
- return fs16.realpathSync(cwd);
138610
+ return fs18.realpathSync(cwd);
137929
138611
  } catch {
137930
138612
  try {
137931
- return path28.resolve(cwd);
138613
+ return path30.resolve(cwd);
137932
138614
  } catch {
137933
138615
  return;
137934
138616
  }
@@ -138676,31 +139358,31 @@ class TracePathService {
138676
139358
  const chains = [];
138677
139359
  const seen = new Set;
138678
139360
  let walks = 0;
138679
- const walk = (fqn, path29) => {
139361
+ const walk = (fqn, path31) => {
138680
139362
  if (chains.length >= CHAIN_CAP)
138681
139363
  return;
138682
139364
  if (walks >= MAX_WALKS)
138683
139365
  return;
138684
139366
  walks++;
138685
- const key = path29.join("\u2192");
139367
+ const key = path31.join("\u2192");
138686
139368
  if (seen.has(key))
138687
139369
  return;
138688
139370
  seen.add(key);
138689
139371
  const next = adj.get(fqn);
138690
139372
  if (!next || next.length === 0 || !whoHasChild.has(fqn)) {
138691
- if (path29.length > 1)
138692
- chains.push(path29.map((n) => this.fqnToName(n)).join(" \u2192 "));
139373
+ if (path31.length > 1)
139374
+ chains.push(path31.map((n) => this.fqnToName(n)).join(" \u2192 "));
138693
139375
  return;
138694
139376
  }
138695
139377
  for (const child of next) {
138696
139378
  if (chains.length >= CHAIN_CAP || walks >= MAX_WALKS)
138697
139379
  return;
138698
- if (path29.includes(child)) {
138699
- const cycled = [...path29, `${this.fqnToName(child)}\u21BA`];
139380
+ if (path31.includes(child)) {
139381
+ const cycled = [...path31, `${this.fqnToName(child)}\u21BA`];
138700
139382
  chains.push(cycled.map((n) => n).join(" \u2192 "));
138701
139383
  continue;
138702
139384
  }
138703
- walk(child, [...path29, child]);
139385
+ walk(child, [...path31, child]);
138704
139386
  }
138705
139387
  };
138706
139388
  for (const seed of seeds) {
@@ -139533,7 +140215,7 @@ var init_get_architecture = __esm(() => {
139533
140215
  });
139534
140216
 
139535
140217
  // ../../packages/core/dist/services/file-read/file-content-cache.js
139536
- import fs17 from "fs/promises";
140218
+ import fs19 from "fs/promises";
139537
140219
 
139538
140220
  class FileContentCache {
139539
140221
  extractMetadata;
@@ -139566,7 +140248,7 @@ class FileContentCache {
139566
140248
  metadata: cached2.metadata
139567
140249
  };
139568
140250
  }
139569
- const content = await fs17.readFile(filePath, "utf-8");
140251
+ const content = await fs19.readFile(filePath, "utf-8");
139570
140252
  const metadata = await this.extractMetadata(content, filePath, options);
139571
140253
  evictOldest(this.fileCache, this.FILE_CACHE_MAX_ENTRIES - 1);
139572
140254
  this.fileCache.set(cacheKey, {
@@ -139583,7 +140265,7 @@ var init_file_content_cache = __esm(() => {
139583
140265
  });
139584
140266
 
139585
140267
  // ../../packages/core/dist/services/file-read/file-metadata.js
139586
- import path29 from "path";
140268
+ import path31 from "path";
139587
140269
 
139588
140270
  class FileMetadataExtractor {
139589
140271
  symbolGraph;
@@ -139619,7 +140301,7 @@ class FileMetadataExtractor {
139619
140301
  return metadata;
139620
140302
  }
139621
140303
  detectLanguage(filePath) {
139622
- const ext2 = path29.extname(filePath).toLowerCase();
140304
+ const ext2 = path31.extname(filePath).toLowerCase();
139623
140305
  const languageMap2 = {
139624
140306
  ".ts": "TypeScript",
139625
140307
  ".tsx": "TypeScript",
@@ -139741,7 +140423,7 @@ var init_line_range = __esm(() => {
139741
140423
  });
139742
140424
 
139743
140425
  // ../../packages/core/dist/services/file-read/path-containment.js
139744
- import path30 from "path";
140426
+ import path32 from "path";
139745
140427
 
139746
140428
  class PathContainment {
139747
140429
  projectRoots;
@@ -139749,14 +140431,14 @@ class PathContainment {
139749
140431
  this.projectRoots = projectRoots;
139750
140432
  }
139751
140433
  async resolveFilePath(filePath, projectId) {
139752
- if (path30.isAbsolute(filePath)) {
139753
- return path30.resolve(filePath);
140434
+ if (path32.isAbsolute(filePath)) {
140435
+ return path32.resolve(filePath);
139754
140436
  }
139755
140437
  if (projectId) {
139756
140438
  const root = await this.projectRoots.getProjectRoot(projectId);
139757
140439
  if (root) {
139758
140440
  const cleaned = sanitizeFilePath(filePath);
139759
- return path30.resolve(root, cleaned);
140441
+ return path32.resolve(root, cleaned);
139760
140442
  }
139761
140443
  return null;
139762
140444
  }
@@ -139767,17 +140449,17 @@ class PathContainment {
139767
140449
  if (projectId) {
139768
140450
  const root = await this.projectRoots.getProjectRoot(projectId);
139769
140451
  if (root)
139770
- roots.push(path30.resolve(root));
140452
+ roots.push(path32.resolve(root));
139771
140453
  }
139772
- roots.push(path30.resolve(process.cwd()));
140454
+ roots.push(path32.resolve(process.cwd()));
139773
140455
  const envRoots = (process.env.MASSA_AI_READ_FILE_ROOTS ?? "").split(":").map((s) => s.trim()).filter((s) => s.length > 0);
139774
140456
  for (const extra of envRoots) {
139775
- roots.push(path30.resolve(extra));
140457
+ roots.push(path32.resolve(extra));
139776
140458
  }
139777
- const target = path30.resolve(absoluteFilePath);
140459
+ const target = path32.resolve(absoluteFilePath);
139778
140460
  for (const root of roots) {
139779
- const rel = path30.relative(root, target);
139780
- if (rel !== "" && !rel.startsWith("..") && !path30.isAbsolute(rel)) {
140461
+ const rel = path32.relative(root, target);
140462
+ if (rel !== "" && !rel.startsWith("..") && !path32.isAbsolute(rel)) {
139781
140463
  return { allowed: true };
139782
140464
  }
139783
140465
  if (rel === "")
@@ -142991,9 +143673,9 @@ var init_l1_memory_cache = __esm(() => {
142991
143673
  });
142992
143674
 
142993
143675
  // ../../packages/core/dist/services/health/local-health-checker.js
142994
- import fs18 from "fs/promises";
143676
+ import fs20 from "fs/promises";
142995
143677
  import { existsSync as existsSync3 } from "fs";
142996
- import path31 from "path";
143678
+ import path33 from "path";
142997
143679
 
142998
143680
  class LocalHealthChecker {
142999
143681
  ollamaBaseUrl = process.env.OLLAMA_BASE_URL || "http://localhost:11434";
@@ -143027,10 +143709,10 @@ class LocalHealthChecker {
143027
143709
  const start = Date.now();
143028
143710
  try {
143029
143711
  if (!existsSync3(this.dataDir))
143030
- await fs18.mkdir(this.dataDir, { recursive: true });
143031
- const probe2 = path31.join(this.dataDir, ".health-check-test");
143032
- await fs18.writeFile(probe2, "ok");
143033
- await fs18.unlink(probe2);
143712
+ await fs20.mkdir(this.dataDir, { recursive: true });
143713
+ const probe2 = path33.join(this.dataDir, ".health-check-test");
143714
+ await fs20.writeFile(probe2, "ok");
143715
+ await fs20.unlink(probe2);
143034
143716
  return { available: true, latency: Date.now() - start, details: { path: this.dataDir, writable: true } };
143035
143717
  } catch (error51) {
143036
143718
  return { available: false, latency: Date.now() - start, error: `Data directory error: ${error51.message}` };
@@ -145162,9 +145844,9 @@ var init_scheduler2 = __esm(() => {
145162
145844
  });
145163
145845
 
145164
145846
  // ../../packages/core/dist/services/pricing/models-dev-client.js
145165
- import fs19 from "fs/promises";
145847
+ import fs21 from "fs/promises";
145166
145848
  import { existsSync as existsSync4 } from "fs";
145167
- import path32 from "path";
145849
+ import path34 from "path";
145168
145850
  function getModelsDevClient() {
145169
145851
  if (!clientInstance) {
145170
145852
  clientInstance = new ModelsDevClient;
@@ -145184,7 +145866,7 @@ var init_models_dev_client = __esm(() => {
145184
145866
  memoryCacheTimestamp = 0;
145185
145867
  getLocalCachePath() {
145186
145868
  const dataDir = config2.get("dataDir");
145187
- return path32.join(dataDir, ModelsDevClient.LOCAL_CACHE_FILE);
145869
+ return path34.join(dataDir, ModelsDevClient.LOCAL_CACHE_FILE);
145188
145870
  }
145189
145871
  async loadLocalCache() {
145190
145872
  const cachePath = this.getLocalCachePath();
@@ -145192,7 +145874,7 @@ var init_models_dev_client = __esm(() => {
145192
145874
  if (!existsSync4(cachePath)) {
145193
145875
  return null;
145194
145876
  }
145195
- const content = await fs19.readFile(cachePath, "utf-8");
145877
+ const content = await fs21.readFile(cachePath, "utf-8");
145196
145878
  const data = JSON.parse(content);
145197
145879
  const age = Date.now() - data.timestamp;
145198
145880
  if (age > ModelsDevClient.LOCAL_CACHE_TTL) {
@@ -145219,14 +145901,14 @@ var init_models_dev_client = __esm(() => {
145219
145901
  async saveLocalCache(models) {
145220
145902
  const cachePath = this.getLocalCachePath();
145221
145903
  try {
145222
- const dir = path32.dirname(cachePath);
145223
- await fs19.mkdir(dir, { recursive: true });
145904
+ const dir = path34.dirname(cachePath);
145905
+ await fs21.mkdir(dir, { recursive: true });
145224
145906
  const data = {
145225
145907
  timestamp: Date.now(),
145226
145908
  version: "1.0.0",
145227
145909
  models: Object.fromEntries(models)
145228
145910
  };
145229
- await fs19.writeFile(cachePath, JSON.stringify(data), "utf-8");
145911
+ await fs21.writeFile(cachePath, JSON.stringify(data), "utf-8");
145230
145912
  logger.debug("Saved pricing to local cache", {
145231
145913
  models: models.size,
145232
145914
  path: cachePath
@@ -145555,7 +146237,7 @@ var init_models_dev_client = __esm(() => {
145555
146237
  const cachePath = this.getLocalCachePath();
145556
146238
  try {
145557
146239
  if (existsSync4(cachePath)) {
145558
- await fs19.unlink(cachePath);
146240
+ await fs21.unlink(cachePath);
145559
146241
  logger.debug("Local pricing cache file deleted");
145560
146242
  }
145561
146243
  } catch (error51) {
@@ -151110,33 +151792,33 @@ var require_URL = __commonJS((exports, module) => {
151110
151792
  else
151111
151793
  return basepath.substring(0, lastslash + 1) + refpath;
151112
151794
  }
151113
- function remove_dot_segments(path33) {
151114
- if (!path33)
151115
- return path33;
151795
+ function remove_dot_segments(path35) {
151796
+ if (!path35)
151797
+ return path35;
151116
151798
  var output = "";
151117
- while (path33.length > 0) {
151118
- if (path33 === "." || path33 === "..") {
151119
- path33 = "";
151799
+ while (path35.length > 0) {
151800
+ if (path35 === "." || path35 === "..") {
151801
+ path35 = "";
151120
151802
  break;
151121
151803
  }
151122
- var twochars = path33.substring(0, 2);
151123
- var threechars = path33.substring(0, 3);
151124
- var fourchars = path33.substring(0, 4);
151804
+ var twochars = path35.substring(0, 2);
151805
+ var threechars = path35.substring(0, 3);
151806
+ var fourchars = path35.substring(0, 4);
151125
151807
  if (threechars === "../") {
151126
- path33 = path33.substring(3);
151808
+ path35 = path35.substring(3);
151127
151809
  } else if (twochars === "./") {
151128
- path33 = path33.substring(2);
151810
+ path35 = path35.substring(2);
151129
151811
  } else if (threechars === "/./") {
151130
- path33 = "/" + path33.substring(3);
151131
- } else if (twochars === "/." && path33.length === 2) {
151132
- path33 = "/";
151133
- } else if (fourchars === "/../" || threechars === "/.." && path33.length === 3) {
151134
- path33 = "/" + path33.substring(4);
151812
+ path35 = "/" + path35.substring(3);
151813
+ } else if (twochars === "/." && path35.length === 2) {
151814
+ path35 = "/";
151815
+ } else if (fourchars === "/../" || threechars === "/.." && path35.length === 3) {
151816
+ path35 = "/" + path35.substring(4);
151135
151817
  output = output.replace(/\/?[^\/]*$/, "");
151136
151818
  } else {
151137
- var segment = path33.match(/(\/?([^\/]*))/)[0];
151819
+ var segment = path35.match(/(\/?([^\/]*))/)[0];
151138
151820
  output += segment;
151139
- path33 = path33.substring(segment.length);
151821
+ path35 = path35.substring(segment.length);
151140
151822
  }
151141
151823
  }
151142
151824
  return output;
@@ -163206,21 +163888,21 @@ function jsonToKeyPathChunks(value, label = "$") {
163206
163888
  walk(value, label, out);
163207
163889
  return out;
163208
163890
  }
163209
- function walk(val, path33, out) {
163891
+ function walk(val, path35, out) {
163210
163892
  if (val === null || val === undefined)
163211
163893
  return;
163212
163894
  if (Array.isArray(val)) {
163213
163895
  if (val.length === 0) {
163214
- out.push({ path: path33, content: `**${path33}** = _[]_` });
163896
+ out.push({ path: path35, content: `**${path35}** = _[]_` });
163215
163897
  return;
163216
163898
  }
163217
163899
  if (val.every((v) => v !== null && typeof v === "object")) {
163218
- val.forEach((v, i) => walk(v, `${path33}[${i}]`, out));
163900
+ val.forEach((v, i) => walk(v, `${path35}[${i}]`, out));
163219
163901
  return;
163220
163902
  }
163221
163903
  const items = val.map((v) => `- \`${String(v)}\``).join(`
163222
163904
  `);
163223
- out.push({ path: path33, content: `**${path33}**
163905
+ out.push({ path: path35, content: `**${path35}**
163224
163906
 
163225
163907
  ${items}` });
163226
163908
  return;
@@ -163228,16 +163910,16 @@ ${items}` });
163228
163910
  if (typeof val === "object") {
163229
163911
  const entries = Object.entries(val);
163230
163912
  if (entries.length === 0) {
163231
- out.push({ path: path33, content: `**${path33}** = _{}_` });
163913
+ out.push({ path: path35, content: `**${path35}** = _{}_` });
163232
163914
  return;
163233
163915
  }
163234
163916
  for (const [k, v] of entries) {
163235
163917
  const safeKey = /^[A-Za-z_$][\w$]*$/.test(k) ? k : JSON.stringify(k);
163236
- walk(v, `${path33}.${safeKey}`, out);
163918
+ walk(v, `${path35}.${safeKey}`, out);
163237
163919
  }
163238
163920
  return;
163239
163921
  }
163240
- out.push({ path: path33, content: `**${path33}** = \`${String(val)}\`` });
163922
+ out.push({ path: path35, content: `**${path35}** = \`${String(val)}\`` });
163241
163923
  }
163242
163924
  var gfm, STRIP_SELECTORS, tdCache = null;
163243
163925
  var init_html_to_md = __esm(() => {
@@ -164000,8 +164682,8 @@ var init_hook_service = __esm(() => {
164000
164682
 
164001
164683
  // ../../packages/core/dist/services/bootstrap/bootstrap-service.js
164002
164684
  import { randomUUID as randomUUID9 } from "crypto";
164003
- import fs20 from "fs";
164004
- import path33 from "path";
164685
+ import fs22 from "fs";
164686
+ import path35 from "path";
164005
164687
  import { spawn as spawn2 } from "child_process";
164006
164688
  function readBootstrapConfig() {
164007
164689
  try {
@@ -164161,9 +164843,9 @@ async function scanSignals(_projectId, projectRoot, caps, symbolGraph, gitRunner
164161
164843
  }
164162
164844
  try {
164163
164845
  for (const name26 of README_CANDIDATES) {
164164
- const p = path33.join(projectRoot, name26);
164165
- if (fs20.existsSync(p) && fs20.statSync(p).isFile()) {
164166
- const buf = fs20.readFileSync(p);
164846
+ const p = path35.join(projectRoot, name26);
164847
+ if (fs22.existsSync(p) && fs22.statSync(p).isFile()) {
164848
+ const buf = fs22.readFileSync(p);
164167
164849
  signals.readme = buf.slice(0, MAX_README_BYTES).toString("utf8");
164168
164850
  break;
164169
164851
  }
@@ -164172,14 +164854,14 @@ async function scanSignals(_projectId, projectRoot, caps, symbolGraph, gitRunner
164172
164854
  logger.debug("bootstrap scan: README read failed", { error: e.message });
164173
164855
  }
164174
164856
  try {
164175
- const docsDir = path33.join(projectRoot, "docs");
164176
- if (fs20.existsSync(docsDir) && fs20.statSync(docsDir).isDirectory()) {
164857
+ const docsDir = path35.join(projectRoot, "docs");
164858
+ if (fs22.existsSync(docsDir) && fs22.statSync(docsDir).isDirectory()) {
164177
164859
  const entries = walkMarkdown(docsDir).slice(0, MAX_DOCS);
164178
164860
  for (const rel of entries) {
164179
164861
  try {
164180
- const buf = fs20.readFileSync(rel);
164862
+ const buf = fs22.readFileSync(rel);
164181
164863
  signals.docs.push({
164182
- path: path33.relative(projectRoot, rel),
164864
+ path: path35.relative(projectRoot, rel),
164183
164865
  snippet: buf.slice(0, MAX_DOC_BYTES).toString("utf8")
164184
164866
  });
164185
164867
  } catch {}
@@ -164190,10 +164872,10 @@ async function scanSignals(_projectId, projectRoot, caps, symbolGraph, gitRunner
164190
164872
  }
164191
164873
  try {
164192
164874
  for (const name26 of MANIFEST_FILES) {
164193
- const p = path33.join(projectRoot, name26);
164194
- if (!fs20.existsSync(p) || !fs20.statSync(p).isFile())
164875
+ const p = path35.join(projectRoot, name26);
164876
+ if (!fs22.existsSync(p) || !fs22.statSync(p).isFile())
164195
164877
  continue;
164196
- const raw2 = fs20.readFileSync(p).slice(0, MAX_MANIFEST_BYTES).toString("utf8");
164878
+ const raw2 = fs22.readFileSync(p).slice(0, MAX_MANIFEST_BYTES).toString("utf8");
164197
164879
  const kind = name26;
164198
164880
  if (name26 === "package.json") {
164199
164881
  try {
@@ -164233,12 +164915,12 @@ function walkMarkdown(dir) {
164233
164915
  const cur = stack.pop();
164234
164916
  let entries;
164235
164917
  try {
164236
- entries = fs20.readdirSync(cur, { withFileTypes: true });
164918
+ entries = fs22.readdirSync(cur, { withFileTypes: true });
164237
164919
  } catch {
164238
164920
  continue;
164239
164921
  }
164240
164922
  for (const e of entries) {
164241
- const full = path33.join(cur, e.name);
164923
+ const full = path35.join(cur, e.name);
164242
164924
  if (e.isDirectory()) {
164243
164925
  if (e.name === "node_modules" || e.name.startsWith("."))
164244
164926
  continue;
@@ -167768,7 +168450,7 @@ class StdioServerTransport {
167768
168450
  }
167769
168451
 
167770
168452
  // src/index.ts
167771
- import fs23 from "fs/promises";
168453
+ import fs25 from "fs/promises";
167772
168454
 
167773
168455
  // src/api-client.ts
167774
168456
  init_config();
@@ -167878,8 +168560,8 @@ init_dist();
167878
168560
  init_dist();
167879
168561
  init_dist15();
167880
168562
  init_dist();
167881
- import fs21 from "fs/promises";
167882
- import path34 from "path";
168563
+ import fs23 from "fs/promises";
168564
+ import path36 from "path";
167883
168565
  var _indexProjectTool = null;
167884
168566
  function indexProjectTool() {
167885
168567
  if (!_indexProjectTool)
@@ -168182,8 +168864,8 @@ class EmbeddedApiClient {
168182
168864
  } else {
168183
168865
  end = start + 20;
168184
168866
  }
168185
- const absolutePath = path34.join(workspace.project_path, file2);
168186
- const content = await fs21.readFile(absolutePath, "utf-8");
168867
+ const absolutePath = path36.join(workspace.project_path, file2);
168868
+ const content = await fs23.readFile(absolutePath, "utf-8");
168187
168869
  const lines = content.split(/\r?\n/);
168188
168870
  const slice = lines.slice(start - 1, Math.min(lines.length, end));
168189
168871
  const formatted = slice.map((text3, idx) => ({ lineNumber: start + idx, content: text3 }));
@@ -168438,22 +169120,22 @@ class EmbeddedApiClient {
168438
169120
  async uploadAndIndex(params) {
168439
169121
  const rawBase = params.projectId || params.projectPath.replace(/\\/g, "/").split("/").filter(Boolean).pop() || "default";
168440
169122
  const finalProjectId = rawBase.replace(/[^a-zA-Z0-9_.-]/g, "_").slice(0, 128);
168441
- const uploadRoot = process.env.MASSA_AI_UPLOAD_DIR || path34.join(getGlobalDataDir(), "uploads");
168442
- const stagingDir = path34.resolve(uploadRoot, finalProjectId);
168443
- await fs21.rm(stagingDir, { recursive: true, force: true });
168444
- await fs21.mkdir(stagingDir, { recursive: true });
169123
+ const uploadRoot = process.env.MASSA_AI_UPLOAD_DIR || path36.join(getGlobalDataDir(), "uploads");
169124
+ const stagingDir = path36.resolve(uploadRoot, finalProjectId);
169125
+ await fs23.rm(stagingDir, { recursive: true, force: true });
169126
+ await fs23.mkdir(stagingDir, { recursive: true });
168445
169127
  const WRITE_BATCH = 20;
168446
169128
  for (let i = 0;i < params.files.length; i += WRITE_BATCH) {
168447
169129
  await Promise.all(params.files.slice(i, i + WRITE_BATCH).map(async (file2) => {
168448
- if (path34.isAbsolute(file2.relativePath) || file2.relativePath.includes("..")) {
169130
+ if (path36.isAbsolute(file2.relativePath) || file2.relativePath.includes("..")) {
168449
169131
  throw new Error(`Invalid file path: ${file2.relativePath}`);
168450
169132
  }
168451
- const dest = path34.resolve(stagingDir, file2.relativePath.replace(/\//g, path34.sep));
168452
- if (!dest.startsWith(stagingDir + path34.sep)) {
169133
+ const dest = path36.resolve(stagingDir, file2.relativePath.replace(/\//g, path36.sep));
169134
+ if (!dest.startsWith(stagingDir + path36.sep)) {
168453
169135
  throw new Error(`Path escapes staging directory: ${file2.relativePath}`);
168454
169136
  }
168455
- await fs21.mkdir(path34.dirname(dest), { recursive: true });
168456
- await fs21.writeFile(dest, file2.content, "utf-8");
169137
+ await fs23.mkdir(path36.dirname(dest), { recursive: true });
169138
+ await fs23.writeFile(dest, file2.content, "utf-8");
168457
169139
  }));
168458
169140
  }
168459
169141
  return await indexProjectTool().handle({
@@ -168950,8 +169632,8 @@ class EmbeddedApiClient {
168950
169632
 
168951
169633
  // src/file-collector.ts
168952
169634
  init_config();
168953
- import fs22 from "fs/promises";
168954
- import path35 from "path";
169635
+ import fs24 from "fs/promises";
169636
+ import path37 from "path";
168955
169637
  var SKIP_DIRS = new Set([
168956
169638
  "node_modules",
168957
169639
  ".git",
@@ -168992,7 +169674,7 @@ async function walk2(root2, dir, files, state, allowed) {
168992
169674
  return;
168993
169675
  let entries;
168994
169676
  try {
168995
- entries = await fs22.readdir(dir, { withFileTypes: true });
169677
+ entries = await fs24.readdir(dir, { withFileTypes: true });
168996
169678
  } catch {
168997
169679
  return;
168998
169680
  }
@@ -169001,22 +169683,22 @@ async function walk2(root2, dir, files, state, allowed) {
169001
169683
  break;
169002
169684
  if (entry2.isDirectory()) {
169003
169685
  if (!SKIP_DIRS.has(entry2.name) && !entry2.name.startsWith(".")) {
169004
- await walk2(root2, path35.join(dir, entry2.name), files, state, allowed);
169686
+ await walk2(root2, path37.join(dir, entry2.name), files, state, allowed);
169005
169687
  }
169006
169688
  } else if (entry2.isFile()) {
169007
- const ext2 = path35.extname(entry2.name).toLowerCase();
169689
+ const ext2 = path37.extname(entry2.name).toLowerCase();
169008
169690
  if (!allowed.has(ext2))
169009
169691
  continue;
169010
- const fullPath = path35.join(dir, entry2.name);
169692
+ const fullPath = path37.join(dir, entry2.name);
169011
169693
  try {
169012
- const stat = await fs22.stat(fullPath);
169694
+ const stat = await fs24.stat(fullPath);
169013
169695
  if (stat.size > MAX_FILE_BYTES)
169014
169696
  continue;
169015
169697
  if (state.totalBytes + stat.size > MAX_TOTAL_BYTES)
169016
169698
  continue;
169017
- const content = await fs22.readFile(fullPath, "utf-8");
169699
+ const content = await fs24.readFile(fullPath, "utf-8");
169018
169700
  state.totalBytes += stat.size;
169019
- const relativePath = path35.relative(root2, fullPath).split(path35.sep).join("/");
169701
+ const relativePath = path37.relative(root2, fullPath).split(path37.sep).join("/");
169020
169702
  files.push({ relativePath, content });
169021
169703
  } catch {}
169022
169704
  }
@@ -170999,7 +171681,7 @@ class McpProxyServer {
170999
171681
  return textContent(JSON.stringify({ success: false, error: "projectPath is required" }));
171000
171682
  }
171001
171683
  try {
171002
- if (!(await fs23.stat(projectPath2)).isDirectory()) {
171684
+ if (!(await fs25.stat(projectPath2)).isDirectory()) {
171003
171685
  return textContent(JSON.stringify({ success: false, error: `${projectPath2} is not a directory` }));
171004
171686
  }
171005
171687
  } catch {