/**
 * Shared HTTP transport for every CLI client (Agent API, `lobu apply`, the
 * memory MCP REST proxy, connector-run). Centralizes three things that used to
 * be hand-rolled per client:
 *
 *   1. a default request timeout (`AbortSignal.timeout`) so a hung server never
 *      wedges the CLI forever;
 *   2. a small bounded retry on transient network errors / 5xx for *idempotent*
 *      GETs only;
 *   3. JSON response parsing + a single superset error extractor.
 *
 * Each caller keeps its own error class (`ApiClientError` / `ApiError` / plain
 * `Error`) and response shape — this module only owns the wire layer.
 */
export declare const DEFAULT_REQUEST_TIMEOUT_MS = 30000;
/**
 * Perform a fetch with a default timeout and a bounded retry on transient
 * failures. Retries apply only to `GET` (idempotent) and only for network
 * errors or 5xx responses — 4xx and non-GET methods surface on the first try.
 *
 * A caller-supplied `signal` (or `init.signal`) is respected; we only inject a
 * timeout signal when none was provided, so explicit cancellation still works.
 */
export declare function fetchWithRetry(url: string, init?: RequestInit, options?: {
    fetchImpl?: typeof fetch;
    timeoutMs?: number;
    retries?: number;
}): Promise<Response>;
/**
 * Read a response body as JSON. Returns `undefined` for 204 / empty bodies.
 * On a parse failure of a *successful* response, calls `onInvalidJson` (so each
 * client throws its own error type); for a failed response it returns
 * `{ error: raw }` so the error extractor can still surface the raw text.
 */
export declare function parseJsonResponse(response: Response, url: string, onInvalidJson: (message: string) => never): Promise<unknown>;
/**
 * Single superset error extractor for every CLI client. Pulls a message (and
 * optional code) out of the common server error envelopes:
 *   - `{ error: "msg" }` (+ optional `error_description` / `message` / `code`)
 *   - `{ error: { message, code } }`
 *   - `{ message }`
 *   - `{ error_description }`
 * Falls back to `HTTP <status> <statusText>`.
 */
export declare function extractApiError(parsed: unknown, status: number, statusText: string): {
    message: string;
    code?: string;
};
//# sourceMappingURL=http.d.ts.map