n8n 2.28.3 → 2.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (889) hide show
  1. package/dist/abstract-server.js +1 -1
  2. package/dist/abstract-server.js.map +1 -1
  3. package/dist/active-executions.js +2 -2
  4. package/dist/active-executions.js.map +1 -1
  5. package/dist/active-workflow-manager.js +1 -1
  6. package/dist/active-workflow-manager.js.map +1 -1
  7. package/dist/auth/auth.service.js +12 -12
  8. package/dist/auth/auth.service.js.map +1 -1
  9. package/dist/blob-storage/azure-byte-store.ee.d.ts +10 -0
  10. package/dist/blob-storage/azure-byte-store.ee.js +57 -0
  11. package/dist/blob-storage/azure-byte-store.ee.js.map +1 -0
  12. package/dist/blob-storage/fs-byte-store.d.ts +14 -0
  13. package/dist/blob-storage/fs-byte-store.js +97 -0
  14. package/dist/blob-storage/fs-byte-store.js.map +1 -0
  15. package/dist/blob-storage/json-store.d.ts +18 -0
  16. package/dist/blob-storage/json-store.js +125 -0
  17. package/dist/blob-storage/json-store.js.map +1 -0
  18. package/dist/blob-storage/s3-byte-store.ee.d.ts +10 -0
  19. package/dist/blob-storage/s3-byte-store.ee.js +52 -0
  20. package/dist/blob-storage/s3-byte-store.ee.js.map +1 -0
  21. package/dist/blob-storage/skipped-entry-deletion.error.d.ts +5 -0
  22. package/dist/blob-storage/skipped-entry-deletion.error.js +13 -0
  23. package/dist/blob-storage/skipped-entry-deletion.error.js.map +1 -0
  24. package/dist/blob-storage/types.d.ts +23 -0
  25. package/dist/blob-storage/types.js +3 -0
  26. package/dist/blob-storage/types.js.map +1 -0
  27. package/dist/build.tsbuildinfo +1 -1
  28. package/dist/chat/chat-server.js +1 -1
  29. package/dist/chat/chat-server.js.map +1 -1
  30. package/dist/chat/chat-service.js +1 -1
  31. package/dist/chat/chat-service.js.map +1 -1
  32. package/dist/chat/chat-service.types.d.ts +2 -2
  33. package/dist/collaboration/collaboration.service.d.ts +2 -2
  34. package/dist/collaboration/collaboration.service.js +2 -2
  35. package/dist/collaboration/collaboration.service.js.map +1 -1
  36. package/dist/commands/base-command.d.ts +1 -1
  37. package/dist/commands/base-command.js +27 -3
  38. package/dist/commands/base-command.js.map +1 -1
  39. package/dist/commands/export/entities.js +3 -3
  40. package/dist/commands/export/entities.js.map +1 -1
  41. package/dist/commands/export/workflow.js.map +1 -1
  42. package/dist/commands/import/entities.js +3 -3
  43. package/dist/commands/import/entities.js.map +1 -1
  44. package/dist/commands/import/workflow.js +1 -1
  45. package/dist/commands/import/workflow.js.map +1 -1
  46. package/dist/commands/start.js +5 -5
  47. package/dist/commands/start.js.map +1 -1
  48. package/dist/controller.registry.d.ts +1 -1
  49. package/dist/controller.registry.js +8 -8
  50. package/dist/controller.registry.js.map +1 -1
  51. package/dist/controllers/ai.controller.d.ts +1 -0
  52. package/dist/controllers/ai.controller.js +20 -11
  53. package/dist/controllers/ai.controller.js.map +1 -1
  54. package/dist/controllers/e2e.controller.js +1 -0
  55. package/dist/controllers/e2e.controller.js.map +1 -1
  56. package/dist/controllers/folder.controller.d.ts +1 -1
  57. package/dist/controllers/folder.controller.js +1 -1
  58. package/dist/controllers/folder.controller.js.map +1 -1
  59. package/dist/controllers/invitation.controller.d.ts +1 -1
  60. package/dist/controllers/invitation.controller.js +5 -5
  61. package/dist/controllers/invitation.controller.js.map +1 -1
  62. package/dist/controllers/oauth/oauth1-credential.controller.d.ts +1 -1
  63. package/dist/controllers/oauth/oauth1-credential.controller.js +1 -1
  64. package/dist/controllers/oauth/oauth1-credential.controller.js.map +1 -1
  65. package/dist/controllers/oauth/oauth2-credential.controller.js +1 -1
  66. package/dist/controllers/oauth/oauth2-credential.controller.js.map +1 -1
  67. package/dist/controllers/orchestration.controller.js.map +1 -1
  68. package/dist/controllers/owner.controller.d.ts +1 -1
  69. package/dist/controllers/owner.controller.js +1 -1
  70. package/dist/controllers/owner.controller.js.map +1 -1
  71. package/dist/controllers/password-reset.controller.d.ts +1 -1
  72. package/dist/controllers/password-reset.controller.js +3 -3
  73. package/dist/controllers/password-reset.controller.js.map +1 -1
  74. package/dist/controllers/posthog.controller.d.ts +2 -5
  75. package/dist/controllers/posthog.controller.js.map +1 -1
  76. package/dist/controllers/role.controller.d.ts +2 -1
  77. package/dist/controllers/role.controller.js +12 -0
  78. package/dist/controllers/role.controller.js.map +1 -1
  79. package/dist/controllers/security-settings.controller.d.ts +1 -1
  80. package/dist/controllers/third-party-licenses.controller.js +1 -1
  81. package/dist/controllers/third-party-licenses.controller.js.map +1 -1
  82. package/dist/controllers/translation.controller.js +1 -1
  83. package/dist/controllers/translation.controller.js.map +1 -1
  84. package/dist/controllers/users.controller.d.ts +8 -6
  85. package/dist/controllers/users.controller.js +59 -9
  86. package/dist/controllers/users.controller.js.map +1 -1
  87. package/dist/credentials/credentials.service.ee.js +7 -0
  88. package/dist/credentials/credentials.service.ee.js.map +1 -1
  89. package/dist/credentials/credentials.service.js +1 -1
  90. package/dist/credentials/credentials.service.js.map +1 -1
  91. package/dist/credentials/validation.js +1 -1
  92. package/dist/credentials/validation.js.map +1 -1
  93. package/dist/credentials-helper.d.ts +3 -1
  94. package/dist/credentials-helper.js +33 -5
  95. package/dist/credentials-helper.js.map +1 -1
  96. package/dist/credentials-overwrites.js.map +1 -1
  97. package/dist/evaluation.ee/evaluation-config.service.js +1 -1
  98. package/dist/evaluation.ee/evaluation-config.service.js.map +1 -1
  99. package/dist/evaluation.ee/test-runner/test-runner.service.ee.d.ts +3 -3
  100. package/dist/evaluation.ee/test-runner/test-runner.service.ee.js +11 -5
  101. package/dist/evaluation.ee/test-runner/test-runner.service.ee.js.map +1 -1
  102. package/dist/evaluation.ee/test-runs.controller.ee.js.map +1 -1
  103. package/dist/events/relays/workflow-failure-notification.event-relay.js +1 -1
  104. package/dist/events/relays/workflow-failure-notification.event-relay.js.map +1 -1
  105. package/dist/execution-lifecycle/shared/shared-hook-functions.js +1 -0
  106. package/dist/execution-lifecycle/shared/shared-hook-functions.js.map +1 -1
  107. package/dist/executions/execution-data/azure-store.ee.js +2 -2
  108. package/dist/executions/execution-data/azure-store.ee.js.map +1 -1
  109. package/dist/executions/execution-data/types.d.ts +1 -1
  110. package/dist/executions/execution-persistence.js +11 -4
  111. package/dist/executions/execution-persistence.js.map +1 -1
  112. package/dist/executions/execution.service.js +5 -4
  113. package/dist/executions/execution.service.js.map +1 -1
  114. package/dist/executions/executions.controller.d.ts +2 -2
  115. package/dist/executions/executions.controller.js +4 -4
  116. package/dist/executions/executions.controller.js.map +1 -1
  117. package/dist/instance-settings-loader/loaders/log-streaming.instance-settings-loader.js +1 -1
  118. package/dist/instance-settings-loader/loaders/log-streaming.instance-settings-loader.js.map +1 -1
  119. package/dist/instance-settings-loader/loaders/owner.instance-settings-loader.js +1 -1
  120. package/dist/instance-settings-loader/loaders/owner.instance-settings-loader.js.map +1 -1
  121. package/dist/license/license.controller.js +1 -0
  122. package/dist/license/license.controller.js.map +1 -1
  123. package/dist/license/license.service.js +3 -4
  124. package/dist/license/license.service.js.map +1 -1
  125. package/dist/metrics/prometheus/db-pool-metrics.service.d.ts +13 -0
  126. package/dist/metrics/prometheus/db-pool-metrics.service.js +71 -0
  127. package/dist/metrics/prometheus/db-pool-metrics.service.js.map +1 -0
  128. package/dist/metrics/prometheus/prometheus.service.d.ts +2 -1
  129. package/dist/metrics/prometheus/prometheus.service.js +5 -2
  130. package/dist/metrics/prometheus/prometheus.service.js.map +1 -1
  131. package/dist/mfa/mfa.service.d.ts +1 -1
  132. package/dist/mfa/mfa.service.js +1 -1
  133. package/dist/mfa/mfa.service.js.map +1 -1
  134. package/dist/mfa/totp.service.js +41 -11
  135. package/dist/mfa/totp.service.js.map +1 -1
  136. package/dist/modules/agents/agent-builder.controller.d.ts +28 -0
  137. package/dist/modules/agents/agent-builder.controller.js +168 -0
  138. package/dist/modules/agents/agent-builder.controller.js.map +1 -0
  139. package/dist/modules/agents/agent-chat.controller.d.ts +41 -0
  140. package/dist/modules/agents/agent-chat.controller.js +206 -0
  141. package/dist/modules/agents/agent-chat.controller.js.map +1 -0
  142. package/dist/modules/agents/agent-config.service.d.ts +33 -0
  143. package/dist/modules/agents/agent-config.service.js +288 -0
  144. package/dist/modules/agents/agent-config.service.js.map +1 -0
  145. package/dist/modules/agents/agent-custom-tools.service.d.ts +22 -0
  146. package/dist/modules/agents/agent-custom-tools.service.js +98 -0
  147. package/dist/modules/agents/agent-custom-tools.service.js.map +1 -0
  148. package/dist/modules/agents/agent-execution-orchestrator.service.d.ts +110 -0
  149. package/dist/modules/agents/agent-execution-orchestrator.service.js +482 -0
  150. package/dist/modules/agents/agent-execution-orchestrator.service.js.map +1 -0
  151. package/dist/modules/agents/agent-execution.service.d.ts +4 -4
  152. package/dist/modules/agents/agent-execution.service.js +6 -5
  153. package/dist/modules/agents/agent-execution.service.js.map +1 -1
  154. package/dist/modules/agents/agent-integration-persistence.service.d.ts +19 -0
  155. package/dist/modules/agents/agent-integration-persistence.service.js +90 -0
  156. package/dist/modules/agents/agent-integration-persistence.service.js.map +1 -0
  157. package/dist/modules/agents/agent-integrations.controller.d.ts +60 -0
  158. package/dist/modules/agents/agent-integrations.controller.js +275 -0
  159. package/dist/modules/agents/agent-integrations.controller.js.map +1 -0
  160. package/dist/modules/agents/agent-knowledge-sandbox.service.d.ts +1 -1
  161. package/dist/modules/agents/agent-knowledge-sandbox.service.js +3 -3
  162. package/dist/modules/agents/agent-knowledge-sandbox.service.js.map +1 -1
  163. package/dist/modules/agents/agent-knowledge.controller.d.ts +26 -0
  164. package/dist/modules/agents/agent-knowledge.controller.js +112 -0
  165. package/dist/modules/agents/agent-knowledge.controller.js.map +1 -0
  166. package/dist/modules/agents/agent-publish.controller.d.ts +38 -0
  167. package/dist/modules/agents/agent-publish.controller.js +94 -0
  168. package/dist/modules/agents/agent-publish.controller.js.map +1 -0
  169. package/dist/modules/agents/agent-publish.service.d.ts +30 -0
  170. package/dist/modules/agents/agent-publish.service.js +293 -0
  171. package/dist/modules/agents/agent-publish.service.js.map +1 -0
  172. package/dist/modules/agents/agent-runnable-state.service.d.ts +15 -0
  173. package/dist/modules/agents/agent-runnable-state.service.js +43 -0
  174. package/dist/modules/agents/agent-runnable-state.service.js.map +1 -0
  175. package/dist/modules/agents/agent-runtime-cache.service.d.ts +44 -0
  176. package/dist/modules/agents/agent-runtime-cache.service.js +169 -0
  177. package/dist/modules/agents/agent-runtime-cache.service.js.map +1 -0
  178. package/dist/modules/agents/agent-runtime-reconstruction.service.d.ts +5 -9
  179. package/dist/modules/agents/agent-runtime-reconstruction.service.js +68 -41
  180. package/dist/modules/agents/agent-runtime-reconstruction.service.js.map +1 -1
  181. package/dist/modules/agents/agent-sandbox.controller.d.ts +3 -3
  182. package/dist/modules/agents/agent-sandbox.controller.js +9 -8
  183. package/dist/modules/agents/agent-sandbox.controller.js.map +1 -1
  184. package/dist/modules/agents/agent-skills.service.d.ts +3 -4
  185. package/dist/modules/agents/agent-skills.service.js +54 -28
  186. package/dist/modules/agents/agent-skills.service.js.map +1 -1
  187. package/dist/modules/agents/agent-task.service.d.ts +5 -5
  188. package/dist/modules/agents/agent-task.service.js +46 -46
  189. package/dist/modules/agents/agent-task.service.js.map +1 -1
  190. package/dist/modules/agents/agent-tasks.controller.d.ts +30 -0
  191. package/dist/modules/agents/agent-tasks.controller.js +106 -0
  192. package/dist/modules/agents/agent-tasks.controller.js.map +1 -0
  193. package/dist/modules/agents/agent-telemetry.js +0 -4
  194. package/dist/modules/agents/agent-telemetry.js.map +1 -1
  195. package/dist/modules/agents/agent-test-chat.service.d.ts +9 -0
  196. package/dist/modules/agents/agent-test-chat.service.js +49 -0
  197. package/dist/modules/agents/agent-test-chat.service.js.map +1 -0
  198. package/dist/modules/agents/agent-threads.controller.d.ts +28 -0
  199. package/dist/modules/agents/agent-threads.controller.js +66 -0
  200. package/dist/modules/agents/agent-threads.controller.js.map +1 -0
  201. package/dist/modules/agents/agent-validation.service.d.ts +13 -0
  202. package/dist/modules/agents/agent-validation.service.js +142 -0
  203. package/dist/modules/agents/agent-validation.service.js.map +1 -0
  204. package/dist/modules/agents/agents-catalog.controller.d.ts +8 -0
  205. package/dist/modules/agents/agents-catalog.controller.js +80 -0
  206. package/dist/modules/agents/agents-catalog.controller.js.map +1 -0
  207. package/dist/modules/agents/agents-config.controller.d.ts +181 -0
  208. package/dist/modules/agents/agents-config.controller.js +71 -0
  209. package/dist/modules/agents/agents-config.controller.js.map +1 -0
  210. package/dist/modules/agents/agents-skills.controller.d.ts +33 -0
  211. package/dist/modules/agents/agents-skills.controller.js +94 -0
  212. package/dist/modules/agents/agents-skills.controller.js.map +1 -0
  213. package/dist/modules/agents/agents-tools.service.d.ts +1 -7
  214. package/dist/modules/agents/agents-tools.service.js +3 -80
  215. package/dist/modules/agents/agents-tools.service.js.map +1 -1
  216. package/dist/modules/agents/agents.controller.d.ts +7 -393
  217. package/dist/modules/agents/agents.controller.js +6 -990
  218. package/dist/modules/agents/agents.controller.js.map +1 -1
  219. package/dist/modules/agents/agents.module.d.ts +2 -2
  220. package/dist/modules/agents/agents.module.js +12 -0
  221. package/dist/modules/agents/agents.module.js.map +1 -1
  222. package/dist/modules/agents/agents.service.d.ts +8 -166
  223. package/dist/modules/agents/agents.service.js +10 -1287
  224. package/dist/modules/agents/agents.service.js.map +1 -1
  225. package/dist/modules/agents/builder/agents-builder-prompts.d.ts +2 -2
  226. package/dist/modules/agents/builder/agents-builder-prompts.js +3 -5
  227. package/dist/modules/agents/builder/agents-builder-prompts.js.map +1 -1
  228. package/dist/modules/agents/builder/agents-builder-tools.service.d.ts +11 -1
  229. package/dist/modules/agents/builder/agents-builder-tools.service.js +60 -25
  230. package/dist/modules/agents/builder/agents-builder-tools.service.js.map +1 -1
  231. package/dist/modules/agents/builder/interactive/ask-credential.tool.d.ts +4 -0
  232. package/dist/modules/agents/builder/interactive/ask-credential.tool.js +36 -12
  233. package/dist/modules/agents/builder/interactive/ask-credential.tool.js.map +1 -1
  234. package/dist/modules/agents/builder/interactive/ask-llm.tool.js +1 -3
  235. package/dist/modules/agents/builder/interactive/ask-llm.tool.js.map +1 -1
  236. package/dist/modules/agents/builder/interactive/ask-question.tool.js.map +1 -1
  237. package/dist/modules/agents/builder/interactive/index.d.ts +1 -1
  238. package/dist/modules/agents/builder/interactive/index.js +2 -1
  239. package/dist/modules/agents/builder/interactive/index.js.map +1 -1
  240. package/dist/modules/agents/builder/interactive/llm-provider-defaults.js +1 -1
  241. package/dist/modules/agents/builder/interactive/llm-provider-defaults.js.map +1 -1
  242. package/dist/modules/agents/builder/interactive/resolve-llm.tool.js +3 -2
  243. package/dist/modules/agents/builder/interactive/resolve-llm.tool.js.map +1 -1
  244. package/dist/modules/agents/builder/prompts/config-mutation.prompt.js +3 -5
  245. package/dist/modules/agents/builder/prompts/config-mutation.prompt.js.map +1 -1
  246. package/dist/modules/agents/builder/prompts/config-rules.prompt.js +4 -6
  247. package/dist/modules/agents/builder/prompts/config-rules.prompt.js.map +1 -1
  248. package/dist/modules/agents/builder/prompts/llm-selection.prompt.js +1 -1
  249. package/dist/modules/agents/builder/prompts/memory.prompt.d.ts +1 -1
  250. package/dist/modules/agents/builder/prompts/memory.prompt.js +4 -4
  251. package/dist/modules/agents/builder/prompts/tools.prompt.d.ts +1 -1
  252. package/dist/modules/agents/builder/prompts/tools.prompt.js +8 -3
  253. package/dist/modules/agents/builder/prompts/tools.prompt.js.map +1 -1
  254. package/dist/modules/agents/builder/skills/integrations.skill.js +8 -0
  255. package/dist/modules/agents/builder/skills/integrations.skill.js.map +1 -1
  256. package/dist/modules/agents/builder/skills/mcp.skill.js +16 -0
  257. package/dist/modules/agents/builder/skills/mcp.skill.js.map +1 -1
  258. package/dist/modules/agents/builder/skills/resource-locators.skill.js +18 -0
  259. package/dist/modules/agents/builder/skills/resource-locators.skill.js.map +1 -1
  260. package/dist/modules/agents/builder/skills/sub-agents.skill.js +34 -8
  261. package/dist/modules/agents/builder/skills/sub-agents.skill.js.map +1 -1
  262. package/dist/modules/agents/builder/skills/target-skills.skill.js +22 -3
  263. package/dist/modules/agents/builder/skills/target-skills.skill.js.map +1 -1
  264. package/dist/modules/agents/builder/skills/target-tasks.skill.js +12 -0
  265. package/dist/modules/agents/builder/skills/target-tasks.skill.js.map +1 -1
  266. package/dist/modules/agents/entities/agent-memory-entry.entity.d.ts +1 -1
  267. package/dist/modules/agents/entities/agent-memory-entry.entity.js.map +1 -1
  268. package/dist/modules/agents/entities/agent.entity.d.ts +1 -2
  269. package/dist/modules/agents/entities/agent.entity.js +0 -4
  270. package/dist/modules/agents/entities/agent.entity.js.map +1 -1
  271. package/dist/modules/agents/integrations/agent-chat-bridge.d.ts +7 -23
  272. package/dist/modules/agents/integrations/agent-chat-bridge.js +60 -646
  273. package/dist/modules/agents/integrations/agent-chat-bridge.js.map +1 -1
  274. package/dist/modules/agents/integrations/agent-chat-hitl-resume-handler.d.ts +44 -0
  275. package/dist/modules/agents/integrations/agent-chat-hitl-resume-handler.js +110 -0
  276. package/dist/modules/agents/integrations/agent-chat-hitl-resume-handler.js.map +1 -0
  277. package/dist/modules/agents/integrations/agent-chat-integration.d.ts +38 -4
  278. package/dist/modules/agents/integrations/agent-chat-integration.js +10 -3
  279. package/dist/modules/agents/integrations/agent-chat-integration.js.map +1 -1
  280. package/dist/modules/agents/integrations/agent-chat-message-context.d.ts +22 -0
  281. package/dist/modules/agents/integrations/agent-chat-message-context.js +104 -0
  282. package/dist/modules/agents/integrations/agent-chat-message-context.js.map +1 -0
  283. package/dist/modules/agents/integrations/agent-chat-stream-consumer.d.ts +29 -0
  284. package/dist/modules/agents/integrations/agent-chat-stream-consumer.js +205 -0
  285. package/dist/modules/agents/integrations/agent-chat-stream-consumer.js.map +1 -0
  286. package/dist/modules/agents/integrations/agent-chat-suspension-cards.d.ts +10 -0
  287. package/dist/modules/agents/integrations/agent-chat-suspension-cards.js +90 -0
  288. package/dist/modules/agents/integrations/agent-chat-suspension-cards.js.map +1 -0
  289. package/dist/modules/agents/integrations/chat-integration.service.js +6 -3
  290. package/dist/modules/agents/integrations/chat-integration.service.js.map +1 -1
  291. package/dist/modules/agents/integrations/integration-message-context.service.d.ts +1 -1
  292. package/dist/modules/agents/integrations/integration-message-context.service.js.map +1 -1
  293. package/dist/modules/agents/integrations/integration-tool-definitions.d.ts +6037 -0
  294. package/dist/modules/agents/integrations/integration-tool-definitions.js +231 -0
  295. package/dist/modules/agents/integrations/integration-tool-definitions.js.map +1 -0
  296. package/dist/modules/agents/integrations/integration-tool-descriptions.d.ts +3 -0
  297. package/dist/modules/agents/integrations/integration-tool-descriptions.js +100 -0
  298. package/dist/modules/agents/integrations/integration-tool-descriptions.js.map +1 -0
  299. package/dist/modules/agents/integrations/integration-tool-execution.d.ts +27 -0
  300. package/dist/modules/agents/integrations/integration-tool-execution.js +278 -0
  301. package/dist/modules/agents/integrations/integration-tool-execution.js.map +1 -0
  302. package/dist/modules/agents/integrations/integration-tool-factory.d.ts +121 -0
  303. package/dist/modules/agents/integrations/integration-tool-factory.js +133 -0
  304. package/dist/modules/agents/integrations/integration-tool-factory.js.map +1 -0
  305. package/dist/modules/agents/integrations/integration-tool-schema.d.ts +107 -0
  306. package/dist/modules/agents/integrations/integration-tool-schema.js +140 -0
  307. package/dist/modules/agents/integrations/integration-tool-schema.js.map +1 -0
  308. package/dist/modules/agents/integrations/integration-tool-types.d.ts +105 -0
  309. package/dist/modules/agents/integrations/integration-tool-types.js +3 -0
  310. package/dist/modules/agents/integrations/integration-tool-types.js.map +1 -0
  311. package/dist/modules/agents/integrations/integration-tools.d.ts +3 -213
  312. package/dist/modules/agents/integrations/integration-tools.js +16 -998
  313. package/dist/modules/agents/integrations/integration-tools.js.map +1 -1
  314. package/dist/modules/agents/integrations/integrations-sync.d.ts +1 -1
  315. package/dist/modules/agents/integrations/n8n-memory.d.ts +1 -1
  316. package/dist/modules/agents/integrations/n8n-memory.js +2 -2
  317. package/dist/modules/agents/integrations/n8n-memory.js.map +1 -1
  318. package/dist/modules/agents/integrations/platforms/linear-integration.d.ts +3 -3
  319. package/dist/modules/agents/integrations/platforms/linear-integration.js +14 -19
  320. package/dist/modules/agents/integrations/platforms/linear-integration.js.map +1 -1
  321. package/dist/modules/agents/integrations/platforms/linear-tool-definitions.d.ts +473 -0
  322. package/dist/modules/agents/integrations/platforms/linear-tool-definitions.js +270 -0
  323. package/dist/modules/agents/integrations/platforms/linear-tool-definitions.js.map +1 -0
  324. package/dist/modules/agents/integrations/platforms/n8n-chat-integration.d.ts +4 -3
  325. package/dist/modules/agents/integrations/platforms/n8n-chat-integration.js +6 -2
  326. package/dist/modules/agents/integrations/platforms/n8n-chat-integration.js.map +1 -1
  327. package/dist/modules/agents/integrations/platforms/slack-bridge-behavior.d.ts +12 -0
  328. package/dist/modules/agents/integrations/platforms/slack-bridge-behavior.js +198 -0
  329. package/dist/modules/agents/integrations/platforms/slack-bridge-behavior.js.map +1 -0
  330. package/dist/modules/agents/integrations/platforms/slack-integration.d.ts +14 -4
  331. package/dist/modules/agents/integrations/platforms/slack-integration.js +20 -7
  332. package/dist/modules/agents/integrations/platforms/slack-integration.js.map +1 -1
  333. package/dist/modules/agents/integrations/platforms/slack-operations.js +1 -1
  334. package/dist/modules/agents/integrations/platforms/slack-operations.js.map +1 -1
  335. package/dist/modules/agents/integrations/platforms/slack-tool-definitions.d.ts +35 -0
  336. package/dist/modules/agents/integrations/platforms/slack-tool-definitions.js +33 -0
  337. package/dist/modules/agents/integrations/platforms/slack-tool-definitions.js.map +1 -0
  338. package/dist/modules/agents/integrations/platforms/telegram-integration.d.ts +1 -2
  339. package/dist/modules/agents/integrations/platforms/telegram-integration.js +2 -1
  340. package/dist/modules/agents/integrations/platforms/telegram-integration.js.map +1 -1
  341. package/dist/modules/agents/integrations/slack-app-setup.service.d.ts +5 -3
  342. package/dist/modules/agents/integrations/slack-app-setup.service.js +11 -6
  343. package/dist/modules/agents/integrations/slack-app-setup.service.js.map +1 -1
  344. package/dist/modules/agents/json-config/from-json-config.d.ts +7 -0
  345. package/dist/modules/agents/json-config/from-json-config.js +60 -15
  346. package/dist/modules/agents/json-config/from-json-config.js.map +1 -1
  347. package/dist/modules/agents/json-config/sanitize-unknown-agent-credentials.js +17 -6
  348. package/dist/modules/agents/json-config/sanitize-unknown-agent-credentials.js.map +1 -1
  349. package/dist/modules/agents/repositories/agent-execution-thread.repository.d.ts +1 -1
  350. package/dist/modules/agents/repositories/agent-execution-thread.repository.js +2 -5
  351. package/dist/modules/agents/repositories/agent-execution-thread.repository.js.map +1 -1
  352. package/dist/modules/agents/repositories/agent-history.repository.d.ts +1 -1
  353. package/dist/modules/agents/repositories/agent-history.repository.js.map +1 -1
  354. package/dist/modules/agents/sub-agents/delegate-sub-agent-tool.d.ts +1 -1
  355. package/dist/modules/agents/sub-agents/sub-agent-source-resolver.d.ts +1 -1
  356. package/dist/modules/agents/sub-agents/sub-agent-source-resolver.js.map +1 -1
  357. package/dist/modules/agents/tools/agent-data-utils.d.ts +22 -0
  358. package/dist/modules/agents/tools/agent-data-utils.js +64 -0
  359. package/dist/modules/agents/tools/agent-data-utils.js.map +1 -0
  360. package/dist/modules/agents/tools/input-data-tool.d.ts +3 -0
  361. package/dist/modules/agents/tools/input-data-tool.js +40 -0
  362. package/dist/modules/agents/tools/input-data-tool.js.map +1 -0
  363. package/dist/modules/agents/tools/node-tool-factory.d.ts +1 -1
  364. package/dist/modules/agents/tools/node-tool-factory.js +1 -1
  365. package/dist/modules/agents/tools/node-tool-factory.js.map +1 -1
  366. package/dist/modules/agents/tools/workflow-context-tool.d.ts +3 -0
  367. package/dist/modules/agents/tools/workflow-context-tool.js +84 -0
  368. package/dist/modules/agents/tools/workflow-context-tool.js.map +1 -0
  369. package/dist/modules/agents/utils/agent-credential-provider.d.ts +4 -0
  370. package/dist/modules/agents/utils/agent-credential-provider.js +8 -0
  371. package/dist/modules/agents/utils/agent-credential-provider.js.map +1 -0
  372. package/dist/modules/agents/utils/agent-missing-skill-ids.d.ts +2 -0
  373. package/dist/modules/agents/utils/agent-missing-skill-ids.js +17 -0
  374. package/dist/modules/agents/utils/agent-missing-skill-ids.js.map +1 -0
  375. package/dist/modules/agents/utils/agent-published-snapshot.d.ts +2 -0
  376. package/dist/modules/agents/utils/agent-published-snapshot.js +17 -0
  377. package/dist/modules/agents/utils/agent-published-snapshot.js.map +1 -0
  378. package/dist/modules/agents/utils/agent-resource-id.d.ts +1 -1
  379. package/dist/modules/agents/utils/sub-agent-resolver.d.ts +14 -0
  380. package/dist/modules/agents/utils/sub-agent-resolver.js +23 -0
  381. package/dist/modules/agents/utils/sub-agent-resolver.js.map +1 -0
  382. package/dist/modules/breaking-changes/rules/v2/file-access.rule.js.map +1 -1
  383. package/dist/modules/breaking-changes/rules/v2/oauth-callback-auth.rule.js.map +1 -1
  384. package/dist/modules/breaking-changes/rules/v2/process-env-access.rule.js.map +1 -1
  385. package/dist/modules/breaking-changes/rules/v2/pyodide-removed.rule.js.map +1 -1
  386. package/dist/modules/breaking-changes/rules/v2/queue-worker-max-stalled-count.rule.js.map +1 -1
  387. package/dist/modules/breaking-changes/rules/v2/removed-nodes.rule.js.map +1 -1
  388. package/dist/modules/breaking-changes/rules/v2/settings-file-permissions.rule.js.map +1 -1
  389. package/dist/modules/breaking-changes/rules/v2/start-node-removed.rule.js.map +1 -1
  390. package/dist/modules/breaking-changes/rules/v2/task-runner-docker-image.rule.js.map +1 -1
  391. package/dist/modules/breaking-changes/rules/v2/tunnel-option.rule.js.map +1 -1
  392. package/dist/modules/breaking-changes/rules/v2/wait-node-subworkflow.rule.js +1 -1
  393. package/dist/modules/breaking-changes/rules/v2/wait-node-subworkflow.rule.js.map +1 -1
  394. package/dist/modules/breaking-changes/rules/v2/workflow-hooks-deprecated.rule.js.map +1 -1
  395. package/dist/modules/chat-hub/chat-hub-agent.service.d.ts +5 -5
  396. package/dist/modules/chat-hub/chat-hub-agent.service.js +9 -9
  397. package/dist/modules/chat-hub/chat-hub-agent.service.js.map +1 -1
  398. package/dist/modules/chat-hub/chat-hub-message.entity.d.ts +2 -2
  399. package/dist/modules/chat-hub/chat-hub-message.entity.js.map +1 -1
  400. package/dist/modules/chat-hub/chat-hub-session.entity.d.ts +1 -1
  401. package/dist/modules/chat-hub/chat-hub.controller.d.ts +5 -2
  402. package/dist/modules/chat-hub/chat-hub.controller.js +23 -5
  403. package/dist/modules/chat-hub/chat-hub.controller.js.map +1 -1
  404. package/dist/modules/chat-hub/chat-hub.module.d.ts +1 -1
  405. package/dist/modules/chat-hub/chat-hub.service.js +1 -1
  406. package/dist/modules/chat-hub/chat-hub.service.js.map +1 -1
  407. package/dist/modules/chat-hub/chat-hub.settings.controller.d.ts +8 -4
  408. package/dist/modules/chat-hub/chat-hub.settings.controller.js +28 -18
  409. package/dist/modules/chat-hub/chat-hub.settings.controller.js.map +1 -1
  410. package/dist/modules/chat-hub/chat-hub.settings.service.js +3 -3
  411. package/dist/modules/chat-hub/chat-hub.settings.service.js.map +1 -1
  412. package/dist/modules/chat-hub/chat-hub.types.d.ts +1 -1
  413. package/dist/modules/chat-hub/chat-session.repository.js +1 -1
  414. package/dist/modules/chat-hub/chat-session.repository.js.map +1 -1
  415. package/dist/modules/community-packages/community-node-types.service.js +2 -2
  416. package/dist/modules/community-packages/community-node-types.service.js.map +1 -1
  417. package/dist/modules/community-packages/community-packages.config.d.ts +2 -0
  418. package/dist/modules/community-packages/community-packages.config.js +10 -0
  419. package/dist/modules/community-packages/community-packages.config.js.map +1 -1
  420. package/dist/modules/community-packages/community-packages.lifecycle.service.d.ts +3 -3
  421. package/dist/modules/community-packages/community-packages.lifecycle.service.js +3 -3
  422. package/dist/modules/community-packages/community-packages.lifecycle.service.js.map +1 -1
  423. package/dist/modules/community-packages/community-packages.service.js +3 -3
  424. package/dist/modules/community-packages/community-packages.service.js.map +1 -1
  425. package/dist/modules/community-packages/npm-utils.js +1 -1
  426. package/dist/modules/community-packages/npm-utils.js.map +1 -1
  427. package/dist/modules/data-table/data-table-aggregate.service.js +1 -1
  428. package/dist/modules/data-table/data-table-aggregate.service.js.map +1 -1
  429. package/dist/modules/data-table/data-table-file-cleanup.service.js +1 -1
  430. package/dist/modules/data-table/data-table-file-cleanup.service.js.map +1 -1
  431. package/dist/modules/data-table/data-table-proxy.service.d.ts +2 -2
  432. package/dist/modules/data-table/data-table-proxy.service.js +3 -3
  433. package/dist/modules/data-table/data-table-proxy.service.js.map +1 -1
  434. package/dist/modules/data-table/data-table.controller.d.ts +2 -2
  435. package/dist/modules/data-table/data-table.controller.js +3 -3
  436. package/dist/modules/data-table/data-table.controller.js.map +1 -1
  437. package/dist/modules/data-table/utils/sql-utils.js.map +1 -1
  438. package/dist/modules/dynamic-credentials.ee/context-establishment-hooks/slack-signature-extractor.js +1 -1
  439. package/dist/modules/dynamic-credentials.ee/context-establishment-hooks/slack-signature-extractor.js.map +1 -1
  440. package/dist/modules/dynamic-credentials.ee/credential-resolvers/identifiers/oauth2-introspection-identifier.js +0 -1
  441. package/dist/modules/dynamic-credentials.ee/credential-resolvers/identifiers/oauth2-introspection-identifier.js.map +1 -1
  442. package/dist/modules/dynamic-credentials.ee/credential-resolvers/identifiers/oauth2-metadata-http-client.d.ts +0 -1
  443. package/dist/modules/dynamic-credentials.ee/credential-resolvers/identifiers/oauth2-metadata-http-client.js +3 -3
  444. package/dist/modules/dynamic-credentials.ee/credential-resolvers/identifiers/oauth2-metadata-http-client.js.map +1 -1
  445. package/dist/modules/dynamic-credentials.ee/credential-resolvers/identifiers/oauth2-userinfo-identifier.js +0 -1
  446. package/dist/modules/dynamic-credentials.ee/credential-resolvers/identifiers/oauth2-userinfo-identifier.js.map +1 -1
  447. package/dist/modules/dynamic-credentials.ee/credential-resolvers/identifiers/slack-signature-identifier.js +2 -2
  448. package/dist/modules/dynamic-credentials.ee/credential-resolvers/identifiers/slack-signature-identifier.js.map +1 -1
  449. package/dist/modules/dynamic-credentials.ee/credential-resolvers/slack-credential-resolver.js.map +1 -1
  450. package/dist/modules/dynamic-credentials.ee/credential-resolvers/storage/dynamic-credential-entry-storage.d.ts +1 -1
  451. package/dist/modules/dynamic-credentials.ee/credential-resolvers/storage/dynamic-credential-entry-storage.js.map +1 -1
  452. package/dist/modules/dynamic-credentials.ee/services/dynamic-credential-cors.service.d.ts +1 -1
  453. package/dist/modules/dynamic-credentials.ee/services/dynamic-credential-cors.service.js +1 -1
  454. package/dist/modules/dynamic-credentials.ee/services/dynamic-credential-cors.service.js.map +1 -1
  455. package/dist/modules/dynamic-credentials.ee/services/dynamic-credential-storage.service.d.ts +2 -2
  456. package/dist/modules/dynamic-credentials.ee/services/dynamic-credential-storage.service.js +2 -2
  457. package/dist/modules/dynamic-credentials.ee/services/dynamic-credential-storage.service.js.map +1 -1
  458. package/dist/modules/dynamic-credentials.ee/services/dynamic-credential-web.service.d.ts +2 -2
  459. package/dist/modules/dynamic-credentials.ee/services/dynamic-credential-web.service.js +2 -2
  460. package/dist/modules/dynamic-credentials.ee/services/dynamic-credential-web.service.js.map +1 -1
  461. package/dist/modules/dynamic-credentials.ee/services/dynamic-credential.service.d.ts +1 -1
  462. package/dist/modules/dynamic-credentials.ee/services/dynamic-credential.service.js.map +1 -1
  463. package/dist/modules/dynamic-credentials.ee/services/n8n-resolver-seeder.service.d.ts +1 -1
  464. package/dist/modules/dynamic-credentials.ee/services/n8n-resolver-seeder.service.js +1 -1
  465. package/dist/modules/dynamic-credentials.ee/services/n8n-resolver-seeder.service.js.map +1 -1
  466. package/dist/modules/dynamic-credentials.ee/utils.js.map +1 -1
  467. package/dist/modules/dynamic-credentials.ee/workflow-status.controller.d.ts +3 -1
  468. package/dist/modules/dynamic-credentials.ee/workflow-status.controller.js +14 -2
  469. package/dist/modules/dynamic-credentials.ee/workflow-status.controller.js.map +1 -1
  470. package/dist/modules/external-secrets.ee/external-secrets-manager.ee.d.ts +3 -4
  471. package/dist/modules/external-secrets.ee/external-secrets-manager.ee.js +20 -46
  472. package/dist/modules/external-secrets.ee/external-secrets-manager.ee.js.map +1 -1
  473. package/dist/modules/external-secrets.ee/external-secrets-provider-connection-manager.ee.d.ts +21 -0
  474. package/dist/modules/external-secrets.ee/external-secrets-provider-connection-manager.ee.js +142 -0
  475. package/dist/modules/external-secrets.ee/external-secrets-provider-connection-manager.ee.js.map +1 -0
  476. package/dist/modules/external-secrets.ee/external-secrets-settings.controller.ee.d.ts +1 -1
  477. package/dist/modules/external-secrets.ee/external-secrets-settings.controller.ee.js +1 -1
  478. package/dist/modules/external-secrets.ee/external-secrets-settings.controller.ee.js.map +1 -1
  479. package/dist/modules/external-secrets.ee/provider-registry.service.d.ts +1 -1
  480. package/dist/modules/external-secrets.ee/provider-registry.service.js +1 -1
  481. package/dist/modules/external-secrets.ee/providers/aws-secrets-manager.js +5 -1
  482. package/dist/modules/external-secrets.ee/providers/aws-secrets-manager.js.map +1 -1
  483. package/dist/modules/external-secrets.ee/providers/infisical.js +4 -4
  484. package/dist/modules/external-secrets.ee/providers/infisical.js.map +1 -1
  485. package/dist/modules/external-secrets.ee/providers/vault.js +10 -10
  486. package/dist/modules/external-secrets.ee/providers/vault.js.map +1 -1
  487. package/dist/modules/external-secrets.ee/redaction.service.ee.js.map +1 -1
  488. package/dist/modules/external-secrets.ee/secrets-providers-connections.service.ee.d.ts +1 -1
  489. package/dist/modules/external-secrets.ee/secrets-providers-connections.service.ee.js +1 -1
  490. package/dist/modules/external-secrets.ee/secrets-providers-connections.service.ee.js.map +1 -1
  491. package/dist/modules/external-secrets.ee/secrets-providers-types.controller.ee.d.ts +1 -1
  492. package/dist/modules/external-secrets.ee/secrets-providers-types.controller.ee.js +2 -2
  493. package/dist/modules/external-secrets.ee/secrets-providers-types.controller.ee.js.map +1 -1
  494. package/dist/modules/favorites/favorites.controller.d.ts +1 -1
  495. package/dist/modules/favorites/favorites.controller.js +2 -2
  496. package/dist/modules/favorites/favorites.controller.js.map +1 -1
  497. package/dist/modules/favorites/favorites.event-relay.d.ts +1 -1
  498. package/dist/modules/favorites/favorites.event-relay.js +1 -1
  499. package/dist/modules/favorites/favorites.event-relay.js.map +1 -1
  500. package/dist/modules/favorites/favorites.service.d.ts +2 -2
  501. package/dist/modules/favorites/favorites.service.js +2 -2
  502. package/dist/modules/favorites/favorites.service.js.map +1 -1
  503. package/dist/modules/insights/database/repositories/insights-by-period.repository.d.ts +1 -0
  504. package/dist/modules/insights/database/repositories/insights-by-period.repository.js +6 -0
  505. package/dist/modules/insights/database/repositories/insights-by-period.repository.js.map +1 -1
  506. package/dist/modules/insights/insights.module.d.ts +1 -0
  507. package/dist/modules/insights/insights.module.js +1 -1
  508. package/dist/modules/insights/insights.module.js.map +1 -1
  509. package/dist/modules/insights/insights.settings.d.ts +6 -3
  510. package/dist/modules/insights/insights.settings.js +8 -3
  511. package/dist/modules/insights/insights.settings.js.map +1 -1
  512. package/dist/modules/instance-ai/browser/browser-local-mcp-server.d.ts +23 -0
  513. package/dist/modules/instance-ai/browser/browser-local-mcp-server.js +123 -0
  514. package/dist/modules/instance-ai/browser/browser-local-mcp-server.js.map +1 -0
  515. package/dist/modules/instance-ai/browser/browser-use-server.d.ts +11 -0
  516. package/dist/modules/instance-ai/browser/browser-use-server.js +68 -0
  517. package/dist/modules/instance-ai/browser/browser-use-server.js.map +1 -0
  518. package/dist/modules/instance-ai/browser/browser-use-ws.constants.d.ts +7 -0
  519. package/dist/modules/instance-ai/browser/browser-use-ws.constants.js +6 -0
  520. package/dist/modules/instance-ai/browser/browser-use-ws.constants.js.map +1 -0
  521. package/dist/modules/instance-ai/browser/composite-local-mcp-server.d.ts +14 -0
  522. package/dist/modules/instance-ai/browser/composite-local-mcp-server.js +57 -0
  523. package/dist/modules/instance-ai/browser/composite-local-mcp-server.js.map +1 -0
  524. package/dist/modules/instance-ai/browser/instance-ai-browser-session.service.d.ts +40 -0
  525. package/dist/modules/instance-ai/browser/instance-ai-browser-session.service.js +297 -0
  526. package/dist/modules/instance-ai/browser/instance-ai-browser-session.service.js.map +1 -0
  527. package/dist/modules/instance-ai/eval/execution.service.js +2 -2
  528. package/dist/modules/instance-ai/eval/execution.service.js.map +1 -1
  529. package/dist/modules/instance-ai/eval/mock-handler.js +5 -1
  530. package/dist/modules/instance-ai/eval/mock-handler.js.map +1 -1
  531. package/dist/modules/instance-ai/eval/pin-data-generator.js +1 -1
  532. package/dist/modules/instance-ai/eval/pin-data-generator.js.map +1 -1
  533. package/dist/modules/instance-ai/eval/thread-restore.service.d.ts +14 -0
  534. package/dist/modules/instance-ai/eval/thread-restore.service.js +149 -0
  535. package/dist/modules/instance-ai/eval/thread-restore.service.js.map +1 -0
  536. package/dist/modules/instance-ai/eval/workflow-analysis.js +1 -1
  537. package/dist/modules/instance-ai/event-bus/in-process-event-bus.js.map +1 -1
  538. package/dist/modules/instance-ai/filesystem/local-gateway-registry.js.map +1 -1
  539. package/dist/modules/instance-ai/filesystem/local-gateway.d.ts +3 -0
  540. package/dist/modules/instance-ai/filesystem/local-gateway.js +20 -3
  541. package/dist/modules/instance-ai/filesystem/local-gateway.js.map +1 -1
  542. package/dist/modules/instance-ai/instance-ai-event-relay.service.d.ts +12 -0
  543. package/dist/modules/instance-ai/instance-ai-event-relay.service.js +56 -0
  544. package/dist/modules/instance-ai/instance-ai-event-relay.service.js.map +1 -0
  545. package/dist/modules/instance-ai/instance-ai-gateway.service.d.ts +5 -1
  546. package/dist/modules/instance-ai/instance-ai-gateway.service.js +10 -3
  547. package/dist/modules/instance-ai/instance-ai-gateway.service.js.map +1 -1
  548. package/dist/modules/instance-ai/instance-ai-memory.service.d.ts +5 -0
  549. package/dist/modules/instance-ai/instance-ai-memory.service.js +38 -0
  550. package/dist/modules/instance-ai/instance-ai-memory.service.js.map +1 -1
  551. package/dist/modules/instance-ai/instance-ai-run-pin-data.d.ts +29 -0
  552. package/dist/modules/instance-ai/instance-ai-run-pin-data.js +222 -0
  553. package/dist/modules/instance-ai/instance-ai-run-pin-data.js.map +1 -0
  554. package/dist/modules/instance-ai/instance-ai-settings.service.d.ts +1 -0
  555. package/dist/modules/instance-ai/instance-ai-settings.service.js +9 -0
  556. package/dist/modules/instance-ai/instance-ai-settings.service.js.map +1 -1
  557. package/dist/modules/instance-ai/instance-ai-terminal-outcome.service.d.ts +72 -0
  558. package/dist/modules/instance-ai/instance-ai-terminal-outcome.service.js +352 -0
  559. package/dist/modules/instance-ai/instance-ai-terminal-outcome.service.js.map +1 -0
  560. package/dist/modules/instance-ai/instance-ai-test.controller.d.ts +2 -2
  561. package/dist/modules/instance-ai/instance-ai-test.controller.js +2 -2
  562. package/dist/modules/instance-ai/instance-ai-test.controller.js.map +1 -1
  563. package/dist/modules/instance-ai/instance-ai.adapter.service.js +78 -193
  564. package/dist/modules/instance-ai/instance-ai.adapter.service.js.map +1 -1
  565. package/dist/modules/instance-ai/instance-ai.controller.d.ts +19 -2
  566. package/dist/modules/instance-ai/instance-ai.controller.js +96 -6
  567. package/dist/modules/instance-ai/instance-ai.controller.js.map +1 -1
  568. package/dist/modules/instance-ai/instance-ai.module.d.ts +1 -0
  569. package/dist/modules/instance-ai/instance-ai.module.js +4 -0
  570. package/dist/modules/instance-ai/instance-ai.module.js.map +1 -1
  571. package/dist/modules/instance-ai/instance-ai.service.d.ts +10 -33
  572. package/dist/modules/instance-ai/instance-ai.service.js +293 -767
  573. package/dist/modules/instance-ai/instance-ai.service.js.map +1 -1
  574. package/dist/modules/instance-ai/internal-messages.d.ts +2 -0
  575. package/dist/modules/instance-ai/internal-messages.js +4 -2
  576. package/dist/modules/instance-ai/internal-messages.js.map +1 -1
  577. package/dist/modules/instance-ai/liveness/index.d.ts +1 -1
  578. package/dist/modules/instance-ai/liveness/index.js.map +1 -1
  579. package/dist/modules/instance-ai/liveness/instance-ai-liveness.service.d.ts +4 -7
  580. package/dist/modules/instance-ai/liveness/instance-ai-liveness.service.js +2 -2
  581. package/dist/modules/instance-ai/liveness/instance-ai-liveness.service.js.map +1 -1
  582. package/dist/modules/instance-ai/mcp/instance-ai-mcp-connection.controller.js.map +1 -1
  583. package/dist/modules/instance-ai/message-parser.js +4 -3
  584. package/dist/modules/instance-ai/message-parser.js.map +1 -1
  585. package/dist/modules/instance-ai/node-definition-resolver.js +2 -1
  586. package/dist/modules/instance-ai/node-definition-resolver.js.map +1 -1
  587. package/dist/modules/instance-ai/planned-task-action-runner.d.ts +1 -1
  588. package/dist/modules/instance-ai/planned-task-action-runner.js +3 -3
  589. package/dist/modules/instance-ai/planned-task-action-runner.js.map +1 -1
  590. package/dist/modules/instance-ai/repositories/instance-ai-checkpoint.repository.js.map +1 -1
  591. package/dist/modules/instance-ai/storage/typeorm-agent-memory.d.ts +1 -0
  592. package/dist/modules/instance-ai/storage/typeorm-agent-memory.js +29 -0
  593. package/dist/modules/instance-ai/storage/typeorm-agent-memory.js.map +1 -1
  594. package/dist/modules/instance-ai/suspended-run-restorer.service.d.ts +4 -8
  595. package/dist/modules/instance-ai/suspended-run-restorer.service.js +2 -2
  596. package/dist/modules/instance-ai/suspended-run-restorer.service.js.map +1 -1
  597. package/dist/modules/instance-ai/suspended-thread-persistence.service.d.ts +0 -14
  598. package/dist/modules/instance-ai/suspended-thread-persistence.service.js +0 -26
  599. package/dist/modules/instance-ai/suspended-thread-persistence.service.js.map +1 -1
  600. package/dist/modules/instance-ai/tracing/index.d.ts +1 -0
  601. package/dist/modules/instance-ai/tracing/index.js +6 -0
  602. package/dist/modules/instance-ai/tracing/index.js.map +1 -0
  603. package/dist/modules/instance-ai/tracing/instance-ai-tracing.service.d.ts +81 -0
  604. package/dist/modules/instance-ai/tracing/instance-ai-tracing.service.js +341 -0
  605. package/dist/modules/instance-ai/tracing/instance-ai-tracing.service.js.map +1 -0
  606. package/dist/modules/instance-ai/workflow-verification-task-projector.js +1 -2
  607. package/dist/modules/instance-ai/workflow-verification-task-projector.js.map +1 -1
  608. package/dist/modules/instance-registry/instance-registry.controller.js +1 -0
  609. package/dist/modules/instance-registry/instance-registry.controller.js.map +1 -1
  610. package/dist/modules/instance-registry/instance-registry.service.js +1 -1
  611. package/dist/modules/instance-registry/instance-registry.service.js.map +1 -1
  612. package/dist/modules/instance-version-history/instance-version-history.service.d.ts +1 -1
  613. package/dist/modules/instance-version-history/instance-version-history.service.js +1 -1
  614. package/dist/modules/instance-version-history/instance-version-history.service.js.map +1 -1
  615. package/dist/modules/ldap.ee/ldap.service.ee.d.ts +1 -1
  616. package/dist/modules/ldap.ee/ldap.service.ee.js +1 -1
  617. package/dist/modules/ldap.ee/ldap.service.ee.js.map +1 -1
  618. package/dist/modules/log-streaming.ee/destinations/message-event-bus-destination-sentry.ee.js.map +1 -1
  619. package/dist/modules/mcp/dto/update-allowed-redirect-uris.dto.js +1 -1
  620. package/dist/modules/mcp/dto/update-allowed-redirect-uris.dto.js.map +1 -1
  621. package/dist/modules/mcp/mcp.service.d.ts +5 -1
  622. package/dist/modules/mcp/mcp.service.js +18 -3
  623. package/dist/modules/mcp/mcp.service.js.map +1 -1
  624. package/dist/modules/mcp/tools/data-table/add-data-table-column.tool.d.ts +1 -1
  625. package/dist/modules/mcp/tools/data-table/add-data-table-column.tool.js.map +1 -1
  626. package/dist/modules/mcp/tools/data-table/add-data-table-rows.tool.d.ts +1 -1
  627. package/dist/modules/mcp/tools/data-table/add-data-table-rows.tool.js.map +1 -1
  628. package/dist/modules/mcp/tools/data-table/create-data-table.tool.d.ts +1 -1
  629. package/dist/modules/mcp/tools/data-table/create-data-table.tool.js.map +1 -1
  630. package/dist/modules/mcp/tools/data-table/delete-data-table-column.tool.d.ts +1 -1
  631. package/dist/modules/mcp/tools/data-table/delete-data-table-column.tool.js.map +1 -1
  632. package/dist/modules/mcp/tools/data-table/rename-data-table-column.tool.d.ts +1 -1
  633. package/dist/modules/mcp/tools/data-table/rename-data-table-column.tool.js.map +1 -1
  634. package/dist/modules/mcp/tools/data-table/rename-data-table.tool.d.ts +1 -1
  635. package/dist/modules/mcp/tools/data-table/rename-data-table.tool.js.map +1 -1
  636. package/dist/modules/mcp/tools/data-table/search-data-tables.tool.d.ts +1 -1
  637. package/dist/modules/mcp/tools/data-table/search-data-tables.tool.js.map +1 -1
  638. package/dist/modules/mcp/tools/execute-workflow.tool.d.ts +2 -2
  639. package/dist/modules/mcp/tools/execution-utils.js.map +1 -1
  640. package/dist/modules/mcp/tools/get-workflow-details.tool.d.ts +3 -3
  641. package/dist/modules/mcp/tools/get-workflow-details.tool.js.map +1 -1
  642. package/dist/modules/mcp/tools/get-workflow-history.tool.d.ts +49 -0
  643. package/dist/modules/mcp/tools/get-workflow-history.tool.js +115 -0
  644. package/dist/modules/mcp/tools/get-workflow-history.tool.js.map +1 -0
  645. package/dist/modules/mcp/tools/get-workflow-version.tool.d.ts +30 -0
  646. package/dist/modules/mcp/tools/get-workflow-version.tool.js +118 -0
  647. package/dist/modules/mcp/tools/get-workflow-version.tool.js.map +1 -0
  648. package/dist/modules/mcp/tools/prepare-workflow-pin-data.tool.d.ts +2 -2
  649. package/dist/modules/mcp/tools/prepare-workflow-pin-data.tool.js.map +1 -1
  650. package/dist/modules/mcp/tools/publish-workflow.tool.d.ts +1 -1
  651. package/dist/modules/mcp/tools/publish-workflow.tool.js.map +1 -1
  652. package/dist/modules/mcp/tools/schemas.d.ts +25 -11
  653. package/dist/modules/mcp/tools/schemas.js +7 -4
  654. package/dist/modules/mcp/tools/schemas.js.map +1 -1
  655. package/dist/modules/mcp/tools/search-folders.tool.d.ts +1 -1
  656. package/dist/modules/mcp/tools/search-folders.tool.js.map +1 -1
  657. package/dist/modules/mcp/tools/search-projects.tool.d.ts +1 -1
  658. package/dist/modules/mcp/tools/search-projects.tool.js.map +1 -1
  659. package/dist/modules/mcp/tools/test-workflow.tool.d.ts +2 -2
  660. package/dist/modules/mcp/tools/test-workflow.tool.js.map +1 -1
  661. package/dist/modules/mcp/tools/unpublish-workflow.tool.d.ts +1 -1
  662. package/dist/modules/mcp/tools/unpublish-workflow.tool.js.map +1 -1
  663. package/dist/modules/mcp/tools/webhook-utils.js.map +1 -1
  664. package/dist/modules/mcp/tools/workflow-builder/connection-structure-check.d.ts +1 -1
  665. package/dist/modules/mcp/tools/workflow-builder/connection-structure-check.js.map +1 -1
  666. package/dist/modules/mcp/tools/workflow-builder/create-workflow-from-code.tool.js +18 -2
  667. package/dist/modules/mcp/tools/workflow-builder/create-workflow-from-code.tool.js.map +1 -1
  668. package/dist/modules/mcp/tools/workflow-builder/delete-workflow.tool.d.ts +1 -1
  669. package/dist/modules/mcp/tools/workflow-builder/delete-workflow.tool.js +1 -1
  670. package/dist/modules/mcp/tools/workflow-builder/delete-workflow.tool.js.map +1 -1
  671. package/dist/modules/mcp/tools/workflow-builder/get-workflow-node-types.tool.d.ts +1 -1
  672. package/dist/modules/mcp/tools/workflow-builder/get-workflow-node-types.tool.js +1 -1
  673. package/dist/modules/mcp/tools/workflow-builder/get-workflow-node-types.tool.js.map +1 -1
  674. package/dist/modules/mcp/tools/workflow-builder/get-workflow-sdk-reference.tool.d.ts +1 -1
  675. package/dist/modules/mcp/tools/workflow-builder/get-workflow-sdk-reference.tool.js +1 -1
  676. package/dist/modules/mcp/tools/workflow-builder/get-workflow-sdk-reference.tool.js.map +1 -1
  677. package/dist/modules/mcp/tools/workflow-builder/mcp-instructions.js +4 -2
  678. package/dist/modules/mcp/tools/workflow-builder/mcp-instructions.js.map +1 -1
  679. package/dist/modules/mcp/tools/workflow-builder/restore-workflow-version.tool.d.ts +20 -0
  680. package/dist/modules/mcp/tools/workflow-builder/restore-workflow-version.tool.js +108 -0
  681. package/dist/modules/mcp/tools/workflow-builder/restore-workflow-version.tool.js.map +1 -0
  682. package/dist/modules/mcp/tools/workflow-builder/search-workflow-nodes.tool.d.ts +1 -1
  683. package/dist/modules/mcp/tools/workflow-builder/search-workflow-nodes.tool.js +1 -1
  684. package/dist/modules/mcp/tools/workflow-builder/search-workflow-nodes.tool.js.map +1 -1
  685. package/dist/modules/mcp/tools/workflow-builder/update-workflow.tool.d.ts +3 -1
  686. package/dist/modules/mcp/tools/workflow-builder/update-workflow.tool.js +117 -4
  687. package/dist/modules/mcp/tools/workflow-builder/update-workflow.tool.js.map +1 -1
  688. package/dist/modules/mcp/tools/workflow-builder/validate-node.tool.d.ts +1 -1
  689. package/dist/modules/mcp/tools/workflow-builder/validate-node.tool.js +1 -1
  690. package/dist/modules/mcp/tools/workflow-builder/validate-node.tool.js.map +1 -1
  691. package/dist/modules/mcp/tools/workflow-builder/validate-workflow-code.tool.d.ts +1 -1
  692. package/dist/modules/mcp/tools/workflow-builder/validate-workflow-code.tool.js +4 -1
  693. package/dist/modules/mcp/tools/workflow-builder/validate-workflow-code.tool.js.map +1 -1
  694. package/dist/modules/mcp/tools/workflow-builder/workflow-operations.d.ts +195 -3
  695. package/dist/modules/mcp/tools/workflow-builder/workflow-operations.js +69 -1
  696. package/dist/modules/mcp/tools/workflow-builder/workflow-operations.js.map +1 -1
  697. package/dist/modules/mcp/tools/workflow-history.utils.d.ts +3 -0
  698. package/dist/modules/mcp/tools/workflow-history.utils.js +18 -0
  699. package/dist/modules/mcp/tools/workflow-history.utils.js.map +1 -0
  700. package/dist/modules/mcp-registry/registry/mcp-registry.service.js +4 -1
  701. package/dist/modules/mcp-registry/registry/mcp-registry.service.js.map +1 -1
  702. package/dist/modules/mcp-registry/synthesize-type-def.d.ts +1 -1
  703. package/dist/modules/mcp-registry/synthesize-type-def.js +3 -3
  704. package/dist/modules/mcp-registry/synthesize-type-def.js.map +1 -1
  705. package/dist/modules/n8n-packages/n8n-packages.service.d.ts +1 -1
  706. package/dist/modules/n8n-packages/n8n-packages.service.js +1 -1
  707. package/dist/modules/n8n-packages/n8n-packages.service.js.map +1 -1
  708. package/dist/modules/n8n-packages/utils/import-package-upload.js +1 -1
  709. package/dist/modules/n8n-packages/utils/import-package-upload.js.map +1 -1
  710. package/dist/modules/oauth-server/oauth-consent.service.d.ts +3 -1
  711. package/dist/modules/oauth-server/oauth-consent.service.js +8 -4
  712. package/dist/modules/oauth-server/oauth-consent.service.js.map +1 -1
  713. package/dist/modules/oauth-server/oauth.controller.js +1 -0
  714. package/dist/modules/oauth-server/oauth.controller.js.map +1 -1
  715. package/dist/modules/oauth-server/oauth.helpers.d.ts +2 -2
  716. package/dist/modules/oauth-server/oauth.helpers.js +4 -2
  717. package/dist/modules/oauth-server/oauth.helpers.js.map +1 -1
  718. package/dist/modules/provisioning.ee/provisioning.module.js +4 -0
  719. package/dist/modules/provisioning.ee/provisioning.module.js.map +1 -1
  720. package/dist/modules/provisioning.ee/role-deletion-checker.ee.d.ts +7 -0
  721. package/dist/modules/provisioning.ee/role-deletion-checker.ee.js +33 -0
  722. package/dist/modules/provisioning.ee/role-deletion-checker.ee.js.map +1 -0
  723. package/dist/modules/quick-connect/handlers/firecrawl.handler.js +3 -3
  724. package/dist/modules/quick-connect/handlers/firecrawl.handler.js.map +1 -1
  725. package/dist/modules/quick-connect/quick-connect.config.d.ts +10 -10
  726. package/dist/modules/quick-connect/quick-connect.module.d.ts +2 -2
  727. package/dist/modules/quick-connect/quick-connect.service.js +1 -1
  728. package/dist/modules/quick-connect/quick-connect.service.js.map +1 -1
  729. package/dist/modules/redaction/executions/execution-redaction.service.d.ts +1 -1
  730. package/dist/modules/redaction/executions/execution-redaction.service.js.map +1 -1
  731. package/dist/modules/runtime-credentials/runtime-credentials.service.js +1 -1
  732. package/dist/modules/runtime-credentials/runtime-credentials.service.js.map +1 -1
  733. package/dist/modules/source-control.ee/source-control-context.factory.js.map +1 -1
  734. package/dist/modules/source-control.ee/source-control-export.service.ee.d.ts +1 -1
  735. package/dist/modules/source-control.ee/source-control-export.service.ee.js +2 -2
  736. package/dist/modules/source-control.ee/source-control-export.service.ee.js.map +1 -1
  737. package/dist/modules/source-control.ee/source-control-scoped.service.d.ts +3 -2
  738. package/dist/modules/source-control.ee/source-control-scoped.service.js +10 -1
  739. package/dist/modules/source-control.ee/source-control-scoped.service.js.map +1 -1
  740. package/dist/modules/source-control.ee/source-control-status.service.ee.d.ts +2 -2
  741. package/dist/modules/source-control.ee/source-control-status.service.ee.js +3 -3
  742. package/dist/modules/source-control.ee/source-control-status.service.ee.js.map +1 -1
  743. package/dist/modules/source-control.ee/source-control.controller.ee.d.ts +4 -4
  744. package/dist/modules/source-control.ee/source-control.controller.ee.js +5 -4
  745. package/dist/modules/source-control.ee/source-control.controller.ee.js.map +1 -1
  746. package/dist/modules/source-control.ee/source-control.service.ee.d.ts +8 -5
  747. package/dist/modules/source-control.ee/source-control.service.ee.js +25 -10
  748. package/dist/modules/source-control.ee/source-control.service.ee.js.map +1 -1
  749. package/dist/modules/sso-saml/saml-helpers.js.map +1 -1
  750. package/dist/modules/sso-saml/saml.controller.ee.d.ts +1 -1
  751. package/dist/modules/sso-saml/saml.controller.ee.js +4 -3
  752. package/dist/modules/sso-saml/saml.controller.ee.js.map +1 -1
  753. package/dist/modules/token-exchange/controllers/embed-auth.controller.js +1 -1
  754. package/dist/modules/token-exchange/controllers/embed-auth.controller.js.map +1 -1
  755. package/dist/modules/token-exchange/services/jwks-resolver.js +1 -1
  756. package/dist/modules/token-exchange/services/jwks-resolver.js.map +1 -1
  757. package/dist/modules/token-exchange/services/trusted-key.service.js +1 -1
  758. package/dist/modules/token-exchange/services/trusted-key.service.js.map +1 -1
  759. package/dist/modules/token-exchange/token-exchange.schemas.d.ts +2 -2
  760. package/dist/modules/workflow-builder/workflow-builder-session.entity.js +1 -1
  761. package/dist/modules/workflow-builder/workflow-builder-session.entity.js.map +1 -1
  762. package/dist/modules/workflow-builder/workflow-builder-session.repository.js +1 -1
  763. package/dist/modules/workflow-builder/workflow-builder-session.repository.js.map +1 -1
  764. package/dist/node-catalog/node-catalog.service.d.ts +3 -2
  765. package/dist/node-catalog/node-catalog.service.js +50 -18
  766. package/dist/node-catalog/node-catalog.service.js.map +1 -1
  767. package/dist/oauth/oauth.service.d.ts +1 -1
  768. package/dist/oauth/oauth.service.js +7 -6
  769. package/dist/oauth/oauth.service.js.map +1 -1
  770. package/dist/permissions.ee/check-access.js +1 -1
  771. package/dist/permissions.ee/check-access.js.map +1 -1
  772. package/dist/public-api/index.js +24 -3
  773. package/dist/public-api/index.js.map +1 -1
  774. package/dist/public-api/v1/handlers/discover/discover.service.js +38 -2
  775. package/dist/public-api/v1/handlers/discover/discover.service.js.map +1 -1
  776. package/dist/public-api/v1/handlers/n8n-packages/n8n-packages.handler.js +1 -1
  777. package/dist/public-api/v1/handlers/n8n-packages/n8n-packages.handler.js.map +1 -1
  778. package/dist/scaling/job-processor.js +1 -0
  779. package/dist/scaling/job-processor.js.map +1 -1
  780. package/dist/scaling/leader-election-client.d.ts +1 -1
  781. package/dist/scaling/leader-election-client.js +1 -1
  782. package/dist/scaling/leader-election-client.js.map +1 -1
  783. package/dist/scaling/pubsub/subscriber.service.js +1 -1
  784. package/dist/scaling/pubsub/subscriber.service.js.map +1 -1
  785. package/dist/scaling/redis/redis.types.d.ts +1 -1
  786. package/dist/scaling/redis-lock.service.d.ts +15 -0
  787. package/dist/scaling/redis-lock.service.js +154 -0
  788. package/dist/scaling/redis-lock.service.js.map +1 -0
  789. package/dist/security-audit/risk-reporters/instance-risk-reporter.js +3 -3
  790. package/dist/security-audit/risk-reporters/instance-risk-reporter.js.map +1 -1
  791. package/dist/server.js +4 -0
  792. package/dist/server.js.map +1 -1
  793. package/dist/services/ai-gateway.service.d.ts +1 -1
  794. package/dist/services/ai-gateway.service.js +1 -1
  795. package/dist/services/ai-gateway.service.js.map +1 -1
  796. package/dist/services/ai-workflow-builder.service.js +5 -4
  797. package/dist/services/ai-workflow-builder.service.js.map +1 -1
  798. package/dist/services/credentials-tester.service.d.ts +1 -1
  799. package/dist/services/credentials-tester.service.js +3 -3
  800. package/dist/services/credentials-tester.service.js.map +1 -1
  801. package/dist/services/dynamic-node-parameters.service.d.ts +3 -3
  802. package/dist/services/dynamic-node-parameters.service.js +4 -4
  803. package/dist/services/dynamic-node-parameters.service.js.map +1 -1
  804. package/dist/services/dynamic-templates.service.js +3 -3
  805. package/dist/services/dynamic-templates.service.js.map +1 -1
  806. package/dist/services/export.service.js +3 -3
  807. package/dist/services/export.service.js.map +1 -1
  808. package/dist/services/frontend.service.js.map +1 -1
  809. package/dist/services/import.service.js.map +1 -1
  810. package/dist/services/ownership.service.d.ts +3 -3
  811. package/dist/services/ownership.service.js +5 -5
  812. package/dist/services/ownership.service.js.map +1 -1
  813. package/dist/services/project.service.ee.js +2 -2
  814. package/dist/services/project.service.ee.js.map +1 -1
  815. package/dist/services/pruning/workflow-history-compaction.service.d.ts +1 -1
  816. package/dist/services/pruning/workflow-history-compaction.service.js +1 -1
  817. package/dist/services/pruning/workflow-history-compaction.service.js.map +1 -1
  818. package/dist/services/rate-limit.service.d.ts +1 -1
  819. package/dist/services/rate-limit.service.js.map +1 -1
  820. package/dist/services/role-deletion-check-proxy.service.d.ts +8 -0
  821. package/dist/services/role-deletion-check-proxy.service.js +28 -0
  822. package/dist/services/role-deletion-check-proxy.service.js.map +1 -0
  823. package/dist/services/role.service.d.ts +5 -2
  824. package/dist/services/role.service.js +18 -2
  825. package/dist/services/role.service.js.map +1 -1
  826. package/dist/services/user.service.js +5 -0
  827. package/dist/services/user.service.js.map +1 -1
  828. package/dist/task-runners/task-managers/data-request-response-builder.js +1 -0
  829. package/dist/task-runners/task-managers/data-request-response-builder.js.map +1 -1
  830. package/dist/task-runners/task-runner-process-js.js +2 -0
  831. package/dist/task-runners/task-runner-process-js.js.map +1 -1
  832. package/dist/tool-generation/hitl-tools.js.map +1 -1
  833. package/dist/utils/compression.util.js +2 -2
  834. package/dist/utils/compression.util.js.map +1 -1
  835. package/dist/utils/health-endpoint.util.js.map +1 -1
  836. package/dist/utils/strapi-utils.js +2 -3
  837. package/dist/utils/strapi-utils.js.map +1 -1
  838. package/dist/webhooks/test-webhook-registrations.service.js +1 -1
  839. package/dist/webhooks/test-webhook-registrations.service.js.map +1 -1
  840. package/dist/webhooks/test-webhooks.d.ts +1 -1
  841. package/dist/webhooks/test-webhooks.js.map +1 -1
  842. package/dist/webhooks/waiting-forms.js +2 -2
  843. package/dist/webhooks/waiting-forms.js.map +1 -1
  844. package/dist/webhooks/webhook.service.d.ts +1 -0
  845. package/dist/webhooks/webhook.service.js +4 -1
  846. package/dist/webhooks/webhook.service.js.map +1 -1
  847. package/dist/workflow-execute-additional-data.d.ts +2 -2
  848. package/dist/workflow-execute-additional-data.js +5 -4
  849. package/dist/workflow-execute-additional-data.js.map +1 -1
  850. package/dist/workflow-helpers.js +1 -9
  851. package/dist/workflow-helpers.js.map +1 -1
  852. package/dist/workflow-runner.js +1 -0
  853. package/dist/workflow-runner.js.map +1 -1
  854. package/dist/workflows/publication/workflow-publication-applier.d.ts +3 -1
  855. package/dist/workflows/publication/workflow-publication-applier.js +10 -2
  856. package/dist/workflows/publication/workflow-publication-applier.js.map +1 -1
  857. package/dist/workflows/triggers/non-webhook-trigger-registrar.d.ts +1 -1
  858. package/dist/workflows/triggers/trigger-execution-context.factory.d.ts +1 -1
  859. package/dist/workflows/triggers/trigger-execution-context.factory.js +4 -5
  860. package/dist/workflows/triggers/trigger-execution-context.factory.js.map +1 -1
  861. package/dist/workflows/triggers/webhook-trigger-registrar.d.ts +4 -1
  862. package/dist/workflows/triggers/webhook-trigger-registrar.js +36 -9
  863. package/dist/workflows/triggers/webhook-trigger-registrar.js.map +1 -1
  864. package/dist/workflows/triggers/workflow-trigger-activator.d.ts +3 -0
  865. package/dist/workflows/triggers/workflow-trigger-activator.js +66 -32
  866. package/dist/workflows/triggers/workflow-trigger-activator.js.map +1 -1
  867. package/dist/workflows/workflow-creation.service.js +1 -1
  868. package/dist/workflows/workflow-creation.service.js.map +1 -1
  869. package/dist/workflows/workflow-history/workflow-history.service.d.ts +4 -3
  870. package/dist/workflows/workflow-history/workflow-history.service.js +4 -3
  871. package/dist/workflows/workflow-history/workflow-history.service.js.map +1 -1
  872. package/dist/workflows/workflow-published-data.service.d.ts +16 -6
  873. package/dist/workflows/workflow-published-data.service.js +42 -2
  874. package/dist/workflows/workflow-published-data.service.js.map +1 -1
  875. package/dist/workflows/workflow-validation.service.js +4 -22
  876. package/dist/workflows/workflow-validation.service.js.map +1 -1
  877. package/dist/workflows/workflow.service.d.ts +2 -2
  878. package/dist/workflows/workflow.service.ee.d.ts +1 -1
  879. package/dist/workflows/workflow.service.ee.js +1 -1
  880. package/dist/workflows/workflow.service.ee.js.map +1 -1
  881. package/dist/workflows/workflow.service.js +7 -7
  882. package/dist/workflows/workflow.service.js.map +1 -1
  883. package/dist/workflows/workflows.controller.d.ts +6 -6
  884. package/dist/workflows/workflows.controller.js +3 -3
  885. package/dist/workflows/workflows.controller.js.map +1 -1
  886. package/package.json +68 -56
  887. package/dist/modules/instance-ai/eval/proxy-loopback.d.ts +0 -1
  888. package/dist/modules/instance-ai/eval/proxy-loopback.js +0 -44
  889. package/dist/modules/instance-ai/eval/proxy-loopback.js.map +0 -1
