/** * Newline-delimited JSON framing for the box session host. * * The host reads a raw TCP stream, so it cuts the lines itself. Two properties * are load-bearing: * - lines are cut on BYTES and decoded one whole line at a time, so a * character split across two TCP chunks arrives intact; * - the length cap trips as soon as the pending bytes pass it, not when a * newline finally arrives. Otherwise a peer that never sends "\n" could make * the host buffer without limit — and before the hello check, that peer is * anyone who can reach the port. */ export interface LineSplitterOptions { /** * Longest allowed line in bytes, not counting the newline. A function is * re-read per chunk, which is how the connection holds a peer to a small cap * until it has signed in and a generous one afterwards. */ maxLineBytes: number | (() => number); onLine: (line: string) => void; /** Called once, when a line passes the cap. Nothing is emitted afterwards. */ onOverflow: () => void; } export interface LineSplitter { push(chunk: Buffer): void; /** Flush a final line that arrived without a trailing newline. */ end(): void; } export declare function createLineSplitter(options: LineSplitterOptions): LineSplitter; //# sourceMappingURL=session-host-ndjson.d.ts.map