/** * Agentic QE v3 - Causal Discovery Engine * ADR-035: STDP-based spike timing correlation for root cause analysis * * Main engine for causal discovery and root cause analysis. * Uses STDP learning to automatically discover causal relationships between events. */ import { CausalDiscoveryConfig, TestEvent, TestEventType, CausalGraph, RootCauseAnalysis, CausalSummary } from './types'; /** * Causal Discovery Engine * * Observes event streams and learns causal relationships using STDP. * Provides root cause analysis for target events. */ export declare class CausalDiscoveryEngine { private readonly weightMatrix; private eventHistory; private readonly config; private firstEventTime; private lastEventTime; constructor(config?: Partial); /** * Observe a single test event * Updates the weight matrix using STDP learning */ observe(event: TestEvent): void; /** * Observe a batch of events in chronological order */ observeBatch(events: TestEvent[]): void; /** * Perform root cause analysis for a target event type * Returns ranked causes, intervention points, and confidence */ analyzeRootCause(targetEvent: TestEventType): RootCauseAnalysis; /** * Find optimal intervention points for a target event * Uses mincut-inspired heuristics to find bottleneck events */ private findInterventionPoints; /** * Generate human-readable reason for intervention */ private generateInterventionReason; /** * Calculate confidence score for the analysis */ private calculateConfidence; /** * Get the current causal graph */ getCausalGraph(): CausalGraph; /** * Predict which events are likely to cause a target event * Returns events that strongly cause the target (strength > threshold) */ predictCauses(targetEvent: TestEventType, threshold?: number): TestEventType[]; /** * Predict which events a source event is likely to cause */ predictEffects(sourceEvent: TestEventType, threshold?: number): TestEventType[]; /** * Get summary statistics about the causal discovery */ getSummary(): CausalSummary; /** * Apply decay to learned weights * Should be called periodically to prevent weight explosion */ decay(): void; /** * Reset all learned causal relationships */ reset(): void; /** * Get recently observed events for a specific type */ getRecentEvents(eventType: TestEventType, limit?: number): TestEvent[]; /** * Get all events in a time window */ getEventsInWindow(startTime: number, endTime: number): TestEvent[]; /** * Find the most likely root cause for a recent failure * Combines causal analysis with temporal proximity */ findMostLikelyRootCause(failureEvent: TestEvent): { event: TestEventType; probability: number; } | null; /** * Serialize the engine state to JSON */ toJSON(): { config: CausalDiscoveryConfig; weights: Record; history: TestEvent[]; firstEventTime: number; lastEventTime: number; }; /** * Restore engine state from JSON */ static fromJSON(data: { config?: Partial; weights?: Record; history?: TestEvent[]; firstEventTime?: number; lastEventTime?: number; }): CausalDiscoveryEngine; /** * Get the configuration */ getConfig(): CausalDiscoveryConfig; /** * Get the observation count */ getObservationCount(): number; } //# sourceMappingURL=discovery-engine.d.ts.map