import type { BlitTransport, BlitTransportOptions, ConnectionStatus } from "../types"; export interface UnixSocketTransportOptions extends BlitTransportOptions { } /** * Shared implementation of the blit local-IPC framing protocol * (little-endian `u32` length prefix, see `crates/server/src/lib.rs` * `read_frame`/`write_frame`). * * Concrete subclasses plug in a socket backend (Node's `net` module, * Bun's `Bun.connect`, ...) via {@link openRawSocket}. They receive * bytes through {@link ingestChunk} and must report lifecycle events * via {@link onRawConnect}, {@link onRawClose} and {@link onRawError}. */ export declare abstract class AbstractUnixSocketTransport implements BlitTransport { private _status; private reconnectTimer; private connectTimer; private currentDelay; private disposed; private messageListeners; private statusListeners; /** Local sockets have no passphrase authentication. */ authRejected: boolean; lastError: string | null; /** Incoming byte accumulator. */ private recvBuf; /** Sentinel that tracks which socket attempt events belong to. */ protected currentAttempt: symbol | null; protected readonly path: string; private readonly _reconnect; private readonly initialDelay; private readonly maxDelay; private readonly backoff; private readonly connectTimeoutMs; constructor(path: string, options?: UnixSocketTransportOptions); get status(): ConnectionStatus; send(data: Uint8Array): void; close(): void; suspend(): void; reconnect(): void; addEventListener(type: "message", listener: (data: ArrayBuffer) => void): void; addEventListener(type: "statuschange", listener: (status: ConnectionStatus) => void): void; removeEventListener(type: "message", listener: (data: ArrayBuffer) => void): void; removeEventListener(type: "statuschange", listener: (status: ConnectionStatus) => void): void; connect(): void; /** * Open a backend-specific socket connected to {@link path}. The * subclass must call {@link onRawConnect} on successful connect, * {@link ingestChunk} on every chunk, {@link onRawClose} on peer * close and {@link onRawError} on error. The {@link attempt} * argument must be echoed back so late events from a superseded * socket can be discarded. */ protected abstract openRawSocket(attempt: symbol): void; /** Write raw bytes to the currently open socket, if any. */ protected abstract writeRaw(data: Uint8Array): void; /** Close and discard the current socket without firing events. */ protected abstract destroyRawSocket(): void; protected onRawConnect(attempt: symbol): void; protected ingestChunk(attempt: symbol, chunk: Uint8Array): void; protected onRawError(attempt: symbol, message: string): void; protected onRawClose(attempt: symbol): void; private setStatus; private clearConnectTimer; private clearReconnectTimer; private scheduleReconnect; } //# sourceMappingURL=unix-base.d.ts.map