UNPKG

vibe-cli-tool

Version:

VibeCLI v1.9 - 模板商店生态,智能部署生成,多语言支持,交互式学习系统,企业级Web全栈应用CLI工具

183 lines 4.85 kB
import type { PromptGenerationConfig } from '../core/types.js'; import { type TemplateMatchResult } from '../prompts/dynamic/intelligent-template-matcher.js'; import { type FallbackResult } from '../prompts/dynamic/intelligent-fallback-handler.js'; /** * MCP上下文对话历史 */ export interface MCPConversationTurn { timestamp: Date; userMessage: string; toolCall?: { name: string; args: any; result: any; }; context: { projectType?: string; features?: string[]; userExperience?: 'beginner' | 'intermediate' | 'expert'; developmentPhase?: 'planning' | 'development' | 'optimization'; }; templateMatchResult?: TemplateMatchResult; fallbackResult?: FallbackResult; clarificationQuestions?: ClarificationQuestion[]; } /** * MCP会话状态 */ export interface MCPSessionState { sessionId: string; conversationHistory: MCPConversationTurn[]; accumulatedContext: { projectInsights: { confirmedType?: string; likelyFeatures: string[]; techPreferences: string[]; complexityIndicators: string[]; }; userProfile: { experienceLevel?: 'beginner' | 'intermediate' | 'expert'; preferredApproach?: 'step-by-step' | 'high-level' | 'code-first'; previousProjects?: string[]; }; conversationFlow: { clarificationNeeded: string[]; confidenceLevel: number; nextSuggestedQuestions: string[]; }; }; } /** * MCP智能上下文管理器 * 通过多轮对话和协议上下文进行智能匹配 */ export declare class MCPContextManager { private sessions; private currentSessionId; /** * 开始新的MCP会话 */ startSession(sessionId?: string): string; /** * 记录用户输入并分析上下文 - 增强版,支持智能模板匹配 */ recordUserInput(sessionId: string, userMessage: string): Promise<MCPContextAnalysis>; /** * 记录工具调用结果 */ recordToolCall(sessionId: string, toolName: string, args: any, result: any): void; /** * 提取上下文线索 */ private extractContextClues; /** * 基于对话历史推断项目类型 */ private inferProjectType; /** * 渐进式特征提取 */ private extractFeatures; /** * 推断用户经验水平 */ private inferUserExperience; /** * 识别开发阶段 */ private inferDevelopmentPhase; /** * 更新累积上下文 */ private updateAccumulatedContext; /** * 生成智能响应 */ private generateIntelligentResponse; /** * 从工具调用中学习 */ private learnFromToolCall; /** * 计算上下文置信度 */ private calculateContextConfidence; /** * 获取会话状态 */ getSession(sessionId: string): MCPSessionState | undefined; /** * 生成会话ID */ private generateSessionId; /** * 获取当前最佳的提示词生成配置 */ getOptimalPromptConfig(sessionId: string): PromptGenerationConfig | null; /** * 重构用户意图描述 */ private reconstructUserIntent; /** * 从上下文推断复杂度 */ private inferComplexityFromContext; /** * 执行智能模板匹配 */ private performIntelligentTemplateMatching; /** * 生成增强的智能响应 */ private generateEnhancedIntelligentResponse; /** * 从上下文推断时间线要求 */ private inferTimelineFromContext; /** * 生成智能澄清问题 */ private generateSmartQuestions; /** * 基于降级方案生成问题 */ private generateFallbackQuestions; } /** * MCP上下文分析结果 */ export interface MCPContextAnalysis { confidence: number; projectType?: string; features: string[]; userExperience?: 'beginner' | 'intermediate' | 'expert'; suggestions: string[]; clarifications: string[]; readyForGeneration: boolean; fallbackGuidance?: FallbackResult; smartQuestions?: ClarificationQuestion[]; } /** * 澄清问题类型 */ export interface ClarificationQuestion { id: string; type: 'choice' | 'text' | 'priority' | 'confirmation'; question: string; context: string; importance: 'high' | 'medium' | 'low'; options?: QuestionOption[]; expectedAnswer?: string; followUp?: string[]; } export interface QuestionOption { value: string; label: string; description?: string; implications?: string[]; } /** * 全局MCP上下文管理器实例 */ export declare const mcpContextManager: MCPContextManager; //# sourceMappingURL=mcp-context-manager.d.ts.map