import { UtilityProcess } from "electron";
import { EventEmitter } from "events";
import { AppManifest } from "@edenapp/types";
/**
 * BackendManager
 *
 * Manages utility processes for app backends.
 * Each app's backend code runs in an isolated utility process.
 * Uses Electron's utilityProcess for better main process integration
 * and MessageChannelMain for direct frontend<->backend communication.
 */
export declare class BackendManager extends EventEmitter {
    private backends;
    private backendData;
    /**
     * MessagePort pairs for frontend<->backend communication
     * The BackendManager holds references to the main-process side of ports
     */
    private backendPorts;
    /**
     * Create and start a utility process for an app backend
     */
    createBackend(appId: string, manifest: AppManifest, installPath: string, launchArgs?: string[]): Promise<{
        backend: UtilityProcess;
    }>;
    /**
     * Send a message to a backend's utility process (for IPC from main)
     */
    sendMessage(appId: string, message: any): boolean;
    /**
     * Send a message with ports to a backend's utility process
     */
    sendPortToBackend(appId: string, message: any, ports: Electron.MessagePortMain[]): boolean;
    /**
     * Get the frontend port for an app (to transfer to renderer)
     */
    getFrontendPort(appId: string): Electron.MessagePortMain | undefined;
    /**
     * Terminate a backend utility process
     */
    terminateBackend(appId: string): Promise<void>;
    /**
     * Get backend by app ID
     */
    getBackend(appId: string): UtilityProcess | undefined;
    /**
     * Check if backend exists for app
     */
    hasBackend(appId: string): boolean;
    /**
     * Get all running backend IDs
     */
    getRunningBackends(): string[];
    /**
     * Handle messages from backends (for system-level IPC)
     */
    private handleBackendMessage;
    /**
     * Terminate all backends
     */
    terminateAll(): Promise<void>;
}
//# sourceMappingURL=BackendManager.d.ts.map