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";
export type GatewayClientOptions = {
    url?: string;
    connectDelayMs?: number;
    tickWatchMinIntervalMs?: number;
    requestTimeoutMs?: number;
    token?: string;
    bootstrapToken?: string;
    deviceToken?: string;
    password?: string;
    instanceId?: string;
    clientName?: GatewayClientName;
    clientDisplayName?: string;
    clientVersion?: string;
    platform?: string;
    deviceFamily?: string;
    mode?: GatewayClientMode;
    role?: string;
    scopes?: string[];
    caps?: string[];
    commands?: string[];
    permissions?: Record<string, boolean>;
    pathEnv?: string;
    deviceIdentity?: DeviceIdentity | null;
    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;
};
export declare const GATEWAY_CLOSE_CODE_HINTS: Readonly<Record<number, string>>;
export declare function describeGatewayCloseCode(code: number): string | undefined;
export declare class GatewayClient {
    private ws;
    private opts;
    private pending;
    private backoffMs;
    private closed;
    private lastSeq;
    private connectNonce;
    private connectSent;
    private connectTimer;
    private pendingDeviceTokenRetry;
    private deviceTokenRetryBudgetUsed;
    private pendingConnectErrorDetailCode;
    private lastTick;
    private tickIntervalMs;
    private tickTimer;
    private readonly requestTimeoutMs;
    constructor(opts: GatewayClientOptions);
    start(): void;
    stop(): void;
    private sendConnect;
    private shouldPauseReconnectAfterAuthFailure;
    private shouldRetryWithStoredDeviceToken;
    private isTrustedDeviceRetryEndpoint;
    private selectConnectAuth;
    private handleMessage;
    private queueConnect;
    private scheduleReconnect;
    private flushPendingErrors;
    private startTickWatch;
    private validateTlsFingerprint;
    request<T = Record<string, unknown>>(method: string, params?: unknown, opts?: {
        expectFinal?: boolean;
        timeoutMs?: number | null;
    }): Promise<T>;
}
