@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,701 @@
1
+ /**
2
+ * @file IStructuredOutputManager.ts
3
+ * @description Interface for the Structured Output Manager in AgentOS.
4
+ *
5
+ * The Structured Output Manager ensures LLM outputs conform to predefined
6
+ * schemas, enabling reliable parsing, validation, and type-safe consumption
7
+ * of agent responses. This is critical for:
8
+ *
9
+ * - **Tool Calls**: Ensuring function arguments match expected types
10
+ * - **Data Extraction**: Pulling structured data from unstructured text
11
+ * - **API Responses**: Generating responses that match API contracts
12
+ * - **Multi-step Workflows**: Reliable data flow between pipeline stages
13
+ *
14
+ * Supports multiple output strategies:
15
+ * - JSON Mode (OpenAI, Anthropic)
16
+ * - Function Calling / Tool Use
17
+ * - Grammar-constrained generation (local models)
18
+ * - Post-hoc parsing with retry
19
+ *
20
+ * @module AgentOS/Structured
21
+ * @version 1.0.0
22
+ *
23
+ * @example
24
+ * ```typescript
25
+ * const manager = new StructuredOutputManager(llmProvider);
26
+ *
27
+ * // Define a schema for extraction
28
+ * const personSchema: JSONSchema = {
29
+ * type: 'object',
30
+ * properties: {
31
+ * name: { type: 'string' },
32
+ * age: { type: 'integer', minimum: 0 },
33
+ * email: { type: 'string', format: 'email' },
34
+ * },
35
+ * required: ['name', 'email'],
36
+ * };
37
+ *
38
+ * // Extract structured data
39
+ * const result = await manager.generate({
40
+ * prompt: 'Extract person info from: John Doe, 30 years old, john@example.com',
41
+ * schema: personSchema,
42
+ * schemaName: 'Person',
43
+ * });
44
+ *
45
+ * console.log(result.data); // { name: 'John Doe', age: 30, email: 'john@example.com' }
46
+ * ```
47
+ */
48
+ import type { ILogger } from '../../logging/ILogger';
49
+ /**
50
+ * JSON Schema type definitions for structured output validation.
51
+ * Follows JSON Schema Draft 2020-12 specification.
52
+ *
53
+ * @see https://json-schema.org/draft/2020-12/json-schema-core
54
+ */
55
+ export type JSONSchemaType = 'string' | 'number' | 'integer' | 'boolean' | 'array' | 'object' | 'null';
56
+ /**
57
+ * String format validators supported by the schema.
58
+ */
59
+ export type JSONSchemaStringFormat = 'date-time' | 'date' | 'time' | 'email' | 'uri' | 'uri-reference' | 'uuid' | 'hostname' | 'ipv4' | 'ipv6' | 'regex';
60
+ /**
61
+ * Complete JSON Schema definition for structured outputs.
62
+ *
63
+ * @remarks
64
+ * This interface supports the commonly used JSON Schema keywords
65
+ * for defining structured LLM outputs. It's designed to be compatible
66
+ * with OpenAI's structured output API and similar implementations.
67
+ */
68
+ export interface JSONSchema {
69
+ /** The data type of the schema */
70
+ type?: JSONSchemaType | JSONSchemaType[];
71
+ /** Human-readable title for the schema */
72
+ title?: string;
73
+ /** Description of what the schema represents */
74
+ description?: string;
75
+ /** Default value if not provided */
76
+ default?: unknown;
77
+ /** Enumeration of allowed values */
78
+ enum?: unknown[];
79
+ /** Constant value (must be exactly this) */
80
+ const?: unknown;
81
+ /** Minimum string length */
82
+ minLength?: number;
83
+ /** Maximum string length */
84
+ maxLength?: number;
85
+ /** Regex pattern the string must match */
86
+ pattern?: string;
87
+ /** String format validator */
88
+ format?: JSONSchemaStringFormat;
89
+ /** Minimum value (inclusive) */
90
+ minimum?: number;
91
+ /** Maximum value (inclusive) */
92
+ maximum?: number;
93
+ /** Minimum value (exclusive) */
94
+ exclusiveMinimum?: number;
95
+ /** Maximum value (exclusive) */
96
+ exclusiveMaximum?: number;
97
+ /** Value must be a multiple of this number */
98
+ multipleOf?: number;
99
+ /** Schema for array items */
100
+ items?: JSONSchema | JSONSchema[];
101
+ /** Minimum number of items */
102
+ minItems?: number;
103
+ /** Maximum number of items */
104
+ maxItems?: number;
105
+ /** All items must be unique */
106
+ uniqueItems?: boolean;
107
+ /** Schema for items after `items` tuple schemas */
108
+ additionalItems?: boolean | JSONSchema;
109
+ /** Prefix items (for tuple validation) */
110
+ prefixItems?: JSONSchema[];
111
+ /** Schema that must validate at least one item */
112
+ contains?: JSONSchema;
113
+ /** Property definitions for object */
114
+ properties?: Record<string, JSONSchema>;
115
+ /** Required property names */
116
+ required?: string[];
117
+ /** Schema for properties not in `properties` */
118
+ additionalProperties?: boolean | JSONSchema;
119
+ /** Pattern-based property schemas */
120
+ patternProperties?: Record<string, JSONSchema>;
121
+ /** Minimum number of properties */
122
+ minProperties?: number;
123
+ /** Maximum number of properties */
124
+ maxProperties?: number;
125
+ /** Property names must match this schema */
126
+ propertyNames?: JSONSchema;
127
+ /** Dependencies between properties */
128
+ dependentRequired?: Record<string, string[]>;
129
+ /** Schema dependencies */
130
+ dependentSchemas?: Record<string, JSONSchema>;
131
+ /** Must match all schemas */
132
+ allOf?: JSONSchema[];
133
+ /** Must match at least one schema */
134
+ anyOf?: JSONSchema[];
135
+ /** Must match exactly one schema */
136
+ oneOf?: JSONSchema[];
137
+ /** Must not match this schema */
138
+ not?: JSONSchema;
139
+ /** Conditional schema application */
140
+ if?: JSONSchema;
141
+ /** Schema if `if` passes */
142
+ then?: JSONSchema;
143
+ /** Schema if `if` fails */
144
+ else?: JSONSchema;
145
+ /** Reference to another schema */
146
+ $ref?: string;
147
+ /** Schema definitions for $ref */
148
+ $defs?: Record<string, JSONSchema>;
149
+ /** Examples of valid values */
150
+ examples?: unknown[];
151
+ /** Whether this value is read-only */
152
+ readOnly?: boolean;
153
+ /** Whether this value is write-only */
154
+ writeOnly?: boolean;
155
+ /** Deprecation flag */
156
+ deprecated?: boolean;
157
+ }
158
+ /**
159
+ * Strategy for enforcing structured output.
160
+ */
161
+ export type StructuredOutputStrategy = 'json_mode' | 'function_calling' | 'grammar' | 'prompt_engineering' | 'auto';
162
+ /**
163
+ * Options for structured output generation.
164
+ */
165
+ export interface StructuredGenerationOptions {
166
+ /** The prompt or messages to send to the LLM */
167
+ prompt: string | Array<{
168
+ role: string;
169
+ content: string;
170
+ }>;
171
+ /** JSON Schema the output must conform to */
172
+ schema: JSONSchema;
173
+ /** Human-readable name for the schema (used in function calling) */
174
+ schemaName: string;
175
+ /** Description of what output is expected */
176
+ schemaDescription?: string;
177
+ /** Strategy for enforcing structure */
178
+ strategy?: StructuredOutputStrategy;
179
+ /** LLM provider to use */
180
+ providerId?: string;
181
+ /** Model ID to use */
182
+ modelId?: string;
183
+ /** Temperature for generation (0-2) */
184
+ temperature?: number;
185
+ /** Maximum tokens to generate */
186
+ maxTokens?: number;
187
+ /** Number of retry attempts on validation failure */
188
+ maxRetries?: number;
189
+ /** Whether to include reasoning/chain-of-thought before output */
190
+ includeReasoning?: boolean;
191
+ /** Custom system prompt to prepend */
192
+ systemPrompt?: string;
193
+ /** Timeout in milliseconds */
194
+ timeoutMs?: number;
195
+ /** Whether to strictly enforce schema (fail on extra properties) */
196
+ strict?: boolean;
197
+ /** Custom validation function for additional checks */
198
+ customValidator?: (data: unknown) => ValidationIssue[];
199
+ }
200
+ /**
201
+ * Options for parallel function/tool calls.
202
+ */
203
+ export interface ParallelFunctionCallOptions {
204
+ /** The prompt requesting actions */
205
+ prompt: string | Array<{
206
+ role: string;
207
+ content: string;
208
+ }>;
209
+ /** Available functions/tools the model can call */
210
+ functions: FunctionDefinition[];
211
+ /** Maximum number of parallel calls allowed */
212
+ maxParallelCalls?: number;
213
+ /** Whether functions are required or optional */
214
+ toolChoice?: 'auto' | 'required' | 'none' | {
215
+ type: 'function';
216
+ function: {
217
+ name: string;
218
+ };
219
+ };
220
+ /** LLM provider to use */
221
+ providerId?: string;
222
+ /** Model ID to use */
223
+ modelId?: string;
224
+ /** Temperature for generation */
225
+ temperature?: number;
226
+ /** Timeout in milliseconds */
227
+ timeoutMs?: number;
228
+ }
229
+ /**
230
+ * Definition of a callable function/tool.
231
+ */
232
+ export interface FunctionDefinition {
233
+ /** Unique function name */
234
+ name: string;
235
+ /** Human-readable description */
236
+ description: string;
237
+ /** JSON Schema for function parameters */
238
+ parameters: JSONSchema;
239
+ /** Whether this function is required */
240
+ required?: boolean;
241
+ /** Function handler (for execution) */
242
+ handler?: (args: Record<string, unknown>) => Promise<unknown> | unknown;
243
+ }
244
+ /**
245
+ * Result of structured output generation.
246
+ *
247
+ * @typeParam T - The expected type of the parsed data
248
+ */
249
+ export interface StructuredGenerationResult<T = unknown> {
250
+ /** Whether generation and validation succeeded */
251
+ success: boolean;
252
+ /** The parsed, validated data (if successful) */
253
+ data?: T;
254
+ /** Raw string output from the LLM */
255
+ rawOutput: string;
256
+ /** Validation errors if any */
257
+ validationErrors?: ValidationIssue[];
258
+ /** The strategy that was used */
259
+ strategyUsed: StructuredOutputStrategy;
260
+ /** Number of retry attempts made */
261
+ retryCount: number;
262
+ /** Token usage statistics */
263
+ tokenUsage?: {
264
+ promptTokens: number;
265
+ completionTokens: number;
266
+ totalTokens: number;
267
+ };
268
+ /** Generation latency in milliseconds */
269
+ latencyMs: number;
270
+ /** Reasoning/chain-of-thought if requested */
271
+ reasoning?: string;
272
+ /** Model that was used */
273
+ modelId: string;
274
+ /** Provider that was used */
275
+ providerId: string;
276
+ }
277
+ /**
278
+ * A single validation issue found during schema validation.
279
+ */
280
+ export interface ValidationIssue {
281
+ /** JSON Pointer path to the invalid value */
282
+ path: string;
283
+ /** Error message describing the issue */
284
+ message: string;
285
+ /** The keyword that failed validation */
286
+ keyword: string;
287
+ /** Expected value or constraint */
288
+ expected?: unknown;
289
+ /** Actual value that was found */
290
+ actual?: unknown;
291
+ /** Severity of the issue */
292
+ severity: 'error' | 'warning';
293
+ }
294
+ /**
295
+ * Result of parallel function calls.
296
+ */
297
+ export interface ParallelFunctionCallResult {
298
+ /** Whether all function calls were successful */
299
+ success: boolean;
300
+ /** Individual function call results */
301
+ calls: FunctionCallResult[];
302
+ /** Any content output alongside function calls */
303
+ textContent?: string;
304
+ /** Token usage statistics */
305
+ tokenUsage?: {
306
+ promptTokens: number;
307
+ completionTokens: number;
308
+ totalTokens: number;
309
+ };
310
+ /** Generation latency in milliseconds */
311
+ latencyMs: number;
312
+ /** Model that was used */
313
+ modelId: string;
314
+ /** Provider that was used */
315
+ providerId: string;
316
+ }
317
+ /**
318
+ * Result of a single function call.
319
+ */
320
+ export interface FunctionCallResult {
321
+ /** Function that was called */
322
+ functionName: string;
323
+ /** Arguments passed to the function */
324
+ arguments: Record<string, unknown>;
325
+ /** Whether arguments validated against schema */
326
+ argumentsValid: boolean;
327
+ /** Validation errors for arguments */
328
+ validationErrors?: ValidationIssue[];
329
+ /** Result of executing the function (if handler provided) */
330
+ executionResult?: unknown;
331
+ /** Error during execution (if any) */
332
+ executionError?: string;
333
+ /** Unique ID for this call (for multi-turn conversations) */
334
+ callId: string;
335
+ }
336
+ /**
337
+ * Options for entity extraction from text.
338
+ */
339
+ export interface EntityExtractionOptions {
340
+ /** Text to extract entities from */
341
+ text: string;
342
+ /** Schema defining the entities to extract */
343
+ entitySchema: JSONSchema;
344
+ /** Name for the extraction task */
345
+ taskName: string;
346
+ /** Additional context or instructions */
347
+ instructions?: string;
348
+ /** Examples of expected extractions */
349
+ examples?: Array<{
350
+ input: string;
351
+ output: unknown;
352
+ }>;
353
+ /** LLM provider to use */
354
+ providerId?: string;
355
+ /** Model ID to use */
356
+ modelId?: string;
357
+ /** Whether to extract all occurrences or just first */
358
+ extractAll?: boolean;
359
+ }
360
+ /**
361
+ * Result of entity extraction.
362
+ */
363
+ export interface EntityExtractionResult<T = unknown> {
364
+ /** Whether extraction succeeded */
365
+ success: boolean;
366
+ /** Extracted entities */
367
+ entities: T[];
368
+ /** Confidence scores for each entity (0-1) */
369
+ confidenceScores?: number[];
370
+ /** Source text spans for each entity */
371
+ sourceSpans?: Array<{
372
+ start: number;
373
+ end: number;
374
+ text: string;
375
+ }>;
376
+ /** Any extraction issues */
377
+ issues?: string[];
378
+ /** Token usage */
379
+ tokenUsage?: {
380
+ promptTokens: number;
381
+ completionTokens: number;
382
+ totalTokens: number;
383
+ };
384
+ }
385
+ /**
386
+ * Statistics about structured output operations.
387
+ */
388
+ export interface StructuredOutputStats {
389
+ /** Total generation attempts */
390
+ totalGenerations: number;
391
+ /** Successful generations */
392
+ successfulGenerations: number;
393
+ /** Success rate (0-1) */
394
+ successRate: number;
395
+ /** Average retries per generation */
396
+ avgRetries: number;
397
+ /** Average latency in ms */
398
+ avgLatencyMs: number;
399
+ /** Generations by strategy */
400
+ byStrategy: Record<StructuredOutputStrategy, number>;
401
+ /** Most common validation errors */
402
+ topValidationErrors: Array<{
403
+ keyword: string;
404
+ count: number;
405
+ }>;
406
+ /** Total tokens used */
407
+ totalTokensUsed: number;
408
+ }
409
+ /**
410
+ * Interface for the Structured Output Manager.
411
+ *
412
+ * The Structured Output Manager provides a unified API for generating
413
+ * LLM outputs that conform to predefined JSON Schemas. It handles:
414
+ *
415
+ * - **Strategy Selection**: Choosing the best approach for the provider/model
416
+ * - **Schema Validation**: Ensuring outputs match the schema
417
+ * - **Retry Logic**: Automatic retries with feedback on validation failures
418
+ * - **Function Calling**: Parallel tool use with argument validation
419
+ * - **Entity Extraction**: Pulling structured data from unstructured text
420
+ *
421
+ * @example
422
+ * ```typescript
423
+ * // Simple structured generation
424
+ * const result = await manager.generate({
425
+ * prompt: 'List the top 3 programming languages',
426
+ * schema: {
427
+ * type: 'object',
428
+ * properties: {
429
+ * languages: {
430
+ * type: 'array',
431
+ * items: {
432
+ * type: 'object',
433
+ * properties: {
434
+ * name: { type: 'string' },
435
+ * popularity: { type: 'integer', minimum: 1, maximum: 100 },
436
+ * },
437
+ * required: ['name', 'popularity'],
438
+ * },
439
+ * minItems: 3,
440
+ * maxItems: 3,
441
+ * },
442
+ * },
443
+ * required: ['languages'],
444
+ * },
445
+ * schemaName: 'ProgrammingLanguages',
446
+ * });
447
+ *
448
+ * if (result.success) {
449
+ * result.data.languages.forEach(lang => {
450
+ * console.log(`${lang.name}: ${lang.popularity}%`);
451
+ * });
452
+ * }
453
+ * ```
454
+ *
455
+ * @example
456
+ * ```typescript
457
+ * // Parallel function calling
458
+ * const result = await manager.generateFunctionCalls({
459
+ * prompt: 'Search for weather in NYC and stock price of AAPL',
460
+ * functions: [
461
+ * {
462
+ * name: 'get_weather',
463
+ * description: 'Get current weather for a city',
464
+ * parameters: {
465
+ * type: 'object',
466
+ * properties: {
467
+ * city: { type: 'string' },
468
+ * units: { type: 'string', enum: ['celsius', 'fahrenheit'] },
469
+ * },
470
+ * required: ['city'],
471
+ * },
472
+ * handler: async (args) => fetchWeather(args.city, args.units),
473
+ * },
474
+ * {
475
+ * name: 'get_stock_price',
476
+ * description: 'Get current stock price',
477
+ * parameters: {
478
+ * type: 'object',
479
+ * properties: {
480
+ * symbol: { type: 'string' },
481
+ * },
482
+ * required: ['symbol'],
483
+ * },
484
+ * handler: async (args) => fetchStockPrice(args.symbol),
485
+ * },
486
+ * ],
487
+ * maxParallelCalls: 5,
488
+ * });
489
+ *
490
+ * // Both functions called in parallel
491
+ * result.calls.forEach(call => {
492
+ * console.log(`${call.functionName}: ${JSON.stringify(call.executionResult)}`);
493
+ * });
494
+ * ```
495
+ */
496
+ export interface IStructuredOutputManager {
497
+ /**
498
+ * Initializes the manager with optional configuration.
499
+ *
500
+ * @param logger - Logger instance for debugging
501
+ */
502
+ initialize(logger?: ILogger): Promise<void>;
503
+ /**
504
+ * Generates structured output conforming to the given schema.
505
+ *
506
+ * @typeParam T - Expected type of the output data
507
+ * @param options - Generation options including prompt and schema
508
+ * @returns Promise resolving to the generation result
509
+ *
510
+ * @throws {StructuredOutputError} If generation fails after all retries
511
+ *
512
+ * @example
513
+ * ```typescript
514
+ * const result = await manager.generate<Person>({
515
+ * prompt: 'Extract person info from: John Doe, 30, john@example.com',
516
+ * schema: personSchema,
517
+ * schemaName: 'Person',
518
+ * strict: true,
519
+ * });
520
+ *
521
+ * if (result.success) {
522
+ * console.log(result.data.name); // Type-safe access
523
+ * }
524
+ * ```
525
+ */
526
+ generate<T = unknown>(options: StructuredGenerationOptions): Promise<StructuredGenerationResult<T>>;
527
+ /**
528
+ * Generates parallel function/tool calls.
529
+ *
530
+ * This method enables the LLM to call multiple functions in a single
531
+ * response, useful for parallel data fetching or multi-step operations.
532
+ *
533
+ * @param options - Function call options
534
+ * @returns Promise resolving to function call results
535
+ *
536
+ * @example
537
+ * ```typescript
538
+ * const result = await manager.generateFunctionCalls({
539
+ * prompt: 'Get the weather in Paris and London',
540
+ * functions: [weatherFunction],
541
+ * maxParallelCalls: 10,
542
+ * });
543
+ *
544
+ * // Execute all calls in parallel
545
+ * await Promise.all(result.calls.map(async call => {
546
+ * const fn = functions.find(f => f.name === call.functionName);
547
+ * if (fn?.handler) {
548
+ * call.executionResult = await fn.handler(call.arguments);
549
+ * }
550
+ * }));
551
+ * ```
552
+ */
553
+ generateFunctionCalls(options: ParallelFunctionCallOptions): Promise<ParallelFunctionCallResult>;
554
+ /**
555
+ * Extracts structured entities from unstructured text.
556
+ *
557
+ * Useful for NER, data extraction, and information retrieval tasks.
558
+ *
559
+ * @typeParam T - Expected type of extracted entities
560
+ * @param options - Extraction options
561
+ * @returns Promise resolving to extraction results
562
+ *
563
+ * @example
564
+ * ```typescript
565
+ * const result = await manager.extractEntities<Person>({
566
+ * text: 'John Doe (john@example.com) met Jane Smith (jane@example.com)',
567
+ * entitySchema: personSchema,
568
+ * taskName: 'PersonExtraction',
569
+ * extractAll: true,
570
+ * });
571
+ *
572
+ * result.entities.forEach(person => {
573
+ * console.log(`Found: ${person.name} - ${person.email}`);
574
+ * });
575
+ * ```
576
+ */
577
+ extractEntities<T = unknown>(options: EntityExtractionOptions): Promise<EntityExtractionResult<T>>;
578
+ /**
579
+ * Validates data against a JSON Schema.
580
+ *
581
+ * @param data - Data to validate
582
+ * @param schema - Schema to validate against
583
+ * @param strict - Whether to fail on additional properties
584
+ * @returns Array of validation issues (empty if valid)
585
+ *
586
+ * @example
587
+ * ```typescript
588
+ * const issues = manager.validate(
589
+ * { name: 'John', age: -5 },
590
+ * personSchema,
591
+ * true
592
+ * );
593
+ *
594
+ * if (issues.length > 0) {
595
+ * issues.forEach(issue => {
596
+ * console.log(`${issue.path}: ${issue.message}`);
597
+ * });
598
+ * }
599
+ * ```
600
+ */
601
+ validate(data: unknown, schema: JSONSchema, strict?: boolean): ValidationIssue[];
602
+ /**
603
+ * Parses JSON string with error recovery.
604
+ *
605
+ * Attempts to extract valid JSON from potentially malformed output,
606
+ * handling common LLM output issues like:
607
+ * - Markdown code blocks
608
+ * - Trailing commas
609
+ * - Unquoted keys
610
+ * - Single quotes
611
+ *
612
+ * @param jsonString - String to parse
613
+ * @returns Parsed object or null if parsing fails
614
+ *
615
+ * @example
616
+ * ```typescript
617
+ * // Handles markdown-wrapped JSON
618
+ * const data = manager.parseJSON('```json\n{"name": "John"}\n```');
619
+ * // Returns: { name: 'John' }
620
+ *
621
+ * // Handles trailing commas
622
+ * const data2 = manager.parseJSON('{"a": 1, "b": 2,}');
623
+ * // Returns: { a: 1, b: 2 }
624
+ * ```
625
+ */
626
+ parseJSON(jsonString: string): unknown | null;
627
+ /**
628
+ * Determines the best strategy for a given provider/model.
629
+ *
630
+ * @param providerId - LLM provider ID
631
+ * @param modelId - Model ID
632
+ * @param schema - Schema to generate for
633
+ * @returns Recommended strategy
634
+ */
635
+ recommendStrategy(providerId: string, modelId: string, schema: JSONSchema): StructuredOutputStrategy;
636
+ /**
637
+ * Registers a custom schema for reuse.
638
+ *
639
+ * @param name - Schema name for reference
640
+ * @param schema - Schema definition
641
+ *
642
+ * @example
643
+ * ```typescript
644
+ * manager.registerSchema('Address', {
645
+ * type: 'object',
646
+ * properties: {
647
+ * street: { type: 'string' },
648
+ * city: { type: 'string' },
649
+ * country: { type: 'string' },
650
+ * postalCode: { type: 'string' },
651
+ * },
652
+ * required: ['street', 'city', 'country'],
653
+ * });
654
+ *
655
+ * // Use in other schemas via $ref
656
+ * const orderSchema = {
657
+ * type: 'object',
658
+ * properties: {
659
+ * shippingAddress: { $ref: '#/$defs/Address' },
660
+ * },
661
+ * };
662
+ * ```
663
+ */
664
+ registerSchema(name: string, schema: JSONSchema): void;
665
+ /**
666
+ * Gets a registered schema by name.
667
+ *
668
+ * @param name - Schema name
669
+ * @returns Schema or undefined if not found
670
+ */
671
+ getSchema(name: string): JSONSchema | undefined;
672
+ /**
673
+ * Gets statistics about structured output operations.
674
+ *
675
+ * @returns Current statistics
676
+ */
677
+ getStatistics(): StructuredOutputStats;
678
+ /**
679
+ * Resets statistics counters.
680
+ */
681
+ resetStatistics(): void;
682
+ }
683
+ /**
684
+ * Error thrown when structured output generation fails.
685
+ */
686
+ export declare class StructuredOutputError extends Error {
687
+ /** Validation issues that caused the failure */
688
+ readonly validationErrors: ValidationIssue[];
689
+ /** Raw output that failed validation */
690
+ readonly rawOutput: string;
691
+ /** Number of retries attempted */
692
+ readonly retryCount: number;
693
+ /** Strategy that was used */
694
+ readonly strategy: StructuredOutputStrategy;
695
+ constructor(message: string, validationErrors: ValidationIssue[], rawOutput: string, retryCount: number, strategy: StructuredOutputStrategy);
696
+ /**
697
+ * Converts error to a plain object for serialization.
698
+ */
699
+ toPlainObject(): Record<string, unknown>;
700
+ }
701
+ //# sourceMappingURL=IStructuredOutputManager.d.ts.map