/** * ai-impact-analyzer — AI 影响分析器(v6.73.0) * * 分层 AI + 知识图谱联动的变更影响分析引擎: * 1. 检索层(零 LLM 成本): unifiedSearch 语义检索 + 知识图谱查询 * 2. 推理层(1 次 LLM 调用): 将检索结果送入 LLM,输出结构化影响分析 * 3. 生成层(合并到同 1 次 LLM 调用): 生成 CHANGE_TODO / 代码变更清单 * * 降级策略:LLM 不可用时,回退到基于规则的分级(语义相关度阈值) */ import { UnifiedResult } from './unified-retrieval'; import { GraphEntity, GraphRelation } from './knowledge-graph'; import { ChangeCategory } from './change-parser'; /** 语义检索后的任务匹配结果 */ export interface TaskSemanticMatch { taskId: string; taskName: string; status: string; score: number; matchedContext: string; files: string[]; } /** 代码级影响 */ export interface CodeImpact { file: string; currentImplementation: string; suggestedChange: string; reason: string; platform?: string; } /** 全局层影响 */ export interface GlobalImpact { artifact: string; reason: string; suggestedAction: string; } /** 跨迭代影响 */ export interface CrossIterationImpact { iteration: string; taskId: string; reason: string; severity: 'warning' | 'critical'; } /** AI 影响分析结果 */ export interface AiImpactAnalysis { thinking: string; taskImpacts: { direct: TaskSemanticMatch[]; indirect: TaskSemanticMatch[]; unaffected: TaskSemanticMatch[]; }; codeImpacts: CodeImpact[]; globalImpacts: GlobalImpact[]; crossIterationImpacts: CrossIterationImpact[]; executionPlan: { steps: string[]; regressionTests: string[]; globalRefreshSuggestions: string[]; }; } /** 检索上下文 */ export interface RetrievalContext { documentChunks: { source: string; content: string; score: number; }[]; codeSlices: { file: string; content: string; score: number; }[]; kgEntities: GraphEntity[]; kgRelations: GraphRelation[]; } /** * 语义检索:替代关键词匹配,使用 unifiedSearch 做真正的语义检索 */ export declare function semanticImpactAnalysis(desc: string, iteration: string, options?: { withCode?: boolean; }): Promise<{ docResult: UnifiedResult; codeResult: UnifiedResult | null; }>; /** * 知识图谱查询:获取变更相关的实体和关联关系 */ export declare function analyzeWithKnowledgeGraph(desc: string, iteration: string, matchedTaskIds: string[]): Promise<{ entities: GraphEntity[]; relations: GraphRelation[]; }>; /** * 按任务分组,计算语义相关度 */ export declare function groupByTask(docResult: UnifiedResult, allTasks: { id: string; name: string; status: string; }[]): TaskSemanticMatch[]; /** * 基于相关度阈值分类任务影响级别 * 降级策略:LLM 不可用时使用 */ export declare function classifyByThreshold(matches: TaskSemanticMatch[], graphContent: string): { direct: TaskSemanticMatch[]; indirect: TaskSemanticMatch[]; unaffected: TaskSemanticMatch[]; }; /** * AI 影响分析主入口 * 合并检索 → LLM 推理 → 生成实施计划 为一次调用 * * 降级:LLM 不可用时返回基于阈值的分类结果 */ export declare function aiImpactAnalysis(desc: string, category: ChangeCategory, iteration: string, allTasks: { id: string; name: string; status: string; }[], options?: { withCode?: boolean; useLlm?: boolean; }): Promise; /** * 生成 CHANGE_TODO.md 内容 */ export declare function generateChangeTodo(changeDesc: string, category: ChangeCategory, analysis: AiImpactAnalysis, changeId?: string): string; //# sourceMappingURL=ai-impact-analyzer.d.ts.map