import type { Readable } from "node:stream";
/**
 * A stack overflow escaped the legacy writer's record path (RULING-68). `legacyJsonText` itself no longer overflows
 * (senpi#5702): this is the typed form of an overflow in any other recursive step a record passes, instead of a
 * `RangeError` that ends a worker or session.
 * It lives beside the serializer the lifecycle supervisor already loads, so the supervisor's import graph stays unchanged
 * (`test/supervisor-import-graph.test.ts`); the refusal bookkeeping stays in `legacy-record-depth.ts`.
 */
export declare class LegacyRecordDepthError extends Error {
    readonly name = "LegacyRecordDepthError";
    readonly recordType: string;
    constructor(record: unknown, cause: RangeError);
}
/** The engine's own stack overflow, as V8 and JavaScriptCore word it; any other `RangeError` is not a depth refusal. */
export declare function isStackOverflow(cause: unknown): cause is RangeError;
/**
 * `JSON.parse(JSON.stringify(input))` with an explicit stack, so no nesting depth overflows it (senpi#5702). Every
 * getter, `toJSON` and `valueOf` runs once, in `JSON.stringify`'s depth-first order; a cycle and a BigInt throw the
 * same `TypeError`. Returns undefined where `JSON.stringify` returns undefined (an unrepresentable root).
 */
export declare function jsonNormalValue(input: unknown): unknown;
/**
 * `JSON.stringify(value)` for the legacy wire, at any nesting depth (senpi#5702). The native writer is the fast path;
 * only when the engine's own stack overflows does an explicit-stack writer with the same semantics produce the text, so
 * a record the native writer handles is byte-identical to before.
 */
export declare function legacyJsonText(value: unknown): string;
/**
 * Serialize a single strict JSONL record.
 *
 * Framing is LF-only. Payload strings may contain other Unicode separators such as
 * U+2028 and U+2029. Clients must split records on `\n` only. Any nesting depth serializes (senpi#5702).
 */
export declare function serializeJsonLine(value: unknown): string;
export declare const MAX_RPC_LINE_CHARACTERS: number;
export interface JsonlLineReaderOptions {
    maxLineLength?: number;
    onOversizedLine?: () => void;
}
/**
 * Attach an LF-only JSONL reader to a stream.
 *
 * This intentionally does not use Node readline. Readline splits on additional
 * Unicode separators that are valid inside JSON strings and therefore does not
 * implement strict JSONL framing.
 */
export declare function attachJsonlLineReader(stream: Readable, onLine: (line: string) => void, options?: JsonlLineReaderOptions): () => void;
//# sourceMappingURL=jsonl.d.ts.map