/** * Agentic QE v3 - Code Intelligence Index Protocol * Cross-domain coordination for knowledge graph indexing * * Triggers: Code change, hourly, manual, git-commit * Participants: Code Intelligence, Semantic Analyzer, Dependency Mapper * Actions: Update KG, analyze impact, index dependencies */ import { Result, DomainName, Severity } from '../../shared/types'; import { QEKernel } from '../../kernel/interfaces'; import { IndexResult, ImpactAnalysis, DependencyMap } from '../../domains/code-intelligence/interfaces'; /** * Trigger types for indexing */ export type IndexTriggerType = 'code-change' | 'hourly' | 'manual' | 'git-commit'; /** * Index trigger configuration */ export interface IndexTrigger { type: IndexTriggerType; files?: string[]; commitHash?: string; branch?: string; paths?: string[]; hotPathsOnly?: boolean; correlationId?: string; } /** * Protocol execution result */ export interface IndexProtocolResult { protocolId: string; trigger: IndexTrigger; indexResult: IndexResult; impactAnalysis?: ImpactAnalysis; dependencyMap?: DependencyMap; notifiedDomains: DomainName[]; duration: number; timestamp: Date; } /** * Protocol configuration */ export interface IndexProtocolConfig { /** Enable impact analysis for changes */ analyzeImpact: boolean; /** Enable dependency graph updates */ updateDependencies: boolean; /** Domains to notify of changes */ notifyDomains: DomainName[]; /** Maximum files per incremental index */ maxIncrementalFiles: number; /** Hot paths for hourly refresh */ hotPaths: string[]; /** Languages to index */ languages: string[]; /** Include test files in index */ includeTests: boolean; /** Memory namespace for protocol state */ namespace: string; /** Track last index time per trigger type */ trackIndexHistory: boolean; } export declare const CodeIndexProtocolEvents: { readonly CodeIndexStarted: "coordination.CodeIndexStarted"; readonly KnowledgeGraphUpdated: "coordination.KnowledgeGraphUpdated"; readonly ImpactAnalysisCompleted: "coordination.ImpactAnalysisCompleted"; readonly DependenciesIndexed: "coordination.DependenciesIndexed"; readonly CodeIndexCompleted: "coordination.CodeIndexCompleted"; readonly DomainNotified: "coordination.DomainNotified"; }; export interface CodeIndexStartedPayload { protocolId: string; trigger: IndexTrigger; fileCount: number; startTime: Date; } export interface ProtocolKnowledgeGraphUpdatedPayload { protocolId: string; nodesCreated: number; edgesCreated: number; filesIndexed: number; duration: number; } export interface ImpactAnalysisCompletedPayload { protocolId: string; changedFiles: string[]; directImpact: number; transitiveImpact: number; impactedTests: number; riskLevel: Severity; } export interface DependenciesIndexedPayload { protocolId: string; totalNodes: number; totalEdges: number; cyclesDetected: number; } export interface CodeIndexCompletedPayload { protocolId: string; trigger: IndexTrigger; success: boolean; filesIndexed: number; duration: number; notifiedDomains: DomainName[]; error?: string; } export interface DomainNotifiedPayload { protocolId: string; domain: DomainName; notificationType: string; filesAffecting: string[]; } export interface ICodeIntelligenceIndexProtocol { /** Execute the protocol with given trigger */ execute(trigger: IndexTrigger): Promise>; /** Detect files changed since last index */ detectChanges(): Promise>; /** Update knowledge graph with new/changed files */ updateKnowledgeGraph(files: string[]): Promise>; /** Analyze impact of changes */ analyzeImpact(changedFiles: string[]): Promise>; /** Index/update dependency graph */ indexDependencies(files: string[]): Promise>; /** Notify affected domains of relevant changes */ notifyAffectedDomains(impactAnalysis: ImpactAnalysis, changedFiles: string[]): Promise>; /** Get protocol statistics */ getStats(): ProtocolStats; } export interface ProtocolStats { totalExecutions: number; lastExecution?: Date; lastExecutionByTrigger: Record; averageDuration: number; successRate: number; totalFilesIndexed: number; } /** * Code Intelligence Index Protocol * Coordinates code indexing across domains */ export declare class CodeIntelligenceIndexProtocol implements ICodeIntelligenceIndexProtocol { private readonly kernel; private readonly config; private readonly gitAnalyzer; private executionCount; private totalDuration; private successCount; private totalFilesIndexed; private lastExecution?; private lastExecutionByTrigger; constructor(kernel: QEKernel, config?: Partial); /** * Execute the indexing protocol based on trigger type */ execute(trigger: IndexTrigger): Promise>; /** * Detect changed files since last index */ detectChanges(): Promise>; /** * Update knowledge graph with files */ updateKnowledgeGraph(files: string[]): Promise>; /** * Analyze impact of changed files */ analyzeImpact(changedFiles: string[]): Promise>; /** * Index dependencies for files */ indexDependencies(files: string[]): Promise>; /** * Notify domains affected by changes */ notifyAffectedDomains(impactAnalysis: ImpactAnalysis, changedFiles: string[]): Promise>; /** * Get protocol statistics */ getStats(): ProtocolStats; private resolveFilesToIndex; private shouldAnalyzeImpact; private detectGitChanges; private detectGitCommitFiles; private resolveHotPaths; private resolveGlobPatterns; private isRelevantFile; private buildDomainNotification; private publishDomainNotification; private publishEvent; private publishCompletedEvent; private storeProtocolResult; private getLastIndexTime; private updateStats; private isTestFile; private isTestForFile; private getBaseName; private mapRiskToPriority; } /** * Create a Code Intelligence Index Protocol instance */ export declare function createCodeIntelligenceIndexProtocol(kernel: QEKernel, config?: Partial): ICodeIntelligenceIndexProtocol; //# sourceMappingURL=code-intelligence-index.d.ts.map