@ductape/sdk 0.0.4-v6 → 0.0.4-v61

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 (937) hide show
  1. package/dist/agents/agent-context.d.ts +98 -0
  2. package/dist/agents/agent-context.js +588 -0
  3. package/dist/agents/agent-context.js.map +1 -0
  4. package/dist/agents/agent-executor.d.ts +180 -0
  5. package/dist/agents/agent-executor.js +715 -0
  6. package/dist/agents/agent-executor.js.map +1 -0
  7. package/dist/agents/agents.service.d.ts +310 -0
  8. package/dist/agents/agents.service.js +1249 -0
  9. package/dist/agents/agents.service.js.map +1 -0
  10. package/dist/agents/index.d.ts +55 -0
  11. package/dist/agents/index.js +110 -0
  12. package/dist/agents/index.js.map +1 -0
  13. package/dist/agents/memory-manager.d.ts +182 -0
  14. package/dist/agents/memory-manager.js +383 -0
  15. package/dist/agents/memory-manager.js.map +1 -0
  16. package/dist/agents/tool-registry.d.ts +141 -0
  17. package/dist/agents/tool-registry.js +355 -0
  18. package/dist/agents/tool-registry.js.map +1 -0
  19. package/dist/agents/types/agents.types.d.ts +1227 -0
  20. package/dist/agents/types/agents.types.js +12 -0
  21. package/dist/agents/types/agents.types.js.map +1 -0
  22. package/dist/agents/types/index.d.ts +6 -0
  23. package/dist/agents/types/index.js +23 -0
  24. package/dist/agents/types/index.js.map +1 -0
  25. package/dist/agents/vector-store-adapter.d.ts +108 -0
  26. package/dist/agents/vector-store-adapter.js +213 -0
  27. package/dist/agents/vector-store-adapter.js.map +1 -0
  28. package/dist/api/services/appApi.service.d.ts +51 -5
  29. package/dist/api/services/appApi.service.js +101 -3
  30. package/dist/api/services/appApi.service.js.map +1 -1
  31. package/dist/api/services/pricingApi.service.d.ts +10 -0
  32. package/dist/api/services/pricingApi.service.js +34 -0
  33. package/dist/api/services/pricingApi.service.js.map +1 -0
  34. package/dist/api/services/processorApi.service.d.ts +334 -2
  35. package/dist/api/services/processorApi.service.js +264 -2
  36. package/dist/api/services/processorApi.service.js.map +1 -1
  37. package/dist/api/services/productsApi.service.d.ts +108 -1
  38. package/dist/api/services/productsApi.service.js +150 -3
  39. package/dist/api/services/productsApi.service.js.map +1 -1
  40. package/dist/api/services/resilienceApi.service.d.ts +106 -0
  41. package/dist/api/services/resilienceApi.service.js +224 -0
  42. package/dist/api/services/resilienceApi.service.js.map +1 -0
  43. package/dist/api/services/secretsApi.service.d.ts +50 -0
  44. package/dist/api/services/secretsApi.service.js +124 -0
  45. package/dist/api/services/secretsApi.service.js.map +1 -0
  46. package/dist/api/services/workflowApi.service.d.ts +199 -0
  47. package/dist/api/services/workflowApi.service.js +183 -0
  48. package/dist/api/services/workflowApi.service.js.map +1 -0
  49. package/dist/api/services/workspaceApi.service.d.ts +8 -0
  50. package/dist/api/services/workspaceApi.service.js +20 -0
  51. package/dist/api/services/workspaceApi.service.js.map +1 -1
  52. package/dist/api/urls.d.ts +65 -1
  53. package/dist/api/urls.js +90 -18
  54. package/dist/api/urls.js.map +1 -1
  55. package/dist/api/utils/auth.utils.d.ts +1 -3
  56. package/dist/api/utils/auth.utils.js.map +1 -1
  57. package/dist/api/utils/cache.utils.d.ts +1 -1
  58. package/dist/api/utils/cache.utils.js +2 -2
  59. package/dist/api/utils/cache.utils.js.map +1 -1
  60. package/dist/api/utils/strings.utils.d.ts +2 -0
  61. package/dist/api/utils/strings.utils.js +14 -0
  62. package/dist/api/utils/strings.utils.js.map +1 -1
  63. package/dist/apps/services/app.service.d.ts +41 -33
  64. package/dist/apps/services/app.service.js +472 -184
  65. package/dist/apps/services/app.service.js.map +1 -1
  66. package/dist/apps/utils/auth-context-manager.d.ts +137 -0
  67. package/dist/apps/utils/auth-context-manager.js +248 -0
  68. package/dist/apps/utils/auth-context-manager.js.map +1 -0
  69. package/dist/apps/utils/credential-manager.d.ts +128 -0
  70. package/dist/apps/utils/credential-manager.js +199 -0
  71. package/dist/apps/utils/credential-manager.js.map +1 -0
  72. package/dist/apps/utils/index.d.ts +10 -0
  73. package/dist/apps/utils/index.js +54 -0
  74. package/dist/apps/utils/index.js.map +1 -0
  75. package/dist/apps/utils/input-helpers.d.ts +67 -0
  76. package/dist/apps/utils/input-helpers.js +185 -0
  77. package/dist/apps/utils/input-helpers.js.map +1 -0
  78. package/dist/apps/utils/input-resolver.d.ts +165 -0
  79. package/dist/apps/utils/input-resolver.js +477 -0
  80. package/dist/apps/utils/input-resolver.js.map +1 -0
  81. package/dist/apps/utils/oauth-manager.d.ts +196 -0
  82. package/dist/apps/utils/oauth-manager.js +429 -0
  83. package/dist/apps/utils/oauth-manager.js.map +1 -0
  84. package/dist/apps/validators/joi-validators/create.appAction.validator.d.ts +1 -2
  85. package/dist/apps/validators/joi-validators/create.appAction.validator.js +21 -2
  86. package/dist/apps/validators/joi-validators/create.appAction.validator.js.map +1 -1
  87. package/dist/apps/validators/joi-validators/update.appAction.validator.js +11 -1
  88. package/dist/apps/validators/joi-validators/update.appAction.validator.js.map +1 -1
  89. package/dist/apps/validators/joi-validators/update.appActionResponse.validator.d.ts +1 -1
  90. package/dist/apps/validators/joi-validators/update.appActionResponse.validator.js +34 -1
  91. package/dist/apps/validators/joi-validators/update.appActionResponse.validator.js.map +1 -1
  92. package/dist/bin.d.ts +26 -0
  93. package/dist/bin.js +28 -0
  94. package/dist/bin.js.map +1 -0
  95. package/dist/brokers/brokers.service.d.ts +289 -0
  96. package/dist/brokers/brokers.service.js +722 -0
  97. package/dist/brokers/brokers.service.js.map +1 -0
  98. package/dist/brokers/index.d.ts +46 -0
  99. package/dist/brokers/index.js +83 -0
  100. package/dist/brokers/index.js.map +1 -0
  101. package/dist/brokers/types/index.d.ts +314 -0
  102. package/dist/brokers/types/index.js +8 -0
  103. package/dist/brokers/types/index.js.map +1 -0
  104. package/dist/brokers/utils/broker.util.d.ts +33 -0
  105. package/dist/brokers/utils/broker.util.js +125 -0
  106. package/dist/brokers/utils/broker.util.js.map +1 -0
  107. package/dist/brokers/utils/providers/aws-sqs.service.d.ts +16 -0
  108. package/dist/brokers/utils/providers/aws-sqs.service.js +71 -0
  109. package/dist/brokers/utils/providers/aws-sqs.service.js.map +1 -0
  110. package/dist/brokers/utils/providers/google-pubsub.service.d.ts +16 -0
  111. package/dist/brokers/utils/providers/google-pubsub.service.js +43 -0
  112. package/dist/brokers/utils/providers/google-pubsub.service.js.map +1 -0
  113. package/dist/brokers/utils/providers/index.d.ts +6 -0
  114. package/dist/brokers/utils/providers/index.js +16 -0
  115. package/dist/brokers/utils/providers/index.js.map +1 -0
  116. package/dist/brokers/utils/providers/kafka.service.d.ts +23 -0
  117. package/dist/brokers/utils/providers/kafka.service.js +131 -0
  118. package/dist/brokers/utils/providers/kafka.service.js.map +1 -0
  119. package/dist/brokers/utils/providers/nats.service.d.ts +18 -0
  120. package/dist/brokers/utils/providers/nats.service.js +63 -0
  121. package/dist/brokers/utils/providers/nats.service.js.map +1 -0
  122. package/dist/brokers/utils/providers/rabbitmq.service.d.ts +15 -0
  123. package/dist/brokers/utils/providers/rabbitmq.service.js +151 -0
  124. package/dist/brokers/utils/providers/rabbitmq.service.js.map +1 -0
  125. package/dist/brokers/utils/providers/redis.service.d.ts +18 -0
  126. package/dist/brokers/utils/providers/redis.service.js +93 -0
  127. package/dist/brokers/utils/providers/redis.service.js.map +1 -0
  128. package/dist/cache/cache.manager.d.ts +159 -0
  129. package/dist/cache/cache.manager.js +265 -0
  130. package/dist/cache/cache.manager.js.map +1 -0
  131. package/dist/cache/cache.service.d.ts +186 -0
  132. package/dist/cache/cache.service.js +437 -0
  133. package/dist/cache/cache.service.js.map +1 -0
  134. package/dist/cache/index.d.ts +52 -0
  135. package/dist/cache/index.js +79 -0
  136. package/dist/cache/index.js.map +1 -0
  137. package/dist/cache/types/index.d.ts +106 -0
  138. package/dist/cache/types/index.js +6 -0
  139. package/dist/cache/types/index.js.map +1 -0
  140. package/dist/clients/pricing.client.d.ts +3 -0
  141. package/dist/clients/pricing.client.js +33 -0
  142. package/dist/clients/pricing.client.js.map +1 -0
  143. package/dist/database/actions/action-manager.d.ts +170 -0
  144. package/dist/database/actions/action-manager.js +465 -0
  145. package/dist/database/actions/action-manager.js.map +1 -0
  146. package/dist/database/actions/index.d.ts +6 -0
  147. package/dist/database/actions/index.js +13 -0
  148. package/dist/database/actions/index.js.map +1 -0
  149. package/dist/database/adapters/adapter.factory.d.ts +62 -0
  150. package/dist/database/adapters/adapter.factory.js +97 -0
  151. package/dist/database/adapters/adapter.factory.js.map +1 -0
  152. package/dist/database/adapters/base.adapter.d.ts +393 -0
  153. package/dist/database/adapters/base.adapter.js +150 -0
  154. package/dist/database/adapters/base.adapter.js.map +1 -0
  155. package/dist/database/adapters/cassandra.adapter.d.ts +91 -0
  156. package/dist/database/adapters/cassandra.adapter.js +1075 -0
  157. package/dist/database/adapters/cassandra.adapter.js.map +1 -0
  158. package/dist/database/adapters/dynamodb.adapter.d.ts +109 -0
  159. package/dist/database/adapters/dynamodb.adapter.js +1534 -0
  160. package/dist/database/adapters/dynamodb.adapter.js.map +1 -0
  161. package/dist/database/adapters/index.d.ts +11 -0
  162. package/dist/database/adapters/index.js +27 -0
  163. package/dist/database/adapters/index.js.map +1 -0
  164. package/dist/database/adapters/mariadb.adapter.d.ts +100 -0
  165. package/dist/database/adapters/mariadb.adapter.js +247 -0
  166. package/dist/database/adapters/mariadb.adapter.js.map +1 -0
  167. package/dist/database/adapters/mongodb.adapter.d.ts +120 -0
  168. package/dist/database/adapters/mongodb.adapter.js +1253 -0
  169. package/dist/database/adapters/mongodb.adapter.js.map +1 -0
  170. package/dist/database/adapters/mysql.adapter.d.ts +85 -0
  171. package/dist/database/adapters/mysql.adapter.js +1313 -0
  172. package/dist/database/adapters/mysql.adapter.js.map +1 -0
  173. package/dist/database/adapters/postgresql.adapter.d.ts +88 -0
  174. package/dist/database/adapters/postgresql.adapter.js +1434 -0
  175. package/dist/database/adapters/postgresql.adapter.js.map +1 -0
  176. package/dist/database/databases.service.d.ts +1388 -0
  177. package/dist/database/databases.service.js +2821 -0
  178. package/dist/database/databases.service.js.map +1 -0
  179. package/dist/database/index.d.ts +46 -0
  180. package/dist/database/index.js +109 -0
  181. package/dist/database/index.js.map +1 -0
  182. package/dist/database/migrations/index.d.ts +6 -0
  183. package/dist/database/migrations/index.js +12 -0
  184. package/dist/database/migrations/index.js.map +1 -0
  185. package/dist/database/migrations/migration-engine.d.ts +132 -0
  186. package/dist/database/migrations/migration-engine.js +1356 -0
  187. package/dist/database/migrations/migration-engine.js.map +1 -0
  188. package/dist/database/operators/aggregation-builder.d.ts +67 -0
  189. package/dist/database/operators/aggregation-builder.js +841 -0
  190. package/dist/database/operators/aggregation-builder.js.map +1 -0
  191. package/dist/database/operators/index.d.ts +7 -0
  192. package/dist/database/operators/index.js +15 -0
  193. package/dist/database/operators/index.js.map +1 -0
  194. package/dist/database/operators/query-builder.d.ts +59 -0
  195. package/dist/database/operators/query-builder.js +397 -0
  196. package/dist/database/operators/query-builder.js.map +1 -0
  197. package/dist/database/presave/decrypt.d.ts +25 -0
  198. package/dist/database/presave/decrypt.js +146 -0
  199. package/dist/database/presave/decrypt.js.map +1 -0
  200. package/dist/database/presave/index.d.ts +9 -0
  201. package/dist/database/presave/index.js +18 -0
  202. package/dist/database/presave/index.js.map +1 -0
  203. package/dist/database/presave/presave-processor.d.ts +148 -0
  204. package/dist/database/presave/presave-processor.js +702 -0
  205. package/dist/database/presave/presave-processor.js.map +1 -0
  206. package/dist/database/schema/index.d.ts +7 -0
  207. package/dist/database/schema/index.js +13 -0
  208. package/dist/database/schema/index.js.map +1 -0
  209. package/dist/database/schema/schema-manager.d.ts +258 -0
  210. package/dist/database/schema/schema-manager.js +637 -0
  211. package/dist/database/schema/schema-manager.js.map +1 -0
  212. package/dist/database/transactions/index.d.ts +6 -0
  213. package/dist/database/transactions/index.js +13 -0
  214. package/dist/database/transactions/index.js.map +1 -0
  215. package/dist/database/transactions/transaction-manager.d.ts +113 -0
  216. package/dist/database/transactions/transaction-manager.js +344 -0
  217. package/dist/database/transactions/transaction-manager.js.map +1 -0
  218. package/dist/database/triggers/index.d.ts +7 -0
  219. package/dist/database/triggers/index.js +14 -0
  220. package/dist/database/triggers/index.js.map +1 -0
  221. package/dist/database/triggers/trigger-processor.d.ts +239 -0
  222. package/dist/database/triggers/trigger-processor.js +1034 -0
  223. package/dist/database/triggers/trigger-processor.js.map +1 -0
  224. package/dist/database/types/action.interface.d.ts +148 -0
  225. package/dist/database/types/action.interface.js +6 -0
  226. package/dist/database/types/action.interface.js.map +1 -0
  227. package/dist/database/types/aggregation.interface.d.ts +185 -0
  228. package/dist/database/types/aggregation.interface.js +6 -0
  229. package/dist/database/types/aggregation.interface.js.map +1 -0
  230. package/dist/database/types/connection.interface.d.ts +137 -0
  231. package/dist/database/types/connection.interface.js +6 -0
  232. package/dist/database/types/connection.interface.js.map +1 -0
  233. package/dist/database/types/enums.d.ts +195 -0
  234. package/dist/database/types/enums.js +244 -0
  235. package/dist/database/types/enums.js.map +1 -0
  236. package/dist/database/types/index.d.ts +14 -0
  237. package/dist/database/types/index.js +31 -0
  238. package/dist/database/types/index.js.map +1 -0
  239. package/dist/database/types/migration.interface.d.ts +686 -0
  240. package/dist/database/types/migration.interface.js +9 -0
  241. package/dist/database/types/migration.interface.js.map +1 -0
  242. package/dist/database/types/presave.interface.d.ts +292 -0
  243. package/dist/database/types/presave.interface.js +60 -0
  244. package/dist/database/types/presave.interface.js.map +1 -0
  245. package/dist/database/types/query.interface.d.ts +205 -0
  246. package/dist/database/types/query.interface.js +6 -0
  247. package/dist/database/types/query.interface.js.map +1 -0
  248. package/dist/database/types/schema.interface.d.ts +398 -0
  249. package/dist/database/types/schema.interface.js +6 -0
  250. package/dist/database/types/schema.interface.js.map +1 -0
  251. package/dist/database/types/transaction.interface.d.ts +84 -0
  252. package/dist/database/types/transaction.interface.js +6 -0
  253. package/dist/database/types/transaction.interface.js.map +1 -0
  254. package/dist/database/types/trigger.interface.d.ts +612 -0
  255. package/dist/database/types/trigger.interface.js +121 -0
  256. package/dist/database/types/trigger.interface.js.map +1 -0
  257. package/dist/database/types/write.interface.d.ts +216 -0
  258. package/dist/database/types/write.interface.js +6 -0
  259. package/dist/database/types/write.interface.js.map +1 -0
  260. package/dist/database/utils/database-error.d.ts +96 -0
  261. package/dist/database/utils/database-error.js +221 -0
  262. package/dist/database/utils/database-error.js.map +1 -0
  263. package/dist/database/utils/index.d.ts +6 -0
  264. package/dist/database/utils/index.js +11 -0
  265. package/dist/database/utils/index.js.map +1 -0
  266. package/dist/graph/adapters/adapter.factory.d.ts +47 -0
  267. package/dist/graph/adapters/adapter.factory.js +77 -0
  268. package/dist/graph/adapters/adapter.factory.js.map +1 -0
  269. package/dist/graph/adapters/arangodb.adapter.d.ts +86 -0
  270. package/dist/graph/adapters/arangodb.adapter.js +1522 -0
  271. package/dist/graph/adapters/arangodb.adapter.js.map +1 -0
  272. package/dist/graph/adapters/base.adapter.d.ts +245 -0
  273. package/dist/graph/adapters/base.adapter.js +64 -0
  274. package/dist/graph/adapters/base.adapter.js.map +1 -0
  275. package/dist/graph/adapters/index.d.ts +11 -0
  276. package/dist/graph/adapters/index.js +21 -0
  277. package/dist/graph/adapters/index.js.map +1 -0
  278. package/dist/graph/adapters/memgraph.adapter.d.ts +110 -0
  279. package/dist/graph/adapters/memgraph.adapter.js +1345 -0
  280. package/dist/graph/adapters/memgraph.adapter.js.map +1 -0
  281. package/dist/graph/adapters/neo4j.adapter.d.ts +81 -0
  282. package/dist/graph/adapters/neo4j.adapter.js +1198 -0
  283. package/dist/graph/adapters/neo4j.adapter.js.map +1 -0
  284. package/dist/graph/adapters/neptune.adapter.d.ts +82 -0
  285. package/dist/graph/adapters/neptune.adapter.js +1313 -0
  286. package/dist/graph/adapters/neptune.adapter.js.map +1 -0
  287. package/dist/graph/graphs.service.d.ts +546 -0
  288. package/dist/graph/graphs.service.js +1893 -0
  289. package/dist/graph/graphs.service.js.map +1 -0
  290. package/dist/graph/index.d.ts +57 -0
  291. package/dist/graph/index.js +77 -0
  292. package/dist/graph/index.js.map +1 -0
  293. package/dist/graph/transactions/index.d.ts +4 -0
  294. package/dist/graph/transactions/index.js +9 -0
  295. package/dist/graph/transactions/index.js.map +1 -0
  296. package/dist/graph/transactions/transaction-manager.d.ts +61 -0
  297. package/dist/graph/transactions/transaction-manager.js +126 -0
  298. package/dist/graph/transactions/transaction-manager.js.map +1 -0
  299. package/dist/graph/types/connection.interface.d.ts +149 -0
  300. package/dist/graph/types/connection.interface.js +9 -0
  301. package/dist/graph/types/connection.interface.js.map +1 -0
  302. package/dist/graph/types/enums.d.ts +101 -0
  303. package/dist/graph/types/enums.js +114 -0
  304. package/dist/graph/types/enums.js.map +1 -0
  305. package/dist/graph/types/index.d.ts +13 -0
  306. package/dist/graph/types/index.js +20 -0
  307. package/dist/graph/types/index.js.map +1 -0
  308. package/dist/graph/types/node.interface.d.ts +248 -0
  309. package/dist/graph/types/node.interface.js +9 -0
  310. package/dist/graph/types/node.interface.js.map +1 -0
  311. package/dist/graph/types/query.interface.d.ts +175 -0
  312. package/dist/graph/types/query.interface.js +9 -0
  313. package/dist/graph/types/query.interface.js.map +1 -0
  314. package/dist/graph/types/relationship.interface.d.ts +207 -0
  315. package/dist/graph/types/relationship.interface.js +9 -0
  316. package/dist/graph/types/relationship.interface.js.map +1 -0
  317. package/dist/graph/types/schema.interface.d.ts +295 -0
  318. package/dist/graph/types/schema.interface.js +9 -0
  319. package/dist/graph/types/schema.interface.js.map +1 -0
  320. package/dist/graph/types/transaction.interface.d.ts +55 -0
  321. package/dist/graph/types/transaction.interface.js +9 -0
  322. package/dist/graph/types/transaction.interface.js.map +1 -0
  323. package/dist/graph/types/traversal.interface.d.ts +181 -0
  324. package/dist/graph/types/traversal.interface.js +9 -0
  325. package/dist/graph/types/traversal.interface.js.map +1 -0
  326. package/dist/graph/utils/graph-error.d.ts +71 -0
  327. package/dist/graph/utils/graph-error.js +142 -0
  328. package/dist/graph/utils/graph-error.js.map +1 -0
  329. package/dist/graph/utils/index.d.ts +4 -0
  330. package/dist/graph/utils/index.js +9 -0
  331. package/dist/graph/utils/index.js.map +1 -0
  332. package/dist/imports/imports.service.d.ts +3 -3
  333. package/dist/imports/imports.service.js +8 -7
  334. package/dist/imports/imports.service.js.map +1 -1
  335. package/dist/imports/imports.types.d.ts +8 -0
  336. package/dist/imports/repos/openApi.repo.d.ts +1 -1
  337. package/dist/imports/repos/openApi.repo.js +414 -47
  338. package/dist/imports/repos/openApi.repo.js.map +1 -1
  339. package/dist/imports/repos/postmanV21.repo.d.ts +1 -1
  340. package/dist/imports/repos/postmanV21.repo.js +126 -83
  341. package/dist/imports/repos/postmanV21.repo.js.map +1 -1
  342. package/dist/index.d.ts +3241 -285
  343. package/dist/index.js +4711 -687
  344. package/dist/index.js.map +1 -1
  345. package/dist/init.interface.d.ts +407 -0
  346. package/dist/init.interface.js +3 -0
  347. package/dist/init.interface.js.map +1 -0
  348. package/dist/inputs/inputs.service.d.ts +1 -1
  349. package/dist/inputs/inputs.service.js +2 -2
  350. package/dist/inputs/inputs.service.js.map +1 -1
  351. package/dist/inputs/utils/inputs.utils.create.js +1 -1
  352. package/dist/inputs/utils/inputs.utils.create.js.map +1 -1
  353. package/dist/jobs/index.d.ts +38 -0
  354. package/dist/jobs/index.js +50 -0
  355. package/dist/jobs/index.js.map +1 -0
  356. package/dist/jobs/jobs.service.d.ts +154 -0
  357. package/dist/jobs/jobs.service.js +491 -0
  358. package/dist/jobs/jobs.service.js.map +1 -0
  359. package/dist/jobs/jobs.state.d.ts +113 -0
  360. package/dist/jobs/jobs.state.js +447 -0
  361. package/dist/jobs/jobs.state.js.map +1 -0
  362. package/dist/jobs/types.d.ts +449 -0
  363. package/dist/jobs/types.js +74 -0
  364. package/dist/jobs/types.js.map +1 -0
  365. package/dist/logs/logs.types.d.ts +16 -1
  366. package/dist/logs/logs.types.js +5 -0
  367. package/dist/logs/logs.types.js.map +1 -1
  368. package/dist/models/index.d.ts +6 -0
  369. package/dist/models/index.js +11 -0
  370. package/dist/models/index.js.map +1 -0
  371. package/dist/models/models.service.d.ts +137 -0
  372. package/dist/models/models.service.js +195 -0
  373. package/dist/models/models.service.js.map +1 -0
  374. package/dist/notifications/index.d.ts +13 -0
  375. package/dist/notifications/index.js +26 -0
  376. package/dist/notifications/index.js.map +1 -0
  377. package/dist/notifications/notifications.service.d.ts +257 -0
  378. package/dist/notifications/notifications.service.js +656 -0
  379. package/dist/notifications/notifications.service.js.map +1 -0
  380. package/dist/notifications/types/index.d.ts +4 -0
  381. package/dist/notifications/types/index.js +21 -0
  382. package/dist/notifications/types/index.js.map +1 -0
  383. package/dist/notifications/types/notifications.types.d.ts +400 -0
  384. package/dist/notifications/types/notifications.types.js +49 -0
  385. package/dist/notifications/types/notifications.types.js.map +1 -0
  386. package/dist/parsers/index.d.ts +3 -0
  387. package/dist/parsers/index.js +27 -0
  388. package/dist/parsers/index.js.map +1 -0
  389. package/dist/parsers/pipelines/postman.pipelines.d.ts +15 -0
  390. package/dist/parsers/pipelines/postman.pipelines.js +103 -0
  391. package/dist/parsers/pipelines/postman.pipelines.js.map +1 -0
  392. package/dist/parsers/types/postman.types.d.ts +200 -0
  393. package/dist/parsers/types/postman.types.js +3 -0
  394. package/dist/parsers/types/postman.types.js.map +1 -0
  395. package/dist/parsers/utils/postman.utils.d.ts +12 -0
  396. package/dist/parsers/utils/postman.utils.js +116 -0
  397. package/dist/parsers/utils/postman.utils.js.map +1 -0
  398. package/dist/parsers/validators/postman-auth.validators.d.ts +10 -0
  399. package/dist/parsers/validators/postman-auth.validators.js +127 -0
  400. package/dist/parsers/validators/postman-auth.validators.js.map +1 -0
  401. package/dist/parsers/validators/postman-request.validators.d.ts +13 -0
  402. package/dist/parsers/validators/postman-request.validators.js +139 -0
  403. package/dist/parsers/validators/postman-request.validators.js.map +1 -0
  404. package/dist/parsers/validators/postman-response.validators.d.ts +13 -0
  405. package/dist/parsers/validators/postman-response.validators.js +150 -0
  406. package/dist/parsers/validators/postman-response.validators.js.map +1 -0
  407. package/dist/parsers/validators/postman-variable.validators.d.ts +14 -0
  408. package/dist/parsers/validators/postman-variable.validators.js +163 -0
  409. package/dist/parsers/validators/postman-variable.validators.js.map +1 -0
  410. package/dist/pricing/pricing.repo.js +1 -0
  411. package/dist/pricing/pricing.repo.js.map +1 -0
  412. package/dist/pricing/pricing.service.d.ts +24 -0
  413. package/dist/pricing/pricing.service.js +51 -0
  414. package/dist/pricing/pricing.service.js.map +1 -0
  415. package/dist/pricing/pricing.types.d.ts +76 -0
  416. package/dist/pricing/pricing.types.js +21 -0
  417. package/dist/pricing/pricing.types.js.map +1 -0
  418. package/dist/pricing/utils/string.utils.d.ts +1 -0
  419. package/dist/pricing/utils/string.utils.js +9 -0
  420. package/dist/pricing/utils/string.utils.js.map +1 -0
  421. package/dist/processor/services/processor.service.d.ts +120 -73
  422. package/dist/processor/services/processor.service.js +1705 -1294
  423. package/dist/processor/services/processor.service.js.map +1 -1
  424. package/dist/processor/services/request.service.d.ts +36 -0
  425. package/dist/processor/services/request.service.js +304 -0
  426. package/dist/processor/services/request.service.js.map +1 -0
  427. package/dist/processor/types/request.types.d.ts +14 -0
  428. package/dist/processor/types/request.types.js +3 -0
  429. package/dist/processor/types/request.types.js.map +1 -0
  430. package/dist/processor/utils/processor.utils.d.ts +3 -0
  431. package/dist/processor/utils/processor.utils.js +87 -21
  432. package/dist/processor/utils/processor.utils.js.map +1 -1
  433. package/dist/processor/utils/request.utils.d.ts +20 -0
  434. package/dist/processor/utils/request.utils.js +113 -0
  435. package/dist/processor/utils/request.utils.js.map +1 -0
  436. package/dist/products/services/products.service.d.ts +330 -77
  437. package/dist/products/services/products.service.js +2586 -397
  438. package/dist/products/services/products.service.js.map +1 -1
  439. package/dist/products/utils/string.utils.d.ts +1 -1
  440. package/dist/products/utils/string.utils.js +14 -2
  441. package/dist/products/utils/string.utils.js.map +1 -1
  442. package/dist/products/validators/index.d.ts +7 -1
  443. package/dist/products/validators/index.js +16 -1
  444. package/dist/products/validators/index.js.map +1 -1
  445. package/dist/products/validators/joi-validators/create.productAgent.validator.d.ts +3 -0
  446. package/dist/products/validators/joi-validators/create.productAgent.validator.js +266 -0
  447. package/dist/products/validators/joi-validators/create.productAgent.validator.js.map +1 -0
  448. package/dist/products/validators/joi-validators/create.productDatabase.validator.js +5 -0
  449. package/dist/products/validators/joi-validators/create.productDatabase.validator.js.map +1 -1
  450. package/dist/products/validators/joi-validators/create.productEnv.validator.js +1 -0
  451. package/dist/products/validators/joi-validators/create.productEnv.validator.js.map +1 -1
  452. package/dist/products/validators/joi-validators/create.productGraph.validator.js +89 -0
  453. package/dist/products/validators/joi-validators/create.productGraph.validator.js.map +1 -0
  454. package/dist/products/validators/joi-validators/create.productHealthcheck.validator.d.ts +4 -0
  455. package/dist/products/validators/joi-validators/create.productHealthcheck.validator.js +58 -0
  456. package/dist/products/validators/joi-validators/create.productHealthcheck.validator.js.map +1 -0
  457. package/dist/products/validators/joi-validators/create.productMessageBrokers.validator.js +81 -25
  458. package/dist/products/validators/joi-validators/create.productMessageBrokers.validator.js.map +1 -1
  459. package/dist/products/validators/joi-validators/create.productModel.validator.d.ts +3 -0
  460. package/dist/products/validators/joi-validators/create.productModel.validator.js +132 -0
  461. package/dist/products/validators/joi-validators/create.productModel.validator.js.map +1 -0
  462. package/dist/products/validators/joi-validators/create.productNotification.validator.js +133 -45
  463. package/dist/products/validators/joi-validators/create.productNotification.validator.js.map +1 -1
  464. package/dist/products/validators/joi-validators/create.productStorage.validator.js +77 -18
  465. package/dist/products/validators/joi-validators/create.productStorage.validator.js.map +1 -1
  466. package/dist/products/validators/joi-validators/create.productVector.validator.d.ts +3 -0
  467. package/dist/products/validators/joi-validators/create.productVector.validator.js +135 -0
  468. package/dist/products/validators/joi-validators/create.productVector.validator.js.map +1 -0
  469. package/dist/products/validators/joi-validators/update.dataValue.validator.js +1 -0
  470. package/dist/products/validators/joi-validators/update.dataValue.validator.js.map +1 -1
  471. package/dist/products/validators/joi-validators/update.productDatabase.validator.js +5 -0
  472. package/dist/products/validators/joi-validators/update.productDatabase.validator.js.map +1 -1
  473. package/dist/products/validators/joi-validators/update.productEnv.validator.js +3 -0
  474. package/dist/products/validators/joi-validators/update.productEnv.validator.js.map +1 -1
  475. package/dist/products/validators/joi-validators/update.productGraph.validator.js +88 -0
  476. package/dist/products/validators/joi-validators/update.productGraph.validator.js.map +1 -0
  477. package/dist/resilience/fallback.service.d.ts +140 -0
  478. package/dist/resilience/fallback.service.js +764 -0
  479. package/dist/resilience/fallback.service.js.map +1 -0
  480. package/dist/resilience/healthcheck.service.d.ts +159 -0
  481. package/dist/resilience/healthcheck.service.js +943 -0
  482. package/dist/resilience/healthcheck.service.js.map +1 -0
  483. package/dist/resilience/index.d.ts +104 -0
  484. package/dist/resilience/index.js +140 -0
  485. package/dist/resilience/index.js.map +1 -0
  486. package/dist/resilience/quota.service.d.ts +82 -0
  487. package/dist/resilience/quota.service.js +516 -0
  488. package/dist/resilience/quota.service.js.map +1 -0
  489. package/dist/resilience/resilience.service.d.ts +98 -0
  490. package/dist/resilience/resilience.service.js +560 -0
  491. package/dist/resilience/resilience.service.js.map +1 -0
  492. package/dist/resilience/types/index.d.ts +513 -0
  493. package/dist/resilience/types/index.js +29 -0
  494. package/dist/resilience/types/index.js.map +1 -0
  495. package/dist/secrets/index.d.ts +10 -0
  496. package/dist/secrets/index.js +33 -0
  497. package/dist/secrets/index.js.map +1 -0
  498. package/dist/secrets/secrets.resolver.d.ts +52 -0
  499. package/dist/secrets/secrets.resolver.js +233 -0
  500. package/dist/secrets/secrets.resolver.js.map +1 -0
  501. package/dist/secrets/secrets.service.d.ts +93 -0
  502. package/dist/secrets/secrets.service.js +258 -0
  503. package/dist/secrets/secrets.service.js.map +1 -0
  504. package/dist/secrets/secrets.types.d.ts +188 -0
  505. package/dist/secrets/secrets.types.js +87 -0
  506. package/dist/secrets/secrets.types.js.map +1 -0
  507. package/dist/sessions/index.d.ts +50 -0
  508. package/dist/sessions/index.js +93 -0
  509. package/dist/sessions/index.js.map +1 -0
  510. package/dist/sessions/sessions.helper.d.ts +68 -0
  511. package/dist/sessions/sessions.helper.js +116 -0
  512. package/dist/sessions/sessions.helper.js.map +1 -0
  513. package/dist/sessions/sessions.resolver.d.ts +150 -0
  514. package/dist/sessions/sessions.resolver.js +356 -0
  515. package/dist/sessions/sessions.resolver.js.map +1 -0
  516. package/dist/sessions/sessions.service.d.ts +170 -0
  517. package/dist/sessions/sessions.service.js +736 -0
  518. package/dist/sessions/sessions.service.js.map +1 -0
  519. package/dist/sessions/types/index.d.ts +290 -0
  520. package/dist/sessions/types/index.js +6 -0
  521. package/dist/sessions/types/index.js.map +1 -0
  522. package/dist/storage/index.d.ts +66 -0
  523. package/dist/storage/index.js +98 -0
  524. package/dist/storage/index.js.map +1 -0
  525. package/dist/storage/storage.service.d.ts +151 -0
  526. package/dist/storage/storage.service.js +522 -0
  527. package/dist/storage/storage.service.js.map +1 -0
  528. package/dist/storage/types/index.d.ts +207 -0
  529. package/dist/storage/types/index.js +6 -0
  530. package/dist/storage/types/index.js.map +1 -0
  531. package/dist/storage/utils/storage.util.d.ts +51 -0
  532. package/dist/storage/utils/storage.util.js +402 -0
  533. package/dist/storage/utils/storage.util.js.map +1 -0
  534. package/dist/test/index.d.ts +3 -0
  535. package/dist/test/index.js +11 -0
  536. package/dist/test/index.js.map +1 -0
  537. package/dist/test/test.appBuilder.d.ts +0 -1
  538. package/dist/test/test.appBuilder.js +0 -15
  539. package/dist/test/test.appBuilder.js.map +1 -1
  540. package/dist/test/test.broker.kafka.js +172 -0
  541. package/dist/test/test.broker.kafka.js.map +1 -0
  542. package/dist/test/test.broker.nats.js +193 -0
  543. package/dist/test/test.broker.nats.js.map +1 -0
  544. package/dist/test/test.broker.pubsub.js +171 -0
  545. package/dist/test/test.broker.pubsub.js.map +1 -0
  546. package/dist/test/test.broker.rabbitmq.js +164 -0
  547. package/dist/test/test.broker.rabbitmq.js.map +1 -0
  548. package/dist/test/test.broker.redis.js +168 -0
  549. package/dist/test/test.broker.redis.js.map +1 -0
  550. package/dist/test/test.broker.sqs.d.ts +1 -0
  551. package/dist/test/test.broker.sqs.js +158 -0
  552. package/dist/test/test.broker.sqs.js.map +1 -0
  553. package/dist/test/test.caches.d.ts +1 -0
  554. package/dist/test/test.caches.js +231 -0
  555. package/dist/test/test.caches.js.map +1 -0
  556. package/dist/test/test.database.d.ts +1 -0
  557. package/dist/test/test.database.dynamo.d.ts +1 -0
  558. package/dist/test/test.database.dynamo.js +265 -0
  559. package/dist/test/test.database.dynamo.js.map +1 -0
  560. package/dist/test/test.database.js +140 -0
  561. package/dist/test/test.database.js.map +1 -0
  562. package/dist/test/test.database.mongo.d.ts +1 -0
  563. package/dist/test/test.database.mongo.js +371 -0
  564. package/dist/test/test.database.mongo.js.map +1 -0
  565. package/dist/test/test.database.mysql.d.ts +1 -0
  566. package/dist/test/test.database.mysql.js +415 -0
  567. package/dist/test/test.database.mysql.js.map +1 -0
  568. package/dist/test/test.database.postgres.d.ts +1 -0
  569. package/dist/test/test.database.postgres.js +412 -0
  570. package/dist/test/test.database.postgres.js.map +1 -0
  571. package/dist/test/test.email.brevo.d.ts +1 -0
  572. package/dist/test/test.email.brevo.js +326 -0
  573. package/dist/test/test.email.brevo.js.map +1 -0
  574. package/dist/test/test.email.mailgun.d.ts +1 -0
  575. package/dist/test/test.email.mailgun.js +352 -0
  576. package/dist/test/test.email.mailgun.js.map +1 -0
  577. package/dist/test/test.email.postmark.d.ts +1 -0
  578. package/dist/test/test.email.postmark.js +316 -0
  579. package/dist/test/test.email.postmark.js.map +1 -0
  580. package/dist/test/test.email.sendgrid.d.ts +1 -0
  581. package/dist/test/test.email.sendgrid.js +365 -0
  582. package/dist/test/test.email.sendgrid.js.map +1 -0
  583. package/dist/test/test.email.smtp.d.ts +1 -0
  584. package/dist/test/test.email.smtp.js +323 -0
  585. package/dist/test/test.email.smtp.js.map +1 -0
  586. package/dist/test/test.graph.arangodb.d.ts +1 -0
  587. package/dist/test/test.graph.arangodb.js +358 -0
  588. package/dist/test/test.graph.arangodb.js.map +1 -0
  589. package/dist/test/test.graph.memgraph.d.ts +1 -0
  590. package/dist/test/test.graph.memgraph.js +320 -0
  591. package/dist/test/test.graph.memgraph.js.map +1 -0
  592. package/dist/test/test.graph.neo4j.d.ts +1 -0
  593. package/dist/test/test.graph.neo4j.js +218 -0
  594. package/dist/test/test.graph.neo4j.js.map +1 -0
  595. package/dist/test/test.graph.neptune.d.ts +1 -0
  596. package/dist/test/test.graph.neptune.js +331 -0
  597. package/dist/test/test.graph.neptune.js.map +1 -0
  598. package/dist/test/test.health.js +1 -0
  599. package/dist/test/test.health.js.map +1 -0
  600. package/dist/test/test.import.d.ts +0 -1
  601. package/dist/test/test.import.js +0 -1459
  602. package/dist/test/test.import.js.map +1 -1
  603. package/dist/test/test.import.openapi.d.ts +0 -1
  604. package/dist/test/test.import.openapi.js +0 -75
  605. package/dist/test/test.import.openapi.js.map +1 -1
  606. package/dist/test/test.imports.js +14 -55
  607. package/dist/test/test.imports.js.map +1 -1
  608. package/dist/test/test.logs.d.ts +0 -1
  609. package/dist/test/test.logs.js +0 -17
  610. package/dist/test/test.logs.js.map +1 -1
  611. package/dist/test/test.notifications.d.ts +1 -0
  612. package/dist/test/test.notifications.js +198 -0
  613. package/dist/test/test.notifications.js.map +1 -0
  614. package/dist/test/test.notifiers.js +1 -0
  615. package/dist/test/test.notifiers.js.map +1 -0
  616. package/dist/test/test.processor.d.ts +0 -1
  617. package/dist/test/test.processor.js +0 -122
  618. package/dist/test/test.processor.js.map +1 -1
  619. package/dist/test/test.productBuilder.d.ts +0 -1
  620. package/dist/test/test.productBuilder.js +0 -660
  621. package/dist/test/test.productBuilder.js.map +1 -1
  622. package/dist/test/test.products.js +1 -0
  623. package/dist/test/test.products.js.map +1 -0
  624. package/dist/test/test.push.expo.d.ts +1 -0
  625. package/dist/test/test.push.expo.js +442 -0
  626. package/dist/test/test.push.expo.js.map +1 -0
  627. package/dist/test/test.push.firebase.d.ts +1 -0
  628. package/dist/test/test.push.firebase.js +409 -0
  629. package/dist/test/test.push.firebase.js.map +1 -0
  630. package/dist/test/test.session.d.ts +1 -0
  631. package/dist/test/test.session.js +299 -0
  632. package/dist/test/test.session.js.map +1 -0
  633. package/dist/test/test.sms.nexmo.d.ts +1 -0
  634. package/dist/test/test.sms.nexmo.js +278 -0
  635. package/dist/test/test.sms.nexmo.js.map +1 -0
  636. package/dist/test/test.sms.twilio.d.ts +1 -0
  637. package/dist/test/test.sms.twilio.js +275 -0
  638. package/dist/test/test.sms.twilio.js.map +1 -0
  639. package/dist/test/test.storage.d.ts +1 -0
  640. package/dist/test/test.storage.js +202 -0
  641. package/dist/test/test.storage.js.map +1 -0
  642. package/dist/test/test.triggers.d.ts +1 -0
  643. package/dist/test/test.triggers.js +314 -0
  644. package/dist/test/test.triggers.js.map +1 -0
  645. package/dist/test/test.vector.pinecone.d.ts +1 -0
  646. package/dist/test/test.vector.pinecone.js +238 -0
  647. package/dist/test/test.vector.pinecone.js.map +1 -0
  648. package/dist/test/test.vector.qdrant.d.ts +1 -0
  649. package/dist/test/test.vector.qdrant.js +307 -0
  650. package/dist/test/test.vector.qdrant.js.map +1 -0
  651. package/dist/test/test.vector.weaviate.d.ts +1 -0
  652. package/dist/test/test.vector.weaviate.js +325 -0
  653. package/dist/test/test.vector.weaviate.js.map +1 -0
  654. package/dist/types/appBuilder.types.d.ts +10 -13
  655. package/dist/types/enums.d.ts +11 -1
  656. package/dist/types/enums.js +10 -0
  657. package/dist/types/enums.js.map +1 -1
  658. package/dist/types/index.types.d.ts +6 -4
  659. package/dist/types/index.types.js +0 -1
  660. package/dist/types/index.types.js.map +1 -1
  661. package/dist/types/pricing.types.d.ts +4 -0
  662. package/dist/types/pricing.types.js +3 -0
  663. package/dist/types/pricing.types.js.map +1 -0
  664. package/dist/types/processor.types.d.ts +245 -20
  665. package/dist/types/processor.types.js +9 -1
  666. package/dist/types/processor.types.js.map +1 -1
  667. package/dist/types/productsBuilder.types.d.ts +906 -24
  668. package/dist/types/productsBuilder.types.js +173 -2
  669. package/dist/types/productsBuilder.types.js.map +1 -1
  670. package/dist/types/request-tracker.interface.js +1 -0
  671. package/dist/types/request-tracker.interface.js.map +1 -0
  672. package/dist/types/requests.types.d.ts +2 -0
  673. package/dist/utils/constants.d.ts +1 -0
  674. package/dist/utils/constants.js +5 -0
  675. package/dist/utils/constants.js.map +1 -0
  676. package/dist/utils/index.d.ts +0 -2
  677. package/dist/utils/index.js +24 -52
  678. package/dist/utils/index.js.map +1 -1
  679. package/dist/vector/adapters/base.adapter.d.ts +152 -0
  680. package/dist/vector/adapters/base.adapter.js +137 -0
  681. package/dist/vector/adapters/base.adapter.js.map +1 -0
  682. package/dist/vector/adapters/index.d.ts +10 -0
  683. package/dist/vector/adapters/index.js +19 -0
  684. package/dist/vector/adapters/index.js.map +1 -0
  685. package/dist/vector/adapters/memory.adapter.d.ts +85 -0
  686. package/dist/vector/adapters/memory.adapter.js +505 -0
  687. package/dist/vector/adapters/memory.adapter.js.map +1 -0
  688. package/dist/vector/adapters/pinecone.adapter.d.ts +52 -0
  689. package/dist/vector/adapters/pinecone.adapter.js +400 -0
  690. package/dist/vector/adapters/pinecone.adapter.js.map +1 -0
  691. package/dist/vector/adapters/qdrant.adapter.d.ts +56 -0
  692. package/dist/vector/adapters/qdrant.adapter.js +392 -0
  693. package/dist/vector/adapters/qdrant.adapter.js.map +1 -0
  694. package/dist/vector/adapters/weaviate.adapter.d.ts +64 -0
  695. package/dist/vector/adapters/weaviate.adapter.js +478 -0
  696. package/dist/vector/adapters/weaviate.adapter.js.map +1 -0
  697. package/dist/vector/index.d.ts +47 -0
  698. package/dist/vector/index.js +72 -0
  699. package/dist/vector/index.js.map +1 -0
  700. package/dist/vector/types/connection.interface.d.ts +151 -0
  701. package/dist/vector/types/connection.interface.js +8 -0
  702. package/dist/vector/types/connection.interface.js.map +1 -0
  703. package/dist/vector/types/embedding.interface.d.ts +144 -0
  704. package/dist/vector/types/embedding.interface.js +8 -0
  705. package/dist/vector/types/embedding.interface.js.map +1 -0
  706. package/dist/vector/types/enums.d.ts +104 -0
  707. package/dist/vector/types/enums.js +113 -0
  708. package/dist/vector/types/enums.js.map +1 -0
  709. package/dist/vector/types/index.d.ts +9 -0
  710. package/dist/vector/types/index.js +16 -0
  711. package/dist/vector/types/index.js.map +1 -0
  712. package/dist/vector/types/vector.interface.d.ts +315 -0
  713. package/dist/vector/types/vector.interface.js +8 -0
  714. package/dist/vector/types/vector.interface.js.map +1 -0
  715. package/dist/vector/utils/index.d.ts +6 -0
  716. package/dist/vector/utils/index.js +11 -0
  717. package/dist/vector/utils/index.js.map +1 -0
  718. package/dist/vector/utils/vector-error.d.ts +69 -0
  719. package/dist/vector/utils/vector-error.js +116 -0
  720. package/dist/vector/utils/vector-error.js.map +1 -0
  721. package/dist/vector/vector-database.service.d.ts +408 -0
  722. package/dist/vector/vector-database.service.js +545 -0
  723. package/dist/vector/vector-database.service.js.map +1 -0
  724. package/dist/vector/vector.service.d.ts +245 -0
  725. package/dist/vector/vector.service.js +384 -0
  726. package/dist/vector/vector.service.js.map +1 -0
  727. package/dist/workflows/index.d.ts +30 -0
  728. package/dist/workflows/index.js +64 -0
  729. package/dist/workflows/index.js.map +1 -0
  730. package/dist/workflows/types/index.d.ts +6 -0
  731. package/dist/workflows/types/index.js +23 -0
  732. package/dist/workflows/types/index.js.map +1 -0
  733. package/dist/workflows/types/workflows.types.d.ts +1035 -0
  734. package/dist/workflows/types/workflows.types.js +13 -0
  735. package/dist/workflows/types/workflows.types.js.map +1 -0
  736. package/dist/workflows/workflow-builder.d.ts +70 -0
  737. package/dist/workflows/workflow-builder.js +338 -0
  738. package/dist/workflows/workflow-builder.js.map +1 -0
  739. package/dist/workflows/workflow-executor.d.ts +208 -0
  740. package/dist/workflows/workflow-executor.js +1194 -0
  741. package/dist/workflows/workflow-executor.js.map +1 -0
  742. package/dist/workflows/workflows.service.d.ts +404 -0
  743. package/dist/workflows/workflows.service.js +1620 -0
  744. package/dist/workflows/workflows.service.js.map +1 -0
  745. package/package.json +54 -11
  746. package/dist/actions/actions.repo.js +0 -13
  747. package/dist/actions/actions.repo.js.map +0 -1
  748. package/dist/actions/actions.service.js +0 -24
  749. package/dist/actions/actions.service.js.map +0 -1
  750. package/dist/actions/utils/actions.util.read.js +0 -427
  751. package/dist/actions/utils/actions.util.read.js.map +0 -1
  752. package/dist/api/services/integrationsApi.service.d.ts +0 -18
  753. package/dist/api/services/integrationsApi.service.js +0 -80
  754. package/dist/api/services/integrationsApi.service.js.map +0 -1
  755. package/dist/appBuilder/services/app.service.d.ts +0 -111
  756. package/dist/appBuilder/services/app.service.js +0 -737
  757. package/dist/appBuilder/services/app.service.js.map +0 -1
  758. package/dist/appBuilder/services/appBuilder.service.d.ts +0 -111
  759. package/dist/appBuilder/services/appBuilder.service.js +0 -662
  760. package/dist/appBuilder/services/appBuilder.service.js.map +0 -1
  761. package/dist/appBuilder/utils/objects.utils.d.ts +0 -3
  762. package/dist/appBuilder/utils/objects.utils.js +0 -9
  763. package/dist/appBuilder/utils/objects.utils.js.map +0 -1
  764. package/dist/appBuilder/utils/string.utils.d.ts +0 -2
  765. package/dist/appBuilder/utils/string.utils.js +0 -57
  766. package/dist/appBuilder/utils/string.utils.js.map +0 -1
  767. package/dist/appBuilder/validators/index.d.ts +0 -19
  768. package/dist/appBuilder/validators/index.js +0 -40
  769. package/dist/appBuilder/validators/index.js.map +0 -1
  770. package/dist/appBuilder/validators/joi-validators/create.app.validator.js +0 -10
  771. package/dist/appBuilder/validators/joi-validators/create.app.validator.js.map +0 -1
  772. package/dist/appBuilder/validators/joi-validators/create.appAction.validator.d.ts +0 -4
  773. package/dist/appBuilder/validators/joi-validators/create.appAction.validator.js +0 -20
  774. package/dist/appBuilder/validators/joi-validators/create.appAction.validator.js.map +0 -1
  775. package/dist/appBuilder/validators/joi-validators/create.appActionResponse.validator.d.ts +0 -7
  776. package/dist/appBuilder/validators/joi-validators/create.appActionResponse.validator.js +0 -44
  777. package/dist/appBuilder/validators/joi-validators/create.appActionResponse.validator.js.map +0 -1
  778. package/dist/appBuilder/validators/joi-validators/create.appAuth.validator.d.ts +0 -3
  779. package/dist/appBuilder/validators/joi-validators/create.appAuth.validator.js +0 -31
  780. package/dist/appBuilder/validators/joi-validators/create.appAuth.validator.js.map +0 -1
  781. package/dist/appBuilder/validators/joi-validators/create.appBody.validators.d.ts +0 -4
  782. package/dist/appBuilder/validators/joi-validators/create.appBody.validators.js +0 -11
  783. package/dist/appBuilder/validators/joi-validators/create.appBody.validators.js.map +0 -1
  784. package/dist/appBuilder/validators/joi-validators/create.appConstants.validator.d.ts +0 -4
  785. package/dist/appBuilder/validators/joi-validators/create.appConstants.validator.js +0 -12
  786. package/dist/appBuilder/validators/joi-validators/create.appConstants.validator.js.map +0 -1
  787. package/dist/appBuilder/validators/joi-validators/create.appEnv.validator.d.ts +0 -4
  788. package/dist/appBuilder/validators/joi-validators/create.appEnv.validator.js +0 -17
  789. package/dist/appBuilder/validators/joi-validators/create.appEnv.validator.js.map +0 -1
  790. package/dist/appBuilder/validators/joi-validators/create.appEvent.validator.d.ts +0 -5
  791. package/dist/appBuilder/validators/joi-validators/create.appEvent.validator.js +0 -30
  792. package/dist/appBuilder/validators/joi-validators/create.appEvent.validator.js.map +0 -1
  793. package/dist/appBuilder/validators/joi-validators/create.appVariable.validator.d.ts +0 -4
  794. package/dist/appBuilder/validators/joi-validators/create.appVariable.validator.js +0 -14
  795. package/dist/appBuilder/validators/joi-validators/create.appVariable.validator.js.map +0 -1
  796. package/dist/appBuilder/validators/joi-validators/sample.validator.d.ts +0 -5
  797. package/dist/appBuilder/validators/joi-validators/sample.validator.js +0 -26
  798. package/dist/appBuilder/validators/joi-validators/sample.validator.js.map +0 -1
  799. package/dist/appBuilder/validators/joi-validators/update.app.validator.d.ts +0 -4
  800. package/dist/appBuilder/validators/joi-validators/update.app.validator.js +0 -34
  801. package/dist/appBuilder/validators/joi-validators/update.app.validator.js.map +0 -1
  802. package/dist/appBuilder/validators/joi-validators/update.appAction.validator.d.ts +0 -4
  803. package/dist/appBuilder/validators/joi-validators/update.appAction.validator.js +0 -23
  804. package/dist/appBuilder/validators/joi-validators/update.appAction.validator.js.map +0 -1
  805. package/dist/appBuilder/validators/joi-validators/update.appActionResponse.validator.d.ts +0 -3
  806. package/dist/appBuilder/validators/joi-validators/update.appActionResponse.validator.js +0 -21
  807. package/dist/appBuilder/validators/joi-validators/update.appActionResponse.validator.js.map +0 -1
  808. package/dist/appBuilder/validators/joi-validators/update.appAuth.validator.d.ts +0 -4
  809. package/dist/appBuilder/validators/joi-validators/update.appAuth.validator.js +0 -19
  810. package/dist/appBuilder/validators/joi-validators/update.appAuth.validator.js.map +0 -1
  811. package/dist/appBuilder/validators/joi-validators/update.appConstants.validator.d.ts +0 -4
  812. package/dist/appBuilder/validators/joi-validators/update.appConstants.validator.js +0 -12
  813. package/dist/appBuilder/validators/joi-validators/update.appConstants.validator.js.map +0 -1
  814. package/dist/appBuilder/validators/joi-validators/update.appEnv.validator.d.ts +0 -4
  815. package/dist/appBuilder/validators/joi-validators/update.appEnv.validator.js +0 -17
  816. package/dist/appBuilder/validators/joi-validators/update.appEnv.validator.js.map +0 -1
  817. package/dist/appBuilder/validators/joi-validators/update.appEvent.validator.d.ts +0 -4
  818. package/dist/appBuilder/validators/joi-validators/update.appEvent.validator.js +0 -16
  819. package/dist/appBuilder/validators/joi-validators/update.appEvent.validator.js.map +0 -1
  820. package/dist/appBuilder/validators/joi-validators/update.appVariables.validator.d.ts +0 -4
  821. package/dist/appBuilder/validators/joi-validators/update.appVariables.validator.js +0 -14
  822. package/dist/appBuilder/validators/joi-validators/update.appVariables.validator.js.map +0 -1
  823. package/dist/appBuilder/validators/joi-validators/update.validation.entityData.validator.js +0 -27
  824. package/dist/appBuilder/validators/joi-validators/update.validation.entityData.validator.js.map +0 -1
  825. package/dist/apps/validators/joi-validators/create.appEvent.validator.d.ts +0 -5
  826. package/dist/apps/validators/joi-validators/create.appEvent.validator.js +0 -30
  827. package/dist/apps/validators/joi-validators/create.appEvent.validator.js.map +0 -1
  828. package/dist/apps/validators/joi-validators/update.appEvent.validator.d.ts +0 -4
  829. package/dist/apps/validators/joi-validators/update.appEvent.validator.js +0 -16
  830. package/dist/apps/validators/joi-validators/update.appEvent.validator.js.map +0 -1
  831. package/dist/clients/integrations.client.d.ts +0 -2
  832. package/dist/clients/integrations.client.js +0 -26
  833. package/dist/clients/integrations.client.js.map +0 -1
  834. package/dist/integrationsBuilder/services/integration.service.d.ts +0 -138
  835. package/dist/integrationsBuilder/services/integration.service.js +0 -1148
  836. package/dist/integrationsBuilder/services/integration.service.js.map +0 -1
  837. package/dist/integrationsBuilder/services/integrationBuilder.service.d.ts +0 -130
  838. package/dist/integrationsBuilder/services/integrationBuilder.service.js +0 -1017
  839. package/dist/integrationsBuilder/services/integrationBuilder.service.js.map +0 -1
  840. package/dist/integrationsBuilder/utils/objects.utils.d.ts +0 -2
  841. package/dist/integrationsBuilder/utils/objects.utils.js +0 -48
  842. package/dist/integrationsBuilder/utils/objects.utils.js.map +0 -1
  843. package/dist/integrationsBuilder/utils/string.utils.d.ts +0 -1
  844. package/dist/integrationsBuilder/utils/string.utils.js +0 -9
  845. package/dist/integrationsBuilder/utils/string.utils.js.map +0 -1
  846. package/dist/integrationsBuilder/validators/index.d.ts +0 -18
  847. package/dist/integrationsBuilder/validators/index.js +0 -38
  848. package/dist/integrationsBuilder/validators/index.js.map +0 -1
  849. package/dist/integrationsBuilder/validators/joi-validators/create.integration.validator.d.ts +0 -3
  850. package/dist/integrationsBuilder/validators/joi-validators/create.integration.validator.js +0 -10
  851. package/dist/integrationsBuilder/validators/joi-validators/create.integration.validator.js.map +0 -1
  852. package/dist/integrationsBuilder/validators/joi-validators/create.integrationApp.validator.d.ts +0 -4
  853. package/dist/integrationsBuilder/validators/joi-validators/create.integrationApp.validator.js +0 -26
  854. package/dist/integrationsBuilder/validators/joi-validators/create.integrationApp.validator.js.map +0 -1
  855. package/dist/integrationsBuilder/validators/joi-validators/create.integrationCache.validator.d.ts +0 -3
  856. package/dist/integrationsBuilder/validators/joi-validators/create.integrationCache.validator.js +0 -8
  857. package/dist/integrationsBuilder/validators/joi-validators/create.integrationCache.validator.js.map +0 -1
  858. package/dist/integrationsBuilder/validators/joi-validators/create.integrationDatabase.validator.d.ts +0 -3
  859. package/dist/integrationsBuilder/validators/joi-validators/create.integrationDatabase.validator.js +0 -8
  860. package/dist/integrationsBuilder/validators/joi-validators/create.integrationDatabase.validator.js.map +0 -1
  861. package/dist/integrationsBuilder/validators/joi-validators/create.integrationEnv.validator.d.ts +0 -3
  862. package/dist/integrationsBuilder/validators/joi-validators/create.integrationEnv.validator.js +0 -10
  863. package/dist/integrationsBuilder/validators/joi-validators/create.integrationEnv.validator.js.map +0 -1
  864. package/dist/integrationsBuilder/validators/joi-validators/create.integrationFeature.validator.d.ts +0 -3
  865. package/dist/integrationsBuilder/validators/joi-validators/create.integrationFeature.validator.js +0 -60
  866. package/dist/integrationsBuilder/validators/joi-validators/create.integrationFeature.validator.js.map +0 -1
  867. package/dist/integrationsBuilder/validators/joi-validators/create.integrationFunction.validator.d.ts +0 -3
  868. package/dist/integrationsBuilder/validators/joi-validators/create.integrationFunction.validator.js +0 -8
  869. package/dist/integrationsBuilder/validators/joi-validators/create.integrationFunction.validator.js.map +0 -1
  870. package/dist/integrationsBuilder/validators/joi-validators/create.integrationJob.validator.d.ts +0 -3
  871. package/dist/integrationsBuilder/validators/joi-validators/create.integrationJob.validator.js +0 -8
  872. package/dist/integrationsBuilder/validators/joi-validators/create.integrationJob.validator.js.map +0 -1
  873. package/dist/integrationsBuilder/validators/joi-validators/create.integrationNotification.validator.d.ts +0 -3
  874. package/dist/integrationsBuilder/validators/joi-validators/create.integrationNotification.validator.js +0 -8
  875. package/dist/integrationsBuilder/validators/joi-validators/create.integrationNotification.validator.js.map +0 -1
  876. package/dist/integrationsBuilder/validators/joi-validators/update.integrationApp.validator.d.ts +0 -3
  877. package/dist/integrationsBuilder/validators/joi-validators/update.integrationApp.validator.js +0 -9
  878. package/dist/integrationsBuilder/validators/joi-validators/update.integrationApp.validator.js.map +0 -1
  879. package/dist/integrationsBuilder/validators/joi-validators/update.integrationCache.validator.d.ts +0 -3
  880. package/dist/integrationsBuilder/validators/joi-validators/update.integrationCache.validator.js +0 -8
  881. package/dist/integrationsBuilder/validators/joi-validators/update.integrationCache.validator.js.map +0 -1
  882. package/dist/integrationsBuilder/validators/joi-validators/update.integrationDatabase.validator.d.ts +0 -3
  883. package/dist/integrationsBuilder/validators/joi-validators/update.integrationDatabase.validator.js +0 -8
  884. package/dist/integrationsBuilder/validators/joi-validators/update.integrationDatabase.validator.js.map +0 -1
  885. package/dist/integrationsBuilder/validators/joi-validators/update.integrationEnv.validator.d.ts +0 -3
  886. package/dist/integrationsBuilder/validators/joi-validators/update.integrationEnv.validator.js +0 -8
  887. package/dist/integrationsBuilder/validators/joi-validators/update.integrationEnv.validator.js.map +0 -1
  888. package/dist/integrationsBuilder/validators/joi-validators/update.integrationFeature.validator.d.ts +0 -3
  889. package/dist/integrationsBuilder/validators/joi-validators/update.integrationFeature.validator.js +0 -8
  890. package/dist/integrationsBuilder/validators/joi-validators/update.integrationFeature.validator.js.map +0 -1
  891. package/dist/integrationsBuilder/validators/joi-validators/update.integrationFunction.validator copy.d.ts +0 -3
  892. package/dist/integrationsBuilder/validators/joi-validators/update.integrationFunction.validator copy.js +0 -8
  893. package/dist/integrationsBuilder/validators/joi-validators/update.integrationFunction.validator copy.js.map +0 -1
  894. package/dist/integrationsBuilder/validators/joi-validators/update.integrationJob.validator.d.ts +0 -3
  895. package/dist/integrationsBuilder/validators/joi-validators/update.integrationJob.validator.js +0 -8
  896. package/dist/integrationsBuilder/validators/joi-validators/update.integrationJob.validator.js.map +0 -1
  897. package/dist/integrationsBuilder/validators/joi-validators/update.integrationNotification.validator.d.ts +0 -3
  898. package/dist/integrationsBuilder/validators/joi-validators/update.integrationNotification.validator.js +0 -8
  899. package/dist/integrationsBuilder/validators/joi-validators/update.integrationNotification.validator.js.map +0 -1
  900. package/dist/postman.d.ts +0 -1
  901. package/dist/postman.js +0 -21674
  902. package/dist/postman.js.map +0 -1
  903. package/dist/processor/utils/mongo.util.js +0 -152
  904. package/dist/processor/utils/mongo.util.js.map +0 -1
  905. package/dist/processor/utils/postgres.util.d.ts +0 -14
  906. package/dist/processor/utils/postgres.util.js +0 -83
  907. package/dist/processor/utils/postgres.util.js.map +0 -1
  908. package/dist/products/validators/joi-validators/create.product.validator.d.ts +0 -3
  909. package/dist/products/validators/joi-validators/create.product.validator.js +0 -10
  910. package/dist/products/validators/joi-validators/create.product.validator.js.map +0 -1
  911. package/dist/test.appBuilder.js +0 -14
  912. package/dist/test.appBuilder.js.map +0 -1
  913. package/dist/test.import.js +0 -24
  914. package/dist/test.import.js.map +0 -1
  915. package/dist/test.imports.js +0 -28
  916. package/dist/test.imports.js.map +0 -1
  917. package/dist/test.integrationBuilder.js +0 -276
  918. package/dist/test.integrationBuilder.js.map +0 -1
  919. package/dist/test.processor.js +0 -23
  920. package/dist/test.processor.js.map +0 -1
  921. package/dist/test.utils.js +0 -25
  922. package/dist/test.utils.js.map +0 -1
  923. package/dist/types/integrationsBuilder.types.d.ts +0 -276
  924. package/dist/types/integrationsBuilder.types.js +0 -51
  925. package/dist/types/integrationsBuilder.types.js.map +0 -1
  926. /package/dist/{actions/actions.repo.d.ts → pricing/pricing.repo.d.ts} +0 -0
  927. /package/dist/{appBuilder/validators/joi-validators/create.app.validator.d.ts → products/validators/joi-validators/create.productGraph.validator.d.ts} +0 -0
  928. /package/dist/{appBuilder/validators/joi-validators/update.validation.entityData.validator.d.ts → products/validators/joi-validators/update.productGraph.validator.d.ts} +0 -0
  929. /package/dist/{test.appBuilder.d.ts → test/test.broker.kafka.d.ts} +0 -0
  930. /package/dist/{test.imports.d.ts → test/test.broker.nats.d.ts} +0 -0
  931. /package/dist/{test.integrationBuilder.d.ts → test/test.broker.pubsub.d.ts} +0 -0
  932. /package/dist/{test.processor.d.ts → test/test.broker.rabbitmq.d.ts} +0 -0
  933. /package/dist/{test.utils.d.ts → test/test.broker.redis.d.ts} +0 -0
  934. /package/dist/{actions/actions.service.d.ts → test/test.health.d.ts} +0 -0
  935. /package/dist/{actions/utils/actions.util.read.d.ts → test/test.notifiers.d.ts} +0 -0
  936. /package/dist/{processor/utils/mongo.util.d.ts → test/test.products.d.ts} +0 -0
  937. /package/dist/{test.import.d.ts → types/request-tracker.interface.d.ts} +0 -0
