import type { Client } from "@connectrpc/connect";
import WebSocket from "ws";
import type { SSHGatewayClientService } from "./internal/proto/tenki/sandbox/v1/ssh_gateway_client_pb.js";
import type { RootCertificates } from "./options.js";
export interface SSHConnectOptions {
    rootCertificates?: RootCertificates;
    /**
     * Resolves the full per-session WebSocket URL (ws(s)://.../v1/ssh/<id>)
     * automatically. Returning "" or throwing uses the configured gateway.
     */
    discoverGateway?: (sessionId: string) => Promise<string>;
}
export declare class SSHConnection {
    private ws;
    private closed;
    private readBuf;
    private readResolve;
    constructor(ws: WebSocket);
    read(): Promise<Uint8Array | null>;
    write(data: Uint8Array): Promise<void>;
    close(): void;
}
export declare function deriveGatewayAddress(baseUrl: string): string;
export declare function discoverSSHGatewayUrl(gatewayClient: Client<typeof SSHGatewayClientService>, sessionId: string): Promise<string>;
export declare function gatewaySSHUrl(gatewayAddress: string, sessionId: string): string;
export declare function connectSSH(gatewayAddress: string, sessionId: string, authToken: string, options?: SSHConnectOptions): Promise<SSHConnection>;
