n8n 2.29.6 → 2.30.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 (690) hide show
  1. package/README.md +9 -8
  2. package/dist/active-executions.d.ts +2 -1
  3. package/dist/active-executions.js +2 -1
  4. package/dist/active-executions.js.map +1 -1
  5. package/dist/active-workflow-manager.js +10 -5
  6. package/dist/active-workflow-manager.js.map +1 -1
  7. package/dist/blob-storage/azure-byte-store.ee.js +2 -2
  8. package/dist/blob-storage/azure-byte-store.ee.js.map +1 -1
  9. package/dist/blob-storage/s3-byte-store.ee.js +2 -2
  10. package/dist/blob-storage/s3-byte-store.ee.js.map +1 -1
  11. package/dist/build.tsbuildinfo +1 -1
  12. package/dist/chat/chat-service.js +5 -4
  13. package/dist/chat/chat-service.js.map +1 -1
  14. package/dist/chat/chat-service.types.d.ts +2 -2
  15. package/dist/command-registry.js +12 -4
  16. package/dist/command-registry.js.map +1 -1
  17. package/dist/commands/audit.js +3 -2
  18. package/dist/commands/audit.js.map +1 -1
  19. package/dist/commands/base-command.js +2 -1
  20. package/dist/commands/base-command.js.map +1 -1
  21. package/dist/commands/execute.d.ts +2 -2
  22. package/dist/commands/export/credentials.d.ts +4 -4
  23. package/dist/commands/export/entities.d.ts +2 -2
  24. package/dist/commands/export/workflow.d.ts +4 -4
  25. package/dist/commands/import/credentials.d.ts +2 -2
  26. package/dist/commands/import/workflow.d.ts +2 -2
  27. package/dist/commands/start.js +2 -0
  28. package/dist/commands/start.js.map +1 -1
  29. package/dist/commands/ttwf/generate.d.ts +2 -2
  30. package/dist/controllers/annotation-tags.controller.ee.d.ts +1 -1
  31. package/dist/controllers/oauth/oauth1-credential.controller.d.ts +3 -1
  32. package/dist/controllers/oauth/oauth1-credential.controller.js +12 -6
  33. package/dist/controllers/oauth/oauth1-credential.controller.js.map +1 -1
  34. package/dist/controllers/oauth/oauth2-credential.controller.d.ts +3 -1
  35. package/dist/controllers/oauth/oauth2-credential.controller.js +12 -5
  36. package/dist/controllers/oauth/oauth2-credential.controller.js.map +1 -1
  37. package/dist/controllers/posthog.controller.d.ts +6 -0
  38. package/dist/controllers/posthog.controller.js +36 -8
  39. package/dist/controllers/posthog.controller.js.map +1 -1
  40. package/dist/controllers/project.controller.d.ts +2 -0
  41. package/dist/controllers/project.controller.js +12 -4
  42. package/dist/controllers/project.controller.js.map +1 -1
  43. package/dist/controllers/role.controller.d.ts +3 -2
  44. package/dist/controllers/role.controller.js +21 -7
  45. package/dist/controllers/role.controller.js.map +1 -1
  46. package/dist/controllers/users.controller.d.ts +3 -2
  47. package/dist/controllers/users.controller.js +5 -1
  48. package/dist/controllers/users.controller.js.map +1 -1
  49. package/dist/credentials/credentials.controller.d.ts +3 -1
  50. package/dist/credentials/credentials.controller.js +24 -18
  51. package/dist/credentials/credentials.controller.js.map +1 -1
  52. package/dist/credentials/credentials.service.d.ts +1 -0
  53. package/dist/credentials/credentials.service.js +11 -0
  54. package/dist/credentials/credentials.service.js.map +1 -1
  55. package/dist/credentials-overwrites.d.ts +2 -0
  56. package/dist/credentials-overwrites.js +10 -0
  57. package/dist/credentials-overwrites.js.map +1 -1
  58. package/dist/deprecation/deprecation.service.js +35 -6
  59. package/dist/deprecation/deprecation.service.js.map +1 -1
  60. package/dist/errors/response-errors/bad-request.error.d.ts +2 -1
  61. package/dist/errors/response-errors/bad-request.error.js +5 -2
  62. package/dist/errors/response-errors/bad-request.error.js.map +1 -1
  63. package/dist/evaluation.ee/test-runs.controller.ee.d.ts +1 -0
  64. package/dist/eventbus/event-message-classes/index.d.ts +2 -2
  65. package/dist/eventbus/event-message-classes/index.js +1 -0
  66. package/dist/eventbus/event-message-classes/index.js.map +1 -1
  67. package/dist/events/event.service.d.ts +2 -1
  68. package/dist/events/event.service.js.map +1 -1
  69. package/dist/events/maps/instance-ai.event-map.d.ts +1 -1
  70. package/dist/events/maps/relay.event-map.d.ts +21 -2
  71. package/dist/events/maps/workflow-publication-metrics.event-map.d.ts +26 -0
  72. package/dist/events/maps/workflow-publication-metrics.event-map.js +3 -0
  73. package/dist/events/maps/workflow-publication-metrics.event-map.js.map +1 -0
  74. package/dist/events/relays/log-streaming.event-relay.d.ts +2 -1
  75. package/dist/events/relays/log-streaming.event-relay.js +16 -3
  76. package/dist/events/relays/log-streaming.event-relay.js.map +1 -1
  77. package/dist/events/relays/telemetry.event-relay.d.ts +3 -0
  78. package/dist/events/relays/telemetry.event-relay.js +44 -3
  79. package/dist/events/relays/telemetry.event-relay.js.map +1 -1
  80. package/dist/execution-lifecycle/execution-lifecycle-hooks.js +2 -0
  81. package/dist/execution-lifecycle/execution-lifecycle-hooks.js.map +1 -1
  82. package/dist/execution-lifecycle/shared/shared-hook-functions.js +2 -2
  83. package/dist/execution-lifecycle/shared/shared-hook-functions.js.map +1 -1
  84. package/dist/executions/execution-data/azure-store.ee.js +2 -1
  85. package/dist/executions/execution-data/azure-store.ee.js.map +1 -1
  86. package/dist/executions/execution-data/s3-store.ee.js +2 -1
  87. package/dist/executions/execution-data/s3-store.ee.js.map +1 -1
  88. package/dist/executions/execution.service.js +13 -2
  89. package/dist/executions/execution.service.js.map +1 -1
  90. package/dist/instance-settings-loader/loaders/community-packages.instance-settings-loader.js +6 -6
  91. package/dist/instance-settings-loader/loaders/community-packages.instance-settings-loader.js.map +1 -1
  92. package/dist/interfaces.d.ts +2 -1
  93. package/dist/license/license.service.js +4 -4
  94. package/dist/license/license.service.js.map +1 -1
  95. package/dist/load-nodes-and-credentials.js +5 -4
  96. package/dist/load-nodes-and-credentials.js.map +1 -1
  97. package/dist/metrics/prometheus/active-workflow-metrics.service.js +8 -13
  98. package/dist/metrics/prometheus/active-workflow-metrics.service.js.map +1 -1
  99. package/dist/metrics/prometheus/cached-metric-query.d.ts +19 -0
  100. package/dist/metrics/prometheus/cached-metric-query.js +28 -0
  101. package/dist/metrics/prometheus/cached-metric-query.js.map +1 -0
  102. package/dist/metrics/prometheus/instance-ai-metrics.service.js +5 -3
  103. package/dist/metrics/prometheus/instance-ai-metrics.service.js.map +1 -1
  104. package/dist/metrics/prometheus/prometheus.service.d.ts +2 -1
  105. package/dist/metrics/prometheus/prometheus.service.js +5 -2
  106. package/dist/metrics/prometheus/prometheus.service.js.map +1 -1
  107. package/dist/metrics/prometheus/workflow-info-metrics.service.js +8 -13
  108. package/dist/metrics/prometheus/workflow-info-metrics.service.js.map +1 -1
  109. package/dist/metrics/prometheus/workflow-publication-metrics.service.d.ts +21 -0
  110. package/dist/metrics/prometheus/workflow-publication-metrics.service.js +160 -0
  111. package/dist/metrics/prometheus/workflow-publication-metrics.service.js.map +1 -0
  112. package/dist/metrics/prometheus/workflow-statistics-metrics.service.d.ts +0 -4
  113. package/dist/metrics/prometheus/workflow-statistics-metrics.service.js +10 -42
  114. package/dist/metrics/prometheus/workflow-statistics-metrics.service.js.map +1 -1
  115. package/dist/middlewares/body-parser.js +21 -7
  116. package/dist/middlewares/body-parser.js.map +1 -1
  117. package/dist/modules/agents/agent-config.service.js +39 -18
  118. package/dist/modules/agents/agent-config.service.js.map +1 -1
  119. package/dist/modules/agents/agent-execution-orchestrator.service.d.ts +2 -2
  120. package/dist/modules/agents/agent-execution-orchestrator.service.js +5 -8
  121. package/dist/modules/agents/agent-execution-orchestrator.service.js.map +1 -1
  122. package/dist/modules/agents/agent-execution.service.d.ts +2 -2
  123. package/dist/modules/agents/agent-execution.service.js +11 -8
  124. package/dist/modules/agents/agent-execution.service.js.map +1 -1
  125. package/dist/modules/agents/agent-integration-persistence.service.d.ts +4 -1
  126. package/dist/modules/agents/agent-integration-persistence.service.js +4 -2
  127. package/dist/modules/agents/agent-integration-persistence.service.js.map +1 -1
  128. package/dist/modules/agents/agent-integrations.controller.js +13 -3
  129. package/dist/modules/agents/agent-integrations.controller.js.map +1 -1
  130. package/dist/modules/agents/agent-knowledge-commands.d.ts +3 -0
  131. package/dist/modules/agents/agent-knowledge-commands.js +32 -9
  132. package/dist/modules/agents/agent-knowledge-commands.js.map +1 -1
  133. package/dist/modules/agents/agent-knowledge-gate.d.ts +1 -1
  134. package/dist/modules/agents/agent-knowledge-gate.js +1 -3
  135. package/dist/modules/agents/agent-knowledge-gate.js.map +1 -1
  136. package/dist/modules/agents/agent-knowledge-retrieval.d.ts +13 -6
  137. package/dist/modules/agents/agent-knowledge-retrieval.js +16 -14
  138. package/dist/modules/agents/agent-knowledge-retrieval.js.map +1 -1
  139. package/dist/modules/agents/agent-knowledge-sandbox.service.d.ts +16 -11
  140. package/dist/modules/agents/agent-knowledge-sandbox.service.js +233 -140
  141. package/dist/modules/agents/agent-knowledge-sandbox.service.js.map +1 -1
  142. package/dist/modules/agents/agent-knowledge-storage.d.ts +4 -15
  143. package/dist/modules/agents/agent-knowledge-storage.js +13 -26
  144. package/dist/modules/agents/agent-knowledge-storage.js.map +1 -1
  145. package/dist/modules/agents/agent-knowledge.controller.d.ts +1 -1
  146. package/dist/modules/agents/agent-knowledge.controller.js +3 -3
  147. package/dist/modules/agents/agent-knowledge.controller.js.map +1 -1
  148. package/dist/modules/agents/agent-knowledge.service.d.ts +13 -12
  149. package/dist/modules/agents/agent-knowledge.service.js +93 -106
  150. package/dist/modules/agents/agent-knowledge.service.js.map +1 -1
  151. package/dist/modules/agents/agent-model-catalog.service.d.ts +11 -0
  152. package/dist/modules/agents/agent-model-catalog.service.js +138 -0
  153. package/dist/modules/agents/agent-model-catalog.service.js.map +1 -0
  154. package/dist/modules/agents/agent-publish.service.js +6 -1
  155. package/dist/modules/agents/agent-publish.service.js.map +1 -1
  156. package/dist/modules/agents/agent-runtime-cache.service.d.ts +0 -1
  157. package/dist/modules/agents/agent-runtime-cache.service.js +4 -13
  158. package/dist/modules/agents/agent-runtime-cache.service.js.map +1 -1
  159. package/dist/modules/agents/agent-runtime-reconstruction.service.d.ts +3 -7
  160. package/dist/modules/agents/agent-runtime-reconstruction.service.js +10 -26
  161. package/dist/modules/agents/agent-runtime-reconstruction.service.js.map +1 -1
  162. package/dist/modules/agents/agent-sandbox.controller.d.ts +1 -1
  163. package/dist/modules/agents/agent-sandbox.controller.js +4 -4
  164. package/dist/modules/agents/agent-sandbox.controller.js.map +1 -1
  165. package/dist/modules/agents/agent-task.service.d.ts +1 -4
  166. package/dist/modules/agents/agent-task.service.js +1 -23
  167. package/dist/modules/agents/agent-task.service.js.map +1 -1
  168. package/dist/modules/agents/agents-catalog.controller.d.ts +9 -2
  169. package/dist/modules/agents/agents-catalog.controller.js +25 -2
  170. package/dist/modules/agents/agents-catalog.controller.js.map +1 -1
  171. package/dist/modules/agents/agents-config.controller.d.ts +46 -30
  172. package/dist/modules/agents/agents.controller.js +1 -1
  173. package/dist/modules/agents/agents.controller.js.map +1 -1
  174. package/dist/modules/agents/agents.service.d.ts +1 -1
  175. package/dist/modules/agents/agents.service.js +8 -2
  176. package/dist/modules/agents/agents.service.js.map +1 -1
  177. package/dist/modules/agents/builder/agents-builder-tools.service.d.ts +3 -3
  178. package/dist/modules/agents/builder/agents-builder-tools.service.js +32 -9
  179. package/dist/modules/agents/builder/agents-builder-tools.service.js.map +1 -1
  180. package/dist/modules/agents/builder/builder-model-live-lookup.service.d.ts +14 -0
  181. package/dist/modules/agents/builder/builder-model-live-lookup.service.js +91 -0
  182. package/dist/modules/agents/builder/builder-model-live-lookup.service.js.map +1 -0
  183. package/dist/modules/agents/builder/interactive/llm-provider-defaults.d.ts +0 -12
  184. package/dist/modules/agents/builder/interactive/llm-provider-defaults.js +20 -40
  185. package/dist/modules/agents/builder/interactive/llm-provider-defaults.js.map +1 -1
  186. package/dist/modules/agents/builder/interactive/resolve-llm.tool.d.ts +1 -2
  187. package/dist/modules/agents/builder/interactive/resolve-llm.tool.js +3 -2
  188. package/dist/modules/agents/builder/interactive/resolve-llm.tool.js.map +1 -1
  189. package/dist/modules/agents/builder/prompts/config-mutation.prompt.js +6 -0
  190. package/dist/modules/agents/builder/prompts/config-mutation.prompt.js.map +1 -1
  191. package/dist/modules/agents/builder/prompts/config-rules.prompt.js +7 -0
  192. package/dist/modules/agents/builder/prompts/config-rules.prompt.js.map +1 -1
  193. package/dist/modules/agents/entities/agent-execution.entity.d.ts +2 -4
  194. package/dist/modules/agents/entities/agent-execution.entity.js +2 -10
  195. package/dist/modules/agents/entities/agent-execution.entity.js.map +1 -1
  196. package/dist/modules/agents/execution-recorder.d.ts +0 -8
  197. package/dist/modules/agents/execution-recorder.js +12 -27
  198. package/dist/modules/agents/execution-recorder.js.map +1 -1
  199. package/dist/modules/agents/integrations/agent-chat-suspension-cards.js +5 -5
  200. package/dist/modules/agents/integrations/agent-chat-suspension-cards.js.map +1 -1
  201. package/dist/modules/agents/integrations/chat-integration.service.d.ts +7 -6
  202. package/dist/modules/agents/integrations/chat-integration.service.js +51 -85
  203. package/dist/modules/agents/integrations/chat-integration.service.js.map +1 -1
  204. package/dist/modules/agents/integrations/integration-action-executor.d.ts +116 -116
  205. package/dist/modules/agents/integrations/integration-helpers.js +5 -5
  206. package/dist/modules/agents/integrations/integration-helpers.js.map +1 -1
  207. package/dist/modules/agents/integrations/integration-message-context.service.js +2 -2
  208. package/dist/modules/agents/integrations/integration-message-context.service.js.map +1 -1
  209. package/dist/modules/agents/integrations/integration-tool-definitions.d.ts +949 -949
  210. package/dist/modules/agents/integrations/integration-tool-execution.js +4 -4
  211. package/dist/modules/agents/integrations/integration-tool-execution.js.map +1 -1
  212. package/dist/modules/agents/integrations/n8n-checkpoint-storage.d.ts +1 -0
  213. package/dist/modules/agents/integrations/n8n-checkpoint-storage.js +9 -1
  214. package/dist/modules/agents/integrations/n8n-checkpoint-storage.js.map +1 -1
  215. package/dist/modules/agents/integrations/platforms/linear-operations.js +18 -18
  216. package/dist/modules/agents/integrations/platforms/linear-operations.js.map +1 -1
  217. package/dist/modules/agents/integrations/platforms/linear-tool-definitions.d.ts +30 -30
  218. package/dist/modules/agents/integrations/platforms/slack-bridge-behavior.js +6 -6
  219. package/dist/modules/agents/integrations/platforms/slack-bridge-behavior.js.map +1 -1
  220. package/dist/modules/agents/integrations/platforms/slack-operations.js +3 -3
  221. package/dist/modules/agents/integrations/platforms/slack-operations.js.map +1 -1
  222. package/dist/modules/agents/integrations/recording/channel-integration-recorder.d.ts +64 -0
  223. package/dist/modules/agents/integrations/recording/channel-integration-recorder.js +376 -0
  224. package/dist/modules/agents/integrations/recording/channel-integration-recorder.js.map +1 -0
  225. package/dist/modules/agents/integrations/recording/recording-adapter.d.ts +2 -0
  226. package/dist/modules/agents/integrations/recording/recording-adapter.js +98 -0
  227. package/dist/modules/agents/integrations/recording/recording-adapter.js.map +1 -0
  228. package/dist/modules/agents/integrations/slack-app-setup.service.js +5 -5
  229. package/dist/modules/agents/integrations/slack-app-setup.service.js.map +1 -1
  230. package/dist/modules/agents/json-config/from-json-config.js +3 -0
  231. package/dist/modules/agents/json-config/from-json-config.js.map +1 -1
  232. package/dist/modules/agents/repositories/agent-checkpoint.repository.d.ts +1 -0
  233. package/dist/modules/agents/repositories/agent-checkpoint.repository.js +4 -0
  234. package/dist/modules/agents/repositories/agent-checkpoint.repository.js.map +1 -1
  235. package/dist/modules/agents/repositories/agent-execution.repository.js +3 -1
  236. package/dist/modules/agents/repositories/agent-execution.repository.js.map +1 -1
  237. package/dist/modules/agents/sub-agents/sub-agent-foreground-runner.d.ts +0 -1
  238. package/dist/modules/agents/sub-agents/sub-agent-foreground-runner.js +0 -1
  239. package/dist/modules/agents/sub-agents/sub-agent-foreground-runner.js.map +1 -1
  240. package/dist/modules/agents/tools/knowledge/search-knowledge.tool.d.ts +12 -8
  241. package/dist/modules/agents/tools/knowledge/search-knowledge.tool.js +12 -10
  242. package/dist/modules/agents/tools/knowledge/search-knowledge.tool.js.map +1 -1
  243. package/dist/modules/agents/tools/workflow-tool-factory.d.ts +2 -6
  244. package/dist/modules/agents/tools/workflow-tool-factory.js +11 -24
  245. package/dist/modules/agents/tools/workflow-tool-factory.js.map +1 -1
  246. package/dist/modules/agents/utils/agent-resource-id.js +2 -2
  247. package/dist/modules/agents/utils/agent-resource-id.js.map +1 -1
  248. package/dist/modules/agents/utils/execution-to-message-mapper.d.ts +1 -1
  249. package/dist/modules/agents/utils/execution-to-message-mapper.js +4 -31
  250. package/dist/modules/agents/utils/execution-to-message-mapper.js.map +1 -1
  251. package/dist/modules/breaking-changes/breaking-changes.controller.d.ts +4 -7
  252. package/dist/modules/breaking-changes/breaking-changes.controller.js +8 -7
  253. package/dist/modules/breaking-changes/breaking-changes.controller.js.map +1 -1
  254. package/dist/modules/breaking-changes/rules/index.d.ts +2 -0
  255. package/dist/modules/breaking-changes/rules/index.js +2 -0
  256. package/dist/modules/breaking-changes/rules/index.js.map +1 -1
  257. package/dist/modules/breaking-changes/rules/v3/always-output-data-multi-output.rule.d.ts +14 -0
  258. package/dist/modules/breaking-changes/rules/v3/always-output-data-multi-output.rule.js +82 -0
  259. package/dist/modules/breaking-changes/rules/v3/always-output-data-multi-output.rule.js.map +1 -0
  260. package/dist/modules/breaking-changes/rules/v3/execute-workflow-each-mode.rule.d.ts +10 -0
  261. package/dist/modules/breaking-changes/rules/v3/execute-workflow-each-mode.rule.js +53 -0
  262. package/dist/modules/breaking-changes/rules/v3/execute-workflow-each-mode.rule.js.map +1 -0
  263. package/dist/modules/chat-hub/chat-hub-extractor.js +2 -1
  264. package/dist/modules/chat-hub/chat-hub-extractor.js.map +1 -1
  265. package/dist/modules/chat-hub/chat-hub.attachment.service.js +3 -3
  266. package/dist/modules/chat-hub/chat-hub.attachment.service.js.map +1 -1
  267. package/dist/modules/chat-hub/chat-hub.controller.js +2 -2
  268. package/dist/modules/chat-hub/chat-hub.controller.js.map +1 -1
  269. package/dist/modules/chat-hub/chat-hub.module.d.ts +1 -1
  270. package/dist/modules/chat-hub/chat-hub.settings.controller.d.ts +3 -3
  271. package/dist/modules/chat-hub/chat-hub.types.d.ts +4 -4
  272. package/dist/modules/community-packages/community-node-types.service.js +3 -2
  273. package/dist/modules/community-packages/community-node-types.service.js.map +1 -1
  274. package/dist/modules/community-packages/community-packages.lifecycle.service.js +2 -1
  275. package/dist/modules/community-packages/community-packages.lifecycle.service.js.map +1 -1
  276. package/dist/modules/community-packages/community-packages.service.d.ts +6 -0
  277. package/dist/modules/community-packages/community-packages.service.js +116 -25
  278. package/dist/modules/community-packages/community-packages.service.js.map +1 -1
  279. package/dist/modules/community-packages/installed-packages.repository.d.ts +2 -0
  280. package/dist/modules/community-packages/installed-packages.repository.js +9 -0
  281. package/dist/modules/community-packages/installed-packages.repository.js.map +1 -1
  282. package/dist/modules/community-packages/npm-utils.js +2 -2
  283. package/dist/modules/community-packages/npm-utils.js.map +1 -1
  284. package/dist/modules/data-table/data-table-column.repository.js +3 -2
  285. package/dist/modules/data-table/data-table-column.repository.js.map +1 -1
  286. package/dist/modules/data-table/data-table-proxy.service.d.ts +3 -0
  287. package/dist/modules/data-table/data-table-proxy.service.js +8 -0
  288. package/dist/modules/data-table/data-table-proxy.service.js.map +1 -1
  289. package/dist/modules/data-table/data-table-rows.repository.d.ts +3 -0
  290. package/dist/modules/data-table/data-table-rows.repository.js +15 -4
  291. package/dist/modules/data-table/data-table-rows.repository.js.map +1 -1
  292. package/dist/modules/data-table/data-table.controller.js +2 -1
  293. package/dist/modules/data-table/data-table.controller.js.map +1 -1
  294. package/dist/modules/data-table/data-table.module.d.ts +1 -1
  295. package/dist/modules/data-table/data-table.repository.js +10 -0
  296. package/dist/modules/data-table/data-table.repository.js.map +1 -1
  297. package/dist/modules/data-table/data-table.service.d.ts +3 -0
  298. package/dist/modules/data-table/data-table.service.js +10 -0
  299. package/dist/modules/data-table/data-table.service.js.map +1 -1
  300. package/dist/modules/data-table/multer-upload-middleware.js +4 -3
  301. package/dist/modules/data-table/multer-upload-middleware.js.map +1 -1
  302. package/dist/modules/dynamic-credentials.ee/context-establishment-hooks/n8n-oauth/n8n-oauth-extractor.js +2 -1
  303. package/dist/modules/dynamic-credentials.ee/context-establishment-hooks/n8n-oauth/n8n-oauth-extractor.js.map +1 -1
  304. package/dist/modules/dynamic-credentials.ee/credential-resolvers/identifiers/oauth2-introspection-identifier.d.ts +2 -2
  305. package/dist/modules/dynamic-credentials.ee/dynamic-credentials.controller.js +2 -1
  306. package/dist/modules/dynamic-credentials.ee/dynamic-credentials.controller.js.map +1 -1
  307. package/dist/modules/dynamic-credentials.ee/services/dynamic-credential-storage.service.js +5 -0
  308. package/dist/modules/dynamic-credentials.ee/services/dynamic-credential-storage.service.js.map +1 -1
  309. package/dist/modules/dynamic-credentials.ee/services/n8n-resolver-seeder.service.d.ts +2 -3
  310. package/dist/modules/dynamic-credentials.ee/services/n8n-resolver-seeder.service.js +1 -7
  311. package/dist/modules/dynamic-credentials.ee/services/n8n-resolver-seeder.service.js.map +1 -1
  312. package/dist/modules/dynamic-credentials.ee/services/shared-fields.d.ts +2 -1
  313. package/dist/modules/dynamic-credentials.ee/services/shared-fields.js +15 -0
  314. package/dist/modules/dynamic-credentials.ee/services/shared-fields.js.map +1 -1
  315. package/dist/modules/external-secrets.ee/errors/secrets-provider-errors.d.ts +33 -0
  316. package/dist/modules/external-secrets.ee/errors/secrets-provider-errors.js +58 -0
  317. package/dist/modules/external-secrets.ee/errors/secrets-provider-errors.js.map +1 -0
  318. package/dist/modules/external-secrets.ee/provider-lifecycle.service.js +4 -4
  319. package/dist/modules/external-secrets.ee/provider-lifecycle.service.js.map +1 -1
  320. package/dist/modules/external-secrets.ee/providers/aws-secrets-manager.d.ts +16 -3
  321. package/dist/modules/external-secrets.ee/providers/aws-secrets-manager.js +114 -23
  322. package/dist/modules/external-secrets.ee/providers/aws-secrets-manager.js.map +1 -1
  323. package/dist/modules/external-secrets.ee/providers/azure-key-vault/azure-key-vault.d.ts +3 -0
  324. package/dist/modules/external-secrets.ee/providers/azure-key-vault/azure-key-vault.js +136 -32
  325. package/dist/modules/external-secrets.ee/providers/azure-key-vault/azure-key-vault.js.map +1 -1
  326. package/dist/modules/external-secrets.ee/providers/gcp-secrets-manager/gcp-secrets-manager.d.ts +2 -0
  327. package/dist/modules/external-secrets.ee/providers/gcp-secrets-manager/gcp-secrets-manager.js +134 -50
  328. package/dist/modules/external-secrets.ee/providers/gcp-secrets-manager/gcp-secrets-manager.js.map +1 -1
  329. package/dist/modules/external-secrets.ee/providers/infisical.d.ts +31 -0
  330. package/dist/modules/external-secrets.ee/providers/infisical.js +97 -40
  331. package/dist/modules/external-secrets.ee/providers/infisical.js.map +1 -1
  332. package/dist/modules/external-secrets.ee/providers/one-password.d.ts +2 -0
  333. package/dist/modules/external-secrets.ee/providers/one-password.js +97 -41
  334. package/dist/modules/external-secrets.ee/providers/one-password.js.map +1 -1
  335. package/dist/modules/external-secrets.ee/providers/vault.d.ts +3 -1
  336. package/dist/modules/external-secrets.ee/providers/vault.js +126 -33
  337. package/dist/modules/external-secrets.ee/providers/vault.js.map +1 -1
  338. package/dist/modules/external-secrets.ee/secrets-cache.service.js +2 -1
  339. package/dist/modules/external-secrets.ee/secrets-cache.service.js.map +1 -1
  340. package/dist/modules/favorites/dto/add-favorite.dto.d.ts +1 -1
  341. package/dist/modules/insights/database/entities/insights-shared.d.ts +1 -1
  342. package/dist/modules/insights/database/repositories/insights-by-period.repository.d.ts +2 -2
  343. package/dist/modules/insights/insights-compaction.service.d.ts +4 -2
  344. package/dist/modules/insights/insights-compaction.service.js +46 -39
  345. package/dist/modules/insights/insights-compaction.service.js.map +1 -1
  346. package/dist/modules/insights/insights.service.d.ts +3 -3
  347. package/dist/modules/insights/insights.service.js +4 -4
  348. package/dist/modules/insights/insights.service.js.map +1 -1
  349. package/dist/modules/instance-ai/browser/browser-local-mcp-server.js +1 -1
  350. package/dist/modules/instance-ai/browser/browser-local-mcp-server.js.map +1 -1
  351. package/dist/modules/instance-ai/eval/date-anchors.d.ts +1 -0
  352. package/dist/modules/instance-ai/eval/date-anchors.js +24 -0
  353. package/dist/modules/instance-ai/eval/date-anchors.js.map +1 -0
  354. package/dist/modules/instance-ai/eval/eval-timings.d.ts +10 -0
  355. package/dist/modules/instance-ai/eval/eval-timings.js +50 -0
  356. package/dist/modules/instance-ai/eval/eval-timings.js.map +1 -0
  357. package/dist/modules/instance-ai/eval/execution.service.d.ts +1 -0
  358. package/dist/modules/instance-ai/eval/execution.service.js +175 -26
  359. package/dist/modules/instance-ai/eval/execution.service.js.map +1 -1
  360. package/dist/modules/instance-ai/eval/llm-completion-mock.d.ts +7 -0
  361. package/dist/modules/instance-ai/eval/llm-completion-mock.js +188 -0
  362. package/dist/modules/instance-ai/eval/llm-completion-mock.js.map +1 -0
  363. package/dist/modules/instance-ai/eval/llm-wire-server.js +14 -1
  364. package/dist/modules/instance-ai/eval/llm-wire-server.js.map +1 -1
  365. package/dist/modules/instance-ai/eval/mock-handler.d.ts +9 -2
  366. package/dist/modules/instance-ai/eval/mock-handler.js +239 -41
  367. package/dist/modules/instance-ai/eval/mock-handler.js.map +1 -1
  368. package/dist/modules/instance-ai/eval/mock-quirks.d.ts +1 -0
  369. package/dist/modules/instance-ai/eval/mock-quirks.js +47 -2
  370. package/dist/modules/instance-ai/eval/mock-quirks.js.map +1 -1
  371. package/dist/modules/instance-ai/eval/pin-data-generator.d.ts +7 -0
  372. package/dist/modules/instance-ai/eval/pin-data-generator.js +190 -8
  373. package/dist/modules/instance-ai/eval/pin-data-generator.js.map +1 -1
  374. package/dist/modules/instance-ai/eval/workflow-analysis.d.ts +2 -0
  375. package/dist/modules/instance-ai/eval/workflow-analysis.js +25 -3
  376. package/dist/modules/instance-ai/eval/workflow-analysis.js.map +1 -1
  377. package/dist/modules/instance-ai/event-bus/in-process-event-bus.d.ts +15 -1
  378. package/dist/modules/instance-ai/event-bus/in-process-event-bus.js +51 -5
  379. package/dist/modules/instance-ai/event-bus/in-process-event-bus.js.map +1 -1
  380. package/dist/modules/instance-ai/instance-ai-error-reporter.service.d.ts +18 -0
  381. package/dist/modules/instance-ai/instance-ai-error-reporter.service.js +76 -0
  382. package/dist/modules/instance-ai/instance-ai-error-reporter.service.js.map +1 -0
  383. package/dist/modules/instance-ai/instance-ai.adapter.service.d.ts +4 -1
  384. package/dist/modules/instance-ai/instance-ai.adapter.service.js +71 -8
  385. package/dist/modules/instance-ai/instance-ai.adapter.service.js.map +1 -1
  386. package/dist/modules/instance-ai/instance-ai.controller.d.ts +5 -5
  387. package/dist/modules/instance-ai/instance-ai.controller.js +85 -55
  388. package/dist/modules/instance-ai/instance-ai.controller.js.map +1 -1
  389. package/dist/modules/instance-ai/instance-ai.service.d.ts +24 -6
  390. package/dist/modules/instance-ai/instance-ai.service.js +303 -106
  391. package/dist/modules/instance-ai/instance-ai.service.js.map +1 -1
  392. package/dist/modules/instance-ai/mcp/instance-ai-mcp-connection.controller.d.ts +2 -1
  393. package/dist/modules/instance-ai/mcp/instance-ai-mcp-connection.controller.js +12 -0
  394. package/dist/modules/instance-ai/mcp/instance-ai-mcp-connection.controller.js.map +1 -1
  395. package/dist/modules/instance-ai/mcp/instance-ai-mcp-registry.service.d.ts +3 -1
  396. package/dist/modules/instance-ai/mcp/instance-ai-mcp-registry.service.js +78 -11
  397. package/dist/modules/instance-ai/mcp/instance-ai-mcp-registry.service.js.map +1 -1
  398. package/dist/modules/instance-ai/message-parser.js +62 -15
  399. package/dist/modules/instance-ai/message-parser.js.map +1 -1
  400. package/dist/modules/instance-ai/node-definition-resolver.js +34 -4
  401. package/dist/modules/instance-ai/node-definition-resolver.js.map +1 -1
  402. package/dist/modules/instance-ai/observability.d.ts +2 -1
  403. package/dist/modules/instance-ai/observability.js +2 -1
  404. package/dist/modules/instance-ai/observability.js.map +1 -1
  405. package/dist/modules/instance-ai/repositories/instance-ai-pending-confirmation.repository.d.ts +1 -0
  406. package/dist/modules/instance-ai/repositories/instance-ai-pending-confirmation.repository.js +4 -0
  407. package/dist/modules/instance-ai/repositories/instance-ai-pending-confirmation.repository.js.map +1 -1
  408. package/dist/modules/instance-ai/storage/db-iteration-log-storage.js +2 -2
  409. package/dist/modules/instance-ai/storage/db-iteration-log-storage.js.map +1 -1
  410. package/dist/modules/instance-ai/storage/typeorm-agent-memory.js +4 -4
  411. package/dist/modules/instance-ai/storage/typeorm-agent-memory.js.map +1 -1
  412. package/dist/modules/instance-ai/suspended-run-restorer.service.d.ts +3 -2
  413. package/dist/modules/instance-ai/suspended-run-restorer.service.js +9 -8
  414. package/dist/modules/instance-ai/suspended-run-restorer.service.js.map +1 -1
  415. package/dist/modules/instance-registry/storage/redis-instance-storage.js +9 -8
  416. package/dist/modules/instance-registry/storage/redis-instance-storage.js.map +1 -1
  417. package/dist/modules/mcp/mcp-api-key.service.js +2 -2
  418. package/dist/modules/mcp/mcp-api-key.service.js.map +1 -1
  419. package/dist/modules/mcp/mcp-server-middleware.service.js +3 -3
  420. package/dist/modules/mcp/mcp-server-middleware.service.js.map +1 -1
  421. package/dist/modules/mcp/mcp.service.d.ts +2 -1
  422. package/dist/modules/mcp/mcp.service.js +3 -2
  423. package/dist/modules/mcp/mcp.service.js.map +1 -1
  424. package/dist/modules/mcp/mcp.typeguards.js +9 -9
  425. package/dist/modules/mcp/mcp.typeguards.js.map +1 -1
  426. package/dist/modules/mcp/mcp.utils.js +2 -2
  427. package/dist/modules/mcp/mcp.utils.js.map +1 -1
  428. package/dist/modules/mcp/tools/execute-workflow.tool.d.ts +8 -8
  429. package/dist/modules/mcp/tools/execute-workflow.tool.js +2 -1
  430. package/dist/modules/mcp/tools/execute-workflow.tool.js.map +1 -1
  431. package/dist/modules/mcp/tools/execution-utils.js +2 -1
  432. package/dist/modules/mcp/tools/execution-utils.js.map +1 -1
  433. package/dist/modules/mcp/tools/get-execution.tool.js +2 -1
  434. package/dist/modules/mcp/tools/get-execution.tool.js.map +1 -1
  435. package/dist/modules/mcp/tools/get-workflow-details.tool.d.ts +2 -2
  436. package/dist/modules/mcp/tools/get-workflow-details.tool.js +5 -5
  437. package/dist/modules/mcp/tools/get-workflow-details.tool.js.map +1 -1
  438. package/dist/modules/mcp/tools/get-workflow-history.tool.d.ts +4 -4
  439. package/dist/modules/mcp/tools/get-workflow-history.tool.js +2 -2
  440. package/dist/modules/mcp/tools/get-workflow-history.tool.js.map +1 -1
  441. package/dist/modules/mcp/tools/get-workflow-version.tool.js +2 -2
  442. package/dist/modules/mcp/tools/get-workflow-version.tool.js.map +1 -1
  443. package/dist/modules/mcp/tools/publish-workflow.tool.js +2 -1
  444. package/dist/modules/mcp/tools/publish-workflow.tool.js.map +1 -1
  445. package/dist/modules/mcp/tools/schemas.d.ts +52 -52
  446. package/dist/modules/mcp/tools/test-workflow.tool.js +2 -1
  447. package/dist/modules/mcp/tools/test-workflow.tool.js.map +1 -1
  448. package/dist/modules/mcp/tools/unpublish-workflow.tool.js +2 -1
  449. package/dist/modules/mcp/tools/unpublish-workflow.tool.js.map +1 -1
  450. package/dist/modules/mcp/tools/webhook-utils.d.ts +2 -3
  451. package/dist/modules/mcp/tools/webhook-utils.js +15 -21
  452. package/dist/modules/mcp/tools/webhook-utils.js.map +1 -1
  453. package/dist/modules/mcp/tools/workflow-builder/get-workflow-node-types.tool.d.ts +2 -2
  454. package/dist/modules/mcp/tools/workflow-builder/restore-workflow-version.tool.js +2 -2
  455. package/dist/modules/mcp/tools/workflow-builder/restore-workflow-version.tool.js.map +1 -1
  456. package/dist/modules/mcp/tools/workflow-builder/validate-node.tool.d.ts +2 -2
  457. package/dist/modules/mcp/tools/workflow-builder/workflow-operations.d.ts +85 -85
  458. package/dist/modules/mcp-registry/mcp-registry-node-loader.js +2 -1
  459. package/dist/modules/mcp-registry/mcp-registry-node-loader.js.map +1 -1
  460. package/dist/modules/n8n-packages/engine/import-pipeline.js +14 -1
  461. package/dist/modules/n8n-packages/engine/import-pipeline.js.map +1 -1
  462. package/dist/modules/n8n-packages/entities/folder/folder.exporter.d.ts +31 -0
  463. package/dist/modules/n8n-packages/entities/folder/folder.exporter.js +115 -0
  464. package/dist/modules/n8n-packages/entities/folder/folder.exporter.js.map +1 -0
  465. package/dist/modules/n8n-packages/entities/folder/folder.serializer.d.ts +5 -0
  466. package/dist/modules/n8n-packages/entities/folder/folder.serializer.js +25 -0
  467. package/dist/modules/n8n-packages/entities/folder/folder.serializer.js.map +1 -0
  468. package/dist/modules/n8n-packages/entities/project/project.exporter.d.ts +20 -0
  469. package/dist/modules/n8n-packages/entities/project/project.exporter.js +59 -0
  470. package/dist/modules/n8n-packages/entities/project/project.exporter.js.map +1 -0
  471. package/dist/modules/n8n-packages/entities/project/project.serializer.d.ts +5 -0
  472. package/dist/modules/n8n-packages/entities/project/project.serializer.js +26 -0
  473. package/dist/modules/n8n-packages/entities/project/project.serializer.js.map +1 -0
  474. package/dist/modules/n8n-packages/entities/requirements.types.d.ts +5 -0
  475. package/dist/modules/n8n-packages/entities/requirements.types.js +8 -0
  476. package/dist/modules/n8n-packages/entities/requirements.types.js.map +1 -0
  477. package/dist/modules/n8n-packages/entities/workflow/workflow-publisher.js +2 -2
  478. package/dist/modules/n8n-packages/entities/workflow/workflow-publisher.js.map +1 -1
  479. package/dist/modules/n8n-packages/entities/workflow/workflow.exporter.d.ts +3 -5
  480. package/dist/modules/n8n-packages/entities/workflow/workflow.exporter.js +2 -2
  481. package/dist/modules/n8n-packages/entities/workflow/workflow.exporter.js.map +1 -1
  482. package/dist/modules/n8n-packages/io/slug.utils.d.ts +1 -1
  483. package/dist/modules/n8n-packages/io/slug.utils.js +1 -2
  484. package/dist/modules/n8n-packages/io/slug.utils.js.map +1 -1
  485. package/dist/modules/n8n-packages/io/unique-filename-allocator.d.ts +3 -2
  486. package/dist/modules/n8n-packages/io/unique-filename-allocator.js +3 -0
  487. package/dist/modules/n8n-packages/io/unique-filename-allocator.js.map +1 -1
  488. package/dist/modules/n8n-packages/n8n-packages.module.js +1 -1
  489. package/dist/modules/n8n-packages/n8n-packages.module.js.map +1 -1
  490. package/dist/modules/n8n-packages/n8n-packages.service.d.ts +11 -3
  491. package/dist/modules/n8n-packages/n8n-packages.service.js +77 -16
  492. package/dist/modules/n8n-packages/n8n-packages.service.js.map +1 -1
  493. package/dist/modules/n8n-packages/n8n-packages.types.d.ts +21 -2
  494. package/dist/modules/n8n-packages/n8n-packages.types.js.map +1 -1
  495. package/dist/modules/n8n-packages/spec/manifest.schema.d.ts +88 -22
  496. package/dist/modules/n8n-packages/spec/manifest.schema.js +20 -12
  497. package/dist/modules/n8n-packages/spec/manifest.schema.js.map +1 -1
  498. package/dist/modules/n8n-packages/spec/requirements.schema.d.ts +8 -8
  499. package/dist/modules/n8n-packages/spec/serialized/credential.schema.d.ts +2 -2
  500. package/dist/modules/n8n-packages/spec/serialized/folder.schema.d.ts +15 -0
  501. package/dist/modules/n8n-packages/spec/serialized/folder.schema.js +12 -0
  502. package/dist/modules/n8n-packages/spec/serialized/folder.schema.js.map +1 -0
  503. package/dist/modules/n8n-packages/spec/serialized/project.schema.d.ts +33 -0
  504. package/dist/modules/n8n-packages/spec/serialized/project.schema.js +15 -0
  505. package/dist/modules/n8n-packages/spec/serialized/project.schema.js.map +1 -0
  506. package/dist/modules/n8n-packages/spec/serialized/workflow.schema.d.ts +32 -32
  507. package/dist/modules/oauth-jwe/oauth-jwe-key.service.js +2 -2
  508. package/dist/modules/oauth-jwe/oauth-jwe-key.service.js.map +1 -1
  509. package/dist/modules/oauth-server/oauth-token.service.js +2 -1
  510. package/dist/modules/oauth-server/oauth-token.service.js.map +1 -1
  511. package/dist/modules/oauth-server/protected-resource-resolvers/workflow-mcp-test-trigger-resource.resolver.js +2 -2
  512. package/dist/modules/oauth-server/protected-resource-resolvers/workflow-mcp-test-trigger-resource.resolver.js.map +1 -1
  513. package/dist/modules/otel/execution-level-tracer.js +32 -8
  514. package/dist/modules/otel/execution-level-tracer.js.map +1 -1
  515. package/dist/modules/otel/execution-level-tracer.types.d.ts +2 -0
  516. package/dist/modules/otel/execution-level-tracer.types.js.map +1 -1
  517. package/dist/modules/provisioning.ee/provisioning.service.ee.d.ts +1 -0
  518. package/dist/modules/provisioning.ee/provisioning.service.ee.js +38 -15
  519. package/dist/modules/provisioning.ee/provisioning.service.ee.js.map +1 -1
  520. package/dist/modules/quick-connect/quick-connect.config.d.ts +19 -19
  521. package/dist/modules/quick-connect/quick-connect.module.d.ts +8 -8
  522. package/dist/modules/source-control.ee/source-control-export.service.ee.js +3 -1
  523. package/dist/modules/source-control.ee/source-control-export.service.ee.js.map +1 -1
  524. package/dist/modules/source-control.ee/source-control-helper.ee.js +2 -0
  525. package/dist/modules/source-control.ee/source-control-helper.ee.js.map +1 -1
  526. package/dist/modules/source-control.ee/source-control-import.service.ee.js +15 -10
  527. package/dist/modules/source-control.ee/source-control-import.service.ee.js.map +1 -1
  528. package/dist/modules/source-control.ee/source-control.controller.ee.d.ts +6 -6
  529. package/dist/modules/source-control.ee/source-control.controller.ee.js +3 -3
  530. package/dist/modules/source-control.ee/source-control.controller.ee.js.map +1 -1
  531. package/dist/modules/source-control.ee/source-control.service.ee.d.ts +2 -2
  532. package/dist/modules/source-control.ee/source-control.service.ee.js +2 -2
  533. package/dist/modules/source-control.ee/source-control.service.ee.js.map +1 -1
  534. package/dist/modules/source-control.ee/types/exportable-credential.d.ts +2 -0
  535. package/dist/modules/sso-saml/saml.controller.ee.d.ts +2 -2
  536. package/dist/modules/token-exchange/token-exchange.schemas.d.ts +8 -8
  537. package/dist/modules/workflow-index/workflow-index.service.js +3 -2
  538. package/dist/modules/workflow-index/workflow-index.service.js.map +1 -1
  539. package/dist/node-types.d.ts +1 -0
  540. package/dist/node-types.js +17 -3
  541. package/dist/node-types.js.map +1 -1
  542. package/dist/oauth/oauth.service.d.ts +5 -0
  543. package/dist/oauth/oauth.service.js +45 -15
  544. package/dist/oauth/oauth.service.js.map +1 -1
  545. package/dist/public-api/types.d.ts +28 -1
  546. package/dist/public-api/v1/handlers/data-tables/data-tables.rows.handler.d.ts +1 -0
  547. package/dist/public-api/v1/handlers/data-tables/data-tables.rows.handler.js +15 -0
  548. package/dist/public-api/v1/handlers/data-tables/data-tables.rows.handler.js.map +1 -1
  549. package/dist/public-api/v1/handlers/discover/discover.service.js +11 -11
  550. package/dist/public-api/v1/handlers/discover/discover.service.js.map +1 -1
  551. package/dist/public-api/v1/handlers/evaluations/evaluations.handler.d.ts +9 -0
  552. package/dist/public-api/v1/handlers/evaluations/evaluations.handler.js +64 -0
  553. package/dist/public-api/v1/handlers/evaluations/evaluations.handler.js.map +1 -0
  554. package/dist/public-api/v1/handlers/evaluations/evaluations.mapper.d.ts +9 -0
  555. package/dist/public-api/v1/handlers/evaluations/evaluations.mapper.js +34 -0
  556. package/dist/public-api/v1/handlers/evaluations/evaluations.mapper.js.map +1 -0
  557. package/dist/public-api/v1/handlers/executions/executions.handler.js +1 -0
  558. package/dist/public-api/v1/handlers/executions/executions.handler.js.map +1 -1
  559. package/dist/public-api/v1/handlers/n8n-packages/n8n-packages.handler.d.ts +5 -3
  560. package/dist/public-api/v1/handlers/n8n-packages/n8n-packages.handler.js +53 -26
  561. package/dist/public-api/v1/handlers/n8n-packages/n8n-packages.handler.js.map +1 -1
  562. package/dist/public-api/v1/handlers/projects/projects.handler.js +10 -0
  563. package/dist/public-api/v1/handlers/projects/projects.handler.js.map +1 -1
  564. package/dist/public-api/v1/openapi.yml +300 -18
  565. package/dist/public-api/v1/shared/middlewares/global.middleware.d.ts +1 -0
  566. package/dist/public-api/v1/shared/middlewares/global.middleware.js +6 -0
  567. package/dist/public-api/v1/shared/middlewares/global.middleware.js.map +1 -1
  568. package/dist/push/index.js +3 -3
  569. package/dist/push/index.js.map +1 -1
  570. package/dist/requests.d.ts +1 -0
  571. package/dist/response-helper.js +2 -1
  572. package/dist/response-helper.js.map +1 -1
  573. package/dist/scaling/constants.d.ts +3 -2
  574. package/dist/scaling/constants.js +4 -1
  575. package/dist/scaling/constants.js.map +1 -1
  576. package/dist/scaling/job-processor.js +1 -0
  577. package/dist/scaling/job-processor.js.map +1 -1
  578. package/dist/scaling/leader-election-client.d.ts +1 -1
  579. package/dist/scaling/leader-election-client.js +13 -12
  580. package/dist/scaling/leader-election-client.js.map +1 -1
  581. package/dist/scaling/pubsub/pubsub.event-map.d.ts +11 -1
  582. package/dist/scaling/pubsub/pubsub.types.d.ts +3 -1
  583. package/dist/scaling/redis-lock.service.js +5 -5
  584. package/dist/scaling/redis-lock.service.js.map +1 -1
  585. package/dist/scaling/scaling.service.js +3 -2
  586. package/dist/scaling/scaling.service.js.map +1 -1
  587. package/dist/scaling/scaling.types.d.ts +1 -0
  588. package/dist/services/folder-finder.service.d.ts +12 -0
  589. package/dist/services/folder-finder.service.js +58 -0
  590. package/dist/services/folder-finder.service.js.map +1 -0
  591. package/dist/services/frontend.service.js +3 -0
  592. package/dist/services/frontend.service.js.map +1 -1
  593. package/dist/services/import.service.js +2 -2
  594. package/dist/services/import.service.js.map +1 -1
  595. package/dist/services/project.service.ee.d.ts +1 -0
  596. package/dist/services/project.service.ee.js +21 -1
  597. package/dist/services/project.service.ee.js.map +1 -1
  598. package/dist/services/protected-resource.registry.js +2 -2
  599. package/dist/services/protected-resource.registry.js.map +1 -1
  600. package/dist/services/proxy-token-manager.js +2 -2
  601. package/dist/services/proxy-token-manager.js.map +1 -1
  602. package/dist/services/pruning/executions-pruning.service.js +3 -3
  603. package/dist/services/pruning/executions-pruning.service.js.map +1 -1
  604. package/dist/services/pruning/workflow-history-compaction.service.js +2 -1
  605. package/dist/services/pruning/workflow-history-compaction.service.js.map +1 -1
  606. package/dist/services/redis-client.service.js +5 -2
  607. package/dist/services/redis-client.service.js.map +1 -1
  608. package/dist/services/role.service.d.ts +3 -3
  609. package/dist/services/role.service.js +9 -3
  610. package/dist/services/role.service.js.map +1 -1
  611. package/dist/services/url.service.d.ts +1 -0
  612. package/dist/services/url.service.js +10 -5
  613. package/dist/services/url.service.js.map +1 -1
  614. package/dist/services/workflow-statistics-rollup.service.d.ts +31 -0
  615. package/dist/services/workflow-statistics-rollup.service.js +160 -0
  616. package/dist/services/workflow-statistics-rollup.service.js.map +1 -0
  617. package/dist/services/workflow-statistics.service.d.ts +5 -2
  618. package/dist/services/workflow-statistics.service.js +37 -15
  619. package/dist/services/workflow-statistics.service.js.map +1 -1
  620. package/dist/task-runners/task-managers/task-requester.d.ts +2 -1
  621. package/dist/task-runners/task-managers/task-requester.js +3 -3
  622. package/dist/task-runners/task-managers/task-requester.js.map +1 -1
  623. package/dist/wait-tracker.js +2 -1
  624. package/dist/wait-tracker.js.map +1 -1
  625. package/dist/webhooks/webhook-helpers.d.ts +2 -1
  626. package/dist/webhooks/webhook-helpers.js +5 -4
  627. package/dist/webhooks/webhook-helpers.js.map +1 -1
  628. package/dist/webhooks/webhook-last-node-response-extractor.d.ts +2 -1
  629. package/dist/webhooks/webhook-last-node-response-extractor.js +12 -11
  630. package/dist/webhooks/webhook-last-node-response-extractor.js.map +1 -1
  631. package/dist/webhooks/webhook-request-handler.js +2 -2
  632. package/dist/webhooks/webhook-request-handler.js.map +1 -1
  633. package/dist/webhooks/webhook-response-headers.js +2 -2
  634. package/dist/webhooks/webhook-response-headers.js.map +1 -1
  635. package/dist/webhooks/webhook.service.js +6 -5
  636. package/dist/webhooks/webhook.service.js.map +1 -1
  637. package/dist/workflow-execute-additional-data.js +6 -13
  638. package/dist/workflow-execute-additional-data.js.map +1 -1
  639. package/dist/workflow-runner.d.ts +2 -1
  640. package/dist/workflow-runner.js +1 -0
  641. package/dist/workflow-runner.js.map +1 -1
  642. package/dist/workflows/publication/workflow-publication-applier.js +2 -2
  643. package/dist/workflows/publication/workflow-publication-applier.js.map +1 -1
  644. package/dist/workflows/publication/workflow-publication-notifier.d.ts +12 -0
  645. package/dist/workflows/publication/workflow-publication-notifier.js +78 -0
  646. package/dist/workflows/publication/workflow-publication-notifier.js.map +1 -0
  647. package/dist/workflows/publication/workflow-publication-outbox-cleanup.service.d.ts +3 -1
  648. package/dist/workflows/publication/workflow-publication-outbox-cleanup.service.js +13 -2
  649. package/dist/workflows/publication/workflow-publication-outbox-cleanup.service.js.map +1 -1
  650. package/dist/workflows/publication/workflow-publication-outbox-consumer.d.ts +4 -1
  651. package/dist/workflows/publication/workflow-publication-outbox-consumer.js +61 -11
  652. package/dist/workflows/publication/workflow-publication-outbox-consumer.js.map +1 -1
  653. package/dist/workflows/publication/workflow-publication-status.service.d.ts +9 -0
  654. package/dist/workflows/publication/workflow-publication-status.service.js +54 -0
  655. package/dist/workflows/publication/workflow-publication-status.service.js.map +1 -0
  656. package/dist/workflows/triggers/non-webhook-trigger-registrar.d.ts +1 -1
  657. package/dist/workflows/triggers/trigger-activation-retry.js +2 -1
  658. package/dist/workflows/triggers/trigger-activation-retry.js.map +1 -1
  659. package/dist/workflows/triggers/trigger-execution-context.factory.d.ts +2 -2
  660. package/dist/workflows/triggers/trigger-execution-context.factory.js +1 -1
  661. package/dist/workflows/triggers/trigger-execution-context.factory.js.map +1 -1
  662. package/dist/workflows/triggers/webhook-trigger-registrar.js +2 -1
  663. package/dist/workflows/triggers/webhook-trigger-registrar.js.map +1 -1
  664. package/dist/workflows/triggers/workflow-trigger-activator.d.ts +7 -1
  665. package/dist/workflows/triggers/workflow-trigger-activator.js +64 -10
  666. package/dist/workflows/triggers/workflow-trigger-activator.js.map +1 -1
  667. package/dist/workflows/workflow-execution.service.d.ts +2 -1
  668. package/dist/workflows/workflow-execution.service.js.map +1 -1
  669. package/dist/workflows/workflow-finder.service.d.ts +1 -0
  670. package/dist/workflows/workflow-finder.service.js +21 -0
  671. package/dist/workflows/workflow-finder.service.js.map +1 -1
  672. package/dist/workflows/workflow-history/workflow-history.service.js +2 -1
  673. package/dist/workflows/workflow-history/workflow-history.service.js.map +1 -1
  674. package/dist/workflows/workflow-published-data.service.js +2 -2
  675. package/dist/workflows/workflow-published-data.service.js.map +1 -1
  676. package/dist/workflows/workflow-validation.service.js +3 -2
  677. package/dist/workflows/workflow-validation.service.js.map +1 -1
  678. package/dist/workflows/workflow.service.d.ts +8 -6
  679. package/dist/workflows/workflow.service.js +9 -3
  680. package/dist/workflows/workflow.service.js.map +1 -1
  681. package/dist/workflows/workflows.controller.d.ts +31 -28
  682. package/dist/workflows/workflows.controller.js +28 -4
  683. package/dist/workflows/workflows.controller.js.map +1 -1
  684. package/package.json +41 -37
  685. package/dist/modules/agents/builder/builder-model-lookup.service.d.ts +0 -17
  686. package/dist/modules/agents/builder/builder-model-lookup.service.js +0 -67
  687. package/dist/modules/agents/builder/builder-model-lookup.service.js.map +0 -1
  688. package/dist/modules/n8n-packages/n8n-packages.controller.d.ts +0 -10
  689. package/dist/modules/n8n-packages/n8n-packages.controller.js +0 -44
  690. package/dist/modules/n8n-packages/n8n-packages.controller.js.map +0 -1
