n8n 2.21.4 → 2.22.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 (336) hide show
  1. package/dist/active-workflow-manager.js +4 -0
  2. package/dist/active-workflow-manager.js.map +1 -1
  3. package/dist/build.tsbuildinfo +1 -1
  4. package/dist/commands/base-command.js +2 -1
  5. package/dist/commands/base-command.js.map +1 -1
  6. package/dist/commands/export/entities.d.ts +3 -0
  7. package/dist/commands/export/entities.js +8 -1
  8. package/dist/commands/export/entities.js.map +1 -1
  9. package/dist/concurrency/concurrency-control.service.d.ts +7 -2
  10. package/dist/concurrency/concurrency-control.service.js +72 -47
  11. package/dist/concurrency/concurrency-control.service.js.map +1 -1
  12. package/dist/constants.js +3 -0
  13. package/dist/constants.js.map +1 -1
  14. package/dist/controllers/e2e.controller.js +2 -0
  15. package/dist/controllers/e2e.controller.js.map +1 -1
  16. package/dist/controllers/users.controller.d.ts +1 -1
  17. package/dist/credentials/credentials.service.js.map +1 -1
  18. package/dist/evaluation.ee/evaluation-collection.service.d.ts +38 -0
  19. package/dist/evaluation.ee/evaluation-collection.service.js +327 -0
  20. package/dist/evaluation.ee/evaluation-collection.service.js.map +1 -0
  21. package/dist/evaluation.ee/evaluation-collections.controller.ee.d.ts +50 -0
  22. package/dist/evaluation.ee/evaluation-collections.controller.ee.js +148 -0
  23. package/dist/evaluation.ee/evaluation-collections.controller.ee.js.map +1 -0
  24. package/dist/evaluation.ee/evaluation-concurrency.helper.d.ts +11 -0
  25. package/dist/evaluation.ee/evaluation-concurrency.helper.js +40 -0
  26. package/dist/evaluation.ee/evaluation-concurrency.helper.js.map +1 -0
  27. package/dist/evaluation.ee/test-runner/test-runner.service.ee.d.ts +22 -6
  28. package/dist/evaluation.ee/test-runner/test-runner.service.ee.js +105 -15
  29. package/dist/evaluation.ee/test-runner/test-runner.service.ee.js.map +1 -1
  30. package/dist/evaluation.ee/test-runs.controller.ee.d.ts +5 -6
  31. package/dist/evaluation.ee/test-runs.controller.ee.js +4 -24
  32. package/dist/evaluation.ee/test-runs.controller.ee.js.map +1 -1
  33. package/dist/interfaces.d.ts +6 -0
  34. package/dist/modules/agents/adapters/agents-credential-provider.d.ts +2 -1
  35. package/dist/modules/agents/adapters/agents-credential-provider.js +25 -24
  36. package/dist/modules/agents/adapters/agents-credential-provider.js.map +1 -1
  37. package/dist/modules/agents/agent-execution.service.js +0 -1
  38. package/dist/modules/agents/agent-execution.service.js.map +1 -1
  39. package/dist/modules/agents/agent-skills.service.d.ts +1 -2
  40. package/dist/modules/agents/agent-skills.service.js.map +1 -1
  41. package/dist/modules/agents/agent-sse-stream.d.ts +1 -1
  42. package/dist/modules/agents/agent-sse-stream.js +0 -31
  43. package/dist/modules/agents/agent-sse-stream.js.map +1 -1
  44. package/dist/modules/agents/agents.controller.d.ts +64 -37
  45. package/dist/modules/agents/agents.controller.js +54 -40
  46. package/dist/modules/agents/agents.controller.js.map +1 -1
  47. package/dist/modules/agents/agents.service.d.ts +15 -5
  48. package/dist/modules/agents/agents.service.js +79 -71
  49. package/dist/modules/agents/agents.service.js.map +1 -1
  50. package/dist/modules/agents/builder/agent-builder-preview-path.d.ts +1 -0
  51. package/dist/modules/agents/builder/agent-builder-preview-path.js +9 -0
  52. package/dist/modules/agents/builder/agent-builder-preview-path.js.map +1 -0
  53. package/dist/modules/agents/builder/agents-builder-model-recommendations.d.ts +3 -0
  54. package/dist/modules/agents/builder/agents-builder-model-recommendations.js +106 -0
  55. package/dist/modules/agents/builder/agents-builder-model-recommendations.js.map +1 -0
  56. package/dist/modules/agents/builder/agents-builder-prompts.d.ts +12 -11
  57. package/dist/modules/agents/builder/agents-builder-prompts.js +61 -32
  58. package/dist/modules/agents/builder/agents-builder-prompts.js.map +1 -1
  59. package/dist/modules/agents/builder/agents-builder-tools.service.d.ts +1 -1
  60. package/dist/modules/agents/builder/agents-builder-tools.service.js +7 -8
  61. package/dist/modules/agents/builder/agents-builder-tools.service.js.map +1 -1
  62. package/dist/modules/agents/builder/agents-builder.service.js +6 -3
  63. package/dist/modules/agents/builder/agents-builder.service.js.map +1 -1
  64. package/dist/modules/agents/builder/interactive/ask-llm.tool.js +1 -1
  65. package/dist/modules/agents/builder/interactive/ask-llm.tool.js.map +1 -1
  66. package/dist/modules/agents/builder/interactive/resolve-llm.tool.js +1 -1
  67. package/dist/modules/agents/builder/interactive/resolve-llm.tool.js.map +1 -1
  68. package/dist/modules/agents/entities/agent-execution.entity.d.ts +0 -1
  69. package/dist/modules/agents/entities/agent-execution.entity.js +0 -4
  70. package/dist/modules/agents/entities/agent-execution.entity.js.map +1 -1
  71. package/dist/modules/agents/entities/agent-observation-lock.entity.d.ts +2 -0
  72. package/dist/modules/agents/entities/agent-observation-lock.entity.js +4 -0
  73. package/dist/modules/agents/entities/agent-observation-lock.entity.js.map +1 -1
  74. package/dist/modules/agents/entities/agent-observation.entity.d.ts +9 -5
  75. package/dist/modules/agents/entities/agent-observation.entity.js +21 -11
  76. package/dist/modules/agents/entities/agent-observation.entity.js.map +1 -1
  77. package/dist/modules/agents/entities/agent-published-version.entity.d.ts +1 -2
  78. package/dist/modules/agents/entities/agent-published-version.entity.js.map +1 -1
  79. package/dist/modules/agents/entities/agent.entity.d.ts +2 -3
  80. package/dist/modules/agents/entities/agent.entity.js.map +1 -1
  81. package/dist/modules/agents/execution-recorder.d.ts +1 -8
  82. package/dist/modules/agents/execution-recorder.js +67 -42
  83. package/dist/modules/agents/execution-recorder.js.map +1 -1
  84. package/dist/modules/agents/integrations/agent-chat-bridge.d.ts +6 -4
  85. package/dist/modules/agents/integrations/agent-chat-bridge.js +22 -13
  86. package/dist/modules/agents/integrations/agent-chat-bridge.js.map +1 -1
  87. package/dist/modules/agents/integrations/agent-chat-integration.d.ts +4 -1
  88. package/dist/modules/agents/integrations/agent-chat-integration.js.map +1 -1
  89. package/dist/modules/agents/integrations/chat-integration.service.d.ts +17 -8
  90. package/dist/modules/agents/integrations/chat-integration.service.js +53 -37
  91. package/dist/modules/agents/integrations/chat-integration.service.js.map +1 -1
  92. package/dist/modules/agents/integrations/integrations-sync.d.ts +2 -2
  93. package/dist/modules/agents/integrations/integrations-sync.js +1 -1
  94. package/dist/modules/agents/integrations/integrations-sync.js.map +1 -1
  95. package/dist/modules/agents/integrations/n8n-memory.d.ts +31 -35
  96. package/dist/modules/agents/integrations/n8n-memory.js +121 -127
  97. package/dist/modules/agents/integrations/n8n-memory.js.map +1 -1
  98. package/dist/modules/agents/integrations/platforms/telegram-integration.d.ts +9 -2
  99. package/dist/modules/agents/integrations/platforms/telegram-integration.js +51 -6
  100. package/dist/modules/agents/integrations/platforms/telegram-integration.js.map +1 -1
  101. package/dist/modules/agents/json-config/agent-config-composition.d.ts +2 -3
  102. package/dist/modules/agents/json-config/agent-config-composition.js.map +1 -1
  103. package/dist/modules/agents/json-config/from-json-config.d.ts +1 -2
  104. package/dist/modules/agents/json-config/from-json-config.js +31 -34
  105. package/dist/modules/agents/json-config/from-json-config.js.map +1 -1
  106. package/dist/modules/agents/observation-log-observer.d.ts +2 -0
  107. package/dist/modules/agents/observation-log-observer.js +10 -0
  108. package/dist/modules/agents/observation-log-observer.js.map +1 -0
  109. package/dist/modules/agents/observation-log-reflector.d.ts +2 -0
  110. package/dist/modules/agents/observation-log-reflector.js +9 -0
  111. package/dist/modules/agents/observation-log-reflector.js.map +1 -0
  112. package/dist/modules/agents/repositories/agent-published-version.repository.d.ts +1 -1
  113. package/dist/modules/agents/repositories/agent.repository.js +1 -1
  114. package/dist/modules/agents/repositories/agent.repository.js.map +1 -1
  115. package/dist/modules/agents/tools/node-tool-factory.d.ts +1 -1
  116. package/dist/modules/agents/tools/workflow-tool-factory.d.ts +1 -1
  117. package/dist/modules/agents/tools/workflow-tool-factory.js +40 -2
  118. package/dist/modules/agents/tools/workflow-tool-factory.js.map +1 -1
  119. package/dist/modules/agents/utils/execution-to-message-mapper.d.ts +6 -0
  120. package/dist/modules/agents/utils/execution-to-message-mapper.js +133 -0
  121. package/dist/modules/agents/utils/execution-to-message-mapper.js.map +1 -0
  122. package/dist/modules/chat-hub/chat-hub-workflow.service.js +9 -0
  123. package/dist/modules/chat-hub/chat-hub-workflow.service.js.map +1 -1
  124. package/dist/modules/chat-hub/chat-hub.constants.js +4 -0
  125. package/dist/modules/chat-hub/chat-hub.constants.js.map +1 -1
  126. package/dist/modules/chat-hub/chat-hub.models.service.d.ts +1 -0
  127. package/dist/modules/chat-hub/chat-hub.models.service.js +43 -0
  128. package/dist/modules/chat-hub/chat-hub.models.service.js.map +1 -1
  129. package/dist/modules/chat-hub/chat-hub.module.d.ts +3 -3
  130. package/dist/modules/chat-hub/chat-hub.settings.controller.d.ts +7 -7
  131. package/dist/modules/chat-hub/context-limits.js +1 -0
  132. package/dist/modules/chat-hub/context-limits.js.map +1 -1
  133. package/dist/modules/chat-hub/dto/chat-models-request.dto.d.ts +2 -2
  134. package/dist/modules/community-packages/community-node-types-utils.d.ts +1 -1
  135. package/dist/modules/community-packages/community-node-types-utils.js +1 -1
  136. package/dist/modules/community-packages/community-node-types-utils.js.map +1 -1
  137. package/dist/modules/community-packages/community-node-types.service.js +1 -1
  138. package/dist/modules/community-packages/community-node-types.service.js.map +1 -1
  139. package/dist/modules/data-table/utils/sql-utils.d.ts +2 -0
  140. package/dist/modules/data-table/utils/sql-utils.js +26 -9
  141. package/dist/modules/data-table/utils/sql-utils.js.map +1 -1
  142. package/dist/modules/inbound-secrets/inbound-secrets-context-hook.d.ts +10 -0
  143. package/dist/modules/inbound-secrets/inbound-secrets-context-hook.js +55 -0
  144. package/dist/modules/inbound-secrets/inbound-secrets-context-hook.js.map +1 -0
  145. package/dist/modules/inbound-secrets/inbound-secrets.config.d.ts +3 -0
  146. package/dist/modules/inbound-secrets/inbound-secrets.config.js +27 -0
  147. package/dist/modules/inbound-secrets/inbound-secrets.config.js.map +1 -0
  148. package/dist/modules/inbound-secrets/inbound-secrets.module.d.ts +4 -0
  149. package/dist/modules/inbound-secrets/inbound-secrets.module.js +61 -0
  150. package/dist/modules/inbound-secrets/inbound-secrets.module.js.map +1 -0
  151. package/dist/modules/inbound-secrets/inbound-secrets.schemas.d.ts +3 -0
  152. package/dist/modules/inbound-secrets/inbound-secrets.schemas.js +6 -0
  153. package/dist/modules/inbound-secrets/inbound-secrets.schemas.js.map +1 -0
  154. package/dist/modules/inbound-secrets/inbound-secrets.service.d.ts +17 -0
  155. package/dist/modules/inbound-secrets/inbound-secrets.service.js +76 -0
  156. package/dist/modules/inbound-secrets/inbound-secrets.service.js.map +1 -0
  157. package/dist/modules/inbound-secrets/path-traversal.d.ts +4 -0
  158. package/dist/modules/inbound-secrets/path-traversal.js +51 -0
  159. package/dist/modules/inbound-secrets/path-traversal.js.map +1 -0
  160. package/dist/modules/insights/database/repositories/insights-by-period.repository.d.ts +1 -0
  161. package/dist/modules/insights/database/repositories/insights-by-period.repository.js +19 -4
  162. package/dist/modules/insights/database/repositories/insights-by-period.repository.js.map +1 -1
  163. package/dist/modules/insights/database/repositories/insights-raw.repository.js +1 -0
  164. package/dist/modules/insights/database/repositories/insights-raw.repository.js.map +1 -1
  165. package/dist/modules/insights/insights-compaction.service.d.ts +5 -0
  166. package/dist/modules/insights/insights-compaction.service.js +93 -18
  167. package/dist/modules/insights/insights-compaction.service.js.map +1 -1
  168. package/dist/modules/insights/insights.config.d.ts +3 -0
  169. package/dist/modules/insights/insights.config.js +15 -0
  170. package/dist/modules/insights/insights.config.js.map +1 -1
  171. package/dist/modules/instance-ai/eval/eval-mocked-credentials-helper.d.ts +17 -0
  172. package/dist/modules/instance-ai/eval/eval-mocked-credentials-helper.js +61 -0
  173. package/dist/modules/instance-ai/eval/eval-mocked-credentials-helper.js.map +1 -0
  174. package/dist/modules/instance-ai/eval/execution.service.js +8 -2
  175. package/dist/modules/instance-ai/eval/execution.service.js.map +1 -1
  176. package/dist/modules/instance-ai/eval/mock-handler.d.ts +1 -0
  177. package/dist/modules/instance-ai/eval/mock-handler.js +116 -72
  178. package/dist/modules/instance-ai/eval/mock-handler.js.map +1 -1
  179. package/dist/modules/instance-ai/eval/mock-quirks.d.ts +10 -0
  180. package/dist/modules/instance-ai/eval/mock-quirks.js +25 -0
  181. package/dist/modules/instance-ai/eval/mock-quirks.js.map +1 -0
  182. package/dist/modules/instance-ai/instance-ai-settings.service.js +14 -0
  183. package/dist/modules/instance-ai/instance-ai-settings.service.js.map +1 -1
  184. package/dist/modules/instance-ai/instance-ai.adapter.service.js +25 -5
  185. package/dist/modules/instance-ai/instance-ai.adapter.service.js.map +1 -1
  186. package/dist/modules/instance-ai/instance-ai.controller.d.ts +10 -3
  187. package/dist/modules/instance-ai/instance-ai.controller.js +34 -2
  188. package/dist/modules/instance-ai/instance-ai.controller.js.map +1 -1
  189. package/dist/modules/instance-ai/instance-ai.service.d.ts +2 -1
  190. package/dist/modules/instance-ai/instance-ai.service.js +75 -29
  191. package/dist/modules/instance-ai/instance-ai.service.js.map +1 -1
  192. package/dist/modules/instance-ai/liveness/index.d.ts +1 -1
  193. package/dist/modules/instance-ai/liveness/index.js.map +1 -1
  194. package/dist/modules/instance-ai/liveness/instance-ai-liveness.service.d.ts +12 -3
  195. package/dist/modules/instance-ai/liveness/instance-ai-liveness.service.js +21 -11
  196. package/dist/modules/instance-ai/liveness/instance-ai-liveness.service.js.map +1 -1
  197. package/dist/modules/instance-ai/run-timeout-details.d.ts +8 -0
  198. package/dist/modules/instance-ai/run-timeout-details.js +3 -0
  199. package/dist/modules/instance-ai/run-timeout-details.js.map +1 -0
  200. package/dist/modules/instance-ai/run-trace-metadata.d.ts +15 -0
  201. package/dist/modules/instance-ai/run-trace-metadata.js +63 -0
  202. package/dist/modules/instance-ai/run-trace-metadata.js.map +1 -0
  203. package/dist/modules/instance-version-history/instance-version-history.controller.d.ts +5 -3
  204. package/dist/modules/instance-version-history/instance-version-history.controller.js +9 -9
  205. package/dist/modules/instance-version-history/instance-version-history.controller.js.map +1 -1
  206. package/dist/modules/mcp/mcp-api-key.service.js +1 -0
  207. package/dist/modules/mcp/mcp-api-key.service.js.map +1 -1
  208. package/dist/modules/mcp/mcp-oauth-token.service.d.ts +7 -2
  209. package/dist/modules/mcp/mcp-oauth-token.service.js +16 -6
  210. package/dist/modules/mcp/mcp-oauth-token.service.js.map +1 -1
  211. package/dist/modules/mcp/mcp-server-middleware.service.js +2 -0
  212. package/dist/modules/mcp/mcp-server-middleware.service.js.map +1 -1
  213. package/dist/modules/mcp/mcp.controller.js +1 -0
  214. package/dist/modules/mcp/mcp.controller.js.map +1 -1
  215. package/dist/modules/mcp/mcp.types.d.ts +2 -0
  216. package/dist/modules/mcp/tools/workflow-builder/credential-validation.d.ts +15 -0
  217. package/dist/modules/mcp/tools/workflow-builder/credential-validation.js +91 -0
  218. package/dist/modules/mcp/tools/workflow-builder/credential-validation.js.map +1 -0
  219. package/dist/modules/mcp/tools/workflow-builder/mcp-instructions.js +1 -1
  220. package/dist/modules/mcp/tools/workflow-builder/update-workflow.tool.d.ts +228 -3
  221. package/dist/modules/mcp/tools/workflow-builder/update-workflow.tool.js +74 -60
  222. package/dist/modules/mcp/tools/workflow-builder/update-workflow.tool.js.map +1 -1
  223. package/dist/modules/mcp/tools/workflow-builder/workflow-operations.d.ts +251 -0
  224. package/dist/modules/mcp/tools/workflow-builder/workflow-operations.js +447 -0
  225. package/dist/modules/mcp/tools/workflow-builder/workflow-operations.js.map +1 -0
  226. package/dist/modules/mcp-registry/mcp-registry-node-loader.d.ts +4 -3
  227. package/dist/modules/mcp-registry/mcp-registry-node-loader.js +6 -3
  228. package/dist/modules/mcp-registry/mcp-registry-node-loader.js.map +1 -1
  229. package/dist/modules/mcp-registry/mcp-registry-test.controller.d.ts +12 -0
  230. package/dist/modules/mcp-registry/mcp-registry-test.controller.js +49 -0
  231. package/dist/modules/mcp-registry/mcp-registry-test.controller.js.map +1 -0
  232. package/dist/modules/mcp-registry/mcp-registry.module.d.ts +2 -0
  233. package/dist/modules/mcp-registry/mcp-registry.module.js +12 -2
  234. package/dist/modules/mcp-registry/mcp-registry.module.js.map +1 -1
  235. package/dist/modules/mcp-registry/node-description-transform.js +16 -2
  236. package/dist/modules/mcp-registry/node-description-transform.js.map +1 -1
  237. package/dist/modules/mcp-registry/registry/mcp-registry-api.client.d.ts +8 -0
  238. package/dist/modules/mcp-registry/registry/mcp-registry-api.client.js +58 -0
  239. package/dist/modules/mcp-registry/registry/mcp-registry-api.client.js.map +1 -0
  240. package/dist/modules/mcp-registry/registry/mcp-registry-server.entity.d.ts +36 -0
  241. package/dist/modules/mcp-registry/registry/mcp-registry-server.entity.js +46 -0
  242. package/dist/modules/mcp-registry/registry/mcp-registry-server.entity.js.map +1 -0
  243. package/dist/modules/mcp-registry/registry/mcp-registry-server.repository.d.ts +5 -0
  244. package/dist/modules/mcp-registry/registry/mcp-registry-server.repository.js +26 -0
  245. package/dist/modules/mcp-registry/registry/mcp-registry-server.repository.js.map +1 -0
  246. package/dist/modules/mcp-registry/registry/mcp-registry.service.d.ts +37 -4
  247. package/dist/modules/mcp-registry/registry/mcp-registry.service.js +196 -12
  248. package/dist/modules/mcp-registry/registry/mcp-registry.service.js.map +1 -1
  249. package/dist/modules/mcp-registry/registry/mcp-registry.types.d.ts +9 -1
  250. package/dist/modules/mcp-registry/registry/mcp-registry.types.js +29 -0
  251. package/dist/modules/mcp-registry/registry/mcp-registry.types.js.map +1 -1
  252. package/dist/modules/mcp-registry/registry/mock-servers.js +2 -0
  253. package/dist/modules/mcp-registry/registry/mock-servers.js.map +1 -1
  254. package/dist/modules/otel/execution-level-tracer.js +4 -2
  255. package/dist/modules/otel/execution-level-tracer.js.map +1 -1
  256. package/dist/modules/otel/otel.constants.d.ts +1 -0
  257. package/dist/modules/otel/otel.constants.js +1 -0
  258. package/dist/modules/otel/otel.constants.js.map +1 -1
  259. package/dist/modules/otel/otel.module.d.ts +3 -0
  260. package/dist/modules/otel/otel.module.js +5 -0
  261. package/dist/modules/otel/otel.module.js.map +1 -1
  262. package/dist/modules/redaction/executions/execution-redaction.service.js +8 -3
  263. package/dist/modules/redaction/executions/execution-redaction.service.js.map +1 -1
  264. package/dist/modules/redaction/instance-redaction-enforcement.service.d.ts +14 -0
  265. package/dist/modules/redaction/instance-redaction-enforcement.service.js +91 -0
  266. package/dist/modules/redaction/instance-redaction-enforcement.service.js.map +1 -0
  267. package/dist/modules/redaction/redaction-enforcement.feature-flag.d.ts +2 -0
  268. package/dist/modules/redaction/redaction-enforcement.feature-flag.js +9 -0
  269. package/dist/modules/redaction/redaction-enforcement.feature-flag.js.map +1 -0
  270. package/dist/modules/redaction/redaction-enforcement.service.d.ts +8 -0
  271. package/dist/modules/redaction/redaction-enforcement.service.js +38 -0
  272. package/dist/modules/redaction/redaction-enforcement.service.js.map +1 -0
  273. package/dist/modules/redaction/redaction.config.d.ts +3 -0
  274. package/dist/modules/redaction/redaction.config.js +27 -0
  275. package/dist/modules/redaction/redaction.config.js.map +1 -0
  276. package/dist/modules/source-control.ee/source-control-import.service.ee.d.ts +3 -1
  277. package/dist/modules/source-control.ee/source-control-import.service.ee.js +14 -6
  278. package/dist/modules/source-control.ee/source-control-import.service.ee.js.map +1 -1
  279. package/dist/modules/source-control.ee/source-control.controller.ee.d.ts +2 -2
  280. package/dist/modules/source-control.ee/source-control.service.ee.d.ts +1 -1
  281. package/dist/modules/workflow-index/workflow-index.service.js.map +1 -1
  282. package/dist/oauth/oauth.service.js +1 -0
  283. package/dist/oauth/oauth.service.js.map +1 -1
  284. package/dist/posthog/index.d.ts +0 -1
  285. package/dist/posthog/index.js +2 -10
  286. package/dist/posthog/index.js.map +1 -1
  287. package/dist/public-api/v1/handlers/workflows/workflows.handler.js +2 -1
  288. package/dist/public-api/v1/handlers/workflows/workflows.handler.js.map +1 -1
  289. package/dist/scaling/constants.d.ts +2 -2
  290. package/dist/scaling/pubsub/pubsub.event-map.d.ts +6 -3
  291. package/dist/scaling/pubsub/pubsub.types.d.ts +3 -1
  292. package/dist/scaling/scaling.service.js +3 -2
  293. package/dist/scaling/scaling.service.js.map +1 -1
  294. package/dist/server.d.ts +1 -0
  295. package/dist/server.js +1 -0
  296. package/dist/server.js.map +1 -1
  297. package/dist/services/export.service.d.ts +6 -1
  298. package/dist/services/export.service.js +97 -1
  299. package/dist/services/export.service.js.map +1 -1
  300. package/dist/services/frontend.service.js +3 -1
  301. package/dist/services/frontend.service.js.map +1 -1
  302. package/dist/services/import.service.d.ts +2 -1
  303. package/dist/services/import.service.js +70 -22
  304. package/dist/services/import.service.js.map +1 -1
  305. package/dist/telemetry/index.d.ts +13 -1
  306. package/dist/telemetry/index.js +54 -18
  307. package/dist/telemetry/index.js.map +1 -1
  308. package/dist/{modules/community-packages → utils}/strapi-utils.js +2 -2
  309. package/dist/utils/strapi-utils.js.map +1 -0
  310. package/dist/workflows/workflow-history/workflow-history.controller.d.ts +9 -0
  311. package/dist/workflows/workflow-history/workflow-history.controller.js +17 -0
  312. package/dist/workflows/workflow-history/workflow-history.controller.js.map +1 -1
  313. package/dist/workflows/workflow-history/workflow-history.service.d.ts +16 -2
  314. package/dist/workflows/workflow-history/workflow-history.service.js +55 -1
  315. package/dist/workflows/workflow-history/workflow-history.service.js.map +1 -1
  316. package/dist/workflows/workflow.service.d.ts +3 -1
  317. package/dist/workflows/workflow.service.js +6 -2
  318. package/dist/workflows/workflow.service.js.map +1 -1
  319. package/package.json +37 -37
  320. package/dist/modules/agents/json-config/agent-json-config.d.ts +0 -1022
  321. package/dist/modules/agents/json-config/agent-json-config.js +0 -128
  322. package/dist/modules/agents/json-config/agent-json-config.js.map +0 -1
  323. package/dist/modules/agents/json-config/integration-config.d.ts +0 -61
  324. package/dist/modules/agents/json-config/integration-config.js +0 -33
  325. package/dist/modules/agents/json-config/integration-config.js.map +0 -1
  326. package/dist/modules/community-packages/strapi-utils.js.map +0 -1
  327. package/dist/modules/mcp-registry/mcp-registry-node-loader.test.d.ts +0 -1
  328. package/dist/modules/mcp-registry/mcp-registry-node-loader.test.js +0 -244
  329. package/dist/modules/mcp-registry/mcp-registry-node-loader.test.js.map +0 -1
  330. package/dist/modules/mcp-registry/node-description-transform.test.d.ts +0 -1
  331. package/dist/modules/mcp-registry/node-description-transform.test.js +0 -286
  332. package/dist/modules/mcp-registry/node-description-transform.test.js.map +0 -1
  333. package/dist/modules/mcp-registry/registry/mcp-registry.service.test.d.ts +0 -1
  334. package/dist/modules/mcp-registry/registry/mcp-registry.service.test.js +0 -41
  335. package/dist/modules/mcp-registry/registry/mcp-registry.service.test.js.map +0 -1
  336. /package/dist/{modules/community-packages → utils}/strapi-utils.d.ts +0 -0
