@framers/agentos 0.1.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/LICENSE +98 -0
- package/README.md +576 -0
- package/dist/api/AgentOS.d.ts +451 -0
- package/dist/api/AgentOS.d.ts.map +1 -0
- package/dist/api/AgentOS.js +1157 -0
- package/dist/api/AgentOS.js.map +1 -0
- package/dist/api/AgentOSOrchestrator.d.ts +157 -0
- package/dist/api/AgentOSOrchestrator.d.ts.map +1 -0
- package/dist/api/AgentOSOrchestrator.js +679 -0
- package/dist/api/AgentOSOrchestrator.js.map +1 -0
- package/dist/api/interfaces/IAgentOS.d.ts +138 -0
- package/dist/api/interfaces/IAgentOS.d.ts.map +1 -0
- package/dist/api/interfaces/IAgentOS.js +11 -0
- package/dist/api/interfaces/IAgentOS.js.map +1 -0
- package/dist/api/interfaces/IUnifiedAgent.d.ts +126 -0
- package/dist/api/interfaces/IUnifiedAgent.d.ts.map +1 -0
- package/dist/api/interfaces/IUnifiedAgent.js +3 -0
- package/dist/api/interfaces/IUnifiedAgent.js.map +1 -0
- package/dist/api/types/AgentOSInput.d.ts +114 -0
- package/dist/api/types/AgentOSInput.d.ts.map +1 -0
- package/dist/api/types/AgentOSInput.js +13 -0
- package/dist/api/types/AgentOSInput.js.map +1 -0
- package/dist/api/types/AgentOSResponse.d.ts +170 -0
- package/dist/api/types/AgentOSResponse.d.ts.map +1 -0
- package/dist/api/types/AgentOSResponse.js +25 -0
- package/dist/api/types/AgentOSResponse.js.map +1 -0
- package/dist/cognitive_substrate/GMI.d.ts +148 -0
- package/dist/cognitive_substrate/GMI.d.ts.map +1 -0
- package/dist/cognitive_substrate/GMI.js +1003 -0
- package/dist/cognitive_substrate/GMI.js.map +1 -0
- package/dist/cognitive_substrate/GMIManager.d.ts +98 -0
- package/dist/cognitive_substrate/GMIManager.d.ts.map +1 -0
- package/dist/cognitive_substrate/GMIManager.js +517 -0
- package/dist/cognitive_substrate/GMIManager.js.map +1 -0
- package/dist/cognitive_substrate/IGMI.d.ts +469 -0
- package/dist/cognitive_substrate/IGMI.d.ts.map +1 -0
- package/dist/cognitive_substrate/IGMI.js +111 -0
- package/dist/cognitive_substrate/IGMI.js.map +1 -0
- package/dist/cognitive_substrate/memory/IWorkingMemory.d.ts +139 -0
- package/dist/cognitive_substrate/memory/IWorkingMemory.d.ts.map +1 -0
- package/dist/cognitive_substrate/memory/IWorkingMemory.js +14 -0
- package/dist/cognitive_substrate/memory/IWorkingMemory.js.map +1 -0
- package/dist/cognitive_substrate/memory/InMemoryWorkingMemory.d.ts +143 -0
- package/dist/cognitive_substrate/memory/InMemoryWorkingMemory.d.ts.map +1 -0
- package/dist/cognitive_substrate/memory/InMemoryWorkingMemory.js +186 -0
- package/dist/cognitive_substrate/memory/InMemoryWorkingMemory.js.map +1 -0
- package/dist/cognitive_substrate/persona_overlays/PersonaOverlayManager.d.ts +33 -0
- package/dist/cognitive_substrate/persona_overlays/PersonaOverlayManager.d.ts.map +1 -0
- package/dist/cognitive_substrate/persona_overlays/PersonaOverlayManager.js +138 -0
- package/dist/cognitive_substrate/persona_overlays/PersonaOverlayManager.js.map +1 -0
- package/dist/cognitive_substrate/persona_overlays/PersonaOverlayTypes.d.ts +32 -0
- package/dist/cognitive_substrate/persona_overlays/PersonaOverlayTypes.d.ts.map +1 -0
- package/dist/cognitive_substrate/persona_overlays/PersonaOverlayTypes.js +2 -0
- package/dist/cognitive_substrate/persona_overlays/PersonaOverlayTypes.js.map +1 -0
- package/dist/cognitive_substrate/personas/IPersonaDefinition.d.ts +336 -0
- package/dist/cognitive_substrate/personas/IPersonaDefinition.d.ts.map +1 -0
- package/dist/cognitive_substrate/personas/IPersonaDefinition.js +8 -0
- package/dist/cognitive_substrate/personas/IPersonaDefinition.js.map +1 -0
- package/dist/cognitive_substrate/personas/IPersonaLoader.d.ts +78 -0
- package/dist/cognitive_substrate/personas/IPersonaLoader.d.ts.map +1 -0
- package/dist/cognitive_substrate/personas/IPersonaLoader.js +9 -0
- package/dist/cognitive_substrate/personas/IPersonaLoader.js.map +1 -0
- package/dist/cognitive_substrate/personas/PersonaLoader.d.ts +60 -0
- package/dist/cognitive_substrate/personas/PersonaLoader.d.ts.map +1 -0
- package/dist/cognitive_substrate/personas/PersonaLoader.js +138 -0
- package/dist/cognitive_substrate/personas/PersonaLoader.js.map +1 -0
- package/dist/cognitive_substrate/personas/PersonaValidation.d.ts +139 -0
- package/dist/cognitive_substrate/personas/PersonaValidation.d.ts.map +1 -0
- package/dist/cognitive_substrate/personas/PersonaValidation.js +277 -0
- package/dist/cognitive_substrate/personas/PersonaValidation.js.map +1 -0
- package/dist/cognitive_substrate/personas/definitions/atlas_systems_architect.json +29 -0
- package/dist/cognitive_substrate/personas/definitions/default_assistant_persona.json +346 -0
- package/dist/cognitive_substrate/personas/definitions/default_free_assistant.json +13 -0
- package/dist/cognitive_substrate/personas/definitions/index.d.ts +14 -0
- package/dist/cognitive_substrate/personas/definitions/index.d.ts.map +1 -0
- package/dist/cognitive_substrate/personas/definitions/index.js +35 -0
- package/dist/cognitive_substrate/personas/definitions/index.js.map +1 -0
- package/dist/cognitive_substrate/personas/definitions/nerf_generalist.json +11 -0
- package/dist/cognitive_substrate/personas/definitions/v_researcher.json +11 -0
- package/dist/config/AgentOSConfig.d.ts +74 -0
- package/dist/config/AgentOSConfig.d.ts.map +1 -0
- package/dist/config/AgentOSConfig.js +399 -0
- package/dist/config/AgentOSConfig.js.map +1 -0
- package/dist/config/EmbeddingManagerConfiguration.d.ts +190 -0
- package/dist/config/EmbeddingManagerConfiguration.d.ts.map +1 -0
- package/dist/config/EmbeddingManagerConfiguration.js +16 -0
- package/dist/config/EmbeddingManagerConfiguration.js.map +1 -0
- package/dist/config/MemoryLifecycleManagerConfiguration.d.ts +165 -0
- package/dist/config/MemoryLifecycleManagerConfiguration.d.ts.map +1 -0
- package/dist/config/MemoryLifecycleManagerConfiguration.js +69 -0
- package/dist/config/MemoryLifecycleManagerConfiguration.js.map +1 -0
- package/dist/config/RetrievalAugmentorConfiguration.d.ts +98 -0
- package/dist/config/RetrievalAugmentorConfiguration.d.ts.map +1 -0
- package/dist/config/RetrievalAugmentorConfiguration.js +47 -0
- package/dist/config/RetrievalAugmentorConfiguration.js.map +1 -0
- package/dist/config/ToolOrchestratorConfig.d.ts +69 -0
- package/dist/config/ToolOrchestratorConfig.d.ts.map +1 -0
- package/dist/config/ToolOrchestratorConfig.js +11 -0
- package/dist/config/ToolOrchestratorConfig.js.map +1 -0
- package/dist/config/VectorStoreConfiguration.d.ts +223 -0
- package/dist/config/VectorStoreConfiguration.d.ts.map +1 -0
- package/dist/config/VectorStoreConfiguration.js +59 -0
- package/dist/config/VectorStoreConfiguration.js.map +1 -0
- package/dist/config/extension-secrets.json +38 -0
- package/dist/config/extensionSecrets.d.ts +13 -0
- package/dist/config/extensionSecrets.d.ts.map +1 -0
- package/dist/config/extensionSecrets.js +24 -0
- package/dist/config/extensionSecrets.js.map +1 -0
- package/dist/core/agency/AgencyMemoryManager.d.ts +300 -0
- package/dist/core/agency/AgencyMemoryManager.d.ts.map +1 -0
- package/dist/core/agency/AgencyMemoryManager.js +657 -0
- package/dist/core/agency/AgencyMemoryManager.js.map +1 -0
- package/dist/core/agency/AgencyRegistry.d.ts +100 -0
- package/dist/core/agency/AgencyRegistry.d.ts.map +1 -0
- package/dist/core/agency/AgencyRegistry.js +209 -0
- package/dist/core/agency/AgencyRegistry.js.map +1 -0
- package/dist/core/agency/AgencyTypes.d.ts +200 -0
- package/dist/core/agency/AgencyTypes.d.ts.map +1 -0
- package/dist/core/agency/AgencyTypes.js +7 -0
- package/dist/core/agency/AgencyTypes.js.map +1 -0
- package/dist/core/agency/AgentCommunicationBus.d.ts +150 -0
- package/dist/core/agency/AgentCommunicationBus.d.ts.map +1 -0
- package/dist/core/agency/AgentCommunicationBus.js +568 -0
- package/dist/core/agency/AgentCommunicationBus.js.map +1 -0
- package/dist/core/agency/IAgentCommunicationBus.d.ts +469 -0
- package/dist/core/agency/IAgentCommunicationBus.d.ts.map +1 -0
- package/dist/core/agency/IAgentCommunicationBus.js +40 -0
- package/dist/core/agency/IAgentCommunicationBus.js.map +1 -0
- package/dist/core/agency/index.d.ts +18 -0
- package/dist/core/agency/index.d.ts.map +1 -0
- package/dist/core/agency/index.js +18 -0
- package/dist/core/agency/index.js.map +1 -0
- package/dist/core/agents/AgentCore.d.ts +385 -0
- package/dist/core/agents/AgentCore.d.ts.map +1 -0
- package/dist/core/agents/AgentCore.js +527 -0
- package/dist/core/agents/AgentCore.js.map +1 -0
- package/dist/core/agents/AgentFactory.d.ts +123 -0
- package/dist/core/agents/AgentFactory.d.ts.map +1 -0
- package/dist/core/agents/AgentFactory.js +232 -0
- package/dist/core/agents/AgentFactory.js.map +1 -0
- package/dist/core/agents/AgentPoolAgent.d.ts +244 -0
- package/dist/core/agents/AgentPoolAgent.d.ts.map +1 -0
- package/dist/core/agents/AgentPoolAgent.js +697 -0
- package/dist/core/agents/AgentPoolAgent.js.map +1 -0
- package/dist/core/agents/AgentPoolConfig.d.ts +191 -0
- package/dist/core/agents/AgentPoolConfig.d.ts.map +1 -0
- package/dist/core/agents/AgentPoolConfig.js +58 -0
- package/dist/core/agents/AgentPoolConfig.js.map +1 -0
- package/dist/core/agents/IAgent.d.ts +226 -0
- package/dist/core/agents/IAgent.d.ts.map +1 -0
- package/dist/core/agents/IAgent.js +14 -0
- package/dist/core/agents/IAgent.js.map +1 -0
- package/dist/core/agents/IAgentFactory.d.ts +137 -0
- package/dist/core/agents/IAgentFactory.d.ts.map +1 -0
- package/dist/core/agents/IAgentFactory.js +13 -0
- package/dist/core/agents/IAgentFactory.js.map +1 -0
- package/dist/core/agents/tools/Tool.d.ts +17 -0
- package/dist/core/agents/tools/Tool.d.ts.map +1 -0
- package/dist/core/agents/tools/Tool.js +8 -0
- package/dist/core/agents/tools/Tool.js.map +1 -0
- package/dist/core/ai_utilities/HybridUtilityAI.d.ts +1 -0
- package/dist/core/ai_utilities/HybridUtilityAI.d.ts.map +1 -0
- package/dist/core/ai_utilities/HybridUtilityAI.js +2 -0
- package/dist/core/ai_utilities/HybridUtilityAI.js.map +1 -0
- package/dist/core/ai_utilities/IUtilityAI.d.ts +212 -0
- package/dist/core/ai_utilities/IUtilityAI.d.ts.map +1 -0
- package/dist/core/ai_utilities/IUtilityAI.js +11 -0
- package/dist/core/ai_utilities/IUtilityAI.js.map +1 -0
- package/dist/core/ai_utilities/LLMUtilityAI.d.ts +94 -0
- package/dist/core/ai_utilities/LLMUtilityAI.d.ts.map +1 -0
- package/dist/core/ai_utilities/LLMUtilityAI.js +434 -0
- package/dist/core/ai_utilities/LLMUtilityAI.js.map +1 -0
- package/dist/core/ai_utilities/StatisticalUtilityAI.d.ts +102 -0
- package/dist/core/ai_utilities/StatisticalUtilityAI.d.ts.map +1 -0
- package/dist/core/ai_utilities/StatisticalUtilityAI.js +617 -0
- package/dist/core/ai_utilities/StatisticalUtilityAI.js.map +1 -0
- package/dist/core/conversation/ConversationContext.d.ts +259 -0
- package/dist/core/conversation/ConversationContext.d.ts.map +1 -0
- package/dist/core/conversation/ConversationContext.js +450 -0
- package/dist/core/conversation/ConversationContext.js.map +1 -0
- package/dist/core/conversation/ConversationManager.d.ts +223 -0
- package/dist/core/conversation/ConversationManager.d.ts.map +1 -0
- package/dist/core/conversation/ConversationManager.js +558 -0
- package/dist/core/conversation/ConversationManager.js.map +1 -0
- package/dist/core/conversation/ConversationMessage.d.ts +184 -0
- package/dist/core/conversation/ConversationMessage.d.ts.map +1 -0
- package/dist/core/conversation/ConversationMessage.js +66 -0
- package/dist/core/conversation/ConversationMessage.js.map +1 -0
- package/dist/core/evaluation/Evaluator.d.ts +28 -0
- package/dist/core/evaluation/Evaluator.d.ts.map +1 -0
- package/dist/core/evaluation/Evaluator.js +490 -0
- package/dist/core/evaluation/Evaluator.js.map +1 -0
- package/dist/core/evaluation/IEvaluator.d.ts +309 -0
- package/dist/core/evaluation/IEvaluator.d.ts.map +1 -0
- package/dist/core/evaluation/IEvaluator.js +12 -0
- package/dist/core/evaluation/IEvaluator.js.map +1 -0
- package/dist/core/evaluation/LLMJudge.d.ts +105 -0
- package/dist/core/evaluation/LLMJudge.d.ts.map +1 -0
- package/dist/core/evaluation/LLMJudge.js +229 -0
- package/dist/core/evaluation/LLMJudge.js.map +1 -0
- package/dist/core/evaluation/index.d.ts +9 -0
- package/dist/core/evaluation/index.d.ts.map +1 -0
- package/dist/core/evaluation/index.js +9 -0
- package/dist/core/evaluation/index.js.map +1 -0
- package/dist/core/guardrails/IGuardrailService.d.ts +142 -0
- package/dist/core/guardrails/IGuardrailService.d.ts.map +1 -0
- package/dist/core/guardrails/IGuardrailService.js +24 -0
- package/dist/core/guardrails/IGuardrailService.js.map +1 -0
- package/dist/core/guardrails/guardrailDispatcher.d.ts +36 -0
- package/dist/core/guardrails/guardrailDispatcher.d.ts.map +1 -0
- package/dist/core/guardrails/guardrailDispatcher.js +240 -0
- package/dist/core/guardrails/guardrailDispatcher.js.map +1 -0
- package/dist/core/hitl/HumanInteractionManager.d.ts +146 -0
- package/dist/core/hitl/HumanInteractionManager.d.ts.map +1 -0
- package/dist/core/hitl/HumanInteractionManager.js +491 -0
- package/dist/core/hitl/HumanInteractionManager.js.map +1 -0
- package/dist/core/hitl/IHumanInteractionManager.d.ts +521 -0
- package/dist/core/hitl/IHumanInteractionManager.d.ts.map +1 -0
- package/dist/core/hitl/IHumanInteractionManager.js +33 -0
- package/dist/core/hitl/IHumanInteractionManager.js.map +1 -0
- package/dist/core/hitl/index.d.ts +17 -0
- package/dist/core/hitl/index.d.ts.map +1 -0
- package/dist/core/hitl/index.js +17 -0
- package/dist/core/hitl/index.js.map +1 -0
- package/dist/core/knowledge/IKnowledgeGraph.d.ts +351 -0
- package/dist/core/knowledge/IKnowledgeGraph.d.ts.map +1 -0
- package/dist/core/knowledge/IKnowledgeGraph.js +10 -0
- package/dist/core/knowledge/IKnowledgeGraph.js.map +1 -0
- package/dist/core/knowledge/KnowledgeGraph.d.ts +93 -0
- package/dist/core/knowledge/KnowledgeGraph.d.ts.map +1 -0
- package/dist/core/knowledge/KnowledgeGraph.js +601 -0
- package/dist/core/knowledge/KnowledgeGraph.js.map +1 -0
- package/dist/core/knowledge/index.d.ts +8 -0
- package/dist/core/knowledge/index.d.ts.map +1 -0
- package/dist/core/knowledge/index.js +8 -0
- package/dist/core/knowledge/index.js.map +1 -0
- package/dist/core/language/LanguageService.d.ts +77 -0
- package/dist/core/language/LanguageService.d.ts.map +1 -0
- package/dist/core/language/LanguageService.js +305 -0
- package/dist/core/language/LanguageService.js.map +1 -0
- package/dist/core/language/index.d.ts +6 -0
- package/dist/core/language/index.d.ts.map +1 -0
- package/dist/core/language/index.js +6 -0
- package/dist/core/language/index.js.map +1 -0
- package/dist/core/language/interfaces.d.ts +168 -0
- package/dist/core/language/interfaces.d.ts.map +1 -0
- package/dist/core/language/interfaces.js +37 -0
- package/dist/core/language/interfaces.js.map +1 -0
- package/dist/core/language/providers/DeepLTranslationProvider.d.ts +16 -0
- package/dist/core/language/providers/DeepLTranslationProvider.d.ts.map +1 -0
- package/dist/core/language/providers/DeepLTranslationProvider.js +28 -0
- package/dist/core/language/providers/DeepLTranslationProvider.js.map +1 -0
- package/dist/core/language/providers/OpenAITranslationProvider.d.ts +17 -0
- package/dist/core/language/providers/OpenAITranslationProvider.d.ts.map +1 -0
- package/dist/core/language/providers/OpenAITranslationProvider.js +34 -0
- package/dist/core/language/providers/OpenAITranslationProvider.js.map +1 -0
- package/dist/core/language/providers/WhisperDetectionProvider.d.ts +16 -0
- package/dist/core/language/providers/WhisperDetectionProvider.d.ts.map +1 -0
- package/dist/core/language/providers/WhisperDetectionProvider.js +15 -0
- package/dist/core/language/providers/WhisperDetectionProvider.js.map +1 -0
- package/dist/core/llm/IPromptEngine.d.ts +627 -0
- package/dist/core/llm/IPromptEngine.d.ts.map +1 -0
- package/dist/core/llm/IPromptEngine.js +81 -0
- package/dist/core/llm/IPromptEngine.js.map +1 -0
- package/dist/core/llm/PromptEngine.d.ts +108 -0
- package/dist/core/llm/PromptEngine.d.ts.map +1 -0
- package/dist/core/llm/PromptEngine.js +872 -0
- package/dist/core/llm/PromptEngine.js.map +1 -0
- package/dist/core/llm/providers/AIModelProviderManager.d.ts +74 -0
- package/dist/core/llm/providers/AIModelProviderManager.d.ts.map +1 -0
- package/dist/core/llm/providers/AIModelProviderManager.js +263 -0
- package/dist/core/llm/providers/AIModelProviderManager.js.map +1 -0
- package/dist/core/llm/providers/IProvider.d.ts +327 -0
- package/dist/core/llm/providers/IProvider.d.ts.map +1 -0
- package/dist/core/llm/providers/IProvider.js +39 -0
- package/dist/core/llm/providers/IProvider.js.map +1 -0
- package/dist/core/llm/providers/errors/OllamaProviderError.d.ts +36 -0
- package/dist/core/llm/providers/errors/OllamaProviderError.d.ts.map +1 -0
- package/dist/core/llm/providers/errors/OllamaProviderError.js +40 -0
- package/dist/core/llm/providers/errors/OllamaProviderError.js.map +1 -0
- package/dist/core/llm/providers/errors/OpenAIProviderError.d.ts +42 -0
- package/dist/core/llm/providers/errors/OpenAIProviderError.d.ts.map +1 -0
- package/dist/core/llm/providers/errors/OpenAIProviderError.js +44 -0
- package/dist/core/llm/providers/errors/OpenAIProviderError.js.map +1 -0
- package/dist/core/llm/providers/errors/OpenRouterProviderError.d.ts +39 -0
- package/dist/core/llm/providers/errors/OpenRouterProviderError.d.ts.map +1 -0
- package/dist/core/llm/providers/errors/OpenRouterProviderError.js +42 -0
- package/dist/core/llm/providers/errors/OpenRouterProviderError.js.map +1 -0
- package/dist/core/llm/providers/errors/ProviderError.d.ts +37 -0
- package/dist/core/llm/providers/errors/ProviderError.d.ts.map +1 -0
- package/dist/core/llm/providers/errors/ProviderError.js +36 -0
- package/dist/core/llm/providers/errors/ProviderError.js.map +1 -0
- package/dist/core/llm/providers/implementations/OllamaProvider.d.ts +80 -0
- package/dist/core/llm/providers/implementations/OllamaProvider.d.ts.map +1 -0
- package/dist/core/llm/providers/implementations/OllamaProvider.js +473 -0
- package/dist/core/llm/providers/implementations/OllamaProvider.js.map +1 -0
- package/dist/core/llm/providers/implementations/OpenAIProvider.d.ts +160 -0
- package/dist/core/llm/providers/implementations/OpenAIProvider.d.ts.map +1 -0
- package/dist/core/llm/providers/implementations/OpenAIProvider.js +672 -0
- package/dist/core/llm/providers/implementations/OpenAIProvider.js.map +1 -0
- package/dist/core/llm/providers/implementations/OpenRouterProvider.d.ts +51 -0
- package/dist/core/llm/providers/implementations/OpenRouterProvider.d.ts.map +1 -0
- package/dist/core/llm/providers/implementations/OpenRouterProvider.js +499 -0
- package/dist/core/llm/providers/implementations/OpenRouterProvider.js.map +1 -0
- package/dist/core/llm/routing/IModelRouter.d.ts +129 -0
- package/dist/core/llm/routing/IModelRouter.d.ts.map +1 -0
- package/dist/core/llm/routing/IModelRouter.js +14 -0
- package/dist/core/llm/routing/IModelRouter.js.map +1 -0
- package/dist/core/llm/routing/ModelRouter.d.ts +157 -0
- package/dist/core/llm/routing/ModelRouter.d.ts.map +1 -0
- package/dist/core/llm/routing/ModelRouter.js +190 -0
- package/dist/core/llm/routing/ModelRouter.js.map +1 -0
- package/dist/core/llm/streaming/StreamingBatcher.d.ts +54 -0
- package/dist/core/llm/streaming/StreamingBatcher.d.ts.map +1 -0
- package/dist/core/llm/streaming/StreamingBatcher.js +173 -0
- package/dist/core/llm/streaming/StreamingBatcher.js.map +1 -0
- package/dist/core/llm/streaming/StreamingReconstructor.d.ts +69 -0
- package/dist/core/llm/streaming/StreamingReconstructor.d.ts.map +1 -0
- package/dist/core/llm/streaming/StreamingReconstructor.js +102 -0
- package/dist/core/llm/streaming/StreamingReconstructor.js.map +1 -0
- package/dist/core/marketplace/IMarketplace.d.ts +500 -0
- package/dist/core/marketplace/IMarketplace.d.ts.map +1 -0
- package/dist/core/marketplace/IMarketplace.js +10 -0
- package/dist/core/marketplace/IMarketplace.js.map +1 -0
- package/dist/core/marketplace/Marketplace.d.ts +122 -0
- package/dist/core/marketplace/Marketplace.d.ts.map +1 -0
- package/dist/core/marketplace/Marketplace.js +591 -0
- package/dist/core/marketplace/Marketplace.js.map +1 -0
- package/dist/core/marketplace/index.d.ts +8 -0
- package/dist/core/marketplace/index.d.ts.map +1 -0
- package/dist/core/marketplace/index.js +8 -0
- package/dist/core/marketplace/index.js.map +1 -0
- package/dist/core/observability/ITracer.d.ts +317 -0
- package/dist/core/observability/ITracer.d.ts.map +1 -0
- package/dist/core/observability/ITracer.js +55 -0
- package/dist/core/observability/ITracer.js.map +1 -0
- package/dist/core/observability/Tracer.d.ts +76 -0
- package/dist/core/observability/Tracer.d.ts.map +1 -0
- package/dist/core/observability/Tracer.js +360 -0
- package/dist/core/observability/Tracer.js.map +1 -0
- package/dist/core/observability/index.d.ts +9 -0
- package/dist/core/observability/index.d.ts.map +1 -0
- package/dist/core/observability/index.js +8 -0
- package/dist/core/observability/index.js.map +1 -0
- package/dist/core/orchestration/AgentOrchestrator.d.ts +243 -0
- package/dist/core/orchestration/AgentOrchestrator.d.ts.map +1 -0
- package/dist/core/orchestration/AgentOrchestrator.js +648 -0
- package/dist/core/orchestration/AgentOrchestrator.js.map +1 -0
- package/dist/core/orchestration/IAgentOrchestrator.d.ts +44 -0
- package/dist/core/orchestration/IAgentOrchestrator.d.ts.map +1 -0
- package/dist/core/orchestration/IAgentOrchestrator.js +4 -0
- package/dist/core/orchestration/IAgentOrchestrator.js.map +1 -0
- package/dist/core/orchestration/helpers.d.ts +12 -0
- package/dist/core/orchestration/helpers.d.ts.map +1 -0
- package/dist/core/orchestration/helpers.js +36 -0
- package/dist/core/orchestration/helpers.js.map +1 -0
- package/dist/core/planning/IPlanningEngine.d.ts +524 -0
- package/dist/core/planning/IPlanningEngine.d.ts.map +1 -0
- package/dist/core/planning/IPlanningEngine.js +32 -0
- package/dist/core/planning/IPlanningEngine.js.map +1 -0
- package/dist/core/planning/PlanningEngine.d.ts +161 -0
- package/dist/core/planning/PlanningEngine.d.ts.map +1 -0
- package/dist/core/planning/PlanningEngine.js +783 -0
- package/dist/core/planning/PlanningEngine.js.map +1 -0
- package/dist/core/planning/index.d.ts +25 -0
- package/dist/core/planning/index.d.ts.map +1 -0
- package/dist/core/planning/index.js +25 -0
- package/dist/core/planning/index.js.map +1 -0
- package/dist/core/sandbox/CodeSandbox.d.ts +86 -0
- package/dist/core/sandbox/CodeSandbox.d.ts.map +1 -0
- package/dist/core/sandbox/CodeSandbox.js +475 -0
- package/dist/core/sandbox/CodeSandbox.js.map +1 -0
- package/dist/core/sandbox/ICodeSandbox.d.ts +249 -0
- package/dist/core/sandbox/ICodeSandbox.d.ts.map +1 -0
- package/dist/core/sandbox/ICodeSandbox.js +24 -0
- package/dist/core/sandbox/ICodeSandbox.js.map +1 -0
- package/dist/core/sandbox/index.d.ts +9 -0
- package/dist/core/sandbox/index.d.ts.map +1 -0
- package/dist/core/sandbox/index.js +8 -0
- package/dist/core/sandbox/index.js.map +1 -0
- package/dist/core/storage/IStorageAdapter.d.ts +483 -0
- package/dist/core/storage/IStorageAdapter.d.ts.map +1 -0
- package/dist/core/storage/IStorageAdapter.js +19 -0
- package/dist/core/storage/IStorageAdapter.js.map +1 -0
- package/dist/core/storage/InMemoryStorageAdapter.d.ts +192 -0
- package/dist/core/storage/InMemoryStorageAdapter.d.ts.map +1 -0
- package/dist/core/storage/InMemoryStorageAdapter.js +343 -0
- package/dist/core/storage/InMemoryStorageAdapter.js.map +1 -0
- package/dist/core/storage/SqlStorageAdapter.d.ts +262 -0
- package/dist/core/storage/SqlStorageAdapter.d.ts.map +1 -0
- package/dist/core/storage/SqlStorageAdapter.js +485 -0
- package/dist/core/storage/SqlStorageAdapter.js.map +1 -0
- package/dist/core/storage/index.d.ts +14 -0
- package/dist/core/storage/index.d.ts.map +1 -0
- package/dist/core/storage/index.js +14 -0
- package/dist/core/storage/index.js.map +1 -0
- package/dist/core/streaming/IStreamClient.d.ts +72 -0
- package/dist/core/streaming/IStreamClient.d.ts.map +1 -0
- package/dist/core/streaming/IStreamClient.js +12 -0
- package/dist/core/streaming/IStreamClient.js.map +1 -0
- package/dist/core/streaming/StreamingManager.d.ts +242 -0
- package/dist/core/streaming/StreamingManager.d.ts.map +1 -0
- package/dist/core/streaming/StreamingManager.js +282 -0
- package/dist/core/streaming/StreamingManager.js.map +1 -0
- package/dist/core/structured/IStructuredOutputManager.d.ts +701 -0
- package/dist/core/structured/IStructuredOutputManager.d.ts.map +1 -0
- package/dist/core/structured/IStructuredOutputManager.js +74 -0
- package/dist/core/structured/IStructuredOutputManager.js.map +1 -0
- package/dist/core/structured/StructuredOutputManager.d.ts +140 -0
- package/dist/core/structured/StructuredOutputManager.d.ts.map +1 -0
- package/dist/core/structured/StructuredOutputManager.js +1015 -0
- package/dist/core/structured/StructuredOutputManager.js.map +1 -0
- package/dist/core/structured/index.d.ts +34 -0
- package/dist/core/structured/index.d.ts.map +1 -0
- package/dist/core/structured/index.js +34 -0
- package/dist/core/structured/index.js.map +1 -0
- package/dist/core/tools/ITool.d.ts +228 -0
- package/dist/core/tools/ITool.d.ts.map +1 -0
- package/dist/core/tools/ITool.js +11 -0
- package/dist/core/tools/ITool.js.map +1 -0
- package/dist/core/tools/IToolOrchestrator.d.ts +131 -0
- package/dist/core/tools/IToolOrchestrator.d.ts.map +1 -0
- package/dist/core/tools/IToolOrchestrator.js +14 -0
- package/dist/core/tools/IToolOrchestrator.js.map +1 -0
- package/dist/core/tools/ToolExecutor.d.ts +143 -0
- package/dist/core/tools/ToolExecutor.d.ts.map +1 -0
- package/dist/core/tools/ToolExecutor.js +364 -0
- package/dist/core/tools/ToolExecutor.js.map +1 -0
- package/dist/core/tools/ToolOrchestrator.d.ts +142 -0
- package/dist/core/tools/ToolOrchestrator.d.ts.map +1 -0
- package/dist/core/tools/ToolOrchestrator.js +373 -0
- package/dist/core/tools/ToolOrchestrator.js.map +1 -0
- package/dist/core/tools/permissions/IToolPermissionManager.d.ts +195 -0
- package/dist/core/tools/permissions/IToolPermissionManager.d.ts.map +1 -0
- package/dist/core/tools/permissions/IToolPermissionManager.js +14 -0
- package/dist/core/tools/permissions/IToolPermissionManager.js.map +1 -0
- package/dist/core/tools/permissions/ToolPermissionManager.d.ts +203 -0
- package/dist/core/tools/permissions/ToolPermissionManager.d.ts.map +1 -0
- package/dist/core/tools/permissions/ToolPermissionManager.js +298 -0
- package/dist/core/tools/permissions/ToolPermissionManager.js.map +1 -0
- package/dist/core/ui/IUIComponent.d.ts +11 -0
- package/dist/core/ui/IUIComponent.d.ts.map +1 -0
- package/dist/core/ui/IUIComponent.js +2 -0
- package/dist/core/ui/IUIComponent.js.map +1 -0
- package/dist/core/usage/UsageLedger.d.ts +81 -0
- package/dist/core/usage/UsageLedger.d.ts.map +1 -0
- package/dist/core/usage/UsageLedger.js +135 -0
- package/dist/core/usage/UsageLedger.js.map +1 -0
- package/dist/core/workflows/IWorkflowEngine.d.ts +42 -0
- package/dist/core/workflows/IWorkflowEngine.d.ts.map +1 -0
- package/dist/core/workflows/IWorkflowEngine.js +2 -0
- package/dist/core/workflows/IWorkflowEngine.js.map +1 -0
- package/dist/core/workflows/WorkflowEngine.d.ts +28 -0
- package/dist/core/workflows/WorkflowEngine.d.ts.map +1 -0
- package/dist/core/workflows/WorkflowEngine.js +309 -0
- package/dist/core/workflows/WorkflowEngine.js.map +1 -0
- package/dist/core/workflows/WorkflowTypes.d.ts +180 -0
- package/dist/core/workflows/WorkflowTypes.d.ts.map +1 -0
- package/dist/core/workflows/WorkflowTypes.js +26 -0
- package/dist/core/workflows/WorkflowTypes.js.map +1 -0
- package/dist/core/workflows/runtime/WorkflowRuntime.d.ts +70 -0
- package/dist/core/workflows/runtime/WorkflowRuntime.d.ts.map +1 -0
- package/dist/core/workflows/runtime/WorkflowRuntime.js +566 -0
- package/dist/core/workflows/runtime/WorkflowRuntime.js.map +1 -0
- package/dist/core/workflows/storage/IWorkflowStore.d.ts +75 -0
- package/dist/core/workflows/storage/IWorkflowStore.d.ts.map +1 -0
- package/dist/core/workflows/storage/IWorkflowStore.js +2 -0
- package/dist/core/workflows/storage/IWorkflowStore.js.map +1 -0
- package/dist/core/workflows/storage/InMemoryWorkflowStore.d.ts +14 -0
- package/dist/core/workflows/storage/InMemoryWorkflowStore.d.ts.map +1 -0
- package/dist/core/workflows/storage/InMemoryWorkflowStore.js +130 -0
- package/dist/core/workflows/storage/InMemoryWorkflowStore.js.map +1 -0
- package/dist/extensions/ExtensionLoader.d.ts +119 -0
- package/dist/extensions/ExtensionLoader.d.ts.map +1 -0
- package/dist/extensions/ExtensionLoader.js +297 -0
- package/dist/extensions/ExtensionLoader.js.map +1 -0
- package/dist/extensions/ExtensionManager.d.ts +49 -0
- package/dist/extensions/ExtensionManager.d.ts.map +1 -0
- package/dist/extensions/ExtensionManager.js +197 -0
- package/dist/extensions/ExtensionManager.js.map +1 -0
- package/dist/extensions/ExtensionRegistry.d.ts +39 -0
- package/dist/extensions/ExtensionRegistry.d.ts.map +1 -0
- package/dist/extensions/ExtensionRegistry.js +103 -0
- package/dist/extensions/ExtensionRegistry.js.map +1 -0
- package/dist/extensions/MultiRegistryLoader.d.ts +61 -0
- package/dist/extensions/MultiRegistryLoader.d.ts.map +1 -0
- package/dist/extensions/MultiRegistryLoader.js +169 -0
- package/dist/extensions/MultiRegistryLoader.js.map +1 -0
- package/dist/extensions/RegistryConfig.d.ts +86 -0
- package/dist/extensions/RegistryConfig.d.ts.map +1 -0
- package/dist/extensions/RegistryConfig.js +99 -0
- package/dist/extensions/RegistryConfig.js.map +1 -0
- package/dist/extensions/events.d.ts +19 -0
- package/dist/extensions/events.d.ts.map +1 -0
- package/dist/extensions/events.js +2 -0
- package/dist/extensions/events.js.map +1 -0
- package/dist/extensions/index.d.ts +9 -0
- package/dist/extensions/index.d.ts.map +1 -0
- package/dist/extensions/index.js +9 -0
- package/dist/extensions/index.js.map +1 -0
- package/dist/extensions/manifest.d.ts +52 -0
- package/dist/extensions/manifest.d.ts.map +1 -0
- package/dist/extensions/manifest.js +2 -0
- package/dist/extensions/manifest.js.map +1 -0
- package/dist/extensions/types.d.ts +294 -0
- package/dist/extensions/types.d.ts.map +1 -0
- package/dist/extensions/types.js +12 -0
- package/dist/extensions/types.js.map +1 -0
- package/dist/index.d.ts +49 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +59 -0
- package/dist/index.js.map +1 -0
- package/dist/logging/ILogger.d.ts +8 -0
- package/dist/logging/ILogger.d.ts.map +1 -0
- package/dist/logging/ILogger.js +2 -0
- package/dist/logging/ILogger.js.map +1 -0
- package/dist/logging/PinoLogger.d.ts +12 -0
- package/dist/logging/PinoLogger.d.ts.map +1 -0
- package/dist/logging/PinoLogger.js +22 -0
- package/dist/logging/PinoLogger.js.map +1 -0
- package/dist/logging/loggerFactory.d.ts +6 -0
- package/dist/logging/loggerFactory.d.ts.map +1 -0
- package/dist/logging/loggerFactory.js +14 -0
- package/dist/logging/loggerFactory.js.map +1 -0
- package/dist/rag/EmbeddingManager.d.ts +81 -0
- package/dist/rag/EmbeddingManager.d.ts.map +1 -0
- package/dist/rag/EmbeddingManager.js +412 -0
- package/dist/rag/EmbeddingManager.js.map +1 -0
- package/dist/rag/IEmbeddingManager.d.ts +277 -0
- package/dist/rag/IEmbeddingManager.d.ts.map +1 -0
- package/dist/rag/IEmbeddingManager.js +19 -0
- package/dist/rag/IEmbeddingManager.js.map +1 -0
- package/dist/rag/IRetrievalAugmentor.d.ts +208 -0
- package/dist/rag/IRetrievalAugmentor.d.ts.map +1 -0
- package/dist/rag/IRetrievalAugmentor.js +21 -0
- package/dist/rag/IRetrievalAugmentor.js.map +1 -0
- package/dist/rag/IVectorStore.d.ts +351 -0
- package/dist/rag/IVectorStore.d.ts.map +1 -0
- package/dist/rag/IVectorStore.js +15 -0
- package/dist/rag/IVectorStore.js.map +1 -0
- package/dist/rag/IVectorStoreManager.d.ts +121 -0
- package/dist/rag/IVectorStoreManager.d.ts.map +1 -0
- package/dist/rag/IVectorStoreManager.js +13 -0
- package/dist/rag/IVectorStoreManager.js.map +1 -0
- package/dist/rag/RetrievalAugmentor.d.ts +99 -0
- package/dist/rag/RetrievalAugmentor.d.ts.map +1 -0
- package/dist/rag/RetrievalAugmentor.js +674 -0
- package/dist/rag/RetrievalAugmentor.js.map +1 -0
- package/dist/rag/VectorStoreManager.d.ts +90 -0
- package/dist/rag/VectorStoreManager.d.ts.map +1 -0
- package/dist/rag/VectorStoreManager.js +283 -0
- package/dist/rag/VectorStoreManager.js.map +1 -0
- package/dist/rag/implementations/index.d.ts +9 -0
- package/dist/rag/implementations/index.d.ts.map +1 -0
- package/dist/rag/implementations/index.js +9 -0
- package/dist/rag/implementations/index.js.map +1 -0
- package/dist/rag/implementations/vector_stores/InMemoryVectorStore.d.ts +132 -0
- package/dist/rag/implementations/vector_stores/InMemoryVectorStore.d.ts.map +1 -0
- package/dist/rag/implementations/vector_stores/InMemoryVectorStore.js +539 -0
- package/dist/rag/implementations/vector_stores/InMemoryVectorStore.js.map +1 -0
- package/dist/rag/implementations/vector_stores/SqlVectorStore.d.ts +265 -0
- package/dist/rag/implementations/vector_stores/SqlVectorStore.d.ts.map +1 -0
- package/dist/rag/implementations/vector_stores/SqlVectorStore.js +755 -0
- package/dist/rag/implementations/vector_stores/SqlVectorStore.js.map +1 -0
- package/dist/rag/implementations/vector_stores/index.d.ts +10 -0
- package/dist/rag/implementations/vector_stores/index.d.ts.map +1 -0
- package/dist/rag/implementations/vector_stores/index.js +12 -0
- package/dist/rag/implementations/vector_stores/index.js.map +1 -0
- package/dist/rag/index.d.ts +95 -0
- package/dist/rag/index.d.ts.map +1 -0
- package/dist/rag/index.js +97 -0
- package/dist/rag/index.js.map +1 -0
- package/dist/services/user_auth/AuthService.d.ts +13 -0
- package/dist/services/user_auth/AuthService.d.ts.map +1 -0
- package/dist/services/user_auth/AuthService.js +24 -0
- package/dist/services/user_auth/AuthService.js.map +1 -0
- package/dist/services/user_auth/SubscriptionService.d.ts +14 -0
- package/dist/services/user_auth/SubscriptionService.d.ts.map +1 -0
- package/dist/services/user_auth/SubscriptionService.js +34 -0
- package/dist/services/user_auth/SubscriptionService.js.map +1 -0
- package/dist/services/user_auth/types.d.ts +30 -0
- package/dist/services/user_auth/types.d.ts.map +1 -0
- package/dist/services/user_auth/types.js +2 -0
- package/dist/services/user_auth/types.js.map +1 -0
- package/dist/stubs/prismaClient.d.ts +35 -0
- package/dist/stubs/prismaClient.d.ts.map +1 -0
- package/dist/stubs/prismaClient.js +47 -0
- package/dist/stubs/prismaClient.js.map +1 -0
- package/dist/types/rateLimitTypes.d.ts +70 -0
- package/dist/types/rateLimitTypes.d.ts.map +1 -0
- package/dist/types/rateLimitTypes.js +55 -0
- package/dist/types/rateLimitTypes.js.map +1 -0
- package/dist/utils/errors.d.ts +80 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +201 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/uuid.d.ts +11 -0
- package/dist/utils/uuid.d.ts.map +1 -0
- package/dist/utils/uuid.js +64 -0
- package/dist/utils/uuid.js.map +1 -0
- package/package.json +84 -0
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Implements the ToolExecutor class, responsible for the direct
|
|
3
|
+
* execution of tools conforming to the ITool interface. It handles critical
|
|
4
|
+
* aspects like input argument validation against JSON schemas and invoking
|
|
5
|
+
* the tool's core logic.
|
|
6
|
+
*
|
|
7
|
+
* @module backend/agentos/core/tools/ToolExecutor
|
|
8
|
+
* @see ./ITool.ts for ITool, ToolExecutionResult, ToolExecutionContext.
|
|
9
|
+
* @see ../cognitive_substrate/IGMI.ts for ToolCallRequest, UserContext.
|
|
10
|
+
* @see @framers/agentos/utils/errors.ts for GMIError, GMIErrorCode, createGMIErrorFromError.
|
|
11
|
+
*/
|
|
12
|
+
import { ITool, ToolExecutionResult } from './ITool';
|
|
13
|
+
import { ToolCallRequest, UserContext } from '../../cognitive_substrate/IGMI';
|
|
14
|
+
import type { IAuthService, ISubscriptionService } from '../../services/user_auth/types';
|
|
15
|
+
import { ExtensionRegistry } from '../../extensions';
|
|
16
|
+
/**
|
|
17
|
+
* @interface ToolExecutionRequestDetails
|
|
18
|
+
* @description Encapsulates all necessary information for the `ToolExecutor` to execute a tool.
|
|
19
|
+
* This includes the specific tool call request (typically originating from an LLM),
|
|
20
|
+
* and crucial contextual information about the invoking GMI, Persona, and User.
|
|
21
|
+
*
|
|
22
|
+
* @property {ToolCallRequest} toolCallRequest - The raw tool call request containing the target tool's
|
|
23
|
+
* function name and its arguments (usually as a JSON string or pre-parsed object).
|
|
24
|
+
* @property {string} gmiId - The ID of the GMI (Generalized Mind Instance) initiating the tool call.
|
|
25
|
+
* @property {string} personaId - The ID of the active Persona within the GMI.
|
|
26
|
+
* @property {string[]} personaCapabilities - Capabilities of the active Persona, used for preliminary checks.
|
|
27
|
+
* @property {UserContext} userContext - Contextual information about the end-user.
|
|
28
|
+
* @property {string} [correlationId] - Optional ID for tracing this specific execution across logs and systems.
|
|
29
|
+
*/
|
|
30
|
+
export interface ToolExecutionRequestDetails {
|
|
31
|
+
toolCallRequest: ToolCallRequest;
|
|
32
|
+
gmiId: string;
|
|
33
|
+
personaId: string;
|
|
34
|
+
personaCapabilities: string[];
|
|
35
|
+
userContext: UserContext;
|
|
36
|
+
correlationId?: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* @class ToolExecutor
|
|
40
|
+
* @description Manages a registry of `ITool` instances and robustly handles their execution.
|
|
41
|
+
* Key responsibilities include validating input arguments against each tool's defined JSON schema
|
|
42
|
+
* using Ajv, and then invoking the tool's `execute` method with the appropriate `ToolExecutionContext`.
|
|
43
|
+
* It ensures that tools are called correctly and their outputs (or errors) are processed consistently.
|
|
44
|
+
*/
|
|
45
|
+
export declare class ToolExecutor {
|
|
46
|
+
private readonly toolRegistry;
|
|
47
|
+
private readonly directRegistrations;
|
|
48
|
+
private readonly authService?;
|
|
49
|
+
private readonly subscriptionService?;
|
|
50
|
+
/**
|
|
51
|
+
* Instance of Ajv for JSON schema validation.
|
|
52
|
+
* Note: The TS2709 error "Cannot use namespace 'Ajv' as a type" might indicate
|
|
53
|
+
* an issue with TypeScript configuration (e.g., esModuleInterop) or Ajv's type
|
|
54
|
+
* definitions version mismatch if it persists. The `import Ajv from 'ajv';`
|
|
55
|
+
* and `ajv: Ajv` usage with `new Ajv()` is standard for Ajv v8+.
|
|
56
|
+
* @private
|
|
57
|
+
* @type {InstanceType<typeof Ajv>}
|
|
58
|
+
*/
|
|
59
|
+
private readonly ajv;
|
|
60
|
+
/**
|
|
61
|
+
* Creates an instance of ToolExecutor.
|
|
62
|
+
* Initializes an empty tool registry and configures an Ajv instance for JSON schema validation.
|
|
63
|
+
* Default tools can be registered via `registerDefaultTools` or explicitly.
|
|
64
|
+
*
|
|
65
|
+
* @constructor
|
|
66
|
+
* @param {IAuthService} [authService] - Optional. An instance of an authentication service.
|
|
67
|
+
* Used for potential future integration with more complex user-specific permission checks directly within the executor,
|
|
68
|
+
* though primary permission logic resides in `ToolPermissionManager`.
|
|
69
|
+
* @param {ISubscriptionService} [subscriptionService] - Optional. An instance of a subscription service.
|
|
70
|
+
* Similarly used for potential future feature-based tool access control at the executor level.
|
|
71
|
+
*/
|
|
72
|
+
constructor(authService?: IAuthService, subscriptionService?: ISubscriptionService, toolRegistry?: ExtensionRegistry<ITool>);
|
|
73
|
+
/**
|
|
74
|
+
* Registers a tool with the executor, making it available for subsequent execution.
|
|
75
|
+
* Tools are indexed by their functional `name` property, which must be unique within the registry.
|
|
76
|
+
*
|
|
77
|
+
* @public
|
|
78
|
+
* @param {ITool} tool - The tool instance to register. It must conform to the `ITool` interface.
|
|
79
|
+
* @returns {void}
|
|
80
|
+
* @throws {GMIError} If the tool is invalid (e.g., missing `id` or `name` - `GMIErrorCode.INVALID_ARGUMENT`),
|
|
81
|
+
* or if a tool with the same functional `name` is already registered (`GMIErrorCode.ALREADY_EXISTS`).
|
|
82
|
+
*/
|
|
83
|
+
registerTool(tool: ITool): Promise<void>;
|
|
84
|
+
/**
|
|
85
|
+
* Retrieves a registered tool instance by its functional name.
|
|
86
|
+
*
|
|
87
|
+
* @public
|
|
88
|
+
* @param {string} toolName - The `name` of the tool (as specified in `ITool.name` and used in `ToolCallRequest.name`).
|
|
89
|
+
* @returns {ITool | undefined} The `ITool` instance if found in the registry; otherwise, `undefined`.
|
|
90
|
+
*/
|
|
91
|
+
getTool(toolName: string): ITool | undefined;
|
|
92
|
+
/**
|
|
93
|
+
* Unregisters a tool from the executor using its functional name.
|
|
94
|
+
* If the tool has a `shutdown` method, it is called prior to removal from the registry.
|
|
95
|
+
*
|
|
96
|
+
* @public
|
|
97
|
+
* @async
|
|
98
|
+
* @param {string} toolName - The `name` of the tool to unregister.
|
|
99
|
+
* @returns {Promise<boolean>} A promise resolving to `true` if the tool was found and successfully unregistered (including its shutdown, if applicable), `false` otherwise.
|
|
100
|
+
*/
|
|
101
|
+
unregisterTool(toolName: string): Promise<boolean>;
|
|
102
|
+
/**
|
|
103
|
+
* Returns an array of definitions for all currently registered tools.
|
|
104
|
+
* This list typically includes essential information like the tool's name, description,
|
|
105
|
+
* input/output schemas, category, and required capabilities, making it suitable for
|
|
106
|
+
* LLM consumption for function calling or for UI display.
|
|
107
|
+
*
|
|
108
|
+
* @public
|
|
109
|
+
* @returns {Array<Pick<ITool, 'name' | 'description' | 'inputSchema' | 'outputSchema' | 'displayName' | 'category' | 'requiredCapabilities'>>}
|
|
110
|
+
* An array of partial tool information objects.
|
|
111
|
+
*/
|
|
112
|
+
listAvailableTools(): Array<Pick<ITool, 'name' | 'description' | 'inputSchema' | 'outputSchema' | 'displayName' | 'category' | 'requiredCapabilities'>>;
|
|
113
|
+
/**
|
|
114
|
+
* Executes a specified tool based on the details provided in a `ToolExecutionRequestDetails` object.
|
|
115
|
+
* This is the core method of the executor, orchestrating validation, context preparation,
|
|
116
|
+
* actual tool invocation, and result packaging.
|
|
117
|
+
*
|
|
118
|
+
* @public
|
|
119
|
+
* @async
|
|
120
|
+
* @param {ToolExecutionRequestDetails} requestDetails - An object containing all necessary details for the tool execution,
|
|
121
|
+
* including the `ToolCallRequest` from the LLM and contextual GMI/user information.
|
|
122
|
+
* @returns {Promise<ToolExecutionResult>} A promise that resolves with the `ToolExecutionResult` object.
|
|
123
|
+
* This result indicates the success or failure of the execution and provides the tool's output or error details.
|
|
124
|
+
*/
|
|
125
|
+
executeTool(requestDetails: ToolExecutionRequestDetails): Promise<ToolExecutionResult>;
|
|
126
|
+
/** @private
|
|
127
|
+
* Registers example tools. In a production system, tools would be loaded dynamically or via configuration.
|
|
128
|
+
*/
|
|
129
|
+
private createDescriptorFromTool;
|
|
130
|
+
private registerDefaultTools;
|
|
131
|
+
/**
|
|
132
|
+
* Gracefully shuts down all registered tools that implement the optional `shutdown` method.
|
|
133
|
+
* This is typically called when the ToolExecutor itself is being shut down as part of a larger
|
|
134
|
+
* application termination sequence.
|
|
135
|
+
*
|
|
136
|
+
* @public
|
|
137
|
+
* @async
|
|
138
|
+
* @returns {Promise<void[]>} A promise that resolves when all tool shutdown attempts are complete.
|
|
139
|
+
* Individual tool shutdown errors are logged but do not prevent other tools from attempting shutdown.
|
|
140
|
+
*/
|
|
141
|
+
shutdownAllTools(): Promise<void[]>;
|
|
142
|
+
}
|
|
143
|
+
//# sourceMappingURL=ToolExecutor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToolExecutor.d.ts","sourceRoot":"","sources":["../../../src/core/tools/ToolExecutor.ts"],"names":[],"mappings":"AACA;;;;;;;;;;GAUG;AAMH,OAAO,EAAE,KAAK,EAAoB,mBAAmB,EAAwB,MAAM,SAAS,CAAC;AAC7F,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC9E,OAAO,KAAK,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAEzF,OAAO,EAAE,iBAAiB,EAAuC,MAAM,kBAAkB,CAAC;AAW1F;;;;;;;;;;;;;GAaG;AACH,MAA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AAC,oBAAoB;IAqD5B;;;;;;;;;MASE;IACW,gBAAgB,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;CAOjD"}
|
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
// File: backend/agentos/core/tools/ToolExecutor.ts
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview Implements the ToolExecutor class, responsible for the direct
|
|
4
|
+
* execution of tools conforming to the ITool interface. It handles critical
|
|
5
|
+
* aspects like input argument validation against JSON schemas and invoking
|
|
6
|
+
* the tool's core logic.
|
|
7
|
+
*
|
|
8
|
+
* @module backend/agentos/core/tools/ToolExecutor
|
|
9
|
+
* @see ./ITool.ts for ITool, ToolExecutionResult, ToolExecutionContext.
|
|
10
|
+
* @see ../cognitive_substrate/IGMI.ts for ToolCallRequest, UserContext.
|
|
11
|
+
* @see @framers/agentos/utils/errors.ts for GMIError, GMIErrorCode, createGMIErrorFromError.
|
|
12
|
+
*/
|
|
13
|
+
import Ajv from 'ajv';
|
|
14
|
+
import addFormats from 'ajv-formats';
|
|
15
|
+
import { uuidv4 } from '../../utils/uuid.js';
|
|
16
|
+
import { GMIError, GMIErrorCode, createGMIErrorFromError } from '../../utils/errors.js';
|
|
17
|
+
import { ExtensionRegistry, EXTENSION_KIND_TOOL } from '../../extensions/index.js';
|
|
18
|
+
/**
|
|
19
|
+
* @class ToolExecutor
|
|
20
|
+
* @description Manages a registry of `ITool` instances and robustly handles their execution.
|
|
21
|
+
* Key responsibilities include validating input arguments against each tool's defined JSON schema
|
|
22
|
+
* using Ajv, and then invoking the tool's `execute` method with the appropriate `ToolExecutionContext`.
|
|
23
|
+
* It ensures that tools are called correctly and their outputs (or errors) are processed consistently.
|
|
24
|
+
*/
|
|
25
|
+
export class ToolExecutor {
|
|
26
|
+
/**
|
|
27
|
+
* Creates an instance of ToolExecutor.
|
|
28
|
+
* Initializes an empty tool registry and configures an Ajv instance for JSON schema validation.
|
|
29
|
+
* Default tools can be registered via `registerDefaultTools` or explicitly.
|
|
30
|
+
*
|
|
31
|
+
* @constructor
|
|
32
|
+
* @param {IAuthService} [authService] - Optional. An instance of an authentication service.
|
|
33
|
+
* Used for potential future integration with more complex user-specific permission checks directly within the executor,
|
|
34
|
+
* though primary permission logic resides in `ToolPermissionManager`.
|
|
35
|
+
* @param {ISubscriptionService} [subscriptionService] - Optional. An instance of a subscription service.
|
|
36
|
+
* Similarly used for potential future feature-based tool access control at the executor level.
|
|
37
|
+
*/
|
|
38
|
+
constructor(authService, subscriptionService, toolRegistry) {
|
|
39
|
+
this.toolRegistry = toolRegistry ?? new ExtensionRegistry(EXTENSION_KIND_TOOL);
|
|
40
|
+
this.directRegistrations = new Set();
|
|
41
|
+
this.authService = authService;
|
|
42
|
+
this.subscriptionService = subscriptionService;
|
|
43
|
+
this.ajv = new Ajv({ allErrors: true, coerceTypes: true, useDefaults: true });
|
|
44
|
+
addFormats(this.ajv); // Adds support for standard formats like "date-time", "email", "uri", etc.
|
|
45
|
+
this.registerDefaultTools();
|
|
46
|
+
console.log(`ToolExecutor initialized. Registered tools: ${this.toolRegistry.listActive().length}.`);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Registers a tool with the executor, making it available for subsequent execution.
|
|
50
|
+
* Tools are indexed by their functional `name` property, which must be unique within the registry.
|
|
51
|
+
*
|
|
52
|
+
* @public
|
|
53
|
+
* @param {ITool} tool - The tool instance to register. It must conform to the `ITool` interface.
|
|
54
|
+
* @returns {void}
|
|
55
|
+
* @throws {GMIError} If the tool is invalid (e.g., missing `id` or `name` - `GMIErrorCode.INVALID_ARGUMENT`),
|
|
56
|
+
* or if a tool with the same functional `name` is already registered (`GMIErrorCode.ALREADY_EXISTS`).
|
|
57
|
+
*/
|
|
58
|
+
async registerTool(tool) {
|
|
59
|
+
if (!tool ||
|
|
60
|
+
typeof tool.name !== 'string' ||
|
|
61
|
+
!tool.name.trim() ||
|
|
62
|
+
typeof tool.id !== 'string' ||
|
|
63
|
+
!tool.id.trim()) {
|
|
64
|
+
throw new GMIError("Invalid tool object provided for registration: 'id' and 'name' are required and must be non-empty strings.", GMIErrorCode.INVALID_ARGUMENT, { toolDetails: { id: tool?.id, name: tool?.name } });
|
|
65
|
+
}
|
|
66
|
+
if (this.directRegistrations.has(tool.name)) {
|
|
67
|
+
await this.toolRegistry.unregister(tool.name);
|
|
68
|
+
this.directRegistrations.delete(tool.name);
|
|
69
|
+
}
|
|
70
|
+
const descriptor = this.createDescriptorFromTool(tool);
|
|
71
|
+
await this.toolRegistry.register(descriptor);
|
|
72
|
+
this.directRegistrations.add(tool.name);
|
|
73
|
+
console.log(`ToolExecutor: Tool '${tool.name}' (ID: '${tool.id}', Version: ${tool.version || 'N/A'}) successfully registered.`);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Retrieves a registered tool instance by its functional name.
|
|
77
|
+
*
|
|
78
|
+
* @public
|
|
79
|
+
* @param {string} toolName - The `name` of the tool (as specified in `ITool.name` and used in `ToolCallRequest.name`).
|
|
80
|
+
* @returns {ITool | undefined} The `ITool` instance if found in the registry; otherwise, `undefined`.
|
|
81
|
+
*/
|
|
82
|
+
getTool(toolName) {
|
|
83
|
+
return this.toolRegistry.getActive(toolName)?.payload;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Unregisters a tool from the executor using its functional name.
|
|
87
|
+
* If the tool has a `shutdown` method, it is called prior to removal from the registry.
|
|
88
|
+
*
|
|
89
|
+
* @public
|
|
90
|
+
* @async
|
|
91
|
+
* @param {string} toolName - The `name` of the tool to unregister.
|
|
92
|
+
* @returns {Promise<boolean>} A promise resolving to `true` if the tool was found and successfully unregistered (including its shutdown, if applicable), `false` otherwise.
|
|
93
|
+
*/
|
|
94
|
+
async unregisterTool(toolName) {
|
|
95
|
+
if (!this.directRegistrations.has(toolName)) {
|
|
96
|
+
console.warn(`ToolExecutor: Attempted to unregister tool '${toolName}', but no direct registration was found.`);
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
const removed = await this.toolRegistry.unregister(toolName);
|
|
100
|
+
if (removed) {
|
|
101
|
+
this.directRegistrations.delete(toolName);
|
|
102
|
+
console.log(`ToolExecutor: Tool '${toolName}' successfully unregistered.`);
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
console.warn(`ToolExecutor: Failed to unregister tool '${toolName}'. Descriptor stack may be managed externally.`);
|
|
106
|
+
}
|
|
107
|
+
return removed;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Returns an array of definitions for all currently registered tools.
|
|
111
|
+
* This list typically includes essential information like the tool's name, description,
|
|
112
|
+
* input/output schemas, category, and required capabilities, making it suitable for
|
|
113
|
+
* LLM consumption for function calling or for UI display.
|
|
114
|
+
*
|
|
115
|
+
* @public
|
|
116
|
+
* @returns {Array<Pick<ITool, 'name' | 'description' | 'inputSchema' | 'outputSchema' | 'displayName' | 'category' | 'requiredCapabilities'>>}
|
|
117
|
+
* An array of partial tool information objects.
|
|
118
|
+
*/
|
|
119
|
+
listAvailableTools() {
|
|
120
|
+
return this.toolRegistry.listActive().map(({ payload }) => ({
|
|
121
|
+
name: payload.name,
|
|
122
|
+
displayName: payload.displayName,
|
|
123
|
+
description: payload.description,
|
|
124
|
+
inputSchema: payload.inputSchema,
|
|
125
|
+
outputSchema: payload.outputSchema,
|
|
126
|
+
category: payload.category,
|
|
127
|
+
requiredCapabilities: payload.requiredCapabilities,
|
|
128
|
+
}));
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Executes a specified tool based on the details provided in a `ToolExecutionRequestDetails` object.
|
|
132
|
+
* This is the core method of the executor, orchestrating validation, context preparation,
|
|
133
|
+
* actual tool invocation, and result packaging.
|
|
134
|
+
*
|
|
135
|
+
* @public
|
|
136
|
+
* @async
|
|
137
|
+
* @param {ToolExecutionRequestDetails} requestDetails - An object containing all necessary details for the tool execution,
|
|
138
|
+
* including the `ToolCallRequest` from the LLM and contextual GMI/user information.
|
|
139
|
+
* @returns {Promise<ToolExecutionResult>} A promise that resolves with the `ToolExecutionResult` object.
|
|
140
|
+
* This result indicates the success or failure of the execution and provides the tool's output or error details.
|
|
141
|
+
*/
|
|
142
|
+
async executeTool(requestDetails) {
|
|
143
|
+
const { toolCallRequest, gmiId, personaId, personaCapabilities, userContext, correlationId } = requestDetails;
|
|
144
|
+
if (!toolCallRequest || !toolCallRequest.name || typeof toolCallRequest.name !== 'string') {
|
|
145
|
+
const errorMsg = "Invalid ToolCallRequest provided to ToolExecutor: 'name' is missing or invalid.";
|
|
146
|
+
console.error(`ToolExecutor: ${errorMsg}`, requestDetails);
|
|
147
|
+
return { success: false, error: errorMsg, details: { receivedRequest: toolCallRequest, code: GMIErrorCode.VALIDATION_ERROR } };
|
|
148
|
+
}
|
|
149
|
+
const toolName = toolCallRequest.name;
|
|
150
|
+
const toolDescriptor = this.toolRegistry.getActive(toolName);
|
|
151
|
+
const tool = toolDescriptor?.payload;
|
|
152
|
+
const logContext = `ToolExecutor (GMI: ${gmiId}, Persona: ${personaId}, Tool: ${toolName}, LLMCallID: ${toolCallRequest.id || 'N/A'})`;
|
|
153
|
+
if (!tool) {
|
|
154
|
+
const errorMsg = `Tool '${toolName}' not found in ToolExecutor registry. Cannot execute.`;
|
|
155
|
+
console.error(`${logContext}: ${errorMsg}`);
|
|
156
|
+
return { success: false, error: errorMsg, details: { toolName, reason: "NotRegisteredInExecutor" } };
|
|
157
|
+
}
|
|
158
|
+
if (tool.requiredCapabilities && tool.requiredCapabilities.length > 0) {
|
|
159
|
+
const hasAllCapabilities = tool.requiredCapabilities.every(cap => personaCapabilities.includes(cap));
|
|
160
|
+
if (!hasAllCapabilities) {
|
|
161
|
+
const missingCaps = tool.requiredCapabilities.filter(rc => !personaCapabilities.includes(rc));
|
|
162
|
+
const errorMsg = `Persona (ID: ${personaId}) lacks capabilities for tool '${tool.name}'. Required: [${tool.requiredCapabilities.join(', ')}], Missing: [${missingCaps.join(', ')}].`;
|
|
163
|
+
console.warn(`${logContext}: Capability check failed - ${errorMsg}`);
|
|
164
|
+
return { success: false, error: errorMsg, details: { toolName: tool.name, requiredCapabilities: tool.requiredCapabilities, possessedCapabilities: personaCapabilities, missingCapabilities: missingCaps } };
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
let parsedArgs;
|
|
168
|
+
try {
|
|
169
|
+
// Assuming toolCallRequest.arguments is already a Record<string, any> as per IGMI.ts ToolCallRequest definition
|
|
170
|
+
// If it can be a string, further parsing logic is needed.
|
|
171
|
+
if (typeof toolCallRequest.arguments === 'string') {
|
|
172
|
+
parsedArgs = JSON.parse(toolCallRequest.arguments);
|
|
173
|
+
}
|
|
174
|
+
else if (typeof toolCallRequest.arguments === 'object' && toolCallRequest.arguments !== null) {
|
|
175
|
+
parsedArgs = toolCallRequest.arguments;
|
|
176
|
+
}
|
|
177
|
+
else if (toolCallRequest.arguments === undefined || toolCallRequest.arguments === null) {
|
|
178
|
+
parsedArgs = {};
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
throw new Error(`Tool arguments are not a JSON string or object: ${typeof toolCallRequest.arguments}`);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
catch (parseError) {
|
|
185
|
+
const errorMsg = `Failed to parse arguments for tool '${tool.name}'. Arguments must be a valid JSON string or object.`;
|
|
186
|
+
console.warn(`${logContext}: Argument parsing failed. Raw Args: "${JSON.stringify(toolCallRequest.arguments)}". Error: ${parseError.message}`);
|
|
187
|
+
return { success: false, error: errorMsg, details: { toolName: tool.name, argumentParsingError: parseError.message, rawArguments: toolCallRequest.arguments } };
|
|
188
|
+
}
|
|
189
|
+
if (tool.inputSchema) {
|
|
190
|
+
const validate = this.ajv.compile(tool.inputSchema);
|
|
191
|
+
if (!validate(parsedArgs)) {
|
|
192
|
+
const errorMsg = `Invalid arguments for tool '${tool.name}'. Validation failed against input schema.`;
|
|
193
|
+
const validationErrors = Array.isArray(validate.errors)
|
|
194
|
+
? validate.errors.map(err => ({
|
|
195
|
+
path: err.instancePath || err.schemaPath,
|
|
196
|
+
message: err.message,
|
|
197
|
+
params: err.params,
|
|
198
|
+
}))
|
|
199
|
+
: [{ message: 'Unknown schema validation error.' }];
|
|
200
|
+
console.warn(`${logContext}: Argument schema validation failed. Errors:`, JSON.stringify(validationErrors, null, 2), 'Parsed Args:', parsedArgs);
|
|
201
|
+
return { success: false, error: errorMsg, details: { toolName: tool.name, validationErrors, providedParsedArgs: parsedArgs } };
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
const executionContext = {
|
|
205
|
+
gmiId,
|
|
206
|
+
personaId,
|
|
207
|
+
userContext,
|
|
208
|
+
correlationId: correlationId || `tool-exec-${uuidv4()}`,
|
|
209
|
+
};
|
|
210
|
+
try {
|
|
211
|
+
console.log(`${logContext}: Executing tool '${tool.name}' (ID: '${tool.id}') with validated arguments:`, parsedArgs);
|
|
212
|
+
const startTime = Date.now();
|
|
213
|
+
const result = await tool.execute(parsedArgs, executionContext);
|
|
214
|
+
const durationMs = Date.now() - startTime;
|
|
215
|
+
const outputPreview = result.output ? JSON.stringify(result.output).substring(0, 150) + (JSON.stringify(result.output).length > 150 ? '...' : '') : 'N/A';
|
|
216
|
+
if (result.success) {
|
|
217
|
+
console.log(`${logContext}: Tool execution successful. Duration: ${durationMs}ms. Output preview: ${outputPreview}`);
|
|
218
|
+
}
|
|
219
|
+
else {
|
|
220
|
+
console.warn(`${logContext}: Tool execution reported failure. Duration: ${durationMs}ms. Error: ${result.error}`, result.details);
|
|
221
|
+
}
|
|
222
|
+
if (tool.outputSchema && result.success && result.output !== undefined) {
|
|
223
|
+
const validateOutput = this.ajv.compile(tool.outputSchema);
|
|
224
|
+
if (!validateOutput(result.output)) {
|
|
225
|
+
const outputErrorMsg = `Tool '${tool.name}' produced output that failed its defined output schema validation.`;
|
|
226
|
+
const outputValidationErrors = Array.isArray(validateOutput.errors)
|
|
227
|
+
? validateOutput.errors.map(err => ({
|
|
228
|
+
path: err.instancePath,
|
|
229
|
+
message: err.message,
|
|
230
|
+
params: err.params,
|
|
231
|
+
}))
|
|
232
|
+
: [];
|
|
233
|
+
console.warn(`${logContext}: Output schema validation failed for '${tool.name}'. Errors:`, JSON.stringify(outputValidationErrors, null, 2));
|
|
234
|
+
return {
|
|
235
|
+
...result,
|
|
236
|
+
success: false, // Mark as overall failure if output schema validation fails
|
|
237
|
+
error: result.error ? `${result.error} And output schema validation failed.` : outputErrorMsg,
|
|
238
|
+
details: {
|
|
239
|
+
...(result.details || {}),
|
|
240
|
+
outputValidationWarning: outputErrorMsg,
|
|
241
|
+
outputValidationErrors,
|
|
242
|
+
},
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
return result;
|
|
247
|
+
}
|
|
248
|
+
catch (err) {
|
|
249
|
+
const execErrorMsg = `Critical unhandled error during the execution of tool '${tool.name}'.`;
|
|
250
|
+
console.error(`${logContext}: ${execErrorMsg}`, err);
|
|
251
|
+
const gmiErr = createGMIErrorFromError(err, GMIErrorCode.TOOL_EXECUTION_FAILED, { toolName: tool.name, arguments: parsedArgs }, execErrorMsg);
|
|
252
|
+
return {
|
|
253
|
+
success: false,
|
|
254
|
+
error: gmiErr.message,
|
|
255
|
+
details: {
|
|
256
|
+
toolName: tool.name,
|
|
257
|
+
errorCode: gmiErr.code,
|
|
258
|
+
errorDetailsFromGMIError: gmiErr.details,
|
|
259
|
+
rawErrorString: err.toString(),
|
|
260
|
+
stack: err.stack
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
/** @private
|
|
266
|
+
* Registers example tools. In a production system, tools would be loaded dynamically or via configuration.
|
|
267
|
+
*/
|
|
268
|
+
createDescriptorFromTool(tool) {
|
|
269
|
+
return {
|
|
270
|
+
id: tool.name,
|
|
271
|
+
kind: EXTENSION_KIND_TOOL,
|
|
272
|
+
payload: tool,
|
|
273
|
+
metadata: {
|
|
274
|
+
toolId: tool.id,
|
|
275
|
+
origin: 'direct-registration',
|
|
276
|
+
},
|
|
277
|
+
onDeactivate: async () => {
|
|
278
|
+
if (typeof tool.shutdown === 'function') {
|
|
279
|
+
try {
|
|
280
|
+
await tool.shutdown();
|
|
281
|
+
}
|
|
282
|
+
catch (error) {
|
|
283
|
+
console.error(`ToolExecutor: Error during shutdown of tool '${tool.name}' (ID: '${tool.id}')`, error);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
},
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
registerDefaultTools() {
|
|
290
|
+
const currentTimeTool = {
|
|
291
|
+
id: "system-current-time-tool-v1.1",
|
|
292
|
+
name: "getCurrentDateTime",
|
|
293
|
+
displayName: "Current Date & Time Service",
|
|
294
|
+
description: "Gets the current date and time, optionally for a specific IANA timezone (e.g., 'America/New_York', 'Europe/London'). Defaults to the server's local timezone if no timezone is provided or if the provided one is invalid.",
|
|
295
|
+
inputSchema: {
|
|
296
|
+
type: "object",
|
|
297
|
+
properties: { timezone: { type: "string", description: "Optional: IANA timezone string (e.g., 'America/Los_Angeles', 'Europe/London'). Examples: 'UTC', 'America/New_York', 'Asia/Tokyo'.", format: "time-zone" } },
|
|
298
|
+
additionalProperties: false,
|
|
299
|
+
},
|
|
300
|
+
outputSchema: {
|
|
301
|
+
type: "object",
|
|
302
|
+
properties: {
|
|
303
|
+
currentTime: { type: "string", description: "The current date and time formatted as a locale string (e.g., '5/24/2025, 11:43:58 AM')." },
|
|
304
|
+
timezoneUsed: { type: "string", description: "The IANA timezone that was used for the calculation." },
|
|
305
|
+
isoTimestamp: { type: "string", format: "date-time", description: "The current date and time in ISO 8601 format (UTC)." }
|
|
306
|
+
},
|
|
307
|
+
required: ["currentTime", "timezoneUsed", "isoTimestamp"]
|
|
308
|
+
},
|
|
309
|
+
category: "System Utilities", version: "1.1.0", hasSideEffects: false,
|
|
310
|
+
execute: async (args, context) => {
|
|
311
|
+
try {
|
|
312
|
+
let effectiveTimezone = args.timezone;
|
|
313
|
+
const serverDefaultTimezone = Intl.DateTimeFormat().resolvedOptions().timeZone || "UTC";
|
|
314
|
+
if (effectiveTimezone) {
|
|
315
|
+
try {
|
|
316
|
+
new Date().toLocaleString("en-US", { timeZone: effectiveTimezone });
|
|
317
|
+
}
|
|
318
|
+
catch (tzError) {
|
|
319
|
+
console.warn(`ToolExecutor[getCurrentDateTime]: Invalid timezone '${args.timezone}' provided by GMI ${context.gmiId}. Falling back to ${serverDefaultTimezone}. Error: ${tzError.message}`);
|
|
320
|
+
effectiveTimezone = serverDefaultTimezone;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
else {
|
|
324
|
+
effectiveTimezone = serverDefaultTimezone;
|
|
325
|
+
}
|
|
326
|
+
const currentDate = new Date();
|
|
327
|
+
return {
|
|
328
|
+
success: true,
|
|
329
|
+
output: {
|
|
330
|
+
currentTime: currentDate.toLocaleString("en-US", { timeZone: effectiveTimezone, hour12: true, year: 'numeric', month: 'numeric', day: 'numeric', hour: 'numeric', minute: 'numeric', second: 'numeric' }),
|
|
331
|
+
timezoneUsed: effectiveTimezone,
|
|
332
|
+
isoTimestamp: currentDate.toISOString(),
|
|
333
|
+
},
|
|
334
|
+
contentType: "application/json"
|
|
335
|
+
};
|
|
336
|
+
}
|
|
337
|
+
catch (e) {
|
|
338
|
+
return { success: false, error: `Error getting current time: ${e.message}`, details: { stack: e.stack } };
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
};
|
|
342
|
+
this.registerTool(currentTimeTool).catch((e) => {
|
|
343
|
+
console.error('Error registering default current time tool:', e);
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* Gracefully shuts down all registered tools that implement the optional `shutdown` method.
|
|
348
|
+
* This is typically called when the ToolExecutor itself is being shut down as part of a larger
|
|
349
|
+
* application termination sequence.
|
|
350
|
+
*
|
|
351
|
+
* @public
|
|
352
|
+
* @async
|
|
353
|
+
* @returns {Promise<void[]>} A promise that resolves when all tool shutdown attempts are complete.
|
|
354
|
+
* Individual tool shutdown errors are logged but do not prevent other tools from attempting shutdown.
|
|
355
|
+
*/
|
|
356
|
+
async shutdownAllTools() {
|
|
357
|
+
const activeCount = this.toolRegistry.listActive().length;
|
|
358
|
+
console.log(`ToolExecutor: Initiating shutdown for ${activeCount} registered tool(s)...`);
|
|
359
|
+
await this.toolRegistry.clear();
|
|
360
|
+
this.directRegistrations.clear();
|
|
361
|
+
return [];
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
//# sourceMappingURL=ToolExecutor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToolExecutor.js","sourceRoot":"","sources":["../../../src/core/tools/ToolExecutor.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD;;;;;;;;;;GAUG;AAEH,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,UAAU,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAKrD,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAChG,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAkB,MAAM,kBAAkB,CAAC;AAkC1F;;;;;;GAMG;AACH,MAAM,OAAO,YAAY;IAgBvB;;;;;;;;;;;MAWE;IACF,YACE,WAA0B,EAC1B,mBAA0C,EAC1C,YAAuC;QAEvC,IAAI,CAAC,YAAY,GAAG,YAAY,IAAI,IAAI,iBAAiB,CAAQ,mBAAmB,CAAC,CAAC;QACtF,IAAI,CAAC,mBAAmB,GAAG,IAAI,GAAG,EAAU,CAAC;QAC7C,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,mBAAmB,GAAG,mBAAmB,CAAC;QAE/C,IAAI,CAAC,GAAG,GAAG,IAAI,GAAG,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;QAC9E,UAAU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