export declare const PACKET_ID_FILE_SENDREQUEST = 80; export declare const PACKET_ID_FILE_CONTROL = 81; export declare const PACKET_ID_FILE_DATA = 82; export declare const PACKET_ID_FILE_FEC = 83; export declare const FILE_ID_LENGTH = 32; export declare const MAX_FILENAME_LENGTH = 255; export declare const MAX_CONCURRENT_FILE_PIPES = 256; export declare const MAX_FILE_DATA_SIZE = 1367; export declare const FILECONTROL: { readonly ACCEPT: 0; readonly PAUSE: 1; readonly KILL: 2; readonly SEEK: 3; readonly ACK: 4; }; export declare const FILEKIND: { readonly DATA: 0; readonly AVATAR: 1; }; export declare function encodeFileSendRequest(fileNumber: number, fileType: number, fileSize: bigint, fileId: Uint8Array, filename: string): Uint8Array; export declare function parseFileSendRequest(p: Uint8Array): { fileNumber: number; fileType: number; fileSize: bigint; fileId: Uint8Array; filename: string; } | undefined; export declare function encodeFileControl(sendReceive: number, fileNumber: number, controlType: number, data?: Uint8Array): Uint8Array; export declare function parseFileControl(p: Uint8Array): { sendReceive: number; fileNumber: number; controlType: number; data: Uint8Array; } | undefined; export declare function encodeFileData(fileNumber: number, offset: number, data: Uint8Array): Uint8Array; export declare function parseFileData(p: Uint8Array): { fileNumber: number; offset: number; data: Uint8Array; } | undefined; export type FtSend = (friendId: string, packetId: number, payload: Uint8Array) => Promise; export type FtEmit = (event: string, payload: Record) => void; export type FtIsLanPath = (friendId: string) => boolean; export type FtPathKind = "lan" | "udp-direct" | "relay"; export type FtPathKindFn = (friendId: string) => FtPathKind; /** Fired every watchdog tick while the zero-delivery breaker is engaged: the * current bulk path is delivering NOTHING (no ack progress). The embedder * should fail the transfer over to its reliable path (e.g. pin file traffic * to the TCP relay) — inbound-UDP freshness does NOT prove our outbound UDP * reaches the peer, and a one-way path looks exactly like this. */ export type FtDeadPathFn = (friendId: string) => void; export declare class FileTransferManager { #private; private readonly send; private readonly emit; private readonly isLanPath; private readonly pathKind; private readonly onDeadPath; constructor(send: FtSend, emit: FtEmit, isLanPath?: FtIsLanPath, pathKind?: FtPathKindFn, onDeadPath?: FtDeadPathFn); /** Enable resumable receives: partials are persisted under `dir` and matched * on re-offer by content-hash fileId. Unset = in-memory only (no resume). */ setResumeDir(dir: string): void; sendFile(friendId: string, data: Uint8Array, opts: { name: string; kind?: number; }): string | null; accept(friendId: string, fileNumber: number): void; cancel(friendId: string, fileNumber: number, isSending: boolean): void; cancelByFileId(friendId: string, fileIdHex: string, isSending: boolean): boolean; /** Cancel in-flight sends matching both name and size. * This is a conservative registry-desync fallback after fileId/hash lookup. */ cancelSendsMatching(friendId: string, match: { name?: string; size: number; }): string[]; handlePacket(friendId: string, packetId: number, payload: Uint8Array): boolean; clearFriend(friendId: string): void; }