@massa-ai/mcp-client 1.25.0 → 1.26.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 +865 -340
- package/dist/index.js +923 -385
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -26709,10 +26709,466 @@ var init_utils = __esm(() => {
|
|
|
26709
26709
|
init_rate_limiter();
|
|
26710
26710
|
});
|
|
26711
26711
|
|
|
26712
|
+
// ../../packages/shared/dist/profile-switch/hosts.js
|
|
26713
|
+
import os3 from "os";
|
|
26714
|
+
import path5 from "path";
|
|
26715
|
+
function isHost(v) {
|
|
26716
|
+
return typeof v === "string" && HOSTS.includes(v);
|
|
26717
|
+
}
|
|
26718
|
+
function fileLayout(host, activeDir, activeGlob, variantsRoot) {
|
|
26719
|
+
return {
|
|
26720
|
+
host,
|
|
26721
|
+
route: "files",
|
|
26722
|
+
activeDir,
|
|
26723
|
+
activeGlob,
|
|
26724
|
+
variantsRoot,
|
|
26725
|
+
variantDir: (profile) => path5.join(variantsRoot, profile)
|
|
26726
|
+
};
|
|
26727
|
+
}
|
|
26728
|
+
function resolveHostLayout(host, opts = {}) {
|
|
26729
|
+
const targetHome = opts.targetHome ?? os3.homedir();
|
|
26730
|
+
const override = opts.projectRoot?.[host];
|
|
26731
|
+
switch (host) {
|
|
26732
|
+
case "cursor":
|
|
26733
|
+
return { host, route: "skip", reason: CURSOR_SKIP_REASON };
|
|
26734
|
+
case "claude": {
|
|
26735
|
+
const root = override ?? path5.join(targetHome, ".claude");
|
|
26736
|
+
return fileLayout(host, path5.join(root, "agents"), "massa-ai-*.md", path5.join(root, "massa-ai", "agent-profiles"));
|
|
26737
|
+
}
|
|
26738
|
+
case "codex": {
|
|
26739
|
+
const root = override ?? path5.join(targetHome, ".codex");
|
|
26740
|
+
return fileLayout(host, path5.join(root, "agents"), "massa-ai-*.toml", path5.join(root, "massa-ai", "agent-profiles"));
|
|
26741
|
+
}
|
|
26742
|
+
case "opencode": {
|
|
26743
|
+
const root = override ?? path5.join(targetHome, ".config", "opencode");
|
|
26744
|
+
const pluginsDir = path5.join(root, "plugins", "massa-ai");
|
|
26745
|
+
return fileLayout(host, path5.join(root, "agents"), "massa-ai-*.md", path5.join(pluginsDir, "agent-profiles"));
|
|
26746
|
+
}
|
|
26747
|
+
}
|
|
26748
|
+
}
|
|
26749
|
+
function detectRoute(platform) {
|
|
26750
|
+
const route = platform?.installRoute;
|
|
26751
|
+
if (route === "file")
|
|
26752
|
+
return { kind: "proceed" };
|
|
26753
|
+
if (route === "marketplace") {
|
|
26754
|
+
return {
|
|
26755
|
+
kind: "refuse",
|
|
26756
|
+
reason: "claude/codex marketplace-route installs are refused (in-place bundle rewrite would dirty a checkout " + "and break the drift gate) \u2014 use the dev path: MASSA_AI_MODEL_PROFILE + regenerate."
|
|
26757
|
+
};
|
|
26758
|
+
}
|
|
26759
|
+
return {
|
|
26760
|
+
kind: "refuse",
|
|
26761
|
+
reason: "no install route recorded \u2014 re-run the installer to record the install route"
|
|
26762
|
+
};
|
|
26763
|
+
}
|
|
26764
|
+
var HOSTS, CURSOR_SKIP_REASON = "all tiers inherit \u2014 Cursor publishes no resolvable model IDs";
|
|
26765
|
+
var init_hosts = __esm(() => {
|
|
26766
|
+
HOSTS = ["claude", "codex", "cursor", "opencode"];
|
|
26767
|
+
});
|
|
26768
|
+
|
|
26769
|
+
// ../../packages/shared/dist/profile-switch/state.js
|
|
26770
|
+
import fs2 from "fs";
|
|
26771
|
+
import path6 from "path";
|
|
26772
|
+
function namedError(name, message) {
|
|
26773
|
+
const err = new InstallStateError(message);
|
|
26774
|
+
err.name = name;
|
|
26775
|
+
return err;
|
|
26776
|
+
}
|
|
26777
|
+
function isPlainObject3(v) {
|
|
26778
|
+
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
26779
|
+
}
|
|
26780
|
+
function validateShape(raw2, filePath) {
|
|
26781
|
+
if (!isPlainObject3(raw2)) {
|
|
26782
|
+
throw CorruptInstallStateError(filePath, "root is not a JSON object");
|
|
26783
|
+
}
|
|
26784
|
+
if (raw2.platforms !== undefined && !isPlainObject3(raw2.platforms)) {
|
|
26785
|
+
throw CorruptInstallStateError(filePath, '"platforms" is present but not an object');
|
|
26786
|
+
}
|
|
26787
|
+
const platforms = isPlainObject3(raw2.platforms) ? raw2.platforms : {};
|
|
26788
|
+
return {
|
|
26789
|
+
...raw2,
|
|
26790
|
+
version: typeof raw2.version === "number" ? raw2.version : 2,
|
|
26791
|
+
platforms
|
|
26792
|
+
};
|
|
26793
|
+
}
|
|
26794
|
+
function readInstallState(filePath) {
|
|
26795
|
+
let text;
|
|
26796
|
+
try {
|
|
26797
|
+
text = fs2.readFileSync(filePath, "utf-8");
|
|
26798
|
+
} catch (err) {
|
|
26799
|
+
const code = err.code;
|
|
26800
|
+
if (code === "ENOENT")
|
|
26801
|
+
return DEFAULT_STATE();
|
|
26802
|
+
throw CorruptInstallStateError(filePath, `could not read file: ${err.message}`);
|
|
26803
|
+
}
|
|
26804
|
+
let raw2;
|
|
26805
|
+
try {
|
|
26806
|
+
raw2 = JSON.parse(text);
|
|
26807
|
+
} catch (err) {
|
|
26808
|
+
throw CorruptInstallStateError(filePath, `invalid JSON: ${err.message}`);
|
|
26809
|
+
}
|
|
26810
|
+
return validateShape(raw2, filePath);
|
|
26811
|
+
}
|
|
26812
|
+
function writeInstallState(filePath, state) {
|
|
26813
|
+
const validated = validateShape(state, filePath);
|
|
26814
|
+
const text = `${JSON.stringify(validated, null, 2)}
|
|
26815
|
+
`;
|
|
26816
|
+
try {
|
|
26817
|
+
fs2.mkdirSync(path6.dirname(filePath), { recursive: true });
|
|
26818
|
+
fs2.writeFileSync(filePath, text);
|
|
26819
|
+
} catch (err) {
|
|
26820
|
+
throw UnwritableInstallStateError(filePath, err.message);
|
|
26821
|
+
}
|
|
26822
|
+
}
|
|
26823
|
+
function updatePlatform(filePath, host, patch) {
|
|
26824
|
+
const state = readInstallState(filePath);
|
|
26825
|
+
const existing = isPlainObject3(state.platforms[host]) ? state.platforms[host] : { root: "", skills: [], skillsOwner: "plugin" };
|
|
26826
|
+
const merged = { ...existing, ...patch };
|
|
26827
|
+
const next = {
|
|
26828
|
+
...state,
|
|
26829
|
+
platforms: { ...state.platforms, [host]: merged }
|
|
26830
|
+
};
|
|
26831
|
+
writeInstallState(filePath, next);
|
|
26832
|
+
return next;
|
|
26833
|
+
}
|
|
26834
|
+
var InstallStateError, CorruptInstallStateError = (filePath, cause) => namedError("CorruptInstallStateError", `install-state.json at ${filePath} is corrupt: ${cause}`), UnwritableInstallStateError = (filePath, cause) => namedError("UnwritableInstallStateError", `could not write install-state.json at ${filePath}: ${cause}`), DEFAULT_STATE = () => ({ version: 2, platforms: {} });
|
|
26835
|
+
var init_state = __esm(() => {
|
|
26836
|
+
InstallStateError = class InstallStateError extends Error {
|
|
26837
|
+
constructor(message) {
|
|
26838
|
+
super(message);
|
|
26839
|
+
this.name = "InstallStateError";
|
|
26840
|
+
}
|
|
26841
|
+
};
|
|
26842
|
+
});
|
|
26843
|
+
|
|
26844
|
+
// ../../packages/shared/dist/profile-switch/lock.js
|
|
26845
|
+
import fs3 from "fs";
|
|
26846
|
+
import path7 from "path";
|
|
26847
|
+
import os4 from "os";
|
|
26848
|
+
import crypto3 from "crypto";
|
|
26849
|
+
import { execFileSync } from "child_process";
|
|
26850
|
+
function namedError2(name, message) {
|
|
26851
|
+
const err = new LockError(message);
|
|
26852
|
+
err.name = name;
|
|
26853
|
+
return err;
|
|
26854
|
+
}
|
|
26855
|
+
function readOwner(ownerPath) {
|
|
26856
|
+
let raw2;
|
|
26857
|
+
try {
|
|
26858
|
+
raw2 = JSON.parse(fs3.readFileSync(ownerPath, "utf-8"));
|
|
26859
|
+
} catch {
|
|
26860
|
+
return null;
|
|
26861
|
+
}
|
|
26862
|
+
if (typeof raw2 !== "object" || raw2 === null)
|
|
26863
|
+
return null;
|
|
26864
|
+
const r = raw2;
|
|
26865
|
+
if (typeof r.host === "string" && typeof r.pid === "number" && typeof r.processStart === "string" && typeof r.token === "string" && typeof r.timestamp === "number") {
|
|
26866
|
+
return r;
|
|
26867
|
+
}
|
|
26868
|
+
return null;
|
|
26869
|
+
}
|
|
26870
|
+
function releaseIfOwned(lockDir, ownerPath, token) {
|
|
26871
|
+
const owner = readOwner(ownerPath);
|
|
26872
|
+
if (owner === null || owner.token !== token)
|
|
26873
|
+
return;
|
|
26874
|
+
fs3.rmSync(lockDir, { recursive: true, force: true });
|
|
26875
|
+
}
|
|
26876
|
+
function acquireLock(stateFilePath, options = {}) {
|
|
26877
|
+
const lockDir = `${stateFilePath}.switch.lock`;
|
|
26878
|
+
const ownerPath = path7.join(lockDir, "owner.json");
|
|
26879
|
+
const clock = options.clock ?? DEFAULT_CLOCK;
|
|
26880
|
+
const identity = options.identity ?? DEFAULT_IDENTITY;
|
|
26881
|
+
const staleAfterMs = options.staleAfterMs ?? DEFAULT_STALE_AFTER_MS;
|
|
26882
|
+
const createFresh = () => {
|
|
26883
|
+
fs3.mkdirSync(lockDir);
|
|
26884
|
+
const pid = identity.pid();
|
|
26885
|
+
const startedAt = identity.processStart(pid);
|
|
26886
|
+
if (startedAt == null) {
|
|
26887
|
+
fs3.rmSync(lockDir, { recursive: true, force: true });
|
|
26888
|
+
throw LockAcquireError(lockDir, "could not determine this process's start-time identity");
|
|
26889
|
+
}
|
|
26890
|
+
const token = crypto3.randomUUID();
|
|
26891
|
+
const record3 = {
|
|
26892
|
+
host: identity.hostname(),
|
|
26893
|
+
pid,
|
|
26894
|
+
processStart: startedAt,
|
|
26895
|
+
token,
|
|
26896
|
+
timestamp: clock.now()
|
|
26897
|
+
};
|
|
26898
|
+
fs3.mkdirSync(path7.dirname(ownerPath), { recursive: true });
|
|
26899
|
+
fs3.writeFileSync(ownerPath, JSON.stringify(record3));
|
|
26900
|
+
return { lockDir, release: () => releaseIfOwned(lockDir, ownerPath, token) };
|
|
26901
|
+
};
|
|
26902
|
+
try {
|
|
26903
|
+
return createFresh();
|
|
26904
|
+
} catch (err) {
|
|
26905
|
+
if (err.code !== "EEXIST")
|
|
26906
|
+
throw err;
|
|
26907
|
+
}
|
|
26908
|
+
const owner = readOwner(ownerPath);
|
|
26909
|
+
const provenDead = owner !== null && clock.now() - owner.timestamp >= staleAfterMs && identity.processStart(owner.pid) !== owner.processStart;
|
|
26910
|
+
if (!provenDead)
|
|
26911
|
+
throw LockHeldError(lockDir);
|
|
26912
|
+
const reclaimDir = `${lockDir}.reclaim.${owner.token}`;
|
|
26913
|
+
try {
|
|
26914
|
+
fs3.renameSync(lockDir, reclaimDir);
|
|
26915
|
+
} catch {
|
|
26916
|
+
throw LockHeldError(lockDir);
|
|
26917
|
+
}
|
|
26918
|
+
fs3.rmSync(reclaimDir, { recursive: true, force: true });
|
|
26919
|
+
try {
|
|
26920
|
+
return createFresh();
|
|
26921
|
+
} catch {
|
|
26922
|
+
throw LockHeldError(lockDir);
|
|
26923
|
+
}
|
|
26924
|
+
}
|
|
26925
|
+
var LockError, LockHeldError = (lockDir) => namedError2("LockHeldError", `another switch is running (lock held at ${lockDir})`), LockAcquireError = (lockDir, cause) => namedError2("LockAcquireError", `could not acquire switch lock at ${lockDir}: ${cause}`), DEFAULT_STALE_AFTER_MS, DEFAULT_CLOCK, DEFAULT_IDENTITY;
|
|
26926
|
+
var init_lock = __esm(() => {
|
|
26927
|
+
LockError = class LockError extends Error {
|
|
26928
|
+
constructor(message) {
|
|
26929
|
+
super(message);
|
|
26930
|
+
this.name = "LockError";
|
|
26931
|
+
}
|
|
26932
|
+
};
|
|
26933
|
+
DEFAULT_STALE_AFTER_MS = 5 * 60 * 1000;
|
|
26934
|
+
DEFAULT_CLOCK = { now: () => Date.now() };
|
|
26935
|
+
DEFAULT_IDENTITY = {
|
|
26936
|
+
pid: () => process.pid,
|
|
26937
|
+
hostname: () => os4.hostname(),
|
|
26938
|
+
processStart: (pid) => {
|
|
26939
|
+
try {
|
|
26940
|
+
const out = execFileSync("ps", ["-p", String(pid), "-o", "lstart="], {
|
|
26941
|
+
encoding: "utf-8"
|
|
26942
|
+
}).trim();
|
|
26943
|
+
return out.length > 0 ? out : null;
|
|
26944
|
+
} catch {
|
|
26945
|
+
return null;
|
|
26946
|
+
}
|
|
26947
|
+
}
|
|
26948
|
+
};
|
|
26949
|
+
});
|
|
26950
|
+
|
|
26951
|
+
// ../../packages/shared/dist/profile-switch/engine.js
|
|
26952
|
+
import fs4 from "fs";
|
|
26953
|
+
import path8 from "path";
|
|
26954
|
+
import os5 from "os";
|
|
26955
|
+
import crypto4 from "crypto";
|
|
26956
|
+
function namedError3(name, message) {
|
|
26957
|
+
const err = new SwitchEngineError(message);
|
|
26958
|
+
err.name = name;
|
|
26959
|
+
return err;
|
|
26960
|
+
}
|
|
26961
|
+
function defaultStatePath(targetHome) {
|
|
26962
|
+
return path8.join(targetHome, ".config", "massa-ai", "install-state.json");
|
|
26963
|
+
}
|
|
26964
|
+
function resolveCommon(opts) {
|
|
26965
|
+
const targetHome = opts.targetHome ?? os5.homedir();
|
|
26966
|
+
const stateFilePath = opts.stateFilePath ?? defaultStatePath(targetHome);
|
|
26967
|
+
return { targetHome, stateFilePath };
|
|
26968
|
+
}
|
|
26969
|
+
function listProfiles(opts = {}) {
|
|
26970
|
+
const { targetHome, stateFilePath } = resolveCommon(opts);
|
|
26971
|
+
const state = readInstallState(stateFilePath);
|
|
26972
|
+
const universe = opts.hosts ?? HOSTS;
|
|
26973
|
+
const hosts = universe.map((host) => {
|
|
26974
|
+
const layout = resolveHostLayout(host, { targetHome, projectRoot: opts.projectRoot });
|
|
26975
|
+
if (layout.route === "skip") {
|
|
26976
|
+
return {
|
|
26977
|
+
host,
|
|
26978
|
+
installed: false,
|
|
26979
|
+
skipped: true,
|
|
26980
|
+
skipReason: layout.reason,
|
|
26981
|
+
activeProfile: null,
|
|
26982
|
+
bundleVersion: null,
|
|
26983
|
+
availableProfiles: []
|
|
26984
|
+
};
|
|
26985
|
+
}
|
|
26986
|
+
const installed = fs4.existsSync(layout.activeDir);
|
|
26987
|
+
const availableProfiles = listVariantProfiles(layout);
|
|
26988
|
+
const platform = state.platforms[host];
|
|
26989
|
+
return {
|
|
26990
|
+
host,
|
|
26991
|
+
installed,
|
|
26992
|
+
skipped: false,
|
|
26993
|
+
skipReason: null,
|
|
26994
|
+
activeProfile: platform?.modelProfile?.profile ?? "balanced",
|
|
26995
|
+
bundleVersion: platform?.plugin?.version ?? null,
|
|
26996
|
+
availableProfiles
|
|
26997
|
+
};
|
|
26998
|
+
});
|
|
26999
|
+
return { hosts };
|
|
27000
|
+
}
|
|
27001
|
+
function listVariantProfiles(layout) {
|
|
27002
|
+
if (!fs4.existsSync(layout.variantsRoot))
|
|
27003
|
+
return [];
|
|
27004
|
+
return fs4.readdirSync(layout.variantsRoot, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => e.name).sort();
|
|
27005
|
+
}
|
|
27006
|
+
function matchesGlob(filename, glob) {
|
|
27007
|
+
const starIdx = glob.indexOf("*");
|
|
27008
|
+
if (starIdx === -1)
|
|
27009
|
+
return filename === glob;
|
|
27010
|
+
const prefix = glob.slice(0, starIdx);
|
|
27011
|
+
const suffix = glob.slice(starIdx + 1);
|
|
27012
|
+
return filename.length >= prefix.length + suffix.length && filename.startsWith(prefix) && filename.endsWith(suffix);
|
|
27013
|
+
}
|
|
27014
|
+
function assertStateWritable(stateFilePath) {
|
|
27015
|
+
const dir = path8.dirname(stateFilePath);
|
|
27016
|
+
try {
|
|
27017
|
+
fs4.mkdirSync(dir, { recursive: true });
|
|
27018
|
+
} catch (err) {
|
|
27019
|
+
throw UnwritableInstallStateError(stateFilePath, err.message);
|
|
27020
|
+
}
|
|
27021
|
+
const checkPath = fs4.existsSync(stateFilePath) ? stateFilePath : dir;
|
|
27022
|
+
try {
|
|
27023
|
+
fs4.accessSync(checkPath, fs4.constants.W_OK);
|
|
27024
|
+
} catch (err) {
|
|
27025
|
+
throw UnwritableInstallStateError(stateFilePath, err.message);
|
|
27026
|
+
}
|
|
27027
|
+
}
|
|
27028
|
+
function copyFileRouteVariant(layout, variantDir) {
|
|
27029
|
+
fs4.mkdirSync(layout.activeDir, { recursive: true });
|
|
27030
|
+
let changed = 0;
|
|
27031
|
+
for (const entry of fs4.readdirSync(variantDir, { withFileTypes: true })) {
|
|
27032
|
+
if (!entry.isFile() || !matchesGlob(entry.name, layout.activeGlob))
|
|
27033
|
+
continue;
|
|
27034
|
+
fs4.copyFileSync(path8.join(variantDir, entry.name), path8.join(layout.activeDir, entry.name));
|
|
27035
|
+
changed++;
|
|
27036
|
+
}
|
|
27037
|
+
return changed;
|
|
27038
|
+
}
|
|
27039
|
+
function repointOpencodeVariant(layout, variantDir) {
|
|
27040
|
+
fs4.mkdirSync(layout.activeDir, { recursive: true });
|
|
27041
|
+
let changed = 0;
|
|
27042
|
+
for (const entry of fs4.readdirSync(variantDir, { withFileTypes: true })) {
|
|
27043
|
+
if (!entry.isFile() || !matchesGlob(entry.name, layout.activeGlob))
|
|
27044
|
+
continue;
|
|
27045
|
+
const dest = path8.join(layout.activeDir, entry.name);
|
|
27046
|
+
const target = path8.resolve(path8.join(variantDir, entry.name));
|
|
27047
|
+
let destExists = true;
|
|
27048
|
+
let destIsSymlink = false;
|
|
27049
|
+
try {
|
|
27050
|
+
destIsSymlink = fs4.lstatSync(dest).isSymbolicLink();
|
|
27051
|
+
} catch {
|
|
27052
|
+
destExists = false;
|
|
27053
|
+
}
|
|
27054
|
+
if (destExists && !destIsSymlink)
|
|
27055
|
+
continue;
|
|
27056
|
+
const tmp = `${dest}.massa-ai-switch.${crypto4.randomUUID()}`;
|
|
27057
|
+
fs4.symlinkSync(target, tmp);
|
|
27058
|
+
fs4.renameSync(tmp, dest);
|
|
27059
|
+
changed++;
|
|
27060
|
+
}
|
|
27061
|
+
return changed;
|
|
27062
|
+
}
|
|
27063
|
+
function copyVariant(host, layout, variantDir) {
|
|
27064
|
+
return host === "opencode" ? repointOpencodeVariant(layout, variantDir) : copyFileRouteVariant(layout, variantDir);
|
|
27065
|
+
}
|
|
27066
|
+
function switchProfile(opts) {
|
|
27067
|
+
const { targetHome, stateFilePath } = resolveCommon(opts);
|
|
27068
|
+
const dryRun = opts.dryRun ?? false;
|
|
27069
|
+
const requested = opts.host ? [opts.host] : opts.hosts ?? HOSTS;
|
|
27070
|
+
const universe = HOSTS.filter((h) => requested.includes(h));
|
|
27071
|
+
const state = readInstallState(stateFilePath);
|
|
27072
|
+
if (!dryRun)
|
|
27073
|
+
assertStateWritable(stateFilePath);
|
|
27074
|
+
const layouts = universe.map((host) => ({ host, layout: resolveHostLayout(host, { targetHome, projectRoot: opts.projectRoot }) }));
|
|
27075
|
+
const skipRows = layouts.filter((l) => l.layout.route === "skip").map((l) => ({ host: l.host, status: "skipped", reason: l.layout.reason }));
|
|
27076
|
+
const fileHosts = layouts.filter((l) => l.layout.route === "files");
|
|
27077
|
+
if (fileHosts.length === 0) {
|
|
27078
|
+
return { profile: opts.profile, dryRun, hosts: orderRows(universe, skipRows), restartRequired: false };
|
|
27079
|
+
}
|
|
27080
|
+
const installedFileHosts = fileHosts.filter((h) => fs4.existsSync(h.layout.activeDir));
|
|
27081
|
+
if (installedFileHosts.length === 0)
|
|
27082
|
+
throw NoHostsDetectedError();
|
|
27083
|
+
const withAvailability = fileHosts.map((h) => {
|
|
27084
|
+
const variantsRootExists = fs4.existsSync(h.layout.variantsRoot);
|
|
27085
|
+
const variantDir = h.layout.variantDir(opts.profile);
|
|
27086
|
+
const available = variantsRootExists && fs4.existsSync(variantDir) && fs4.statSync(variantDir).isDirectory();
|
|
27087
|
+
return { ...h, variantsRootExists, variantDir, available };
|
|
27088
|
+
});
|
|
27089
|
+
if (!withAvailability.some((h) => h.available)) {
|
|
27090
|
+
const known = new Set;
|
|
27091
|
+
for (const h of withAvailability) {
|
|
27092
|
+
if (!h.variantsRootExists)
|
|
27093
|
+
continue;
|
|
27094
|
+
for (const name of listVariantProfiles(h.layout))
|
|
27095
|
+
known.add(name);
|
|
27096
|
+
}
|
|
27097
|
+
throw UnknownProfileError(opts.profile, [...known].sort());
|
|
27098
|
+
}
|
|
27099
|
+
const lock = dryRun ? null : acquireLock(stateFilePath, opts.lock);
|
|
27100
|
+
try {
|
|
27101
|
+
const rows = [...skipRows];
|
|
27102
|
+
for (const h of withAvailability) {
|
|
27103
|
+
if (!h.variantsRootExists) {
|
|
27104
|
+
rows.push({ host: h.host, status: "unsupported", reason: "bundle has no variants \u2014 upgrade plugin" });
|
|
27105
|
+
continue;
|
|
27106
|
+
}
|
|
27107
|
+
if (!h.available) {
|
|
27108
|
+
const supported = listVariantProfiles(h.layout);
|
|
27109
|
+
rows.push({
|
|
27110
|
+
host: h.host,
|
|
27111
|
+
status: "unsupported",
|
|
27112
|
+
reason: `profile "${opts.profile}" not supported on ${h.host} (supports: ${supported.join(", ") || "none"})`
|
|
27113
|
+
});
|
|
27114
|
+
continue;
|
|
27115
|
+
}
|
|
27116
|
+
const route = detectRoute(state.platforms[h.host]);
|
|
27117
|
+
if (route.kind === "refuse") {
|
|
27118
|
+
rows.push({ host: h.host, status: "failed", reason: route.reason });
|
|
27119
|
+
continue;
|
|
27120
|
+
}
|
|
27121
|
+
if (dryRun) {
|
|
27122
|
+
rows.push({ host: h.host, status: "switched" });
|
|
27123
|
+
continue;
|
|
27124
|
+
}
|
|
27125
|
+
try {
|
|
27126
|
+
const filesChanged = copyVariant(h.host, h.layout, h.variantDir);
|
|
27127
|
+
updatePlatform(stateFilePath, h.host, {
|
|
27128
|
+
modelProfile: { profile: opts.profile, switchedAt: new Date().toISOString() }
|
|
27129
|
+
});
|
|
27130
|
+
rows.push({ host: h.host, status: "switched", filesChanged });
|
|
27131
|
+
} catch (err) {
|
|
27132
|
+
rows.push({ host: h.host, status: "failed", reason: err.message });
|
|
27133
|
+
}
|
|
27134
|
+
}
|
|
27135
|
+
const ordered = orderRows(universe, rows);
|
|
27136
|
+
const restartRequired = !dryRun && ordered.some((r) => r.status === "switched");
|
|
27137
|
+
return { profile: opts.profile, dryRun, hosts: ordered, restartRequired };
|
|
27138
|
+
} finally {
|
|
27139
|
+
lock?.release();
|
|
27140
|
+
}
|
|
27141
|
+
}
|
|
27142
|
+
function orderRows(universe, rows) {
|
|
27143
|
+
const byHost = new Map(rows.map((r) => [r.host, r]));
|
|
27144
|
+
return HOSTS.filter((h) => universe.includes(h) && byHost.has(h)).map((h) => byHost.get(h));
|
|
27145
|
+
}
|
|
27146
|
+
var SwitchEngineError, UnknownProfileError = (profile, known) => namedError3("UnknownProfileError", `unknown profile "${profile}" \u2014 installed: ${known.length > 0 ? known.join(", ") : "none"}`), NoHostsDetectedError = () => namedError3("NoHostsDetectedError", "no installed hosts found");
|
|
27147
|
+
var init_engine = __esm(() => {
|
|
27148
|
+
init_hosts();
|
|
27149
|
+
init_state();
|
|
27150
|
+
init_lock();
|
|
27151
|
+
SwitchEngineError = class SwitchEngineError extends Error {
|
|
27152
|
+
constructor(message) {
|
|
27153
|
+
super(message);
|
|
27154
|
+
this.name = "SwitchEngineError";
|
|
27155
|
+
}
|
|
27156
|
+
};
|
|
27157
|
+
});
|
|
27158
|
+
|
|
27159
|
+
// ../../packages/shared/dist/profile-switch/report.js
|
|
27160
|
+
function reportSucceeded(report) {
|
|
27161
|
+
return report.hosts.every((h) => h.status === "switched" || h.status === "skipped");
|
|
27162
|
+
}
|
|
27163
|
+
|
|
26712
27164
|
// ../../packages/shared/dist/index.js
|
|
26713
27165
|
var init_dist = __esm(() => {
|
|
26714
27166
|
init_env();
|
|
26715
27167
|
init_config();
|
|
27168
|
+
init_hosts();
|
|
27169
|
+
init_state();
|
|
27170
|
+
init_lock();
|
|
27171
|
+
init_engine();
|
|
26716
27172
|
init_types2();
|
|
26717
27173
|
init_interfaces();
|
|
26718
27174
|
init_utils();
|
|
@@ -28234,7 +28690,7 @@ var import_brace_expansion, minimatch = (p, pattern, options = {}) => {
|
|
|
28234
28690
|
}, qmarksTestNoExtDot = ([$0]) => {
|
|
28235
28691
|
const len = $0.length;
|
|
28236
28692
|
return (f) => f.length === len && f !== "." && f !== "..";
|
|
28237
|
-
}, defaultPlatform,
|
|
28693
|
+
}, defaultPlatform, path9, sep, GLOBSTAR, qmark2 = "[^/]", star2, twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?", twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?", filter = (pattern, options = {}) => (p) => minimatch(p, pattern, options), ext = (a, b = {}) => Object.assign({}, a, b), defaults = (def) => {
|
|
28238
28694
|
if (!def || typeof def !== "object" || !Object.keys(def).length) {
|
|
28239
28695
|
return minimatch;
|
|
28240
28696
|
}
|
|
@@ -28292,11 +28748,11 @@ var init_esm = __esm(() => {
|
|
|
28292
28748
|
starRE = /^\*+$/;
|
|
28293
28749
|
qmarksRE = /^\?+([^+@!?\*\[\(]*)?$/;
|
|
28294
28750
|
defaultPlatform = typeof process === "object" && process ? typeof process.env === "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
|
|
28295
|
-
|
|
28751
|
+
path9 = {
|
|
28296
28752
|
win32: { sep: "\\" },
|
|
28297
28753
|
posix: { sep: "/" }
|
|
28298
28754
|
};
|
|
28299
|
-
sep = defaultPlatform === "win32" ?
|
|
28755
|
+
sep = defaultPlatform === "win32" ? path9.win32.sep : path9.posix.sep;
|
|
28300
28756
|
minimatch.sep = sep;
|
|
28301
28757
|
GLOBSTAR = Symbol("globstar **");
|
|
28302
28758
|
minimatch.GLOBSTAR = GLOBSTAR;
|
|
@@ -30262,12 +30718,12 @@ var init_esm4 = __esm(() => {
|
|
|
30262
30718
|
childrenCache() {
|
|
30263
30719
|
return this.#children;
|
|
30264
30720
|
}
|
|
30265
|
-
resolve(
|
|
30266
|
-
if (!
|
|
30721
|
+
resolve(path10) {
|
|
30722
|
+
if (!path10) {
|
|
30267
30723
|
return this;
|
|
30268
30724
|
}
|
|
30269
|
-
const rootPath = this.getRootString(
|
|
30270
|
-
const dir =
|
|
30725
|
+
const rootPath = this.getRootString(path10);
|
|
30726
|
+
const dir = path10.substring(rootPath.length);
|
|
30271
30727
|
const dirParts = dir.split(this.splitSep);
|
|
30272
30728
|
const result = rootPath ? this.getRoot(rootPath).#resolveParts(dirParts) : this.#resolveParts(dirParts);
|
|
30273
30729
|
return result;
|
|
@@ -30795,8 +31251,8 @@ var init_esm4 = __esm(() => {
|
|
|
30795
31251
|
newChild(name, type = UNKNOWN, opts = {}) {
|
|
30796
31252
|
return new PathWin32(name, type, this.root, this.roots, this.nocase, this.childrenCache(), opts);
|
|
30797
31253
|
}
|
|
30798
|
-
getRootString(
|
|
30799
|
-
return win32.parse(
|
|
31254
|
+
getRootString(path10) {
|
|
31255
|
+
return win32.parse(path10).root;
|
|
30800
31256
|
}
|
|
30801
31257
|
getRoot(rootPath) {
|
|
30802
31258
|
rootPath = uncToDrive(rootPath.toUpperCase());
|
|
@@ -30821,8 +31277,8 @@ var init_esm4 = __esm(() => {
|
|
|
30821
31277
|
constructor(name, type = UNKNOWN, root, roots, nocase, children, opts) {
|
|
30822
31278
|
super(name, type, root, roots, nocase, children, opts);
|
|
30823
31279
|
}
|
|
30824
|
-
getRootString(
|
|
30825
|
-
return
|
|
31280
|
+
getRootString(path10) {
|
|
31281
|
+
return path10.startsWith("/") ? "/" : "";
|
|
30826
31282
|
}
|
|
30827
31283
|
getRoot(_rootPath) {
|
|
30828
31284
|
return this.root;
|
|
@@ -30841,8 +31297,8 @@ var init_esm4 = __esm(() => {
|
|
|
30841
31297
|
#children;
|
|
30842
31298
|
nocase;
|
|
30843
31299
|
#fs;
|
|
30844
|
-
constructor(cwd = process.cwd(), pathImpl, sep2, { nocase, childrenCacheSize = 16 * 1024, fs:
|
|
30845
|
-
this.#fs = fsFromOption(
|
|
31300
|
+
constructor(cwd = process.cwd(), pathImpl, sep2, { nocase, childrenCacheSize = 16 * 1024, fs: fs5 = defaultFS } = {}) {
|
|
31301
|
+
this.#fs = fsFromOption(fs5);
|
|
30846
31302
|
if (cwd instanceof URL || cwd.startsWith("file://")) {
|
|
30847
31303
|
cwd = fileURLToPath(cwd);
|
|
30848
31304
|
}
|
|
@@ -30878,11 +31334,11 @@ var init_esm4 = __esm(() => {
|
|
|
30878
31334
|
}
|
|
30879
31335
|
this.cwd = prev;
|
|
30880
31336
|
}
|
|
30881
|
-
depth(
|
|
30882
|
-
if (typeof
|
|
30883
|
-
|
|
31337
|
+
depth(path10 = this.cwd) {
|
|
31338
|
+
if (typeof path10 === "string") {
|
|
31339
|
+
path10 = this.cwd.resolve(path10);
|
|
30884
31340
|
}
|
|
30885
|
-
return
|
|
31341
|
+
return path10.depth();
|
|
30886
31342
|
}
|
|
30887
31343
|
childrenCache() {
|
|
30888
31344
|
return this.#children;
|
|
@@ -31298,9 +31754,9 @@ var init_esm4 = __esm(() => {
|
|
|
31298
31754
|
process4();
|
|
31299
31755
|
return results;
|
|
31300
31756
|
}
|
|
31301
|
-
chdir(
|
|
31757
|
+
chdir(path10 = this.cwd) {
|
|
31302
31758
|
const oldCwd = this.cwd;
|
|
31303
|
-
this.cwd = typeof
|
|
31759
|
+
this.cwd = typeof path10 === "string" ? this.cwd.resolve(path10) : path10;
|
|
31304
31760
|
this.cwd[setAsCwd](oldCwd);
|
|
31305
31761
|
}
|
|
31306
31762
|
};
|
|
@@ -31317,8 +31773,8 @@ var init_esm4 = __esm(() => {
|
|
|
31317
31773
|
parseRootPath(dir) {
|
|
31318
31774
|
return win32.parse(dir).root.toUpperCase();
|
|
31319
31775
|
}
|
|
31320
|
-
newRoot(
|
|
31321
|
-
return new PathWin32(this.rootPath, IFDIR, undefined, this.roots, this.nocase, this.childrenCache(), { fs:
|
|
31776
|
+
newRoot(fs5) {
|
|
31777
|
+
return new PathWin32(this.rootPath, IFDIR, undefined, this.roots, this.nocase, this.childrenCache(), { fs: fs5 });
|
|
31322
31778
|
}
|
|
31323
31779
|
isAbsolute(p) {
|
|
31324
31780
|
return p.startsWith("/") || p.startsWith("\\") || /^[a-z]:(\/|\\)/i.test(p);
|
|
@@ -31334,8 +31790,8 @@ var init_esm4 = __esm(() => {
|
|
|
31334
31790
|
parseRootPath(_dir) {
|
|
31335
31791
|
return "/";
|
|
31336
31792
|
}
|
|
31337
|
-
newRoot(
|
|
31338
|
-
return new PathPosix(this.rootPath, IFDIR, undefined, this.roots, this.nocase, this.childrenCache(), { fs:
|
|
31793
|
+
newRoot(fs5) {
|
|
31794
|
+
return new PathPosix(this.rootPath, IFDIR, undefined, this.roots, this.nocase, this.childrenCache(), { fs: fs5 });
|
|
31339
31795
|
}
|
|
31340
31796
|
isAbsolute(p) {
|
|
31341
31797
|
return p.startsWith("/");
|
|
@@ -31592,8 +32048,8 @@ class MatchRecord {
|
|
|
31592
32048
|
this.store.set(target, current === undefined ? n : n & current);
|
|
31593
32049
|
}
|
|
31594
32050
|
entries() {
|
|
31595
|
-
return [...this.store.entries()].map(([
|
|
31596
|
-
|
|
32051
|
+
return [...this.store.entries()].map(([path10, n]) => [
|
|
32052
|
+
path10,
|
|
31597
32053
|
!!(n & 2),
|
|
31598
32054
|
!!(n & 1)
|
|
31599
32055
|
]);
|
|
@@ -31797,9 +32253,9 @@ class GlobUtil {
|
|
|
31797
32253
|
signal;
|
|
31798
32254
|
maxDepth;
|
|
31799
32255
|
includeChildMatches;
|
|
31800
|
-
constructor(patterns,
|
|
32256
|
+
constructor(patterns, path10, opts) {
|
|
31801
32257
|
this.patterns = patterns;
|
|
31802
|
-
this.path =
|
|
32258
|
+
this.path = path10;
|
|
31803
32259
|
this.opts = opts;
|
|
31804
32260
|
this.#sep = !opts.posix && opts.platform === "win32" ? "\\" : "/";
|
|
31805
32261
|
this.includeChildMatches = opts.includeChildMatches !== false;
|
|
@@ -31818,11 +32274,11 @@ class GlobUtil {
|
|
|
31818
32274
|
});
|
|
31819
32275
|
}
|
|
31820
32276
|
}
|
|
31821
|
-
#ignored(
|
|
31822
|
-
return this.seen.has(
|
|
32277
|
+
#ignored(path10) {
|
|
32278
|
+
return this.seen.has(path10) || !!this.#ignore?.ignored?.(path10);
|
|
31823
32279
|
}
|
|
31824
|
-
#childrenIgnored(
|
|
31825
|
-
return !!this.#ignore?.childrenIgnored?.(
|
|
32280
|
+
#childrenIgnored(path10) {
|
|
32281
|
+
return !!this.#ignore?.childrenIgnored?.(path10);
|
|
31826
32282
|
}
|
|
31827
32283
|
pause() {
|
|
31828
32284
|
this.paused = true;
|
|
@@ -32039,8 +32495,8 @@ var init_walker = __esm(() => {
|
|
|
32039
32495
|
init_processor();
|
|
32040
32496
|
GlobWalker = class GlobWalker extends GlobUtil {
|
|
32041
32497
|
matches = new Set;
|
|
32042
|
-
constructor(patterns,
|
|
32043
|
-
super(patterns,
|
|
32498
|
+
constructor(patterns, path10, opts) {
|
|
32499
|
+
super(patterns, path10, opts);
|
|
32044
32500
|
}
|
|
32045
32501
|
matchEmit(e) {
|
|
32046
32502
|
this.matches.add(e);
|
|
@@ -32077,8 +32533,8 @@ var init_walker = __esm(() => {
|
|
|
32077
32533
|
};
|
|
32078
32534
|
GlobStream = class GlobStream extends GlobUtil {
|
|
32079
32535
|
results;
|
|
32080
|
-
constructor(patterns,
|
|
32081
|
-
super(patterns,
|
|
32536
|
+
constructor(patterns, path10, opts) {
|
|
32537
|
+
super(patterns, path10, opts);
|
|
32082
32538
|
this.results = new Minipass({
|
|
32083
32539
|
signal: this.signal,
|
|
32084
32540
|
objectMode: true
|
|
@@ -32506,20 +32962,20 @@ var require_ignore = __commonJS((exports, module) => {
|
|
|
32506
32962
|
var throwError = (message, Ctor) => {
|
|
32507
32963
|
throw new Ctor(message);
|
|
32508
32964
|
};
|
|
32509
|
-
var checkPath = (
|
|
32510
|
-
if (!isString(
|
|
32965
|
+
var checkPath = (path10, originalPath, doThrow) => {
|
|
32966
|
+
if (!isString(path10)) {
|
|
32511
32967
|
return doThrow(`path must be a string, but got \`${originalPath}\``, TypeError);
|
|
32512
32968
|
}
|
|
32513
|
-
if (!
|
|
32969
|
+
if (!path10) {
|
|
32514
32970
|
return doThrow(`path must not be empty`, TypeError);
|
|
32515
32971
|
}
|
|
32516
|
-
if (checkPath.isNotRelative(
|
|
32972
|
+
if (checkPath.isNotRelative(path10)) {
|
|
32517
32973
|
const r = "`path.relative()`d";
|
|
32518
32974
|
return doThrow(`path should be a ${r} string, but got "${originalPath}"`, RangeError);
|
|
32519
32975
|
}
|
|
32520
32976
|
return true;
|
|
32521
32977
|
};
|
|
32522
|
-
var isNotRelative = (
|
|
32978
|
+
var isNotRelative = (path10) => REGEX_TEST_INVALID_PATH.test(path10);
|
|
32523
32979
|
checkPath.isNotRelative = isNotRelative;
|
|
32524
32980
|
checkPath.convert = (p) => p;
|
|
32525
32981
|
|
|
@@ -32562,7 +33018,7 @@ var require_ignore = __commonJS((exports, module) => {
|
|
|
32562
33018
|
addPattern(pattern) {
|
|
32563
33019
|
return this.add(pattern);
|
|
32564
33020
|
}
|
|
32565
|
-
_testOne(
|
|
33021
|
+
_testOne(path10, checkUnignored) {
|
|
32566
33022
|
let ignored = false;
|
|
32567
33023
|
let unignored = false;
|
|
32568
33024
|
this._rules.forEach((rule) => {
|
|
@@ -32570,7 +33026,7 @@ var require_ignore = __commonJS((exports, module) => {
|
|
|
32570
33026
|
if (unignored === negative && ignored !== unignored || negative && !ignored && !unignored && !checkUnignored) {
|
|
32571
33027
|
return;
|
|
32572
33028
|
}
|
|
32573
|
-
const matched = rule.regex.test(
|
|
33029
|
+
const matched = rule.regex.test(path10);
|
|
32574
33030
|
if (matched) {
|
|
32575
33031
|
ignored = !negative;
|
|
32576
33032
|
unignored = negative;
|
|
@@ -32582,39 +33038,39 @@ var require_ignore = __commonJS((exports, module) => {
|
|
|
32582
33038
|
};
|
|
32583
33039
|
}
|
|
32584
33040
|
_test(originalPath, cache, checkUnignored, slices) {
|
|
32585
|
-
const
|
|
32586
|
-
checkPath(
|
|
32587
|
-
return this._t(
|
|
33041
|
+
const path10 = originalPath && checkPath.convert(originalPath);
|
|
33042
|
+
checkPath(path10, originalPath, this._allowRelativePaths ? RETURN_FALSE : throwError);
|
|
33043
|
+
return this._t(path10, cache, checkUnignored, slices);
|
|
32588
33044
|
}
|
|
32589
|
-
_t(
|
|
32590
|
-
if (
|
|
32591
|
-
return cache[
|
|
33045
|
+
_t(path10, cache, checkUnignored, slices) {
|
|
33046
|
+
if (path10 in cache) {
|
|
33047
|
+
return cache[path10];
|
|
32592
33048
|
}
|
|
32593
33049
|
if (!slices) {
|
|
32594
|
-
slices =
|
|
33050
|
+
slices = path10.split(SLASH);
|
|
32595
33051
|
}
|
|
32596
33052
|
slices.pop();
|
|
32597
33053
|
if (!slices.length) {
|
|
32598
|
-
return cache[
|
|
33054
|
+
return cache[path10] = this._testOne(path10, checkUnignored);
|
|
32599
33055
|
}
|
|
32600
33056
|
const parent = this._t(slices.join(SLASH) + SLASH, cache, checkUnignored, slices);
|
|
32601
|
-
return cache[
|
|
33057
|
+
return cache[path10] = parent.ignored ? parent : this._testOne(path10, checkUnignored);
|
|
32602
33058
|
}
|
|
32603
|
-
ignores(
|
|
32604
|
-
return this._test(
|
|
33059
|
+
ignores(path10) {
|
|
33060
|
+
return this._test(path10, this._ignoreCache, false).ignored;
|
|
32605
33061
|
}
|
|
32606
33062
|
createFilter() {
|
|
32607
|
-
return (
|
|
33063
|
+
return (path10) => !this.ignores(path10);
|
|
32608
33064
|
}
|
|
32609
33065
|
filter(paths) {
|
|
32610
33066
|
return makeArray(paths).filter(this.createFilter());
|
|
32611
33067
|
}
|
|
32612
|
-
test(
|
|
32613
|
-
return this._test(
|
|
33068
|
+
test(path10) {
|
|
33069
|
+
return this._test(path10, this._testCache, true);
|
|
32614
33070
|
}
|
|
32615
33071
|
}
|
|
32616
33072
|
var factory = (options) => new Ignore2(options);
|
|
32617
|
-
var isPathValid = (
|
|
33073
|
+
var isPathValid = (path10) => checkPath(path10 && checkPath.convert(path10), path10, RETURN_FALSE);
|
|
32618
33074
|
factory.isPathValid = isPathValid;
|
|
32619
33075
|
factory.default = factory;
|
|
32620
33076
|
module.exports = factory;
|
|
@@ -32622,7 +33078,7 @@ var require_ignore = __commonJS((exports, module) => {
|
|
|
32622
33078
|
const makePosix = (str) => /^\\\\\?\\/.test(str) || /["<>|\u0000-\u001F]+/u.test(str) ? str : str.replace(/\\/g, "/");
|
|
32623
33079
|
checkPath.convert = makePosix;
|
|
32624
33080
|
const REGIX_IS_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i;
|
|
32625
|
-
checkPath.isNotRelative = (
|
|
33081
|
+
checkPath.isNotRelative = (path10) => REGIX_IS_WINDOWS_PATH_ABSOLUTE.test(path10) || isNotRelative(path10);
|
|
32626
33082
|
}
|
|
32627
33083
|
});
|
|
32628
33084
|
|
|
@@ -32684,18 +33140,18 @@ function validatePolicy(policy, opts = {}) {
|
|
|
32684
33140
|
}
|
|
32685
33141
|
}
|
|
32686
33142
|
}
|
|
32687
|
-
function
|
|
33143
|
+
function matchesGlob2(path10, pattern) {
|
|
32688
33144
|
let re = regexCache.get(pattern);
|
|
32689
33145
|
if (!re) {
|
|
32690
33146
|
re = globToRegex(pattern);
|
|
32691
33147
|
regexCache.set(pattern, re);
|
|
32692
33148
|
}
|
|
32693
|
-
return re.test(
|
|
33149
|
+
return re.test(path10);
|
|
32694
33150
|
}
|
|
32695
33151
|
var MAX_MATCH_WORK = 1e5, MAX_IGNORE_PATTERNS2 = 1024, DEFAULT_POLICY, applyPolicy = (filePath, policy) => {
|
|
32696
33152
|
const normalized = filePath.trim();
|
|
32697
33153
|
for (const rule of policy.rules) {
|
|
32698
|
-
if (
|
|
33154
|
+
if (matchesGlob2(normalized, rule.pattern))
|
|
32699
33155
|
return rule.disposition;
|
|
32700
33156
|
}
|
|
32701
33157
|
return "Keep";
|
|
@@ -32741,8 +33197,8 @@ var init_capture_policy = __esm(() => {
|
|
|
32741
33197
|
});
|
|
32742
33198
|
|
|
32743
33199
|
// ../../packages/core/dist/services/search/ignore-patterns.js
|
|
32744
|
-
import
|
|
32745
|
-
import
|
|
33200
|
+
import fs5 from "fs/promises";
|
|
33201
|
+
import path10 from "path";
|
|
32746
33202
|
function buildExtensionGlob(extensions) {
|
|
32747
33203
|
return extensions.map((ext2) => `**/*${ext2}`);
|
|
32748
33204
|
}
|
|
@@ -32765,8 +33221,8 @@ async function loadProjectIgnore(projectPath) {
|
|
|
32765
33221
|
const ig = ignore();
|
|
32766
33222
|
ig.add(DEFAULT_IGNORES);
|
|
32767
33223
|
try {
|
|
32768
|
-
const gitignorePath =
|
|
32769
|
-
const gitignoreContent = await
|
|
33224
|
+
const gitignorePath = path10.join(projectPath, ".gitignore");
|
|
33225
|
+
const gitignoreContent = await fs5.readFile(gitignorePath, "utf8");
|
|
32770
33226
|
const rules = gitignoreContent.split(`
|
|
32771
33227
|
`).map((line) => line.trim()).filter((line) => line && !line.startsWith("#"));
|
|
32772
33228
|
ig.add(rules);
|
|
@@ -34094,7 +34550,7 @@ var require_cert_signatures = __commonJS((exports, module) => {
|
|
|
34094
34550
|
|
|
34095
34551
|
// ../../node_modules/pg/lib/crypto/sasl.js
|
|
34096
34552
|
var require_sasl = __commonJS((exports, module) => {
|
|
34097
|
-
var
|
|
34553
|
+
var crypto5 = require_utils3();
|
|
34098
34554
|
var { signatureAlgorithmHashFromCertificate } = require_cert_signatures();
|
|
34099
34555
|
function saslprep(password) {
|
|
34100
34556
|
const nonAsciiSpace = /[\u00A0\u1680\u2000-\u200B\u202F\u205F\u3000]/g;
|
|
@@ -34113,7 +34569,7 @@ var require_sasl = __commonJS((exports, module) => {
|
|
|
34113
34569
|
if (mechanism === "SCRAM-SHA-256-PLUS" && typeof stream2.getPeerCertificate !== "function") {
|
|
34114
34570
|
throw new Error("SASL: Mechanism SCRAM-SHA-256-PLUS requires a certificate");
|
|
34115
34571
|
}
|
|
34116
|
-
const clientNonce =
|
|
34572
|
+
const clientNonce = crypto5.randomBytes(18).toString("base64");
|
|
34117
34573
|
const gs2Header = mechanism === "SCRAM-SHA-256-PLUS" ? "p=tls-server-end-point" : stream2 ? "y" : "n";
|
|
34118
34574
|
return {
|
|
34119
34575
|
mechanism,
|
|
@@ -34154,20 +34610,20 @@ var require_sasl = __commonJS((exports, module) => {
|
|
|
34154
34610
|
let hashName = signatureAlgorithmHashFromCertificate(peerCert);
|
|
34155
34611
|
if (hashName === "MD5" || hashName === "SHA-1")
|
|
34156
34612
|
hashName = "SHA-256";
|
|
34157
|
-
const certHash = await
|
|
34613
|
+
const certHash = await crypto5.hashByName(hashName, peerCert);
|
|
34158
34614
|
const bindingData = Buffer.concat([Buffer.from("p=tls-server-end-point,,"), Buffer.from(certHash)]);
|
|
34159
34615
|
channelBinding = bindingData.toString("base64");
|
|
34160
34616
|
}
|
|
34161
34617
|
const clientFinalMessageWithoutProof = "c=" + channelBinding + ",r=" + sv.nonce;
|
|
34162
34618
|
const authMessage = clientFirstMessageBare + "," + serverFirstMessage + "," + clientFinalMessageWithoutProof;
|
|
34163
34619
|
const saltBytes = Buffer.from(sv.salt, "base64");
|
|
34164
|
-
const saltedPassword = await
|
|
34165
|
-
const clientKey = await
|
|
34166
|
-
const storedKey = await
|
|
34167
|
-
const clientSignature = await
|
|
34620
|
+
const saltedPassword = await crypto5.deriveKey(saslprep(password), saltBytes, sv.iteration);
|
|
34621
|
+
const clientKey = await crypto5.hmacSha256(saltedPassword, "Client Key");
|
|
34622
|
+
const storedKey = await crypto5.sha256(clientKey);
|
|
34623
|
+
const clientSignature = await crypto5.hmacSha256(storedKey, authMessage);
|
|
34168
34624
|
const clientProof = xorBuffers(Buffer.from(clientKey), Buffer.from(clientSignature)).toString("base64");
|
|
34169
|
-
const serverKey = await
|
|
34170
|
-
const serverSignatureBytes = await
|
|
34625
|
+
const serverKey = await crypto5.hmacSha256(saltedPassword, "Server Key");
|
|
34626
|
+
const serverSignatureBytes = await crypto5.hmacSha256(serverKey, authMessage);
|
|
34171
34627
|
session.message = "SASLResponse";
|
|
34172
34628
|
session.serverSignature = Buffer.from(serverSignatureBytes).toString("base64");
|
|
34173
34629
|
session.response = clientFinalMessageWithoutProof + ",p=" + clientProof;
|
|
@@ -34362,15 +34818,15 @@ var require_pg_connection_string = __commonJS((exports, module) => {
|
|
|
34362
34818
|
if (config3.sslnegotiation === "direct" && config3.ssl === undefined) {
|
|
34363
34819
|
config3.ssl = true;
|
|
34364
34820
|
}
|
|
34365
|
-
const
|
|
34821
|
+
const fs6 = config3.sslcert || config3.sslkey || config3.sslrootcert ? __require("fs") : null;
|
|
34366
34822
|
if (config3.sslcert) {
|
|
34367
|
-
config3.ssl.cert =
|
|
34823
|
+
config3.ssl.cert = fs6.readFileSync(config3.sslcert).toString();
|
|
34368
34824
|
}
|
|
34369
34825
|
if (config3.sslkey) {
|
|
34370
|
-
config3.ssl.key =
|
|
34826
|
+
config3.ssl.key = fs6.readFileSync(config3.sslkey).toString();
|
|
34371
34827
|
}
|
|
34372
34828
|
if (config3.sslrootcert) {
|
|
34373
|
-
config3.ssl.ca =
|
|
34829
|
+
config3.ssl.ca = fs6.readFileSync(config3.sslrootcert).toString();
|
|
34374
34830
|
}
|
|
34375
34831
|
if (options.useLibpqCompat && config3.uselibpqcompat) {
|
|
34376
34832
|
throw new Error("Both useLibpqCompat and uselibpqcompat are set. Please use only one of them.");
|
|
@@ -36084,7 +36540,7 @@ var require_split2 = __commonJS((exports, module) => {
|
|
|
36084
36540
|
|
|
36085
36541
|
// ../../node_modules/pgpass/lib/helper.js
|
|
36086
36542
|
var require_helper = __commonJS((exports, module) => {
|
|
36087
|
-
var
|
|
36543
|
+
var path11 = __require("path");
|
|
36088
36544
|
var Stream2 = __require("stream").Stream;
|
|
36089
36545
|
var split = require_split2();
|
|
36090
36546
|
var util3 = __require("util");
|
|
@@ -36124,7 +36580,7 @@ var require_helper = __commonJS((exports, module) => {
|
|
|
36124
36580
|
};
|
|
36125
36581
|
exports.getFileName = function(rawEnv) {
|
|
36126
36582
|
var env = rawEnv || process.env;
|
|
36127
|
-
var file2 = env.PGPASSFILE || (isWin ?
|
|
36583
|
+
var file2 = env.PGPASSFILE || (isWin ? path11.join(env.APPDATA || "./", "postgresql", "pgpass.conf") : path11.join(env.HOME || "./", ".pgpass"));
|
|
36128
36584
|
return file2;
|
|
36129
36585
|
};
|
|
36130
36586
|
exports.usePgPass = function(stats, fname) {
|
|
@@ -36248,16 +36704,16 @@ var require_helper = __commonJS((exports, module) => {
|
|
|
36248
36704
|
|
|
36249
36705
|
// ../../node_modules/pgpass/lib/index.js
|
|
36250
36706
|
var require_lib = __commonJS((exports, module) => {
|
|
36251
|
-
var
|
|
36252
|
-
var
|
|
36707
|
+
var path11 = __require("path");
|
|
36708
|
+
var fs6 = __require("fs");
|
|
36253
36709
|
var helper = require_helper();
|
|
36254
36710
|
module.exports = function(connInfo, cb) {
|
|
36255
36711
|
var file2 = helper.getFileName();
|
|
36256
|
-
|
|
36712
|
+
fs6.stat(file2, function(err, stat) {
|
|
36257
36713
|
if (err || !helper.usePgPass(stat, file2)) {
|
|
36258
36714
|
return cb(undefined);
|
|
36259
36715
|
}
|
|
36260
|
-
var st =
|
|
36716
|
+
var st = fs6.createReadStream(file2);
|
|
36261
36717
|
helper.getPassword(connInfo, st, cb);
|
|
36262
36718
|
});
|
|
36263
36719
|
};
|
|
@@ -36275,7 +36731,7 @@ var require_client = __commonJS((exports, module) => {
|
|
|
36275
36731
|
var Query = require_query();
|
|
36276
36732
|
var defaults2 = require_defaults2();
|
|
36277
36733
|
var Connection = require_connection();
|
|
36278
|
-
var
|
|
36734
|
+
var crypto5 = require_utils3();
|
|
36279
36735
|
var activeQueryDeprecationNotice = nodeUtils.deprecate(() => {}, "Client.activeQuery is deprecated and will be removed in pg@9.0");
|
|
36280
36736
|
var queryQueueDeprecationNotice = nodeUtils.deprecate(() => {}, "Client.queryQueue is deprecated and will be removed in pg@9.0.");
|
|
36281
36737
|
var pgPassDeprecationNotice = nodeUtils.deprecate(() => {}, "pgpass support is deprecated and will be removed in pg@9.0. " + "You can provide an async function as the password property to the Client/Pool constructor that returns a password instead. Within this function you can call the pgpass module in your own code.");
|
|
@@ -36507,7 +36963,7 @@ var require_client = __commonJS((exports, module) => {
|
|
|
36507
36963
|
_handleAuthMD5Password(msg) {
|
|
36508
36964
|
this._getPassword(async () => {
|
|
36509
36965
|
try {
|
|
36510
|
-
const hashedPassword = await
|
|
36966
|
+
const hashedPassword = await crypto5.postgresMd5PasswordHash(this.user, this.password, msg.salt);
|
|
36511
36967
|
this.connection.password(hashedPassword);
|
|
36512
36968
|
} catch (e) {
|
|
36513
36969
|
this.emit("error", e);
|
|
@@ -37874,8 +38330,8 @@ var init_alias_resolver = __esm(() => {
|
|
|
37874
38330
|
});
|
|
37875
38331
|
|
|
37876
38332
|
// ../../packages/core/dist/services/search/index-manager.js
|
|
37877
|
-
import
|
|
37878
|
-
import
|
|
38333
|
+
import fs6 from "fs";
|
|
38334
|
+
import path11 from "path";
|
|
37879
38335
|
|
|
37880
38336
|
class IndexManager {
|
|
37881
38337
|
metadataCache = new Map;
|
|
@@ -37968,9 +38424,9 @@ class IndexManager {
|
|
|
37968
38424
|
const fileMetadata = {};
|
|
37969
38425
|
let totalSize = 0;
|
|
37970
38426
|
for (const filePath of indexedFiles) {
|
|
37971
|
-
const fullPath =
|
|
38427
|
+
const fullPath = path11.join(projectPath, filePath);
|
|
37972
38428
|
try {
|
|
37973
|
-
const stat = await
|
|
38429
|
+
const stat = await fs6.promises.stat(fullPath);
|
|
37974
38430
|
fileMetadata[filePath] = {
|
|
37975
38431
|
path: filePath,
|
|
37976
38432
|
mtime: stat.mtimeMs,
|
|
@@ -38021,9 +38477,9 @@ class IndexManager {
|
|
|
38021
38477
|
if (ig.ignores(match2)) {
|
|
38022
38478
|
continue;
|
|
38023
38479
|
}
|
|
38024
|
-
const fullPath =
|
|
38480
|
+
const fullPath = path11.join(projectPath, match2);
|
|
38025
38481
|
try {
|
|
38026
|
-
const stat = await
|
|
38482
|
+
const stat = await fs6.promises.stat(fullPath);
|
|
38027
38483
|
files.set(match2, {
|
|
38028
38484
|
path: match2,
|
|
38029
38485
|
mtime: stat.mtimeMs,
|
|
@@ -41276,23 +41732,23 @@ var require_auth_config = __commonJS((exports, module) => {
|
|
|
41276
41732
|
writeAuthConfig: () => writeAuthConfig
|
|
41277
41733
|
});
|
|
41278
41734
|
module.exports = __toCommonJS2(auth_config_exports);
|
|
41279
|
-
var
|
|
41280
|
-
var
|
|
41735
|
+
var fs7 = __toESM2(__require("fs"));
|
|
41736
|
+
var path12 = __toESM2(__require("path"));
|
|
41281
41737
|
var import_token_util = require_token_util();
|
|
41282
41738
|
function getAuthConfigPath() {
|
|
41283
41739
|
const dataDir = (0, import_token_util.getVercelDataDir)();
|
|
41284
41740
|
if (!dataDir) {
|
|
41285
41741
|
throw new Error(`Unable to find Vercel CLI data directory. Your platform: ${process.platform}. Supported: darwin, linux, win32.`);
|
|
41286
41742
|
}
|
|
41287
|
-
return
|
|
41743
|
+
return path12.join(dataDir, "auth.json");
|
|
41288
41744
|
}
|
|
41289
41745
|
function readAuthConfig() {
|
|
41290
41746
|
try {
|
|
41291
41747
|
const authPath = getAuthConfigPath();
|
|
41292
|
-
if (!
|
|
41748
|
+
if (!fs7.existsSync(authPath)) {
|
|
41293
41749
|
return null;
|
|
41294
41750
|
}
|
|
41295
|
-
const content =
|
|
41751
|
+
const content = fs7.readFileSync(authPath, "utf8");
|
|
41296
41752
|
if (!content) {
|
|
41297
41753
|
return null;
|
|
41298
41754
|
}
|
|
@@ -41303,11 +41759,11 @@ var require_auth_config = __commonJS((exports, module) => {
|
|
|
41303
41759
|
}
|
|
41304
41760
|
function writeAuthConfig(config3) {
|
|
41305
41761
|
const authPath = getAuthConfigPath();
|
|
41306
|
-
const authDir =
|
|
41307
|
-
if (!
|
|
41308
|
-
|
|
41762
|
+
const authDir = path12.dirname(authPath);
|
|
41763
|
+
if (!fs7.existsSync(authDir)) {
|
|
41764
|
+
fs7.mkdirSync(authDir, { mode: 504, recursive: true });
|
|
41309
41765
|
}
|
|
41310
|
-
|
|
41766
|
+
fs7.writeFileSync(authPath, JSON.stringify(config3, null, 2), { mode: 384 });
|
|
41311
41767
|
}
|
|
41312
41768
|
function isValidAccessToken(authConfig, expirationBufferMs = 0) {
|
|
41313
41769
|
if (!authConfig.token)
|
|
@@ -41482,8 +41938,8 @@ var require_token_util = __commonJS((exports, module) => {
|
|
|
41482
41938
|
saveToken: () => saveToken
|
|
41483
41939
|
});
|
|
41484
41940
|
module.exports = __toCommonJS2(token_util_exports);
|
|
41485
|
-
var
|
|
41486
|
-
var
|
|
41941
|
+
var path12 = __toESM2(__require("path"));
|
|
41942
|
+
var fs7 = __toESM2(__require("fs"));
|
|
41487
41943
|
var import_token_error = require_token_error();
|
|
41488
41944
|
var import_token_io = require_token_io();
|
|
41489
41945
|
var import_auth_config = require_auth_config();
|
|
@@ -41495,7 +41951,7 @@ var require_token_util = __commonJS((exports, module) => {
|
|
|
41495
41951
|
if (!dataDir) {
|
|
41496
41952
|
return null;
|
|
41497
41953
|
}
|
|
41498
|
-
return
|
|
41954
|
+
return path12.join(dataDir, vercelFolder);
|
|
41499
41955
|
}
|
|
41500
41956
|
async function getVercelToken2(options) {
|
|
41501
41957
|
const authConfig = (0, import_auth_config.readAuthConfig)();
|
|
@@ -41563,11 +42019,11 @@ var require_token_util = __commonJS((exports, module) => {
|
|
|
41563
42019
|
if (!dir) {
|
|
41564
42020
|
throw new import_token_error.VercelOidcTokenError("Unable to find project root directory. Have you linked your project with `vc link?`");
|
|
41565
42021
|
}
|
|
41566
|
-
const prjPath =
|
|
41567
|
-
if (!
|
|
42022
|
+
const prjPath = path12.join(dir, ".vercel", "project.json");
|
|
42023
|
+
if (!fs7.existsSync(prjPath)) {
|
|
41568
42024
|
throw new import_token_error.VercelOidcTokenError("project.json not found, have you linked your project with `vc link?`");
|
|
41569
42025
|
}
|
|
41570
|
-
const prj = JSON.parse(
|
|
42026
|
+
const prj = JSON.parse(fs7.readFileSync(prjPath, "utf8"));
|
|
41571
42027
|
if (typeof prj.projectId !== "string" && typeof prj.orgId !== "string") {
|
|
41572
42028
|
throw new TypeError("Expected a string-valued projectId property. Try running `vc link` to re-link your project.");
|
|
41573
42029
|
}
|
|
@@ -41578,11 +42034,11 @@ var require_token_util = __commonJS((exports, module) => {
|
|
|
41578
42034
|
if (!dir) {
|
|
41579
42035
|
throw new import_token_error.VercelOidcTokenError("Unable to find user data directory. Please reach out to Vercel support.");
|
|
41580
42036
|
}
|
|
41581
|
-
const tokenPath =
|
|
42037
|
+
const tokenPath = path12.join(dir, "com.vercel.token", `${projectId}.json`);
|
|
41582
42038
|
const tokenJson = JSON.stringify(token);
|
|
41583
|
-
|
|
41584
|
-
|
|
41585
|
-
|
|
42039
|
+
fs7.mkdirSync(path12.dirname(tokenPath), { mode: 504, recursive: true });
|
|
42040
|
+
fs7.writeFileSync(tokenPath, tokenJson);
|
|
42041
|
+
fs7.chmodSync(tokenPath, 432);
|
|
41586
42042
|
return;
|
|
41587
42043
|
}
|
|
41588
42044
|
function loadToken(projectId) {
|
|
@@ -41590,11 +42046,11 @@ var require_token_util = __commonJS((exports, module) => {
|
|
|
41590
42046
|
if (!dir) {
|
|
41591
42047
|
throw new import_token_error.VercelOidcTokenError("Unable to find user data directory. Please reach out to Vercel support.");
|
|
41592
42048
|
}
|
|
41593
|
-
const tokenPath =
|
|
41594
|
-
if (!
|
|
42049
|
+
const tokenPath = path12.join(dir, "com.vercel.token", `${projectId}.json`);
|
|
42050
|
+
if (!fs7.existsSync(tokenPath)) {
|
|
41595
42051
|
return null;
|
|
41596
42052
|
}
|
|
41597
|
-
const token = JSON.parse(
|
|
42053
|
+
const token = JSON.parse(fs7.readFileSync(tokenPath, "utf8"));
|
|
41598
42054
|
assertVercelOidcTokenResponse(token);
|
|
41599
42055
|
return token;
|
|
41600
42056
|
}
|
|
@@ -52436,37 +52892,37 @@ function createOpenAI(options = {}) {
|
|
|
52436
52892
|
}, `ai-sdk/openai/${VERSION4}`);
|
|
52437
52893
|
const createChatModel = (modelId) => new OpenAIChatLanguageModel(modelId, {
|
|
52438
52894
|
provider: `${providerName}.chat`,
|
|
52439
|
-
url: ({ path:
|
|
52895
|
+
url: ({ path: path12 }) => `${baseURL}${path12}`,
|
|
52440
52896
|
headers: getHeaders,
|
|
52441
52897
|
fetch: options.fetch
|
|
52442
52898
|
});
|
|
52443
52899
|
const createCompletionModel = (modelId) => new OpenAICompletionLanguageModel(modelId, {
|
|
52444
52900
|
provider: `${providerName}.completion`,
|
|
52445
|
-
url: ({ path:
|
|
52901
|
+
url: ({ path: path12 }) => `${baseURL}${path12}`,
|
|
52446
52902
|
headers: getHeaders,
|
|
52447
52903
|
fetch: options.fetch
|
|
52448
52904
|
});
|
|
52449
52905
|
const createEmbeddingModel = (modelId) => new OpenAIEmbeddingModel(modelId, {
|
|
52450
52906
|
provider: `${providerName}.embedding`,
|
|
52451
|
-
url: ({ path:
|
|
52907
|
+
url: ({ path: path12 }) => `${baseURL}${path12}`,
|
|
52452
52908
|
headers: getHeaders,
|
|
52453
52909
|
fetch: options.fetch
|
|
52454
52910
|
});
|
|
52455
52911
|
const createImageModel = (modelId) => new OpenAIImageModel(modelId, {
|
|
52456
52912
|
provider: `${providerName}.image`,
|
|
52457
|
-
url: ({ path:
|
|
52913
|
+
url: ({ path: path12 }) => `${baseURL}${path12}`,
|
|
52458
52914
|
headers: getHeaders,
|
|
52459
52915
|
fetch: options.fetch
|
|
52460
52916
|
});
|
|
52461
52917
|
const createTranscriptionModel = (modelId) => new OpenAITranscriptionModel(modelId, {
|
|
52462
52918
|
provider: `${providerName}.transcription`,
|
|
52463
|
-
url: ({ path:
|
|
52919
|
+
url: ({ path: path12 }) => `${baseURL}${path12}`,
|
|
52464
52920
|
headers: getHeaders,
|
|
52465
52921
|
fetch: options.fetch
|
|
52466
52922
|
});
|
|
52467
52923
|
const createSpeechModel = (modelId) => new OpenAISpeechModel(modelId, {
|
|
52468
52924
|
provider: `${providerName}.speech`,
|
|
52469
|
-
url: ({ path:
|
|
52925
|
+
url: ({ path: path12 }) => `${baseURL}${path12}`,
|
|
52470
52926
|
headers: getHeaders,
|
|
52471
52927
|
fetch: options.fetch
|
|
52472
52928
|
});
|
|
@@ -52479,7 +52935,7 @@ function createOpenAI(options = {}) {
|
|
|
52479
52935
|
const createResponsesModel = (modelId) => {
|
|
52480
52936
|
return new OpenAIResponsesLanguageModel(modelId, {
|
|
52481
52937
|
provider: `${providerName}.responses`,
|
|
52482
|
-
url: ({ path:
|
|
52938
|
+
url: ({ path: path12 }) => `${baseURL}${path12}`,
|
|
52483
52939
|
headers: getHeaders,
|
|
52484
52940
|
fetch: options.fetch,
|
|
52485
52941
|
fileIdPrefixes: ["file-"]
|
|
@@ -69012,26 +69468,26 @@ var require_process = __commonJS((exports, module) => {
|
|
|
69012
69468
|
|
|
69013
69469
|
// ../../node_modules/detect-libc/lib/filesystem.js
|
|
69014
69470
|
var require_filesystem = __commonJS((exports, module) => {
|
|
69015
|
-
var
|
|
69471
|
+
var fs7 = __require("fs");
|
|
69016
69472
|
var LDD_PATH = "/usr/bin/ldd";
|
|
69017
69473
|
var SELF_PATH = "/proc/self/exe";
|
|
69018
69474
|
var MAX_LENGTH = 2048;
|
|
69019
|
-
var readFileSync2 = (
|
|
69020
|
-
const fd =
|
|
69475
|
+
var readFileSync2 = (path12) => {
|
|
69476
|
+
const fd = fs7.openSync(path12, "r");
|
|
69021
69477
|
const buffer = Buffer.alloc(MAX_LENGTH);
|
|
69022
|
-
const bytesRead =
|
|
69023
|
-
|
|
69478
|
+
const bytesRead = fs7.readSync(fd, buffer, 0, MAX_LENGTH, 0);
|
|
69479
|
+
fs7.close(fd, () => {});
|
|
69024
69480
|
return buffer.subarray(0, bytesRead);
|
|
69025
69481
|
};
|
|
69026
|
-
var readFile = (
|
|
69027
|
-
|
|
69482
|
+
var readFile = (path12) => new Promise((resolve4, reject) => {
|
|
69483
|
+
fs7.open(path12, "r", (err, fd) => {
|
|
69028
69484
|
if (err) {
|
|
69029
69485
|
reject(err);
|
|
69030
69486
|
} else {
|
|
69031
69487
|
const buffer = Buffer.alloc(MAX_LENGTH);
|
|
69032
|
-
|
|
69488
|
+
fs7.read(fd, buffer, 0, MAX_LENGTH, 0, (_, bytesRead) => {
|
|
69033
69489
|
resolve4(buffer.subarray(0, bytesRead));
|
|
69034
|
-
|
|
69490
|
+
fs7.close(fd, () => {});
|
|
69035
69491
|
});
|
|
69036
69492
|
}
|
|
69037
69493
|
});
|
|
@@ -69136,11 +69592,11 @@ var require_detect_libc = __commonJS((exports, module) => {
|
|
|
69136
69592
|
}
|
|
69137
69593
|
return null;
|
|
69138
69594
|
};
|
|
69139
|
-
var familyFromInterpreterPath = (
|
|
69140
|
-
if (
|
|
69141
|
-
if (
|
|
69595
|
+
var familyFromInterpreterPath = (path12) => {
|
|
69596
|
+
if (path12) {
|
|
69597
|
+
if (path12.includes("/ld-musl-")) {
|
|
69142
69598
|
return MUSL;
|
|
69143
|
-
} else if (
|
|
69599
|
+
} else if (path12.includes("/ld-linux-")) {
|
|
69144
69600
|
return GLIBC;
|
|
69145
69601
|
}
|
|
69146
69602
|
}
|
|
@@ -69185,8 +69641,8 @@ var require_detect_libc = __commonJS((exports, module) => {
|
|
|
69185
69641
|
cachedFamilyInterpreter = null;
|
|
69186
69642
|
try {
|
|
69187
69643
|
const selfContent = await readFile(SELF_PATH);
|
|
69188
|
-
const
|
|
69189
|
-
cachedFamilyInterpreter = familyFromInterpreterPath(
|
|
69644
|
+
const path12 = interpreterPath(selfContent);
|
|
69645
|
+
cachedFamilyInterpreter = familyFromInterpreterPath(path12);
|
|
69190
69646
|
} catch (e) {}
|
|
69191
69647
|
return cachedFamilyInterpreter;
|
|
69192
69648
|
};
|
|
@@ -69197,8 +69653,8 @@ var require_detect_libc = __commonJS((exports, module) => {
|
|
|
69197
69653
|
cachedFamilyInterpreter = null;
|
|
69198
69654
|
try {
|
|
69199
69655
|
const selfContent = readFileSync2(SELF_PATH);
|
|
69200
|
-
const
|
|
69201
|
-
cachedFamilyInterpreter = familyFromInterpreterPath(
|
|
69656
|
+
const path12 = interpreterPath(selfContent);
|
|
69657
|
+
cachedFamilyInterpreter = familyFromInterpreterPath(path12);
|
|
69202
69658
|
} catch (e) {}
|
|
69203
69659
|
return cachedFamilyInterpreter;
|
|
69204
69660
|
};
|
|
@@ -70860,18 +71316,18 @@ var require_sharp = __commonJS((exports, module) => {
|
|
|
70860
71316
|
`@img/sharp-${runtimePlatform}/sharp.node`,
|
|
70861
71317
|
"@img/sharp-wasm32/sharp.node"
|
|
70862
71318
|
];
|
|
70863
|
-
var
|
|
71319
|
+
var path12;
|
|
70864
71320
|
var sharp;
|
|
70865
71321
|
var errors4 = [];
|
|
70866
|
-
for (
|
|
71322
|
+
for (path12 of paths) {
|
|
70867
71323
|
try {
|
|
70868
|
-
sharp = __require(
|
|
71324
|
+
sharp = __require(path12);
|
|
70869
71325
|
break;
|
|
70870
71326
|
} catch (err) {
|
|
70871
71327
|
errors4.push(err);
|
|
70872
71328
|
}
|
|
70873
71329
|
}
|
|
70874
|
-
if (sharp &&
|
|
71330
|
+
if (sharp && path12.startsWith("@img/sharp-linux-x64") && !sharp._isUsingX64V2()) {
|
|
70875
71331
|
const err = new Error("Prebuilt binaries for linux-x64 require v2 microarchitecture");
|
|
70876
71332
|
err.code = "Unsupported CPU";
|
|
70877
71333
|
errors4.push(err);
|
|
@@ -70880,7 +71336,7 @@ var require_sharp = __commonJS((exports, module) => {
|
|
|
70880
71336
|
if (sharp) {
|
|
70881
71337
|
module.exports = sharp;
|
|
70882
71338
|
} else {
|
|
70883
|
-
const [isLinux, isMacOs, isWindows] = ["linux", "darwin", "win32"].map((
|
|
71339
|
+
const [isLinux, isMacOs, isWindows] = ["linux", "darwin", "win32"].map((os6) => runtimePlatform.startsWith(os6));
|
|
70884
71340
|
const help = [`Could not load the "sharp" module using the ${runtimePlatform} runtime`];
|
|
70885
71341
|
errors4.forEach((err) => {
|
|
70886
71342
|
if (err.code !== "MODULE_NOT_FOUND") {
|
|
@@ -70893,9 +71349,9 @@ var require_sharp = __commonJS((exports, module) => {
|
|
|
70893
71349
|
const { found, expected } = isUnsupportedNodeRuntime();
|
|
70894
71350
|
help.push("- Please upgrade Node.js:", ` Found ${found}`, ` Requires ${expected}`);
|
|
70895
71351
|
} else if (prebuiltPlatforms.includes(runtimePlatform)) {
|
|
70896
|
-
const [
|
|
70897
|
-
const libc =
|
|
70898
|
-
help.push("- Ensure optional dependencies can be installed:", " npm install --include=optional sharp", "- Ensure your package manager supports multi-platform installation:", " See https://sharp.pixelplumbing.com/install#cross-platform", "- Add platform-specific dependencies:", ` npm install --os=${
|
|
71352
|
+
const [os6, cpu] = runtimePlatform.split("-");
|
|
71353
|
+
const libc = os6.endsWith("musl") ? " --libc=musl" : "";
|
|
71354
|
+
help.push("- Ensure optional dependencies can be installed:", " npm install --include=optional sharp", "- Ensure your package manager supports multi-platform installation:", " See https://sharp.pixelplumbing.com/install#cross-platform", "- Add platform-specific dependencies:", ` npm install --os=${os6.replace("musl", "")}${libc} --cpu=${cpu} sharp`);
|
|
70899
71355
|
} else {
|
|
70900
71356
|
help.push(`- Manually install libvips >= ${minimumLibvipsVersion}`, "- Add experimental WebAssembly-based dependencies:", " npm install --cpu=wasm32 sharp", " npm install @img/sharp-wasm32");
|
|
70901
71357
|
}
|
|
@@ -73733,15 +74189,15 @@ var require_color = __commonJS((exports, module) => {
|
|
|
73733
74189
|
};
|
|
73734
74190
|
}
|
|
73735
74191
|
function wrapConversion(toModel, graph) {
|
|
73736
|
-
const
|
|
74192
|
+
const path12 = [graph[toModel].parent, toModel];
|
|
73737
74193
|
let fn = conversions_default[graph[toModel].parent][toModel];
|
|
73738
74194
|
let cur = graph[toModel].parent;
|
|
73739
74195
|
while (graph[cur].parent) {
|
|
73740
|
-
|
|
74196
|
+
path12.unshift(graph[cur].parent);
|
|
73741
74197
|
fn = link(conversions_default[graph[cur].parent][cur], fn);
|
|
73742
74198
|
cur = graph[cur].parent;
|
|
73743
74199
|
}
|
|
73744
|
-
fn.conversion =
|
|
74200
|
+
fn.conversion = path12;
|
|
73745
74201
|
return fn;
|
|
73746
74202
|
}
|
|
73747
74203
|
function route(fromModel) {
|
|
@@ -74346,7 +74802,7 @@ var require_output = __commonJS((exports, module) => {
|
|
|
74346
74802
|
Copyright 2013 Lovell Fuller and others.
|
|
74347
74803
|
SPDX-License-Identifier: Apache-2.0
|
|
74348
74804
|
*/
|
|
74349
|
-
var
|
|
74805
|
+
var path12 = __require("path");
|
|
74350
74806
|
var is = require_is();
|
|
74351
74807
|
var sharp = require_sharp();
|
|
74352
74808
|
var formats = new Map([
|
|
@@ -74377,9 +74833,9 @@ var require_output = __commonJS((exports, module) => {
|
|
|
74377
74833
|
let err;
|
|
74378
74834
|
if (!is.string(fileOut)) {
|
|
74379
74835
|
err = new Error("Missing output file path");
|
|
74380
|
-
} else if (is.string(this.options.input.file) &&
|
|
74836
|
+
} else if (is.string(this.options.input.file) && path12.resolve(this.options.input.file) === path12.resolve(fileOut)) {
|
|
74381
74837
|
err = new Error("Cannot use same file for input and output");
|
|
74382
|
-
} else if (jp2Regex.test(
|
|
74838
|
+
} else if (jp2Regex.test(path12.extname(fileOut)) && !this.constructor.format.jp2k.output.file) {
|
|
74383
74839
|
err = errJp2Save();
|
|
74384
74840
|
}
|
|
74385
74841
|
if (err) {
|
|
@@ -81626,11 +82082,11 @@ var init_transformers_node = __esm(() => {
|
|
|
81626
82082
|
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}).`);
|
|
81627
82083
|
}
|
|
81628
82084
|
for (let i = 0;i < num_chunks; ++i) {
|
|
81629
|
-
const
|
|
81630
|
-
const fullPath = `${options.subfolder ?? ""}/${
|
|
82085
|
+
const path12 = `${baseName}_data${i === 0 ? "" : "_" + i}`;
|
|
82086
|
+
const fullPath = `${options.subfolder ?? ""}/${path12}`;
|
|
81631
82087
|
externalDataPromises.push(new Promise(async (resolve4, reject) => {
|
|
81632
82088
|
const data = await (0, _utils_hub_js__WEBPACK_IMPORTED_MODULE_5__.getModelFile)(pretrained_model_name_or_path, fullPath, true, options, return_path);
|
|
81633
|
-
resolve4(data instanceof Uint8Array ? { path:
|
|
82089
|
+
resolve4(data instanceof Uint8Array ? { path: path12, data } : path12);
|
|
81634
82090
|
}));
|
|
81635
82091
|
}
|
|
81636
82092
|
} else if (session_options.externalData !== undefined) {
|
|
@@ -94694,7 +95150,7 @@ ${fake_token_around_image}` + `${global_img_token}` + image_token.repeat(image_s
|
|
|
94694
95150
|
const blob = new Blob([wav], { type: "audio/wav" });
|
|
94695
95151
|
return blob;
|
|
94696
95152
|
}
|
|
94697
|
-
async save(
|
|
95153
|
+
async save(path12) {
|
|
94698
95154
|
let fn;
|
|
94699
95155
|
if (_env_js__WEBPACK_IMPORTED_MODULE_3__.apis.IS_BROWSER_ENV) {
|
|
94700
95156
|
if (_env_js__WEBPACK_IMPORTED_MODULE_3__.apis.IS_WEBWORKER_ENV) {
|
|
@@ -94702,14 +95158,14 @@ ${fake_token_around_image}` + `${global_img_token}` + image_token.repeat(image_s
|
|
|
94702
95158
|
}
|
|
94703
95159
|
fn = _core_js__WEBPACK_IMPORTED_MODULE_2__.saveBlob;
|
|
94704
95160
|
} else if (_env_js__WEBPACK_IMPORTED_MODULE_3__.apis.IS_FS_AVAILABLE) {
|
|
94705
|
-
fn = async (
|
|
95161
|
+
fn = async (path13, blob) => {
|
|
94706
95162
|
let buffer = await blob.arrayBuffer();
|
|
94707
|
-
node_fs__WEBPACK_IMPORTED_MODULE_5__["default"].writeFileSync(
|
|
95163
|
+
node_fs__WEBPACK_IMPORTED_MODULE_5__["default"].writeFileSync(path13, Buffer.from(buffer));
|
|
94708
95164
|
};
|
|
94709
95165
|
} else {
|
|
94710
95166
|
throw new Error("Unable to save because filesystem is disabled in this environment.");
|
|
94711
95167
|
}
|
|
94712
|
-
await fn(
|
|
95168
|
+
await fn(path12, this.toBlob());
|
|
94713
95169
|
}
|
|
94714
95170
|
}
|
|
94715
95171
|
},
|
|
@@ -94805,11 +95261,11 @@ ${fake_token_around_image}` + `${global_img_token}` + image_token.repeat(image_s
|
|
|
94805
95261
|
function calculateReflectOffset(i, w) {
|
|
94806
95262
|
return Math.abs((i + w) % (2 * w) - w);
|
|
94807
95263
|
}
|
|
94808
|
-
function saveBlob(
|
|
95264
|
+
function saveBlob(path12, blob) {
|
|
94809
95265
|
const dataURL = URL.createObjectURL(blob);
|
|
94810
95266
|
const downloadLink = document.createElement("a");
|
|
94811
95267
|
downloadLink.href = dataURL;
|
|
94812
|
-
downloadLink.download =
|
|
95268
|
+
downloadLink.download = path12;
|
|
94813
95269
|
downloadLink.click();
|
|
94814
95270
|
downloadLink.remove();
|
|
94815
95271
|
URL.revokeObjectURL(dataURL);
|
|
@@ -95410,8 +95866,8 @@ ${fake_token_around_image}` + `${global_img_token}` + image_token.repeat(image_s
|
|
|
95410
95866
|
}
|
|
95411
95867
|
|
|
95412
95868
|
class FileCache {
|
|
95413
|
-
constructor(
|
|
95414
|
-
this.path =
|
|
95869
|
+
constructor(path12) {
|
|
95870
|
+
this.path = path12;
|
|
95415
95871
|
}
|
|
95416
95872
|
async match(request) {
|
|
95417
95873
|
let filePath = node_path__WEBPACK_IMPORTED_MODULE_1__["default"].join(this.path, request);
|
|
@@ -96167,20 +96623,20 @@ ${fake_token_around_image}` + `${global_img_token}` + image_token.repeat(image_s
|
|
|
96167
96623
|
}
|
|
96168
96624
|
return this;
|
|
96169
96625
|
}
|
|
96170
|
-
async save(
|
|
96626
|
+
async save(path12) {
|
|
96171
96627
|
if (IS_BROWSER_OR_WEBWORKER) {
|
|
96172
96628
|
if (_env_js__WEBPACK_IMPORTED_MODULE_2__.apis.IS_WEBWORKER_ENV) {
|
|
96173
96629
|
throw new Error("Unable to save an image from a Web Worker.");
|
|
96174
96630
|
}
|
|
96175
|
-
const extension =
|
|
96631
|
+
const extension = path12.split(".").pop().toLowerCase();
|
|
96176
96632
|
const mime = CONTENT_TYPE_MAP.get(extension) ?? "image/png";
|
|
96177
96633
|
const blob = await this.toBlob(mime);
|
|
96178
|
-
(0, _core_js__WEBPACK_IMPORTED_MODULE_0__.saveBlob)(
|
|
96634
|
+
(0, _core_js__WEBPACK_IMPORTED_MODULE_0__.saveBlob)(path12, blob);
|
|
96179
96635
|
} else if (!_env_js__WEBPACK_IMPORTED_MODULE_2__.apis.IS_FS_AVAILABLE) {
|
|
96180
96636
|
throw new Error("Unable to save the image because filesystem is disabled in this environment.");
|
|
96181
96637
|
} else {
|
|
96182
96638
|
const img = this.toSharp();
|
|
96183
|
-
return await img.toFile(
|
|
96639
|
+
return await img.toFile(path12);
|
|
96184
96640
|
}
|
|
96185
96641
|
}
|
|
96186
96642
|
toSharp() {
|
|
@@ -105385,7 +105841,7 @@ Note that ${s.bold("include")} statements only accept relation fields.`, a;
|
|
|
105385
105841
|
function ns(e = Yo, t = Yo) {
|
|
105386
105842
|
return (r) => e(t(r));
|
|
105387
105843
|
}
|
|
105388
|
-
function
|
|
105844
|
+
function os6({ dataPath: e, modelName: t, args: r, runtimeDataModel: n }) {
|
|
105389
105845
|
let i = { modelName: t, args: r ?? {} }, o = dp(e);
|
|
105390
105846
|
if (!o || o.length === 0)
|
|
105391
105847
|
return i;
|
|
@@ -105690,10 +106146,10 @@ Note that ${s.bold("include")} statements only accept relation fields.`, a;
|
|
|
105690
106146
|
super(t, "P2023", r);
|
|
105691
106147
|
}
|
|
105692
106148
|
};
|
|
105693
|
-
var
|
|
106149
|
+
var fs7 = new WeakMap;
|
|
105694
106150
|
function Ep(e) {
|
|
105695
|
-
let t =
|
|
105696
|
-
return t || (t = Object.entries(e),
|
|
106151
|
+
let t = fs7.get(e);
|
|
106152
|
+
return t || (t = Object.entries(e), fs7.set(e, t)), t;
|
|
105697
106153
|
}
|
|
105698
106154
|
function hs(e, t, r) {
|
|
105699
106155
|
switch (t.type) {
|
|
@@ -109258,7 +109714,7 @@ new PrismaClient({
|
|
|
109258
109714
|
let m = await es(this, d);
|
|
109259
109715
|
if (!d.model)
|
|
109260
109716
|
return m;
|
|
109261
|
-
let g =
|
|
109717
|
+
let g = os6({ dataPath: d.dataPath, modelName: d.model, args: d.args, runtimeDataModel: this._runtimeDataModel });
|
|
109262
109718
|
return Wo({ result: m, modelName: g.modelName, args: g.args, extensions: this._extensions, runtimeDataModel: this._runtimeDataModel, globalOmit: this._globalOmit });
|
|
109263
109719
|
};
|
|
109264
109720
|
return this._tracingHelper.runInChildSpan(s.operation, () => new zl.AsyncResource("prisma-client-request").runInAsyncScope(() => a(o)));
|
|
@@ -109661,7 +110117,7 @@ var require_prisma = __commonJS((exports) => {
|
|
|
109661
110117
|
Prisma.JsonNull = JsonNull2;
|
|
109662
110118
|
Prisma.AnyNull = AnyNull2;
|
|
109663
110119
|
Prisma.NullTypes = NullTypes2;
|
|
109664
|
-
var
|
|
110120
|
+
var path12 = __require("path");
|
|
109665
110121
|
exports.Prisma.TransactionIsolationLevel = makeStrictEnum2({
|
|
109666
110122
|
ReadUncommitted: "ReadUncommitted",
|
|
109667
110123
|
ReadCommitted: "ReadCommitted",
|
|
@@ -115621,7 +116077,7 @@ var init_vector_store_factory = __esm(() => {
|
|
|
115621
116077
|
});
|
|
115622
116078
|
|
|
115623
116079
|
// ../../packages/core/dist/services/search/search-cache-pg.js
|
|
115624
|
-
import
|
|
116080
|
+
import crypto5 from "crypto";
|
|
115625
116081
|
|
|
115626
116082
|
class SearchCachePg {
|
|
115627
116083
|
pool = null;
|
|
@@ -115678,7 +116134,7 @@ class SearchCachePg {
|
|
|
115678
116134
|
projectId,
|
|
115679
116135
|
options: this.normalizeOptions(options)
|
|
115680
116136
|
});
|
|
115681
|
-
return
|
|
116137
|
+
return crypto5.createHash("sha256").update(payload).digest("hex");
|
|
115682
116138
|
}
|
|
115683
116139
|
normalizeOptions(options) {
|
|
115684
116140
|
const searchAffectingParams = [
|
|
@@ -122407,10 +122863,10 @@ var init_chunker_code = __esm(() => {
|
|
|
122407
122863
|
});
|
|
122408
122864
|
|
|
122409
122865
|
// ../../packages/core/dist/services/search/smart-chunker.js
|
|
122410
|
-
import
|
|
122866
|
+
import path12 from "path";
|
|
122411
122867
|
function smartChunk(content, filePath, config3 = {}) {
|
|
122412
122868
|
const cfg = { ...DEFAULT_CONFIG, ...config3 };
|
|
122413
|
-
const ext2 =
|
|
122869
|
+
const ext2 = path12.extname(filePath).toLowerCase();
|
|
122414
122870
|
const relativePath = filePath;
|
|
122415
122871
|
const fileImports = isCodeFile(ext2) ? extractFileImports(content, ext2) : undefined;
|
|
122416
122872
|
let chunks;
|
|
@@ -122717,8 +123173,8 @@ var init_managed_run_repository_pg = __esm(() => {
|
|
|
122717
123173
|
});
|
|
122718
123174
|
|
|
122719
123175
|
// ../../packages/core/dist/services/search/project-indexer.js
|
|
122720
|
-
import
|
|
122721
|
-
import
|
|
123176
|
+
import fs7 from "fs/promises";
|
|
123177
|
+
import path13 from "path";
|
|
122722
123178
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
122723
123179
|
async function runWithIndexLock(lockMap, projectId, work) {
|
|
122724
123180
|
const prevLock = lockMap.get(projectId);
|
|
@@ -122761,7 +123217,7 @@ async function indexProjectInternal(deps, projectPath, projectId, options = {})
|
|
|
122761
123217
|
dot: false
|
|
122762
123218
|
});
|
|
122763
123219
|
const filteredFiles = files.filter((file2) => {
|
|
122764
|
-
const relativePath =
|
|
123220
|
+
const relativePath = path13.relative(projectPath, file2);
|
|
122765
123221
|
const shouldIgnore = ig.ignores(relativePath);
|
|
122766
123222
|
if (shouldIgnore) {
|
|
122767
123223
|
logger.debug("Ignoring file per .gitignore during indexing", {
|
|
@@ -122801,7 +123257,7 @@ async function indexProjectInternal(deps, projectPath, projectId, options = {})
|
|
|
122801
123257
|
});
|
|
122802
123258
|
}
|
|
122803
123259
|
}
|
|
122804
|
-
const indexedFilesList = filteredFiles.map((f) =>
|
|
123260
|
+
const indexedFilesList = filteredFiles.map((f) => path13.relative(projectPath, f));
|
|
122805
123261
|
await deps.indexManager.updateIndexMetadata(projectId, projectPath, indexedFilesList);
|
|
122806
123262
|
logger.info("Project indexing completed", {
|
|
122807
123263
|
projectId,
|
|
@@ -122926,7 +123382,7 @@ async function ensureFreshIndex(deps, projectId, projectPath, options = {}) {
|
|
|
122926
123382
|
let errors4 = 0;
|
|
122927
123383
|
for (const relativeFilePath of filesToReindex) {
|
|
122928
123384
|
try {
|
|
122929
|
-
const fullPath =
|
|
123385
|
+
const fullPath = path13.join(projectPath, relativeFilePath);
|
|
122930
123386
|
const result = await deps.indexFile(fullPath, projectId, projectPath, centralityMap);
|
|
122931
123387
|
filesIndexed++;
|
|
122932
123388
|
chunksIndexed += result.chunks;
|
|
@@ -122977,8 +123433,8 @@ async function checkSearchAdmission(deps, projectId, projectPath) {
|
|
|
122977
123433
|
}
|
|
122978
123434
|
async function indexFile(deps, filePath, projectId, projectRoot, centralityMap) {
|
|
122979
123435
|
projectId = await getProjectIdentityAliasResolver().resolve(projectId);
|
|
122980
|
-
const content = await
|
|
122981
|
-
const relativePath =
|
|
123436
|
+
const content = await fs7.readFile(filePath, "utf-8");
|
|
123437
|
+
const relativePath = path13.relative(projectRoot, filePath);
|
|
122982
123438
|
const maxFileSize = config2.get("security").maxFileSize || 1024 * 1024;
|
|
122983
123439
|
if (content.length > maxFileSize) {
|
|
122984
123440
|
logger.warn("File too large, skipping", {
|
|
@@ -122998,7 +123454,7 @@ async function indexFile(deps, filePath, projectId, projectRoot, centralityMap)
|
|
|
122998
123454
|
chunkIndex: i,
|
|
122999
123455
|
totalChunks: chunks.length,
|
|
123000
123456
|
type: chunk.type,
|
|
123001
|
-
language:
|
|
123457
|
+
language: path13.extname(filePath).slice(1),
|
|
123002
123458
|
lineStart: chunk.lineStart,
|
|
123003
123459
|
lineEnd: chunk.lineEnd,
|
|
123004
123460
|
label: chunk.label,
|
|
@@ -123837,8 +124293,8 @@ var init_index_job_tracker = __esm(() => {
|
|
|
123837
124293
|
});
|
|
123838
124294
|
|
|
123839
124295
|
// ../../packages/core/dist/services/etl/stages/discover.js
|
|
123840
|
-
import
|
|
123841
|
-
import
|
|
124296
|
+
import fs8 from "fs/promises";
|
|
124297
|
+
import path14 from "path";
|
|
123842
124298
|
import { createHash as createHash5 } from "crypto";
|
|
123843
124299
|
|
|
123844
124300
|
class DiscoverStage {
|
|
@@ -123864,7 +124320,7 @@ class DiscoverStage {
|
|
|
123864
124320
|
dot: false,
|
|
123865
124321
|
absolute: false
|
|
123866
124322
|
});
|
|
123867
|
-
relPaths = found.map((p) =>
|
|
124323
|
+
relPaths = found.map((p) => path14.isAbsolute(p) ? path14.relative(ctx.projectPath, p) : p).filter((p) => !ig.ignores(p) && applyPolicy(p, policy) !== "Drop");
|
|
123868
124324
|
}
|
|
123869
124325
|
if (ctx.resumeCursor?.path) {
|
|
123870
124326
|
const cursorPath = ctx.resumeCursor.path;
|
|
@@ -123923,10 +124379,10 @@ class DiscoverStage {
|
|
|
123923
124379
|
return discovered;
|
|
123924
124380
|
}
|
|
123925
124381
|
async processFile(ctx, relativePath, forceReindex) {
|
|
123926
|
-
const absolutePath =
|
|
124382
|
+
const absolutePath = path14.join(ctx.projectPath, relativePath);
|
|
123927
124383
|
try {
|
|
123928
|
-
const stat = await
|
|
123929
|
-
const content = await
|
|
124384
|
+
const stat = await fs8.stat(absolutePath);
|
|
124385
|
+
const content = await fs8.readFile(absolutePath, "utf-8");
|
|
123930
124386
|
const contentHash = createHash5("sha256").update(content).digest("hex");
|
|
123931
124387
|
let needsReparse = forceReindex;
|
|
123932
124388
|
if (!forceReindex) {
|
|
@@ -123969,8 +124425,8 @@ class DiscoverStage {
|
|
|
123969
124425
|
ig.add(pattern);
|
|
123970
124426
|
}
|
|
123971
124427
|
try {
|
|
123972
|
-
const gitignorePath =
|
|
123973
|
-
const gitignoreContent = await
|
|
124428
|
+
const gitignorePath = path14.join(projectPath, ".gitignore");
|
|
124429
|
+
const gitignoreContent = await fs8.readFile(gitignorePath, "utf8");
|
|
123974
124430
|
const rules = gitignoreContent.split(`
|
|
123975
124431
|
`).map((line) => line.trim()).filter((line) => line && !line.startsWith("#"));
|
|
123976
124432
|
ig.add(rules);
|
|
@@ -125325,8 +125781,8 @@ function rustUseLeaves(node, source, prefix = []) {
|
|
|
125325
125781
|
}
|
|
125326
125782
|
if (node.type === "use_wildcard")
|
|
125327
125783
|
return [{ path: [...prefix, "*"], glob: true }];
|
|
125328
|
-
const
|
|
125329
|
-
return
|
|
125784
|
+
const path15 = rustPathSegments(node, source);
|
|
125785
|
+
return path15.length ? [{ path: [...prefix, ...path15] }] : [];
|
|
125330
125786
|
}
|
|
125331
125787
|
function functionalCaptures(captures, source, family) {
|
|
125332
125788
|
if (family !== "clojure")
|
|
@@ -126298,8 +126754,8 @@ var init_structural_runtime = __esm(() => {
|
|
|
126298
126754
|
});
|
|
126299
126755
|
|
|
126300
126756
|
// ../../packages/core/dist/services/etl/stages/parse.js
|
|
126301
|
-
import
|
|
126302
|
-
import
|
|
126757
|
+
import path15 from "path";
|
|
126758
|
+
import fs9 from "fs/promises";
|
|
126303
126759
|
function resolveChunkerMaxChars() {
|
|
126304
126760
|
const global2 = Number(process.env.EMBEDDING_MAX_CHARS);
|
|
126305
126761
|
if (Number.isFinite(global2) && global2 > 0)
|
|
@@ -126327,8 +126783,8 @@ class ParseStage {
|
|
|
126327
126783
|
const results = new Map;
|
|
126328
126784
|
let processed = 0;
|
|
126329
126785
|
const phases = [
|
|
126330
|
-
files.filter((file2) =>
|
|
126331
|
-
files.filter((file2) =>
|
|
126786
|
+
files.filter((file2) => path15.extname(file2.relativePath).toLowerCase() !== ".h"),
|
|
126787
|
+
files.filter((file2) => path15.extname(file2.relativePath).toLowerCase() === ".h")
|
|
126332
126788
|
];
|
|
126333
126789
|
const batches = phases.flatMap((phase) => Array.from({ length: Math.ceil(phase.length / BATCH_SIZE) }, (_, index) => phase.slice(index * BATCH_SIZE, (index + 1) * BATCH_SIZE)));
|
|
126334
126790
|
for (const batch of batches) {
|
|
@@ -126366,19 +126822,19 @@ class ParseStage {
|
|
|
126366
126822
|
return files.map((file2) => results.get(file2.relativePath));
|
|
126367
126823
|
}
|
|
126368
126824
|
recordHeaderImporterEvidence(ctx, files, parsedFiles) {
|
|
126369
|
-
const knownHeaders = new Set(files.filter((file2) =>
|
|
126825
|
+
const knownHeaders = new Set(files.filter((file2) => path15.extname(file2.relativePath).toLowerCase() === ".h").map((file2) => path15.posix.normalize(file2.relativePath)));
|
|
126370
126826
|
const mutable = {
|
|
126371
126827
|
...ctx.structuralHeaderEvidenceByFile
|
|
126372
126828
|
};
|
|
126373
126829
|
for (const parsed of parsedFiles) {
|
|
126374
|
-
const extension =
|
|
126830
|
+
const extension = path15.extname(parsed.file.relativePath).toLowerCase();
|
|
126375
126831
|
const key = extension === ".c" ? "cImporters" : [".cpp", ".hpp"].includes(extension) ? "cppImporters" : undefined;
|
|
126376
126832
|
if (!key)
|
|
126377
126833
|
continue;
|
|
126378
126834
|
for (const imported of parsed.rawImports) {
|
|
126379
126835
|
if (!["c_include", "cpp_include"].includes(imported.form) || imported.specifier.startsWith("<"))
|
|
126380
126836
|
continue;
|
|
126381
|
-
const header =
|
|
126837
|
+
const header = path15.posix.normalize(path15.posix.join(path15.posix.dirname(parsed.file.relativePath), imported.specifier));
|
|
126382
126838
|
if (!knownHeaders.has(header))
|
|
126383
126839
|
continue;
|
|
126384
126840
|
const existing = mutable[header] ?? {};
|
|
@@ -126389,9 +126845,9 @@ class ParseStage {
|
|
|
126389
126845
|
}
|
|
126390
126846
|
async parseFile(ctx, file2) {
|
|
126391
126847
|
if (!file2.needsReparse) {
|
|
126392
|
-
const extension =
|
|
126848
|
+
const extension = path15.extname(file2.relativePath).toLowerCase();
|
|
126393
126849
|
if ([".c", ".cpp", ".hpp"].includes(extension)) {
|
|
126394
|
-
const content = file2.snapshotContent ?? await
|
|
126850
|
+
const content = file2.snapshotContent ?? await fs9.readFile(file2.absolutePath, "utf8");
|
|
126395
126851
|
const outcome = await this.runtime.parse({ extension, source: Buffer.from(content) });
|
|
126396
126852
|
if (outcome.status === "failed")
|
|
126397
126853
|
throw new StructuralEtlParseError(file2.relativePath, outcome.failureKind, `Structural evidence parse failed (${outcome.failureKind})`, outcome.diagnosticCount, outcome.diagnostics.slice(0, 10));
|
|
@@ -126403,8 +126859,8 @@ class ParseStage {
|
|
|
126403
126859
|
return { file: file2, chunks: [], symbols: [], rawImports: [], rawEdges: [] };
|
|
126404
126860
|
}
|
|
126405
126861
|
try {
|
|
126406
|
-
const content = file2.snapshotContent ?? await
|
|
126407
|
-
const ext2 =
|
|
126862
|
+
const content = file2.snapshotContent ?? await fs9.readFile(file2.absolutePath, "utf-8");
|
|
126863
|
+
const ext2 = path15.extname(file2.relativePath).toLowerCase();
|
|
126408
126864
|
const chunkerMaxChars = resolveChunkerMaxChars();
|
|
126409
126865
|
const chunks = smartChunk(content, file2.relativePath, chunkerMaxChars ? { maxChunkChars: chunkerMaxChars } : {});
|
|
126410
126866
|
let symbols;
|
|
@@ -126958,7 +127414,7 @@ var init_resolver = __esm(() => {
|
|
|
126958
127414
|
});
|
|
126959
127415
|
|
|
126960
127416
|
// ../../packages/core/dist/services/structural/resolvers/typescript.js
|
|
126961
|
-
import
|
|
127417
|
+
import path16 from "path";
|
|
126962
127418
|
function candidates(identities) {
|
|
126963
127419
|
return Object.freeze(identities.map((identity) => Object.freeze({
|
|
126964
127420
|
fqn: identity.fqn,
|
|
@@ -127053,7 +127509,7 @@ function probe(base, known, dialect = "typescript") {
|
|
|
127053
127509
|
const bases = /\.[cm]?jsx?$/u.test(base) ? [base.replace(/\.[cm]?jsx?$/u, ".ts"), base.replace(/\.[cm]?jsx?$/u, ".tsx"), base] : [base];
|
|
127054
127510
|
for (const candidateBase of bases)
|
|
127055
127511
|
for (const suffix of DIALECT_PROBES[dialect] ?? [""]) {
|
|
127056
|
-
const value =
|
|
127512
|
+
const value = path16.posix.normalize(`${candidateBase}${suffix}`);
|
|
127057
127513
|
if (!value.startsWith("../") && value !== ".." && known.has(value))
|
|
127058
127514
|
return value;
|
|
127059
127515
|
}
|
|
@@ -127062,7 +127518,7 @@ function probe(base, known, dialect = "typescript") {
|
|
|
127062
127518
|
function resolveStructuralSpecifier(specifier, fromFile, build, dialect = "typescript") {
|
|
127063
127519
|
const known = new Set(build.knownFiles.map(normalizeStructuralFile));
|
|
127064
127520
|
if (specifier.startsWith("./") || specifier.startsWith("../")) {
|
|
127065
|
-
return probe(
|
|
127521
|
+
return probe(path16.posix.join(path16.posix.dirname(fromFile), specifier), known, dialect);
|
|
127066
127522
|
}
|
|
127067
127523
|
const aliases = build.pathAliasesByFile?.[normalizeStructuralFile(fromFile)] ?? build.pathAliases ?? [];
|
|
127068
127524
|
for (const alias of aliases) {
|
|
@@ -127326,7 +127782,7 @@ var init_scripting2 = __esm(() => {
|
|
|
127326
127782
|
});
|
|
127327
127783
|
|
|
127328
127784
|
// ../../packages/core/dist/services/structural/resolvers/systems.js
|
|
127329
|
-
import
|
|
127785
|
+
import path17 from "path";
|
|
127330
127786
|
var DIALECTS, SYSTEMS_LANGUAGE_RESOLVER;
|
|
127331
127787
|
var init_systems2 = __esm(() => {
|
|
127332
127788
|
init_typescript2();
|
|
@@ -127345,7 +127801,7 @@ var init_systems2 = __esm(() => {
|
|
|
127345
127801
|
const bindings = item.bindings.map((binding) => binding.imported === "*" && binding.local === "*" && unresolvedTarget && !unresolvedTarget.qualifier ? { ...binding, imported: unresolvedTarget.name, local: unresolvedTarget.name } : binding);
|
|
127346
127802
|
if (item.specifier === "crate" || item.specifier.startsWith("crate/")) {
|
|
127347
127803
|
const crateRoot = file2.file.startsWith("src/") ? "src" : "";
|
|
127348
|
-
return { ...item, bindings, specifier: `./${
|
|
127804
|
+
return { ...item, bindings, specifier: `./${path17.posix.relative(path17.posix.dirname(file2.file), path17.posix.join(crateRoot, item.specifier.replace(/^crate\/?/u, "")))}` };
|
|
127349
127805
|
}
|
|
127350
127806
|
if (item.specifier === "self" || item.specifier.startsWith("self/"))
|
|
127351
127807
|
return { ...item, bindings, specifier: `./${item.specifier.replace(/^self\/?/u, "")}` };
|
|
@@ -127443,8 +127899,8 @@ var init_data_document2 = __esm(() => {
|
|
|
127443
127899
|
});
|
|
127444
127900
|
|
|
127445
127901
|
// ../../packages/core/dist/services/etl/stages/resolve.js
|
|
127446
|
-
import
|
|
127447
|
-
import
|
|
127902
|
+
import path18 from "path";
|
|
127903
|
+
import fs10 from "fs";
|
|
127448
127904
|
|
|
127449
127905
|
class ResolveStage {
|
|
127450
127906
|
symbolRepository;
|
|
@@ -127468,7 +127924,7 @@ class ResolveStage {
|
|
|
127468
127924
|
const structuralDocuments = files.flatMap((file2) => {
|
|
127469
127925
|
if (!file2.structure)
|
|
127470
127926
|
return [];
|
|
127471
|
-
const language = resolveStructuralLanguage(
|
|
127927
|
+
const language = resolveStructuralLanguage(path18.extname(file2.file.relativePath));
|
|
127472
127928
|
if (language.status !== "supported")
|
|
127473
127929
|
throw new Error(`structural_manifest_missing:${file2.file.relativePath}`);
|
|
127474
127930
|
return [{
|
|
@@ -127480,13 +127936,13 @@ class ResolveStage {
|
|
|
127480
127936
|
}];
|
|
127481
127937
|
});
|
|
127482
127938
|
const currentStructuralFiles = new Set(structuralDocuments.map((document2) => document2.file));
|
|
127483
|
-
const skippedStructuralFiles = new Set(files.filter((item) => !item.file.needsReparse && STRUCTURAL_SEED_EXTENSIONS.has(
|
|
127939
|
+
const skippedStructuralFiles = new Set(files.filter((item) => !item.file.needsReparse && STRUCTURAL_SEED_EXTENSIONS.has(path18.extname(item.file.relativePath).toLowerCase())).map((item) => item.file.relativePath));
|
|
127484
127940
|
const pathAliasesByFile = Object.fromEntries([...knownRelPaths].map((file2) => [
|
|
127485
127941
|
file2,
|
|
127486
127942
|
this.structuralAliasesFor(file2, rootAliases, monorepoPackages)
|
|
127487
127943
|
]));
|
|
127488
127944
|
const buildMetadata = { knownFiles: [...knownRelPaths], pathAliasesByFile };
|
|
127489
|
-
const seedRows = repositoryDefinitions.filter((definition) => STRUCTURAL_SEED_EXTENSIONS.has(
|
|
127945
|
+
const seedRows = repositoryDefinitions.filter((definition) => STRUCTURAL_SEED_EXTENSIONS.has(path18.extname(definition.file_path).toLowerCase())).filter((definition) => knownRelPaths.has(definition.file_path) && skippedStructuralFiles.has(definition.file_path)).filter((definition) => !currentStructuralFiles.has(definition.file_path));
|
|
127490
127946
|
const seedIds = new Set;
|
|
127491
127947
|
for (const definition of seedRows) {
|
|
127492
127948
|
if (seedIds.has(definition.id))
|
|
@@ -127579,7 +128035,7 @@ class ResolveStage {
|
|
|
127579
128035
|
if (parsed.file !== definition.file_path) {
|
|
127580
128036
|
throw new Error(`structural_repository_seed_file_mismatch:${definition.id}`);
|
|
127581
128037
|
}
|
|
127582
|
-
const language = resolveStructuralLanguage(
|
|
128038
|
+
const language = resolveStructuralLanguage(path18.extname(definition.file_path));
|
|
127583
128039
|
if (language.status !== "supported")
|
|
127584
128040
|
throw new Error(`structural_repository_seed_language:${definition.id}`);
|
|
127585
128041
|
let identity;
|
|
@@ -127631,7 +128087,7 @@ class ResolveStage {
|
|
|
127631
128087
|
});
|
|
127632
128088
|
}
|
|
127633
128089
|
resolveFile(parsed, projectPath, knownRelPaths, rootAliases, monorepoPackages, symbolIndex, knownFqns) {
|
|
127634
|
-
const fromDir =
|
|
128090
|
+
const fromDir = path18.dirname(path18.join(projectPath, parsed.file.relativePath));
|
|
127635
128091
|
const packageAliases = this.getPackageAliases(parsed.file.relativePath, monorepoPackages);
|
|
127636
128092
|
const allAliases = [...packageAliases, ...rootAliases];
|
|
127637
128093
|
const resolvedImports = parsed.rawImports.map((raw2) => {
|
|
@@ -127702,7 +128158,7 @@ class ResolveStage {
|
|
|
127702
128158
|
index.set(def.name, `${def.file_path}#${def.name}`);
|
|
127703
128159
|
}
|
|
127704
128160
|
} catch (err) {
|
|
127705
|
-
const skippedStructural = files.some((file2) => !file2.file.needsReparse && STRUCTURAL_SEED_EXTENSIONS.has(
|
|
128161
|
+
const skippedStructural = files.some((file2) => !file2.file.needsReparse && STRUCTURAL_SEED_EXTENSIONS.has(path18.extname(file2.file.relativePath).toLowerCase()));
|
|
127706
128162
|
if (skippedStructural)
|
|
127707
128163
|
throw new Error("structural_repository_seed_failed", { cause: err });
|
|
127708
128164
|
logger.warn("buildSymbolIndex: repo seed failed, in-batch only", {
|
|
@@ -127726,7 +128182,7 @@ class ResolveStage {
|
|
|
127726
128182
|
}
|
|
127727
128183
|
resolveSpecifier(specifier, fromDir, projectPath, knownRelPaths, aliases) {
|
|
127728
128184
|
if (specifier.startsWith("./") || specifier.startsWith("../")) {
|
|
127729
|
-
const resolved = this.probeExtensions(
|
|
128185
|
+
const resolved = this.probeExtensions(path18.resolve(fromDir, specifier), projectPath, knownRelPaths);
|
|
127730
128186
|
return { resolvedPath: resolved, external: false };
|
|
127731
128187
|
}
|
|
127732
128188
|
for (const alias of aliases) {
|
|
@@ -127734,8 +128190,8 @@ class ResolveStage {
|
|
|
127734
128190
|
const suffix = specifier.slice(alias.prefix.length);
|
|
127735
128191
|
for (const target of alias.targets) {
|
|
127736
128192
|
const cleanTarget = target.replace(/\/\*$/, "");
|
|
127737
|
-
const basePath = alias.packagePath ?
|
|
127738
|
-
const absPath =
|
|
128193
|
+
const basePath = alias.packagePath ? path18.join(projectPath, alias.packagePath) : projectPath;
|
|
128194
|
+
const absPath = path18.join(basePath, cleanTarget + suffix);
|
|
127739
128195
|
const resolved = this.probeExtensions(absPath, projectPath, knownRelPaths);
|
|
127740
128196
|
if (resolved)
|
|
127741
128197
|
return { resolvedPath: resolved, external: false };
|
|
@@ -127751,7 +128207,7 @@ class ResolveStage {
|
|
|
127751
128207
|
...TS_EXTENSIONS.map((ext2) => absPath.replace(/\.[^.]+$/, ext2))
|
|
127752
128208
|
];
|
|
127753
128209
|
for (const candidate2 of candidates2) {
|
|
127754
|
-
const rel =
|
|
128210
|
+
const rel = path18.relative(projectPath, candidate2).replace(/\\/g, "/");
|
|
127755
128211
|
if (knownRelPaths.has(rel))
|
|
127756
128212
|
return rel;
|
|
127757
128213
|
}
|
|
@@ -127759,9 +128215,9 @@ class ResolveStage {
|
|
|
127759
128215
|
}
|
|
127760
128216
|
loadTsConfigPaths(projectPath, packageBase) {
|
|
127761
128217
|
const aliases = [];
|
|
127762
|
-
const tsconfigPath =
|
|
128218
|
+
const tsconfigPath = path18.join(projectPath, "tsconfig.json");
|
|
127763
128219
|
try {
|
|
127764
|
-
const raw2 =
|
|
128220
|
+
const raw2 = fs10.readFileSync(tsconfigPath, "utf-8");
|
|
127765
128221
|
const stripped = raw2.replace(/\/\/[^\n]*/g, "").replace(/\/\*[\s\S]*?\*\//g, "");
|
|
127766
128222
|
const tsconfig = JSON.parse(stripped);
|
|
127767
128223
|
const paths = tsconfig?.compilerOptions?.paths ?? {};
|
|
@@ -127790,7 +128246,7 @@ class ResolveStage {
|
|
|
127790
128246
|
}
|
|
127791
128247
|
}
|
|
127792
128248
|
for (const packageRelPath of packagePaths) {
|
|
127793
|
-
const absPackagePath =
|
|
128249
|
+
const absPackagePath = path18.join(projectPath, packageRelPath);
|
|
127794
128250
|
const aliases = this.loadTsConfigPaths(absPackagePath, packageRelPath);
|
|
127795
128251
|
if (aliases.length > 0) {
|
|
127796
128252
|
packages.push({
|
|
@@ -127820,7 +128276,7 @@ class ResolveStage {
|
|
|
127820
128276
|
structuralAliasesFor(filePath, rootAliases, packages) {
|
|
127821
128277
|
return [...this.getPackageAliases(filePath, packages), ...rootAliases].map((alias) => ({
|
|
127822
128278
|
pattern: alias.prefix + (alias.targets.some((target) => target.includes("*")) ? "/*" : ""),
|
|
127823
|
-
targets: alias.targets.map((target) => alias.packagePath ?
|
|
128279
|
+
targets: alias.targets.map((target) => alias.packagePath ? path18.posix.join(alias.packagePath, target) : target)
|
|
127824
128280
|
}));
|
|
127825
128281
|
}
|
|
127826
128282
|
}
|
|
@@ -127884,7 +128340,7 @@ var init_with_deadlock_retry = __esm(() => {
|
|
|
127884
128340
|
});
|
|
127885
128341
|
|
|
127886
128342
|
// ../../packages/core/dist/services/etl/stages/load.js
|
|
127887
|
-
import
|
|
128343
|
+
import path19 from "path";
|
|
127888
128344
|
function formatDuration(ms) {
|
|
127889
128345
|
const totalSec = Math.max(0, Math.round(ms / 1000));
|
|
127890
128346
|
if (totalSec < 60)
|
|
@@ -128154,7 +128610,7 @@ class LoadStage {
|
|
|
128154
128610
|
const filePath = file2.file.relativePath;
|
|
128155
128611
|
const batch = buildSymbolPersistenceBatch(ctx.projectId, file2);
|
|
128156
128612
|
if (ctx.graphGenerationLease) {
|
|
128157
|
-
const manifest = getLanguageManifestEntry(
|
|
128613
|
+
const manifest = getLanguageManifestEntry(path19.extname(filePath));
|
|
128158
128614
|
const diagnostics2 = (file2.structuralDiagnostics ?? []).slice(0, 10).map((diagnostic2) => ({
|
|
128159
128615
|
code: diagnostic2.code,
|
|
128160
128616
|
severity: diagnostic2.severity,
|
|
@@ -128610,9 +129066,9 @@ var init_graph_generation_coordinator = __esm(() => {
|
|
|
128610
129066
|
// ../../packages/core/dist/services/etl/pipeline.js
|
|
128611
129067
|
import { createHash as createHash7 } from "crypto";
|
|
128612
129068
|
import { setTimeout as delay2 } from "timers/promises";
|
|
128613
|
-
import
|
|
129069
|
+
import path20 from "path";
|
|
128614
129070
|
function buildHeaderLanguageEvidence(files) {
|
|
128615
|
-
const headers = new Set(files.filter((file2) =>
|
|
129071
|
+
const headers = new Set(files.filter((file2) => path20.posix.extname(file2.relativePath).toLowerCase() === ".h").map((file2) => path20.posix.normalize(file2.relativePath)));
|
|
128616
129072
|
const mutable = new Map;
|
|
128617
129073
|
const entry2 = (header) => {
|
|
128618
129074
|
let value = mutable.get(header);
|
|
@@ -128623,7 +129079,7 @@ function buildHeaderLanguageEvidence(files) {
|
|
|
128623
129079
|
return value;
|
|
128624
129080
|
};
|
|
128625
129081
|
for (const file2 of files) {
|
|
128626
|
-
if (
|
|
129082
|
+
if (path20.posix.basename(file2.relativePath) !== "compile_commands.json" || file2.snapshotContent === undefined)
|
|
128627
129083
|
continue;
|
|
128628
129084
|
let commands;
|
|
128629
129085
|
try {
|
|
@@ -128639,11 +129095,11 @@ function buildHeaderLanguageEvidence(files) {
|
|
|
128639
129095
|
const record3 = command;
|
|
128640
129096
|
if (typeof record3.file !== "string")
|
|
128641
129097
|
continue;
|
|
128642
|
-
const projectRoot =
|
|
128643
|
-
const commandDirectory = typeof record3.directory === "string" ?
|
|
128644
|
-
const absoluteInput =
|
|
128645
|
-
const relative2 =
|
|
128646
|
-
const header =
|
|
129098
|
+
const projectRoot = path20.resolve(file2.absolutePath, ...file2.relativePath.split("/").map(() => ".."));
|
|
129099
|
+
const commandDirectory = typeof record3.directory === "string" ? path20.resolve(projectRoot, record3.directory) : projectRoot;
|
|
129100
|
+
const absoluteInput = path20.resolve(commandDirectory, record3.file);
|
|
129101
|
+
const relative2 = path20.relative(projectRoot, absoluteInput);
|
|
129102
|
+
const header = path20.posix.normalize(relative2.replaceAll(path20.sep, "/"));
|
|
128647
129103
|
if (!headers.has(header))
|
|
128648
129104
|
continue;
|
|
128649
129105
|
const invocation = typeof record3.command === "string" ? record3.command : Array.isArray(record3.arguments) ? record3.arguments.join(" ") : "";
|
|
@@ -129167,9 +129623,9 @@ var init_acquire_indexing_lease = __esm(() => {
|
|
|
129167
129623
|
|
|
129168
129624
|
// ../../packages/core/dist/services/project-identity/project-root-identity.js
|
|
129169
129625
|
import { realpath as realpath2 } from "fs/promises";
|
|
129170
|
-
import
|
|
129626
|
+
import path21 from "path";
|
|
129171
129627
|
async function canonicalizeProjectRoot(projectPath, canonicalize = realpath2) {
|
|
129172
|
-
return canonicalize(
|
|
129628
|
+
return canonicalize(path21.resolve(projectPath));
|
|
129173
129629
|
}
|
|
129174
129630
|
async function assertProjectRootReuse(options) {
|
|
129175
129631
|
if (!options.storedProjectPath || options.forceReindex)
|
|
@@ -129177,9 +129633,9 @@ async function assertProjectRootReuse(options) {
|
|
|
129177
129633
|
const canonicalize = options.canonicalize ?? realpath2;
|
|
129178
129634
|
let storedCanonical;
|
|
129179
129635
|
try {
|
|
129180
|
-
storedCanonical = await canonicalize(
|
|
129636
|
+
storedCanonical = await canonicalize(path21.resolve(options.storedProjectPath));
|
|
129181
129637
|
} catch {
|
|
129182
|
-
storedCanonical =
|
|
129638
|
+
storedCanonical = path21.resolve(options.storedProjectPath);
|
|
129183
129639
|
}
|
|
129184
129640
|
if (storedCanonical !== options.canonicalProjectPath) {
|
|
129185
129641
|
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");
|
|
@@ -129922,16 +130378,16 @@ function detectRoutes(httpEdges, defs, opts = {}) {
|
|
|
129922
130378
|
const seen = new Set;
|
|
129923
130379
|
const out = [];
|
|
129924
130380
|
for (const e of httpEdges) {
|
|
129925
|
-
const
|
|
129926
|
-
if (!
|
|
130381
|
+
const path22 = e.route;
|
|
130382
|
+
if (!path22)
|
|
129927
130383
|
continue;
|
|
129928
130384
|
const method = (e.method ?? "ANY").toUpperCase();
|
|
129929
|
-
const key = method + " " +
|
|
130385
|
+
const key = method + " " + path22;
|
|
129930
130386
|
if (seen.has(key))
|
|
129931
130387
|
continue;
|
|
129932
130388
|
seen.add(key);
|
|
129933
130389
|
out.push({
|
|
129934
|
-
path:
|
|
130390
|
+
path: path22,
|
|
129935
130391
|
method: e.method,
|
|
129936
130392
|
file: e.fromFile,
|
|
129937
130393
|
handler: e.targetFqn ?? e.symbolName
|
|
@@ -129942,12 +130398,12 @@ function detectRoutes(httpEdges, defs, opts = {}) {
|
|
|
129942
130398
|
continue;
|
|
129943
130399
|
const parsed = parseRouteName(d.name);
|
|
129944
130400
|
const method = parsed?.method ?? "ANY";
|
|
129945
|
-
const
|
|
129946
|
-
const key = method + " " +
|
|
130401
|
+
const path22 = parsed?.path ?? d.name;
|
|
130402
|
+
const key = method + " " + path22;
|
|
129947
130403
|
if (seen.has(key))
|
|
129948
130404
|
continue;
|
|
129949
130405
|
seen.add(key);
|
|
129950
|
-
out.push({ path:
|
|
130406
|
+
out.push({ path: path22, method: parsed?.method, file: d.filePath, handler: d.name });
|
|
129951
130407
|
}
|
|
129952
130408
|
for (const d of defs) {
|
|
129953
130409
|
const parsed = parseRouteName(d.name);
|
|
@@ -130168,8 +130624,8 @@ __export(exports_symbol_graph_service, {
|
|
|
130168
130624
|
symbolGraphService: () => symbolGraphService,
|
|
130169
130625
|
SymbolGraphService: () => SymbolGraphService
|
|
130170
130626
|
});
|
|
130171
|
-
import
|
|
130172
|
-
import
|
|
130627
|
+
import path22 from "path";
|
|
130628
|
+
import fs11 from "fs/promises";
|
|
130173
130629
|
|
|
130174
130630
|
class SymbolGraphService {
|
|
130175
130631
|
identityLookup;
|
|
@@ -130497,7 +130953,7 @@ class SymbolGraphService {
|
|
|
130497
130953
|
async readSnippet(relativePath, lineStart, lineEnd, projectId) {
|
|
130498
130954
|
try {
|
|
130499
130955
|
const absolutePath = await this.resolveToAbsolute(relativePath, projectId);
|
|
130500
|
-
const content = await
|
|
130956
|
+
const content = await fs11.readFile(absolutePath, "utf-8");
|
|
130501
130957
|
const lines = content.split(`
|
|
130502
130958
|
`);
|
|
130503
130959
|
return lines.slice(Math.max(0, lineStart - 1), Math.min(lines.length, lineEnd)).join(`
|
|
@@ -130509,7 +130965,7 @@ class SymbolGraphService {
|
|
|
130509
130965
|
async readContext(relativePath, lineNumber, contextLines, projectId) {
|
|
130510
130966
|
try {
|
|
130511
130967
|
const absolutePath = await this.resolveToAbsolute(relativePath, projectId);
|
|
130512
|
-
const content = await
|
|
130968
|
+
const content = await fs11.readFile(absolutePath, "utf-8");
|
|
130513
130969
|
const lines = content.split(`
|
|
130514
130970
|
`);
|
|
130515
130971
|
const start = Math.max(0, lineNumber - contextLines - 1);
|
|
@@ -130522,7 +130978,7 @@ class SymbolGraphService {
|
|
|
130522
130978
|
}
|
|
130523
130979
|
async resolveToAbsolute(relativePath, projectId) {
|
|
130524
130980
|
const root = await this.getProjectRoot(projectId);
|
|
130525
|
-
return root ?
|
|
130981
|
+
return root ? path22.resolve(root, relativePath) : relativePath;
|
|
130526
130982
|
}
|
|
130527
130983
|
async getProjectRoot(projectId) {
|
|
130528
130984
|
const cached2 = this.projectRootCache.get(projectId);
|
|
@@ -130665,7 +131121,7 @@ var init_workspace_manager = __esm(() => {
|
|
|
130665
131121
|
});
|
|
130666
131122
|
|
|
130667
131123
|
// ../../packages/core/dist/tools/index_project.js
|
|
130668
|
-
import
|
|
131124
|
+
import path23 from "path";
|
|
130669
131125
|
|
|
130670
131126
|
class IndexProjectTool {
|
|
130671
131127
|
name = "index_project";
|
|
@@ -130713,7 +131169,7 @@ class IndexProjectTool {
|
|
|
130713
131169
|
try {
|
|
130714
131170
|
await assertParserReadyForIndexing();
|
|
130715
131171
|
const canonicalProjectPath = await canonicalizeProjectRoot(projectPath);
|
|
130716
|
-
const finalProjectId = projectId ||
|
|
131172
|
+
const finalProjectId = projectId || path23.basename(canonicalProjectPath) || "default";
|
|
130717
131173
|
const existing = await workspaceManager.getWorkspace(finalProjectId);
|
|
130718
131174
|
await assertProjectRootReuse({
|
|
130719
131175
|
projectId: finalProjectId,
|
|
@@ -130893,7 +131349,7 @@ function normalizeValue(value) {
|
|
|
130893
131349
|
return Array.from(value).map(normalizeValue);
|
|
130894
131350
|
if (value instanceof Map)
|
|
130895
131351
|
return Object.fromEntries(Array.from(value, ([k, v]) => [String(k), normalizeValue(v)]));
|
|
130896
|
-
if (
|
|
131352
|
+
if (isPlainObject4(value)) {
|
|
130897
131353
|
const encodedValues = {};
|
|
130898
131354
|
for (const key in value)
|
|
130899
131355
|
if (Object.hasOwn(value, key))
|
|
@@ -130914,7 +131370,7 @@ function isJsonObject(value) {
|
|
|
130914
131370
|
function isEmptyObject(value) {
|
|
130915
131371
|
return Object.keys(value).length === 0;
|
|
130916
131372
|
}
|
|
130917
|
-
function
|
|
131373
|
+
function isPlainObject4(value) {
|
|
130918
131374
|
if (value === null || typeof value !== "object")
|
|
130919
131375
|
return false;
|
|
130920
131376
|
const prototype = Object.getPrototypeOf(value);
|
|
@@ -131266,17 +131722,17 @@ function applyReplacer(root, replacer) {
|
|
|
131266
131722
|
return transformChildren(root, replacer, []);
|
|
131267
131723
|
return transformChildren(normalizeValue(replacedRoot), replacer, []);
|
|
131268
131724
|
}
|
|
131269
|
-
function transformChildren(value, replacer,
|
|
131725
|
+
function transformChildren(value, replacer, path24) {
|
|
131270
131726
|
if (isJsonObject(value))
|
|
131271
|
-
return transformObject(value, replacer,
|
|
131727
|
+
return transformObject(value, replacer, path24);
|
|
131272
131728
|
if (isJsonArray(value))
|
|
131273
|
-
return transformArray(value, replacer,
|
|
131729
|
+
return transformArray(value, replacer, path24);
|
|
131274
131730
|
return value;
|
|
131275
131731
|
}
|
|
131276
|
-
function transformObject(obj, replacer,
|
|
131732
|
+
function transformObject(obj, replacer, path24) {
|
|
131277
131733
|
const result = {};
|
|
131278
131734
|
for (const [key, value] of Object.entries(obj)) {
|
|
131279
|
-
const childPath = [...
|
|
131735
|
+
const childPath = [...path24, key];
|
|
131280
131736
|
const replacedValue = replacer(key, value, childPath);
|
|
131281
131737
|
if (replacedValue === undefined)
|
|
131282
131738
|
continue;
|
|
@@ -131284,11 +131740,11 @@ function transformObject(obj, replacer, path20) {
|
|
|
131284
131740
|
}
|
|
131285
131741
|
return result;
|
|
131286
131742
|
}
|
|
131287
|
-
function transformArray(arr, replacer,
|
|
131743
|
+
function transformArray(arr, replacer, path24) {
|
|
131288
131744
|
const result = [];
|
|
131289
131745
|
for (let i = 0;i < arr.length; i++) {
|
|
131290
131746
|
const value = arr[i];
|
|
131291
|
-
const childPath = [...
|
|
131747
|
+
const childPath = [...path24, i];
|
|
131292
131748
|
const replacedValue = replacer(String(i), value, childPath);
|
|
131293
131749
|
if (replacedValue === undefined)
|
|
131294
131750
|
continue;
|
|
@@ -136354,9 +136810,9 @@ var init_session_pin_store = __esm(() => {
|
|
|
136354
136810
|
});
|
|
136355
136811
|
|
|
136356
136812
|
// ../../packages/core/dist/services/hooks/attribution-resolver.js
|
|
136357
|
-
import
|
|
136358
|
-
import
|
|
136359
|
-
import
|
|
136813
|
+
import fs12 from "fs";
|
|
136814
|
+
import os6 from "os";
|
|
136815
|
+
import path24 from "path";
|
|
136360
136816
|
|
|
136361
136817
|
class PgWorkspaceRootProvider {
|
|
136362
136818
|
cache = null;
|
|
@@ -136407,8 +136863,8 @@ class AttributionResolver {
|
|
|
136407
136863
|
this.aliasResolver = options.aliasResolver ?? getProjectIdentityAliasResolver();
|
|
136408
136864
|
this.pins = options.pins ?? new SessionPinStore;
|
|
136409
136865
|
this.canonicalize = options.canonicalize ?? defaultCanonicalize;
|
|
136410
|
-
this.homedir = options.homedir ??
|
|
136411
|
-
this.fsRoot = options.fsRoot ?? (() =>
|
|
136866
|
+
this.homedir = options.homedir ?? os6.homedir;
|
|
136867
|
+
this.fsRoot = options.fsRoot ?? (() => path24.parse(path24.sep).root);
|
|
136412
136868
|
}
|
|
136413
136869
|
async resolve(input) {
|
|
136414
136870
|
const caller = input.callerProjectId;
|
|
@@ -136461,7 +136917,7 @@ class AttributionResolver {
|
|
|
136461
136917
|
}
|
|
136462
136918
|
let bestPath = null;
|
|
136463
136919
|
for (const candidate2 of byPath.keys()) {
|
|
136464
|
-
if (canonicalCwd === candidate2 || canonicalCwd.startsWith(candidate2.endsWith(
|
|
136920
|
+
if (canonicalCwd === candidate2 || canonicalCwd.startsWith(candidate2.endsWith(path24.sep) ? candidate2 : candidate2 + path24.sep)) {
|
|
136465
136921
|
if (bestPath === null || candidate2.length > bestPath.length) {
|
|
136466
136922
|
bestPath = candidate2;
|
|
136467
136923
|
}
|
|
@@ -136484,7 +136940,7 @@ class AttributionResolver {
|
|
|
136484
136940
|
return projectPath2;
|
|
136485
136941
|
const fsRoot = this.fsRoot();
|
|
136486
136942
|
let normalized = projectPath2;
|
|
136487
|
-
while (normalized.length > fsRoot.length && normalized.endsWith(
|
|
136943
|
+
while (normalized.length > fsRoot.length && normalized.endsWith(path24.sep)) {
|
|
136488
136944
|
normalized = normalized.slice(0, -1);
|
|
136489
136945
|
}
|
|
136490
136946
|
return normalized;
|
|
@@ -136492,10 +136948,10 @@ class AttributionResolver {
|
|
|
136492
136948
|
}
|
|
136493
136949
|
function defaultCanonicalize(cwd) {
|
|
136494
136950
|
try {
|
|
136495
|
-
return
|
|
136951
|
+
return fs12.realpathSync(cwd);
|
|
136496
136952
|
} catch {
|
|
136497
136953
|
try {
|
|
136498
|
-
return
|
|
136954
|
+
return path24.resolve(cwd);
|
|
136499
136955
|
} catch {
|
|
136500
136956
|
return;
|
|
136501
136957
|
}
|
|
@@ -137308,31 +137764,31 @@ class TracePathService {
|
|
|
137308
137764
|
const chains = [];
|
|
137309
137765
|
const seen = new Set;
|
|
137310
137766
|
let walks = 0;
|
|
137311
|
-
const walk = (fqn,
|
|
137767
|
+
const walk = (fqn, path25) => {
|
|
137312
137768
|
if (chains.length >= CHAIN_CAP)
|
|
137313
137769
|
return;
|
|
137314
137770
|
if (walks >= MAX_WALKS)
|
|
137315
137771
|
return;
|
|
137316
137772
|
walks++;
|
|
137317
|
-
const key =
|
|
137773
|
+
const key = path25.join("\u2192");
|
|
137318
137774
|
if (seen.has(key))
|
|
137319
137775
|
return;
|
|
137320
137776
|
seen.add(key);
|
|
137321
137777
|
const next = adj.get(fqn);
|
|
137322
137778
|
if (!next || next.length === 0 || !whoHasChild.has(fqn)) {
|
|
137323
|
-
if (
|
|
137324
|
-
chains.push(
|
|
137779
|
+
if (path25.length > 1)
|
|
137780
|
+
chains.push(path25.map((n) => this.fqnToName(n)).join(" \u2192 "));
|
|
137325
137781
|
return;
|
|
137326
137782
|
}
|
|
137327
137783
|
for (const child of next) {
|
|
137328
137784
|
if (chains.length >= CHAIN_CAP || walks >= MAX_WALKS)
|
|
137329
137785
|
return;
|
|
137330
|
-
if (
|
|
137331
|
-
const cycled = [...
|
|
137786
|
+
if (path25.includes(child)) {
|
|
137787
|
+
const cycled = [...path25, `${this.fqnToName(child)}\u21BA`];
|
|
137332
137788
|
chains.push(cycled.map((n) => n).join(" \u2192 "));
|
|
137333
137789
|
continue;
|
|
137334
137790
|
}
|
|
137335
|
-
walk(child, [...
|
|
137791
|
+
walk(child, [...path25, child]);
|
|
137336
137792
|
}
|
|
137337
137793
|
};
|
|
137338
137794
|
for (const seed of seeds) {
|
|
@@ -137525,7 +137981,7 @@ var init_git_ref_validation = __esm(() => {
|
|
|
137525
137981
|
});
|
|
137526
137982
|
|
|
137527
137983
|
// ../../packages/core/dist/services/symbol/impact-analysis.js
|
|
137528
|
-
import { execFileSync } from "child_process";
|
|
137984
|
+
import { execFileSync as execFileSync2 } from "child_process";
|
|
137529
137985
|
function readBfsCteFlag() {
|
|
137530
137986
|
try {
|
|
137531
137987
|
return Boolean(config2.get("impact")?.bfsCteEnabled);
|
|
@@ -137851,19 +138307,19 @@ function defaultDiffRunner(projectPath2, scope, baseBranch, since) {
|
|
|
137851
138307
|
let diffRange;
|
|
137852
138308
|
if (since) {
|
|
137853
138309
|
try {
|
|
137854
|
-
ref =
|
|
138310
|
+
ref = execFileSync2("git", ["-C", projectPath2, "rev-parse", "--verify", `${since}^{commit}`], {
|
|
137855
138311
|
cwd: projectPath2,
|
|
137856
138312
|
encoding: "utf-8",
|
|
137857
138313
|
stdio: ["ignore", "pipe", "pipe"]
|
|
137858
138314
|
}).trim();
|
|
137859
138315
|
} catch {
|
|
137860
|
-
ref =
|
|
138316
|
+
ref = execFileSync2("git", ["-C", projectPath2, "rev-list", "-1", `--before=${since}`, "HEAD"], {
|
|
137861
138317
|
cwd: projectPath2,
|
|
137862
138318
|
encoding: "utf-8",
|
|
137863
138319
|
stdio: ["ignore", "pipe", "pipe"]
|
|
137864
138320
|
}).trim();
|
|
137865
138321
|
if (!ref) {
|
|
137866
|
-
const emptyTree =
|
|
138322
|
+
const emptyTree = execFileSync2("git", ["hash-object", "-t", "tree", "--stdin"], {
|
|
137867
138323
|
cwd: projectPath2,
|
|
137868
138324
|
encoding: "utf-8",
|
|
137869
138325
|
input: "",
|
|
@@ -137875,7 +138331,7 @@ function defaultDiffRunner(projectPath2, scope, baseBranch, since) {
|
|
|
137875
138331
|
}
|
|
137876
138332
|
args.push(diffRange ?? `${ref}...HEAD`);
|
|
137877
138333
|
}
|
|
137878
|
-
const out =
|
|
138334
|
+
const out = execFileSync2("git", args, {
|
|
137879
138335
|
cwd: projectPath2,
|
|
137880
138336
|
encoding: "utf-8",
|
|
137881
138337
|
stdio: ["ignore", "pipe", "pipe"],
|
|
@@ -137887,7 +138343,7 @@ function defaultDiffRunner(projectPath2, scope, baseBranch, since) {
|
|
|
137887
138343
|
let untrackedFiltered = 0;
|
|
137888
138344
|
const merged = new Set(tracked);
|
|
137889
138345
|
if (includeUntracked) {
|
|
137890
|
-
const untracked =
|
|
138346
|
+
const untracked = execFileSync2("git", ["-C", projectPath2, "ls-files", "--others", "--exclude-standard"], {
|
|
137891
138347
|
cwd: projectPath2,
|
|
137892
138348
|
encoding: "utf-8",
|
|
137893
138349
|
stdio: ["ignore", "pipe", "pipe"],
|
|
@@ -138165,7 +138621,7 @@ var init_get_architecture = __esm(() => {
|
|
|
138165
138621
|
});
|
|
138166
138622
|
|
|
138167
138623
|
// ../../packages/core/dist/services/file-read/file-content-cache.js
|
|
138168
|
-
import
|
|
138624
|
+
import fs13 from "fs/promises";
|
|
138169
138625
|
|
|
138170
138626
|
class FileContentCache {
|
|
138171
138627
|
extractMetadata;
|
|
@@ -138198,7 +138654,7 @@ class FileContentCache {
|
|
|
138198
138654
|
metadata: cached2.metadata
|
|
138199
138655
|
};
|
|
138200
138656
|
}
|
|
138201
|
-
const content = await
|
|
138657
|
+
const content = await fs13.readFile(filePath, "utf-8");
|
|
138202
138658
|
const metadata = await this.extractMetadata(content, filePath, options);
|
|
138203
138659
|
evictOldest(this.fileCache, this.FILE_CACHE_MAX_ENTRIES - 1);
|
|
138204
138660
|
this.fileCache.set(cacheKey, {
|
|
@@ -138215,7 +138671,7 @@ var init_file_content_cache = __esm(() => {
|
|
|
138215
138671
|
});
|
|
138216
138672
|
|
|
138217
138673
|
// ../../packages/core/dist/services/file-read/file-metadata.js
|
|
138218
|
-
import
|
|
138674
|
+
import path25 from "path";
|
|
138219
138675
|
|
|
138220
138676
|
class FileMetadataExtractor {
|
|
138221
138677
|
symbolGraph;
|
|
@@ -138251,7 +138707,7 @@ class FileMetadataExtractor {
|
|
|
138251
138707
|
return metadata;
|
|
138252
138708
|
}
|
|
138253
138709
|
detectLanguage(filePath) {
|
|
138254
|
-
const ext2 =
|
|
138710
|
+
const ext2 = path25.extname(filePath).toLowerCase();
|
|
138255
138711
|
const languageMap2 = {
|
|
138256
138712
|
".ts": "TypeScript",
|
|
138257
138713
|
".tsx": "TypeScript",
|
|
@@ -138373,7 +138829,7 @@ var init_line_range = __esm(() => {
|
|
|
138373
138829
|
});
|
|
138374
138830
|
|
|
138375
138831
|
// ../../packages/core/dist/services/file-read/path-containment.js
|
|
138376
|
-
import
|
|
138832
|
+
import path26 from "path";
|
|
138377
138833
|
|
|
138378
138834
|
class PathContainment {
|
|
138379
138835
|
projectRoots;
|
|
@@ -138381,14 +138837,14 @@ class PathContainment {
|
|
|
138381
138837
|
this.projectRoots = projectRoots;
|
|
138382
138838
|
}
|
|
138383
138839
|
async resolveFilePath(filePath, projectId) {
|
|
138384
|
-
if (
|
|
138385
|
-
return
|
|
138840
|
+
if (path26.isAbsolute(filePath)) {
|
|
138841
|
+
return path26.resolve(filePath);
|
|
138386
138842
|
}
|
|
138387
138843
|
if (projectId) {
|
|
138388
138844
|
const root = await this.projectRoots.getProjectRoot(projectId);
|
|
138389
138845
|
if (root) {
|
|
138390
138846
|
const cleaned = sanitizeFilePath(filePath);
|
|
138391
|
-
return
|
|
138847
|
+
return path26.resolve(root, cleaned);
|
|
138392
138848
|
}
|
|
138393
138849
|
return null;
|
|
138394
138850
|
}
|
|
@@ -138399,17 +138855,17 @@ class PathContainment {
|
|
|
138399
138855
|
if (projectId) {
|
|
138400
138856
|
const root = await this.projectRoots.getProjectRoot(projectId);
|
|
138401
138857
|
if (root)
|
|
138402
|
-
roots.push(
|
|
138858
|
+
roots.push(path26.resolve(root));
|
|
138403
138859
|
}
|
|
138404
|
-
roots.push(
|
|
138860
|
+
roots.push(path26.resolve(process.cwd()));
|
|
138405
138861
|
const envRoots = (process.env.MASSA_AI_READ_FILE_ROOTS ?? "").split(":").map((s) => s.trim()).filter((s) => s.length > 0);
|
|
138406
138862
|
for (const extra of envRoots) {
|
|
138407
|
-
roots.push(
|
|
138863
|
+
roots.push(path26.resolve(extra));
|
|
138408
138864
|
}
|
|
138409
|
-
const target =
|
|
138865
|
+
const target = path26.resolve(absoluteFilePath);
|
|
138410
138866
|
for (const root of roots) {
|
|
138411
|
-
const rel =
|
|
138412
|
-
if (rel !== "" && !rel.startsWith("..") && !
|
|
138867
|
+
const rel = path26.relative(root, target);
|
|
138868
|
+
if (rel !== "" && !rel.startsWith("..") && !path26.isAbsolute(rel)) {
|
|
138413
138869
|
return { allowed: true };
|
|
138414
138870
|
}
|
|
138415
138871
|
if (rel === "")
|
|
@@ -138923,7 +139379,7 @@ var init_tools = __esm(() => {
|
|
|
138923
139379
|
});
|
|
138924
139380
|
|
|
138925
139381
|
// ../../packages/core/dist/services/executor/runtime.js
|
|
138926
|
-
import { execFileSync as
|
|
139382
|
+
import { execFileSync as execFileSync3, execSync } from "child_process";
|
|
138927
139383
|
function commandExists(cmd) {
|
|
138928
139384
|
try {
|
|
138929
139385
|
const check2 = isWindows ? `where ${cmd}` : `command -v ${cmd}`;
|
|
@@ -138956,7 +139412,7 @@ function getVersion(cmd, args = ["--version"], deps) {
|
|
|
138956
139412
|
timeout: 5000
|
|
138957
139413
|
}).trim().split(/\r?\n/)[0];
|
|
138958
139414
|
}
|
|
138959
|
-
return
|
|
139415
|
+
return execFileSync3(cmd, args, {
|
|
138960
139416
|
encoding: "utf-8",
|
|
138961
139417
|
stdio: ["pipe", "pipe", "pipe"],
|
|
138962
139418
|
timeout: 5000
|
|
@@ -139097,12 +139553,12 @@ var init_runtime = __esm(() => {
|
|
|
139097
139553
|
|
|
139098
139554
|
// ../../packages/core/dist/services/executor/sandbox.js
|
|
139099
139555
|
import { realpathSync as realpathSync2 } from "fs";
|
|
139100
|
-
import { execFileSync as
|
|
139556
|
+
import { execFileSync as execFileSync4 } from "child_process";
|
|
139101
139557
|
function isDockerAvailable() {
|
|
139102
139558
|
if (_dockerAvailable !== null)
|
|
139103
139559
|
return _dockerAvailable;
|
|
139104
139560
|
try {
|
|
139105
|
-
|
|
139561
|
+
execFileSync4("docker", ["--version"], { stdio: "pipe", timeout: 5000 });
|
|
139106
139562
|
_dockerAvailable = true;
|
|
139107
139563
|
} catch {
|
|
139108
139564
|
_dockerAvailable = false;
|
|
@@ -139113,7 +139569,7 @@ function isSeatbeltAvailable() {
|
|
|
139113
139569
|
if (_seatbeltAvailable !== null)
|
|
139114
139570
|
return _seatbeltAvailable;
|
|
139115
139571
|
try {
|
|
139116
|
-
|
|
139572
|
+
execFileSync4("sandbox-exec", ["--version"], { stdio: "pipe", timeout: 5000 });
|
|
139117
139573
|
_seatbeltAvailable = true;
|
|
139118
139574
|
} catch {
|
|
139119
139575
|
_seatbeltAvailable = false;
|
|
@@ -139218,7 +139674,7 @@ var init_sandbox = __esm(() => {
|
|
|
139218
139674
|
});
|
|
139219
139675
|
|
|
139220
139676
|
// ../../packages/core/dist/services/executor/executor.js
|
|
139221
|
-
import { spawn, execSync as execSync2, execFileSync as
|
|
139677
|
+
import { spawn, execSync as execSync2, execFileSync as execFileSync5 } from "child_process";
|
|
139222
139678
|
import { mkdtempSync, writeFileSync as writeFileSync2, rmSync, realpathSync as realpathSync3 } from "fs";
|
|
139223
139679
|
import { join as join3, resolve as resolve5, isAbsolute, relative as relative2 } from "path";
|
|
139224
139680
|
import { tmpdir } from "os";
|
|
@@ -139421,7 +139877,7 @@ ${body}`;
|
|
|
139421
139877
|
const binPath = srcPath.replace(/\.rs$/, isWin ? ".exe" : "");
|
|
139422
139878
|
try {
|
|
139423
139879
|
try {
|
|
139424
|
-
|
|
139880
|
+
execFileSync5("rustc", [srcPath, "-o", binPath], {
|
|
139425
139881
|
cwd,
|
|
139426
139882
|
timeout: Math.min(timeout, 60000),
|
|
139427
139883
|
encoding: "utf-8",
|
|
@@ -141623,9 +142079,9 @@ var init_l1_memory_cache = __esm(() => {
|
|
|
141623
142079
|
});
|
|
141624
142080
|
|
|
141625
142081
|
// ../../packages/core/dist/services/health/local-health-checker.js
|
|
141626
|
-
import
|
|
142082
|
+
import fs14 from "fs/promises";
|
|
141627
142083
|
import { existsSync as existsSync3 } from "fs";
|
|
141628
|
-
import
|
|
142084
|
+
import path27 from "path";
|
|
141629
142085
|
|
|
141630
142086
|
class LocalHealthChecker {
|
|
141631
142087
|
ollamaBaseUrl = process.env.OLLAMA_BASE_URL || "http://localhost:11434";
|
|
@@ -141659,10 +142115,10 @@ class LocalHealthChecker {
|
|
|
141659
142115
|
const start = Date.now();
|
|
141660
142116
|
try {
|
|
141661
142117
|
if (!existsSync3(this.dataDir))
|
|
141662
|
-
await
|
|
141663
|
-
const probe2 =
|
|
141664
|
-
await
|
|
141665
|
-
await
|
|
142118
|
+
await fs14.mkdir(this.dataDir, { recursive: true });
|
|
142119
|
+
const probe2 = path27.join(this.dataDir, ".health-check-test");
|
|
142120
|
+
await fs14.writeFile(probe2, "ok");
|
|
142121
|
+
await fs14.unlink(probe2);
|
|
141666
142122
|
return { available: true, latency: Date.now() - start, details: { path: this.dataDir, writable: true } };
|
|
141667
142123
|
} catch (error51) {
|
|
141668
142124
|
return { available: false, latency: Date.now() - start, error: `Data directory error: ${error51.message}` };
|
|
@@ -143601,9 +144057,9 @@ var init_scheduler2 = __esm(() => {
|
|
|
143601
144057
|
});
|
|
143602
144058
|
|
|
143603
144059
|
// ../../packages/core/dist/services/pricing/models-dev-client.js
|
|
143604
|
-
import
|
|
144060
|
+
import fs15 from "fs/promises";
|
|
143605
144061
|
import { existsSync as existsSync4 } from "fs";
|
|
143606
|
-
import
|
|
144062
|
+
import path28 from "path";
|
|
143607
144063
|
function getModelsDevClient() {
|
|
143608
144064
|
if (!clientInstance) {
|
|
143609
144065
|
clientInstance = new ModelsDevClient;
|
|
@@ -143623,7 +144079,7 @@ var init_models_dev_client = __esm(() => {
|
|
|
143623
144079
|
memoryCacheTimestamp = 0;
|
|
143624
144080
|
getLocalCachePath() {
|
|
143625
144081
|
const dataDir = config2.get("dataDir");
|
|
143626
|
-
return
|
|
144082
|
+
return path28.join(dataDir, ModelsDevClient.LOCAL_CACHE_FILE);
|
|
143627
144083
|
}
|
|
143628
144084
|
async loadLocalCache() {
|
|
143629
144085
|
const cachePath = this.getLocalCachePath();
|
|
@@ -143631,7 +144087,7 @@ var init_models_dev_client = __esm(() => {
|
|
|
143631
144087
|
if (!existsSync4(cachePath)) {
|
|
143632
144088
|
return null;
|
|
143633
144089
|
}
|
|
143634
|
-
const content = await
|
|
144090
|
+
const content = await fs15.readFile(cachePath, "utf-8");
|
|
143635
144091
|
const data = JSON.parse(content);
|
|
143636
144092
|
const age = Date.now() - data.timestamp;
|
|
143637
144093
|
if (age > ModelsDevClient.LOCAL_CACHE_TTL) {
|
|
@@ -143658,14 +144114,14 @@ var init_models_dev_client = __esm(() => {
|
|
|
143658
144114
|
async saveLocalCache(models) {
|
|
143659
144115
|
const cachePath = this.getLocalCachePath();
|
|
143660
144116
|
try {
|
|
143661
|
-
const dir =
|
|
143662
|
-
await
|
|
144117
|
+
const dir = path28.dirname(cachePath);
|
|
144118
|
+
await fs15.mkdir(dir, { recursive: true });
|
|
143663
144119
|
const data = {
|
|
143664
144120
|
timestamp: Date.now(),
|
|
143665
144121
|
version: "1.0.0",
|
|
143666
144122
|
models: Object.fromEntries(models)
|
|
143667
144123
|
};
|
|
143668
|
-
await
|
|
144124
|
+
await fs15.writeFile(cachePath, JSON.stringify(data), "utf-8");
|
|
143669
144125
|
logger.debug("Saved pricing to local cache", {
|
|
143670
144126
|
models: models.size,
|
|
143671
144127
|
path: cachePath
|
|
@@ -143994,7 +144450,7 @@ var init_models_dev_client = __esm(() => {
|
|
|
143994
144450
|
const cachePath = this.getLocalCachePath();
|
|
143995
144451
|
try {
|
|
143996
144452
|
if (existsSync4(cachePath)) {
|
|
143997
|
-
await
|
|
144453
|
+
await fs15.unlink(cachePath);
|
|
143998
144454
|
logger.debug("Local pricing cache file deleted");
|
|
143999
144455
|
}
|
|
144000
144456
|
} catch (error51) {
|
|
@@ -149549,33 +150005,33 @@ var require_URL = __commonJS((exports, module) => {
|
|
|
149549
150005
|
else
|
|
149550
150006
|
return basepath.substring(0, lastslash + 1) + refpath;
|
|
149551
150007
|
}
|
|
149552
|
-
function remove_dot_segments(
|
|
149553
|
-
if (!
|
|
149554
|
-
return
|
|
150008
|
+
function remove_dot_segments(path29) {
|
|
150009
|
+
if (!path29)
|
|
150010
|
+
return path29;
|
|
149555
150011
|
var output = "";
|
|
149556
|
-
while (
|
|
149557
|
-
if (
|
|
149558
|
-
|
|
150012
|
+
while (path29.length > 0) {
|
|
150013
|
+
if (path29 === "." || path29 === "..") {
|
|
150014
|
+
path29 = "";
|
|
149559
150015
|
break;
|
|
149560
150016
|
}
|
|
149561
|
-
var twochars =
|
|
149562
|
-
var threechars =
|
|
149563
|
-
var fourchars =
|
|
150017
|
+
var twochars = path29.substring(0, 2);
|
|
150018
|
+
var threechars = path29.substring(0, 3);
|
|
150019
|
+
var fourchars = path29.substring(0, 4);
|
|
149564
150020
|
if (threechars === "../") {
|
|
149565
|
-
|
|
150021
|
+
path29 = path29.substring(3);
|
|
149566
150022
|
} else if (twochars === "./") {
|
|
149567
|
-
|
|
150023
|
+
path29 = path29.substring(2);
|
|
149568
150024
|
} else if (threechars === "/./") {
|
|
149569
|
-
|
|
149570
|
-
} else if (twochars === "/." &&
|
|
149571
|
-
|
|
149572
|
-
} else if (fourchars === "/../" || threechars === "/.." &&
|
|
149573
|
-
|
|
150025
|
+
path29 = "/" + path29.substring(3);
|
|
150026
|
+
} else if (twochars === "/." && path29.length === 2) {
|
|
150027
|
+
path29 = "/";
|
|
150028
|
+
} else if (fourchars === "/../" || threechars === "/.." && path29.length === 3) {
|
|
150029
|
+
path29 = "/" + path29.substring(4);
|
|
149574
150030
|
output = output.replace(/\/?[^\/]*$/, "");
|
|
149575
150031
|
} else {
|
|
149576
|
-
var segment =
|
|
150032
|
+
var segment = path29.match(/(\/?([^\/]*))/)[0];
|
|
149577
150033
|
output += segment;
|
|
149578
|
-
|
|
150034
|
+
path29 = path29.substring(segment.length);
|
|
149579
150035
|
}
|
|
149580
150036
|
}
|
|
149581
150037
|
return output;
|
|
@@ -161645,21 +162101,21 @@ function jsonToKeyPathChunks(value, label = "$") {
|
|
|
161645
162101
|
walk(value, label, out);
|
|
161646
162102
|
return out;
|
|
161647
162103
|
}
|
|
161648
|
-
function walk(val,
|
|
162104
|
+
function walk(val, path29, out) {
|
|
161649
162105
|
if (val === null || val === undefined)
|
|
161650
162106
|
return;
|
|
161651
162107
|
if (Array.isArray(val)) {
|
|
161652
162108
|
if (val.length === 0) {
|
|
161653
|
-
out.push({ path:
|
|
162109
|
+
out.push({ path: path29, content: `**${path29}** = _[]_` });
|
|
161654
162110
|
return;
|
|
161655
162111
|
}
|
|
161656
162112
|
if (val.every((v) => v !== null && typeof v === "object")) {
|
|
161657
|
-
val.forEach((v, i) => walk(v, `${
|
|
162113
|
+
val.forEach((v, i) => walk(v, `${path29}[${i}]`, out));
|
|
161658
162114
|
return;
|
|
161659
162115
|
}
|
|
161660
162116
|
const items = val.map((v) => `- \`${String(v)}\``).join(`
|
|
161661
162117
|
`);
|
|
161662
|
-
out.push({ path:
|
|
162118
|
+
out.push({ path: path29, content: `**${path29}**
|
|
161663
162119
|
|
|
161664
162120
|
${items}` });
|
|
161665
162121
|
return;
|
|
@@ -161667,16 +162123,16 @@ ${items}` });
|
|
|
161667
162123
|
if (typeof val === "object") {
|
|
161668
162124
|
const entries = Object.entries(val);
|
|
161669
162125
|
if (entries.length === 0) {
|
|
161670
|
-
out.push({ path:
|
|
162126
|
+
out.push({ path: path29, content: `**${path29}** = _{}_` });
|
|
161671
162127
|
return;
|
|
161672
162128
|
}
|
|
161673
162129
|
for (const [k, v] of entries) {
|
|
161674
162130
|
const safeKey = /^[A-Za-z_$][\w$]*$/.test(k) ? k : JSON.stringify(k);
|
|
161675
|
-
walk(v, `${
|
|
162131
|
+
walk(v, `${path29}.${safeKey}`, out);
|
|
161676
162132
|
}
|
|
161677
162133
|
return;
|
|
161678
162134
|
}
|
|
161679
|
-
out.push({ path:
|
|
162135
|
+
out.push({ path: path29, content: `**${path29}** = \`${String(val)}\`` });
|
|
161680
162136
|
}
|
|
161681
162137
|
var gfm, STRIP_SELECTORS, tdCache = null;
|
|
161682
162138
|
var init_html_to_md = __esm(() => {
|
|
@@ -162438,8 +162894,8 @@ var init_hook_service = __esm(() => {
|
|
|
162438
162894
|
|
|
162439
162895
|
// ../../packages/core/dist/services/bootstrap/bootstrap-service.js
|
|
162440
162896
|
import { randomUUID as randomUUID9 } from "crypto";
|
|
162441
|
-
import
|
|
162442
|
-
import
|
|
162897
|
+
import fs16 from "fs";
|
|
162898
|
+
import path29 from "path";
|
|
162443
162899
|
import { spawn as spawn2 } from "child_process";
|
|
162444
162900
|
function readBootstrapConfig() {
|
|
162445
162901
|
try {
|
|
@@ -162599,9 +163055,9 @@ async function scanSignals(_projectId, projectRoot, caps, symbolGraph, gitRunner
|
|
|
162599
163055
|
}
|
|
162600
163056
|
try {
|
|
162601
163057
|
for (const name26 of README_CANDIDATES) {
|
|
162602
|
-
const p =
|
|
162603
|
-
if (
|
|
162604
|
-
const buf =
|
|
163058
|
+
const p = path29.join(projectRoot, name26);
|
|
163059
|
+
if (fs16.existsSync(p) && fs16.statSync(p).isFile()) {
|
|
163060
|
+
const buf = fs16.readFileSync(p);
|
|
162605
163061
|
signals.readme = buf.slice(0, MAX_README_BYTES).toString("utf8");
|
|
162606
163062
|
break;
|
|
162607
163063
|
}
|
|
@@ -162610,14 +163066,14 @@ async function scanSignals(_projectId, projectRoot, caps, symbolGraph, gitRunner
|
|
|
162610
163066
|
logger.debug("bootstrap scan: README read failed", { error: e.message });
|
|
162611
163067
|
}
|
|
162612
163068
|
try {
|
|
162613
|
-
const docsDir =
|
|
162614
|
-
if (
|
|
163069
|
+
const docsDir = path29.join(projectRoot, "docs");
|
|
163070
|
+
if (fs16.existsSync(docsDir) && fs16.statSync(docsDir).isDirectory()) {
|
|
162615
163071
|
const entries = walkMarkdown(docsDir).slice(0, MAX_DOCS);
|
|
162616
163072
|
for (const rel of entries) {
|
|
162617
163073
|
try {
|
|
162618
|
-
const buf =
|
|
163074
|
+
const buf = fs16.readFileSync(rel);
|
|
162619
163075
|
signals.docs.push({
|
|
162620
|
-
path:
|
|
163076
|
+
path: path29.relative(projectRoot, rel),
|
|
162621
163077
|
snippet: buf.slice(0, MAX_DOC_BYTES).toString("utf8")
|
|
162622
163078
|
});
|
|
162623
163079
|
} catch {}
|
|
@@ -162628,10 +163084,10 @@ async function scanSignals(_projectId, projectRoot, caps, symbolGraph, gitRunner
|
|
|
162628
163084
|
}
|
|
162629
163085
|
try {
|
|
162630
163086
|
for (const name26 of MANIFEST_FILES) {
|
|
162631
|
-
const p =
|
|
162632
|
-
if (!
|
|
163087
|
+
const p = path29.join(projectRoot, name26);
|
|
163088
|
+
if (!fs16.existsSync(p) || !fs16.statSync(p).isFile())
|
|
162633
163089
|
continue;
|
|
162634
|
-
const raw2 =
|
|
163090
|
+
const raw2 = fs16.readFileSync(p).slice(0, MAX_MANIFEST_BYTES).toString("utf8");
|
|
162635
163091
|
const kind = name26;
|
|
162636
163092
|
if (name26 === "package.json") {
|
|
162637
163093
|
try {
|
|
@@ -162671,12 +163127,12 @@ function walkMarkdown(dir) {
|
|
|
162671
163127
|
const cur = stack.pop();
|
|
162672
163128
|
let entries;
|
|
162673
163129
|
try {
|
|
162674
|
-
entries =
|
|
163130
|
+
entries = fs16.readdirSync(cur, { withFileTypes: true });
|
|
162675
163131
|
} catch {
|
|
162676
163132
|
continue;
|
|
162677
163133
|
}
|
|
162678
163134
|
for (const e of entries) {
|
|
162679
|
-
const full =
|
|
163135
|
+
const full = path29.join(cur, e.name);
|
|
162680
163136
|
if (e.isDirectory()) {
|
|
162681
163137
|
if (e.name === "node_modules" || e.name.startsWith("."))
|
|
162682
163138
|
continue;
|
|
@@ -166086,7 +166542,7 @@ class StdioServerTransport {
|
|
|
166086
166542
|
}
|
|
166087
166543
|
|
|
166088
166544
|
// src/index.ts
|
|
166089
|
-
import
|
|
166545
|
+
import fs19 from "fs/promises";
|
|
166090
166546
|
|
|
166091
166547
|
// src/api-client.ts
|
|
166092
166548
|
init_config();
|
|
@@ -166193,10 +166649,11 @@ class ApiClient {
|
|
|
166193
166649
|
// src/embedded-api-client.ts
|
|
166194
166650
|
init_dist15();
|
|
166195
166651
|
init_dist();
|
|
166652
|
+
init_dist();
|
|
166196
166653
|
init_dist15();
|
|
166197
166654
|
init_dist();
|
|
166198
|
-
import
|
|
166199
|
-
import
|
|
166655
|
+
import fs17 from "fs/promises";
|
|
166656
|
+
import path30 from "path";
|
|
166200
166657
|
var _indexProjectTool = null;
|
|
166201
166658
|
function indexProjectTool() {
|
|
166202
166659
|
if (!_indexProjectTool)
|
|
@@ -166343,6 +166800,19 @@ function compactSnapshotTool() {
|
|
|
166343
166800
|
function httpError(status, message) {
|
|
166344
166801
|
throw new ApiHttpError(status, { success: false, error: message });
|
|
166345
166802
|
}
|
|
166803
|
+
function profileEngineError(e) {
|
|
166804
|
+
const err = e instanceof Error ? e : new Error(String(e));
|
|
166805
|
+
let status = 500;
|
|
166806
|
+
if (err.name === "UnknownProfileError")
|
|
166807
|
+
status = 400;
|
|
166808
|
+
else if (err.name === "NoHostsDetectedError")
|
|
166809
|
+
status = 404;
|
|
166810
|
+
else if (err instanceof LockError)
|
|
166811
|
+
status = 409;
|
|
166812
|
+
else if (err instanceof InstallStateError)
|
|
166813
|
+
status = 500;
|
|
166814
|
+
throw new ApiHttpError(status, { success: false, error: { code: err.name, message: err.message } });
|
|
166815
|
+
}
|
|
166346
166816
|
function qs(val) {
|
|
166347
166817
|
if (val === undefined || val === null)
|
|
166348
166818
|
return;
|
|
@@ -166466,8 +166936,8 @@ class EmbeddedApiClient {
|
|
|
166466
166936
|
} else {
|
|
166467
166937
|
end = start + 20;
|
|
166468
166938
|
}
|
|
166469
|
-
const absolutePath =
|
|
166470
|
-
const content = await
|
|
166939
|
+
const absolutePath = path30.join(workspace.project_path, file2);
|
|
166940
|
+
const content = await fs17.readFile(absolutePath, "utf-8");
|
|
166471
166941
|
const lines = content.split(/\r?\n/);
|
|
166472
166942
|
const slice = lines.slice(start - 1, Math.min(lines.length, end));
|
|
166473
166943
|
const formatted = slice.map((text3, idx) => ({ lineNumber: start + idx, content: text3 }));
|
|
@@ -166521,6 +166991,18 @@ class EmbeddedApiClient {
|
|
|
166521
166991
|
if (endpoint === "/api/v1/analytics" || endpoint === "/api/v1/analytics/") {
|
|
166522
166992
|
return await analyticsTool().handle(queryParams ?? {});
|
|
166523
166993
|
}
|
|
166994
|
+
if (endpoint === "/api/v1/profiles") {
|
|
166995
|
+
const hostParam = qs(queryParams?.host);
|
|
166996
|
+
if (hostParam !== undefined && !isHost(hostParam)) {
|
|
166997
|
+
return { success: false, error: { code: "InvalidHostError", message: `unknown host "${hostParam}"` } };
|
|
166998
|
+
}
|
|
166999
|
+
try {
|
|
167000
|
+
const inventory = listProfiles(hostParam ? { hosts: [hostParam] } : {});
|
|
167001
|
+
return { success: true, data: inventory };
|
|
167002
|
+
} catch (e) {
|
|
167003
|
+
profileEngineError(e);
|
|
167004
|
+
}
|
|
167005
|
+
}
|
|
166524
167006
|
return httpError(404, `EmbeddedApiClient: no GET handler for ${endpoint}`);
|
|
166525
167007
|
} catch (error51) {
|
|
166526
167008
|
if (error51 instanceof ApiHttpError)
|
|
@@ -166601,6 +167083,8 @@ class EmbeddedApiClient {
|
|
|
166601
167083
|
return await this.handleProposalReject(body);
|
|
166602
167084
|
case "/api/v1/synapse/session":
|
|
166603
167085
|
return await this.handleSynapseSession(body);
|
|
167086
|
+
case "/api/v1/profiles/switch":
|
|
167087
|
+
return this.handleProfileSwitch(body);
|
|
166604
167088
|
case "/api/v1/synapse/sessions":
|
|
166605
167089
|
break;
|
|
166606
167090
|
default:
|
|
@@ -166690,22 +167174,22 @@ class EmbeddedApiClient {
|
|
|
166690
167174
|
async uploadAndIndex(params) {
|
|
166691
167175
|
const rawBase = params.projectId || params.projectPath.replace(/\\/g, "/").split("/").filter(Boolean).pop() || "default";
|
|
166692
167176
|
const finalProjectId = rawBase.replace(/[^a-zA-Z0-9_.-]/g, "_").slice(0, 128);
|
|
166693
|
-
const uploadRoot = process.env.MASSA_AI_UPLOAD_DIR ||
|
|
166694
|
-
const stagingDir =
|
|
166695
|
-
await
|
|
166696
|
-
await
|
|
167177
|
+
const uploadRoot = process.env.MASSA_AI_UPLOAD_DIR || path30.join(getGlobalDataDir(), "uploads");
|
|
167178
|
+
const stagingDir = path30.resolve(uploadRoot, finalProjectId);
|
|
167179
|
+
await fs17.rm(stagingDir, { recursive: true, force: true });
|
|
167180
|
+
await fs17.mkdir(stagingDir, { recursive: true });
|
|
166697
167181
|
const WRITE_BATCH = 20;
|
|
166698
167182
|
for (let i = 0;i < params.files.length; i += WRITE_BATCH) {
|
|
166699
167183
|
await Promise.all(params.files.slice(i, i + WRITE_BATCH).map(async (file2) => {
|
|
166700
|
-
if (
|
|
167184
|
+
if (path30.isAbsolute(file2.relativePath) || file2.relativePath.includes("..")) {
|
|
166701
167185
|
throw new Error(`Invalid file path: ${file2.relativePath}`);
|
|
166702
167186
|
}
|
|
166703
|
-
const dest =
|
|
166704
|
-
if (!dest.startsWith(stagingDir +
|
|
167187
|
+
const dest = path30.resolve(stagingDir, file2.relativePath.replace(/\//g, path30.sep));
|
|
167188
|
+
if (!dest.startsWith(stagingDir + path30.sep)) {
|
|
166705
167189
|
throw new Error(`Path escapes staging directory: ${file2.relativePath}`);
|
|
166706
167190
|
}
|
|
166707
|
-
await
|
|
166708
|
-
await
|
|
167191
|
+
await fs17.mkdir(path30.dirname(dest), { recursive: true });
|
|
167192
|
+
await fs17.writeFile(dest, file2.content, "utf-8");
|
|
166709
167193
|
}));
|
|
166710
167194
|
}
|
|
166711
167195
|
return await indexProjectTool().handle({
|
|
@@ -166719,6 +167203,18 @@ class EmbeddedApiClient {
|
|
|
166719
167203
|
async healthCheck() {
|
|
166720
167204
|
return true;
|
|
166721
167205
|
}
|
|
167206
|
+
handleProfileSwitch(body) {
|
|
167207
|
+
const { profile, host, dryRun } = body;
|
|
167208
|
+
if (host !== undefined && !isHost(host)) {
|
|
167209
|
+
return { success: false, error: { code: "InvalidHostError", message: `unknown host "${host}"` } };
|
|
167210
|
+
}
|
|
167211
|
+
try {
|
|
167212
|
+
const report = switchProfile({ profile, host, dryRun });
|
|
167213
|
+
return { success: true, data: report };
|
|
167214
|
+
} catch (e) {
|
|
167215
|
+
profileEngineError(e);
|
|
167216
|
+
}
|
|
167217
|
+
}
|
|
166722
167218
|
async handleMemoryList(body) {
|
|
166723
167219
|
try {
|
|
166724
167220
|
const repo = getMemoryRepository();
|
|
@@ -167037,8 +167533,8 @@ class EmbeddedApiClient {
|
|
|
167037
167533
|
|
|
167038
167534
|
// src/file-collector.ts
|
|
167039
167535
|
init_config();
|
|
167040
|
-
import
|
|
167041
|
-
import
|
|
167536
|
+
import fs18 from "fs/promises";
|
|
167537
|
+
import path31 from "path";
|
|
167042
167538
|
var SKIP_DIRS = new Set([
|
|
167043
167539
|
"node_modules",
|
|
167044
167540
|
".git",
|
|
@@ -167079,7 +167575,7 @@ async function walk2(root2, dir, files, state, allowed) {
|
|
|
167079
167575
|
return;
|
|
167080
167576
|
let entries;
|
|
167081
167577
|
try {
|
|
167082
|
-
entries = await
|
|
167578
|
+
entries = await fs18.readdir(dir, { withFileTypes: true });
|
|
167083
167579
|
} catch {
|
|
167084
167580
|
return;
|
|
167085
167581
|
}
|
|
@@ -167088,22 +167584,22 @@ async function walk2(root2, dir, files, state, allowed) {
|
|
|
167088
167584
|
break;
|
|
167089
167585
|
if (entry2.isDirectory()) {
|
|
167090
167586
|
if (!SKIP_DIRS.has(entry2.name) && !entry2.name.startsWith(".")) {
|
|
167091
|
-
await walk2(root2,
|
|
167587
|
+
await walk2(root2, path31.join(dir, entry2.name), files, state, allowed);
|
|
167092
167588
|
}
|
|
167093
167589
|
} else if (entry2.isFile()) {
|
|
167094
|
-
const ext2 =
|
|
167590
|
+
const ext2 = path31.extname(entry2.name).toLowerCase();
|
|
167095
167591
|
if (!allowed.has(ext2))
|
|
167096
167592
|
continue;
|
|
167097
|
-
const fullPath =
|
|
167593
|
+
const fullPath = path31.join(dir, entry2.name);
|
|
167098
167594
|
try {
|
|
167099
|
-
const stat = await
|
|
167595
|
+
const stat = await fs18.stat(fullPath);
|
|
167100
167596
|
if (stat.size > MAX_FILE_BYTES)
|
|
167101
167597
|
continue;
|
|
167102
167598
|
if (state.totalBytes + stat.size > MAX_TOTAL_BYTES)
|
|
167103
167599
|
continue;
|
|
167104
|
-
const content = await
|
|
167600
|
+
const content = await fs18.readFile(fullPath, "utf-8");
|
|
167105
167601
|
state.totalBytes += stat.size;
|
|
167106
|
-
const relativePath =
|
|
167602
|
+
const relativePath = path31.relative(root2, fullPath).split(path31.sep).join("/");
|
|
167107
167603
|
files.push({ relativePath, content });
|
|
167108
167604
|
} catch {}
|
|
167109
167605
|
}
|
|
@@ -168343,6 +168839,48 @@ var PROJECT_TOOL_DEFINITIONS = [
|
|
|
168343
168839
|
},
|
|
168344
168840
|
required: ["sourceProjectId", "targetProjectId"]
|
|
168345
168841
|
}
|
|
168842
|
+
},
|
|
168843
|
+
{
|
|
168844
|
+
name: "profile_list",
|
|
168845
|
+
description: "List shipped model profiles and, per detected host, the currently active profile (from recorded state; " + "'balanced' shown when unrecorded) and bundle version. Offline \u2014 reads on-disk variant directories only, " + "never the registry.",
|
|
168846
|
+
apiEndpoint: "/api/v1/profiles",
|
|
168847
|
+
apiMethod: "GET",
|
|
168848
|
+
inputSchema: {
|
|
168849
|
+
type: "object",
|
|
168850
|
+
properties: {
|
|
168851
|
+
host: {
|
|
168852
|
+
type: "string",
|
|
168853
|
+
enum: ["claude", "codex", "cursor", "opencode"],
|
|
168854
|
+
description: "Limit the inventory to a single host. Omit to report every detected host."
|
|
168855
|
+
}
|
|
168856
|
+
}
|
|
168857
|
+
}
|
|
168858
|
+
},
|
|
168859
|
+
{
|
|
168860
|
+
name: "profile_set",
|
|
168861
|
+
description: "Switch the installed massa-ai agents to a registry profile (e.g. 'work', 'cheap'). Local trust model \u2014 " + "same as the code-execution tools: this mutates the machine the MCP server runs on, replacing the active " + "installed agent files for every detected, supported host with the chosen profile's variant. Reports per " + "host: switched / skipped (reason) / failed (reason). A host session restart is required for the change to " + "take effect. Use dryRun to preview the per-host plan without changing any files.",
|
|
168862
|
+
apiEndpoint: "/api/v1/profiles/switch",
|
|
168863
|
+
apiMethod: "POST",
|
|
168864
|
+
inputSchema: {
|
|
168865
|
+
type: "object",
|
|
168866
|
+
properties: {
|
|
168867
|
+
profile: {
|
|
168868
|
+
type: "string",
|
|
168869
|
+
description: "Target profile name (must be a profile shipped in the installed bundle)."
|
|
168870
|
+
},
|
|
168871
|
+
host: {
|
|
168872
|
+
type: "string",
|
|
168873
|
+
enum: ["claude", "codex", "cursor", "opencode"],
|
|
168874
|
+
description: "Limit the switch to a single host. Omit to switch every detected, supported host."
|
|
168875
|
+
},
|
|
168876
|
+
dryRun: {
|
|
168877
|
+
type: "boolean",
|
|
168878
|
+
description: "Preview the per-host plan; change nothing.",
|
|
168879
|
+
default: false
|
|
168880
|
+
}
|
|
168881
|
+
},
|
|
168882
|
+
required: ["profile"]
|
|
168883
|
+
}
|
|
168346
168884
|
}
|
|
168347
168885
|
];
|
|
168348
168886
|
|
|
@@ -168667,7 +169205,7 @@ var HOOKS_EXEC_TOOL_DEFINITIONS = [
|
|
|
168667
169205
|
|
|
168668
169206
|
// src/tool-definitions.ts
|
|
168669
169207
|
var BY_NAME = new Map([...PROJECT_TOOL_DEFINITIONS, ...SEARCH_TOOL_DEFINITIONS, ...MEMORY_TOOL_DEFINITIONS, ...SYNAPSE_TOOL_DEFINITIONS, ...HOOKS_EXEC_TOOL_DEFINITIONS].map((t) => [t.name, t]));
|
|
168670
|
-
var CANONICAL_ORDER = ["index", "index_status", "search", "remember", "recall", "memory_update", "memory_delete", "list_checkpoints", "create_checkpoint", "restore_checkpoint", "compress", "optimized_context", "analytics", "list_projects", "project_map", "get_architecture", "search_definitions", "get_references", "go_to_definition", "trace_path", "impact_analysis", "reset_project", "read_file", "synapse_session", "synapse_get", "synapse_update", "synapse_end", "synapse_prime", "synapse_access", "synapse_prefetch", "synapse_list", "synapse_task_begin", "synapse_task_end", "symbol_snippet", "memory_list", "reindex", "hook_ingest", "compact_snapshot", "bootstrap", "handoff_begin", "handoff_accept", "handoff_cancel", "handoff_list_pending", "list_proposals", "approve_proposal", "reject_proposal", "execute", "execute_file", "batch_execute", "fetch_and_index", "rename_project", "merge_projects"];
|
|
169208
|
+
var CANONICAL_ORDER = ["index", "index_status", "search", "remember", "recall", "memory_update", "memory_delete", "list_checkpoints", "create_checkpoint", "restore_checkpoint", "compress", "optimized_context", "analytics", "list_projects", "project_map", "get_architecture", "search_definitions", "get_references", "go_to_definition", "trace_path", "impact_analysis", "reset_project", "read_file", "synapse_session", "synapse_get", "synapse_update", "synapse_end", "synapse_prime", "synapse_access", "synapse_prefetch", "synapse_list", "synapse_task_begin", "synapse_task_end", "symbol_snippet", "memory_list", "reindex", "hook_ingest", "compact_snapshot", "bootstrap", "handoff_begin", "handoff_accept", "handoff_cancel", "handoff_list_pending", "list_proposals", "approve_proposal", "reject_proposal", "execute", "execute_file", "batch_execute", "fetch_and_index", "rename_project", "merge_projects", "profile_list", "profile_set"];
|
|
168671
169209
|
var TOOL_DEFINITIONS = CANONICAL_ORDER.map((name26) => BY_NAME.get(name26));
|
|
168672
169210
|
function getToolDefinition(name26) {
|
|
168673
169211
|
return TOOL_DEFINITIONS.find((t) => t.name === name26);
|
|
@@ -168962,7 +169500,7 @@ class McpProxyServer {
|
|
|
168962
169500
|
return textContent(JSON.stringify({ success: false, error: "projectPath is required" }));
|
|
168963
169501
|
}
|
|
168964
169502
|
try {
|
|
168965
|
-
if (!(await
|
|
169503
|
+
if (!(await fs19.stat(projectPath2)).isDirectory()) {
|
|
168966
169504
|
return textContent(JSON.stringify({ success: false, error: `${projectPath2} is not a directory` }));
|
|
168967
169505
|
}
|
|
168968
169506
|
} catch {
|