import type { DeviceIdentity } from "../infra/device-identity.js";
import { type GatewayClientMode, type GatewayClientName } from "../utils/message-channel.js";
import { type EventFrame, type HelloOk } from "./protocol/index.js";
/** Configuration for creating a Gateway WebSocket client connection. */
export type GatewayClientOptions = {
    url?: string;
    token?: string | (() => string | undefined);
    password?: string;
    instanceId?: string;
    clientName?: GatewayClientName;
    clientDisplayName?: string;
    clientVersion?: string;
    platform?: string;
    mode?: GatewayClientMode;
    role?: string;
    scopes?: string[];
    caps?: string[];
    commands?: string[];
    permissions?: Record<string, boolean>;
    pathEnv?: string;
    deviceIdentity?: DeviceIdentity;
    minProtocol?: number;
    maxProtocol?: number;
    tlsFingerprint?: string;
    onEvent?: (evt: EventFrame) => void;
    onHelloOk?: (hello: HelloOk) => void;
    onConnectError?: (err: Error) => void;
    onClose?: (code: number, reason: string) => void;
    onGap?: (info: {
        expected: number;
        received: number;
    }) => void;
    /** Max reconnection attempts before giving up. undefined = unlimited. */
    maxReconnectAttempts?: number;
    /** Called when maxReconnectAttempts is exceeded. */
    onReconnectExhausted?: () => void;
};
export declare const GATEWAY_CLOSE_CODE_HINTS: Readonly<Record<number, string>>;
/** Returns a human-readable hint for known WebSocket close codes. */
export declare function describeGatewayCloseCode(code: number): string | undefined;
/**
 * Persistent WebSocket client that connects to the Gateway daemon.
 * Automatically reconnects with exponential backoff, validates TLS
 * fingerprints, detects stalled connections via tick monitoring, and
 * provides a typed request/response interface for RPC calls.
 */
export declare class GatewayClient {
    private ws;
    private opts;
    private pending;
    private backoffMs;
    private reconnectAttempts;
    private closed;
    private lastSeq;
    private connectNonce;
    private connectSent;
    private connectTimer;
    private lastTick;
    private tickIntervalMs;
    private tickTimer;
    constructor(opts: GatewayClientOptions);
    start(): void;
    stop(): void;
    private sendConnect;
    private handleMessage;
    private queueConnect;
    private scheduleReconnect;
    private flushPendingErrors;
    private startTickWatch;
    private validateTlsFingerprint;
    request<T = Record<string, unknown>>(method: string, params?: unknown, opts?: {
        expectFinal?: boolean;
    }): Promise<T>;
}
