export interface ResponseTextPrefix { text: string; /** True when the byte limit was reached before EOF was observed. */ truncated: boolean; } /** Base class for deterministic response-protocol violations. */ export declare class InvalidResponseBodyError extends TypeError { constructor(message: string, options?: ErrorOptions); } /** Raised when a response stream yields an invalid byte chunk. */ export declare class InvalidResponseBodyChunkError extends InvalidResponseBodyError { constructor(message: string, options?: ErrorOptions); } /** Raised when response metadata cannot describe a bounded body safely. */ export declare class InvalidResponseBodyMetadataError extends InvalidResponseBodyError { constructor(message: string, options?: ErrorOptions); } /** Raised when a streamed JSON envelope is malformed or has the wrong shape. */ export declare class InvalidResponseBodyJsonError extends InvalidResponseBodyError { constructor(message: string, options?: ErrorOptions); } /** Raised when streamed JSON nesting exceeds the parser's structural bound. */ export declare class InvalidResponseBodyJsonNestingError extends RangeError { constructor(message: string); } /** Raised when strict response decoding encounters malformed UTF-8. */ export declare class InvalidResponseBodyUtf8Error extends InvalidResponseBodyError { constructor(options?: ErrorOptions); } /** Raised when one streamed JSON string exceeds its admitted logical UTF-8 size. */ export declare class JsonStringValueTooLargeError extends RangeError { readonly maximumBytes: number; constructor(maximumBytes: number); } /** Raised when JSON bytes outside the selected string exceed their policy budget. */ export declare class JsonNonValueBytesTooLargeError extends RangeError { readonly maximumBytes: number; constructor(maximumBytes: number); } /** Raised when a response exceeds its independent whole-body transport ceiling. */ export declare class ResponseBodyTooLargeError extends RangeError { readonly maximumBytes: number; constructor(maximumBytes: number); } /** * Derive a hard JSON-document ceiling that admits every string within its * logical UTF-8 limit plus a separate policy budget for keys, metadata, * delimiters, and other non-value bytes. */ export declare function maximumJsonStringDocumentBytes(maximumValueBytes: number, maximumNonValueBytes: number): number; /** * Read one top-level JSON string as exact UTF-8 bytes without retaining or * parsing the complete response envelope. Other JSON fields are validated and * discarded incrementally. When supplied, `maximumNonValueBytes` independently * bounds every source byte outside the selected string's encoded contents. */ export declare function readResponseJsonStringBytesWithinLimit(response: Response, fieldName: string, maximumValueBytes: number, maximumResponseBytes: number, abortSignal?: AbortSignal, maximumNonValueBytes?: number): Promise; /** * Read one top-level JSON string losslessly while bounding its logical UTF-8 * size. Escaped lone surrogates retain the same UTF-16 code units JSON.parse * would return; the byte-oriented helper intentionally uses replacement bytes. * `maximumNonValueBytes` has the same independent envelope semantics as above. */ export declare function readResponseJsonStringWithinLimit(response: Response, fieldName: string, maximumValueBytes: number, maximumResponseBytes: number, abortSignal?: AbortSignal, maximumNonValueBytes?: number): Promise; /** Read at most maxBytes from a response body and cancel any unread remainder. */ export declare function readResponseTextPrefix(response: Response, maxBytes: number, abortSignal?: AbortSignal, options?: { fatalUtf8?: boolean; }): Promise; //# sourceMappingURL=response-body.d.ts.map