import { i as OpenClawConfig } from "./types.openclaw-fYj4Ft14.js"; import { r as AnyAgentTool } from "./common-trYgkCB1.js"; import { TSchema } from "typebox"; import { CallToolResult } from "@modelcontextprotocol/sdk/types.js"; //#region src/agents/agent-bundle-mcp-types.d.ts /** Materialized MCP tools plus diagnostics and cleanup handle for one run. */ type BundleMcpToolRuntime = { tools: AnyAgentTool[]; diagnostics?: readonly McpToolCatalogDiagnostic[]; dispose: () => Promise; }; /** Catalog metadata for one configured MCP server. */ type McpServerCatalog = { serverName: string; safeServerName?: string; launchSummary: string; toolCount: number; resources?: { listChanged?: boolean; }; prompts?: { listChanged?: boolean; }; tools?: { listChanged?: boolean; filteredCount?: number; }; requestTimeoutMs?: number; supportsParallelToolCalls?: boolean; toolFilter?: { include?: string[]; exclude?: string[]; }; }; /** MCP tool entry after server-name sanitization and schema normalization. */ type McpCatalogTool = { serverName: string; safeServerName: string; toolName: string; title?: string; description?: string; inputSchema: TSchema; fallbackDescription: string; }; /** Complete tool catalog for a session-scoped MCP runtime. */ type McpToolCatalog = { version: number; generatedAt: number; servers: Record; tools: McpCatalogTool[]; diagnostics?: readonly McpToolCatalogDiagnostic[]; }; type McpToolCatalogDiagnostic = { serverName: string; safeServerName: string; launchSummary: string; message: string; }; /** Live MCP runtime bound to one session/workspace. */ type SessionMcpRuntime = { sessionId: string; sessionKey?: string; workspaceDir: string; configFingerprint: string; createdAt: number; lastUsedAt: number; activeLeases?: number; acquireLease?: () => () => void; /** Lists tools if needed and may connect MCP transports. */ getCatalog: () => Promise; /** Returns the cached catalog only; must not start runtimes, connect transports, or issue tools/list. */ peekCatalog: () => McpToolCatalog | null; markUsed: () => void; callTool: (serverName: string, toolName: string, input: unknown) => Promise; listResources?: (serverName: string) => Promise; readResource?: (serverName: string, uri: string) => Promise; listPrompts?: (serverName: string) => Promise; getPrompt?: (serverName: string, name: string, args?: Record) => Promise; dispose: () => Promise; }; /** Manager for session-scoped MCP runtimes and their idle lifecycle. */ type SessionMcpRuntimeManager = { getOrCreate: (params: { sessionId: string; sessionKey?: string; workspaceDir: string; cfg?: OpenClawConfig; }) => Promise; bindSessionKey: (sessionKey: string, sessionId: string) => void; resolveSessionId: (sessionKey: string) => string | undefined; /** Looks up an existing runtime only; must not create runtimes or connect transports. */ peekSession: (params: { sessionId?: string; sessionKey?: string; }) => SessionMcpRuntime | undefined; disposeSession: (sessionId: string) => Promise; disposeAll: () => Promise; sweepIdleRuntimes: () => Promise; listSessionIds: () => string[]; }; //#endregion export { SessionMcpRuntimeManager as a, SessionMcpRuntime as i, McpCatalogTool as n, McpToolCatalog as r, BundleMcpToolRuntime as t };