@@ -43,187 +43,22 @@ var __metadata = (this && this.__metadata) || function (k, v) {
43
43
  };
44
44
  Object.defineProperty(exports, "__esModule", { value: true });
45
45
  exports.AgentsService = void 0;
46
- exports.chatThreadId = chatThreadId;
47
- const api_types_1 = require("@n8n/api-types");
48
- const fromai_helpers_1 = require("@n8n/ai-utilities/fromai-helpers");
49
46
  const backend_common_1 = require("@n8n/backend-common");
50
- const config_1 = require("@n8n/config");
51
- const constants_1 = require("@n8n/constants");
52
- const utils_1 = require("@n8n/utils");
53
47
  const db_1 = require("@n8n/db");
54
- const decorators_1 = require("@n8n/decorators");
55
48
  const di_1 = require("@n8n/di");
56
- const n8n_workflow_1 = require("n8n-workflow");
57
49
  const uuid_1 = require("uuid");
58
- const credentials_service_1 = require("../../credentials/credentials.service");
59
- const conflict_error_1 = require("../../errors/response-errors/conflict.error");
60
- const not_found_error_1 = require("../../errors/response-errors/not-found.error");
61
- const node_definition_resolver_1 = require("../../modules/instance-ai/node-definition-resolver");
62
- const publisher_service_1 = require("../../scaling/pubsub/publisher.service");
63
- const telemetry_1 = require("../../telemetry");
64
- const ttl_map_1 = require("../../utils/ttl-map");
65
- const agents_credential_provider_1 = require("./adapters/agents-credential-provider");
66
- const agent_telemetry_1 = require("./agent-telemetry");
67
- const agent_draft_utils_1 = require("./utils/agent-draft.utils");
68
- const agent_memory_scope_1 = require("./utils/agent-memory-scope");
69
- const execution_to_message_mapper_1 = require("./utils/execution-to-message-mapper");
70
- const agent_resource_id_1 = require("./utils/agent-resource-id");
71
- const agent_stream_1 = require("./utils/agent-stream");
72
- const structured_output_error_1 = require("./utils/structured-output-error");
73
- const agent_execution_service_1 = require("./agent-execution.service");
74
- const agent_skills_service_1 = require("./agent-skills.service");
75
- const builder_tool_names_1 = require("./builder/builder-tool-names");
76
- const llm_provider_defaults_1 = require("./builder/interactive/llm-provider-defaults");
77
- const agent_task_entity_1 = require("./entities/agent-task.entity");
78
- const execution_recorder_1 = require("./execution-recorder");
79
- const agent_chat_integration_1 = require("./integrations/agent-chat-integration");
80
- const integration_message_context_service_1 = require("./integrations/integration-message-context.service");
81
- const integrations_sync_1 = require("./integrations/integrations-sync");
82
- const n8n_checkpoint_storage_1 = require("./integrations/n8n-checkpoint-storage");
83
- const n8n_memory_1 = require("./integrations/n8n-memory");
84
- const agent_config_composition_1 = require("./json-config/agent-config-composition");
85
- const model_id_1 = require("./json-config/model-id");
86
- const sanitize_unknown_agent_credentials_1 = require("./json-config/sanitize-unknown-agent-credentials");
87
- const agent_runtime_reconstruction_service_1 = require("./agent-runtime-reconstruction.service");
88
- const agent_history_repository_1 = require("./repositories/agent-history.repository");
89
- const agent_task_snapshot_repository_1 = require("./repositories/agent-task-snapshot.repository");
90
- const agent_task_repository_1 = require("./repositories/agent-task.repository");
91
- const agent_repository_1 = require("./repositories/agent.repository");
92
- const chat_integration_service_1 = require("./integrations/chat-integration.service");
93
50
  const agent_knowledge_service_1 = require("./agent-knowledge.service");
