/**
 * Log Aggregator
 *
 * Provides efficient querying across multiple log files with streaming,
 * filtering, and pagination support.
 *
 * @module core/logs/log-aggregator
 */
import { SyncPlatform } from '../types/sync-config.js';
import { SyncOperation } from '../sync/permission-enforcer.js';
import { AuditLogEntry } from '../sync/sync-audit-logger.js';
import { Logger } from '../../utils/logger.js';
/**
 * Query options for log aggregation
 */
export interface LogQuery {
    /**
     * Start date (inclusive)
     */
    since?: Date;
    /**
     * End date (inclusive)
     */
    until?: Date;
    /**
     * Filter by platform
     */
    platform?: SyncPlatform;
    /**
     * Filter by operation type
     */
    operation?: SyncOperation;
    /**
     * Filter by result
     */
    result?: 'success' | 'denied' | 'error';
    /**
     * Maximum number of entries to return
     * @default 100
     */
    limit?: number;
    /**
     * Number of entries to skip
     * @default 0
     */
    offset?: number;
}
/**
 * Query result with metadata
 */
export interface LogQueryResult {
    entries: AuditLogEntry[];
    total: number;
    hasMore: boolean;
    query: LogQuery;
    executionTimeMs: number;
}
/**
 * Log aggregator options
 */
export interface LogAggregatorOptions {
    /**
     * Path to .specweave directory
     */
    specweavePath?: string;
    /**
     * Logger instance
     */
    logger?: Logger;
    /**
     * Default query limit
     * @default 100
     */
    defaultLimit?: number;
}
/**
 * LogAggregator - Efficient cross-file log querying
 *
 * Features:
 * - Stream-based processing (memory efficient)
 * - Date range filtering
 * - Platform/operation/result filtering
 * - Pagination support
 * - Early termination when limit reached
 */
export declare class LogAggregator {
    private readonly logDir;
    private readonly logger;
    private readonly defaultLimit;
    constructor(options?: LogAggregatorOptions);
    /**
     * Query log entries across all log files
     */
    query(query?: LogQuery): Promise<LogQueryResult>;
    /**
     * Count entries matching query
     */
    count(query?: LogQuery): Promise<number>;
    /**
     * Get aggregated statistics
     */
    getStats(query?: LogQuery): Promise<{
        total: number;
        byResult: Record<string, number>;
        byPlatform: Record<SyncPlatform, number>;
        byOperation: Record<string, number>;
        avgDurationMs: number;
    }>;
    /**
     * Get all log files in date range, sorted newest first
     */
    private getLogFilesForDateRange;
    /**
     * Read and filter a single log file using streaming
     */
    private readAndFilterFile;
    /**
     * Check if an entry matches the query filters
     */
    private matchesQuery;
    /**
     * Extract date string from filename (audit-YYYY-MM-DD.jsonl)
     */
    private extractDateFromFilename;
    /**
     * Format date to YYYY-MM-DD string
     */
    private formatDateStr;
}
//# sourceMappingURL=log-aggregator.d.ts.map