/**
 * @module xfetch
 * Drop-in fetch() replacement with auto-upgrade to xBind
 *
 * Provides transparent upgrade from HTTP to xBind when both parties support it.
 * Falls back to regular HTTP fetch() when xBind is not available.
 */
import { Agent } from './agent.js';
/**
 * xFetch options extending standard fetch RequestInit
 */
export interface XFetchOptions extends RequestInit {
    /** Force xBind transport (fail if unavailable) */
    forceXBind?: boolean;
    /** Disable auto-upgrade to xBind (use HTTP only) */
    disableXBind?: boolean;
    /** Agent instance to use (creates ephemeral if not provided) */
    agent?: Agent;
    /** Timeout in milliseconds (default: 30000) */
    timeout?: number;
    /** Retry configuration */
    retry?: {
        /** Maximum retry attempts (default: 3) */
        maxAttempts?: number;
        /** Initial backoff delay in ms (default: 1000) */
        initialDelay?: number;
        /** Backoff multiplier (default: 2) */
        multiplier?: number;
    };
}
/**
 * xFetch response extending standard Response
 */
export interface XFetchResponse extends Response {
    /** True if request was upgraded to xBind */
    usedXBind: boolean;
    /** Transport metadata */
    transport: {
        protocol: 'xbind' | 'http' | 'https';
        latency?: number;
        peerDID?: string;
    };
}
/**
 * xBind capability detection result
 */
interface CapabilityCheck {
    supported: boolean;
    endpoint?: string;
    peerDID?: string;
    version?: string;
}
/**
 * xFetch - Drop-in fetch() replacement with auto-upgrade to xBind
 *
 * @param url - Target URL
 * @param options - Request options (extends fetch RequestInit)
 * @returns Response with xBind metadata
 *
 * @example
 * ```typescript
 * // Basic usage (auto-upgrades to xBind if supported)
 * const response = await xfetch('https://api.example.com/data');
 * console.log('Used xBind?', response.usedXBind);
 * const data = await response.json();
 * ```
 *
 * @example
 * ```typescript
 * // Force xBind (fail if not supported)
 * const response = await xfetch('https://api.example.com/secure', {
 *   forceXBind: true,
 * });
 * ```
 *
 * @example
 * ```typescript
 * // Disable xBind (HTTP only)
 * const response = await xfetch('https://api.example.com/public', {
 *   disableXBind: true,
 * });
 * ```
 *
 * @example
 * ```typescript
 * // With retry and timeout
 * const response = await xfetch('https://api.example.com/data', {
 *   timeout: 10000,
 *   retry: {
 *     maxAttempts: 5,
 *     initialDelay: 500,
 *     multiplier: 2,
 *   },
 * });
 * ```
 */
export declare function xfetch(url: string, options?: XFetchOptions): Promise<XFetchResponse>;
/**
 * Check if a URL supports xBind
 *
 * Utility function for checking xBind support before making a request.
 *
 * @param url - URL to check
 * @returns True if endpoint supports xBind
 *
 * @example
 * ```typescript
 * const supported = await isXBindSupported('https://api.example.com');
 * if (supported) {
 *   console.log('Endpoint supports xBind - request will be upgraded');
 * }
 * ```
 */
export declare function isXBindSupported(url: string): Promise<boolean>;
/**
 * Get xBind capability information for a URL
 *
 * @param url - URL to check
 * @returns Capability information
 *
 * @example
 * ```typescript
 * const info = await getXBindCapability('https://api.example.com');
 * console.log('Peer DID:', info.peerDID);
 * console.log('xBind version:', info.version);
 * ```
 */
export declare function getXBindCapability(url: string): Promise<CapabilityCheck>;
export {};
