openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
57 lines (56 loc) • 1.9 kB
JavaScript
import { n as CLAUDE_BUNDLE_MANIFEST_RELATIVE_PATH, o as resolveBundleComponentPaths } from "./bundle-manifest-js7o0H7U.mjs";
import { t as applyMergePatch } from "./merge-patch-D-7aajuy.mjs";
import { n as loadEnabledBundleConfig, r as readBundleJsonObject, t as extractBundleServerMap } from "./bundle-config-shared-P1HNI6RX.mjs";
//#region src/plugins/bundle-lsp.ts
function loadBundleLspConfig(e) {
if (e.bundleFormat !== "claude") return {
config: { lspServers: {} },
diagnostics: []
};
const t = readBundleJsonObject({
rootDir: e.rootDir,
relativePath: CLAUDE_BUNDLE_MANIFEST_RELATIVE_PATH
});
if (!t.ok) return {
config: { lspServers: {} },
diagnostics: [t.error]
};
let n = { lspServers: {} };
const r = resolveBundleComponentPaths(t.raw.lspServers, e.rootDir, [".lsp.json"]);
const i = [];
for (const t of r) {
const r = readBundleJsonObject({
rootDir: e.rootDir,
relativePath: t,
allowMissing: true
});
if (!r.ok) i.push(r.reason === "open" ? r.error : `unable to read ${t}: ${r.error}`);
n = applyMergePatch(n, { lspServers: r.ok ? extractBundleServerMap(r.raw, ["lspServers"]) : {} });
}
return {
config: n,
diagnostics: i
};
}
function inspectBundleLspRuntimeSupport(e) {
const { config: t, diagnostics: n } = loadBundleLspConfig(e);
const r = [];
const i = [];
for (const [e, n] of Object.entries(t.lspServers)) (typeof n.command === "string" && n.command.trim().length > 0 ? r : i).push(e);
return {
supportedServerNames: r,
unsupportedServerNames: i,
diagnostics: n
};
}
function loadEnabledBundleLspConfig(e) {
return loadEnabledBundleConfig({
workspaceDir: e.workspaceDir,
cfg: e.cfg,
manifestRegistry: e.manifestRegistry,
createEmptyConfig: () => ({ lspServers: {} }),
loadBundleConfig: loadBundleLspConfig
});
}
//#endregion
export { loadEnabledBundleLspConfig as n, inspectBundleLspRuntimeSupport as t };