mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-26 16:11:12 +00:00
Mechanical: manager, combined facade, install path, lifecycle, config loading, and resolver types move to focused modules; the runtime facade re-exports its prior surface so importers are unchanged. Deletes dead tools-barrel re-exports flagged by check-dependencies. No behavior change.
37 lines
1.7 KiB
TypeScript
37 lines
1.7 KiB
TypeScript
/** Shared session MCP runtime constants and create-runtime factory type. */
|
|
import type { OpenClawConfig } from "../config/types.openclaw.js";
|
|
import type { PluginManifestRegistry } from "../plugins/manifest-registry.js";
|
|
import type { SessionMcpRequesterScope, SessionMcpRuntime } from "./agent-bundle-mcp-types.js";
|
|
import type { McpServerConnectionResolved } from "./mcp-connection-resolver.js";
|
|
|
|
export const SESSION_MCP_RUNTIME_MANAGER_KEY = Symbol.for("openclaw.sessionMcpRuntimeManager");
|
|
export const DEFAULT_SESSION_MCP_RUNTIME_IDLE_TTL_MS = 10 * 60 * 1000;
|
|
export const SESSION_MCP_RUNTIME_SWEEP_INTERVAL_MS = 60 * 1000;
|
|
// Bounds live per-sender MCP transports in one session between idle sweeps;
|
|
// far above concurrent-run parallelism, so active requesters never evict.
|
|
export const SESSION_MCP_MAX_IDLE_REQUESTER_RUNTIMES = 64;
|
|
|
|
export type CreateSessionMcpRuntime = (params: {
|
|
sessionId: string;
|
|
sessionKey?: string;
|
|
workspaceDir: string;
|
|
agentDir?: string;
|
|
cfg?: OpenClawConfig;
|
|
manifestRegistry?: Pick<PluginManifestRegistry, "plugins">;
|
|
includeServerNames?: ReadonlySet<string>;
|
|
excludeServerNames?: ReadonlySet<string>;
|
|
safeServerNamesByServer?: ReadonlyMap<string, string>;
|
|
connectionOverrides?: ReadonlyMap<string, McpServerConnectionResolved>;
|
|
redactConnectionServerNames?: ReadonlySet<string>;
|
|
requesterScope?: SessionMcpRequesterScope;
|
|
configFingerprint?: string;
|
|
}) => SessionMcpRuntime;
|
|
|
|
export function resolveSessionMcpRuntimeIdleTtlMs(cfg?: OpenClawConfig): number {
|
|
const raw = cfg?.mcp?.sessionIdleTtlMs;
|
|
if (typeof raw === "number" && Number.isFinite(raw) && raw >= 0) {
|
|
return Math.floor(raw);
|
|
}
|
|
return DEFAULT_SESSION_MCP_RUNTIME_IDLE_TTL_MS;
|
|
}
|