export type TerminalUrlResolver = { wsAuthQuery(): Record; wsBase(baseUrl: string): string; /** * The socket of one terminal, for a host that addresses each by path (a * Conduit terminal binding's `/sessions/{id}/ws`). Given, the terminal and * its size are not added to the URL: the size goes as a `resize` message * once the socket is open, as it does for any resize. */ wsUrl?(baseUrl: string, terminalId: string): string; }; export declare const directTerminalUrlResolver: TerminalUrlResolver; export type TerminalHelloMessage = { type: "hello"; cols: number; rows: number; }; export type TerminalOutputMessage = { type: "output"; data: string; }; export type TerminalExitMessage = { type: "exit"; exitCode: number; signal?: number; }; export type TerminalErrorMessage = { type: "error"; message: string; }; export type TerminalInputRejectedMessage = { type: "input-rejected"; message: string; }; export type TerminalMessage = TerminalHelloMessage | TerminalOutputMessage | TerminalExitMessage | TerminalErrorMessage | TerminalInputRejectedMessage; export type TerminalClientOptions = { authToken?: () => string | undefined; baseUrl: string; cols?: number; rows?: number; terminalId: string; urlResolver?: TerminalUrlResolver; }; export declare class TerminalClient { /** The size last asked for: the constructor's, then each resize's. */ cols: number | undefined; rows: number | undefined; readonly terminalId: string; private readonly authToken?; private socket?; private readonly baseUrl; private readonly urls; constructor({ authToken, baseUrl, cols, rows, terminalId, urlResolver }: TerminalClientOptions); connect(): WebSocket; write(data: string): void; resize(cols: number, rows: number): void; close(): void; parse(raw: string): TerminalMessage; private requireOpenSocket; private url; } export declare function webSocketBaseUrl(baseUrl: string): string;