@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,195 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Defines the IToolPermissionManager interface, responsible for
|
|
3
|
+
* determining if a tool execution is authorized based on various criteria such as
|
|
4
|
+
* Persona capabilities, user subscriptions, and potentially other contextual rules.
|
|
5
|
+
*
|
|
6
|
+
* @module backend/agentos/core/tools/IToolPermissionManager
|
|
7
|
+
* @see ./ITool.ts for ITool definition (which includes requiredCapabilities).
|
|
8
|
+
* @see ../cognitive_substrate/IGMI.ts for UserContext.
|
|
9
|
+
* @see ../../../../services/user_auth/IAuthService.ts for authentication context.
|
|
10
|
+
* @see ../../../../services/user_auth/SubscriptionService.ts for subscription and feature flags.
|
|
11
|
+
*/
|
|
12
|
+
import { ITool } from '../ITool';
|
|
13
|
+
import { UserContext } from '../../../cognitive_substrate/IGMI';
|
|
14
|
+
import type { IAuthService, ISubscriptionService } from '../../../services/user_auth/types';
|
|
15
|
+
/**
|
|
16
|
+
* @interface FeatureFlag
|
|
17
|
+
* @description Defines the structure for a feature flag, used to gate access to tools
|
|
18
|
+
* based on user subscriptions or specific entitlements.
|
|
19
|
+
*
|
|
20
|
+
* @property {string} flag - The unique string identifier for the feature flag (e.g., "CAN_USE_ADVANCED_SEARCH_TOOL").
|
|
21
|
+
* @property {string} [description] - Optional. A human-readable description of the feature.
|
|
22
|
+
*/
|
|
23
|
+
export interface FeatureFlag {
|
|
24
|
+
flag: string;
|
|
25
|
+
description?: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Represents the context required for making a permission decision for tool usage.
|
|
29
|
+
* This object aggregates all necessary information that the `IToolPermissionManager`
|
|
30
|
+
* needs to evaluate whether a tool call should be allowed.
|
|
31
|
+
*
|
|
32
|
+
* @interface PermissionCheckContext
|
|
33
|
+
* @property {ITool} tool - The actual `ITool` instance for which permission is being checked.
|
|
34
|
+
* This provides access to tool metadata like `id`, `name`, and `requiredCapabilities`.
|
|
35
|
+
* @property {string} personaId - The unique identifier of the active Persona within the GMI
|
|
36
|
+
* that is attempting to use the tool.
|
|
37
|
+
* @property {string[]} personaCapabilities - An array of capability strings (e.g., "filesystem:read", "api:weather")
|
|
38
|
+
* currently possessed by the active Persona.
|
|
39
|
+
* @property {UserContext} userContext - The context of the end-user associated with the current request,
|
|
40
|
+
* which may include `userId`, preferences, skill level, etc.
|
|
41
|
+
* @property {string} [gmiId] - Optional. The unique identifier of the GMI instance making the request.
|
|
42
|
+
* Useful for logging or more granular GMI-specific rules.
|
|
43
|
+
*/
|
|
44
|
+
export interface PermissionCheckContext {
|
|
45
|
+
tool: ITool;
|
|
46
|
+
personaId: string;
|
|
47
|
+
personaCapabilities: string[];
|
|
48
|
+
userContext: UserContext;
|
|
49
|
+
gmiId?: string;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Represents the result of a permission check performed by the `IToolPermissionManager`.
|
|
53
|
+
*
|
|
54
|
+
* @interface PermissionCheckResult
|
|
55
|
+
* @property {boolean} isAllowed - `true` if the tool execution is permitted based on the evaluated context, `false` otherwise.
|
|
56
|
+
* @property {string} [reason] - An optional human-readable string explaining why the permission was
|
|
57
|
+
* granted or denied. This is useful for logging, debugging, or providing feedback to users/developers.
|
|
58
|
+
* @property {Record<string, any>} [details] - An optional object for any additional details or metadata
|
|
59
|
+
* related to the permission decision (e.g., specific capability missing, subscription feature lacking, policy rule invoked).
|
|
60
|
+
*/
|
|
61
|
+
export interface PermissionCheckResult {
|
|
62
|
+
isAllowed: boolean;
|
|
63
|
+
reason?: string;
|
|
64
|
+
details?: Record<string, any>;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Configuration options for the `ToolPermissionManager`.
|
|
68
|
+
* This allows administrators to fine-tune how tool permissions are evaluated and enforced.
|
|
69
|
+
*
|
|
70
|
+
* @interface ToolPermissionManagerConfig
|
|
71
|
+
* @property {boolean} [strictCapabilityChecking=true] - If `true` (default), the Persona must possess *all*
|
|
72
|
+
* capabilities listed in the `tool.requiredCapabilities` array. If `false`, this check might be bypassed
|
|
73
|
+
* or handled with more leniency (though generally not recommended for tools accessing sensitive resources).
|
|
74
|
+
* @property {Record<string, FeatureFlag[]>} [toolToSubscriptionFeatures] - Optional. A mapping where keys are
|
|
75
|
+
* tool IDs (`ITool.id`) or tool names (`ITool.name`), and values are arrays of `FeatureFlag` objects (or their string identifiers).
|
|
76
|
+
* This allows linking specific tools to subscription features, meaning a user must have the corresponding
|
|
77
|
+
* features enabled via their subscription tier to use the tool.
|
|
78
|
+
* @property {boolean} [logToolCalls=false] - If true, detailed information about permission checks for tool calls will be logged. Defaults to false.
|
|
79
|
+
* @example
|
|
80
|
+
* // Example: Only users with "AdvancedAnalysisTools" and "PremiumSupport" features can use "financial_data_analyzer_v2"
|
|
81
|
+
* const config: ToolPermissionManagerConfig = {
|
|
82
|
+
* strictCapabilityChecking: true,
|
|
83
|
+
* logToolCalls: true,
|
|
84
|
+
* toolToSubscriptionFeatures: {
|
|
85
|
+
* "financial_data_analyzer_v2": [
|
|
86
|
+
* { flag: "FEATURE_ADVANCED_ANALYSIS", description: "Access to advanced analysis tools" },
|
|
87
|
+
* { flag: "FEATURE_PREMIUM_SUPPORT_TOOLS", description: "Access to tools included with premium support" }
|
|
88
|
+
* ]
|
|
89
|
+
* }
|
|
90
|
+
* };
|
|
91
|
+
*/
|
|
92
|
+
export interface ToolPermissionManagerConfig {
|
|
93
|
+
strictCapabilityChecking?: boolean;
|
|
94
|
+
toolToSubscriptionFeatures?: Record<string, FeatureFlag[]>;
|
|
95
|
+
logToolCalls?: boolean;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* @interface IToolPermissionManager
|
|
99
|
+
* @description Defines the contract for a service responsible for managing and enforcing
|
|
100
|
+
* permissions related to tool execution within the AgentOS ecosystem. Implementations of this
|
|
101
|
+
* interface will centralize the logic for checking Persona capabilities, user subscription
|
|
102
|
+
* features, and any other custom authorization rules before a tool is allowed to execute.
|
|
103
|
+
*/
|
|
104
|
+
export interface IToolPermissionManager {
|
|
105
|
+
/**
|
|
106
|
+
* Initializes the ToolPermissionManager with its specific configuration and any
|
|
107
|
+
* necessary service dependencies (like authentication or subscription services).
|
|
108
|
+
* This method must be called successfully before the manager can process permission checks.
|
|
109
|
+
*
|
|
110
|
+
* @public
|
|
111
|
+
* @async
|
|
112
|
+
* @param {ToolPermissionManagerConfig} config - The configuration object for the permission manager,
|
|
113
|
+
* defining its operational parameters and rules.
|
|
114
|
+
* @param {IAuthService} [authService] - Optional. An instance of the authentication service. This might be used
|
|
115
|
+
* for more complex permission rules based on user roles, identity verification status, or other authentication attributes.
|
|
116
|
+
* @param {ISubscriptionService} [subscriptionService] - Optional. An instance of the subscription service. This is
|
|
117
|
+
* crucial if tool access is tied to user subscription tiers or specific feature flags defined in `ToolPermissionManagerConfig`.
|
|
118
|
+
* @returns {Promise<void>} A promise that resolves upon successful initialization of the manager.
|
|
119
|
+
* @throws {GMIError | Error} If initialization fails due to invalid configuration or issues with dependencies.
|
|
120
|
+
*/
|
|
121
|
+
initialize(config: ToolPermissionManagerConfig, authService?: IAuthService, subscriptionService?: ISubscriptionService): Promise<void>;
|
|
122
|
+
/**
|
|
123
|
+
* Checks if the execution of a given tool is permitted based on the comprehensive context provided.
|
|
124
|
+
* This is the primary method for authorizing tool calls. It should consolidate all relevant checks, including:
|
|
125
|
+
* - Persona capabilities against `tool.requiredCapabilities`.
|
|
126
|
+
* - User subscription features against `config.toolToSubscriptionFeatures`.
|
|
127
|
+
* - Any other custom rules or policies defined within the implementation.
|
|
128
|
+
*
|
|
129
|
+
* @public
|
|
130
|
+
* @async
|
|
131
|
+
* @param {PermissionCheckContext} context - The context object containing all necessary information
|
|
132
|
+
* for the permission decision (the tool instance, persona details, user context, etc.).
|
|
133
|
+
* @returns {Promise<PermissionCheckResult>} A promise that resolves with a `PermissionCheckResult` object,
|
|
134
|
+
* which includes a boolean `isAllowed` flag and an optional `reason` and `details` for the decision.
|
|
135
|
+
*
|
|
136
|
+
* @example
|
|
137
|
+
* const permissionContext = {
|
|
138
|
+
* tool: myCalculatorTool,
|
|
139
|
+
* personaId: "calculator-persona",
|
|
140
|
+
* personaCapabilities: ["execute_basic_math"],
|
|
141
|
+
* userContext: { userId: "user-test-123" }
|
|
142
|
+
* };
|
|
143
|
+
* const result = await permissionManager.isExecutionAllowed(permissionContext);
|
|
144
|
+
* if (result.isAllowed) {
|
|
145
|
+
* console.log("Calculator tool execution permitted.");
|
|
146
|
+
* } else {
|
|
147
|
+
* console.warn(`Calculator tool execution denied: ${result.reason}`, result.details);
|
|
148
|
+
* }
|
|
149
|
+
*/
|
|
150
|
+
isExecutionAllowed(context: PermissionCheckContext): Promise<PermissionCheckResult>;
|
|
151
|
+
/**
|
|
152
|
+
* Performs a specific check to determine if a Persona possesses all the capabilities
|
|
153
|
+
* explicitly listed as required by a tool.
|
|
154
|
+
*
|
|
155
|
+
* @public
|
|
156
|
+
* @param {string[]} personaCapabilities - An array of capability strings currently held by the Persona.
|
|
157
|
+
* @param {string[] | undefined} toolRequiredCapabilities - An array of capability strings defined as required by the tool.
|
|
158
|
+
* If `undefined` or empty, this check inherently passes (tool requires no specific capabilities).
|
|
159
|
+
* @returns {boolean} `true` if the Persona possesses all capabilities required by the tool, `false` otherwise.
|
|
160
|
+
*/
|
|
161
|
+
hasRequiredCapabilities(personaCapabilities: string[], toolRequiredCapabilities: string[] | undefined): boolean;
|
|
162
|
+
/**
|
|
163
|
+
* Performs a specific check to determine if a user's subscription plan includes the
|
|
164
|
+
* necessary features or flags that are configured as prerequisites for using a particular tool.
|
|
165
|
+
* This relies on the `ISubscriptionService` and the `toolToSubscriptionFeatures` mapping
|
|
166
|
+
* in the `ToolPermissionManagerConfig`.
|
|
167
|
+
*
|
|
168
|
+
* @public
|
|
169
|
+
* @async
|
|
170
|
+
* @param {string} userId - The ID of the user whose subscription is being checked.
|
|
171
|
+
* @param {string} toolIdOrName - The unique ID (`ITool.id`) or functional name (`ITool.name`) of the tool.
|
|
172
|
+
* @returns {Promise<{isAllowed: boolean, missingFeatures?: FeatureFlag[], reason?: string}>}
|
|
173
|
+
* An object indicating if access is allowed by subscription. If `isAllowed` is `false`,
|
|
174
|
+
* `missingFeatures` (if applicable) will list the specific subscription features the user lacks,
|
|
175
|
+
* and `reason` may provide additional context.
|
|
176
|
+
* @throws {GMIError} If the `ISubscriptionService` is not configured but this check is invoked
|
|
177
|
+
* for a tool that has required features (`GMIErrorCode.CONFIGURATION_ERROR` or `EXTERNAL_SERVICE_ERROR`).
|
|
178
|
+
*/
|
|
179
|
+
checkToolSubscriptionAccess(userId: string, toolIdOrName: string): Promise<{
|
|
180
|
+
isAllowed: boolean;
|
|
181
|
+
missingFeatures?: FeatureFlag[];
|
|
182
|
+
reason?: string;
|
|
183
|
+
}>;
|
|
184
|
+
/**
|
|
185
|
+
* Retrieves the list of `FeatureFlag`s that are configured as being required for a specific tool.
|
|
186
|
+
* This information is sourced from the `toolToSubscriptionFeatures` mapping in the manager's configuration.
|
|
187
|
+
*
|
|
188
|
+
* @public
|
|
189
|
+
* @param {string} toolIdOrName - The ID or name of the tool.
|
|
190
|
+
* @returns {FeatureFlag[] | undefined} An array of `FeatureFlag` objects required for the tool,
|
|
191
|
+
* or `undefined` if no specific features are mapped as required for this tool.
|
|
192
|
+
*/
|
|
193
|
+
getRequiredFeaturesForTool(toolIdOrName: string): FeatureFlag[] | undefined;
|
|
194
|
+
}
|
|
195
|
+
//# sourceMappingURL=IToolPermissionManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IToolPermissionManager.d.ts","sourceRoot":"","sources":["../../../../src/core/tools/permissions/IToolPermissionManager.ts"],"names":[],"mappings":"AACA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAChE,OAAO,KAAK,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAE5F;;;;;;;GAOG;AACH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,KAAK,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,mBAAmB,EAAE,MAAM,EAAE,CAAC;IAC9B,WAAW,EAAE,WAAW,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,qBAAqB;IACpC,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC/B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,WAAW,2BAA2B;IAC1C,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,0BAA0B,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,EAAE,CAAC,CAAC;IAC3D,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAGD;;;;;;GAMG;AACH,MAAM,WAAW,sBAAsB;IACrC;;;;;;;;;;;;;;;OAeG;IACH,UAAU,CACR,MAAM,EAAE,2BAA2B,EACnC,WAAW,CAAC,EAAE,YAAY,EAC1B,mBAAmB,CAAC,EAAE,oBAAoB,GACzC,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjB;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,kBAAkB,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAEpF;;;;;;;;;OASG;IACH,uBAAuB,CACrB,mBAAmB,EAAE,MAAM,EAAE,EAC7B,wBAAwB,EAAE,MAAM,EAAE,GAAG,SAAS,GAC7C,OAAO,CAAC;IAEX;;;;;;;;;;;;;;;;OAgBG;IACH,2BAA2B,CACzB,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC;QAAC,SAAS,EAAE,OAAO,CAAC;QAAC,eAAe,CAAC,EAAE,WAAW,EAAE,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAC,CAAC,CAAC;IAEnF;;;;;;;;OAQG;IACH,0BAA0B,CAAC,YAAY,EAAE,MAAM,GAAG,WAAW,EAAE,GAAG,SAAS,CAAC;CAC7E"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// File: backend/agentos/core/tools/permissions/IToolPermissionManager.ts
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview Defines the IToolPermissionManager interface, responsible for
|
|
4
|
+
* determining if a tool execution is authorized based on various criteria such as
|
|
5
|
+
* Persona capabilities, user subscriptions, and potentially other contextual rules.
|
|
6
|
+
*
|
|
7
|
+
* @module backend/agentos/core/tools/IToolPermissionManager
|
|
8
|
+
* @see ./ITool.ts for ITool definition (which includes requiredCapabilities).
|
|
9
|
+
* @see ../cognitive_substrate/IGMI.ts for UserContext.
|
|
10
|
+
* @see ../../../../services/user_auth/IAuthService.ts for authentication context.
|
|
11
|
+
* @see ../../../../services/user_auth/SubscriptionService.ts for subscription and feature flags.
|
|
12
|
+
*/
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=IToolPermissionManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IToolPermissionManager.js","sourceRoot":"","sources":["../../../../src/core/tools/permissions/IToolPermissionManager.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE;;;;;;;;;;GAUG"}
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file ToolPermissionManager.ts
|
|
3
|
+
* @module backend/agentos/core/tools/permissions/ToolPermissionManager
|
|
4
|
+
* @version 1.2.1
|
|
5
|
+
*
|
|
6
|
+
* @description
|
|
7
|
+
* This module implements the `IToolPermissionManager` interface, providing a robust and
|
|
8
|
+
* configurable system for managing permissions related to tool execution within the AgentOS ecosystem.
|
|
9
|
+
* The `ToolPermissionManager` is a critical component for enforcing authorization policies,
|
|
10
|
+
* evaluating requests against Persona capabilities, user subscription features (via `ISubscriptionService`),
|
|
11
|
+
* and any other defined contextual rules. Its design emphasizes clarity, extensibility, and
|
|
12
|
+
* adherence to SOTA TypeScript practices.
|
|
13
|
+
*
|
|
14
|
+
* Key Responsibilities:
|
|
15
|
+
* - Initialization with a detailed configuration (`ToolPermissionManagerConfig`) and essential
|
|
16
|
+
* dependent services such as `IAuthService` and `ISubscriptionService`.
|
|
17
|
+
* - Authoritatively checking if a tool execution is permitted based on a comprehensive
|
|
18
|
+
* `PermissionCheckContext`, which includes the tool in question, the invoking Persona's
|
|
19
|
+
* profile, and the end-user's context.
|
|
20
|
+
* - Verifying that the invoking Persona possesses all `requiredCapabilities` specified by the tool,
|
|
21
|
+
* if `strictCapabilityChecking` is enabled.
|
|
22
|
+
* - Interacting with the `ISubscriptionService` to determine if the user's current subscription
|
|
23
|
+
* tier grants access to specific features that may be prerequisites for using certain tools.
|
|
24
|
+
* - Providing clear, actionable reasons and detailed metadata for all permission decisions,
|
|
25
|
+
* aiding in debugging, auditing, and user feedback.
|
|
26
|
+
* - Centralizing tool access logic to enhance security and maintainability across the platform.
|
|
27
|
+
* - Offering configurable logging for permission checks via `logToolCalls` in its configuration.
|
|
28
|
+
*
|
|
29
|
+
* Architectural Tenets Applied:
|
|
30
|
+
* - Interface-Driven Design: Implements `IToolPermissionManager`.
|
|
31
|
+
* - Dependency Injection: `IAuthService` and `ISubscriptionService` are injected.
|
|
32
|
+
* - Comprehensive JSDoc: All public and significant private members are documented.
|
|
33
|
+
* - Robust Error Handling: Uses standardized `GMIError` and `GMIErrorCode`.
|
|
34
|
+
* - Configuration Management: Behavior is driven by `ToolPermissionManagerConfig`.
|
|
35
|
+
* - Strict Type Safety: Leverages TypeScript's type system to prevent common errors.
|
|
36
|
+
*
|
|
37
|
+
* @see {@link ./IToolPermissionManager.ts} for the interface definition and related types (including `FeatureFlag` and `ToolPermissionManagerConfig`).
|
|
38
|
+
* @see {@link ../ITool.ts} for `ITool` and `ToolDefinition` which include `requiredCapabilities`.
|
|
39
|
+
* @see {@link ../../../cognitive_substrate/IGMI.ts} for `UserContext` definition.
|
|
40
|
+
* @see {@link ../../../../services/user_auth/SubscriptionService.ts} for `ISubscriptionService` and `ISubscriptionTier`.
|
|
41
|
+
* @see {@link @framers/agentos/utils/errors.ts} for `GMIError` and `GMIErrorCode`.
|
|
42
|
+
*/
|
|
43
|
+
import { IToolPermissionManager, PermissionCheckContext, PermissionCheckResult, ToolPermissionManagerConfig, FeatureFlag } from './IToolPermissionManager';
|
|
44
|
+
import type { IAuthService, ISubscriptionService } from '../../../services/user_auth/types';
|
|
45
|
+
/**
|
|
46
|
+
* @class ToolPermissionManager
|
|
47
|
+
* @implements {IToolPermissionManager}
|
|
48
|
+
* @description
|
|
49
|
+
* Manages and enforces permissions for tool usage within the AgentOS ecosystem.
|
|
50
|
+
* It evaluates tool execution requests against configured policies, Persona capabilities,
|
|
51
|
+
* and user subscription entitlements to determine authorization. This class provides a
|
|
52
|
+
* centralized point of control for tool access, enhancing security and feature gating
|
|
53
|
+
* across the platform.
|
|
54
|
+
*/
|
|
55
|
+
export declare class ToolPermissionManager implements IToolPermissionManager {
|
|
56
|
+
/**
|
|
57
|
+
* Readonly configuration for this permission manager instance, applied during initialization.
|
|
58
|
+
* Defines behavior such as strict capability checking, mappings of tools to subscription features,
|
|
59
|
+
* and verbosity of logging. Ensures that once initialized, the core operational parameters of
|
|
60
|
+
* the manager do not change, promoting predictable behavior.
|
|
61
|
+
* @private
|
|
62
|
+
* @readonly
|
|
63
|
+
* @type {Readonly<Required<ToolPermissionManagerConfig>>}
|
|
64
|
+
*/
|
|
65
|
+
private config;
|
|
66
|
+
/**
|
|
67
|
+
* Optional authentication service instance. This service can be used for more complex
|
|
68
|
+
* permission rules that might depend on user roles, identity verification status,
|
|
69
|
+
* or other authentication-related attributes not typically found in `UserContext`.
|
|
70
|
+
* @private
|
|
71
|
+
* @type {IAuthService | undefined}
|
|
72
|
+
*/
|
|
73
|
+
private authService?;
|
|
74
|
+
/**
|
|
75
|
+
* Optional subscription service instance. This service is crucial if tool access is
|
|
76
|
+
* gated by user subscription tiers or specific feature flags. It allows the manager
|
|
77
|
+
* to check if a user's current subscription plan permits the use of a requested tool.
|
|
78
|
+
* @private
|
|
79
|
+
* @type {ISubscriptionService | undefined}
|
|
80
|
+
*/
|
|
81
|
+
private subscriptionService?;
|
|
82
|
+
/**
|
|
83
|
+
* Flag indicating if the manager has been successfully initialized.
|
|
84
|
+
* Operations that depend on configuration or services are blocked until initialization is complete,
|
|
85
|
+
* ensuring the manager operates in a valid state.
|
|
86
|
+
* @private
|
|
87
|
+
* @type {boolean}
|
|
88
|
+
*/
|
|
89
|
+
private isInitialized;
|
|
90
|
+
/**
|
|
91
|
+
* A unique identifier for this `ToolPermissionManager` instance.
|
|
92
|
+
* Useful for logging, debugging, and potentially differentiating between multiple manager
|
|
93
|
+
* instances if the system architecture evolves to support such a scenario.
|
|
94
|
+
* @public
|
|
95
|
+
* @readonly
|
|
96
|
+
* @type {string}
|
|
97
|
+
*/
|
|
98
|
+
readonly managerId: string;
|
|
99
|
+
/**
|
|
100
|
+
* Constructs a `ToolPermissionManager` instance.
|
|
101
|
+
* The instance is not fully operational until the `initialize` method is called
|
|
102
|
+
* with the necessary configuration and optional service dependencies. This ensures
|
|
103
|
+
* that the manager always starts in a predictable, uninitialized state.
|
|
104
|
+
*/
|
|
105
|
+
constructor();
|
|
106
|
+
/**
|
|
107
|
+
* Initializes the `ToolPermissionManager` with its configuration and dependent services.
|
|
108
|
+
* This method must be called and successfully awaited before any permission checks can be performed.
|
|
109
|
+
* It establishes the manager's operational parameters and links it to essential external services
|
|
110
|
+
* like authentication and subscription management if they are provided, ensuring all dependencies
|
|
111
|
+
* are ready for use.
|
|
112
|
+
*
|
|
113
|
+
* @public
|
|
114
|
+
* @async
|
|
115
|
+
* @param {ToolPermissionManagerConfig} config - The configuration object that defines how
|
|
116
|
+
* tool permissions are to be evaluated (e.g., strictness of capability checks,
|
|
117
|
+
* tool-to-feature mappings, logging verbosity). Must not be null or undefined.
|
|
118
|
+
* @param {IAuthService} [authService] - Optional. An instance of the authentication service,
|
|
119
|
+
* conforming to the `IAuthService` interface. If provided, it can be used for advanced,
|
|
120
|
+
* identity-based permission rules not covered by `UserContext` alone.
|
|
121
|
+
* @param {ISubscriptionService} [subscriptionService] - Optional. An instance of the subscription service,
|
|
122
|
+
* conforming to the `ISubscriptionService` interface. If provided, it's used to check if a user's
|
|
123
|
+
* subscription entitles them to use specific tools based on feature flags.
|
|
124
|
+
* @returns {Promise<void>} A promise that resolves when the manager is fully initialized and ready
|
|
125
|
+
* to process permission requests.
|
|
126
|
+
* @throws {GMIError} If the provided `config` is null or undefined, a `GMIError` with
|
|
127
|
+
* `GMIErrorCode.CONFIGURATION_ERROR` is thrown, preventing initialization with invalid parameters.
|
|
128
|
+
*/
|
|
129
|
+
initialize(config: ToolPermissionManagerConfig, authService?: IAuthService, subscriptionService?: ISubscriptionService): Promise<void>;
|
|
130
|
+
/**
|
|
131
|
+
* Ensures that the permission manager has been properly initialized before attempting
|
|
132
|
+
* to perform any operations that rely on its configuration or injected services.
|
|
133
|
+
* This is a critical check to prevent runtime errors due to an unconfigured state.
|
|
134
|
+
*
|
|
135
|
+
* @private
|
|
136
|
+
* @throws {GMIError} If the manager is not initialized, an error with
|
|
137
|
+
* `GMIErrorCode.NOT_INITIALIZED` is thrown, detailing that an operation was
|
|
138
|
+
* attempted on an uninitialized manager.
|
|
139
|
+
*/
|
|
140
|
+
private ensureInitialized;
|
|
141
|
+
/**
|
|
142
|
+
* Checks if a Persona possesses all capabilities explicitly required by a tool.
|
|
143
|
+
* This is a fundamental building block for the overall permission decision in `isExecutionAllowed`.
|
|
144
|
+
* An empty or undefined `toolRequiredCapabilities` array means the tool has no specific capability prerequisites.
|
|
145
|
+
*
|
|
146
|
+
* @public
|
|
147
|
+
* @param {string[]} personaCapabilities - An array of capability strings (e.g., "filesystem:read", "api:weather")
|
|
148
|
+
* currently possessed by the Persona. It's expected these are valid, non-empty strings.
|
|
149
|
+
* @param {string[] | undefined} toolRequiredCapabilities - An array of capability strings defined by the tool
|
|
150
|
+
* as prerequisites for its execution. If `undefined` or empty, the tool is considered to have no
|
|
151
|
+
* specific capability requirements, and this check will pass by default.
|
|
152
|
+
* @returns {boolean} `true` if the Persona possesses all capabilities required by the tool,
|
|
153
|
+
* or if the tool requires no specific capabilities. Returns `false` if any required capability is missing,
|
|
154
|
+
* or if the Persona has no capabilities listed when some are required.
|
|
155
|
+
*/
|
|
156
|
+
hasRequiredCapabilities(personaCapabilities: string[], toolRequiredCapabilities: string[] | undefined): boolean;
|
|
157
|
+
/**
|
|
158
|
+
* Retrieves the list of `FeatureFlag`s that are configured as being required for a specific tool.
|
|
159
|
+
* These feature flags typically map to user subscription tiers or special entitlements.
|
|
160
|
+
* The information is sourced directly from the `toolToSubscriptionFeatures` mapping
|
|
161
|
+
* provided in the manager's runtime configuration.
|
|
162
|
+
*
|
|
163
|
+
* @public
|
|
164
|
+
* @param {string} toolIdOrName - The unique ID (`ITool.id`) or functional name (`ITool.name`) of the tool.
|
|
165
|
+
* The manager will attempt to find a mapping using this identifier. Using `tool.id` is generally preferred
|
|
166
|
+
* for more stable mappings if tool names might change or be overloaded.
|
|
167
|
+
* @returns {FeatureFlag[] | undefined} An array of `FeatureFlag` objects (each with a `flag` string
|
|
168
|
+
* and optional `description`) required for the tool. Returns `undefined` if no specific features
|
|
169
|
+
* are mapped as required for this tool in the current configuration.
|
|
170
|
+
*/
|
|
171
|
+
getRequiredFeaturesForTool(toolIdOrName: string): FeatureFlag[] | undefined;
|
|
172
|
+
/**
|
|
173
|
+
* Checks if a user's current subscription grants them access to the specific features
|
|
174
|
+
* required by a particular tool. This method relies on an injected `ISubscriptionService`
|
|
175
|
+
* to fetch user tier information and validate feature entitlements.
|
|
176
|
+
*
|
|
177
|
+
* @public
|
|
178
|
+
* @async
|
|
179
|
+
* @param {string} userId - The ID of the user whose subscription entitlements are being verified.
|
|
180
|
+
* @param {string} toolIdOrName - The unique ID (`ITool.id`) or functional name (`ITool.name`) of the tool.
|
|
181
|
+
* This identifier is used to look up any feature flag prerequisites from the manager's configuration.
|
|
182
|
+
* @returns {Promise<{isAllowed: boolean, missingFeatures?: FeatureFlag[], reason?: string}>}
|
|
183
|
+
* An object detailing the outcome of the subscription check.
|
|
184
|
+
* @throws {GMIError} If critical services are misconfigured or if interaction with `ISubscriptionService` fails.
|
|
185
|
+
*/
|
|
186
|
+
checkToolSubscriptionAccess(userId: string, toolIdOrName: string): Promise<{
|
|
187
|
+
isAllowed: boolean;
|
|
188
|
+
missingFeatures?: FeatureFlag[];
|
|
189
|
+
reason?: string;
|
|
190
|
+
}>;
|
|
191
|
+
/**
|
|
192
|
+
* Determines if a tool execution is permitted based on the comprehensive provided context.
|
|
193
|
+
* This is the primary method for authorizing tool calls.
|
|
194
|
+
*
|
|
195
|
+
* @public
|
|
196
|
+
* @async
|
|
197
|
+
* @param {PermissionCheckContext} context - The context for the permission check.
|
|
198
|
+
* @returns {Promise<PermissionCheckResult>} A promise resolving to a `PermissionCheckResult`.
|
|
199
|
+
* @throws {GMIError} If the manager is not initialized or if an unrecoverable error occurs.
|
|
200
|
+
*/
|
|
201
|
+
isExecutionAllowed(context: PermissionCheckContext): Promise<PermissionCheckResult>;
|
|
202
|
+
}
|
|
203
|
+
//# sourceMappingURL=ToolPermissionManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToolPermissionManager.d.ts","sourceRoot":"","sources":["../../../../src/core/tools/permissions/ToolPermissionManager.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAEH,OAAO,EACL,sBAAsB,EACtB,sBAAsB,EACtB,qBAAqB,EACrB,2BAA2B,EAC3B,WAAW,EACZ,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,YAAY,EAAE,oBAAoB,EAAqB,MAAM,mCAAmC,CAAC;AAI/G;;;;;;;;;GASG;AACH,qBAAa,qBAAsB,YAAW,sBAAsB;IAClE;;;;;;;;OAQG;IACH,OAAO,CAAC,MAAM,CAAmD;IAEjE;;;;;;OAMG;IACH,OAAO,CAAC,WAAW,CAAC,CAAe;IAEnC;;;;;;OAMG;IACH,OAAO,CAAC,mBAAmB,CAAC,CAAuB;IAEnD;;;;;;OAMG;IACH,OAAO,CAAC,aAAa,CAAkB;IAEvC;;;;;;;OAOG;IACH,SAAgB,SAAS,EAAE,MAAM,CAAC;IAElC;;;;;OAKG;;IAKH;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACU,UAAU,CACrB,MAAM,EAAE,2BAA2B,EACnC,WAAW,CAAC,EAAE,YAAY,EAC1B,mBAAmB,CAAC,EAAE,oBAAoB,GACzC,OAAO,CAAC,IAAI,CAAC;IA+BhB;;;;;;;;;OASG;IACH,OAAO,CAAC,iBAAiB;IAUzB;;;;;;;;;;;;;;OAcG;IACI,uBAAuB,CAC5B,mBAAmB,EAAE,MAAM,EAAE,EAC7B,wBAAwB,EAAE,MAAM,EAAE,GAAG,SAAS,GAC7C,OAAO;IAqBV;;;;;;;;;;;;;OAaG;IACI,0BAA0B,CAAC,YAAY,EAAE,MAAM,GAAG,WAAW,EAAE,GAAG,SAAS;IAKlF;;;;;;;;;;;;;OAaG;IACU,2BAA2B,CACtC,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC;QAAC,SAAS,EAAE,OAAO,CAAC;QAAC,eAAe,CAAC,EAAE,WAAW,EAAE,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAC,CAAC;IAsDlF;;;;;;;;;OASG;IACU,kBAAkB,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,qBAAqB,CAAC;CAuDjG"}
|