@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.
Files changed (601) hide show
  1. package/LICENSE +98 -0
  2. package/README.md +576 -0
  3. package/dist/api/AgentOS.d.ts +451 -0
  4. package/dist/api/AgentOS.d.ts.map +1 -0
  5. package/dist/api/AgentOS.js +1157 -0
  6. package/dist/api/AgentOS.js.map +1 -0
  7. package/dist/api/AgentOSOrchestrator.d.ts +157 -0
  8. package/dist/api/AgentOSOrchestrator.d.ts.map +1 -0
  9. package/dist/api/AgentOSOrchestrator.js +679 -0
  10. package/dist/api/AgentOSOrchestrator.js.map +1 -0
  11. package/dist/api/interfaces/IAgentOS.d.ts +138 -0
  12. package/dist/api/interfaces/IAgentOS.d.ts.map +1 -0
  13. package/dist/api/interfaces/IAgentOS.js +11 -0
  14. package/dist/api/interfaces/IAgentOS.js.map +1 -0
  15. package/dist/api/interfaces/IUnifiedAgent.d.ts +126 -0
  16. package/dist/api/interfaces/IUnifiedAgent.d.ts.map +1 -0
  17. package/dist/api/interfaces/IUnifiedAgent.js +3 -0
  18. package/dist/api/interfaces/IUnifiedAgent.js.map +1 -0
  19. package/dist/api/types/AgentOSInput.d.ts +114 -0
  20. package/dist/api/types/AgentOSInput.d.ts.map +1 -0
  21. package/dist/api/types/AgentOSInput.js +13 -0
  22. package/dist/api/types/AgentOSInput.js.map +1 -0
  23. package/dist/api/types/AgentOSResponse.d.ts +170 -0
  24. package/dist/api/types/AgentOSResponse.d.ts.map +1 -0
  25. package/dist/api/types/AgentOSResponse.js +25 -0
  26. package/dist/api/types/AgentOSResponse.js.map +1 -0
  27. package/dist/cognitive_substrate/GMI.d.ts +148 -0
  28. package/dist/cognitive_substrate/GMI.d.ts.map +1 -0
  29. package/dist/cognitive_substrate/GMI.js +1003 -0
  30. package/dist/cognitive_substrate/GMI.js.map +1 -0
  31. package/dist/cognitive_substrate/GMIManager.d.ts +98 -0
  32. package/dist/cognitive_substrate/GMIManager.d.ts.map +1 -0
  33. package/dist/cognitive_substrate/GMIManager.js +517 -0
  34. package/dist/cognitive_substrate/GMIManager.js.map +1 -0
  35. package/dist/cognitive_substrate/IGMI.d.ts +469 -0
  36. package/dist/cognitive_substrate/IGMI.d.ts.map +1 -0
  37. package/dist/cognitive_substrate/IGMI.js +111 -0
  38. package/dist/cognitive_substrate/IGMI.js.map +1 -0
  39. package/dist/cognitive_substrate/memory/IWorkingMemory.d.ts +139 -0
  40. package/dist/cognitive_substrate/memory/IWorkingMemory.d.ts.map +1 -0
  41. package/dist/cognitive_substrate/memory/IWorkingMemory.js +14 -0
  42. package/dist/cognitive_substrate/memory/IWorkingMemory.js.map +1 -0
  43. package/dist/cognitive_substrate/memory/InMemoryWorkingMemory.d.ts +143 -0
  44. package/dist/cognitive_substrate/memory/InMemoryWorkingMemory.d.ts.map +1 -0
  45. package/dist/cognitive_substrate/memory/InMemoryWorkingMemory.js +186 -0
  46. package/dist/cognitive_substrate/memory/InMemoryWorkingMemory.js.map +1 -0
  47. package/dist/cognitive_substrate/persona_overlays/PersonaOverlayManager.d.ts +33 -0
  48. package/dist/cognitive_substrate/persona_overlays/PersonaOverlayManager.d.ts.map +1 -0
  49. package/dist/cognitive_substrate/persona_overlays/PersonaOverlayManager.js +138 -0
  50. package/dist/cognitive_substrate/persona_overlays/PersonaOverlayManager.js.map +1 -0
  51. package/dist/cognitive_substrate/persona_overlays/PersonaOverlayTypes.d.ts +32 -0
  52. package/dist/cognitive_substrate/persona_overlays/PersonaOverlayTypes.d.ts.map +1 -0
  53. package/dist/cognitive_substrate/persona_overlays/PersonaOverlayTypes.js +2 -0
  54. package/dist/cognitive_substrate/persona_overlays/PersonaOverlayTypes.js.map +1 -0
  55. package/dist/cognitive_substrate/personas/IPersonaDefinition.d.ts +336 -0
  56. package/dist/cognitive_substrate/personas/IPersonaDefinition.d.ts.map +1 -0
  57. package/dist/cognitive_substrate/personas/IPersonaDefinition.js +8 -0
  58. package/dist/cognitive_substrate/personas/IPersonaDefinition.js.map +1 -0
  59. package/dist/cognitive_substrate/personas/IPersonaLoader.d.ts +78 -0
  60. package/dist/cognitive_substrate/personas/IPersonaLoader.d.ts.map +1 -0
  61. package/dist/cognitive_substrate/personas/IPersonaLoader.js +9 -0
  62. package/dist/cognitive_substrate/personas/IPersonaLoader.js.map +1 -0
  63. package/dist/cognitive_substrate/personas/PersonaLoader.d.ts +60 -0
  64. package/dist/cognitive_substrate/personas/PersonaLoader.d.ts.map +1 -0
  65. package/dist/cognitive_substrate/personas/PersonaLoader.js +138 -0
  66. package/dist/cognitive_substrate/personas/PersonaLoader.js.map +1 -0
  67. package/dist/cognitive_substrate/personas/PersonaValidation.d.ts +139 -0
  68. package/dist/cognitive_substrate/personas/PersonaValidation.d.ts.map +1 -0
  69. package/dist/cognitive_substrate/personas/PersonaValidation.js +277 -0
  70. package/dist/cognitive_substrate/personas/PersonaValidation.js.map +1 -0
  71. package/dist/cognitive_substrate/personas/definitions/atlas_systems_architect.json +29 -0
  72. package/dist/cognitive_substrate/personas/definitions/default_assistant_persona.json +346 -0
  73. package/dist/cognitive_substrate/personas/definitions/default_free_assistant.json +13 -0
  74. package/dist/cognitive_substrate/personas/definitions/index.d.ts +14 -0
  75. package/dist/cognitive_substrate/personas/definitions/index.d.ts.map +1 -0
  76. package/dist/cognitive_substrate/personas/definitions/index.js +35 -0
  77. package/dist/cognitive_substrate/personas/definitions/index.js.map +1 -0
  78. package/dist/cognitive_substrate/personas/definitions/nerf_generalist.json +11 -0
  79. package/dist/cognitive_substrate/personas/definitions/v_researcher.json +11 -0
  80. package/dist/config/AgentOSConfig.d.ts +74 -0
  81. package/dist/config/AgentOSConfig.d.ts.map +1 -0
  82. package/dist/config/AgentOSConfig.js +399 -0
  83. package/dist/config/AgentOSConfig.js.map +1 -0
  84. package/dist/config/EmbeddingManagerConfiguration.d.ts +190 -0
  85. package/dist/config/EmbeddingManagerConfiguration.d.ts.map +1 -0
  86. package/dist/config/EmbeddingManagerConfiguration.js +16 -0
  87. package/dist/config/EmbeddingManagerConfiguration.js.map +1 -0
  88. package/dist/config/MemoryLifecycleManagerConfiguration.d.ts +165 -0
  89. package/dist/config/MemoryLifecycleManagerConfiguration.d.ts.map +1 -0
  90. package/dist/config/MemoryLifecycleManagerConfiguration.js +69 -0
  91. package/dist/config/MemoryLifecycleManagerConfiguration.js.map +1 -0
  92. package/dist/config/RetrievalAugmentorConfiguration.d.ts +98 -0
  93. package/dist/config/RetrievalAugmentorConfiguration.d.ts.map +1 -0
  94. package/dist/config/RetrievalAugmentorConfiguration.js +47 -0
  95. package/dist/config/RetrievalAugmentorConfiguration.js.map +1 -0
  96. package/dist/config/ToolOrchestratorConfig.d.ts +69 -0
  97. package/dist/config/ToolOrchestratorConfig.d.ts.map +1 -0
  98. package/dist/config/ToolOrchestratorConfig.js +11 -0
  99. package/dist/config/ToolOrchestratorConfig.js.map +1 -0
  100. package/dist/config/VectorStoreConfiguration.d.ts +223 -0
  101. package/dist/config/VectorStoreConfiguration.d.ts.map +1 -0
  102. package/dist/config/VectorStoreConfiguration.js +59 -0
  103. package/dist/config/VectorStoreConfiguration.js.map +1 -0
  104. package/dist/config/extension-secrets.json +38 -0
  105. package/dist/config/extensionSecrets.d.ts +13 -0
  106. package/dist/config/extensionSecrets.d.ts.map +1 -0
  107. package/dist/config/extensionSecrets.js +24 -0
  108. package/dist/config/extensionSecrets.js.map +1 -0
  109. package/dist/core/agency/AgencyMemoryManager.d.ts +300 -0
  110. package/dist/core/agency/AgencyMemoryManager.d.ts.map +1 -0
  111. package/dist/core/agency/AgencyMemoryManager.js +657 -0
  112. package/dist/core/agency/AgencyMemoryManager.js.map +1 -0
  113. package/dist/core/agency/AgencyRegistry.d.ts +100 -0
  114. package/dist/core/agency/AgencyRegistry.d.ts.map +1 -0
  115. package/dist/core/agency/AgencyRegistry.js +209 -0
  116. package/dist/core/agency/AgencyRegistry.js.map +1 -0
  117. package/dist/core/agency/AgencyTypes.d.ts +200 -0
  118. package/dist/core/agency/AgencyTypes.d.ts.map +1 -0
  119. package/dist/core/agency/AgencyTypes.js +7 -0
  120. package/dist/core/agency/AgencyTypes.js.map +1 -0
  121. package/dist/core/agency/AgentCommunicationBus.d.ts +150 -0
  122. package/dist/core/agency/AgentCommunicationBus.d.ts.map +1 -0
  123. package/dist/core/agency/AgentCommunicationBus.js +568 -0
  124. package/dist/core/agency/AgentCommunicationBus.js.map +1 -0
  125. package/dist/core/agency/IAgentCommunicationBus.d.ts +469 -0
  126. package/dist/core/agency/IAgentCommunicationBus.d.ts.map +1 -0
  127. package/dist/core/agency/IAgentCommunicationBus.js +40 -0
  128. package/dist/core/agency/IAgentCommunicationBus.js.map +1 -0
  129. package/dist/core/agency/index.d.ts +18 -0
  130. package/dist/core/agency/index.d.ts.map +1 -0
  131. package/dist/core/agency/index.js +18 -0
  132. package/dist/core/agency/index.js.map +1 -0
  133. package/dist/core/agents/AgentCore.d.ts +385 -0
  134. package/dist/core/agents/AgentCore.d.ts.map +1 -0
  135. package/dist/core/agents/AgentCore.js +527 -0
  136. package/dist/core/agents/AgentCore.js.map +1 -0
  137. package/dist/core/agents/AgentFactory.d.ts +123 -0
  138. package/dist/core/agents/AgentFactory.d.ts.map +1 -0
  139. package/dist/core/agents/AgentFactory.js +232 -0
  140. package/dist/core/agents/AgentFactory.js.map +1 -0
  141. package/dist/core/agents/AgentPoolAgent.d.ts +244 -0
  142. package/dist/core/agents/AgentPoolAgent.d.ts.map +1 -0
  143. package/dist/core/agents/AgentPoolAgent.js +697 -0
  144. package/dist/core/agents/AgentPoolAgent.js.map +1 -0
  145. package/dist/core/agents/AgentPoolConfig.d.ts +191 -0
  146. package/dist/core/agents/AgentPoolConfig.d.ts.map +1 -0
  147. package/dist/core/agents/AgentPoolConfig.js +58 -0
  148. package/dist/core/agents/AgentPoolConfig.js.map +1 -0
  149. package/dist/core/agents/IAgent.d.ts +226 -0
  150. package/dist/core/agents/IAgent.d.ts.map +1 -0
  151. package/dist/core/agents/IAgent.js +14 -0
  152. package/dist/core/agents/IAgent.js.map +1 -0
  153. package/dist/core/agents/IAgentFactory.d.ts +137 -0
  154. package/dist/core/agents/IAgentFactory.d.ts.map +1 -0
  155. package/dist/core/agents/IAgentFactory.js +13 -0
  156. package/dist/core/agents/IAgentFactory.js.map +1 -0
  157. package/dist/core/agents/tools/Tool.d.ts +17 -0
  158. package/dist/core/agents/tools/Tool.d.ts.map +1 -0
  159. package/dist/core/agents/tools/Tool.js +8 -0
  160. package/dist/core/agents/tools/Tool.js.map +1 -0
  161. package/dist/core/ai_utilities/HybridUtilityAI.d.ts +1 -0
  162. package/dist/core/ai_utilities/HybridUtilityAI.d.ts.map +1 -0
  163. package/dist/core/ai_utilities/HybridUtilityAI.js +2 -0
  164. package/dist/core/ai_utilities/HybridUtilityAI.js.map +1 -0
  165. package/dist/core/ai_utilities/IUtilityAI.d.ts +212 -0
  166. package/dist/core/ai_utilities/IUtilityAI.d.ts.map +1 -0
  167. package/dist/core/ai_utilities/IUtilityAI.js +11 -0
  168. package/dist/core/ai_utilities/IUtilityAI.js.map +1 -0
  169. package/dist/core/ai_utilities/LLMUtilityAI.d.ts +94 -0
  170. package/dist/core/ai_utilities/LLMUtilityAI.d.ts.map +1 -0
  171. package/dist/core/ai_utilities/LLMUtilityAI.js +434 -0
  172. package/dist/core/ai_utilities/LLMUtilityAI.js.map +1 -0
  173. package/dist/core/ai_utilities/StatisticalUtilityAI.d.ts +102 -0
  174. package/dist/core/ai_utilities/StatisticalUtilityAI.d.ts.map +1 -0
  175. package/dist/core/ai_utilities/StatisticalUtilityAI.js +617 -0
  176. package/dist/core/ai_utilities/StatisticalUtilityAI.js.map +1 -0
  177. package/dist/core/conversation/ConversationContext.d.ts +259 -0
  178. package/dist/core/conversation/ConversationContext.d.ts.map +1 -0
  179. package/dist/core/conversation/ConversationContext.js +450 -0
  180. package/dist/core/conversation/ConversationContext.js.map +1 -0
  181. package/dist/core/conversation/ConversationManager.d.ts +223 -0
  182. package/dist/core/conversation/ConversationManager.d.ts.map +1 -0
  183. package/dist/core/conversation/ConversationManager.js +558 -0
  184. package/dist/core/conversation/ConversationManager.js.map +1 -0
  185. package/dist/core/conversation/ConversationMessage.d.ts +184 -0
  186. package/dist/core/conversation/ConversationMessage.d.ts.map +1 -0
  187. package/dist/core/conversation/ConversationMessage.js +66 -0
  188. package/dist/core/conversation/ConversationMessage.js.map +1 -0
  189. package/dist/core/evaluation/Evaluator.d.ts +28 -0
  190. package/dist/core/evaluation/Evaluator.d.ts.map +1 -0
  191. package/dist/core/evaluation/Evaluator.js +490 -0
  192. package/dist/core/evaluation/Evaluator.js.map +1 -0
  193. package/dist/core/evaluation/IEvaluator.d.ts +309 -0
  194. package/dist/core/evaluation/IEvaluator.d.ts.map +1 -0
  195. package/dist/core/evaluation/IEvaluator.js +12 -0
  196. package/dist/core/evaluation/IEvaluator.js.map +1 -0
  197. package/dist/core/evaluation/LLMJudge.d.ts +105 -0
  198. package/dist/core/evaluation/LLMJudge.d.ts.map +1 -0
  199. package/dist/core/evaluation/LLMJudge.js +229 -0
  200. package/dist/core/evaluation/LLMJudge.js.map +1 -0
  201. package/dist/core/evaluation/index.d.ts +9 -0
  202. package/dist/core/evaluation/index.d.ts.map +1 -0
  203. package/dist/core/evaluation/index.js +9 -0
  204. package/dist/core/evaluation/index.js.map +1 -0
  205. package/dist/core/guardrails/IGuardrailService.d.ts +142 -0
  206. package/dist/core/guardrails/IGuardrailService.d.ts.map +1 -0
  207. package/dist/core/guardrails/IGuardrailService.js +24 -0
  208. package/dist/core/guardrails/IGuardrailService.js.map +1 -0
  209. package/dist/core/guardrails/guardrailDispatcher.d.ts +36 -0
  210. package/dist/core/guardrails/guardrailDispatcher.d.ts.map +1 -0
  211. package/dist/core/guardrails/guardrailDispatcher.js +240 -0
  212. package/dist/core/guardrails/guardrailDispatcher.js.map +1 -0
  213. package/dist/core/hitl/HumanInteractionManager.d.ts +146 -0
  214. package/dist/core/hitl/HumanInteractionManager.d.ts.map +1 -0
  215. package/dist/core/hitl/HumanInteractionManager.js +491 -0
  216. package/dist/core/hitl/HumanInteractionManager.js.map +1 -0
  217. package/dist/core/hitl/IHumanInteractionManager.d.ts +521 -0
  218. package/dist/core/hitl/IHumanInteractionManager.d.ts.map +1 -0
  219. package/dist/core/hitl/IHumanInteractionManager.js +33 -0
  220. package/dist/core/hitl/IHumanInteractionManager.js.map +1 -0
  221. package/dist/core/hitl/index.d.ts +17 -0
  222. package/dist/core/hitl/index.d.ts.map +1 -0
  223. package/dist/core/hitl/index.js +17 -0
  224. package/dist/core/hitl/index.js.map +1 -0
  225. package/dist/core/knowledge/IKnowledgeGraph.d.ts +351 -0
  226. package/dist/core/knowledge/IKnowledgeGraph.d.ts.map +1 -0
  227. package/dist/core/knowledge/IKnowledgeGraph.js +10 -0
  228. package/dist/core/knowledge/IKnowledgeGraph.js.map +1 -0
  229. package/dist/core/knowledge/KnowledgeGraph.d.ts +93 -0
  230. package/dist/core/knowledge/KnowledgeGraph.d.ts.map +1 -0
  231. package/dist/core/knowledge/KnowledgeGraph.js +601 -0
  232. package/dist/core/knowledge/KnowledgeGraph.js.map +1 -0
  233. package/dist/core/knowledge/index.d.ts +8 -0
  234. package/dist/core/knowledge/index.d.ts.map +1 -0
  235. package/dist/core/knowledge/index.js +8 -0
  236. package/dist/core/knowledge/index.js.map +1 -0
  237. package/dist/core/language/LanguageService.d.ts +77 -0
  238. package/dist/core/language/LanguageService.d.ts.map +1 -0
  239. package/dist/core/language/LanguageService.js +305 -0
  240. package/dist/core/language/LanguageService.js.map +1 -0
  241. package/dist/core/language/index.d.ts +6 -0
  242. package/dist/core/language/index.d.ts.map +1 -0
  243. package/dist/core/language/index.js +6 -0
  244. package/dist/core/language/index.js.map +1 -0
  245. package/dist/core/language/interfaces.d.ts +168 -0
  246. package/dist/core/language/interfaces.d.ts.map +1 -0
  247. package/dist/core/language/interfaces.js +37 -0
  248. package/dist/core/language/interfaces.js.map +1 -0
  249. package/dist/core/language/providers/DeepLTranslationProvider.d.ts +16 -0
  250. package/dist/core/language/providers/DeepLTranslationProvider.d.ts.map +1 -0
  251. package/dist/core/language/providers/DeepLTranslationProvider.js +28 -0
  252. package/dist/core/language/providers/DeepLTranslationProvider.js.map +1 -0
  253. package/dist/core/language/providers/OpenAITranslationProvider.d.ts +17 -0
  254. package/dist/core/language/providers/OpenAITranslationProvider.d.ts.map +1 -0
  255. package/dist/core/language/providers/OpenAITranslationProvider.js +34 -0
  256. package/dist/core/language/providers/OpenAITranslationProvider.js.map +1 -0
  257. package/dist/core/language/providers/WhisperDetectionProvider.d.ts +16 -0
  258. package/dist/core/language/providers/WhisperDetectionProvider.d.ts.map +1 -0
  259. package/dist/core/language/providers/WhisperDetectionProvider.js +15 -0
  260. package/dist/core/language/providers/WhisperDetectionProvider.js.map +1 -0
  261. package/dist/core/llm/IPromptEngine.d.ts +627 -0
  262. package/dist/core/llm/IPromptEngine.d.ts.map +1 -0
  263. package/dist/core/llm/IPromptEngine.js +81 -0
  264. package/dist/core/llm/IPromptEngine.js.map +1 -0
  265. package/dist/core/llm/PromptEngine.d.ts +108 -0
  266. package/dist/core/llm/PromptEngine.d.ts.map +1 -0
  267. package/dist/core/llm/PromptEngine.js +872 -0
  268. package/dist/core/llm/PromptEngine.js.map +1 -0
  269. package/dist/core/llm/providers/AIModelProviderManager.d.ts +74 -0
  270. package/dist/core/llm/providers/AIModelProviderManager.d.ts.map +1 -0
  271. package/dist/core/llm/providers/AIModelProviderManager.js +263 -0
  272. package/dist/core/llm/providers/AIModelProviderManager.js.map +1 -0
  273. package/dist/core/llm/providers/IProvider.d.ts +327 -0
  274. package/dist/core/llm/providers/IProvider.d.ts.map +1 -0
  275. package/dist/core/llm/providers/IProvider.js +39 -0
  276. package/dist/core/llm/providers/IProvider.js.map +1 -0
  277. package/dist/core/llm/providers/errors/OllamaProviderError.d.ts +36 -0
  278. package/dist/core/llm/providers/errors/OllamaProviderError.d.ts.map +1 -0
  279. package/dist/core/llm/providers/errors/OllamaProviderError.js +40 -0
  280. package/dist/core/llm/providers/errors/OllamaProviderError.js.map +1 -0
  281. package/dist/core/llm/providers/errors/OpenAIProviderError.d.ts +42 -0
  282. package/dist/core/llm/providers/errors/OpenAIProviderError.d.ts.map +1 -0
  283. package/dist/core/llm/providers/errors/OpenAIProviderError.js +44 -0
  284. package/dist/core/llm/providers/errors/OpenAIProviderError.js.map +1 -0
  285. package/dist/core/llm/providers/errors/OpenRouterProviderError.d.ts +39 -0
  286. package/dist/core/llm/providers/errors/OpenRouterProviderError.d.ts.map +1 -0
  287. package/dist/core/llm/providers/errors/OpenRouterProviderError.js +42 -0
  288. package/dist/core/llm/providers/errors/OpenRouterProviderError.js.map +1 -0
  289. package/dist/core/llm/providers/errors/ProviderError.d.ts +37 -0
  290. package/dist/core/llm/providers/errors/ProviderError.d.ts.map +1 -0
  291. package/dist/core/llm/providers/errors/ProviderError.js +36 -0
  292. package/dist/core/llm/providers/errors/ProviderError.js.map +1 -0
  293. package/dist/core/llm/providers/implementations/OllamaProvider.d.ts +80 -0
  294. package/dist/core/llm/providers/implementations/OllamaProvider.d.ts.map +1 -0
  295. package/dist/core/llm/providers/implementations/OllamaProvider.js +473 -0
  296. package/dist/core/llm/providers/implementations/OllamaProvider.js.map +1 -0
  297. package/dist/core/llm/providers/implementations/OpenAIProvider.d.ts +160 -0
  298. package/dist/core/llm/providers/implementations/OpenAIProvider.d.ts.map +1 -0
  299. package/dist/core/llm/providers/implementations/OpenAIProvider.js +672 -0
  300. package/dist/core/llm/providers/implementations/OpenAIProvider.js.map +1 -0
  301. package/dist/core/llm/providers/implementations/OpenRouterProvider.d.ts +51 -0
  302. package/dist/core/llm/providers/implementations/OpenRouterProvider.d.ts.map +1 -0
  303. package/dist/core/llm/providers/implementations/OpenRouterProvider.js +499 -0
  304. package/dist/core/llm/providers/implementations/OpenRouterProvider.js.map +1 -0
  305. package/dist/core/llm/routing/IModelRouter.d.ts +129 -0
  306. package/dist/core/llm/routing/IModelRouter.d.ts.map +1 -0
  307. package/dist/core/llm/routing/IModelRouter.js +14 -0
  308. package/dist/core/llm/routing/IModelRouter.js.map +1 -0
  309. package/dist/core/llm/routing/ModelRouter.d.ts +157 -0
  310. package/dist/core/llm/routing/ModelRouter.d.ts.map +1 -0
  311. package/dist/core/llm/routing/ModelRouter.js +190 -0
  312. package/dist/core/llm/routing/ModelRouter.js.map +1 -0
  313. package/dist/core/llm/streaming/StreamingBatcher.d.ts +54 -0
  314. package/dist/core/llm/streaming/StreamingBatcher.d.ts.map +1 -0
  315. package/dist/core/llm/streaming/StreamingBatcher.js +173 -0
  316. package/dist/core/llm/streaming/StreamingBatcher.js.map +1 -0
  317. package/dist/core/llm/streaming/StreamingReconstructor.d.ts +69 -0
  318. package/dist/core/llm/streaming/StreamingReconstructor.d.ts.map +1 -0
  319. package/dist/core/llm/streaming/StreamingReconstructor.js +102 -0
  320. package/dist/core/llm/streaming/StreamingReconstructor.js.map +1 -0
  321. package/dist/core/marketplace/IMarketplace.d.ts +500 -0
  322. package/dist/core/marketplace/IMarketplace.d.ts.map +1 -0
  323. package/dist/core/marketplace/IMarketplace.js +10 -0
  324. package/dist/core/marketplace/IMarketplace.js.map +1 -0
  325. package/dist/core/marketplace/Marketplace.d.ts +122 -0
  326. package/dist/core/marketplace/Marketplace.d.ts.map +1 -0
  327. package/dist/core/marketplace/Marketplace.js +591 -0
  328. package/dist/core/marketplace/Marketplace.js.map +1 -0
  329. package/dist/core/marketplace/index.d.ts +8 -0
  330. package/dist/core/marketplace/index.d.ts.map +1 -0
  331. package/dist/core/marketplace/index.js +8 -0
  332. package/dist/core/marketplace/index.js.map +1 -0
  333. package/dist/core/observability/ITracer.d.ts +317 -0
  334. package/dist/core/observability/ITracer.d.ts.map +1 -0
  335. package/dist/core/observability/ITracer.js +55 -0
  336. package/dist/core/observability/ITracer.js.map +1 -0
  337. package/dist/core/observability/Tracer.d.ts +76 -0
  338. package/dist/core/observability/Tracer.d.ts.map +1 -0
  339. package/dist/core/observability/Tracer.js +360 -0
  340. package/dist/core/observability/Tracer.js.map +1 -0
  341. package/dist/core/observability/index.d.ts +9 -0
  342. package/dist/core/observability/index.d.ts.map +1 -0
  343. package/dist/core/observability/index.js +8 -0
  344. package/dist/core/observability/index.js.map +1 -0
  345. package/dist/core/orchestration/AgentOrchestrator.d.ts +243 -0
  346. package/dist/core/orchestration/AgentOrchestrator.d.ts.map +1 -0
  347. package/dist/core/orchestration/AgentOrchestrator.js +648 -0
  348. package/dist/core/orchestration/AgentOrchestrator.js.map +1 -0
  349. package/dist/core/orchestration/IAgentOrchestrator.d.ts +44 -0
  350. package/dist/core/orchestration/IAgentOrchestrator.d.ts.map +1 -0
  351. package/dist/core/orchestration/IAgentOrchestrator.js +4 -0
  352. package/dist/core/orchestration/IAgentOrchestrator.js.map +1 -0
  353. package/dist/core/orchestration/helpers.d.ts +12 -0
  354. package/dist/core/orchestration/helpers.d.ts.map +1 -0
  355. package/dist/core/orchestration/helpers.js +36 -0
  356. package/dist/core/orchestration/helpers.js.map +1 -0
  357. package/dist/core/planning/IPlanningEngine.d.ts +524 -0
  358. package/dist/core/planning/IPlanningEngine.d.ts.map +1 -0
  359. package/dist/core/planning/IPlanningEngine.js +32 -0
  360. package/dist/core/planning/IPlanningEngine.js.map +1 -0
  361. package/dist/core/planning/PlanningEngine.d.ts +161 -0
  362. package/dist/core/planning/PlanningEngine.d.ts.map +1 -0
  363. package/dist/core/planning/PlanningEngine.js +783 -0
  364. package/dist/core/planning/PlanningEngine.js.map +1 -0
  365. package/dist/core/planning/index.d.ts +25 -0
  366. package/dist/core/planning/index.d.ts.map +1 -0
  367. package/dist/core/planning/index.js +25 -0
  368. package/dist/core/planning/index.js.map +1 -0
  369. package/dist/core/sandbox/CodeSandbox.d.ts +86 -0
  370. package/dist/core/sandbox/CodeSandbox.d.ts.map +1 -0
  371. package/dist/core/sandbox/CodeSandbox.js +475 -0
  372. package/dist/core/sandbox/CodeSandbox.js.map +1 -0
  373. package/dist/core/sandbox/ICodeSandbox.d.ts +249 -0
  374. package/dist/core/sandbox/ICodeSandbox.d.ts.map +1 -0
  375. package/dist/core/sandbox/ICodeSandbox.js +24 -0
  376. package/dist/core/sandbox/ICodeSandbox.js.map +1 -0
  377. package/dist/core/sandbox/index.d.ts +9 -0
  378. package/dist/core/sandbox/index.d.ts.map +1 -0
  379. package/dist/core/sandbox/index.js +8 -0
  380. package/dist/core/sandbox/index.js.map +1 -0
  381. package/dist/core/storage/IStorageAdapter.d.ts +483 -0
  382. package/dist/core/storage/IStorageAdapter.d.ts.map +1 -0
  383. package/dist/core/storage/IStorageAdapter.js +19 -0
  384. package/dist/core/storage/IStorageAdapter.js.map +1 -0
  385. package/dist/core/storage/InMemoryStorageAdapter.d.ts +192 -0
  386. package/dist/core/storage/InMemoryStorageAdapter.d.ts.map +1 -0
  387. package/dist/core/storage/InMemoryStorageAdapter.js +343 -0
  388. package/dist/core/storage/InMemoryStorageAdapter.js.map +1 -0
  389. package/dist/core/storage/SqlStorageAdapter.d.ts +262 -0
  390. package/dist/core/storage/SqlStorageAdapter.d.ts.map +1 -0
  391. package/dist/core/storage/SqlStorageAdapter.js +485 -0
  392. package/dist/core/storage/SqlStorageAdapter.js.map +1 -0
  393. package/dist/core/storage/index.d.ts +14 -0
  394. package/dist/core/storage/index.d.ts.map +1 -0
  395. package/dist/core/storage/index.js +14 -0
  396. package/dist/core/storage/index.js.map +1 -0
  397. package/dist/core/streaming/IStreamClient.d.ts +72 -0
  398. package/dist/core/streaming/IStreamClient.d.ts.map +1 -0
  399. package/dist/core/streaming/IStreamClient.js +12 -0
  400. package/dist/core/streaming/IStreamClient.js.map +1 -0
  401. package/dist/core/streaming/StreamingManager.d.ts +242 -0
  402. package/dist/core/streaming/StreamingManager.d.ts.map +1 -0
  403. package/dist/core/streaming/StreamingManager.js +282 -0
  404. package/dist/core/streaming/StreamingManager.js.map +1 -0
  405. package/dist/core/structured/IStructuredOutputManager.d.ts +701 -0
  406. package/dist/core/structured/IStructuredOutputManager.d.ts.map +1 -0
  407. package/dist/core/structured/IStructuredOutputManager.js +74 -0
  408. package/dist/core/structured/IStructuredOutputManager.js.map +1 -0
  409. package/dist/core/structured/StructuredOutputManager.d.ts +140 -0
  410. package/dist/core/structured/StructuredOutputManager.d.ts.map +1 -0
  411. package/dist/core/structured/StructuredOutputManager.js +1015 -0
  412. package/dist/core/structured/StructuredOutputManager.js.map +1 -0
  413. package/dist/core/structured/index.d.ts +34 -0
  414. package/dist/core/structured/index.d.ts.map +1 -0
  415. package/dist/core/structured/index.js +34 -0
  416. package/dist/core/structured/index.js.map +1 -0
  417. package/dist/core/tools/ITool.d.ts +228 -0
  418. package/dist/core/tools/ITool.d.ts.map +1 -0
  419. package/dist/core/tools/ITool.js +11 -0
  420. package/dist/core/tools/ITool.js.map +1 -0
  421. package/dist/core/tools/IToolOrchestrator.d.ts +131 -0
  422. package/dist/core/tools/IToolOrchestrator.d.ts.map +1 -0
  423. package/dist/core/tools/IToolOrchestrator.js +14 -0
  424. package/dist/core/tools/IToolOrchestrator.js.map +1 -0
  425. package/dist/core/tools/ToolExecutor.d.ts +143 -0
  426. package/dist/core/tools/ToolExecutor.d.ts.map +1 -0
  427. package/dist/core/tools/ToolExecutor.js +364 -0
  428. package/dist/core/tools/ToolExecutor.js.map +1 -0
  429. package/dist/core/tools/ToolOrchestrator.d.ts +142 -0
  430. package/dist/core/tools/ToolOrchestrator.d.ts.map +1 -0
  431. package/dist/core/tools/ToolOrchestrator.js +373 -0
  432. package/dist/core/tools/ToolOrchestrator.js.map +1 -0
  433. package/dist/core/tools/permissions/IToolPermissionManager.d.ts +195 -0
  434. package/dist/core/tools/permissions/IToolPermissionManager.d.ts.map +1 -0
  435. package/dist/core/tools/permissions/IToolPermissionManager.js +14 -0
  436. package/dist/core/tools/permissions/IToolPermissionManager.js.map +1 -0
  437. package/dist/core/tools/permissions/ToolPermissionManager.d.ts +203 -0
  438. package/dist/core/tools/permissions/ToolPermissionManager.d.ts.map +1 -0
  439. package/dist/core/tools/permissions/ToolPermissionManager.js +298 -0
  440. package/dist/core/tools/permissions/ToolPermissionManager.js.map +1 -0
  441. package/dist/core/ui/IUIComponent.d.ts +11 -0
  442. package/dist/core/ui/IUIComponent.d.ts.map +1 -0
  443. package/dist/core/ui/IUIComponent.js +2 -0
  444. package/dist/core/ui/IUIComponent.js.map +1 -0
  445. package/dist/core/usage/UsageLedger.d.ts +81 -0
  446. package/dist/core/usage/UsageLedger.d.ts.map +1 -0
  447. package/dist/core/usage/UsageLedger.js +135 -0
  448. package/dist/core/usage/UsageLedger.js.map +1 -0
  449. package/dist/core/workflows/IWorkflowEngine.d.ts +42 -0
  450. package/dist/core/workflows/IWorkflowEngine.d.ts.map +1 -0
  451. package/dist/core/workflows/IWorkflowEngine.js +2 -0
  452. package/dist/core/workflows/IWorkflowEngine.js.map +1 -0
  453. package/dist/core/workflows/WorkflowEngine.d.ts +28 -0
  454. package/dist/core/workflows/WorkflowEngine.d.ts.map +1 -0
  455. package/dist/core/workflows/WorkflowEngine.js +309 -0
  456. package/dist/core/workflows/WorkflowEngine.js.map +1 -0
  457. package/dist/core/workflows/WorkflowTypes.d.ts +180 -0
  458. package/dist/core/workflows/WorkflowTypes.d.ts.map +1 -0
  459. package/dist/core/workflows/WorkflowTypes.js +26 -0
  460. package/dist/core/workflows/WorkflowTypes.js.map +1 -0
  461. package/dist/core/workflows/runtime/WorkflowRuntime.d.ts +70 -0
  462. package/dist/core/workflows/runtime/WorkflowRuntime.d.ts.map +1 -0
  463. package/dist/core/workflows/runtime/WorkflowRuntime.js +566 -0
  464. package/dist/core/workflows/runtime/WorkflowRuntime.js.map +1 -0
  465. package/dist/core/workflows/storage/IWorkflowStore.d.ts +75 -0
  466. package/dist/core/workflows/storage/IWorkflowStore.d.ts.map +1 -0
  467. package/dist/core/workflows/storage/IWorkflowStore.js +2 -0
  468. package/dist/core/workflows/storage/IWorkflowStore.js.map +1 -0
  469. package/dist/core/workflows/storage/InMemoryWorkflowStore.d.ts +14 -0
  470. package/dist/core/workflows/storage/InMemoryWorkflowStore.d.ts.map +1 -0
  471. package/dist/core/workflows/storage/InMemoryWorkflowStore.js +130 -0
  472. package/dist/core/workflows/storage/InMemoryWorkflowStore.js.map +1 -0
  473. package/dist/extensions/ExtensionLoader.d.ts +119 -0
  474. package/dist/extensions/ExtensionLoader.d.ts.map +1 -0
  475. package/dist/extensions/ExtensionLoader.js +297 -0
  476. package/dist/extensions/ExtensionLoader.js.map +1 -0
  477. package/dist/extensions/ExtensionManager.d.ts +49 -0
  478. package/dist/extensions/ExtensionManager.d.ts.map +1 -0
  479. package/dist/extensions/ExtensionManager.js +197 -0
  480. package/dist/extensions/ExtensionManager.js.map +1 -0
  481. package/dist/extensions/ExtensionRegistry.d.ts +39 -0
  482. package/dist/extensions/ExtensionRegistry.d.ts.map +1 -0
  483. package/dist/extensions/ExtensionRegistry.js +103 -0
  484. package/dist/extensions/ExtensionRegistry.js.map +1 -0
  485. package/dist/extensions/MultiRegistryLoader.d.ts +61 -0
  486. package/dist/extensions/MultiRegistryLoader.d.ts.map +1 -0
  487. package/dist/extensions/MultiRegistryLoader.js +169 -0
  488. package/dist/extensions/MultiRegistryLoader.js.map +1 -0
  489. package/dist/extensions/RegistryConfig.d.ts +86 -0
  490. package/dist/extensions/RegistryConfig.d.ts.map +1 -0
  491. package/dist/extensions/RegistryConfig.js +99 -0
  492. package/dist/extensions/RegistryConfig.js.map +1 -0
  493. package/dist/extensions/events.d.ts +19 -0
  494. package/dist/extensions/events.d.ts.map +1 -0
  495. package/dist/extensions/events.js +2 -0
  496. package/dist/extensions/events.js.map +1 -0
  497. package/dist/extensions/index.d.ts +9 -0
  498. package/dist/extensions/index.d.ts.map +1 -0
  499. package/dist/extensions/index.js +9 -0
  500. package/dist/extensions/index.js.map +1 -0
  501. package/dist/extensions/manifest.d.ts +52 -0
  502. package/dist/extensions/manifest.d.ts.map +1 -0
  503. package/dist/extensions/manifest.js +2 -0
  504. package/dist/extensions/manifest.js.map +1 -0
  505. package/dist/extensions/types.d.ts +294 -0
  506. package/dist/extensions/types.d.ts.map +1 -0
  507. package/dist/extensions/types.js +12 -0
  508. package/dist/extensions/types.js.map +1 -0
  509. package/dist/index.d.ts +49 -0
  510. package/dist/index.d.ts.map +1 -0
  511. package/dist/index.js +59 -0
  512. package/dist/index.js.map +1 -0
  513. package/dist/logging/ILogger.d.ts +8 -0
  514. package/dist/logging/ILogger.d.ts.map +1 -0
  515. package/dist/logging/ILogger.js +2 -0
  516. package/dist/logging/ILogger.js.map +1 -0
  517. package/dist/logging/PinoLogger.d.ts +12 -0
  518. package/dist/logging/PinoLogger.d.ts.map +1 -0
  519. package/dist/logging/PinoLogger.js +22 -0
  520. package/dist/logging/PinoLogger.js.map +1 -0
  521. package/dist/logging/loggerFactory.d.ts +6 -0
  522. package/dist/logging/loggerFactory.d.ts.map +1 -0
  523. package/dist/logging/loggerFactory.js +14 -0
  524. package/dist/logging/loggerFactory.js.map +1 -0
  525. package/dist/rag/EmbeddingManager.d.ts +81 -0
  526. package/dist/rag/EmbeddingManager.d.ts.map +1 -0
  527. package/dist/rag/EmbeddingManager.js +412 -0
  528. package/dist/rag/EmbeddingManager.js.map +1 -0
  529. package/dist/rag/IEmbeddingManager.d.ts +277 -0
  530. package/dist/rag/IEmbeddingManager.d.ts.map +1 -0
  531. package/dist/rag/IEmbeddingManager.js +19 -0
  532. package/dist/rag/IEmbeddingManager.js.map +1 -0
  533. package/dist/rag/IRetrievalAugmentor.d.ts +208 -0
  534. package/dist/rag/IRetrievalAugmentor.d.ts.map +1 -0
  535. package/dist/rag/IRetrievalAugmentor.js +21 -0
  536. package/dist/rag/IRetrievalAugmentor.js.map +1 -0
  537. package/dist/rag/IVectorStore.d.ts +351 -0
  538. package/dist/rag/IVectorStore.d.ts.map +1 -0
  539. package/dist/rag/IVectorStore.js +15 -0
  540. package/dist/rag/IVectorStore.js.map +1 -0
  541. package/dist/rag/IVectorStoreManager.d.ts +121 -0
  542. package/dist/rag/IVectorStoreManager.d.ts.map +1 -0
  543. package/dist/rag/IVectorStoreManager.js +13 -0
  544. package/dist/rag/IVectorStoreManager.js.map +1 -0
  545. package/dist/rag/RetrievalAugmentor.d.ts +99 -0
  546. package/dist/rag/RetrievalAugmentor.d.ts.map +1 -0
  547. package/dist/rag/RetrievalAugmentor.js +674 -0
  548. package/dist/rag/RetrievalAugmentor.js.map +1 -0
  549. package/dist/rag/VectorStoreManager.d.ts +90 -0
  550. package/dist/rag/VectorStoreManager.d.ts.map +1 -0
  551. package/dist/rag/VectorStoreManager.js +283 -0
  552. package/dist/rag/VectorStoreManager.js.map +1 -0
  553. package/dist/rag/implementations/index.d.ts +9 -0
  554. package/dist/rag/implementations/index.d.ts.map +1 -0
  555. package/dist/rag/implementations/index.js +9 -0
  556. package/dist/rag/implementations/index.js.map +1 -0
  557. package/dist/rag/implementations/vector_stores/InMemoryVectorStore.d.ts +132 -0
  558. package/dist/rag/implementations/vector_stores/InMemoryVectorStore.d.ts.map +1 -0
  559. package/dist/rag/implementations/vector_stores/InMemoryVectorStore.js +539 -0
  560. package/dist/rag/implementations/vector_stores/InMemoryVectorStore.js.map +1 -0
  561. package/dist/rag/implementations/vector_stores/SqlVectorStore.d.ts +265 -0
  562. package/dist/rag/implementations/vector_stores/SqlVectorStore.d.ts.map +1 -0
  563. package/dist/rag/implementations/vector_stores/SqlVectorStore.js +755 -0
  564. package/dist/rag/implementations/vector_stores/SqlVectorStore.js.map +1 -0
  565. package/dist/rag/implementations/vector_stores/index.d.ts +10 -0
  566. package/dist/rag/implementations/vector_stores/index.d.ts.map +1 -0
  567. package/dist/rag/implementations/vector_stores/index.js +12 -0
  568. package/dist/rag/implementations/vector_stores/index.js.map +1 -0
  569. package/dist/rag/index.d.ts +95 -0
  570. package/dist/rag/index.d.ts.map +1 -0
  571. package/dist/rag/index.js +97 -0
  572. package/dist/rag/index.js.map +1 -0
  573. package/dist/services/user_auth/AuthService.d.ts +13 -0
  574. package/dist/services/user_auth/AuthService.d.ts.map +1 -0
  575. package/dist/services/user_auth/AuthService.js +24 -0
  576. package/dist/services/user_auth/AuthService.js.map +1 -0
  577. package/dist/services/user_auth/SubscriptionService.d.ts +14 -0
  578. package/dist/services/user_auth/SubscriptionService.d.ts.map +1 -0
  579. package/dist/services/user_auth/SubscriptionService.js +34 -0
  580. package/dist/services/user_auth/SubscriptionService.js.map +1 -0
  581. package/dist/services/user_auth/types.d.ts +30 -0
  582. package/dist/services/user_auth/types.d.ts.map +1 -0
  583. package/dist/services/user_auth/types.js +2 -0
  584. package/dist/services/user_auth/types.js.map +1 -0
  585. package/dist/stubs/prismaClient.d.ts +35 -0
  586. package/dist/stubs/prismaClient.d.ts.map +1 -0
  587. package/dist/stubs/prismaClient.js +47 -0
  588. package/dist/stubs/prismaClient.js.map +1 -0
  589. package/dist/types/rateLimitTypes.d.ts +70 -0
  590. package/dist/types/rateLimitTypes.d.ts.map +1 -0
  591. package/dist/types/rateLimitTypes.js +55 -0
  592. package/dist/types/rateLimitTypes.js.map +1 -0
  593. package/dist/utils/errors.d.ts +80 -0
  594. package/dist/utils/errors.d.ts.map +1 -0
  595. package/dist/utils/errors.js +201 -0
  596. package/dist/utils/errors.js.map +1 -0
  597. package/dist/utils/uuid.d.ts +11 -0
  598. package/dist/utils/uuid.d.ts.map +1 -0
  599. package/dist/utils/uuid.js +64 -0
  600. package/dist/utils/uuid.js.map +1 -0
  601. package/package.json +84 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LLMJudge.js","sourceRoot":"","sources":["../../../src/core/evaluation/LLMJudge.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAoDH;;GAEG;AACH,MAAM,gBAAgB,GAAoB;IACxC;QACE,IAAI,EAAE,UAAU;QAChB,WAAW,EAAE,qDAAqD;QAClE,MAAM,EAAE,GAAG;QACX,MAAM,EAAE,gEAAgE;KACzE;IACD;QACE,IAAI,EAAE,WAAW;QACjB,WAAW,EAAE,qDAAqD;QAClE,MAAM,EAAE,IAAI;QACZ,MAAM,EAAE,2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,EAAE,GAAG,EAAE;QAC7E,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,iCAAiC,EAAE,MAAM,EAAE,GAAG,EAAE;KAC9D;IAEpB,sCAAsC;IACtC,eAAe,EAAE;QACf,EAAE,IAAI,EAAE,YAAY,EAAE,WAAW,EAAE,8BAA8B,EAAE,MAAM,EAAE,GAAG,EAAE;QAChF,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,mCAAmC,EAAE,MAAM,EAAE,IAAI,EAAE;QACrF,EAAE,IAAI,EAAE,YAAY,EAAE,WAAW,EAAE,iCAAiC,EAAE,MAAM,EAAE,IAAI,EAAE;QACpF,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,mCAAmC,EAAE,MAAM,EAAE,GAAG,EAAE;KAC9D;IAEpB,yCAAyC;IACzC,MAAM,EAAE;QACN,EAAE,IAAI,EAAE,cAAc,EAAE,WAAW,EAAE,0CAA0C,EAAE,MAAM,EAAE,GAAG,EAAE;QAC9F,EAAE,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,+BAA+B,EAAE,MAAM,EAAE,GAAG,EAAE;QAC/E,EAAE,IAAI,EAAE,iBAAiB,EAAE,WAAW,EAAE,0CAA0C,EAAE,MAAM,EAAE,GAAG,EAAE;QACjG,EAAE,IAAI,EAAE,aAAa,EAAE,WAAW,EAAE,gDAAgD,EAAE,MAAM,EAAE,GAAG,EAAE;KACjF;CACrB,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @file index.ts
