UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

4 lines • 1.95 kB
import{o as isDefaultInstallIdentity}from"./paths-D_FOvGon.mjs";import{n as resolveStdioMcpServerLaunchConfig}from"./mcp-stdio-B1gRAX5S.mjs";import{n as loadEnabledBundleLspConfig}from"./bundle-lsp-PgbHVkY2.mjs";import{n as resolveGatewayService}from"./service-Bz63n2ee.mjs";import{t as note}from"./note-e4DtVgg2.mjs";import{l as shouldManageGatewayService}from"./doctor-service-repair-policy-gYXaFNLg.mjs"; //!src/commands/doctor-bundle-lsp-env.ts async function noteBundleLspEnvPassthrough(e){if(e.cfg.gateway?.mode===`remote`)return;const{cfg:t,workspaceDirs:n}=e;const r=e.runWithPluginMetadataSnapshot;const i=/* @__PURE__ */ new Map;for(const e of n){const load=()=>loadEnabledBundleLspConfig({workspaceDir:e,cfg:t});const n=r?r({config:t,workspaceDir:e},load):load();for(const[e,t]of Object.entries(n.config.lspServers)){const n=resolveStdioMcpServerLaunchConfig(t);if(n.ok)i.set(e,[...i.get(e)??[],n.config.env])}}if(i.size===0)return;const{collectWithheldLspEnvNames:a,formatWithheldLspEnvHints:o,LSP_ENV_PASSTHROUGH_DOCS_URL:s,resolveLspServerEnv:c}=await import(`./agent-bundle-lsp-env-CiKFiaYO.mjs`);const l=e.env??process.env;const u=e.service??resolveGatewayService();const d=[l];if(isDefaultInstallIdentity(l)&&await shouldManageGatewayService(l)){const e=await u.readCommand(l).catch(()=>null);if(e?.environment)d.push(e.environment)}const f=[];for(const[e,t]of[...i].toSorted(([e],[t])=>e.localeCompare(t))){const n=t.flatMap(e=>d.map(t=>a({parentEnv:t,childEnv:c(e,t)})));const r=new Set(n.flatMap(e=>e.configurable));const i=new Set(n.flatMap(e=>e.refused));for(const t of o({configurable:[...r].toSorted(),refused:[...i].toSorted()}))f.push(`- "${e}": ${t}`)}if(f.length===0)return;(e.noteFn??note)([`Bundle LSP servers start from an allowlisted environment, not the full Gateway environment. These Gateway variables are set but not passed:`,...f,`Docs: ${s}`].join(` `),`Bundle LSP environment`)}export{noteBundleLspEnvPassthrough};