UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

21 lines (20 loc) • 1.19 kB
//#region src/agents/agent-bundle-mcp-runtime-shared.ts const SESSION_MCP_RUNTIME_MANAGER_KEY = Symbol.for("openclaw.sessionMcpRuntimeManager"); const SESSION_MCP_RUNTIME_SWEEP_INTERVAL_MS = 6e4; var SessionMcpRuntimeCapacityError = class extends Error { constructor(e, t = "MCP tools are temporarily unavailable: all 256 Gateway MCP runtimes are in use. This turn will continue without MCP tools; retry on the next turn.") { super(t); this.notify = e; } }; /** TTL eviction is opt-in; capacity eviction also applies when zero. */ function resolveSessionMcpRuntimeIdleTtlMs(e) { return Math.floor(e?.mcp?.sessionIdleTtlMs ?? 0); } /** Checks whether harness-scoped MCP can affect a turn without loading its runtime graph. */ function shouldLoadRequesterScopedMcpHarnessRuntime(e) { if (e.requesterSenderId?.trim()) return true; return (globalThis[SESSION_MCP_RUNTIME_MANAGER_KEY]?.getAdvertisedScopedCatalog(e.sessionId)?.tools.length ?? 0) > 0; } //#endregion export { shouldLoadRequesterScopedMcpHarnessRuntime as a, resolveSessionMcpRuntimeIdleTtlMs as i, SESSION_MCP_RUNTIME_SWEEP_INTERVAL_MS as n, SessionMcpRuntimeCapacityError as r, SESSION_MCP_RUNTIME_MANAGER_KEY as t };