import { type McpServerDeclaration } from "@skaile/workspaces/core"; import type { PreMintedSecretProvider } from "@skaile/workspaces/connectors"; import type { ExternalMcpManager } from "./external-mcp.js"; export interface McpRuntimeHandlerDeps { /** Returns `null` during the brief session-recreate gap; guard before use. */ getOrCreateMcpManager: () => ExternalMcpManager | null; /** `null` when the session has no pre-minted secret store yet (CLI mode). */ getPreMintedSecrets: () => PreMintedSecretProvider | null; /** True when the active driver picks up newly-registered capabilities without a session restart. */ driverPicksUpToolsLive: () => boolean; /** * Record a live-attached server in serve's registry so every later session * rebuild respawns it. Without it the rebuild reads `skaile.yaml` only, which * a live attach never updates, and the server is dropped for good. */ registerLiveAttachedMcp: (declaration: McpServerDeclaration) => void; /** * Queue a driver restart so a non-live driver re-bakes its tool set (owned by * `serve.ts`). Fire-and-forget by contract: the platform caps this capability * call at 30s and a rebuild routinely exceeds that. */ scheduleDriverRestartForToolChanges: (reason: string) => void; emitResourcesAvailable: () => void; log: (msg: string) => void; /** * Absolute path to the session project directory (used by `attachInstance` * for materialized asset lookup). Required when `attachInstance` is invoked. */ getProjectDir?: () => string; } export interface McpRuntimeHandlers { addMcpServer?: (input: { declaration: McpServerDeclaration; preMintedToken?: { token: string; expiresAt?: string | null; }; }) => Promise<{ ok: true; id: string; live: boolean; toolCount: number; } | { ok: false; code: string; message: string; }>; /** * Materialize-then-attach-by-ref: the platform has already written * `/.skaile/assets/mcp-server//MCP.md` (+ optional * `.instance.json` with `resolvedSecrets`). The runner self-derives the * declaration from disk and attaches it live via `ExternalMcpManager.addServer`. * Connectors return `unsupported_kind` (deferred — Phase 2.5). */ attachInstance?: (input: { kind: string; name: string; preMintedToken?: { token: string; expiresAt?: string | null; }; }) => Promise<{ ok: true; id: string; live: boolean; toolCount: number; } | { ok: false; code: string; message: string; }>; } export declare function buildMcpRuntimeHandlers(deps: McpRuntimeHandlerDeps): McpRuntimeHandlers; //# sourceMappingURL=mcp-runtime-handlers.d.ts.map