@robota-sdk/agent-core 3.0.0-beta.1

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 (508) hide show
  1. package/CHANGELOG.md +180 -0
  2. package/LICENSE +21 -0
  3. package/README.md +230 -0
  4. package/dist/abstracts/abstract-agent.d.ts +56 -0
  5. package/dist/abstracts/abstract-agent.d.ts.map +1 -0
  6. package/dist/abstracts/abstract-agent.js +55 -0
  7. package/dist/abstracts/abstract-agent.js.map +1 -0
  8. package/dist/abstracts/abstract-ai-provider.d.ts +187 -0
  9. package/dist/abstracts/abstract-ai-provider.d.ts.map +1 -0
  10. package/dist/abstracts/abstract-ai-provider.js +252 -0
  11. package/dist/abstracts/abstract-ai-provider.js.map +1 -0
  12. package/dist/abstracts/abstract-executor.d.ts +110 -0
  13. package/dist/abstracts/abstract-executor.d.ts.map +1 -0
  14. package/dist/abstracts/abstract-executor.js +156 -0
  15. package/dist/abstracts/abstract-executor.js.map +1 -0
  16. package/dist/abstracts/abstract-manager.d.ts +42 -0
  17. package/dist/abstracts/abstract-manager.d.ts.map +1 -0
  18. package/dist/abstracts/abstract-manager.js +49 -0
  19. package/dist/abstracts/abstract-manager.js.map +1 -0
  20. package/dist/abstracts/abstract-module.d.ts +365 -0
  21. package/dist/abstracts/abstract-module.d.ts.map +1 -0
  22. package/dist/abstracts/abstract-module.js +474 -0
  23. package/dist/abstracts/abstract-module.js.map +1 -0
  24. package/dist/abstracts/abstract-plugin.d.ts +369 -0
  25. package/dist/abstracts/abstract-plugin.d.ts.map +1 -0
  26. package/dist/abstracts/abstract-plugin.js +258 -0
  27. package/dist/abstracts/abstract-plugin.js.map +1 -0
  28. package/dist/abstracts/abstract-tool.d.ts +175 -0
  29. package/dist/abstracts/abstract-tool.d.ts.map +1 -0
  30. package/dist/abstracts/abstract-tool.js +140 -0
  31. package/dist/abstracts/abstract-tool.js.map +1 -0
  32. package/dist/abstracts/abstract-workflow-converter.d.ts +136 -0
  33. package/dist/abstracts/abstract-workflow-converter.d.ts.map +1 -0
  34. package/dist/abstracts/abstract-workflow-converter.js +252 -0
  35. package/dist/abstracts/abstract-workflow-converter.js.map +1 -0
  36. package/dist/abstracts/abstract-workflow-validator.d.ts +203 -0
  37. package/dist/abstracts/abstract-workflow-validator.d.ts.map +1 -0
  38. package/dist/abstracts/abstract-workflow-validator.js +447 -0
  39. package/dist/abstracts/abstract-workflow-validator.js.map +1 -0
  40. package/dist/abstracts/index.d.ts +6 -0
  41. package/dist/abstracts/index.d.ts.map +1 -0
  42. package/dist/abstracts/index.js +9 -0
  43. package/dist/abstracts/index.js.map +1 -0
  44. package/dist/agents/constants.d.ts +23 -0
  45. package/dist/agents/constants.d.ts.map +1 -0
  46. package/dist/agents/constants.js +22 -0
  47. package/dist/agents/constants.js.map +1 -0
  48. package/dist/agents/index.d.ts +1 -0
  49. package/dist/agents/index.d.ts.map +1 -0
  50. package/dist/agents/index.js +4 -0
  51. package/dist/agents/index.js.map +1 -0
  52. package/dist/agents/robota.test.d.ts +2 -0
  53. package/dist/agents/robota.test.d.ts.map +1 -0
  54. package/dist/agents/robota.test.js +416 -0
  55. package/dist/agents/robota.test.js.map +1 -0
  56. package/dist/browser/builtin-templates.json +107 -0
  57. package/dist/browser/index.d.ts +4237 -0
  58. package/dist/browser/index.js +4 -0
  59. package/dist/core/robota.d.ts +694 -0
  60. package/dist/core/robota.d.ts.map +1 -0
  61. package/dist/core/robota.js +1277 -0
  62. package/dist/core/robota.js.map +1 -0
  63. package/dist/executors/local-executor.d.ts +96 -0
  64. package/dist/executors/local-executor.d.ts.map +1 -0
  65. package/dist/executors/local-executor.js +197 -0
  66. package/dist/executors/local-executor.js.map +1 -0
  67. package/dist/executors/local-executor.test.d.ts +2 -0
  68. package/dist/executors/local-executor.test.d.ts.map +1 -0
  69. package/dist/executors/local-executor.test.js +192 -0
  70. package/dist/executors/local-executor.test.js.map +1 -0
  71. package/dist/index.d.ts +274 -0
  72. package/dist/index.d.ts.map +1 -0
  73. package/dist/index.js +235 -0
  74. package/dist/index.js.map +1 -0
  75. package/dist/interfaces/agent.d.ts +198 -0
  76. package/dist/interfaces/agent.d.ts.map +1 -0
  77. package/dist/interfaces/agent.js +2 -0
  78. package/dist/interfaces/agent.js.map +1 -0
  79. package/dist/interfaces/event-service.d.ts +79 -0
  80. package/dist/interfaces/event-service.d.ts.map +1 -0
  81. package/dist/interfaces/event-service.js +2 -0
  82. package/dist/interfaces/event-service.js.map +1 -0
  83. package/dist/interfaces/executor.d.ts +128 -0
  84. package/dist/interfaces/executor.d.ts.map +1 -0
  85. package/dist/interfaces/executor.js +2 -0
  86. package/dist/interfaces/executor.js.map +1 -0
  87. package/dist/interfaces/history-module.d.ts +19 -0
  88. package/dist/interfaces/history-module.d.ts.map +1 -0
  89. package/dist/interfaces/history-module.js +2 -0
  90. package/dist/interfaces/history-module.js.map +1 -0
  91. package/dist/interfaces/index.d.ts +13 -0
  92. package/dist/interfaces/index.d.ts.map +1 -0
  93. package/dist/interfaces/index.js +4 -0
  94. package/dist/interfaces/index.js.map +1 -0
  95. package/dist/interfaces/manager.d.ts +142 -0
  96. package/dist/interfaces/manager.d.ts.map +1 -0
  97. package/dist/interfaces/manager.js +2 -0
  98. package/dist/interfaces/manager.js.map +1 -0
  99. package/dist/interfaces/messages.d.ts +75 -0
  100. package/dist/interfaces/messages.d.ts.map +1 -0
  101. package/dist/interfaces/messages.js +29 -0
  102. package/dist/interfaces/messages.js.map +1 -0
  103. package/dist/interfaces/progress-reporting.d.ts +86 -0
  104. package/dist/interfaces/progress-reporting.d.ts.map +1 -0
  105. package/dist/interfaces/progress-reporting.js +37 -0
  106. package/dist/interfaces/progress-reporting.js.map +1 -0
  107. package/dist/interfaces/provider.d.ts +217 -0
  108. package/dist/interfaces/provider.d.ts.map +1 -0
  109. package/dist/interfaces/provider.js +2 -0
  110. package/dist/interfaces/provider.js.map +1 -0
  111. package/dist/interfaces/service.d.ts +205 -0
  112. package/dist/interfaces/service.d.ts.map +1 -0
  113. package/dist/interfaces/service.js +6 -0
  114. package/dist/interfaces/service.js.map +1 -0
  115. package/dist/interfaces/tool.d.ts +248 -0
  116. package/dist/interfaces/tool.d.ts.map +1 -0
  117. package/dist/interfaces/tool.js +2 -0
  118. package/dist/interfaces/tool.js.map +1 -0
  119. package/dist/interfaces/types.d.ts +71 -0
  120. package/dist/interfaces/types.d.ts.map +1 -0
  121. package/dist/interfaces/types.js +33 -0
  122. package/dist/interfaces/types.js.map +1 -0
  123. package/dist/interfaces/workflow-converter.d.ts +193 -0
  124. package/dist/interfaces/workflow-converter.d.ts.map +1 -0
  125. package/dist/interfaces/workflow-converter.js +11 -0
  126. package/dist/interfaces/workflow-converter.js.map +1 -0
  127. package/dist/interfaces/workflow-validator.d.ts +209 -0
  128. package/dist/interfaces/workflow-validator.d.ts.map +1 -0
  129. package/dist/interfaces/workflow-validator.js +16 -0
  130. package/dist/interfaces/workflow-validator.js.map +1 -0
  131. package/dist/managers/agent-factory.d.ts +132 -0
  132. package/dist/managers/agent-factory.d.ts.map +1 -0
  133. package/dist/managers/agent-factory.js +284 -0
  134. package/dist/managers/agent-factory.js.map +1 -0
  135. package/dist/managers/agent-factory.test.d.ts +2 -0
  136. package/dist/managers/agent-factory.test.d.ts.map +1 -0
  137. package/dist/managers/agent-factory.test.js +249 -0
  138. package/dist/managers/agent-factory.test.js.map +1 -0
  139. package/dist/managers/agent-templates.d.ts +84 -0
  140. package/dist/managers/agent-templates.d.ts.map +1 -0
  141. package/dist/managers/agent-templates.js +159 -0
  142. package/dist/managers/agent-templates.js.map +1 -0
  143. package/dist/managers/ai-provider-manager.d.ts +80 -0
  144. package/dist/managers/ai-provider-manager.d.ts.map +1 -0
  145. package/dist/managers/ai-provider-manager.js +226 -0
  146. package/dist/managers/ai-provider-manager.js.map +1 -0
  147. package/dist/managers/conversation-history-manager.d.ts +455 -0
  148. package/dist/managers/conversation-history-manager.d.ts.map +1 -0
  149. package/dist/managers/conversation-history-manager.js +578 -0
  150. package/dist/managers/conversation-history-manager.js.map +1 -0
  151. package/dist/managers/conversation-history-manager.test.d.ts +2 -0
  152. package/dist/managers/conversation-history-manager.test.d.ts.map +1 -0
  153. package/dist/managers/conversation-history-manager.test.js +374 -0
  154. package/dist/managers/conversation-history-manager.test.js.map +1 -0
  155. package/dist/managers/index.d.ts +8 -0
  156. package/dist/managers/index.d.ts.map +1 -0
  157. package/dist/managers/index.js +8 -0
  158. package/dist/managers/index.js.map +1 -0
  159. package/dist/managers/module-registry.d.ts +161 -0
  160. package/dist/managers/module-registry.d.ts.map +1 -0
  161. package/dist/managers/module-registry.js +519 -0
  162. package/dist/managers/module-registry.js.map +1 -0
  163. package/dist/managers/module-type-registry.d.ts +113 -0
  164. package/dist/managers/module-type-registry.d.ts.map +1 -0
  165. package/dist/managers/module-type-registry.js +439 -0
  166. package/dist/managers/module-type-registry.js.map +1 -0
  167. package/dist/managers/plugins.d.ts +166 -0
  168. package/dist/managers/plugins.d.ts.map +1 -0
  169. package/dist/managers/plugins.js +339 -0
  170. package/dist/managers/plugins.js.map +1 -0
  171. package/dist/managers/tool-manager.d.ts +70 -0
  172. package/dist/managers/tool-manager.d.ts.map +1 -0
  173. package/dist/managers/tool-manager.js +138 -0
  174. package/dist/managers/tool-manager.js.map +1 -0
  175. package/dist/managers/tool-manager.test.d.ts +2 -0
  176. package/dist/managers/tool-manager.test.d.ts.map +1 -0
  177. package/dist/managers/tool-manager.test.js +186 -0
  178. package/dist/managers/tool-manager.test.js.map +1 -0
  179. package/dist/node/builtin-templates.json +107 -0
  180. package/dist/node/index.cjs +4 -0
  181. package/dist/node/index.d.cts +4237 -0
  182. package/dist/node/index.d.ts +4237 -0
  183. package/dist/node/index.js +4 -0
  184. package/dist/plugins/conversation-history/conversation-history-plugin.d.ts +67 -0
  185. package/dist/plugins/conversation-history/conversation-history-plugin.d.ts.map +1 -0
  186. package/dist/plugins/conversation-history/conversation-history-plugin.js +270 -0
  187. package/dist/plugins/conversation-history/conversation-history-plugin.js.map +1 -0
  188. package/dist/plugins/conversation-history/index.d.ts +3 -0
  189. package/dist/plugins/conversation-history/index.d.ts.map +1 -0
  190. package/dist/plugins/conversation-history/index.js +2 -0
  191. package/dist/plugins/conversation-history/index.js.map +1 -0
  192. package/dist/plugins/conversation-history/storages/database-storage.d.ts +19 -0
  193. package/dist/plugins/conversation-history/storages/database-storage.d.ts.map +1 -0
  194. package/dist/plugins/conversation-history/storages/database-storage.js +94 -0
  195. package/dist/plugins/conversation-history/storages/database-storage.js.map +1 -0
  196. package/dist/plugins/conversation-history/storages/file-storage.d.ts +15 -0
  197. package/dist/plugins/conversation-history/storages/file-storage.d.ts.map +1 -0
  198. package/dist/plugins/conversation-history/storages/file-storage.js +94 -0
  199. package/dist/plugins/conversation-history/storages/file-storage.js.map +1 -0
  200. package/dist/plugins/conversation-history/storages/index.d.ts +4 -0
  201. package/dist/plugins/conversation-history/storages/index.d.ts.map +1 -0
  202. package/dist/plugins/conversation-history/storages/index.js +4 -0
  203. package/dist/plugins/conversation-history/storages/index.js.map +1 -0
  204. package/dist/plugins/conversation-history/storages/memory-storage.d.ts +15 -0
  205. package/dist/plugins/conversation-history/storages/memory-storage.d.ts.map +1 -0
  206. package/dist/plugins/conversation-history/storages/memory-storage.js +33 -0
  207. package/dist/plugins/conversation-history/storages/memory-storage.js.map +1 -0
  208. package/dist/plugins/conversation-history/types.d.ts +61 -0
  209. package/dist/plugins/conversation-history/types.d.ts.map +1 -0
  210. package/dist/plugins/conversation-history/types.js +2 -0
  211. package/dist/plugins/conversation-history/types.js.map +1 -0
  212. package/dist/plugins/error-handling/context-adapter.d.ts +30 -0
  213. package/dist/plugins/error-handling/context-adapter.d.ts.map +1 -0
  214. package/dist/plugins/error-handling/context-adapter.js +41 -0
  215. package/dist/plugins/error-handling/context-adapter.js.map +1 -0
  216. package/dist/plugins/error-handling/error-handling-plugin.d.ts +49 -0
  217. package/dist/plugins/error-handling/error-handling-plugin.d.ts.map +1 -0
  218. package/dist/plugins/error-handling/error-handling-plugin.js +229 -0
  219. package/dist/plugins/error-handling/error-handling-plugin.js.map +1 -0
  220. package/dist/plugins/error-handling/index.d.ts +10 -0
  221. package/dist/plugins/error-handling/index.d.ts.map +1 -0
  222. package/dist/plugins/error-handling/index.js +10 -0
  223. package/dist/plugins/error-handling/index.js.map +1 -0
  224. package/dist/plugins/error-handling/types.d.ts +73 -0
  225. package/dist/plugins/error-handling/types.d.ts.map +1 -0
  226. package/dist/plugins/error-handling/types.js +14 -0
  227. package/dist/plugins/error-handling/types.js.map +1 -0
  228. package/dist/plugins/event-emitter/metrics.d.ts +17 -0
  229. package/dist/plugins/event-emitter/metrics.d.ts.map +1 -0
  230. package/dist/plugins/event-emitter/metrics.js +17 -0
  231. package/dist/plugins/event-emitter/metrics.js.map +1 -0
  232. package/dist/plugins/event-emitter/types.d.ts +112 -0
  233. package/dist/plugins/event-emitter/types.d.ts.map +1 -0
  234. package/dist/plugins/event-emitter/types.js +65 -0
  235. package/dist/plugins/event-emitter/types.js.map +1 -0
  236. package/dist/plugins/event-emitter-plugin.d.ts +222 -0
  237. package/dist/plugins/event-emitter-plugin.d.ts.map +1 -0
  238. package/dist/plugins/event-emitter-plugin.js +432 -0
  239. package/dist/plugins/event-emitter-plugin.js.map +1 -0
  240. package/dist/plugins/event-emitter-plugin.test.d.ts +2 -0
  241. package/dist/plugins/event-emitter-plugin.test.d.ts.map +1 -0
  242. package/dist/plugins/event-emitter-plugin.test.js +94 -0
  243. package/dist/plugins/event-emitter-plugin.test.js.map +1 -0
  244. package/dist/plugins/execution/execution-analytics-plugin.d.ts +129 -0
  245. package/dist/plugins/execution/execution-analytics-plugin.d.ts.map +1 -0
  246. package/dist/plugins/execution/execution-analytics-plugin.js +517 -0
  247. package/dist/plugins/execution/execution-analytics-plugin.js.map +1 -0
  248. package/dist/plugins/execution/index.d.ts +3 -0
  249. package/dist/plugins/execution/index.d.ts.map +1 -0
  250. package/dist/plugins/execution/index.js +2 -0
  251. package/dist/plugins/execution/index.js.map +1 -0
  252. package/dist/plugins/execution/types.d.ts +90 -0
  253. package/dist/plugins/execution/types.d.ts.map +1 -0
  254. package/dist/plugins/execution/types.js +2 -0
  255. package/dist/plugins/execution/types.js.map +1 -0
  256. package/dist/plugins/index.d.ts +10 -0
  257. package/dist/plugins/index.d.ts.map +1 -0
  258. package/dist/plugins/index.js +11 -0
  259. package/dist/plugins/index.js.map +1 -0
  260. package/dist/plugins/limits/types.d.ts +61 -0
  261. package/dist/plugins/limits/types.d.ts.map +1 -0
  262. package/dist/plugins/limits/types.js +2 -0
  263. package/dist/plugins/limits/types.js.map +1 -0
  264. package/dist/plugins/limits-plugin.d.ts +113 -0
  265. package/dist/plugins/limits-plugin.d.ts.map +1 -0
  266. package/dist/plugins/limits-plugin.js +380 -0
  267. package/dist/plugins/limits-plugin.js.map +1 -0
  268. package/dist/plugins/logging/formatters.d.ts +14 -0
  269. package/dist/plugins/logging/formatters.d.ts.map +1 -0
  270. package/dist/plugins/logging/formatters.js +24 -0
  271. package/dist/plugins/logging/formatters.js.map +1 -0
  272. package/dist/plugins/logging/index.d.ts +3 -0
  273. package/dist/plugins/logging/index.d.ts.map +1 -0
  274. package/dist/plugins/logging/index.js +2 -0
  275. package/dist/plugins/logging/index.js.map +1 -0
  276. package/dist/plugins/logging/logging-plugin.d.ts +91 -0
  277. package/dist/plugins/logging/logging-plugin.d.ts.map +1 -0
  278. package/dist/plugins/logging/logging-plugin.js +335 -0
  279. package/dist/plugins/logging/logging-plugin.js.map +1 -0
  280. package/dist/plugins/logging/storages/console-storage.d.ts +14 -0
  281. package/dist/plugins/logging/storages/console-storage.d.ts.map +1 -0
  282. package/dist/plugins/logging/storages/console-storage.js +38 -0
  283. package/dist/plugins/logging/storages/console-storage.js.map +1 -0
  284. package/dist/plugins/logging/storages/file-storage.d.ts +14 -0
  285. package/dist/plugins/logging/storages/file-storage.d.ts.map +1 -0
  286. package/dist/plugins/logging/storages/file-storage.js +41 -0
  287. package/dist/plugins/logging/storages/file-storage.js.map +1 -0
  288. package/dist/plugins/logging/storages/index.d.ts +5 -0
  289. package/dist/plugins/logging/storages/index.d.ts.map +1 -0
  290. package/dist/plugins/logging/storages/index.js +5 -0
  291. package/dist/plugins/logging/storages/index.js.map +1 -0
  292. package/dist/plugins/logging/storages/remote-storage.d.ts +20 -0
  293. package/dist/plugins/logging/storages/remote-storage.d.ts.map +1 -0
  294. package/dist/plugins/logging/storages/remote-storage.js +61 -0
  295. package/dist/plugins/logging/storages/remote-storage.js.map +1 -0
  296. package/dist/plugins/logging/storages/silent-storage.d.ts +10 -0
  297. package/dist/plugins/logging/storages/silent-storage.d.ts.map +1 -0
  298. package/dist/plugins/logging/storages/silent-storage.js +15 -0
  299. package/dist/plugins/logging/storages/silent-storage.js.map +1 -0
  300. package/dist/plugins/logging/types.d.ts +84 -0
  301. package/dist/plugins/logging/types.d.ts.map +1 -0
  302. package/dist/plugins/logging/types.js +2 -0
  303. package/dist/plugins/logging/types.js.map +1 -0
  304. package/dist/plugins/performance/collectors/system-metrics-collector.d.ts +12 -0
  305. package/dist/plugins/performance/collectors/system-metrics-collector.d.ts.map +1 -0
  306. package/dist/plugins/performance/collectors/system-metrics-collector.js +65 -0
  307. package/dist/plugins/performance/collectors/system-metrics-collector.js.map +1 -0
  308. package/dist/plugins/performance/index.d.ts +5 -0
  309. package/dist/plugins/performance/index.d.ts.map +1 -0
  310. package/dist/plugins/performance/index.js +4 -0
  311. package/dist/plugins/performance/index.js.map +1 -0
  312. package/dist/plugins/performance/performance-plugin.d.ts +49 -0
  313. package/dist/plugins/performance/performance-plugin.d.ts.map +1 -0
  314. package/dist/plugins/performance/performance-plugin.js +293 -0
  315. package/dist/plugins/performance/performance-plugin.js.map +1 -0
  316. package/dist/plugins/performance/storages/index.d.ts +2 -0
  317. package/dist/plugins/performance/storages/index.d.ts.map +1 -0
  318. package/dist/plugins/performance/storages/index.js +4 -0
  319. package/dist/plugins/performance/storages/index.js.map +1 -0
  320. package/dist/plugins/performance/storages/memory-storage.d.ts +19 -0
  321. package/dist/plugins/performance/storages/memory-storage.d.ts.map +1 -0
  322. package/dist/plugins/performance/storages/memory-storage.js +69 -0
  323. package/dist/plugins/performance/storages/memory-storage.js.map +1 -0
  324. package/dist/plugins/performance/types.d.ts +154 -0
  325. package/dist/plugins/performance/types.d.ts.map +1 -0
  326. package/dist/plugins/performance/types.js +2 -0
  327. package/dist/plugins/performance/types.js.map +1 -0
  328. package/dist/plugins/usage/aggregate-usage-stats.d.ts +12 -0
  329. package/dist/plugins/usage/aggregate-usage-stats.d.ts.map +1 -0
  330. package/dist/plugins/usage/aggregate-usage-stats.js +115 -0
  331. package/dist/plugins/usage/aggregate-usage-stats.js.map +1 -0
  332. package/dist/plugins/usage/index.d.ts +5 -0
  333. package/dist/plugins/usage/index.d.ts.map +1 -0
  334. package/dist/plugins/usage/index.js +4 -0
  335. package/dist/plugins/usage/index.js.map +1 -0
  336. package/dist/plugins/usage/storages/file-storage.d.ts +22 -0
  337. package/dist/plugins/usage/storages/file-storage.d.ts.map +1 -0
  338. package/dist/plugins/usage/storages/file-storage.js +111 -0
  339. package/dist/plugins/usage/storages/file-storage.js.map +1 -0
  340. package/dist/plugins/usage/storages/index.d.ts +5 -0
  341. package/dist/plugins/usage/storages/index.d.ts.map +1 -0
  342. package/dist/plugins/usage/storages/index.js +5 -0
  343. package/dist/plugins/usage/storages/index.js.map +1 -0
  344. package/dist/plugins/usage/storages/memory-storage.d.ts +22 -0
  345. package/dist/plugins/usage/storages/memory-storage.d.ts.map +1 -0
  346. package/dist/plugins/usage/storages/memory-storage.js +42 -0
  347. package/dist/plugins/usage/storages/memory-storage.js.map +1 -0
  348. package/dist/plugins/usage/storages/remote-storage.d.ts +26 -0
  349. package/dist/plugins/usage/storages/remote-storage.d.ts.map +1 -0
  350. package/dist/plugins/usage/storages/remote-storage.js +115 -0
  351. package/dist/plugins/usage/storages/remote-storage.js.map +1 -0
  352. package/dist/plugins/usage/storages/silent-storage.d.ts +19 -0
  353. package/dist/plugins/usage/storages/silent-storage.d.ts.map +1 -0
  354. package/dist/plugins/usage/storages/silent-storage.js +26 -0
  355. package/dist/plugins/usage/storages/silent-storage.js.map +1 -0
  356. package/dist/plugins/usage/types.d.ts +127 -0
  357. package/dist/plugins/usage/types.d.ts.map +1 -0
  358. package/dist/plugins/usage/types.js +2 -0
  359. package/dist/plugins/usage/types.js.map +1 -0
  360. package/dist/plugins/usage/usage-plugin.d.ts +67 -0
  361. package/dist/plugins/usage/usage-plugin.d.ts.map +1 -0
  362. package/dist/plugins/usage/usage-plugin.js +309 -0
  363. package/dist/plugins/usage/usage-plugin.js.map +1 -0
  364. package/dist/plugins/webhook/http-client.d.ts +30 -0
  365. package/dist/plugins/webhook/http-client.d.ts.map +1 -0
  366. package/dist/plugins/webhook/http-client.js +110 -0
  367. package/dist/plugins/webhook/http-client.js.map +1 -0
  368. package/dist/plugins/webhook/index.d.ts +9 -0
  369. package/dist/plugins/webhook/index.d.ts.map +1 -0
  370. package/dist/plugins/webhook/index.js +9 -0
  371. package/dist/plugins/webhook/index.js.map +1 -0
  372. package/dist/plugins/webhook/transformer.d.ts +63 -0
  373. package/dist/plugins/webhook/transformer.d.ts.map +1 -0
  374. package/dist/plugins/webhook/transformer.js +157 -0
  375. package/dist/plugins/webhook/transformer.js.map +1 -0
  376. package/dist/plugins/webhook/types.d.ts +183 -0
  377. package/dist/plugins/webhook/types.d.ts.map +1 -0
  378. package/dist/plugins/webhook/types.js +2 -0
  379. package/dist/plugins/webhook/types.js.map +1 -0
  380. package/dist/plugins/webhook/webhook-plugin.d.ts +92 -0
  381. package/dist/plugins/webhook/webhook-plugin.d.ts.map +1 -0
  382. package/dist/plugins/webhook/webhook-plugin.js +328 -0
  383. package/dist/plugins/webhook/webhook-plugin.js.map +1 -0
  384. package/dist/schemas/agent-template-schema.d.ts +137 -0
  385. package/dist/schemas/agent-template-schema.d.ts.map +1 -0
  386. package/dist/schemas/agent-template-schema.js +87 -0
  387. package/dist/schemas/agent-template-schema.js.map +1 -0
  388. package/dist/services/conversation-service/index.d.ts +88 -0
  389. package/dist/services/conversation-service/index.d.ts.map +1 -0
  390. package/dist/services/conversation-service/index.js +441 -0
  391. package/dist/services/conversation-service/index.js.map +1 -0
  392. package/dist/services/conversation-service/types.d.ts +32 -0
  393. package/dist/services/conversation-service/types.d.ts.map +1 -0
  394. package/dist/services/conversation-service/types.js +8 -0
  395. package/dist/services/conversation-service/types.js.map +1 -0
  396. package/dist/services/event-service.d.ts +61 -0
  397. package/dist/services/event-service.d.ts.map +1 -0
  398. package/dist/services/event-service.js +110 -0
  399. package/dist/services/event-service.js.map +1 -0
  400. package/dist/services/event-service.test.d.ts +2 -0
  401. package/dist/services/event-service.test.d.ts.map +1 -0
  402. package/dist/services/event-service.test.js +86 -0
  403. package/dist/services/event-service.test.js.map +1 -0
  404. package/dist/services/execution-service.d.ts +151 -0
  405. package/dist/services/execution-service.d.ts.map +1 -0
  406. package/dist/services/execution-service.js +1262 -0
  407. package/dist/services/execution-service.js.map +1 -0
  408. package/dist/services/execution-service.test.d.ts +2 -0
  409. package/dist/services/execution-service.test.d.ts.map +1 -0
  410. package/dist/services/execution-service.test.js +338 -0
  411. package/dist/services/execution-service.test.js.map +1 -0
  412. package/dist/services/history-module.d.ts +15 -0
  413. package/dist/services/history-module.d.ts.map +1 -0
  414. package/dist/services/history-module.js +42 -0
  415. package/dist/services/history-module.js.map +1 -0
  416. package/dist/services/in-memory-history-store.d.ts +12 -0
  417. package/dist/services/in-memory-history-store.d.ts.map +1 -0
  418. package/dist/services/in-memory-history-store.js +41 -0
  419. package/dist/services/in-memory-history-store.js.map +1 -0
  420. package/dist/services/index.d.ts +7 -0
  421. package/dist/services/index.d.ts.map +1 -0
  422. package/dist/services/index.js +13 -0
  423. package/dist/services/index.js.map +1 -0
  424. package/dist/services/task-events.d.ts +6 -0
  425. package/dist/services/task-events.d.ts.map +1 -0
  426. package/dist/services/task-events.js +6 -0
  427. package/dist/services/task-events.js.map +1 -0
  428. package/dist/services/tool-execution-service.d.ts +74 -0
  429. package/dist/services/tool-execution-service.d.ts.map +1 -0
  430. package/dist/services/tool-execution-service.js +189 -0
  431. package/dist/services/tool-execution-service.js.map +1 -0
  432. package/dist/services/user-events.d.ts +7 -0
  433. package/dist/services/user-events.d.ts.map +1 -0
  434. package/dist/services/user-events.js +6 -0
  435. package/dist/services/user-events.js.map +1 -0
  436. package/dist/tools/implementations/function-tool/index.d.ts +9 -0
  437. package/dist/tools/implementations/function-tool/index.d.ts.map +1 -0
  438. package/dist/tools/implementations/function-tool/index.js +13 -0
  439. package/dist/tools/implementations/function-tool/index.js.map +1 -0
  440. package/dist/tools/implementations/function-tool/schema-converter.d.ts +32 -0
  441. package/dist/tools/implementations/function-tool/schema-converter.d.ts.map +1 -0
  442. package/dist/tools/implementations/function-tool/schema-converter.js +164 -0
  443. package/dist/tools/implementations/function-tool/schema-converter.js.map +1 -0
  444. package/dist/tools/implementations/function-tool/types.d.ts +72 -0
  445. package/dist/tools/implementations/function-tool/types.d.ts.map +1 -0
  446. package/dist/tools/implementations/function-tool/types.js +14 -0
  447. package/dist/tools/implementations/function-tool/types.js.map +1 -0
  448. package/dist/tools/implementations/function-tool.d.ts +49 -0
  449. package/dist/tools/implementations/function-tool.d.ts.map +1 -0
  450. package/dist/tools/implementations/function-tool.js +223 -0
  451. package/dist/tools/implementations/function-tool.js.map +1 -0
  452. package/dist/tools/implementations/index.d.ts +4 -0
  453. package/dist/tools/implementations/index.d.ts.map +1 -0
  454. package/dist/tools/implementations/index.js +5 -0
  455. package/dist/tools/implementations/index.js.map +1 -0
  456. package/dist/tools/implementations/mcp-tool.d.ts +72 -0
  457. package/dist/tools/implementations/mcp-tool.d.ts.map +1 -0
  458. package/dist/tools/implementations/mcp-tool.js +246 -0
  459. package/dist/tools/implementations/mcp-tool.js.map +1 -0
  460. package/dist/tools/implementations/openapi-tool.d.ts +56 -0
  461. package/dist/tools/implementations/openapi-tool.d.ts.map +1 -0
  462. package/dist/tools/implementations/openapi-tool.js +324 -0
  463. package/dist/tools/implementations/openapi-tool.js.map +1 -0
  464. package/dist/tools/implementations/relay-mcp-tool.d.ts +38 -0
  465. package/dist/tools/implementations/relay-mcp-tool.d.ts.map +1 -0
  466. package/dist/tools/implementations/relay-mcp-tool.js +46 -0
  467. package/dist/tools/implementations/relay-mcp-tool.js.map +1 -0
  468. package/dist/tools/index.d.ts +3 -0
  469. package/dist/tools/index.d.ts.map +1 -0
  470. package/dist/tools/index.js +4 -0
  471. package/dist/tools/index.js.map +1 -0
  472. package/dist/tools/registry/index.d.ts +2 -0
  473. package/dist/tools/registry/index.d.ts.map +1 -0
  474. package/dist/tools/registry/index.js +3 -0
  475. package/dist/tools/registry/index.js.map +1 -0
  476. package/dist/tools/registry/tool-registry.d.ts +54 -0
  477. package/dist/tools/registry/tool-registry.d.ts.map +1 -0
  478. package/dist/tools/registry/tool-registry.js +146 -0
  479. package/dist/tools/registry/tool-registry.js.map +1 -0
  480. package/dist/utils/errors.d.ts +155 -0
  481. package/dist/utils/errors.d.ts.map +1 -0
  482. package/dist/utils/errors.js +203 -0
  483. package/dist/utils/errors.js.map +1 -0
  484. package/dist/utils/execution-proxy.d.ts +75 -0
  485. package/dist/utils/execution-proxy.d.ts.map +1 -0
  486. package/dist/utils/execution-proxy.js +230 -0
  487. package/dist/utils/execution-proxy.js.map +1 -0
  488. package/dist/utils/index.d.ts +11 -0
  489. package/dist/utils/index.d.ts.map +1 -0
  490. package/dist/utils/index.js +7 -0
  491. package/dist/utils/index.js.map +1 -0
  492. package/dist/utils/logger.d.ts +74 -0
  493. package/dist/utils/logger.d.ts.map +1 -0
  494. package/dist/utils/logger.js +143 -0
  495. package/dist/utils/logger.js.map +1 -0
  496. package/dist/utils/message-converter.d.ts +68 -0
  497. package/dist/utils/message-converter.d.ts.map +1 -0
  498. package/dist/utils/message-converter.js +87 -0
  499. package/dist/utils/message-converter.js.map +1 -0
  500. package/dist/utils/periodic-task.d.ts +14 -0
  501. package/dist/utils/periodic-task.d.ts.map +1 -0
  502. package/dist/utils/periodic-task.js +26 -0
  503. package/dist/utils/periodic-task.js.map +1 -0
  504. package/dist/utils/validation.d.ts +40 -0
  505. package/dist/utils/validation.d.ts.map +1 -0
  506. package/dist/utils/validation.js +162 -0
  507. package/dist/utils/validation.js.map +1 -0
  508. package/package.json +101 -0
