openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
2 lines • 1.11 kB
JavaScript
//!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;function projectBundleMcpCatalogFailure(e,t){return{...e??{version:1,servers:{},tools:[]},generatedAt:Date.now(),diagnostics:[t]}}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}};function resolveSessionMcpRuntimeIdleTtlMs(e){return Math.floor(e?.mcp?.sessionIdleTtlMs??0)}function shouldLoadRequesterScopedMcpHarnessRuntime(e){if(e.requesterSenderId?.trim())return true;return(globalThis[SESSION_MCP_RUNTIME_MANAGER_KEY]?.getAdvertisedScopedCatalog(e.sessionId)?.tools.length??0)>0}export{resolveSessionMcpRuntimeIdleTtlMs as a,projectBundleMcpCatalogFailure as i,SESSION_MCP_RUNTIME_SWEEP_INTERVAL_MS as n,shouldLoadRequesterScopedMcpHarnessRuntime as o,SessionMcpRuntimeCapacityError as r,SESSION_MCP_RUNTIME_MANAGER_KEY as t};