import type { CliConfig } from './config.js';
export declare class NetworkError extends Error {
    readonly code: string;
    readonly hint?: string | undefined;
    readonly status = 0;
    /** `hint` is printed after the error; doctor, which is the connectivity check, leaves it out. */
    constructor(message: string, code: string, cause?: unknown, hint?: string | undefined);
}
export declare function networkError(error: unknown, url: string, timeoutMs: number, timedOut: boolean): NetworkError;
/** The option that sets each service's origin, which a caller names for the redirect message. */
export type OriginOption = '--base-url' | '--one-url' | '--auth-url';
export declare const MAX_RESPONSE_BYTES: number;
/** Bound decoded bytes even when Content-Length is absent, compressed, or dishonest. */
export declare function readBoundedBody(response: Response, signal: AbortSignal, maxBytes?: number): Promise<string>;
/**
 * A signal that aborts with the reason of the first of `signals` to abort.
 * Uses `AbortSignal.any` (Node 20.3+) and combines them by hand on older
 * Node 20; `dispose` then removes the listeners so a long-lived signal does
 * not collect one per request.
 */
export declare function anySignal(signals: AbortSignal[]): {
    signal: AbortSignal;
    dispose: () => void;
};
/**
 * Keep the timeout active until the complete response body has been read. `option` names the option that sets the
 * service's origin, for the message when it redirects.
 */
export declare function requestText(config: CliConfig, url: string, { option, ...init }?: RequestInit & {
    option?: OriginOption;
}): Promise<{
    response: Response;
    text: string;
}>;
export declare function parseJsonResponse(response: Response, text: string): unknown;
