/**
 * @module debug-mode
 * Debug mode for enhanced developer experience with verbose logging and state inspection
 *
 * Provides comprehensive debugging capabilities including:
 * - Verbose logging of all operations
 * - Internal state dumping and inspection
 * - Network request/response logging
 * - Crypto operation tracing
 * - Performance profiling and timing
 * - Memory usage tracking
 *
 * Usage:
 * ```typescript
 * import { enableDebugMode, dumpState, createDebugLogger } from '@private.me/xbind/debug-mode';
 *
 * // Enable debug mode globally
 * enableDebugMode({ verbose: true, traceNetwork: true });
 *
 * // Create debug logger for component
 * const debug = createDebugLogger('agent');
 * debug.trace('Operation starting', { did: 'did:key:...' });
 *
 * // Dump internal state
 * const state = dumpState(agent);
 * console.log(state);
 * ```
 */
import type { Logger, LogContext } from './logger.js';
import type { Agent } from './agent.js';
/**
 * Debug mode configuration options
 */
export interface DebugModeOptions {
    /** Enable verbose logging (default: false) */
    verbose?: boolean;
    /** Trace network requests/responses (default: false) */
    traceNetwork?: boolean;
    /** Trace crypto operations (default: false) */
    traceCrypto?: boolean;
    /** Enable performance profiling (default: false) */
    profile?: boolean;
    /** Track memory usage (default: false) */
    trackMemory?: boolean;
    /** Log internal state changes (default: false) */
    traceState?: boolean;
    /** Custom output function (default: console.log) */
    output?: (message: string) => void;
    /** Filter patterns for selective logging */
    filters?: {
        /** Include only operations matching these patterns */
        include?: RegExp[];
        /** Exclude operations matching these patterns */
        exclude?: RegExp[];
    };
}
/**
 * Performance measurement result
 */
export interface PerformanceMeasurement {
    /** Operation name */
    operation: string;
    /** Start timestamp (ms) */
    startTime: number;
    /** End timestamp (ms) */
    endTime: number;
    /** Duration (ms) */
    duration: number;
    /** Memory usage before operation (bytes) */
    memoryBefore?: number;
    /** Memory usage after operation (bytes) */
    memoryAfter?: number;
    /** Memory delta (bytes) */
    memoryDelta?: number;
    /** Additional context */
    context?: Record<string, unknown>;
}
/**
 * Network trace entry
 */
export interface NetworkTrace {
    /** Request ID */
    id: string;
    /** HTTP method */
    method: string;
    /** URL */
    url: string;
    /** Request headers (redacted) */
    requestHeaders: Record<string, string>;
    /** Request body (truncated) */
    requestBody?: string;
    /** Response status code */
    status?: number;
    /** Response headers (redacted) */
    responseHeaders?: Record<string, string>;
    /** Response body (truncated) */
    responseBody?: string;
    /** Start timestamp */
    startTime: number;
    /** End timestamp */
    endTime?: number;
    /** Duration (ms) */
    duration?: number;
    /** Error (if failed) */
    error?: string;
}
/**
 * Crypto operation trace entry
 */
export interface CryptoTrace {
    /** Operation type (encrypt, decrypt, sign, verify, etc.) */
    operation: string;
    /** Algorithm */
    algorithm: string;
    /** Input size (bytes) */
    inputSize: number;
    /** Output size (bytes) */
    outputSize?: number;
    /** Duration (ms) */
    duration: number;
    /** Success flag */
    success: boolean;
    /** Error message (if failed) */
    error?: string;
    /** Timestamp */
    timestamp: number;
}
/**
 * Agent state snapshot
 */