@@ -1,11 +1,19 @@
1
- import type { AgentDbMessage, BuiltMemory, BuiltObservationStore, MemoryDescriptor, NewObservation, Observation, ObservationCursor, ObservationLockHandle, ScopeKind, Thread } from '@n8n/agents';
1
+ import { type AgentDbMessage, type BuiltMemory, type BuiltObservationLogStore, type MemoryDescriptor, type NewObservationLogEntry, type ObservationCursor, type ObservationLogEntry, type ObservationLogReadOptions, type ObservationLogReflection, type ObservationLogReflectionResult, type ObservationLogScope, type ObservationLogScopeKind, type Thread } from '@n8n/agents';
2
2
  import { AgentMessageRepository } from '../repositories/agent-message.repository';
3
3
  import { AgentObservationCursorRepository } from '../repositories/agent-observation-cursor.repository';
4
4
  import { AgentObservationLockRepository } from '../repositories/agent-observation-lock.repository';
5
5
  import { AgentObservationRepository } from '../repositories/agent-observation.repository';
6
6
  import { AgentResourceRepository } from '../repositories/agent-resource.repository';
7
7
  import { AgentThreadRepository } from '../repositories/agent-thread.repository';
8
- export declare class N8nMemory implements BuiltMemory, BuiltObservationStore {
8
+ type ObservationLogTaskKind = 'observer' | 'reflector';
9
+ interface ObservationLogTaskLockHandle {
10
+ scopeKind: ObservationLogScopeKind;
11
+ scopeId: string;
12
+ taskKind: ObservationLogTaskKind;
13
+ holderId: string;
14
+ heldUntil: Date;
15
+ }
16
+ export declare class N8nMemory implements BuiltMemory, BuiltObservationLogStore {
9
17
  private readonly threadRepository;
10
18
  private readonly messageRepository;
11
19
  private readonly resourceRepository;
@@ -30,47 +38,35 @@ export declare class N8nMemory implements BuiltMemory, BuiltObservationStore {
30
38
  }): Promise<void>;
31
39
  deleteMessages(messageIds: string[]): Promise<void>;
32
40
  deleteMessagesByThread(threadId: string, resourceId?: string): Promise<void>;
33
- getWorkingMemory(params: {
34
- threadId: string;
35
- resourceId: string;
36
- scope: 'resource' | 'thread';
37
- }): Promise<string | null>;
38
- saveWorkingMemory(params: {
39
- threadId: string;
40
- resourceId: string;
41
- scope: 'resource' | 'thread';
42
- }, content: string): Promise<void>;
43
- appendObservations(rows: NewObservation[]): Promise<Observation[]>;
44
- getObservations(opts: {
45
- scopeKind: ScopeKind;
46
- scopeId: string;
47
- since?: {
48
- sinceCreatedAt: Date;
49
- sinceObservationId: string;
50
- };
51
- kindIs?: string;
41
+ appendObservationLogEntries(rows: NewObservationLogEntry[]): Promise<ObservationLogEntry[]>;
42
+ getActiveObservationLog(scope: ObservationLogScope & {
52
43
  limit?: number;
53
- schemaVersionAtMost?: number;
54
- }): Promise<Observation[]>;
55
- getMessagesForScope(scopeKind: ScopeKind, scopeId: string, opts?: {
44
+ order?: 'asc' | 'desc';
45
+ }): Promise<ObservationLogEntry[]>;
46
+ getObservationLog(opts: ObservationLogReadOptions): Promise<ObservationLogEntry[]>;
47
+ getMessagesForScope(scopeKind: ObservationLogScopeKind, scopeId: string, opts?: {
56
48
  since?: {
57
49
  sinceCreatedAt: Date;
58
50
  sinceMessageId: string;
59
51
  };
52
+ resourceId?: string;
60
53
  }): Promise<AgentDbMessage[]>;
61
- deleteObservations(ids: string[]): Promise<void>;
62
- getCursor(scopeKind: ScopeKind, scopeId: string): Promise<ObservationCursor | null>;
63
- setCursor(cursor: ObservationCursor): Promise<void>;
64
- acquireObservationLock(scopeKind: ScopeKind, scopeId: string, opts: {
54
+ dropObservationLogEntries(ids: string[]): Promise<void>;
55
+ supersedeObservationLogEntries(ids: string[], supersededBy: string): Promise<void>;
56
+ applyObservationLogReflection(scope: ObservationLogScope, reflection: ObservationLogReflection): Promise<ObservationLogReflectionResult>;
57
+ getCursor(scopeKind: ObservationLogScopeKind, scopeId: string): Promise<ObservationCursor | null>;
58
+ setCursor(cursor: ObservationCursor & {
59
+ scopeKind: ObservationLogScopeKind;
60
+ }): Promise<void>;
61
+ acquireObservationLogTaskLock(scopeKind: ObservationLogScopeKind, scopeId: string, taskKind: ObservationLogTaskKind, opts: {
65
62
  ttlMs: number;
66
63
  holderId: string;
67
- }): Promise<ObservationLockHandle | null>;
68
- releaseObservationLock(handle: ObservationLockHandle): Promise<void>;
64
+ }): Promise<ObservationLogTaskLockHandle | null>;
65
+ releaseObservationLogTaskLock(handle: ObservationLogTaskLockHandle): Promise<void>;
66
+ private releaseScopeLock;
69
67
  describe(): MemoryDescriptor;
70
- private toObservation;
68
+ private toAgentDbMessage;
69
+ private toObservationLogEntry;
71
70
  private toThread;
72
- private extractWorkingMemory;
73
- private mergeWorkingMemory;
74
- private upsertResourceMetadata;
75
- private upsertThreadMetadata;
76
71
  }
72
+ export {};
@@ -10,6 +10,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.N8nMemory = void 0;
13
+ const agents_1 = require("@n8n/agents");
13
14
  const di_1 = require("@n8n/di");
14
15
  const typeorm_1 = require("@n8n/typeorm");
15
16
  const n8n_workflow_1 = require("n8n-workflow");
@@ -23,7 +24,7 @@ const agent_observation_lock_repository_1 = require("../repositories/agent-obser
23
24
  const agent_observation_repository_1 = require("../repositories/agent-observation.repository");
24
25
  const agent_resource_repository_1 = require("../repositories/agent-resource.repository");
25
26
  const agent_thread_repository_1 = require("../repositories/agent-thread.repository");
26
- const WORKING_MEMORY_KEY = 'workingMemory';
27
+ const estimateObservationTokens = (text) => Math.ceil(text.length / 4);
27
28
  let N8nMemory = class N8nMemory {
28
29
  constructor(threadRepository, messageRepository, resourceRepository, observationRepository, observationCursorRepository, observationLockRepository) {
29
30
  this.threadRepository = threadRepository;
@@ -68,20 +69,31 @@ let N8nMemory = class N8nMemory {
68
69
  }
69
70
  async deleteThread(threadId) {
70
71
  await this.threadRepository.manager.transaction(async (trx) => {
71
- const scope = { scopeKind: 'thread', scopeId: threadId };
72
- await trx.delete(agent_observation_entity_1.AgentObservationEntity, scope);
73
- await trx.delete(agent_observation_cursor_entity_1.AgentObservationCursorEntity, scope);
74
- await trx.delete(agent_observation_lock_entity_1.AgentObservationLockEntity, scope);
72
+ const legacyScope = { scopeKind: 'thread', scopeId: threadId };
73
+ const resourceScope = {
74
+ scopeKind: 'thread',
75
+ scopeId: (0, typeorm_1.Like)(`${(0, agents_1.createObservationLogThreadScopePrefix)(threadId)}%`),
76
+ };
77
+ for (const scope of [legacyScope, resourceScope]) {
78
+ await trx.delete(agent_observation_entity_1.AgentObservationEntity, scope);
79
+ await trx.delete(agent_observation_cursor_entity_1.AgentObservationCursorEntity, scope);
80
+ await trx.delete(agent_observation_lock_entity_1.AgentObservationLockEntity, scope);
81
+ }
75
82
  await trx.delete(agent_thread_entity_1.AgentThreadEntity, { id: threadId });
76
83
  });
77
84
  }
78
85
  async deleteThreadsByPrefix(threadIdPrefix) {
79
86
  const scopeId = (0, typeorm_1.Like)(`${threadIdPrefix}%`);
87
+ const resourceScopeId = (0, typeorm_1.Like)(`${(0, agents_1.createObservationLogThreadScopePrefix)(threadIdPrefix)}%`);
80
88
  await this.threadRepository.manager.transaction(async (trx) => {
81
- const scope = { scopeKind: 'thread', scopeId };
82
- await trx.delete(agent_observation_entity_1.AgentObservationEntity, scope);
83
- await trx.delete(agent_observation_cursor_entity_1.AgentObservationCursorEntity, scope);
84
- await trx.delete(agent_observation_lock_entity_1.AgentObservationLockEntity, scope);
89
+ for (const scope of [
90
+ { scopeKind: 'thread', scopeId },
91
+ { scopeKind: 'thread', scopeId: resourceScopeId },
92
+ ]) {
93
+ await trx.delete(agent_observation_entity_1.AgentObservationEntity, scope);
94
+ await trx.delete(agent_observation_cursor_entity_1.AgentObservationCursorEntity, scope);
95
+ await trx.delete(agent_observation_lock_entity_1.AgentObservationLockEntity, scope);
96
+ }
85
97
  await trx.delete(agent_thread_entity_1.AgentThreadEntity, { id: scopeId });
86
98
  });
87
99
  }
@@ -99,11 +111,7 @@ let N8nMemory = class N8nMemory {
99
111
  if (opts?.limit !== undefined) {
100
112
  entities.reverse();
101
113
  }
102
- return entities.map((e) => {
103
- const msg = e.content;
104
- msg.id = e.id;
105
- return msg;
106
- });
114
+ return entities.map((e) => this.toAgentDbMessage(e));
107
115
  }
108
116
  async saveMessages(args) {
109
117
  if (args.messages.length === 0)
@@ -136,68 +144,51 @@ let N8nMemory = class N8nMemory {
136
144
  ...(resourceId !== undefined && { resourceId }),
137
145
  });
138
146
  }
139
- async getWorkingMemory(params) {
140
- if (params.scope === 'resource') {
141
- const resource = await this.resourceRepository.findOneBy({ id: params.resourceId });
142
- return this.extractWorkingMemory(resource?.metadata ?? null);
143
- }
144
- const thread = await this.threadRepository.findOneBy({ id: params.threadId });
145
- return this.extractWorkingMemory(thread?.metadata ?? null);
146
- }
147
- async saveWorkingMemory(params, content) {
148
- if (params.scope === 'resource') {
149
- await this.upsertResourceMetadata(params.resourceId, content);
150
- }
151
- else {
152
- await this.upsertThreadMetadata(params.threadId, params.resourceId, content);
153
- }
154
- }
155
- async appendObservations(rows) {
147
+ async appendObservationLogEntries(rows) {
156
148
  if (rows.length === 0)
157
149
  return [];
158
150
  const entities = rows.map((row) => this.observationRepository.create({
159
151
  scopeKind: row.scopeKind,
160
152
  scopeId: row.scopeId,
161
- kind: row.kind,
162
- payload: row.payload,
163
- durationMs: row.durationMs,
164
- schemaVersion: row.schemaVersion,
153
+ marker: row.marker,
154
+ text: row.text,
155
+ parentId: row.parentId ?? null,
156
+ tokenCount: row.tokenCount ?? estimateObservationTokens(row.text),
157
+ status: 'active',
158
+ supersededBy: null,
165
159
  createdAt: row.createdAt,
166
160
  }));
167
161
  const saved = await this.observationRepository.save(entities);
168
- return saved.map((e) => this.toObservation(e));
162
+ return saved.map((e) => this.toObservationLogEntry(e));
163
+ }
164
+ async getActiveObservationLog(scope) {
165
+ return await this.getObservationLog({ ...scope, status: 'active' });
169
166
  }
170
- async getObservations(opts) {
167
+ async getObservationLog(opts) {
171
168
  const baseWhere = {
172
169
  scopeKind: opts.scopeKind,
173
170
  scopeId: opts.scopeId,
174
- ...(opts.kindIs !== undefined && { kind: opts.kindIs }),
175
- ...(opts.schemaVersionAtMost !== undefined && {
176
- schemaVersion: (0, typeorm_1.LessThanOrEqual)(opts.schemaVersionAtMost),
177
- }),
171
+ ...(opts.status !== undefined && { status: opts.status }),
172
+ ...(opts.parentId !== undefined && { parentId: opts.parentId ?? (0, typeorm_1.IsNull)() }),
178
173
  };
179
- const where = opts.since
180
- ? [
181
- { ...baseWhere, createdAt: (0, typeorm_1.MoreThan)(opts.since.sinceCreatedAt) },
182
- {
183
- ...baseWhere,
184
- createdAt: (0, typeorm_1.Equal)(opts.since.sinceCreatedAt),
185
- id: (0, typeorm_1.MoreThan)(opts.since.sinceObservationId),
186
- },
187
- ]
188
- : [baseWhere];
189
174
  const entities = await this.observationRepository.find({
190
- where,
191
- order: { createdAt: 'ASC', id: 'ASC' },
175
+ where: [baseWhere],
176
+ order: {
177
+ createdAt: opts.order === 'desc' ? 'DESC' : 'ASC',
178
+ id: opts.order === 'desc' ? 'DESC' : 'ASC',
179
+ },
192
180
  ...(opts.limit !== undefined && { take: opts.limit }),
193
181
  });
194
- return entities.map((e) => this.toObservation(e));
182
+ return entities.map((e) => this.toObservationLogEntry(e));
195
183
  }
196
184
  async getMessagesForScope(scopeKind, scopeId, opts) {
197
185
  if (scopeKind !== 'thread') {
198
186
  throw new n8n_workflow_1.UnexpectedError(`getMessagesForScope: scopeKind='${scopeKind}' is not supported in observational memory v1`);
199
187
  }
200
- const baseWhere = { threadId: scopeId };
188
+ const baseWhere = {
189
+ threadId: scopeId,
190
+ ...(opts?.resourceId !== undefined && { resourceId: opts.resourceId }),
191
+ };
201
192
  const where = opts?.since
202
193
  ? [
203
194
  { ...baseWhere, createdAt: (0, typeorm_1.MoreThan)(opts.since.sinceCreatedAt) },
@@ -212,16 +203,58 @@ let N8nMemory = class N8nMemory {
212
203
  where,
213
204
  order: { createdAt: 'ASC', id: 'ASC' },
214
205
  });
215
- return entities.map((e) => {
216
- const msg = e.content;
217
- msg.id = e.id;
218
- return msg;
219
- });
206
+ return entities.map((e) => this.toAgentDbMessage(e));
220
207
  }
221
- async deleteObservations(ids) {
208
+ async dropObservationLogEntries(ids) {
222
209
  if (ids.length === 0)
223
210
  return;
224
- await this.observationRepository.delete({ id: (0, typeorm_1.In)(ids) });
211
+ await this.observationRepository.update({ id: (0, typeorm_1.In)(ids) }, { status: 'dropped', supersededBy: null });
212
+ }
213
+ async supersedeObservationLogEntries(ids, supersededBy) {
214
+ if (ids.length === 0)
215
+ return;
216
+ await this.observationRepository.update({ id: (0, typeorm_1.In)(ids) }, { status: 'superseded', supersededBy });
217
+ }
218
+ async applyObservationLogReflection(scope, reflection) {
219
+ return await this.observationRepository.manager.transaction(async (trx) => {
220
+ const repo = trx.getRepository(agent_observation_entity_1.AgentObservationEntity);
221
+ const activeEntries = await repo.find({
222
+ where: {
223
+ scopeKind: scope.scopeKind,
224
+ scopeId: scope.scopeId,
225
+ status: 'active',
226
+ },
227
+ order: { createdAt: 'ASC', id: 'ASC' },
228
+ });
229
+ const normalized = (0, agents_1.normalizeObservationLogReflection)(activeEntries.map((entry) => this.toObservationLogEntry(entry)), reflection);
230
+ const inserted = normalized.merge.length
231
+ ? await repo.save(normalized.merge.map((entry) => repo.create({
232
+ scopeKind: scope.scopeKind,
233
+ scopeId: scope.scopeId,
234
+ marker: entry.marker,
235
+ text: entry.text,
236
+ parentId: entry.parentId ?? null,
237
+ tokenCount: entry.tokenCount ?? estimateObservationTokens(entry.text),
238
+ status: 'active',
239
+ supersededBy: null,
240
+ createdAt: entry.createdAt,
241
+ })))
242
+ : [];
243
+ if (normalized.drop.length > 0) {
244
+ await repo.update({ scopeKind: scope.scopeKind, scopeId: scope.scopeId, id: (0, typeorm_1.In)(normalized.drop) }, { status: 'dropped', supersededBy: null });
245
+ }
246
+ for (const [index, merge] of normalized.merge.entries()) {
247
+ const replacement = inserted[index];
248
+ if (replacement && merge.supersedes.length > 0) {
249
+ await repo.update({ scopeKind: scope.scopeKind, scopeId: scope.scopeId, id: (0, typeorm_1.In)(merge.supersedes) }, { status: 'superseded', supersededBy: replacement.id });
250
+ }
251
+ }
252
+ return {
253
+ droppedIds: [...normalized.drop],
254
+ supersededIds: normalized.merge.flatMap((entry) => entry.supersedes),
255
+ inserted: inserted.map((entry) => this.toObservationLogEntry(entry)),
256
+ };
257
+ });
225
258
  }
226
259
  async getCursor(scopeKind, scopeId) {
227
260
  const entity = await this.observationCursorRepository.findOneBy({ scopeKind, scopeId });
@@ -244,56 +277,70 @@ let N8nMemory = class N8nMemory {
244
277
  updatedAt: cursor.updatedAt,
245
278
  }, { conflictPaths: ['scopeKind', 'scopeId'], skipUpdateIfNoValuesChanged: false });
246
279
  }
247
- async acquireObservationLock(scopeKind, scopeId, opts) {
280
+ async acquireObservationLogTaskLock(scopeKind, scopeId, taskKind, opts) {
248
281
  const now = new Date();
249
282
  const heldUntil = new Date(now.getTime() + opts.ttlMs);
250
283
  const updateResult = await this.observationLockRepository
251
284
  .createQueryBuilder()
252
285
  .update(agent_observation_lock_entity_1.AgentObservationLockEntity)
253
- .set({ holderId: opts.holderId, heldUntil })
286
+ .set({ taskKind, holderId: opts.holderId, heldUntil })
254
287
  .where('"scopeKind" = :scopeKind')
255
288
  .andWhere('"scopeId" = :scopeId')
289
+ .andWhere('"taskKind" = :taskKind')
256
290
  .andWhere('("holderId" = :holderId OR "heldUntil" <= :now)')
257
- .setParameters({ scopeKind, scopeId, holderId: opts.holderId, now })
291
+ .setParameters({ scopeKind, scopeId, taskKind, holderId: opts.holderId, now })
258
292
  .execute();
259
293
  if ((updateResult.affected ?? 0) > 0) {
260
- return { scopeKind, scopeId, holderId: opts.holderId, heldUntil };
294
+ return { scopeKind, scopeId, taskKind, holderId: opts.holderId, heldUntil };
261
295
  }
262
296
  await this.observationLockRepository
263
297
  .createQueryBuilder()
264
298
  .insert()
265
299
  .into(agent_observation_lock_entity_1.AgentObservationLockEntity)
266
- .values({ scopeKind, scopeId, holderId: opts.holderId, heldUntil })
300
+ .values({ scopeKind, scopeId, taskKind, holderId: opts.holderId, heldUntil })
267
301
  .orIgnore()
268
302
  .execute();
269
303
  const claimed = await this.observationLockRepository.findOneBy({
270
304
  scopeKind,
271
305
  scopeId,
306
+ taskKind,
272
307
  holderId: opts.holderId,
273
308
  });
274
309
  if (!claimed)
275
310
  return null;
276
- return { scopeKind, scopeId, holderId: opts.holderId, heldUntil };
311
+ return { scopeKind, scopeId, taskKind, holderId: opts.holderId, heldUntil };
277
312
  }
278
- async releaseObservationLock(handle) {
313
+ async releaseObservationLogTaskLock(handle) {
314
+ await this.releaseScopeLock(handle);
315
+ }
316
+ async releaseScopeLock(handle) {
279
317
  await this.observationLockRepository.delete({
280
318
  scopeKind: handle.scopeKind,
281
319
  scopeId: handle.scopeId,
320
+ taskKind: handle.taskKind,
282
321
  holderId: handle.holderId,
283
322
  });
284
323
  }
285
324
  describe() {
286
325
  return { name: 'n8n', connectionParams: {}, constructorName: this.constructor.name };
287
326
  }
288
- toObservation(entity) {
327
+ toAgentDbMessage(entity) {
328
+ const msg = entity.content;
329
+ msg.id = entity.id;
330
+ msg.createdAt = entity.createdAt;
331
+ return msg;
332
+ }
333
+ toObservationLogEntry(entity) {
289
334
  return {
290
335
  id: entity.id,
291
336
  scopeKind: entity.scopeKind,
292
337
  scopeId: entity.scopeId,
293
- kind: entity.kind,
294
- payload: entity.payload,
295
- durationMs: entity.durationMs === null ? null : Number(entity.durationMs),
296
- schemaVersion: Number(entity.schemaVersion),
338
+ marker: entity.marker,
339
+ text: entity.text,
340
+ parentId: entity.parentId,
341
+ tokenCount: Number(entity.tokenCount),
342
+ status: entity.status,
343
+ supersededBy: entity.supersededBy,
297
344
  createdAt: entity.createdAt,
298
345
  };
299
346
  }
@@ -316,59 +363,6 @@ let N8nMemory = class N8nMemory {
316
363
  updatedAt: entity.updatedAt,
317
364
  };
318
365
  }
319
- extractWorkingMemory(metadataJson) {
320
- if (!metadataJson)
321
- return null;
322
- try {
323
- const parsed = JSON.parse(metadataJson);
324
- const wm = parsed[WORKING_MEMORY_KEY];
325
- return typeof wm === 'string' ? wm : null;
326
- }
327
- catch {
328
- return null;
329
- }
330
- }
331
- mergeWorkingMemory(existingJson, content) {
332
- let parsed = {};
333
- if (existingJson) {
334
- try {
335
- parsed = JSON.parse(existingJson);
336
- }
337
- catch {
338
- }
339
- }
340
- parsed[WORKING_MEMORY_KEY] = content;
341
- return JSON.stringify(parsed);
342
- }
343
- async upsertResourceMetadata(resourceId, content) {
344
- const existing = await this.resourceRepository.findOneBy({ id: resourceId });
345
- if (existing) {
346
- existing.metadata = this.mergeWorkingMemory(existing.metadata, content);
347
- await this.resourceRepository.save(existing);
348
- }
349
- else {
350
- const entity = this.resourceRepository.create({
351
- id: resourceId,
352
- metadata: this.mergeWorkingMemory(null, content),
353
- });
354
- await this.resourceRepository.save(entity);
355
- }
356
- }
357
- async upsertThreadMetadata(threadId, resourceId, content) {
358
- const existing = await this.threadRepository.findOneBy({ id: threadId });
359
- if (existing) {
360
- existing.metadata = this.mergeWorkingMemory(existing.metadata, content);
361
- await this.threadRepository.save(existing);
362
- return;
363
- }
364
- await this.ensureResource(resourceId);
365
- await this.threadRepository.save(this.threadRepository.create({
366
- id: threadId,
367
- resourceId,
368
- title: null,
369
- metadata: this.mergeWorkingMemory(null, content),
370
- }));
371
- }
372
366
  };
373
367
  exports.N8nMemory = N8nMemory;
374
368
  exports.N8nMemory = N8nMemory = __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"n8n-memory.js","sourceRoot":"","sources":["../../../../src/modules/agents/integrations/n8n-memory.ts"],"names":[],"mappings":";;;;;;;;;;;;AAaA,gCAAkC;AAElC,0CAAoF;AAEpF,+CAA+C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AAM,CAAC,SAAS;YAC3B,SAAS,EAAE,MAAM,CAAC,SAAS;SAC3B,CAAC;IACH,CAAC;CACD,CAAA;AA1cY,8BAAS;oBAAT,SAAS;IADrB,IAAA,YAAO,GAAE;qCAG2B,+CAAqB;QACpB,iDAAsB;QACrB,mDAAuB;QACpB,yDAA0B;QACpB,sEAAgC;QAClC,kEAA8B;GAP/D,SAAS,CA0crB"}
@@ -1,5 +1,7 @@
1
+ import { AgentCredentialIntegrationConfig } from '@n8n/api-types';
1
2
  import { Logger } from '@n8n/backend-common';
2
- import type { Thread } from 'chat';
3
+ import type { Thread, Author } from 'chat';
4
+ import { InstanceSettings } from 'n8n-core';
3
5
  import { UrlService } from '../../../../services/url.service';
4
6
  import { AgentRepository } from '../../repositories/agent.repository';
5
7
  import { AgentChatIntegration, type AgentChatIntegrationContext } from '../agent-chat-integration';
@@ -8,6 +10,7 @@ export declare class TelegramIntegration extends AgentChatIntegration {
8
10
  private readonly logger;
9
11
  private readonly urlService;
10
12
  private readonly agentRepository;
13
+ private readonly instanceSettings;
11
14
  readonly type = "telegram";
12
15
  readonly credentialTypes: string[];
13
16
  readonly displayLabel = "Telegram";
@@ -19,12 +22,16 @@ export declare class TelegramIntegration extends AgentChatIntegration {
19
22
  fromSdk: (thread: Thread<unknown, unknown>) => string;
20
23
  toSdk: (threadId: string) => string;
21
24
  };
22
- constructor(logger: Logger, urlService: UrlService, agentRepository: AgentRepository);
25
+ constructor(logger: Logger, urlService: UrlService, agentRepository: AgentRepository, instanceSettings: InstanceSettings);
23
26
  createAdapter(ctx: AgentChatIntegrationContext): Promise<unknown>;
24
27
  requiresLeader(): boolean;
25
28
  onBeforeConnect(ctx: AgentChatIntegrationContext): Promise<void>;
26
29
  onAfterConnect(ctx: AgentChatIntegrationContext): Promise<void>;
30
+ onBeforeDisconnect(ctx: AgentChatIntegrationContext): Promise<void>;
31
+ isUserAllowed(author: Author, integration: AgentCredentialIntegrationConfig | undefined): boolean;
27
32
  normalizeComponents(components: SuspendComponent[]): SuspendComponent[];
28
33
  private getMode;
34
+ private deriveSecretToken;
29
35
  private extractBotToken;
36
+ private botApiUrl;
30
37
  }