import type { RuntimeStore } from '../runtime/store/index.js';
import type { RuntimeEventBus, RuntimeEventDomain } from '../runtime/events/index.js';
import type { ControlPlaneClientDescriptor, ControlPlaneServerConfig, ControlPlaneSurfaceMessage } from '@pellux/goodvibes-sdk/platform/control-plane/types';
export interface ControlPlaneGatewayConfig {
    readonly runtimeBus?: RuntimeEventBus | null;
    readonly runtimeStore?: RuntimeStore | null;
    readonly server?: Partial<ControlPlaneServerConfig>;
}
export interface ControlPlaneEventStreamOptions {
    readonly clientId?: string;
    readonly clientKind?: 'tui' | 'web' | 'slack' | 'discord' | 'ntfy' | 'webhook' | 'telegram' | 'google-chat' | 'signal' | 'whatsapp' | 'imessage' | 'msteams' | 'bluebubbles' | 'mattermost' | 'matrix' | 'daemon';
    readonly transport?: 'local' | 'http' | 'sse' | 'ws' | 'webhook';
    readonly label?: string;
    readonly domains?: readonly RuntimeEventDomain[];
    readonly principalId?: string;
    readonly principalKind?: 'user' | 'bot' | 'service' | 'token';
    readonly scopes?: readonly string[];
    readonly sessionId?: string;
    readonly routeId?: string;
    readonly surfaceId?: string;
    readonly remoteAddress?: string;
    readonly capabilities?: readonly string[];
}
export interface ControlPlaneRecentEvent {
    readonly id: string;
    readonly event: string;
    readonly createdAt: number;
    readonly payload: unknown;
}
interface LiveControlPlaneClient {
    readonly clientId: string;
    readonly kind: 'tui' | 'web' | 'slack' | 'discord' | 'ntfy' | 'webhook' | 'telegram' | 'google-chat' | 'signal' | 'whatsapp' | 'imessage' | 'msteams' | 'bluebubbles' | 'mattermost' | 'matrix' | 'daemon';
    readonly surfaceId?: string;
    readonly routeId?: string;
    readonly send: (event: string, payload: unknown, id?: string) => void;
}
export declare class ControlPlaneGateway {
    private runtimeBus;
    private dispatch;
    private readonly serverConfig;
    private readonly clients;
    private readonly liveClients;
    private readonly websocketClients;
    private readonly recentMessages;
    private readonly recentEvents;
    private requestCount;
    private errorCount;
    private lastRequestAt;
    constructor(config?: ControlPlaneGatewayConfig);
    attachRuntime(config: {
        readonly runtimeBus?: RuntimeEventBus | null;
        readonly runtimeStore?: RuntimeStore | null;
    }): void;
    listClients(): ControlPlaneClientDescriptor[];
    getSnapshot(): Record<string, unknown>;
    listSurfaceMessages(limit?: number): ControlPlaneSurfaceMessage[];
    listRecentEvents(limit?: number): ControlPlaneRecentEvent[];
    publishSurfaceMessage(input: Omit<ControlPlaneSurfaceMessage, 'id' | 'createdAt'>): ControlPlaneSurfaceMessage;
    publishEvent(event: string, payload: unknown, filter?: {
        readonly clientKind?: LiveControlPlaneClient['kind'];
        readonly clientId?: string;
        readonly routeId?: string;
        readonly surfaceId?: string;
    }): void;
    recordApiRequest(input: {
        readonly method: string;
        readonly path: string;
        readonly status: number;
        readonly clientKind?: ControlPlaneEventStreamOptions['clientKind'];
        readonly error?: string;
    }): void;
    setServerState(patch: Partial<ControlPlaneServerConfig>): void;
    openWebSocketClient(options: ControlPlaneEventStreamOptions, send: (event: string, payload: unknown, id?: string) => void): {
        clientId: string;
        domains: readonly RuntimeEventDomain[];
    };
    touchWebSocketClient(clientId: string, metadata?: Record<string, unknown>): void;
    authenticateClient(clientId: string, input: {
        readonly principalId: string;
        readonly principalKind?: 'user' | 'bot' | 'service' | 'token';
        readonly scopes?: readonly string[];
        readonly label?: string;
        readonly capabilities?: readonly string[];
    }): void;
    subscribeWebSocketClient(clientId: string, domains: readonly RuntimeEventDomain[]): void;
    unsubscribeWebSocketClient(clientId: string, domains?: readonly RuntimeEventDomain[]): void;
    closeWebSocketClient(clientId: string, reason?: string): void;
    private replayRecentTraffic;
    createEventStream(request: Request, options?: ControlPlaneEventStreamOptions): Response;
    renderWebUi(authTokenHint?: string): Response;
    private rememberEvent;
}
export {};
//# sourceMappingURL=gateway.d.ts.map