export interface AgentStateSnapshot {
    /** Agent DID */
    did: string;
    /** Identity mode */
    identityMode: 'persistent' | 'ephemeral';
    /** Registration status */
    registered: boolean;
    /** Trust registry URL */
    registryUrl?: string;
    /** Nonce store type */
    nonceStoreType: string;
    /** Nonce count */
    nonceCount: number;
    /** Transport adapter type */
    transportType: string;
    /** Security policy summary */
    securityPolicy: {
        level: string;
        replayWindow: number;
        timestampTolerance: number;
    };
    /** Post-quantum enabled */
    postQuantum: boolean;
    /** Memory usage (bytes) */
    memoryUsage?: number;
    /** Snapshot timestamp */
    timestamp: number;
}
/**
 * Enable debug mode with optional configuration
 *
 * @param options - Debug mode options
 */
export declare function enableDebugMode(options?: DebugModeOptions): void;
/**
 * Disable debug mode and clear collected data
 */
export declare function disableDebugMode(): void;
/**
 * Check if debug mode is enabled
 */
export declare function isDebugEnabled(): boolean;
/**
 * Get current debug mode options
 */
export declare function getDebugOptions(): DebugModeOptions;
/**
 * Create a debug logger for a specific component
 *
 * @param component - Component name
 * @returns Logger instance with debug capabilities
 */
export declare function createDebugLogger(component: string): Logger & {
    trace: (message: string, context?: LogContext) => void;
};
/**
 * Start performance measurement for an operation
 *
 * @param operation - Operation name
 * @param context - Optional context
 */
export declare function startProfiling(operation: string, context?: Record<string, unknown>): void;
/**
 * End performance measurement and record result
 *
 * @param operation - Operation name
 * @param context - Optional context (overrides context from startProfiling if provided)
 */
export declare function endProfiling(operation: string, context?: Record<string, unknown>): void;
/**
 * Get all performance measurements
 */
export declare function getPerformanceMeasurements(): PerformanceMeasurement[];
/**
 * Clear performance measurements
 */
export declare function clearPerformanceMeasurements(): void;
/**
 * Log network request start
 *
 * @param id - Request ID
 * @param method - HTTP method
 * @param url - URL
 * @param headers - Request headers
 * @param body - Request body
 */
export declare function traceNetworkRequest(id: string, method: string, url: string, headers: Record<string, string>, body?: string): void;
/**
 * Log network response
 *
 * @param id - Request ID
 * @param status - HTTP status code
 * @param headers - Response headers
 * @param body - Response body
 * @param error - Error (if failed)
 */
export declare function traceNetworkResponse(id: string, status?: number, headers?: Record<string, string>, body?: string, error?: string): void;
/**
 * Get all network traces
 */
export declare function getNetworkTraces(): NetworkTrace[];
/**
 * Clear network traces
 */
export declare function clearNetworkTraces(): void;
/**
 * Log crypto operation
 *
 * @param operation - Operation type
 * @param algorithm - Algorithm name
 * @param inputSize - Input size (bytes)
 * @param outputSize - Output size (bytes)
 * @param duration - Duration (ms)
 * @param success - Success flag
 * @param error - Error message (if failed)
 */
export declare function traceCryptoOperation(operation: string, algorithm: string, inputSize: number, outputSize?: number, duration?: number, success?: boolean, error?: string): void;
/**
 * Get all crypto traces
 */
export declare function getCryptoTraces(): CryptoTrace[];
/**
 * Clear crypto traces
 */
export declare function clearCryptoTraces(): void;
/**
 * Dump internal state of an agent
 *
 * @param agent - Agent instance
 * @returns State snapshot
 */
export declare function dumpState(agent: Agent): AgentStateSnapshot;
/**
 * Get all state snapshots
 */
export declare function getStateSnapshots(): AgentStateSnapshot[];
/**
 * Clear state snapshots
 */
export declare function clearStateSnapshots(): void;
/**
 * Export all debug data as JSON
 *
 * @returns JSON string with all debug data
 */
export declare function exportDebugData(): string;
/**
 * Clear all debug data
 */
export declare function clearAllDebugData(): void;
/**
 * Generate debug report
 *
 * @returns Human-readable debug report
 */
export declare function generateDebugReport(): string;
