@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,61 @@
1
+ import { TUniversalMessage } from '../../interfaces/agent';
2
+ import type { IPluginOptions, IPluginStats } from '../../abstracts/abstract-plugin';
3
+ /**
4
+ * Storage strategy for conversation history
5
+ */
6
+ export type THistoryStorageStrategy = 'memory' | 'file' | 'database';
7
+ /**
8
+ * Configuration options for conversation history plugin
9
+ */
10
+ export interface IConversationHistoryPluginOptions extends IPluginOptions {
11
+ /** Storage strategy to use */
12
+ storage: THistoryStorageStrategy;
13
+ /** Maximum number of conversations to store */
14
+ maxConversations?: number;
15
+ /** Maximum messages per conversation */
16
+ maxMessagesPerConversation?: number;
17
+ /** File path for file storage strategy */
18
+ filePath?: string;
19
+ /** Database connection string for database storage */
20
+ connectionString?: string;
21
+ /** Whether to auto-save after each message */
22
+ autoSave?: boolean;
23
+ /** Save interval in milliseconds for batch saving */
24
+ saveInterval?: number;
25
+ }
26
+ /**
27
+ * Conversation history entry
28
+ */
29
+ export interface IConversationHistoryEntry {
30
+ conversationId: string;
31
+ messages: TUniversalMessage[];
32
+ startTime: Date;
33
+ lastUpdated: Date;
34
+ metadata?: Record<string, string | number | boolean | Date>;
35
+ }
36
+ /**
37
+ * Storage interface for conversation history
38
+ */
39
+ export interface IHistoryStorage {
40
+ save(conversationId: string, entry: IConversationHistoryEntry): Promise<void>;
41
+ load(conversationId: string): Promise<IConversationHistoryEntry | undefined>;
42
+ list(): Promise<string[]>;
43
+ delete(conversationId: string): Promise<boolean>;
44
+ clear(): Promise<void>;
45
+ }
46
+ /**
47
+ * Conversation history plugin statistics
48
+ */
49
+ export interface IConversationHistoryPluginStats extends IPluginStats {
50
+ /** Total number of conversations stored */
51
+ totalConversations: number;
52
+ /** Total number of messages stored */
53
+ totalMessages: number;
54
+ /** Storage strategy in use */
55
+ storageStrategy: THistoryStorageStrategy;
56
+ /** Last save timestamp */
57
+ lastSaveTime?: Date;
58
+ /** Number of failed saves */
59
+ failedSaves: number;
60
+ }
61
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/plugins/conversation-history/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAEpF;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG,QAAQ,GAAG,MAAM,GAAG,UAAU,CAAC;AAErE;;GAEG;AACH,MAAM,WAAW,iCAAkC,SAAQ,cAAc;IACrE,8BAA8B;IAC9B,OAAO,EAAE,uBAAuB,CAAC;IACjC,+CAA+C;IAC/C,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,wCAAwC;IACxC,0BAA0B,CAAC,EAAE,MAAM,CAAC;IACpC,0CAA0C;IAC1C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,sDAAsD;IACtD,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,qDAAqD;IACrD,YAAY,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACtC,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,iBAAiB,EAAE,CAAC;IAC9B,SAAS,EAAE,IAAI,CAAC;IAChB,WAAW,EAAE,IAAI,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC,CAAC;CAC/D;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC5B,IAAI,CAAC,cAAc,EAAE,MAAM,EAAE,KAAK,EAAE,yBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9E,IAAI,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,yBAAyB,GAAG,SAAS,CAAC,CAAC;IAC7E,IAAI,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC1B,MAAM,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACjD,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,+BAAgC,SAAQ,YAAY;IACjE,2CAA2C;IAC3C,kBAAkB,EAAE,MAAM,CAAC;IAC3B,sCAAsC;IACtC,aAAa,EAAE,MAAM,CAAC;IACtB,8BAA8B;IAC9B,eAAe,EAAE,uBAAuB,CAAC;IACzC,0BAA0B;IAC1B,YAAY,CAAC,EAAE,IAAI,CAAC;IACpB,6BAA6B;IAC7B,WAAW,EAAE,MAAM,CAAC;CACvB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plugins/conversation-history/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * ErrorHandling Plugin - Context adapter utilities for Facade pattern
3
+ *
4
+ * REASON: TypeScript exactOptionalPropertyTypes strict mode requires special handling for optional properties
5
+ * ALTERNATIVES_CONSIDERED: Bracket notation (rejected by TS), type assertions (rejected), interface modification (breaks compatibility), union types (causes dependencies), removing context (loses debugging)
6
+ * TODO: Consider unified error context type system across all plugins
7
+ */
8
+ import type { IErrorHandlingContextData, IErrorContextAdapter } from './types';
9
+ import type { TErrorContextData } from '../../utils/errors';
10
+ /**
11
+ * Convert IErrorHandlingContextData to ErrorContextData-compatible format for PluginError
12
+ * REASON: Simple object spread with known properties to avoid index signature conflicts
13
+ * ALTERNATIVES_CONSIDERED: Complex type adapters (unnecessary), Object.assign (verbose), bracket notation (rejected by TS), type assertions (reduces safety)
14
+ * TODO: Consider unified error context type system across all plugins
15
+ */
16
+ export declare function toErrorContext(context: IErrorHandlingContextData): IErrorContextAdapter;
17
+ /**
18
+ * Safe context extraction for PluginError with nested context structure
19
+ *
20
+ * REASON: PluginError context needs flexible data structure for debugging information
21
+ * ALTERNATIVES_CONSIDERED:
22
+ * 1. Strict primitive types (loses debugging information)
23
+ * 2. Interface definitions (too rigid for error contexts)
24
+ * 3. Union types (becomes unwieldy for error data)
25
+ * 4. Generic constraints (too complex for error handling)
26
+ * 5. Type assertions (decreases type safety)
27
+ * TODO: Consider standardized error context interface if patterns emerge
28
+ */
29
+ export declare function createPluginErrorContext(context: IErrorHandlingContextData, additionalData?: TErrorContextData): TErrorContextData;
30
+ //# sourceMappingURL=context-adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context-adapter.d.ts","sourceRoot":"","sources":["../../../src/plugins/error-handling/context-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,yBAAyB,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAC/E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE5D;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,yBAAyB,GAAG,oBAAoB,CAQvF;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,yBAAyB,EAAE,cAAc,CAAC,EAAE,iBAAiB,GAAG,iBAAiB,CAKlI"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * ErrorHandling Plugin - Context adapter utilities for Facade pattern
3
+ *
4
+ * REASON: TypeScript exactOptionalPropertyTypes strict mode requires special handling for optional properties
5
+ * ALTERNATIVES_CONSIDERED: Bracket notation (rejected by TS), type assertions (rejected), interface modification (breaks compatibility), union types (causes dependencies), removing context (loses debugging)
6
+ * TODO: Consider unified error context type system across all plugins
7
+ */
8
+ /**
9
+ * Convert IErrorHandlingContextData to ErrorContextData-compatible format for PluginError
10
+ * REASON: Simple object spread with known properties to avoid index signature conflicts
11
+ * ALTERNATIVES_CONSIDERED: Complex type adapters (unnecessary), Object.assign (verbose), bracket notation (rejected by TS), type assertions (reduces safety)
12
+ * TODO: Consider unified error context type system across all plugins
13
+ */
14
+ export function toErrorContext(context) {
15
+ return {
16
+ ...(context.executionId && { executionId: context.executionId }),
17
+ ...(context.sessionId && { sessionId: context.sessionId }),
18
+ ...(context.userId && { userId: context.userId }),
19
+ ...(context.attempt !== undefined && { attempt: context.attempt }),
20
+ ...(context.originalError && { originalError: context.originalError })
21
+ };
22
+ }
23
+ /**
24
+ * Safe context extraction for PluginError with nested context structure
25
+ *
26
+ * REASON: PluginError context needs flexible data structure for debugging information
27
+ * ALTERNATIVES_CONSIDERED:
28
+ * 1. Strict primitive types (loses debugging information)
29
+ * 2. Interface definitions (too rigid for error contexts)
30
+ * 3. Union types (becomes unwieldy for error data)
31
+ * 4. Generic constraints (too complex for error handling)
32
+ * 5. Type assertions (decreases type safety)
33
+ * TODO: Consider standardized error context interface if patterns emerge
34
+ */
35
+ export function createPluginErrorContext(context, additionalData) {
36
+ return {
37
+ ...toErrorContext(context),
38
+ ...(additionalData && { ...additionalData })
39
+ };
40
+ }
41
+ //# sourceMappingURL=context-adapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context-adapter.js","sourceRoot":"","sources":["../../../src/plugins/error-handling/context-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,OAAkC;IAC7D,OAAO;QACH,GAAG,CAAC,OAAO,CAAC,WAAW,IAAI,EAAE,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE,CAAC;QAChE,GAAG,CAAC,OAAO,CAAC,SAAS,IAAI,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,CAAC;QAC1D,GAAG,CAAC,OAAO,CAAC,MAAM,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC;QACjD,GAAG,CAAC,OAAO,CAAC,OAAO,KAAK,SAAS,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC;QAClE,GAAG,CAAC,OAAO,CAAC,aAAa,IAAI,EAAE,aAAa,EAAE,OAAO,CAAC,aAAa,EAAE,CAAC;KACzE,CAAC;AACN,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,wBAAwB,CAAC,OAAkC,EAAE,cAAkC;IAC3G,OAAO;QACH,GAAG,cAAc,CAAC,OAAO,CAAC;QAC1B,GAAG,CAAC,cAAc,IAAI,EAAE,GAAG,cAAc,EAAE,CAAC;KAC/C,CAAC;AACN,CAAC"}
@@ -0,0 +1,49 @@
1
+ import { AbstractPlugin } from '../../abstracts/abstract-plugin';
2
+ import type { IErrorHandlingContextData, IErrorHandlingPluginOptions, IErrorHandlingPluginStats } from './types';
3
+ /**
4
+ * Plugin for handling errors with configurable strategies
5
+ * Provides error recovery, retry mechanisms, and circuit breaker patterns
6
+ */
7
+ export declare class ErrorHandlingPlugin extends AbstractPlugin<IErrorHandlingPluginOptions, IErrorHandlingPluginStats> {
8
+ name: string;
9
+ version: string;
10
+ private pluginOptions;
11
+ private logger;
12
+ private failureCount;
13
+ private circuitBreakerOpen;
14
+ private lastFailureTime;
15
+ constructor(options: IErrorHandlingPluginOptions);
16
+ /**
17
+ * Handle an error with the configured strategy
18
+ */
19
+ handleError(error: Error, context?: IErrorHandlingContextData): Promise<void>;
20
+ /**
21
+ * Execute a function with error handling and retry logic
22
+ */
23
+ /**
24
+ * Execute a function with error handling and retry logic
25
+ * REASON: PluginError constructor requires ErrorContextData which has different type constraints than IErrorHandlingContextData, causing multiple type compatibility issues
26
+ * ALTERNATIVES_CONSIDERED: Union types (breaks existing error context interfaces), interface definition (creates circular dependencies), generic types (complex type propagation through error handling chain), conditional types (breaks existing plugin interfaces), mapped types (incompatible with error constructor signatures), type guards (runtime only, doesn't solve constructor compatibility), custom declarations (breaks PluginError interface contract), code refactoring (would require redesigning entire error handling system across all plugins), @types packages (none available for this specific use case), external library integration (no standard error context type systems available), utility types (Pick/Omit create new compatibility issues)
27
+ * TODO: Create unified error context type system that bridges IErrorHandlingContextData and ErrorContextData requirements, or redesign PluginError to accept more flexible context types
28
+ */
29
+ executeWithRetry<T>(fn: () => Promise<T>, context?: IErrorHandlingContextData): Promise<T>;
30
+ /**
31
+ * Reset circuit breaker state
32
+ */
33
+ resetCircuitBreaker(): void;
34
+ /**
35
+ * Get error handling statistics
36
+ */
37
+ getStats(): IErrorHandlingPluginStats;
38
+ /**
39
+ * Cleanup resources
40
+ */
41
+ destroy(): Promise<void>;
42
+ private handleSimple;
43
+ private handleCircuitBreaker;
44
+ private handleExponentialBackoff;
45
+ private isCircuitBreakerOpen;
46
+ private validateOptions;
47
+ private sleep;
48
+ }
49
+ //# sourceMappingURL=error-handling-plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-handling-plugin.d.ts","sourceRoot":"","sources":["../../../src/plugins/error-handling/error-handling-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAkC,MAAM,iCAAiC,CAAC;AAKjG,OAAO,KAAK,EACR,yBAAyB,EACzB,2BAA2B,EAC3B,yBAAyB,EAC5B,MAAM,SAAS,CAAC;AAGjB;;;GAGG;AACH,qBAAa,mBAAoB,SAAQ,cAAc,CAAC,2BAA2B,EAAE,yBAAyB,CAAC;IAC3G,IAAI,SAAyB;IAC7B,OAAO,SAAW;IAElB,OAAO,CAAC,aAAa,CAAmK;IACxL,OAAO,CAAC,MAAM,CAAU;IACxB,OAAO,CAAC,YAAY,CAAK;IACzB,OAAO,CAAC,kBAAkB,CAAS;IACnC,OAAO,CAAC,eAAe,CAAK;gBAEhB,OAAO,EAAE,2BAA2B;IA+BhD;;OAEG;IACG,WAAW,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,GAAE,yBAA8B,GAAG,OAAO,CAAC,IAAI,CAAC;IAsCvF;;OAEG;IACH;;;;;OAKG;IACG,gBAAgB,CAAC,CAAC,EACpB,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACpB,OAAO,GAAE,yBAA8B,GACxC,OAAO,CAAC,CAAC,CAAC;IAuDb;;OAEG;IACH,mBAAmB,IAAI,IAAI;IAO3B;;OAEG;IACM,QAAQ,IAAI,yBAAyB;IAY9C;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;YAIhB,YAAY;YAQZ,oBAAoB;YAcpB,wBAAwB;IAStC,OAAO,CAAC,oBAAoB;IAiB5B,OAAO,CAAC,eAAe;IAqBvB,OAAO,CAAC,KAAK;CAGhB"}
@@ -0,0 +1,229 @@
1
+ import { AbstractPlugin, PluginCategory, PluginPriority } from '../../abstracts/abstract-plugin';
2
+ import { createLogger } from '../../utils/logger';
3
+ import { PluginError, ConfigurationError } from '../../utils/errors';
4
+ import { toErrorContext, createPluginErrorContext } from './context-adapter';
5
+ /**
6
+ * Plugin for handling errors with configurable strategies
7
+ * Provides error recovery, retry mechanisms, and circuit breaker patterns
8
+ */
9
+ export class ErrorHandlingPlugin extends AbstractPlugin {
10
+ name = 'ErrorHandlingPlugin';
11
+ version = '1.0.0';
12
+ pluginOptions;
13
+ logger;
14
+ failureCount = 0;
15
+ circuitBreakerOpen = false;
16
+ lastFailureTime = 0;
17
+ constructor(options) {
18
+ super();
19
+ this.logger = createLogger('ErrorHandlingPlugin');
20
+ // Validate options
21
+ this.validateOptions(options);
22
+ // Set defaults
23
+ this.pluginOptions = {
24
+ enabled: options.enabled ?? true,
25
+ strategy: options.strategy,
26
+ maxRetries: options.maxRetries ?? 3,
27
+ retryDelay: options.retryDelay ?? 1000,
28
+ logErrors: options.logErrors ?? true,
29
+ failureThreshold: options.failureThreshold ?? 5,
30
+ circuitBreakerTimeout: options.circuitBreakerTimeout ?? 60000, // 1 minute
31
+ // Add plugin options defaults
32
+ category: options.category ?? PluginCategory.ERROR_HANDLING,
33
+ priority: options.priority ?? PluginPriority.HIGH,
34
+ moduleEvents: options.moduleEvents ?? [],
35
+ subscribeToAllModuleEvents: options.subscribeToAllModuleEvents ?? false,
36
+ ...(options.customErrorHandler && { customErrorHandler: options.customErrorHandler }),
37
+ };
38
+ this.logger.info('ErrorHandlingPlugin initialized', {
39
+ strategy: this.pluginOptions.strategy,
40
+ maxRetries: this.pluginOptions.maxRetries,
41
+ failureThreshold: this.pluginOptions.failureThreshold
42
+ });
43
+ }
44
+ /**
45
+ * Handle an error with the configured strategy
46
+ */
47
+ async handleError(error, context = {}) {
48
+ if (this.pluginOptions.logErrors) {
49
+ this.logger.error('Error occurred', {
50
+ error: error.message,
51
+ stack: error.stack,
52
+ context: context
53
+ });
54
+ }
55
+ // Custom error handler takes precedence
56
+ if (this.pluginOptions.customErrorHandler) {
57
+ try {
58
+ await this.pluginOptions.customErrorHandler(error, context);
59
+ return;
60
+ }
61
+ catch (handlerError) {
62
+ this.logger.error('Custom error handler failed', {
63
+ handlerError: handlerError instanceof Error ? handlerError.message : String(handlerError)
64
+ });
65
+ }
66
+ }
67
+ // Apply strategy-specific handling
68
+ switch (this.pluginOptions.strategy) {
69
+ case 'circuit-breaker':
70
+ await this.handleCircuitBreaker(error, context);
71
+ break;
72
+ case 'exponential-backoff':
73
+ await this.handleExponentialBackoff(error, context);
74
+ break;
75
+ case 'simple':
76
+ await this.handleSimple(error, context);
77
+ break;
78
+ case 'silent':
79
+ // Silent mode - do nothing
80
+ break;
81
+ }
82
+ }
83
+ /**
84
+ * Execute a function with error handling and retry logic
85
+ */
86
+ /**
87
+ * Execute a function with error handling and retry logic
88
+ * REASON: PluginError constructor requires ErrorContextData which has different type constraints than IErrorHandlingContextData, causing multiple type compatibility issues
89
+ * ALTERNATIVES_CONSIDERED: Union types (breaks existing error context interfaces), interface definition (creates circular dependencies), generic types (complex type propagation through error handling chain), conditional types (breaks existing plugin interfaces), mapped types (incompatible with error constructor signatures), type guards (runtime only, doesn't solve constructor compatibility), custom declarations (breaks PluginError interface contract), code refactoring (would require redesigning entire error handling system across all plugins), @types packages (none available for this specific use case), external library integration (no standard error context type systems available), utility types (Pick/Omit create new compatibility issues)
90
+ * TODO: Create unified error context type system that bridges IErrorHandlingContextData and ErrorContextData requirements, or redesign PluginError to accept more flexible context types
91
+ */
92
+ async executeWithRetry(fn, context = {}) {
93
+ let lastError = null;
94
+ let attempt = 0;
95
+ while (attempt <= this.pluginOptions.maxRetries) {
96
+ try {
97
+ // Check circuit breaker
98
+ if (this.pluginOptions.strategy === 'circuit-breaker' && this.isCircuitBreakerOpen()) {
99
+ throw new PluginError('Circuit breaker is open', this.name, toErrorContext(context));
100
+ }
101
+ const result = await fn();
102
+ // Reset failure count on success
103
+ if (attempt > 0) {
104
+ this.failureCount = 0;
105
+ this.circuitBreakerOpen = false;
106
+ this.logger.info('Operation succeeded after retry', {
107
+ attempt: attempt,
108
+ context: context
109
+ });
110
+ }
111
+ return result;
112
+ }
113
+ catch (error) {
114
+ lastError = error instanceof Error ? error : new Error(String(error));
115
+ attempt++;
116
+ if (attempt <= this.pluginOptions.maxRetries) {
117
+ await this.handleError(lastError, { ...context, attempt });
118
+ // Calculate delay
119
+ const delay = this.pluginOptions.strategy === 'exponential-backoff'
120
+ ? this.pluginOptions.retryDelay * Math.pow(2, attempt - 1)
121
+ : this.pluginOptions.retryDelay;
122
+ this.logger.debug('Retrying operation', {
123
+ attempt: attempt,
124
+ delay: delay,
125
+ context: context
126
+ });
127
+ await this.sleep(delay);
128
+ }
129
+ else {
130
+ await this.handleError(lastError, { ...context, finalAttempt: true });
131
+ }
132
+ }
133
+ }
134
+ throw new PluginError(`Operation failed after ${this.pluginOptions.maxRetries} retries`, this.name, createPluginErrorContext(context, {
135
+ originalError: lastError?.message || 'Unknown error'
136
+ }));
137
+ }
138
+ /**
139
+ * Reset circuit breaker state
140
+ */
141
+ resetCircuitBreaker() {
142
+ this.failureCount = 0;
143
+ this.circuitBreakerOpen = false;
144
+ this.lastFailureTime = 0;
145
+ this.logger.info('Circuit breaker reset');
146
+ }
147
+ /**
148
+ * Get error handling statistics
149
+ */
150
+ getStats() {
151
+ const base = super.getStats();
152
+ return {
153
+ ...base,
154
+ failureCount: this.failureCount,
155
+ circuitBreakerOpen: this.circuitBreakerOpen,
156
+ lastFailureTime: this.lastFailureTime,
157
+ totalRetries: 0, // TODO: Track total retries
158
+ successfulRecoveries: 0 // TODO: Track successful recoveries
159
+ };
160
+ }
161
+ /**
162
+ * Cleanup resources
163
+ */
164
+ async destroy() {
165
+ this.logger.info('ErrorHandlingPlugin destroyed');
166
+ }
167
+ async handleSimple(error, context) {
168
+ // Simple logging - no additional logic
169
+ this.logger.debug('Simple error handling applied', {
170
+ error: error.message,
171
+ context: context
172
+ });
173
+ }
174
+ async handleCircuitBreaker(_error, context) {
175
+ this.failureCount++;
176
+ this.lastFailureTime = Date.now();
177
+ if (this.failureCount >= this.pluginOptions.failureThreshold) {
178
+ this.circuitBreakerOpen = true;
179
+ this.logger.warn('Circuit breaker opened', {
180
+ failureCount: this.failureCount,
181
+ threshold: this.pluginOptions.failureThreshold,
182
+ context: context
183
+ });
184
+ }
185
+ }
186
+ async handleExponentialBackoff(_error, context) {
187
+ this.failureCount++;
188
+ this.logger.debug('Exponential backoff error handling applied', {
189
+ error: _error.message,
190
+ failureCount: this.failureCount,
191
+ context: context
192
+ });
193
+ }
194
+ isCircuitBreakerOpen() {
195
+ if (!this.circuitBreakerOpen) {
196
+ return false;
197
+ }
198
+ // Check if timeout period has passed
199
+ const timeoutPassed = Date.now() - this.lastFailureTime > this.pluginOptions.circuitBreakerTimeout;
200
+ if (timeoutPassed) {
201
+ this.circuitBreakerOpen = false;
202
+ this.failureCount = 0;
203
+ this.logger.info('Circuit breaker timeout passed, attempting to close');
204
+ return false;
205
+ }
206
+ return true;
207
+ }
208
+ validateOptions(options) {
209
+ if (!options.strategy) {
210
+ throw new ConfigurationError('Error handling strategy is required');
211
+ }
212
+ if (!['simple', 'circuit-breaker', 'exponential-backoff', 'silent'].includes(options.strategy)) {
213
+ throw new ConfigurationError('Invalid error handling strategy', {
214
+ validStrategies: ['simple', 'circuit-breaker', 'exponential-backoff', 'silent'],
215
+ provided: options.strategy
216
+ });
217
+ }
218
+ if (options.maxRetries !== undefined && options.maxRetries < 0) {
219
+ throw new ConfigurationError('Max retries must be non-negative');
220
+ }
221
+ if (options.retryDelay !== undefined && options.retryDelay <= 0) {
222
+ throw new ConfigurationError('Retry delay must be positive');
223
+ }
224
+ }
225
+ sleep(ms) {
226
+ return new Promise(resolve => setTimeout(resolve, ms));
227
+ }
228
+ }
229
+ //# sourceMappingURL=error-handling-plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-handling-plugin.js","sourceRoot":"","sources":["../../../src/plugins/error-handling/error-handling-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjG,OAAO,EAAE,YAAY,EAAgB,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAQrE,OAAO,EAAE,cAAc,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAE7E;;;GAGG;AACH,MAAM,OAAO,mBAAoB,SAAQ,cAAsE;IAC3G,IAAI,GAAG,qBAAqB,CAAC;IAC7B,OAAO,GAAG,OAAO,CAAC;IAEV,aAAa,CAAmK;IAChL,MAAM,CAAU;IAChB,YAAY,GAAG,CAAC,CAAC;IACjB,kBAAkB,GAAG,KAAK,CAAC;IAC3B,eAAe,GAAG,CAAC,CAAC;IAE5B,YAAY,OAAoC;QAC5C,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,MAAM,GAAG,YAAY,CA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0,0 +1,10 @@
1
+ /**
2
+ * ErrorHandling Plugin - Centralized exports for Facade pattern
3
+ *
4
+ * This module provides a clean interface for error handling functionality
5
+ * with proper type safety and context adaptation.
6
+ */
7
+ export type { TErrorHandlingStrategy, IErrorHandlingContextData, IErrorHandlingPluginOptions, IErrorHandlingPluginStats, IErrorContextAdapter } from './types';
8
+ export { toErrorContext, createPluginErrorContext } from './context-adapter';
9
+ export { ErrorHandlingPlugin } from './error-handling-plugin';
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/error-handling/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,YAAY,EACR,sBAAsB,EACtB,yBAAyB,EACzB,2BAA2B,EAC3B,yBAAyB,EACzB,oBAAoB,EACvB,MAAM,SAAS,CAAC;AAGjB,OAAO,EACH,cAAc,EACd,wBAAwB,EAC3B,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * ErrorHandling Plugin - Centralized exports for Facade pattern
3
+ *
4
+ * This module provides a clean interface for error handling functionality
5
+ * with proper type safety and context adaptation.
6
+ */
7
+ // Context adapter utilities
8
+ export { toErrorContext, createPluginErrorContext } from './context-adapter';
9
+ export { ErrorHandlingPlugin } from './error-handling-plugin';
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/plugins/error-handling/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAWH,4BAA4B;AAC5B,OAAO,EACH,cAAc,EACd,wBAAwB,EAC3B,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC"}
@@ -0,0 +1,73 @@
1
+ /**
2
+ * ErrorHandling Plugin - Type definitions for Facade pattern implementation
3
+ *
4
+ * REASON: Complex ErrorContextData compatibility issues require type adapters and unified error handling
5
+ * ALTERNATIVES_CONSIDERED:
6
+ * 1. Modify ErrorContextData type globally (breaks other components)
7
+ * 2. Use type assertions everywhere (reduces type safety)
8
+ * 3. Create complex union types (causes circular dependencies)
9
+ * 4. Redesign PluginError constructor (breaks existing contracts)
10
+ * 5. Remove context from error handling (loses debugging capability)
11
+ * TODO: Consider unified error context system across all plugins
12
+ */
13
+ /**
14
+ * Error handling strategy types
15
+ */
16
+ export type TErrorHandlingStrategy = 'simple' | 'circuit-breaker' | 'exponential-backoff' | 'silent';
17
+ /**
18
+ * Base error context for internal operations
19
+ * REASON: Optional properties and index signature for compatibility with both exactOptionalPropertyTypes and logger constraints
20
+ * ALTERNATIVES_CONSIDERED: Union types (breaks interface compatibility), explicit undefined (still triggers index signature rules), removing optional properties (breaks existing usage), type assertions (loses safety), intersection types (complex propagation)
21
+ * TODO: Consider unified error context type system across all plugins
22
+ */
23
+ export interface IErrorHandlingContextData {
24
+ executionId?: string;
25
+ sessionId?: string;
26
+ userId?: string;
27
+ attempt?: number;
28
+ finalAttempt?: boolean;
29
+ originalError?: string;
30
+ [key: string]: string | number | boolean | undefined;
31
+ }
32
+ import type { IPluginOptions, IPluginStats } from '../../abstracts/abstract-plugin';
33
+ /**
34
+ * Configuration options for error handling plugin
35
+ */
36
+ export interface IErrorHandlingPluginOptions extends IPluginOptions {
37
+ /** Error handling strategy to use */
38
+ strategy: TErrorHandlingStrategy;
39
+ /** Maximum number of retry attempts */
40
+ maxRetries?: number;
41
+ /** Initial delay between retries in milliseconds */
42
+ retryDelay?: number;
43
+ /** Whether to log errors */
44
+ logErrors?: boolean;
45
+ /** Circuit breaker failure threshold */
46
+ failureThreshold?: number;
47
+ /** Circuit breaker timeout in milliseconds */
48
+ circuitBreakerTimeout?: number;
49
+ /** Custom error handler function */
50
+ customErrorHandler?: (error: Error, context: IErrorHandlingContextData) => Promise<void>;
51
+ }
52
+ /**
53
+ * Error handling plugin statistics
54
+ */
55
+ export interface IErrorHandlingPluginStats extends IPluginStats {
56
+ failureCount: number;
57
+ circuitBreakerOpen: boolean;
58
+ lastFailureTime: number;
59
+ totalRetries: number;
60
+ successfulRecoveries: number;
61
+ }
62
+ /**
63
+ * Error context adapter for PluginError compatibility
64
+ */
65
+ export interface IErrorContextAdapter {
66
+ originalError?: string;
67
+ executionId?: string;
68
+ sessionId?: string;
69
+ userId?: string;
70
+ attempt?: number;
71
+ [key: string]: string | number | boolean | Date | Error | string[] | undefined;
72
+ }
73
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/plugins/error-handling/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,QAAQ,GAAG,iBAAiB,GAAG,qBAAqB,GAAG,QAAQ,CAAC;AAErG;;;;;GAKG;AACH,MAAM,WAAW,yBAAyB;IACtC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;CACxD;AAED,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAEpF;;GAEG;AACH,MAAM,WAAW,2BAA4B,SAAQ,cAAc;IAC/D,qCAAqC;IACrC,QAAQ,EAAE,sBAAsB,CAAC;IACjC,uCAAuC;IACvC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oDAAoD;IACpD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,4BAA4B;IAC5B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,wCAAwC;IACxC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,8CAA8C;IAC9C,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,oCAAoC;IACpC,kBAAkB,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,yBAAyB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5F;AAED;;GAEG;AACH,MAAM,WAAW,yBAA0B,SAAQ,YAAY;IAC3D,YAAY,EAAE,MAAM,CAAC;IACrB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,oBAAoB,EAAE,MAAM,CAAC;CAChC;AAID;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACjC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,KAAK,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC;CAClF"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * ErrorHandling Plugin - Type definitions for Facade pattern implementation
3
+ *
4
+ * REASON: Complex ErrorContextData compatibility issues require type adapters and unified error handling
5
+ * ALTERNATIVES_CONSIDERED:
6
+ * 1. Modify ErrorContextData type globally (breaks other components)
7
+ * 2. Use type assertions everywhere (reduces type safety)
8
+ * 3. Create complex union types (causes circular dependencies)
9
+ * 4. Redesign PluginError constructor (breaks existing contracts)
10
+ * 5. Remove context from error handling (loses debugging capability)
11
+ * TODO: Consider unified error context system across all plugins
12
+ */
13
+ export {};
14
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plugins/error-handling/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG"}
@@ -0,0 +1,17 @@
1
+ export interface IEventEmitterMetricsSnapshot {
2
+ totalEmitted: number;
3
+ totalErrors: number;
4
+ }
5
+ export interface IEventEmitterMetrics {
6
+ incrementEmitted(): void;
7
+ incrementErrors(): void;
8
+ getSnapshot(): IEventEmitterMetricsSnapshot;
9
+ }
10
+ export declare class InMemoryEventEmitterMetrics implements IEventEmitterMetrics {
11
+ private totalEmitted;
12
+ private totalErrors;
13
+ incrementEmitted(): void;
14
+ incrementErrors(): void;
15
+ getSnapshot(): IEventEmitterMetricsSnapshot;
16
+ }
17
+ //# sourceMappingURL=metrics.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metrics.d.ts","sourceRoot":"","sources":["../../../src/plugins/event-emitter/metrics.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,4BAA4B;IACzC,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,oBAAoB;IACjC,gBAAgB,IAAI,IAAI,CAAC;IACzB,eAAe,IAAI,IAAI,CAAC;IACxB,WAAW,IAAI,4BAA4B,CAAC;CAC/C;AAED,qBAAa,2BAA4B,YAAW,oBAAoB;IACpE,OAAO,CAAC,YAAY,CAAK;IACzB,OAAO,CAAC,WAAW,CAAK;IAExB,gBAAgB,IAAI,IAAI;IAIxB,eAAe,IAAI,IAAI;IAIvB,WAAW,IAAI,4BAA4B;CAM9C"}
@@ -0,0 +1,17 @@
1
+ export class InMemoryEventEmitterMetrics {
2
+ totalEmitted = 0;
3
+ totalErrors = 0;
4
+ incrementEmitted() {
5
+ this.totalEmitted += 1;
6
+ }
7
+ incrementErrors() {
8
+ this.totalErrors += 1;
9
+ }
10
+ getSnapshot() {
11
+ return {
12
+ totalEmitted: this.totalEmitted,
13
+ totalErrors: this.totalErrors
14
+ };
15
+ }
16
+ }
17
+ //# sourceMappingURL=metrics.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metrics.js","sourceRoot":"","sources":["../../../src/plugins/event-emitter/metrics.ts"],"names":[],"mappings":"AAWA,MAAM,OAAO,2BAA2B;IAC5B,YAAY,GAAG,CAAC,CAAC;IACjB,WAAW,GAAG,CAAC,CAAC;IAExB,gBAAgB;QACZ,IAAI,CAAC,YAAY,IAAI,CAAC,CAAC;IAC3B,CAAC;IAED,eAAe;QACX,IAAI,CAAC,WAAW,IAAI,CAAC,CAAC;IAC1B,CAAC;IAED,WAAW;QACP,OAAO;YACH,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,WAAW,EAAE,IAAI,CAAC,WAAW;SAChC,CAAC;IACN,CAAC;CACJ"}