/** * Drift Detection Agent * * Uses AI to detect when documentation drifts from the actual codebase. * This is the core of intelligent drift detection for k0ntext v3.1.0. * * @version 3.1.0 */ import { OpenRouterClient } from '../embeddings/openrouter.js'; /** * A detected drift issue */ export interface DriftIssue { /** The file where drift was detected */ file: string; /** Severity level */ severity: 'low' | 'medium' | 'high'; /** What the documentation says */ expected: string; /** What the actual codebase has */ actual: string; /** Suggested fix (optional) */ suggestion?: string; /** Line number where drift occurs (optional) */ line?: number; } /** * Result of drift detection */ export interface DriftResult { /** All detected drifts */ drifts: DriftIssue[]; /** Number of drifts automatically fixed */ fixed: number; /** Files checked */ filesChecked: number; /** Time taken in milliseconds */ duration: number; /** Files that failed due to authentication errors */ authFailures?: string[]; /** Files that failed due to other errors */ errors?: Array<{ file: string; error: string; }>; } /** * Configuration for the drift agent */ export interface DriftAgentConfig { /** OpenRouter client for AI analysis */ openRouter: OpenRouterClient; /** Model override (not recommended) */ model?: string; /** Whether to fail on any drift */ strict?: boolean; /** Project root directory */ projectRoot: string; } /** * Drift Detection Agent * * Analyzes documentation files and compares them against the actual * codebase to detect discrepancies using AI semantic analysis. */ export declare class DriftAgent { private openRouter; private model; private strict; private projectRoot; constructor(config: DriftAgentConfig); /** * Detect drift across all context files */ detectDrift(options: { paths?: string[]; autoFix?: boolean; maxFiles?: number; }): Promise; /** * Check a single file for drift */ private checkFileForDrift; /** * Get the drift detection system prompt */ private getDriftDetectionPrompt; /** * Build the drift analysis prompt for a specific file */ private buildDriftAnalysisPrompt; /** * Parse the drift detection response */ private parseDriftResponse; /** * Get relevant source code samples for comparison */ private getRelevantSourceSamples; /** * Discover source files in the project */ private discoverSourceFiles; /** * Get all context files to check */ private getContextFiles; /** * Attempt to fix drift in a file */ private fixDrift; /** * Close the agent and clean up resources */ close(): void; } /** * Create a drift agent */ export declare function createDriftAgent(config: Omit): DriftAgent; //# sourceMappingURL=drift-agent.d.ts.map