@massa-ai/mcp-client 1.61.0 → 1.63.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.
- package/dist/config-cli.js +498 -416
- package/dist/index.js +542 -460
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -27446,12 +27446,12 @@ import path6 from "path";
|
|
|
27446
27446
|
function isHost(v) {
|
|
27447
27447
|
return typeof v === "string" && HOSTS.includes(v);
|
|
27448
27448
|
}
|
|
27449
|
-
function fileLayout(host, activeDir,
|
|
27449
|
+
function fileLayout(host, activeDir, activeExt, variantsRoot) {
|
|
27450
27450
|
return {
|
|
27451
27451
|
host,
|
|
27452
27452
|
route: "files",
|
|
27453
27453
|
activeDir,
|
|
27454
|
-
|
|
27454
|
+
activeExt,
|
|
27455
27455
|
variantsRoot,
|
|
27456
27456
|
variantDir: (profile) => path6.join(variantsRoot, profile)
|
|
27457
27457
|
};
|
|
@@ -27465,19 +27465,19 @@ function resolveHostLayout(host, opts = {}) {
|
|
|
27465
27465
|
case "claude": {
|
|
27466
27466
|
const marketplaceRoot = opts.marketplaceRoot?.claude;
|
|
27467
27467
|
if (override === undefined && marketplaceRoot !== undefined) {
|
|
27468
|
-
return fileLayout(host, path6.join(marketplaceRoot, "agents"), "
|
|
27468
|
+
return fileLayout(host, path6.join(marketplaceRoot, "agents"), ".md", path6.join(marketplaceRoot, "agent-profiles"));
|
|
27469
27469
|
}
|
|
27470
27470
|
const root = override ?? path6.join(targetHome, ".claude");
|
|
27471
|
-
return fileLayout(host, path6.join(root, "agents"), "
|
|
27471
|
+
return fileLayout(host, path6.join(root, "agents"), ".md", path6.join(root, "massa-ai", "agent-profiles"));
|
|
27472
27472
|
}
|
|
27473
27473
|
case "codex": {
|
|
27474
27474
|
const root = override ?? path6.join(targetHome, ".codex");
|
|
27475
|
-
return fileLayout(host, path6.join(root, "agents"), "
|
|
27475
|
+
return fileLayout(host, path6.join(root, "agents"), ".toml", path6.join(root, "massa-ai", "agent-profiles"));
|
|
27476
27476
|
}
|
|
27477
27477
|
case "opencode": {
|
|
27478
27478
|
const root = override ?? path6.join(targetHome, ".config", "opencode");
|
|
27479
27479
|
const pluginsDir = path6.join(root, "plugins", "massa-ai");
|
|
27480
|
-
return fileLayout(host, path6.join(root, "agents"), "
|
|
27480
|
+
return fileLayout(host, path6.join(root, "agents"), ".md", path6.join(pluginsDir, "agent-profiles"));
|
|
27481
27481
|
}
|
|
27482
27482
|
}
|
|
27483
27483
|
}
|
|
@@ -27811,6 +27811,90 @@ function readInstalledPluginVersion(opts = {}) {
|
|
|
27811
27811
|
var DEFAULT_PLUGIN_KEY = "massa-ai@massa-ai";
|
|
27812
27812
|
var init_claude_marketplace = () => {};
|
|
27813
27813
|
|
|
27814
|
+
// ../../packages/shared/dist/profile-switch/ownership.js
|
|
27815
|
+
import fs6 from "fs";
|
|
27816
|
+
import path10 from "path";
|
|
27817
|
+
function isLegacyAgentName(fileName) {
|
|
27818
|
+
const base = path10.basename(fileName).replace(/\.[^.]*$/, "");
|
|
27819
|
+
return base.startsWith("massa-ai-") && LEGACY_AGENT_NAMES.includes(base.slice("massa-ai-".length));
|
|
27820
|
+
}
|
|
27821
|
+
function hasOwnedMarker(content) {
|
|
27822
|
+
const lines = content.split(`
|
|
27823
|
+
`);
|
|
27824
|
+
if (lines[0] !== "---")
|
|
27825
|
+
return false;
|
|
27826
|
+
const close = lines.indexOf("---", 1);
|
|
27827
|
+
return close !== -1 && lines[close + 1] === OWNED_MARKER_MD;
|
|
27828
|
+
}
|
|
27829
|
+
function isRegularFile(filePath) {
|
|
27830
|
+
try {
|
|
27831
|
+
return fs6.lstatSync(filePath).isFile();
|
|
27832
|
+
} catch {
|
|
27833
|
+
return false;
|
|
27834
|
+
}
|
|
27835
|
+
}
|
|
27836
|
+
function isOwnedAgentFile(filePath) {
|
|
27837
|
+
if (!isRegularFile(filePath))
|
|
27838
|
+
return false;
|
|
27839
|
+
if (!filePath.endsWith(".toml") && isLegacyAgentName(filePath))
|
|
27840
|
+
return true;
|
|
27841
|
+
let content;
|
|
27842
|
+
try {
|
|
27843
|
+
content = fs6.readFileSync(filePath, "utf8");
|
|
27844
|
+
} catch {
|
|
27845
|
+
return false;
|
|
27846
|
+
}
|
|
27847
|
+
if (filePath.endsWith(".toml"))
|
|
27848
|
+
return content.split(`
|
|
27849
|
+
`)[0] === OWNED_MARKER_TOML;
|
|
27850
|
+
return hasOwnedMarker(content);
|
|
27851
|
+
}
|
|
27852
|
+
function isOwnedAgentLink(linkPath) {
|
|
27853
|
+
try {
|
|
27854
|
+
if (!fs6.lstatSync(linkPath).isSymbolicLink())
|
|
27855
|
+
return false;
|
|
27856
|
+
} catch {
|
|
27857
|
+
return false;
|
|
27858
|
+
}
|
|
27859
|
+
if (isLegacyAgentName(linkPath))
|
|
27860
|
+
return true;
|
|
27861
|
+
const base = path10.basename(linkPath);
|
|
27862
|
+
const target = fs6.readlinkSync(linkPath);
|
|
27863
|
+
if (target.endsWith(`/opencode-plugin/agents/${base}`))
|
|
27864
|
+
return true;
|
|
27865
|
+
const escaped = base.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
27866
|
+
if (new RegExp(`/plugins/massa-ai/agent-profiles/.*/${escaped}$`).test(target))
|
|
27867
|
+
return true;
|
|
27868
|
+
try {
|
|
27869
|
+
return fs6.statSync(linkPath).isFile() && hasOwnedMarker(fs6.readFileSync(linkPath, "utf8"));
|
|
27870
|
+
} catch {
|
|
27871
|
+
return false;
|
|
27872
|
+
}
|
|
27873
|
+
}
|
|
27874
|
+
var OWNED_MARKER_MD = "<!-- massa-ai-owned: true -->", OWNED_MARKER_TOML = "# massa-ai-owned", LEGACY_AGENT_NAMES;
|
|
27875
|
+
var init_ownership = __esm(() => {
|
|
27876
|
+
LEGACY_AGENT_NAMES = [
|
|
27877
|
+
"architecture-specialist",
|
|
27878
|
+
"audit-specialist",
|
|
27879
|
+
"builder",
|
|
27880
|
+
"context-curator",
|
|
27881
|
+
"designer",
|
|
27882
|
+
"documentation-agent",
|
|
27883
|
+
"furps-analyst",
|
|
27884
|
+
"investigator",
|
|
27885
|
+
"judge",
|
|
27886
|
+
"meta-judge",
|
|
27887
|
+
"mobile-specialist",
|
|
27888
|
+
"navigator",
|
|
27889
|
+
"plan-critic",
|
|
27890
|
+
"planner",
|
|
27891
|
+
"requirements-analyst",
|
|
27892
|
+
"reviewer",
|
|
27893
|
+
"test-engineer",
|
|
27894
|
+
"verification-agent"
|
|
27895
|
+
];
|
|
27896
|
+
});
|
|
27897
|
+
|
|
27814
27898
|
// ../../packages/shared/dist/profile-switch/frontmatter.js
|
|
27815
27899
|
function parseFrontmatter(raw2) {
|
|
27816
27900
|
const match = /^---\r?\n([\s\S]*?)\r?\n---\r?\n([\s\S]*)$/.exec(raw2);
|
|
@@ -27868,12 +27952,12 @@ function unquoteScalar(s) {
|
|
|
27868
27952
|
}
|
|
27869
27953
|
|
|
27870
27954
|
// ../../packages/shared/dist/profile-switch/doctor.js
|
|
27871
|
-
import
|
|
27955
|
+
import fs7 from "fs";
|
|
27872
27956
|
import os6 from "os";
|
|
27873
|
-
import
|
|
27957
|
+
import path11 from "path";
|
|
27874
27958
|
function readTextFile(filePath) {
|
|
27875
27959
|
try {
|
|
27876
|
-
return
|
|
27960
|
+
return fs7.readFileSync(filePath, "utf8");
|
|
27877
27961
|
} catch {
|
|
27878
27962
|
return null;
|
|
27879
27963
|
}
|
|
@@ -27889,7 +27973,7 @@ function readJsonFile(filePath) {
|
|
|
27889
27973
|
}
|
|
27890
27974
|
}
|
|
27891
27975
|
function readPluginVersion(pluginRoot) {
|
|
27892
|
-
const manifest = readJsonFile(
|
|
27976
|
+
const manifest = readJsonFile(path11.join(pluginRoot, ".claude-plugin", "plugin.json"));
|
|
27893
27977
|
return typeof manifest?.version === "string" ? manifest.version : null;
|
|
27894
27978
|
}
|
|
27895
27979
|
function detectEnvOverride(env) {
|
|
@@ -27902,19 +27986,19 @@ function detectEnvOverride(env) {
|
|
|
27902
27986
|
return null;
|
|
27903
27987
|
}
|
|
27904
27988
|
function readRoles(liveRoot, activeProfile) {
|
|
27905
|
-
const agentsDir =
|
|
27989
|
+
const agentsDir = path11.join(liveRoot, "agents");
|
|
27906
27990
|
let entries;
|
|
27907
27991
|
try {
|
|
27908
|
-
entries =
|
|
27992
|
+
entries = fs7.readdirSync(agentsDir, { withFileTypes: true });
|
|
27909
27993
|
} catch {
|
|
27910
27994
|
return [];
|
|
27911
27995
|
}
|
|
27912
27996
|
const roles = [];
|
|
27913
27997
|
for (const entry of entries) {
|
|
27914
|
-
if (!entry.
|
|
27998
|
+
if (!entry.name.endsWith(".md") || !isOwnedAgentFile(path11.join(agentsDir, entry.name))) {
|
|
27915
27999
|
continue;
|
|
27916
28000
|
}
|
|
27917
|
-
const activeRaw = readTextFile(
|
|
28001
|
+
const activeRaw = readTextFile(path11.join(agentsDir, entry.name));
|
|
27918
28002
|
let model = null;
|
|
27919
28003
|
let effort = null;
|
|
27920
28004
|
if (activeRaw !== null) {
|
|
@@ -27926,7 +28010,7 @@ function readRoles(liveRoot, activeProfile) {
|
|
|
27926
28010
|
}
|
|
27927
28011
|
let staleVariant = false;
|
|
27928
28012
|
if (activeProfile && activeRaw !== null) {
|
|
27929
|
-
const variantRaw = readTextFile(
|
|
28013
|
+
const variantRaw = readTextFile(path11.join(liveRoot, "agent-profiles", activeProfile, entry.name));
|
|
27930
28014
|
if (variantRaw !== null) {
|
|
27931
28015
|
staleVariant = variantRaw !== activeRaw;
|
|
27932
28016
|
}
|
|
@@ -27938,7 +28022,7 @@ function readRoles(liveRoot, activeProfile) {
|
|
|
27938
28022
|
function runtimeDriftReport(opts = {}) {
|
|
27939
28023
|
const targetHome = opts.targetHome ?? os6.homedir();
|
|
27940
28024
|
const host = opts.host ?? "claude";
|
|
27941
|
-
const stateFilePath = opts.stateFilePath ??
|
|
28025
|
+
const stateFilePath = opts.stateFilePath ?? path11.join(targetHome, ".config", "massa-ai", "install-state.json");
|
|
27942
28026
|
let state = opts.state ?? null;
|
|
27943
28027
|
if (state === null) {
|
|
27944
28028
|
try {
|
|
@@ -27987,13 +28071,14 @@ function runtimeDriftReport(opts = {}) {
|
|
|
27987
28071
|
var ENV_OVERRIDE_VARS;
|
|
27988
28072
|
var init_doctor = __esm(() => {
|
|
27989
28073
|
init_claude_marketplace();
|
|
28074
|
+
init_ownership();
|
|
27990
28075
|
init_state();
|
|
27991
28076
|
ENV_OVERRIDE_VARS = ["CLAUDE_CODE_SUBAGENT_MODEL"];
|
|
27992
28077
|
});
|
|
27993
28078
|
|
|
27994
28079
|
// ../../packages/shared/dist/profile-switch/engine.js
|
|
27995
|
-
import
|
|
27996
|
-
import
|
|
28080
|
+
import fs8 from "fs";
|
|
28081
|
+
import path12 from "path";
|
|
27997
28082
|
import os7 from "os";
|
|
27998
28083
|
import crypto4 from "crypto";
|
|
27999
28084
|
import { execFileSync as execFileSync2 } from "child_process";
|
|
@@ -28003,7 +28088,7 @@ function namedError3(name, message) {
|
|
|
28003
28088
|
return err;
|
|
28004
28089
|
}
|
|
28005
28090
|
function defaultStatePath(targetHome) {
|
|
28006
|
-
return
|
|
28091
|
+
return path12.join(targetHome, ".config", "massa-ai", "install-state.json");
|
|
28007
28092
|
}
|
|
28008
28093
|
function resolveCommon(opts) {
|
|
28009
28094
|
const targetHome = opts.targetHome ?? os7.homedir();
|
|
@@ -28014,7 +28099,7 @@ function marketplaceRoots(targetHome, state) {
|
|
|
28014
28099
|
return state.platforms.claude?.installRoute === "marketplace" ? { claude: resolveClaudeMarketplaceRoot({ targetHome }) ?? undefined } : {};
|
|
28015
28100
|
}
|
|
28016
28101
|
function claudeMarketplaceUnresolvedReason(targetHome) {
|
|
28017
|
-
const registryPath =
|
|
28102
|
+
const registryPath = path12.join(targetHome, ".claude", "plugins", "installed_plugins.json");
|
|
28018
28103
|
return `claude installRoute is "marketplace" but no install root could be resolved from ${registryPath} ` + "\u2014 re-run the Claude plugin installer, or verify the plugin registry file";
|
|
28019
28104
|
}
|
|
28020
28105
|
function listProfiles(opts = {}) {
|
|
@@ -28055,7 +28140,7 @@ function listProfiles(opts = {}) {
|
|
|
28055
28140
|
...claudeDriftFields(host)
|
|
28056
28141
|
};
|
|
28057
28142
|
}
|
|
28058
|
-
const installed =
|
|
28143
|
+
const installed = fs8.existsSync(layout.activeDir);
|
|
28059
28144
|
const availableProfiles = listVariantProfiles(layout);
|
|
28060
28145
|
const platform = state.platforms[host];
|
|
28061
28146
|
return {
|
|
@@ -28072,20 +28157,20 @@ function listProfiles(opts = {}) {
|
|
|
28072
28157
|
return { hosts };
|
|
28073
28158
|
}
|
|
28074
28159
|
function listVariantProfiles(layout) {
|
|
28075
|
-
if (!
|
|
28160
|
+
if (!fs8.existsSync(layout.variantsRoot))
|
|
28076
28161
|
return [];
|
|
28077
|
-
return
|
|
28162
|
+
return fs8.readdirSync(layout.variantsRoot, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => e.name).sort();
|
|
28078
28163
|
}
|
|
28079
|
-
function
|
|
28080
|
-
|
|
28081
|
-
if (starIdx === -1)
|
|
28082
|
-
return filename === glob;
|
|
28083
|
-
const prefix = glob.slice(0, starIdx);
|
|
28084
|
-
const suffix = glob.slice(starIdx + 1);
|
|
28085
|
-
return filename.length >= prefix.length + suffix.length && filename.startsWith(prefix) && filename.endsWith(suffix);
|
|
28164
|
+
function matchingFileNames(dir, ext) {
|
|
28165
|
+
return fs8.readdirSync(dir, { withFileTypes: true }).filter((e) => e.isFile() && e.name.endsWith(ext) && !isLegacyAgentName(e.name) && isOwnedAgentFile(path12.join(dir, e.name))).map((e) => e.name);
|
|
28086
28166
|
}
|
|
28087
|
-
function
|
|
28088
|
-
|
|
28167
|
+
function destIsAbsent(dest) {
|
|
28168
|
+
try {
|
|
28169
|
+
fs8.lstatSync(dest);
|
|
28170
|
+
return false;
|
|
28171
|
+
} catch {
|
|
28172
|
+
return true;
|
|
28173
|
+
}
|
|
28089
28174
|
}
|
|
28090
28175
|
function detectGitAvailability(dir) {
|
|
28091
28176
|
try {
|
|
@@ -28111,7 +28196,7 @@ function gitTrackedFileNames(dir, filenames) {
|
|
|
28111
28196
|
}
|
|
28112
28197
|
}
|
|
28113
28198
|
function checkTrackedPathGuard(activeDir, filenames) {
|
|
28114
|
-
if (filenames.length === 0 || !
|
|
28199
|
+
if (filenames.length === 0 || !fs8.existsSync(activeDir))
|
|
28115
28200
|
return GUARD_PASS;
|
|
28116
28201
|
const availability = detectGitAvailability(activeDir);
|
|
28117
28202
|
if (availability === "no-git")
|
|
@@ -28122,53 +28207,45 @@ function checkTrackedPathGuard(activeDir, filenames) {
|
|
|
28122
28207
|
if (tracked.size === 0)
|
|
28123
28208
|
return GUARD_PASS;
|
|
28124
28209
|
const offending = filenames.find((name) => tracked.has(name));
|
|
28125
|
-
return { blocked: true, path:
|
|
28210
|
+
return { blocked: true, path: path12.join(activeDir, offending), unchecked: false };
|
|
28126
28211
|
}
|
|
28127
28212
|
function assertStateWritable(stateFilePath) {
|
|
28128
|
-
const dir =
|
|
28213
|
+
const dir = path12.dirname(stateFilePath);
|
|
28129
28214
|
try {
|
|
28130
|
-
|
|
28215
|
+
fs8.mkdirSync(dir, { recursive: true });
|
|
28131
28216
|
} catch (err) {
|
|
28132
28217
|
throw UnwritableInstallStateError(stateFilePath, err.message);
|
|
28133
28218
|
}
|
|
28134
|
-
const checkPath =
|
|
28219
|
+
const checkPath = fs8.existsSync(stateFilePath) ? stateFilePath : dir;
|
|
28135
28220
|
try {
|
|
28136
|
-
|
|
28221
|
+
fs8.accessSync(checkPath, fs8.constants.W_OK);
|
|
28137
28222
|
} catch (err) {
|
|
28138
28223
|
throw UnwritableInstallStateError(stateFilePath, err.message);
|
|
28139
28224
|
}
|
|
28140
28225
|
}
|
|
28141
28226
|
function copyFileRouteVariant(layout, variantDir) {
|
|
28142
|
-
|
|
28227
|
+
fs8.mkdirSync(layout.activeDir, { recursive: true });
|
|
28143
28228
|
let changed = 0;
|
|
28144
|
-
for (const
|
|
28145
|
-
|
|
28229
|
+
for (const name of matchingFileNames(variantDir, layout.activeExt)) {
|
|
28230
|
+
const dest = path12.join(layout.activeDir, name);
|
|
28231
|
+
if (!destIsAbsent(dest) && !isOwnedAgentFile(dest))
|
|
28146
28232
|
continue;
|
|
28147
|
-
|
|
28233
|
+
fs8.copyFileSync(path12.join(variantDir, name), dest);
|
|
28148
28234
|
changed++;
|
|
28149
28235
|
}
|
|
28150
28236
|
return changed;
|
|
28151
28237
|
}
|
|
28152
28238
|
function repointOpencodeVariant(layout, variantDir) {
|
|
28153
|
-
|
|
28239
|
+
fs8.mkdirSync(layout.activeDir, { recursive: true });
|
|
28154
28240
|
let changed = 0;
|
|
28155
|
-
for (const
|
|
28156
|
-
|
|
28157
|
-
|
|
28158
|
-
|
|
28159
|
-
const target = path11.resolve(path11.join(variantDir, entry.name));
|
|
28160
|
-
let destExists = true;
|
|
28161
|
-
let destIsSymlink = false;
|
|
28162
|
-
try {
|
|
28163
|
-
destIsSymlink = fs7.lstatSync(dest).isSymbolicLink();
|
|
28164
|
-
} catch {
|
|
28165
|
-
destExists = false;
|
|
28166
|
-
}
|
|
28167
|
-
if (destExists && !destIsSymlink)
|
|
28241
|
+
for (const name of matchingFileNames(variantDir, layout.activeExt)) {
|
|
28242
|
+
const dest = path12.join(layout.activeDir, name);
|
|
28243
|
+
const target = path12.resolve(path12.join(variantDir, name));
|
|
28244
|
+
if (!destIsAbsent(dest) && !isOwnedAgentLink(dest))
|
|
28168
28245
|
continue;
|
|
28169
28246
|
const tmp = `${dest}.massa-ai-switch.${crypto4.randomUUID()}`;
|
|
28170
|
-
|
|
28171
|
-
|
|
28247
|
+
fs8.symlinkSync(target, tmp);
|
|
28248
|
+
fs8.renameSync(tmp, dest);
|
|
28172
28249
|
changed++;
|
|
28173
28250
|
}
|
|
28174
28251
|
return changed;
|
|
@@ -28208,13 +28285,13 @@ function switchProfile(opts) {
|
|
|
28208
28285
|
if (fileHosts.length === 0) {
|
|
28209
28286
|
return { profile: opts.profile, dryRun, hosts: orderRows(universe, skipRows), restartRequired: false };
|
|
28210
28287
|
}
|
|
28211
|
-
const installedFileHosts = fileHosts.filter((h) =>
|
|
28288
|
+
const installedFileHosts = fileHosts.filter((h) => fs8.existsSync(h.layout.activeDir));
|
|
28212
28289
|
if (installedFileHosts.length === 0)
|
|
28213
28290
|
throw NoHostsDetectedError();
|
|
28214
28291
|
const withAvailability = fileHosts.map((h) => {
|
|
28215
|
-
const variantsRootExists =
|
|
28292
|
+
const variantsRootExists = fs8.existsSync(h.layout.variantsRoot);
|
|
28216
28293
|
const variantDir = h.layout.variantDir(opts.profile);
|
|
28217
|
-
const available = variantsRootExists &&
|
|
28294
|
+
const available = variantsRootExists && fs8.existsSync(variantDir) && fs8.statSync(variantDir).isDirectory();
|
|
28218
28295
|
return { ...h, variantsRootExists, variantDir, available };
|
|
28219
28296
|
});
|
|
28220
28297
|
if (!withAvailability.some((h) => h.available)) {
|
|
@@ -28253,7 +28330,7 @@ function switchProfile(opts) {
|
|
|
28253
28330
|
rows.push({ host: h.host, status: "would-switch" });
|
|
28254
28331
|
continue;
|
|
28255
28332
|
}
|
|
28256
|
-
const candidateNames = matchingFileNames(h.variantDir, h.layout.
|
|
28333
|
+
const candidateNames = matchingFileNames(h.variantDir, h.layout.activeExt);
|
|
28257
28334
|
const guard = checkTrackedPathGuard(h.layout.activeDir, candidateNames);
|
|
28258
28335
|
if (guard.blocked) {
|
|
28259
28336
|
rows.push({
|
|
@@ -28295,6 +28372,7 @@ var init_engine = __esm(() => {
|
|
|
28295
28372
|
init_state();
|
|
28296
28373
|
init_lock();
|
|
28297
28374
|
init_claude_marketplace();
|
|
28375
|
+
init_ownership();
|
|
28298
28376
|
init_doctor();
|
|
28299
28377
|
SwitchEngineError = class SwitchEngineError extends Error {
|
|
28300
28378
|
constructor(message) {
|
|
@@ -28312,25 +28390,25 @@ function reportSucceeded(report) {
|
|
|
28312
28390
|
}
|
|
28313
28391
|
|
|
28314
28392
|
// ../../packages/shared/dist/profile-switch/variant-sync.js
|
|
28315
|
-
import
|
|
28316
|
-
import
|
|
28393
|
+
import fs9 from "fs";
|
|
28394
|
+
import path13 from "path";
|
|
28317
28395
|
import os8 from "os";
|
|
28318
28396
|
import crypto5 from "crypto";
|
|
28319
28397
|
function defaultStatePath2(targetHome) {
|
|
28320
|
-
return
|
|
28398
|
+
return path13.join(targetHome, ".config", "massa-ai", "install-state.json");
|
|
28321
28399
|
}
|
|
28322
28400
|
function marketplaceRoots2(targetHome, state) {
|
|
28323
28401
|
return state.platforms.claude?.installRoute === "marketplace" ? { claude: resolveClaudeMarketplaceRoot({ targetHome }) ?? undefined } : {};
|
|
28324
28402
|
}
|
|
28325
28403
|
function writeFileIntoDirAtomically(destDir, destName, content) {
|
|
28326
28404
|
const unique = `${process.pid}.${++tempFileCounter2}.${crypto5.randomBytes(6).toString("hex")}`;
|
|
28327
|
-
const tempFile =
|
|
28405
|
+
const tempFile = path13.join(destDir, `.${destName}.${unique}.tmp`);
|
|
28328
28406
|
try {
|
|
28329
|
-
|
|
28330
|
-
|
|
28407
|
+
fs9.writeFileSync(tempFile, content);
|
|
28408
|
+
fs9.renameSync(tempFile, path13.join(destDir, destName));
|
|
28331
28409
|
} catch (error51) {
|
|
28332
28410
|
try {
|
|
28333
|
-
|
|
28411
|
+
fs9.unlinkSync(tempFile);
|
|
28334
28412
|
} catch {}
|
|
28335
28413
|
throw error51;
|
|
28336
28414
|
}
|
|
@@ -28338,20 +28416,20 @@ function writeFileIntoDirAtomically(destDir, destName, content) {
|
|
|
28338
28416
|
function isSafeDirName(name) {
|
|
28339
28417
|
if (name === "." || name === "..")
|
|
28340
28418
|
return false;
|
|
28341
|
-
if (name.includes("/") || name.includes("\\") || name.includes(
|
|
28419
|
+
if (name.includes("/") || name.includes("\\") || name.includes(path13.sep))
|
|
28342
28420
|
return false;
|
|
28343
|
-
return
|
|
28421
|
+
return path13.basename(name) === name;
|
|
28344
28422
|
}
|
|
28345
28423
|
function syncHost(host, sourceRoot, targetHome, marketplaceRoot) {
|
|
28346
28424
|
const layout = resolveHostLayout(host, { targetHome, marketplaceRoot });
|
|
28347
28425
|
if (layout.route === "skip") {
|
|
28348
28426
|
return { host, status: "skipped", profiles: [], retained: [], files: 0, reason: layout.reason };
|
|
28349
28427
|
}
|
|
28350
|
-
const srcDir =
|
|
28351
|
-
if (!
|
|
28428
|
+
const srcDir = path13.join(sourceRoot, "apps", `${host}-plugin`, "agent-profiles");
|
|
28429
|
+
if (!fs9.existsSync(srcDir) || !fs9.statSync(srcDir).isDirectory()) {
|
|
28352
28430
|
return { host, status: "skipped", profiles: [], retained: [], files: 0, reason: "no generated variants for this host" };
|
|
28353
28431
|
}
|
|
28354
|
-
if (!
|
|
28432
|
+
if (!fs9.existsSync(layout.variantsRoot)) {
|
|
28355
28433
|
return {
|
|
28356
28434
|
host,
|
|
28357
28435
|
status: "skipped",
|
|
@@ -28363,24 +28441,24 @@ function syncHost(host, sourceRoot, targetHome, marketplaceRoot) {
|
|
|
28363
28441
|
}
|
|
28364
28442
|
const profiles = [];
|
|
28365
28443
|
let files = 0;
|
|
28366
|
-
for (const entry of
|
|
28444
|
+
for (const entry of fs9.readdirSync(srcDir, { withFileTypes: true })) {
|
|
28367
28445
|
if (!entry.isDirectory())
|
|
28368
28446
|
continue;
|
|
28369
28447
|
if (!isSafeDirName(entry.name))
|
|
28370
28448
|
continue;
|
|
28371
|
-
const srcProfileDir =
|
|
28372
|
-
const destProfileDir =
|
|
28373
|
-
|
|
28374
|
-
for (const fileEntry of
|
|
28449
|
+
const srcProfileDir = path13.join(srcDir, entry.name);
|
|
28450
|
+
const destProfileDir = path13.join(layout.variantsRoot, entry.name);
|
|
28451
|
+
fs9.mkdirSync(destProfileDir, { recursive: true });
|
|
28452
|
+
for (const fileEntry of fs9.readdirSync(srcProfileDir, { withFileTypes: true })) {
|
|
28375
28453
|
if (!fileEntry.isFile())
|
|
28376
28454
|
continue;
|
|
28377
|
-
const content =
|
|
28455
|
+
const content = fs9.readFileSync(path13.join(srcProfileDir, fileEntry.name));
|
|
28378
28456
|
writeFileIntoDirAtomically(destProfileDir, fileEntry.name, content);
|
|
28379
28457
|
files++;
|
|
28380
28458
|
}
|
|
28381
28459
|
profiles.push(entry.name);
|
|
28382
28460
|
}
|
|
28383
|
-
const retained =
|
|
28461
|
+
const retained = fs9.readdirSync(layout.variantsRoot, { withFileTypes: true }).filter((e) => e.isDirectory() && !profiles.includes(e.name)).map((e) => e.name).sort();
|
|
28384
28462
|
return { host, status: "synced", profiles: profiles.sort(), retained, files };
|
|
28385
28463
|
}
|
|
28386
28464
|
function syncGeneratedVariants(opts) {
|
|
@@ -28415,14 +28493,14 @@ var init_variant_sync = __esm(() => {
|
|
|
28415
28493
|
});
|
|
28416
28494
|
|
|
28417
28495
|
// ../../packages/shared/dist/profile-switch/repo-root.js
|
|
28418
|
-
import
|
|
28419
|
-
import
|
|
28496
|
+
import fs10 from "fs";
|
|
28497
|
+
import path14 from "path";
|
|
28420
28498
|
function findRepoRootWithMarker(startDir, marker, maxLevels) {
|
|
28421
28499
|
let dir = startDir;
|
|
28422
28500
|
for (let i = 0;i <= maxLevels; i++) {
|
|
28423
|
-
if (
|
|
28501
|
+
if (fs10.existsSync(path14.join(dir, marker)))
|
|
28424
28502
|
return dir;
|
|
28425
|
-
const parent =
|
|
28503
|
+
const parent = path14.dirname(dir);
|
|
28426
28504
|
if (parent === dir)
|
|
28427
28505
|
break;
|
|
28428
28506
|
dir = parent;
|
|
@@ -28432,6 +28510,9 @@ function findRepoRootWithMarker(startDir, marker, maxLevels) {
|
|
|
28432
28510
|
var init_repo_root = () => {};
|
|
28433
28511
|
|
|
28434
28512
|
// ../../packages/shared/dist/bootstrap/rules.js
|
|
28513
|
+
function isRetiredRuleId(value) {
|
|
28514
|
+
return RETIRED_RULE_IDS.includes(value);
|
|
28515
|
+
}
|
|
28435
28516
|
function isBootstrapRuleId(value) {
|
|
28436
28517
|
return typeof value === "string" && BOOTSTRAP_RULE_IDS.includes(value);
|
|
28437
28518
|
}
|
|
@@ -28450,12 +28531,14 @@ function assertKnownRuleId(id) {
|
|
|
28450
28531
|
if (!isBootstrapRuleId(id))
|
|
28451
28532
|
throw UnknownRuleError(id, BOOTSTRAP_RULE_IDS);
|
|
28452
28533
|
}
|
|
28453
|
-
var BOOTSTRAP_RULE_IDS, BOOTSTRAP_RULES, RULES_BY_ID, BootstrapRuleError, UnknownRuleError = (id, known = BOOTSTRAP_RULE_IDS) =>
|
|
28534
|
+
var BOOTSTRAP_RULE_IDS, RETIRED_RULE_IDS, BOOTSTRAP_RULES, RULES_BY_ID, BootstrapRuleError, UnknownRuleError = (id, known = BOOTSTRAP_RULE_IDS) => {
|
|
28535
|
+
const what = isRetiredRuleId(id) ? `bootstrap rule "${id}" was retired and can no longer be toggled` : `unknown bootstrap rule "${id}"`;
|
|
28536
|
+
return namedError4("UnknownRuleError", `${what} \u2014 valid ids: ${known.join(", ")}`);
|
|
28537
|
+
};
|
|
28454
28538
|
var init_rules = __esm(() => {
|
|
28455
28539
|
BOOTSTRAP_RULE_IDS = [
|
|
28456
28540
|
"caveman",
|
|
28457
28541
|
"massa-ai-router",
|
|
28458
|
-
"persona-router",
|
|
28459
28542
|
"dedupe-guardrails",
|
|
28460
28543
|
"plan-challenge",
|
|
28461
28544
|
"conversation-feedback",
|
|
@@ -28463,6 +28546,7 @@ var init_rules = __esm(() => {
|
|
|
28463
28546
|
"english-code",
|
|
28464
28547
|
"code-comments"
|
|
28465
28548
|
];
|
|
28549
|
+
RETIRED_RULE_IDS = ["persona-router"];
|
|
28466
28550
|
BOOTSTRAP_RULES = [
|
|
28467
28551
|
{
|
|
28468
28552
|
id: "caveman",
|
|
@@ -28474,11 +28558,6 @@ var init_rules = __esm(() => {
|
|
|
28474
28558
|
defaultEnabled: true,
|
|
28475
28559
|
description: "Load the massa-ai skill as the workflow router before substantive work."
|
|
28476
28560
|
},
|
|
28477
|
-
{
|
|
28478
|
-
id: "persona-router",
|
|
28479
|
-
defaultEnabled: true,
|
|
28480
|
-
description: "Select one cataloged specialist persona after massa-ai context is available."
|
|
28481
|
-
},
|
|
28482
28561
|
{
|
|
28483
28562
|
id: "dedupe-guardrails",
|
|
28484
28563
|
defaultEnabled: true,
|
|
@@ -28520,7 +28599,7 @@ var init_rules = __esm(() => {
|
|
|
28520
28599
|
});
|
|
28521
28600
|
|
|
28522
28601
|
// ../../packages/shared/dist/bootstrap/state.js
|
|
28523
|
-
import
|
|
28602
|
+
import fs11 from "fs";
|
|
28524
28603
|
function isPlainObject4(value) {
|
|
28525
28604
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
28526
28605
|
}
|
|
@@ -28541,6 +28620,8 @@ function resolveBootstrapState(doc2) {
|
|
|
28541
28620
|
return { state, ignoredStateKeys: [BOOTSTRAP_STATE_PATH] };
|
|
28542
28621
|
}
|
|
28543
28622
|
for (const [key, value] of Object.entries(rules)) {
|
|
28623
|
+
if (isRetiredRuleId(key))
|
|
28624
|
+
continue;
|
|
28544
28625
|
if (!isBootstrapRuleId(key) || typeof value !== "boolean") {
|
|
28545
28626
|
ignored.push(key);
|
|
28546
28627
|
continue;
|
|
@@ -28551,7 +28632,7 @@ function resolveBootstrapState(doc2) {
|
|
|
28551
28632
|
}
|
|
28552
28633
|
function readConfigBytes() {
|
|
28553
28634
|
try {
|
|
28554
|
-
return
|
|
28635
|
+
return fs11.readFileSync(getConfigPath(), "utf-8");
|
|
28555
28636
|
} catch (error51) {
|
|
28556
28637
|
if (error51?.code === "ENOENT")
|
|
28557
28638
|
return "";
|
|
@@ -28606,7 +28687,7 @@ var init_state2 = __esm(() => {
|
|
|
28606
28687
|
});
|
|
28607
28688
|
|
|
28608
28689
|
// ../../packages/shared/dist/bootstrap/render.js
|
|
28609
|
-
import
|
|
28690
|
+
import path15 from "path";
|
|
28610
28691
|
function wrapBootstrapBlock(body) {
|
|
28611
28692
|
return `${BOOTSTRAP_BLOCK_START}
|
|
28612
28693
|
${body.replace(/\n+$/, "")}
|
|
@@ -28619,19 +28700,19 @@ function ruleMarker(id, suffix) {
|
|
|
28619
28700
|
function resolveHostRoot(host, targetHome, hostRoot) {
|
|
28620
28701
|
requireAbsoluteTargetHome(targetHome);
|
|
28621
28702
|
if (hostRoot === undefined)
|
|
28622
|
-
return
|
|
28623
|
-
const relative =
|
|
28624
|
-
if (!
|
|
28703
|
+
return path15.join(targetHome, ...HOST_CONFIG_DIR[host]);
|
|
28704
|
+
const relative = path15.relative(targetHome, hostRoot);
|
|
28705
|
+
if (!path15.isAbsolute(hostRoot) || relative === "" || relative.startsWith("..") || path15.isAbsolute(relative)) {
|
|
28625
28706
|
throw new BootstrapRenderError("HostRootOutsideTargetHomeError", `hostRoot must be an absolute directory inside targetHome, got "${hostRoot}" for targetHome "${targetHome}"`, [hostRoot, targetHome]);
|
|
28626
28707
|
}
|
|
28627
28708
|
return hostRoot;
|
|
28628
28709
|
}
|
|
28629
28710
|
function bootstrapContractPath(host, targetHome, hostRoot) {
|
|
28630
|
-
return
|
|
28711
|
+
return path15.join(resolveHostRoot(host, targetHome, hostRoot), CONTRACT_FILENAME);
|
|
28631
28712
|
}
|
|
28632
28713
|
function bootstrapStateFilePath(targetHome) {
|
|
28633
28714
|
requireAbsoluteTargetHome(targetHome);
|
|
28634
|
-
return
|
|
28715
|
+
return path15.join(targetHome, ".config", "massa-ai", "config.json");
|
|
28635
28716
|
}
|
|
28636
28717
|
function renderBootstrap(options) {
|
|
28637
28718
|
const { source, state, host, targetHome, hostRoot } = options;
|
|
@@ -28654,7 +28735,7 @@ ${body}`;
|
|
|
28654
28735
|
return { contract, pointer };
|
|
28655
28736
|
}
|
|
28656
28737
|
function requireAbsoluteTargetHome(targetHome) {
|
|
28657
|
-
if (!
|
|
28738
|
+
if (!path15.isAbsolute(targetHome)) {
|
|
28658
28739
|
throw new BootstrapRenderError("TargetHomeNotAbsoluteError", `targetHome must be an absolute path, got "${targetHome}"`, [targetHome]);
|
|
28659
28740
|
}
|
|
28660
28741
|
}
|
|
@@ -28831,14 +28912,14 @@ var init_report = __esm(() => {
|
|
|
28831
28912
|
});
|
|
28832
28913
|
|
|
28833
28914
|
// ../../packages/shared/dist/bootstrap/engine.js
|
|
28834
|
-
import
|
|
28835
|
-
import
|
|
28915
|
+
import fs12 from "fs";
|
|
28916
|
+
import path16 from "path";
|
|
28836
28917
|
function applyBootstrapState(options) {
|
|
28837
28918
|
const { targetHome } = options;
|
|
28838
28919
|
const dryRun = options.dryRun ?? false;
|
|
28839
28920
|
const warn = options.onWarning ?? ((message) => console.warn(message));
|
|
28840
28921
|
const configPath = bootstrapStateFilePath(targetHome);
|
|
28841
|
-
const installStatePath =
|
|
28922
|
+
const installStatePath = path16.join(path16.dirname(configPath), INSTALL_STATE_FILENAME);
|
|
28842
28923
|
const { platforms } = readInstallState(installStatePath);
|
|
28843
28924
|
const installed = HOSTS.filter((host) => platforms[host] !== undefined);
|
|
28844
28925
|
if (installed.length === 0) {
|
|
@@ -28931,22 +29012,22 @@ function applyHost(input) {
|
|
|
28931
29012
|
}
|
|
28932
29013
|
function wiringArtifact(host, targetHome, hostRoot) {
|
|
28933
29014
|
const root = resolveHostRoot(host, targetHome, hostRoot);
|
|
28934
|
-
const contractPath =
|
|
29015
|
+
const contractPath = path16.join(root, CONTRACT_FILENAME);
|
|
28935
29016
|
switch (host) {
|
|
28936
29017
|
case "claude":
|
|
28937
|
-
return { file:
|
|
29018
|
+
return { file: path16.join(root, "CLAUDE.md"), token: `@${CONTRACT_FILENAME}` };
|
|
28938
29019
|
case "codex":
|
|
28939
29020
|
case "cursor":
|
|
28940
|
-
return { file:
|
|
29021
|
+
return { file: path16.join(root, "AGENTS.md"), token: contractPath };
|
|
28941
29022
|
case "opencode":
|
|
28942
29023
|
return { file: openCodeConfigPath(root), token: `"${contractPath}"` };
|
|
28943
29024
|
}
|
|
28944
29025
|
}
|
|
28945
29026
|
function openCodeConfigPath(root) {
|
|
28946
|
-
const json2 =
|
|
28947
|
-
if (
|
|
29027
|
+
const json2 = path16.join(root, "opencode.json");
|
|
29028
|
+
if (fs12.existsSync(json2))
|
|
28948
29029
|
return json2;
|
|
28949
|
-
return
|
|
29030
|
+
return path16.join(root, "opencode.jsonc");
|
|
28950
29031
|
}
|
|
28951
29032
|
function isWired(host, targetHome, hostRoot) {
|
|
28952
29033
|
const artifact = wiringArtifact(host, targetHome, hostRoot);
|
|
@@ -28959,7 +29040,7 @@ function notWiredReason(host, targetHome, hostRoot) {
|
|
|
28959
29040
|
}
|
|
28960
29041
|
function readFileOrNull(filePath) {
|
|
28961
29042
|
try {
|
|
28962
|
-
return
|
|
29043
|
+
return fs12.readFileSync(filePath, "utf-8");
|
|
28963
29044
|
} catch {
|
|
28964
29045
|
return null;
|
|
28965
29046
|
}
|
|
@@ -29041,6 +29122,7 @@ var init_dist = __esm(() => {
|
|
|
29041
29122
|
init_state();
|
|
29042
29123
|
init_lock();
|
|
29043
29124
|
init_engine();
|
|
29125
|
+
init_ownership();
|
|
29044
29126
|
init_variant_sync();
|
|
29045
29127
|
init_repo_root();
|
|
29046
29128
|
init_doctor();
|
|
@@ -30566,7 +30648,7 @@ var import_brace_expansion, minimatch = (p, pattern, options = {}) => {
|
|
|
30566
30648
|
}, qmarksTestNoExtDot = ([$0]) => {
|
|
30567
30649
|
const len = $0.length;
|
|
30568
30650
|
return (f) => f.length === len && f !== "." && f !== "..";
|
|
30569
|
-
}, defaultPlatform,
|
|
30651
|
+
}, defaultPlatform, path17, 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) => {
|
|
30570
30652
|
if (!def || typeof def !== "object" || !Object.keys(def).length) {
|
|
30571
30653
|
return minimatch;
|
|
30572
30654
|
}
|
|
@@ -30624,11 +30706,11 @@ var init_esm = __esm(() => {
|
|
|
30624
30706
|
starRE = /^\*+$/;
|
|
30625
30707
|
qmarksRE = /^\?+([^+@!?\*\[\(]*)?$/;
|
|
30626
30708
|
defaultPlatform = typeof process === "object" && process ? typeof process.env === "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
|
|
30627
|
-
|
|
30709
|
+
path17 = {
|
|
30628
30710
|
win32: { sep: "\\" },
|
|
30629
30711
|
posix: { sep: "/" }
|
|
30630
30712
|
};
|
|
30631
|
-
sep = defaultPlatform === "win32" ?
|
|
30713
|
+
sep = defaultPlatform === "win32" ? path17.win32.sep : path17.posix.sep;
|
|
30632
30714
|
minimatch.sep = sep;
|
|
30633
30715
|
GLOBSTAR = Symbol("globstar **");
|
|
30634
30716
|
minimatch.GLOBSTAR = GLOBSTAR;
|
|
@@ -32594,12 +32676,12 @@ var init_esm4 = __esm(() => {
|
|
|
32594
32676
|
childrenCache() {
|
|
32595
32677
|
return this.#children;
|
|
32596
32678
|
}
|
|
32597
|
-
resolve(
|
|
32598
|
-
if (!
|
|
32679
|
+
resolve(path18) {
|
|
32680
|
+
if (!path18) {
|
|
32599
32681
|
return this;
|
|
32600
32682
|
}
|
|
32601
|
-
const rootPath = this.getRootString(
|
|
32602
|
-
const dir =
|
|
32683
|
+
const rootPath = this.getRootString(path18);
|
|
32684
|
+
const dir = path18.substring(rootPath.length);
|
|
32603
32685
|
const dirParts = dir.split(this.splitSep);
|
|
32604
32686
|
const result = rootPath ? this.getRoot(rootPath).#resolveParts(dirParts) : this.#resolveParts(dirParts);
|
|
32605
32687
|
return result;
|
|
@@ -33127,8 +33209,8 @@ var init_esm4 = __esm(() => {
|
|
|
33127
33209
|
newChild(name, type = UNKNOWN, opts = {}) {
|
|
33128
33210
|
return new PathWin32(name, type, this.root, this.roots, this.nocase, this.childrenCache(), opts);
|
|
33129
33211
|
}
|
|
33130
|
-
getRootString(
|
|
33131
|
-
return win32.parse(
|
|
33212
|
+
getRootString(path18) {
|
|
33213
|
+
return win32.parse(path18).root;
|
|
33132
33214
|
}
|
|
33133
33215
|
getRoot(rootPath) {
|
|
33134
33216
|
rootPath = uncToDrive(rootPath.toUpperCase());
|
|
@@ -33153,8 +33235,8 @@ var init_esm4 = __esm(() => {
|
|
|
33153
33235
|
constructor(name, type = UNKNOWN, root, roots, nocase, children, opts) {
|
|
33154
33236
|
super(name, type, root, roots, nocase, children, opts);
|
|
33155
33237
|
}
|
|
33156
|
-
getRootString(
|
|
33157
|
-
return
|
|
33238
|
+
getRootString(path18) {
|
|
33239
|
+
return path18.startsWith("/") ? "/" : "";
|
|
33158
33240
|
}
|
|
33159
33241
|
getRoot(_rootPath) {
|
|
33160
33242
|
return this.root;
|
|
@@ -33173,8 +33255,8 @@ var init_esm4 = __esm(() => {
|
|
|
33173
33255
|
#children;
|
|
33174
33256
|
nocase;
|
|
33175
33257
|
#fs;
|
|
33176
|
-
constructor(cwd = process.cwd(), pathImpl, sep2, { nocase, childrenCacheSize = 16 * 1024, fs:
|
|
33177
|
-
this.#fs = fsFromOption(
|
|
33258
|
+
constructor(cwd = process.cwd(), pathImpl, sep2, { nocase, childrenCacheSize = 16 * 1024, fs: fs13 = defaultFS } = {}) {
|
|
33259
|
+
this.#fs = fsFromOption(fs13);
|
|
33178
33260
|
if (cwd instanceof URL || cwd.startsWith("file://")) {
|
|
33179
33261
|
cwd = fileURLToPath(cwd);
|
|
33180
33262
|
}
|
|
@@ -33210,11 +33292,11 @@ var init_esm4 = __esm(() => {
|
|
|
33210
33292
|
}
|
|
33211
33293
|
this.cwd = prev;
|
|
33212
33294
|
}
|
|
33213
|
-
depth(
|
|
33214
|
-
if (typeof
|
|
33215
|
-
|
|
33295
|
+
depth(path18 = this.cwd) {
|
|
33296
|
+
if (typeof path18 === "string") {
|
|
33297
|
+
path18 = this.cwd.resolve(path18);
|
|
33216
33298
|
}
|
|
33217
|
-
return
|
|
33299
|
+
return path18.depth();
|
|
33218
33300
|
}
|
|
33219
33301
|
childrenCache() {
|
|
33220
33302
|
return this.#children;
|
|
@@ -33630,9 +33712,9 @@ var init_esm4 = __esm(() => {
|
|
|
33630
33712
|
process4();
|
|
33631
33713
|
return results;
|
|
33632
33714
|
}
|
|
33633
|
-
chdir(
|
|
33715
|
+
chdir(path18 = this.cwd) {
|
|
33634
33716
|
const oldCwd = this.cwd;
|
|
33635
|
-
this.cwd = typeof
|
|
33717
|
+
this.cwd = typeof path18 === "string" ? this.cwd.resolve(path18) : path18;
|
|
33636
33718
|
this.cwd[setAsCwd](oldCwd);
|
|
33637
33719
|
}
|
|
33638
33720
|
};
|
|
@@ -33649,8 +33731,8 @@ var init_esm4 = __esm(() => {
|
|
|
33649
33731
|
parseRootPath(dir) {
|
|
33650
33732
|
return win32.parse(dir).root.toUpperCase();
|
|
33651
33733
|
}
|
|
33652
|
-
newRoot(
|
|
33653
|
-
return new PathWin32(this.rootPath, IFDIR, undefined, this.roots, this.nocase, this.childrenCache(), { fs:
|
|
33734
|
+
newRoot(fs13) {
|
|
33735
|
+
return new PathWin32(this.rootPath, IFDIR, undefined, this.roots, this.nocase, this.childrenCache(), { fs: fs13 });
|
|
33654
33736
|
}
|
|
33655
33737
|
isAbsolute(p) {
|
|
33656
33738
|
return p.startsWith("/") || p.startsWith("\\") || /^[a-z]:(\/|\\)/i.test(p);
|
|
@@ -33666,8 +33748,8 @@ var init_esm4 = __esm(() => {
|
|
|
33666
33748
|
parseRootPath(_dir) {
|
|
33667
33749
|
return "/";
|
|
33668
33750
|
}
|
|
33669
|
-
newRoot(
|
|
33670
|
-
return new PathPosix(this.rootPath, IFDIR, undefined, this.roots, this.nocase, this.childrenCache(), { fs:
|
|
33751
|
+
newRoot(fs13) {
|
|
33752
|
+
return new PathPosix(this.rootPath, IFDIR, undefined, this.roots, this.nocase, this.childrenCache(), { fs: fs13 });
|
|
33671
33753
|
}
|
|
33672
33754
|
isAbsolute(p) {
|
|
33673
33755
|
return p.startsWith("/");
|
|
@@ -33924,8 +34006,8 @@ class MatchRecord {
|
|
|
33924
34006
|
this.store.set(target, current === undefined ? n : n & current);
|
|
33925
34007
|
}
|
|
33926
34008
|
entries() {
|
|
33927
|
-
return [...this.store.entries()].map(([
|
|
33928
|
-
|
|
34009
|
+
return [...this.store.entries()].map(([path18, n]) => [
|
|
34010
|
+
path18,
|
|
33929
34011
|
!!(n & 2),
|
|
33930
34012
|
!!(n & 1)
|
|
33931
34013
|
]);
|
|
@@ -34129,9 +34211,9 @@ class GlobUtil {
|
|
|
34129
34211
|
signal;
|
|
34130
34212
|
maxDepth;
|
|
34131
34213
|
includeChildMatches;
|
|
34132
|
-
constructor(patterns,
|
|
34214
|
+
constructor(patterns, path18, opts) {
|
|
34133
34215
|
this.patterns = patterns;
|
|
34134
|
-
this.path =
|
|
34216
|
+
this.path = path18;
|
|
34135
34217
|
this.opts = opts;
|
|
34136
34218
|
this.#sep = !opts.posix && opts.platform === "win32" ? "\\" : "/";
|
|
34137
34219
|
this.includeChildMatches = opts.includeChildMatches !== false;
|
|
@@ -34150,11 +34232,11 @@ class GlobUtil {
|
|
|
34150
34232
|
});
|
|
34151
34233
|
}
|
|
34152
34234
|
}
|
|
34153
|
-
#ignored(
|
|
34154
|
-
return this.seen.has(
|
|
34235
|
+
#ignored(path18) {
|
|
34236
|
+
return this.seen.has(path18) || !!this.#ignore?.ignored?.(path18);
|
|
34155
34237
|
}
|
|
34156
|
-
#childrenIgnored(
|
|
34157
|
-
return !!this.#ignore?.childrenIgnored?.(
|
|
34238
|
+
#childrenIgnored(path18) {
|
|
34239
|
+
return !!this.#ignore?.childrenIgnored?.(path18);
|
|
34158
34240
|
}
|
|
34159
34241
|
pause() {
|
|
34160
34242
|
this.paused = true;
|
|
@@ -34371,8 +34453,8 @@ var init_walker = __esm(() => {
|
|
|
34371
34453
|
init_processor();
|
|
34372
34454
|
GlobWalker = class GlobWalker extends GlobUtil {
|
|
34373
34455
|
matches = new Set;
|
|
34374
|
-
constructor(patterns,
|
|
34375
|
-
super(patterns,
|
|
34456
|
+
constructor(patterns, path18, opts) {
|
|
34457
|
+
super(patterns, path18, opts);
|
|
34376
34458
|
}
|
|
34377
34459
|
matchEmit(e) {
|
|
34378
34460
|
this.matches.add(e);
|
|
@@ -34409,8 +34491,8 @@ var init_walker = __esm(() => {
|
|
|
34409
34491
|
};
|
|
34410
34492
|
GlobStream = class GlobStream extends GlobUtil {
|
|
34411
34493
|
results;
|
|
34412
|
-
constructor(patterns,
|
|
34413
|
-
super(patterns,
|
|
34494
|
+
constructor(patterns, path18, opts) {
|
|
34495
|
+
super(patterns, path18, opts);
|
|
34414
34496
|
this.results = new Minipass({
|
|
34415
34497
|
signal: this.signal,
|
|
34416
34498
|
objectMode: true
|
|
@@ -34838,20 +34920,20 @@ var require_ignore = __commonJS((exports, module) => {
|
|
|
34838
34920
|
var throwError = (message, Ctor) => {
|
|
34839
34921
|
throw new Ctor(message);
|
|
34840
34922
|
};
|
|
34841
|
-
var checkPath = (
|
|
34842
|
-
if (!isString(
|
|
34923
|
+
var checkPath = (path18, originalPath, doThrow) => {
|
|
34924
|
+
if (!isString(path18)) {
|
|
34843
34925
|
return doThrow(`path must be a string, but got \`${originalPath}\``, TypeError);
|
|
34844
34926
|
}
|
|
34845
|
-
if (!
|
|
34927
|
+
if (!path18) {
|
|
34846
34928
|
return doThrow(`path must not be empty`, TypeError);
|
|
34847
34929
|
}
|
|
34848
|
-
if (checkPath.isNotRelative(
|
|
34930
|
+
if (checkPath.isNotRelative(path18)) {
|
|
34849
34931
|
const r = "`path.relative()`d";
|
|
34850
34932
|
return doThrow(`path should be a ${r} string, but got "${originalPath}"`, RangeError);
|
|
34851
34933
|
}
|
|
34852
34934
|
return true;
|
|
34853
34935
|
};
|
|
34854
|
-
var isNotRelative = (
|
|
34936
|
+
var isNotRelative = (path18) => REGEX_TEST_INVALID_PATH.test(path18);
|
|
34855
34937
|
checkPath.isNotRelative = isNotRelative;
|
|
34856
34938
|
checkPath.convert = (p) => p;
|
|
34857
34939
|
|
|
@@ -34894,7 +34976,7 @@ var require_ignore = __commonJS((exports, module) => {
|
|
|
34894
34976
|
addPattern(pattern) {
|
|
34895
34977
|
return this.add(pattern);
|
|
34896
34978
|
}
|
|
34897
|
-
_testOne(
|
|
34979
|
+
_testOne(path18, checkUnignored) {
|
|
34898
34980
|
let ignored = false;
|
|
34899
34981
|
let unignored = false;
|
|
34900
34982
|
this._rules.forEach((rule) => {
|
|
@@ -34902,7 +34984,7 @@ var require_ignore = __commonJS((exports, module) => {
|
|
|
34902
34984
|
if (unignored === negative && ignored !== unignored || negative && !ignored && !unignored && !checkUnignored) {
|
|
34903
34985
|
return;
|
|
34904
34986
|
}
|
|
34905
|
-
const matched = rule.regex.test(
|
|
34987
|
+
const matched = rule.regex.test(path18);
|
|
34906
34988
|
if (matched) {
|
|
34907
34989
|
ignored = !negative;
|
|
34908
34990
|
unignored = negative;
|
|
@@ -34914,39 +34996,39 @@ var require_ignore = __commonJS((exports, module) => {
|
|
|
34914
34996
|
};
|
|
34915
34997
|
}
|
|
34916
34998
|
_test(originalPath, cache, checkUnignored, slices) {
|
|
34917
|
-
const
|
|
34918
|
-
checkPath(
|
|
34919
|
-
return this._t(
|
|
34999
|
+
const path18 = originalPath && checkPath.convert(originalPath);
|
|
35000
|
+
checkPath(path18, originalPath, this._allowRelativePaths ? RETURN_FALSE : throwError);
|
|
35001
|
+
return this._t(path18, cache, checkUnignored, slices);
|
|
34920
35002
|
}
|
|
34921
|
-
_t(
|
|
34922
|
-
if (
|
|
34923
|
-
return cache[
|
|
35003
|
+
_t(path18, cache, checkUnignored, slices) {
|
|
35004
|
+
if (path18 in cache) {
|
|
35005
|
+
return cache[path18];
|
|
34924
35006
|
}
|
|
34925
35007
|
if (!slices) {
|
|
34926
|
-
slices =
|
|
35008
|
+
slices = path18.split(SLASH2);
|
|
34927
35009
|
}
|
|
34928
35010
|
slices.pop();
|
|
34929
35011
|
if (!slices.length) {
|
|
34930
|
-
return cache[
|
|
35012
|
+
return cache[path18] = this._testOne(path18, checkUnignored);
|
|
34931
35013
|
}
|
|
34932
35014
|
const parent = this._t(slices.join(SLASH2) + SLASH2, cache, checkUnignored, slices);
|
|
34933
|
-
return cache[
|
|
35015
|
+
return cache[path18] = parent.ignored ? parent : this._testOne(path18, checkUnignored);
|
|
34934
35016
|
}
|
|
34935
|
-
ignores(
|
|
34936
|
-
return this._test(
|
|
35017
|
+
ignores(path18) {
|
|
35018
|
+
return this._test(path18, this._ignoreCache, false).ignored;
|
|
34937
35019
|
}
|
|
34938
35020
|
createFilter() {
|
|
34939
|
-
return (
|
|
35021
|
+
return (path18) => !this.ignores(path18);
|
|
34940
35022
|
}
|
|
34941
35023
|
filter(paths) {
|
|
34942
35024
|
return makeArray(paths).filter(this.createFilter());
|
|
34943
35025
|
}
|
|
34944
|
-
test(
|
|
34945
|
-
return this._test(
|
|
35026
|
+
test(path18) {
|
|
35027
|
+
return this._test(path18, this._testCache, true);
|
|
34946
35028
|
}
|
|
34947
35029
|
}
|
|
34948
35030
|
var factory = (options) => new Ignore2(options);
|
|
34949
|
-
var isPathValid = (
|
|
35031
|
+
var isPathValid = (path18) => checkPath(path18 && checkPath.convert(path18), path18, RETURN_FALSE);
|
|
34950
35032
|
factory.isPathValid = isPathValid;
|
|
34951
35033
|
factory.default = factory;
|
|
34952
35034
|
module.exports = factory;
|
|
@@ -34954,7 +35036,7 @@ var require_ignore = __commonJS((exports, module) => {
|
|
|
34954
35036
|
const makePosix = (str) => /^\\\\\?\\/.test(str) || /["<>|\u0000-\u001F]+/u.test(str) ? str : str.replace(/\\/g, "/");
|
|
34955
35037
|
checkPath.convert = makePosix;
|
|
34956
35038
|
const REGIX_IS_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i;
|
|
34957
|
-
checkPath.isNotRelative = (
|
|
35039
|
+
checkPath.isNotRelative = (path18) => REGIX_IS_WINDOWS_PATH_ABSOLUTE.test(path18) || isNotRelative(path18);
|
|
34958
35040
|
}
|
|
34959
35041
|
});
|
|
34960
35042
|
|
|
@@ -35016,18 +35098,18 @@ function validatePolicy(policy, opts = {}) {
|
|
|
35016
35098
|
}
|
|
35017
35099
|
}
|
|
35018
35100
|
}
|
|
35019
|
-
function
|
|
35101
|
+
function matchesGlob(path18, pattern) {
|
|
35020
35102
|
let re = regexCache.get(pattern);
|
|
35021
35103
|
if (!re) {
|
|
35022
35104
|
re = globToRegex(pattern);
|
|
35023
35105
|
regexCache.set(pattern, re);
|
|
35024
35106
|
}
|
|
35025
|
-
return re.test(
|
|
35107
|
+
return re.test(path18);
|
|
35026
35108
|
}
|
|
35027
35109
|
var DEFAULT_POLICY, applyPolicy = (filePath, policy) => {
|
|
35028
35110
|
const normalized = filePath.trim();
|
|
35029
35111
|
for (const rule of policy.rules) {
|
|
35030
|
-
if (
|
|
35112
|
+
if (matchesGlob(normalized, rule.pattern))
|
|
35031
35113
|
return rule.disposition;
|
|
35032
35114
|
}
|
|
35033
35115
|
return "Keep";
|
|
@@ -35039,8 +35121,8 @@ var init_capture_policy = __esm(() => {
|
|
|
35039
35121
|
});
|
|
35040
35122
|
|
|
35041
35123
|
// ../../packages/core/dist/services/search/ignore-patterns.js
|
|
35042
|
-
import
|
|
35043
|
-
import
|
|
35124
|
+
import fs13 from "fs/promises";
|
|
35125
|
+
import path18 from "path";
|
|
35044
35126
|
function buildExtensionGlob(extensions) {
|
|
35045
35127
|
return extensions.map((ext2) => `**/*${ext2}`);
|
|
35046
35128
|
}
|
|
@@ -35063,8 +35145,8 @@ async function loadProjectIgnore(projectPath) {
|
|
|
35063
35145
|
const ig = ignore();
|
|
35064
35146
|
ig.add(DEFAULT_IGNORES);
|
|
35065
35147
|
try {
|
|
35066
|
-
const gitignorePath =
|
|
35067
|
-
const gitignoreContent = await
|
|
35148
|
+
const gitignorePath = path18.join(projectPath, ".gitignore");
|
|
35149
|
+
const gitignoreContent = await fs13.readFile(gitignorePath, "utf8");
|
|
35068
35150
|
const rules = gitignoreContent.split(`
|
|
35069
35151
|
`).map((line) => line.trim()).filter((line) => line && !line.startsWith("#"));
|
|
35070
35152
|
ig.add(rules);
|
|
@@ -36663,15 +36745,15 @@ var require_pg_connection_string = __commonJS((exports, module) => {
|
|
|
36663
36745
|
if (config3.sslnegotiation === "direct" && config3.ssl === undefined) {
|
|
36664
36746
|
config3.ssl = true;
|
|
36665
36747
|
}
|
|
36666
|
-
const
|
|
36748
|
+
const fs14 = config3.sslcert || config3.sslkey || config3.sslrootcert ? __require("fs") : null;
|
|
36667
36749
|
if (config3.sslcert) {
|
|
36668
|
-
config3.ssl.cert =
|
|
36750
|
+
config3.ssl.cert = fs14.readFileSync(config3.sslcert).toString();
|
|
36669
36751
|
}
|
|
36670
36752
|
if (config3.sslkey) {
|
|
36671
|
-
config3.ssl.key =
|
|
36753
|
+
config3.ssl.key = fs14.readFileSync(config3.sslkey).toString();
|
|
36672
36754
|
}
|
|
36673
36755
|
if (config3.sslrootcert) {
|
|
36674
|
-
config3.ssl.ca =
|
|
36756
|
+
config3.ssl.ca = fs14.readFileSync(config3.sslrootcert).toString();
|
|
36675
36757
|
}
|
|
36676
36758
|
if (options.useLibpqCompat && config3.uselibpqcompat) {
|
|
36677
36759
|
throw new Error("Both useLibpqCompat and uselibpqcompat are set. Please use only one of them.");
|
|
@@ -38385,7 +38467,7 @@ var require_split2 = __commonJS((exports, module) => {
|
|
|
38385
38467
|
|
|
38386
38468
|
// ../../node_modules/pgpass/lib/helper.js
|
|
38387
38469
|
var require_helper = __commonJS((exports, module) => {
|
|
38388
|
-
var
|
|
38470
|
+
var path19 = __require("path");
|
|
38389
38471
|
var Stream2 = __require("stream").Stream;
|
|
38390
38472
|
var split = require_split2();
|
|
38391
38473
|
var util3 = __require("util");
|
|
@@ -38425,7 +38507,7 @@ var require_helper = __commonJS((exports, module) => {
|
|
|
38425
38507
|
};
|
|
38426
38508
|
exports.getFileName = function(rawEnv) {
|
|
38427
38509
|
var env = rawEnv || process.env;
|
|
38428
|
-
var file2 = env.PGPASSFILE || (isWin ?
|
|
38510
|
+
var file2 = env.PGPASSFILE || (isWin ? path19.join(env.APPDATA || "./", "postgresql", "pgpass.conf") : path19.join(env.HOME || "./", ".pgpass"));
|
|
38429
38511
|
return file2;
|
|
38430
38512
|
};
|
|
38431
38513
|
exports.usePgPass = function(stats, fname) {
|
|
@@ -38549,16 +38631,16 @@ var require_helper = __commonJS((exports, module) => {
|
|
|
38549
38631
|
|
|
38550
38632
|
// ../../node_modules/pgpass/lib/index.js
|
|
38551
38633
|
var require_lib = __commonJS((exports, module) => {
|
|
38552
|
-
var
|
|
38553
|
-
var
|
|
38634
|
+
var path19 = __require("path");
|
|
38635
|
+
var fs14 = __require("fs");
|
|
38554
38636
|
var helper = require_helper();
|
|
38555
38637
|
module.exports = function(connInfo, cb) {
|
|
38556
38638
|
var file2 = helper.getFileName();
|
|
38557
|
-
|
|
38639
|
+
fs14.stat(file2, function(err, stat) {
|
|
38558
38640
|
if (err || !helper.usePgPass(stat, file2)) {
|
|
38559
38641
|
return cb(undefined);
|
|
38560
38642
|
}
|
|
38561
|
-
var st =
|
|
38643
|
+
var st = fs14.createReadStream(file2);
|
|
38562
38644
|
helper.getPassword(connInfo, st, cb);
|
|
38563
38645
|
});
|
|
38564
38646
|
};
|
|
@@ -40257,8 +40339,8 @@ var init_alias_resolver = __esm(() => {
|
|
|
40257
40339
|
});
|
|
40258
40340
|
|
|
40259
40341
|
// ../../packages/core/dist/services/search/index-manager.js
|
|
40260
|
-
import
|
|
40261
|
-
import
|
|
40342
|
+
import fs14 from "fs";
|
|
40343
|
+
import path19 from "path";
|
|
40262
40344
|
|
|
40263
40345
|
class IndexManager {
|
|
40264
40346
|
metadataCache = new Map;
|
|
@@ -40351,9 +40433,9 @@ class IndexManager {
|
|
|
40351
40433
|
const fileMetadata = {};
|
|
40352
40434
|
let totalSize = 0;
|
|
40353
40435
|
for (const filePath of indexedFiles) {
|
|
40354
|
-
const fullPath =
|
|
40436
|
+
const fullPath = path19.join(projectPath, filePath);
|
|
40355
40437
|
try {
|
|
40356
|
-
const stat = await
|
|
40438
|
+
const stat = await fs14.promises.stat(fullPath);
|
|
40357
40439
|
fileMetadata[filePath] = {
|
|
40358
40440
|
path: filePath,
|
|
40359
40441
|
mtime: stat.mtimeMs,
|
|
@@ -40404,9 +40486,9 @@ class IndexManager {
|
|
|
40404
40486
|
if (ig.ignores(match2)) {
|
|
40405
40487
|
continue;
|
|
40406
40488
|
}
|
|
40407
|
-
const fullPath =
|
|
40489
|
+
const fullPath = path19.join(projectPath, match2);
|
|
40408
40490
|
try {
|
|
40409
|
-
const stat = await
|
|
40491
|
+
const stat = await fs14.promises.stat(fullPath);
|
|
40410
40492
|
files.set(match2, {
|
|
40411
40493
|
path: match2,
|
|
40412
40494
|
mtime: stat.mtimeMs,
|
|
@@ -43659,23 +43741,23 @@ var require_auth_config = __commonJS((exports, module) => {
|
|
|
43659
43741
|
writeAuthConfig: () => writeAuthConfig
|
|
43660
43742
|
});
|
|
43661
43743
|
module.exports = __toCommonJS2(auth_config_exports);
|
|
43662
|
-
var
|
|
43663
|
-
var
|
|
43744
|
+
var fs15 = __toESM2(__require("fs"));
|
|
43745
|
+
var path20 = __toESM2(__require("path"));
|
|
43664
43746
|
var import_token_util = require_token_util();
|
|
43665
43747
|
function getAuthConfigPath() {
|
|
43666
43748
|
const dataDir = (0, import_token_util.getVercelDataDir)();
|
|
43667
43749
|
if (!dataDir) {
|
|
43668
43750
|
throw new Error(`Unable to find Vercel CLI data directory. Your platform: ${process.platform}. Supported: darwin, linux, win32.`);
|
|
43669
43751
|
}
|
|
43670
|
-
return
|
|
43752
|
+
return path20.join(dataDir, "auth.json");
|
|
43671
43753
|
}
|
|
43672
43754
|
function readAuthConfig() {
|
|
43673
43755
|
try {
|
|
43674
43756
|
const authPath = getAuthConfigPath();
|
|
43675
|
-
if (!
|
|
43757
|
+
if (!fs15.existsSync(authPath)) {
|
|
43676
43758
|
return null;
|
|
43677
43759
|
}
|
|
43678
|
-
const content =
|
|
43760
|
+
const content = fs15.readFileSync(authPath, "utf8");
|
|
43679
43761
|
if (!content) {
|
|
43680
43762
|
return null;
|
|
43681
43763
|
}
|
|
@@ -43686,11 +43768,11 @@ var require_auth_config = __commonJS((exports, module) => {
|
|
|
43686
43768
|
}
|
|
43687
43769
|
function writeAuthConfig(config3) {
|
|
43688
43770
|
const authPath = getAuthConfigPath();
|
|
43689
|
-
const authDir =
|
|
43690
|
-
if (!
|
|
43691
|
-
|
|
43771
|
+
const authDir = path20.dirname(authPath);
|
|
43772
|
+
if (!fs15.existsSync(authDir)) {
|
|
43773
|
+
fs15.mkdirSync(authDir, { mode: 504, recursive: true });
|
|
43692
43774
|
}
|
|
43693
|
-
|
|
43775
|
+
fs15.writeFileSync(authPath, JSON.stringify(config3, null, 2), { mode: 384 });
|
|
43694
43776
|
}
|
|
43695
43777
|
function isValidAccessToken(authConfig, expirationBufferMs = 0) {
|
|
43696
43778
|
if (!authConfig.token)
|
|
@@ -43865,8 +43947,8 @@ var require_token_util = __commonJS((exports, module) => {
|
|
|
43865
43947
|
saveToken: () => saveToken
|
|
43866
43948
|
});
|
|
43867
43949
|
module.exports = __toCommonJS2(token_util_exports);
|
|
43868
|
-
var
|
|
43869
|
-
var
|
|
43950
|
+
var path20 = __toESM2(__require("path"));
|
|
43951
|
+
var fs15 = __toESM2(__require("fs"));
|
|
43870
43952
|
var import_token_error = require_token_error();
|
|
43871
43953
|
var import_token_io = require_token_io();
|
|
43872
43954
|
var import_auth_config = require_auth_config();
|
|
@@ -43878,7 +43960,7 @@ var require_token_util = __commonJS((exports, module) => {
|
|
|
43878
43960
|
if (!dataDir) {
|
|
43879
43961
|
return null;
|
|
43880
43962
|
}
|
|
43881
|
-
return
|
|
43963
|
+
return path20.join(dataDir, vercelFolder);
|
|
43882
43964
|
}
|
|
43883
43965
|
async function getVercelToken2(options) {
|
|
43884
43966
|
const authConfig = (0, import_auth_config.readAuthConfig)();
|
|
@@ -43946,11 +44028,11 @@ var require_token_util = __commonJS((exports, module) => {
|
|
|
43946
44028
|
if (!dir) {
|
|
43947
44029
|
throw new import_token_error.VercelOidcTokenError("Unable to find project root directory. Have you linked your project with `vc link?`");
|
|
43948
44030
|
}
|
|
43949
|
-
const prjPath =
|
|
43950
|
-
if (!
|
|
44031
|
+
const prjPath = path20.join(dir, ".vercel", "project.json");
|
|
44032
|
+
if (!fs15.existsSync(prjPath)) {
|
|
43951
44033
|
throw new import_token_error.VercelOidcTokenError("project.json not found, have you linked your project with `vc link?`");
|
|
43952
44034
|
}
|
|
43953
|
-
const prj = JSON.parse(
|
|
44035
|
+
const prj = JSON.parse(fs15.readFileSync(prjPath, "utf8"));
|
|
43954
44036
|
if (typeof prj.projectId !== "string" && typeof prj.orgId !== "string") {
|
|
43955
44037
|
throw new TypeError("Expected a string-valued projectId property. Try running `vc link` to re-link your project.");
|
|
43956
44038
|
}
|
|
@@ -43961,11 +44043,11 @@ var require_token_util = __commonJS((exports, module) => {
|
|
|
43961
44043
|
if (!dir) {
|
|
43962
44044
|
throw new import_token_error.VercelOidcTokenError("Unable to find user data directory. Please reach out to Vercel support.");
|
|
43963
44045
|
}
|
|
43964
|
-
const tokenPath =
|
|
44046
|
+
const tokenPath = path20.join(dir, "com.vercel.token", `${projectId}.json`);
|
|
43965
44047
|
const tokenJson = JSON.stringify(token);
|
|
43966
|
-
|
|
43967
|
-
|
|
43968
|
-
|
|
44048
|
+
fs15.mkdirSync(path20.dirname(tokenPath), { mode: 504, recursive: true });
|
|
44049
|
+
fs15.writeFileSync(tokenPath, tokenJson);
|
|
44050
|
+
fs15.chmodSync(tokenPath, 432);
|
|
43969
44051
|
return;
|
|
43970
44052
|
}
|
|
43971
44053
|
function loadToken(projectId) {
|
|
@@ -43973,11 +44055,11 @@ var require_token_util = __commonJS((exports, module) => {
|
|
|
43973
44055
|
if (!dir) {
|
|
43974
44056
|
throw new import_token_error.VercelOidcTokenError("Unable to find user data directory. Please reach out to Vercel support.");
|
|
43975
44057
|
}
|
|
43976
|
-
const tokenPath =
|
|
43977
|
-
if (!
|
|
44058
|
+
const tokenPath = path20.join(dir, "com.vercel.token", `${projectId}.json`);
|
|
44059
|
+
if (!fs15.existsSync(tokenPath)) {
|
|
43978
44060
|
return null;
|
|
43979
44061
|
}
|
|
43980
|
-
const token = JSON.parse(
|
|
44062
|
+
const token = JSON.parse(fs15.readFileSync(tokenPath, "utf8"));
|
|
43981
44063
|
assertVercelOidcTokenResponse(token);
|
|
43982
44064
|
return token;
|
|
43983
44065
|
}
|
|
@@ -54819,37 +54901,37 @@ function createOpenAI(options = {}) {
|
|
|
54819
54901
|
}, `ai-sdk/openai/${VERSION4}`);
|
|
54820
54902
|
const createChatModel = (modelId) => new OpenAIChatLanguageModel(modelId, {
|
|
54821
54903
|
provider: `${providerName}.chat`,
|
|
54822
|
-
url: ({ path:
|
|
54904
|
+
url: ({ path: path20 }) => `${baseURL}${path20}`,
|
|
54823
54905
|
headers: getHeaders,
|
|
54824
54906
|
fetch: options.fetch
|
|
54825
54907
|
});
|
|
54826
54908
|
const createCompletionModel = (modelId) => new OpenAICompletionLanguageModel(modelId, {
|
|
54827
54909
|
provider: `${providerName}.completion`,
|
|
54828
|
-
url: ({ path:
|
|
54910
|
+
url: ({ path: path20 }) => `${baseURL}${path20}`,
|
|
54829
54911
|
headers: getHeaders,
|
|
54830
54912
|
fetch: options.fetch
|
|
54831
54913
|
});
|
|
54832
54914
|
const createEmbeddingModel = (modelId) => new OpenAIEmbeddingModel(modelId, {
|
|
54833
54915
|
provider: `${providerName}.embedding`,
|
|
54834
|
-
url: ({ path:
|
|
54916
|
+
url: ({ path: path20 }) => `${baseURL}${path20}`,
|
|
54835
54917
|
headers: getHeaders,
|
|
54836
54918
|
fetch: options.fetch
|
|
54837
54919
|
});
|
|
54838
54920
|
const createImageModel = (modelId) => new OpenAIImageModel(modelId, {
|
|
54839
54921
|
provider: `${providerName}.image`,
|
|
54840
|
-
url: ({ path:
|
|
54922
|
+
url: ({ path: path20 }) => `${baseURL}${path20}`,
|
|
54841
54923
|
headers: getHeaders,
|
|
54842
54924
|
fetch: options.fetch
|
|
54843
54925
|
});
|
|
54844
54926
|
const createTranscriptionModel = (modelId) => new OpenAITranscriptionModel(modelId, {
|
|
54845
54927
|
provider: `${providerName}.transcription`,
|
|
54846
|
-
url: ({ path:
|
|
54928
|
+
url: ({ path: path20 }) => `${baseURL}${path20}`,
|
|
54847
54929
|
headers: getHeaders,
|
|
54848
54930
|
fetch: options.fetch
|
|
54849
54931
|
});
|
|
54850
54932
|
const createSpeechModel = (modelId) => new OpenAISpeechModel(modelId, {
|
|
54851
54933
|
provider: `${providerName}.speech`,
|
|
54852
|
-
url: ({ path:
|
|
54934
|
+
url: ({ path: path20 }) => `${baseURL}${path20}`,
|
|
54853
54935
|
headers: getHeaders,
|
|
54854
54936
|
fetch: options.fetch
|
|
54855
54937
|
});
|
|
@@ -54862,7 +54944,7 @@ function createOpenAI(options = {}) {
|
|
|
54862
54944
|
const createResponsesModel = (modelId) => {
|
|
54863
54945
|
return new OpenAIResponsesLanguageModel(modelId, {
|
|
54864
54946
|
provider: `${providerName}.responses`,
|
|
54865
|
-
url: ({ path:
|
|
54947
|
+
url: ({ path: path20 }) => `${baseURL}${path20}`,
|
|
54866
54948
|
headers: getHeaders,
|
|
54867
54949
|
fetch: options.fetch,
|
|
54868
54950
|
fileIdPrefixes: ["file-"]
|
|
@@ -71517,26 +71599,26 @@ var require_process = __commonJS((exports, module) => {
|
|
|
71517
71599
|
|
|
71518
71600
|
// ../../node_modules/detect-libc/lib/filesystem.js
|
|
71519
71601
|
var require_filesystem = __commonJS((exports, module) => {
|
|
71520
|
-
var
|
|
71602
|
+
var fs15 = __require("fs");
|
|
71521
71603
|
var LDD_PATH = "/usr/bin/ldd";
|
|
71522
71604
|
var SELF_PATH = "/proc/self/exe";
|
|
71523
71605
|
var MAX_LENGTH = 2048;
|
|
71524
|
-
var readFileSync2 = (
|
|
71525
|
-
const fd =
|
|
71606
|
+
var readFileSync2 = (path20) => {
|
|
71607
|
+
const fd = fs15.openSync(path20, "r");
|
|
71526
71608
|
const buffer = Buffer.alloc(MAX_LENGTH);
|
|
71527
|
-
const bytesRead =
|
|
71528
|
-
|
|
71609
|
+
const bytesRead = fs15.readSync(fd, buffer, 0, MAX_LENGTH, 0);
|
|
71610
|
+
fs15.close(fd, () => {});
|
|
71529
71611
|
return buffer.subarray(0, bytesRead);
|
|
71530
71612
|
};
|
|
71531
|
-
var readFile = (
|
|
71532
|
-
|
|
71613
|
+
var readFile = (path20) => new Promise((resolve4, reject) => {
|
|
71614
|
+
fs15.open(path20, "r", (err, fd) => {
|
|
71533
71615
|
if (err) {
|
|
71534
71616
|
reject(err);
|
|
71535
71617
|
} else {
|
|
71536
71618
|
const buffer = Buffer.alloc(MAX_LENGTH);
|
|
71537
|
-
|
|
71619
|
+
fs15.read(fd, buffer, 0, MAX_LENGTH, 0, (_, bytesRead) => {
|
|
71538
71620
|
resolve4(buffer.subarray(0, bytesRead));
|
|
71539
|
-
|
|
71621
|
+
fs15.close(fd, () => {});
|
|
71540
71622
|
});
|
|
71541
71623
|
}
|
|
71542
71624
|
});
|
|
@@ -71641,11 +71723,11 @@ var require_detect_libc = __commonJS((exports, module) => {
|
|
|
71641
71723
|
}
|
|
71642
71724
|
return null;
|
|
71643
71725
|
};
|
|
71644
|
-
var familyFromInterpreterPath = (
|
|
71645
|
-
if (
|
|
71646
|
-
if (
|
|
71726
|
+
var familyFromInterpreterPath = (path20) => {
|
|
71727
|
+
if (path20) {
|
|
71728
|
+
if (path20.includes("/ld-musl-")) {
|
|
71647
71729
|
return MUSL;
|
|
71648
|
-
} else if (
|
|
71730
|
+
} else if (path20.includes("/ld-linux-")) {
|
|
71649
71731
|
return GLIBC;
|
|
71650
71732
|
}
|
|
71651
71733
|
}
|
|
@@ -71690,8 +71772,8 @@ var require_detect_libc = __commonJS((exports, module) => {
|
|
|
71690
71772
|
cachedFamilyInterpreter = null;
|
|
71691
71773
|
try {
|
|
71692
71774
|
const selfContent = await readFile(SELF_PATH);
|
|
71693
|
-
const
|
|
71694
|
-
cachedFamilyInterpreter = familyFromInterpreterPath(
|
|
71775
|
+
const path20 = interpreterPath(selfContent);
|
|
71776
|
+
cachedFamilyInterpreter = familyFromInterpreterPath(path20);
|
|
71695
71777
|
} catch (e) {}
|
|
71696
71778
|
return cachedFamilyInterpreter;
|
|
71697
71779
|
};
|
|
@@ -71702,8 +71784,8 @@ var require_detect_libc = __commonJS((exports, module) => {
|
|
|
71702
71784
|
cachedFamilyInterpreter = null;
|
|
71703
71785
|
try {
|
|
71704
71786
|
const selfContent = readFileSync2(SELF_PATH);
|
|
71705
|
-
const
|
|
71706
|
-
cachedFamilyInterpreter = familyFromInterpreterPath(
|
|
71787
|
+
const path20 = interpreterPath(selfContent);
|
|
71788
|
+
cachedFamilyInterpreter = familyFromInterpreterPath(path20);
|
|
71707
71789
|
} catch (e) {}
|
|
71708
71790
|
return cachedFamilyInterpreter;
|
|
71709
71791
|
};
|
|
@@ -73365,18 +73447,18 @@ var require_sharp = __commonJS((exports, module) => {
|
|
|
73365
73447
|
`@img/sharp-${runtimePlatform}/sharp.node`,
|
|
73366
73448
|
"@img/sharp-wasm32/sharp.node"
|
|
73367
73449
|
];
|
|
73368
|
-
var
|
|
73450
|
+
var path20;
|
|
73369
73451
|
var sharp;
|
|
73370
73452
|
var errors4 = [];
|
|
73371
|
-
for (
|
|
73453
|
+
for (path20 of paths) {
|
|
73372
73454
|
try {
|
|
73373
|
-
sharp = __require(
|
|
73455
|
+
sharp = __require(path20);
|
|
73374
73456
|
break;
|
|
73375
73457
|
} catch (err) {
|
|
73376
73458
|
errors4.push(err);
|
|
73377
73459
|
}
|
|
73378
73460
|
}
|
|
73379
|
-
if (sharp &&
|
|
73461
|
+
if (sharp && path20.startsWith("@img/sharp-linux-x64") && !sharp._isUsingX64V2()) {
|
|
73380
73462
|
const err = new Error("Prebuilt binaries for linux-x64 require v2 microarchitecture");
|
|
73381
73463
|
err.code = "Unsupported CPU";
|
|
73382
73464
|
errors4.push(err);
|
|
@@ -76238,15 +76320,15 @@ var require_color = __commonJS((exports, module) => {
|
|
|
76238
76320
|
};
|
|
76239
76321
|
}
|
|
76240
76322
|
function wrapConversion(toModel, graph) {
|
|
76241
|
-
const
|
|
76323
|
+
const path20 = [graph[toModel].parent, toModel];
|
|
76242
76324
|
let fn = conversions_default[graph[toModel].parent][toModel];
|
|
76243
76325
|
let cur = graph[toModel].parent;
|
|
76244
76326
|
while (graph[cur].parent) {
|
|
76245
|
-
|
|
76327
|
+
path20.unshift(graph[cur].parent);
|
|
76246
76328
|
fn = link(conversions_default[graph[cur].parent][cur], fn);
|
|
76247
76329
|
cur = graph[cur].parent;
|
|
76248
76330
|
}
|
|
76249
|
-
fn.conversion =
|
|
76331
|
+
fn.conversion = path20;
|
|
76250
76332
|
return fn;
|
|
76251
76333
|
}
|
|
76252
76334
|
function route(fromModel) {
|
|
@@ -76851,7 +76933,7 @@ var require_output = __commonJS((exports, module) => {
|
|
|
76851
76933
|
Copyright 2013 Lovell Fuller and others.
|
|
76852
76934
|
SPDX-License-Identifier: Apache-2.0
|
|
76853
76935
|
*/
|
|
76854
|
-
var
|
|
76936
|
+
var path20 = __require("path");
|
|
76855
76937
|
var is = require_is();
|
|
76856
76938
|
var sharp = require_sharp();
|
|
76857
76939
|
var formats = new Map([
|
|
@@ -76882,9 +76964,9 @@ var require_output = __commonJS((exports, module) => {
|
|
|
76882
76964
|
let err;
|
|
76883
76965
|
if (!is.string(fileOut)) {
|
|
76884
76966
|
err = new Error("Missing output file path");
|
|
76885
|
-
} else if (is.string(this.options.input.file) &&
|
|
76967
|
+
} else if (is.string(this.options.input.file) && path20.resolve(this.options.input.file) === path20.resolve(fileOut)) {
|
|
76886
76968
|
err = new Error("Cannot use same file for input and output");
|
|
76887
|
-
} else if (jp2Regex.test(
|
|
76969
|
+
} else if (jp2Regex.test(path20.extname(fileOut)) && !this.constructor.format.jp2k.output.file) {
|
|
76888
76970
|
err = errJp2Save();
|
|
76889
76971
|
}
|
|
76890
76972
|
if (err) {
|
|
@@ -84131,11 +84213,11 @@ var init_transformers_node = __esm(() => {
|
|
|
84131
84213
|
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}).`);
|
|
84132
84214
|
}
|
|
84133
84215
|
for (let i = 0;i < num_chunks; ++i) {
|
|
84134
|
-
const
|
|
84135
|
-
const fullPath = `${options.subfolder ?? ""}/${
|
|
84216
|
+
const path20 = `${baseName}_data${i === 0 ? "" : "_" + i}`;
|
|
84217
|
+
const fullPath = `${options.subfolder ?? ""}/${path20}`;
|
|
84136
84218
|
externalDataPromises.push(new Promise(async (resolve4, reject) => {
|
|
84137
84219
|
const data = await (0, _utils_hub_js__WEBPACK_IMPORTED_MODULE_5__.getModelFile)(pretrained_model_name_or_path, fullPath, true, options, return_path);
|
|
84138
|
-
resolve4(data instanceof Uint8Array ? { path:
|
|
84220
|
+
resolve4(data instanceof Uint8Array ? { path: path20, data } : path20);
|
|
84139
84221
|
}));
|
|
84140
84222
|
}
|
|
84141
84223
|
} else if (session_options.externalData !== undefined) {
|
|
@@ -97199,7 +97281,7 @@ ${fake_token_around_image}` + `${global_img_token}` + image_token.repeat(image_s
|
|
|
97199
97281
|
const blob = new Blob([wav], { type: "audio/wav" });
|
|
97200
97282
|
return blob;
|
|
97201
97283
|
}
|
|
97202
|
-
async save(
|
|
97284
|
+
async save(path20) {
|
|
97203
97285
|
let fn;
|
|
97204
97286
|
if (_env_js__WEBPACK_IMPORTED_MODULE_3__.apis.IS_BROWSER_ENV) {
|
|
97205
97287
|
if (_env_js__WEBPACK_IMPORTED_MODULE_3__.apis.IS_WEBWORKER_ENV) {
|
|
@@ -97207,14 +97289,14 @@ ${fake_token_around_image}` + `${global_img_token}` + image_token.repeat(image_s
|
|
|
97207
97289
|
}
|
|
97208
97290
|
fn = _core_js__WEBPACK_IMPORTED_MODULE_2__.saveBlob;
|
|
97209
97291
|
} else if (_env_js__WEBPACK_IMPORTED_MODULE_3__.apis.IS_FS_AVAILABLE) {
|
|
97210
|
-
fn = async (
|
|
97292
|
+
fn = async (path21, blob) => {
|
|
97211
97293
|
let buffer = await blob.arrayBuffer();
|
|
97212
|
-
node_fs__WEBPACK_IMPORTED_MODULE_5__["default"].writeFileSync(
|
|
97294
|
+
node_fs__WEBPACK_IMPORTED_MODULE_5__["default"].writeFileSync(path21, Buffer.from(buffer));
|
|
97213
97295
|
};
|
|
97214
97296
|
} else {
|
|
97215
97297
|
throw new Error("Unable to save because filesystem is disabled in this environment.");
|
|
97216
97298
|
}
|
|
97217
|
-
await fn(
|
|
97299
|
+
await fn(path20, this.toBlob());
|
|
97218
97300
|
}
|
|
97219
97301
|
}
|
|
97220
97302
|
},
|
|
@@ -97310,11 +97392,11 @@ ${fake_token_around_image}` + `${global_img_token}` + image_token.repeat(image_s
|
|
|
97310
97392
|
function calculateReflectOffset(i, w) {
|
|
97311
97393
|
return Math.abs((i + w) % (2 * w) - w);
|
|
97312
97394
|
}
|
|
97313
|
-
function saveBlob(
|
|
97395
|
+
function saveBlob(path20, blob) {
|
|
97314
97396
|
const dataURL = URL.createObjectURL(blob);
|
|
97315
97397
|
const downloadLink = document.createElement("a");
|
|
97316
97398
|
downloadLink.href = dataURL;
|
|
97317
|
-
downloadLink.download =
|
|
97399
|
+
downloadLink.download = path20;
|
|
97318
97400
|
downloadLink.click();
|
|
97319
97401
|
downloadLink.remove();
|
|
97320
97402
|
URL.revokeObjectURL(dataURL);
|
|
@@ -97915,8 +97997,8 @@ ${fake_token_around_image}` + `${global_img_token}` + image_token.repeat(image_s
|
|
|
97915
97997
|
}
|
|
97916
97998
|
|
|
97917
97999
|
class FileCache {
|
|
97918
|
-
constructor(
|
|
97919
|
-
this.path =
|
|
98000
|
+
constructor(path20) {
|
|
98001
|
+
this.path = path20;
|
|
97920
98002
|
}
|
|
97921
98003
|
async match(request) {
|
|
97922
98004
|
let filePath = node_path__WEBPACK_IMPORTED_MODULE_1__["default"].join(this.path, request);
|
|
@@ -98672,20 +98754,20 @@ ${fake_token_around_image}` + `${global_img_token}` + image_token.repeat(image_s
|
|
|
98672
98754
|
}
|
|
98673
98755
|
return this;
|
|
98674
98756
|
}
|
|
98675
|
-
async save(
|
|
98757
|
+
async save(path20) {
|
|
98676
98758
|
if (IS_BROWSER_OR_WEBWORKER) {
|
|
98677
98759
|
if (_env_js__WEBPACK_IMPORTED_MODULE_2__.apis.IS_WEBWORKER_ENV) {
|
|
98678
98760
|
throw new Error("Unable to save an image from a Web Worker.");
|
|
98679
98761
|
}
|
|
98680
|
-
const extension =
|
|
98762
|
+
const extension = path20.split(".").pop().toLowerCase();
|
|
98681
98763
|
const mime = CONTENT_TYPE_MAP.get(extension) ?? "image/png";
|
|
98682
98764
|
const blob = await this.toBlob(mime);
|
|
98683
|
-
(0, _core_js__WEBPACK_IMPORTED_MODULE_0__.saveBlob)(
|
|
98765
|
+
(0, _core_js__WEBPACK_IMPORTED_MODULE_0__.saveBlob)(path20, blob);
|
|
98684
98766
|
} else if (!_env_js__WEBPACK_IMPORTED_MODULE_2__.apis.IS_FS_AVAILABLE) {
|
|
98685
98767
|
throw new Error("Unable to save the image because filesystem is disabled in this environment.");
|
|
98686
98768
|
} else {
|
|
98687
98769
|
const img = this.toSharp();
|
|
98688
|
-
return await img.toFile(
|
|
98770
|
+
return await img.toFile(path20);
|
|
98689
98771
|
}
|
|
98690
98772
|
}
|
|
98691
98773
|
toSharp() {
|
|
@@ -108225,10 +108307,10 @@ Note that ${s.bold("include")} statements only accept relation fields.`, a;
|
|
|
108225
108307
|
super(t, "P2023", r);
|
|
108226
108308
|
}
|
|
108227
108309
|
};
|
|
108228
|
-
var
|
|
108310
|
+
var fs15 = new WeakMap;
|
|
108229
108311
|
function Ep(e) {
|
|
108230
|
-
let t =
|
|
108231
|
-
return t || (t = Object.entries(e),
|
|
108312
|
+
let t = fs15.get(e);
|
|
108313
|
+
return t || (t = Object.entries(e), fs15.set(e, t)), t;
|
|
108232
108314
|
}
|
|
108233
108315
|
function hs(e, t, r) {
|
|
108234
108316
|
switch (t.type) {
|
|
@@ -112196,7 +112278,7 @@ var require_prisma = __commonJS((exports) => {
|
|
|
112196
112278
|
Prisma.JsonNull = JsonNull2;
|
|
112197
112279
|
Prisma.AnyNull = AnyNull2;
|
|
112198
112280
|
Prisma.NullTypes = NullTypes2;
|
|
112199
|
-
var
|
|
112281
|
+
var path20 = __require("path");
|
|
112200
112282
|
exports.Prisma.TransactionIsolationLevel = makeStrictEnum2({
|
|
112201
112283
|
ReadUncommitted: "ReadUncommitted",
|
|
112202
112284
|
ReadCommitted: "ReadCommitted",
|
|
@@ -123918,10 +124000,10 @@ var init_chunker_code = __esm(() => {
|
|
|
123918
124000
|
});
|
|
123919
124001
|
|
|
123920
124002
|
// ../../packages/core/dist/services/search/smart-chunker.js
|
|
123921
|
-
import
|
|
124003
|
+
import path20 from "path";
|
|
123922
124004
|
function smartChunk(content, filePath, config3 = {}) {
|
|
123923
124005
|
const cfg = { ...DEFAULT_CONFIG, ...config3 };
|
|
123924
|
-
const ext2 =
|
|
124006
|
+
const ext2 = path20.extname(filePath).toLowerCase();
|
|
123925
124007
|
const relativePath = filePath;
|
|
123926
124008
|
const fileImports = isCodeFile(ext2) ? extractFileImports(content, ext2) : undefined;
|
|
123927
124009
|
let chunks;
|
|
@@ -124259,8 +124341,8 @@ var init_embedding_freshness = __esm(() => {
|
|
|
124259
124341
|
});
|
|
124260
124342
|
|
|
124261
124343
|
// ../../packages/core/dist/services/search/project-indexer.js
|
|
124262
|
-
import
|
|
124263
|
-
import
|
|
124344
|
+
import fs15 from "fs/promises";
|
|
124345
|
+
import path21 from "path";
|
|
124264
124346
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
124265
124347
|
async function runWithIndexLock(lockMap, projectId, work) {
|
|
124266
124348
|
const prevLock = lockMap.get(projectId);
|
|
@@ -124303,7 +124385,7 @@ async function indexProjectInternal(deps, projectPath, projectId, options = {})
|
|
|
124303
124385
|
dot: false
|
|
124304
124386
|
});
|
|
124305
124387
|
const filteredFiles = files.filter((file2) => {
|
|
124306
|
-
const relativePath =
|
|
124388
|
+
const relativePath = path21.relative(projectPath, file2);
|
|
124307
124389
|
const shouldIgnore = ig.ignores(relativePath);
|
|
124308
124390
|
if (shouldIgnore) {
|
|
124309
124391
|
logger.debug("Ignoring file per .gitignore during indexing", {
|
|
@@ -124343,7 +124425,7 @@ async function indexProjectInternal(deps, projectPath, projectId, options = {})
|
|
|
124343
124425
|
});
|
|
124344
124426
|
}
|
|
124345
124427
|
}
|
|
124346
|
-
const indexedFilesList = filteredFiles.map((f) =>
|
|
124428
|
+
const indexedFilesList = filteredFiles.map((f) => path21.relative(projectPath, f));
|
|
124347
124429
|
await deps.indexManager.updateIndexMetadata(projectId, projectPath, indexedFilesList);
|
|
124348
124430
|
logger.info("Project indexing completed", {
|
|
124349
124431
|
projectId,
|
|
@@ -124473,7 +124555,7 @@ async function ensureFreshIndex(deps, projectId, projectPath, options = {}) {
|
|
|
124473
124555
|
let errors4 = 0;
|
|
124474
124556
|
for (const relativeFilePath of filesToReindex) {
|
|
124475
124557
|
try {
|
|
124476
|
-
const fullPath =
|
|
124558
|
+
const fullPath = path21.join(projectPath, relativeFilePath);
|
|
124477
124559
|
const result = await deps.indexFile(fullPath, projectId, projectPath, centralityMap);
|
|
124478
124560
|
filesIndexed++;
|
|
124479
124561
|
chunksIndexed += result.chunks;
|
|
@@ -124533,8 +124615,8 @@ async function checkSearchAdmission(deps, projectId, projectPath) {
|
|
|
124533
124615
|
}
|
|
124534
124616
|
async function indexFile(deps, filePath, projectId, projectRoot, centralityMap) {
|
|
124535
124617
|
projectId = await getProjectIdentityAliasResolver().resolve(projectId);
|
|
124536
|
-
const content = await
|
|
124537
|
-
const relativePath =
|
|
124618
|
+
const content = await fs15.readFile(filePath, "utf-8");
|
|
124619
|
+
const relativePath = path21.relative(projectRoot, filePath);
|
|
124538
124620
|
const maxFileSize = config2.get("security").maxFileSize || 1024 * 1024;
|
|
124539
124621
|
if (content.length > maxFileSize) {
|
|
124540
124622
|
logger.warn("File too large, skipping", {
|
|
@@ -124554,7 +124636,7 @@ async function indexFile(deps, filePath, projectId, projectRoot, centralityMap)
|
|
|
124554
124636
|
chunkIndex: i,
|
|
124555
124637
|
totalChunks: chunks.length,
|
|
124556
124638
|
type: chunk.type,
|
|
124557
|
-
language:
|
|
124639
|
+
language: path21.extname(filePath).slice(1),
|
|
124558
124640
|
lineStart: chunk.lineStart,
|
|
124559
124641
|
lineEnd: chunk.lineEnd,
|
|
124560
124642
|
label: chunk.label,
|
|
@@ -126625,8 +126707,8 @@ function stripNul(content) {
|
|
|
126625
126707
|
}
|
|
126626
126708
|
|
|
126627
126709
|
// ../../packages/core/dist/services/etl/stages/discover.js
|
|
126628
|
-
import
|
|
126629
|
-
import
|
|
126710
|
+
import fs16 from "fs/promises";
|
|
126711
|
+
import path22 from "path";
|
|
126630
126712
|
import { createHash as createHash5 } from "crypto";
|
|
126631
126713
|
|
|
126632
126714
|
class DiscoverStage {
|
|
@@ -126652,7 +126734,7 @@ class DiscoverStage {
|
|
|
126652
126734
|
dot: false,
|
|
126653
126735
|
absolute: false
|
|
126654
126736
|
});
|
|
126655
|
-
relPaths = found.map((p) =>
|
|
126737
|
+
relPaths = found.map((p) => path22.isAbsolute(p) ? path22.relative(ctx.projectPath, p) : p).filter((p) => !ig.ignores(p) && applyPolicy(p, policy) !== "Drop");
|
|
126656
126738
|
}
|
|
126657
126739
|
if (ctx.resumeCursor?.path) {
|
|
126658
126740
|
const cursorPath = ctx.resumeCursor.path;
|
|
@@ -126711,10 +126793,10 @@ class DiscoverStage {
|
|
|
126711
126793
|
return discovered;
|
|
126712
126794
|
}
|
|
126713
126795
|
async processFile(ctx, relativePath, forceReindex) {
|
|
126714
|
-
const absolutePath =
|
|
126796
|
+
const absolutePath = path22.join(ctx.projectPath, relativePath);
|
|
126715
126797
|
try {
|
|
126716
|
-
const stat = await
|
|
126717
|
-
const content = stripNul(await
|
|
126798
|
+
const stat = await fs16.stat(absolutePath);
|
|
126799
|
+
const content = stripNul(await fs16.readFile(absolutePath, "utf-8"));
|
|
126718
126800
|
const contentHash = createHash5("sha256").update(content).digest("hex");
|
|
126719
126801
|
let needsReparse = forceReindex;
|
|
126720
126802
|
if (!forceReindex) {
|
|
@@ -126758,8 +126840,8 @@ class DiscoverStage {
|
|
|
126758
126840
|
ig.add(pattern);
|
|
126759
126841
|
}
|
|
126760
126842
|
try {
|
|
126761
|
-
const gitignorePath =
|
|
126762
|
-
const gitignoreContent = await
|
|
126843
|
+
const gitignorePath = path22.join(projectPath, ".gitignore");
|
|
126844
|
+
const gitignoreContent = await fs16.readFile(gitignorePath, "utf8");
|
|
126763
126845
|
const rules = gitignoreContent.split(`
|
|
126764
126846
|
`).map((line) => line.trim()).filter((line) => line && !line.startsWith("#"));
|
|
126765
126847
|
ig.add(rules);
|
|
@@ -128114,8 +128196,8 @@ function rustUseLeaves(node, source, prefix = []) {
|
|
|
128114
128196
|
}
|
|
128115
128197
|
if (node.type === "use_wildcard")
|
|
128116
128198
|
return [{ path: [...prefix, "*"], glob: true }];
|
|
128117
|
-
const
|
|
128118
|
-
return
|
|
128199
|
+
const path23 = rustPathSegments(node, source);
|
|
128200
|
+
return path23.length ? [{ path: [...prefix, ...path23] }] : [];
|
|
128119
128201
|
}
|
|
128120
128202
|
function functionalCaptures(captures, source, family) {
|
|
128121
128203
|
if (family !== "clojure")
|
|
@@ -129087,8 +129169,8 @@ var init_structural_runtime = __esm(() => {
|
|
|
129087
129169
|
});
|
|
129088
129170
|
|
|
129089
129171
|
// ../../packages/core/dist/services/etl/stages/parse.js
|
|
129090
|
-
import
|
|
129091
|
-
import
|
|
129172
|
+
import path23 from "path";
|
|
129173
|
+
import fs17 from "fs/promises";
|
|
129092
129174
|
function resolveChunkerMaxChars() {
|
|
129093
129175
|
const global2 = Number(process.env.EMBEDDING_MAX_CHARS);
|
|
129094
129176
|
if (Number.isFinite(global2) && global2 > 0)
|
|
@@ -129116,8 +129198,8 @@ class ParseStage {
|
|
|
129116
129198
|
const results = new Map;
|
|
129117
129199
|
let processed = 0;
|
|
129118
129200
|
const phases = [
|
|
129119
|
-
files.filter((file2) =>
|
|
129120
|
-
files.filter((file2) =>
|
|
129201
|
+
files.filter((file2) => path23.extname(file2.relativePath).toLowerCase() !== ".h"),
|
|
129202
|
+
files.filter((file2) => path23.extname(file2.relativePath).toLowerCase() === ".h")
|
|
129121
129203
|
];
|
|
129122
129204
|
const batches = phases.flatMap((phase) => Array.from({ length: Math.ceil(phase.length / BATCH_SIZE) }, (_, index) => phase.slice(index * BATCH_SIZE, (index + 1) * BATCH_SIZE)));
|
|
129123
129205
|
for (const batch of batches) {
|
|
@@ -129155,19 +129237,19 @@ class ParseStage {
|
|
|
129155
129237
|
return files.map((file2) => results.get(file2.relativePath));
|
|
129156
129238
|
}
|
|
129157
129239
|
recordHeaderImporterEvidence(ctx, files, parsedFiles) {
|
|
129158
|
-
const knownHeaders = new Set(files.filter((file2) =>
|
|
129240
|
+
const knownHeaders = new Set(files.filter((file2) => path23.extname(file2.relativePath).toLowerCase() === ".h").map((file2) => path23.posix.normalize(file2.relativePath)));
|
|
129159
129241
|
const mutable = {
|
|
129160
129242
|
...ctx.structuralHeaderEvidenceByFile
|
|
129161
129243
|
};
|
|
129162
129244
|
for (const parsed of parsedFiles) {
|
|
129163
|
-
const extension =
|
|
129245
|
+
const extension = path23.extname(parsed.file.relativePath).toLowerCase();
|
|
129164
129246
|
const key = extension === ".c" ? "cImporters" : [".cpp", ".hpp"].includes(extension) ? "cppImporters" : undefined;
|
|
129165
129247
|
if (!key)
|
|
129166
129248
|
continue;
|
|
129167
129249
|
for (const imported of parsed.rawImports) {
|
|
129168
129250
|
if (!["c_include", "cpp_include"].includes(imported.form) || imported.specifier.startsWith("<"))
|
|
129169
129251
|
continue;
|
|
129170
|
-
const header =
|
|
129252
|
+
const header = path23.posix.normalize(path23.posix.join(path23.posix.dirname(parsed.file.relativePath), imported.specifier));
|
|
129171
129253
|
if (!knownHeaders.has(header))
|
|
129172
129254
|
continue;
|
|
129173
129255
|
const existing = mutable[header] ?? {};
|
|
@@ -129178,9 +129260,9 @@ class ParseStage {
|
|
|
129178
129260
|
}
|
|
129179
129261
|
async parseFile(ctx, file2) {
|
|
129180
129262
|
if (!file2.needsReparse) {
|
|
129181
|
-
const extension =
|
|
129263
|
+
const extension = path23.extname(file2.relativePath).toLowerCase();
|
|
129182
129264
|
if ([".c", ".cpp", ".hpp"].includes(extension)) {
|
|
129183
|
-
const content = file2.snapshotContent ?? await
|
|
129265
|
+
const content = file2.snapshotContent ?? await fs17.readFile(file2.absolutePath, "utf8");
|
|
129184
129266
|
const outcome = await this.runtime.parse({ extension, source: Buffer.from(content) });
|
|
129185
129267
|
if (outcome.status === "failed")
|
|
129186
129268
|
throw new StructuralEtlParseError(file2.relativePath, outcome.failureKind, `Structural evidence parse failed (${outcome.failureKind})`, outcome.diagnosticCount, outcome.diagnostics.slice(0, 10));
|
|
@@ -129192,8 +129274,8 @@ class ParseStage {
|
|
|
129192
129274
|
return { file: file2, chunks: [], symbols: [], rawImports: [], rawEdges: [] };
|
|
129193
129275
|
}
|
|
129194
129276
|
try {
|
|
129195
|
-
const content = file2.snapshotContent ?? await
|
|
129196
|
-
const ext2 =
|
|
129277
|
+
const content = file2.snapshotContent ?? await fs17.readFile(file2.absolutePath, "utf-8");
|
|
129278
|
+
const ext2 = path23.extname(file2.relativePath).toLowerCase();
|
|
129197
129279
|
const chunkerMaxChars = resolveChunkerMaxChars();
|
|
129198
129280
|
const chunks = smartChunk(content, file2.relativePath, chunkerMaxChars ? { maxChunkChars: chunkerMaxChars } : {});
|
|
129199
129281
|
let symbols;
|
|
@@ -129748,7 +129830,7 @@ var init_resolver = __esm(() => {
|
|
|
129748
129830
|
});
|
|
129749
129831
|
|
|
129750
129832
|
// ../../packages/core/dist/services/structural/resolvers/typescript.js
|
|
129751
|
-
import
|
|
129833
|
+
import path24 from "path";
|
|
129752
129834
|
function candidates(identities) {
|
|
129753
129835
|
return Object.freeze(identities.map((identity) => Object.freeze({
|
|
129754
129836
|
fqn: identity.fqn,
|
|
@@ -129843,7 +129925,7 @@ function probe(base, known, dialect = "typescript") {
|
|
|
129843
129925
|
const bases = /\.[cm]?jsx?$/u.test(base) ? [base.replace(/\.[cm]?jsx?$/u, ".ts"), base.replace(/\.[cm]?jsx?$/u, ".tsx"), base] : [base];
|
|
129844
129926
|
for (const candidateBase of bases)
|
|
129845
129927
|
for (const suffix of DIALECT_PROBES[dialect] ?? [""]) {
|
|
129846
|
-
const value =
|
|
129928
|
+
const value = path24.posix.normalize(`${candidateBase}${suffix}`);
|
|
129847
129929
|
if (!value.startsWith("../") && value !== ".." && known.has(value))
|
|
129848
129930
|
return value;
|
|
129849
129931
|
}
|
|
@@ -129852,7 +129934,7 @@ function probe(base, known, dialect = "typescript") {
|
|
|
129852
129934
|
function resolveStructuralSpecifier(specifier, fromFile, build, dialect = "typescript") {
|
|
129853
129935
|
const known = new Set(build.knownFiles.map(normalizeStructuralFile));
|
|
129854
129936
|
if (specifier.startsWith("./") || specifier.startsWith("../")) {
|
|
129855
|
-
return probe(
|
|
129937
|
+
return probe(path24.posix.join(path24.posix.dirname(fromFile), specifier), known, dialect);
|
|
129856
129938
|
}
|
|
129857
129939
|
const aliases = build.pathAliasesByFile?.[normalizeStructuralFile(fromFile)] ?? build.pathAliases ?? [];
|
|
129858
129940
|
for (const alias of aliases) {
|
|
@@ -130116,7 +130198,7 @@ var init_scripting2 = __esm(() => {
|
|
|
130116
130198
|
});
|
|
130117
130199
|
|
|
130118
130200
|
// ../../packages/core/dist/services/structural/resolvers/systems.js
|
|
130119
|
-
import
|
|
130201
|
+
import path25 from "path";
|
|
130120
130202
|
var DIALECTS, SYSTEMS_LANGUAGE_RESOLVER;
|
|
130121
130203
|
var init_systems2 = __esm(() => {
|
|
130122
130204
|
init_typescript2();
|
|
@@ -130135,7 +130217,7 @@ var init_systems2 = __esm(() => {
|
|
|
130135
130217
|
const bindings = item.bindings.map((binding) => binding.imported === "*" && binding.local === "*" && unresolvedTarget && !unresolvedTarget.qualifier ? { ...binding, imported: unresolvedTarget.name, local: unresolvedTarget.name } : binding);
|
|
130136
130218
|
if (item.specifier === "crate" || item.specifier.startsWith("crate/")) {
|
|
130137
130219
|
const crateRoot = file2.file.startsWith("src/") ? "src" : "";
|
|
130138
|
-
return { ...item, bindings, specifier: `./${
|
|
130220
|
+
return { ...item, bindings, specifier: `./${path25.posix.relative(path25.posix.dirname(file2.file), path25.posix.join(crateRoot, item.specifier.replace(/^crate\/?/u, "")))}` };
|
|
130139
130221
|
}
|
|
130140
130222
|
if (item.specifier === "self" || item.specifier.startsWith("self/"))
|
|
130141
130223
|
return { ...item, bindings, specifier: `./${item.specifier.replace(/^self\/?/u, "")}` };
|
|
@@ -130233,8 +130315,8 @@ var init_data_document2 = __esm(() => {
|
|
|
130233
130315
|
});
|
|
130234
130316
|
|
|
130235
130317
|
// ../../packages/core/dist/services/etl/stages/resolve.js
|
|
130236
|
-
import
|
|
130237
|
-
import
|
|
130318
|
+
import path26 from "path";
|
|
130319
|
+
import fs18 from "fs";
|
|
130238
130320
|
|
|
130239
130321
|
class ResolveStage {
|
|
130240
130322
|
symbolRepository;
|
|
@@ -130258,7 +130340,7 @@ class ResolveStage {
|
|
|
130258
130340
|
const structuralDocuments = files.flatMap((file2) => {
|
|
130259
130341
|
if (!file2.structure)
|
|
130260
130342
|
return [];
|
|
130261
|
-
const language = resolveStructuralLanguage(
|
|
130343
|
+
const language = resolveStructuralLanguage(path26.extname(file2.file.relativePath));
|
|
130262
130344
|
if (language.status !== "supported")
|
|
130263
130345
|
throw new Error(`structural_manifest_missing:${file2.file.relativePath}`);
|
|
130264
130346
|
return [{
|
|
@@ -130270,13 +130352,13 @@ class ResolveStage {
|
|
|
130270
130352
|
}];
|
|
130271
130353
|
});
|
|
130272
130354
|
const currentStructuralFiles = new Set(structuralDocuments.map((document2) => document2.file));
|
|
130273
|
-
const skippedStructuralFiles = new Set(files.filter((item) => !item.file.needsReparse && STRUCTURAL_SEED_EXTENSIONS.has(
|
|
130355
|
+
const skippedStructuralFiles = new Set(files.filter((item) => !item.file.needsReparse && STRUCTURAL_SEED_EXTENSIONS.has(path26.extname(item.file.relativePath).toLowerCase())).map((item) => item.file.relativePath));
|
|
130274
130356
|
const pathAliasesByFile = Object.fromEntries([...knownRelPaths].map((file2) => [
|
|
130275
130357
|
file2,
|
|
130276
130358
|
this.structuralAliasesFor(file2, rootAliases, monorepoPackages)
|
|
130277
130359
|
]));
|
|
130278
130360
|
const buildMetadata = { knownFiles: [...knownRelPaths], pathAliasesByFile };
|
|
130279
|
-
const seedRows = repositoryDefinitions.filter((definition) => STRUCTURAL_SEED_EXTENSIONS.has(
|
|
130361
|
+
const seedRows = repositoryDefinitions.filter((definition) => STRUCTURAL_SEED_EXTENSIONS.has(path26.extname(definition.file_path).toLowerCase())).filter((definition) => knownRelPaths.has(definition.file_path) && skippedStructuralFiles.has(definition.file_path)).filter((definition) => !currentStructuralFiles.has(definition.file_path));
|
|
130280
130362
|
const seedIds = new Set;
|
|
130281
130363
|
for (const definition of seedRows) {
|
|
130282
130364
|
if (seedIds.has(definition.id))
|
|
@@ -130369,7 +130451,7 @@ class ResolveStage {
|
|
|
130369
130451
|
if (parsed.file !== definition.file_path) {
|
|
130370
130452
|
throw new Error(`structural_repository_seed_file_mismatch:${definition.id}`);
|
|
130371
130453
|
}
|
|
130372
|
-
const language = resolveStructuralLanguage(
|
|
130454
|
+
const language = resolveStructuralLanguage(path26.extname(definition.file_path));
|
|
130373
130455
|
if (language.status !== "supported")
|
|
130374
130456
|
throw new Error(`structural_repository_seed_language:${definition.id}`);
|
|
130375
130457
|
let identity;
|
|
@@ -130421,7 +130503,7 @@ class ResolveStage {
|
|
|
130421
130503
|
});
|
|
130422
130504
|
}
|
|
130423
130505
|
resolveFile(parsed, projectPath, knownRelPaths, rootAliases, monorepoPackages, symbolIndex, knownFqns) {
|
|
130424
|
-
const fromDir =
|
|
130506
|
+
const fromDir = path26.dirname(path26.join(projectPath, parsed.file.relativePath));
|
|
130425
130507
|
const packageAliases = this.getPackageAliases(parsed.file.relativePath, monorepoPackages);
|
|
130426
130508
|
const allAliases = [...packageAliases, ...rootAliases];
|
|
130427
130509
|
const resolvedImports = parsed.rawImports.map((raw2) => {
|
|
@@ -130492,7 +130574,7 @@ class ResolveStage {
|
|
|
130492
130574
|
index.set(def.name, `${def.file_path}#${def.name}`);
|
|
130493
130575
|
}
|
|
130494
130576
|
} catch (err) {
|
|
130495
|
-
const skippedStructural = files.some((file2) => !file2.file.needsReparse && STRUCTURAL_SEED_EXTENSIONS.has(
|
|
130577
|
+
const skippedStructural = files.some((file2) => !file2.file.needsReparse && STRUCTURAL_SEED_EXTENSIONS.has(path26.extname(file2.file.relativePath).toLowerCase()));
|
|
130496
130578
|
if (skippedStructural)
|
|
130497
130579
|
throw new Error("structural_repository_seed_failed", { cause: err });
|
|
130498
130580
|
logger.warn("buildSymbolIndex: repo seed failed, in-batch only", {
|
|
@@ -130516,7 +130598,7 @@ class ResolveStage {
|
|
|
130516
130598
|
}
|
|
130517
130599
|
resolveSpecifier(specifier, fromDir, projectPath, knownRelPaths, aliases) {
|
|
130518
130600
|
if (specifier.startsWith("./") || specifier.startsWith("../")) {
|
|
130519
|
-
const resolved = this.probeExtensions(
|
|
130601
|
+
const resolved = this.probeExtensions(path26.resolve(fromDir, specifier), projectPath, knownRelPaths);
|
|
130520
130602
|
return { resolvedPath: resolved, external: false };
|
|
130521
130603
|
}
|
|
130522
130604
|
for (const alias of aliases) {
|
|
@@ -130524,8 +130606,8 @@ class ResolveStage {
|
|
|
130524
130606
|
const suffix = specifier.slice(alias.prefix.length);
|
|
130525
130607
|
for (const target of alias.targets) {
|
|
130526
130608
|
const cleanTarget = target.replace(/\/\*$/, "");
|
|
130527
|
-
const basePath = alias.packagePath ?
|
|
130528
|
-
const absPath =
|
|
130609
|
+
const basePath = alias.packagePath ? path26.join(projectPath, alias.packagePath) : projectPath;
|
|
130610
|
+
const absPath = path26.join(basePath, cleanTarget + suffix);
|
|
130529
130611
|
const resolved = this.probeExtensions(absPath, projectPath, knownRelPaths);
|
|
130530
130612
|
if (resolved)
|
|
130531
130613
|
return { resolvedPath: resolved, external: false };
|
|
@@ -130541,7 +130623,7 @@ class ResolveStage {
|
|
|
130541
130623
|
...TS_EXTENSIONS.map((ext2) => absPath.replace(/\.[^.]+$/, ext2))
|
|
130542
130624
|
];
|
|
130543
130625
|
for (const candidate2 of candidates2) {
|
|
130544
|
-
const rel =
|
|
130626
|
+
const rel = path26.relative(projectPath, candidate2).replace(/\\/g, "/");
|
|
130545
130627
|
if (knownRelPaths.has(rel))
|
|
130546
130628
|
return rel;
|
|
130547
130629
|
}
|
|
@@ -130549,9 +130631,9 @@ class ResolveStage {
|
|
|
130549
130631
|
}
|
|
130550
130632
|
loadTsConfigPaths(projectPath, packageBase) {
|
|
130551
130633
|
const aliases = [];
|
|
130552
|
-
const tsconfigPath =
|
|
130634
|
+
const tsconfigPath = path26.join(projectPath, "tsconfig.json");
|
|
130553
130635
|
try {
|
|
130554
|
-
const raw2 =
|
|
130636
|
+
const raw2 = fs18.readFileSync(tsconfigPath, "utf-8");
|
|
130555
130637
|
const stripped = raw2.replace(/\/\/[^\n]*/g, "").replace(/\/\*[\s\S]*?\*\//g, "");
|
|
130556
130638
|
const tsconfig = JSON.parse(stripped);
|
|
130557
130639
|
const paths = tsconfig?.compilerOptions?.paths ?? {};
|
|
@@ -130580,7 +130662,7 @@ class ResolveStage {
|
|
|
130580
130662
|
}
|
|
130581
130663
|
}
|
|
130582
130664
|
for (const packageRelPath of packagePaths) {
|
|
130583
|
-
const absPackagePath =
|
|
130665
|
+
const absPackagePath = path26.join(projectPath, packageRelPath);
|
|
130584
130666
|
const aliases = this.loadTsConfigPaths(absPackagePath, packageRelPath);
|
|
130585
130667
|
if (aliases.length > 0) {
|
|
130586
130668
|
packages.push({
|
|
@@ -130610,7 +130692,7 @@ class ResolveStage {
|
|
|
130610
130692
|
structuralAliasesFor(filePath, rootAliases, packages) {
|
|
130611
130693
|
return [...this.getPackageAliases(filePath, packages), ...rootAliases].map((alias) => ({
|
|
130612
130694
|
pattern: alias.prefix + (alias.targets.some((target) => target.includes("*")) ? "/*" : ""),
|
|
130613
|
-
targets: alias.targets.map((target) => alias.packagePath ?
|
|
130695
|
+
targets: alias.targets.map((target) => alias.packagePath ? path26.posix.join(alias.packagePath, target) : target)
|
|
130614
130696
|
}));
|
|
130615
130697
|
}
|
|
130616
130698
|
}
|
|
@@ -130674,7 +130756,7 @@ var init_with_deadlock_retry = __esm(() => {
|
|
|
130674
130756
|
});
|
|
130675
130757
|
|
|
130676
130758
|
// ../../packages/core/dist/services/etl/stages/load.js
|
|
130677
|
-
import
|
|
130759
|
+
import path27 from "path";
|
|
130678
130760
|
function formatDuration(ms) {
|
|
130679
130761
|
const totalSec = Math.max(0, Math.round(ms / 1000));
|
|
130680
130762
|
if (totalSec < 60)
|
|
@@ -130951,7 +131033,7 @@ class LoadStage {
|
|
|
130951
131033
|
const filePath = file2.file.relativePath;
|
|
130952
131034
|
const batch = buildSymbolPersistenceBatch(ctx.projectId, file2);
|
|
130953
131035
|
if (ctx.graphGenerationLease) {
|
|
130954
|
-
const manifest = getLanguageManifestEntry(
|
|
131036
|
+
const manifest = getLanguageManifestEntry(path27.extname(filePath));
|
|
130955
131037
|
const diagnostics2 = (file2.structuralDiagnostics ?? []).slice(0, 10).map((diagnostic2) => ({
|
|
130956
131038
|
code: diagnostic2.code,
|
|
130957
131039
|
severity: diagnostic2.severity,
|
|
@@ -131408,9 +131490,9 @@ var init_graph_generation_coordinator = __esm(() => {
|
|
|
131408
131490
|
// ../../packages/core/dist/services/etl/pipeline.js
|
|
131409
131491
|
import { createHash as createHash7 } from "crypto";
|
|
131410
131492
|
import { setTimeout as delay2 } from "timers/promises";
|
|
131411
|
-
import
|
|
131493
|
+
import path28 from "path";
|
|
131412
131494
|
function buildHeaderLanguageEvidence(files) {
|
|
131413
|
-
const headers = new Set(files.filter((file2) =>
|
|
131495
|
+
const headers = new Set(files.filter((file2) => path28.posix.extname(file2.relativePath).toLowerCase() === ".h").map((file2) => path28.posix.normalize(file2.relativePath)));
|
|
131414
131496
|
const mutable = new Map;
|
|
131415
131497
|
const entry2 = (header) => {
|
|
131416
131498
|
let value = mutable.get(header);
|
|
@@ -131421,7 +131503,7 @@ function buildHeaderLanguageEvidence(files) {
|
|
|
131421
131503
|
return value;
|
|
131422
131504
|
};
|
|
131423
131505
|
for (const file2 of files) {
|
|
131424
|
-
if (
|
|
131506
|
+
if (path28.posix.basename(file2.relativePath) !== "compile_commands.json" || file2.snapshotContent === undefined)
|
|
131425
131507
|
continue;
|
|
131426
131508
|
let commands;
|
|
131427
131509
|
try {
|
|
@@ -131437,11 +131519,11 @@ function buildHeaderLanguageEvidence(files) {
|
|
|
131437
131519
|
const record3 = command;
|
|
131438
131520
|
if (typeof record3.file !== "string")
|
|
131439
131521
|
continue;
|
|
131440
|
-
const projectRoot =
|
|
131441
|
-
const commandDirectory = typeof record3.directory === "string" ?
|
|
131442
|
-
const absoluteInput =
|
|
131443
|
-
const relative2 =
|
|
131444
|
-
const header =
|
|
131522
|
+
const projectRoot = path28.resolve(file2.absolutePath, ...file2.relativePath.split("/").map(() => ".."));
|
|
131523
|
+
const commandDirectory = typeof record3.directory === "string" ? path28.resolve(projectRoot, record3.directory) : projectRoot;
|
|
131524
|
+
const absoluteInput = path28.resolve(commandDirectory, record3.file);
|
|
131525
|
+
const relative2 = path28.relative(projectRoot, absoluteInput);
|
|
131526
|
+
const header = path28.posix.normalize(relative2.replaceAll(path28.sep, "/"));
|
|
131445
131527
|
if (!headers.has(header))
|
|
131446
131528
|
continue;
|
|
131447
131529
|
const invocation = typeof record3.command === "string" ? record3.command : Array.isArray(record3.arguments) ? record3.arguments.join(" ") : "";
|
|
@@ -131988,9 +132070,9 @@ var init_acquire_indexing_lease = __esm(() => {
|
|
|
131988
132070
|
|
|
131989
132071
|
// ../../packages/core/dist/services/project-identity/project-root-identity.js
|
|
131990
132072
|
import { realpath as realpath2 } from "fs/promises";
|
|
131991
|
-
import
|
|
132073
|
+
import path29 from "path";
|
|
131992
132074
|
async function canonicalizeProjectRoot(projectPath, canonicalize = realpath2) {
|
|
131993
|
-
return canonicalize(
|
|
132075
|
+
return canonicalize(path29.resolve(projectPath));
|
|
131994
132076
|
}
|
|
131995
132077
|
async function assertProjectRootReuse(options) {
|
|
131996
132078
|
if (!options.storedProjectPath || options.forceReindex)
|
|
@@ -131998,9 +132080,9 @@ async function assertProjectRootReuse(options) {
|
|
|
131998
132080
|
const canonicalize = options.canonicalize ?? realpath2;
|
|
131999
132081
|
let storedCanonical;
|
|
132000
132082
|
try {
|
|
132001
|
-
storedCanonical = await canonicalize(
|
|
132083
|
+
storedCanonical = await canonicalize(path29.resolve(options.storedProjectPath));
|
|
132002
132084
|
} catch {
|
|
132003
|
-
storedCanonical =
|
|
132085
|
+
storedCanonical = path29.resolve(options.storedProjectPath);
|
|
132004
132086
|
}
|
|
132005
132087
|
if (storedCanonical !== options.canonicalProjectPath) {
|
|
132006
132088
|
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");
|
|
@@ -132743,16 +132825,16 @@ function detectRoutes(httpEdges, defs, opts = {}) {
|
|
|
132743
132825
|
const seen = new Set;
|
|
132744
132826
|
const out = [];
|
|
132745
132827
|
for (const e of httpEdges) {
|
|
132746
|
-
const
|
|
132747
|
-
if (!
|
|
132828
|
+
const path30 = e.route;
|
|
132829
|
+
if (!path30)
|
|
132748
132830
|
continue;
|
|
132749
132831
|
const method = (e.method ?? "ANY").toUpperCase();
|
|
132750
|
-
const key = method + " " +
|
|
132832
|
+
const key = method + " " + path30;
|
|
132751
132833
|
if (seen.has(key))
|
|
132752
132834
|
continue;
|
|
132753
132835
|
seen.add(key);
|
|
132754
132836
|
out.push({
|
|
132755
|
-
path:
|
|
132837
|
+
path: path30,
|
|
132756
132838
|
method: e.method,
|
|
132757
132839
|
file: e.fromFile,
|
|
132758
132840
|
handler: e.targetFqn ?? e.symbolName
|
|
@@ -132763,12 +132845,12 @@ function detectRoutes(httpEdges, defs, opts = {}) {
|
|
|
132763
132845
|
continue;
|
|
132764
132846
|
const parsed = parseRouteName(d.name);
|
|
132765
132847
|
const method = parsed?.method ?? "ANY";
|
|
132766
|
-
const
|
|
132767
|
-
const key = method + " " +
|
|
132848
|
+
const path30 = parsed?.path ?? d.name;
|
|
132849
|
+
const key = method + " " + path30;
|
|
132768
132850
|
if (seen.has(key))
|
|
132769
132851
|
continue;
|
|
132770
132852
|
seen.add(key);
|
|
132771
|
-
out.push({ path:
|
|
132853
|
+
out.push({ path: path30, method: parsed?.method, file: d.filePath, handler: d.name });
|
|
132772
132854
|
}
|
|
132773
132855
|
for (const d of defs) {
|
|
132774
132856
|
const parsed = parseRouteName(d.name);
|
|
@@ -132989,8 +133071,8 @@ __export(exports_symbol_graph_service, {
|
|
|
132989
133071
|
symbolGraphService: () => symbolGraphService,
|
|
132990
133072
|
SymbolGraphService: () => SymbolGraphService
|
|
132991
133073
|
});
|
|
132992
|
-
import
|
|
132993
|
-
import
|
|
133074
|
+
import path30 from "path";
|
|
133075
|
+
import fs19 from "fs/promises";
|
|
132994
133076
|
|
|
132995
133077
|
class SymbolGraphService {
|
|
132996
133078
|
identityLookup;
|
|
@@ -133318,7 +133400,7 @@ class SymbolGraphService {
|
|
|
133318
133400
|
async readSnippet(relativePath, lineStart, lineEnd, projectId) {
|
|
133319
133401
|
try {
|
|
133320
133402
|
const absolutePath = await this.resolveToAbsolute(relativePath, projectId);
|
|
133321
|
-
const content = await
|
|
133403
|
+
const content = await fs19.readFile(absolutePath, "utf-8");
|
|
133322
133404
|
const lines = content.split(`
|
|
133323
133405
|
`);
|
|
133324
133406
|
return lines.slice(Math.max(0, lineStart - 1), Math.min(lines.length, lineEnd)).join(`
|
|
@@ -133330,7 +133412,7 @@ class SymbolGraphService {
|
|
|
133330
133412
|
async readContext(relativePath, lineNumber, contextLines, projectId) {
|
|
133331
133413
|
try {
|
|
133332
133414
|
const absolutePath = await this.resolveToAbsolute(relativePath, projectId);
|
|
133333
|
-
const content = await
|
|
133415
|
+
const content = await fs19.readFile(absolutePath, "utf-8");
|
|
133334
133416
|
const lines = content.split(`
|
|
133335
133417
|
`);
|
|
133336
133418
|
const start = Math.max(0, lineNumber - contextLines - 1);
|
|
@@ -133343,7 +133425,7 @@ class SymbolGraphService {
|
|
|
133343
133425
|
}
|
|
133344
133426
|
async resolveToAbsolute(relativePath, projectId) {
|
|
133345
133427
|
const root = await this.getProjectRoot(projectId);
|
|
133346
|
-
return root ?
|
|
133428
|
+
return root ? path30.resolve(root, relativePath) : relativePath;
|
|
133347
133429
|
}
|
|
133348
133430
|
async getProjectRoot(projectId) {
|
|
133349
133431
|
const cached2 = this.projectRootCache.get(projectId);
|
|
@@ -133486,7 +133568,7 @@ var init_workspace_manager = __esm(() => {
|
|
|
133486
133568
|
});
|
|
133487
133569
|
|
|
133488
133570
|
// ../../packages/core/dist/tools/index_project.js
|
|
133489
|
-
import
|
|
133571
|
+
import path31 from "path";
|
|
133490
133572
|
|
|
133491
133573
|
class IndexProjectTool {
|
|
133492
133574
|
name = "index_project";
|
|
@@ -133534,7 +133616,7 @@ class IndexProjectTool {
|
|
|
133534
133616
|
try {
|
|
133535
133617
|
await assertParserReadyForIndexing();
|
|
133536
133618
|
const canonicalProjectPath = await canonicalizeProjectRoot(projectPath);
|
|
133537
|
-
const finalProjectId = projectId ||
|
|
133619
|
+
const finalProjectId = projectId || path31.basename(canonicalProjectPath) || "default";
|
|
133538
133620
|
const existing = await workspaceManager.getWorkspace(finalProjectId);
|
|
133539
133621
|
await assertProjectRootReuse({
|
|
133540
133622
|
projectId: finalProjectId,
|
|
@@ -134087,17 +134169,17 @@ function applyReplacer(root, replacer) {
|
|
|
134087
134169
|
return transformChildren(root, replacer, []);
|
|
134088
134170
|
return transformChildren(normalizeValue(replacedRoot), replacer, []);
|
|
134089
134171
|
}
|
|
134090
|
-
function transformChildren(value, replacer,
|
|
134172
|
+
function transformChildren(value, replacer, path32) {
|
|
134091
134173
|
if (isJsonObject(value))
|
|
134092
|
-
return transformObject(value, replacer,
|
|
134174
|
+
return transformObject(value, replacer, path32);
|
|
134093
134175
|
if (isJsonArray(value))
|
|
134094
|
-
return transformArray(value, replacer,
|
|
134176
|
+
return transformArray(value, replacer, path32);
|
|
134095
134177
|
return value;
|
|
134096
134178
|
}
|
|
134097
|
-
function transformObject(obj, replacer,
|
|
134179
|
+
function transformObject(obj, replacer, path32) {
|
|
134098
134180
|
const result = {};
|
|
134099
134181
|
for (const [key, value] of Object.entries(obj)) {
|
|
134100
|
-
const childPath = [...
|
|
134182
|
+
const childPath = [...path32, key];
|
|
134101
134183
|
const replacedValue = replacer(key, value, childPath);
|
|
134102
134184
|
if (replacedValue === undefined)
|
|
134103
134185
|
continue;
|
|
@@ -134105,11 +134187,11 @@ function transformObject(obj, replacer, path31) {
|
|
|
134105
134187
|
}
|
|
134106
134188
|
return result;
|
|
134107
134189
|
}
|
|
134108
|
-
function transformArray(arr, replacer,
|
|
134190
|
+
function transformArray(arr, replacer, path32) {
|
|
134109
134191
|
const result = [];
|
|
134110
134192
|
for (let i = 0;i < arr.length; i++) {
|
|
134111
134193
|
const value = arr[i];
|
|
134112
|
-
const childPath = [...
|
|
134194
|
+
const childPath = [...path32, i];
|
|
134113
134195
|
const replacedValue = replacer(String(i), value, childPath);
|
|
134114
134196
|
if (replacedValue === undefined)
|
|
134115
134197
|
continue;
|
|
@@ -138799,7 +138881,7 @@ var TOOL_NAME_NORMALIZE, classifyToolCall = (_source, payload) => {
|
|
|
138799
138881
|
if (lowerPrompt.includes("blocked on") || lowerPrompt.includes("waiting on") || lowerPrompt.includes("can't proceed") || lowerPrompt.includes("stuck on")) {
|
|
138800
138882
|
return "blocked-on";
|
|
138801
138883
|
}
|
|
138802
|
-
if (lowerPrompt.startsWith("
|
|
138884
|
+
if (lowerPrompt.startsWith("act as") || lowerPrompt.startsWith("you are a")) {
|
|
138803
138885
|
return "role";
|
|
138804
138886
|
}
|
|
138805
138887
|
return "user-prompts";
|
|
@@ -139200,9 +139282,9 @@ var init_session_pin_store = __esm(() => {
|
|
|
139200
139282
|
});
|
|
139201
139283
|
|
|
139202
139284
|
// ../../packages/core/dist/services/hooks/attribution-resolver.js
|
|
139203
|
-
import
|
|
139285
|
+
import fs20 from "fs";
|
|
139204
139286
|
import os9 from "os";
|
|
139205
|
-
import
|
|
139287
|
+
import path32 from "path";
|
|
139206
139288
|
|
|
139207
139289
|
class PgWorkspaceRootProvider {
|
|
139208
139290
|
cache = null;
|
|
@@ -139252,7 +139334,7 @@ class AttributionResolver {
|
|
|
139252
139334
|
this.pins = options.pins ?? new SessionPinStore;
|
|
139253
139335
|
this.canonicalize = options.canonicalize ?? defaultCanonicalize;
|
|
139254
139336
|
this.homedir = options.homedir ?? os9.homedir;
|
|
139255
|
-
this.fsRoot = options.fsRoot ?? (() =>
|
|
139337
|
+
this.fsRoot = options.fsRoot ?? (() => path32.parse(path32.sep).root);
|
|
139256
139338
|
}
|
|
139257
139339
|
async resolve(input) {
|
|
139258
139340
|
const caller = input.callerProjectId;
|
|
@@ -139303,7 +139385,7 @@ class AttributionResolver {
|
|
|
139303
139385
|
}
|
|
139304
139386
|
let bestPath = null;
|
|
139305
139387
|
for (const candidate2 of byPath.keys()) {
|
|
139306
|
-
if (canonicalCwd === candidate2 || canonicalCwd.startsWith(candidate2.endsWith(
|
|
139388
|
+
if (canonicalCwd === candidate2 || canonicalCwd.startsWith(candidate2.endsWith(path32.sep) ? candidate2 : candidate2 + path32.sep)) {
|
|
139307
139389
|
if (bestPath === null || candidate2.length > bestPath.length) {
|
|
139308
139390
|
bestPath = candidate2;
|
|
139309
139391
|
}
|
|
@@ -139326,7 +139408,7 @@ class AttributionResolver {
|
|
|
139326
139408
|
return projectPath2;
|
|
139327
139409
|
const fsRoot = this.fsRoot();
|
|
139328
139410
|
let normalized = projectPath2;
|
|
139329
|
-
while (normalized.length > fsRoot.length && normalized.endsWith(
|
|
139411
|
+
while (normalized.length > fsRoot.length && normalized.endsWith(path32.sep)) {
|
|
139330
139412
|
normalized = normalized.slice(0, -1);
|
|
139331
139413
|
}
|
|
139332
139414
|
return normalized;
|
|
@@ -139334,10 +139416,10 @@ class AttributionResolver {
|
|
|
139334
139416
|
}
|
|
139335
139417
|
function defaultCanonicalize(cwd) {
|
|
139336
139418
|
try {
|
|
139337
|
-
return
|
|
139419
|
+
return fs20.realpathSync(cwd);
|
|
139338
139420
|
} catch {
|
|
139339
139421
|
try {
|
|
139340
|
-
return
|
|
139422
|
+
return path32.resolve(cwd);
|
|
139341
139423
|
} catch {
|
|
139342
139424
|
return;
|
|
139343
139425
|
}
|
|
@@ -140086,31 +140168,31 @@ class TracePathService {
|
|
|
140086
140168
|
const chains = [];
|
|
140087
140169
|
const seen = new Set;
|
|
140088
140170
|
let walks = 0;
|
|
140089
|
-
const walk = (fqn,
|
|
140171
|
+
const walk = (fqn, path33) => {
|
|
140090
140172
|
if (chains.length >= CHAIN_CAP)
|
|
140091
140173
|
return;
|
|
140092
140174
|
if (walks >= MAX_WALKS)
|
|
140093
140175
|
return;
|
|
140094
140176
|
walks++;
|
|
140095
|
-
const key =
|
|
140177
|
+
const key = path33.join("\u2192");
|
|
140096
140178
|
if (seen.has(key))
|
|
140097
140179
|
return;
|
|
140098
140180
|
seen.add(key);
|
|
140099
140181
|
const next = adj.get(fqn);
|
|
140100
140182
|
if (!next || next.length === 0 || !whoHasChild.has(fqn)) {
|
|
140101
|
-
if (
|
|
140102
|
-
chains.push(
|
|
140183
|
+
if (path33.length > 1)
|
|
140184
|
+
chains.push(path33.map((n) => this.fqnToName(n)).join(" \u2192 "));
|
|
140103
140185
|
return;
|
|
140104
140186
|
}
|
|
140105
140187
|
for (const child of next) {
|
|
140106
140188
|
if (chains.length >= CHAIN_CAP || walks >= MAX_WALKS)
|
|
140107
140189
|
return;
|
|
140108
|
-
if (
|
|
140109
|
-
const cycled = [...
|
|
140190
|
+
if (path33.includes(child)) {
|
|
140191
|
+
const cycled = [...path33, `${this.fqnToName(child)}\u21BA`];
|
|
140110
140192
|
chains.push(cycled.map((n) => n).join(" \u2192 "));
|
|
140111
140193
|
continue;
|
|
140112
140194
|
}
|
|
140113
|
-
walk(child, [...
|
|
140195
|
+
walk(child, [...path33, child]);
|
|
140114
140196
|
}
|
|
140115
140197
|
};
|
|
140116
140198
|
for (const seed of seeds) {
|
|
@@ -140943,7 +141025,7 @@ var init_get_architecture = __esm(() => {
|
|
|
140943
141025
|
});
|
|
140944
141026
|
|
|
140945
141027
|
// ../../packages/core/dist/services/file-read/file-content-cache.js
|
|
140946
|
-
import
|
|
141028
|
+
import fs21 from "fs/promises";
|
|
140947
141029
|
|
|
140948
141030
|
class FileContentCache {
|
|
140949
141031
|
extractMetadata;
|
|
@@ -140976,7 +141058,7 @@ class FileContentCache {
|
|
|
140976
141058
|
metadata: cached2.metadata
|
|
140977
141059
|
};
|
|
140978
141060
|
}
|
|
140979
|
-
const content = await
|
|
141061
|
+
const content = await fs21.readFile(filePath, "utf-8");
|
|
140980
141062
|
const metadata = await this.extractMetadata(content, filePath, options);
|
|
140981
141063
|
evictOldest(this.fileCache, this.FILE_CACHE_MAX_ENTRIES - 1);
|
|
140982
141064
|
this.fileCache.set(cacheKey, {
|
|
@@ -140993,7 +141075,7 @@ var init_file_content_cache = __esm(() => {
|
|
|
140993
141075
|
});
|
|
140994
141076
|
|
|
140995
141077
|
// ../../packages/core/dist/services/file-read/file-metadata.js
|
|
140996
|
-
import
|
|
141078
|
+
import path33 from "path";
|
|
140997
141079
|
|
|
140998
141080
|
class FileMetadataExtractor {
|
|
140999
141081
|
symbolGraph;
|
|
@@ -141029,7 +141111,7 @@ class FileMetadataExtractor {
|
|
|
141029
141111
|
return metadata;
|
|
141030
141112
|
}
|
|
141031
141113
|
detectLanguage(filePath) {
|
|
141032
|
-
const ext2 =
|
|
141114
|
+
const ext2 = path33.extname(filePath).toLowerCase();
|
|
141033
141115
|
const languageMap2 = {
|
|
141034
141116
|
".ts": "TypeScript",
|
|
141035
141117
|
".tsx": "TypeScript",
|
|
@@ -141151,7 +141233,7 @@ var init_line_range = __esm(() => {
|
|
|
141151
141233
|
});
|
|
141152
141234
|
|
|
141153
141235
|
// ../../packages/core/dist/services/file-read/path-containment.js
|
|
141154
|
-
import
|
|
141236
|
+
import path34 from "path";
|
|
141155
141237
|
|
|
141156
141238
|
class PathContainment {
|
|
141157
141239
|
projectRoots;
|
|
@@ -141159,14 +141241,14 @@ class PathContainment {
|
|
|
141159
141241
|
this.projectRoots = projectRoots;
|
|
141160
141242
|
}
|
|
141161
141243
|
async resolveFilePath(filePath, projectId) {
|
|
141162
|
-
if (
|
|
141163
|
-
return
|
|
141244
|
+
if (path34.isAbsolute(filePath)) {
|
|
141245
|
+
return path34.resolve(filePath);
|
|
141164
141246
|
}
|
|
141165
141247
|
if (projectId) {
|
|
141166
141248
|
const root = await this.projectRoots.getProjectRoot(projectId);
|
|
141167
141249
|
if (root) {
|
|
141168
141250
|
const cleaned = sanitizeFilePath(filePath);
|
|
141169
|
-
return
|
|
141251
|
+
return path34.resolve(root, cleaned);
|
|
141170
141252
|
}
|
|
141171
141253
|
return null;
|
|
141172
141254
|
}
|
|
@@ -141177,17 +141259,17 @@ class PathContainment {
|
|
|
141177
141259
|
if (projectId) {
|
|
141178
141260
|
const root = await this.projectRoots.getProjectRoot(projectId);
|
|
141179
141261
|
if (root)
|
|
141180
|
-
roots.push(
|
|
141262
|
+
roots.push(path34.resolve(root));
|
|
141181
141263
|
}
|
|
141182
|
-
roots.push(
|
|
141264
|
+
roots.push(path34.resolve(process.cwd()));
|
|
141183
141265
|
const envRoots = (process.env.MASSA_AI_READ_FILE_ROOTS ?? "").split(":").map((s) => s.trim()).filter((s) => s.length > 0);
|
|
141184
141266
|
for (const extra of envRoots) {
|
|
141185
|
-
roots.push(
|
|
141267
|
+
roots.push(path34.resolve(extra));
|
|
141186
141268
|
}
|
|
141187
|
-
const target =
|
|
141269
|
+
const target = path34.resolve(absoluteFilePath);
|
|
141188
141270
|
for (const root of roots) {
|
|
141189
|
-
const rel =
|
|
141190
|
-
if (rel !== "" && !rel.startsWith("..") && !
|
|
141271
|
+
const rel = path34.relative(root, target);
|
|
141272
|
+
if (rel !== "" && !rel.startsWith("..") && !path34.isAbsolute(rel)) {
|
|
141191
141273
|
return { allowed: true };
|
|
141192
141274
|
}
|
|
141193
141275
|
if (rel === "")
|
|
@@ -144433,9 +144515,9 @@ var init_inference_probe = __esm(() => {
|
|
|
144433
144515
|
});
|
|
144434
144516
|
|
|
144435
144517
|
// ../../packages/core/dist/services/health/local-health-checker.js
|
|
144436
|
-
import
|
|
144518
|
+
import fs22 from "fs/promises";
|
|
144437
144519
|
import { existsSync as existsSync3 } from "fs";
|
|
144438
|
-
import
|
|
144520
|
+
import path35 from "path";
|
|
144439
144521
|
|
|
144440
144522
|
class LocalHealthChecker {
|
|
144441
144523
|
dataDir = config2.get("dataDir");
|
|
@@ -144513,10 +144595,10 @@ class LocalHealthChecker {
|
|
|
144513
144595
|
const start = Date.now();
|
|
144514
144596
|
try {
|
|
144515
144597
|
if (!existsSync3(this.dataDir))
|
|
144516
|
-
await
|
|
144517
|
-
const probe2 =
|
|
144518
|
-
await
|
|
144519
|
-
await
|
|
144598
|
+
await fs22.mkdir(this.dataDir, { recursive: true });
|
|
144599
|
+
const probe2 = path35.join(this.dataDir, ".health-check-test");
|
|
144600
|
+
await fs22.writeFile(probe2, "ok");
|
|
144601
|
+
await fs22.unlink(probe2);
|
|
144520
144602
|
return { available: true, latency: Date.now() - start, details: { path: this.dataDir, writable: true } };
|
|
144521
144603
|
} catch (error51) {
|
|
144522
144604
|
return { available: false, latency: Date.now() - start, error: `Data directory error: ${error51.message}` };
|
|
@@ -146653,9 +146735,9 @@ var init_scheduler2 = __esm(() => {
|
|
|
146653
146735
|
});
|
|
146654
146736
|
|
|
146655
146737
|
// ../../packages/core/dist/services/pricing/models-dev-client.js
|
|
146656
|
-
import
|
|
146738
|
+
import fs23 from "fs/promises";
|
|
146657
146739
|
import { existsSync as existsSync4 } from "fs";
|
|
146658
|
-
import
|
|
146740
|
+
import path36 from "path";
|
|
146659
146741
|
function getModelsDevClient() {
|
|
146660
146742
|
if (!clientInstance) {
|
|
146661
146743
|
clientInstance = new ModelsDevClient;
|
|
@@ -146675,7 +146757,7 @@ var init_models_dev_client = __esm(() => {
|
|
|
146675
146757
|
memoryCacheTimestamp = 0;
|
|
146676
146758
|
getLocalCachePath() {
|
|
146677
146759
|
const dataDir = config2.get("dataDir");
|
|
146678
|
-
return
|
|
146760
|
+
return path36.join(dataDir, ModelsDevClient.LOCAL_CACHE_FILE);
|
|
146679
146761
|
}
|
|
146680
146762
|
async loadLocalCache() {
|
|
146681
146763
|
const cachePath = this.getLocalCachePath();
|
|
@@ -146683,7 +146765,7 @@ var init_models_dev_client = __esm(() => {
|
|
|
146683
146765
|
if (!existsSync4(cachePath)) {
|
|
146684
146766
|
return null;
|
|
146685
146767
|
}
|
|
146686
|
-
const content = await
|
|
146768
|
+
const content = await fs23.readFile(cachePath, "utf-8");
|
|
146687
146769
|
const data = JSON.parse(content);
|
|
146688
146770
|
const age = Date.now() - data.timestamp;
|
|
146689
146771
|
if (age > ModelsDevClient.LOCAL_CACHE_TTL) {
|
|
@@ -146710,14 +146792,14 @@ var init_models_dev_client = __esm(() => {
|
|
|
146710
146792
|
async saveLocalCache(models) {
|
|
146711
146793
|
const cachePath = this.getLocalCachePath();
|
|
146712
146794
|
try {
|
|
146713
|
-
const dir =
|
|
146714
|
-
await
|
|
146795
|
+
const dir = path36.dirname(cachePath);
|
|
146796
|
+
await fs23.mkdir(dir, { recursive: true });
|
|
146715
146797
|
const data = {
|
|
146716
146798
|
timestamp: Date.now(),
|
|
146717
146799
|
version: "1.0.0",
|
|
146718
146800
|
models: Object.fromEntries(models)
|
|
146719
146801
|
};
|
|
146720
|
-
await
|
|
146802
|
+
await fs23.writeFile(cachePath, JSON.stringify(data), "utf-8");
|
|
146721
146803
|
logger.debug("Saved pricing to local cache", {
|
|
146722
146804
|
models: models.size,
|
|
146723
146805
|
path: cachePath
|
|
@@ -147047,7 +147129,7 @@ var init_models_dev_client = __esm(() => {
|
|
|
147047
147129
|
const cachePath = this.getLocalCachePath();
|
|
147048
147130
|
try {
|
|
147049
147131
|
if (existsSync4(cachePath)) {
|
|
147050
|
-
await
|
|
147132
|
+
await fs23.unlink(cachePath);
|
|
147051
147133
|
logger.debug("Local pricing cache file deleted");
|
|
147052
147134
|
}
|
|
147053
147135
|
} catch (error51) {
|
|
@@ -152606,33 +152688,33 @@ var require_URL = __commonJS((exports, module) => {
|
|
|
152606
152688
|
else
|
|
152607
152689
|
return basepath.substring(0, lastslash + 1) + refpath;
|
|
152608
152690
|
}
|
|
152609
|
-
function remove_dot_segments(
|
|
152610
|
-
if (!
|
|
152611
|
-
return
|
|
152691
|
+
function remove_dot_segments(path37) {
|
|
152692
|
+
if (!path37)
|
|
152693
|
+
return path37;
|
|
152612
152694
|
var output = "";
|
|
152613
|
-
while (
|
|
152614
|
-
if (
|
|
152615
|
-
|
|
152695
|
+
while (path37.length > 0) {
|
|
152696
|
+
if (path37 === "." || path37 === "..") {
|
|
152697
|
+
path37 = "";
|
|
152616
152698
|
break;
|
|
152617
152699
|
}
|
|
152618
|
-
var twochars =
|
|
152619
|
-
var threechars =
|
|
152620
|
-
var fourchars =
|
|
152700
|
+
var twochars = path37.substring(0, 2);
|
|
152701
|
+
var threechars = path37.substring(0, 3);
|
|
152702
|
+
var fourchars = path37.substring(0, 4);
|
|
152621
152703
|
if (threechars === "../") {
|
|
152622
|
-
|
|
152704
|
+
path37 = path37.substring(3);
|
|
152623
152705
|
} else if (twochars === "./") {
|
|
152624
|
-
|
|
152706
|
+
path37 = path37.substring(2);
|
|
152625
152707
|
} else if (threechars === "/./") {
|
|
152626
|
-
|
|
152627
|
-
} else if (twochars === "/." &&
|
|
152628
|
-
|
|
152629
|
-
} else if (fourchars === "/../" || threechars === "/.." &&
|
|
152630
|
-
|
|
152708
|
+
path37 = "/" + path37.substring(3);
|
|
152709
|
+
} else if (twochars === "/." && path37.length === 2) {
|
|
152710
|
+
path37 = "/";
|
|
152711
|
+
} else if (fourchars === "/../" || threechars === "/.." && path37.length === 3) {
|
|
152712
|
+
path37 = "/" + path37.substring(4);
|
|
152631
152713
|
output = output.replace(/\/?[^\/]*$/, "");
|
|
152632
152714
|
} else {
|
|
152633
|
-
var segment =
|
|
152715
|
+
var segment = path37.match(/(\/?([^\/]*))/)[0];
|
|
152634
152716
|
output += segment;
|
|
152635
|
-
|
|
152717
|
+
path37 = path37.substring(segment.length);
|
|
152636
152718
|
}
|
|
152637
152719
|
}
|
|
152638
152720
|
return output;
|
|
@@ -164702,21 +164784,21 @@ function jsonToKeyPathChunks(value, label = "$") {
|
|
|
164702
164784
|
walk(value, label, out);
|
|
164703
164785
|
return out;
|
|
164704
164786
|
}
|
|
164705
|
-
function walk(val,
|
|
164787
|
+
function walk(val, path37, out) {
|
|
164706
164788
|
if (val === null || val === undefined)
|
|
164707
164789
|
return;
|
|
164708
164790
|
if (Array.isArray(val)) {
|
|
164709
164791
|
if (val.length === 0) {
|
|
164710
|
-
out.push({ path:
|
|
164792
|
+
out.push({ path: path37, content: `**${path37}** = _[]_` });
|
|
164711
164793
|
return;
|
|
164712
164794
|
}
|
|
164713
164795
|
if (val.every((v) => v !== null && typeof v === "object")) {
|
|
164714
|
-
val.forEach((v, i) => walk(v, `${
|
|
164796
|
+
val.forEach((v, i) => walk(v, `${path37}[${i}]`, out));
|
|
164715
164797
|
return;
|
|
164716
164798
|
}
|
|
164717
164799
|
const items = val.map((v) => `- \`${String(v)}\``).join(`
|
|
164718
164800
|
`);
|
|
164719
|
-
out.push({ path:
|
|
164801
|
+
out.push({ path: path37, content: `**${path37}**
|
|
164720
164802
|
|
|
164721
164803
|
${items}` });
|
|
164722
164804
|
return;
|
|
@@ -164724,16 +164806,16 @@ ${items}` });
|
|
|
164724
164806
|
if (typeof val === "object") {
|
|
164725
164807
|
const entries = Object.entries(val);
|
|
164726
164808
|
if (entries.length === 0) {
|
|
164727
|
-
out.push({ path:
|
|
164809
|
+
out.push({ path: path37, content: `**${path37}** = _{}_` });
|
|
164728
164810
|
return;
|
|
164729
164811
|
}
|
|
164730
164812
|
for (const [k, v] of entries) {
|
|
164731
164813
|
const safeKey = /^[A-Za-z_$][\w$]*$/.test(k) ? k : JSON.stringify(k);
|
|
164732
|
-
walk(v, `${
|
|
164814
|
+
walk(v, `${path37}.${safeKey}`, out);
|
|
164733
164815
|
}
|
|
164734
164816
|
return;
|
|
164735
164817
|
}
|
|
164736
|
-
out.push({ path:
|
|
164818
|
+
out.push({ path: path37, content: `**${path37}** = \`${String(val)}\`` });
|
|
164737
164819
|
}
|
|
164738
164820
|
var gfm, STRIP_SELECTORS, tdCache = null;
|
|
164739
164821
|
var init_html_to_md = __esm(() => {
|
|
@@ -165500,8 +165582,8 @@ var init_hook_service = __esm(() => {
|
|
|
165500
165582
|
|
|
165501
165583
|
// ../../packages/core/dist/services/bootstrap/bootstrap-service.js
|
|
165502
165584
|
import { randomUUID as randomUUID9 } from "crypto";
|
|
165503
|
-
import
|
|
165504
|
-
import
|
|
165585
|
+
import fs24 from "fs";
|
|
165586
|
+
import path37 from "path";
|
|
165505
165587
|
import { spawn as spawn2 } from "child_process";
|
|
165506
165588
|
function readBootstrapConfig() {
|
|
165507
165589
|
try {
|
|
@@ -165661,9 +165743,9 @@ async function scanSignals(_projectId, projectRoot, caps, symbolGraph, gitRunner
|
|
|
165661
165743
|
}
|
|
165662
165744
|
try {
|
|
165663
165745
|
for (const name26 of README_CANDIDATES) {
|
|
165664
|
-
const p =
|
|
165665
|
-
if (
|
|
165666
|
-
const buf =
|
|
165746
|
+
const p = path37.join(projectRoot, name26);
|
|
165747
|
+
if (fs24.existsSync(p) && fs24.statSync(p).isFile()) {
|
|
165748
|
+
const buf = fs24.readFileSync(p);
|
|
165667
165749
|
signals.readme = buf.slice(0, MAX_README_BYTES).toString("utf8");
|
|
165668
165750
|
break;
|
|
165669
165751
|
}
|
|
@@ -165672,14 +165754,14 @@ async function scanSignals(_projectId, projectRoot, caps, symbolGraph, gitRunner
|
|
|
165672
165754
|
logger.debug("bootstrap scan: README read failed", { error: e.message });
|
|
165673
165755
|
}
|
|
165674
165756
|
try {
|
|
165675
|
-
const docsDir =
|
|
165676
|
-
if (
|
|
165757
|
+
const docsDir = path37.join(projectRoot, "docs");
|
|
165758
|
+
if (fs24.existsSync(docsDir) && fs24.statSync(docsDir).isDirectory()) {
|
|
165677
165759
|
const entries = walkMarkdown(docsDir).slice(0, MAX_DOCS);
|
|
165678
165760
|
for (const rel of entries) {
|
|
165679
165761
|
try {
|
|
165680
|
-
const buf =
|
|
165762
|
+
const buf = fs24.readFileSync(rel);
|
|
165681
165763
|
signals.docs.push({
|
|
165682
|
-
path:
|
|
165764
|
+
path: path37.relative(projectRoot, rel),
|
|
165683
165765
|
snippet: buf.slice(0, MAX_DOC_BYTES).toString("utf8")
|
|
165684
165766
|
});
|
|
165685
165767
|
} catch {}
|
|
@@ -165690,10 +165772,10 @@ async function scanSignals(_projectId, projectRoot, caps, symbolGraph, gitRunner
|
|
|
165690
165772
|
}
|
|
165691
165773
|
try {
|
|
165692
165774
|
for (const name26 of MANIFEST_FILES) {
|
|
165693
|
-
const p =
|
|
165694
|
-
if (!
|
|
165775
|
+
const p = path37.join(projectRoot, name26);
|
|
165776
|
+
if (!fs24.existsSync(p) || !fs24.statSync(p).isFile())
|
|
165695
165777
|
continue;
|
|
165696
|
-
const raw2 =
|
|
165778
|
+
const raw2 = fs24.readFileSync(p).slice(0, MAX_MANIFEST_BYTES).toString("utf8");
|
|
165697
165779
|
const kind = name26;
|
|
165698
165780
|
if (name26 === "package.json") {
|
|
165699
165781
|
try {
|
|
@@ -165733,12 +165815,12 @@ function walkMarkdown(dir) {
|
|
|
165733
165815
|
const cur = stack.pop();
|
|
165734
165816
|
let entries;
|
|
165735
165817
|
try {
|
|
165736
|
-
entries =
|
|
165818
|
+
entries = fs24.readdirSync(cur, { withFileTypes: true });
|
|
165737
165819
|
} catch {
|
|
165738
165820
|
continue;
|
|
165739
165821
|
}
|
|
165740
165822
|
for (const e of entries) {
|
|
165741
|
-
const full =
|
|
165823
|
+
const full = path37.join(cur, e.name);
|
|
165742
165824
|
if (e.isDirectory()) {
|
|
165743
165825
|
if (e.name === "node_modules" || e.name.startsWith("."))
|
|
165744
165826
|
continue;
|
|
@@ -169268,7 +169350,7 @@ class StdioServerTransport {
|
|
|
169268
169350
|
}
|
|
169269
169351
|
|
|
169270
169352
|
// src/index.ts
|
|
169271
|
-
import
|
|
169353
|
+
import fs27 from "fs/promises";
|
|
169272
169354
|
|
|
169273
169355
|
// src/api-client.ts
|
|
169274
169356
|
init_config();
|
|
@@ -169378,8 +169460,8 @@ init_dist();
|
|
|
169378
169460
|
init_dist();
|
|
169379
169461
|
init_dist15();
|
|
169380
169462
|
init_dist();
|
|
169381
|
-
import
|
|
169382
|
-
import
|
|
169463
|
+
import fs25 from "fs/promises";
|
|
169464
|
+
import path38 from "path";
|
|
169383
169465
|
var _indexProjectTool = null;
|
|
169384
169466
|
function indexProjectTool() {
|
|
169385
169467
|
if (!_indexProjectTool)
|
|
@@ -169682,8 +169764,8 @@ class EmbeddedApiClient {
|
|
|
169682
169764
|
} else {
|
|
169683
169765
|
end = start + 20;
|
|
169684
169766
|
}
|
|
169685
|
-
const absolutePath =
|
|
169686
|
-
const content = await
|
|
169767
|
+
const absolutePath = path38.join(workspace.project_path, file2);
|
|
169768
|
+
const content = await fs25.readFile(absolutePath, "utf-8");
|
|
169687
169769
|
const lines = content.split(/\r?\n/);
|
|
169688
169770
|
const slice = lines.slice(start - 1, Math.min(lines.length, end));
|
|
169689
169771
|
const formatted = slice.map((text3, idx) => ({ lineNumber: start + idx, content: text3 }));
|
|
@@ -169938,22 +170020,22 @@ class EmbeddedApiClient {
|
|
|
169938
170020
|
async uploadAndIndex(params) {
|
|
169939
170021
|
const rawBase = params.projectId || params.projectPath.replace(/\\/g, "/").split("/").filter(Boolean).pop() || "default";
|
|
169940
170022
|
const finalProjectId = rawBase.replace(/[^a-zA-Z0-9_.-]/g, "_").slice(0, 128);
|
|
169941
|
-
const uploadRoot = process.env.MASSA_AI_UPLOAD_DIR ||
|
|
169942
|
-
const stagingDir =
|
|
169943
|
-
await
|
|
169944
|
-
await
|
|
170023
|
+
const uploadRoot = process.env.MASSA_AI_UPLOAD_DIR || path38.join(getGlobalDataDir(), "uploads");
|
|
170024
|
+
const stagingDir = path38.resolve(uploadRoot, finalProjectId);
|
|
170025
|
+
await fs25.rm(stagingDir, { recursive: true, force: true });
|
|
170026
|
+
await fs25.mkdir(stagingDir, { recursive: true });
|
|
169945
170027
|
const WRITE_BATCH = 20;
|
|
169946
170028
|
for (let i = 0;i < params.files.length; i += WRITE_BATCH) {
|
|
169947
170029
|
await Promise.all(params.files.slice(i, i + WRITE_BATCH).map(async (file2) => {
|
|
169948
|
-
if (
|
|
170030
|
+
if (path38.isAbsolute(file2.relativePath) || file2.relativePath.includes("..")) {
|
|
169949
170031
|
throw new Error(`Invalid file path: ${file2.relativePath}`);
|
|
169950
170032
|
}
|
|
169951
|
-
const dest =
|
|
169952
|
-
if (!dest.startsWith(stagingDir +
|
|
170033
|
+
const dest = path38.resolve(stagingDir, file2.relativePath.replace(/\//g, path38.sep));
|
|
170034
|
+
if (!dest.startsWith(stagingDir + path38.sep)) {
|
|
169953
170035
|
throw new Error(`Path escapes staging directory: ${file2.relativePath}`);
|
|
169954
170036
|
}
|
|
169955
|
-
await
|
|
169956
|
-
await
|
|
170037
|
+
await fs25.mkdir(path38.dirname(dest), { recursive: true });
|
|
170038
|
+
await fs25.writeFile(dest, file2.content, "utf-8");
|
|
169957
170039
|
}));
|
|
169958
170040
|
}
|
|
169959
170041
|
return await indexProjectTool().handle({
|
|
@@ -170453,8 +170535,8 @@ class EmbeddedApiClient {
|
|
|
170453
170535
|
|
|
170454
170536
|
// src/file-collector.ts
|
|
170455
170537
|
init_config();
|
|
170456
|
-
import
|
|
170457
|
-
import
|
|
170538
|
+
import fs26 from "fs/promises";
|
|
170539
|
+
import path39 from "path";
|
|
170458
170540
|
var SKIP_DIRS = new Set([
|
|
170459
170541
|
"node_modules",
|
|
170460
170542
|
".git",
|
|
@@ -170495,7 +170577,7 @@ async function walk2(root2, dir, files, state, allowed) {
|
|
|
170495
170577
|
return;
|
|
170496
170578
|
let entries;
|
|
170497
170579
|
try {
|
|
170498
|
-
entries = await
|
|
170580
|
+
entries = await fs26.readdir(dir, { withFileTypes: true });
|
|
170499
170581
|
} catch {
|
|
170500
170582
|
return;
|
|
170501
170583
|
}
|
|
@@ -170504,22 +170586,22 @@ async function walk2(root2, dir, files, state, allowed) {
|
|
|
170504
170586
|
break;
|
|
170505
170587
|
if (entry2.isDirectory()) {
|
|
170506
170588
|
if (!SKIP_DIRS.has(entry2.name) && !entry2.name.startsWith(".")) {
|
|
170507
|
-
await walk2(root2,
|
|
170589
|
+
await walk2(root2, path39.join(dir, entry2.name), files, state, allowed);
|
|
170508
170590
|
}
|
|
170509
170591
|
} else if (entry2.isFile()) {
|
|
170510
|
-
const ext2 =
|
|
170592
|
+
const ext2 = path39.extname(entry2.name).toLowerCase();
|
|
170511
170593
|
if (!allowed.has(ext2))
|
|
170512
170594
|
continue;
|
|
170513
|
-
const fullPath =
|
|
170595
|
+
const fullPath = path39.join(dir, entry2.name);
|
|
170514
170596
|
try {
|
|
170515
|
-
const stat = await
|
|
170597
|
+
const stat = await fs26.stat(fullPath);
|
|
170516
170598
|
if (stat.size > MAX_FILE_BYTES)
|
|
170517
170599
|
continue;
|
|
170518
170600
|
if (state.totalBytes + stat.size > MAX_TOTAL_BYTES)
|
|
170519
170601
|
continue;
|
|
170520
|
-
const content = await
|
|
170602
|
+
const content = await fs26.readFile(fullPath, "utf-8");
|
|
170521
170603
|
state.totalBytes += stat.size;
|
|
170522
|
-
const relativePath =
|
|
170604
|
+
const relativePath = path39.relative(root2, fullPath).split(path39.sep).join("/");
|
|
170523
170605
|
files.push({ relativePath, content });
|
|
170524
170606
|
} catch {}
|
|
170525
170607
|
}
|
|
@@ -172502,7 +172584,7 @@ class McpProxyServer {
|
|
|
172502
172584
|
return textContent(JSON.stringify({ success: false, error: "projectPath is required" }));
|
|
172503
172585
|
}
|
|
172504
172586
|
try {
|
|
172505
|
-
if (!(await
|
|
172587
|
+
if (!(await fs27.stat(projectPath2)).isDirectory()) {
|
|
172506
172588
|
return textContent(JSON.stringify({ success: false, error: `${projectPath2} is not a directory` }));
|
|
172507
172589
|
}
|
|
172508
172590
|
} catch {
|