openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
52 lines (51 loc) • 1.87 kB
JavaScript
import { i as listAgentIds } from "./agent-roster-t1ooUdXp.mjs";
import { f as resolveAgentWorkspaceDir } from "./agent-scope-config-DmXgFGKP.mjs";
import { t as runTasksWithConcurrency } from "./run-with-concurrency-B34GDKXE.mjs";
import { n as resolveStdioMcpServerLaunchConfig } from "./mcp-stdio-BbrQn34X.mjs";
import { t as loadMergedBundleMcpConfig } from "./bundle-mcp-config-Ca9TXxki.mjs";
import { t as parseMcpDockerCommand } from "./mcp-docker-command-Cs1DrAOj.mjs";
//#region src/agents/mcp-docker-recovery.ts
/** Metadata-only discovery keeps Docker and native identity out of other installations. */
async function recoverConfiguredMcpDockerServers(e, t) {
const n = [];
for (const r of listAgentIds(e)) {
const i = loadMergedBundleMcpConfig({
cfg: e,
manifestRegistry: t,
workspaceDir: resolveAgentWorkspaceDir(e, r)
});
n.push(...Object.values(i.config.mcpServers));
}
await recoverMcpDockerServers(n);
}
/** CLI probes recover only the selected definitions, without discovering other registries. */
async function recoverMcpDockerServers(e) {
const t = /* @__PURE__ */ new Set();
const n = [];
for (const r of e) {
if (r.enabled === false) continue;
const e = resolveStdioMcpServerLaunchConfig(r);
if (!e.ok) continue;
const i = parseMcpDockerCommand(e.config.command, e.config.args);
if (i.kind !== "docker") continue;
const { env: a, cwd: o } = e.config;
const s = JSON.stringify([
i.command,
a,
o
]);
if (t.has(s)) continue;
t.add(s);
n.push(async () => {
const { recoverMcpDockerContainers: e } = await import("./mcp-docker-custody-xbrimqfI.mjs");
await e(i.command, a, o);
});
}
const { hasError: r, firstError: i } = await runTasksWithConcurrency({
tasks: n,
limit: 4
});
if (r) throw i;
}
//#endregion
export { recoverConfiguredMcpDockerServers, recoverMcpDockerServers };