import type { RegisteredService, ServiceInfo, ConnectResult } from "@edenapp/types";
import { CommandRegistry } from "../ipc";
import { BackendManager } from "../process-manager/BackendManager";
/**
 * AppChannelManager
 *
 * Central manager for peer-to-peer channels between apps.
 * Uses Electron's MessageChannelMain for direct communication
 * that bypasses the main process after initial setup.
 */
export declare class AppChannelManager {
    /** Map of "appId:serviceName" -> RegisteredService */
    private services;
    /** Active connections for cleanup tracking */
    private connections;
    /** IPC handler for appbus/* commands */
    private handler;
    private backendManager;
    constructor(commandRegistry: CommandRegistry, backendManager: BackendManager);
    /**
     * Generate a unique key for a service
     */
    private serviceKey;
    /**
     * Register a service that an app exposes
     */
    registerService(appId: string, serviceName: string, webContentsId: number, options?: {
        description?: string;
        allowedClients?: string[];
    }): void;
    /**
     * Unregister a service
     */
    unregisterService(appId: string, serviceName: string): boolean;
    /**
     * Unregister all services from an app (called when app stops)
     */
    unregisterAllServices(appId: string): number;
    /**
     * Get a registered service
     */
    getService(appId: string, serviceName: string): RegisteredService | undefined;
    /**
     * Check if a client app is allowed to connect to a service
     */
    isClientAllowed(service: RegisteredService, clientAppId: string): boolean;
    /**
     * Connect to a service - creates MessageChannel and transfers ports directly
     */
    connect(requesterAppId: string, requesterWebContentsId: number, targetAppId: string, serviceName: string): ConnectResult;
    /**
     * Close a channel connection
     */
    closeConnection(connectionId: string): boolean;
    /**
     * Close all connections for a specific app (called when app/backend stops)
     */
    closeConnectionsForApp(appId: string): void;
    /**
     * Helper to notify a process that a port was closed
     */
    private notifyPortClosed;
    /**
     * List all registered services
     */
    listServices(): ServiceInfo[];
    /**
     * Get services by app ID
     */
    getServicesByApp(appId: string): ServiceInfo[];
    /**
     * Check if an app has any registered services
     */
    hasServices(appId: string): boolean;
    /**
     * Cleanup all connections and services
     */
    destroy(): void;
}
//# sourceMappingURL=AppChannelManager.d.ts.map