import type { IPitcherClient } from "@codesandbox/pitcher-client";
import { Disposable } from "../../utils/disposable";
export type Port = {
    host: string;
    port: number;
};
export declare class Ports {
    private pitcherClient;
    private disposable;
    private onDidPortOpenEmitter;
    get onDidPortOpen(): import("../../utils/event").Event<Port>;
    private onDidPortCloseEmitter;
    get onDidPortClose(): import("../../utils/event").Event<number>;
    private lastOpenedPorts;
    constructor(sessionDisposable: Disposable, pitcherClient: IPitcherClient);
    /**
     * Get a port by number.
     */
    get(port: number): Port | undefined;
    /**
     * Get all ports.
     */
    getAll(): Port[];
    /**
     * Wait for a port to be opened.
     *
     * @param port - The port to wait for.
     * @param options - Additional options
     * @param options.timeoutMs - Optional timeout in milliseconds. If specified, the promise will reject after this time if the port hasn't opened.
     * @returns A promise that resolves when the port is opened.
     * @throws {Error} If the timeout is reached before the port opens
     */
    waitForPort(port: number, options?: {
        timeoutMs?: number;
    }): Promise<Port>;
}