94
- const agent_knowledge_gate_1 = require("./agent-knowledge-gate");
95
- function chatThreadId(agentId, userId) {
96
- const baseThreadId = `${builder_tool_names_1.AGENT_THREAD_PREFIX.TEST}${agentId}`;
97
- return userId ? `${baseThreadId}:${userId}` : baseThreadId;
98
- }
99
- function getMaxIterationsChunks() {
100
- const id = crypto.randomUUID();
101
- return [
102
- { type: 'text-start', id },
103
- {
104
- type: 'text-delta',
105
- id,
106
- delta: 'The agent has reached the maximum number of iterations and has stopped.',
107
- },
108
- { type: 'text-end', id },
109
- ];
110
- }
51
+ const agent_runtime_cache_service_1 = require("./agent-runtime-cache.service");
52
+ const agent_test_chat_service_1 = require("./agent-test-chat.service");
53
+ const agent_repository_1 = require("./repositories/agent.repository");
111
54
  let AgentsService = class AgentsService {
112
- computeRuntimeCacheKey(params) {
113
- if (params.usePublishedVersion) {
114
- const parts = [params.agentId, 'published'];
115
- if (params.integrationType)
116
- parts.push(params.integrationType);
117
- return parts.join(':');
118
- }
119
- const parts = [params.agentId, 'draft'];
120
- if (params.n8nUserId)
121
- parts.push(params.n8nUserId);
122
- if (params.integrationType)
123
- parts.push(params.integrationType);
124
- return parts.join(':');
125
- }
126
- clearRuntimes(agentId, options = {}) {
127
- for (const key of this.runtimes.keys()) {
128
- if (key === agentId || key.startsWith(`${agentId}:`)) {
129
- const entry = this.runtimes.get(key);
130
- this.runtimes.delete(key);
131
- if (entry)
132
- this.closeAgentResources(entry.agent, agentId);
133
- }
134
- }
135
- if (options.skipBroadcast)
136
- return;
137
- if (!this.globalConfig.multiMainSetup.enabled)
138
- return;
139
- void this.publisher
140
- .publishCommand({
141
- command: 'agent-config-changed',
142
- payload: { agentId },
143
- })
144
- .catch((error) => {
145
- this.logger.warn(`[AgentsService] Failed to publish agent-config-changed for ${agentId}`, {
146
- error: error instanceof Error ? error.message : String(error),
147
- });
148
- });
149
- }
150
- clearRuntimeCacheForAgent(agentId) {
151
- this.clearRuntimes(agentId);
152
- }
153
- handleAgentConfigChanged(payload) {
154
- this.clearRuntimes(payload.agentId, { skipBroadcast: true });
155
- }
156
- constructor(logger, agentRepository, projectRelationRepository, n8nCheckpointStorage, n8nMemory, agentExecutionService, agentHistoryRepository, agentSkillsService, agentTaskRepository, agentTaskSnapshotRepository, publisher, agentsConfig, globalConfig, telemetry, chatIntegrationService, agentKnowledgeService, agentRuntimeReconstructionService, integrationMessageContextService) {
55
+ constructor(logger, agentRepository, projectRelationRepository, agentKnowledgeService, runtimeCacheService, testChatService) {
157
56
  this.logger = logger;
158
57
  this.agentRepository = agentRepository;
159
58
  this.projectRelationRepository = projectRelationRepository;
160
- this.n8nCheckpointStorage = n8nCheckpointStorage;
161
- this.n8nMemory = n8nMemory;
162
- this.agentExecutionService = agentExecutionService;
163
- this.agentHistoryRepository = agentHistoryRepository;
164
- this.agentSkillsService = agentSkillsService;
165
- this.agentTaskRepository = agentTaskRepository;
166
- this.agentTaskSnapshotRepository = agentTaskSnapshotRepository;
167
- this.publisher = publisher;
168
- this.agentsConfig = agentsConfig;
169
- this.globalConfig = globalConfig;
170
- this.telemetry = telemetry;
171
- this.chatIntegrationService = chatIntegrationService;
172
59
  this.agentKnowledgeService = agentKnowledgeService;
173
- this.agentRuntimeReconstructionService = agentRuntimeReconstructionService;
174
- this.integrationMessageContextService = integrationMessageContextService;
175
- this.runtimes = new ttl_map_1.TtlMap(30 * constants_1.Time.minutes.toMilliseconds);
176
- }
177
- isNodeToolsModuleEnabled() {
178
- return this.agentsConfig.modules.includes('node-tools-searcher');
179
- }
180
- isKnowledgeBaseEnabled() {
181
- return (0, agent_knowledge_gate_1.isAgentKnowledgeBaseEnabled)(this.agentsConfig);
182
- }
183
- closeAgentResources(agent, agentId) {
184
- agent.close().catch((error) => {
185
- this.logger.warn('[AgentsService] Failed to close agent resources on eviction', {
186
- agentId,
187
- error: error instanceof Error ? error.message : String(error),
188
- });
189
- });
190
- }
191
- createAgentExecutionCounter({ agentId, userId, }) {
192
- const attribution = userId ? { user_id: userId } : {};
193
- return {
194
- incrementMessageCount: () => this.telemetry.trackAgentExecution({
195
- agent_id: agentId,
196
- ...attribution,
197
- message_count: 1,
198
- }),
199
- incrementTokenCount: (tokenCount) => this.telemetry.trackAgentExecution({
200
- agent_id: agentId,
201
- ...attribution,
202
- token_count: tokenCount,
203
- }),
204
- incrementToolCallCount: () => this.telemetry.trackAgentExecution({
205
- agent_id: agentId,
206
- ...attribution,
207
- tool_call_count: 1,
208
- }),
209
- };
210
- }
211
- listChatIntegrations() {
212
- return di_1.Container.get(agent_chat_integration_1.ChatIntegrationRegistry)
213
- .listPublic()
214
- .map((i) => ({
215
- type: i.type,
216
- label: i.displayLabel,
217
- icon: i.displayIcon,
218
- credentialTypes: i.credentialTypes,
219
- ...(i.builderGuidance
220
- ? {
221
- capabilities: i.builderGuidance.capabilities,
222
- useIntegrationWhen: i.builderGuidance.useIntegrationWhen,
223
- useNodeToolWhen: i.builderGuidance.useNodeToolWhen,
224
- }
225
- : {}),
226
- }));
60
+ this.runtimeCacheService = runtimeCacheService;
61
+ this.testChatService = testChatService;
227
62
  }
228
63
  async create(projectId, name) {
229
64
  const defaultConfig = {
@@ -252,37 +87,6 @@ let AgentsService = class AgentsService {
252
87
  async findById(agentId, projectId) {
253
88
  return await this.agentRepository.findByIdAndProjectId(agentId, projectId);
254
89
  }
255
- async updateName(agentId, projectId, name) {
256
- const agent = await this.agentRepository.findByIdAndProjectId(agentId, projectId);
257
- if (!agent) {
258
- return null;
259
- }
260
- agent.name = name;
261
- if (agent.schema) {
262
- agent.schema = { ...agent.schema, name };
263
- }
264
- (0, agent_draft_utils_1.markAgentDraftDirty)(agent);
265
- const saved = await this.agentRepository.save(agent);
266
- this.logger.debug('Updated SDK agent name', { agentId, projectId, name });
267
- return saved;
268
- }
269
- async updateDescription(agentId, projectId, description, updatedAt) {
270
- const agent = await this.agentRepository.findByIdAndProjectId(agentId, projectId);
271
- if (!agent) {
272
- return null;
273
- }
274
- if (updatedAt && agent.updatedAt.toISOString() !== updatedAt) {
275
- throw new conflict_error_1.ConflictError('Agent has been modified');
276
- }
277
- agent.description = description;
278
- if (agent.schema) {
279
- agent.schema = { ...agent.schema, description };
280
- }
281
- (0, agent_draft_utils_1.markAgentDraftDirty)(agent);
282
- const saved = await this.agentRepository.save(agent);
283
- this.logger.debug('Updated SDK agent description', { agentId, projectId });
284
- return saved;
285
- }
286
90
  async findByUser(userId) {
287
91
  const projectRelations = await this.projectRelationRepository.findAllByUser(userId);
288
92
  const projectIds = projectRelations.map((pr) => pr.projectId);
@@ -310,152 +114,6 @@ let AgentsService = class AgentsService {
310
114
  });
311
115
  return agents.filter((agent) => agent.activeVersionId !== null);
312
116
  }
313
- async publishAgent(agentId, projectId, user, versionId, options = {}) {
314
- const agent = await this.agentRepository.findByIdAndProjectId(agentId, projectId);
315
- if (!agent) {
316
- throw new not_found_error_1.NotFoundError(`Agent "${agentId}" not found`);
317
- }
318
- if (!versionId && agent.versionId !== null && agent.versionId === agent.activeVersionId) {
319
- return agent;
320
- }
321
- if (versionId !== undefined && versionId === agent.activeVersionId) {
322
- return agent;
323
- }
324
- await this.agentRepository.manager.transaction(async (trx) => {
325
- if (versionId) {
326
- const existing = await this.agentHistoryRepository.findByVersionAndAgentId(versionId, agentId, trx);
327
- if (!existing) {
328
- throw new not_found_error_1.NotFoundError(`Version "${versionId}" not found for agent "${agentId}"`);
329
- }
330
- agent.activeVersionId = existing.versionId;
331
- agent.activeVersion = existing;
332
- agent.versionId = (0, uuid_1.v4)();
333
- }
334
- else {
335
- agent.versionId ??= (0, uuid_1.v4)();
336
- agent.activeVersion = await this.agentHistoryRepository.saveVersion({
337
- versionId: agent.versionId,
338
- agentId: agent.id,
339
- schema: agent.schema,
340
- tools: this.snapshotConfiguredTools(agent.schema, agent.tools ?? {}),
341
- skills: this.agentSkillsService.snapshotConfiguredSkills(agent.schema, agent.skills ?? {}),
342
- publishedBy: user,
343
- }, trx);
344
- await this.snapshotConfiguredTasks(trx, agent.versionId, agent.id, agent.schema);
345
- agent.activeVersionId = agent.versionId;
346
- }
347
- await trx.save(agent);
348
- });
349
- this.clearRuntimes(agentId);
350
- const credentialIntegrations = agent.integrations ?? [];
351
- if (credentialIntegrations.length > 0 && options.syncIntegrations !== false) {
352
- const { ChatIntegrationService } = await Promise.resolve().then(() => __importStar(require('./integrations/chat-integration.service')));
353
- await di_1.Container.get(ChatIntegrationService)
354
- .syncToConfig(agent, [], credentialIntegrations)
355
- .catch((error) => this.logger.warn('Failed to connect integrations on publish', {
356
- agentId,
357
- error,
358
- }));
359
- }
360
- const { AgentTaskService } = await Promise.resolve().then(() => __importStar(require('./agent-task.service')));
361
- await di_1.Container.get(AgentTaskService)
362
- .requestReconcile(agentId)
363
- .catch((error) => this.logger.warn('Failed to register agent tasks on publish', { agentId, error }));
364
- this.logger.debug('Published SDK agent', { agentId, projectId, userId: user.id });
365
- return agent;
366
- }
367
- async unpublishAgent(agentId, projectId) {
368
- const agent = await this.agentRepository.findByIdAndProjectId(agentId, projectId);
369
- if (!agent) {
370
- throw new not_found_error_1.NotFoundError(`Agent "${agentId}" not found`);
371
- }
372
- await this.agentRepository.manager.transaction(async (trx) => {
373
- agent.activeVersionId = null;
374
- agent.activeVersion = null;
375
- agent.versionId = (0, uuid_1.v4)();
376
- await trx.save(agent);
377
- });
378
- this.clearRuntimes(agentId);
379
- const { ChatIntegrationService } = await Promise.resolve().then(() => __importStar(require('./integrations/chat-integration.service')));
380
- await di_1.Container.get(ChatIntegrationService).disconnect(agentId);
381
- const { AgentTaskService } = await Promise.resolve().then(() => __importStar(require('./agent-task.service')));
382
- await di_1.Container.get(AgentTaskService)
383
- .requestReconcile(agentId)
384
- .catch((error) => this.logger.warn('Failed to stop agent tasks on unpublish', { agentId, error }));
385
- this.logger.debug('Unpublished SDK agent', { agentId, projectId });
386
- return agent;
387
- }
388
- async revertToPublishedAgent(agentId, projectId) {
389
- const agent = await this.agentRepository.findByIdAndProjectId(agentId, projectId);
390
- if (!agent) {
391
- throw new not_found_error_1.NotFoundError(`Agent "${agentId}" not found`);
392
- }
393
- const activeVersion = agent.activeVersion;
394
- if (!activeVersion) {
395
- throw new conflict_error_1.ConflictError(`Agent "${agentId}" is not published`);
396
- }
397
- await this.agentRepository.manager.transaction(async (trx) => {
398
- agent.schema = activeVersion.schema ? (0, n8n_workflow_1.deepCopy)(activeVersion.schema) : null;
399
- agent.tools = (0, n8n_workflow_1.deepCopy)(activeVersion.tools ?? {});
400
- agent.skills = (0, n8n_workflow_1.deepCopy)(activeVersion.skills ?? {});
401
- agent.versionId = activeVersion.versionId;
402
- if (agent.schema) {
403
- agent.name = agent.schema.name;
404
- agent.description = agent.schema.description ?? null;
405
- }
406
- await trx.save(agent);
407
- await this.restoreTasksFromSnapshot(trx, agentId, activeVersion.versionId);
408
- });
409
- this.clearRuntimes(agentId);
410
- this.logger.debug('Reverted SDK agent to published version', { agentId, projectId });
411
- return agent;
412
- }
413
- async revertToVersion(agentId, projectId, versionId) {
414
- const agent = await this.agentRepository.findByIdAndProjectId(agentId, projectId);
415
- if (!agent) {
416
- throw new not_found_error_1.NotFoundError(`Agent "${agentId}" not found`);
417
- }
418
- await this.agentRepository.manager.transaction(async (trx) => {
419
- const target = await this.agentHistoryRepository.findByVersionAndAgentId(versionId, agentId, trx);
420
- if (!target) {
421
- throw new not_found_error_1.NotFoundError(`Version "${versionId}" not found`);
422
- }
423
- agent.schema = target.schema ? (0, n8n_workflow_1.deepCopy)(target.schema) : null;
424
- agent.tools = (0, n8n_workflow_1.deepCopy)(target.tools ?? {});
425
- agent.skills = (0, n8n_workflow_1.deepCopy)(target.skills ?? {});
426
- agent.versionId = (0, uuid_1.v4)();
427
- if (agent.schema) {
428
- agent.name = agent.schema.name;
429
- agent.description = agent.schema.description ?? null;
430
- }
431
- await trx.save(agent);
432
- });
433
- this.clearRuntimes(agentId);
434
- this.logger.debug('Reverted SDK agent to a specific version', {
435
- agentId,
436
- projectId,
437
- versionId,
438
- });
439
- return agent;
440
- }
441
- async hasPublishHistory(agentId) {
442
- return await this.agentHistoryRepository.existsForAgent(agentId);
443
- }
444
- async listPublishHistory(agentId, projectId, take, skip) {
445
- const agent = await this.agentRepository.findByIdAndProjectId(agentId, projectId);
446
- if (!agent) {
447
- throw new not_found_error_1.NotFoundError(`Agent "${agentId}" not found`);
448
- }
449
- const versions = await this.agentHistoryRepository.findByAgentId(agentId, take, skip);
450
- return versions.map((v) => ({
451
- versionId: v.versionId,
452
- agentId: v.agentId,
453
- createdAt: v.createdAt.toISOString(),
454
- updatedAt: v.updatedAt.toISOString(),
455
- author: v.author,
456
- isActive: v.versionId === agent.activeVersionId,
457
- }));
458
- }
459
117
  async delete(agentId, projectId, userId) {
460
118
  const agent = await this.agentRepository.findByIdAndProjectId(agentId, projectId);
461
119
  if (!agent) {
@@ -471,7 +129,7 @@ let AgentsService = class AgentsService {
471
129
  });
472
130
  }
473
131
  await this.agentRepository.remove(agent);
474
- this.clearRuntimes(agentId);
132
+ this.runtimeCacheService.clearRuntimes(agentId);
475
133
  try {
476
134
  const { AgentTaskService } = await Promise.resolve().then(() => __importStar(require('./agent-task.service')));
477
135
  await di_1.Container.get(AgentTaskService).requestReconcile(agentId);
@@ -483,7 +141,7 @@ let AgentsService = class AgentsService {
483
141
  });
484
142
  }
485
143
  try {
486
- await this.clearAllTestChatMessages(agentId);
144
+ await this.testChatService.clearAllTestChatMessages(agentId);
487
145
  }
488
146
  catch (error) {
489
147
  this.logger.warn('Failed to clear test chat on agent delete', {
@@ -494,950 +152,15 @@ let AgentsService = class AgentsService {
494
152
  this.logger.debug('Deleted SDK agent', { agentId, projectId });
495
153
  return true;
496
154
  }
497
- async getConversationHistory(params) {
498
- const { threadId, projectId, agentId } = params;
499
- const detail = await this.agentExecutionService.getThreadDetail(threadId, projectId, agentId);
500
- if (!detail)
501
- return null;
502
- return (0, execution_to_message_mapper_1.executionsToMessagesDto)(detail.executions);
503
- }
504
- createCredentialProvider(projectId) {
505
- return new agents_credential_provider_1.AgentsCredentialProvider(di_1.Container.get(credentials_service_1.CredentialsService), projectId);
506
- }
507
- async getRuntime(params) {
508
- const { agentId, projectId, integrationType, usePublishedVersion } = params;
509
- const cacheKey = this.computeRuntimeCacheKey(params);
510
- const cached = this.runtimes.get(cacheKey);
511
- if (cached)
512
- return cached;
513
- const agentEntity = await this.agentRepository.findByIdAndProjectId(agentId, projectId);
514
- if (!agentEntity)
515
- throw new not_found_error_1.NotFoundError(`Agent ${agentId} not found`);
516
- let n8nUserId = params.n8nUserId;
517
- let agentData = agentEntity;
518
- if (usePublishedVersion) {
519
- agentData = this.getPublishedAgent(agentEntity);
520
- n8nUserId ??= agentEntity.activeVersion?.publishedById ?? undefined;
521
- }
522
- if (!n8nUserId) {
523
- throw new n8n_workflow_1.UserError('Agent user owner id is required');
524
- }
525
- const credentialProvider = this.createCredentialProvider(projectId);
526
- const { agent: agentInstance, toolRegistry } = await this.reconstructFromConfig(agentData, credentialProvider, n8nUserId, integrationType);
527
- this.runtimes.set(cacheKey, {
528
- agent: agentInstance,
529
- agentId,
530
- toolRegistry,
531
- projectId,
532
- telemetryConfiguration: (0, agent_telemetry_1.buildAgentConfigurationTelemetry)(agentData),
533
- });
534
- const runtime = this.runtimes.get(cacheKey);
535
- if (!runtime)
536
- throw new Error(`Agent ${agentId} failed to reconstruct`);
537
- return runtime;
538
- }
539
- async *resumeForChat(config) {
540
- const { agentId, projectId, runId, toolCallId, resumeData, integrationType, userId, usePublishedVersion = true, } = config;
541
- const checkpointStatus = await this.n8nCheckpointStorage.getStatus(runId);
542
- if (checkpointStatus.status === 'expired') {
543
- throw new n8n_workflow_1.UserError(`Checkpoint ${runId} is expired and cannot be resumed`);
544
- }
545
- if (checkpointStatus.status === 'not-found') {
546
- throw new n8n_workflow_1.UserError(`Checkpoint ${runId} not found and cannot be resumed`);
547
- }
548
- const memoryScope = checkpointStatus.checkpoint?.persistence;
549
- if (!memoryScope) {
550
- throw new n8n_workflow_1.UserError(`Checkpoint ${runId} has no memory data and cannot be resumed`);
551
- }
552
- const threadId = memoryScope.threadId;
553
- const runtime = await this.getRuntime({
554
- agentId,
555
- projectId,
556
- ...(userId ? { n8nUserId: userId } : {}),
557
- usePublishedVersion,
558
- integrationType,
559
- });
560
- const { agent: agentInstance, toolRegistry } = runtime;
561
- const recorder = new execution_recorder_1.ExecutionRecorder(toolRegistry);
562
- const runType = usePublishedVersion ? 'production' : 'test';
563
- try {
564
- const resultStream = await agentInstance.resume('stream', resumeData, {
565
- runId,
566
- toolCallId,
567
- executionCounter: this.createAgentExecutionCounter({ agentId, userId }),
568
- });
569
- for await (const value of (0, agent_stream_1.streamAgentChunks)(resultStream.stream)) {
570
- recorder.record(value);
571
- yield value;
572
- }
573
- }
574
- catch (error) {
575
- recorder.record({ type: 'error', error });
576
- recorder.record({ type: 'finish', finishReason: 'error' });
577
- throw error;
578
- }
579
- finally {
580
- const messageRecord = recorder.getMessageRecord();
581
- void this.agentExecutionService
582
- .recordMessage({
583
- threadId,
584
- agentId,
585
- agentName: agentInstance.name,
586
- projectId,
587
- userMessage: '',
588
- record: messageRecord,
589
- telemetry: {
590
- runType,
591
- configuration: runtime.telemetryConfiguration,
592
- },
593
- hitlStatus: recorder.suspended ? 'suspended' : 'resumed',
594
- })
595
- .catch((error) => {
596
- this.logger.warn('Failed to record resumed agent execution', {
597
- agentId,
598
- threadId,
599
- error: error instanceof Error ? error.message : String(error),
600
- });
601
- });
602
- }
603
- }
604
- async validateAgentIsRunnable(agentId, projectId, credentialProvider) {
605
- const agentEntity = await this.agentRepository.findByIdAndProjectId(agentId, projectId);
606
- if (!agentEntity) {
607
- return { missing: ['agent'] };
608
- }
609
- const config = agentEntity.schema;
610
- const missing = [];
611
- if (!config) {
612
- return { missing: ['instructions', 'model', 'credential'] };
613
- }
614
- if (!config.instructions?.trim()) {
615
- missing.push('instructions');
616
- }
617
- if (!config.model?.trim() || !api_types_1.AgentModelSchema.safeParse(config.model).success) {
618
- missing.push('model');
619
- }
620
- let credentialList;
621
- const findCredential = async (credentialId) => {
622
- credentialList ??= await credentialProvider.list();
623
- return credentialList.find((credential) => credential.id === credentialId);
624
- };
625
- const credentialExists = async (credentialId) => {
626
- return (await findCredential(credentialId)) !== undefined;
627
- };
628
- if (!config.credential?.trim()) {
629
- missing.push('credential');
630
- }
631
- else {
632
- try {
633
- const credentialId = config.credential.trim();
634
- if (!(await credentialExists(credentialId)))
635
- missing.push('credential');
636
- }
637
- catch {
638
- }
639
- }
640
- const episodicMemory = config.memory?.episodicMemory;
641
- if (config.memory?.enabled) {
642
- try {
643
- await this.validateMemoryWorkerModel(config.memory.observationalMemory?.observerModel, 'memory.observationalMemory.observerModel', findCredential, missing);
644
- await this.validateMemoryWorkerModel(config.memory.observationalMemory?.reflectorModel, 'memory.observationalMemory.reflectorModel', findCredential, missing);
645
- if (episodicMemory?.enabled === true) {
646
- if (!(await credentialExists(episodicMemory.credential.trim()))) {
647
- missing.push('episodicMemory.credential');
648
- }
649
- await this.validateMemoryWorkerModel(episodicMemory.extractorModel, 'memory.episodicMemory.extractorModel', findCredential, missing);
650
- await this.validateMemoryWorkerModel(episodicMemory.reflectorModel, 'memory.episodicMemory.reflectorModel', findCredential, missing);
651
- }
652
- }
653
- catch {
654
- }
655
- }
656
- const webSearch = config.config?.webSearch;
657
- if (webSearch?.enabled &&
658
- (webSearch.provider === 'brave' || webSearch.provider === 'searxng')) {
659
- const webSearchCredentialId = webSearch.credential?.trim();
660
- if (!webSearchCredentialId) {
661
- missing.push('webSearch.credential');
662
- }
663
- else {
664
- try {
665
- if (!(await credentialExists(webSearchCredentialId))) {
666
- missing.push('webSearch.credential');
667
- }
668
- }
669
- catch {
670
- }
671
- }
672
- }
673
- try {
674
- const modelsByDifficulty = config.subAgents?.modelsByDifficulty;
675
- if (modelsByDifficulty) {
676
- for (const difficulty of api_types_1.SUB_AGENT_TASK_DIFFICULTIES) {
677
- await this.validateMemoryWorkerModel(modelsByDifficulty[difficulty], `subAgents.modelsByDifficulty.${difficulty}`, findCredential, missing);
678
- }
679
- }
680
- }
681
- catch {
682
- }
683
- missing.push(...this.agentSkillsService
684
- .getMissingSkillIds(config, agentEntity.skills ?? {})
685
- .map((skillId) => `skill:${skillId}`));
686
- return { missing };
687
- }
688
- async validateMemoryWorkerModel(modelConfig, path, findCredential, missing) {
689
- if (modelConfig === undefined || modelConfig === null)
690
- return;
691
- if (typeof modelConfig === 'string') {
692
- missing.push(`${path}.credential`);
693
- return;
694
- }
695
- if (!modelConfig.model?.trim() || !api_types_1.AgentModelSchema.safeParse(modelConfig.model).success) {
696
- missing.push(`${path}.model`);
697
- }
698
- const credentialId = modelConfig.credential?.trim();
699
- if (!credentialId) {
700
- missing.push(`${path}.credential`);
701
- return;
702
- }
703
- const credential = await findCredential(credentialId);
704
- if (!credential ||
705
- !this.workerCredentialSupportsModel(credential.type, modelConfig.model ?? '')) {
706
- missing.push(`${path}.credential`);
707
- }
708
- }
709
- workerCredentialSupportsModel(credentialType, model) {
710
- return llm_provider_defaults_1.LLM_PROVIDER_DEFAULTS[credentialType]?.provider === (0, model_id_1.getProviderPrefix)(model);
711
- }
712
- async *executeForChat(config) {
713
- const { agentId, projectId, message, userId, memory } = config;
714
- const runtime = await this.getRuntime({
715
- agentId,
716
- projectId,
717
- n8nUserId: userId,
718
- integrationType: api_types_1.N8N_CHAT_INTEGRATION_TYPE,
719
- });
720
- await this.integrationMessageContextService.setLatest(memory.threadId, memory.resourceId, {
721
- integrationConnectionId: api_types_1.N8N_CHAT_INTEGRATION_TYPE,
722
- platform: api_types_1.N8N_CHAT_INTEGRATION_TYPE,
723
- target: { type: 'dm', userId, threadId: memory.threadId },
724
- interactingUserId: userId,
725
- updatedAt: new Date().toISOString(),
726
- });
727
- yield* this.streamChatResponse({
728
- agentInstance: runtime.agent,
729
- toolRegistry: runtime.toolRegistry,
730
- agentId,
731
- userId,
732
- message,
733
- memory,
734
- projectId: runtime.projectId,
735
- telemetry: {
736
- runType: 'test',
737
- configuration: runtime.telemetryConfiguration,
738
- },
739
- });
740
- }
741
- async getTestChatMessages(agentId, userId) {
742
- return await this.n8nMemory
743
- .getImplementation(agentId)
744
- .getMessages(chatThreadId(agentId, userId), {
745
- resourceId: (0, agent_memory_scope_1.draftChatMemoryResourceId)(userId),
746
- });
747
- }
748
- async clearTestChatMessages(agentId, userId) {
749
- await this.n8nMemory.getImplementation(agentId).deleteThread(chatThreadId(agentId, userId));
750
- }
751
- async clearAllTestChatMessages(agentId) {
752
- const threadId = chatThreadId(agentId);
753
- const memory = this.n8nMemory.getImplementation(agentId);
754
- await memory.deleteThreadsByPrefix(threadId);
755
- await memory.deleteMessagesByThread(threadId);
756
- await memory.deleteThread(threadId);
757
- }
758
- async *executeForChatPublished(config) {
759
- const { agentId, projectId, message, memory, integrationType } = config;
760
- const runtime = await this.getRuntime({
761
- agentId,
762
- projectId,
763
- integrationType,
764
- usePublishedVersion: true,
765
- });
766
- yield* this.streamChatResponse({
767
- agentInstance: runtime.agent,
768
- toolRegistry: runtime.toolRegistry,
769
- agentId,
770
- message,
771
- memory,
772
- projectId: runtime.projectId,
773
- source: integrationType,
774
- telemetry: {
775
- runType: 'production',
776
- configuration: runtime.telemetryConfiguration,
777
- },
778
- });
779
- }
780
- async *executeForTaskPublished(config) {
781
- const { agentId, projectId, message, memory, taskId, taskVersionId } = config;
782
- const runtime = await this.getRuntime({
783
- agentId,
784
- projectId,
785
- integrationType: 'task',
786
- usePublishedVersion: true,
787
- });
788
- yield* this.streamChatResponse({
789
- agentInstance: runtime.agent,
790
- toolRegistry: runtime.toolRegistry,
791
- agentId,
792
- message,
793
- memory,
794
- projectId: runtime.projectId,
795
- source: 'task',
796
- taskId,
797
- taskVersionId,
798
- telemetry: {
799
- runType: 'production',
800
- configuration: runtime.telemetryConfiguration,
801
- },
802
- });
803
- }
804
- async *executeForTaskNow(config) {
805
- const { agentId, projectId, userId, message, memory, taskId } = config;
806
- const runtime = await this.getRuntime({ agentId, projectId, n8nUserId: userId });
807
- yield* this.streamChatResponse({
808
- agentInstance: runtime.agent,
809
- toolRegistry: runtime.toolRegistry,
810
- agentId,
811
- userId,
812
- message,
813
- memory,
814
- projectId: runtime.projectId,
815
- source: 'task',
816
- taskId,
817
- telemetry: {
818
- runType: 'test',
819
- configuration: runtime.telemetryConfiguration,
820
- },
821
- });
822
- }
823
- async *streamChatResponse(config) {
824
- const { agentInstance, toolRegistry, agentId, userId, message, memory, projectId, source, taskId, taskVersionId, telemetry, } = config;
825
- const { threadId, resourceId } = memory;
826
- const recorder = new execution_recorder_1.ExecutionRecorder(toolRegistry);
827
- try {
828
- const resultStream = await agentInstance.stream(message, {
829
- persistence: { threadId, resourceId },
830
- executionCounter: this.createAgentExecutionCounter({ agentId, userId }),
831
- });
832
- for await (const value of (0, agent_stream_1.streamAgentChunks)(resultStream.stream)) {
833
- recorder.record(value);
834
- if (value.type === 'tool-call-suspended') {
835
- this.logger.info('Chat: tool-call-suspended chunk received', {
836
- agentId,
837
- toolCallId: value.toolCallId,
838
- toolName: value.toolName,
839
- });
840
- }
841
- if (value.type === 'finish' && value.finishReason === 'max-iterations') {
842
- for (const chunk of getMaxIterationsChunks()) {
843
- yield chunk;
844
- }
845
- }
846
- yield value;
847
- }
848
- }
849
- catch (error) {
850
- recorder.record({ type: 'error', error });
851
- recorder.record({ type: 'finish', finishReason: 'error' });
852
- throw error;
853
- }
854
- finally {
855
- const messageRecord = recorder.getMessageRecord();
856
- void this.agentExecutionService
857
- .recordMessage({
858
- threadId,
859
- agentId,
860
- agentName: agentInstance.name,
861
- projectId,
862
- userMessage: message,
863
- record: messageRecord,
864
- hitlStatus: recorder.suspended ? 'suspended' : undefined,
865
- source,
866
- taskId,
867
- taskVersionId,
868
- telemetry,
869
- })
870
- .catch((error) => {
871
- this.logger.warn('Failed to record agent execution', {
872
- agentId,
873
- threadId,
874
- error: error instanceof Error ? error.message : String(error),
875
- });
876
- });
877
- }
878
- }
879
- async compileIsolated(agentEntity, credentialProvider, userId, outputSchema) {
880
- if (!agentEntity.schema) {
881
- return { ok: false, error: 'Agent has no JSON config. Create a config first.' };
882
- }
883
- try {
884
- const { agent: reconstructed } = await this.reconstructFromConfig(agentEntity, credentialProvider, userId);
885
- if (outputSchema) {
886
- reconstructed.structuredOutput(outputSchema);
887
- }
888
- return { ok: true, agent: reconstructed };
889
- }
890
- catch (e) {
891
- return {
892
- ok: false,
893
- error: e instanceof Error ? e.message : 'Unknown compilation error',
894
- };
895
- }
896
- }
897
- getPublishedAgent(agentEntity) {
898
- const activeVersionSchema = agentEntity.activeVersion?.schema;
899
- if (!activeVersionSchema) {
900
- throw new n8n_workflow_1.OperationalError('Agent is not published. Publish the agent before using it in a workflow.');
901
- }
902
- return {
903
- ...agentEntity,
904
- schema: activeVersionSchema,
905
- tools: agentEntity.activeVersion?.tools ?? agentEntity.tools ?? {},
906
- skills: agentEntity.activeVersion?.skills ?? agentEntity.skills ?? {},
907
- };
908
- }
909
- async executeForWorkflow(agentId, message, executionId, threadId, userId, projectId, telemetryUserId, useDraftVersion, outputSchema) {
910
- const agentEntity = await this.agentRepository.findByIdAndProjectId(agentId, projectId);
911
- if (!agentEntity) {
912
- throw new n8n_workflow_1.OperationalError('Agent not found or not accessible.');
913
- }
914
- const credentialProvider = new agents_credential_provider_1.AgentsCredentialProvider(di_1.Container.get(credentials_service_1.CredentialsService), projectId);
915
- let agentData = agentEntity;
916
- if (!useDraftVersion) {
917
- agentData = this.getPublishedAgent(agentEntity);
918
- }
919
- const telemetryConfiguration = (0, agent_telemetry_1.buildAgentConfigurationTelemetry)(agentData);
920
- const compiled = await this.compileIsolated(agentData, credentialProvider, userId, outputSchema);
921
- if (!compiled.ok || !compiled.agent) {
922
- throw new n8n_workflow_1.OperationalError(`Failed to compile agent: ${compiled.error ?? 'unknown error'}`);
923
- }
924
- const agentInstance = compiled.agent;
925
- const recorder = new execution_recorder_1.ExecutionRecorder();
926
- let structuredOutput = null;
927
- const toolCalls = [];
928
- const toolInputs = new Map();
929
- let streamError;
930
- try {
931
- const resultStream = await agentInstance.stream(message, {
932
- persistence: { resourceId: executionId, threadId },
933
- executionCounter: this.createAgentExecutionCounter({ agentId, userId: telemetryUserId }),
934
- });
935
- for await (const value of (0, agent_stream_1.streamAgentChunks)(resultStream.stream)) {
936
- recorder.record(value);
937
- if (value.type === 'tool-call') {
938
- toolInputs.set(value.toolCallId, { toolName: value.toolName, input: value.input });
939
- }
940
- else if (value.type === 'tool-result') {
941
- const pending = toolInputs.get(value.toolCallId);
942
- toolCalls.push({
943
- toolName: value.toolName,
944
- input: pending?.input ?? null,
945
- result: value.output,
946
- });
947
- toolInputs.delete(value.toolCallId);
948
- }
949
- else if (value.type === 'finish' && value.structuredOutput !== undefined) {
950
- structuredOutput = value.structuredOutput;
951
- }
952
- }
953
- }
954
- catch (error) {
955
- recorder.record({ type: 'error', error });
956
- recorder.record({ type: 'finish', finishReason: 'error' });
957
- streamError = error instanceof Error ? error : new Error(String(error));
958
- }
959
- const messageRecord = recorder.getMessageRecord();
960
- void this.agentExecutionService
961
- .recordMessage({
962
- threadId,
963
- agentId,
964
- agentName: agentInstance.name,
965
- projectId,
966
- userMessage: message,
967
- record: messageRecord,
968
- source: api_types_1.AGENT_WORKFLOW_TRIGGER_TYPE,
969
- telemetry: {
970
- runType: useDraftVersion ? 'test' : 'production',
971
- configuration: telemetryConfiguration,
972
- },
973
- })
974
- .catch((error) => {
975
- this.logger.warn('Failed to record agent execution from workflow', {
976
- agentId,
977
- threadId,
978
- error: error instanceof Error ? error.message : String(error),
979
- });
980
- });
981
- if (streamError !== undefined) {
982
- throw streamError;
983
- }
984
- if (recorder.suspended) {
985
- throw new n8n_workflow_1.OperationalError('Agent execution suspended waiting for tool approval. ' +
986
- 'Suspend/resume is not supported in workflow execution context.');
987
- }
988
- if (messageRecord.error) {
989
- if (outputSchema) {
990
- const structuredOutputError = (0, structured_output_error_1.describeStructuredOutputError)(messageRecord.error);
991
- if (structuredOutputError) {
992
- throw new n8n_workflow_1.OperationalError(structuredOutputError);
993
- }
994
- }
995
- throw new n8n_workflow_1.OperationalError(`Agent execution failed: ${messageRecord.error}`);
996
- }
997
- if (messageRecord.finishReason === 'error') {
998
- throw new n8n_workflow_1.OperationalError(outputSchema
999
- ? 'Agent execution finished with an error while producing structured output. ' +
1000
- "The agent's model or provider may not support JSON Schema structured output."
1001
- : 'Agent execution finished with an error.');
1002
- }
1003
- return {
1004
- response: messageRecord.assistantResponse,
1005
- structuredOutput: structuredOutput ?? null,
1006
- usage: messageRecord.usage
1007
- ? {
1008
- promptTokens: messageRecord.usage.promptTokens,
1009
- completionTokens: messageRecord.usage.completionTokens,
1010
- totalTokens: messageRecord.usage.totalTokens,
1011
- }
1012
- : null,
1013
- toolCalls,
1014
- finishReason: messageRecord.finishReason,
1015
- session: {
1016
- agentId,
1017
- projectId,
1018
- sessionId: threadId,
1019
- },
1020
- };
1021
- }
1022
- async getConfig(agentId, projectId) {
1023
- const entity = await this.agentRepository.findByIdAndProjectId(agentId, projectId);
1024
- if (!entity)
1025
- throw new not_found_error_1.NotFoundError('Agent not found');
1026
- const config = (0, agent_config_composition_1.composeJsonConfig)(entity);
1027
- if (!config) {
1028
- throw new n8n_workflow_1.UserError('Agent has no JSON config yet.');
1029
- }
1030
- return config;
1031
- }
1032
- async validateConfig(raw) {
1033
- if (hasNodeToolInputSchema(raw)) {
1034
- return { valid: false, error: 'Node tool configs must not include inputSchema.' };
1035
- }
1036
- const parsed = api_types_1.AgentJsonConfigSchema.safeParse((0, api_types_1.sanitizeAgentJsonConfig)(raw));
1037
- if (!parsed.success) {
1038
- return { valid: false, error: parsed.error.message };
1039
- }
1040
- const config = parsed.data;
1041
- if ((0, api_types_1.isNodeToolsEnabled)(config.config) && !this.isNodeToolsModuleEnabled()) {
1042
- return {
1043
- valid: false,
1044
- error: 'config.nodeTools.enabled requires the node-tools-searcher agents module to be enabled.',
1045
- };
1046
- }
1047
- try {
1048
- this.validateNodeToolExpressions(config);
1049
- }
1050
- catch (error) {
1051
- const message = error instanceof Error ? error.message : String(error);
1052
- return {
1053
- valid: false,
1054
- error: `Invalid $fromAI expression in node tool config: ${message}`,
1055
- };
1056
- }
1057
- const nodeError = await this.validateNodeToolConfigs(config);
1058
- if (nodeError) {
1059
- return { valid: false, error: nodeError };
1060
- }
1061
- return { valid: true, config };
1062
- }
1063
- validateNodeToolExpressions(config) {
1064
- for (const tool of config.tools ?? []) {
1065
- if (tool.type !== 'node')
1066
- continue;
1067
- (0, fromai_helpers_1.extractFromAIParameters)((tool.node.nodeParameters ?? {}));
1068
- }
1069
- }
1070
- async updateConfig(agentId, projectId, config) {
1071
- const entity = await this.agentRepository.findByIdAndProjectId(agentId, projectId);
1072
- if (!entity)
1073
- throw new not_found_error_1.NotFoundError('Agent not found');
1074
- const credentialProvider = this.createCredentialProvider(projectId);
1075
- const accessibleCredentialIds = new Set((await credentialProvider.list()).map((credential) => credential.id));
1076
- const sanitizedConfig = (0, sanitize_unknown_agent_credentials_1.sanitizeUnknownAgentCredentials)((0, api_types_1.sanitizeAgentJsonConfig)(config), accessibleCredentialIds);
1077
- const result = await this.validateConfig(sanitizedConfig);
1078
- if (!result.valid) {
1079
- throw new n8n_workflow_1.UserError(`Invalid agent config: ${result.error}`);
1080
- }
1081
- const tasksProvided = result.config.tasks !== undefined;
1082
- const existingTaskIds = tasksProvided
1083
- ? (await this.agentTaskRepository.findByAgentId(agentId)).map((task) => task.id)
1084
- : [];
1085
- const resolvedSubAgents = await this.removeMissingConfigRefs(result.config, entity, new Set(existingTaskIds));
1086
- this.validateSubAgentRefs(resolvedSubAgents, entity);
1087
- const previousIntegrations = entity.integrations ?? [];
1088
- const previousSchema = entity.schema ?? null;
1089
- const integrationsProvided = result.config.integrations !== undefined;
1090
- const toolsProvided = result.config.tools !== undefined;
1091
- const skillsProvided = result.config.skills !== undefined;
1092
- const descriptionProvided = result.config.description !== undefined;
1093
- const credentialProvided = result.config.credential !== undefined;
1094
- const memoryProvided = result.config.memory !== undefined;
1095
- const subAgentsProvided = result.config.subAgents !== undefined;
1096
- const providerToolsProvided = result.config.providerTools !== undefined;
1097
- const configBlockProvided = result.config.config !== undefined;
1098
- const mcpServersProvided = result.config.mcpServers !== undefined;
1099
- const { schemaConfig: decomposedSchema, integrations: decomposedIntegrations } = (0, agent_config_composition_1.decomposeJsonConfig)(result.config);
1100
- const nextIntegrations = integrationsProvided ? decomposedIntegrations : previousIntegrations;
1101
- const nextSchema = {
1102
- ...(previousSchema ?? {}),
1103
- name: decomposedSchema.name,
1104
- model: decomposedSchema.model,
1105
- instructions: decomposedSchema.instructions,
1106
- ...(descriptionProvided ? { description: decomposedSchema.description } : {}),
1107
- ...(credentialProvided ? { credential: decomposedSchema.credential } : {}),
1108
- ...(memoryProvided ? { memory: decomposedSchema.memory } : {}),
1109
- ...(subAgentsProvided ? { subAgents: decomposedSchema.subAgents } : {}),
1110
- ...(toolsProvided ? { tools: decomposedSchema.tools } : {}),
1111
- ...(skillsProvided ? { skills: decomposedSchema.skills } : {}),
1112
- ...(tasksProvided ? { tasks: decomposedSchema.tasks } : {}),
1113
- ...(providerToolsProvided ? { providerTools: decomposedSchema.providerTools } : {}),
1114
- ...(configBlockProvided ? { config: decomposedSchema.config } : {}),
1115
- ...(mcpServersProvided ? { mcpServers: decomposedSchema.mcpServers } : {}),
1116
- };
1117
- entity.schema = nextSchema;
1118
- entity.name = result.config.name;
1119
- if (descriptionProvided)
1120
- entity.description = result.config.description ?? null;
1121
- entity.integrations = nextIntegrations;
1122
- (0, agent_draft_utils_1.markAgentDraftDirty)(entity);
1123
- if (toolsProvided) {
1124
- const referencedIds = new Set((result.config.tools ?? [])
1125
- .filter((t) => t.type === 'custom')
1126
- .map((t) => t.id));
1127
- const orphanIds = Object.keys(entity.tools).filter((id) => !referencedIds.has(id));
1128
- if (orphanIds.length > 0) {
1129
- const tools = { ...entity.tools };
1130
- for (const id of orphanIds) {
1131
- delete tools[id];
1132
- }
1133
- entity.tools = tools;
1134
- }
1135
- }
1136
- if (skillsProvided) {
1137
- this.agentSkillsService.removeUnreferencedSkills(entity, result.config);
1138
- }
1139
- this.clearRuntimes(agentId);
1140
- const saved = await this.agentRepository.save(entity);
1141
- this.logger.debug('Updated agent JSON config', { agentId, projectId });
1142
- if (tasksProvided) {
1143
- const referencedTaskIds = new Set((result.config.tasks ?? []).map((ref) => ref.id));
1144
- const orphanTaskIds = existingTaskIds.filter((id) => !referencedTaskIds.has(id));
1145
- if (orphanTaskIds.length > 0) {
1146
- await this.agentTaskRepository.delete(orphanTaskIds);
1147
- }
1148
- }
1149
- if (integrationsProvided) {
1150
- await (0, integrations_sync_1.syncAgentIntegrations)(saved, previousIntegrations, nextIntegrations, this.logger);
1151
- }
1152
- return {
1153
- config: (0, agent_config_composition_1.composeJsonConfig)(saved) ?? result.config,
1154
- updatedAt: saved.updatedAt.toISOString(),
1155
- versionId: saved.versionId,
1156
- };
1157
- }
1158
- async saveCredentialIntegration(agent, integration, options = {}) {
1159
- const parseResult = api_types_1.AgentIntegrationSchema.safeParse(integration);
1160
- if (!parseResult.success) {
1161
- throw new n8n_workflow_1.UserError(`Invalid credential integration: ${parseResult.error.message}`);
1162
- }
1163
- const validated = parseResult.data;
1164
- const { type, credentialId } = validated;
1165
- if (credentialId === '') {
1166
- throw new n8n_workflow_1.UserError('Credential integration requires a credential ID.');
1167
- }
1168
- const existing = agent.integrations ?? [];
1169
- const alreadyExists = existing.some((i) => i.type === type && i.credentialId === credentialId);
1170
- agent.integrations = alreadyExists
1171
- ? existing.map((existingIntegration) => existingIntegration.type === type && existingIntegration.credentialId === credentialId
1172
- ? validated
1173
- : existingIntegration)
1174
- : [...existing, validated];
1175
- (0, agent_draft_utils_1.markAgentDraftDirty)(agent);
1176
- this.clearRuntimes(agent.id);
1177
- const result = await this.agentRepository.save(agent);
1178
- if (options.broadcast !== false) {
1179
- await this.chatIntegrationService.broadcastIntegrationChange(agent.id, integration, 'connect');
1180
- }
1181
- return result;
1182
- }
1183
- async removeCredentialIntegration(agent, type, credentialId) {
1184
- if (!agent.integrations?.length)
1185
- return agent;
1186
- const integration = agent.integrations.find((i) => i.type === type && i.credentialId === credentialId);
1187
- if (!integration)
1188
- return agent;
1189
- agent.integrations = agent.integrations.filter((i) => i !== integration);
1190
- (0, agent_draft_utils_1.markAgentDraftDirty)(agent);
1191
- this.clearRuntimes(agent.id);
1192
- const result = await this.agentRepository.save(agent);
1193
- await this.chatIntegrationService.broadcastIntegrationChange(agent.id, integration, 'disconnect');
1194
- return result;
1195
- }
1196
- async buildCustomTool(agentId, projectId, code, descriptor) {
1197
- const entity = await this.agentRepository.findByIdAndProjectId(agentId, projectId);
1198
- if (!entity)
1199
- throw new not_found_error_1.NotFoundError('Agent not found');
1200
- const toolId = (0, agent_resource_id_1.generateAgentResourceId)('tool', Object.keys(entity.tools ?? {}));
1201
- entity.tools = {
1202
- ...entity.tools,
1203
- [toolId]: { code, descriptor },
1204
- };
1205
- (0, agent_draft_utils_1.markAgentDraftDirty)(entity);
1206
- this.clearRuntimes(agentId);
1207
- await this.agentRepository.save(entity);
1208
- this.logger.debug('Built custom tool', { agentId, projectId, toolId });
1209
- return { ok: true, id: toolId, descriptor };
1210
- }
1211
- async listSkills(agentId, projectId) {
1212
- return await this.agentSkillsService.listSkills(agentId, projectId);
1213
- }
1214
- async getSkill(agentId, projectId, skillId) {
1215
- return await this.agentSkillsService.getSkill(agentId, projectId, skillId);
1216
- }
1217
- async createSkill(agentId, projectId, skill) {
1218
- const result = await this.agentSkillsService.createSkill(agentId, projectId, skill);
1219
- this.clearRuntimes(agentId);
1220
- return result;
1221
- }
1222
- async createAndAttachSkill(agentId, projectId, skill) {
1223
- const result = await this.agentSkillsService.createAndAttachSkill(agentId, projectId, skill);
1224
- this.clearRuntimes(agentId);
1225
- return result;
1226
- }
1227
- async updateSkill(agentId, projectId, skillId, updates) {
1228
- const result = await this.agentSkillsService.updateSkill(agentId, projectId, skillId, updates);
1229
- this.clearRuntimes(agentId);
1230
- return result;
1231
- }
1232
- async deleteCustomTool(agentId, projectId, toolId) {
1233
- const entity = await this.agentRepository.findByIdAndProjectId(agentId, projectId);
1234
- if (!entity)
1235
- throw new not_found_error_1.NotFoundError('Agent not found');
1236
- const tools = { ...entity.tools };
1237
- delete tools[toolId];
1238
- entity.tools = tools;
1239
- if (entity.schema?.tools) {
1240
- entity.schema.tools = entity.schema.tools.filter((t) => !(t.type === 'custom' && 'id' in t && t.id === toolId));
1241
- }
1242
- (0, agent_draft_utils_1.markAgentDraftDirty)(entity);
1243
- this.clearRuntimes(agentId);
1244
- await this.agentRepository.save(entity);
1245
- this.logger.debug('Deleted custom tool', { agentId, projectId, toolId });
1246
- }
1247
- async deleteSkill(agentId, projectId, skillId) {
1248
- await this.agentSkillsService.deleteSkill(agentId, projectId, skillId);
1249
- this.clearRuntimes(agentId);
1250
- }
1251
- async validateNodeToolConfigs(config) {
1252
- const nodeTools = (config.tools ?? []).filter((t) => t.type === 'node');
1253
- if (nodeTools.length === 0)
1254
- return null;
1255
- const { setSchemaBaseDirs, validateNodeConfig } = await Promise.resolve().then(() => __importStar(require('@n8n/workflow-sdk')));
1256
- const dirs = (0, node_definition_resolver_1.resolveBuiltinNodeDefinitionDirs)();
1257
- if (dirs.length > 0) {
1258
- setSchemaBaseDirs(dirs);
1259
- }
1260
- const errors = [];
1261
- for (const tool of nodeTools) {
1262
- const nodeType = tool.node.nodeType;
1263
- const nodeTypeVersion = tool.node.nodeTypeVersion;
1264
- const nodeParameters = tool.node.nodeParameters ?? {};
1265
- const result = validateNodeConfig(nodeType, nodeTypeVersion, { parameters: nodeParameters }, { isToolNode: true });
1266
- if (!result.valid) {
1267
- const messages = result.errors
1268
- .map((e) => e.message)
1269
- .join('; ');
1270
- errors.push(`Node tool "${tool.name}" (${nodeType}@${nodeTypeVersion}): ${messages}`);
1271
- }
1272
- }
1273
- return errors.length > 0 ? errors.join('\n') : null;
1274
- }
1275
- async removeMissingConfigRefs(config, entity, existingTaskIds) {
1276
- if (config.skills !== undefined) {
1277
- const skills = entity.skills ?? {};
1278
- config.skills = config.skills.filter((ref) => Boolean(skills[ref.id]));
1279
- }
1280
- if (config.tools !== undefined) {
1281
- const tools = entity.tools ?? {};
1282
- config.tools = config.tools.filter((ref) => ref.type !== 'custom' || Boolean(tools[ref.id]));
1283
- }
1284
- if (config.tasks !== undefined) {
1285
- config.tasks = config.tasks.filter((ref) => existingTaskIds.has(ref.id));
1286
- }
1287
- if (config.subAgents?.agents !== undefined) {
1288
- const resolvedSubAgents = await this.fetchUniqueSubAgents(config.subAgents.agents, entity.projectId);
1289
- const existingSubAgentIds = new Set(resolvedSubAgents.filter(({ agent }) => agent !== null).map(({ agentId }) => agentId));
1290
- config.subAgents.agents = config.subAgents.agents.filter(({ agentId }) => existingSubAgentIds.has(agentId));
1291
- return resolvedSubAgents;
1292
- }
1293
- return [];
1294
- }
1295
- async fetchUniqueSubAgents(refs, projectId) {
1296
- const seen = new Set();
1297
- const resolved = [];
1298
- for (const { agentId } of refs) {
1299
- if (seen.has(agentId))
1300
- continue;
1301
- seen.add(agentId);
1302
- resolved.push({
1303
- agentId,
1304
- agent: await this.agentRepository.findByIdAndProjectId(agentId, projectId),
1305
- });
1306
- }
1307
- return resolved;
1308
- }
1309
- validateSubAgentRefs(resolvedSubAgents, entity) {
1310
- for (const { agentId, agent } of resolvedSubAgents) {
1311
- if (!agent)
1312
- continue;
1313
- if (agentId === entity.id) {
1314
- throw new n8n_workflow_1.UserError('Invalid agent config: An agent cannot use itself as a subagent');
1315
- }
1316
- if (!agent.activeVersionId) {
1317
- throw new n8n_workflow_1.UserError(`Invalid agent config: Subagent "${agentId}" must be published`);
1318
- }
1319
- }
1320
- }
1321
- getMissingCustomToolIds(config, tools) {
1322
- const refs = (config?.tools ?? []).filter((ref) => ref.type === 'custom');
1323
- const seen = new Set();
1324
- const missing = [];
1325
- for (const ref of refs) {
1326
- if (seen.has(ref.id))
1327
- continue;
1328
- seen.add(ref.id);
1329
- if (!tools[ref.id])
1330
- missing.push(ref.id);
1331
- }
1332
- return missing;
1333
- }
1334
- snapshotConfiguredTools(config, tools) {
1335
- if (!config)
1336
- return null;
1337
- const missing = this.getMissingCustomToolIds(config, tools);
1338
- if (missing.length > 0) {
1339
- throw new n8n_workflow_1.UserError(`Cannot publish agent with missing custom tools: ${missing.join(', ')}`);
1340
- }
1341
- const snapshot = {};
1342
- for (const ref of config.tools ?? []) {
1343
- if (ref.type !== 'custom')
1344
- continue;
1345
- const tool = tools[ref.id];
1346
- if (tool)
1347
- snapshot[ref.id] = tool;
1348
- }
1349
- return snapshot;
1350
- }
1351
- async snapshotConfiguredTasks(trx, versionId, agentId, config) {
1352
- if (!config)
1353
- return;
1354
- const refs = config.tasks ?? [];
1355
- if (refs.length === 0)
1356
- return;
1357
- const bodies = await trx.getRepository(agent_task_entity_1.AgentTask).findBy({ agentId });
1358
- const byId = new Map(bodies.map((body) => [body.id, body]));
1359
- const missing = refs.filter((ref) => !byId.has(ref.id)).map((ref) => ref.id);
1360
- if (missing.length > 0) {
1361
- throw new n8n_workflow_1.UserError(`Cannot publish agent with missing task bodies: ${missing.join(', ')}`);
1362
- }
1363
- await this.agentTaskSnapshotRepository.saveForVersion(refs.map((ref) => {
1364
- const body = byId.get(ref.id);
1365
- if (!body) {
1366
- throw new n8n_workflow_1.UserError(`Cannot publish agent with missing task body: ${ref.id}`);
1367
- }
1368
- return {
1369
- versionId,
1370
- taskId: ref.id,
1371
- enabled: ref.enabled,
1372
- name: body.name,
1373
- objective: body.objective,
1374
- cronExpression: body.cronExpression,
1375
- };
1376
- }), trx);
1377
- }
1378
- async restoreTasksFromSnapshot(trx, agentId, versionId) {
1379
- const repo = trx.getRepository(agent_task_entity_1.AgentTask);
1380
- const existing = await repo.findBy({ agentId });
1381
- const snapshots = await this.agentTaskSnapshotRepository.findByVersionId(versionId, trx);
1382
- const snapshotIds = new Set(snapshots.map((snapshot) => snapshot.taskId));
1383
- const orphanIds = existing.filter((row) => !snapshotIds.has(row.id)).map((row) => row.id);
1384
- if (orphanIds.length > 0)
1385
- await repo.delete(orphanIds);
1386
- const existingIds = new Set(existing.map((row) => row.id));
1387
- for (const snapshot of snapshots) {
1388
- if (existingIds.has(snapshot.taskId)) {
1389
- await repo.update(snapshot.taskId, {
1390
- name: snapshot.name,
1391
- objective: snapshot.objective,
1392
- cronExpression: snapshot.cronExpression,
1393
- });
1394
- }
1395
- else {
1396
- await repo.insert({
1397
- id: snapshot.taskId,
1398
- agentId,
1399
- name: snapshot.name,
1400
- objective: snapshot.objective,
1401
- cronExpression: snapshot.cronExpression,
1402
- });
1403
- }
1404
- }
1405
- }
1406
- async reconstructFromConfig(agentEntity, credentialProvider, userId, integrationType) {
1407
- return await this.agentRuntimeReconstructionService.reconstructFromAgentEntity(agentEntity, credentialProvider, userId, integrationType);
1408
- }
1409
155
  };
1410
156
  exports.AgentsService = AgentsService;
1411
- __decorate([
1412
- (0, decorators_1.OnPubSubEvent)('agent-config-changed', { instanceType: 'main' }),
1413
- __metadata("design:type", Function),
1414
- __metadata("design:paramtypes", [Object]),
1415
- __metadata("design:returntype", void 0)
1416
- ], AgentsService.prototype, "handleAgentConfigChanged", null);
1417
157
  exports.AgentsService = AgentsService = __decorate([
1418
158
  (0, di_1.Service)(),
1419
159
  __metadata("design:paramtypes", [backend_common_1.Logger,
1420
160
  agent_repository_1.AgentRepository,
1421
161
  db_1.ProjectRelationRepository,
1422
- n8n_checkpoint_storage_1.N8NCheckpointStorage,
1423
- n8n_memory_1.N8nMemory,
1424
- agent_execution_service_1.AgentExecutionService,
1425
- agent_history_repository_1.AgentHistoryRepository,
1426
- agent_skills_service_1.AgentSkillsService,
1427
- agent_task_repository_1.AgentTaskRepository,
1428
- agent_task_snapshot_repository_1.AgentTaskSnapshotRepository,
1429
- publisher_service_1.Publisher,
1430
- config_1.AgentsConfig,
1431
- config_1.GlobalConfig,
1432
- telemetry_1.Telemetry,
1433
- chat_integration_service_1.ChatIntegrationService,
1434
162
  agent_knowledge_service_1.AgentKnowledgeService,
1435
- agent_runtime_reconstruction_service_1.AgentRuntimeReconstructionService,
1436
- integration_message_context_service_1.IntegrationMessageContextService])
163
+ agent_runtime_cache_service_1.AgentRuntimeCacheService,
164
+ agent_test_chat_service_1.AgentTestChatService])
1437
165
  ], AgentsService);
1438
- function hasNodeToolInputSchema(raw) {
1439
- if (!(0, utils_1.isRecord)(raw) || !Array.isArray(raw.tools))
1440
- return false;
1441
- return raw.tools.some((tool) => (0, utils_1.isRecord)(tool) && tool.type === 'node' && 'inputSchema' in tool);
1442
- }
1443
166
  //# sourceMappingURL=agents.service.js.map