@@ -14,6 +14,7 @@ const agents_1 = require("@n8n/agents");
14
14
  const sandbox_1 = require("@n8n/agents/sandbox");
15
15
  const backend_common_1 = require("@n8n/backend-common");
16
16
  const config_1 = require("@n8n/config");
17
+ const constants_1 = require("@n8n/constants");
17
18
  const di_1 = require("@n8n/di");
18
19
  const n8n_core_1 = require("n8n-core");
19
20
  const n8n_workflow_1 = require("n8n-workflow");
@@ -22,20 +23,18 @@ const node_crypto_1 = require("node:crypto");
22
23
  const bad_request_error_1 = require("../../errors/response-errors/bad-request.error");
23
24
  const not_found_error_1 = require("../../errors/response-errors/not-found.error");
24
25
  const ai_service_1 = require("../../services/ai.service");
26
+ const ttl_map_1 = require("../../utils/ttl-map");
25
27
  const agent_knowledge_commands_1 = require("./agent-knowledge-commands");
26
28
  const agent_knowledge_gate_1 = require("./agent-knowledge-gate");
27
29
  const agent_knowledge_retrieval_1 = require("./agent-knowledge-retrieval");
28
30
  const agent_knowledge_storage_1 = require("./agent-knowledge-storage");
29
31
  const agent_file_repository_1 = require("./repositories/agent-file.repository");
