@ductape/sdk 0.0.4-v51 → 0.0.4-v52

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