/**
 * Deadline / timeout aggregation for provider HTTP calls.
 *
 * A "deadline" combines:
 *   - per-call timeout (caller-supplied, ms)
 *   - provider-default timeout (cfg.providers.<id>.request.timeoutMs, ms)
 *   - upstream AbortSignal (e.g. agent cancellation)
 *
 * The effective timeout is the **smaller** of the per-call value and the
 * provider default; abort is propagated from upstream.
 */
export interface DeadlineInput {
    /** Per-call timeout (ms). Wins when smaller than {@link providerDefaultMs}. */
    timeoutMs?: number;
    /** Provider-default timeout (ms), e.g. from config. */
    providerDefaultMs?: number;
    /** Upstream cancellation. */
    signal?: AbortSignal;
}
export interface ResolvedDeadline {
    /** Final timeout in ms, or undefined when neither side specified one. */
    timeoutMs: number | undefined;
    /** Combined AbortSignal that fires on timeout OR upstream abort. */
    signal: AbortSignal;
    /** Manual cleanup (clear timer, detach listener). Always safe to call. */
    cleanup: () => void;
}
/**
 * Pick the smallest *positive* timeout among the inputs.
 *
 * - Negative / zero / non-finite values are ignored.
 * - Returns undefined when no valid timeout is supplied.
 */
/**
 * Effective positive timeout for outbound provider calls, or `fallbackMs` when
 * neither per-call nor provider-default timeouts are set.
 */
export declare function pickTimeoutMsOrFallback(timeoutMs: number | undefined, providerDefaultMs: number | undefined, fallbackMs: number): number;
export declare function pickEffectiveTimeoutMs(input: DeadlineInput): number | undefined;
/**
 * Build a combined deadline.
 *
 * Always returns a fresh {@link AbortController} so that callers can pass
 * `signal` directly to `fetch()` without leaking listeners on long-lived
 * upstream signals.
 */
export declare function resolveDeadline(input: DeadlineInput): ResolvedDeadline;
/** Concrete error class so callers can distinguish deadline-aborts from upstream-aborts. */
export declare class TimeoutAbortError extends Error {
    readonly timeoutMs: number;
    constructor(timeoutMs: number);
}
export declare function isTimeoutAbortError(e: unknown): e is TimeoutAbortError;