3
+ * @description Evaluation framework exports.
4
+ * @module AgentOS/Evaluation
5
+ */
6
+ export * from './IEvaluator';
7
+ export * from './Evaluator';
8
+ export * from './LLMJudge';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/evaluation/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @file index.ts
3
+ * @description Evaluation framework exports.
4
+ * @module AgentOS/Evaluation
5
+ */
6
+ export * from './IEvaluator.js';
7
+ export * from './Evaluator.js';
8
+ export * from './LLMJudge.js';
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/evaluation/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC"}
@@ -0,0 +1,142 @@
1
+ import type { AgentOSInput } from '../../api/types/AgentOSInput';
2
+ import type { AgentOSResponse } from '../../api/types/AgentOSResponse';
3
+ /**
4
+ * High-level outcome emitted by a guardrail evaluation.
5
+ * The action instructs AgentOS (or the host) how to proceed.
6
+ */
7
+ export declare enum GuardrailAction {
8
+ /**
9
+ * Allow the content to pass through unchanged.
10
+ */
11
+ ALLOW = "allow",
12
+ /**
13
+ * Allow the request/response but record metadata (e.g. for analytics).
14
+ */
15
+ FLAG = "flag",
16
+ /**
17
+ * Continue processing after replacing user/assistant content with a sanitised version.
18
+ */
19
+ SANITIZE = "sanitize",
20
+ /**
21
+ * Block the interaction entirely and return an error back to the host.
22
+ */
23
+ BLOCK = "block"
24
+ }
25
+ /**
26
+ * Lightweight description of the conversational context
27
+ * that is relevant for guardrail decisions.
28
+ */
29
+ export interface GuardrailContext {
30
+ userId: string;
31
+ sessionId: string;
32
+ personaId?: string;
33
+ conversationId?: string;
34
+ mode?: string;
35
+ metadata?: Record<string, unknown>;
36
+ }
37
+ /**
38
+ * Result returned by a guardrail evaluation stage.
39
+ */
40
+ export interface GuardrailEvaluationResult {
41
+ action: GuardrailAction;
42
+ /**
43
+ * Optional short reason that can be shown to the end user or logged.
44
+ */
45
+ reason?: string;
46
+ /**
47
+ * Machine readable code (e.g. policy identifier).
48
+ */
49
+ reasonCode?: string;
50
+ /**
51
+ * Additional metadata that hosts may want to persist.
52
+ */
53
+ metadata?: Record<string, unknown>;
54
+ /**
55
+ * Free-form details (stack traces, moderation results, etc.).
56
+ */
57
+ details?: unknown;
58
+ /**
59
+ * Replacement text to use when {@link GuardrailAction.SANITIZE} is returned.
60
+ */
61
+ modifiedText?: string | null;
62
+ }
63
+ /**
64
+ * Payload supplied to the guardrail service before a request
65
+ * enters the orchestration pipeline.
66
+ */
67
+ export interface GuardrailInputPayload {
68
+ context: GuardrailContext;
69
+ input: AgentOSInput;
70
+ }
71
+ /**
72
+ * Payload supplied to the guardrail service right before
73
+ * a response chunk is emitted to the host.
74
+ */
75
+ export interface GuardrailOutputPayload {
76
+ context: GuardrailContext;
77
+ chunk: AgentOSResponse;
78
+ }
79
+ /**
80
+ * Configuration for guardrail evaluation behavior.
81
+ */
82
+ export interface GuardrailConfig {
83
+ /**
84
+ * If true, evaluates TEXT_DELTA chunks during streaming (real-time redaction).
85
+ * If false, only evaluates FINAL_RESPONSE chunks (default, faster, lower cost).
86
+ *
87
+ * **Performance Impact:**
88
+ * - Streaming evaluation: Adds 1-500ms latency per TEXT_DELTA chunk
89
+ * - Final-only evaluation: Adds 1-500ms latency once per response
90
+ *
91
+ * **Cost Impact:**
92
+ * - Streaming evaluation: May trigger LLM calls per chunk (if using LLM-powered guardrails)
93
+ * - Final-only evaluation: Single evaluation per response
94
+ *
95
+ * **Use Cases:**
96
+ * - Streaming: Real-time PII redaction, immediate blocking of harmful content
97
+ * - Final-only: Cost-sensitive deployments, policy checks that need full context
98
+ *
99
+ * @default false
100
+ */
101
+ evaluateStreamingChunks?: boolean;
102
+ /**
103
+ * Maximum number of streaming chunks to evaluate per request.
104
+ * Only applies when evaluateStreamingChunks is true.
105
+ * Set to limit cost/performance impact of streaming evaluation.
106
+ *
107
+ * @default undefined (no limit)
108
+ */
109
+ maxStreamingEvaluations?: number;
110
+ }
111
+ /**
112
+ * Contract that host applications can implement to inject
113
+ * custom guardrail logic (moderation, policy enforcement, censorship).
114
+ *
115
+ * Both methods are optional to keep the package lightweight — provide
116
+ * implementations for the stages you care about.
117
+ */
118
+ export interface IGuardrailService {
119
+ /**
120
+ * Optional configuration for guardrail evaluation behavior.
121
+ */
122
+ config?: GuardrailConfig;
123
+ /**
124
+ * Evaluate user input before the orchestration pipeline executes.
125
+ * Returning {@link GuardrailAction.BLOCK} will prevent the request from being processed.
126
+ */
127
+ evaluateInput?(payload: GuardrailInputPayload): Promise<GuardrailEvaluationResult | null>;
128
+ /**
129
+ * Inspect the agent's response chunks before they are streamed to the client.
130
+ * You can flag, sanitise, or block chunks.
131
+ *
132
+ * **Evaluation Timing:**
133
+ * - If `config.evaluateStreamingChunks === true`: Called for every TEXT_DELTA chunk
134
+ * - Otherwise: Called only for FINAL_RESPONSE chunks
135
+ *
136
+ * **Performance Note:**
137
+ * Streaming evaluation adds latency per chunk. Use final-only evaluation unless
138
+ * real-time redaction is required.
139
+ */
140
+ evaluateOutput?(payload: GuardrailOutputPayload): Promise<GuardrailEvaluationResult | null>;
141
+ }
142
+ //# sourceMappingURL=IGuardrailService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IGuardrailService.d.ts","sourceRoot":"","sources":["../../../src/core/guardrails/IGuardrailService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAEvE;;;GAGG;AACH,oBAAY,eAAe;IACzB;;OAEG;IACH,KAAK,UAAU;IACf;;OAEG;IACH,IAAI,SAAS;IACb;;OAEG;IACH,QAAQ,aAAa;IACrB;;OAEG;IACH,KAAK,UAAU;CAChB;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cA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**
2
+ * High-level outcome emitted by a guardrail evaluation.
3
+ * The action instructs AgentOS (or the host) how to proceed.
4
+ */
5
+ export var GuardrailAction;
6
+ (function (GuardrailAction) {
7
+ /**
8
+ * Allow the content to pass through unchanged.
9
+ */
10
+ GuardrailAction["ALLOW"] = "allow";
11
+ /**
12
+ * Allow the request/response but record metadata (e.g. for analytics).
13
+ */
14
+ GuardrailAction["FLAG"] = "flag";
15
+ /**
16
+ * Continue processing after replacing user/assistant content with a sanitised version.
17
+ */
18
+ GuardrailAction["SANITIZE"] = "sanitize";
19
+ /**
20
+ * Block the interaction entirely and return an error back to the host.
21
+ */
22
+ GuardrailAction["BLOCK"] = "block";
23
+ })(GuardrailAction || (GuardrailAction = {}));
24
+ //# sourceMappingURL=IGuardrailService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IGuardrailService.js","sourceRoot":"","sources":["../../../src/core/guardrails/IGuardrailService.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,MAAM,CAAN,IAAY,eAiBX;AAjBD,WAAY,eAAe;IACzB;;OAEG;IACH,kCAAe,CAAA;IACf;;OAEG;IACH,gCAAa,CAAA;IACb;;OAEG;IACH,wCAAqB,CAAA;IACrB;;OAEG;IACH,kCAAe,CAAA;AACjB,CAAC,EAjBW,eAAe,KAAf,eAAe,QAiB1B"}
@@ -0,0 +1,36 @@
1
+ import type { AgentOSInput } from '../../api/types/AgentOSInput';
2
+ import { AgentOSResponse } from '../../api/types/AgentOSResponse';
3
+ import { type GuardrailContext, type GuardrailEvaluationResult, type IGuardrailService } from './IGuardrailService';
4
+ /**
5
+ * Outcome of an input guardrail evaluation.
6
+ */
7
+ export interface GuardrailInputOutcome {
8
+ sanitizedInput: AgentOSInput;
9
+ evaluation?: GuardrailEvaluationResult | null;
10
+ evaluations?: GuardrailEvaluationResult[];
11
+ }
12
+ export interface GuardrailOutputOptions {
13
+ streamId: string;
14
+ personaId?: string;
15
+ inputEvaluations?: GuardrailEvaluationResult[] | null;
16
+ }
17
+ /**
18
+ * Runs the guardrail service against the inbound request.
19
+ * Returns the (potentially modified) input and the evaluation metadata.
20
+ */
21
+ export declare function evaluateInputGuardrails(service: IGuardrailService | IGuardrailService[] | undefined, input: AgentOSInput, context: GuardrailContext): Promise<GuardrailInputOutcome>;
22
+ /**
23
+ * Creates an async generator that emits a terminal guardrail error chunk.
24
+ */
25
+ export declare function createGuardrailBlockedStream(context: GuardrailContext, evaluation: GuardrailEvaluationResult, options?: GuardrailOutputOptions): AsyncGenerator<AgentOSResponse, void, undefined>;
26
+ /**
27
+ * Wraps a response stream and applies guardrail checks before yielding chunks
28
+ * to the host.
29
+ *
30
+ * **Evaluation Strategy:**
31
+ * - Guardrails with `config.evaluateStreamingChunks === true` evaluate TEXT_DELTA chunks (real-time)
32
+ * - All guardrails evaluate FINAL_RESPONSE chunks (final check)
33
+ * - This allows cost/performance tradeoffs per guardrail
34
+ */
35
+ export declare function wrapOutputGuardrails(service: IGuardrailService | IGuardrailService[] | undefined, context: GuardrailContext, stream: AsyncGenerator<AgentOSResponse, void, undefined>, options: GuardrailOutputOptions): AsyncGenerator<AgentOSResponse, void, undefined>;
36
+ //# sourceMappingURL=guardrailDispatcher.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"guardrailDispatcher.d.ts","sourceRoot":"","sources":["../../../src/core/guardrails/guardrailDispatcher.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EACL,eAAe,EAIhB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAEL,KAAK,gBAAgB,EACrB,KAAK,yBAAyB,EAC9B,KAAK,iBAAiB,EACvB,MAAM,qBAAqB,CAAC;AAW7B;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,cAAc,EAAE,YAAY,CAAC;IAC7B,UAAU,CAAC,EAAE,yBAAyB,GAAG,IAAI,CAAC;IAC9C,WAAW,CAAC,EAAE,yBAAyB,EAAE,CAAC;CAC3C;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,yBAAyB,EAAE,GAAG,IAAI,CAAC;CACvD;AASD;;;GAGG;AACH,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE,iBAAiB,GAAG,iBAAiB,EAAE,GAAG,SAAS,EAC5D,KAAK,EAAE,YAAY,EACnB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,qBAAqB,CAAC,CAmDhC;AAED;;GAEG;AACH,wBAAuB,4BAA4B,CACjD,OAAO,EAAE,gBAAgB,EACzB,UAAU,EAAE,yBAAyB,EACrC,OAAO,CAAC,EAAE,sBAAsB,GAC/B,cAAc,CAAC,eAAe,EAAE,IAAI,EAAE,SAAS,CAAC,CAkBlD;AAED;;;;;;;;GAQG;AACH,wBAAuB,oBAAoB,CACzC,OAAO,EAAE,iBAAiB,GAAG,iBAAiB,EAAE,GAAG,SAAS,EAC5D,OAAO,EAAE,gBAAgB,EACzB,MAAM,EAAE,cAAc,CAAC,eAAe,EAAE,IAAI,EAAE,SAAS,CAAC,EACxD,OAAO,EAAE,sBAAsB,GAC9B,cAAc,CAAC,eAAe,EAAE,IAAI,EAAE,SAAS,CAAC,CA8IlD"}
@@ -0,0 +1,240 @@
1
+ import { uuidv4 } from '../../utils/uuid.js';
2
+ import { AgentOSResponseChunkType, } from '../../api/types/AgentOSResponse.js';
3
+ import { GuardrailAction, } from './IGuardrailService.js';
4
+ // Type guard to narrow services that implement evaluateOutput
5
+ function hasEvaluateOutput(svc) {
6
+ return typeof svc.evaluateOutput === 'function';
7
+ }
8
+ /**
9
+ * Runs the guardrail service against the inbound request.
10
+ * Returns the (potentially modified) input and the evaluation metadata.
11
+ */
12
+ export async function evaluateInputGuardrails(service, input, context) {
13
+ const services = Array.isArray(service)
14
+ ? service.filter(Boolean)
15
+ : service
16
+ ? [service]
17
+ : [];
18
+ if (services.length === 0) {
19
+ return { sanitizedInput: input, evaluations: [] };
20
+ }
21
+ let sanitizedInput = input;
22
+ const evaluations = [];
23
+ for (const currentService of services) {
24
+ if (!currentService?.evaluateInput) {
25
+ continue;
26
+ }
27
+ let evaluation = null;
28
+ try {
29
+ evaluation = await currentService.evaluateInput({ context, input: sanitizedInput });
30
+ }
31
+ catch (error) {
32
+ console.warn('[AgentOS][Guardrails] evaluateInput failed.', error);
33
+ continue;
34
+ }
35
+ if (!evaluation) {
36
+ continue;
37
+ }
38
+ evaluations.push(evaluation);
39
+ if (evaluation.action === GuardrailAction.SANITIZE && evaluation.modifiedText !== undefined) {
40
+ sanitizedInput = {
41
+ ...sanitizedInput,
42
+ textInput: evaluation.modifiedText,
43
+ };
44
+ continue;
45
+ }
46
+ if (evaluation.action === GuardrailAction.BLOCK) {
47
+ return { sanitizedInput, evaluation, evaluations };
48
+ }
49
+ }
50
+ return {
51
+ sanitizedInput,
52
+ evaluation: evaluations.at(-1) ?? null,
53
+ evaluations,
54
+ };
55
+ }
56
+ /**
57
+ * Creates an async generator that emits a terminal guardrail error chunk.
58
+ */
59
+ export async function* createGuardrailBlockedStream(context, evaluation, options) {
60
+ const streamId = options?.streamId ?? uuidv4();
61
+ const errorChunk = {
62
+ type: AgentOSResponseChunkType.ERROR,
63
+ streamId,
64
+ gmiInstanceId: 'guardrail',
65
+ personaId: options?.personaId ?? context.personaId ?? 'unknown_persona',
66
+ isFinal: true,
67
+ timestamp: new Date().toISOString(),
68
+ code: evaluation.reasonCode ?? 'GUARDRAIL_BLOCKED',
69
+ message: evaluation.reason ?? 'Request blocked by guardrail policy.',
70
+ details: {
71
+ action: evaluation.action,
72
+ metadata: evaluation.metadata,
73
+ context,
74
+ },
75
+ };
76
+ yield errorChunk;
77
+ }
78
+ /**
79
+ * Wraps a response stream and applies guardrail checks before yielding chunks
80
+ * to the host.
81
+ *
82
+ * **Evaluation Strategy:**
83
+ * - Guardrails with `config.evaluateStreamingChunks === true` evaluate TEXT_DELTA chunks (real-time)
84
+ * - All guardrails evaluate FINAL_RESPONSE chunks (final check)
85
+ * - This allows cost/performance tradeoffs per guardrail
86
+ */
87
+ export async function* wrapOutputGuardrails(service, context, stream, options) {
88
+ const services = Array.isArray(service)
89
+ ? service.filter(Boolean)
90
+ : service
91
+ ? [service]
92
+ : [];
93
+ // Separate guardrails by evaluation mode
94
+ const streamingGuardrails = services.filter((svc) => svc.config?.evaluateStreamingChunks === true && hasEvaluateOutput(svc));
95
+ const _finalOnlyGuardrails = services.filter((svc) => svc.config?.evaluateStreamingChunks !== true && typeof svc.evaluateOutput === 'function');
96
+ const guardrailEnabled = services.some((svc) => typeof svc.evaluateOutput === 'function');
97
+ const serializedInputEvaluations = (options.inputEvaluations ?? []).map(serializeEvaluation);
98
+ let inputMetadataApplied = serializedInputEvaluations.length === 0;
99
+ // Track streaming evaluations for rate limiting
100
+ const streamingEvaluationCounts = new Map();
101
+ for await (const chunk of stream) {
102
+ let currentChunk = chunk;
103
+ if (!inputMetadataApplied && serializedInputEvaluations.length > 0) {
104
+ currentChunk = withGuardrailMetadata(currentChunk, { input: serializedInputEvaluations });
105
+ inputMetadataApplied = true;
106
+ }
107
+ // Evaluate streaming chunks (TEXT_DELTA) if guardrails are configured for it
108
+ if (streamingGuardrails.length > 0 &&
109
+ chunk.type === AgentOSResponseChunkType.TEXT_DELTA &&
110
+ !chunk.isFinal) {
111
+ const outputEvaluations = [];
112
+ let workingChunk = currentChunk;
113
+ for (const svc of streamingGuardrails) {
114
+ const svcId = svc.id || 'unknown';
115
+ const currentCount = streamingEvaluationCounts.get(svcId) || 0;
116
+ const maxEvals = svc.config?.maxStreamingEvaluations;
117
+ // Skip if rate limit reached
118
+ if (maxEvals !== undefined && currentCount >= maxEvals) {
119
+ continue;
120
+ }
121
+ let evaluation = null;
122
+ try {
123
+ const evalRes = await svc.evaluateOutput({ context, chunk: workingChunk });
124
+ streamingEvaluationCounts.set(svcId, currentCount + 1);
125
+ evaluation = evalRes ?? null;
126
+ }
127
+ catch (error) {
128
+ console.warn('[AgentOS][Guardrails] evaluateOutput (streaming) failed.', error);
129
+ }
130
+ if (!evaluation) {
131
+ continue;
132
+ }
133
+ outputEvaluations.push(evaluation);
134
+ if (evaluation.action === GuardrailAction.BLOCK) {
135
+ yield* createGuardrailBlockedStream(context, evaluation, options);
136
+ return;
137
+ }
138
+ // For TEXT_DELTA chunks, sanitize modifies the textDelta field
139
+ if (evaluation.action === GuardrailAction.SANITIZE && evaluation.modifiedText !== undefined) {
140
+ workingChunk = {
141
+ ...workingChunk,
142
+ textDelta: evaluation.modifiedText,
143
+ };
144
+ }
145
+ }
146
+ if (outputEvaluations.length > 0) {
147
+ workingChunk = withGuardrailMetadata(workingChunk, {
148
+ output: outputEvaluations.map(serializeEvaluation),
149
+ });
150
+ }
151
+ currentChunk = workingChunk;
152
+ }
153
+ // Evaluate final chunks (all guardrails)
154
+ if (guardrailEnabled && chunk.isFinal) {
155
+ const outputEvaluations = [];
156
+ let workingChunk = currentChunk;
157
+ for (const svc of services) {
158
+ if (!svc?.evaluateOutput) {
159
+ continue;
160
+ }
161
+ let evaluation = null;
162
+ try {
163
+ evaluation = await svc.evaluateOutput({ context, chunk: workingChunk });
164
+ }
165
+ catch (error) {
166
+ console.warn('[AgentOS][Guardrails] evaluateOutput (final) failed.', error);
167
+ }
168
+ if (!evaluation) {
169
+ continue;
170
+ }
171
+ outputEvaluations.push(evaluation);
172
+ if (evaluation.action === GuardrailAction.BLOCK) {
173
+ yield* createGuardrailBlockedStream(context, evaluation, options);
174
+ return;
175
+ }
176
+ if (evaluation.action === GuardrailAction.SANITIZE &&
177
+ workingChunk.type === AgentOSResponseChunkType.FINAL_RESPONSE) {
178
+ workingChunk = {
179
+ ...workingChunk,
180
+ finalResponseText: evaluation.modifiedText !== undefined
181
+ ? evaluation.modifiedText
182
+ : workingChunk.finalResponseText,
183
+ };
184
+ }
185
+ }
186
+ if (outputEvaluations.length > 0) {
187
+ workingChunk = withGuardrailMetadata(workingChunk, {
188
+ output: outputEvaluations.map(serializeEvaluation),
189
+ });
190
+ }
191
+ currentChunk = workingChunk;
192
+ }
193
+ yield currentChunk;
194
+ }
195
+ }
196
+ function serializeEvaluation(evaluation) {
197
+ return {
198
+ action: evaluation.action,
199
+ reason: evaluation.reason,
200
+ reasonCode: evaluation.reasonCode,
201
+ metadata: evaluation.metadata,
202
+ };
203
+ }
204
+ function withGuardrailMetadata(chunk, entry) {
205
+ const existingMetadata = chunk.metadata ?? {};
206
+ const existingGuardrail = existingMetadata.guardrail ?? {};
207
+ const existingInput = Array.isArray(existingGuardrail.input)
208
+ ? existingGuardrail.input
209
+ : existingGuardrail.input
210
+ ? [existingGuardrail.input]
211
+ : [];
212
+ const existingOutput = Array.isArray(existingGuardrail.output)
213
+ ? existingGuardrail.output
214
+ : existingGuardrail.output
215
+ ? [existingGuardrail.output]
216
+ : [];
217
+ const incomingInput = normalizeMetadata(entry.input);
218
+ const incomingOutput = normalizeMetadata(entry.output);
219
+ const mergedInput = existingInput.concat(incomingInput);
220
+ const mergedOutput = existingOutput.concat(incomingOutput);
221
+ const guardrail = {
222
+ ...existingGuardrail,
223
+ ...(mergedInput.length ? { input: mergedInput } : {}),
224
+ ...(mergedOutput.length ? { output: mergedOutput } : {}),
225
+ };
226
+ return {
227
+ ...chunk,
228
+ metadata: {
229
+ ...existingMetadata,
230
+ guardrail,
231
+ },
232
+ };
233
+ }
234
+ function normalizeMetadata(entry) {
235
+ if (!entry) {
236
+ return [];
237
+ }
238
+ return Array.isArray(entry) ? entry : [entry];
239
+ }
240
+ //# sourceMappingURL=guardrailDispatcher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"guardrailDispatcher.js","sourceRoot":"","sources":["../../../src/core/guardrails/guardrailDispatcher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAErD,OAAO,EAEL,wBAAwB,GAGzB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAC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C,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;AAChD,CAAC"}
@@ -0,0 +1,146 @@
1
+ /**
2
+ * @file HumanInteractionManager.ts
3
+ * @description Implementation of the Human-in-the-Loop Manager for AgentOS.
4
+ * Manages structured collaboration between AI agents and human operators.
5
+ *
6
+ * @module AgentOS/HITL
7
+ * @version 1.0.0
8
+ */
9
+ import type { ILogger } from '../../logging/ILogger';
10
+ import type { IHumanInteractionManager, PendingAction, ApprovalDecision, ClarificationRequest, ClarificationResponse, DraftOutput, EditedOutput, EscalationContext, EscalationDecision, WorkflowCheckpoint, CheckpointDecision, HumanFeedback, HITLStatistics, HITLNotificationHandler } from './IHumanInteractionManager';
11
+ /**
12
+ * Configuration for HumanInteractionManager.
13
+ */
14
+ export interface HumanInteractionManagerConfig {
15
+ /** Logger instance */
16
+ logger?: ILogger;
17
+ /** Default timeout for requests in ms */
18
+ defaultTimeoutMs?: number;
19
+ /** Notification handler */
20
+ notificationHandler?: HITLNotificationHandler;
21
+ /** Maximum pending requests per type */
22
+ maxPendingPerType?: number;
23
+ /** Auto-reject on timeout (vs returning timeout response) */
24
+ autoRejectOnTimeout?: boolean;
25
+ }
26
+ /**
27
+ * Implementation of the Human-in-the-Loop Manager.
28
+ *
29
+ * Features:
30
+ * - Approval requests with severity levels
31
+ * - Clarification requests with options
32
+ * - Output review and editing
33
+ * - Escalation handling
34
+ * - Workflow checkpoints
35
+ * - Feedback collection for learning
36
+ *
37
+ * @implements {IHumanInteractionManager}
38
+ */
39
+ export declare class HumanInteractionManager implements IHumanInteractionManager {
40
+ private readonly logger?;
41
+ private readonly defaultTimeoutMs;
42
+ private readonly maxPendingPerType;
43
+ private readonly autoRejectOnTimeout;
44
+ private notificationHandler?;
45
+ /** Pending approval requests */
46
+ private readonly pendingApprovals;
47
+ /** Pending clarification requests */
48
+ private readonly pendingClarifications;
49
+ /** Pending edit requests */
50
+ private readonly pendingEdits;
51
+ /** Pending escalations */
52
+ private readonly pendingEscalations;
53
+ /** Pending checkpoints */
54
+ private readonly pendingCheckpoints;
55
+ /** Feedback history */
56
+ private readonly feedbackHistory;
57
+ /** Statistics */
58
+ private stats;
59
+ private approvedCount;
60
+ private totalResponseTimeMs;
61
+ private responseCount;
62
+ /**
63
+ * Creates a new HumanInteractionManager instance.
64
+ *
65
+ * @param config - Configuration options
66
+ */
67
+ constructor(config?: HumanInteractionManagerConfig);
68
+ /**
69
+ * Requests human approval before executing an action.
70
+ */
71
+ requestApproval(action: PendingAction): Promise<ApprovalDecision>;
72
+ /**
73
+ * Submits an approval decision.
74
+ */
75
+ submitApprovalDecision(decision: ApprovalDecision): Promise<void>;
76
+ /**
77
+ * Requests clarification from a human.
78
+ */
79
+ requestClarification(request: ClarificationRequest): Promise<ClarificationResponse>;
80
+ /**
81
+ * Submits a clarification response.
82
+ */
83
+ submitClarification(response: ClarificationResponse): Promise<void>;
84
+ /**
85
+ * Requests human review and potential editing of agent output.
86
+ */
87
+ requestEdit(draft: DraftOutput): Promise<EditedOutput>;
88
+ /**
89
+ * Submits an edited output.
90
+ */
91
+ submitEdit(edited: EditedOutput): Promise<void>;
92
+ /**
93
+ * Escalates a situation to human control.
94
+ */
95
+ escalate(context: EscalationContext): Promise<EscalationDecision>;
96
+ /**
97
+ * Submits an escalation decision.
98
+ */
99
+ submitEscalationDecision(escalationId: string, decision: EscalationDecision): Promise<void>;
100
+ /**
101
+ * Creates a checkpoint for human review.
102
+ */
103
+ checkpoint(checkpoint: WorkflowCheckpoint): Promise<CheckpointDecision>;
104
+ /**
105
+ * Submits a checkpoint decision.
106
+ */
107
+ submitCheckpointDecision(decision: CheckpointDecision): Promise<void>;
108
+ /**
109
+ * Records human feedback for agent improvement.
110
+ */
111
+ recordFeedback(feedback: HumanFeedback): Promise<void>;
112
+ /**
113
+ * Gets feedback history for an agent.
114
+ */
115
+ getFeedbackHistory(agentId: string, options?: {
116
+ limit?: number;
117
+ since?: Date;
118
+ type?: HumanFeedback['feedbackType'];
119
+ }): Promise<HumanFeedback[]>;
120
+ /**
121
+ * Gets all pending requests awaiting human response.
122
+ */
123
+ getPendingRequests(): Promise<{
124
+ approvals: PendingAction[];
125
+ clarifications: ClarificationRequest[];
126
+ edits: DraftOutput[];
127
+ escalations: EscalationContext[];
128
+ checkpoints: WorkflowCheckpoint[];
129
+ }>;
130
+ /**
131
+ * Cancels a pending request.
132
+ */
133
+ cancelRequest(requestId: string, reason: string): Promise<void>;
134
+ /**
135
+ * Gets HITL interaction statistics.
136
+ */
137
+ getStatistics(): HITLStatistics;
138
+ /**
139
+ * Sets the notification handler.
140
+ */
141
+ setNotificationHandler(handler: HITLNotificationHandler): void;
142
+ private sendNotification;
143
+ private updatePendingCount;
144
+ private updateResponseTime;
145
+ }
146
+ //# sourceMappingURL=HumanInteractionManager.d.ts.map