@mxf-dev/core 2.0.4 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config/ModelContextLimits.d.ts.map +1 -1
- package/dist/config/ModelContextLimits.js +7 -1
- package/dist/config/ModelContextLimits.js.map +1 -1
- package/dist/constants/CoreTools.d.ts +6 -5
- package/dist/constants/CoreTools.d.ts.map +1 -1
- package/dist/constants/CoreTools.js +6 -5
- package/dist/constants/CoreTools.js.map +1 -1
- package/dist/constants/DefaultPhaseProfiles.d.ts.map +1 -1
- package/dist/constants/DefaultPhaseProfiles.js +29 -0
- package/dist/constants/DefaultPhaseProfiles.js.map +1 -1
- package/dist/constants/ReservedIdentities.d.ts +14 -0
- package/dist/constants/ReservedIdentities.d.ts.map +1 -0
- package/dist/constants/ReservedIdentities.js +42 -0
- package/dist/constants/ReservedIdentities.js.map +1 -0
- package/dist/database/adapters/mongodb/MongoKnowledgeGraphRepository.d.ts +16 -16
- package/dist/database/adapters/mongodb/MongoKnowledgeGraphRepository.d.ts.map +1 -1
- package/dist/database/adapters/mongodb/MongoKnowledgeGraphRepository.js +98 -36
- package/dist/database/adapters/mongodb/MongoKnowledgeGraphRepository.js.map +1 -1
- package/dist/events/ClientEventBus.d.ts +28 -0
- package/dist/events/ClientEventBus.d.ts.map +1 -1
- package/dist/events/ClientEventBus.js +87 -40
- package/dist/events/ClientEventBus.js.map +1 -1
- package/dist/events/EventBus.d.ts +19 -1
- package/dist/events/EventBus.d.ts.map +1 -1
- package/dist/events/EventBus.js +23 -0
- package/dist/events/EventBus.js.map +1 -1
- package/dist/events/EventBusBase.d.ts +37 -6
- package/dist/events/EventBusBase.d.ts.map +1 -1
- package/dist/events/EventBusBase.js +75 -27
- package/dist/events/EventBusBase.js.map +1 -1
- package/dist/events/EventNames.d.ts +49 -36
- package/dist/events/EventNames.d.ts.map +1 -1
- package/dist/events/EventNames.js +38 -36
- package/dist/events/EventNames.js.map +1 -1
- package/dist/events/PublicEvents.d.ts +5 -1
- package/dist/events/PublicEvents.d.ts.map +1 -1
- package/dist/events/PublicEvents.js +7 -0
- package/dist/events/PublicEvents.js.map +1 -1
- package/dist/events/ServerEventBus.d.ts +7 -54
- package/dist/events/ServerEventBus.d.ts.map +1 -1
- package/dist/events/ServerEventBus.js +10 -96
- package/dist/events/ServerEventBus.js.map +1 -1
- package/dist/events/event-definitions/ControlLoopEvents.d.ts +35 -0
- package/dist/events/event-definitions/ControlLoopEvents.d.ts.map +1 -1
- package/dist/events/event-definitions/ControlLoopEvents.js +6 -0
- package/dist/events/event-definitions/ControlLoopEvents.js.map +1 -1
- package/dist/events/event-definitions/SdkEvents.d.ts +55 -0
- package/dist/events/event-definitions/SdkEvents.d.ts.map +1 -0
- package/dist/events/event-definitions/SdkEvents.js +36 -0
- package/dist/events/event-definitions/SdkEvents.js.map +1 -0
- package/dist/events/event-definitions/TaskEvents.d.ts +2 -7
- package/dist/events/event-definitions/TaskEvents.d.ts.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/interfaces/AgentInterfaces.d.ts +5 -0
- package/dist/interfaces/AgentInterfaces.d.ts.map +1 -1
- package/dist/interfaces/ChannelConfig.d.ts +2 -2
- package/dist/interfaces/ChannelConfig.d.ts.map +1 -1
- package/dist/interfaces/ConversationMessage.d.ts +1 -1
- package/dist/interfaces/ConversationMessage.d.ts.map +1 -1
- package/dist/interfaces/IMemoryPersistence.d.ts +47 -1
- package/dist/interfaces/IMemoryPersistence.d.ts.map +1 -1
- package/dist/interfaces/SocketServiceInterface.d.ts +3 -2
- package/dist/interfaces/SocketServiceInterface.d.ts.map +1 -1
- package/dist/interfaces/TaskInterfaces.d.ts +14 -1
- package/dist/interfaces/TaskInterfaces.d.ts.map +1 -1
- package/dist/models/agent.d.ts +0 -1
- package/dist/models/agent.d.ts.map +1 -1
- package/dist/models/agent.js +0 -5
- package/dist/models/agent.js.map +1 -1
- package/dist/models/agentIdentityReservation.d.ts +42 -0
- package/dist/models/agentIdentityReservation.d.ts.map +1 -0
- package/dist/models/agentIdentityReservation.js +52 -0
- package/dist/models/agentIdentityReservation.js.map +1 -0
- package/dist/models/channel.d.ts +2 -0
- package/dist/models/channel.d.ts.map +1 -1
- package/dist/models/channel.js.map +1 -1
- package/dist/models/channelKey.d.ts +1 -0
- package/dist/models/channelKey.d.ts.map +1 -1
- package/dist/models/channelKey.js +5 -0
- package/dist/models/channelKey.js.map +1 -1
- package/dist/models/memory.d.ts +1 -1
- package/dist/models/memory.d.ts.map +1 -1
- package/dist/models/memory.js +9 -12
- package/dist/models/memory.js.map +1 -1
- package/dist/models/memoryStrata.d.ts +3 -16
- package/dist/models/memoryStrata.d.ts.map +1 -1
- package/dist/models/memoryStrata.js +3 -5
- package/dist/models/memoryStrata.js.map +1 -1
- package/dist/models/plan.d.ts +2 -2
- package/dist/models/plan.d.ts.map +1 -1
- package/dist/models/plan.js +1 -1
- package/dist/models/plan.js.map +1 -1
- package/dist/models/taskEffectiveness.d.ts +1 -0
- package/dist/models/taskEffectiveness.d.ts.map +1 -1
- package/dist/models/taskEffectiveness.js +7 -1
- package/dist/models/taskEffectiveness.js.map +1 -1
- package/dist/models/user.d.ts +4 -0
- package/dist/models/user.d.ts.map +1 -1
- package/dist/models/user.js +8 -0
- package/dist/models/user.js.map +1 -1
- package/dist/protocols/mcp/LlmTestEnvironmentGuard.d.ts +16 -0
- package/dist/protocols/mcp/LlmTestEnvironmentGuard.d.ts.map +1 -0
- package/dist/protocols/mcp/LlmTestEnvironmentGuard.js +25 -0
- package/dist/protocols/mcp/LlmTestEnvironmentGuard.js.map +1 -0
- package/dist/protocols/mcp/McpServerTypes.d.ts +9 -0
- package/dist/protocols/mcp/McpServerTypes.d.ts.map +1 -1
- package/dist/protocols/mcp/providers/AnthropicMcpClient.d.ts.map +1 -1
- package/dist/protocols/mcp/providers/AnthropicMcpClient.js +1 -0
- package/dist/protocols/mcp/providers/AnthropicMcpClient.js.map +1 -1
- package/dist/protocols/mcp/providers/AzureOpenAiMcpClient.d.ts.map +1 -1
- package/dist/protocols/mcp/providers/AzureOpenAiMcpClient.js +1 -0
- package/dist/protocols/mcp/providers/AzureOpenAiMcpClient.js.map +1 -1
- package/dist/protocols/mcp/providers/BaseMcpClient.d.ts +4 -0
- package/dist/protocols/mcp/providers/BaseMcpClient.d.ts.map +1 -1
- package/dist/protocols/mcp/providers/BaseMcpClient.js +10 -0
- package/dist/protocols/mcp/providers/BaseMcpClient.js.map +1 -1
- package/dist/protocols/mcp/providers/CustomMcpClient.d.ts.map +1 -1
- package/dist/protocols/mcp/providers/CustomMcpClient.js +7 -0
- package/dist/protocols/mcp/providers/CustomMcpClient.js.map +1 -1
- package/dist/protocols/mcp/providers/GeminiMcpClient.d.ts.map +1 -1
- package/dist/protocols/mcp/providers/GeminiMcpClient.js +1 -0
- package/dist/protocols/mcp/providers/GeminiMcpClient.js.map +1 -1
- package/dist/protocols/mcp/providers/OllamaMcpClient.d.ts +1 -0
- package/dist/protocols/mcp/providers/OllamaMcpClient.d.ts.map +1 -1
- package/dist/protocols/mcp/providers/OllamaMcpClient.js +1 -0
- package/dist/protocols/mcp/providers/OllamaMcpClient.js.map +1 -1
- package/dist/protocols/mcp/providers/OpenAiMcpClient.d.ts.map +1 -1
- package/dist/protocols/mcp/providers/OpenAiMcpClient.js +1 -0
- package/dist/protocols/mcp/providers/OpenAiMcpClient.js.map +1 -1
- package/dist/protocols/mcp/providers/OpenRouterMcpClient.d.ts.map +1 -1
- package/dist/protocols/mcp/providers/OpenRouterMcpClient.js +2 -0
- package/dist/protocols/mcp/providers/OpenRouterMcpClient.js.map +1 -1
- package/dist/protocols/mcp/providers/XaiMcpClient.d.ts.map +1 -1
- package/dist/protocols/mcp/providers/XaiMcpClient.js +1 -0
- package/dist/protocols/mcp/providers/XaiMcpClient.js.map +1 -1
- package/dist/protocols/mcp/security/BrowserTargetGuard.d.ts +14 -0
- package/dist/protocols/mcp/security/BrowserTargetGuard.d.ts.map +1 -0
- package/dist/protocols/mcp/security/BrowserTargetGuard.js +55 -0
- package/dist/protocols/mcp/security/BrowserTargetGuard.js.map +1 -0
- package/dist/protocols/mcp/security/ExternalMcpRegistrationPolicy.d.ts +24 -0
- package/dist/protocols/mcp/security/ExternalMcpRegistrationPolicy.d.ts.map +1 -0
- package/dist/protocols/mcp/security/ExternalMcpRegistrationPolicy.js +33 -0
- package/dist/protocols/mcp/security/ExternalMcpRegistrationPolicy.js.map +1 -0
- package/dist/protocols/mcp/security/HttpTargetGuard.d.ts.map +1 -1
- package/dist/protocols/mcp/security/HttpTargetGuard.js +68 -6
- package/dist/protocols/mcp/security/HttpTargetGuard.js.map +1 -1
- package/dist/protocols/mcp/security/McpSecurityGuard.d.ts.map +1 -1
- package/dist/protocols/mcp/security/McpSecurityGuard.js +7 -5
- package/dist/protocols/mcp/security/McpSecurityGuard.js.map +1 -1
- package/dist/protocols/mcp/security/McpToolPolicy.d.ts +18 -0
- package/dist/protocols/mcp/security/McpToolPolicy.d.ts.map +1 -1
- package/dist/protocols/mcp/security/McpToolPolicy.js +60 -0
- package/dist/protocols/mcp/security/McpToolPolicy.js.map +1 -1
- package/dist/protocols/mcp/services/ExternalMcpServerManager.d.ts +118 -5
- package/dist/protocols/mcp/services/ExternalMcpServerManager.d.ts.map +1 -1
- package/dist/protocols/mcp/services/ExternalMcpServerManager.js +499 -98
- package/dist/protocols/mcp/services/ExternalMcpServerManager.js.map +1 -1
- package/dist/protocols/mcp/services/ExternalServerConfigs.d.ts +2 -2
- package/dist/protocols/mcp/services/ExternalServerConfigs.d.ts.map +1 -1
- package/dist/protocols/mcp/services/ExternalServerConfigs.js +25 -8
- package/dist/protocols/mcp/services/ExternalServerConfigs.js.map +1 -1
- package/dist/protocols/mcp/tools/AnalyticsTools.d.ts +3 -37
- package/dist/protocols/mcp/tools/AnalyticsTools.d.ts.map +1 -1
- package/dist/protocols/mcp/tools/AnalyticsTools.js +134 -614
- package/dist/protocols/mcp/tools/AnalyticsTools.js.map +1 -1
- package/dist/protocols/mcp/tools/CodeAnalysisTools.d.ts.map +1 -1
- package/dist/protocols/mcp/tools/CodeAnalysisTools.js +16 -13
- package/dist/protocols/mcp/tools/CodeAnalysisTools.js.map +1 -1
- package/dist/protocols/mcp/tools/EffectivenessTools.d.ts.map +1 -1
- package/dist/protocols/mcp/tools/EffectivenessTools.js +94 -30
- package/dist/protocols/mcp/tools/EffectivenessTools.js.map +1 -1
- package/dist/protocols/mcp/tools/GitTools.d.ts.map +1 -1
- package/dist/protocols/mcp/tools/GitTools.js +9 -5
- package/dist/protocols/mcp/tools/GitTools.js.map +1 -1
- package/dist/protocols/mcp/tools/InfrastructureTools.d.ts +10 -40
- package/dist/protocols/mcp/tools/InfrastructureTools.d.ts.map +1 -1
- package/dist/protocols/mcp/tools/InfrastructureTools.js +29 -70
- package/dist/protocols/mcp/tools/InfrastructureTools.js.map +1 -1
- package/dist/protocols/mcp/tools/JsonTools.d.ts.map +1 -1
- package/dist/protocols/mcp/tools/JsonTools.js +4 -4
- package/dist/protocols/mcp/tools/JsonTools.js.map +1 -1
- package/dist/protocols/mcp/tools/KnowledgeGraphTools.d.ts +55 -592
- package/dist/protocols/mcp/tools/KnowledgeGraphTools.d.ts.map +1 -1
- package/dist/protocols/mcp/tools/KnowledgeGraphTools.js +169 -119
- package/dist/protocols/mcp/tools/KnowledgeGraphTools.js.map +1 -1
- package/dist/protocols/mcp/tools/MemorySearchTools.d.ts +6 -6
- package/dist/protocols/mcp/tools/MemorySearchTools.d.ts.map +1 -1
- package/dist/protocols/mcp/tools/MemorySearchTools.js +107 -39
- package/dist/protocols/mcp/tools/MemorySearchTools.js.map +1 -1
- package/dist/protocols/mcp/tools/MemoryUtilityTools.d.ts +4 -5
- package/dist/protocols/mcp/tools/MemoryUtilityTools.d.ts.map +1 -1
- package/dist/protocols/mcp/tools/MemoryUtilityTools.js +59 -208
- package/dist/protocols/mcp/tools/MemoryUtilityTools.js.map +1 -1
- package/dist/protocols/mcp/tools/PlanningTools.d.ts +2 -1
- package/dist/protocols/mcp/tools/PlanningTools.d.ts.map +1 -1
- package/dist/protocols/mcp/tools/PlanningTools.js +111 -49
- package/dist/protocols/mcp/tools/PlanningTools.js.map +1 -1
- package/dist/protocols/mcp/tools/ProjectContextTools.d.ts.map +1 -1
- package/dist/protocols/mcp/tools/ProjectContextTools.js +18 -12
- package/dist/protocols/mcp/tools/ProjectContextTools.js.map +1 -1
- package/dist/protocols/mcp/tools/SafetyTools.d.ts.map +1 -1
- package/dist/protocols/mcp/tools/SafetyTools.js +16 -13
- package/dist/protocols/mcp/tools/SafetyTools.js.map +1 -1
- package/dist/protocols/mcp/tools/SearchProjectTools.d.ts +24 -7
- package/dist/protocols/mcp/tools/SearchProjectTools.d.ts.map +1 -1
- package/dist/protocols/mcp/tools/SearchProjectTools.js +226 -126
- package/dist/protocols/mcp/tools/SearchProjectTools.js.map +1 -1
- package/dist/protocols/mcp/tools/TaskPlanningTools.d.ts +0 -32
- package/dist/protocols/mcp/tools/TaskPlanningTools.d.ts.map +1 -1
- package/dist/protocols/mcp/tools/TaskPlanningTools.js +363 -450
- package/dist/protocols/mcp/tools/TaskPlanningTools.js.map +1 -1
- package/dist/protocols/mcp/tools/TestTools.d.ts.map +1 -1
- package/dist/protocols/mcp/tools/TestTools.js +18 -11
- package/dist/protocols/mcp/tools/TestTools.js.map +1 -1
- package/dist/protocols/mcp/tools/TypeScriptTools.d.ts.map +1 -1
- package/dist/protocols/mcp/tools/TypeScriptTools.js +22 -12
- package/dist/protocols/mcp/tools/TypeScriptTools.js.map +1 -1
- package/dist/protocols/mcp/tools/UserInputTools.d.ts.map +1 -1
- package/dist/protocols/mcp/tools/UserInputTools.js +14 -1
- package/dist/protocols/mcp/tools/UserInputTools.js.map +1 -1
- package/dist/protocols/mcp/tools/UserMemoryTools.d.ts +3 -1
- package/dist/protocols/mcp/tools/UserMemoryTools.d.ts.map +1 -1
- package/dist/protocols/mcp/tools/UserMemoryTools.js +27 -62
- package/dist/protocols/mcp/tools/UserMemoryTools.js.map +1 -1
- package/dist/protocols/mcp/tools/shell/ShellExecuteHandler.d.ts.map +1 -1
- package/dist/protocols/mcp/tools/shell/ShellExecuteHandler.js +14 -60
- package/dist/protocols/mcp/tools/shell/ShellExecuteHandler.js.map +1 -1
- package/dist/protocols/mcp/tools/shell/ShellSandbox.d.ts.map +1 -1
- package/dist/protocols/mcp/tools/shell/ShellSandbox.js +9 -27
- package/dist/protocols/mcp/tools/shell/ShellSandbox.js.map +1 -1
- package/dist/repositories/interfaces/IKnowledgeGraphRepository.d.ts +40 -30
- package/dist/repositories/interfaces/IKnowledgeGraphRepository.d.ts.map +1 -1
- package/dist/schemas/EventPayloadSchema.d.ts +28 -0
- package/dist/schemas/EventPayloadSchema.d.ts.map +1 -1
- package/dist/schemas/EventPayloadSchema.js +30 -1
- package/dist/schemas/EventPayloadSchema.js.map +1 -1
- package/dist/schemas/MxpProtocolSchemas.d.ts +6 -6
- package/dist/services/AgentPerformanceService.d.ts +11 -0
- package/dist/services/AgentPerformanceService.d.ts.map +1 -1
- package/dist/services/AgentPerformanceService.js +59 -33
- package/dist/services/AgentPerformanceService.js.map +1 -1
- package/dist/services/AutoCorrectionService.d.ts +3 -0
- package/dist/services/AutoCorrectionService.d.ts.map +1 -1
- package/dist/services/AutoCorrectionService.js +19 -2
- package/dist/services/AutoCorrectionService.js.map +1 -1
- package/dist/services/BackgroundTaskManager.d.ts +23 -7
- package/dist/services/BackgroundTaskManager.d.ts.map +1 -1
- package/dist/services/BackgroundTaskManager.js +137 -57
- package/dist/services/BackgroundTaskManager.js.map +1 -1
- package/dist/services/BrowserManager.d.ts +2 -0
- package/dist/services/BrowserManager.d.ts.map +1 -1
- package/dist/services/BrowserManager.js +18 -15
- package/dist/services/BrowserManager.js.map +1 -1
- package/dist/services/ChannelContextMemoryOperations.d.ts +8 -1
- package/dist/services/ChannelContextMemoryOperations.d.ts.map +1 -1
- package/dist/services/ChannelContextMemoryOperations.js +89 -165
- package/dist/services/ChannelContextMemoryOperations.js.map +1 -1
- package/dist/services/ChannelContextMessageOperations.d.ts +4 -3
- package/dist/services/ChannelContextMessageOperations.d.ts.map +1 -1
- package/dist/services/ChannelContextMessageOperations.js +72 -212
- package/dist/services/ChannelContextMessageOperations.js.map +1 -1
- package/dist/services/MemoryService.d.ts +52 -21
- package/dist/services/MemoryService.d.ts.map +1 -1
- package/dist/services/MemoryService.js +775 -548
- package/dist/services/MemoryService.js.map +1 -1
- package/dist/services/PatternLearningService.d.ts +5 -0
- package/dist/services/PatternLearningService.d.ts.map +1 -1
- package/dist/services/PatternLearningService.js +26 -3
- package/dist/services/PatternLearningService.js.map +1 -1
- package/dist/services/PerformanceOptimizationService.d.ts +2 -1
- package/dist/services/PerformanceOptimizationService.d.ts.map +1 -1
- package/dist/services/PerformanceOptimizationService.js +21 -6
- package/dist/services/PerformanceOptimizationService.js.map +1 -1
- package/dist/services/PredictiveAnalyticsService.d.ts +1 -0
- package/dist/services/PredictiveAnalyticsService.d.ts.map +1 -1
- package/dist/services/PredictiveAnalyticsService.js +18 -6
- package/dist/services/PredictiveAnalyticsService.js.map +1 -1
- package/dist/services/ProactiveValidationService.d.ts +6 -0
- package/dist/services/ProactiveValidationService.d.ts.map +1 -1
- package/dist/services/ProactiveValidationService.js +58 -39
- package/dist/services/ProactiveValidationService.js.map +1 -1
- package/dist/services/TaskEffectivenessService.d.ts +55 -31
- package/dist/services/TaskEffectivenessService.d.ts.map +1 -1
- package/dist/services/TaskEffectivenessService.js +243 -125
- package/dist/services/TaskEffectivenessService.js.map +1 -1
- package/dist/services/ToolExecutionInterceptor.d.ts +4 -0
- package/dist/services/ToolExecutionInterceptor.d.ts.map +1 -1
- package/dist/services/ToolExecutionInterceptor.js +31 -5
- package/dist/services/ToolExecutionInterceptor.js.map +1 -1
- package/dist/services/UserInputRequestManager.d.ts +13 -3
- package/dist/services/UserInputRequestManager.d.ts.map +1 -1
- package/dist/services/UserInputRequestManager.js +42 -6
- package/dist/services/UserInputRequestManager.js.map +1 -1
- package/dist/services/UserMemoryService.d.ts +2 -0
- package/dist/services/UserMemoryService.d.ts.map +1 -1
- package/dist/services/UserMemoryService.js +9 -4
- package/dist/services/UserMemoryService.js.map +1 -1
- package/dist/services/ValidationAnalyticsService.d.ts +4 -0
- package/dist/services/ValidationAnalyticsService.d.ts.map +1 -1
- package/dist/services/ValidationAnalyticsService.js +30 -8
- package/dist/services/ValidationAnalyticsService.js.map +1 -1
- package/dist/services/ValidationCacheService.d.ts +3 -1
- package/dist/services/ValidationCacheService.d.ts.map +1 -1
- package/dist/services/ValidationCacheService.js +25 -4
- package/dist/services/ValidationCacheService.js.map +1 -1
- package/dist/services/ValidationMiddleware.d.ts +7 -0
- package/dist/services/ValidationMiddleware.d.ts.map +1 -1
- package/dist/services/ValidationMiddleware.js +53 -10
- package/dist/services/ValidationMiddleware.js.map +1 -1
- package/dist/services/ValidationPerformanceService.d.ts +3 -0
- package/dist/services/ValidationPerformanceService.d.ts.map +1 -1
- package/dist/services/ValidationPerformanceService.js +28 -11
- package/dist/services/ValidationPerformanceService.js.map +1 -1
- package/dist/services/WebSearchService.d.ts.map +1 -1
- package/dist/services/WebSearchService.js +9 -0
- package/dist/services/WebSearchService.js.map +1 -1
- package/dist/services/dag/TaskDagService.d.ts +3 -0
- package/dist/services/dag/TaskDagService.d.ts.map +1 -1
- package/dist/services/dag/TaskDagService.js +18 -0
- package/dist/services/dag/TaskDagService.js.map +1 -1
- package/dist/services/kg/EntityQValueManager.d.ts +3 -1
- package/dist/services/kg/EntityQValueManager.d.ts.map +1 -1
- package/dist/services/kg/EntityQValueManager.js +10 -10
- package/dist/services/kg/EntityQValueManager.js.map +1 -1
- package/dist/services/kg/GraphSurpriseCalculator.d.ts +0 -4
- package/dist/services/kg/GraphSurpriseCalculator.d.ts.map +1 -1
- package/dist/services/kg/GraphSurpriseCalculator.js +0 -9
- package/dist/services/kg/GraphSurpriseCalculator.js.map +1 -1
- package/dist/services/kg/KnowledgeGraphService.d.ts +12 -12
- package/dist/services/kg/KnowledgeGraphService.d.ts.map +1 -1
- package/dist/services/kg/KnowledgeGraphService.js +43 -51
- package/dist/services/kg/KnowledgeGraphService.js.map +1 -1
- package/dist/services/kg/OrparGraphIntegration.d.ts.map +1 -1
- package/dist/services/kg/OrparGraphIntegration.js +6 -5
- package/dist/services/kg/OrparGraphIntegration.js.map +1 -1
- package/dist/services/orpar-memory/CycleConsolidationTrigger.d.ts +1 -0
- package/dist/services/orpar-memory/CycleConsolidationTrigger.d.ts.map +1 -1
- package/dist/services/orpar-memory/CycleConsolidationTrigger.js +8 -1
- package/dist/services/orpar-memory/CycleConsolidationTrigger.js.map +1 -1
- package/dist/services/orpar-memory/OrparMemoryCoordinator.d.ts +8 -1
- package/dist/services/orpar-memory/OrparMemoryCoordinator.d.ts.map +1 -1
- package/dist/services/orpar-memory/OrparMemoryCoordinator.js +93 -45
- package/dist/services/orpar-memory/OrparMemoryCoordinator.js.map +1 -1
- package/dist/services/orpar-memory/SurpriseOrparAdapter.d.ts +1 -0
- package/dist/services/orpar-memory/SurpriseOrparAdapter.d.ts.map +1 -1
- package/dist/services/orpar-memory/SurpriseOrparAdapter.js +8 -1
- package/dist/services/orpar-memory/SurpriseOrparAdapter.js.map +1 -1
- package/dist/types/ChannelContext.d.ts +2 -1
- package/dist/types/ChannelContext.d.ts.map +1 -1
- package/dist/types/EffectivenessTypes.d.ts +4 -1
- package/dist/types/EffectivenessTypes.d.ts.map +1 -1
- package/dist/types/TaskCompletionTypes.d.ts +7 -5
- package/dist/types/TaskCompletionTypes.d.ts.map +1 -1
- package/dist/types/TaskTypes.d.ts +8 -1
- package/dist/types/TaskTypes.d.ts.map +1 -1
- package/dist/utils/GlobMatcher.d.ts +37 -0
- package/dist/utils/GlobMatcher.d.ts.map +1 -0
- package/dist/utils/GlobMatcher.js +131 -0
- package/dist/utils/GlobMatcher.js.map +1 -0
- package/package.json +1 -1
- package/src/config/ModelContextLimits.ts +7 -1
- package/src/constants/CoreTools.ts +6 -5
- package/src/constants/DefaultPhaseProfiles.ts +29 -0
- package/src/constants/ReservedIdentities.ts +51 -0
- package/src/database/adapters/mongodb/MongoKnowledgeGraphRepository.ts +115 -36
- package/src/events/ClientEventBus.ts +117 -48
- package/src/events/EventBus.ts +32 -2
- package/src/events/EventBusBase.ts +132 -39
- package/src/events/EventNames.ts +43 -36
- package/src/events/PublicEvents.ts +8 -0
- package/src/events/ServerEventBus.ts +9 -128
- package/src/events/event-definitions/ControlLoopEvents.ts +12 -0
- package/src/events/event-definitions/SdkEvents.ts +58 -0
- package/src/events/event-definitions/TaskEvents.ts +2 -2
- package/src/index.ts +15 -0
- package/src/interfaces/AgentInterfaces.ts +5 -0
- package/src/interfaces/ChannelConfig.ts +2 -2
- package/src/interfaces/ConversationMessage.ts +5 -0
- package/src/interfaces/IMemoryPersistence.ts +55 -1
- package/src/interfaces/SocketServiceInterface.ts +3 -2
- package/src/interfaces/TaskInterfaces.ts +16 -1
- package/src/models/agent.ts +0 -6
- package/src/models/agentIdentityReservation.ts +77 -0
- package/src/models/channel.ts +2 -0
- package/src/models/channelKey.ts +10 -0
- package/src/models/memory.ts +18 -19
- package/src/models/memoryStrata.ts +9 -23
- package/src/models/plan.ts +3 -3
- package/src/models/taskEffectiveness.ts +9 -2
- package/src/models/user.ts +12 -0
- package/src/protocols/mcp/LlmTestEnvironmentGuard.ts +30 -0
- package/src/protocols/mcp/McpServerTypes.ts +9 -0
- package/src/protocols/mcp/providers/AnthropicMcpClient.ts +2 -0
- package/src/protocols/mcp/providers/AzureOpenAiMcpClient.ts +1 -0
- package/src/protocols/mcp/providers/BaseMcpClient.ts +13 -0
- package/src/protocols/mcp/providers/CustomMcpClient.ts +7 -0
- package/src/protocols/mcp/providers/GeminiMcpClient.ts +2 -0
- package/src/protocols/mcp/providers/OllamaMcpClient.ts +3 -1
- package/src/protocols/mcp/providers/OpenAiMcpClient.ts +2 -0
- package/src/protocols/mcp/providers/OpenRouterMcpClient.ts +3 -0
- package/src/protocols/mcp/providers/XaiMcpClient.ts +2 -0
- package/src/protocols/mcp/security/BrowserTargetGuard.ts +64 -0
- package/src/protocols/mcp/security/ExternalMcpRegistrationPolicy.ts +38 -0
- package/src/protocols/mcp/security/HttpTargetGuard.ts +77 -6
- package/src/protocols/mcp/security/McpSecurityGuard.ts +7 -5
- package/src/protocols/mcp/security/McpToolPolicy.ts +74 -0
- package/src/protocols/mcp/services/ExternalMcpServerManager.ts +656 -111
- package/src/protocols/mcp/services/ExternalServerConfigs.ts +26 -8
- package/src/protocols/mcp/tools/AnalyticsTools.ts +167 -641
- package/src/protocols/mcp/tools/CodeAnalysisTools.ts +44 -14
- package/src/protocols/mcp/tools/EffectivenessTools.ts +185 -45
- package/src/protocols/mcp/tools/GitTools.ts +15 -5
- package/src/protocols/mcp/tools/InfrastructureTools.ts +42 -90
- package/src/protocols/mcp/tools/JsonTools.ts +7 -4
- package/src/protocols/mcp/tools/KnowledgeGraphTools.ts +313 -164
- package/src/protocols/mcp/tools/MemorySearchTools.ts +158 -46
- package/src/protocols/mcp/tools/MemoryUtilityTools.ts +85 -232
- package/src/protocols/mcp/tools/PlanningTools.ts +137 -59
- package/src/protocols/mcp/tools/ProjectContextTools.ts +33 -12
- package/src/protocols/mcp/tools/SafetyTools.ts +49 -13
- package/src/protocols/mcp/tools/SearchProjectTools.ts +294 -153
- package/src/protocols/mcp/tools/TaskPlanningTools.ts +437 -514
- package/src/protocols/mcp/tools/TestTools.ts +41 -11
- package/src/protocols/mcp/tools/TypeScriptTools.ts +61 -12
- package/src/protocols/mcp/tools/UserInputTools.ts +15 -1
- package/src/protocols/mcp/tools/UserMemoryTools.ts +27 -62
- package/src/protocols/mcp/tools/shell/ShellExecuteHandler.ts +26 -84
- package/src/protocols/mcp/tools/shell/ShellSandbox.ts +13 -31
- package/src/repositories/interfaces/IKnowledgeGraphRepository.ts +45 -27
- package/src/schemas/EventPayloadSchema.ts +45 -1
- package/src/services/AgentPerformanceService.ts +85 -36
- package/src/services/AutoCorrectionService.ts +25 -6
- package/src/services/BackgroundTaskManager.ts +183 -76
- package/src/services/BrowserManager.ts +20 -16
- package/src/services/ChannelContextMemoryOperations.ts +169 -202
- package/src/services/ChannelContextMessageOperations.ts +112 -274
- package/src/services/MemoryService.ts +1053 -760
- package/src/services/PatternLearningService.ts +32 -7
- package/src/services/PerformanceOptimizationService.ts +26 -9
- package/src/services/PredictiveAnalyticsService.ts +23 -10
- package/src/services/ProactiveValidationService.ts +66 -40
- package/src/services/TaskEffectivenessService.ts +421 -206
- package/src/services/ToolExecutionInterceptor.ts +40 -9
- package/src/services/UserInputRequestManager.ts +51 -6
- package/src/services/UserMemoryService.ts +12 -3
- package/src/services/ValidationAnalyticsService.ts +36 -11
- package/src/services/ValidationCacheService.ts +30 -7
- package/src/services/ValidationMiddleware.ts +62 -14
- package/src/services/ValidationPerformanceService.ts +47 -25
- package/src/services/WebSearchService.ts +16 -4
- package/src/services/dag/TaskDagService.ts +20 -1
- package/src/services/kg/EntityQValueManager.ts +21 -10
- package/src/services/kg/GraphSurpriseCalculator.ts +0 -14
- package/src/services/kg/KnowledgeGraphService.ts +56 -48
- package/src/services/kg/OrparGraphIntegration.ts +11 -5
- package/src/services/orpar-memory/CycleConsolidationTrigger.ts +10 -1
- package/src/services/orpar-memory/OrparMemoryCoordinator.ts +142 -71
- package/src/services/orpar-memory/SurpriseOrparAdapter.ts +10 -1
- package/src/types/ChannelContext.ts +3 -1
- package/src/types/EffectivenessTypes.ts +6 -2
- package/src/types/TaskCompletionTypes.ts +9 -9
- package/src/types/TaskTypes.ts +12 -1
- package/src/utils/GlobMatcher.ts +157 -0
|
@@ -18,26 +18,22 @@
|
|
|
18
18
|
* @documentation https://mxf-dev.github.io/mxf/
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
*/
|
|
27
|
-
|
|
28
|
-
import { McpToolDefinition, McpToolHandlerResult } from '../McpServerTypes.js';
|
|
29
|
-
import { Logger } from '../../../utils/Logger.js';
|
|
30
|
-
import { ValidationAnalyticsService } from '../../../services/ValidationAnalyticsService.js';
|
|
21
|
+
import {
|
|
22
|
+
McpToolDefinition,
|
|
23
|
+
McpToolHandlerContext,
|
|
24
|
+
McpToolHandlerResult
|
|
25
|
+
} from '../McpServerTypes.js';
|
|
31
26
|
import { TaskEffectivenessService } from '../../../services/TaskEffectivenessService.js';
|
|
32
27
|
import { AgentPerformanceService } from '../../../services/AgentPerformanceService.js';
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
28
|
+
import { AgentId } from '../../../types/Agent.js';
|
|
29
|
+
import { ChannelId } from '../../../types/ChannelContext.js';
|
|
35
30
|
|
|
36
|
-
|
|
37
|
-
|
|
31
|
+
interface AnalyticsTenantIdentity {
|
|
32
|
+
agentId: AgentId;
|
|
33
|
+
channelId: ChannelId;
|
|
34
|
+
}
|
|
38
35
|
|
|
39
|
-
|
|
40
|
-
function createToolResult(success: boolean, data: any): McpToolHandlerResult {
|
|
36
|
+
function createToolResult(success: boolean, data: Record<string, unknown>): McpToolHandlerResult {
|
|
41
37
|
return {
|
|
42
38
|
content: {
|
|
43
39
|
type: 'application/json',
|
|
@@ -46,705 +42,235 @@ function createToolResult(success: boolean, data: any): McpToolHandlerResult {
|
|
|
46
42
|
};
|
|
47
43
|
}
|
|
48
44
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
45
|
+
function requireTenantIdentity(context: McpToolHandlerContext): AnalyticsTenantIdentity {
|
|
46
|
+
if (!context.agentId?.trim() || !context.channelId?.trim() ||
|
|
47
|
+
context.agentId !== context.agentId.trim() ||
|
|
48
|
+
context.channelId !== context.channelId.trim()) {
|
|
49
|
+
throw new Error('Authenticated agent and channel context are required');
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return {
|
|
53
|
+
agentId: context.agentId as AgentId,
|
|
54
|
+
channelId: context.channelId as ChannelId
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function rejectCallerSelectedTenant(input: Record<string, unknown>): void {
|
|
59
|
+
if (Object.prototype.hasOwnProperty.call(input, 'agentId') ||
|
|
60
|
+
Object.prototype.hasOwnProperty.call(input, 'channelId')) {
|
|
61
|
+
throw new Error('Agent and channel identity are derived from authenticated tool context');
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function requireObjectInput(input: unknown): Record<string, unknown> {
|
|
66
|
+
if (input === null || typeof input !== 'object' || Array.isArray(input)) {
|
|
67
|
+
throw new Error('Tool input must be an object');
|
|
68
|
+
}
|
|
69
|
+
return input as Record<string, unknown>;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function errorMessage(error: unknown): string {
|
|
73
|
+
return error instanceof Error ? error.message : String(error);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function unavailableHandler(reason: string): () => Promise<McpToolHandlerResult> {
|
|
77
|
+
return async () => createToolResult(false, { error: reason });
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** Read already-observed performance for the authenticated agent in its channel. */
|
|
52
81
|
export const analytics_agent_performance: McpToolDefinition = {
|
|
53
82
|
name: 'analytics_agent_performance',
|
|
54
|
-
description: 'Get
|
|
83
|
+
description: 'Get tracked performance metrics for the authenticated agent in the current channel',
|
|
55
84
|
inputSchema: {
|
|
56
85
|
type: 'object',
|
|
57
86
|
properties: {
|
|
58
|
-
agentId: {
|
|
59
|
-
type: 'string',
|
|
60
|
-
description: 'Specific agent ID to analyze (optional - omit for all agents)'
|
|
61
|
-
},
|
|
62
|
-
timeRange: {
|
|
63
|
-
type: 'string',
|
|
64
|
-
enum: ['1h', '24h', '7d', '30d'],
|
|
65
|
-
description: 'Time range for metrics analysis',
|
|
66
|
-
default: '24h'
|
|
67
|
-
},
|
|
68
87
|
includeDetails: {
|
|
69
88
|
type: 'boolean',
|
|
70
|
-
description: 'Include
|
|
89
|
+
description: 'Include the complete tracked metric record',
|
|
71
90
|
default: false
|
|
72
91
|
}
|
|
73
92
|
},
|
|
74
93
|
additionalProperties: false
|
|
75
94
|
},
|
|
76
95
|
enabled: true,
|
|
77
|
-
handler: async (
|
|
78
|
-
const performanceService = AgentPerformanceService.getInstance();
|
|
96
|
+
handler: async (rawInput: unknown, context: McpToolHandlerContext) => {
|
|
79
97
|
try {
|
|
98
|
+
const input = requireObjectInput(rawInput);
|
|
99
|
+
rejectCallerSelectedTenant(input);
|
|
100
|
+
const { agentId, channelId } = requireTenantIdentity(context);
|
|
101
|
+
const metrics = AgentPerformanceService.getInstance()
|
|
102
|
+
.getTrackedPerformanceMetrics(agentId, channelId);
|
|
80
103
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
const performanceObs = await performanceService.getPerformanceMetrics(
|
|
86
|
-
agentId || contextAgentId,
|
|
87
|
-
channelId
|
|
88
|
-
);
|
|
89
|
-
performanceData = await firstValueFrom(performanceObs);
|
|
90
|
-
} catch (error: any) {
|
|
91
|
-
logger.warn(`Could not get performance data: ${error.message}`);
|
|
92
|
-
}
|
|
104
|
+
if (!metrics) {
|
|
105
|
+
return createToolResult(false, {
|
|
106
|
+
error: 'No tracked performance metrics exist for this agent in this channel'
|
|
107
|
+
});
|
|
93
108
|
}
|
|
94
|
-
|
|
95
|
-
return createToolResult(true, {
|
|
96
|
-
agentId: agentId || 'all',
|
|
97
|
-
timeRange,
|
|
98
|
-
metrics: performanceData,
|
|
99
|
-
summary: {
|
|
100
|
-
totalTasks: performanceData?.collaboration?.successfulCollaborations || 0,
|
|
101
|
-
averageResponseTime: performanceData?.orparTiming?.averageTotalCycleTime || 0,
|
|
102
|
-
successRate: performanceData?.collaboration?.collaborationSuccessRate || 0,
|
|
103
|
-
efficiency: performanceData?.benchmark?.relativePerformance?.efficiency || 0
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
} catch (error: any) {
|
|
107
|
-
logger.error('Error getting agent performance:', error);
|
|
108
|
-
return createToolResult(false, { error: `Failed to get agent performance: ${error.message}` });
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* 2. Get Channel Activity Analytics
|
|
115
|
-
*/
|
|
116
|
-
export const analytics_channel_activity: McpToolDefinition = {
|
|
117
|
-
name: 'analytics_channel_activity',
|
|
118
|
-
description: 'Analyze channel activity patterns, message volume, and engagement metrics',
|
|
119
|
-
inputSchema: {
|
|
120
|
-
type: 'object',
|
|
121
|
-
properties: {
|
|
122
|
-
channelId: {
|
|
123
|
-
type: 'string',
|
|
124
|
-
description: 'Specific channel ID to analyze (optional - omit for all channels)'
|
|
125
|
-
},
|
|
126
|
-
timeRange: {
|
|
127
|
-
type: 'string',
|
|
128
|
-
enum: ['1h', '24h', '7d', '30d'],
|
|
129
|
-
description: 'Time range for activity analysis',
|
|
130
|
-
default: '24h'
|
|
131
|
-
},
|
|
132
|
-
includePatterns: {
|
|
133
|
-
type: 'boolean',
|
|
134
|
-
description: 'Include activity pattern analysis',
|
|
135
|
-
default: true
|
|
136
|
-
}
|
|
137
|
-
},
|
|
138
|
-
additionalProperties: false
|
|
139
|
-
},
|
|
140
|
-
enabled: true,
|
|
141
|
-
handler: async ({ channelId, timeRange = '24h', includePatterns = true }: any, { agentId, channelId: contextChannelId }: any) => {
|
|
142
|
-
try {
|
|
143
|
-
|
|
144
|
-
// Mock implementation - replace with actual analytics service call
|
|
145
|
-
const activityData = {
|
|
146
|
-
totalMessages: 0,
|
|
147
|
-
activeAgents: 0,
|
|
148
|
-
averageResponseTime: 0,
|
|
149
|
-
peakActivity: null,
|
|
150
|
-
patterns: includePatterns ? {
|
|
151
|
-
mostActiveHours: [],
|
|
152
|
-
averageMessagesPerHour: 0,
|
|
153
|
-
responseTimeDistribution: {}
|
|
154
|
-
} : null
|
|
155
|
-
};
|
|
156
|
-
|
|
157
|
-
return createToolResult(true, {
|
|
158
|
-
channelId: channelId || 'all',
|
|
159
|
-
timeRange,
|
|
160
|
-
activity: activityData,
|
|
161
|
-
insights: [
|
|
162
|
-
'Channel activity analysis complete',
|
|
163
|
-
`Analyzed ${timeRange} of data`,
|
|
164
|
-
includePatterns ? 'Pattern analysis included' : 'Basic metrics only'
|
|
165
|
-
]
|
|
166
|
-
});
|
|
167
|
-
} catch (error: any) {
|
|
168
|
-
logger.error('Error getting channel activity:', error);
|
|
169
|
-
return createToolResult(false, { error: `Failed to get channel activity: ${error.message}` });
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
};
|
|
173
109
|
|
|
174
|
-
/**
|
|
175
|
-
* 3. Get System Health Metrics
|
|
176
|
-
*/
|
|
177
|
-
export const analytics_system_health: McpToolDefinition = {
|
|
178
|
-
name: 'analytics_system_health',
|
|
179
|
-
description: 'Get comprehensive system health metrics including resource usage and service status',
|
|
180
|
-
inputSchema: {
|
|
181
|
-
type: 'object',
|
|
182
|
-
properties: {
|
|
183
|
-
includeServices: {
|
|
184
|
-
type: 'boolean',
|
|
185
|
-
description: 'Include individual service health checks',
|
|
186
|
-
default: true
|
|
187
|
-
},
|
|
188
|
-
includeResources: {
|
|
189
|
-
type: 'boolean',
|
|
190
|
-
description: 'Include resource usage metrics',
|
|
191
|
-
default: true
|
|
192
|
-
}
|
|
193
|
-
},
|
|
194
|
-
additionalProperties: false
|
|
195
|
-
},
|
|
196
|
-
enabled: true,
|
|
197
|
-
handler: async ({ includeServices = true, includeResources = true }: any, { agentId, channelId }: any) => {
|
|
198
|
-
try {
|
|
199
|
-
|
|
200
|
-
// Get basic system metrics
|
|
201
|
-
const systemHealth = {
|
|
202
|
-
status: 'healthy',
|
|
203
|
-
uptime: Math.floor(process.uptime()),
|
|
204
|
-
timestamp: new Date().toISOString(),
|
|
205
|
-
memory: includeResources ? {
|
|
206
|
-
used: process.memoryUsage().heapUsed,
|
|
207
|
-
total: process.memoryUsage().heapTotal,
|
|
208
|
-
external: process.memoryUsage().external
|
|
209
|
-
} : null,
|
|
210
|
-
services: includeServices ? {
|
|
211
|
-
database: 'connected',
|
|
212
|
-
eventBus: 'active',
|
|
213
|
-
socketService: 'running',
|
|
214
|
-
mcpService: 'active'
|
|
215
|
-
} : null
|
|
216
|
-
};
|
|
217
|
-
|
|
218
110
|
return createToolResult(true, {
|
|
219
|
-
|
|
111
|
+
agentId,
|
|
112
|
+
channelId,
|
|
113
|
+
metrics: input.includeDetails === true ? metrics : undefined,
|
|
220
114
|
summary: {
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
Math.round((systemHealth.memory!.used / systemHealth.memory!.total) * 100) : 'N/A'
|
|
115
|
+
totalTasks: metrics.collaboration.successfulCollaborations,
|
|
116
|
+
averageResponseTime: metrics.orparTiming.averageTotalCycleTime,
|
|
117
|
+
successRate: metrics.collaboration.collaborationSuccessRate,
|
|
118
|
+
efficiency: metrics.benchmark.relativePerformance.efficiency
|
|
226
119
|
}
|
|
227
120
|
});
|
|
228
|
-
} catch (error:
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
};
|
|
234
|
-
|
|
235
|
-
/**
|
|
236
|
-
* 4. Generate Analytics Report
|
|
237
|
-
*/
|
|
238
|
-
export const analytics_generate_report: McpToolDefinition = {
|
|
239
|
-
name: 'analytics_generate_report',
|
|
240
|
-
description: 'Generate comprehensive analytics reports with customizable parameters',
|
|
241
|
-
inputSchema: {
|
|
242
|
-
type: 'object',
|
|
243
|
-
properties: {
|
|
244
|
-
reportType: {
|
|
245
|
-
type: 'string',
|
|
246
|
-
enum: ['performance', 'activity', 'system', 'comprehensive'],
|
|
247
|
-
description: 'Type of report to generate'
|
|
248
|
-
},
|
|
249
|
-
timeRange: {
|
|
250
|
-
type: 'string',
|
|
251
|
-
enum: ['24h', '7d', '30d', '90d'],
|
|
252
|
-
description: 'Time range for report data',
|
|
253
|
-
default: '7d'
|
|
254
|
-
},
|
|
255
|
-
format: {
|
|
256
|
-
type: 'string',
|
|
257
|
-
enum: ['json', 'summary', 'detailed'],
|
|
258
|
-
description: 'Report output format',
|
|
259
|
-
default: 'summary'
|
|
260
|
-
},
|
|
261
|
-
includeCharts: {
|
|
262
|
-
type: 'boolean',
|
|
263
|
-
description: 'Include chart data for visualizations',
|
|
264
|
-
default: false
|
|
265
|
-
}
|
|
266
|
-
},
|
|
267
|
-
required: ['reportType'],
|
|
268
|
-
additionalProperties: false
|
|
269
|
-
},
|
|
270
|
-
enabled: true,
|
|
271
|
-
handler: async ({ reportType, timeRange = '7d', format = 'summary', includeCharts = false }: any, { agentId, channelId }: any) => {
|
|
272
|
-
try {
|
|
273
|
-
|
|
274
|
-
// Generate report based on type
|
|
275
|
-
const report = {
|
|
276
|
-
id: `report_${Date.now()}`,
|
|
277
|
-
type: reportType,
|
|
278
|
-
timeRange,
|
|
279
|
-
format,
|
|
280
|
-
generatedAt: new Date().toISOString(),
|
|
281
|
-
data: {
|
|
282
|
-
summary: `${reportType} report for ${timeRange}`,
|
|
283
|
-
metrics: {},
|
|
284
|
-
insights: [],
|
|
285
|
-
recommendations: []
|
|
286
|
-
},
|
|
287
|
-
charts: includeCharts ? {
|
|
288
|
-
available: true,
|
|
289
|
-
types: ['line', 'bar', 'pie']
|
|
290
|
-
} : null
|
|
291
|
-
};
|
|
292
|
-
|
|
293
|
-
return createToolResult(true, {
|
|
294
|
-
report,
|
|
295
|
-
downloadUrl: null, // Could implement file generation
|
|
296
|
-
sharing: {
|
|
297
|
-
reportId: report.id,
|
|
298
|
-
expiresAt: new Date(Date.now() + 7 * 24 * 60 * 60 * 1000).toISOString()
|
|
299
|
-
}
|
|
121
|
+
} catch (error: unknown) {
|
|
122
|
+
return createToolResult(false, {
|
|
123
|
+
error: `Failed to get agent performance: ${errorMessage(error)}`
|
|
300
124
|
});
|
|
301
|
-
} catch (error: any) {
|
|
302
|
-
logger.error('Error generating report:', error);
|
|
303
|
-
return createToolResult(false, { error: `Failed to generate report: ${error.message}` });
|
|
304
125
|
}
|
|
305
126
|
}
|
|
306
127
|
};
|
|
307
128
|
|
|
308
|
-
/**
|
|
309
|
-
* 5. Get Task Completion Analytics
|
|
310
|
-
*/
|
|
129
|
+
/** Read task-effectiveness analytics for the authenticated agent and channel. */
|
|
311
130
|
export const analytics_task_completion: McpToolDefinition = {
|
|
312
131
|
name: 'analytics_task_completion',
|
|
313
|
-
description: 'Analyze task completion
|
|
132
|
+
description: 'Analyze task completion for the authenticated agent in the current channel',
|
|
314
133
|
inputSchema: {
|
|
315
134
|
type: 'object',
|
|
316
135
|
properties: {
|
|
317
136
|
timeRange: {
|
|
318
137
|
type: 'string',
|
|
319
138
|
enum: ['24h', '7d', '30d'],
|
|
320
|
-
description: 'Time range for task analysis',
|
|
321
139
|
default: '7d'
|
|
322
140
|
},
|
|
323
141
|
includeBreakdown: {
|
|
324
142
|
type: 'boolean',
|
|
325
|
-
description: 'Include detailed breakdown by priority, type, etc.',
|
|
326
143
|
default: true
|
|
327
|
-
},
|
|
328
|
-
agentId: {
|
|
329
|
-
type: 'string',
|
|
330
|
-
description: 'Filter by specific agent (optional)'
|
|
331
|
-
},
|
|
332
|
-
channelId: {
|
|
333
|
-
type: 'string',
|
|
334
|
-
description: 'Filter by specific channel (optional)'
|
|
335
144
|
}
|
|
336
145
|
},
|
|
337
146
|
additionalProperties: false
|
|
338
147
|
},
|
|
339
148
|
enabled: true,
|
|
340
|
-
handler: async (
|
|
341
|
-
const effectivenessService = TaskEffectivenessService.getInstance();
|
|
149
|
+
handler: async (rawInput: unknown, context: McpToolHandlerContext) => {
|
|
342
150
|
try {
|
|
151
|
+
const input = requireObjectInput(rawInput);
|
|
152
|
+
rejectCallerSelectedTenant(input);
|
|
153
|
+
const { agentId, channelId } = requireTenantIdentity(context);
|
|
154
|
+
const timeRange = input.timeRange === '24h' || input.timeRange === '30d'
|
|
155
|
+
? input.timeRange
|
|
156
|
+
: '7d';
|
|
157
|
+
const timeRangeMs = timeRange === '24h'
|
|
158
|
+
? 24 * 60 * 60 * 1000
|
|
159
|
+
: timeRange === '7d'
|
|
160
|
+
? 7 * 24 * 60 * 60 * 1000
|
|
161
|
+
: 30 * 24 * 60 * 60 * 1000;
|
|
162
|
+
const endTime = Date.now();
|
|
163
|
+
const analytics = await TaskEffectivenessService.getInstance().getAnalytics(
|
|
164
|
+
endTime - timeRangeMs,
|
|
165
|
+
endTime,
|
|
166
|
+
agentId,
|
|
167
|
+
channelId
|
|
168
|
+
);
|
|
169
|
+
const taskTypeStats = Object.values(analytics.byTaskType);
|
|
170
|
+
const totalTasks = taskTypeStats.reduce((sum, stats) => sum + stats.count, 0);
|
|
171
|
+
const completedTasks = Object.values(analytics.byChannel)
|
|
172
|
+
.reduce((sum, stats) => sum + stats.completedTasks, 0);
|
|
173
|
+
const averageCompletionTime = totalTasks === 0
|
|
174
|
+
? 0
|
|
175
|
+
: taskTypeStats.reduce(
|
|
176
|
+
(sum, stats) => sum + (stats.avgCompletionTime * stats.count),
|
|
177
|
+
0
|
|
178
|
+
) / totalTasks;
|
|
343
179
|
|
|
344
|
-
// Get effectiveness data from service
|
|
345
|
-
const now = Date.now();
|
|
346
|
-
const timeRangeMs = timeRange === '24h' ? 24 * 60 * 60 * 1000 :
|
|
347
|
-
timeRange === '7d' ? 7 * 24 * 60 * 60 * 1000 :
|
|
348
|
-
30 * 24 * 60 * 60 * 1000;
|
|
349
|
-
const startTime = now - timeRangeMs;
|
|
350
|
-
const taskAnalytics = await effectivenessService.getAnalytics(startTime, now, channelId);
|
|
351
|
-
|
|
352
180
|
return createToolResult(true, {
|
|
353
181
|
timeRange,
|
|
354
|
-
|
|
182
|
+
tenant: { agentId, channelId },
|
|
355
183
|
metrics: {
|
|
356
|
-
totalTasks
|
|
357
|
-
completedTasks
|
|
358
|
-
failedTasks:
|
|
359
|
-
averageCompletionTime
|
|
360
|
-
completionRate:
|
|
184
|
+
totalTasks,
|
|
185
|
+
completedTasks,
|
|
186
|
+
failedTasks: totalTasks - completedTasks,
|
|
187
|
+
averageCompletionTime,
|
|
188
|
+
completionRate: totalTasks === 0 ? 0 : completedTasks / totalTasks
|
|
361
189
|
},
|
|
362
|
-
breakdown: includeBreakdown ? {
|
|
363
|
-
byTaskType:
|
|
364
|
-
byChannel:
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
190
|
+
breakdown: input.includeBreakdown === false ? undefined : {
|
|
191
|
+
byTaskType: analytics.byTaskType,
|
|
192
|
+
byChannel: analytics.byChannel
|
|
193
|
+
},
|
|
194
|
+
trends: analytics.trends
|
|
195
|
+
});
|
|
196
|
+
} catch (error: unknown) {
|
|
197
|
+
return createToolResult(false, {
|
|
198
|
+
error: `Failed to get task analytics: ${errorMessage(error)}`
|
|
368
199
|
});
|
|
369
|
-
} catch (error: any) {
|
|
370
|
-
logger.error('Error getting task completion analytics:', error);
|
|
371
|
-
return createToolResult(false, { error: `Failed to get task analytics: ${error.message}` });
|
|
372
200
|
}
|
|
373
201
|
}
|
|
374
202
|
};
|
|
375
203
|
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
204
|
+
const unavailableInputSchema = {
|
|
205
|
+
type: 'object',
|
|
206
|
+
properties: {},
|
|
207
|
+
additionalProperties: false
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
export const analytics_channel_activity: McpToolDefinition = {
|
|
211
|
+
name: 'analytics_channel_activity',
|
|
212
|
+
description: 'Unavailable until channel activity analytics has an authoritative tenant-scoped data source',
|
|
213
|
+
inputSchema: unavailableInputSchema,
|
|
214
|
+
enabled: false,
|
|
215
|
+
handler: unavailableHandler('Channel activity analytics is not implemented')
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
export const analytics_system_health: McpToolDefinition = {
|
|
219
|
+
name: 'analytics_system_health',
|
|
220
|
+
description: 'Server-global health is not available to agent MCP callers',
|
|
221
|
+
inputSchema: unavailableInputSchema,
|
|
222
|
+
enabled: false,
|
|
223
|
+
handler: unavailableHandler('Server-global health is restricted to administrative surfaces')
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
export const analytics_generate_report: McpToolDefinition = {
|
|
227
|
+
name: 'analytics_generate_report',
|
|
228
|
+
description: 'Unavailable until report generation has an authoritative tenant-scoped implementation',
|
|
229
|
+
inputSchema: unavailableInputSchema,
|
|
230
|
+
enabled: false,
|
|
231
|
+
handler: unavailableHandler('Analytics report generation is not implemented')
|
|
232
|
+
};
|
|
233
|
+
|
|
379
234
|
export const analytics_validation_metrics: McpToolDefinition = {
|
|
380
235
|
name: 'analytics_validation_metrics',
|
|
381
|
-
description: '
|
|
382
|
-
inputSchema:
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
timeRange: {
|
|
386
|
-
type: 'string',
|
|
387
|
-
enum: ['1h', '24h', '7d', '30d'],
|
|
388
|
-
description: 'Time range for validation metrics',
|
|
389
|
-
default: '24h'
|
|
390
|
-
},
|
|
391
|
-
includeDetails: {
|
|
392
|
-
type: 'boolean',
|
|
393
|
-
description: 'Include detailed error patterns and corrections',
|
|
394
|
-
default: true
|
|
395
|
-
}
|
|
396
|
-
},
|
|
397
|
-
additionalProperties: false
|
|
398
|
-
},
|
|
399
|
-
enabled: true,
|
|
400
|
-
handler: async ({ timeRange = '24h', includeDetails = true }: any, { agentId, channelId }: any) => {
|
|
401
|
-
const validationAnalytics = ValidationAnalyticsService.getInstance();
|
|
402
|
-
try {
|
|
403
|
-
|
|
404
|
-
// Get validation metrics from service
|
|
405
|
-
const timeRangeEnum = timeRange === '1h' ? 'hour' :
|
|
406
|
-
timeRange === '24h' ? 'day' :
|
|
407
|
-
timeRange === '7d' ? 'week' : 'month';
|
|
408
|
-
const validationMetrics = await validationAnalytics.aggregateValidationMetrics(timeRangeEnum as any) || {};
|
|
409
|
-
|
|
410
|
-
return createToolResult(true, {
|
|
411
|
-
timeRange,
|
|
412
|
-
metrics: {
|
|
413
|
-
totalValidations: validationMetrics.totalValidations || 0,
|
|
414
|
-
successfulValidations: validationMetrics.successfulValidations || 0,
|
|
415
|
-
errorsPrevented: validationMetrics.errorsPrevented || 0,
|
|
416
|
-
averageValidationTime: validationMetrics.averageValidationTime || 0,
|
|
417
|
-
successRate: validationMetrics.successRate || 0
|
|
418
|
-
},
|
|
419
|
-
autoCorrection: {
|
|
420
|
-
totalCorrections: validationMetrics.autoCorrections || 0,
|
|
421
|
-
correctionSuccessRate: validationMetrics.correctionSuccessRate || 0,
|
|
422
|
-
commonCorrections: validationMetrics.commonCorrections || []
|
|
423
|
-
},
|
|
424
|
-
details: includeDetails ? {
|
|
425
|
-
errorPatterns: validationMetrics.errorPatterns || [],
|
|
426
|
-
performanceOptimizations: validationMetrics.optimizations || [],
|
|
427
|
-
predictiveAccuracy: validationMetrics.predictiveAccuracy || 0
|
|
428
|
-
} : null
|
|
429
|
-
});
|
|
430
|
-
} catch (error: any) {
|
|
431
|
-
logger.error('Error getting validation analytics:', error);
|
|
432
|
-
return createToolResult(false, { error: `Failed to get validation metrics: ${error.message}` });
|
|
433
|
-
}
|
|
434
|
-
}
|
|
236
|
+
description: 'Server-global validation analytics is not available to agent MCP callers',
|
|
237
|
+
inputSchema: unavailableInputSchema,
|
|
238
|
+
enabled: false,
|
|
239
|
+
handler: unavailableHandler('Server-global validation analytics is restricted to administrative surfaces')
|
|
435
240
|
};
|
|
436
241
|
|
|
437
|
-
/**
|
|
438
|
-
* 7. Get MCP Tool Usage Analytics
|
|
439
|
-
*/
|
|
440
242
|
export const analytics_tool_usage: McpToolDefinition = {
|
|
441
243
|
name: 'analytics_tool_usage',
|
|
442
|
-
description: '
|
|
443
|
-
inputSchema:
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
timeRange: {
|
|
447
|
-
type: 'string',
|
|
448
|
-
enum: ['24h', '7d', '30d'],
|
|
449
|
-
description: 'Time range for tool usage analysis',
|
|
450
|
-
default: '7d'
|
|
451
|
-
},
|
|
452
|
-
category: {
|
|
453
|
-
type: 'string',
|
|
454
|
-
description: 'Filter by tool category (optional)'
|
|
455
|
-
},
|
|
456
|
-
sortBy: {
|
|
457
|
-
type: 'string',
|
|
458
|
-
enum: ['usage', 'success_rate', 'performance', 'errors'],
|
|
459
|
-
description: 'Sort tools by metric',
|
|
460
|
-
default: 'usage'
|
|
461
|
-
},
|
|
462
|
-
limit: {
|
|
463
|
-
type: 'number',
|
|
464
|
-
description: 'Limit number of tools in results',
|
|
465
|
-
default: 20,
|
|
466
|
-
minimum: 1,
|
|
467
|
-
maximum: 100
|
|
468
|
-
}
|
|
469
|
-
},
|
|
470
|
-
additionalProperties: false
|
|
471
|
-
},
|
|
472
|
-
enabled: true,
|
|
473
|
-
handler: async ({ timeRange = '7d', category, sortBy = 'usage', limit = 20 }: any, { agentId, channelId }: any) => {
|
|
474
|
-
try {
|
|
475
|
-
|
|
476
|
-
// Mock tool usage data - replace with actual analytics
|
|
477
|
-
const toolUsage = {
|
|
478
|
-
totalExecutions: 0,
|
|
479
|
-
uniqueTools: 0,
|
|
480
|
-
averageExecutionTime: 0,
|
|
481
|
-
topTools: [],
|
|
482
|
-
categories: {},
|
|
483
|
-
trends: []
|
|
484
|
-
};
|
|
485
|
-
|
|
486
|
-
return createToolResult(true, {
|
|
487
|
-
timeRange,
|
|
488
|
-
filters: { category, sortBy, limit },
|
|
489
|
-
usage: toolUsage,
|
|
490
|
-
insights: [
|
|
491
|
-
`Analyzed ${toolUsage.uniqueTools} unique tools`,
|
|
492
|
-
`Total executions: ${toolUsage.totalExecutions}`,
|
|
493
|
-
`Average execution time: ${toolUsage.averageExecutionTime}ms`
|
|
494
|
-
]
|
|
495
|
-
});
|
|
496
|
-
} catch (error: any) {
|
|
497
|
-
logger.error('Error getting tool usage analytics:', error);
|
|
498
|
-
return createToolResult(false, { error: `Failed to get tool usage analytics: ${error.message}` });
|
|
499
|
-
}
|
|
500
|
-
}
|
|
244
|
+
description: 'Unavailable until tool usage analytics has an authoritative tenant-scoped data source',
|
|
245
|
+
inputSchema: unavailableInputSchema,
|
|
246
|
+
enabled: false,
|
|
247
|
+
handler: unavailableHandler('Tool usage analytics is not implemented')
|
|
501
248
|
};
|
|
502
249
|
|
|
503
|
-
/**
|
|
504
|
-
* 8. Compare Performance Metrics
|
|
505
|
-
*/
|
|
506
250
|
export const analytics_compare_performance: McpToolDefinition = {
|
|
507
251
|
name: 'analytics_compare_performance',
|
|
508
|
-
description: '
|
|
509
|
-
inputSchema:
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
comparisonType: {
|
|
513
|
-
type: 'string',
|
|
514
|
-
enum: ['time_periods', 'agents', 'channels'],
|
|
515
|
-
description: 'Type of comparison to perform'
|
|
516
|
-
},
|
|
517
|
-
baseline: {
|
|
518
|
-
type: 'object',
|
|
519
|
-
description: 'Baseline parameters for comparison',
|
|
520
|
-
properties: {
|
|
521
|
-
timeRange: { type: 'string' },
|
|
522
|
-
agentId: { type: 'string' },
|
|
523
|
-
channelId: { type: 'string' }
|
|
524
|
-
}
|
|
525
|
-
},
|
|
526
|
-
comparison: {
|
|
527
|
-
type: 'object',
|
|
528
|
-
description: 'Comparison parameters',
|
|
529
|
-
properties: {
|
|
530
|
-
timeRange: { type: 'string' },
|
|
531
|
-
agentId: { type: 'string' },
|
|
532
|
-
channelId: { type: 'string' }
|
|
533
|
-
}
|
|
534
|
-
},
|
|
535
|
-
metrics: {
|
|
536
|
-
type: 'array',
|
|
537
|
-
items: { type: 'string' },
|
|
538
|
-
description: 'Specific metrics to compare',
|
|
539
|
-
default: ['response_time', 'success_rate', 'task_completion']
|
|
540
|
-
}
|
|
541
|
-
},
|
|
542
|
-
required: ['comparisonType', 'baseline', 'comparison'],
|
|
543
|
-
additionalProperties: false
|
|
544
|
-
},
|
|
545
|
-
enabled: true,
|
|
546
|
-
handler: async ({ comparisonType, baseline, comparison, metrics = ['response_time', 'success_rate', 'task_completion'] }: any, { agentId, channelId }: any) => {
|
|
547
|
-
try {
|
|
548
|
-
|
|
549
|
-
// Mock comparison data since compareMetrics doesn't exist
|
|
550
|
-
const comparisonResult = {
|
|
551
|
-
improvement: 0,
|
|
552
|
-
significantChanges: [],
|
|
553
|
-
recommendations: ['Comparison functionality needs implementation']
|
|
554
|
-
};
|
|
555
|
-
|
|
556
|
-
return createToolResult(true, {
|
|
557
|
-
comparisonType,
|
|
558
|
-
baseline,
|
|
559
|
-
comparison,
|
|
560
|
-
metrics,
|
|
561
|
-
results: comparisonResult,
|
|
562
|
-
summary: {
|
|
563
|
-
improvement: comparisonResult.improvement || 0,
|
|
564
|
-
significantChanges: comparisonResult.significantChanges || [],
|
|
565
|
-
recommendations: comparisonResult.recommendations || []
|
|
566
|
-
}
|
|
567
|
-
});
|
|
568
|
-
} catch (error: any) {
|
|
569
|
-
logger.error('Error comparing performance:', error);
|
|
570
|
-
return createToolResult(false, { error: `Failed to compare performance: ${error.message}` });
|
|
571
|
-
}
|
|
572
|
-
}
|
|
252
|
+
description: 'Unavailable until performance comparison has an authoritative tenant-scoped implementation',
|
|
253
|
+
inputSchema: unavailableInputSchema,
|
|
254
|
+
enabled: false,
|
|
255
|
+
handler: unavailableHandler('Performance comparison is not implemented')
|
|
573
256
|
};
|
|
574
257
|
|
|
575
|
-
/**
|
|
576
|
-
* 9. Get Real-time Analytics Dashboard Data
|
|
577
|
-
*/
|
|
578
258
|
export const analytics_dashboard_data: McpToolDefinition = {
|
|
579
259
|
name: 'analytics_dashboard_data',
|
|
580
|
-
description: '
|
|
581
|
-
inputSchema:
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
refresh: {
|
|
585
|
-
type: 'boolean',
|
|
586
|
-
description: 'Force refresh of cached data',
|
|
587
|
-
default: false
|
|
588
|
-
},
|
|
589
|
-
widgets: {
|
|
590
|
-
type: 'array',
|
|
591
|
-
items: {
|
|
592
|
-
type: 'string',
|
|
593
|
-
enum: ['system_status', 'active_agents', 'task_queue', 'performance_overview', 'recent_activities']
|
|
594
|
-
},
|
|
595
|
-
description: 'Specific dashboard widgets to include',
|
|
596
|
-
default: ['system_status', 'active_agents', 'task_queue', 'performance_overview']
|
|
597
|
-
}
|
|
598
|
-
},
|
|
599
|
-
additionalProperties: false
|
|
600
|
-
},
|
|
601
|
-
enabled: true,
|
|
602
|
-
handler: async ({ refresh = false, widgets = ['system_status', 'active_agents', 'task_queue', 'performance_overview'] }: any, { agentId, channelId }: any) => {
|
|
603
|
-
try {
|
|
604
|
-
|
|
605
|
-
const dashboardData: any = {
|
|
606
|
-
timestamp: new Date().toISOString(),
|
|
607
|
-
widgets: {}
|
|
608
|
-
};
|
|
609
|
-
|
|
610
|
-
// Populate requested widgets
|
|
611
|
-
for (const widget of widgets) {
|
|
612
|
-
switch (widget) {
|
|
613
|
-
case 'system_status':
|
|
614
|
-
dashboardData.widgets.system_status = {
|
|
615
|
-
status: 'healthy',
|
|
616
|
-
uptime: Math.floor(process.uptime()),
|
|
617
|
-
services: { active: 4, total: 4 }
|
|
618
|
-
};
|
|
619
|
-
break;
|
|
620
|
-
case 'active_agents':
|
|
621
|
-
dashboardData.widgets.active_agents = {
|
|
622
|
-
total: 0,
|
|
623
|
-
active: 0,
|
|
624
|
-
idle: 0
|
|
625
|
-
};
|
|
626
|
-
break;
|
|
627
|
-
case 'task_queue':
|
|
628
|
-
dashboardData.widgets.task_queue = {
|
|
629
|
-
pending: 0,
|
|
630
|
-
running: 0,
|
|
631
|
-
completed: 0
|
|
632
|
-
};
|
|
633
|
-
break;
|
|
634
|
-
case 'performance_overview':
|
|
635
|
-
dashboardData.widgets.performance_overview = {
|
|
636
|
-
averageResponseTime: 0,
|
|
637
|
-
successRate: 0,
|
|
638
|
-
throughput: 0
|
|
639
|
-
};
|
|
640
|
-
break;
|
|
641
|
-
case 'recent_activities':
|
|
642
|
-
dashboardData.widgets.recent_activities = {
|
|
643
|
-
activities: [],
|
|
644
|
-
count: 0
|
|
645
|
-
};
|
|
646
|
-
break;
|
|
647
|
-
}
|
|
648
|
-
}
|
|
649
|
-
|
|
650
|
-
return createToolResult(true, {
|
|
651
|
-
dashboard: dashboardData,
|
|
652
|
-
meta: {
|
|
653
|
-
refreshed: refresh,
|
|
654
|
-
widgetCount: widgets.length,
|
|
655
|
-
dataAge: 0
|
|
656
|
-
}
|
|
657
|
-
});
|
|
658
|
-
} catch (error: any) {
|
|
659
|
-
logger.error('Error getting dashboard data:', error);
|
|
660
|
-
return createToolResult(false, { error: `Failed to get dashboard data: ${error.message}` });
|
|
661
|
-
}
|
|
662
|
-
}
|
|
260
|
+
description: 'Server-global dashboard data is not available to agent MCP callers',
|
|
261
|
+
inputSchema: unavailableInputSchema,
|
|
262
|
+
enabled: false,
|
|
263
|
+
handler: unavailableHandler('Server-global dashboard data is restricted to administrative surfaces')
|
|
663
264
|
};
|
|
664
265
|
|
|
665
|
-
/**
|
|
666
|
-
* 10. Export Analytics Data
|
|
667
|
-
*/
|
|
668
266
|
export const analytics_export_data: McpToolDefinition = {
|
|
669
267
|
name: 'analytics_export_data',
|
|
670
|
-
description: '
|
|
671
|
-
inputSchema:
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
dataType: {
|
|
675
|
-
type: 'string',
|
|
676
|
-
enum: ['performance', 'tasks', 'validation', 'system', 'comprehensive'],
|
|
677
|
-
description: 'Type of data to export'
|
|
678
|
-
},
|
|
679
|
-
timeRange: {
|
|
680
|
-
type: 'string',
|
|
681
|
-
enum: ['24h', '7d', '30d', '90d'],
|
|
682
|
-
description: 'Time range for exported data',
|
|
683
|
-
default: '7d'
|
|
684
|
-
},
|
|
685
|
-
format: {
|
|
686
|
-
type: 'string',
|
|
687
|
-
enum: ['json', 'csv', 'excel'],
|
|
688
|
-
description: 'Export format',
|
|
689
|
-
default: 'json'
|
|
690
|
-
},
|
|
691
|
-
includeRawData: {
|
|
692
|
-
type: 'boolean',
|
|
693
|
-
description: 'Include raw data points (larger file)',
|
|
694
|
-
default: false
|
|
695
|
-
},
|
|
696
|
-
filters: {
|
|
697
|
-
type: 'object',
|
|
698
|
-
description: 'Optional filters for data export',
|
|
699
|
-
properties: {
|
|
700
|
-
agentId: { type: 'string' },
|
|
701
|
-
channelId: { type: 'string' },
|
|
702
|
-
category: { type: 'string' }
|
|
703
|
-
}
|
|
704
|
-
}
|
|
705
|
-
},
|
|
706
|
-
required: ['dataType'],
|
|
707
|
-
additionalProperties: false
|
|
708
|
-
},
|
|
709
|
-
enabled: true,
|
|
710
|
-
handler: async ({ dataType, timeRange = '7d', format = 'json', includeRawData = false, filters = {} }: any, { agentId, channelId }: any) => {
|
|
711
|
-
try {
|
|
712
|
-
|
|
713
|
-
// Generate export metadata
|
|
714
|
-
const exportData = {
|
|
715
|
-
exportId: `export_${Date.now()}`,
|
|
716
|
-
dataType,
|
|
717
|
-
timeRange,
|
|
718
|
-
format,
|
|
719
|
-
includeRawData,
|
|
720
|
-
filters,
|
|
721
|
-
generatedAt: new Date().toISOString(),
|
|
722
|
-
estimatedSize: '1.2MB', // Mock estimate
|
|
723
|
-
downloadReady: true,
|
|
724
|
-
expiresAt: new Date(Date.now() + 24 * 60 * 60 * 1000).toISOString()
|
|
725
|
-
};
|
|
726
|
-
|
|
727
|
-
return createToolResult(true, {
|
|
728
|
-
export: exportData,
|
|
729
|
-
downloadInfo: {
|
|
730
|
-
url: null, // Would be actual download URL
|
|
731
|
-
filename: `mxf_analytics_${dataType}_${timeRange}.${format}`,
|
|
732
|
-
size: exportData.estimatedSize
|
|
733
|
-
},
|
|
734
|
-
preview: {
|
|
735
|
-
recordCount: 100, // Mock count
|
|
736
|
-
columns: ['timestamp', 'metric', 'value', 'context'],
|
|
737
|
-
sampleData: includeRawData ? [] : null
|
|
738
|
-
}
|
|
739
|
-
});
|
|
740
|
-
} catch (error: any) {
|
|
741
|
-
logger.error('Error exporting analytics data:', error);
|
|
742
|
-
return createToolResult(false, { error: `Failed to export data: ${error.message}` });
|
|
743
|
-
}
|
|
744
|
-
}
|
|
268
|
+
description: 'Unavailable until analytics export has an authoritative tenant-scoped implementation',
|
|
269
|
+
inputSchema: unavailableInputSchema,
|
|
270
|
+
enabled: false,
|
|
271
|
+
handler: unavailableHandler('Analytics export is not implemented')
|
|
745
272
|
};
|
|
746
273
|
|
|
747
|
-
// Export all analytics tools
|
|
748
274
|
export const analyticsTools: McpToolDefinition[] = [
|
|
749
275
|
analytics_agent_performance,
|
|
750
276
|
analytics_channel_activity,
|
|
@@ -756,4 +282,4 @@ export const analyticsTools: McpToolDefinition[] = [
|
|
|
756
282
|
analytics_compare_performance,
|
|
757
283
|
analytics_dashboard_data,
|
|
758
284
|
analytics_export_data
|
|
759
|
-
];
|
|
285
|
+
];
|