@@ -0,0 +1,374 @@
1
+ import { describe, it, expect } from 'vitest';
2
+ import { ConversationSession, ConversationHistory, isToolMessage, isAssistantMessage, createAssistantMessage, createToolMessage } from './conversation-history-manager';
3
+ describe('ConversationSession', () => {
4
+ describe('addToolMessageWithId', () => {
5
+ it('should add tool message successfully with unique toolCallId', () => {
6
+ const session = new ConversationSession();
7
+ session.addToolMessageWithId('Tool result content', 'tool-call-1', 'testTool', { success: true });
8
+ const messages = session.getMessages();
9
+ expect(messages).toHaveLength(1);
10
+ expect(messages[0].role).toBe('tool');
11
+ expect(messages[0].content).toBe('Tool result content');
12
+ expect(isToolMessage(messages[0]) && messages[0].toolCallId).toBe('tool-call-1');
13
+ });
14
+ it('should throw error when adding tool message with duplicate toolCallId', () => {
15
+ const session = new ConversationSession();
16
+ // Add first tool message
17
+ session.addToolMessageWithId('First tool result', 'tool-call-1', 'testTool', { success: true });
18
+ // Attempt to add second tool message with same toolCallId
19
+ expect(() => {
20
+ session.addToolMessageWithId('Second tool result', 'tool-call-1', // Same toolCallId
21
+ 'testTool', { success: true });
22
+ }).toThrow('Duplicate tool message detected for toolCallId: tool-call-1');
23
+ // Verify only one message was added
24
+ const messages = session.getMessages();
25
+ expect(messages).toHaveLength(1);
26
+ expect(messages[0].content).toBe('First tool result');
27
+ });
28
+ it('should allow different toolCallIds', () => {
29
+ const session = new ConversationSession();
30
+ session.addToolMessageWithId('First tool result', 'tool-call-1', 'testTool', { success: true });
31
+ session.addToolMessageWithId('Second tool result', 'tool-call-2', // Different toolCallId
32
+ 'testTool', { success: true });
33
+ const messages = session.getMessages();
34
+ expect(messages).toHaveLength(2);
35
+ expect(isToolMessage(messages[0]) && messages[0].toolCallId).toBe('tool-call-1');
36
+ expect(isToolMessage(messages[1]) && messages[1].toolCallId).toBe('tool-call-2');
37
+ });
38
+ it('should maintain proper message order', () => {
39
+ const session = new ConversationSession();
40
+ session.addUserMessage('User input');
41
+ session.addAssistantMessage('Assistant response', [
42
+ { id: 'tool-call-1', type: 'function', function: { name: 'testTool', arguments: '{}' } }
43
+ ]);
44
+ session.addToolMessageWithId('Tool result', 'tool-call-1', 'testTool');
45
+ const messages = session.getMessages();
46
+ expect(messages).toHaveLength(3);
47
+ expect(messages[0].role).toBe('user');
48
+ expect(messages[1].role).toBe('assistant');
49
+ expect(messages[2].role).toBe('tool');
50
+ });
51
+ });
52
+ describe('High-level API data integrity', () => {
53
+ it('should preserve assistant message with null content and tool calls', () => {
54
+ const session = new ConversationSession();
55
+ // Add user message
56
+ session.addUserMessage('What is 5 plus 3?');
57
+ // Add assistant message with null content and tool calls (simulating OpenAI API response)
58
+ session.addAssistantMessage(null, [
59
+ {
60
+ id: 'call_calculate_123',
61
+ type: 'function',
62
+ function: {
63
+ name: 'calculate',
64
+ arguments: '{"operation":"add","a":5,"b":3}'
65
+ }
66
+ }
67
+ ]);
68
+ // Add tool result
69
+ session.addToolMessage('{"result":8,"operation":"5 + 3 = 8"}', 'call_calculate_123', 'calculate');
70
+ const messages = session.getMessages();
71
+ expect(messages).toHaveLength(3);
72
+ // Verify user message
73
+ expect(messages[0].role).toBe('user');
74
+ expect(messages[0].content).toBe('What is 5 plus 3?');
75
+ // Verify assistant message with null content is preserved
76
+ expect(messages[1].role).toBe('assistant');
77
+ expect(messages[1].content).toBe(null); // Critical: null should be preserved, not converted to empty string
78
+ expect(isAssistantMessage(messages[1]) && messages[1].toolCalls).toHaveLength(1);
79
+ expect(isAssistantMessage(messages[1]) && messages[1].toolCalls?.[0].id).toBe('call_calculate_123');
80
+ // Verify tool message
81
+ expect(messages[2].role).toBe('tool');
82
+ expect(messages[2].content).toBe('{"result":8,"operation":"5 + 3 = 8"}');
83
+ expect(isToolMessage(messages[2]) && messages[2].toolCallId).toBe('call_calculate_123');
84
+ });
85
+ it('should preserve assistant message with empty string content and tool calls', () => {
86
+ const session = new ConversationSession();
87
+ // Add assistant message with empty content and tool calls
88
+ session.addAssistantMessage('', [
89
+ {
90
+ id: 'call_weather_456',
91
+ type: 'function',
92
+ function: {
93
+ name: 'getWeather',
94
+ arguments: '{"city":"Seoul"}'
95
+ }
96
+ }
97
+ ]);
98
+ const messages = session.getMessages();
99
+ expect(messages).toHaveLength(1);
100
+ const assistantMessage = messages[0];
101
+ expect(assistantMessage.role).toBe('assistant');
102
+ expect(assistantMessage.content).toBe(''); // Empty string should be preserved as-is
103
+ expect(isAssistantMessage(assistantMessage) && assistantMessage.toolCalls).toHaveLength(1);
104
+ });
105
+ it('should preserve assistant message with meaningful content and tool calls', () => {
106
+ const session = new ConversationSession();
107
+ session.addAssistantMessage('Let me calculate that for you.', [
108
+ {
109
+ id: 'call_789',
110
+ type: 'function',
111
+ function: {
112
+ name: 'calculate',
113
+ arguments: '{"operation":"multiply","a":7,"b":8}'
114
+ }
115
+ }
116
+ ]);
117
+ const messages = session.getMessages();
118
+ expect(messages).toHaveLength(1);
119
+ const assistantMessage = messages[0];
120
+ expect(assistantMessage.role).toBe('assistant');
121
+ expect(assistantMessage.content).toBe('Let me calculate that for you.');
122
+ expect(isAssistantMessage(assistantMessage) && assistantMessage.toolCalls).toHaveLength(1);
123
+ expect(isAssistantMessage(assistantMessage) && assistantMessage.toolCalls?.[0].function.name).toBe('calculate');
124
+ });
125
+ it('should handle complete tool execution conversation flow', () => {
126
+ const session = new ConversationSession();
127
+ // Step 1: User asks question
128
+ session.addUserMessage('Calculate 15 * 24');
129
+ // Step 2: Assistant responds with tool call (null content)
130
+ session.addAssistantMessage(null, [
131
+ {
132
+ id: 'call_multiply_001',
133
+ type: 'function',
134
+ function: {
135
+ name: 'calculate',
136
+ arguments: '{"operation":"multiply","a":15,"b":24}'
137
+ }
138
+ }
139
+ ]);
140
+ // Step 3: Tool returns result
141
+ session.addToolMessage('{"result":360,"operation":"15 * 24 = 360"}', 'call_multiply_001', 'calculate');
142
+ // Step 4: Assistant provides final response
143
+ session.addAssistantMessage('The result of 15 * 24 is 360.');
144
+ const messages = session.getMessages();
145
+ expect(messages).toHaveLength(4);
146
+ // Validate the complete flow
147
+ expect(messages[0].role).toBe('user');
148
+ expect(messages[1].role).toBe('assistant');
149
+ expect(messages[1].content).toBe(null); // Tool call assistant message should have null content
150
+ expect(messages[2].role).toBe('tool');
151
+ expect(messages[3].role).toBe('assistant');
152
+ expect(messages[3].content).toBe('The result of 15 * 24 is 360.');
153
+ // Verify tool call data integrity
154
+ expect(isAssistantMessage(messages[1]) && messages[1].toolCalls?.[0].id).toBe('call_multiply_001');
155
+ expect(isToolMessage(messages[2]) && messages[2].toolCallId).toBe('call_multiply_001');
156
+ });
157
+ it('should handle multiple tool calls in single assistant message', () => {
158
+ const session = new ConversationSession();
159
+ session.addAssistantMessage(null, [
160
+ {
161
+ id: 'call_weather_001',
162
+ type: 'function',
163
+ function: {
164
+ name: 'getWeather',
165
+ arguments: '{"city":"Seoul"}'
166
+ }
167
+ },
168
+ {
169
+ id: 'call_weather_002',
170
+ type: 'function',
171
+ function: {
172
+ name: 'getWeather',
173
+ arguments: '{"city":"Tokyo"}'
174
+ }
175
+ }
176
+ ]);
177
+ session.addToolMessage('{"weather":"Sunny, 25°C"}', 'call_weather_001', 'getWeather');
178
+ session.addToolMessage('{"weather":"Cloudy, 18°C"}', 'call_weather_002', 'getWeather');
179
+ const messages = session.getMessages();
180
+ expect(messages).toHaveLength(3);
181
+ // Verify assistant message has multiple tool calls
182
+ expect(isAssistantMessage(messages[0]) && messages[0].toolCalls).toHaveLength(2);
183
+ expect(isAssistantMessage(messages[0]) && messages[0].content).toBe(null);
184
+ // Verify tool messages are correctly linked
185
+ expect(isToolMessage(messages[1]) && messages[1].toolCallId).toBe('call_weather_001');
186
+ expect(isToolMessage(messages[2]) && messages[2].toolCallId).toBe('call_weather_002');
187
+ });
188
+ it('should preserve metadata for all message types', () => {
189
+ const session = new ConversationSession();
190
+ const userMetadata = { userId: 'user123', timestamp: '2024-01-01' };
191
+ const assistantMetadata = { model: 'gpt-4', provider: 'openai' };
192
+ const toolMetadata = { executionTime: 150, success: true };
193
+ session.addUserMessage('Test message', userMetadata);
194
+ session.addAssistantMessage('Response', [], assistantMetadata);
195
+ session.addToolMessage('Tool result', 'call_123', 'testTool', toolMetadata);
196
+ const messages = session.getMessages();
197
+ expect(messages[0].metadata).toEqual(userMetadata);
198
+ expect(messages[1].metadata).toEqual(assistantMetadata);
199
+ expect(messages[2].metadata).toEqual(toolMetadata);
200
+ });
201
+ });
202
+ describe('Factory functions data integrity', () => {
203
+ it('should create assistant message with null content correctly', () => {
204
+ const message = createAssistantMessage(null, {
205
+ toolCalls: [
206
+ {
207
+ id: 'call_123',
208
+ type: 'function',
209
+ function: { name: 'test', arguments: '{}' }
210
+ }
211
+ ]
212
+ });
213
+ expect(message.role).toBe('assistant');
214
+ expect(message.content).toBe(null);
215
+ expect(message.toolCalls).toHaveLength(1);
216
+ expect(message.timestamp).toBeInstanceOf(Date);
217
+ });
218
+ it('should create tool message with all required fields', () => {
219
+ const message = createToolMessage('{"result": "success"}', {
220
+ toolCallId: 'call_123',
221
+ name: 'testTool',
222
+ metadata: { success: true }
223
+ });
224
+ expect(message.role).toBe('tool');
225
+ expect(message.content).toBe('{"result": "success"}');
226
+ expect(message.toolCallId).toBe('call_123');
227
+ expect(message.name).toBe('testTool');
228
+ expect(message.metadata).toEqual({ success: true });
229
+ expect(message.timestamp).toBeInstanceOf(Date);
230
+ });
231
+ });
232
+ });
233
+ describe('ConversationHistory', () => {
234
+ describe('High-level conversation management', () => {
235
+ it('should maintain conversation integrity across sessions', () => {
236
+ const history = new ConversationHistory();
237
+ const sessionA = history.getConversationSession('conversation-a');
238
+ const sessionB = history.getConversationSession('conversation-b');
239
+ // Add messages to different sessions
240
+ sessionA.addUserMessage('Hello from A');
241
+ sessionA.addAssistantMessage(null, [
242
+ { id: 'call_a_1', type: 'function', function: { name: 'toolA', arguments: '{}' } }
243
+ ]);
244
+ sessionB.addUserMessage('Hello from B');
245
+ sessionB.addAssistantMessage('Response from B');
246
+ // Verify session isolation
247
+ expect(sessionA.getMessages()).toHaveLength(2);
248
+ expect(sessionB.getMessages()).toHaveLength(2);
249
+ // Verify content integrity
250
+ expect(sessionA.getMessages()[0].content).toBe('Hello from A');
251
+ expect(sessionA.getMessages()[1].content).toBe(null);
252
+ expect(sessionB.getMessages()[0].content).toBe('Hello from B');
253
+ expect(sessionB.getMessages()[1].content).toBe('Response from B');
254
+ });
255
+ it('should provide accurate statistics', () => {
256
+ const history = new ConversationHistory();
257
+ const session1 = history.getConversationSession('conv1');
258
+ const session2 = history.getConversationSession('conv2');
259
+ session1.addUserMessage('Message 1');
260
+ session1.addAssistantMessage('Response 1');
261
+ session2.addUserMessage('Message 2');
262
+ const stats = history.getStats();
263
+ expect(stats.totalConversations).toBe(2);
264
+ expect(stats.totalMessages).toBe(3);
265
+ expect(stats.conversationIds).toContain('conv1');
266
+ expect(stats.conversationIds).toContain('conv2');
267
+ });
268
+ });
269
+ describe('Tool execution loop prevention integration test', () => {
270
+ it('should prevent infinite tool execution by preserving conversation history correctly', () => {
271
+ // This test simulates the exact scenario that was causing infinite tool execution
272
+ const session = new ConversationSession();
273
+ // Simulate the conversation flow that was causing the issue:
274
+ // Turn 1: User asks for calculation
275
+ session.addUserMessage('What is 5 plus 3?');
276
+ // Turn 2: AI decides to use calculator tool
277
+ // This is the critical point - OpenAI API returns content: null when making tool calls
278
+ session.addAssistantMessage(null, [
279
+ {
280
+ id: 'call_calculate_abc123',
281
+ type: 'function',
282
+ function: {
283
+ name: 'calculate',
284
+ arguments: '{"operation":"add","a":5,"b":3}'
285
+ }
286
+ }
287
+ ]);
288
+ // Turn 3: Tool executes and returns result
289
+ session.addToolMessage('{"result":8,"operation":"5 + 3 = 8"}', 'call_calculate_abc123', 'calculate');
290
+ // Turn 4: AI provides final answer
291
+ session.addAssistantMessage('The result of 5 plus 3 is 8.');
292
+ // Now simulate what would happen if we send this conversation back to AI
293
+ const messages = session.getMessages();
294
+ expect(messages).toHaveLength(4);
295
+ // The key test: AI should be able to see that it already made a tool call
296
+ // by looking at the assistant message with null content and tool_calls
297
+ const assistantToolCallMessage = messages[1];
298
+ expect(assistantToolCallMessage.role).toBe('assistant');
299
+ expect(assistantToolCallMessage.content).toBe(null); // This is critical!
300
+ expect(isAssistantMessage(assistantToolCallMessage) && assistantToolCallMessage.toolCalls).toHaveLength(1);
301
+ // The tool result should be properly linked
302
+ const toolResultMessage = messages[2];
303
+ expect(toolResultMessage.role).toBe('tool');
304
+ expect(isToolMessage(toolResultMessage) && toolResultMessage.toolCallId).toBe('call_calculate_abc123');
305
+ // If this conversation history is sent back to AI, it should NOT call the tool again
306
+ // because it can see the tool was already called and the result was provided
307
+ });
308
+ it('should demonstrate the infinite loop scenario that was happening before the fix', () => {
309
+ // This test documents what was happening before we fixed the content handling
310
+ const session = new ConversationSession();
311
+ session.addUserMessage('What is 5 plus 3?');
312
+ // BEFORE FIX: We were incorrectly storing empty string instead of null
313
+ // This made the AI think no tool call was made, causing it to call the tool again
314
+ const incorrectAssistantMessage = createAssistantMessage('', {
315
+ toolCalls: [
316
+ {
317
+ id: 'call_calculate_xyz789',
318
+ type: 'function',
319
+ function: {
320
+ name: 'calculate',
321
+ arguments: '{"operation":"add","a":5,"b":3}'
322
+ }
323
+ }
324
+ ]
325
+ });
326
+ // AFTER FIX: We now correctly store null content
327
+ const correctAssistantMessage = createAssistantMessage(null, {
328
+ toolCalls: [
329
+ {
330
+ id: 'call_calculate_xyz789',
331
+ type: 'function',
332
+ function: {
333
+ name: 'calculate',
334
+ arguments: '{"operation":"add","a":5,"b":3}'
335
+ }
336
+ }
337
+ ]
338
+ });
339
+ // Both messages have tool calls, but content differs
340
+ expect(incorrectAssistantMessage.content).toBe(''); // This was causing the problem
341
+ expect(correctAssistantMessage.content).toBe(null); // This is the correct way
342
+ // When converted by OpenAI adapter, both should become content: null
343
+ // But in conversation history, we need to preserve the original null from API
344
+ expect(correctAssistantMessage.content).toBe(null);
345
+ });
346
+ it('should handle edge case of assistant message with both content and tool calls', () => {
347
+ // Some AI models might return both content and tool calls
348
+ const session = new ConversationSession();
349
+ session.addUserMessage('Calculate 10 * 5 and explain the process');
350
+ // Assistant message with both explanation and tool call
351
+ session.addAssistantMessage('I\'ll calculate 10 * 5 for you.', [
352
+ {
353
+ id: 'call_calc_explain_001',
354
+ type: 'function',
355
+ function: {
356
+ name: 'calculate',
357
+ arguments: '{"operation":"multiply","a":10,"b":5}'
358
+ }
359
+ }
360
+ ]);
361
+ session.addToolMessage('{"result":50}', 'call_calc_explain_001', 'calculate');
362
+ session.addAssistantMessage('The result is 50. I used multiplication to get 10 × 5 = 50.');
363
+ const messages = session.getMessages();
364
+ // Verify the assistant message with both content and tool calls
365
+ const assistantMessage = messages[1];
366
+ expect(assistantMessage.role).toBe('assistant');
367
+ expect(assistantMessage.content).toBe('I\'ll calculate 10 * 5 for you.');
368
+ expect(isAssistantMessage(assistantMessage) && assistantMessage.toolCalls).toHaveLength(1);
369
+ // This should NOT cause infinite loops because the tool call ID is preserved
370
+ expect(isToolMessage(messages[2]) && messages[2].toolCallId).toBe('call_calc_explain_001');
371
+ });
372
+ });
373
+ });
374
+ //# sourceMappingURL=conversation-history-manager.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversation-history-manager.test.js","sourceRoot":"","sources":["../../src/managers/conversation-history-manager.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EACH,mBAAmB,EACnB,mBAAmB,EACnB,aAAa,EACb,kBAAkB,EAClB,sBAAsB,EACtB,iBAAiB,EAGpB,MAAM,gCAAgC,CAAC;AAExC,QAAQ,CAAC,qBAAqB,EAA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,IAAI,EAAE,WAAW;wBACjB,SAAS,EAAE,uCAAuC;qBACrD;iBACJ;aACJ,CAAC,CAAC;YAEH,OAAO,CAAC,cAAc,CAAC,eAAe,EAAE,uBAAuB,EAAE,WAAW,CAAC,CAAC;YAC9E,OAAO,CAAC,mBAAmB,CAAC,6DAA6D,CAAC,CAAC;YAE3F,MAAM,QAAQ,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;YAEvC,gEAAgE;YAChE,MAAM,gBAAgB,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;YACrC,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YAChD,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,iCAAiC,CAAC,CAAC;YACzE,MAAM,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,IAAI,gBAAgB,CAAC,SAAS,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;YAE3F,6EAA6E;YAC7E,MAAM,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;QAC/F,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ export { AgentFactory } from './agent-factory';
2
+ export { Tools } from './tool-manager';
3
+ export { AIProviders } from './ai-provider-manager';
4
+ export { AgentTemplates, type ITemplateApplicationResult } from './agent-templates';
5
+ export { ConversationHistory, ConversationSession, type IProviderApiMessage, type IConversationHistoryOptions, createUserMessage, createAssistantMessage, createSystemMessage, createToolMessage, isAssistantMessage, isToolMessage, isSystemMessage } from './conversation-history-manager';
6
+ export { Plugins } from './plugins';
7
+ export type { IPluginsManager, IPluginLifecycleEvents, IPluginDependency, IPluginRegistrationOptions, IPluginStatus } from './plugins';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/managers/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,KAAK,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AACpF,OAAO,EACH,mBAAmB,EACnB,mBAAmB,EACnB,KAAK,mBAAmB,EACxB,KAAK,2BAA2B,EAChC,iBAAiB,EACjB,sBAAsB,EACtB,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,aAAa,EACb,eAAe,EAClB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,YAAY,EACR,eAAe,EACf,sBAAsB,EACtB,iBAAiB,EACjB,0BAA0B,EAC1B,aAAa,EAChB,MAAM,WAAW,CAAC"}
@@ -0,0 +1,8 @@
1
+ // Manager exports
2
+ export { AgentFactory } from './agent-factory';
3
+ export { Tools } from './tool-manager';
4
+ export { AIProviders } from './ai-provider-manager';
5
+ export { AgentTemplates } from './agent-templates';
6
+ export { ConversationHistory, ConversationSession, createUserMessage, createAssistantMessage, createSystemMessage, createToolMessage, isAssistantMessage, isToolMessage, isSystemMessage } from './conversation-history-manager';
7
+ export { Plugins } from './plugins';
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/managers/index.ts"],"names":[],"mappings":"AAAA,kBAAkB;AAClB,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAmC,MAAM,mBAAmB,CAAC;AACpF,OAAO,EACH,mBAAmB,EACnB,mBAAmB,EAGnB,iBAAiB,EACjB,sBAAsB,EACtB,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,aAAa,EACb,eAAe,EAClB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC"}
@@ -0,0 +1,161 @@
1
+ import type { IBaseModuleOptions, IModule, IModuleExecutionContext, IModuleExecutionResult } from '../abstracts/abstract-module';
2
+ import type { IEventEmitterPlugin } from '../plugins/event-emitter/types';
3
+ export declare const MODULE_REGISTRY_EVENTS: {
4
+ /** Emitted when a module is registered in ModuleRegistry */
5
+ readonly REGISTERED: "module.registered";
6
+ /** Emitted when a module is unregistered in ModuleRegistry */
7
+ readonly UNREGISTERED: "module.unregistered";
8
+ };
9
+ /**
10
+ * Module registration options
11
+ */
12
+ export interface IModuleRegistrationOptions {
13
+ /** Whether to initialize the module immediately */
14
+ autoInitialize?: boolean;
15
+ /** Custom initialization options */
16
+ initOptions?: IBaseModuleOptions;
17
+ /** Whether to validate dependencies */
18
+ validateDependencies?: boolean;
19
+ /** Custom initialization timeout */
20
+ initTimeout?: number;
21
+ }
22
+ /**
23
+ * Module status information
24
+ */
25
+ export interface IModuleStatus {
26
+ name: string;
27
+ type: string;
28
+ enabled: boolean;
29
+ initialized: boolean;
30
+ hasEventEmitter: boolean;
31
+ registrationTime: Date;
32
+ initializationTime?: Date;
33
+ lastActivity?: Date;
34
+ dependencies: string[];
35
+ dependents: string[];
36
+ }
37
+ /**
38
+ * Module execution statistics
39
+ */
40
+ export interface IModuleExecutionStats {
41
+ totalExecutions: number;
42
+ successfulExecutions: number;
43
+ failedExecutions: number;
44
+ averageExecutionTime: number;
45
+ lastExecutionTime?: Date;
46
+ totalExecutionTime: number;
47
+ }
48
+ /**
49
+ * Registry for managing module instances
50
+ * Handles module lifecycle, dependencies, and execution coordination
51
+ *
52
+ * Key features:
53
+ * - Dependency-based initialization ordering
54
+ * - Module lifecycle management (register, initialize, dispose)
55
+ * - Event-driven communication through EventEmitter
56
+ * - Module status tracking and statistics
57
+ * - Error handling and recovery
58
+ */
59
+ export declare class ModuleRegistry {
60
+ private modules;
61
+ private moduleOptions;
62
+ private moduleStatuses;
63
+ private moduleStats;
64
+ private registrationOrder;
65
+ private initializationOrder;
66
+ private typeRegistry;
67
+ private eventEmitter;
68
+ private logger;
69
+ private isDisposing;
70
+ constructor(eventEmitter?: IEventEmitterPlugin);
71
+ /**
72
+ * Register a module instance
73
+ */
74
+ registerModule(module: IModule, options?: IModuleRegistrationOptions): Promise<void>;
75
+ /**
76
+ * Unregister a module
77
+ */
78
+ unregisterModule(moduleName: string): Promise<boolean>;
79
+ /**
80
+ * Initialize a specific module
81
+ */
82
+ initializeModule(moduleName: string, timeout?: number): Promise<void>;
83
+ /**
84
+ * Initialize all registered modules in dependency order
85
+ */
86
+ initializeAllModules(timeout?: number): Promise<void>;
87
+ /**
88
+ * Execute a module by name
89
+ */
90
+ executeModule(moduleName: string, context: IModuleExecutionContext): Promise<IModuleExecutionResult>;
91
+ /**
92
+ * Get a module by name
93
+ */
94
+ getModule(moduleName: string): IModule | null;
95
+ /**
96
+ * Get modules by type
97
+ */
98
+ getModulesByType(moduleType: string): IModule[];
99
+ /**
100
+ * Get all registered modules
101
+ */
102
+ getAllModules(): IModule[];
103
+ /**
104
+ * Get module names
105
+ */
106
+ getModuleNames(): string[];
107
+ /**
108
+ * Check if a module is registered
109
+ */
110
+ hasModule(moduleName: string): boolean;
111
+ /**
112
+ * Get module status
113
+ */
114
+ getModuleStatus(moduleName: string): IModuleStatus | null;
115
+ /**
116
+ * Get all module statuses
117
+ */
118
+ getAllModuleStatuses(): IModuleStatus[];
119
+ /**
120
+ * Get module execution statistics
121
+ */
122
+ getModuleStats(moduleName: string): IModuleExecutionStats | null;
123
+ /**
124
+ * Get all module execution statistics
125
+ */
126
+ getAllModuleStats(): Record<string, IModuleExecutionStats>;
127
+ /**
128
+ * Dispose all modules in reverse initialization order
129
+ */
130
+ disposeAllModules(): Promise<void>;
131
+ /**
132
+ * Clear all modules (for testing)
133
+ */
134
+ clearAllModules(): void;
135
+ /**
136
+ * Get registry statistics
137
+ */
138
+ getRegistryStats(): {
139
+ totalModules: number;
140
+ initializedModules: number;
141
+ enabledModules: number;
142
+ modulesByType: Record<string, number>;
143
+ totalExecutions: number;
144
+ totalSuccessfulExecutions: number;
145
+ totalFailedExecutions: number;
146
+ averageExecutionTime: number;
147
+ };
148
+ /**
149
+ * Validate a module before registration
150
+ */
151
+ private validateModule;
152
+ /**
153
+ * Validate module dependencies
154
+ */
155
+ private validateModuleDependencies;
156
+ /**
157
+ * Find modules that depend on the given module
158
+ */
159
+ private findDependentModules;
160
+ }
161
+ //# sourceMappingURL=module-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"module-registry.d.ts","sourceRoot":"","sources":["../../src/managers/module-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,kBAAkB,EAClB,OAAO,EACP,uBAAuB,EACvB,sBAAsB,EACzB,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAK1E,eAAO,MAAM,sBAAsB;IAC/B,4DAA4D;;IAE5D,8DAA8D;;CAExD,CAAC;AAEX;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACvC,mDAAmD;IACnD,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,oCAAoC;IACpC,WAAW,CAAC,EAAE,kBAAkB,CAAC;IACjC,uCAAuC;IACvC,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,oCAAoC;IACpC,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAA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