30
32
  const agent_repository_1 = require("./repositories/agent.repository");
31
- exports.AGENT_KNOWLEDGE_SANDBOX_NAME_PREFIX = 'agents-knowledgebase';
33
+ exports.AGENT_KNOWLEDGE_SANDBOX_NAME_PREFIX = 'agent-';
32
34
  const MAX_SANDBOX_ERROR_DETAIL_CHARS = 2_000;
33
35
  const LABEL_KNOWLEDGE_BASE = 'n8n-agents-knowledgebase';
34
36
  const LABEL_PROJECT_ID = 'n8n-project-id';
35
37
  const LABEL_AGENT_ID = 'n8n-agent-id';
36
- const LABEL_USER_ID = 'n8n-user-id';
37
- const LABEL_SANDBOX_SCOPE_ID = 'n8n-agents-sandbox-scope-id';
38
- const SANDBOX_SCOPE_LABEL_MAX_LEN = 63;
39
38
  const SANDBOX_STATE_STARTED = 'started';
40
39
  const DEAD_SANDBOX_STATES = new Set([
41
40
  'destroyed',
@@ -45,7 +44,9 @@ const DEAD_SANDBOX_STATES = new Set([
45
44
  ]);
46
45
  const DEFAULT_SANDBOX_IMAGE = 'daytonaio/sandbox:0.5.0';
47
46
  const AUTO_STOP_INTERVAL_MINUTES = 5;
48
- const SANDBOX_LIST_PAGE_SIZE = 100;
47
+ const MIRROR_MANIFEST_HASH_TTL_MS = 30 * constants_1.Time.minutes.toMilliseconds;
48
+ const MIRROR_DISK_FIT_WARNING_BYTES = 2 * 1024 * 1024 * 1024;
49
+ const MIRROR_UPLOAD_BATCH_BYTES = 64 * 1024 * 1024;
49
50
  function emptySearchKnowledgeResult(outputMode, limit) {
50
51
  if (outputMode === 'files_with_matches') {
51
52
  return { outputMode, files: [], limit, hasMore: false, truncated: false };
@@ -55,61 +56,43 @@ function emptySearchKnowledgeResult(outputMode, limit) {
55
56
  }
56
57
  return { outputMode, matches: [], limit, hasMore: false, truncated: false };
57
58
  }
58
- function buildSandboxScopeKey(projectId, agentId, ownerUserId, sandboxScopeId) {
59
- return `${projectId}:${agentId}:${ownerUserId}:${normalizeSandboxScopeLabel(sandboxScopeId)}`;
59
+ function buildSandboxScopeKey(projectId, agentId) {
60
+ return `${projectId}:${agentId}`;
60
61
  }
61
62
  function buildSandboxName(scope) {
62
- const hash = (0, node_crypto_1.createHash)('sha256').update(JSON.stringify(scope)).digest('hex').slice(0, 32);
63
- return `${exports.AGENT_KNOWLEDGE_SANDBOX_NAME_PREFIX}-${hash}`;
63
+ return `${exports.AGENT_KNOWLEDGE_SANDBOX_NAME_PREFIX}${scope.instanceId}-${scope.projectId}-${scope.agentId}`.toLowerCase();
64
+ }
65
+ function extractCommandOutput(result) {
66
+ return result.artifacts?.stdout ?? result.result ?? '';
67
+ }
68
+ function parseManifestNames(output) {
69
+ return output
70
+ .split(/\r?\n/)
71
+ .map((line) => line.trim())
72
+ .filter(Boolean);
73
+ }
74
+ function hashManifestNames(names) {
75
+ return (0, node_crypto_1.createHash)('sha256')
76
+ .update(JSON.stringify([...names].sort()))
77
+ .digest('hex');
64
78
  }
65
79
  function isDaytonaNotFoundError(error) {
66
80
  const { DaytonaNotFoundError } = (0, sandbox_1.loadDaytona)();
67
81
  return error instanceof DaytonaNotFoundError;
68
82
  }
69
- function buildScopeLabels(projectId, agentId, ownerUserId, sandboxScopeId) {
83
+ function buildScopeLabels(projectId, agentId) {
70
84
  return {
71
85
  [LABEL_KNOWLEDGE_BASE]: 'true',
72
86
  [LABEL_PROJECT_ID]: projectId,
73
87
  [LABEL_AGENT_ID]: agentId,
74
- [LABEL_USER_ID]: ownerUserId,
75
- [LABEL_SANDBOX_SCOPE_ID]: normalizeSandboxScopeLabel(sandboxScopeId),
76
88
  };
77
89
  }
78
- function normalizeSandboxScopeLabel(scopeId) {
79
- const normalized = scopeId
80
- .replace(/[^A-Za-z0-9_.-]+/g, '-')
81
- .replace(/^[-.]+|[-.]+$/g, '')
82
- .replace(/[-.]+/g, '-');
83
- const digest = (0, node_crypto_1.createHash)('sha256').update(scopeId).digest('hex').slice(0, 8);
84
- if (!normalized) {
85
- return `scope-${digest}`;
86
- }
87
- if (normalized.length <= SANDBOX_SCOPE_LABEL_MAX_LEN && normalized === scopeId) {
88
- return normalized;
89
- }
90
- const prefixMaxLen = SANDBOX_SCOPE_LABEL_MAX_LEN - digest.length - 1;
91
- const prefix = normalized.slice(0, prefixMaxLen).replace(/[-.]+$/, '');
92
- return prefix ? `${prefix}-${digest}` : `scope-${digest}`;
93
- }
94
- function isVolumeMountFailure(error) {
95
- const message = error instanceof Error ? error.message : String(error);
96
- return /volume|mount|subpath/i.test(message);
97
- }
98
90
  function isUsableSandbox(sandbox) {
99
91
  const state = sandbox.state;
100
92
  if (!state)
101
93
  return true;
102
94
  return !DEAD_SANDBOX_STATES.has(state);
103
95
  }
104
- function hasMatchingVolumeMount(sandbox, expected) {
105
- const volumes = sandbox.volumes ?? [];
106
- return volumes.some((volume) => {
107
- const mount = volume;
108
- return (mount.volumeId === expected.volumeId &&
109
- mount.mountPath === expected.mountPath &&
110
- mount.subpath === expected.subpath);
111
- });
112
- }
113
96
  function truncateSandboxErrorDetail(value) {
114
97
  if (value.length <= MAX_SANDBOX_ERROR_DETAIL_CHARS)
115
98
  return value;
@@ -132,26 +115,50 @@ function assertKnowledgeFilesDirectoryAvailable(operation, result) {
132
115
  throw new n8n_workflow_1.OperationalError(`Agent knowledge ${operation} failed because the uploaded knowledge files directory is unavailable in the sandbox`);
133
116
  }
134
117
  let AgentKnowledgeSandboxService = class AgentKnowledgeSandboxService {
135
- constructor(agentsConfig, logger, aiService, instanceSettings, agentFileRepository, agentRepository) {
118
+ constructor(agentsConfig, logger, aiService, instanceSettings, agentFileRepository, agentRepository, binaryDataService) {
136
119
  this.agentsConfig = agentsConfig;
137
120
  this.logger = logger;
138
121
  this.aiService = aiService;
139
122
  this.instanceSettings = instanceSettings;
140
123
  this.agentFileRepository = agentFileRepository;
141
124
  this.agentRepository = agentRepository;
125
+ this.binaryDataService = binaryDataService;
142
126
  this.pendingSandboxAcquisitions = new Map();
127
+ this.mirrorManifestHashes = new ttl_map_1.TtlMap(MIRROR_MANIFEST_HASH_TTL_MS);
128
+ this.pendingMirrorSyncs = new Map();
143
129
  }
144
- async withKnowledgeFilesystem(projectId, agentId, userId, operation) {
130
+ async warmSandbox(projectId, agentId) {
145
131
  this.assertKnowledgeConfiguration(projectId, agentId);
146
- const sandbox = await this.acquireSandbox(projectId, agentId, userId);
147
- const filesystem = this.createFilesystemAdapter(sandbox);
148
- return await operation(filesystem);
132
+ await this.acquireSandbox(projectId, agentId);
149
133
  }
150
- async warmSandbox(projectId, agentId, userId) {
151
- this.assertKnowledgeConfiguration(projectId, agentId);
152
- await this.acquireSandbox(projectId, agentId, userId);
134
+ async destroySandbox(projectId, agentId) {
135
+ if (!(0, agent_knowledge_gate_1.isAgentKnowledgeBaseEnabled)(this.agentsConfig))
136
+ return;
137
+ try {
138
+ const { Daytona } = (0, sandbox_1.loadDaytona)();
139
+ const connection = await this.resolveDaytonaConnection(projectId);
140
+ const daytona = new Daytona({
141
+ apiUrl: connection.apiUrl,
142
+ apiKey: connection.apiKey,
143
+ });
144
+ const name = buildSandboxName({
145
+ instanceId: this.instanceSettings.instanceId,
146
+ projectId,
147
+ agentId,
148
+ });
149
+ const timeoutSeconds = Math.ceil(this.agentsConfig.sandboxTimeout / 1000);
150
+ const sandbox = await daytona.get(name);
151
+ await sandbox.delete(timeoutSeconds);
152
+ }
153
+ catch (error) {
154
+ this.logger.warn('Failed to destroy agent knowledge sandbox', {
155
+ projectId,
156
+ agentId,
157
+ error: error instanceof Error ? error.message : String(error),
158
+ });
159
+ }
153
160
  }
154
- async searchKnowledge(projectId, agentId, userId, request) {
161
+ async searchKnowledge(projectId, agentId, request) {
155
162
  const validatedRequest = (0, agent_knowledge_retrieval_1.parseSearchKnowledgeRequest)(request);
156
163
  const references = await this.loadKnowledgeReferenceLookup(projectId, agentId);
157
164
  const outputMode = validatedRequest.output_mode ?? 'content';
@@ -160,7 +167,7 @@ let AgentKnowledgeSandboxService = class AgentKnowledgeSandboxService {
160
167
  return emptySearchKnowledgeResult(outputMode, limit);
161
168
  }
162
169
  const scopedFilesByPath = new Map();
163
- for (const path of validatedRequest.path) {
170
+ for (const path of validatedRequest.path ?? []) {
164
171
  const file = this.resolveOptionalFile({ file: path }, references);
165
172
  if (!file) {
166
173
  throw new bad_request_error_1.BadRequestError('Knowledge file not found');
@@ -169,7 +176,7 @@ let AgentKnowledgeSandboxService = class AgentKnowledgeSandboxService {
169
176
  }
170
177
  const scopedFiles = [...scopedFilesByPath.values()];
171
178
  const command = (0, agent_knowledge_commands_1.buildSearchKnowledgeCommand)(validatedRequest, scopedFiles.map((file) => file.file));
172
- const result = await this.executeKnowledgeOperation(projectId, agentId, userId, command);
179
+ const result = await this.executeKnowledgeOperation(projectId, agentId, command, references.files);
173
180
  assertKnowledgeFilesDirectoryAvailable('search', result);
174
181
  if (result.exitCode === 1) {
175
182
  return emptySearchKnowledgeResult(outputMode, limit);
@@ -209,26 +216,28 @@ let AgentKnowledgeSandboxService = class AgentKnowledgeSandboxService {
209
216
  truncated: parsed.incomplete,
210
217
  };
211
218
  }
212
- async globKnowledgeFiles(projectId, agentId, _userId, request) {
219
+ async globKnowledgeFiles(projectId, agentId, request) {
213
220
  const validatedRequest = (0, agent_knowledge_retrieval_1.parseGlobKnowledgeFilesRequest)(request);
214
221
  const references = await this.loadKnowledgeReferenceLookup(projectId, agentId);
215
222
  const limit = validatedRequest.limit ?? agent_knowledge_retrieval_1.DEFAULT_GLOB_FILES_LIMIT;
223
+ const offset = validatedRequest.offset ?? 0;
216
224
  if (references.files.length === 0) {
217
- return { files: [], limit, hasMore: false };
225
+ return { files: [], limit, offset, hasMore: false };
218
226
  }
219
227
  const matches = matchKnowledgeFilesByGlob(references.files, validatedRequest);
220
228
  return {
221
- files: matches.slice(0, limit),
229
+ files: matches.slice(offset, offset + limit),
222
230
  limit,
223
- hasMore: matches.length > limit,
231
+ offset,
232
+ hasMore: matches.length > offset + limit,
224
233
  };
225
234
  }
226
- async readKnowledge(projectId, agentId, userId, request) {
235
+ async readKnowledge(projectId, agentId, request) {
227
236
  const validatedRequest = (0, agent_knowledge_retrieval_1.parseReadKnowledgeRequest)(request);
228
237
  const references = await this.loadKnowledgeReferenceLookup(projectId, agentId);
229
238
  const file = this.resolveRequiredFile(validatedRequest, references);
230
239
  const command = (0, agent_knowledge_commands_1.buildReadKnowledgeCommand)(file.file, validatedRequest);
231
- const result = await this.executeKnowledgeOperation(projectId, agentId, userId, command);
240
+ const result = await this.executeKnowledgeOperation(projectId, agentId, command, references.files);
232
241
  assertKnowledgeFilesDirectoryAvailable('read', result);
233
242
  if (result.exitCode !== 0) {
234
243
  throw new n8n_workflow_1.OperationalError(formatSandboxCommandFailure('read', result));
@@ -242,10 +251,16 @@ let AgentKnowledgeSandboxService = class AgentKnowledgeSandboxService {
242
251
  truncated: parsed.truncated,
243
252
  };
244
253
  }
245
- async executeKnowledgeOperation(projectId, agentId, userId, command) {
254
+ async executeKnowledgeOperation(projectId, agentId, command, files) {
246
255
  const timeoutSeconds = Math.ceil(this.agentsConfig.sandboxTimeout / 1000);
247
256
  const scopedCommand = (0, agent_knowledge_commands_1.buildScopedKnowledgeShellCommand)(command);
248
- const sandbox = await this.acquireSandbox(projectId, agentId, userId);
257
+ const sandbox = await this.acquireSandbox(projectId, agentId);
258
+ const sandboxName = buildSandboxName({
259
+ instanceId: this.instanceSettings.instanceId,
260
+ projectId,
261
+ agentId,
262
+ });
263
+ await this.ensureMirrorSynced(sandbox, files, sandboxName);
249
264
  const result = await sandbox.process.executeCommand(scopedCommand, undefined, undefined, timeoutSeconds);
250
265
  return {
251
266
  exitCode: result.exitCode,
@@ -257,6 +272,128 @@ let AgentKnowledgeSandboxService = class AgentKnowledgeSandboxService {
257
272
  : '',
258
273
  };
259
274
  }
275
+ async ensureMirrorSynced(sandbox, files, sandboxName) {
276
+ const expectedHash = hashManifestNames(files.map((file) => file.file));
277
+ if (this.mirrorManifestHashes.get(sandboxName) === expectedHash) {
278
+ return;
279
+ }
280
+ let pending = this.pendingMirrorSyncs.get(sandboxName);
281
+ if (!pending) {
282
+ pending = this.syncMirror(sandbox, files, expectedHash, sandboxName).finally(() => {
283
+ this.pendingMirrorSyncs.delete(sandboxName);
284
+ });
285
+ this.pendingMirrorSyncs.set(sandboxName, pending);
286
+ }
287
+ await pending;
288
+ }
289
+ async syncMirror(sandbox, files, expectedHash, sandboxName) {
290
+ if (this.mirrorManifestHashes.get(sandboxName) === expectedHash)
291
+ return;
292
+ const manifestResult = await sandbox.process.executeCommand((0, agent_knowledge_commands_1.buildReadMirrorManifestCommand)(), undefined, undefined, agent_knowledge_commands_1.MIRROR_SYNC_TIMEOUT_SECONDS);
293
+ const present = parseManifestNames(extractCommandOutput(manifestResult));
294
+ const expectedNames = files.map((file) => file.file);
295
+ const expectedSet = new Set(expectedNames);
296
+ const presentSet = new Set(present);
297
+ const toCopy = expectedNames.filter((name) => !presentSet.has(name));
298
+ const toDelete = present.filter((name) => !expectedSet.has(name));
299
+ if (toCopy.length === 0 && toDelete.length === 0) {
300
+ this.mirrorManifestHashes.set(sandboxName, expectedHash);
301
+ return;
302
+ }
303
+ for (const name of [...expectedNames, ...toDelete]) {
304
+ (0, agent_knowledge_storage_1.assertKnowledgePathSegment)(name, 'knowledge mirror file name');
305
+ }
306
+ if (present.length === 0 && toCopy.length > 0) {
307
+ const totalBytes = files.reduce((total, file) => total + file.fileSizeBytes, 0);
308
+ if (totalBytes > MIRROR_DISK_FIT_WARNING_BYTES) {
309
+ this.logger.warn('Agent knowledge mirror copy exceeds the disk-fit guard threshold', {
310
+ sandboxName,
311
+ totalBytes,
312
+ });
313
+ }
314
+ }
315
+ const filesByName = new Map(files.map((file) => [file.file, file]));
316
+ const copiedNames = await this.uploadMirrorFiles(sandbox, toCopy, filesByName, sandboxName);
317
+ const finalManifestNames = expectedNames.filter((name) => copiedNames.has(name) || presentSet.has(name));
318
+ const syncResult = await sandbox.process.executeCommand((0, agent_knowledge_commands_1.buildMirrorFinalizeCommand)([...copiedNames], toDelete, finalManifestNames), undefined, undefined, agent_knowledge_commands_1.MIRROR_SYNC_TIMEOUT_SECONDS);
319
+ if (syncResult.exitCode !== 0) {
320
+ throw new n8n_workflow_1.OperationalError(`Agent knowledge mirror sync failed: exitCode=${syncResult.exitCode}; output=${sanitizeSandboxErrorDetail(extractCommandOutput(syncResult))}`);
321
+ }
322
+ this.mirrorManifestHashes.set(sandboxName, hashManifestNames(finalManifestNames));
323
+ }
324
+ async uploadMirrorFiles(sandbox, names, filesByName, sandboxName) {
325
+ const copiedNames = new Set();
326
+ if (names.length === 0)
327
+ return copiedNames;
328
+ await sandbox.fs.createFolder(agent_knowledge_storage_1.KNOWLEDGE_MIRROR_FILES_DIR, '755');
329
+ let batch = [];
330
+ let batchNames = [];
331
+ let batchBytes = 0;
332
+ const flushBatch = async () => {
333
+ if (batch.length === 0)
334
+ return;
335
+ await sandbox.fs.uploadFiles(batch);
336
+ for (const name of batchNames)
337
+ copiedNames.add(name);
338
+ batch = [];
339
+ batchNames = [];
340
+ batchBytes = 0;
341
+ };
342
+ for (const name of names) {
343
+ const file = filesByName.get(name);
344
+ if (!file)
345
+ continue;
346
+ try {
347
+ const buffer = await this.binaryDataService.getAsBuffer({
348
+ id: file.binaryDataId,
349
+ data: '',
350
+ mimeType: file.mimeType,
351
+ });
352
+ batch.push({ source: buffer, destination: `${agent_knowledge_storage_1.KNOWLEDGE_MIRROR_FILES_DIR}/.tmp-${name}` });
353
+ batchNames.push(name);
354
+ batchBytes += buffer.length;
355
+ }
356
+ catch (error) {
357
+ this.logger.warn('Failed to load agent knowledge file for mirror sync', {
358
+ sandboxName,
359
+ file: name,
360
+ error: error instanceof Error ? error.message : String(error),
361
+ });
362
+ continue;
363
+ }
364
+ if (batchBytes >= MIRROR_UPLOAD_BATCH_BYTES) {
365
+ await flushBatch();
366
+ }
367
+ }
368
+ await flushBatch();
369
+ return copiedNames;
370
+ }
371
+ prewarmMirrorInBackground(projectId, agentId) {
372
+ void (async () => {
373
+ const references = await this.loadKnowledgeReferenceLookup(projectId, agentId);
374
+ const sandbox = await this.acquireSandbox(projectId, agentId);
375
+ const sandboxName = buildSandboxName({
376
+ instanceId: this.instanceSettings.instanceId,
377
+ projectId,
378
+ agentId,
379
+ });
380
+ await this.ensureMirrorSynced(sandbox, references.files, sandboxName);
381
+ })().catch((error) => {
382
+ this.logger.warn('Agent knowledge mirror pre-warm failed', {
383
+ projectId,
384
+ agentId,
385
+ error: error instanceof Error ? error.message : String(error),
386
+ });
387
+ });
388
+ }
389
+ invalidateMirror(projectId, agentId) {
390
+ const sandboxName = buildSandboxName({
391
+ instanceId: this.instanceSettings.instanceId,
392
+ projectId,
393
+ agentId,
394
+ });
395
+ this.mirrorManifestHashes.delete(sandboxName);
396
+ }
260
397
  async loadKnowledgeReferenceLookup(projectId, agentId) {
261
398
  await this.assertKnowledgeAccess(projectId, agentId);
262
399
  const files = await this.loadKnowledgeFileReferences(agentId);
@@ -269,8 +406,9 @@ let AgentKnowledgeSandboxService = class AgentKnowledgeSandboxService {
269
406
  async loadKnowledgeFileReferences(agentId) {
270
407
  const files = await this.agentFileRepository.findByAgentId(agentId);
271
408
  return files.map((file) => ({
272
- file: (0, agent_knowledge_storage_1.fromVolumeStorageReference)(file.binaryDataId),
409
+ file: (0, agent_knowledge_storage_1.storageFileNameForOriginalFileName)(file.fileName),
273
410
  fileId: file.id,
411
+ binaryDataId: file.binaryDataId,
274
412
  displayName: file.fileName,
275
413
  mimeType: file.mimeType,
276
414
  fileSizeBytes: file.fileSizeBytes,
@@ -310,62 +448,43 @@ let AgentKnowledgeSandboxService = class AgentKnowledgeSandboxService {
310
448
  }
311
449
  return file;
312
450
  }
313
- createFilesystemAdapter(sandbox) {
314
- return {
315
- uploadFiles: async (files) => {
316
- if (files.length === 0) {
317
- return;
318
- }
319
- await sandbox.fs.uploadFiles(files.map((file) => ({ source: file.source, destination: file.destination })));
320
- },
321
- deleteFile: async (filePath, recursive) => await sandbox.fs.deleteFile(filePath, recursive),
322
- ensureDir: async (dirPath) => await sandbox.fs.createFolder(dirPath, '755'),
323
- };
324
- }
325
- async acquireSandbox(projectId, agentId, ownerUserId, sandboxScopeId = ownerUserId) {
326
- const cacheKey = buildSandboxScopeKey(projectId, agentId, ownerUserId, sandboxScopeId);
451
+ async acquireSandbox(projectId, agentId) {
452
+ const cacheKey = buildSandboxScopeKey(projectId, agentId);
327
453
  let pending = this.pendingSandboxAcquisitions.get(cacheKey);
328
454
  if (!pending) {
329
- pending = this.acquireSandboxFresh(projectId, agentId, ownerUserId, sandboxScopeId).finally(() => {
455
+ pending = this.acquireSandboxFresh(projectId, agentId).finally(() => {
330
456
  this.pendingSandboxAcquisitions.delete(cacheKey);
331
457
  });
332
458
  this.pendingSandboxAcquisitions.set(cacheKey, pending);
333
459
  }
334
460
  return await pending;
335
461
  }
336
- async acquireSandboxFresh(projectId, agentId, ownerUserId, sandboxScopeId) {
462
+ async acquireSandboxFresh(projectId, agentId) {
463
+ const agent = await this.agentRepository.findByIdAndProjectId(agentId, projectId);
464
+ if (!agent) {
465
+ throw new not_found_error_1.NotFoundError(`Agent "${agentId}" not found`);
466
+ }
467
+ if (agent.activeVersionId === null) {
468
+ throw new n8n_workflow_1.OperationalError('Knowledge base is only available for published agents. Publish the agent first.');
469
+ }
337
470
  const { Daytona } = (0, sandbox_1.loadDaytona)();
338
- const connection = await this.resolveDaytonaConnection(ownerUserId);
471
+ const connection = await this.resolveDaytonaConnection(projectId);
339
472
  const daytona = new Daytona({
340
473
  apiUrl: connection.apiUrl,
341
474
  apiKey: connection.apiKey,
342
475
  });
343
- const labels = buildScopeLabels(projectId, agentId, ownerUserId, sandboxScopeId);
476
+ const labels = buildScopeLabels(projectId, agentId);
344
477
  const timeoutSeconds = Math.ceil(this.agentsConfig.sandboxTimeout / 1000);
345
- const volumeMount = this.buildVolumeMount(projectId, agentId);
346
478
  const name = buildSandboxName({
347
479
  instanceId: this.instanceSettings.instanceId,
348
480
  projectId,
349
481
  agentId,
350
- ownerUserId,
351
- sandboxScopeId,
352
482
  });
353
- const sandboxByName = await this.resolveSandboxByName(daytona, name, volumeMount, timeoutSeconds, connection);
483
+ const sandboxByName = await this.resolveSandboxByName(daytona, name, timeoutSeconds, connection);
354
484
  if (sandboxByName) {
355
485
  this.logger.debug('Reused agent knowledge sandbox', { projectId, agentId, name });
356
486
  return sandboxByName;
357
487
  }
358
- for await (const sandbox of daytona.list({ labels, limit: SANDBOX_LIST_PAGE_SIZE })) {
359
- if (!isUsableSandbox(sandbox) || !hasMatchingVolumeMount(sandbox, volumeMount)) {
360
- continue;
361
- }
362
- if (sandbox.state !== SANDBOX_STATE_STARTED) {
363
- await sandbox.start(timeoutSeconds);
364
- }
365
- const reusableSandbox = await this.resolveReusableSandbox(daytona, sandbox, connection);
366
- this.logger.debug('Reused agent knowledge sandbox', { projectId, agentId });
367
- return reusableSandbox;
368
- }
369
488
  const image = connection.image;
370
489
  const baseCreateParams = {
371
490
  name,
@@ -373,39 +492,29 @@ let AgentKnowledgeSandboxService = class AgentKnowledgeSandboxService {
373
492
  language: 'typescript',
374
493
  ephemeral: this.agentsConfig.sandboxEphemeral,
375
494
  autoStopInterval: AUTO_STOP_INTERVAL_MINUTES,
376
- volumes: [volumeMount],
377
495
  };
378
496
  let sandbox;
379
- try {
380
- if (connection.snapshot) {
381
- try {
382
- sandbox = await daytona.create({ ...baseCreateParams, snapshot: connection.snapshot }, { timeout: timeoutSeconds });
383
- }
384
- catch (error) {
385
- this.logger.warn('Agent knowledge sandbox create from snapshot failed; falling back to image', {
386
- projectId,
387
- agentId,
388
- snapshotName: connection.snapshot,
389
- error: error instanceof Error ? error.message : String(error),
390
- });
391
- sandbox = await daytona.create({ ...baseCreateParams, image }, { timeout: timeoutSeconds });
392
- }
497
+ if (connection.snapshot) {
498
+ try {
499
+ sandbox = await daytona.create({ ...baseCreateParams, snapshot: connection.snapshot }, { timeout: timeoutSeconds });
393
500
  }
394
- else {
501
+ catch (error) {
502
+ this.logger.warn('Agent knowledge sandbox create from snapshot failed; falling back to image', {
503
+ projectId,
504
+ agentId,
505
+ snapshotName: connection.snapshot,
506
+ error: error instanceof Error ? error.message : String(error),
507
+ });
395
508
  sandbox = await daytona.create({ ...baseCreateParams, image }, { timeout: timeoutSeconds });
396
509
  }
397
510
  }
398
- catch (error) {
399
- if (connection.mode === 'proxy' && isVolumeMountFailure(error)) {
400
- const message = error instanceof Error ? error.message : String(error);
401
- throw new n8n_workflow_1.OperationalError(`Agent knowledge sandbox creation failed through the AI Assistant sandbox proxy: ${message}. If the proxy does not support volume mounts, enable them before using the agent knowledge base.`, { cause: error });
402
- }
403
- throw error;
511
+ else {
512
+ sandbox = await daytona.create({ ...baseCreateParams, image }, { timeout: timeoutSeconds });
404
513
  }
405
514
  this.logger.debug('Created agent knowledge sandbox', { projectId, agentId, name });
406
515
  return sandbox;
407
516
  }
408
- async resolveDaytonaConnection(userId) {
517
+ async resolveDaytonaConnection(projectId) {
409
518
  const directImage = this.agentsConfig.sandboxImage || DEFAULT_SANDBOX_IMAGE;
410
519
  const snapshot = this.agentsConfig.sandboxSnapshot.trim() || undefined;
411
520
  if (!this.aiService.isProxyEnabled()) {
@@ -419,7 +528,7 @@ let AgentKnowledgeSandboxService = class AgentKnowledgeSandboxService {
419
528
  }
420
529
  const client = await this.aiService.getClient();
421
530
  const proxyConfig = await client.getSandboxProxyConfig();
422
- const token = await client.getBuilderApiProxyToken({ id: userId }, { userMessageId: (0, nanoid_1.nanoid)() });
531
+ const token = await client.getBuilderApiProxyToken({ id: projectId }, { userMessageId: (0, nanoid_1.nanoid)() });
423
532
  return {
424
533
  mode: 'proxy',
425
534
  apiUrl: client.getSandboxProxyBaseUrl(),
@@ -428,14 +537,7 @@ let AgentKnowledgeSandboxService = class AgentKnowledgeSandboxService {
428
537
  snapshot,
429
538
  };
430
539
  }
431
- buildVolumeMount(projectId, agentId) {
432
- return {
433
- volumeId: this.agentsConfig.daytonaVolumeId,
434
- mountPath: agent_knowledge_storage_1.AGENT_KNOWLEDGE_VOLUME_MOUNT_PATH,
435
- subpath: (0, agent_knowledge_storage_1.buildKnowledgeVolumeSubpath)(this.instanceSettings.instanceId, projectId, agentId),
436
- };
437
- }
438
- async resolveSandboxByName(daytona, name, volumeMount, timeoutSeconds, connection) {
540
+ async resolveSandboxByName(daytona, name, timeoutSeconds, connection) {
439
541
  let sandbox;
440
542
  try {
441
543
  sandbox = await daytona.get(name);
@@ -450,9 +552,6 @@ let AgentKnowledgeSandboxService = class AgentKnowledgeSandboxService {
450
552
  await sandbox.delete(timeoutSeconds);
451
553
  return undefined;
452
554
  }
453
- if (!hasMatchingVolumeMount(sandbox, volumeMount)) {
454
- throw new n8n_workflow_1.OperationalError('Agent knowledge sandbox has an unexpected volume mount');
455
- }
456
555
  if (sandbox.state !== SANDBOX_STATE_STARTED) {
457
556
  await sandbox.start(timeoutSeconds);
458
557
  }
@@ -489,11 +588,6 @@ let AgentKnowledgeSandboxService = class AgentKnowledgeSandboxService {
489
588
  if ((0, agent_knowledge_gate_1.isAgentKnowledgeBaseEnabled)(this.agentsConfig)) {
490
589
  return;
491
590
  }
492
- if (this.agentsConfig.sandboxEnabled &&
493
- this.agentsConfig.sandboxProvider === 'daytona' &&
494
- !this.agentsConfig.daytonaVolumeId.trim()) {
495
- throw new n8n_workflow_1.OperationalError('Agent knowledge Daytona volume is not configured');
496
- }
497
591
  throw new n8n_workflow_1.OperationalError('Agent knowledge sandbox is not enabled');
498
592
  }
499
593
  };
@@ -505,21 +599,20 @@ exports.AgentKnowledgeSandboxService = AgentKnowledgeSandboxService = __decorate
505
599
  ai_service_1.AiService,
506
600
  n8n_core_1.InstanceSettings,
507
601
  agent_file_repository_1.AgentFileRepository,
508
- agent_repository_1.AgentRepository])
602
+ agent_repository_1.AgentRepository,
603
+ n8n_core_1.BinaryDataService])
509
604
  ], AgentKnowledgeSandboxService);
510
605
  function matchKnowledgeFilesByGlob(files, request) {
511
606
  const caseSensitive = request.caseSensitive === true;
512
607
  const regex = globPatternToRegExp(request.pattern, caseSensitive);
513
608
  const patternTokens = tokenizeKnowledgeFilePattern(request.pattern, caseSensitive);
514
609
  return files
515
- .map((file, index) => ({ file, index }))
516
- .filter(({ file }) => regex.test(file.file) || regex.test(file.displayName))
517
- .map(({ file, index }) => ({
610
+ .filter((file) => regex.test(file.file) || regex.test(file.displayName))
611
+ .map((file) => ({
518
612
  file,
519
- index,
520
613
  bucket: getKnowledgeFileMatchBucket(file, patternTokens, caseSensitive),
521
614
  }))
522
- .sort((left, right) => left.bucket - right.bucket || left.index - right.index)
615
+ .sort((left, right) => left.bucket - right.bucket || left.file.displayName.localeCompare(right.file.displayName))
523
616
  .map(({ file }) => file);
524
617
  }
525
618
  function getKnowledgeFileMatchBucket(file, patternTokens, caseSensitive) {