@massa-ai/mcp-client 1.24.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/config-cli.js
CHANGED
|
@@ -1712,10 +1712,466 @@ var init_utils = __esm(() => {
|
|
|
1712
1712
|
init_rate_limiter();
|
|
1713
1713
|
});
|
|
1714
1714
|
|
|
1715
|
+
// ../../packages/shared/dist/profile-switch/hosts.js
|
|
1716
|
+
import os3 from "os";
|
|
1717
|
+
import path5 from "path";
|
|
1718
|
+
function isHost(v) {
|
|
1719
|
+
return typeof v === "string" && HOSTS.includes(v);
|
|
1720
|
+
}
|
|
1721
|
+
function fileLayout(host, activeDir, activeGlob, variantsRoot) {
|
|
1722
|
+
return {
|
|
1723
|
+
host,
|
|
1724
|
+
route: "files",
|
|
1725
|
+
activeDir,
|
|
1726
|
+
activeGlob,
|
|
1727
|
+
variantsRoot,
|
|
1728
|
+
variantDir: (profile) => path5.join(variantsRoot, profile)
|
|
1729
|
+
};
|
|
1730
|
+
}
|
|
1731
|
+
function resolveHostLayout(host, opts = {}) {
|
|
1732
|
+
const targetHome = opts.targetHome ?? os3.homedir();
|
|
1733
|
+
const override = opts.projectRoot?.[host];
|
|
1734
|
+
switch (host) {
|
|
1735
|
+
case "cursor":
|
|
1736
|
+
return { host, route: "skip", reason: CURSOR_SKIP_REASON };
|
|
1737
|
+
case "claude": {
|
|
1738
|
+
const root = override ?? path5.join(targetHome, ".claude");
|
|
1739
|
+
return fileLayout(host, path5.join(root, "agents"), "massa-ai-*.md", path5.join(root, "massa-ai", "agent-profiles"));
|
|
1740
|
+
}
|
|
1741
|
+
case "codex": {
|
|
1742
|
+
const root = override ?? path5.join(targetHome, ".codex");
|
|
1743
|
+
return fileLayout(host, path5.join(root, "agents"), "massa-ai-*.toml", path5.join(root, "massa-ai", "agent-profiles"));
|
|
1744
|
+
}
|
|
1745
|
+
case "opencode": {
|
|
1746
|
+
const root = override ?? path5.join(targetHome, ".config", "opencode");
|
|
1747
|
+
const pluginsDir = path5.join(root, "plugins", "massa-ai");
|
|
1748
|
+
return fileLayout(host, path5.join(root, "agents"), "massa-ai-*.md", path5.join(pluginsDir, "agent-profiles"));
|
|
1749
|
+
}
|
|
1750
|
+
}
|
|
1751
|
+
}
|
|
1752
|
+
function detectRoute(platform) {
|
|
1753
|
+
const route = platform?.installRoute;
|
|
1754
|
+
if (route === "file")
|
|
1755
|
+
return { kind: "proceed" };
|
|
1756
|
+
if (route === "marketplace") {
|
|
1757
|
+
return {
|
|
1758
|
+
kind: "refuse",
|
|
1759
|
+
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."
|
|
1760
|
+
};
|
|
1761
|
+
}
|
|
1762
|
+
return {
|
|
1763
|
+
kind: "refuse",
|
|
1764
|
+
reason: "no install route recorded \u2014 re-run the installer to record the install route"
|
|
1765
|
+
};
|
|
1766
|
+
}
|
|
1767
|
+
var HOSTS, CURSOR_SKIP_REASON = "all tiers inherit \u2014 Cursor publishes no resolvable model IDs";
|
|
1768
|
+
var init_hosts = __esm(() => {
|
|
1769
|
+
HOSTS = ["claude", "codex", "cursor", "opencode"];
|
|
1770
|
+
});
|
|
1771
|
+
|
|
1772
|
+
// ../../packages/shared/dist/profile-switch/state.js
|
|
1773
|
+
import fs2 from "fs";
|
|
1774
|
+
import path6 from "path";
|
|
1775
|
+
function namedError(name, message) {
|
|
1776
|
+
const err = new InstallStateError(message);
|
|
1777
|
+
err.name = name;
|
|
1778
|
+
return err;
|
|
1779
|
+
}
|
|
1780
|
+
function isPlainObject(v) {
|
|
1781
|
+
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
1782
|
+
}
|
|
1783
|
+
function validateShape(raw2, filePath) {
|
|
1784
|
+
if (!isPlainObject(raw2)) {
|
|
1785
|
+
throw CorruptInstallStateError(filePath, "root is not a JSON object");
|
|
1786
|
+
}
|
|
1787
|
+
if (raw2.platforms !== undefined && !isPlainObject(raw2.platforms)) {
|
|
1788
|
+
throw CorruptInstallStateError(filePath, '"platforms" is present but not an object');
|
|
1789
|
+
}
|
|
1790
|
+
const platforms = isPlainObject(raw2.platforms) ? raw2.platforms : {};
|
|
1791
|
+
return {
|
|
1792
|
+
...raw2,
|
|
1793
|
+
version: typeof raw2.version === "number" ? raw2.version : 2,
|
|
1794
|
+
platforms
|
|
1795
|
+
};
|
|
1796
|
+
}
|
|
1797
|
+
function readInstallState(filePath) {
|
|
1798
|
+
let text;
|
|
1799
|
+
try {
|
|
1800
|
+
text = fs2.readFileSync(filePath, "utf-8");
|
|
1801
|
+
} catch (err) {
|
|
1802
|
+
const code = err.code;
|
|
1803
|
+
if (code === "ENOENT")
|
|
1804
|
+
return DEFAULT_STATE();
|
|
1805
|
+
throw CorruptInstallStateError(filePath, `could not read file: ${err.message}`);
|
|
1806
|
+
}
|
|
1807
|
+
let raw2;
|
|
1808
|
+
try {
|
|
1809
|
+
raw2 = JSON.parse(text);
|
|
1810
|
+
} catch (err) {
|
|
1811
|
+
throw CorruptInstallStateError(filePath, `invalid JSON: ${err.message}`);
|
|
1812
|
+
}
|
|
1813
|
+
return validateShape(raw2, filePath);
|
|
1814
|
+
}
|
|
1815
|
+
function writeInstallState(filePath, state) {
|
|
1816
|
+
const validated = validateShape(state, filePath);
|
|
1817
|
+
const text = `${JSON.stringify(validated, null, 2)}
|
|
1818
|
+
`;
|
|
1819
|
+
try {
|
|
1820
|
+
fs2.mkdirSync(path6.dirname(filePath), { recursive: true });
|
|
1821
|
+
fs2.writeFileSync(filePath, text);
|
|
1822
|
+
} catch (err) {
|
|
1823
|
+
throw UnwritableInstallStateError(filePath, err.message);
|
|
1824
|
+
}
|
|
1825
|
+
}
|
|
1826
|
+
function updatePlatform(filePath, host, patch) {
|
|
1827
|
+
const state = readInstallState(filePath);
|
|
1828
|
+
const existing = isPlainObject(state.platforms[host]) ? state.platforms[host] : { root: "", skills: [], skillsOwner: "plugin" };
|
|
1829
|
+
const merged = { ...existing, ...patch };
|
|
1830
|
+
const next = {
|
|
1831
|
+
...state,
|
|
1832
|
+
platforms: { ...state.platforms, [host]: merged }
|
|
1833
|
+
};
|
|
1834
|
+
writeInstallState(filePath, next);
|
|
1835
|
+
return next;
|
|
1836
|
+
}
|
|
1837
|
+
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: {} });
|
|
1838
|
+
var init_state = __esm(() => {
|
|
1839
|
+
InstallStateError = class InstallStateError extends Error {
|
|
1840
|
+
constructor(message) {
|
|
1841
|
+
super(message);
|
|
1842
|
+
this.name = "InstallStateError";
|
|
1843
|
+
}
|
|
1844
|
+
};
|
|
1845
|
+
});
|
|
1846
|
+
|
|
1847
|
+
// ../../packages/shared/dist/profile-switch/lock.js
|
|
1848
|
+
import fs3 from "fs";
|
|
1849
|
+
import path7 from "path";
|
|
1850
|
+
import os4 from "os";
|
|
1851
|
+
import crypto3 from "crypto";
|
|
1852
|
+
import { execFileSync } from "child_process";
|
|
1853
|
+
function namedError2(name, message) {
|
|
1854
|
+
const err = new LockError(message);
|
|
1855
|
+
err.name = name;
|
|
1856
|
+
return err;
|
|
1857
|
+
}
|
|
1858
|
+
function readOwner(ownerPath) {
|
|
1859
|
+
let raw2;
|
|
1860
|
+
try {
|
|
1861
|
+
raw2 = JSON.parse(fs3.readFileSync(ownerPath, "utf-8"));
|
|
1862
|
+
} catch {
|
|
1863
|
+
return null;
|
|
1864
|
+
}
|
|
1865
|
+
if (typeof raw2 !== "object" || raw2 === null)
|
|
1866
|
+
return null;
|
|
1867
|
+
const r = raw2;
|
|
1868
|
+
if (typeof r.host === "string" && typeof r.pid === "number" && typeof r.processStart === "string" && typeof r.token === "string" && typeof r.timestamp === "number") {
|
|
1869
|
+
return r;
|
|
1870
|
+
}
|
|
1871
|
+
return null;
|
|
1872
|
+
}
|
|
1873
|
+
function releaseIfOwned(lockDir, ownerPath, token) {
|
|
1874
|
+
const owner = readOwner(ownerPath);
|
|
1875
|
+
if (owner === null || owner.token !== token)
|
|
1876
|
+
return;
|
|
1877
|
+
fs3.rmSync(lockDir, { recursive: true, force: true });
|
|
1878
|
+
}
|
|
1879
|
+
function acquireLock(stateFilePath, options = {}) {
|
|
1880
|
+
const lockDir = `${stateFilePath}.switch.lock`;
|
|
1881
|
+
const ownerPath = path7.join(lockDir, "owner.json");
|
|
1882
|
+
const clock = options.clock ?? DEFAULT_CLOCK;
|
|
1883
|
+
const identity = options.identity ?? DEFAULT_IDENTITY;
|
|
1884
|
+
const staleAfterMs = options.staleAfterMs ?? DEFAULT_STALE_AFTER_MS;
|
|
1885
|
+
const createFresh = () => {
|
|
1886
|
+
fs3.mkdirSync(lockDir);
|
|
1887
|
+
const pid = identity.pid();
|
|
1888
|
+
const startedAt = identity.processStart(pid);
|
|
1889
|
+
if (startedAt == null) {
|
|
1890
|
+
fs3.rmSync(lockDir, { recursive: true, force: true });
|
|
1891
|
+
throw LockAcquireError(lockDir, "could not determine this process's start-time identity");
|
|
1892
|
+
}
|
|
1893
|
+
const token = crypto3.randomUUID();
|
|
1894
|
+
const record = {
|
|
1895
|
+
host: identity.hostname(),
|
|
1896
|
+
pid,
|
|
1897
|
+
processStart: startedAt,
|
|
1898
|
+
token,
|
|
1899
|
+
timestamp: clock.now()
|
|
1900
|
+
};
|
|
1901
|
+
fs3.mkdirSync(path7.dirname(ownerPath), { recursive: true });
|
|
1902
|
+
fs3.writeFileSync(ownerPath, JSON.stringify(record));
|
|
1903
|
+
return { lockDir, release: () => releaseIfOwned(lockDir, ownerPath, token) };
|
|
1904
|
+
};
|
|
1905
|
+
try {
|
|
1906
|
+
return createFresh();
|
|
1907
|
+
} catch (err) {
|
|
1908
|
+
if (err.code !== "EEXIST")
|
|
1909
|
+
throw err;
|
|
1910
|
+
}
|
|
1911
|
+
const owner = readOwner(ownerPath);
|
|
1912
|
+
const provenDead = owner !== null && clock.now() - owner.timestamp >= staleAfterMs && identity.processStart(owner.pid) !== owner.processStart;
|
|
1913
|
+
if (!provenDead)
|
|
1914
|
+
throw LockHeldError(lockDir);
|
|
1915
|
+
const reclaimDir = `${lockDir}.reclaim.${owner.token}`;
|
|
1916
|
+
try {
|
|
1917
|
+
fs3.renameSync(lockDir, reclaimDir);
|
|
1918
|
+
} catch {
|
|
1919
|
+
throw LockHeldError(lockDir);
|
|
1920
|
+
}
|
|
1921
|
+
fs3.rmSync(reclaimDir, { recursive: true, force: true });
|
|
1922
|
+
try {
|
|
1923
|
+
return createFresh();
|
|
1924
|
+
} catch {
|
|
1925
|
+
throw LockHeldError(lockDir);
|
|
1926
|
+
}
|
|
1927
|
+
}
|
|
1928
|
+
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;
|
|
1929
|
+
var init_lock = __esm(() => {
|
|
1930
|
+
LockError = class LockError extends Error {
|
|
1931
|
+
constructor(message) {
|
|
1932
|
+
super(message);
|
|
1933
|
+
this.name = "LockError";
|
|
1934
|
+
}
|
|
1935
|
+
};
|
|
1936
|
+
DEFAULT_STALE_AFTER_MS = 5 * 60 * 1000;
|
|
1937
|
+
DEFAULT_CLOCK = { now: () => Date.now() };
|
|
1938
|
+
DEFAULT_IDENTITY = {
|
|
1939
|
+
pid: () => process.pid,
|
|
1940
|
+
hostname: () => os4.hostname(),
|
|
1941
|
+
processStart: (pid) => {
|
|
1942
|
+
try {
|
|
1943
|
+
const out = execFileSync("ps", ["-p", String(pid), "-o", "lstart="], {
|
|
1944
|
+
encoding: "utf-8"
|
|
1945
|
+
}).trim();
|
|
1946
|
+
return out.length > 0 ? out : null;
|
|
1947
|
+
} catch {
|
|
1948
|
+
return null;
|
|
1949
|
+
}
|
|
1950
|
+
}
|
|
1951
|
+
};
|
|
1952
|
+
});
|
|
1953
|
+
|
|
1954
|
+
// ../../packages/shared/dist/profile-switch/engine.js
|
|
1955
|
+
import fs4 from "fs";
|
|
1956
|
+
import path8 from "path";
|
|
1957
|
+
import os5 from "os";
|
|
1958
|
+
import crypto4 from "crypto";
|
|
1959
|
+
function namedError3(name, message) {
|
|
1960
|
+
const err = new SwitchEngineError(message);
|
|
1961
|
+
err.name = name;
|
|
1962
|
+
return err;
|
|
1963
|
+
}
|
|
1964
|
+
function defaultStatePath(targetHome) {
|
|
1965
|
+
return path8.join(targetHome, ".config", "massa-ai", "install-state.json");
|
|
1966
|
+
}
|
|
1967
|
+
function resolveCommon(opts) {
|
|
1968
|
+
const targetHome = opts.targetHome ?? os5.homedir();
|
|
1969
|
+
const stateFilePath = opts.stateFilePath ?? defaultStatePath(targetHome);
|
|
1970
|
+
return { targetHome, stateFilePath };
|
|
1971
|
+
}
|
|
1972
|
+
function listProfiles(opts = {}) {
|
|
1973
|
+
const { targetHome, stateFilePath } = resolveCommon(opts);
|
|
1974
|
+
const state = readInstallState(stateFilePath);
|
|
1975
|
+
const universe = opts.hosts ?? HOSTS;
|
|
1976
|
+
const hosts = universe.map((host) => {
|
|
1977
|
+
const layout = resolveHostLayout(host, { targetHome, projectRoot: opts.projectRoot });
|
|
1978
|
+
if (layout.route === "skip") {
|
|
1979
|
+
return {
|
|
1980
|
+
host,
|
|
1981
|
+
installed: false,
|
|
1982
|
+
skipped: true,
|
|
1983
|
+
skipReason: layout.reason,
|
|
1984
|
+
activeProfile: null,
|
|
1985
|
+
bundleVersion: null,
|
|
1986
|
+
availableProfiles: []
|
|
1987
|
+
};
|
|
1988
|
+
}
|
|
1989
|
+
const installed = fs4.existsSync(layout.activeDir);
|
|
1990
|
+
const availableProfiles = listVariantProfiles(layout);
|
|
1991
|
+
const platform = state.platforms[host];
|
|
1992
|
+
return {
|
|
1993
|
+
host,
|
|
1994
|
+
installed,
|
|
1995
|
+
skipped: false,
|
|
1996
|
+
skipReason: null,
|
|
1997
|
+
activeProfile: platform?.modelProfile?.profile ?? "balanced",
|
|
1998
|
+
bundleVersion: platform?.plugin?.version ?? null,
|
|
1999
|
+
availableProfiles
|
|
2000
|
+
};
|
|
2001
|
+
});
|
|
2002
|
+
return { hosts };
|
|
2003
|
+
}
|
|
2004
|
+
function listVariantProfiles(layout) {
|
|
2005
|
+
if (!fs4.existsSync(layout.variantsRoot))
|
|
2006
|
+
return [];
|
|
2007
|
+
return fs4.readdirSync(layout.variantsRoot, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => e.name).sort();
|
|
2008
|
+
}
|
|
2009
|
+
function matchesGlob(filename, glob) {
|
|
2010
|
+
const starIdx = glob.indexOf("*");
|
|
2011
|
+
if (starIdx === -1)
|
|
2012
|
+
return filename === glob;
|
|
2013
|
+
const prefix = glob.slice(0, starIdx);
|
|
2014
|
+
const suffix = glob.slice(starIdx + 1);
|
|
2015
|
+
return filename.length >= prefix.length + suffix.length && filename.startsWith(prefix) && filename.endsWith(suffix);
|
|
2016
|
+
}
|
|
2017
|
+
function assertStateWritable(stateFilePath) {
|
|
2018
|
+
const dir = path8.dirname(stateFilePath);
|
|
2019
|
+
try {
|
|
2020
|
+
fs4.mkdirSync(dir, { recursive: true });
|
|
2021
|
+
} catch (err) {
|
|
2022
|
+
throw UnwritableInstallStateError(stateFilePath, err.message);
|
|
2023
|
+
}
|
|
2024
|
+
const checkPath = fs4.existsSync(stateFilePath) ? stateFilePath : dir;
|
|
2025
|
+
try {
|
|
2026
|
+
fs4.accessSync(checkPath, fs4.constants.W_OK);
|
|
2027
|
+
} catch (err) {
|
|
2028
|
+
throw UnwritableInstallStateError(stateFilePath, err.message);
|
|
2029
|
+
}
|
|
2030
|
+
}
|
|
2031
|
+
function copyFileRouteVariant(layout, variantDir) {
|
|
2032
|
+
fs4.mkdirSync(layout.activeDir, { recursive: true });
|
|
2033
|
+
let changed = 0;
|
|
2034
|
+
for (const entry of fs4.readdirSync(variantDir, { withFileTypes: true })) {
|
|
2035
|
+
if (!entry.isFile() || !matchesGlob(entry.name, layout.activeGlob))
|
|
2036
|
+
continue;
|
|
2037
|
+
fs4.copyFileSync(path8.join(variantDir, entry.name), path8.join(layout.activeDir, entry.name));
|
|
2038
|
+
changed++;
|
|
2039
|
+
}
|
|
2040
|
+
return changed;
|
|
2041
|
+
}
|
|
2042
|
+
function repointOpencodeVariant(layout, variantDir) {
|
|
2043
|
+
fs4.mkdirSync(layout.activeDir, { recursive: true });
|
|
2044
|
+
let changed = 0;
|
|
2045
|
+
for (const entry of fs4.readdirSync(variantDir, { withFileTypes: true })) {
|
|
2046
|
+
if (!entry.isFile() || !matchesGlob(entry.name, layout.activeGlob))
|
|
2047
|
+
continue;
|
|
2048
|
+
const dest = path8.join(layout.activeDir, entry.name);
|
|
2049
|
+
const target = path8.resolve(path8.join(variantDir, entry.name));
|
|
2050
|
+
let destExists = true;
|
|
2051
|
+
let destIsSymlink = false;
|
|
2052
|
+
try {
|
|
2053
|
+
destIsSymlink = fs4.lstatSync(dest).isSymbolicLink();
|
|
2054
|
+
} catch {
|
|
2055
|
+
destExists = false;
|
|
2056
|
+
}
|
|
2057
|
+
if (destExists && !destIsSymlink)
|
|
2058
|
+
continue;
|
|
2059
|
+
const tmp = `${dest}.massa-ai-switch.${crypto4.randomUUID()}`;
|
|
2060
|
+
fs4.symlinkSync(target, tmp);
|
|
2061
|
+
fs4.renameSync(tmp, dest);
|
|
2062
|
+
changed++;
|
|
2063
|
+
}
|
|
2064
|
+
return changed;
|
|
2065
|
+
}
|
|
2066
|
+
function copyVariant(host, layout, variantDir) {
|
|
2067
|
+
return host === "opencode" ? repointOpencodeVariant(layout, variantDir) : copyFileRouteVariant(layout, variantDir);
|
|
2068
|
+
}
|
|
2069
|
+
function switchProfile(opts) {
|
|
2070
|
+
const { targetHome, stateFilePath } = resolveCommon(opts);
|
|
2071
|
+
const dryRun = opts.dryRun ?? false;
|
|
2072
|
+
const requested = opts.host ? [opts.host] : opts.hosts ?? HOSTS;
|
|
2073
|
+
const universe = HOSTS.filter((h) => requested.includes(h));
|
|
2074
|
+
const state = readInstallState(stateFilePath);
|
|
2075
|
+
if (!dryRun)
|
|
2076
|
+
assertStateWritable(stateFilePath);
|
|
2077
|
+
const layouts = universe.map((host) => ({ host, layout: resolveHostLayout(host, { targetHome, projectRoot: opts.projectRoot }) }));
|
|
2078
|
+
const skipRows = layouts.filter((l) => l.layout.route === "skip").map((l) => ({ host: l.host, status: "skipped", reason: l.layout.reason }));
|
|
2079
|
+
const fileHosts = layouts.filter((l) => l.layout.route === "files");
|
|
2080
|
+
if (fileHosts.length === 0) {
|
|
2081
|
+
return { profile: opts.profile, dryRun, hosts: orderRows(universe, skipRows), restartRequired: false };
|
|
2082
|
+
}
|
|
2083
|
+
const installedFileHosts = fileHosts.filter((h) => fs4.existsSync(h.layout.activeDir));
|
|
2084
|
+
if (installedFileHosts.length === 0)
|
|
2085
|
+
throw NoHostsDetectedError();
|
|
2086
|
+
const withAvailability = fileHosts.map((h) => {
|
|
2087
|
+
const variantsRootExists = fs4.existsSync(h.layout.variantsRoot);
|
|
2088
|
+
const variantDir = h.layout.variantDir(opts.profile);
|
|
2089
|
+
const available = variantsRootExists && fs4.existsSync(variantDir) && fs4.statSync(variantDir).isDirectory();
|
|
2090
|
+
return { ...h, variantsRootExists, variantDir, available };
|
|
2091
|
+
});
|
|
2092
|
+
if (!withAvailability.some((h) => h.available)) {
|
|
2093
|
+
const known = new Set;
|
|
2094
|
+
for (const h of withAvailability) {
|
|
2095
|
+
if (!h.variantsRootExists)
|
|
2096
|
+
continue;
|
|
2097
|
+
for (const name of listVariantProfiles(h.layout))
|
|
2098
|
+
known.add(name);
|
|
2099
|
+
}
|
|
2100
|
+
throw UnknownProfileError(opts.profile, [...known].sort());
|
|
2101
|
+
}
|
|
2102
|
+
const lock = dryRun ? null : acquireLock(stateFilePath, opts.lock);
|
|
2103
|
+
try {
|
|
2104
|
+
const rows = [...skipRows];
|
|
2105
|
+
for (const h of withAvailability) {
|
|
2106
|
+
if (!h.variantsRootExists) {
|
|
2107
|
+
rows.push({ host: h.host, status: "unsupported", reason: "bundle has no variants \u2014 upgrade plugin" });
|
|
2108
|
+
continue;
|
|
2109
|
+
}
|
|
2110
|
+
if (!h.available) {
|
|
2111
|
+
const supported = listVariantProfiles(h.layout);
|
|
2112
|
+
rows.push({
|
|
2113
|
+
host: h.host,
|
|
2114
|
+
status: "unsupported",
|
|
2115
|
+
reason: `profile "${opts.profile}" not supported on ${h.host} (supports: ${supported.join(", ") || "none"})`
|
|
2116
|
+
});
|
|
2117
|
+
continue;
|
|
2118
|
+
}
|
|
2119
|
+
const route = detectRoute(state.platforms[h.host]);
|
|
2120
|
+
if (route.kind === "refuse") {
|
|
2121
|
+
rows.push({ host: h.host, status: "failed", reason: route.reason });
|
|
2122
|
+
continue;
|
|
2123
|
+
}
|
|
2124
|
+
if (dryRun) {
|
|
2125
|
+
rows.push({ host: h.host, status: "switched" });
|
|
2126
|
+
continue;
|
|
2127
|
+
}
|
|
2128
|
+
try {
|
|
2129
|
+
const filesChanged = copyVariant(h.host, h.layout, h.variantDir);
|
|
2130
|
+
updatePlatform(stateFilePath, h.host, {
|
|
2131
|
+
modelProfile: { profile: opts.profile, switchedAt: new Date().toISOString() }
|
|
2132
|
+
});
|
|
2133
|
+
rows.push({ host: h.host, status: "switched", filesChanged });
|
|
2134
|
+
} catch (err) {
|
|
2135
|
+
rows.push({ host: h.host, status: "failed", reason: err.message });
|
|
2136
|
+
}
|
|
2137
|
+
}
|
|
2138
|
+
const ordered = orderRows(universe, rows);
|
|
2139
|
+
const restartRequired = !dryRun && ordered.some((r) => r.status === "switched");
|
|
2140
|
+
return { profile: opts.profile, dryRun, hosts: ordered, restartRequired };
|
|
2141
|
+
} finally {
|
|
2142
|
+
lock?.release();
|
|
2143
|
+
}
|
|
2144
|
+
}
|
|
2145
|
+
function orderRows(universe, rows) {
|
|
2146
|
+
const byHost = new Map(rows.map((r) => [r.host, r]));
|
|
2147
|
+
return HOSTS.filter((h) => universe.includes(h) && byHost.has(h)).map((h) => byHost.get(h));
|
|
2148
|
+
}
|
|
2149
|
+
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");
|
|
2150
|
+
var init_engine = __esm(() => {
|
|
2151
|
+
init_hosts();
|
|
2152
|
+
init_state();
|
|
2153
|
+
init_lock();
|
|
2154
|
+
SwitchEngineError = class SwitchEngineError extends Error {
|
|
2155
|
+
constructor(message) {
|
|
2156
|
+
super(message);
|
|
2157
|
+
this.name = "SwitchEngineError";
|
|
2158
|
+
}
|
|
2159
|
+
};
|
|
2160
|
+
});
|
|
2161
|
+
|
|
2162
|
+
// ../../packages/shared/dist/profile-switch/report.js
|
|
2163
|
+
function reportSucceeded(report) {
|
|
2164
|
+
return report.hosts.every((h) => h.status === "switched" || h.status === "skipped");
|
|
2165
|
+
}
|
|
2166
|
+
|
|
1715
2167
|
// ../../packages/shared/dist/index.js
|
|
1716
2168
|
var init_dist = __esm(() => {
|
|
1717
2169
|
init_env();
|
|
1718
2170
|
init_config();
|
|
2171
|
+
init_hosts();
|
|
2172
|
+
init_state();
|
|
2173
|
+
init_lock();
|
|
2174
|
+
init_engine();
|
|
1719
2175
|
init_types();
|
|
1720
2176
|
init_interfaces();
|
|
1721
2177
|
init_utils();
|
|
@@ -3237,7 +3693,7 @@ var import_brace_expansion, minimatch = (p, pattern, options = {}) => {
|
|
|
3237
3693
|
}, qmarksTestNoExtDot = ([$0]) => {
|
|
3238
3694
|
const len = $0.length;
|
|
3239
3695
|
return (f) => f.length === len && f !== "." && f !== "..";
|
|
3240
|
-
}, defaultPlatform,
|
|
3696
|
+
}, 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) => {
|
|
3241
3697
|
if (!def || typeof def !== "object" || !Object.keys(def).length) {
|
|
3242
3698
|
return minimatch;
|
|
3243
3699
|
}
|
|
@@ -3295,11 +3751,11 @@ var init_esm = __esm(() => {
|
|
|
3295
3751
|
starRE = /^\*+$/;
|
|
3296
3752
|
qmarksRE = /^\?+([^+@!?\*\[\(]*)?$/;
|
|
3297
3753
|
defaultPlatform = typeof process === "object" && process ? typeof process.env === "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
|
|
3298
|
-
|
|
3754
|
+
path9 = {
|
|
3299
3755
|
win32: { sep: "\\" },
|
|
3300
3756
|
posix: { sep: "/" }
|
|
3301
3757
|
};
|
|
3302
|
-
sep = defaultPlatform === "win32" ?
|
|
3758
|
+
sep = defaultPlatform === "win32" ? path9.win32.sep : path9.posix.sep;
|
|
3303
3759
|
minimatch.sep = sep;
|
|
3304
3760
|
GLOBSTAR = Symbol("globstar **");
|
|
3305
3761
|
minimatch.GLOBSTAR = GLOBSTAR;
|
|
@@ -5265,12 +5721,12 @@ var init_esm4 = __esm(() => {
|
|
|
5265
5721
|
childrenCache() {
|
|
5266
5722
|
return this.#children;
|
|
5267
5723
|
}
|
|
5268
|
-
resolve(
|
|
5269
|
-
if (!
|
|
5724
|
+
resolve(path10) {
|
|
5725
|
+
if (!path10) {
|
|
5270
5726
|
return this;
|
|
5271
5727
|
}
|
|
5272
|
-
const rootPath = this.getRootString(
|
|
5273
|
-
const dir =
|
|
5728
|
+
const rootPath = this.getRootString(path10);
|
|
5729
|
+
const dir = path10.substring(rootPath.length);
|
|
5274
5730
|
const dirParts = dir.split(this.splitSep);
|
|
5275
5731
|
const result = rootPath ? this.getRoot(rootPath).#resolveParts(dirParts) : this.#resolveParts(dirParts);
|
|
5276
5732
|
return result;
|
|
@@ -5798,8 +6254,8 @@ var init_esm4 = __esm(() => {
|
|
|
5798
6254
|
newChild(name, type = UNKNOWN, opts = {}) {
|
|
5799
6255
|
return new PathWin32(name, type, this.root, this.roots, this.nocase, this.childrenCache(), opts);
|
|
5800
6256
|
}
|
|
5801
|
-
getRootString(
|
|
5802
|
-
return win32.parse(
|
|
6257
|
+
getRootString(path10) {
|
|
6258
|
+
return win32.parse(path10).root;
|
|
5803
6259
|
}
|
|
5804
6260
|
getRoot(rootPath) {
|
|
5805
6261
|
rootPath = uncToDrive(rootPath.toUpperCase());
|
|
@@ -5824,8 +6280,8 @@ var init_esm4 = __esm(() => {
|
|
|
5824
6280
|
constructor(name, type = UNKNOWN, root, roots, nocase, children, opts) {
|
|
5825
6281
|
super(name, type, root, roots, nocase, children, opts);
|
|
5826
6282
|
}
|
|
5827
|
-
getRootString(
|
|
5828
|
-
return
|
|
6283
|
+
getRootString(path10) {
|
|
6284
|
+
return path10.startsWith("/") ? "/" : "";
|
|
5829
6285
|
}
|
|
5830
6286
|
getRoot(_rootPath) {
|
|
5831
6287
|
return this.root;
|
|
@@ -5844,8 +6300,8 @@ var init_esm4 = __esm(() => {
|
|
|
5844
6300
|
#children;
|
|
5845
6301
|
nocase;
|
|
5846
6302
|
#fs;
|
|
5847
|
-
constructor(cwd = process.cwd(), pathImpl, sep2, { nocase, childrenCacheSize = 16 * 1024, fs:
|
|
5848
|
-
this.#fs = fsFromOption(
|
|
6303
|
+
constructor(cwd = process.cwd(), pathImpl, sep2, { nocase, childrenCacheSize = 16 * 1024, fs: fs5 = defaultFS } = {}) {
|
|
6304
|
+
this.#fs = fsFromOption(fs5);
|
|
5849
6305
|
if (cwd instanceof URL || cwd.startsWith("file://")) {
|
|
5850
6306
|
cwd = fileURLToPath(cwd);
|
|
5851
6307
|
}
|
|
@@ -5881,11 +6337,11 @@ var init_esm4 = __esm(() => {
|
|
|
5881
6337
|
}
|
|
5882
6338
|
this.cwd = prev;
|
|
5883
6339
|
}
|
|
5884
|
-
depth(
|
|
5885
|
-
if (typeof
|
|
5886
|
-
|
|
6340
|
+
depth(path10 = this.cwd) {
|
|
6341
|
+
if (typeof path10 === "string") {
|
|
6342
|
+
path10 = this.cwd.resolve(path10);
|
|
5887
6343
|
}
|
|
5888
|
-
return
|
|
6344
|
+
return path10.depth();
|
|
5889
6345
|
}
|
|
5890
6346
|
childrenCache() {
|
|
5891
6347
|
return this.#children;
|
|
@@ -6301,9 +6757,9 @@ var init_esm4 = __esm(() => {
|
|
|
6301
6757
|
process2();
|
|
6302
6758
|
return results;
|
|
6303
6759
|
}
|
|
6304
|
-
chdir(
|
|
6760
|
+
chdir(path10 = this.cwd) {
|
|
6305
6761
|
const oldCwd = this.cwd;
|
|
6306
|
-
this.cwd = typeof
|
|
6762
|
+
this.cwd = typeof path10 === "string" ? this.cwd.resolve(path10) : path10;
|
|
6307
6763
|
this.cwd[setAsCwd](oldCwd);
|
|
6308
6764
|
}
|
|
6309
6765
|
};
|
|
@@ -6320,8 +6776,8 @@ var init_esm4 = __esm(() => {
|
|
|
6320
6776
|
parseRootPath(dir) {
|
|
6321
6777
|
return win32.parse(dir).root.toUpperCase();
|
|
6322
6778
|
}
|
|
6323
|
-
newRoot(
|
|
6324
|
-
return new PathWin32(this.rootPath, IFDIR, undefined, this.roots, this.nocase, this.childrenCache(), { fs:
|
|
6779
|
+
newRoot(fs5) {
|
|
6780
|
+
return new PathWin32(this.rootPath, IFDIR, undefined, this.roots, this.nocase, this.childrenCache(), { fs: fs5 });
|
|
6325
6781
|
}
|
|
6326
6782
|
isAbsolute(p) {
|
|
6327
6783
|
return p.startsWith("/") || p.startsWith("\\") || /^[a-z]:(\/|\\)/i.test(p);
|
|
@@ -6337,8 +6793,8 @@ var init_esm4 = __esm(() => {
|
|
|
6337
6793
|
parseRootPath(_dir) {
|
|
6338
6794
|
return "/";
|
|
6339
6795
|
}
|
|
6340
|
-
newRoot(
|
|
6341
|
-
return new PathPosix(this.rootPath, IFDIR, undefined, this.roots, this.nocase, this.childrenCache(), { fs:
|
|
6796
|
+
newRoot(fs5) {
|
|
6797
|
+
return new PathPosix(this.rootPath, IFDIR, undefined, this.roots, this.nocase, this.childrenCache(), { fs: fs5 });
|
|
6342
6798
|
}
|
|
6343
6799
|
isAbsolute(p) {
|
|
6344
6800
|
return p.startsWith("/");
|
|
@@ -6595,8 +7051,8 @@ class MatchRecord {
|
|
|
6595
7051
|
this.store.set(target, current === undefined ? n : n & current);
|
|
6596
7052
|
}
|
|
6597
7053
|
entries() {
|
|
6598
|
-
return [...this.store.entries()].map(([
|
|
6599
|
-
|
|
7054
|
+
return [...this.store.entries()].map(([path10, n]) => [
|
|
7055
|
+
path10,
|
|
6600
7056
|
!!(n & 2),
|
|
6601
7057
|
!!(n & 1)
|
|
6602
7058
|
]);
|
|
@@ -6800,9 +7256,9 @@ class GlobUtil {
|
|
|
6800
7256
|
signal;
|
|
6801
7257
|
maxDepth;
|
|
6802
7258
|
includeChildMatches;
|
|
6803
|
-
constructor(patterns,
|
|
7259
|
+
constructor(patterns, path10, opts) {
|
|
6804
7260
|
this.patterns = patterns;
|
|
6805
|
-
this.path =
|
|
7261
|
+
this.path = path10;
|
|
6806
7262
|
this.opts = opts;
|
|
6807
7263
|
this.#sep = !opts.posix && opts.platform === "win32" ? "\\" : "/";
|
|
6808
7264
|
this.includeChildMatches = opts.includeChildMatches !== false;
|
|
@@ -6821,11 +7277,11 @@ class GlobUtil {
|
|
|
6821
7277
|
});
|
|
6822
7278
|
}
|
|
6823
7279
|
}
|
|
6824
|
-
#ignored(
|
|
6825
|
-
return this.seen.has(
|
|
7280
|
+
#ignored(path10) {
|
|
7281
|
+
return this.seen.has(path10) || !!this.#ignore?.ignored?.(path10);
|
|
6826
7282
|
}
|
|
6827
|
-
#childrenIgnored(
|
|
6828
|
-
return !!this.#ignore?.childrenIgnored?.(
|
|
7283
|
+
#childrenIgnored(path10) {
|
|
7284
|
+
return !!this.#ignore?.childrenIgnored?.(path10);
|
|
6829
7285
|
}
|
|
6830
7286
|
pause() {
|
|
6831
7287
|
this.paused = true;
|
|
@@ -7042,8 +7498,8 @@ var init_walker = __esm(() => {
|
|
|
7042
7498
|
init_processor();
|
|
7043
7499
|
GlobWalker = class GlobWalker extends GlobUtil {
|
|
7044
7500
|
matches = new Set;
|
|
7045
|
-
constructor(patterns,
|
|
7046
|
-
super(patterns,
|
|
7501
|
+
constructor(patterns, path10, opts) {
|
|
7502
|
+
super(patterns, path10, opts);
|
|
7047
7503
|
}
|
|
7048
7504
|
matchEmit(e) {
|
|
7049
7505
|
this.matches.add(e);
|
|
@@ -7080,8 +7536,8 @@ var init_walker = __esm(() => {
|
|
|
7080
7536
|
};
|
|
7081
7537
|
GlobStream = class GlobStream extends GlobUtil {
|
|
7082
7538
|
results;
|
|
7083
|
-
constructor(patterns,
|
|
7084
|
-
super(patterns,
|
|
7539
|
+
constructor(patterns, path10, opts) {
|
|
7540
|
+
super(patterns, path10, opts);
|
|
7085
7541
|
this.results = new Minipass({
|
|
7086
7542
|
signal: this.signal,
|
|
7087
7543
|
objectMode: true
|
|
@@ -7509,20 +7965,20 @@ var require_ignore = __commonJS((exports, module) => {
|
|
|
7509
7965
|
var throwError = (message, Ctor) => {
|
|
7510
7966
|
throw new Ctor(message);
|
|
7511
7967
|
};
|
|
7512
|
-
var checkPath = (
|
|
7513
|
-
if (!isString(
|
|
7968
|
+
var checkPath = (path10, originalPath, doThrow) => {
|
|
7969
|
+
if (!isString(path10)) {
|
|
7514
7970
|
return doThrow(`path must be a string, but got \`${originalPath}\``, TypeError);
|
|
7515
7971
|
}
|
|
7516
|
-
if (!
|
|
7972
|
+
if (!path10) {
|
|
7517
7973
|
return doThrow(`path must not be empty`, TypeError);
|
|
7518
7974
|
}
|
|
7519
|
-
if (checkPath.isNotRelative(
|
|
7975
|
+
if (checkPath.isNotRelative(path10)) {
|
|
7520
7976
|
const r = "`path.relative()`d";
|
|
7521
7977
|
return doThrow(`path should be a ${r} string, but got "${originalPath}"`, RangeError);
|
|
7522
7978
|
}
|
|
7523
7979
|
return true;
|
|
7524
7980
|
};
|
|
7525
|
-
var isNotRelative = (
|
|
7981
|
+
var isNotRelative = (path10) => REGEX_TEST_INVALID_PATH.test(path10);
|
|
7526
7982
|
checkPath.isNotRelative = isNotRelative;
|
|
7527
7983
|
checkPath.convert = (p) => p;
|
|
7528
7984
|
|
|
@@ -7565,7 +8021,7 @@ var require_ignore = __commonJS((exports, module) => {
|
|
|
7565
8021
|
addPattern(pattern) {
|
|
7566
8022
|
return this.add(pattern);
|
|
7567
8023
|
}
|
|
7568
|
-
_testOne(
|
|
8024
|
+
_testOne(path10, checkUnignored) {
|
|
7569
8025
|
let ignored = false;
|
|
7570
8026
|
let unignored = false;
|
|
7571
8027
|
this._rules.forEach((rule) => {
|
|
@@ -7573,7 +8029,7 @@ var require_ignore = __commonJS((exports, module) => {
|
|
|
7573
8029
|
if (unignored === negative && ignored !== unignored || negative && !ignored && !unignored && !checkUnignored) {
|
|
7574
8030
|
return;
|
|
7575
8031
|
}
|
|
7576
|
-
const matched = rule.regex.test(
|
|
8032
|
+
const matched = rule.regex.test(path10);
|
|
7577
8033
|
if (matched) {
|
|
7578
8034
|
ignored = !negative;
|
|
7579
8035
|
unignored = negative;
|
|
@@ -7585,39 +8041,39 @@ var require_ignore = __commonJS((exports, module) => {
|
|
|
7585
8041
|
};
|
|
7586
8042
|
}
|
|
7587
8043
|
_test(originalPath, cache, checkUnignored, slices) {
|
|
7588
|
-
const
|
|
7589
|
-
checkPath(
|
|
7590
|
-
return this._t(
|
|
8044
|
+
const path10 = originalPath && checkPath.convert(originalPath);
|
|
8045
|
+
checkPath(path10, originalPath, this._allowRelativePaths ? RETURN_FALSE : throwError);
|
|
8046
|
+
return this._t(path10, cache, checkUnignored, slices);
|
|
7591
8047
|
}
|
|
7592
|
-
_t(
|
|
7593
|
-
if (
|
|
7594
|
-
return cache[
|
|
8048
|
+
_t(path10, cache, checkUnignored, slices) {
|
|
8049
|
+
if (path10 in cache) {
|
|
8050
|
+
return cache[path10];
|
|
7595
8051
|
}
|
|
7596
8052
|
if (!slices) {
|
|
7597
|
-
slices =
|
|
8053
|
+
slices = path10.split(SLASH);
|
|
7598
8054
|
}
|
|
7599
8055
|
slices.pop();
|
|
7600
8056
|
if (!slices.length) {
|
|
7601
|
-
return cache[
|
|
8057
|
+
return cache[path10] = this._testOne(path10, checkUnignored);
|
|
7602
8058
|
}
|
|
7603
8059
|
const parent = this._t(slices.join(SLASH) + SLASH, cache, checkUnignored, slices);
|
|
7604
|
-
return cache[
|
|
8060
|
+
return cache[path10] = parent.ignored ? parent : this._testOne(path10, checkUnignored);
|
|
7605
8061
|
}
|
|
7606
|
-
ignores(
|
|
7607
|
-
return this._test(
|
|
8062
|
+
ignores(path10) {
|
|
8063
|
+
return this._test(path10, this._ignoreCache, false).ignored;
|
|
7608
8064
|
}
|
|
7609
8065
|
createFilter() {
|
|
7610
|
-
return (
|
|
8066
|
+
return (path10) => !this.ignores(path10);
|
|
7611
8067
|
}
|
|
7612
8068
|
filter(paths) {
|
|
7613
8069
|
return makeArray(paths).filter(this.createFilter());
|
|
7614
8070
|
}
|
|
7615
|
-
test(
|
|
7616
|
-
return this._test(
|
|
8071
|
+
test(path10) {
|
|
8072
|
+
return this._test(path10, this._testCache, true);
|
|
7617
8073
|
}
|
|
7618
8074
|
}
|
|
7619
8075
|
var factory = (options) => new Ignore2(options);
|
|
7620
|
-
var isPathValid = (
|
|
8076
|
+
var isPathValid = (path10) => checkPath(path10 && checkPath.convert(path10), path10, RETURN_FALSE);
|
|
7621
8077
|
factory.isPathValid = isPathValid;
|
|
7622
8078
|
factory.default = factory;
|
|
7623
8079
|
module.exports = factory;
|
|
@@ -7625,7 +8081,7 @@ var require_ignore = __commonJS((exports, module) => {
|
|
|
7625
8081
|
const makePosix = (str) => /^\\\\\?\\/.test(str) || /["<>|\u0000-\u001F]+/u.test(str) ? str : str.replace(/\\/g, "/");
|
|
7626
8082
|
checkPath.convert = makePosix;
|
|
7627
8083
|
const REGIX_IS_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i;
|
|
7628
|
-
checkPath.isNotRelative = (
|
|
8084
|
+
checkPath.isNotRelative = (path10) => REGIX_IS_WINDOWS_PATH_ABSOLUTE.test(path10) || isNotRelative(path10);
|
|
7629
8085
|
}
|
|
7630
8086
|
});
|
|
7631
8087
|
|
|
@@ -7687,18 +8143,18 @@ function validatePolicy(policy, opts = {}) {
|
|
|
7687
8143
|
}
|
|
7688
8144
|
}
|
|
7689
8145
|
}
|
|
7690
|
-
function
|
|
8146
|
+
function matchesGlob2(path10, pattern) {
|
|
7691
8147
|
let re = regexCache.get(pattern);
|
|
7692
8148
|
if (!re) {
|
|
7693
8149
|
re = globToRegex(pattern);
|
|
7694
8150
|
regexCache.set(pattern, re);
|
|
7695
8151
|
}
|
|
7696
|
-
return re.test(
|
|
8152
|
+
return re.test(path10);
|
|
7697
8153
|
}
|
|
7698
8154
|
var MAX_MATCH_WORK = 1e5, MAX_IGNORE_PATTERNS2 = 1024, DEFAULT_POLICY, applyPolicy = (filePath, policy) => {
|
|
7699
8155
|
const normalized = filePath.trim();
|
|
7700
8156
|
for (const rule of policy.rules) {
|
|
7701
|
-
if (
|
|
8157
|
+
if (matchesGlob2(normalized, rule.pattern))
|
|
7702
8158
|
return rule.disposition;
|
|
7703
8159
|
}
|
|
7704
8160
|
return "Keep";
|
|
@@ -7744,8 +8200,8 @@ var init_capture_policy = __esm(() => {
|
|
|
7744
8200
|
});
|
|
7745
8201
|
|
|
7746
8202
|
// ../../packages/core/dist/services/search/ignore-patterns.js
|
|
7747
|
-
import
|
|
7748
|
-
import
|
|
8203
|
+
import fs5 from "fs/promises";
|
|
8204
|
+
import path10 from "path";
|
|
7749
8205
|
function buildExtensionGlob(extensions) {
|
|
7750
8206
|
return extensions.map((ext2) => `**/*${ext2}`);
|
|
7751
8207
|
}
|
|
@@ -7768,8 +8224,8 @@ async function loadProjectIgnore(projectPath) {
|
|
|
7768
8224
|
const ig = ignore();
|
|
7769
8225
|
ig.add(DEFAULT_IGNORES);
|
|
7770
8226
|
try {
|
|
7771
|
-
const gitignorePath =
|
|
7772
|
-
const gitignoreContent = await
|
|
8227
|
+
const gitignorePath = path10.join(projectPath, ".gitignore");
|
|
8228
|
+
const gitignoreContent = await fs5.readFile(gitignorePath, "utf8");
|
|
7773
8229
|
const rules = gitignoreContent.split(`
|
|
7774
8230
|
`).map((line) => line.trim()).filter((line) => line && !line.startsWith("#"));
|
|
7775
8231
|
ig.add(rules);
|
|
@@ -9097,7 +9553,7 @@ var require_cert_signatures = __commonJS((exports, module) => {
|
|
|
9097
9553
|
|
|
9098
9554
|
// ../../node_modules/pg/lib/crypto/sasl.js
|
|
9099
9555
|
var require_sasl = __commonJS((exports, module) => {
|
|
9100
|
-
var
|
|
9556
|
+
var crypto5 = require_utils2();
|
|
9101
9557
|
var { signatureAlgorithmHashFromCertificate } = require_cert_signatures();
|
|
9102
9558
|
function saslprep(password) {
|
|
9103
9559
|
const nonAsciiSpace = /[\u00A0\u1680\u2000-\u200B\u202F\u205F\u3000]/g;
|
|
@@ -9116,7 +9572,7 @@ var require_sasl = __commonJS((exports, module) => {
|
|
|
9116
9572
|
if (mechanism === "SCRAM-SHA-256-PLUS" && typeof stream2.getPeerCertificate !== "function") {
|
|
9117
9573
|
throw new Error("SASL: Mechanism SCRAM-SHA-256-PLUS requires a certificate");
|
|
9118
9574
|
}
|
|
9119
|
-
const clientNonce =
|
|
9575
|
+
const clientNonce = crypto5.randomBytes(18).toString("base64");
|
|
9120
9576
|
const gs2Header = mechanism === "SCRAM-SHA-256-PLUS" ? "p=tls-server-end-point" : stream2 ? "y" : "n";
|
|
9121
9577
|
return {
|
|
9122
9578
|
mechanism,
|
|
@@ -9157,20 +9613,20 @@ var require_sasl = __commonJS((exports, module) => {
|
|
|
9157
9613
|
let hashName = signatureAlgorithmHashFromCertificate(peerCert);
|
|
9158
9614
|
if (hashName === "MD5" || hashName === "SHA-1")
|
|
9159
9615
|
hashName = "SHA-256";
|
|
9160
|
-
const certHash = await
|
|
9616
|
+
const certHash = await crypto5.hashByName(hashName, peerCert);
|
|
9161
9617
|
const bindingData = Buffer.concat([Buffer.from("p=tls-server-end-point,,"), Buffer.from(certHash)]);
|
|
9162
9618
|
channelBinding = bindingData.toString("base64");
|
|
9163
9619
|
}
|
|
9164
9620
|
const clientFinalMessageWithoutProof = "c=" + channelBinding + ",r=" + sv.nonce;
|
|
9165
9621
|
const authMessage = clientFirstMessageBare + "," + serverFirstMessage + "," + clientFinalMessageWithoutProof;
|
|
9166
9622
|
const saltBytes = Buffer.from(sv.salt, "base64");
|
|
9167
|
-
const saltedPassword = await
|
|
9168
|
-
const clientKey = await
|
|
9169
|
-
const storedKey = await
|
|
9170
|
-
const clientSignature = await
|
|
9623
|
+
const saltedPassword = await crypto5.deriveKey(saslprep(password), saltBytes, sv.iteration);
|
|
9624
|
+
const clientKey = await crypto5.hmacSha256(saltedPassword, "Client Key");
|
|
9625
|
+
const storedKey = await crypto5.sha256(clientKey);
|
|
9626
|
+
const clientSignature = await crypto5.hmacSha256(storedKey, authMessage);
|
|
9171
9627
|
const clientProof = xorBuffers(Buffer.from(clientKey), Buffer.from(clientSignature)).toString("base64");
|
|
9172
|
-
const serverKey = await
|
|
9173
|
-
const serverSignatureBytes = await
|
|
9628
|
+
const serverKey = await crypto5.hmacSha256(saltedPassword, "Server Key");
|
|
9629
|
+
const serverSignatureBytes = await crypto5.hmacSha256(serverKey, authMessage);
|
|
9174
9630
|
session.message = "SASLResponse";
|
|
9175
9631
|
session.serverSignature = Buffer.from(serverSignatureBytes).toString("base64");
|
|
9176
9632
|
session.response = clientFinalMessageWithoutProof + ",p=" + clientProof;
|
|
@@ -9365,15 +9821,15 @@ var require_pg_connection_string = __commonJS((exports, module) => {
|
|
|
9365
9821
|
if (config2.sslnegotiation === "direct" && config2.ssl === undefined) {
|
|
9366
9822
|
config2.ssl = true;
|
|
9367
9823
|
}
|
|
9368
|
-
const
|
|
9824
|
+
const fs6 = config2.sslcert || config2.sslkey || config2.sslrootcert ? __require("fs") : null;
|
|
9369
9825
|
if (config2.sslcert) {
|
|
9370
|
-
config2.ssl.cert =
|
|
9826
|
+
config2.ssl.cert = fs6.readFileSync(config2.sslcert).toString();
|
|
9371
9827
|
}
|
|
9372
9828
|
if (config2.sslkey) {
|
|
9373
|
-
config2.ssl.key =
|
|
9829
|
+
config2.ssl.key = fs6.readFileSync(config2.sslkey).toString();
|
|
9374
9830
|
}
|
|
9375
9831
|
if (config2.sslrootcert) {
|
|
9376
|
-
config2.ssl.ca =
|
|
9832
|
+
config2.ssl.ca = fs6.readFileSync(config2.sslrootcert).toString();
|
|
9377
9833
|
}
|
|
9378
9834
|
if (options.useLibpqCompat && config2.uselibpqcompat) {
|
|
9379
9835
|
throw new Error("Both useLibpqCompat and uselibpqcompat are set. Please use only one of them.");
|
|
@@ -11087,7 +11543,7 @@ var require_split2 = __commonJS((exports, module) => {
|
|
|
11087
11543
|
|
|
11088
11544
|
// ../../node_modules/pgpass/lib/helper.js
|
|
11089
11545
|
var require_helper = __commonJS((exports, module) => {
|
|
11090
|
-
var
|
|
11546
|
+
var path11 = __require("path");
|
|
11091
11547
|
var Stream2 = __require("stream").Stream;
|
|
11092
11548
|
var split = require_split2();
|
|
11093
11549
|
var util = __require("util");
|
|
@@ -11127,7 +11583,7 @@ var require_helper = __commonJS((exports, module) => {
|
|
|
11127
11583
|
};
|
|
11128
11584
|
exports.getFileName = function(rawEnv) {
|
|
11129
11585
|
var env = rawEnv || process.env;
|
|
11130
|
-
var file = env.PGPASSFILE || (isWin ?
|
|
11586
|
+
var file = env.PGPASSFILE || (isWin ? path11.join(env.APPDATA || "./", "postgresql", "pgpass.conf") : path11.join(env.HOME || "./", ".pgpass"));
|
|
11131
11587
|
return file;
|
|
11132
11588
|
};
|
|
11133
11589
|
exports.usePgPass = function(stats, fname) {
|
|
@@ -11251,16 +11707,16 @@ var require_helper = __commonJS((exports, module) => {
|
|
|
11251
11707
|
|
|
11252
11708
|
// ../../node_modules/pgpass/lib/index.js
|
|
11253
11709
|
var require_lib = __commonJS((exports, module) => {
|
|
11254
|
-
var
|
|
11255
|
-
var
|
|
11710
|
+
var path11 = __require("path");
|
|
11711
|
+
var fs6 = __require("fs");
|
|
11256
11712
|
var helper = require_helper();
|
|
11257
11713
|
module.exports = function(connInfo, cb) {
|
|
11258
11714
|
var file = helper.getFileName();
|
|
11259
|
-
|
|
11715
|
+
fs6.stat(file, function(err, stat) {
|
|
11260
11716
|
if (err || !helper.usePgPass(stat, file)) {
|
|
11261
11717
|
return cb(undefined);
|
|
11262
11718
|
}
|
|
11263
|
-
var st =
|
|
11719
|
+
var st = fs6.createReadStream(file);
|
|
11264
11720
|
helper.getPassword(connInfo, st, cb);
|
|
11265
11721
|
});
|
|
11266
11722
|
};
|
|
@@ -11278,7 +11734,7 @@ var require_client = __commonJS((exports, module) => {
|
|
|
11278
11734
|
var Query = require_query();
|
|
11279
11735
|
var defaults2 = require_defaults();
|
|
11280
11736
|
var Connection = require_connection();
|
|
11281
|
-
var
|
|
11737
|
+
var crypto5 = require_utils2();
|
|
11282
11738
|
var activeQueryDeprecationNotice = nodeUtils.deprecate(() => {}, "Client.activeQuery is deprecated and will be removed in pg@9.0");
|
|
11283
11739
|
var queryQueueDeprecationNotice = nodeUtils.deprecate(() => {}, "Client.queryQueue is deprecated and will be removed in pg@9.0.");
|
|
11284
11740
|
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.");
|
|
@@ -11510,7 +11966,7 @@ var require_client = __commonJS((exports, module) => {
|
|
|
11510
11966
|
_handleAuthMD5Password(msg) {
|
|
11511
11967
|
this._getPassword(async () => {
|
|
11512
11968
|
try {
|
|
11513
|
-
const hashedPassword = await
|
|
11969
|
+
const hashedPassword = await crypto5.postgresMd5PasswordHash(this.user, this.password, msg.salt);
|
|
11514
11970
|
this.connection.password(hashedPassword);
|
|
11515
11971
|
} catch (e) {
|
|
11516
11972
|
this.emit("error", e);
|
|
@@ -12877,8 +13333,8 @@ var init_alias_resolver = __esm(() => {
|
|
|
12877
13333
|
});
|
|
12878
13334
|
|
|
12879
13335
|
// ../../packages/core/dist/services/search/index-manager.js
|
|
12880
|
-
import
|
|
12881
|
-
import
|
|
13336
|
+
import fs6 from "fs";
|
|
13337
|
+
import path11 from "path";
|
|
12882
13338
|
|
|
12883
13339
|
class IndexManager {
|
|
12884
13340
|
metadataCache = new Map;
|
|
@@ -12971,9 +13427,9 @@ class IndexManager {
|
|
|
12971
13427
|
const fileMetadata = {};
|
|
12972
13428
|
let totalSize = 0;
|
|
12973
13429
|
for (const filePath of indexedFiles) {
|
|
12974
|
-
const fullPath =
|
|
13430
|
+
const fullPath = path11.join(projectPath, filePath);
|
|
12975
13431
|
try {
|
|
12976
|
-
const stat = await
|
|
13432
|
+
const stat = await fs6.promises.stat(fullPath);
|
|
12977
13433
|
fileMetadata[filePath] = {
|
|
12978
13434
|
path: filePath,
|
|
12979
13435
|
mtime: stat.mtimeMs,
|
|
@@ -13024,9 +13480,9 @@ class IndexManager {
|
|
|
13024
13480
|
if (ig.ignores(match2)) {
|
|
13025
13481
|
continue;
|
|
13026
13482
|
}
|
|
13027
|
-
const fullPath =
|
|
13483
|
+
const fullPath = path11.join(projectPath, match2);
|
|
13028
13484
|
try {
|
|
13029
|
-
const stat = await
|
|
13485
|
+
const stat = await fs6.promises.stat(fullPath);
|
|
13030
13486
|
files.set(match2, {
|
|
13031
13487
|
path: match2,
|
|
13032
13488
|
mtime: stat.mtimeMs,
|
|
@@ -13345,7 +13801,7 @@ __export(exports_util, {
|
|
|
13345
13801
|
jsonStringifyReplacer: () => jsonStringifyReplacer,
|
|
13346
13802
|
joinValues: () => joinValues,
|
|
13347
13803
|
issue: () => issue,
|
|
13348
|
-
isPlainObject: () =>
|
|
13804
|
+
isPlainObject: () => isPlainObject2,
|
|
13349
13805
|
isObject: () => isObject,
|
|
13350
13806
|
hexToUint8Array: () => hexToUint8Array,
|
|
13351
13807
|
getSizableOrigin: () => getSizableOrigin,
|
|
@@ -13477,10 +13933,10 @@ function mergeDefs(...defs) {
|
|
|
13477
13933
|
function cloneDef(schema) {
|
|
13478
13934
|
return mergeDefs(schema._zod.def);
|
|
13479
13935
|
}
|
|
13480
|
-
function getElementAtPath(obj,
|
|
13481
|
-
if (!
|
|
13936
|
+
function getElementAtPath(obj, path12) {
|
|
13937
|
+
if (!path12)
|
|
13482
13938
|
return obj;
|
|
13483
|
-
return
|
|
13939
|
+
return path12.reduce((acc, key) => acc?.[key], obj);
|
|
13484
13940
|
}
|
|
13485
13941
|
function promiseAllObject(promisesObj) {
|
|
13486
13942
|
const keys = Object.keys(promisesObj);
|
|
@@ -13510,7 +13966,7 @@ function slugify(input) {
|
|
|
13510
13966
|
function isObject(data) {
|
|
13511
13967
|
return typeof data === "object" && data !== null && !Array.isArray(data);
|
|
13512
13968
|
}
|
|
13513
|
-
function
|
|
13969
|
+
function isPlainObject2(o) {
|
|
13514
13970
|
if (isObject(o) === false)
|
|
13515
13971
|
return false;
|
|
13516
13972
|
const ctor = o.constructor;
|
|
@@ -13527,7 +13983,7 @@ function isPlainObject(o) {
|
|
|
13527
13983
|
return true;
|
|
13528
13984
|
}
|
|
13529
13985
|
function shallowClone(o) {
|
|
13530
|
-
if (
|
|
13986
|
+
if (isPlainObject2(o))
|
|
13531
13987
|
return { ...o };
|
|
13532
13988
|
if (Array.isArray(o))
|
|
13533
13989
|
return [...o];
|
|
@@ -13667,7 +14123,7 @@ function omit(schema, mask) {
|
|
|
13667
14123
|
return clone(schema, def);
|
|
13668
14124
|
}
|
|
13669
14125
|
function extend(schema, shape) {
|
|
13670
|
-
if (!
|
|
14126
|
+
if (!isPlainObject2(shape)) {
|
|
13671
14127
|
throw new Error("Invalid input to extend: expected a plain object");
|
|
13672
14128
|
}
|
|
13673
14129
|
const checks = schema._zod.def.checks;
|
|
@@ -13690,7 +14146,7 @@ function extend(schema, shape) {
|
|
|
13690
14146
|
return clone(schema, def);
|
|
13691
14147
|
}
|
|
13692
14148
|
function safeExtend(schema, shape) {
|
|
13693
|
-
if (!
|
|
14149
|
+
if (!isPlainObject2(shape)) {
|
|
13694
14150
|
throw new Error("Invalid input to safeExtend: expected a plain object");
|
|
13695
14151
|
}
|
|
13696
14152
|
const def = mergeDefs(schema._zod.def, {
|
|
@@ -13808,11 +14264,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
13808
14264
|
}
|
|
13809
14265
|
return false;
|
|
13810
14266
|
}
|
|
13811
|
-
function prefixIssues(
|
|
14267
|
+
function prefixIssues(path12, issues) {
|
|
13812
14268
|
return issues.map((iss) => {
|
|
13813
14269
|
var _a3;
|
|
13814
14270
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
13815
|
-
iss.path.unshift(
|
|
14271
|
+
iss.path.unshift(path12);
|
|
13816
14272
|
return iss;
|
|
13817
14273
|
});
|
|
13818
14274
|
}
|
|
@@ -14025,16 +14481,16 @@ function flattenError(error, mapper = (issue2) => issue2.message) {
|
|
|
14025
14481
|
}
|
|
14026
14482
|
function formatError(error, mapper = (issue2) => issue2.message) {
|
|
14027
14483
|
const fieldErrors = { _errors: [] };
|
|
14028
|
-
const processError = (error2,
|
|
14484
|
+
const processError = (error2, path12 = []) => {
|
|
14029
14485
|
for (const issue2 of error2.issues) {
|
|
14030
14486
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
14031
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
14487
|
+
issue2.errors.map((issues) => processError({ issues }, [...path12, ...issue2.path]));
|
|
14032
14488
|
} else if (issue2.code === "invalid_key") {
|
|
14033
|
-
processError({ issues: issue2.issues }, [...
|
|
14489
|
+
processError({ issues: issue2.issues }, [...path12, ...issue2.path]);
|
|
14034
14490
|
} else if (issue2.code === "invalid_element") {
|
|
14035
|
-
processError({ issues: issue2.issues }, [...
|
|
14491
|
+
processError({ issues: issue2.issues }, [...path12, ...issue2.path]);
|
|
14036
14492
|
} else {
|
|
14037
|
-
const fullpath = [...
|
|
14493
|
+
const fullpath = [...path12, ...issue2.path];
|
|
14038
14494
|
if (fullpath.length === 0) {
|
|
14039
14495
|
fieldErrors._errors.push(mapper(issue2));
|
|
14040
14496
|
} else {
|
|
@@ -14061,17 +14517,17 @@ function formatError(error, mapper = (issue2) => issue2.message) {
|
|
|
14061
14517
|
}
|
|
14062
14518
|
function treeifyError(error, mapper = (issue2) => issue2.message) {
|
|
14063
14519
|
const result = { errors: [] };
|
|
14064
|
-
const processError = (error2,
|
|
14520
|
+
const processError = (error2, path12 = []) => {
|
|
14065
14521
|
var _a3, _b;
|
|
14066
14522
|
for (const issue2 of error2.issues) {
|
|
14067
14523
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
14068
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
14524
|
+
issue2.errors.map((issues) => processError({ issues }, [...path12, ...issue2.path]));
|
|
14069
14525
|
} else if (issue2.code === "invalid_key") {
|
|
14070
|
-
processError({ issues: issue2.issues }, [...
|
|
14526
|
+
processError({ issues: issue2.issues }, [...path12, ...issue2.path]);
|
|
14071
14527
|
} else if (issue2.code === "invalid_element") {
|
|
14072
|
-
processError({ issues: issue2.issues }, [...
|
|
14528
|
+
processError({ issues: issue2.issues }, [...path12, ...issue2.path]);
|
|
14073
14529
|
} else {
|
|
14074
|
-
const fullpath = [...
|
|
14530
|
+
const fullpath = [...path12, ...issue2.path];
|
|
14075
14531
|
if (fullpath.length === 0) {
|
|
14076
14532
|
result.errors.push(mapper(issue2));
|
|
14077
14533
|
continue;
|
|
@@ -14103,8 +14559,8 @@ function treeifyError(error, mapper = (issue2) => issue2.message) {
|
|
|
14103
14559
|
}
|
|
14104
14560
|
function toDotPath(_path) {
|
|
14105
14561
|
const segs = [];
|
|
14106
|
-
const
|
|
14107
|
-
for (const seg of
|
|
14562
|
+
const path12 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
14563
|
+
for (const seg of path12) {
|
|
14108
14564
|
if (typeof seg === "number")
|
|
14109
14565
|
segs.push(`[${seg}]`);
|
|
14110
14566
|
else if (typeof seg === "symbol")
|
|
@@ -15173,7 +15629,7 @@ function mergeValues(a, b) {
|
|
|
15173
15629
|
if (a instanceof Date && b instanceof Date && +a === +b) {
|
|
15174
15630
|
return { valid: true, data: a };
|
|
15175
15631
|
}
|
|
15176
|
-
if (
|
|
15632
|
+
if (isPlainObject2(a) && isPlainObject2(b)) {
|
|
15177
15633
|
const bKeys = Object.keys(b);
|
|
15178
15634
|
const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1);
|
|
15179
15635
|
const newObj = { ...a, ...b };
|
|
@@ -16430,7 +16886,7 @@ var init_schemas = __esm(() => {
|
|
|
16430
16886
|
$ZodType.init(inst, def);
|
|
16431
16887
|
inst._zod.parse = (payload, ctx) => {
|
|
16432
16888
|
const input = payload.value;
|
|
16433
|
-
if (!
|
|
16889
|
+
if (!isPlainObject2(input)) {
|
|
16434
16890
|
payload.issues.push({
|
|
16435
16891
|
expected: "record",
|
|
16436
16892
|
code: "invalid_type",
|
|
@@ -27107,13 +27563,13 @@ function resolveRef(ref, ctx) {
|
|
|
27107
27563
|
if (!ref.startsWith("#")) {
|
|
27108
27564
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
27109
27565
|
}
|
|
27110
|
-
const
|
|
27111
|
-
if (
|
|
27566
|
+
const path12 = ref.slice(1).split("/").filter(Boolean);
|
|
27567
|
+
if (path12.length === 0) {
|
|
27112
27568
|
return ctx.rootSchema;
|
|
27113
27569
|
}
|
|
27114
27570
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
27115
|
-
if (
|
|
27116
|
-
const key =
|
|
27571
|
+
if (path12[0] === defsKey) {
|
|
27572
|
+
const key = path12[1];
|
|
27117
27573
|
if (!key || !ctx.defs[key]) {
|
|
27118
27574
|
throw new Error(`Reference not found: ${ref}`);
|
|
27119
27575
|
}
|
|
@@ -28602,8 +29058,8 @@ class ParseStatus {
|
|
|
28602
29058
|
}
|
|
28603
29059
|
}
|
|
28604
29060
|
var makeIssue = (params) => {
|
|
28605
|
-
const { data, path:
|
|
28606
|
-
const fullPath = [...
|
|
29061
|
+
const { data, path: path12, errorMaps, issueData } = params;
|
|
29062
|
+
const fullPath = [...path12, ...issueData.path || []];
|
|
28607
29063
|
const fullIssue = {
|
|
28608
29064
|
...issueData,
|
|
28609
29065
|
path: fullPath
|
|
@@ -28648,11 +29104,11 @@ var init_errorUtil = __esm(() => {
|
|
|
28648
29104
|
|
|
28649
29105
|
// ../../node_modules/zod/v3/types.js
|
|
28650
29106
|
class ParseInputLazyPath {
|
|
28651
|
-
constructor(parent, value,
|
|
29107
|
+
constructor(parent, value, path12, key) {
|
|
28652
29108
|
this._cachedPath = [];
|
|
28653
29109
|
this.parent = parent;
|
|
28654
29110
|
this.data = value;
|
|
28655
|
-
this._path =
|
|
29111
|
+
this._path = path12;
|
|
28656
29112
|
this._key = key;
|
|
28657
29113
|
}
|
|
28658
29114
|
get path() {
|
|
@@ -34717,23 +35173,23 @@ var require_auth_config = __commonJS((exports, module) => {
|
|
|
34717
35173
|
writeAuthConfig: () => writeAuthConfig
|
|
34718
35174
|
});
|
|
34719
35175
|
module.exports = __toCommonJS2(auth_config_exports);
|
|
34720
|
-
var
|
|
34721
|
-
var
|
|
35176
|
+
var fs7 = __toESM2(__require("fs"));
|
|
35177
|
+
var path12 = __toESM2(__require("path"));
|
|
34722
35178
|
var import_token_util = require_token_util();
|
|
34723
35179
|
function getAuthConfigPath() {
|
|
34724
35180
|
const dataDir = (0, import_token_util.getVercelDataDir)();
|
|
34725
35181
|
if (!dataDir) {
|
|
34726
35182
|
throw new Error(`Unable to find Vercel CLI data directory. Your platform: ${process.platform}. Supported: darwin, linux, win32.`);
|
|
34727
35183
|
}
|
|
34728
|
-
return
|
|
35184
|
+
return path12.join(dataDir, "auth.json");
|
|
34729
35185
|
}
|
|
34730
35186
|
function readAuthConfig() {
|
|
34731
35187
|
try {
|
|
34732
35188
|
const authPath = getAuthConfigPath();
|
|
34733
|
-
if (!
|
|
35189
|
+
if (!fs7.existsSync(authPath)) {
|
|
34734
35190
|
return null;
|
|
34735
35191
|
}
|
|
34736
|
-
const content =
|
|
35192
|
+
const content = fs7.readFileSync(authPath, "utf8");
|
|
34737
35193
|
if (!content) {
|
|
34738
35194
|
return null;
|
|
34739
35195
|
}
|
|
@@ -34744,11 +35200,11 @@ var require_auth_config = __commonJS((exports, module) => {
|
|
|
34744
35200
|
}
|
|
34745
35201
|
function writeAuthConfig(config3) {
|
|
34746
35202
|
const authPath = getAuthConfigPath();
|
|
34747
|
-
const authDir =
|
|
34748
|
-
if (!
|
|
34749
|
-
|
|
35203
|
+
const authDir = path12.dirname(authPath);
|
|
35204
|
+
if (!fs7.existsSync(authDir)) {
|
|
35205
|
+
fs7.mkdirSync(authDir, { mode: 504, recursive: true });
|
|
34750
35206
|
}
|
|
34751
|
-
|
|
35207
|
+
fs7.writeFileSync(authPath, JSON.stringify(config3, null, 2), { mode: 384 });
|
|
34752
35208
|
}
|
|
34753
35209
|
function isValidAccessToken(authConfig, expirationBufferMs = 0) {
|
|
34754
35210
|
if (!authConfig.token)
|
|
@@ -34923,8 +35379,8 @@ var require_token_util = __commonJS((exports, module) => {
|
|
|
34923
35379
|
saveToken: () => saveToken
|
|
34924
35380
|
});
|
|
34925
35381
|
module.exports = __toCommonJS2(token_util_exports);
|
|
34926
|
-
var
|
|
34927
|
-
var
|
|
35382
|
+
var path12 = __toESM2(__require("path"));
|
|
35383
|
+
var fs7 = __toESM2(__require("fs"));
|
|
34928
35384
|
var import_token_error = require_token_error();
|
|
34929
35385
|
var import_token_io = require_token_io();
|
|
34930
35386
|
var import_auth_config = require_auth_config();
|
|
@@ -34936,7 +35392,7 @@ var require_token_util = __commonJS((exports, module) => {
|
|
|
34936
35392
|
if (!dataDir) {
|
|
34937
35393
|
return null;
|
|
34938
35394
|
}
|
|
34939
|
-
return
|
|
35395
|
+
return path12.join(dataDir, vercelFolder);
|
|
34940
35396
|
}
|
|
34941
35397
|
async function getVercelToken2(options) {
|
|
34942
35398
|
const authConfig = (0, import_auth_config.readAuthConfig)();
|
|
@@ -35004,11 +35460,11 @@ var require_token_util = __commonJS((exports, module) => {
|
|
|
35004
35460
|
if (!dir) {
|
|
35005
35461
|
throw new import_token_error.VercelOidcTokenError("Unable to find project root directory. Have you linked your project with `vc link?`");
|
|
35006
35462
|
}
|
|
35007
|
-
const prjPath =
|
|
35008
|
-
if (!
|
|
35463
|
+
const prjPath = path12.join(dir, ".vercel", "project.json");
|
|
35464
|
+
if (!fs7.existsSync(prjPath)) {
|
|
35009
35465
|
throw new import_token_error.VercelOidcTokenError("project.json not found, have you linked your project with `vc link?`");
|
|
35010
35466
|
}
|
|
35011
|
-
const prj = JSON.parse(
|
|
35467
|
+
const prj = JSON.parse(fs7.readFileSync(prjPath, "utf8"));
|
|
35012
35468
|
if (typeof prj.projectId !== "string" && typeof prj.orgId !== "string") {
|
|
35013
35469
|
throw new TypeError("Expected a string-valued projectId property. Try running `vc link` to re-link your project.");
|
|
35014
35470
|
}
|
|
@@ -35019,11 +35475,11 @@ var require_token_util = __commonJS((exports, module) => {
|
|
|
35019
35475
|
if (!dir) {
|
|
35020
35476
|
throw new import_token_error.VercelOidcTokenError("Unable to find user data directory. Please reach out to Vercel support.");
|
|
35021
35477
|
}
|
|
35022
|
-
const tokenPath =
|
|
35478
|
+
const tokenPath = path12.join(dir, "com.vercel.token", `${projectId}.json`);
|
|
35023
35479
|
const tokenJson = JSON.stringify(token);
|
|
35024
|
-
|
|
35025
|
-
|
|
35026
|
-
|
|
35480
|
+
fs7.mkdirSync(path12.dirname(tokenPath), { mode: 504, recursive: true });
|
|
35481
|
+
fs7.writeFileSync(tokenPath, tokenJson);
|
|
35482
|
+
fs7.chmodSync(tokenPath, 432);
|
|
35027
35483
|
return;
|
|
35028
35484
|
}
|
|
35029
35485
|
function loadToken(projectId) {
|
|
@@ -35031,11 +35487,11 @@ var require_token_util = __commonJS((exports, module) => {
|
|
|
35031
35487
|
if (!dir) {
|
|
35032
35488
|
throw new import_token_error.VercelOidcTokenError("Unable to find user data directory. Please reach out to Vercel support.");
|
|
35033
35489
|
}
|
|
35034
|
-
const tokenPath =
|
|
35035
|
-
if (!
|
|
35490
|
+
const tokenPath = path12.join(dir, "com.vercel.token", `${projectId}.json`);
|
|
35491
|
+
if (!fs7.existsSync(tokenPath)) {
|
|
35036
35492
|
return null;
|
|
35037
35493
|
}
|
|
35038
|
-
const token = JSON.parse(
|
|
35494
|
+
const token = JSON.parse(fs7.readFileSync(tokenPath, "utf8"));
|
|
35039
35495
|
assertVercelOidcTokenResponse(token);
|
|
35040
35496
|
return token;
|
|
35041
35497
|
}
|
|
@@ -45877,37 +46333,37 @@ function createOpenAI(options = {}) {
|
|
|
45877
46333
|
}, `ai-sdk/openai/${VERSION4}`);
|
|
45878
46334
|
const createChatModel = (modelId) => new OpenAIChatLanguageModel(modelId, {
|
|
45879
46335
|
provider: `${providerName}.chat`,
|
|
45880
|
-
url: ({ path:
|
|
46336
|
+
url: ({ path: path12 }) => `${baseURL}${path12}`,
|
|
45881
46337
|
headers: getHeaders,
|
|
45882
46338
|
fetch: options.fetch
|
|
45883
46339
|
});
|
|
45884
46340
|
const createCompletionModel = (modelId) => new OpenAICompletionLanguageModel(modelId, {
|
|
45885
46341
|
provider: `${providerName}.completion`,
|
|
45886
|
-
url: ({ path:
|
|
46342
|
+
url: ({ path: path12 }) => `${baseURL}${path12}`,
|
|
45887
46343
|
headers: getHeaders,
|
|
45888
46344
|
fetch: options.fetch
|
|
45889
46345
|
});
|
|
45890
46346
|
const createEmbeddingModel = (modelId) => new OpenAIEmbeddingModel(modelId, {
|
|
45891
46347
|
provider: `${providerName}.embedding`,
|
|
45892
|
-
url: ({ path:
|
|
46348
|
+
url: ({ path: path12 }) => `${baseURL}${path12}`,
|
|
45893
46349
|
headers: getHeaders,
|
|
45894
46350
|
fetch: options.fetch
|
|
45895
46351
|
});
|
|
45896
46352
|
const createImageModel = (modelId) => new OpenAIImageModel(modelId, {
|
|
45897
46353
|
provider: `${providerName}.image`,
|
|
45898
|
-
url: ({ path:
|
|
46354
|
+
url: ({ path: path12 }) => `${baseURL}${path12}`,
|
|
45899
46355
|
headers: getHeaders,
|
|
45900
46356
|
fetch: options.fetch
|
|
45901
46357
|
});
|
|
45902
46358
|
const createTranscriptionModel = (modelId) => new OpenAITranscriptionModel(modelId, {
|
|
45903
46359
|
provider: `${providerName}.transcription`,
|
|
45904
|
-
url: ({ path:
|
|
46360
|
+
url: ({ path: path12 }) => `${baseURL}${path12}`,
|
|
45905
46361
|
headers: getHeaders,
|
|
45906
46362
|
fetch: options.fetch
|
|
45907
46363
|
});
|
|
45908
46364
|
const createSpeechModel = (modelId) => new OpenAISpeechModel(modelId, {
|
|
45909
46365
|
provider: `${providerName}.speech`,
|
|
45910
|
-
url: ({ path:
|
|
46366
|
+
url: ({ path: path12 }) => `${baseURL}${path12}`,
|
|
45911
46367
|
headers: getHeaders,
|
|
45912
46368
|
fetch: options.fetch
|
|
45913
46369
|
});
|
|
@@ -45920,7 +46376,7 @@ function createOpenAI(options = {}) {
|
|
|
45920
46376
|
const createResponsesModel = (modelId) => {
|
|
45921
46377
|
return new OpenAIResponsesLanguageModel(modelId, {
|
|
45922
46378
|
provider: `${providerName}.responses`,
|
|
45923
|
-
url: ({ path:
|
|
46379
|
+
url: ({ path: path12 }) => `${baseURL}${path12}`,
|
|
45924
46380
|
headers: getHeaders,
|
|
45925
46381
|
fetch: options.fetch,
|
|
45926
46382
|
fileIdPrefixes: ["file-"]
|
|
@@ -62453,26 +62909,26 @@ var require_process = __commonJS((exports, module) => {
|
|
|
62453
62909
|
|
|
62454
62910
|
// ../../node_modules/detect-libc/lib/filesystem.js
|
|
62455
62911
|
var require_filesystem = __commonJS((exports, module) => {
|
|
62456
|
-
var
|
|
62912
|
+
var fs7 = __require("fs");
|
|
62457
62913
|
var LDD_PATH = "/usr/bin/ldd";
|
|
62458
62914
|
var SELF_PATH = "/proc/self/exe";
|
|
62459
62915
|
var MAX_LENGTH = 2048;
|
|
62460
|
-
var readFileSync2 = (
|
|
62461
|
-
const fd =
|
|
62916
|
+
var readFileSync2 = (path12) => {
|
|
62917
|
+
const fd = fs7.openSync(path12, "r");
|
|
62462
62918
|
const buffer = Buffer.alloc(MAX_LENGTH);
|
|
62463
|
-
const bytesRead =
|
|
62464
|
-
|
|
62919
|
+
const bytesRead = fs7.readSync(fd, buffer, 0, MAX_LENGTH, 0);
|
|
62920
|
+
fs7.close(fd, () => {});
|
|
62465
62921
|
return buffer.subarray(0, bytesRead);
|
|
62466
62922
|
};
|
|
62467
|
-
var readFile = (
|
|
62468
|
-
|
|
62923
|
+
var readFile = (path12) => new Promise((resolve4, reject) => {
|
|
62924
|
+
fs7.open(path12, "r", (err, fd) => {
|
|
62469
62925
|
if (err) {
|
|
62470
62926
|
reject(err);
|
|
62471
62927
|
} else {
|
|
62472
62928
|
const buffer = Buffer.alloc(MAX_LENGTH);
|
|
62473
|
-
|
|
62929
|
+
fs7.read(fd, buffer, 0, MAX_LENGTH, 0, (_, bytesRead) => {
|
|
62474
62930
|
resolve4(buffer.subarray(0, bytesRead));
|
|
62475
|
-
|
|
62931
|
+
fs7.close(fd, () => {});
|
|
62476
62932
|
});
|
|
62477
62933
|
}
|
|
62478
62934
|
});
|
|
@@ -62577,11 +63033,11 @@ var require_detect_libc = __commonJS((exports, module) => {
|
|
|
62577
63033
|
}
|
|
62578
63034
|
return null;
|
|
62579
63035
|
};
|
|
62580
|
-
var familyFromInterpreterPath = (
|
|
62581
|
-
if (
|
|
62582
|
-
if (
|
|
63036
|
+
var familyFromInterpreterPath = (path12) => {
|
|
63037
|
+
if (path12) {
|
|
63038
|
+
if (path12.includes("/ld-musl-")) {
|
|
62583
63039
|
return MUSL;
|
|
62584
|
-
} else if (
|
|
63040
|
+
} else if (path12.includes("/ld-linux-")) {
|
|
62585
63041
|
return GLIBC;
|
|
62586
63042
|
}
|
|
62587
63043
|
}
|
|
@@ -62626,8 +63082,8 @@ var require_detect_libc = __commonJS((exports, module) => {
|
|
|
62626
63082
|
cachedFamilyInterpreter = null;
|
|
62627
63083
|
try {
|
|
62628
63084
|
const selfContent = await readFile(SELF_PATH);
|
|
62629
|
-
const
|
|
62630
|
-
cachedFamilyInterpreter = familyFromInterpreterPath(
|
|
63085
|
+
const path12 = interpreterPath(selfContent);
|
|
63086
|
+
cachedFamilyInterpreter = familyFromInterpreterPath(path12);
|
|
62631
63087
|
} catch (e) {}
|
|
62632
63088
|
return cachedFamilyInterpreter;
|
|
62633
63089
|
};
|
|
@@ -62638,8 +63094,8 @@ var require_detect_libc = __commonJS((exports, module) => {
|
|
|
62638
63094
|
cachedFamilyInterpreter = null;
|
|
62639
63095
|
try {
|
|
62640
63096
|
const selfContent = readFileSync2(SELF_PATH);
|
|
62641
|
-
const
|
|
62642
|
-
cachedFamilyInterpreter = familyFromInterpreterPath(
|
|
63097
|
+
const path12 = interpreterPath(selfContent);
|
|
63098
|
+
cachedFamilyInterpreter = familyFromInterpreterPath(path12);
|
|
62643
63099
|
} catch (e) {}
|
|
62644
63100
|
return cachedFamilyInterpreter;
|
|
62645
63101
|
};
|
|
@@ -64301,18 +64757,18 @@ var require_sharp = __commonJS((exports, module) => {
|
|
|
64301
64757
|
`@img/sharp-${runtimePlatform}/sharp.node`,
|
|
64302
64758
|
"@img/sharp-wasm32/sharp.node"
|
|
64303
64759
|
];
|
|
64304
|
-
var
|
|
64760
|
+
var path12;
|
|
64305
64761
|
var sharp;
|
|
64306
64762
|
var errors4 = [];
|
|
64307
|
-
for (
|
|
64763
|
+
for (path12 of paths) {
|
|
64308
64764
|
try {
|
|
64309
|
-
sharp = __require(
|
|
64765
|
+
sharp = __require(path12);
|
|
64310
64766
|
break;
|
|
64311
64767
|
} catch (err) {
|
|
64312
64768
|
errors4.push(err);
|
|
64313
64769
|
}
|
|
64314
64770
|
}
|
|
64315
|
-
if (sharp &&
|
|
64771
|
+
if (sharp && path12.startsWith("@img/sharp-linux-x64") && !sharp._isUsingX64V2()) {
|
|
64316
64772
|
const err = new Error("Prebuilt binaries for linux-x64 require v2 microarchitecture");
|
|
64317
64773
|
err.code = "Unsupported CPU";
|
|
64318
64774
|
errors4.push(err);
|
|
@@ -64321,7 +64777,7 @@ var require_sharp = __commonJS((exports, module) => {
|
|
|
64321
64777
|
if (sharp) {
|
|
64322
64778
|
module.exports = sharp;
|
|
64323
64779
|
} else {
|
|
64324
|
-
const [isLinux, isMacOs, isWindows] = ["linux", "darwin", "win32"].map((
|
|
64780
|
+
const [isLinux, isMacOs, isWindows] = ["linux", "darwin", "win32"].map((os6) => runtimePlatform.startsWith(os6));
|
|
64325
64781
|
const help = [`Could not load the "sharp" module using the ${runtimePlatform} runtime`];
|
|
64326
64782
|
errors4.forEach((err) => {
|
|
64327
64783
|
if (err.code !== "MODULE_NOT_FOUND") {
|
|
@@ -64334,9 +64790,9 @@ var require_sharp = __commonJS((exports, module) => {
|
|
|
64334
64790
|
const { found, expected } = isUnsupportedNodeRuntime();
|
|
64335
64791
|
help.push("- Please upgrade Node.js:", ` Found ${found}`, ` Requires ${expected}`);
|
|
64336
64792
|
} else if (prebuiltPlatforms.includes(runtimePlatform)) {
|
|
64337
|
-
const [
|
|
64338
|
-
const libc =
|
|
64339
|
-
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=${
|
|
64793
|
+
const [os6, cpu] = runtimePlatform.split("-");
|
|
64794
|
+
const libc = os6.endsWith("musl") ? " --libc=musl" : "";
|
|
64795
|
+
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`);
|
|
64340
64796
|
} else {
|
|
64341
64797
|
help.push(`- Manually install libvips >= ${minimumLibvipsVersion}`, "- Add experimental WebAssembly-based dependencies:", " npm install --cpu=wasm32 sharp", " npm install @img/sharp-wasm32");
|
|
64342
64798
|
}
|
|
@@ -67174,15 +67630,15 @@ var require_color = __commonJS((exports, module) => {
|
|
|
67174
67630
|
};
|
|
67175
67631
|
}
|
|
67176
67632
|
function wrapConversion(toModel, graph) {
|
|
67177
|
-
const
|
|
67633
|
+
const path12 = [graph[toModel].parent, toModel];
|
|
67178
67634
|
let fn = conversions_default[graph[toModel].parent][toModel];
|
|
67179
67635
|
let cur = graph[toModel].parent;
|
|
67180
67636
|
while (graph[cur].parent) {
|
|
67181
|
-
|
|
67637
|
+
path12.unshift(graph[cur].parent);
|
|
67182
67638
|
fn = link(conversions_default[graph[cur].parent][cur], fn);
|
|
67183
67639
|
cur = graph[cur].parent;
|
|
67184
67640
|
}
|
|
67185
|
-
fn.conversion =
|
|
67641
|
+
fn.conversion = path12;
|
|
67186
67642
|
return fn;
|
|
67187
67643
|
}
|
|
67188
67644
|
function route(fromModel) {
|
|
@@ -67787,7 +68243,7 @@ var require_output = __commonJS((exports, module) => {
|
|
|
67787
68243
|
Copyright 2013 Lovell Fuller and others.
|
|
67788
68244
|
SPDX-License-Identifier: Apache-2.0
|
|
67789
68245
|
*/
|
|
67790
|
-
var
|
|
68246
|
+
var path12 = __require("path");
|
|
67791
68247
|
var is = require_is();
|
|
67792
68248
|
var sharp = require_sharp();
|
|
67793
68249
|
var formats = new Map([
|
|
@@ -67818,9 +68274,9 @@ var require_output = __commonJS((exports, module) => {
|
|
|
67818
68274
|
let err;
|
|
67819
68275
|
if (!is.string(fileOut)) {
|
|
67820
68276
|
err = new Error("Missing output file path");
|
|
67821
|
-
} else if (is.string(this.options.input.file) &&
|
|
68277
|
+
} else if (is.string(this.options.input.file) && path12.resolve(this.options.input.file) === path12.resolve(fileOut)) {
|
|
67822
68278
|
err = new Error("Cannot use same file for input and output");
|
|
67823
|
-
} else if (jp2Regex.test(
|
|
68279
|
+
} else if (jp2Regex.test(path12.extname(fileOut)) && !this.constructor.format.jp2k.output.file) {
|
|
67824
68280
|
err = errJp2Save();
|
|
67825
68281
|
}
|
|
67826
68282
|
if (err) {
|
|
@@ -75067,11 +75523,11 @@ var init_transformers_node = __esm(() => {
|
|
|
75067
75523
|
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}).`);
|
|
75068
75524
|
}
|
|
75069
75525
|
for (let i = 0;i < num_chunks; ++i) {
|
|
75070
|
-
const
|
|
75071
|
-
const fullPath = `${options.subfolder ?? ""}/${
|
|
75526
|
+
const path12 = `${baseName}_data${i === 0 ? "" : "_" + i}`;
|
|
75527
|
+
const fullPath = `${options.subfolder ?? ""}/${path12}`;
|
|
75072
75528
|
externalDataPromises.push(new Promise(async (resolve4, reject) => {
|
|
75073
75529
|
const data = await (0, _utils_hub_js__WEBPACK_IMPORTED_MODULE_5__.getModelFile)(pretrained_model_name_or_path, fullPath, true, options, return_path);
|
|
75074
|
-
resolve4(data instanceof Uint8Array ? { path:
|
|
75530
|
+
resolve4(data instanceof Uint8Array ? { path: path12, data } : path12);
|
|
75075
75531
|
}));
|
|
75076
75532
|
}
|
|
75077
75533
|
} else if (session_options.externalData !== undefined) {
|
|
@@ -88135,7 +88591,7 @@ ${fake_token_around_image}` + `${global_img_token}` + image_token.repeat(image_s
|
|
|
88135
88591
|
const blob = new Blob([wav], { type: "audio/wav" });
|
|
88136
88592
|
return blob;
|
|
88137
88593
|
}
|
|
88138
|
-
async save(
|
|
88594
|
+
async save(path12) {
|
|
88139
88595
|
let fn;
|
|
88140
88596
|
if (_env_js__WEBPACK_IMPORTED_MODULE_3__.apis.IS_BROWSER_ENV) {
|
|
88141
88597
|
if (_env_js__WEBPACK_IMPORTED_MODULE_3__.apis.IS_WEBWORKER_ENV) {
|
|
@@ -88143,14 +88599,14 @@ ${fake_token_around_image}` + `${global_img_token}` + image_token.repeat(image_s
|
|
|
88143
88599
|
}
|
|
88144
88600
|
fn = _core_js__WEBPACK_IMPORTED_MODULE_2__.saveBlob;
|
|
88145
88601
|
} else if (_env_js__WEBPACK_IMPORTED_MODULE_3__.apis.IS_FS_AVAILABLE) {
|
|
88146
|
-
fn = async (
|
|
88602
|
+
fn = async (path13, blob) => {
|
|
88147
88603
|
let buffer = await blob.arrayBuffer();
|
|
88148
|
-
node_fs__WEBPACK_IMPORTED_MODULE_5__["default"].writeFileSync(
|
|
88604
|
+
node_fs__WEBPACK_IMPORTED_MODULE_5__["default"].writeFileSync(path13, Buffer.from(buffer));
|
|
88149
88605
|
};
|
|
88150
88606
|
} else {
|
|
88151
88607
|
throw new Error("Unable to save because filesystem is disabled in this environment.");
|
|
88152
88608
|
}
|
|
88153
|
-
await fn(
|
|
88609
|
+
await fn(path12, this.toBlob());
|
|
88154
88610
|
}
|
|
88155
88611
|
}
|
|
88156
88612
|
},
|
|
@@ -88246,11 +88702,11 @@ ${fake_token_around_image}` + `${global_img_token}` + image_token.repeat(image_s
|
|
|
88246
88702
|
function calculateReflectOffset(i, w) {
|
|
88247
88703
|
return Math.abs((i + w) % (2 * w) - w);
|
|
88248
88704
|
}
|
|
88249
|
-
function saveBlob(
|
|
88705
|
+
function saveBlob(path12, blob) {
|
|
88250
88706
|
const dataURL = URL.createObjectURL(blob);
|
|
88251
88707
|
const downloadLink = document.createElement("a");
|
|
88252
88708
|
downloadLink.href = dataURL;
|
|
88253
|
-
downloadLink.download =
|
|
88709
|
+
downloadLink.download = path12;
|
|
88254
88710
|
downloadLink.click();
|
|
88255
88711
|
downloadLink.remove();
|
|
88256
88712
|
URL.revokeObjectURL(dataURL);
|
|
@@ -88851,8 +89307,8 @@ ${fake_token_around_image}` + `${global_img_token}` + image_token.repeat(image_s
|
|
|
88851
89307
|
}
|
|
88852
89308
|
|
|
88853
89309
|
class FileCache {
|
|
88854
|
-
constructor(
|
|
88855
|
-
this.path =
|
|
89310
|
+
constructor(path12) {
|
|
89311
|
+
this.path = path12;
|
|
88856
89312
|
}
|
|
88857
89313
|
async match(request) {
|
|
88858
89314
|
let filePath = node_path__WEBPACK_IMPORTED_MODULE_1__["default"].join(this.path, request);
|
|
@@ -89608,20 +90064,20 @@ ${fake_token_around_image}` + `${global_img_token}` + image_token.repeat(image_s
|
|
|
89608
90064
|
}
|
|
89609
90065
|
return this;
|
|
89610
90066
|
}
|
|
89611
|
-
async save(
|
|
90067
|
+
async save(path12) {
|
|
89612
90068
|
if (IS_BROWSER_OR_WEBWORKER) {
|
|
89613
90069
|
if (_env_js__WEBPACK_IMPORTED_MODULE_2__.apis.IS_WEBWORKER_ENV) {
|
|
89614
90070
|
throw new Error("Unable to save an image from a Web Worker.");
|
|
89615
90071
|
}
|
|
89616
|
-
const extension =
|
|
90072
|
+
const extension = path12.split(".").pop().toLowerCase();
|
|
89617
90073
|
const mime = CONTENT_TYPE_MAP.get(extension) ?? "image/png";
|
|
89618
90074
|
const blob = await this.toBlob(mime);
|
|
89619
|
-
(0, _core_js__WEBPACK_IMPORTED_MODULE_0__.saveBlob)(
|
|
90075
|
+
(0, _core_js__WEBPACK_IMPORTED_MODULE_0__.saveBlob)(path12, blob);
|
|
89620
90076
|
} else if (!_env_js__WEBPACK_IMPORTED_MODULE_2__.apis.IS_FS_AVAILABLE) {
|
|
89621
90077
|
throw new Error("Unable to save the image because filesystem is disabled in this environment.");
|
|
89622
90078
|
} else {
|
|
89623
90079
|
const img = this.toSharp();
|
|
89624
|
-
return await img.toFile(
|
|
90080
|
+
return await img.toFile(path12);
|
|
89625
90081
|
}
|
|
89626
90082
|
}
|
|
89627
90083
|
toSharp() {
|
|
@@ -98826,7 +99282,7 @@ Note that ${s.bold("include")} statements only accept relation fields.`, a;
|
|
|
98826
99282
|
function ns(e = Yo, t = Yo) {
|
|
98827
99283
|
return (r) => e(t(r));
|
|
98828
99284
|
}
|
|
98829
|
-
function
|
|
99285
|
+
function os6({ dataPath: e, modelName: t, args: r, runtimeDataModel: n }) {
|
|
98830
99286
|
let i = { modelName: t, args: r ?? {} }, o = dp(e);
|
|
98831
99287
|
if (!o || o.length === 0)
|
|
98832
99288
|
return i;
|
|
@@ -99131,10 +99587,10 @@ Note that ${s.bold("include")} statements only accept relation fields.`, a;
|
|
|
99131
99587
|
super(t, "P2023", r);
|
|
99132
99588
|
}
|
|
99133
99589
|
};
|
|
99134
|
-
var
|
|
99590
|
+
var fs7 = new WeakMap;
|
|
99135
99591
|
function Ep(e) {
|
|
99136
|
-
let t =
|
|
99137
|
-
return t || (t = Object.entries(e),
|
|
99592
|
+
let t = fs7.get(e);
|
|
99593
|
+
return t || (t = Object.entries(e), fs7.set(e, t)), t;
|
|
99138
99594
|
}
|
|
99139
99595
|
function hs(e, t, r) {
|
|
99140
99596
|
switch (t.type) {
|
|
@@ -102699,7 +103155,7 @@ new PrismaClient({
|
|
|
102699
103155
|
let m = await es(this, d);
|
|
102700
103156
|
if (!d.model)
|
|
102701
103157
|
return m;
|
|
102702
|
-
let g =
|
|
103158
|
+
let g = os6({ dataPath: d.dataPath, modelName: d.model, args: d.args, runtimeDataModel: this._runtimeDataModel });
|
|
102703
103159
|
return Wo({ result: m, modelName: g.modelName, args: g.args, extensions: this._extensions, runtimeDataModel: this._runtimeDataModel, globalOmit: this._globalOmit });
|
|
102704
103160
|
};
|
|
102705
103161
|
return this._tracingHelper.runInChildSpan(s.operation, () => new zl.AsyncResource("prisma-client-request").runInAsyncScope(() => a(o)));
|
|
@@ -103102,7 +103558,7 @@ var require_prisma = __commonJS((exports) => {
|
|
|
103102
103558
|
Prisma.JsonNull = JsonNull2;
|
|
103103
103559
|
Prisma.AnyNull = AnyNull2;
|
|
103104
103560
|
Prisma.NullTypes = NullTypes2;
|
|
103105
|
-
var
|
|
103561
|
+
var path12 = __require("path");
|
|
103106
103562
|
exports.Prisma.TransactionIsolationLevel = makeStrictEnum2({
|
|
103107
103563
|
ReadUncommitted: "ReadUncommitted",
|
|
103108
103564
|
ReadCommitted: "ReadCommitted",
|
|
@@ -109062,7 +109518,7 @@ var init_vector_store_factory = __esm(() => {
|
|
|
109062
109518
|
});
|
|
109063
109519
|
|
|
109064
109520
|
// ../../packages/core/dist/services/search/search-cache-pg.js
|
|
109065
|
-
import
|
|
109521
|
+
import crypto5 from "crypto";
|
|
109066
109522
|
|
|
109067
109523
|
class SearchCachePg {
|
|
109068
109524
|
pool = null;
|
|
@@ -109119,7 +109575,7 @@ class SearchCachePg {
|
|
|
109119
109575
|
projectId,
|
|
109120
109576
|
options: this.normalizeOptions(options)
|
|
109121
109577
|
});
|
|
109122
|
-
return
|
|
109578
|
+
return crypto5.createHash("sha256").update(payload).digest("hex");
|
|
109123
109579
|
}
|
|
109124
109580
|
normalizeOptions(options) {
|
|
109125
109581
|
const searchAffectingParams = [
|
|
@@ -115848,10 +116304,10 @@ var init_chunker_code = __esm(() => {
|
|
|
115848
116304
|
});
|
|
115849
116305
|
|
|
115850
116306
|
// ../../packages/core/dist/services/search/smart-chunker.js
|
|
115851
|
-
import
|
|
116307
|
+
import path12 from "path";
|
|
115852
116308
|
function smartChunk(content, filePath, config3 = {}) {
|
|
115853
116309
|
const cfg = { ...DEFAULT_CONFIG, ...config3 };
|
|
115854
|
-
const ext2 =
|
|
116310
|
+
const ext2 = path12.extname(filePath).toLowerCase();
|
|
115855
116311
|
const relativePath = filePath;
|
|
115856
116312
|
const fileImports = isCodeFile(ext2) ? extractFileImports(content, ext2) : undefined;
|
|
115857
116313
|
let chunks;
|
|
@@ -116158,8 +116614,8 @@ var init_managed_run_repository_pg = __esm(() => {
|
|
|
116158
116614
|
});
|
|
116159
116615
|
|
|
116160
116616
|
// ../../packages/core/dist/services/search/project-indexer.js
|
|
116161
|
-
import
|
|
116162
|
-
import
|
|
116617
|
+
import fs7 from "fs/promises";
|
|
116618
|
+
import path13 from "path";
|
|
116163
116619
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
116164
116620
|
async function runWithIndexLock(lockMap, projectId, work) {
|
|
116165
116621
|
const prevLock = lockMap.get(projectId);
|
|
@@ -116202,7 +116658,7 @@ async function indexProjectInternal(deps, projectPath, projectId, options = {})
|
|
|
116202
116658
|
dot: false
|
|
116203
116659
|
});
|
|
116204
116660
|
const filteredFiles = files.filter((file2) => {
|
|
116205
|
-
const relativePath =
|
|
116661
|
+
const relativePath = path13.relative(projectPath, file2);
|
|
116206
116662
|
const shouldIgnore = ig.ignores(relativePath);
|
|
116207
116663
|
if (shouldIgnore) {
|
|
116208
116664
|
logger.debug("Ignoring file per .gitignore during indexing", {
|
|
@@ -116242,7 +116698,7 @@ async function indexProjectInternal(deps, projectPath, projectId, options = {})
|
|
|
116242
116698
|
});
|
|
116243
116699
|
}
|
|
116244
116700
|
}
|
|
116245
|
-
const indexedFilesList = filteredFiles.map((f) =>
|
|
116701
|
+
const indexedFilesList = filteredFiles.map((f) => path13.relative(projectPath, f));
|
|
116246
116702
|
await deps.indexManager.updateIndexMetadata(projectId, projectPath, indexedFilesList);
|
|
116247
116703
|
logger.info("Project indexing completed", {
|
|
116248
116704
|
projectId,
|
|
@@ -116367,7 +116823,7 @@ async function ensureFreshIndex(deps, projectId, projectPath, options = {}) {
|
|
|
116367
116823
|
let errors4 = 0;
|
|
116368
116824
|
for (const relativeFilePath of filesToReindex) {
|
|
116369
116825
|
try {
|
|
116370
|
-
const fullPath =
|
|
116826
|
+
const fullPath = path13.join(projectPath, relativeFilePath);
|
|
116371
116827
|
const result = await deps.indexFile(fullPath, projectId, projectPath, centralityMap);
|
|
116372
116828
|
filesIndexed++;
|
|
116373
116829
|
chunksIndexed += result.chunks;
|
|
@@ -116418,8 +116874,8 @@ async function checkSearchAdmission(deps, projectId, projectPath) {
|
|
|
116418
116874
|
}
|
|
116419
116875
|
async function indexFile(deps, filePath, projectId, projectRoot, centralityMap) {
|
|
116420
116876
|
projectId = await getProjectIdentityAliasResolver().resolve(projectId);
|
|
116421
|
-
const content = await
|
|
116422
|
-
const relativePath =
|
|
116877
|
+
const content = await fs7.readFile(filePath, "utf-8");
|
|
116878
|
+
const relativePath = path13.relative(projectRoot, filePath);
|
|
116423
116879
|
const maxFileSize = config.get("security").maxFileSize || 1024 * 1024;
|
|
116424
116880
|
if (content.length > maxFileSize) {
|
|
116425
116881
|
logger.warn("File too large, skipping", {
|
|
@@ -116439,7 +116895,7 @@ async function indexFile(deps, filePath, projectId, projectRoot, centralityMap)
|
|
|
116439
116895
|
chunkIndex: i,
|
|
116440
116896
|
totalChunks: chunks.length,
|
|
116441
116897
|
type: chunk.type,
|
|
116442
|
-
language:
|
|
116898
|
+
language: path13.extname(filePath).slice(1),
|
|
116443
116899
|
lineStart: chunk.lineStart,
|
|
116444
116900
|
lineEnd: chunk.lineEnd,
|
|
116445
116901
|
label: chunk.label,
|
|
@@ -119770,16 +120226,16 @@ function detectRoutes(httpEdges, defs, opts = {}) {
|
|
|
119770
120226
|
const seen = new Set;
|
|
119771
120227
|
const out = [];
|
|
119772
120228
|
for (const e of httpEdges) {
|
|
119773
|
-
const
|
|
119774
|
-
if (!
|
|
120229
|
+
const path14 = e.route;
|
|
120230
|
+
if (!path14)
|
|
119775
120231
|
continue;
|
|
119776
120232
|
const method = (e.method ?? "ANY").toUpperCase();
|
|
119777
|
-
const key = method + " " +
|
|
120233
|
+
const key = method + " " + path14;
|
|
119778
120234
|
if (seen.has(key))
|
|
119779
120235
|
continue;
|
|
119780
120236
|
seen.add(key);
|
|
119781
120237
|
out.push({
|
|
119782
|
-
path:
|
|
120238
|
+
path: path14,
|
|
119783
120239
|
method: e.method,
|
|
119784
120240
|
file: e.fromFile,
|
|
119785
120241
|
handler: e.targetFqn ?? e.symbolName
|
|
@@ -119790,12 +120246,12 @@ function detectRoutes(httpEdges, defs, opts = {}) {
|
|
|
119790
120246
|
continue;
|
|
119791
120247
|
const parsed = parseRouteName(d.name);
|
|
119792
120248
|
const method = parsed?.method ?? "ANY";
|
|
119793
|
-
const
|
|
119794
|
-
const key = method + " " +
|
|
120249
|
+
const path14 = parsed?.path ?? d.name;
|
|
120250
|
+
const key = method + " " + path14;
|
|
119795
120251
|
if (seen.has(key))
|
|
119796
120252
|
continue;
|
|
119797
120253
|
seen.add(key);
|
|
119798
|
-
out.push({ path:
|
|
120254
|
+
out.push({ path: path14, method: parsed?.method, file: d.filePath, handler: d.name });
|
|
119799
120255
|
}
|
|
119800
120256
|
for (const d of defs) {
|
|
119801
120257
|
const parsed = parseRouteName(d.name);
|
|
@@ -120016,8 +120472,8 @@ __export(exports_symbol_graph_service, {
|
|
|
120016
120472
|
symbolGraphService: () => symbolGraphService,
|
|
120017
120473
|
SymbolGraphService: () => SymbolGraphService
|
|
120018
120474
|
});
|
|
120019
|
-
import
|
|
120020
|
-
import
|
|
120475
|
+
import path14 from "path";
|
|
120476
|
+
import fs8 from "fs/promises";
|
|
120021
120477
|
|
|
120022
120478
|
class SymbolGraphService {
|
|
120023
120479
|
identityLookup;
|
|
@@ -120345,7 +120801,7 @@ class SymbolGraphService {
|
|
|
120345
120801
|
async readSnippet(relativePath, lineStart, lineEnd, projectId) {
|
|
120346
120802
|
try {
|
|
120347
120803
|
const absolutePath = await this.resolveToAbsolute(relativePath, projectId);
|
|
120348
|
-
const content = await
|
|
120804
|
+
const content = await fs8.readFile(absolutePath, "utf-8");
|
|
120349
120805
|
const lines = content.split(`
|
|
120350
120806
|
`);
|
|
120351
120807
|
return lines.slice(Math.max(0, lineStart - 1), Math.min(lines.length, lineEnd)).join(`
|
|
@@ -120357,7 +120813,7 @@ class SymbolGraphService {
|
|
|
120357
120813
|
async readContext(relativePath, lineNumber, contextLines, projectId) {
|
|
120358
120814
|
try {
|
|
120359
120815
|
const absolutePath = await this.resolveToAbsolute(relativePath, projectId);
|
|
120360
|
-
const content = await
|
|
120816
|
+
const content = await fs8.readFile(absolutePath, "utf-8");
|
|
120361
120817
|
const lines = content.split(`
|
|
120362
120818
|
`);
|
|
120363
120819
|
const start = Math.max(0, lineNumber - contextLines - 1);
|
|
@@ -120370,7 +120826,7 @@ class SymbolGraphService {
|
|
|
120370
120826
|
}
|
|
120371
120827
|
async resolveToAbsolute(relativePath, projectId) {
|
|
120372
120828
|
const root = await this.getProjectRoot(projectId);
|
|
120373
|
-
return root ?
|
|
120829
|
+
return root ? path14.resolve(root, relativePath) : relativePath;
|
|
120374
120830
|
}
|
|
120375
120831
|
async getProjectRoot(projectId) {
|
|
120376
120832
|
const cached2 = this.projectRootCache.get(projectId);
|
|
@@ -120741,7 +121197,7 @@ var init_context_controller = __esm(() => {
|
|
|
120741
121197
|
});
|
|
120742
121198
|
|
|
120743
121199
|
// ../../packages/core/dist/services/executor/runtime.js
|
|
120744
|
-
import { execFileSync, execSync } from "child_process";
|
|
121200
|
+
import { execFileSync as execFileSync2, execSync } from "child_process";
|
|
120745
121201
|
function commandExists(cmd) {
|
|
120746
121202
|
try {
|
|
120747
121203
|
const check2 = isWindows ? `where ${cmd}` : `command -v ${cmd}`;
|
|
@@ -120774,7 +121230,7 @@ function getVersion(cmd, args = ["--version"], deps) {
|
|
|
120774
121230
|
timeout: 5000
|
|
120775
121231
|
}).trim().split(/\r?\n/)[0];
|
|
120776
121232
|
}
|
|
120777
|
-
return
|
|
121233
|
+
return execFileSync2(cmd, args, {
|
|
120778
121234
|
encoding: "utf-8",
|
|
120779
121235
|
stdio: ["pipe", "pipe", "pipe"],
|
|
120780
121236
|
timeout: 5000
|
|
@@ -120915,12 +121371,12 @@ var init_runtime = __esm(() => {
|
|
|
120915
121371
|
|
|
120916
121372
|
// ../../packages/core/dist/services/executor/sandbox.js
|
|
120917
121373
|
import { realpathSync as realpathSync2 } from "fs";
|
|
120918
|
-
import { execFileSync as
|
|
121374
|
+
import { execFileSync as execFileSync3 } from "child_process";
|
|
120919
121375
|
function isDockerAvailable() {
|
|
120920
121376
|
if (_dockerAvailable !== null)
|
|
120921
121377
|
return _dockerAvailable;
|
|
120922
121378
|
try {
|
|
120923
|
-
|
|
121379
|
+
execFileSync3("docker", ["--version"], { stdio: "pipe", timeout: 5000 });
|
|
120924
121380
|
_dockerAvailable = true;
|
|
120925
121381
|
} catch {
|
|
120926
121382
|
_dockerAvailable = false;
|
|
@@ -120931,7 +121387,7 @@ function isSeatbeltAvailable() {
|
|
|
120931
121387
|
if (_seatbeltAvailable !== null)
|
|
120932
121388
|
return _seatbeltAvailable;
|
|
120933
121389
|
try {
|
|
120934
|
-
|
|
121390
|
+
execFileSync3("sandbox-exec", ["--version"], { stdio: "pipe", timeout: 5000 });
|
|
120935
121391
|
_seatbeltAvailable = true;
|
|
120936
121392
|
} catch {
|
|
120937
121393
|
_seatbeltAvailable = false;
|
|
@@ -121036,7 +121492,7 @@ var init_sandbox = __esm(() => {
|
|
|
121036
121492
|
});
|
|
121037
121493
|
|
|
121038
121494
|
// ../../packages/core/dist/services/executor/executor.js
|
|
121039
|
-
import { spawn, execSync as execSync2, execFileSync as
|
|
121495
|
+
import { spawn, execSync as execSync2, execFileSync as execFileSync4 } from "child_process";
|
|
121040
121496
|
import { mkdtempSync, writeFileSync as writeFileSync2, rmSync, realpathSync as realpathSync3 } from "fs";
|
|
121041
121497
|
import { join as join3, resolve as resolve5, isAbsolute, relative as relative2 } from "path";
|
|
121042
121498
|
import { tmpdir } from "os";
|
|
@@ -121239,7 +121695,7 @@ ${body}`;
|
|
|
121239
121695
|
const binPath = srcPath.replace(/\.rs$/, isWin ? ".exe" : "");
|
|
121240
121696
|
try {
|
|
121241
121697
|
try {
|
|
121242
|
-
|
|
121698
|
+
execFileSync4("rustc", [srcPath, "-o", binPath], {
|
|
121243
121699
|
cwd,
|
|
121244
121700
|
timeout: Math.min(timeout, 60000),
|
|
121245
121701
|
encoding: "utf-8",
|
|
@@ -122148,31 +122604,31 @@ class TracePathService {
|
|
|
122148
122604
|
const chains = [];
|
|
122149
122605
|
const seen = new Set;
|
|
122150
122606
|
let walks = 0;
|
|
122151
|
-
const walk = (fqn,
|
|
122607
|
+
const walk = (fqn, path15) => {
|
|
122152
122608
|
if (chains.length >= CHAIN_CAP)
|
|
122153
122609
|
return;
|
|
122154
122610
|
if (walks >= MAX_WALKS)
|
|
122155
122611
|
return;
|
|
122156
122612
|
walks++;
|
|
122157
|
-
const key =
|
|
122613
|
+
const key = path15.join("\u2192");
|
|
122158
122614
|
if (seen.has(key))
|
|
122159
122615
|
return;
|
|
122160
122616
|
seen.add(key);
|
|
122161
122617
|
const next = adj.get(fqn);
|
|
122162
122618
|
if (!next || next.length === 0 || !whoHasChild.has(fqn)) {
|
|
122163
|
-
if (
|
|
122164
|
-
chains.push(
|
|
122619
|
+
if (path15.length > 1)
|
|
122620
|
+
chains.push(path15.map((n) => this.fqnToName(n)).join(" \u2192 "));
|
|
122165
122621
|
return;
|
|
122166
122622
|
}
|
|
122167
122623
|
for (const child of next) {
|
|
122168
122624
|
if (chains.length >= CHAIN_CAP || walks >= MAX_WALKS)
|
|
122169
122625
|
return;
|
|
122170
|
-
if (
|
|
122171
|
-
const cycled = [...
|
|
122626
|
+
if (path15.includes(child)) {
|
|
122627
|
+
const cycled = [...path15, `${this.fqnToName(child)}\u21BA`];
|
|
122172
122628
|
chains.push(cycled.map((n) => n).join(" \u2192 "));
|
|
122173
122629
|
continue;
|
|
122174
122630
|
}
|
|
122175
|
-
walk(child, [...
|
|
122631
|
+
walk(child, [...path15, child]);
|
|
122176
122632
|
}
|
|
122177
122633
|
};
|
|
122178
122634
|
for (const seed of seeds) {
|
|
@@ -122214,7 +122670,7 @@ var init_git_ref_validation = __esm(() => {
|
|
|
122214
122670
|
});
|
|
122215
122671
|
|
|
122216
122672
|
// ../../packages/core/dist/services/symbol/impact-analysis.js
|
|
122217
|
-
import { execFileSync as
|
|
122673
|
+
import { execFileSync as execFileSync5 } from "child_process";
|
|
122218
122674
|
function readBfsCteFlag() {
|
|
122219
122675
|
try {
|
|
122220
122676
|
return Boolean(config.get("impact")?.bfsCteEnabled);
|
|
@@ -122540,19 +122996,19 @@ function defaultDiffRunner(projectPath, scope, baseBranch, since) {
|
|
|
122540
122996
|
let diffRange;
|
|
122541
122997
|
if (since) {
|
|
122542
122998
|
try {
|
|
122543
|
-
ref =
|
|
122999
|
+
ref = execFileSync5("git", ["-C", projectPath, "rev-parse", "--verify", `${since}^{commit}`], {
|
|
122544
123000
|
cwd: projectPath,
|
|
122545
123001
|
encoding: "utf-8",
|
|
122546
123002
|
stdio: ["ignore", "pipe", "pipe"]
|
|
122547
123003
|
}).trim();
|
|
122548
123004
|
} catch {
|
|
122549
|
-
ref =
|
|
123005
|
+
ref = execFileSync5("git", ["-C", projectPath, "rev-list", "-1", `--before=${since}`, "HEAD"], {
|
|
122550
123006
|
cwd: projectPath,
|
|
122551
123007
|
encoding: "utf-8",
|
|
122552
123008
|
stdio: ["ignore", "pipe", "pipe"]
|
|
122553
123009
|
}).trim();
|
|
122554
123010
|
if (!ref) {
|
|
122555
|
-
const emptyTree =
|
|
123011
|
+
const emptyTree = execFileSync5("git", ["hash-object", "-t", "tree", "--stdin"], {
|
|
122556
123012
|
cwd: projectPath,
|
|
122557
123013
|
encoding: "utf-8",
|
|
122558
123014
|
input: "",
|
|
@@ -122564,7 +123020,7 @@ function defaultDiffRunner(projectPath, scope, baseBranch, since) {
|
|
|
122564
123020
|
}
|
|
122565
123021
|
args.push(diffRange ?? `${ref}...HEAD`);
|
|
122566
123022
|
}
|
|
122567
|
-
const out =
|
|
123023
|
+
const out = execFileSync5("git", args, {
|
|
122568
123024
|
cwd: projectPath,
|
|
122569
123025
|
encoding: "utf-8",
|
|
122570
123026
|
stdio: ["ignore", "pipe", "pipe"],
|
|
@@ -122576,7 +123032,7 @@ function defaultDiffRunner(projectPath, scope, baseBranch, since) {
|
|
|
122576
123032
|
let untrackedFiltered = 0;
|
|
122577
123033
|
const merged = new Set(tracked);
|
|
122578
123034
|
if (includeUntracked) {
|
|
122579
|
-
const untracked =
|
|
123035
|
+
const untracked = execFileSync5("git", ["-C", projectPath, "ls-files", "--others", "--exclude-standard"], {
|
|
122580
123036
|
cwd: projectPath,
|
|
122581
123037
|
encoding: "utf-8",
|
|
122582
123038
|
stdio: ["ignore", "pipe", "pipe"],
|
|
@@ -124166,9 +124622,9 @@ var init_l1_memory_cache = __esm(() => {
|
|
|
124166
124622
|
});
|
|
124167
124623
|
|
|
124168
124624
|
// ../../packages/core/dist/services/health/local-health-checker.js
|
|
124169
|
-
import
|
|
124625
|
+
import fs9 from "fs/promises";
|
|
124170
124626
|
import { existsSync as existsSync3 } from "fs";
|
|
124171
|
-
import
|
|
124627
|
+
import path15 from "path";
|
|
124172
124628
|
|
|
124173
124629
|
class LocalHealthChecker {
|
|
124174
124630
|
ollamaBaseUrl = process.env.OLLAMA_BASE_URL || "http://localhost:11434";
|
|
@@ -124202,10 +124658,10 @@ class LocalHealthChecker {
|
|
|
124202
124658
|
const start = Date.now();
|
|
124203
124659
|
try {
|
|
124204
124660
|
if (!existsSync3(this.dataDir))
|
|
124205
|
-
await
|
|
124206
|
-
const probe =
|
|
124207
|
-
await
|
|
124208
|
-
await
|
|
124661
|
+
await fs9.mkdir(this.dataDir, { recursive: true });
|
|
124662
|
+
const probe = path15.join(this.dataDir, ".health-check-test");
|
|
124663
|
+
await fs9.writeFile(probe, "ok");
|
|
124664
|
+
await fs9.unlink(probe);
|
|
124209
124665
|
return { available: true, latency: Date.now() - start, details: { path: this.dataDir, writable: true } };
|
|
124210
124666
|
} catch (error51) {
|
|
124211
124667
|
return { available: false, latency: Date.now() - start, error: `Data directory error: ${error51.message}` };
|
|
@@ -126904,9 +127360,9 @@ var init_scheduler2 = __esm(() => {
|
|
|
126904
127360
|
});
|
|
126905
127361
|
|
|
126906
127362
|
// ../../packages/core/dist/services/pricing/models-dev-client.js
|
|
126907
|
-
import
|
|
127363
|
+
import fs10 from "fs/promises";
|
|
126908
127364
|
import { existsSync as existsSync4 } from "fs";
|
|
126909
|
-
import
|
|
127365
|
+
import path16 from "path";
|
|
126910
127366
|
function getModelsDevClient() {
|
|
126911
127367
|
if (!clientInstance) {
|
|
126912
127368
|
clientInstance = new ModelsDevClient;
|
|
@@ -126926,7 +127382,7 @@ var init_models_dev_client = __esm(() => {
|
|
|
126926
127382
|
memoryCacheTimestamp = 0;
|
|
126927
127383
|
getLocalCachePath() {
|
|
126928
127384
|
const dataDir = config.get("dataDir");
|
|
126929
|
-
return
|
|
127385
|
+
return path16.join(dataDir, ModelsDevClient.LOCAL_CACHE_FILE);
|
|
126930
127386
|
}
|
|
126931
127387
|
async loadLocalCache() {
|
|
126932
127388
|
const cachePath = this.getLocalCachePath();
|
|
@@ -126934,7 +127390,7 @@ var init_models_dev_client = __esm(() => {
|
|
|
126934
127390
|
if (!existsSync4(cachePath)) {
|
|
126935
127391
|
return null;
|
|
126936
127392
|
}
|
|
126937
|
-
const content = await
|
|
127393
|
+
const content = await fs10.readFile(cachePath, "utf-8");
|
|
126938
127394
|
const data = JSON.parse(content);
|
|
126939
127395
|
const age = Date.now() - data.timestamp;
|
|
126940
127396
|
if (age > ModelsDevClient.LOCAL_CACHE_TTL) {
|
|
@@ -126961,14 +127417,14 @@ var init_models_dev_client = __esm(() => {
|
|
|
126961
127417
|
async saveLocalCache(models) {
|
|
126962
127418
|
const cachePath = this.getLocalCachePath();
|
|
126963
127419
|
try {
|
|
126964
|
-
const dir =
|
|
126965
|
-
await
|
|
127420
|
+
const dir = path16.dirname(cachePath);
|
|
127421
|
+
await fs10.mkdir(dir, { recursive: true });
|
|
126966
127422
|
const data = {
|
|
126967
127423
|
timestamp: Date.now(),
|
|
126968
127424
|
version: "1.0.0",
|
|
126969
127425
|
models: Object.fromEntries(models)
|
|
126970
127426
|
};
|
|
126971
|
-
await
|
|
127427
|
+
await fs10.writeFile(cachePath, JSON.stringify(data), "utf-8");
|
|
126972
127428
|
logger.debug("Saved pricing to local cache", {
|
|
126973
127429
|
models: models.size,
|
|
126974
127430
|
path: cachePath
|
|
@@ -127297,7 +127753,7 @@ var init_models_dev_client = __esm(() => {
|
|
|
127297
127753
|
const cachePath = this.getLocalCachePath();
|
|
127298
127754
|
try {
|
|
127299
127755
|
if (existsSync4(cachePath)) {
|
|
127300
|
-
await
|
|
127756
|
+
await fs10.unlink(cachePath);
|
|
127301
127757
|
logger.debug("Local pricing cache file deleted");
|
|
127302
127758
|
}
|
|
127303
127759
|
} catch (error51) {
|
|
@@ -128276,8 +128732,8 @@ var init_auto_checkpointer = __esm(() => {
|
|
|
128276
128732
|
});
|
|
128277
128733
|
|
|
128278
128734
|
// ../../packages/core/dist/services/etl/stages/discover.js
|
|
128279
|
-
import
|
|
128280
|
-
import
|
|
128735
|
+
import fs11 from "fs/promises";
|
|
128736
|
+
import path17 from "path";
|
|
128281
128737
|
import { createHash as createHash8 } from "crypto";
|
|
128282
128738
|
|
|
128283
128739
|
class DiscoverStage {
|
|
@@ -128303,7 +128759,7 @@ class DiscoverStage {
|
|
|
128303
128759
|
dot: false,
|
|
128304
128760
|
absolute: false
|
|
128305
128761
|
});
|
|
128306
|
-
relPaths = found.map((p) =>
|
|
128762
|
+
relPaths = found.map((p) => path17.isAbsolute(p) ? path17.relative(ctx.projectPath, p) : p).filter((p) => !ig.ignores(p) && applyPolicy(p, policy) !== "Drop");
|
|
128307
128763
|
}
|
|
128308
128764
|
if (ctx.resumeCursor?.path) {
|
|
128309
128765
|
const cursorPath = ctx.resumeCursor.path;
|
|
@@ -128362,10 +128818,10 @@ class DiscoverStage {
|
|
|
128362
128818
|
return discovered;
|
|
128363
128819
|
}
|
|
128364
128820
|
async processFile(ctx, relativePath, forceReindex) {
|
|
128365
|
-
const absolutePath =
|
|
128821
|
+
const absolutePath = path17.join(ctx.projectPath, relativePath);
|
|
128366
128822
|
try {
|
|
128367
|
-
const stat = await
|
|
128368
|
-
const content = await
|
|
128823
|
+
const stat = await fs11.stat(absolutePath);
|
|
128824
|
+
const content = await fs11.readFile(absolutePath, "utf-8");
|
|
128369
128825
|
const contentHash = createHash8("sha256").update(content).digest("hex");
|
|
128370
128826
|
let needsReparse = forceReindex;
|
|
128371
128827
|
if (!forceReindex) {
|
|
@@ -128408,8 +128864,8 @@ class DiscoverStage {
|
|
|
128408
128864
|
ig.add(pattern);
|
|
128409
128865
|
}
|
|
128410
128866
|
try {
|
|
128411
|
-
const gitignorePath =
|
|
128412
|
-
const gitignoreContent = await
|
|
128867
|
+
const gitignorePath = path17.join(projectPath, ".gitignore");
|
|
128868
|
+
const gitignoreContent = await fs11.readFile(gitignorePath, "utf8");
|
|
128413
128869
|
const rules = gitignoreContent.split(`
|
|
128414
128870
|
`).map((line) => line.trim()).filter((line) => line && !line.startsWith("#"));
|
|
128415
128871
|
ig.add(rules);
|
|
@@ -129764,8 +130220,8 @@ function rustUseLeaves(node, source, prefix = []) {
|
|
|
129764
130220
|
}
|
|
129765
130221
|
if (node.type === "use_wildcard")
|
|
129766
130222
|
return [{ path: [...prefix, "*"], glob: true }];
|
|
129767
|
-
const
|
|
129768
|
-
return
|
|
130223
|
+
const path18 = rustPathSegments(node, source);
|
|
130224
|
+
return path18.length ? [{ path: [...prefix, ...path18] }] : [];
|
|
129769
130225
|
}
|
|
129770
130226
|
function functionalCaptures(captures, source, family) {
|
|
129771
130227
|
if (family !== "clojure")
|
|
@@ -130737,8 +131193,8 @@ var init_structural_runtime = __esm(() => {
|
|
|
130737
131193
|
});
|
|
130738
131194
|
|
|
130739
131195
|
// ../../packages/core/dist/services/etl/stages/parse.js
|
|
130740
|
-
import
|
|
130741
|
-
import
|
|
131196
|
+
import path18 from "path";
|
|
131197
|
+
import fs12 from "fs/promises";
|
|
130742
131198
|
function resolveChunkerMaxChars() {
|
|
130743
131199
|
const global2 = Number(process.env.EMBEDDING_MAX_CHARS);
|
|
130744
131200
|
if (Number.isFinite(global2) && global2 > 0)
|
|
@@ -130766,8 +131222,8 @@ class ParseStage {
|
|
|
130766
131222
|
const results = new Map;
|
|
130767
131223
|
let processed = 0;
|
|
130768
131224
|
const phases = [
|
|
130769
|
-
files.filter((file2) =>
|
|
130770
|
-
files.filter((file2) =>
|
|
131225
|
+
files.filter((file2) => path18.extname(file2.relativePath).toLowerCase() !== ".h"),
|
|
131226
|
+
files.filter((file2) => path18.extname(file2.relativePath).toLowerCase() === ".h")
|
|
130771
131227
|
];
|
|
130772
131228
|
const batches = phases.flatMap((phase) => Array.from({ length: Math.ceil(phase.length / BATCH_SIZE) }, (_, index) => phase.slice(index * BATCH_SIZE, (index + 1) * BATCH_SIZE)));
|
|
130773
131229
|
for (const batch of batches) {
|
|
@@ -130805,19 +131261,19 @@ class ParseStage {
|
|
|
130805
131261
|
return files.map((file2) => results.get(file2.relativePath));
|
|
130806
131262
|
}
|
|
130807
131263
|
recordHeaderImporterEvidence(ctx, files, parsedFiles) {
|
|
130808
|
-
const knownHeaders = new Set(files.filter((file2) =>
|
|
131264
|
+
const knownHeaders = new Set(files.filter((file2) => path18.extname(file2.relativePath).toLowerCase() === ".h").map((file2) => path18.posix.normalize(file2.relativePath)));
|
|
130809
131265
|
const mutable = {
|
|
130810
131266
|
...ctx.structuralHeaderEvidenceByFile
|
|
130811
131267
|
};
|
|
130812
131268
|
for (const parsed of parsedFiles) {
|
|
130813
|
-
const extension =
|
|
131269
|
+
const extension = path18.extname(parsed.file.relativePath).toLowerCase();
|
|
130814
131270
|
const key = extension === ".c" ? "cImporters" : [".cpp", ".hpp"].includes(extension) ? "cppImporters" : undefined;
|
|
130815
131271
|
if (!key)
|
|
130816
131272
|
continue;
|
|
130817
131273
|
for (const imported of parsed.rawImports) {
|
|
130818
131274
|
if (!["c_include", "cpp_include"].includes(imported.form) || imported.specifier.startsWith("<"))
|
|
130819
131275
|
continue;
|
|
130820
|
-
const header =
|
|
131276
|
+
const header = path18.posix.normalize(path18.posix.join(path18.posix.dirname(parsed.file.relativePath), imported.specifier));
|
|
130821
131277
|
if (!knownHeaders.has(header))
|
|
130822
131278
|
continue;
|
|
130823
131279
|
const existing = mutable[header] ?? {};
|
|
@@ -130828,9 +131284,9 @@ class ParseStage {
|
|
|
130828
131284
|
}
|
|
130829
131285
|
async parseFile(ctx, file2) {
|
|
130830
131286
|
if (!file2.needsReparse) {
|
|
130831
|
-
const extension =
|
|
131287
|
+
const extension = path18.extname(file2.relativePath).toLowerCase();
|
|
130832
131288
|
if ([".c", ".cpp", ".hpp"].includes(extension)) {
|
|
130833
|
-
const content = file2.snapshotContent ?? await
|
|
131289
|
+
const content = file2.snapshotContent ?? await fs12.readFile(file2.absolutePath, "utf8");
|
|
130834
131290
|
const outcome = await this.runtime.parse({ extension, source: Buffer.from(content) });
|
|
130835
131291
|
if (outcome.status === "failed")
|
|
130836
131292
|
throw new StructuralEtlParseError(file2.relativePath, outcome.failureKind, `Structural evidence parse failed (${outcome.failureKind})`, outcome.diagnosticCount, outcome.diagnostics.slice(0, 10));
|
|
@@ -130842,8 +131298,8 @@ class ParseStage {
|
|
|
130842
131298
|
return { file: file2, chunks: [], symbols: [], rawImports: [], rawEdges: [] };
|
|
130843
131299
|
}
|
|
130844
131300
|
try {
|
|
130845
|
-
const content = file2.snapshotContent ?? await
|
|
130846
|
-
const ext2 =
|
|
131301
|
+
const content = file2.snapshotContent ?? await fs12.readFile(file2.absolutePath, "utf-8");
|
|
131302
|
+
const ext2 = path18.extname(file2.relativePath).toLowerCase();
|
|
130847
131303
|
const chunkerMaxChars = resolveChunkerMaxChars();
|
|
130848
131304
|
const chunks = smartChunk(content, file2.relativePath, chunkerMaxChars ? { maxChunkChars: chunkerMaxChars } : {});
|
|
130849
131305
|
let symbols;
|
|
@@ -131397,7 +131853,7 @@ var init_resolver = __esm(() => {
|
|
|
131397
131853
|
});
|
|
131398
131854
|
|
|
131399
131855
|
// ../../packages/core/dist/services/structural/resolvers/typescript.js
|
|
131400
|
-
import
|
|
131856
|
+
import path19 from "path";
|
|
131401
131857
|
function candidates(identities) {
|
|
131402
131858
|
return Object.freeze(identities.map((identity) => Object.freeze({
|
|
131403
131859
|
fqn: identity.fqn,
|
|
@@ -131492,7 +131948,7 @@ function probe(base, known, dialect = "typescript") {
|
|
|
131492
131948
|
const bases = /\.[cm]?jsx?$/u.test(base) ? [base.replace(/\.[cm]?jsx?$/u, ".ts"), base.replace(/\.[cm]?jsx?$/u, ".tsx"), base] : [base];
|
|
131493
131949
|
for (const candidateBase of bases)
|
|
131494
131950
|
for (const suffix of DIALECT_PROBES[dialect] ?? [""]) {
|
|
131495
|
-
const value =
|
|
131951
|
+
const value = path19.posix.normalize(`${candidateBase}${suffix}`);
|
|
131496
131952
|
if (!value.startsWith("../") && value !== ".." && known.has(value))
|
|
131497
131953
|
return value;
|
|
131498
131954
|
}
|
|
@@ -131501,7 +131957,7 @@ function probe(base, known, dialect = "typescript") {
|
|
|
131501
131957
|
function resolveStructuralSpecifier(specifier, fromFile, build, dialect = "typescript") {
|
|
131502
131958
|
const known = new Set(build.knownFiles.map(normalizeStructuralFile));
|
|
131503
131959
|
if (specifier.startsWith("./") || specifier.startsWith("../")) {
|
|
131504
|
-
return probe(
|
|
131960
|
+
return probe(path19.posix.join(path19.posix.dirname(fromFile), specifier), known, dialect);
|
|
131505
131961
|
}
|
|
131506
131962
|
const aliases = build.pathAliasesByFile?.[normalizeStructuralFile(fromFile)] ?? build.pathAliases ?? [];
|
|
131507
131963
|
for (const alias of aliases) {
|
|
@@ -131765,7 +132221,7 @@ var init_scripting2 = __esm(() => {
|
|
|
131765
132221
|
});
|
|
131766
132222
|
|
|
131767
132223
|
// ../../packages/core/dist/services/structural/resolvers/systems.js
|
|
131768
|
-
import
|
|
132224
|
+
import path20 from "path";
|
|
131769
132225
|
var DIALECTS, SYSTEMS_LANGUAGE_RESOLVER;
|
|
131770
132226
|
var init_systems2 = __esm(() => {
|
|
131771
132227
|
init_typescript2();
|
|
@@ -131784,7 +132240,7 @@ var init_systems2 = __esm(() => {
|
|
|
131784
132240
|
const bindings = item.bindings.map((binding) => binding.imported === "*" && binding.local === "*" && unresolvedTarget && !unresolvedTarget.qualifier ? { ...binding, imported: unresolvedTarget.name, local: unresolvedTarget.name } : binding);
|
|
131785
132241
|
if (item.specifier === "crate" || item.specifier.startsWith("crate/")) {
|
|
131786
132242
|
const crateRoot = file2.file.startsWith("src/") ? "src" : "";
|
|
131787
|
-
return { ...item, bindings, specifier: `./${
|
|
132243
|
+
return { ...item, bindings, specifier: `./${path20.posix.relative(path20.posix.dirname(file2.file), path20.posix.join(crateRoot, item.specifier.replace(/^crate\/?/u, "")))}` };
|
|
131788
132244
|
}
|
|
131789
132245
|
if (item.specifier === "self" || item.specifier.startsWith("self/"))
|
|
131790
132246
|
return { ...item, bindings, specifier: `./${item.specifier.replace(/^self\/?/u, "")}` };
|
|
@@ -131882,8 +132338,8 @@ var init_data_document2 = __esm(() => {
|
|
|
131882
132338
|
});
|
|
131883
132339
|
|
|
131884
132340
|
// ../../packages/core/dist/services/etl/stages/resolve.js
|
|
131885
|
-
import
|
|
131886
|
-
import
|
|
132341
|
+
import path21 from "path";
|
|
132342
|
+
import fs13 from "fs";
|
|
131887
132343
|
|
|
131888
132344
|
class ResolveStage {
|
|
131889
132345
|
symbolRepository;
|
|
@@ -131907,7 +132363,7 @@ class ResolveStage {
|
|
|
131907
132363
|
const structuralDocuments = files.flatMap((file2) => {
|
|
131908
132364
|
if (!file2.structure)
|
|
131909
132365
|
return [];
|
|
131910
|
-
const language = resolveStructuralLanguage(
|
|
132366
|
+
const language = resolveStructuralLanguage(path21.extname(file2.file.relativePath));
|
|
131911
132367
|
if (language.status !== "supported")
|
|
131912
132368
|
throw new Error(`structural_manifest_missing:${file2.file.relativePath}`);
|
|
131913
132369
|
return [{
|
|
@@ -131919,13 +132375,13 @@ class ResolveStage {
|
|
|
131919
132375
|
}];
|
|
131920
132376
|
});
|
|
131921
132377
|
const currentStructuralFiles = new Set(structuralDocuments.map((document2) => document2.file));
|
|
131922
|
-
const skippedStructuralFiles = new Set(files.filter((item) => !item.file.needsReparse && STRUCTURAL_SEED_EXTENSIONS.has(
|
|
132378
|
+
const skippedStructuralFiles = new Set(files.filter((item) => !item.file.needsReparse && STRUCTURAL_SEED_EXTENSIONS.has(path21.extname(item.file.relativePath).toLowerCase())).map((item) => item.file.relativePath));
|
|
131923
132379
|
const pathAliasesByFile = Object.fromEntries([...knownRelPaths].map((file2) => [
|
|
131924
132380
|
file2,
|
|
131925
132381
|
this.structuralAliasesFor(file2, rootAliases, monorepoPackages)
|
|
131926
132382
|
]));
|
|
131927
132383
|
const buildMetadata = { knownFiles: [...knownRelPaths], pathAliasesByFile };
|
|
131928
|
-
const seedRows = repositoryDefinitions.filter((definition) => STRUCTURAL_SEED_EXTENSIONS.has(
|
|
132384
|
+
const seedRows = repositoryDefinitions.filter((definition) => STRUCTURAL_SEED_EXTENSIONS.has(path21.extname(definition.file_path).toLowerCase())).filter((definition) => knownRelPaths.has(definition.file_path) && skippedStructuralFiles.has(definition.file_path)).filter((definition) => !currentStructuralFiles.has(definition.file_path));
|
|
131929
132385
|
const seedIds = new Set;
|
|
131930
132386
|
for (const definition of seedRows) {
|
|
131931
132387
|
if (seedIds.has(definition.id))
|
|
@@ -132018,7 +132474,7 @@ class ResolveStage {
|
|
|
132018
132474
|
if (parsed.file !== definition.file_path) {
|
|
132019
132475
|
throw new Error(`structural_repository_seed_file_mismatch:${definition.id}`);
|
|
132020
132476
|
}
|
|
132021
|
-
const language = resolveStructuralLanguage(
|
|
132477
|
+
const language = resolveStructuralLanguage(path21.extname(definition.file_path));
|
|
132022
132478
|
if (language.status !== "supported")
|
|
132023
132479
|
throw new Error(`structural_repository_seed_language:${definition.id}`);
|
|
132024
132480
|
let identity;
|
|
@@ -132070,7 +132526,7 @@ class ResolveStage {
|
|
|
132070
132526
|
});
|
|
132071
132527
|
}
|
|
132072
132528
|
resolveFile(parsed, projectPath, knownRelPaths, rootAliases, monorepoPackages, symbolIndex, knownFqns) {
|
|
132073
|
-
const fromDir =
|
|
132529
|
+
const fromDir = path21.dirname(path21.join(projectPath, parsed.file.relativePath));
|
|
132074
132530
|
const packageAliases = this.getPackageAliases(parsed.file.relativePath, monorepoPackages);
|
|
132075
132531
|
const allAliases = [...packageAliases, ...rootAliases];
|
|
132076
132532
|
const resolvedImports = parsed.rawImports.map((raw2) => {
|
|
@@ -132141,7 +132597,7 @@ class ResolveStage {
|
|
|
132141
132597
|
index.set(def.name, `${def.file_path}#${def.name}`);
|
|
132142
132598
|
}
|
|
132143
132599
|
} catch (err) {
|
|
132144
|
-
const skippedStructural = files.some((file2) => !file2.file.needsReparse && STRUCTURAL_SEED_EXTENSIONS.has(
|
|
132600
|
+
const skippedStructural = files.some((file2) => !file2.file.needsReparse && STRUCTURAL_SEED_EXTENSIONS.has(path21.extname(file2.file.relativePath).toLowerCase()));
|
|
132145
132601
|
if (skippedStructural)
|
|
132146
132602
|
throw new Error("structural_repository_seed_failed", { cause: err });
|
|
132147
132603
|
logger.warn("buildSymbolIndex: repo seed failed, in-batch only", {
|
|
@@ -132165,7 +132621,7 @@ class ResolveStage {
|
|
|
132165
132621
|
}
|
|
132166
132622
|
resolveSpecifier(specifier, fromDir, projectPath, knownRelPaths, aliases) {
|
|
132167
132623
|
if (specifier.startsWith("./") || specifier.startsWith("../")) {
|
|
132168
|
-
const resolved = this.probeExtensions(
|
|
132624
|
+
const resolved = this.probeExtensions(path21.resolve(fromDir, specifier), projectPath, knownRelPaths);
|
|
132169
132625
|
return { resolvedPath: resolved, external: false };
|
|
132170
132626
|
}
|
|
132171
132627
|
for (const alias of aliases) {
|
|
@@ -132173,8 +132629,8 @@ class ResolveStage {
|
|
|
132173
132629
|
const suffix = specifier.slice(alias.prefix.length);
|
|
132174
132630
|
for (const target of alias.targets) {
|
|
132175
132631
|
const cleanTarget = target.replace(/\/\*$/, "");
|
|
132176
|
-
const basePath = alias.packagePath ?
|
|
132177
|
-
const absPath =
|
|
132632
|
+
const basePath = alias.packagePath ? path21.join(projectPath, alias.packagePath) : projectPath;
|
|
132633
|
+
const absPath = path21.join(basePath, cleanTarget + suffix);
|
|
132178
132634
|
const resolved = this.probeExtensions(absPath, projectPath, knownRelPaths);
|
|
132179
132635
|
if (resolved)
|
|
132180
132636
|
return { resolvedPath: resolved, external: false };
|
|
@@ -132190,7 +132646,7 @@ class ResolveStage {
|
|
|
132190
132646
|
...TS_EXTENSIONS.map((ext2) => absPath.replace(/\.[^.]+$/, ext2))
|
|
132191
132647
|
];
|
|
132192
132648
|
for (const candidate2 of candidates2) {
|
|
132193
|
-
const rel =
|
|
132649
|
+
const rel = path21.relative(projectPath, candidate2).replace(/\\/g, "/");
|
|
132194
132650
|
if (knownRelPaths.has(rel))
|
|
132195
132651
|
return rel;
|
|
132196
132652
|
}
|
|
@@ -132198,9 +132654,9 @@ class ResolveStage {
|
|
|
132198
132654
|
}
|
|
132199
132655
|
loadTsConfigPaths(projectPath, packageBase) {
|
|
132200
132656
|
const aliases = [];
|
|
132201
|
-
const tsconfigPath =
|
|
132657
|
+
const tsconfigPath = path21.join(projectPath, "tsconfig.json");
|
|
132202
132658
|
try {
|
|
132203
|
-
const raw2 =
|
|
132659
|
+
const raw2 = fs13.readFileSync(tsconfigPath, "utf-8");
|
|
132204
132660
|
const stripped = raw2.replace(/\/\/[^\n]*/g, "").replace(/\/\*[\s\S]*?\*\//g, "");
|
|
132205
132661
|
const tsconfig = JSON.parse(stripped);
|
|
132206
132662
|
const paths = tsconfig?.compilerOptions?.paths ?? {};
|
|
@@ -132229,7 +132685,7 @@ class ResolveStage {
|
|
|
132229
132685
|
}
|
|
132230
132686
|
}
|
|
132231
132687
|
for (const packageRelPath of packagePaths) {
|
|
132232
|
-
const absPackagePath =
|
|
132688
|
+
const absPackagePath = path21.join(projectPath, packageRelPath);
|
|
132233
132689
|
const aliases = this.loadTsConfigPaths(absPackagePath, packageRelPath);
|
|
132234
132690
|
if (aliases.length > 0) {
|
|
132235
132691
|
packages.push({
|
|
@@ -132259,7 +132715,7 @@ class ResolveStage {
|
|
|
132259
132715
|
structuralAliasesFor(filePath, rootAliases, packages) {
|
|
132260
132716
|
return [...this.getPackageAliases(filePath, packages), ...rootAliases].map((alias) => ({
|
|
132261
132717
|
pattern: alias.prefix + (alias.targets.some((target) => target.includes("*")) ? "/*" : ""),
|
|
132262
|
-
targets: alias.targets.map((target) => alias.packagePath ?
|
|
132718
|
+
targets: alias.targets.map((target) => alias.packagePath ? path21.posix.join(alias.packagePath, target) : target)
|
|
132263
132719
|
}));
|
|
132264
132720
|
}
|
|
132265
132721
|
}
|
|
@@ -132323,7 +132779,7 @@ var init_with_deadlock_retry = __esm(() => {
|
|
|
132323
132779
|
});
|
|
132324
132780
|
|
|
132325
132781
|
// ../../packages/core/dist/services/etl/stages/load.js
|
|
132326
|
-
import
|
|
132782
|
+
import path22 from "path";
|
|
132327
132783
|
function formatDuration(ms) {
|
|
132328
132784
|
const totalSec = Math.max(0, Math.round(ms / 1000));
|
|
132329
132785
|
if (totalSec < 60)
|
|
@@ -132593,7 +133049,7 @@ class LoadStage {
|
|
|
132593
133049
|
const filePath = file2.file.relativePath;
|
|
132594
133050
|
const batch = buildSymbolPersistenceBatch(ctx.projectId, file2);
|
|
132595
133051
|
if (ctx.graphGenerationLease) {
|
|
132596
|
-
const manifest = getLanguageManifestEntry(
|
|
133052
|
+
const manifest = getLanguageManifestEntry(path22.extname(filePath));
|
|
132597
133053
|
const diagnostics2 = (file2.structuralDiagnostics ?? []).slice(0, 10).map((diagnostic2) => ({
|
|
132598
133054
|
code: diagnostic2.code,
|
|
132599
133055
|
severity: diagnostic2.severity,
|
|
@@ -133049,9 +133505,9 @@ var init_graph_generation_coordinator = __esm(() => {
|
|
|
133049
133505
|
// ../../packages/core/dist/services/etl/pipeline.js
|
|
133050
133506
|
import { createHash as createHash10 } from "crypto";
|
|
133051
133507
|
import { setTimeout as delay2 } from "timers/promises";
|
|
133052
|
-
import
|
|
133508
|
+
import path23 from "path";
|
|
133053
133509
|
function buildHeaderLanguageEvidence(files) {
|
|
133054
|
-
const headers = new Set(files.filter((file2) =>
|
|
133510
|
+
const headers = new Set(files.filter((file2) => path23.posix.extname(file2.relativePath).toLowerCase() === ".h").map((file2) => path23.posix.normalize(file2.relativePath)));
|
|
133055
133511
|
const mutable = new Map;
|
|
133056
133512
|
const entry2 = (header) => {
|
|
133057
133513
|
let value = mutable.get(header);
|
|
@@ -133062,7 +133518,7 @@ function buildHeaderLanguageEvidence(files) {
|
|
|
133062
133518
|
return value;
|
|
133063
133519
|
};
|
|
133064
133520
|
for (const file2 of files) {
|
|
133065
|
-
if (
|
|
133521
|
+
if (path23.posix.basename(file2.relativePath) !== "compile_commands.json" || file2.snapshotContent === undefined)
|
|
133066
133522
|
continue;
|
|
133067
133523
|
let commands;
|
|
133068
133524
|
try {
|
|
@@ -133078,11 +133534,11 @@ function buildHeaderLanguageEvidence(files) {
|
|
|
133078
133534
|
const record2 = command;
|
|
133079
133535
|
if (typeof record2.file !== "string")
|
|
133080
133536
|
continue;
|
|
133081
|
-
const projectRoot =
|
|
133082
|
-
const commandDirectory = typeof record2.directory === "string" ?
|
|
133083
|
-
const absoluteInput =
|
|
133084
|
-
const relative3 =
|
|
133085
|
-
const header =
|
|
133537
|
+
const projectRoot = path23.resolve(file2.absolutePath, ...file2.relativePath.split("/").map(() => ".."));
|
|
133538
|
+
const commandDirectory = typeof record2.directory === "string" ? path23.resolve(projectRoot, record2.directory) : projectRoot;
|
|
133539
|
+
const absoluteInput = path23.resolve(commandDirectory, record2.file);
|
|
133540
|
+
const relative3 = path23.relative(projectRoot, absoluteInput);
|
|
133541
|
+
const header = path23.posix.normalize(relative3.replaceAll(path23.sep, "/"));
|
|
133086
133542
|
if (!headers.has(header))
|
|
133087
133543
|
continue;
|
|
133088
133544
|
const invocation = typeof record2.command === "string" ? record2.command : Array.isArray(record2.arguments) ? record2.arguments.join(" ") : "";
|
|
@@ -138941,33 +139397,33 @@ var require_URL = __commonJS((exports, module) => {
|
|
|
138941
139397
|
else
|
|
138942
139398
|
return basepath.substring(0, lastslash + 1) + refpath;
|
|
138943
139399
|
}
|
|
138944
|
-
function remove_dot_segments(
|
|
138945
|
-
if (!
|
|
138946
|
-
return
|
|
139400
|
+
function remove_dot_segments(path24) {
|
|
139401
|
+
if (!path24)
|
|
139402
|
+
return path24;
|
|
138947
139403
|
var output = "";
|
|
138948
|
-
while (
|
|
138949
|
-
if (
|
|
138950
|
-
|
|
139404
|
+
while (path24.length > 0) {
|
|
139405
|
+
if (path24 === "." || path24 === "..") {
|
|
139406
|
+
path24 = "";
|
|
138951
139407
|
break;
|
|
138952
139408
|
}
|
|
138953
|
-
var twochars =
|
|
138954
|
-
var threechars =
|
|
138955
|
-
var fourchars =
|
|
139409
|
+
var twochars = path24.substring(0, 2);
|
|
139410
|
+
var threechars = path24.substring(0, 3);
|
|
139411
|
+
var fourchars = path24.substring(0, 4);
|
|
138956
139412
|
if (threechars === "../") {
|
|
138957
|
-
|
|
139413
|
+
path24 = path24.substring(3);
|
|
138958
139414
|
} else if (twochars === "./") {
|
|
138959
|
-
|
|
139415
|
+
path24 = path24.substring(2);
|
|
138960
139416
|
} else if (threechars === "/./") {
|
|
138961
|
-
|
|
138962
|
-
} else if (twochars === "/." &&
|
|
138963
|
-
|
|
138964
|
-
} else if (fourchars === "/../" || threechars === "/.." &&
|
|
138965
|
-
|
|
139417
|
+
path24 = "/" + path24.substring(3);
|
|
139418
|
+
} else if (twochars === "/." && path24.length === 2) {
|
|
139419
|
+
path24 = "/";
|
|
139420
|
+
} else if (fourchars === "/../" || threechars === "/.." && path24.length === 3) {
|
|
139421
|
+
path24 = "/" + path24.substring(4);
|
|
138966
139422
|
output = output.replace(/\/?[^\/]*$/, "");
|
|
138967
139423
|
} else {
|
|
138968
|
-
var segment =
|
|
139424
|
+
var segment = path24.match(/(\/?([^\/]*))/)[0];
|
|
138969
139425
|
output += segment;
|
|
138970
|
-
|
|
139426
|
+
path24 = path24.substring(segment.length);
|
|
138971
139427
|
}
|
|
138972
139428
|
}
|
|
138973
139429
|
return output;
|
|
@@ -151037,21 +151493,21 @@ function jsonToKeyPathChunks(value, label = "$") {
|
|
|
151037
151493
|
walk(value, label, out);
|
|
151038
151494
|
return out;
|
|
151039
151495
|
}
|
|
151040
|
-
function walk(val,
|
|
151496
|
+
function walk(val, path24, out) {
|
|
151041
151497
|
if (val === null || val === undefined)
|
|
151042
151498
|
return;
|
|
151043
151499
|
if (Array.isArray(val)) {
|
|
151044
151500
|
if (val.length === 0) {
|
|
151045
|
-
out.push({ path:
|
|
151501
|
+
out.push({ path: path24, content: `**${path24}** = _[]_` });
|
|
151046
151502
|
return;
|
|
151047
151503
|
}
|
|
151048
151504
|
if (val.every((v) => v !== null && typeof v === "object")) {
|
|
151049
|
-
val.forEach((v, i) => walk(v, `${
|
|
151505
|
+
val.forEach((v, i) => walk(v, `${path24}[${i}]`, out));
|
|
151050
151506
|
return;
|
|
151051
151507
|
}
|
|
151052
151508
|
const items = val.map((v) => `- \`${String(v)}\``).join(`
|
|
151053
151509
|
`);
|
|
151054
|
-
out.push({ path:
|
|
151510
|
+
out.push({ path: path24, content: `**${path24}**
|
|
151055
151511
|
|
|
151056
151512
|
${items}` });
|
|
151057
151513
|
return;
|
|
@@ -151059,16 +151515,16 @@ ${items}` });
|
|
|
151059
151515
|
if (typeof val === "object") {
|
|
151060
151516
|
const entries = Object.entries(val);
|
|
151061
151517
|
if (entries.length === 0) {
|
|
151062
|
-
out.push({ path:
|
|
151518
|
+
out.push({ path: path24, content: `**${path24}** = _{}_` });
|
|
151063
151519
|
return;
|
|
151064
151520
|
}
|
|
151065
151521
|
for (const [k, v] of entries) {
|
|
151066
151522
|
const safeKey = /^[A-Za-z_$][\w$]*$/.test(k) ? k : JSON.stringify(k);
|
|
151067
|
-
walk(v, `${
|
|
151523
|
+
walk(v, `${path24}.${safeKey}`, out);
|
|
151068
151524
|
}
|
|
151069
151525
|
return;
|
|
151070
151526
|
}
|
|
151071
|
-
out.push({ path:
|
|
151527
|
+
out.push({ path: path24, content: `**${path24}** = \`${String(val)}\`` });
|
|
151072
151528
|
}
|
|
151073
151529
|
var gfm, STRIP_SELECTORS, tdCache = null;
|
|
151074
151530
|
var init_html_to_md = __esm(() => {
|
|
@@ -151490,6 +151946,7 @@ var init_recover_project = __esm(() => {
|
|
|
151490
151946
|
|
|
151491
151947
|
// src/config-cli.ts
|
|
151492
151948
|
init_config();
|
|
151949
|
+
init_dist();
|
|
151493
151950
|
function help() {
|
|
151494
151951
|
console.log(`
|
|
151495
151952
|
massa-ai-config - Configuration manager for massa-ai
|
|
@@ -151515,6 +151972,11 @@ Commands:
|
|
|
151515
151972
|
<projectId> Project ID to recover
|
|
151516
151973
|
--path <newPath> New filesystem path
|
|
151517
151974
|
|
|
151975
|
+
profile list List shipped model profiles + per-host active profile
|
|
151976
|
+
profile show Same as 'profile list'
|
|
151977
|
+
profile set <name> [--host <h>] [--dry-run]
|
|
151978
|
+
Switch installed agents to a profile (restart required after)
|
|
151979
|
+
|
|
151518
151980
|
Examples:
|
|
151519
151981
|
massa-ai-config init
|
|
151520
151982
|
massa-ai-config init --mistral your-api-key
|
|
@@ -151522,6 +151984,7 @@ Examples:
|
|
|
151522
151984
|
massa-ai-config use mistral --api-key your-key
|
|
151523
151985
|
massa-ai-config set embedding.dimensions 1024
|
|
151524
151986
|
massa-ai-config recover my-project --path /home/user/renamed-dir
|
|
151987
|
+
massa-ai-config profile set work --dry-run
|
|
151525
151988
|
`);
|
|
151526
151989
|
}
|
|
151527
151990
|
function parseOptions(args) {
|
|
@@ -151539,6 +152002,30 @@ function parseOptions(args) {
|
|
|
151539
152002
|
}
|
|
151540
152003
|
return options;
|
|
151541
152004
|
}
|
|
152005
|
+
function formatProfileInventory(inventory) {
|
|
152006
|
+
for (const h of inventory.hosts) {
|
|
152007
|
+
if (h.skipped) {
|
|
152008
|
+
console.log(` ${h.host}: skipped (${h.skipReason})`);
|
|
152009
|
+
continue;
|
|
152010
|
+
}
|
|
152011
|
+
if (!h.installed) {
|
|
152012
|
+
console.log(` ${h.host}: not installed`);
|
|
152013
|
+
continue;
|
|
152014
|
+
}
|
|
152015
|
+
console.log(` ${h.host}: active=${h.activeProfile} bundle=${h.bundleVersion ?? "unknown"} supports=${h.availableProfiles.length > 0 ? h.availableProfiles.join(",") : "none"}`);
|
|
152016
|
+
}
|
|
152017
|
+
}
|
|
152018
|
+
function formatSwitchReport(report) {
|
|
152019
|
+
console.log(`profile: ${report.profile}${report.dryRun ? " (dry run \u2014 no files changed)" : ""}`);
|
|
152020
|
+
for (const row of report.hosts) {
|
|
152021
|
+
const detail = row.reason ? `: ${row.reason}` : row.filesChanged !== undefined ? ` (${row.filesChanged} files changed)` : "";
|
|
152022
|
+
console.log(` ${row.host}: ${row.status}${detail}`);
|
|
152023
|
+
}
|
|
152024
|
+
if (report.restartRequired) {
|
|
152025
|
+
console.log(`
|
|
152026
|
+
A host session restart is required for the change to take effect.`);
|
|
152027
|
+
}
|
|
152028
|
+
}
|
|
151542
152029
|
async function runCli(argv) {
|
|
151543
152030
|
const args = argv;
|
|
151544
152031
|
const command = args[0];
|
|
@@ -151681,6 +152168,44 @@ Using defaults:`);
|
|
|
151681
152168
|
}
|
|
151682
152169
|
break;
|
|
151683
152170
|
}
|
|
152171
|
+
case "profile": {
|
|
152172
|
+
const subcommand = args[1];
|
|
152173
|
+
if (subcommand === "list" || subcommand === "show") {
|
|
152174
|
+
try {
|
|
152175
|
+
formatProfileInventory(listProfiles());
|
|
152176
|
+
} catch (e) {
|
|
152177
|
+
console.error(`Error: ${e.message}`);
|
|
152178
|
+
return 1;
|
|
152179
|
+
}
|
|
152180
|
+
return 0;
|
|
152181
|
+
}
|
|
152182
|
+
if (subcommand === "set") {
|
|
152183
|
+
const name26 = args[2];
|
|
152184
|
+
if (!name26) {
|
|
152185
|
+
console.error("Usage: massa-ai-config profile set <name> [--host <h>] [--dry-run]");
|
|
152186
|
+
return 1;
|
|
152187
|
+
}
|
|
152188
|
+
const hostOpt = typeof options.host === "string" ? options.host : undefined;
|
|
152189
|
+
if (hostOpt !== undefined && !isHost(hostOpt)) {
|
|
152190
|
+
console.error(`Error: unknown host "${hostOpt}"`);
|
|
152191
|
+
return 1;
|
|
152192
|
+
}
|
|
152193
|
+
try {
|
|
152194
|
+
const report = switchProfile({
|
|
152195
|
+
profile: name26,
|
|
152196
|
+
host: hostOpt,
|
|
152197
|
+
dryRun: options["dry-run"] === true
|
|
152198
|
+
});
|
|
152199
|
+
formatSwitchReport(report);
|
|
152200
|
+
return reportSucceeded(report) ? 0 : 1;
|
|
152201
|
+
} catch (e) {
|
|
152202
|
+
console.error(`Error: ${e.message}`);
|
|
152203
|
+
return 1;
|
|
152204
|
+
}
|
|
152205
|
+
}
|
|
152206
|
+
console.error("Usage: massa-ai-config profile <list|show|set> ...");
|
|
152207
|
+
return 1;
|
|
152208
|
+
}
|
|
151684
152209
|
default:
|
|
151685
152210
|
console.error(`Unknown command: ${command}`);
|
|
151686
152211
|
help();
|