import type { McpServerConfig } from '@pellux/goodvibes-sdk/platform/mcp/config';
import type { McpEvent } from '@pellux/goodvibes-sdk/platform/runtime/events/mcp';
import type { McpServerState, McpServerEntry, McpReconnectConfig, McpTrustLevel, McpPermission, SchemaFreshness, QuarantineReason, McpTrustMode, McpServerRole, McpServerPermissions } from '@pellux/goodvibes-sdk/platform/runtime/mcp/types';
/** Callback type for state-change notifications. */
export type McpEventHandler = (event: McpEvent) => void;
/** Options for constructing a McpLifecycleManager. */
export interface McpLifecycleManagerOptions {
    /** Reconnect back-off configuration. Defaults to DEFAULT_RECONNECT_CONFIG. */
    reconnect?: Partial<McpReconnectConfig>;
    /** Schema freshness TTL in ms. Defaults to 5 minutes. */
    schemaTtlMs?: number;
}
/**
 * McpLifecycleManager — manages the full lifecycle of all configured MCP servers.
 *
 * Usage:
 * ```ts
 * const mgr = createMcpLifecycleManager();
 * mgr.onEvent((e) => store.dispatch(e));
 * await mgr.startAll(configs);
 * // ...
 * await mgr.stopAll();
 * ```
 */
export declare class McpLifecycleManager {
    private readonly servers;
    private readonly clients;
    private readonly permissions;
    private readonly freshness;
    private readonly reconnectConfig;
    private readonly eventHandlers;
    private readonly reconnectTimers;
    constructor(options?: McpLifecycleManagerOptions);
    /**
     * Register an event handler called on every lifecycle transition.
     *
     * @param handler - Callback receiving McpEvent on each transition
     */
    onEvent(handler: McpEventHandler): void;
    /**
     * Register and start all provided server configs.
     *
     * Connection errors on individual servers are logged but do not abort the
     * overall startup.
     *
     * @param configs - Array of server configurations to start
     */
    startAll(configs: McpServerConfig[]): Promise<void>;
    /**
     * Register and start a single server.
     *
     * @param config - Server configuration
     */
    startServer(config: McpServerConfig): Promise<void>;
    /**
     * Disconnect all servers and cancel pending reconnect timers.
     */
    stopAll(): Promise<void>;
    /**
     * Disconnect a single server by name.
     *
     * @param serverName - Server identifier
     * @param reason     - Optional reason for disconnection
     */
    stopServer(serverName: string, reason?: string): Promise<void>;
    /**
     * Check whether a tool call is permitted for the given server.
     *
     * Quarantined schemas unconditionally block execution — the freshness check
     * runs before the permission check so a quarantined schema cannot be bypassed
     * by a permissive trust level.
     *
     * @param serverName - Server identifier
     * @param toolName   - Tool name on the server (not qualified)
     */
    isToolAllowed(serverName: string, toolName: string): McpPermission;
    /**
     * Update the trust level for a server.
     *
     * @param serverName - Server identifier
     * @param level      - New trust level
     */
    setTrustLevel(serverName: string, level: McpTrustLevel): void;
    setTrustMode(serverName: string, mode: McpTrustMode): void;
    setServerRole(serverName: string, role: McpServerRole): void;
    /**
     * Explicitly allow a tool for a server.
     *
     * @param serverName - Server identifier
     * @param toolName   - Tool name
     * @param note       - Optional note
     */
    allowTool(serverName: string, toolName: string, note?: string): void;
    /**
     * Explicitly deny a tool for a server.
     *
     * @param serverName - Server identifier
     * @param toolName   - Tool name
     * @param note       - Optional note
     */
    denyTool(serverName: string, toolName: string, note?: string): void;
    getServerPermissions(serverName: string): McpServerPermissions | null;
    listTrustProfiles(): Array<McpServerPermissions['profile']>;
    /**
     * Return the schema freshness for a server.
     *
     * @param serverName - Server identifier
     */
    getSchemaFreshness(serverName: string): SchemaFreshness;
    /**
     * Returns `true` if the server's schema is quarantined.
     *
     * When quarantined, `isToolAllowed` will block all tool execution until the
     * schema is refreshed (`markFresh` via a successful schema fetch) or an
     * operator approves a temporary override via `approveSchemaQuarantine`.
     *
     * @param serverName - Server identifier
     */
    isSchemaQuarantined(serverName: string): boolean;
    /**
     * Manually quarantine a server's schema.
     *
     * Intended for operator-initiated quarantine (e.g. after detecting schema
     * incompatibility). Emits `MCP_SCHEMA_QUARANTINED`.
     *
     * @param serverName - Server identifier
     * @param reason     - Why quarantine is being applied
     * @param detail     - Optional detail for the MCP panel display
     */
    quarantineSchema(serverName: string, reason: QuarantineReason, detail?: string): void;
    /**
     * Operator override: approve a quarantined schema so tool execution can
     * proceed temporarily without a full schema refresh.
     *
     * The quarantine record is preserved for audit purposes. Freshness transitions
     * to `stale`. Emits `MCP_SCHEMA_QUARANTINE_APPROVED`.
     *
     * @param serverName - Server identifier
     * @param operatorId - Identifier of the approving operator
     */
    approveSchemaQuarantine(serverName: string, operatorId: string): void;
    /** Return the current lifecycle state for a server, or `null` if unknown. */
    getState(serverName: string): McpServerState | null;
    /** Return all server entries as a read-only snapshot. */
    getServers(): ReadonlyMap<string, McpServerEntry>;
    /** Return the entry for a single server, or `null`. */
    getServer(serverName: string): McpServerEntry | null;
    /** Names of all servers currently in an operational state (connected/degraded). */
    get operationalServerNames(): string[];
    private _startServer;
    private _connect;
    private _stopServer;
    private _scheduleReconnect;
    private _cancelReconnect;
    private _setState;
    private _emit;
}
//# sourceMappingURL=manager.d.ts.map