import { EventEmitter } from '@opensumi/events';
import { BaseConnection } from '@opensumi/ide-connection/lib/common/connection';
import { IDisposable } from '@opensumi/ide-core-common';
export interface IInterProcessConnection {
    $createConnection(id: string): Promise<void>;
    $deleteConnection(id: string): Promise<void>;
    $sendMessage(id: string, message: string): Promise<void>;
}
export declare const IInterProcessConnectionService: unique symbol;
export interface IInterProcessConnectionService extends IInterProcessConnection {
    ensureConnection(id: string): Promise<ExtensionConnection>;
}
/**
 * Definition of the communication layer between the ext process and the main process
 */
export declare class ExtensionConnection implements BaseConnection<string> {
    protected readonly id: string;
    protected readonly proxy: IInterProcessConnection;
    readonly dispose: () => void;
    emitter: EventEmitter<{
        message: [string];
        close: [code?: number, reason?: string];
    }>;
    constructor(id: string, proxy: IInterProcessConnection, dispose: () => void);
    send(data: string): void;
    onMessage(cb: (data: string) => void): IDisposable;
    onceClose(cb: (code?: number, reason?: string) => void): IDisposable;
    close(): void;
    readMessage(message: string): void;
    fireClose(): void;
}
//# sourceMappingURL=connection.d.ts.map