import { z } from "zod"; /** * File-transfer binary frame codec (architecture/websocket-protocol.md § Binary frames, * features/file-explorer-transfer.md § Binary transfer frames). Separate from the terminal codec * but lives in the same module family. * * Frame layout: `[1-byte opcode][1-byte stream][payload]`. * - `stream` multiplexes concurrent transfers on one socket (0–255). * - A transfer is `Begin` (metadata header) → N × `Chunk` (raw bytes) → `End` (completion marker), * or `Error` to abort. * * NOTE: exact opcode values / chunk sizing / completion marker are TODO(verify) against the live * codec; this is a faithful chunked-with-completion-marker reconstruction from the scope. */ export declare const FileTransferOpcode: { readonly Begin: 16; readonly Chunk: 17; readonly End: 18; readonly Error: 19; }; export type FileTransferOpcodeName = keyof typeof FileTransferOpcode; /** Metadata header for a transfer (carried by the `Begin` frame as UTF-8 JSON). */ export declare const fileTransferBeginSchema: z.ZodObject<{ transferId: z.ZodString; fileName: z.ZodOptional; mimeType: z.ZodOptional; totalBytes: z.ZodOptional; }, "strip", z.ZodTypeAny, { transferId: string; fileName?: string | undefined; mimeType?: string | undefined; totalBytes?: number | undefined; }, { transferId: string; fileName?: string | undefined; mimeType?: string | undefined; totalBytes?: number | undefined; }>; export type FileTransferBegin = z.infer; export type FileTransferFrame = { opcode: "Begin"; stream: number; meta: FileTransferBegin; } | { opcode: "Chunk"; stream: number; data: Uint8Array; } | { opcode: "End"; stream: number; ok: boolean; } | { opcode: "Error"; stream: number; message: string; }; export declare class FileTransferFrameError extends Error { constructor(message: string); } export declare function encodeFileTransferFrame(f: FileTransferFrame): Uint8Array; export declare function decodeFileTransferFrame(bytes: Uint8Array): FileTransferFrame; export declare function tryDecodeFileTransferFrame(bytes: Uint8Array): FileTransferFrame | null; //# sourceMappingURL=file-transfer-protocol.d.ts.map