@@ -0,0 +1,1249 @@
1
+ "use strict";
2
+ /**
3
+ * Agents Service
4
+ *
5
+ * Main service class for agentic workflows operations.
6
+ * Provides CRUD operations and execution for Ductape Agents.
7
+ *
8
+ * Agentic workflows extend Ductape's workflow engine to support AI-driven,
9
+ * autonomous multi-step processes where an LLM dynamically decides the
10
+ * next action based on observations and reasoning.
11
+ */
12
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ var desc = Object.getOwnPropertyDescriptor(m, k);
15
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
16
+ desc = { enumerable: true, get: function() { return m[k]; } };
17
+ }
18
+ Object.defineProperty(o, k2, desc);
19
+ }) : (function(o, m, k, k2) {
20
+ if (k2 === undefined) k2 = k;
21
+ o[k2] = m[k];
22
+ }));
23
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
24
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
25
+ }) : function(o, v) {
26
+ o["default"] = v;
27
+ });
28
+ var __importStar = (this && this.__importStar) || (function () {
29
+ var ownKeys = function(o) {
30
+ ownKeys = Object.getOwnPropertyNames || function (o) {
31
+ var ar = [];
32
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
33
+ return ar;
34
+ };
35
+ return ownKeys(o);
36
+ };
37
+ return function (mod) {
38
+ if (mod && mod.__esModule) return mod;
39
+ var result = {};
40
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
41
+ __setModuleDefault(result, mod);
42
+ return result;
43
+ };
44
+ })();
45
+ var __importDefault = (this && this.__importDefault) || function (mod) {
46
+ return (mod && mod.__esModule) ? mod : { "default": mod };
47
+ };
48
+ Object.defineProperty(exports, "__esModule", { value: true });
49
+ exports.agentsService = exports.AgentsService = exports.AgentError = void 0;
50
+ const crypto_1 = require("crypto");
51
+ const products_service_1 = __importDefault(require("../products/services/products.service"));
52
+ const processor_service_1 = __importDefault(require("../processor/services/processor.service"));
53
+ const logs_service_1 = __importDefault(require("../logs/logs.service"));
54
+ const logs_types_1 = require("../logs/logs.types");
55
+ const processor_utils_1 = require("../processor/utils/processor.utils");
56
+ const productsBuilder_types_1 = require("../types/productsBuilder.types");
57
+ const tool_registry_1 = require("./tool-registry");
58
+ const agent_executor_1 = require("./agent-executor");
59
+ const quota_service_1 = require("../resilience/quota.service");
60
+ const fallback_service_1 = require("../resilience/fallback.service");
61
+ const healthcheck_service_1 = require("../resilience/healthcheck.service");
62
+ const secrets_1 = require("../secrets");
63
+ /**
64
+ * Error class for agent-related errors
65
+ */
66
+ class AgentError extends Error {
67
+ constructor(message, code, details) {
68
+ super(message);
69
+ this.code = code;
70
+ this.details = details;
71
+ this.name = 'AgentError';
72
+ }
73
+ static configurationError(message) {
74
+ return new AgentError(message, 'CONFIGURATION_ERROR');
75
+ }
76
+ static validationError(message, details) {
77
+ return new AgentError(message, 'VALIDATION_ERROR', details);
78
+ }
79
+ static notFoundError(message) {
80
+ return new AgentError(message, 'NOT_FOUND');
81
+ }
82
+ static executionError(message, details) {
83
+ return new AgentError(message, 'EXECUTION_ERROR', details);
84
+ }
85
+ }
86
+ exports.AgentError = AgentError;
87
+ /**
88
+ * Main Agents Service class
89
+ * Provides unified interface for agent management and execution
90
+ */
91
+ class AgentsService {
92
+ /**
93
+ * Create a new AgentsService instance
94
+ * @param config - Optional configuration for authentication and workspace context
95
+ */
96
+ constructor(config) {
97
+ /** Service configuration */
98
+ this.config = null;
99
+ /** ProductBuilder instances cache (keyed by product tag) */
100
+ this.productBuilders = new Map();
101
+ /** Local agent definitions */
102
+ this.localAgents = new Map();
103
+ /** Tool registries per agent */
104
+ this.toolRegistries = new Map();
105
+ /** Active executors (for status/signal handling) */
106
+ this.activeExecutors = new Map();
107
+ /** LogService instance for logging operations */
108
+ this.logService = null;
109
+ /** Current product ID for logging */
110
+ this.productId = '';
111
+ this.config = config || null;
112
+ this._privateKey = config ? config.private_key : '';
113
+ }
114
+ // ==================== CONFIGURATION ====================
115
+ /**
116
+ * Update service configuration
117
+ */
118
+ updateConfig(config) {
119
+ this.config = config;
120
+ }
121
+ /**
122
+ * Get service configuration
123
+ */
124
+ getConfig() {
125
+ return this.config;
126
+ }
127
+ // ==================== PRODUCT BUILDER MANAGEMENT ====================
128
+ /**
129
+ * Create a new ProductBuilder instance
130
+ */
131
+ createNewProductBuilder() {
132
+ if (!this.config) {
133
+ throw AgentError.configurationError('AgentsService not configured. Please provide config when initializing.');
134
+ }
135
+ return new products_service_1.default({
136
+ workspace_id: this.config.workspace_id,
137
+ public_key: this.config.public_key,
138
+ user_id: this.config.user_id,
139
+ token: this.config.token,
140
+ env_type: this.config.env_type,
141
+ });
142
+ }
143
+ /**
144
+ * Get or create a ProductBuilder instance for the given product tag
145
+ */
146
+ async getProductBuilder(productTag) {
147
+ let builder = this.productBuilders.get(productTag);
148
+ if (!builder) {
149
+ builder = this.createNewProductBuilder();
150
+ await builder.initializeProductByTag(productTag);
151
+ this.productBuilders.set(productTag, builder);
152
+ this.productId = builder.fetchProductId() || '';
153
+ }
154
+ return builder;
155
+ }
156
+ /**
157
+ * Initialize logging service
158
+ */
159
+ initializeLogService() {
160
+ if (!this.logService && this.config) {
161
+ this.logService = new logs_service_1.default({
162
+ product_id: this.productId,
163
+ workspace_id: this.config.workspace_id,
164
+ public_key: this.config.public_key,
165
+ user_id: this.config.user_id,
166
+ token: this.config.token,
167
+ env_type: this.config.env_type,
168
+ });
169
+ }
170
+ }
171
+ /**
172
+ * Create a new ProcessorService instance
173
+ */
174
+ createNewProcessor() {
175
+ if (!this.config) {
176
+ throw AgentError.configurationError('AgentsService not configured. Please provide config when initializing.');
177
+ }
178
+ return new processor_service_1.default({
179
+ workspace_id: this.config.workspace_id,
180
+ public_key: this.config.public_key,
181
+ user_id: this.config.user_id,
182
+ token: this.config.token,
183
+ env_type: this.config.env_type,
184
+ redis_client: this.config.redis_client,
185
+ private_key: this._privateKey,
186
+ });
187
+ }
188
+ /**
189
+ * Create a resilience service wrapper for agent operations
190
+ */
191
+ createResilienceService() {
192
+ if (!this.config) {
193
+ return undefined;
194
+ }
195
+ const serviceConfig = {
196
+ workspace_id: this.config.workspace_id,
197
+ public_key: this.config.public_key,
198
+ user_id: this.config.user_id,
199
+ token: this.config.token,
200
+ env_type: this.config.env_type,
201
+ private_key: this._privateKey,
202
+ access_key: this.config.access_key,
203
+ };
204
+ // Create individual services
205
+ const quotaService = new quota_service_1.QuotaService(serviceConfig);
206
+ const fallbackService = new fallback_service_1.FallbackService(serviceConfig);
207
+ const healthcheckService = new healthcheck_service_1.HealthcheckService(serviceConfig);
208
+ // Return a wrapper that delegates to the appropriate service
209
+ return {
210
+ async runQuota(options) {
211
+ return quotaService.run({
212
+ product: options.product,
213
+ env: options.env,
214
+ tag: options.tag,
215
+ input: options.input,
216
+ session: options.session,
217
+ });
218
+ },
219
+ async runFallback(options) {
220
+ return fallbackService.run({
221
+ product: options.product,
222
+ env: options.env,
223
+ tag: options.tag,
224
+ input: options.input,
225
+ session: options.session,
226
+ });
227
+ },
228
+ async checkHealth(options) {
229
+ return healthcheckService.getStatus({
230
+ product: options.product,
231
+ env: options.env,
232
+ tag: options.tag,
233
+ });
234
+ },
235
+ async getQuotaStatus(options) {
236
+ // This would need to be implemented in QuotaService
237
+ // For now, return basic status
238
+ return {
239
+ tag: options.tag,
240
+ totalQuota: undefined,
241
+ usedQuota: undefined,
242
+ remainingQuota: undefined,
243
+ providers: [],
244
+ };
245
+ },
246
+ };
247
+ }
248
+ /**
249
+ * Get context services for agent execution
250
+ */
251
+ getContextServices(resilienceConfig) {
252
+ return {
253
+ config: this.config,
254
+ processorService: this.createNewProcessor(),
255
+ resilienceService: this.createResilienceService(),
256
+ resilienceConfig,
257
+ // Note: These services would be injected from the main Ductape class
258
+ // databaseService, graphService, storageService, brokersService
259
+ };
260
+ }
261
+ // ==================== AGENT DEFINITION ====================
262
+ /**
263
+ * Define a new agent and optionally persist to database
264
+ *
265
+ * @example
266
+ * ```ts
267
+ * // Define and persist to database
268
+ * const agent = await ductape.agents.define({
269
+ * product: 'my-product',
270
+ * tag: 'customer-support',
271
+ * name: 'Customer Support Agent',
272
+ * model: { provider: 'anthropic', model: 'claude-sonnet-4-20250514' },
273
+ * systemPrompt: 'You are a helpful customer support agent...',
274
+ * tools: [
275
+ * {
276
+ * tag: 'lookup-order',
277
+ * description: 'Look up order details',
278
+ * parameters: { orderId: { type: 'string', description: 'Order ID' } },
279
+ * handler: async (ctx, params) => ctx.database.query({ ... }),
280
+ * },
281
+ * ],
282
+ * });
283
+ * ```
284
+ */
285
+ async define(options) {
286
+ var _a;
287
+ // Validate required fields
288
+ if (!options.tag) {
289
+ throw AgentError.validationError('Agent tag is required');
290
+ }
291
+ if (!options.name) {
292
+ throw AgentError.validationError('Agent name is required');
293
+ }
294
+ if (!options.model) {
295
+ throw AgentError.validationError('Agent model configuration is required');
296
+ }
297
+ if (!options.systemPrompt) {
298
+ throw AgentError.validationError('Agent system prompt is required');
299
+ }
300
+ // Create tool registry
301
+ const toolRegistry = new tool_registry_1.ToolRegistry();
302
+ if (options.tools && options.tools.length > 0) {
303
+ toolRegistry.registerMany(options.tools);
304
+ }
305
+ // Store tool registry (with handlers for local execution)
306
+ this.toolRegistries.set(options.tag, toolRegistry);
307
+ // Get tool schemas (without handlers for storage)
308
+ const toolSchemas = toolRegistry.getSchemas();
309
+ // Create defined agent (without handlers for storage)
310
+ const definedAgent = {
311
+ tag: options.tag,
312
+ name: options.name,
313
+ description: options.description,
314
+ model: options.model,
315
+ modelConfig: options.modelConfig,
316
+ systemPrompt: options.systemPrompt,
317
+ toolSchemas,
318
+ termination: options.termination,
319
+ memory: options.memory,
320
+ humanInLoop: options.humanInLoop,
321
+ streaming: options.streaming,
322
+ inputSchema: options.inputSchema,
323
+ envs: options.envs,
324
+ resilience: options.resilience,
325
+ };
326
+ // Store locally
327
+ this.localAgents.set(options.tag, definedAgent);
328
+ // If product is specified, persist to database
329
+ if (options.product) {
330
+ try {
331
+ const productBuilder = await this.getProductBuilder(options.product);
332
+ // Convert to IProductAgent format for storage
333
+ const productAgent = {
334
+ tag: options.tag,
335
+ name: options.name,
336
+ description: options.description,
337
+ model: options.model, // Model is a tag reference to product-level model config
338
+ modelConfig: options.modelConfig,
339
+ systemPrompt: options.systemPrompt,
340
+ tools: toolSchemas.map((schema) => ({
341
+ tag: schema.tag,
342
+ name: schema.name,
343
+ description: schema.description,
344
+ parameters: schema.parameters,
345
+ requiresConfirmation: schema.requiresConfirmation,
346
+ costEstimate: schema.costEstimate,
347
+ timeout: schema.timeout,
348
+ retries: schema.retries,
349
+ })),
350
+ termination: options.termination ? {
351
+ maxIterations: options.termination.maxIterations,
352
+ maxTokens: options.termination.maxTokens,
353
+ timeout: typeof options.termination.timeout === 'string'
354
+ ? parseInt(options.termination.timeout)
355
+ : options.termination.timeout,
356
+ allowManualStop: options.termination.allowManualStop,
357
+ } : undefined,
358
+ memory: options.memory ? {
359
+ shortTerm: options.memory.shortTerm,
360
+ longTerm: options.memory.longTerm,
361
+ } : undefined,
362
+ humanInLoop: options.humanInLoop ? {
363
+ enabled: options.humanInLoop.enabled,
364
+ alwaysRequireApproval: options.humanInLoop.alwaysRequireApproval,
365
+ approvalTimeout: typeof options.humanInLoop.approvalTimeout === 'string'
366
+ ? parseInt(options.humanInLoop.approvalTimeout)
367
+ : options.humanInLoop.approvalTimeout,
368
+ approvalWebhook: options.humanInLoop.approvalWebhook,
369
+ approvalBroker: options.humanInLoop.approvalBroker,
370
+ } : undefined,
371
+ streaming: options.streaming ? {
372
+ enabled: options.streaming.enabled,
373
+ events: options.streaming.events,
374
+ webhook: options.streaming.webhook,
375
+ broker: options.streaming.broker,
376
+ } : undefined,
377
+ inputSchema: options.inputSchema,
378
+ envs: (_a = options.envs) === null || _a === void 0 ? void 0 : _a.map((env) => ({
379
+ slug: env.slug,
380
+ active: env.active,
381
+ model: env.model, // Model tag override for this environment
382
+ modelConfig: env.modelConfig,
383
+ toolOverrides: env.toolOverrides,
384
+ })),
385
+ resilience: options.resilience,
386
+ };
387
+ await productBuilder.createAgent(productAgent);
388
+ }
389
+ catch (error) {
390
+ // Log but don't fail - agent is still stored locally
391
+ console.warn(`Failed to persist agent to database: ${error}`);
392
+ }
393
+ }
394
+ return definedAgent;
395
+ }
396
+ /**
397
+ * Register a defined agent with a product (persists to database)
398
+ *
399
+ * @example
400
+ * ```ts
401
+ * await ductape.agents.register('my-product', agent);
402
+ * ```
403
+ */
404
+ async register(product, agent) {
405
+ var _a, _b, _c, _d, _e, _f, _g;
406
+ const process_id = (0, processor_utils_1.generateObjectId)();
407
+ // Initialize logging
408
+ await this.getProductBuilder(product);
409
+ this.initializeLogService();
410
+ const baseLogs = {
411
+ product_tag: product,
412
+ workspace_id: ((_a = this.config) === null || _a === void 0 ? void 0 : _a.workspace_id) || '',
413
+ env: '',
414
+ process_id,
415
+ type: logs_types_1.LogEventTypes.WORKFLOW,
416
+ parent_tag: agent.tag,
417
+ data: { agent: agent.tag, operation: 'register' },
418
+ };
419
+ (_b = this.logService) === null || _b === void 0 ? void 0 : _b.add(Object.assign(Object.assign({}, baseLogs), { message: 'Agent register - initiated', status: logs_types_1.LogEventStatus.PROCESSING }));
420
+ try {
421
+ const productBuilder = await this.getProductBuilder(product);
422
+ // Convert to IProductAgent format and persist to database
423
+ const productAgent = {
424
+ tag: agent.tag,
425
+ name: agent.name,
426
+ description: agent.description,
427
+ model: agent.model, // Model is a tag reference to product-level model config
428
+ modelConfig: agent.modelConfig,
429
+ systemPrompt: agent.systemPrompt,
430
+ tools: agent.toolSchemas.map((schema) => ({
431
+ tag: schema.tag,
432
+ name: schema.name,
433
+ description: schema.description,
434
+ parameters: schema.parameters,
435
+ requiresConfirmation: schema.requiresConfirmation,
436
+ costEstimate: schema.costEstimate,
437
+ timeout: schema.timeout,
438
+ retries: schema.retries,
439
+ })),
440
+ termination: agent.termination ? {
441
+ maxIterations: agent.termination.maxIterations,
442
+ maxTokens: agent.termination.maxTokens,
443
+ timeout: typeof agent.termination.timeout === 'string'
444
+ ? parseInt(agent.termination.timeout)
445
+ : agent.termination.timeout,
446
+ allowManualStop: agent.termination.allowManualStop,
447
+ } : undefined,
448
+ memory: agent.memory ? {
449
+ shortTerm: agent.memory.shortTerm,
450
+ longTerm: agent.memory.longTerm,
451
+ } : undefined,
452
+ humanInLoop: agent.humanInLoop ? {
453
+ enabled: agent.humanInLoop.enabled,
454
+ alwaysRequireApproval: agent.humanInLoop.alwaysRequireApproval,
455
+ approvalTimeout: typeof agent.humanInLoop.approvalTimeout === 'string'
456
+ ? parseInt(agent.humanInLoop.approvalTimeout)
457
+ : agent.humanInLoop.approvalTimeout,
458
+ approvalWebhook: agent.humanInLoop.approvalWebhook,
459
+ approvalBroker: agent.humanInLoop.approvalBroker,
460
+ } : undefined,
461
+ streaming: agent.streaming ? {
462
+ enabled: agent.streaming.enabled,
463
+ events: agent.streaming.events,
464
+ webhook: agent.streaming.webhook,
465
+ broker: agent.streaming.broker,
466
+ } : undefined,
467
+ inputSchema: agent.inputSchema,
468
+ envs: (_c = agent.envs) === null || _c === void 0 ? void 0 : _c.map((env) => ({
469
+ slug: env.slug,
470
+ active: env.active,
471
+ model: env.model, // Model tag override for this environment
472
+ modelConfig: env.modelConfig,
473
+ toolOverrides: env.toolOverrides,
474
+ })),
475
+ resilience: agent.resilience,
476
+ };
477
+ await productBuilder.createAgent(productAgent);
478
+ // Also store locally for immediate execution
479
+ this.localAgents.set(agent.tag, agent);
480
+ (_d = this.logService) === null || _d === void 0 ? void 0 : _d.add(Object.assign(Object.assign({}, baseLogs), { message: 'Agent register - success', successful_execution: true, status: logs_types_1.LogEventStatus.SUCCESS }));
481
+ (_e = this.logService) === null || _e === void 0 ? void 0 : _e.publish();
482
+ }
483
+ catch (error) {
484
+ (_f = this.logService) === null || _f === void 0 ? void 0 : _f.add(Object.assign(Object.assign({}, baseLogs), { message: 'Agent register - failed', failed_execution: true, data: { agent: agent.tag, operation: 'register', error: String(error) }, status: logs_types_1.LogEventStatus.FAIL }));
485
+ await ((_g = this.logService) === null || _g === void 0 ? void 0 : _g.publish());
486
+ throw AgentError.executionError(`Failed to register agent: ${error}`, { agent: agent.tag });
487
+ }
488
+ }
489
+ // ==================== AGENT EXECUTION ====================
490
+ /**
491
+ * Run an agent
492
+ *
493
+ * @example
494
+ * ```ts
495
+ * const result = await ductape.agents.run({
496
+ * product: 'my-product',
497
+ * env: 'production',
498
+ * tag: 'customer-support',
499
+ * input: {
500
+ * ticketId: 'TICKET-123',
501
+ * message: 'I need help with my order',
502
+ * },
503
+ * });
504
+ * ```
505
+ */
506
+ async run(options) {
507
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12;
508
+ const process_id = (0, processor_utils_1.generateObjectId)();
509
+ const startTime = Date.now();
510
+ // Session log fields (will be populated if session is provided)
511
+ let sessionLogFields = {};
512
+ let resolvedOptions = options;
513
+ // Initialize logging
514
+ const productBuilder = await this.getProductBuilder(options.product);
515
+ this.initializeLogService();
516
+ // Process session if provided - verify and resolve $Session{} references
517
+ if (options.session) {
518
+ const privateKey = productBuilder.fetchPrivateKey();
519
+ if (privateKey) {
520
+ const { processSessionForExecution } = await Promise.resolve().then(() => __importStar(require('../sessions')));
521
+ const sessionResult = await processSessionForExecution(options.session, privateKey, options, options.env);
522
+ if (sessionResult.error) {
523
+ throw AgentError.executionError(`Session validation failed: ${sessionResult.error}`);
524
+ }
525
+ resolvedOptions = sessionResult.input;
526
+ sessionLogFields = sessionResult.logFields;
527
+ }
528
+ }
529
+ const baseLogs = Object.assign({ product_tag: options.product, workspace_id: ((_a = this.config) === null || _a === void 0 ? void 0 : _a.workspace_id) || '', env: options.env, process_id, type: logs_types_1.LogEventTypes.WORKFLOW, parent_tag: options.tag, data: { agent: options.tag, operation: 'run' } }, sessionLogFields);
530
+ (_b = this.logService) === null || _b === void 0 ? void 0 : _b.add(Object.assign(Object.assign({}, baseLogs), { message: 'Agent run - initiated', status: logs_types_1.LogEventStatus.PROCESSING }));
531
+ try {
532
+ // Get agent definition - first check local, then fetch from database
533
+ let agent = this.localAgents.get(resolvedOptions.tag);
534
+ let toolRegistry = this.toolRegistries.get(resolvedOptions.tag);
535
+ if (!agent) {
536
+ // Try to fetch from database
537
+ const storedAgent = await productBuilder.fetchAgent(resolvedOptions.tag);
538
+ if (!storedAgent) {
539
+ throw AgentError.notFoundError(`Agent '${resolvedOptions.tag}' not found`);
540
+ }
541
+ // Convert IProductAgent to IDefinedAgent
542
+ agent = this.convertProductAgentToDefinedAgent(storedAgent);
543
+ // Store locally for future use
544
+ this.localAgents.set(resolvedOptions.tag, agent);
545
+ // Create tool registry from stored schemas (without handlers)
546
+ toolRegistry = new tool_registry_1.ToolRegistry();
547
+ // Note: Tools from database won't have handlers - they need handlerRef or runtime registration
548
+ for (const tool of storedAgent.tools || []) {
549
+ toolRegistry.register({
550
+ tag: tool.tag,
551
+ name: tool.name,
552
+ description: tool.description,
553
+ parameters: tool.parameters,
554
+ requiresConfirmation: tool.requiresConfirmation,
555
+ costEstimate: tool.costEstimate,
556
+ timeout: tool.timeout,
557
+ retries: tool.retries,
558
+ // Handler will need to be resolved from handlerRef or provided at runtime
559
+ handler: tool.handlerRef
560
+ ? this.createHandlerFromRef(tool.handlerRef, resolvedOptions.product, resolvedOptions.env)
561
+ : async () => { throw new Error(`No handler for tool '${tool.tag}'. Provide handlerRef or register handler at runtime.`); },
562
+ });
563
+ }
564
+ this.toolRegistries.set(resolvedOptions.tag, toolRegistry);
565
+ }
566
+ if (!toolRegistry) {
567
+ throw AgentError.notFoundError(`Tool registry for agent '${resolvedOptions.tag}' not found`);
568
+ }
569
+ // Resolve model config from the model tag
570
+ const modelConfig = await productBuilder.fetchModel(agent.model);
571
+ if (!modelConfig) {
572
+ throw AgentError.notFoundError(`Model '${agent.model}' not found`);
573
+ }
574
+ // Find the env-specific config
575
+ const envConfig = modelConfig.envs.find(e => e.slug === resolvedOptions.env);
576
+ if (!envConfig) {
577
+ throw AgentError.configurationError(`Model '${agent.model}' has no configuration for environment '${resolvedOptions.env}'`);
578
+ }
579
+ // Decrypt API key using product private key, or resolve secret reference
580
+ const privateKey = productBuilder.fetchPrivateKey();
581
+ let apiKey = envConfig.apiKey;
582
+ if (apiKey) {
583
+ // Check if it's a secret reference
584
+ if ((0, secrets_1.isSecretReference)(apiKey).isSecret) {
585
+ const secretsService = (0, secrets_1.getSecretsService)();
586
+ if (secretsService) {
587
+ const resolved = await secretsService.resolve(apiKey, { env: resolvedOptions.env });
588
+ apiKey = resolved.value;
589
+ }
590
+ else {
591
+ throw AgentError.configurationError(`Model API key contains secret reference '${apiKey}' but secrets service is not initialized. ` +
592
+ `Please ensure the Ductape client is properly initialized.`);
593
+ }
594
+ }
595
+ else if (privateKey) {
596
+ // Try to decrypt if it's not a secret reference
597
+ try {
598
+ const { decrypt } = await Promise.resolve().then(() => __importStar(require('../processor/utils/processor.utils')));
599
+ apiKey = decrypt(apiKey, privateKey);
600
+ }
601
+ catch (e) {
602
+ // If decryption fails, try using the key as-is (might be unencrypted in dev)
603
+ console.warn('Failed to decrypt model API key, using as-is');
604
+ }
605
+ }
606
+ }
607
+ // Also resolve any secret references in baseUrl
608
+ let baseUrl = envConfig.baseUrl;
609
+ if (baseUrl && (0, secrets_1.isSecretReference)(baseUrl).isSecret) {
610
+ const secretsService = (0, secrets_1.getSecretsService)();
611
+ if (secretsService) {
612
+ const resolved = await secretsService.resolve(baseUrl, { env: resolvedOptions.env });
613
+ baseUrl = resolved.value;
614
+ }
615
+ else {
616
+ throw AgentError.configurationError(`Model baseUrl contains secret reference but secrets service is not initialized.`);
617
+ }
618
+ }
619
+ // Get environment-specific agent config if available
620
+ const agentEnvConfig = (_c = agent.envs) === null || _c === void 0 ? void 0 : _c.find(e => e.slug === resolvedOptions.env);
621
+ // Build the resolved LLM config with overrides
622
+ // Precedence: model entity < agent.modelConfig < agentEnvConfig.modelConfig < resolvedOptions.modelConfig
623
+ const resolvedModelConfig = {
624
+ provider: modelConfig.provider,
625
+ model: modelConfig.model,
626
+ // Start with model entity values, then apply overrides
627
+ temperature: (_j = (_g = (_e = (_d = resolvedOptions.modelConfig) === null || _d === void 0 ? void 0 : _d.temperature) !== null && _e !== void 0 ? _e : (_f = agentEnvConfig === null || agentEnvConfig === void 0 ? void 0 : agentEnvConfig.modelConfig) === null || _f === void 0 ? void 0 : _f.temperature) !== null && _g !== void 0 ? _g : (_h = agent.modelConfig) === null || _h === void 0 ? void 0 : _h.temperature) !== null && _j !== void 0 ? _j : modelConfig.temperature,
628
+ maxTokens: (_q = (_o = (_l = (_k = resolvedOptions.modelConfig) === null || _k === void 0 ? void 0 : _k.maxTokens) !== null && _l !== void 0 ? _l : (_m = agentEnvConfig === null || agentEnvConfig === void 0 ? void 0 : agentEnvConfig.modelConfig) === null || _m === void 0 ? void 0 : _m.maxTokens) !== null && _o !== void 0 ? _o : (_p = agent.modelConfig) === null || _p === void 0 ? void 0 : _p.maxTokens) !== null && _q !== void 0 ? _q : modelConfig.maxTokens,
629
+ topP: (_w = (_u = (_s = (_r = resolvedOptions.modelConfig) === null || _r === void 0 ? void 0 : _r.topP) !== null && _s !== void 0 ? _s : (_t = agentEnvConfig === null || agentEnvConfig === void 0 ? void 0 : agentEnvConfig.modelConfig) === null || _t === void 0 ? void 0 : _t.topP) !== null && _u !== void 0 ? _u : (_v = agent.modelConfig) === null || _v === void 0 ? void 0 : _v.topP) !== null && _w !== void 0 ? _w : modelConfig.topP,
630
+ stopSequences: (_2 = (_0 = (_y = (_x = resolvedOptions.modelConfig) === null || _x === void 0 ? void 0 : _x.stopSequences) !== null && _y !== void 0 ? _y : (_z = agentEnvConfig === null || agentEnvConfig === void 0 ? void 0 : agentEnvConfig.modelConfig) === null || _z === void 0 ? void 0 : _z.stopSequences) !== null && _0 !== void 0 ? _0 : (_1 = agent.modelConfig) === null || _1 === void 0 ? void 0 : _1.stopSequences) !== null && _2 !== void 0 ? _2 : modelConfig.stopSequences,
631
+ timeout: (_8 = (_6 = (_4 = (_3 = resolvedOptions.modelConfig) === null || _3 === void 0 ? void 0 : _3.timeout) !== null && _4 !== void 0 ? _4 : (_5 = agentEnvConfig === null || agentEnvConfig === void 0 ? void 0 : agentEnvConfig.modelConfig) === null || _5 === void 0 ? void 0 : _5.timeout) !== null && _6 !== void 0 ? _6 : (_7 = agent.modelConfig) === null || _7 === void 0 ? void 0 : _7.timeout) !== null && _8 !== void 0 ? _8 : modelConfig.timeout,
632
+ apiKey,
633
+ baseUrl,
634
+ };
635
+ // Create executor with resolved model config
636
+ const executor = new agent_executor_1.AgentExecutor(agent, toolRegistry, this.getContextServices(agent.resilience), resolvedOptions, (0, agent_executor_1.createLLMProvider)(resolvedModelConfig), resolvedModelConfig);
637
+ // Store executor for signal handling
638
+ const executionId = executor.getState().execution_id;
639
+ this.activeExecutors.set(executionId, executor);
640
+ // Execute agent
641
+ const result = await executor.execute();
642
+ // Cleanup
643
+ this.activeExecutors.delete(executionId);
644
+ (_9 = this.logService) === null || _9 === void 0 ? void 0 : _9.add(Object.assign(Object.assign({}, baseLogs), { message: 'Agent run - success', successful_execution: result.status === 'completed', failed_execution: result.status === 'failed', data: {
645
+ agent: resolvedOptions.tag,
646
+ operation: 'run',
647
+ execution_id: result.execution_id,
648
+ iterations: result.iterations,
649
+ status: result.status,
650
+ }, status: result.status === 'completed' ? logs_types_1.LogEventStatus.SUCCESS : logs_types_1.LogEventStatus.FAIL }));
651
+ (_10 = this.logService) === null || _10 === void 0 ? void 0 : _10.publish();
652
+ return result;
653
+ }
654
+ catch (error) {
655
+ (_11 = this.logService) === null || _11 === void 0 ? void 0 : _11.add(Object.assign(Object.assign({}, baseLogs), { message: 'Agent run - failed', failed_execution: true, data: { agent: resolvedOptions.tag, operation: 'run', error: String(error) }, status: logs_types_1.LogEventStatus.FAIL }));
656
+ await ((_12 = this.logService) === null || _12 === void 0 ? void 0 : _12.publish());
657
+ throw AgentError.executionError(`Failed to run agent: ${error}`, { agent: resolvedOptions.tag });
658
+ }
659
+ }
660
+ // ==================== DISPATCH (SCHEDULED EXECUTION) ====================
661
+ /**
662
+ * Dispatch an agent for scheduled or deferred execution
663
+ *
664
+ * @example
665
+ * ```ts
666
+ * const job = await ductape.agents.dispatch({
667
+ * product: 'my-product',
668
+ * env: 'production',
669
+ * agent: 'daily-report-agent',
670
+ * input: { reportType: 'daily' },
671
+ * schedule: { cron: '0 9 * * *' }, // Daily at 9 AM
672
+ * });
673
+ * ```
674
+ */
675
+ async dispatch(options) {
676
+ var _a, _b, _c, _d, _e, _f;
677
+ const process_id = (0, processor_utils_1.generateObjectId)();
678
+ const processorService = this.createNewProcessor();
679
+ const productBuilder = await this.getProductBuilder(options.product);
680
+ const schedule = options.schedule || {};
681
+ const startAt = typeof schedule.start_at === 'string'
682
+ ? new Date(schedule.start_at).getTime()
683
+ : schedule.start_at || Date.now();
684
+ const jobTag = `agent:${options.agent}`;
685
+ // Initialize logging
686
+ this.initializeLogService();
687
+ const baseLogs = {
688
+ product_tag: options.product,
689
+ workspace_id: ((_a = this.config) === null || _a === void 0 ? void 0 : _a.workspace_id) || '',
690
+ env: options.env,
691
+ process_id,
692
+ type: logs_types_1.LogEventTypes.WORKFLOW,
693
+ parent_tag: options.agent,
694
+ data: { agent: options.agent, operation: 'dispatch' },
695
+ };
696
+ (_b = this.logService) === null || _b === void 0 ? void 0 : _b.add(Object.assign(Object.assign({}, baseLogs), { message: 'Agent dispatch - initiated', status: logs_types_1.LogEventStatus.PROCESSING }));
697
+ try {
698
+ // Check if job exists, if not create it
699
+ const existingJob = await productBuilder.fetchJob(jobTag);
700
+ if (!existingJob) {
701
+ await productBuilder.createJob({
702
+ tag: jobTag,
703
+ name: `Agent: ${options.agent}`,
704
+ description: `Auto-created job for agent ${options.agent}`,
705
+ type: productsBuilder_types_1.JobEventTypes.ACTION, // Agent executions are actions
706
+ app: options.agent,
707
+ event: 'execute',
708
+ executions: 0,
709
+ intervals: schedule.every || 0,
710
+ start_at: startAt,
711
+ });
712
+ }
713
+ const jobInput = {
714
+ product: options.product,
715
+ env: options.env,
716
+ event: jobTag,
717
+ input: options.input,
718
+ retries: options.retries || 0,
719
+ start_at: startAt,
720
+ session: options.session,
721
+ cache: options.cache,
722
+ repeat: schedule.cron || schedule.every
723
+ ? {
724
+ cron: schedule.cron,
725
+ every: schedule.every,
726
+ limit: schedule.limit,
727
+ endDate: schedule.endDate,
728
+ tz: schedule.tz,
729
+ }
730
+ : undefined,
731
+ };
732
+ await processorService.processJob(jobInput);
733
+ const isRecurring = !!(schedule.cron || schedule.every);
734
+ let nextRunAt;
735
+ if (isRecurring && schedule.every) {
736
+ nextRunAt = startAt + schedule.every;
737
+ }
738
+ const job_id = (0, crypto_1.randomUUID)();
739
+ (_c = this.logService) === null || _c === void 0 ? void 0 : _c.add(Object.assign(Object.assign({}, baseLogs), { message: 'Agent dispatch - success', successful_execution: true, data: { agent: options.agent, operation: 'dispatch', job_id }, status: logs_types_1.LogEventStatus.SUCCESS }));
740
+ (_d = this.logService) === null || _d === void 0 ? void 0 : _d.publish();
741
+ return {
742
+ job_id,
743
+ status: startAt > Date.now() ? 'scheduled' : 'queued',
744
+ scheduled_at: startAt,
745
+ recurring: isRecurring,
746
+ next_run_at: nextRunAt,
747
+ };
748
+ }
749
+ catch (error) {
750
+ (_e = this.logService) === null || _e === void 0 ? void 0 : _e.add(Object.assign(Object.assign({}, baseLogs), { message: 'Agent dispatch - failed', failed_execution: true, data: { agent: options.agent, operation: 'dispatch', error: String(error) }, status: logs_types_1.LogEventStatus.FAIL }));
751
+ await ((_f = this.logService) === null || _f === void 0 ? void 0 : _f.publish());
752
+ throw error;
753
+ }
754
+ }
755
+ // ==================== SIGNALS ====================
756
+ /**
757
+ * Send a signal to a running agent
758
+ *
759
+ * @example
760
+ * ```ts
761
+ * // Stop an agent
762
+ * await ductape.agents.signal({
763
+ * product: 'my-product',
764
+ * env: 'production',
765
+ * execution_id: 'exec-123',
766
+ * signal: 'stop',
767
+ * });
768
+ *
769
+ * // Approve a tool call
770
+ * await ductape.agents.signal({
771
+ * product: 'my-product',
772
+ * env: 'production',
773
+ * execution_id: 'exec-123',
774
+ * signal: 'approve',
775
+ * payload: { toolCallId: 'tc-456' },
776
+ * });
777
+ * ```
778
+ */
779
+ async signal(options) {
780
+ const executor = this.activeExecutors.get(options.execution_id);
781
+ if (!executor) {
782
+ throw AgentError.notFoundError(`Agent execution '${options.execution_id}' not found or not active`);
783
+ }
784
+ switch (options.signal) {
785
+ case 'stop':
786
+ executor.handleStop();
787
+ break;
788
+ case 'pause':
789
+ executor.handlePause();
790
+ break;
791
+ case 'resume':
792
+ executor.handleResume();
793
+ break;
794
+ case 'approve':
795
+ executor.handleApproval(true, options.payload);
796
+ break;
797
+ case 'reject':
798
+ executor.handleApproval(false);
799
+ break;
800
+ default:
801
+ throw AgentError.validationError(`Unknown signal: ${options.signal}`);
802
+ }
803
+ }
804
+ // ==================== STATUS ====================
805
+ /**
806
+ * Get the status of an agent execution
807
+ *
808
+ * @example
809
+ * ```ts
810
+ * const status = await ductape.agents.status({
811
+ * product: 'my-product',
812
+ * env: 'production',
813
+ * execution_id: 'exec-123',
814
+ * });
815
+ * ```
816
+ */
817
+ async status(options) {
818
+ const executor = this.activeExecutors.get(options.execution_id);
819
+ if (!executor) {
820
+ // Could query from database for completed executions
821
+ return null;
822
+ }
823
+ return executor.getState();
824
+ }
825
+ /**
826
+ * List agent executions
827
+ *
828
+ * @example
829
+ * ```ts
830
+ * const executions = await ductape.agents.list({
831
+ * product: 'my-product',
832
+ * env: 'production',
833
+ * agent: 'customer-support',
834
+ * status: 'completed',
835
+ * limit: 10,
836
+ * });
837
+ * ```
838
+ */
839
+ async list(options) {
840
+ // For now, return active executions
841
+ // In production, would query from database
842
+ const executions = [];
843
+ for (const [executionId, executor] of this.activeExecutors) {
844
+ const state = executor.getState();
845
+ // Apply filters
846
+ if (options.agent && state.agent_tag !== options.agent) {
847
+ continue;
848
+ }
849
+ if (options.status) {
850
+ const statuses = Array.isArray(options.status) ? options.status : [options.status];
851
+ if (!statuses.includes(state.status)) {
852
+ continue;
853
+ }
854
+ }
855
+ executions.push({
856
+ execution_id: state.execution_id,
857
+ agent_tag: state.agent_tag,
858
+ status: state.status,
859
+ startedAt: state.startedAt,
860
+ completedAt: state.status !== 'running' ? state.updatedAt : undefined,
861
+ iterations: state.iteration,
862
+ usage: state.usage,
863
+ });
864
+ }
865
+ // Pagination
866
+ const page = options.page || 1;
867
+ const limit = options.limit || 10;
868
+ const start = (page - 1) * limit;
869
+ const paginatedExecutions = executions.slice(start, start + limit);
870
+ return {
871
+ executions: paginatedExecutions,
872
+ total: executions.length,
873
+ page,
874
+ limit,
875
+ };
876
+ }
877
+ // ==================== TOOL MANAGEMENT ====================
878
+ /**
879
+ * Add a tool to an agent
880
+ *
881
+ * @example
882
+ * ```ts
883
+ * await ductape.agents.addTool('customer-support', {
884
+ * tag: 'new-tool',
885
+ * description: 'A new tool',
886
+ * parameters: { ... },
887
+ * handler: async (ctx, params) => { ... },
888
+ * });
889
+ * ```
890
+ */
891
+ addTool(agentTag, tool) {
892
+ const registry = this.toolRegistries.get(agentTag);
893
+ if (!registry) {
894
+ throw AgentError.notFoundError(`Agent '${agentTag}' not found`);
895
+ }
896
+ registry.register(tool);
897
+ // Update agent definition
898
+ const agent = this.localAgents.get(agentTag);
899
+ if (agent) {
900
+ agent.toolSchemas = registry.getSchemas();
901
+ }
902
+ }
903
+ /**
904
+ * Remove a tool from an agent
905
+ */
906
+ removeTool(agentTag, toolTag) {
907
+ const registry = this.toolRegistries.get(agentTag);
908
+ if (!registry) {
909
+ return false;
910
+ }
911
+ const removed = registry.unregister(toolTag);
912
+ // Update agent definition
913
+ if (removed) {
914
+ const agent = this.localAgents.get(agentTag);
915
+ if (agent) {
916
+ agent.toolSchemas = registry.getSchemas();
917
+ }
918
+ }
919
+ return removed;
920
+ }
921
+ /**
922
+ * Get tools for an agent
923
+ */
924
+ getTools(agentTag) {
925
+ const registry = this.toolRegistries.get(agentTag);
926
+ if (!registry) {
927
+ return [];
928
+ }
929
+ return registry.getSchemas();
930
+ }
931
+ // ==================== AGENT AS TOOL ====================
932
+ /**
933
+ * Convert an agent into a tool that can be used by another agent
934
+ *
935
+ * This enables multi-agent orchestration where a "manager" agent can
936
+ * delegate tasks to specialized agents.
937
+ *
938
+ * @example
939
+ * ```ts
940
+ * // Define specialized agents
941
+ * const researchAgent = await ductape.agents.define({
942
+ * tag: 'research-agent',
943
+ * name: 'Research Agent',
944
+ * // ...
945
+ * });
946
+ *
947
+ * const writerAgent = await ductape.agents.define({
948
+ * tag: 'writer-agent',
949
+ * name: 'Writer Agent',
950
+ * // ...
951
+ * });
952
+ *
953
+ * // Create a manager agent that can delegate to specialists
954
+ * const managerAgent = await ductape.agents.define({
955
+ * tag: 'manager-agent',
956
+ * name: 'Project Manager',
957
+ * tools: [
958
+ * ductape.agents.asTool({
959
+ * agentTag: 'research-agent',
960
+ * product: 'my-product',
961
+ * options: {
962
+ * toolDescription: 'Delegate research tasks to the research specialist',
963
+ * },
964
+ * }),
965
+ * ductape.agents.asTool({
966
+ * agentTag: 'writer-agent',
967
+ * product: 'my-product',
968
+ * options: {
969
+ * toolDescription: 'Delegate writing tasks to the writing specialist',
970
+ * },
971
+ * }),
972
+ * ],
973
+ * });
974
+ * ```
975
+ */
976
+ asTool(definition) {
977
+ const { agentTag, product, env, options = {} } = definition;
978
+ // Get the agent definition to extract metadata
979
+ const agent = this.localAgents.get(agentTag);
980
+ // Build input schema - either from options or use a generic input schema
981
+ const inputSchema = options.inputSchema || {
982
+ task: {
983
+ type: 'string',
984
+ description: 'The task or instruction to give to the agent',
985
+ required: true,
986
+ },
987
+ context: {
988
+ type: 'object',
989
+ description: 'Additional context or data to pass to the agent',
990
+ },
991
+ };
992
+ // Create the tool
993
+ const tool = {
994
+ tag: options.toolTag || `agent:${agentTag}`,
995
+ name: options.toolName || (agent === null || agent === void 0 ? void 0 : agent.name) || agentTag,
996
+ description: options.toolDescription ||
997
+ (agent === null || agent === void 0 ? void 0 : agent.description) ||
998
+ `Delegate task to the ${agentTag} agent`,
999
+ parameters: inputSchema,
1000
+ requiresConfirmation: options.requiresConfirmation,
1001
+ timeout: options.timeout,
1002
+ retries: options.retries,
1003
+ handler: async (ctx, params) => {
1004
+ var _a;
1005
+ // Transform input if transformer provided
1006
+ const input = options.inputTransform
1007
+ ? options.inputTransform(params)
1008
+ : params;
1009
+ // Build the input message for the sub-agent
1010
+ const inputMessage = typeof input === 'string'
1011
+ ? input
1012
+ : input.task ||
1013
+ JSON.stringify(input);
1014
+ // Run the sub-agent
1015
+ // When delegating to sub-agent, append agent tag to session for traceability
1016
+ const subAgentSession = ctx.session ? `${ctx.session}:${agentTag}` : undefined;
1017
+ const result = await this.run({
1018
+ product,
1019
+ env: env || ctx.env,
1020
+ tag: agentTag,
1021
+ input: typeof inputMessage === 'string' ? { message: inputMessage } : inputMessage,
1022
+ session: subAgentSession,
1023
+ });
1024
+ // Transform output if transformer provided
1025
+ if (options.outputTransform) {
1026
+ return options.outputTransform(result);
1027
+ }
1028
+ // Return full details or just output based on options
1029
+ if (options.includeDetails) {
1030
+ return {
1031
+ agent: agentTag,
1032
+ status: result.status,
1033
+ output: result.output,
1034
+ iterations: result.iterations,
1035
+ toolCalls: (_a = result.toolCalls) === null || _a === void 0 ? void 0 : _a.map((tc) => ({
1036
+ tool: tc.tool,
1037
+ success: tc.success,
1038
+ })),
1039
+ executionTime: result.executionTime,
1040
+ };
1041
+ }
1042
+ // Default: return just the output
1043
+ return result.output;
1044
+ },
1045
+ };
1046
+ return tool;
1047
+ }
1048
+ /**
1049
+ * Create an agent tool from a handlerRef string
1050
+ *
1051
+ * @example
1052
+ * ```ts
1053
+ * // In tool definition
1054
+ * {
1055
+ * tag: 'delegate-research',
1056
+ * handlerRef: 'agent:research-agent',
1057
+ * }
1058
+ * ```
1059
+ */
1060
+ createAgentToolFromRef(handlerRef, product, env) {
1061
+ // Parse handlerRef: "agent:agent-tag" or "agent:agent-tag:options"
1062
+ const parts = handlerRef.split(':');
1063
+ if (parts[0] !== 'agent') {
1064
+ throw AgentError.validationError(`Invalid agent handlerRef format: ${handlerRef}. Expected "agent:agent-tag"`);
1065
+ }
1066
+ const agentTag = parts[1];
1067
+ return async (ctx, params) => {
1068
+ const input = typeof params === 'string'
1069
+ ? params
1070
+ : params.task || JSON.stringify(params);
1071
+ // When delegating to sub-agent, append agent tag to session for traceability
1072
+ const subAgentSession = ctx.session ? `${ctx.session}:${agentTag}` : undefined;
1073
+ const result = await this.run({
1074
+ product,
1075
+ env,
1076
+ tag: agentTag,
1077
+ input: typeof input === 'string' ? { message: input } : input,
1078
+ session: subAgentSession,
1079
+ });
1080
+ return result.output;
1081
+ };
1082
+ }
1083
+ // ==================== UTILITIES ====================
1084
+ /**
1085
+ * Get a defined agent by tag
1086
+ */
1087
+ getAgent(tag) {
1088
+ return this.localAgents.get(tag);
1089
+ }
1090
+ /**
1091
+ * List all defined agents
1092
+ */
1093
+ listAgents() {
1094
+ return Array.from(this.localAgents.values());
1095
+ }
1096
+ /**
1097
+ * Delete an agent definition
1098
+ */
1099
+ deleteAgent(tag) {
1100
+ this.toolRegistries.delete(tag);
1101
+ return this.localAgents.delete(tag);
1102
+ }
1103
+ /**
1104
+ * Clear all agent definitions
1105
+ */
1106
+ clearAll() {
1107
+ this.localAgents.clear();
1108
+ this.toolRegistries.clear();
1109
+ this.activeExecutors.clear();
1110
+ }
1111
+ // ==================== PRIVATE HELPERS ====================
1112
+ /**
1113
+ * Convert a stored IProductAgent to IDefinedAgent format
1114
+ */
1115
+ convertProductAgentToDefinedAgent(storedAgent) {
1116
+ var _a;
1117
+ return {
1118
+ tag: storedAgent.tag,
1119
+ name: storedAgent.name,
1120
+ description: storedAgent.description,
1121
+ model: storedAgent.model, // Model tag reference - resolved at runtime
1122
+ modelConfig: storedAgent.modelConfig,
1123
+ systemPrompt: storedAgent.systemPrompt,
1124
+ toolSchemas: (storedAgent.tools || []).map((tool) => ({
1125
+ tag: tool.tag,
1126
+ name: tool.name,
1127
+ description: tool.description,
1128
+ parameters: tool.parameters,
1129
+ requiresConfirmation: tool.requiresConfirmation,
1130
+ costEstimate: tool.costEstimate,
1131
+ timeout: tool.timeout,
1132
+ retries: tool.retries,
1133
+ })),
1134
+ termination: storedAgent.termination ? {
1135
+ maxIterations: storedAgent.termination.maxIterations,
1136
+ maxTokens: storedAgent.termination.maxTokens,
1137
+ timeout: storedAgent.termination.timeout,
1138
+ allowManualStop: storedAgent.termination.allowManualStop,
1139
+ } : undefined,
1140
+ memory: storedAgent.memory ? {
1141
+ shortTerm: storedAgent.memory.shortTerm,
1142
+ longTerm: storedAgent.memory.longTerm,
1143
+ } : undefined,
1144
+ humanInLoop: storedAgent.humanInLoop ? {
1145
+ enabled: storedAgent.humanInLoop.enabled,
1146
+ alwaysRequireApproval: storedAgent.humanInLoop.alwaysRequireApproval,
1147
+ approvalTimeout: storedAgent.humanInLoop.approvalTimeout,
1148
+ approvalWebhook: storedAgent.humanInLoop.approvalWebhook,
1149
+ approvalBroker: storedAgent.humanInLoop.approvalBroker,
1150
+ } : undefined,
1151
+ streaming: storedAgent.streaming ? {
1152
+ enabled: storedAgent.streaming.enabled,
1153
+ events: storedAgent.streaming.events,
1154
+ webhook: storedAgent.streaming.webhook,
1155
+ broker: storedAgent.streaming.broker,
1156
+ } : undefined,
1157
+ inputSchema: storedAgent.inputSchema,
1158
+ envs: (_a = storedAgent.envs) === null || _a === void 0 ? void 0 : _a.map((env) => ({
1159
+ slug: env.slug,
1160
+ active: env.active,
1161
+ model: env.model, // Model tag override - resolved at runtime
1162
+ modelConfig: env.modelConfig,
1163
+ toolOverrides: env.toolOverrides,
1164
+ })),
1165
+ resilience: storedAgent.resilience,
1166
+ };
1167
+ }
1168
+ /**
1169
+ * Create a handler function from a handlerRef string
1170
+ * Format: "type:tag:event" (e.g., "action:payment-app:process-payment", "feature:checkout-flow")
1171
+ */
1172
+ createHandlerFromRef(handlerRef, product, env) {
1173
+ const parts = handlerRef.split(':');
1174
+ const type = parts[0];
1175
+ const tag = parts[1];
1176
+ const event = parts[2];
1177
+ return async (ctx, params) => {
1178
+ switch (type) {
1179
+ case 'action':
1180
+ return ctx.action.run({
1181
+ app: tag,
1182
+ event,
1183
+ input: params,
1184
+ });
1185
+ case 'feature':
1186
+ return ctx.feature.run({
1187
+ feature: tag,
1188
+ input: params,
1189
+ });
1190
+ case 'database':
1191
+ return ctx.database.execute({
1192
+ database: tag,
1193
+ event,
1194
+ input: params,
1195
+ });
1196
+ case 'graph':
1197
+ return ctx.graph.execute({
1198
+ graph: tag,
1199
+ action: event,
1200
+ input: params,
1201
+ });
1202
+ case 'storage':
1203
+ return ctx.storage.upload({
1204
+ storage: tag,
1205
+ event,
1206
+ input: params,
1207
+ });
1208
+ case 'notification':
1209
+ await ctx.notification.send({
1210
+ notification: tag,
1211
+ event,
1212
+ input: params,
1213
+ });
1214
+ return { success: true };
1215
+ case 'publish':
1216
+ await ctx.publish.send({
1217
+ broker: tag,
1218
+ event,
1219
+ input: { message: params },
1220
+ });
1221
+ return { success: true };
1222
+ case 'agent':
1223
+ // Delegate to another agent
1224
+ // Format: "agent:agent-tag"
1225
+ const input = typeof params === 'string'
1226
+ ? params
1227
+ : params.task || JSON.stringify(params);
1228
+ // When delegating to sub-agent, append agent tag to session for traceability
1229
+ const subAgentSession = ctx.session ? `${ctx.session}:${tag}` : undefined;
1230
+ const result = await this.run({
1231
+ product,
1232
+ env,
1233
+ tag,
1234
+ input: typeof input === 'string' ? { message: input } : input,
1235
+ session: subAgentSession,
1236
+ });
1237
+ return result.output;
1238
+ default:
1239
+ throw new Error(`Unknown handler type: ${type}`);
1240
+ }
1241
+ };
1242
+ }
1243
+ }
1244
+ exports.AgentsService = AgentsService;
1245
+ // Export singleton instance for convenience
1246
+ exports.agentsService = new AgentsService();
1247
+ // Default export
1248
+ exports.default = AgentsService;
1249
+ //# sourceMappingURL=agents.service.js.map