n8n 2.39.5 → 2.40.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 (1099) hide show
  1. package/dist/agent-library-bundle.js +178 -11
  2. package/dist/auth/auth.service.d.ts +5 -0
  3. package/dist/auth/auth.service.js +35 -2
  4. package/dist/auth/auth.service.js.map +1 -1
  5. package/dist/binary-data/binary-data-access.service.d.ts +1 -1
  6. package/dist/binary-data/binary-data-access.service.js +15 -6
  7. package/dist/binary-data/binary-data-access.service.js.map +1 -1
  8. package/dist/binary-data/database.manager.js +1 -1
  9. package/dist/binary-data/database.manager.js.map +1 -1
  10. package/dist/build.tsbuildinfo +1 -1
  11. package/dist/commands/base-command.d.ts +1 -0
  12. package/dist/commands/base-command.js +11 -1
  13. package/dist/commands/base-command.js.map +1 -1
  14. package/dist/commands/execute-batch.js.map +1 -1
  15. package/dist/commands/list/workflow.js +1 -4
  16. package/dist/commands/list/workflow.js.map +1 -1
  17. package/dist/commands/publish/workflow.js +1 -5
  18. package/dist/commands/publish/workflow.js.map +1 -1
  19. package/dist/commands/start.js +1 -7
  20. package/dist/commands/start.js.map +1 -1
  21. package/dist/commands/ttwf/generate.js +1 -4
  22. package/dist/commands/ttwf/generate.js.map +1 -1
  23. package/dist/commands/unpublish/workflow.js +1 -5
  24. package/dist/commands/unpublish/workflow.js.map +1 -1
  25. package/dist/commands/update/workflow.js +1 -5
  26. package/dist/commands/update/workflow.js.map +1 -1
  27. package/dist/controller.registry.d.ts +1 -1
  28. package/dist/controller.registry.js +3 -3
  29. package/dist/controller.registry.js.map +1 -1
  30. package/dist/controllers/ai-preference.controller.d.ts +17 -0
  31. package/dist/controllers/ai-preference.controller.js +78 -0
  32. package/dist/controllers/ai-preference.controller.js.map +1 -0
  33. package/dist/controllers/change-email.controller.d.ts +31 -0
  34. package/dist/controllers/change-email.controller.js +164 -0
  35. package/dist/controllers/change-email.controller.js.map +1 -0
  36. package/dist/controllers/me.controller.d.ts +3 -2
  37. package/dist/controllers/me.controller.js +10 -42
  38. package/dist/controllers/me.controller.js.map +1 -1
  39. package/dist/credentials/dynamic-credentials-proxy.js.map +1 -1
  40. package/dist/credentials/executing-user-identifier-proxy.d.ts +7 -0
  41. package/dist/credentials/executing-user-identifier-proxy.js +25 -0
  42. package/dist/credentials/executing-user-identifier-proxy.js.map +1 -0
  43. package/dist/credentials/executing-user-identifier.interface.d.ts +4 -0
  44. package/dist/credentials/executing-user-identifier.interface.js +3 -0
  45. package/dist/credentials/executing-user-identifier.interface.js.map +1 -0
  46. package/dist/credentials/mock-node-types.d.ts +5 -0
  47. package/dist/credentials/mock-node-types.js +34 -0
  48. package/dist/credentials/mock-node-types.js.map +1 -0
  49. package/dist/credentials-helper.js +5 -27
  50. package/dist/credentials-helper.js.map +1 -1
  51. package/dist/deprecation/deprecation.service.js +6 -2
  52. package/dist/deprecation/deprecation.service.js.map +1 -1
  53. package/dist/encryption/key-manager.service.js +3 -1
  54. package/dist/encryption/key-manager.service.js.map +1 -1
  55. package/dist/encryption/key-rotation-flag.js +2 -1
  56. package/dist/encryption/key-rotation-flag.js.map +1 -1
  57. package/dist/errors/pre-execute-blocked.error.d.ts +6 -0
  58. package/dist/errors/pre-execute-blocked.error.js +15 -0
  59. package/dist/errors/pre-execute-blocked.error.js.map +1 -0
  60. package/dist/eventbus/event-message-classes/event-message-audit.js.map +1 -1
  61. package/dist/eventbus/event-message-classes/event-message-generic.js.map +1 -1
  62. package/dist/eventbus/event-message-classes/event-message-mcp.js.map +1 -1
  63. package/dist/eventbus/event-message-classes/event-message-workflow.js.map +1 -1
  64. package/dist/eventbus/message-event-bus/message-event-bus.d.ts +3 -1
  65. package/dist/eventbus/message-event-bus/message-event-bus.js +5 -3
  66. package/dist/eventbus/message-event-bus/message-event-bus.js.map +1 -1
  67. package/dist/eventbus/message-event-bus-writer/message-event-bus-log-writer.js.map +1 -1
  68. package/dist/events/maps/relay.event-map.d.ts +22 -2
  69. package/dist/events/relays/telemetry.event-relay.d.ts +6 -0
  70. package/dist/events/relays/telemetry.event-relay.js +88 -1
  71. package/dist/events/relays/telemetry.event-relay.js.map +1 -1
  72. package/dist/execution-lifecycle/execution-lifecycle-hooks.js +22 -10
  73. package/dist/execution-lifecycle/execution-lifecycle-hooks.js.map +1 -1
  74. package/dist/execution-lifecycle/restore-binary-data-id.js +2 -2
  75. package/dist/execution-lifecycle/restore-binary-data-id.js.map +1 -1
  76. package/dist/executions/enqueued-execution-recovery.service.d.ts +3 -3
  77. package/dist/executions/enqueued-execution-recovery.service.js +6 -6
  78. package/dist/executions/enqueued-execution-recovery.service.js.map +1 -1
  79. package/dist/executions/execution-crash.service.d.ts +12 -0
  80. package/dist/executions/execution-crash.service.js +43 -0
  81. package/dist/executions/execution-crash.service.js.map +1 -0
  82. package/dist/executions/execution-recovery.service.d.ts +3 -1
  83. package/dist/executions/execution-recovery.service.js +6 -4
  84. package/dist/executions/execution-recovery.service.js.map +1 -1
  85. package/dist/executions/execution.service.js.map +1 -1
  86. package/dist/executions/pre-execution-checks/credentials-permission-checker.d.ts +5 -2
  87. package/dist/executions/pre-execution-checks/credentials-permission-checker.js +20 -29
  88. package/dist/executions/pre-execution-checks/credentials-permission-checker.js.map +1 -1
  89. package/dist/executions/pre-execution-checks/index.d.ts +1 -0
  90. package/dist/executions/pre-execution-checks/index.js +3 -1
  91. package/dist/executions/pre-execution-checks/index.js.map +1 -1
  92. package/dist/executions/pre-execution-checks/workflow-pre-execute.d.ts +16 -0
  93. package/dist/executions/pre-execution-checks/workflow-pre-execute.js +96 -0
  94. package/dist/executions/pre-execution-checks/workflow-pre-execute.js.map +1 -0
  95. package/dist/instance-settings-loader/loaders/sso/provisioning.instance-settings-loader.js +25 -3
  96. package/dist/instance-settings-loader/loaders/sso/provisioning.instance-settings-loader.js.map +1 -1
  97. package/dist/license/license-renewal.task.d.ts +13 -0
  98. package/dist/license/license-renewal.task.js +38 -0
  99. package/dist/license/license-renewal.task.js.map +1 -0
  100. package/dist/license.d.ts +1 -2
  101. package/dist/license.js +5 -19
  102. package/dist/license.js.map +1 -1
  103. package/dist/load-nodes-and-credentials.d.ts +1 -0
  104. package/dist/load-nodes-and-credentials.js +7 -2
  105. package/dist/load-nodes-and-credentials.js.map +1 -1
  106. package/dist/metrics/prometheus/encryption-metrics.service.d.ts +10 -0
  107. package/dist/metrics/prometheus/encryption-metrics.service.js +55 -0
  108. package/dist/metrics/prometheus/encryption-metrics.service.js.map +1 -0
  109. package/dist/metrics/prometheus/prometheus.service.d.ts +2 -1
  110. package/dist/metrics/prometheus/prometheus.service.js +4 -2
  111. package/dist/metrics/prometheus/prometheus.service.js.map +1 -1
  112. package/dist/modules/agents/agent-chat.controller.d.ts +11 -2
  113. package/dist/modules/agents/agent-chat.controller.js +42 -2
  114. package/dist/modules/agents/agent-chat.controller.js.map +1 -1
  115. package/dist/modules/agents/agent-checkpoint-pruning.task.d.ts +14 -0
  116. package/dist/modules/agents/agent-checkpoint-pruning.task.js +38 -0
  117. package/dist/modules/agents/agent-checkpoint-pruning.task.js.map +1 -0
  118. package/dist/modules/agents/agent-config.service.d.ts +7 -7
  119. package/dist/modules/agents/agent-config.service.js +13 -3
  120. package/dist/modules/agents/agent-config.service.js.map +1 -1
  121. package/dist/modules/agents/agent-custom-tools.service.d.ts +3 -1
  122. package/dist/modules/agents/agent-custom-tools.service.js +6 -2
  123. package/dist/modules/agents/agent-custom-tools.service.js.map +1 -1
  124. package/dist/modules/agents/agent-execution-orchestrator.service.d.ts +34 -2
  125. package/dist/modules/agents/agent-execution-orchestrator.service.js +143 -16
  126. package/dist/modules/agents/agent-execution-orchestrator.service.js.map +1 -1
  127. package/dist/modules/agents/agent-execution-update-broadcaster.d.ts +6 -1
  128. package/dist/modules/agents/agent-execution-update-broadcaster.js +34 -2
  129. package/dist/modules/agents/agent-execution-update-broadcaster.js.map +1 -1
  130. package/dist/modules/agents/agent-execution.service.d.ts +5 -2
  131. package/dist/modules/agents/agent-execution.service.js +2 -1
  132. package/dist/modules/agents/agent-execution.service.js.map +1 -1
  133. package/dist/modules/agents/agent-integration-management.service.d.ts +2 -0
  134. package/dist/modules/agents/agent-integration-management.service.js +4 -0
  135. package/dist/modules/agents/agent-integration-management.service.js.map +1 -1
  136. package/dist/modules/agents/agent-integrations.controller.d.ts +3 -1
  137. package/dist/modules/agents/agent-integrations.controller.js +7 -5
  138. package/dist/modules/agents/agent-integrations.controller.js.map +1 -1
  139. package/dist/modules/agents/agent-interrupted-execution-sweeper.d.ts +3 -1
  140. package/dist/modules/agents/agent-interrupted-execution-sweeper.js +10 -2
  141. package/dist/modules/agents/agent-interrupted-execution-sweeper.js.map +1 -1
  142. package/dist/modules/agents/agent-knowledge-commands.js +2 -2
  143. package/dist/modules/agents/agent-knowledge-commands.js.map +1 -1
  144. package/dist/modules/agents/agent-modification-telemetry.service.d.ts +1 -0
  145. package/dist/modules/agents/agent-modification-telemetry.service.js.map +1 -1
  146. package/dist/modules/agents/agent-publish.controller.d.ts +8 -0
  147. package/dist/modules/agents/agent-publish.controller.js +4 -4
  148. package/dist/modules/agents/agent-publish.controller.js.map +1 -1
  149. package/dist/modules/agents/agent-publish.service.d.ts +7 -5
  150. package/dist/modules/agents/agent-publish.service.js +12 -6
  151. package/dist/modules/agents/agent-publish.service.js.map +1 -1
  152. package/dist/modules/agents/agent-runnable-state.service.d.ts +2 -0
  153. package/dist/modules/agents/agent-runnable-state.service.js +8 -0
  154. package/dist/modules/agents/agent-runnable-state.service.js.map +1 -1
  155. package/dist/modules/agents/agent-runtime-cache.service.d.ts +3 -0
  156. package/dist/modules/agents/agent-runtime-cache.service.js +8 -3
  157. package/dist/modules/agents/agent-runtime-cache.service.js.map +1 -1
  158. package/dist/modules/agents/agent-runtime-reconstruction.service.d.ts +7 -1
  159. package/dist/modules/agents/agent-runtime-reconstruction.service.js +34 -11
  160. package/dist/modules/agents/agent-runtime-reconstruction.service.js.map +1 -1
  161. package/dist/modules/agents/agent-sandbox-principal.d.ts +2 -2
  162. package/dist/modules/agents/agent-sandbox-principal.js +2 -2
  163. package/dist/modules/agents/agent-sandbox-principal.js.map +1 -1
  164. package/dist/modules/agents/agent-sandbox-runtime.service.js +9 -8
  165. package/dist/modules/agents/agent-sandbox-runtime.service.js.map +1 -1
  166. package/dist/modules/agents/agent-session-langsmith-export.service.js +110 -10
  167. package/dist/modules/agents/agent-session-langsmith-export.service.js.map +1 -1
  168. package/dist/modules/agents/agent-skills.service.d.ts +4 -2
  169. package/dist/modules/agents/agent-skills.service.js +30 -6
  170. package/dist/modules/agents/agent-skills.service.js.map +1 -1
  171. package/dist/modules/agents/agent-sse-stream.js.map +1 -1
  172. package/dist/modules/agents/agent-task.service.d.ts +6 -2
  173. package/dist/modules/agents/agent-task.service.js +79 -91
  174. package/dist/modules/agents/agent-task.service.js.map +1 -1
  175. package/dist/modules/agents/agent-tasks.controller.js +3 -0
  176. package/dist/modules/agents/agent-tasks.controller.js.map +1 -1
  177. package/dist/modules/agents/agent-test-chat.service.js +8 -1
  178. package/dist/modules/agents/agent-test-chat.service.js.map +1 -1
  179. package/dist/modules/agents/agent-test-run.service.d.ts +3 -1
  180. package/dist/modules/agents/agent-test-run.service.js +5 -3
  181. package/dist/modules/agents/agent-test-run.service.js.map +1 -1
  182. package/dist/modules/agents/agent-update-broadcaster.d.ts +22 -0
  183. package/dist/modules/agents/agent-update-broadcaster.js +74 -0
  184. package/dist/modules/agents/agent-update-broadcaster.js.map +1 -0
  185. package/dist/modules/agents/agent-validation.service.js.map +1 -1
  186. package/dist/modules/agents/agent-workflow-execution.service.d.ts +3 -1
  187. package/dist/modules/agents/agent-workflow-execution.service.js +7 -3
  188. package/dist/modules/agents/agent-workflow-execution.service.js.map +1 -1
  189. package/dist/modules/agents/agent-workflow-tool-resume.service.js +1 -0
  190. package/dist/modules/agents/agent-workflow-tool-resume.service.js.map +1 -1
  191. package/dist/modules/agents/agents-config.controller.d.ts +214 -219
  192. package/dist/modules/agents/agents-config.controller.js +7 -2
  193. package/dist/modules/agents/agents-config.controller.js.map +1 -1
  194. package/dist/modules/agents/agents-skills.controller.js +6 -2
  195. package/dist/modules/agents/agents-skills.controller.js.map +1 -1
  196. package/dist/modules/agents/agents.controller.d.ts +4 -0
  197. package/dist/modules/agents/agents.controller.js +12 -1
  198. package/dist/modules/agents/agents.controller.js.map +1 -1
  199. package/dist/modules/agents/agents.module.d.ts +2 -1
  200. package/dist/modules/agents/agents.module.js +25 -2
  201. package/dist/modules/agents/agents.module.js.map +1 -1
  202. package/dist/modules/agents/agents.service.d.ts +9 -4
  203. package/dist/modules/agents/agents.service.js +29 -7
  204. package/dist/modules/agents/agents.service.js.map +1 -1
  205. package/dist/modules/agents/background/agent-background-job.service.d.ts +16 -3
  206. package/dist/modules/agents/background/agent-background-job.service.js +105 -6
  207. package/dist/modules/agents/background/agent-background-job.service.js.map +1 -1
  208. package/dist/modules/agents/background/agent-wake.service.d.ts +47 -0
  209. package/dist/modules/agents/background/agent-wake.service.js +237 -0
  210. package/dist/modules/agents/background/agent-wake.service.js.map +1 -0
  211. package/dist/modules/agents/background/background-job-messages.d.ts +7 -0
  212. package/dist/modules/agents/background/background-job-messages.js +42 -0
  213. package/dist/modules/agents/background/background-job-messages.js.map +1 -0
  214. package/dist/modules/agents/background/background-job-tools.js +45 -12
  215. package/dist/modules/agents/background/background-job-tools.js.map +1 -1
  216. package/dist/modules/agents/background/sub-agent-background-runner.d.ts +1 -1
  217. package/dist/modules/agents/background/sub-agent-background-runner.js +3 -3
  218. package/dist/modules/agents/background/sub-agent-background-runner.js.map +1 -1
  219. package/dist/modules/agents/builder/agent-builder-preview-path.js +1 -1
  220. package/dist/modules/agents/builder/agent-builder-preview-path.js.map +1 -1
  221. package/dist/modules/agents/builder/agents-builder-tools.service.d.ts +3 -2
  222. package/dist/modules/agents/builder/agents-builder-tools.service.js +29 -17
  223. package/dist/modules/agents/builder/agents-builder-tools.service.js.map +1 -1
  224. package/dist/modules/agents/builder/agents-builder.service.d.ts +4 -1
  225. package/dist/modules/agents/builder/agents-builder.service.js +12 -3
  226. package/dist/modules/agents/builder/agents-builder.service.js.map +1 -1
  227. package/dist/modules/agents/builder/builder-model-live-lookup.service.d.ts +7 -2
  228. package/dist/modules/agents/builder/builder-model-live-lookup.service.js +21 -3
  229. package/dist/modules/agents/builder/builder-model-live-lookup.service.js.map +1 -1
  230. package/dist/modules/agents/builder/format-preview-context.js +3 -0
  231. package/dist/modules/agents/builder/format-preview-context.js.map +1 -1
  232. package/dist/modules/agents/builder/get-resource-locator-options.tool.d.ts +2 -2
  233. package/dist/modules/agents/builder/prompts/config-rules.prompt.js +2 -3
  234. package/dist/modules/agents/builder/prompts/config-rules.prompt.js.map +1 -1
  235. package/dist/modules/agents/builder/skills/external-services.skill.js +2 -2
  236. package/dist/modules/agents/builder/skills/external-services.skill.js.map +1 -1
  237. package/dist/modules/agents/builder/skills/memory.skill.js +4 -4
  238. package/dist/modules/agents/builder/skills/memory.skill.js.map +1 -1
  239. package/dist/modules/agents/builder/skills/target-skills.skill.js +4 -2
  240. package/dist/modules/agents/builder/skills/target-skills.skill.js.map +1 -1
  241. package/dist/modules/agents/entities/agent-background-job.entity.d.ts +3 -0
  242. package/dist/modules/agents/entities/agent-background-job.entity.js +14 -1
  243. package/dist/modules/agents/entities/agent-background-job.entity.js.map +1 -1
  244. package/dist/modules/agents/entities/agent-execution.entity.d.ts +2 -0
  245. package/dist/modules/agents/entities/agent-execution.entity.js +4 -0
  246. package/dist/modules/agents/entities/agent-execution.entity.js.map +1 -1
  247. package/dist/modules/agents/entities/agent-memory-entry-candidate.entity.d.ts +15 -0
  248. package/dist/modules/agents/entities/agent-memory-entry-candidate.entity.js +70 -0
  249. package/dist/modules/agents/entities/agent-memory-entry-candidate.entity.js.map +1 -0
  250. package/dist/modules/agents/entities/agent-memory-entry-source.entity.d.ts +2 -1
  251. package/dist/modules/agents/entities/agent-memory-entry-source.entity.js +11 -2
  252. package/dist/modules/agents/entities/agent-memory-entry-source.entity.js.map +1 -1
  253. package/dist/modules/agents/entities/agent-message.entity.js +2 -1
  254. package/dist/modules/agents/entities/agent-message.entity.js.map +1 -1
  255. package/dist/modules/agents/episodic-memory.d.ts +2 -2
  256. package/dist/modules/agents/episodic-memory.js +1 -4
  257. package/dist/modules/agents/episodic-memory.js.map +1 -1
  258. package/dist/modules/agents/execution-recorder.d.ts +6 -2
  259. package/dist/modules/agents/execution-recorder.js +17 -6
  260. package/dist/modules/agents/execution-recorder.js.map +1 -1
  261. package/dist/modules/agents/instance-ai-builder-delegate.adapter.d.ts +3 -1
  262. package/dist/modules/agents/instance-ai-builder-delegate.adapter.js +5 -4
  263. package/dist/modules/agents/instance-ai-builder-delegate.adapter.js.map +1 -1
  264. package/dist/modules/agents/integrations/agent-chat-bridge.d.ts +5 -1
  265. package/dist/modules/agents/integrations/agent-chat-bridge.js +53 -13
  266. package/dist/modules/agents/integrations/agent-chat-bridge.js.map +1 -1
  267. package/dist/modules/agents/integrations/agent-chat-stream-consumer.d.ts +5 -3
  268. package/dist/modules/agents/integrations/agent-chat-stream-consumer.js +35 -25
  269. package/dist/modules/agents/integrations/agent-chat-stream-consumer.js.map +1 -1
  270. package/dist/modules/agents/integrations/channel-rate-limit.d.ts +14 -0
  271. package/dist/modules/agents/integrations/channel-rate-limit.guard.d.ts +5 -0
  272. package/dist/modules/agents/integrations/channel-rate-limit.guard.js +40 -0
  273. package/dist/modules/agents/integrations/channel-rate-limit.guard.js.map +1 -0
  274. package/dist/modules/agents/integrations/channel-rate-limit.js +69 -0
  275. package/dist/modules/agents/integrations/channel-rate-limit.js.map +1 -0
  276. package/dist/modules/agents/integrations/chat-integration.service.js.map +1 -1
  277. package/dist/modules/agents/integrations/component-mapper.js.map +1 -1
  278. package/dist/modules/agents/integrations/cron-validation.d.ts +2 -1
  279. package/dist/modules/agents/integrations/cron-validation.js +10 -1
  280. package/dist/modules/agents/integrations/cron-validation.js.map +1 -1
  281. package/dist/modules/agents/integrations/integration-action-executor.d.ts +3 -1
  282. package/dist/modules/agents/integrations/integration-action-executor.js +20 -4
  283. package/dist/modules/agents/integrations/integration-action-executor.js.map +1 -1
  284. package/dist/modules/agents/integrations/integration-context-query-executor.d.ts +3 -1
  285. package/dist/modules/agents/integrations/integration-context-query-executor.js +20 -4
  286. package/dist/modules/agents/integrations/integration-context-query-executor.js.map +1 -1
  287. package/dist/modules/agents/integrations/integration-error-codes.d.ts +1 -0
  288. package/dist/modules/agents/integrations/integration-error-codes.js +1 -0
  289. package/dist/modules/agents/integrations/integration-error-codes.js.map +1 -1
  290. package/dist/modules/agents/integrations/integration-helpers.d.ts +1 -0
  291. package/dist/modules/agents/integrations/integration-helpers.js +4 -0
  292. package/dist/modules/agents/integrations/integration-helpers.js.map +1 -1
  293. package/dist/modules/agents/integrations/integration-tool-factory.js.map +1 -1
  294. package/dist/modules/agents/integrations/n8n-checkpoint-storage.d.ts +3 -14
  295. package/dist/modules/agents/integrations/n8n-checkpoint-storage.js +7 -64
  296. package/dist/modules/agents/integrations/n8n-checkpoint-storage.js.map +1 -1
  297. package/dist/modules/agents/integrations/n8n-memory.d.ts +14 -10
  298. package/dist/modules/agents/integrations/n8n-memory.js +119 -82
  299. package/dist/modules/agents/integrations/n8n-memory.js.map +1 -1
  300. package/dist/modules/agents/integrations/platforms/discord-integration.js +1 -1
  301. package/dist/modules/agents/integrations/platforms/discord-integration.js.map +1 -1
  302. package/dist/modules/agents/integrations/platforms/slack/slack-operations.js.map +1 -1
  303. package/dist/modules/agents/integrations/recording/channel-integration-recorder.js +2 -9
  304. package/dist/modules/agents/integrations/recording/channel-integration-recorder.js.map +1 -1
  305. package/dist/modules/agents/json-config/credential-field-mapping.js.map +1 -1
  306. package/dist/modules/agents/json-config/from-json-config.d.ts +1 -0
  307. package/dist/modules/agents/json-config/from-json-config.js +14 -25
  308. package/dist/modules/agents/json-config/from-json-config.js.map +1 -1
  309. package/dist/modules/agents/json-config/model-config.js.map +1 -1
  310. package/dist/modules/agents/json-config/sanitize-unknown-agent-credentials.js +0 -1
  311. package/dist/modules/agents/json-config/sanitize-unknown-agent-credentials.js.map +1 -1
  312. package/dist/modules/agents/model-stream-stall-options.d.ts +3 -0
  313. package/dist/modules/agents/model-stream-stall-options.js +21 -0
  314. package/dist/modules/agents/model-stream-stall-options.js.map +1 -0
  315. package/dist/modules/agents/repositories/agent-background-job.repository.d.ts +8 -0
  316. package/dist/modules/agents/repositories/agent-background-job.repository.js +44 -1
  317. package/dist/modules/agents/repositories/agent-background-job.repository.js.map +1 -1
  318. package/dist/modules/agents/repositories/agent-execution.repository.d.ts +1 -0
  319. package/dist/modules/agents/repositories/agent-execution.repository.js +3 -0
  320. package/dist/modules/agents/repositories/agent-execution.repository.js.map +1 -1
  321. package/dist/modules/agents/repositories/agent-memory-entry-candidate.repository.d.ts +22 -0
  322. package/dist/modules/agents/repositories/agent-memory-entry-candidate.repository.js +75 -0
  323. package/dist/modules/agents/repositories/agent-memory-entry-candidate.repository.js.map +1 -0
  324. package/dist/modules/agents/repositories/agent-message.repository.d.ts +1 -0
  325. package/dist/modules/agents/repositories/agent-message.repository.js +11 -0
  326. package/dist/modules/agents/repositories/agent-message.repository.js.map +1 -1
  327. package/dist/modules/agents/repositories/agent.repository.d.ts +2 -0
  328. package/dist/modules/agents/repositories/agent.repository.js +14 -0
  329. package/dist/modules/agents/repositories/agent.repository.js.map +1 -1
  330. package/dist/modules/agents/scheduling/agent-task-job-registrar.d.ts +23 -0
  331. package/dist/modules/agents/scheduling/agent-task-job-registrar.js +146 -0
  332. package/dist/modules/agents/scheduling/agent-task-job-registrar.js.map +1 -0
  333. package/dist/modules/agents/scheduling/agent-task-job.d.ts +7 -0
  334. package/dist/modules/agents/scheduling/agent-task-job.js +12 -0
  335. package/dist/modules/agents/scheduling/agent-task-job.js.map +1 -0
  336. package/dist/modules/agents/scheduling/agent-task-task-handler.d.ts +13 -0
  337. package/dist/modules/agents/scheduling/agent-task-task-handler.js +68 -0
  338. package/dist/modules/agents/scheduling/agent-task-task-handler.js.map +1 -0
  339. package/dist/modules/agents/scheduling/task-timezone.d.ts +2 -0
  340. package/dist/modules/agents/scheduling/task-timezone.js +13 -0
  341. package/dist/modules/agents/scheduling/task-timezone.js.map +1 -0
  342. package/dist/modules/agents/sub-agents/sub-agent-runner.d.ts +3 -1
  343. package/dist/modules/agents/sub-agents/sub-agent-runner.js +14 -5
  344. package/dist/modules/agents/sub-agents/sub-agent-runner.js.map +1 -1
  345. package/dist/modules/agents/tools/node-tool-factory.js.map +1 -1
  346. package/dist/modules/agents/tools/workflow-tool-factory.d.ts +1 -0
  347. package/dist/modules/agents/tools/workflow-tool-factory.js +35 -6
  348. package/dist/modules/agents/tools/workflow-tool-factory.js.map +1 -1
  349. package/dist/modules/agents/utils/agent-config-hash.d.ts +4 -1
  350. package/dist/modules/agents/utils/agent-config-hash.js +10 -3
  351. package/dist/modules/agents/utils/agent-config-hash.js.map +1 -1
  352. package/dist/modules/agents/utils/agent-memory-scope.d.ts +7 -0
  353. package/dist/modules/agents/utils/agent-memory-scope.js +30 -1
  354. package/dist/modules/agents/utils/agent-memory-scope.js.map +1 -1
  355. package/dist/modules/agents/utils/execution-to-message-mapper.d.ts +1 -1
  356. package/dist/modules/agents/utils/execution-to-message-mapper.js +11 -7
  357. package/dist/modules/agents/utils/execution-to-message-mapper.js.map +1 -1
  358. package/dist/modules/agents/utils/mcp-attribution.d.ts +4 -0
  359. package/dist/modules/agents/utils/mcp-attribution.js +34 -0
  360. package/dist/modules/agents/utils/mcp-attribution.js.map +1 -0
  361. package/dist/modules/breaking-changes/rules/index.d.ts +4 -1
  362. package/dist/modules/breaking-changes/rules/index.js +4 -1
  363. package/dist/modules/breaking-changes/rules/index.js.map +1 -1
  364. package/dist/modules/breaking-changes/rules/v3/chat-hub-deprecated.rule.d.ts +9 -0
  365. package/dist/modules/breaking-changes/rules/v3/chat-hub-deprecated.rule.js +59 -0
  366. package/dist/modules/breaking-changes/rules/v3/chat-hub-deprecated.rule.js.map +1 -0
  367. package/dist/modules/breaking-changes/rules/v3/external-secrets-project-roles-default.rule.d.ts +12 -0
  368. package/dist/modules/breaking-changes/rules/v3/external-secrets-project-roles-default.rule.js +70 -0
  369. package/dist/modules/breaking-changes/rules/v3/external-secrets-project-roles-default.rule.js.map +1 -0
  370. package/dist/modules/breaking-changes/rules/v3/pre-execute-error-creates-execution.rule.d.ts +9 -0
  371. package/dist/modules/breaking-changes/rules/v3/pre-execute-error-creates-execution.rule.js +56 -0
  372. package/dist/modules/breaking-changes/rules/v3/pre-execute-error-creates-execution.rule.js.map +1 -0
  373. package/dist/modules/breaking-changes/rules/v3/{task-runner-internal-mode.rule.d.ts → storage-path-rename.rule.d.ts} +4 -1
  374. package/dist/modules/breaking-changes/rules/v3/storage-path-rename.rule.js +87 -0
  375. package/dist/modules/breaking-changes/rules/v3/storage-path-rename.rule.js.map +1 -0
  376. package/dist/modules/chat-hub/chat-hub-extractor.d.ts +3 -1
  377. package/dist/modules/chat-hub/chat-hub-extractor.js +21 -14
  378. package/dist/modules/chat-hub/chat-hub-extractor.js.map +1 -1
  379. package/dist/modules/chat-hub/chat-hub.attachment.service.js +1 -1
  380. package/dist/modules/chat-hub/chat-hub.attachment.service.js.map +1 -1
  381. package/dist/modules/data-table/data-table-aggregate.controller.js +0 -2
  382. package/dist/modules/data-table/data-table-aggregate.controller.js.map +1 -1
  383. package/dist/modules/data-table/data-table-aggregate.service.d.ts +5 -4
  384. package/dist/modules/data-table/data-table-aggregate.service.js +8 -6
  385. package/dist/modules/data-table/data-table-aggregate.service.js.map +1 -1
  386. package/dist/modules/data-table/data-table-file-cleanup.service.js.map +1 -1
  387. package/dist/modules/data-table/data-table-rows.repository.js +6 -0
  388. package/dist/modules/data-table/data-table-rows.repository.js.map +1 -1
  389. package/dist/modules/data-table/data-table.service.js +12 -0
  390. package/dist/modules/data-table/data-table.service.js.map +1 -1
  391. package/dist/modules/dynamic-credentials.ee/credential-resolvers/identifiers/n8n-identifier.d.ts +4 -1
  392. package/dist/modules/dynamic-credentials.ee/credential-resolvers/identifiers/n8n-identifier.js +30 -2
  393. package/dist/modules/dynamic-credentials.ee/credential-resolvers/identifiers/n8n-identifier.js.map +1 -1
  394. package/dist/modules/dynamic-credentials.ee/dynamic-credentials.module.js +5 -1
  395. package/dist/modules/dynamic-credentials.ee/dynamic-credentials.module.js.map +1 -1
  396. package/dist/modules/dynamic-credentials.ee/services/credential-check-proxy.service.d.ts +2 -2
  397. package/dist/modules/dynamic-credentials.ee/services/credential-check-proxy.service.js +2 -2
  398. package/dist/modules/dynamic-credentials.ee/services/credential-check-proxy.service.js.map +1 -1
  399. package/dist/modules/dynamic-credentials.ee/services/credential-resolver-workflow.service.d.ts +5 -2
  400. package/dist/modules/dynamic-credentials.ee/services/credential-resolver-workflow.service.js +9 -9
  401. package/dist/modules/dynamic-credentials.ee/services/credential-resolver-workflow.service.js.map +1 -1
  402. package/dist/modules/dynamic-credentials.ee/workflow-status.controller.js +1 -1
  403. package/dist/modules/dynamic-credentials.ee/workflow-status.controller.js.map +1 -1
  404. package/dist/modules/engine-v2/engine-control-plane-auth.middleware.d.ts +2 -1
  405. package/dist/modules/engine-v2/engine-control-plane-auth.middleware.js +2 -2
  406. package/dist/modules/engine-v2/engine-control-plane-auth.middleware.js.map +1 -1
  407. package/dist/modules/engine-v2/engine-control-plane-client.d.ts +2 -4
  408. package/dist/modules/engine-v2/engine-control-plane-client.js +4 -13
  409. package/dist/modules/engine-v2/engine-control-plane-client.js.map +1 -1
  410. package/dist/modules/engine-v2/engine-control-plane-server.d.ts +3 -1
  411. package/dist/modules/engine-v2/engine-control-plane-server.js +7 -6
  412. package/dist/modules/engine-v2/engine-control-plane-server.js.map +1 -1
  413. package/dist/modules/engine-v2/engine-control-plane-transport.d.ts +10 -0
  414. package/dist/modules/engine-v2/engine-control-plane-transport.js +38 -0
  415. package/dist/modules/engine-v2/engine-control-plane-transport.js.map +1 -0
  416. package/dist/modules/engine-v2/engine-credentials-client.d.ts +8 -0
  417. package/dist/modules/engine-v2/engine-credentials-client.js +47 -0
  418. package/dist/modules/engine-v2/engine-credentials-client.js.map +1 -0
  419. package/dist/modules/engine-v2/engine-credentials.contract.d.ts +1 -0
  420. package/dist/modules/engine-v2/engine-credentials.contract.js +7 -0
  421. package/dist/modules/engine-v2/engine-credentials.contract.js.map +1 -1
  422. package/dist/modules/engine-v2/engine-credentials.controller.d.ts +7 -0
  423. package/dist/modules/engine-v2/engine-credentials.controller.js +35 -0
  424. package/dist/modules/engine-v2/engine-credentials.controller.js.map +1 -0
  425. package/dist/modules/engine-v2/engine-credentials.service.d.ts +12 -0
  426. package/dist/modules/engine-v2/engine-credentials.service.js +95 -0
  427. package/dist/modules/engine-v2/engine-credentials.service.js.map +1 -0
  428. package/dist/modules/engine-v2/engine-data-plane-client.js.map +1 -1
  429. package/dist/modules/engine-v2/remote-credentials-helper.d.ts +24 -0
  430. package/dist/modules/engine-v2/remote-credentials-helper.js +90 -0
  431. package/dist/modules/engine-v2/remote-credentials-helper.js.map +1 -0
  432. package/dist/modules/insights/database/entities/insights-shared.d.ts +4 -2
  433. package/dist/modules/insights/database/entities/insights-shared.js +1 -0
  434. package/dist/modules/insights/database/entities/insights-shared.js.map +1 -1
  435. package/dist/modules/insights/database/repositories/insights-by-period.repository.d.ts +3 -3
  436. package/dist/modules/insights/database/repositories/insights-by-period.repository.js +8 -2
  437. package/dist/modules/insights/database/repositories/insights-by-period.repository.js.map +1 -1
  438. package/dist/modules/insights/insights-collection.service.js +8 -0
  439. package/dist/modules/insights/insights-collection.service.js.map +1 -1
  440. package/dist/modules/insights/insights-compaction.task.js +1 -2
  441. package/dist/modules/insights/insights-compaction.task.js.map +1 -1
  442. package/dist/modules/insights/insights-pruning.task.js +1 -2
  443. package/dist/modules/insights/insights-pruning.task.js.map +1 -1
  444. package/dist/modules/insights/insights.controller.js +4 -5
  445. package/dist/modules/insights/insights.controller.js.map +1 -1
  446. package/dist/modules/insights/insights.service.d.ts +12 -22
  447. package/dist/modules/insights/insights.service.js +49 -18
  448. package/dist/modules/insights/insights.service.js.map +1 -1
  449. package/dist/modules/instance-ai/browser/browser-local-mcp-server.js +2 -2
  450. package/dist/modules/instance-ai/browser/browser-local-mcp-server.js.map +1 -1
  451. package/dist/modules/instance-ai/drop-rejected-attachments.d.ts +1 -1
  452. package/dist/modules/instance-ai/entities/instance-ai-checkpoint.entity.d.ts +1 -1
  453. package/dist/modules/instance-ai/entities/instance-ai-thread.entity.js +2 -1
  454. package/dist/modules/instance-ai/entities/instance-ai-thread.entity.js.map +1 -1
  455. package/dist/modules/instance-ai/eval/agent-scenario-seed.js +4 -2
  456. package/dist/modules/instance-ai/eval/agent-scenario-seed.js.map +1 -1
  457. package/dist/modules/instance-ai/eval/execution.service.js.map +1 -1
  458. package/dist/modules/instance-ai/eval/llm-completion-mock.js +16 -19
  459. package/dist/modules/instance-ai/eval/llm-completion-mock.js.map +1 -1
  460. package/dist/modules/instance-ai/eval/mock-handler.js +3 -2
  461. package/dist/modules/instance-ai/eval/mock-handler.js.map +1 -1
  462. package/dist/modules/instance-ai/eval/mock-utils.js +2 -4
  463. package/dist/modules/instance-ai/eval/mock-utils.js.map +1 -1
  464. package/dist/modules/instance-ai/eval/openai-envelope.js.map +1 -1
  465. package/dist/modules/instance-ai/eval/openai-responses-envelope.js +9 -11
  466. package/dist/modules/instance-ai/eval/openai-responses-envelope.js.map +1 -1
  467. package/dist/modules/instance-ai/eval/provider-shapes.js +30 -33
  468. package/dist/modules/instance-ai/eval/provider-shapes.js.map +1 -1
  469. package/dist/modules/instance-ai/eval/request-sanitizer.js.map +1 -1
  470. package/dist/modules/instance-ai/eval/structured-output-conformance.js +14 -16
  471. package/dist/modules/instance-ai/eval/structured-output-conformance.js.map +1 -1
  472. package/dist/modules/instance-ai/eval/thread-restore.service.d.ts +13 -3
  473. package/dist/modules/instance-ai/eval/thread-restore.service.js +95 -22
  474. package/dist/modules/instance-ai/eval/thread-restore.service.js.map +1 -1
  475. package/dist/modules/instance-ai/eval/workflow-analysis.js +2 -4
  476. package/dist/modules/instance-ai/eval/workflow-analysis.js.map +1 -1
  477. package/dist/modules/instance-ai/event-bus/durable-event-log.d.ts +4 -0
  478. package/dist/modules/instance-ai/event-bus/durable-event-log.js +4 -0
  479. package/dist/modules/instance-ai/event-bus/durable-event-log.js.map +1 -1
  480. package/dist/modules/instance-ai/instance-ai-checkpoint-pruning.task.d.ts +16 -0
  481. package/dist/modules/instance-ai/instance-ai-checkpoint-pruning.task.js +40 -0
  482. package/dist/modules/instance-ai/instance-ai-checkpoint-pruning.task.js.map +1 -0
  483. package/dist/modules/instance-ai/instance-ai-credit.service.js +12 -8
  484. package/dist/modules/instance-ai/instance-ai-credit.service.js.map +1 -1
  485. package/dist/modules/instance-ai/instance-ai-memory.service.d.ts +6 -3
  486. package/dist/modules/instance-ai/instance-ai-memory.service.js +36 -2
  487. package/dist/modules/instance-ai/instance-ai-memory.service.js.map +1 -1
  488. package/dist/modules/instance-ai/instance-ai-model.service.js +2 -2
  489. package/dist/modules/instance-ai/instance-ai-model.service.js.map +1 -1
  490. package/dist/modules/instance-ai/instance-ai-pending-agent.service.d.ts +2 -0
  491. package/dist/modules/instance-ai/instance-ai-settings.service.js +8 -8
  492. package/dist/modules/instance-ai/instance-ai-settings.service.js.map +1 -1
  493. package/dist/modules/instance-ai/instance-ai-setup-telemetry.service.js +2 -2
  494. package/dist/modules/instance-ai/instance-ai-setup-telemetry.service.js.map +1 -1
  495. package/dist/modules/instance-ai/instance-ai-verification.service.js +3 -4
  496. package/dist/modules/instance-ai/instance-ai-verification.service.js.map +1 -1
  497. package/dist/modules/instance-ai/instance-ai.adapter.service.d.ts +8 -4
  498. package/dist/modules/instance-ai/instance-ai.adapter.service.js +192 -73
  499. package/dist/modules/instance-ai/instance-ai.adapter.service.js.map +1 -1
  500. package/dist/modules/instance-ai/instance-ai.controller.d.ts +7 -1
  501. package/dist/modules/instance-ai/instance-ai.controller.js +37 -5
  502. package/dist/modules/instance-ai/instance-ai.controller.js.map +1 -1
  503. package/dist/modules/instance-ai/instance-ai.module.d.ts +2 -1
  504. package/dist/modules/instance-ai/instance-ai.module.js +7 -0
  505. package/dist/modules/instance-ai/instance-ai.module.js.map +1 -1
  506. package/dist/modules/instance-ai/instance-ai.service.d.ts +13 -18
  507. package/dist/modules/instance-ai/instance-ai.service.js +180 -400
  508. package/dist/modules/instance-ai/instance-ai.service.js.map +1 -1
  509. package/dist/modules/instance-ai/instance-context.service.d.ts +48 -0
  510. package/dist/modules/instance-ai/instance-context.service.js +388 -0
  511. package/dist/modules/instance-ai/instance-context.service.js.map +1 -0
  512. package/dist/modules/instance-ai/internal-messages.d.ts +8 -0
  513. package/dist/modules/instance-ai/internal-messages.js +34 -3
  514. package/dist/modules/instance-ai/internal-messages.js.map +1 -1
  515. package/dist/modules/instance-ai/message-parser.d.ts +4 -3
  516. package/dist/modules/instance-ai/message-parser.js.map +1 -1
  517. package/dist/modules/instance-ai/repositories/instance-ai-checkpoint.repository.d.ts +1 -1
  518. package/dist/modules/instance-ai/repositories/instance-ai-event-log.repository.d.ts +5 -1
  519. package/dist/modules/instance-ai/repositories/instance-ai-event-log.repository.js +16 -0
  520. package/dist/modules/instance-ai/repositories/instance-ai-event-log.repository.js.map +1 -1
  521. package/dist/modules/instance-ai/repositories/instance-ai-thread.repository.d.ts +13 -3
  522. package/dist/modules/instance-ai/repositories/instance-ai-thread.repository.js +59 -4
  523. package/dist/modules/instance-ai/repositories/instance-ai-thread.repository.js.map +1 -1
  524. package/dist/modules/instance-ai/sandbox/instance-ai-sandbox.service.d.ts +8 -2
  525. package/dist/modules/instance-ai/sandbox/instance-ai-sandbox.service.js +91 -55
  526. package/dist/modules/instance-ai/sandbox/instance-ai-sandbox.service.js.map +1 -1
  527. package/dist/modules/instance-ai/storage/typeorm-agent-checkpoint-store.d.ts +1 -1
  528. package/dist/modules/instance-ai/storage/typeorm-agent-memory.d.ts +6 -2
  529. package/dist/modules/instance-ai/storage/typeorm-agent-memory.js +20 -24
  530. package/dist/modules/instance-ai/storage/typeorm-agent-memory.js.map +1 -1
  531. package/dist/modules/instance-ai/storage/typeorm-observation-log-store.d.ts +1 -2
  532. package/dist/modules/instance-ai/storage/typeorm-observation-log-store.js.map +1 -1
  533. package/dist/modules/instance-ai/stream-transport-error.js +3 -1
  534. package/dist/modules/instance-ai/stream-transport-error.js.map +1 -1
  535. package/dist/modules/instance-ai/suspended-thread-persistence.service.js.map +1 -1
  536. package/dist/modules/instance-ai/web-research/fetch-and-extract.js.map +1 -1
  537. package/dist/modules/instance-ai/workflow-templates.service.js +3 -5
  538. package/dist/modules/instance-ai/workflow-templates.service.js.map +1 -1
  539. package/dist/modules/instance-ai/workflow-verification-obligation-service.d.ts +2 -1
  540. package/dist/modules/instance-ai/workflow-verification-obligation-service.js +11 -3
  541. package/dist/modules/instance-ai/workflow-verification-obligation-service.js.map +1 -1
  542. package/dist/modules/instance-registry/checks/build-check-result.d.ts +13 -0
  543. package/dist/modules/instance-registry/checks/build-check-result.js +19 -0
  544. package/dist/modules/instance-registry/checks/build-check-result.js.map +1 -0
  545. package/dist/modules/instance-registry/checks/hostid-clash.check.js +13 -21
  546. package/dist/modules/instance-registry/checks/hostid-clash.check.js.map +1 -1
  547. package/dist/modules/instance-registry/checks/split-brain.check.js +14 -23
  548. package/dist/modules/instance-registry/checks/split-brain.check.js.map +1 -1
  549. package/dist/modules/instance-registry/checks/version-mismatch.check.js +17 -24
  550. package/dist/modules/instance-registry/checks/version-mismatch.check.js.map +1 -1
  551. package/dist/modules/instance-reporting.ee/database/entities/instance-monitoring-report.js.map +1 -0
  552. package/dist/modules/{instance-reporting → instance-reporting.ee}/database/repositories/instance-monitoring-report.repository.d.ts +1 -0
  553. package/dist/modules/{instance-reporting → instance-reporting.ee}/database/repositories/instance-monitoring-report.repository.js +8 -0
  554. package/dist/modules/instance-reporting.ee/database/repositories/instance-monitoring-report.repository.js.map +1 -0
  555. package/dist/modules/{instance-reporting → instance-reporting.ee}/instance-reporting-scheduler.service.d.ts +4 -7
  556. package/dist/modules/{instance-reporting → instance-reporting.ee}/instance-reporting-scheduler.service.js +5 -18
  557. package/dist/modules/instance-reporting.ee/instance-reporting-scheduler.service.js.map +1 -0
  558. package/dist/modules/instance-reporting.ee/instance-reporting-settings.service.js.map +1 -0
  559. package/dist/modules/instance-reporting.ee/instance-reporting.config.js.map +1 -0
  560. package/dist/modules/instance-reporting.ee/instance-reporting.constants.js.map +1 -0
  561. package/dist/modules/instance-reporting.ee/instance-reporting.controller.d.ts +7 -0
  562. package/dist/modules/instance-reporting.ee/instance-reporting.controller.js +35 -0
  563. package/dist/modules/instance-reporting.ee/instance-reporting.controller.js.map +1 -0
  564. package/dist/modules/{instance-reporting → instance-reporting.ee}/instance-reporting.module.d.ts +8 -0
  565. package/dist/modules/instance-reporting.ee/instance-reporting.module.js +49 -0
  566. package/dist/modules/instance-reporting.ee/instance-reporting.module.js.map +1 -0
  567. package/dist/modules/instance-reporting.ee/instance-reporting.service.js.map +1 -0
  568. package/dist/modules/ldap.ee/ldap.service.ee.js.map +1 -1
  569. package/dist/modules/mcp/mcp.controller.js +8 -6
  570. package/dist/modules/mcp/mcp.controller.js.map +1 -1
  571. package/dist/modules/mcp/mcp.service.d.ts +9 -2
  572. package/dist/modules/mcp/mcp.service.js +28 -8
  573. package/dist/modules/mcp/mcp.service.js.map +1 -1
  574. package/dist/modules/mcp/tools/agents/agent-reference.js +2 -1
  575. package/dist/modules/mcp/tools/agents/agent-reference.js.map +1 -1
  576. package/dist/modules/mcp/tools/agents/agent-tools.service.js +40 -10
  577. package/dist/modules/mcp/tools/agents/agent-tools.service.js.map +1 -1
  578. package/dist/modules/mcp/tools/data-table/get-data-table-rows.tool.d.ts +5 -5
  579. package/dist/modules/mcp/tools/get-workflow-details.tool.js +3 -3
  580. package/dist/modules/mcp/tools/get-workflow-details.tool.js.map +1 -1
  581. package/dist/modules/mcp/tools/get-workflow-versions-diff.tool.js +2 -2
  582. package/dist/modules/mcp/tools/get-workflow-versions-diff.tool.js.map +1 -1
  583. package/dist/modules/mcp/tools/schemas.d.ts +2 -1
  584. package/dist/modules/mcp/tools/schemas.js +6 -2
  585. package/dist/modules/mcp/tools/schemas.js.map +1 -1
  586. package/dist/modules/mcp/tools/webhook-utils.js +8 -6
  587. package/dist/modules/mcp/tools/webhook-utils.js.map +1 -1
  588. package/dist/modules/mcp/tools/workflow-builder/create-workflow-from-code.tool.js +7 -2
  589. package/dist/modules/mcp/tools/workflow-builder/create-workflow-from-code.tool.js.map +1 -1
  590. package/dist/modules/mcp/tools/workflow-builder/mcp-instructions.d.ts +1 -0
  591. package/dist/modules/mcp/tools/workflow-builder/mcp-instructions.js +4 -3
  592. package/dist/modules/mcp/tools/workflow-builder/mcp-instructions.js.map +1 -1
  593. package/dist/modules/mcp/tools/workflow-builder/top-level-items-warning.d.ts +13 -0
  594. package/dist/modules/mcp/tools/workflow-builder/top-level-items-warning.js +24 -0
  595. package/dist/modules/mcp/tools/workflow-builder/top-level-items-warning.js.map +1 -0
  596. package/dist/modules/mcp/tools/workflow-builder/update-workflow.tool.d.ts +1 -1
  597. package/dist/modules/mcp/tools/workflow-builder/update-workflow.tool.js +23 -4
  598. package/dist/modules/mcp/tools/workflow-builder/update-workflow.tool.js.map +1 -1
  599. package/dist/modules/mcp/tools/workflow-builder/workflow-operations.js +7 -9
  600. package/dist/modules/mcp/tools/workflow-builder/workflow-operations.js.map +1 -1
  601. package/dist/modules/mcp-registry/mcp-registry-connection.js +7 -2
  602. package/dist/modules/mcp-registry/mcp-registry-connection.js.map +1 -1
  603. package/dist/modules/mcp-registry/registry/mcp-registry.types.d.ts +32 -20
  604. package/dist/modules/mcp-registry/registry/mcp-registry.types.js +8 -10
  605. package/dist/modules/mcp-registry/registry/mcp-registry.types.js.map +1 -1
  606. package/dist/modules/mcp-registry/registry/mock-servers.js +2 -0
  607. package/dist/modules/mcp-registry/registry/mock-servers.js.map +1 -1
  608. package/dist/modules/n8n-packages/engine/n8n-package-parser.d.ts +1 -0
  609. package/dist/modules/n8n-packages/engine/n8n-package-parser.js +24 -7
  610. package/dist/modules/n8n-packages/engine/n8n-package-parser.js.map +1 -1
  611. package/dist/modules/n8n-packages/entities/folder/folder.exporter.d.ts +2 -0
  612. package/dist/modules/n8n-packages/entities/folder/folder.exporter.js +27 -2
  613. package/dist/modules/n8n-packages/entities/folder/folder.exporter.js.map +1 -1
  614. package/dist/modules/n8n-packages/entities/project/project.exporter.d.ts +2 -0
  615. package/dist/modules/n8n-packages/entities/project/project.exporter.js +28 -8
  616. package/dist/modules/n8n-packages/entities/project/project.exporter.js.map +1 -1
  617. package/dist/modules/n8n-packages/entities/workflow/auto-included-workflow.exporter.js +1 -1
  618. package/dist/modules/n8n-packages/entities/workflow/auto-included-workflow.exporter.js.map +1 -1
  619. package/dist/modules/n8n-packages/entities/workflow/workflow-import.types.d.ts +2 -1
  620. package/dist/modules/n8n-packages/entities/workflow/workflow-importer.js +1 -1
  621. package/dist/modules/n8n-packages/entities/workflow/workflow-importer.js.map +1 -1
  622. package/dist/modules/n8n-packages/entities/workflow/workflow-published-state.d.ts +2 -0
  623. package/dist/modules/n8n-packages/entities/workflow/workflow-published-state.js +9 -0
  624. package/dist/modules/n8n-packages/entities/workflow/workflow-published-state.js.map +1 -0
  625. package/dist/modules/n8n-packages/entities/workflow/workflow-publishing-policy.js +2 -0
  626. package/dist/modules/n8n-packages/entities/workflow/workflow-publishing-policy.js.map +1 -1
  627. package/dist/modules/n8n-packages/entities/workflow/workflow-publishing-policy.types.d.ts +1 -1
  628. package/dist/modules/n8n-packages/entities/workflow/workflow-publishing-policy.types.js.map +1 -1
  629. package/dist/modules/n8n-packages/entities/workflow/workflow.exporter.js +1 -1
  630. package/dist/modules/n8n-packages/entities/workflow/workflow.exporter.js.map +1 -1
  631. package/dist/modules/n8n-packages/entities/workflow/workflow.serializer.d.ts +2 -0
  632. package/dist/modules/n8n-packages/entities/workflow/workflow.serializer.js +5 -1
  633. package/dist/modules/n8n-packages/entities/workflow/workflow.serializer.js.map +1 -1
  634. package/dist/modules/n8n-packages/io/entity-file-format.d.ts +1 -0
  635. package/dist/modules/n8n-packages/io/entity-file-format.js +7 -0
  636. package/dist/modules/n8n-packages/io/entity-file-format.js.map +1 -0
  637. package/dist/modules/n8n-packages/io/hashing-package-writer.d.ts +10 -0
  638. package/dist/modules/n8n-packages/io/hashing-package-writer.js +25 -0
  639. package/dist/modules/n8n-packages/io/hashing-package-writer.js.map +1 -0
  640. package/dist/modules/n8n-packages/io/manifest-entry.d.ts +38 -0
  641. package/dist/modules/n8n-packages/io/manifest-entry.js +26 -22
  642. package/dist/modules/n8n-packages/io/manifest-entry.js.map +1 -1
  643. package/dist/modules/n8n-packages/n8n-packages.service.d.ts +7 -3
  644. package/dist/modules/n8n-packages/n8n-packages.service.js +10 -3
  645. package/dist/modules/n8n-packages/n8n-packages.service.js.map +1 -1
  646. package/dist/modules/n8n-packages/n8n-packages.types.d.ts +5 -0
  647. package/dist/modules/n8n-packages/n8n-packages.types.js.map +1 -1
  648. package/dist/modules/n8n-packages/spec/constants.d.ts +1 -0
  649. package/dist/modules/n8n-packages/spec/constants.js +2 -1
  650. package/dist/modules/n8n-packages/spec/constants.js.map +1 -1
  651. package/dist/modules/n8n-packages/spec/serialized/workflow-metadata.schema.d.ts +9 -0
  652. package/dist/modules/n8n-packages/spec/serialized/workflow-metadata.schema.js +8 -0
  653. package/dist/modules/n8n-packages/spec/serialized/workflow-metadata.schema.js.map +1 -0
  654. package/dist/modules/n8n-packages/spec/serialized/workflow.schema.d.ts +0 -3
  655. package/dist/modules/n8n-packages/spec/serialized/workflow.schema.js +0 -1
  656. package/dist/modules/n8n-packages/spec/serialized/workflow.schema.js.map +1 -1
  657. package/dist/modules/oauth-jwe/oauth-jwe-key.service.js.map +1 -1
  658. package/dist/modules/oauth-jwe/oauth-jwe.module.js +2 -4
  659. package/dist/modules/oauth-jwe/oauth-jwe.module.js.map +1 -1
  660. package/dist/modules/oauth-server/protected-resource-resolvers/chat-trigger-resource.base.js +2 -4
  661. package/dist/modules/oauth-server/protected-resource-resolvers/chat-trigger-resource.base.js.map +1 -1
  662. package/dist/modules/oauth-server/protected-resource-resolvers/form-trigger-resource.resolver.js +2 -4
  663. package/dist/modules/oauth-server/protected-resource-resolvers/form-trigger-resource.resolver.js.map +1 -1
  664. package/dist/modules/oauth-server/protected-resource-resolvers/form-trigger-test-resource.resolver.js +2 -4
  665. package/dist/modules/oauth-server/protected-resource-resolvers/form-trigger-test-resource.resolver.js.map +1 -1
  666. package/dist/modules/oauth-server/protected-resource-resolvers/utils.d.ts +2 -0
  667. package/dist/modules/oauth-server/protected-resource-resolvers/utils.js +8 -0
  668. package/dist/modules/oauth-server/protected-resource-resolvers/utils.js.map +1 -1
  669. package/dist/modules/oauth-server/protected-resource-resolvers/workflow-mcp-test-trigger-resource.resolver.js +2 -4
  670. package/dist/modules/oauth-server/protected-resource-resolvers/workflow-mcp-test-trigger-resource.resolver.js.map +1 -1
  671. package/dist/modules/oauth-server/protected-resource-resolvers/workflow-mcp-trigger-resource.resolver.js +2 -4
  672. package/dist/modules/oauth-server/protected-resource-resolvers/workflow-mcp-trigger-resource.resolver.js.map +1 -1
  673. package/dist/modules/oauth-server/protected-resource-resolvers/workflow-webhook-test-trigger-resource.resolver.js +2 -4
  674. package/dist/modules/oauth-server/protected-resource-resolvers/workflow-webhook-test-trigger-resource.resolver.js.map +1 -1
  675. package/dist/modules/oauth-server/protected-resource-resolvers/workflow-webhook-trigger-resource.resolver.js +2 -4
  676. package/dist/modules/oauth-server/protected-resource-resolvers/workflow-webhook-trigger-resource.resolver.js.map +1 -1
  677. package/dist/modules/otel/execution-level-tracer.types.js.map +1 -1
  678. package/dist/modules/otel/otel-lifecycle-handler.js +3 -1
  679. package/dist/modules/otel/otel-lifecycle-handler.js.map +1 -1
  680. package/dist/modules/policy-infrastructure/policy-infrastructure.module.js.map +1 -1
  681. package/dist/modules/promotions.ee/base-branch-files.d.ts +67 -0
  682. package/dist/modules/promotions.ee/base-branch-files.js +75 -0
  683. package/dist/modules/promotions.ee/base-branch-files.js.map +1 -0
  684. package/dist/modules/promotions.ee/branch-placement.d.ts +15 -0
  685. package/dist/modules/promotions.ee/branch-placement.js +42 -0
  686. package/dist/modules/promotions.ee/branch-placement.js.map +1 -0
  687. package/dist/modules/{git-connections.ee → promotions.ee}/constants.d.ts +7 -1
  688. package/dist/modules/{git-connections.ee → promotions.ee}/constants.js +5 -2
  689. package/dist/modules/promotions.ee/constants.js.map +1 -0
  690. package/dist/modules/promotions.ee/database/entities/promotion-config.entity.d.ts +11 -0
  691. package/dist/modules/promotions.ee/database/entities/promotion-config.entity.js +44 -0
  692. package/dist/modules/promotions.ee/database/entities/promotion-config.entity.js.map +1 -0
  693. package/dist/modules/promotions.ee/database/entities/promotion-connection-project.entity.d.ts +8 -0
  694. package/dist/modules/{git-connections.ee/database/entities/git-connection-project.entity.js → promotions.ee/database/entities/promotion-connection-project.entity.js} +13 -13
  695. package/dist/modules/promotions.ee/database/entities/promotion-connection-project.entity.js.map +1 -0
  696. package/dist/modules/promotions.ee/database/entities/promotion-connection.entity.d.ts +11 -0
  697. package/dist/modules/promotions.ee/database/entities/promotion-connection.entity.js +45 -0
  698. package/dist/modules/promotions.ee/database/entities/promotion-connection.entity.js.map +1 -0
  699. package/dist/modules/promotions.ee/database/entities/promotion-provider.entity.d.ts +9 -0
  700. package/dist/modules/promotions.ee/database/entities/promotion-provider.entity.js +41 -0
  701. package/dist/modules/promotions.ee/database/entities/promotion-provider.entity.js.map +1 -0
  702. package/dist/modules/promotions.ee/database/promotion-conflict.error.d.ts +6 -0
  703. package/dist/modules/promotions.ee/database/promotion-conflict.error.js +12 -0
  704. package/dist/modules/promotions.ee/database/promotion-conflict.error.js.map +1 -0
  705. package/dist/modules/promotions.ee/database/repositories/promotion-config.repository.d.ts +19 -0
  706. package/dist/modules/promotions.ee/database/repositories/promotion-config.repository.js +67 -0
  707. package/dist/modules/promotions.ee/database/repositories/promotion-config.repository.js.map +1 -0
  708. package/dist/modules/promotions.ee/database/repositories/promotion-connection-project.repository.d.ts +10 -0
  709. package/dist/modules/promotions.ee/database/repositories/promotion-connection-project.repository.js +54 -0
  710. package/dist/modules/promotions.ee/database/repositories/promotion-connection-project.repository.js.map +1 -0
  711. package/dist/modules/promotions.ee/database/repositories/promotion-connection.repository.d.ts +27 -0
  712. package/dist/modules/promotions.ee/database/repositories/promotion-connection.repository.js +77 -0
  713. package/dist/modules/promotions.ee/database/repositories/promotion-connection.repository.js.map +1 -0
  714. package/dist/modules/promotions.ee/database/repositories/promotion-provider.repository.d.ts +19 -0
  715. package/dist/modules/promotions.ee/database/repositories/promotion-provider.repository.js +71 -0
  716. package/dist/modules/promotions.ee/database/repositories/promotion-provider.repository.js.map +1 -0
  717. package/dist/modules/promotions.ee/diff-package-files.d.ts +13 -0
  718. package/dist/modules/promotions.ee/diff-package-files.js +48 -0
  719. package/dist/modules/promotions.ee/diff-package-files.js.map +1 -0
  720. package/dist/modules/promotions.ee/import-manifest-bridge.d.ts +8 -0
  721. package/dist/modules/promotions.ee/import-manifest-bridge.js +254 -0
  722. package/dist/modules/promotions.ee/import-manifest-bridge.js.map +1 -0
  723. package/dist/modules/promotions.ee/promotion-change.service.d.ts +14 -0
  724. package/dist/modules/promotions.ee/promotion-change.service.js +211 -0
  725. package/dist/modules/promotions.ee/promotion-change.service.js.map +1 -0
  726. package/dist/modules/promotions.ee/promotion-changes.controller.d.ts +9 -0
  727. package/dist/modules/promotions.ee/promotion-changes.controller.js +50 -0
  728. package/dist/modules/promotions.ee/promotion-changes.controller.js.map +1 -0
  729. package/dist/modules/promotions.ee/promotion-config-settings.d.ts +6 -0
  730. package/dist/modules/promotions.ee/promotion-config-settings.js +13 -0
  731. package/dist/modules/promotions.ee/promotion-config-settings.js.map +1 -0
  732. package/dist/modules/promotions.ee/promotion-config.resolver.d.ts +16 -0
  733. package/dist/modules/promotions.ee/promotion-config.resolver.js +97 -0
  734. package/dist/modules/promotions.ee/promotion-config.resolver.js.map +1 -0
  735. package/dist/modules/promotions.ee/promotion-conflicts.d.ts +1 -0
  736. package/dist/modules/promotions.ee/promotion-conflicts.js +16 -0
  737. package/dist/modules/promotions.ee/promotion-conflicts.js.map +1 -0
  738. package/dist/modules/promotions.ee/promotion-connections.service.d.ts +70 -0
  739. package/dist/modules/promotions.ee/promotion-connections.service.js +274 -0
  740. package/dist/modules/promotions.ee/promotion-connections.service.js.map +1 -0
  741. package/dist/modules/promotions.ee/promotion-providers.service.d.ts +48 -0
  742. package/dist/modules/promotions.ee/promotion-providers.service.js +166 -0
  743. package/dist/modules/promotions.ee/promotion-providers.service.js.map +1 -0
  744. package/dist/modules/promotions.ee/promotion-working-directory.service.d.ts +19 -0
  745. package/dist/modules/promotions.ee/promotion-working-directory.service.js +82 -0
  746. package/dist/modules/promotions.ee/promotion-working-directory.service.js.map +1 -0
  747. package/dist/modules/promotions.ee/promotions-git.service.d.ts +59 -0
  748. package/dist/modules/promotions.ee/promotions-git.service.js +402 -0
  749. package/dist/modules/promotions.ee/promotions-git.service.js.map +1 -0
  750. package/dist/modules/promotions.ee/promotions-git.utils.d.ts +16 -0
  751. package/dist/modules/{git-connections.ee/git-connections-git.utils.js → promotions.ee/promotions-git.utils.js} +15 -3
  752. package/dist/modules/promotions.ee/promotions-git.utils.js.map +1 -0
  753. package/dist/modules/promotions.ee/promotions.module.d.ts +5 -0
  754. package/dist/modules/promotions.ee/promotions.module.js +35 -0
  755. package/dist/modules/promotions.ee/promotions.module.js.map +1 -0
  756. package/dist/modules/promotions.ee/promotions.service.d.ts +43 -0
  757. package/dist/modules/promotions.ee/promotions.service.js +413 -0
  758. package/dist/modules/promotions.ee/promotions.service.js.map +1 -0
  759. package/dist/modules/promotions.ee/promotions.types.d.ts +61 -0
  760. package/dist/modules/promotions.ee/promotions.types.js +15 -0
  761. package/dist/modules/promotions.ee/promotions.types.js.map +1 -0
  762. package/dist/modules/promotions.ee/working-copy-updater.d.ts +53 -0
  763. package/dist/modules/promotions.ee/working-copy-updater.js +487 -0
  764. package/dist/modules/promotions.ee/working-copy-updater.js.map +1 -0
  765. package/dist/modules/redaction/dynamic-credentials-context-hook.d.ts +13 -0
  766. package/dist/modules/redaction/dynamic-credentials-context-hook.js +68 -0
  767. package/dist/modules/redaction/dynamic-credentials-context-hook.js.map +1 -0
  768. package/dist/modules/redaction/executions/execution-redaction.service.js +11 -1
  769. package/dist/modules/redaction/executions/execution-redaction.service.js.map +1 -1
  770. package/dist/modules/redaction/instance-redaction-enforcement.service.js.map +1 -1
  771. package/dist/modules/redaction/redaction.module.js +2 -1
  772. package/dist/modules/redaction/redaction.module.js.map +1 -1
  773. package/dist/modules/runtime-credentials/runtime-credentials.module.js +2 -4
  774. package/dist/modules/runtime-credentials/runtime-credentials.module.js.map +1 -1
  775. package/dist/modules/source-control.ee/source-control-git.service.ee.js +7 -4
  776. package/dist/modules/source-control.ee/source-control-git.service.ee.js.map +1 -1
  777. package/dist/modules/source-control.ee/source-control-helper.ee.js +3 -6
  778. package/dist/modules/source-control.ee/source-control-helper.ee.js.map +1 -1
  779. package/dist/modules/source-control.ee/source-control-import.service.ee.d.ts +7 -4
  780. package/dist/modules/source-control.ee/source-control-import.service.ee.js +40 -9
  781. package/dist/modules/source-control.ee/source-control-import.service.ee.js.map +1 -1
  782. package/dist/modules/sso-oidc/oidc.service.ee.js.map +1 -1
  783. package/dist/modules/sso-saml/saml-helpers.js.map +1 -1
  784. package/dist/modules/sso-saml/saml.service.ee.js.map +1 -1
  785. package/dist/modules/token-exchange/services/jwks-resolver.js.map +1 -1
  786. package/dist/modules/token-exchange/token-exchange.module.js +3 -5
  787. package/dist/modules/token-exchange/token-exchange.module.js.map +1 -1
  788. package/dist/modules/type-availability-policies/available-types.controller.d.ts +10 -0
  789. package/dist/modules/type-availability-policies/available-types.controller.js +57 -0
  790. package/dist/modules/type-availability-policies/available-types.controller.js.map +1 -0
  791. package/dist/modules/type-availability-policies/constants.d.ts +1 -0
  792. package/dist/modules/type-availability-policies/constants.js +5 -0
  793. package/dist/modules/type-availability-policies/constants.js.map +1 -0
  794. package/dist/modules/type-availability-policies/database/repositories/type-availability-policy-scope.repository.d.ts +1 -0
  795. package/dist/modules/type-availability-policies/database/repositories/type-availability-policy-scope.repository.js +11 -0
  796. package/dist/modules/type-availability-policies/database/repositories/type-availability-policy-scope.repository.js.map +1 -1
  797. package/dist/modules/type-availability-policies/database/repositories/type-availability-policy.repository.d.ts +2 -1
  798. package/dist/modules/type-availability-policies/database/repositories/type-availability-policy.repository.js +18 -5
  799. package/dist/modules/type-availability-policies/database/repositories/type-availability-policy.repository.js.map +1 -1
  800. package/dist/modules/type-availability-policies/policy-evaluator.d.ts +15 -1
  801. package/dist/modules/type-availability-policies/policy-evaluator.js +74 -5
  802. package/dist/modules/type-availability-policies/policy-evaluator.js.map +1 -1
  803. package/dist/modules/type-availability-policies/policy-rule.types.d.ts +2 -13
  804. package/dist/modules/type-availability-policies/type-availability-policies.module.js +7 -1
  805. package/dist/modules/type-availability-policies/type-availability-policies.module.js.map +1 -1
  806. package/dist/modules/type-availability-policies/type-availability-policy-instance.controller.d.ts +5 -8
  807. package/dist/modules/type-availability-policies/type-availability-policy-instance.controller.js +10 -13
  808. package/dist/modules/type-availability-policies/type-availability-policy-instance.controller.js.map +1 -1
  809. package/dist/modules/type-availability-policies/type-availability-policy-project.controller.d.ts +25 -0
  810. package/dist/modules/type-availability-policies/type-availability-policy-project.controller.js +67 -0
  811. package/dist/modules/type-availability-policies/type-availability-policy-project.controller.js.map +1 -0
  812. package/dist/modules/type-availability-policies/type-availability-policy.service.d.ts +7 -0
  813. package/dist/modules/type-availability-policies/type-availability-policy.service.js +78 -6
  814. package/dist/modules/type-availability-policies/type-availability-policy.service.js.map +1 -1
  815. package/dist/node-execution/ephemeral-node-executor.js.map +1 -1
  816. package/dist/node-types.js +9 -6
  817. package/dist/node-types.js.map +1 -1
  818. package/dist/posthog/index.js +2 -1
  819. package/dist/posthog/index.js.map +1 -1
  820. package/dist/public-api/public-api-controller.registry.js +17 -10
  821. package/dist/public-api/public-api-controller.registry.js.map +1 -1
  822. package/dist/public-api/public-api-route-resolver.d.ts +11 -1
  823. package/dist/public-api/public-api-route-resolver.js +17 -2
  824. package/dist/public-api/public-api-route-resolver.js.map +1 -1
  825. package/dist/public-api/public-api-validation-error.d.ts +1 -1
  826. package/dist/public-api/public-api-validation-error.js.map +1 -1
  827. package/dist/public-api/types.d.ts +1 -29
  828. package/dist/public-api/v1/controllers/credentials.public.controller.d.ts +18 -2
  829. package/dist/public-api/v1/controllers/credentials.public.controller.js +210 -5
  830. package/dist/public-api/v1/controllers/credentials.public.controller.js.map +1 -1
  831. package/dist/public-api/v1/controllers/executions.public.controller.js +6 -17
  832. package/dist/public-api/v1/controllers/executions.public.controller.js.map +1 -1
  833. package/dist/public-api/v1/controllers/index.d.ts +4 -1
  834. package/dist/public-api/v1/controllers/index.js +4 -1
  835. package/dist/public-api/v1/controllers/index.js.map +1 -1
  836. package/dist/public-api/v1/controllers/node-type-policies.public.controller.d.ts +13 -0
  837. package/dist/public-api/v1/controllers/node-type-policies.public.controller.js +141 -0
  838. package/dist/public-api/v1/controllers/node-type-policies.public.controller.js.map +1 -0
  839. package/dist/public-api/v1/controllers/projects.public.controller.d.ts +19 -0
  840. package/dist/public-api/v1/controllers/projects.public.controller.js +231 -0
  841. package/dist/public-api/v1/controllers/projects.public.controller.js.map +1 -0
  842. package/dist/public-api/v1/controllers/promotions.public.controller.d.ts +33 -0
  843. package/dist/public-api/v1/controllers/promotions.public.controller.js +503 -0
  844. package/dist/public-api/v1/controllers/promotions.public.controller.js.map +1 -0
  845. package/dist/public-api/v1/controllers/role-mapping-rules.public.controller.js +3 -3
  846. package/dist/public-api/v1/controllers/role-mapping-rules.public.controller.js.map +1 -1
  847. package/dist/public-api/v1/controllers/roles.public.controller.d.ts +3 -3
  848. package/dist/public-api/v1/controllers/roles.public.controller.js +14 -14
  849. package/dist/public-api/v1/controllers/roles.public.controller.js.map +1 -1
  850. package/dist/public-api/v1/controllers/source-control.public.controller.d.ts +5 -2
  851. package/dist/public-api/v1/controllers/source-control.public.controller.js +50 -4
  852. package/dist/public-api/v1/controllers/source-control.public.controller.js.map +1 -1
  853. package/dist/public-api/v1/controllers/tags.public.controller.d.ts +3 -1
  854. package/dist/public-api/v1/controllers/tags.public.controller.js +56 -6
  855. package/dist/public-api/v1/controllers/tags.public.controller.js.map +1 -1
  856. package/dist/public-api/v1/controllers/variables.public.controller.d.ts +12 -0
  857. package/dist/public-api/v1/controllers/variables.public.controller.js +127 -0
  858. package/dist/public-api/v1/controllers/variables.public.controller.js.map +1 -0
  859. package/dist/public-api/v1/controllers/workflows.public.controller.d.ts +1 -1
  860. package/dist/public-api/v1/controllers/workflows.public.controller.js +20 -29
  861. package/dist/public-api/v1/controllers/workflows.public.controller.js.map +1 -1
  862. package/dist/public-api/v1/handlers/credentials/credentials.handler.d.ts +0 -4
  863. package/dist/public-api/v1/handlers/credentials/credentials.handler.js +0 -159
  864. package/dist/public-api/v1/handlers/credentials/credentials.handler.js.map +1 -1
  865. package/dist/public-api/v1/handlers/credentials/credentials.utils.d.ts +6 -0
  866. package/dist/public-api/v1/handlers/credentials/credentials.utils.js +30 -0
  867. package/dist/public-api/v1/handlers/credentials/credentials.utils.js.map +1 -1
  868. package/dist/public-api/v1/handlers/tags/tags.handler.d.ts +0 -2
  869. package/dist/public-api/v1/handlers/tags/tags.handler.js +0 -27
  870. package/dist/public-api/v1/handlers/tags/tags.handler.js.map +1 -1
  871. package/dist/public-api/v1/openapi-gen/decorator-routes.js +3 -2
  872. package/dist/public-api/v1/openapi-gen/decorator-routes.js.map +1 -1
  873. package/dist/public-api/v1/openapi.yml +4712 -2646
  874. package/dist/public-api/v1/shared/project.mapper.d.ts +3 -0
  875. package/dist/public-api/v1/shared/project.mapper.js +20 -0
  876. package/dist/public-api/v1/shared/project.mapper.js.map +1 -0
  877. package/dist/push/abstract.push.d.ts +3 -1
  878. package/dist/push/abstract.push.js +2 -2
  879. package/dist/push/abstract.push.js.map +1 -1
  880. package/dist/push/index.d.ts +3 -1
  881. package/dist/push/index.js +2 -2
  882. package/dist/push/index.js.map +1 -1
  883. package/dist/requests.d.ts +0 -8
  884. package/dist/scaling/constants.d.ts +2 -2
  885. package/dist/scaling/constants.js +3 -0
  886. package/dist/scaling/constants.js.map +1 -1
  887. package/dist/scaling/job-processor.d.ts +2 -0
  888. package/dist/scaling/job-processor.js +54 -9
  889. package/dist/scaling/job-processor.js.map +1 -1
  890. package/dist/scaling/pubsub/pubsub.event-map.d.ts +13 -0
  891. package/dist/scaling/pubsub/pubsub.types.d.ts +4 -1
  892. package/dist/scaling/scaling.service.d.ts +3 -1
  893. package/dist/scaling/scaling.service.js +5 -3
  894. package/dist/scaling/scaling.service.js.map +1 -1
  895. package/dist/scheduling/poll-trigger-node/poll-trigger-task.d.ts +2 -5
  896. package/dist/scheduling/poll-trigger-node/poll-trigger-task.js +2 -3
  897. package/dist/scheduling/poll-trigger-node/poll-trigger-task.js.map +1 -1
  898. package/dist/scheduling/schedule-trigger-node/schedule-trigger-task-handler.js.map +1 -1
  899. package/dist/scheduling/schedule-trigger-node/schedule-trigger-task.d.ts +2 -5
  900. package/dist/scheduling/schedule-trigger-node/schedule-trigger-task.js +2 -3
  901. package/dist/scheduling/schedule-trigger-node/schedule-trigger-task.js.map +1 -1
  902. package/dist/scheduling/system-tasks/main-system-tasks.d.ts +2 -1
  903. package/dist/scheduling/system-tasks/main-system-tasks.js +19 -2
  904. package/dist/scheduling/system-tasks/main-system-tasks.js.map +1 -1
  905. package/dist/scheduling/system-tasks/system-task-runner.js +3 -3
  906. package/dist/scheduling/system-tasks/system-task-runner.js.map +1 -1
  907. package/dist/scheduling/workflow-node-task-payload.d.ts +5 -0
  908. package/dist/scheduling/workflow-node-task-payload.js +7 -0
  909. package/dist/scheduling/workflow-node-task-payload.js.map +1 -0
  910. package/dist/server.d.ts +2 -0
  911. package/dist/server.js +2 -0
  912. package/dist/server.js.map +1 -1
  913. package/dist/services/ai-preference.service.d.ts +46 -0
  914. package/dist/services/ai-preference.service.js +336 -0
  915. package/dist/services/ai-preference.service.js.map +1 -0
  916. package/dist/services/annotation-tag.service.ee.js.map +1 -1
  917. package/dist/services/credentials-tester.service.js +2 -24
  918. package/dist/services/credentials-tester.service.js.map +1 -1
  919. package/dist/services/dynamic-node-parameters.service.js +3 -1
  920. package/dist/services/dynamic-node-parameters.service.js.map +1 -1
  921. package/dist/services/email-change.service.d.ts +21 -0
  922. package/dist/services/email-change.service.js +84 -0
  923. package/dist/services/email-change.service.js.map +1 -0
  924. package/dist/services/engine-v2-dispatcher.service.js +1 -1
  925. package/dist/services/engine-v2-dispatcher.service.js.map +1 -1
  926. package/dist/services/engine-v2-payload-guard.service.d.ts +13 -0
  927. package/dist/services/engine-v2-payload-guard.service.js +49 -0
  928. package/dist/services/engine-v2-payload-guard.service.js.map +1 -0
  929. package/dist/services/ownership-transfer/ownership-transfer.manifest.json +8 -3
  930. package/dist/services/project.service.ee.js +2 -0
  931. package/dist/services/project.service.ee.js.map +1 -1
  932. package/dist/services/pruning/execution-pruning-soft-delete.task.d.ts +14 -0
  933. package/dist/services/pruning/execution-pruning-soft-delete.task.js +38 -0
  934. package/dist/services/pruning/execution-pruning-soft-delete.task.js.map +1 -0
  935. package/dist/services/pruning/executions-pruning.service.d.ts +0 -2
  936. package/dist/services/pruning/executions-pruning.service.js +5 -11
  937. package/dist/services/pruning/executions-pruning.service.js.map +1 -1
  938. package/dist/services/pruning/workflow-history-compaction-optimize.task.d.ts +14 -0
  939. package/dist/services/pruning/workflow-history-compaction-optimize.task.js +38 -0
  940. package/dist/services/pruning/workflow-history-compaction-optimize.task.js.map +1 -0
  941. package/dist/services/pruning/workflow-history-compaction-trim.task.d.ts +12 -0
  942. package/dist/services/pruning/workflow-history-compaction-trim.task.js +40 -0
  943. package/dist/services/pruning/workflow-history-compaction-trim.task.js.map +1 -0
  944. package/dist/services/pruning/workflow-history-compaction.service.d.ts +7 -10
  945. package/dist/services/pruning/workflow-history-compaction.service.js +41 -59
  946. package/dist/services/pruning/workflow-history-compaction.service.js.map +1 -1
  947. package/dist/services/workflow-statistics.service.d.ts +6 -0
  948. package/dist/services/workflow-statistics.service.js +40 -30
  949. package/dist/services/workflow-statistics.service.js.map +1 -1
  950. package/dist/task-runners/task-broker/task-broker-ws-server.js.map +1 -1
  951. package/dist/task-runners/task-broker/task-broker.service.js.map +1 -1
  952. package/dist/task-runners/task-managers/local-task-requester.js.map +1 -1
  953. package/dist/task-runners/task-runner-module.js.map +1 -1
  954. package/dist/user-management/email/interfaces.d.ts +11 -0
  955. package/dist/user-management/email/templates/email-change-completed.handlebars +183 -0
  956. package/dist/user-management/email/templates/email-change-requested.handlebars +206 -0
  957. package/dist/user-management/email/user-management-mailer.d.ts +4 -2
  958. package/dist/user-management/email/user-management-mailer.js +20 -0
  959. package/dist/user-management/email/user-management-mailer.js.map +1 -1
  960. package/dist/utils/is-billable-execution.d.ts +5 -0
  961. package/dist/utils/is-billable-execution.js +32 -0
  962. package/dist/utils/is-billable-execution.js.map +1 -0
  963. package/dist/utils/object-to-error.js.map +1 -1
  964. package/dist/webhooks/engine-v2-webhooks.d.ts +4 -7
  965. package/dist/webhooks/engine-v2-webhooks.js +6 -24
  966. package/dist/webhooks/engine-v2-webhooks.js.map +1 -1
  967. package/dist/webhooks/webhook-helpers.js +9 -2
  968. package/dist/webhooks/webhook-helpers.js.map +1 -1
  969. package/dist/workflow-execute-additional-data.js +9 -2
  970. package/dist/workflow-execute-additional-data.js.map +1 -1
  971. package/dist/workflow-runner.d.ts +7 -3
  972. package/dist/workflow-runner.js +54 -29
  973. package/dist/workflow-runner.js.map +1 -1
  974. package/dist/workflows/publication/published-workflow-trigger-deactivator.d.ts +1 -0
  975. package/dist/workflows/publication/published-workflow-trigger-deactivator.js +12 -4
  976. package/dist/workflows/publication/published-workflow-trigger-deactivator.js.map +1 -1
  977. package/dist/workflows/publication/trigger-diff.d.ts +4 -1
  978. package/dist/workflows/publication/trigger-diff.js +12 -2
  979. package/dist/workflows/publication/trigger-diff.js.map +1 -1
  980. package/dist/workflows/publication/workflow-publication-applier.js +3 -1
  981. package/dist/workflows/publication/workflow-publication-applier.js.map +1 -1
  982. package/dist/workflows/publication/workflow-publication-lifecycle-lock.d.ts +7 -1
  983. package/dist/workflows/publication/workflow-publication-lifecycle-lock.js +18 -4
  984. package/dist/workflows/publication/workflow-publication-lifecycle-lock.js.map +1 -1
  985. package/dist/workflows/publication/workflow-publication-outbox-cleanup.service.d.ts +3 -10
  986. package/dist/workflows/publication/workflow-publication-outbox-cleanup.service.js +4 -49
  987. package/dist/workflows/publication/workflow-publication-outbox-cleanup.service.js.map +1 -1
  988. package/dist/workflows/publication/workflow-publication-outbox-cleanup.task.d.ts +15 -0
  989. package/dist/workflows/publication/workflow-publication-outbox-cleanup.task.js +38 -0
  990. package/dist/workflows/publication/workflow-publication-outbox-cleanup.task.js.map +1 -0
  991. package/dist/workflows/publication/workflow-publication-outbox-consumer.d.ts +2 -0
  992. package/dist/workflows/publication/workflow-publication-outbox-consumer.js +62 -27
  993. package/dist/workflows/publication/workflow-publication-outbox-consumer.js.map +1 -1
  994. package/dist/workflows/publication/workflow-publication-reconciler.service.d.ts +1 -0
  995. package/dist/workflows/publication/workflow-publication-reconciler.service.js +21 -8
  996. package/dist/workflows/publication/workflow-publication-reconciler.service.js.map +1 -1
  997. package/dist/workflows/triggers/engine-v2-active-triggers.d.ts +16 -0
  998. package/dist/workflows/triggers/engine-v2-active-triggers.js +39 -0
  999. package/dist/workflows/triggers/engine-v2-active-triggers.js.map +1 -0
  1000. package/dist/workflows/triggers/trigger-execution-context.factory.d.ts +4 -1
  1001. package/dist/workflows/triggers/trigger-execution-context.factory.js +41 -6
  1002. package/dist/workflows/triggers/trigger-execution-context.factory.js.map +1 -1
  1003. package/dist/workflows/workflow-execution.service.d.ts +8 -3
  1004. package/dist/workflows/workflow-execution.service.js +44 -5
  1005. package/dist/workflows/workflow-execution.service.js.map +1 -1
  1006. package/dist/workflows/workflow-finder.service.d.ts +1 -0
  1007. package/dist/workflows/workflow-finder.service.js +6 -2
  1008. package/dist/workflows/workflow-finder.service.js.map +1 -1
  1009. package/dist/workflows/workflow-history/workflow-history.service.js.map +1 -1
  1010. package/package.json +49 -57
  1011. package/dist/modules/agents/entities/agent-memory-entry-cursor.entity.d.ts +0 -7
  1012. package/dist/modules/agents/entities/agent-memory-entry-cursor.entity.js +0 -38
  1013. package/dist/modules/agents/entities/agent-memory-entry-cursor.entity.js.map +0 -1
  1014. package/dist/modules/agents/repositories/agent-memory-entry-cursor.repository.d.ts +0 -5
  1015. package/dist/modules/agents/repositories/agent-memory-entry-cursor.repository.js +0 -26
  1016. package/dist/modules/agents/repositories/agent-memory-entry-cursor.repository.js.map +0 -1
  1017. package/dist/modules/breaking-changes/rules/v3/task-runner-internal-mode.rule.js +0 -51
  1018. package/dist/modules/breaking-changes/rules/v3/task-runner-internal-mode.rule.js.map +0 -1
  1019. package/dist/modules/git-connections.ee/constants.js.map +0 -1
  1020. package/dist/modules/git-connections.ee/database/entities/git-connection-project.entity.d.ts +0 -8
  1021. package/dist/modules/git-connections.ee/database/entities/git-connection-project.entity.js.map +0 -1
  1022. package/dist/modules/git-connections.ee/database/entities/git-connection.entity.d.ts +0 -14
  1023. package/dist/modules/git-connections.ee/database/entities/git-connection.entity.js +0 -61
  1024. package/dist/modules/git-connections.ee/database/entities/git-connection.entity.js.map +0 -1
  1025. package/dist/modules/git-connections.ee/database/repositories/git-connection-project.repository.d.ts +0 -11
  1026. package/dist/modules/git-connections.ee/database/repositories/git-connection-project.repository.js +0 -58
  1027. package/dist/modules/git-connections.ee/database/repositories/git-connection-project.repository.js.map +0 -1
  1028. package/dist/modules/git-connections.ee/database/repositories/git-connection.repository.d.ts +0 -12
  1029. package/dist/modules/git-connections.ee/database/repositories/git-connection.repository.js +0 -37
  1030. package/dist/modules/git-connections.ee/database/repositories/git-connection.repository.js.map +0 -1
  1031. package/dist/modules/git-connections.ee/git-connections-git.service.d.ts +0 -60
  1032. package/dist/modules/git-connections.ee/git-connections-git.service.js +0 -281
  1033. package/dist/modules/git-connections.ee/git-connections-git.service.js.map +0 -1
  1034. package/dist/modules/git-connections.ee/git-connections-git.utils.d.ts +0 -13
  1035. package/dist/modules/git-connections.ee/git-connections-git.utils.js.map +0 -1
  1036. package/dist/modules/git-connections.ee/git-connections.module.d.ts +0 -5
  1037. package/dist/modules/git-connections.ee/git-connections.module.js +0 -32
  1038. package/dist/modules/git-connections.ee/git-connections.module.js.map +0 -1
  1039. package/dist/modules/git-connections.ee/git-connections.service.d.ts +0 -70
  1040. package/dist/modules/git-connections.ee/git-connections.service.js +0 -476
  1041. package/dist/modules/git-connections.ee/git-connections.service.js.map +0 -1
  1042. package/dist/modules/insights/whole-seconds.d.ts +0 -1
  1043. package/dist/modules/insights/whole-seconds.js +0 -7
  1044. package/dist/modules/insights/whole-seconds.js.map +0 -1
  1045. package/dist/modules/instance-reporting/database/entities/instance-monitoring-report.js.map +0 -1
  1046. package/dist/modules/instance-reporting/database/repositories/instance-monitoring-report.repository.js.map +0 -1
  1047. package/dist/modules/instance-reporting/instance-reporting-scheduler.service.js.map +0 -1
  1048. package/dist/modules/instance-reporting/instance-reporting-settings.service.js.map +0 -1
  1049. package/dist/modules/instance-reporting/instance-reporting.config.js.map +0 -1
  1050. package/dist/modules/instance-reporting/instance-reporting.constants.js.map +0 -1
  1051. package/dist/modules/instance-reporting/instance-reporting.module.js +0 -26
  1052. package/dist/modules/instance-reporting/instance-reporting.module.js.map +0 -1
  1053. package/dist/modules/instance-reporting/instance-reporting.service.js.map +0 -1
  1054. package/dist/modules/type-availability-policies/dto/create-policy-document.dto.d.ts +0 -80
  1055. package/dist/modules/type-availability-policies/dto/create-policy-document.dto.js +0 -11
  1056. package/dist/modules/type-availability-policies/dto/create-policy-document.dto.js.map +0 -1
  1057. package/dist/modules/type-availability-policies/dto/policy-rule.schema.d.ts +0 -108
  1058. package/dist/modules/type-availability-policies/dto/policy-rule.schema.js +0 -30
  1059. package/dist/modules/type-availability-policies/dto/policy-rule.schema.js.map +0 -1
  1060. package/dist/modules/type-availability-policies/dto/policy-selector.schema.d.ts +0 -20
  1061. package/dist/modules/type-availability-policies/dto/policy-selector.schema.js +0 -9
  1062. package/dist/modules/type-availability-policies/dto/policy-selector.schema.js.map +0 -1
  1063. package/dist/modules/type-availability-policies/dto/put-instance-policy.dto.d.ts +0 -85
  1064. package/dist/modules/type-availability-policies/dto/put-instance-policy.dto.js +0 -14
  1065. package/dist/modules/type-availability-policies/dto/put-instance-policy.dto.js.map +0 -1
  1066. package/dist/modules/type-availability-policies/dto/replace-attachments.dto.d.ts +0 -97
  1067. package/dist/modules/type-availability-policies/dto/replace-attachments.dto.js +0 -36
  1068. package/dist/modules/type-availability-policies/dto/replace-attachments.dto.js.map +0 -1
  1069. package/dist/modules/type-availability-policies/dto/update-policy-document.dto.d.ts +0 -83
  1070. package/dist/modules/type-availability-policies/dto/update-policy-document.dto.js +0 -13
  1071. package/dist/modules/type-availability-policies/dto/update-policy-document.dto.js.map +0 -1
  1072. package/dist/public-api/v1/controllers/git-connections.public.controller.d.ts +0 -21
  1073. package/dist/public-api/v1/controllers/git-connections.public.controller.js +0 -302
  1074. package/dist/public-api/v1/controllers/git-connections.public.controller.js.map +0 -1
  1075. package/dist/public-api/v1/handlers/credentials/credentials.mapper.d.ts +0 -6
  1076. package/dist/public-api/v1/handlers/credentials/credentials.mapper.js +0 -19
  1077. package/dist/public-api/v1/handlers/credentials/credentials.mapper.js.map +0 -1
  1078. package/dist/public-api/v1/handlers/credentials/credentials.middleware.d.ts +0 -6
  1079. package/dist/public-api/v1/handlers/credentials/credentials.middleware.js +0 -91
  1080. package/dist/public-api/v1/handlers/credentials/credentials.middleware.js.map +0 -1
  1081. package/dist/public-api/v1/handlers/projects/projects.handler.d.ts +0 -31
  1082. package/dist/public-api/v1/handlers/projects/projects.handler.js +0 -165
  1083. package/dist/public-api/v1/handlers/projects/projects.handler.js.map +0 -1
  1084. package/dist/public-api/v1/handlers/source-control/source-control.handler.d.ts +0 -7
  1085. package/dist/public-api/v1/handlers/source-control/source-control.handler.js +0 -46
  1086. package/dist/public-api/v1/handlers/source-control/source-control.handler.js.map +0 -1
  1087. package/dist/public-api/v1/handlers/variables/variables.handler.d.ts +0 -15
  1088. package/dist/public-api/v1/handlers/variables/variables.handler.js +0 -56
  1089. package/dist/public-api/v1/handlers/variables/variables.handler.js.map +0 -1
  1090. /package/dist/modules/{instance-reporting → instance-reporting.ee}/database/entities/instance-monitoring-report.d.ts +0 -0
  1091. /package/dist/modules/{instance-reporting → instance-reporting.ee}/database/entities/instance-monitoring-report.js +0 -0
  1092. /package/dist/modules/{instance-reporting → instance-reporting.ee}/instance-reporting-settings.service.d.ts +0 -0
  1093. /package/dist/modules/{instance-reporting → instance-reporting.ee}/instance-reporting-settings.service.js +0 -0
  1094. /package/dist/modules/{instance-reporting → instance-reporting.ee}/instance-reporting.config.d.ts +0 -0
  1095. /package/dist/modules/{instance-reporting → instance-reporting.ee}/instance-reporting.config.js +0 -0
  1096. /package/dist/modules/{instance-reporting → instance-reporting.ee}/instance-reporting.constants.d.ts +0 -0
  1097. /package/dist/modules/{instance-reporting → instance-reporting.ee}/instance-reporting.constants.js +0 -0
  1098. /package/dist/modules/{instance-reporting → instance-reporting.ee}/instance-reporting.service.d.ts +0 -0
  1099. /package/dist/modules/{instance-reporting → instance-reporting.ee}/instance-reporting.service.js +0 -0
@@ -15,6 +15,7 @@ exports.isAttachmentRejectedByProviderError = isAttachmentRejectedByProviderErro
15
15
  exports.getUserFacingErrorMessage = getUserFacingErrorMessage;
16
16
  exports.isMaskedStreamFailure = isMaskedStreamFailure;
17
17
  const agents_1 = require("@n8n/agents");
18
+ const sandbox_1 = require("@n8n/agents/sandbox");
18
19
  const api_types_1 = require("@n8n/api-types");
19
20
  const backend_common_1 = require("@n8n/backend-common");
20
21
  const backend_network_1 = require("@n8n/backend-network");
@@ -36,9 +37,11 @@ const bad_request_error_1 = require("../../errors/response-errors/bad-request.er
36
37
  const forbidden_error_1 = require("../../errors/response-errors/forbidden.error");
37
38
  const event_service_1 = require("../../events/event.service");
38
39
  const instance_ai_builder_delegate_adapter_1 = require("../../modules/agents/instance-ai-builder-delegate.adapter");
40
+ const model_stream_stall_options_1 = require("../../modules/agents/model-stream-stall-options");
39
41
  const check_access_1 = require("../../permissions.ee/check-access");
40
42
  const publisher_service_1 = require("../../scaling/pubsub/publisher.service");
41
43
  const push_1 = require("../../push");
44
+ const ai_preference_service_1 = require("../../services/ai-preference.service");
42
45
  const ai_service_1 = require("../../services/ai.service");
43
46
  const instance_write_access_service_1 = require("../../services/instance-write-access.service");
44
47
  const proxy_token_manager_1 = require("../../services/proxy-token-manager");
@@ -46,6 +49,7 @@ const url_service_1 = require("../../services/url.service");
46
49
  const telemetry_2 = require("../../telemetry");
47
50
  const utils_1 = require("../../utils");
48
51
  const agent_preview_handoff_1 = require("./agent-preview-handoff");
52
+ const instance_context_service_1 = require("./instance-context.service");
49
53
  const composite_local_mcp_server_1 = require("./browser/composite-local-mcp-server");
50
54
  const instance_ai_browser_session_service_1 = require("./browser/instance-ai-browser-session.service");
51
55
  const canvas_node_context_flag_gate_1 = require("./canvas-node-context-flag-gate");
@@ -75,7 +79,7 @@ const planned_task_action_runner_1 = require("./planned-task-action-runner");
75
79
  const instance_ai_event_log_repository_1 = require("./repositories/instance-ai-event-log.repository");
76
80
  const instance_ai_pending_confirmation_repository_1 = require("./repositories/instance-ai-pending-confirmation.repository");
77
81
  const instance_ai_thread_grant_repository_1 = require("./repositories/instance-ai-thread-grant.repository");
78
- const sandbox_1 = require("./sandbox");
82
+ const sandbox_2 = require("./sandbox");
79
83
  const db_iteration_log_storage_1 = require("./storage/db-iteration-log-storage");
80
84
  const typeorm_agent_checkpoint_store_1 = require("./storage/typeorm-agent-checkpoint-store");
81
85
  const typeorm_agent_memory_1 = require("./storage/typeorm-agent-memory");
@@ -201,7 +205,6 @@ function isTelemetryConfigurableAgent(agent) {
201
205
  agent !== null &&
202
206
  typeof Reflect.get(agent, 'telemetry') === 'function');
203
207
  }
204
- const INSTANCE_AI_CHECKPOINT_PRUNE_RETRY_MS = 30 * 1000;
205
208
  const WORKFLOW_SETUP_ROUTING_CLAIM_TTL_MS = 15 * 60 * 1000;
206
209
  const CONFIRMATION_EXPIRED_MESSAGE = 'This confirmation has expired. Send a new message to continue.';
207
210
  const RESUME_REJECTED_MESSAGE = 'I could not apply that confirmation. Send a new message to continue.';
@@ -242,7 +245,7 @@ function isAttachmentRejectedByProviderError(error) {
242
245
  const haystack = [(0, get_error_message_1.getErrorMessage)(error), ...collectErrorText(error)].join(' ').toLowerCase();
243
246
  return ATTACHMENT_SUBJECT_PATTERN.test(haystack) && ATTACHMENT_REFUSAL_PATTERN.test(haystack);
244
247
  }
245
- exports.QUOTA_EXHAUSTED_USER_MESSAGE = "You've run out of AI credits. Upgrade your plan to continue using the AI assistant.";
248
+ exports.QUOTA_EXHAUSTED_USER_MESSAGE = "You've run out of AI credits. Upgrade your plan to continue using the n8n Assistant.";
246
249
  const OPERATIONAL_ERROR_USER_MESSAGE = 'I hit an operational error before I could finish that response. Please try again.';
247
250
  const GENERIC_ERROR_USER_MESSAGE = 'Something went wrong before I could finish that response. Please try again.';
248
251
  function getUserFacingErrorCode(error) {
@@ -345,7 +348,7 @@ let InstanceAiService = class InstanceAiService {
345
348
  }
346
349
  return this._mcpClientManager;
347
350
  }
348
- constructor(logger, globalConfig, instanceSettings, adapterService, eventBus, eventLog, interruptedRunSweeper, settingsService, gatewayService, browserSessionService, memoryService, agentMemory, checkpointStore, aiService, threadGrantRepo, pendingConfirmationRepo, urlService, eventLogRepository, dbIterationLogStorage, instanceWriteAccess, telemetry, mcpRegistryService, userRepository, temporaryWorkflowService, errorReporter, ssrfProtectionConfig, ssrfProtectionService, eventService, evalCredentialAllowlists, runProbe, modelService, creditService, publisher, instanceAiErrorReporter, canvasNodeContextFlagGate, push, conversationHistoryService) {
351
+ constructor(logger, globalConfig, instanceSettings, adapterService, eventBus, eventLog, interruptedRunSweeper, settingsService, gatewayService, browserSessionService, memoryService, agentMemory, checkpointStore, aiService, threadGrantRepo, pendingConfirmationRepo, urlService, eventLogRepository, dbIterationLogStorage, instanceWriteAccess, telemetry, mcpRegistryService, userRepository, temporaryWorkflowService, errorReporter, ssrfProtectionConfig, ssrfProtectionService, eventService, evalCredentialAllowlists, runProbe, modelService, creditService, publisher, instanceAiErrorReporter, canvasNodeContextFlagGate, push, conversationHistoryService, instanceContext, aiPreferenceService) {
349
352
  this.instanceSettings = instanceSettings;
350
353
  this.adapterService = adapterService;
351
354
  this.eventBus = eventBus;
@@ -378,6 +381,8 @@ let InstanceAiService = class InstanceAiService {
378
381
  this.canvasNodeContextFlagGate = canvasNodeContextFlagGate;
379
382
  this.push = push;
380
383
  this.conversationHistoryService = conversationHistoryService;
384
+ this.instanceContext = instanceContext;
385
+ this.aiPreferenceService = aiPreferenceService;
381
386
  this.runState = new instance_ai_1.RunStateRegistry((user) => user.id);
382
387
  this.memoryTaskRegistry = new instance_ai_1.MemoryTaskRegistry();
383
388
  this.domainAccessTrackersByThread = new Map();
@@ -386,16 +391,15 @@ let InstanceAiService = class InstanceAiService {
386
391
  this.planRequestsByThread = new Map();
387
392
  this.schedulerLocks = new Map();
388
393
  this.failedInternalFollowUpStreaks = new Map();
389
- this.pendingCheckpointReentries = new Map();
390
394
  this.runDebugBuffer = new instance_ai_1.RunDebugBuffer();
391
- this.checkpointPruningStopped = true;
392
395
  this.inFlightExecutions = new Set();
393
396
  this.preserveHitlOnShutdown = new Set();
394
397
  this.logger = logger.scoped('instance-ai');
395
398
  runProbe.registerActiveRunCountProvider(() => this.runState.activeRunCount());
396
- this.workflowObligations = new workflow_verification_obligation_service_1.WorkflowVerificationObligationService(this.agentMemory);
399
+ this.workflowObligations = new workflow_verification_obligation_service_1.WorkflowVerificationObligationService(this.agentMemory, () => this.settingsService.isInstanceAiSetupPanelEnabled());
397
400
  this.taskProjector = new workflow_verification_task_projector_1.WorkflowVerificationTaskProjector(this.agentMemory, this.eventBus, this.logger, this.workflowObligations);
398
401
  this.instanceAiConfig = globalConfig.instanceAi;
402
+ this.aiConfig = globalConfig.ai;
399
403
  this.backgroundTasks = new instance_ai_1.BackgroundTaskManager(MAX_CONCURRENT_BACKGROUND_TASKS_PER_THREAD, this.instanceAiConfig.maxConcurrentSubAgents);
400
404
  this.suspendedThreads = new suspended_thread_persistence_service_1.SuspendedThreadPersistenceService({
401
405
  logger: this.logger,
@@ -438,7 +442,7 @@ let InstanceAiService = class InstanceAiService {
438
442
  eventLog: this.eventLogRepository,
439
443
  aiService: this.aiService,
440
444
  });
441
- this.sandboxService = new sandbox_1.InstanceAiSandboxService({
445
+ this.sandboxService = new sandbox_2.InstanceAiSandboxService({
442
446
  config: this.instanceAiConfig,
443
447
  logger: this.logger,
444
448
  errorReporter: this.errorReporter,
@@ -446,6 +450,13 @@ let InstanceAiService = class InstanceAiService {
446
450
  backgroundTasks: this.backgroundTasks,
447
451
  settingsService: this.settingsService,
448
452
  aiService: this.aiService,
453
+ resolveTracingConfig: async (threadId, userId) => {
454
+ const ownerId = userId ?? (await this.agentMemory.getThread(threadId))?.resourceId;
455
+ if (!ownerId)
456
+ return { userId: 'system' };
457
+ const { tracingProxyConfig } = await this.createProxyRunConfig({ id: ownerId });
458
+ return { userId: ownerId, proxyConfig: tracingProxyConfig };
459
+ },
449
460
  });
450
461
  this.terminalOutcome = new instance_ai_terminal_outcome_service_1.InstanceAiTerminalOutcomeService({
451
462
  eventBus: {
@@ -486,8 +497,6 @@ let InstanceAiService = class InstanceAiService {
486
497
  });
487
498
  });
488
499
  this.liveness.start();
489
- if (this.instanceSettings.isLeader)
490
- this.startCheckpointPruning();
491
500
  }
492
501
  async createProxyRunConfig(user) {
493
502
  if (!this.aiService.isProxyEnabled())
@@ -666,6 +675,7 @@ let InstanceAiService = class InstanceAiService {
666
675
  maxIterations: instance_ai_1.MAX_STEPS.ORCHESTRATOR,
667
676
  abortSignal: signal,
668
677
  recoverUsageOnAbort: true,
678
+ ...(0, model_stream_stall_options_1.modelStreamStallOptions)(this.aiConfig),
669
679
  persistence: {
670
680
  resourceId: user.id,
671
681
  threadId,
@@ -692,6 +702,7 @@ let InstanceAiService = class InstanceAiService {
692
702
  toolCallId,
693
703
  abortSignal: signal,
694
704
  recoverUsageOnAbort: true,
705
+ ...(0, model_stream_stall_options_1.modelStreamStallOptions)(this.aiConfig),
695
706
  persistence: {
696
707
  resourceId: user.id,
697
708
  threadId,
@@ -857,7 +868,7 @@ let InstanceAiService = class InstanceAiService {
857
868
  error,
858
869
  }));
859
870
  }
860
- async applyTaskControlLocally({ threadId, taskId, action, correction, }) {
871
+ async applyTaskControlLocally({ threadId, taskId, action, correction, userId, }) {
861
872
  switch (action) {
862
873
  case 'correct':
863
874
  if (!taskId || correction === undefined)
@@ -876,7 +887,7 @@ let InstanceAiService = class InstanceAiService {
876
887
  this.cancelRun(threadId);
877
888
  return false;
878
889
  case 'clear-thread':
879
- await this.clearThreadState(threadId);
890
+ await this.clearThreadState(threadId, userId);
880
891
  return false;
881
892
  }
882
893
  }
@@ -899,8 +910,12 @@ let InstanceAiService = class InstanceAiService {
899
910
  await this.interruptedRunSweeper.cancelUnfinishedRuns(threadId);
900
911
  }
901
912
  }
902
- async routeClearThreadState(threadId) {
903
- await this.routeTaskControl({ threadId, action: 'clear-thread' });
913
+ async routeClearThreadState(threadId, userId) {
914
+ await this.routeTaskControl({
915
+ threadId,
916
+ action: 'clear-thread',
917
+ ...(userId ? { userId } : {}),
918
+ });
904
919
  }
905
920
  async handleRelayTaskControl(payload) {
906
921
  try {
@@ -1044,7 +1059,7 @@ let InstanceAiService = class InstanceAiService {
1044
1059
  clearTraceEvents(slug) {
1045
1060
  this.tracing.clearTraceEvents(slug);
1046
1061
  }
1047
- async clearThreadState(threadId) {
1062
+ async clearThreadState(threadId, userId) {
1048
1063
  this.liveness.clearThreadState(threadId);
1049
1064
  const { active, suspended } = this.runState.clearThread(threadId);
1050
1065
  if (active) {
@@ -1079,7 +1094,7 @@ let InstanceAiService = class InstanceAiService {
1079
1094
  this.memoryTaskRegistry.clearThread(threadId);
1080
1095
  this.tracing.deleteTraceContextsForThread(threadId);
1081
1096
  await this.deleteAgentBuilderSessions(threadId);
1082
- await this.sandboxService.destroySandbox(threadId);
1097
+ await this.sandboxService.destroySandbox(threadId, 'thread_cleanup', userId);
1083
1098
  await this.temporaryWorkflowService.reapForThreadCleanup(threadId);
1084
1099
  await this.suspendedThreads.dropPendingConfirmationsForThread(threadId);
1085
1100
  this.eventBus.clearThread(threadId);
@@ -1098,7 +1113,6 @@ let InstanceAiService = class InstanceAiService {
1098
1113
  }
1099
1114
  }
1100
1115
  async shutdown() {
1101
- this.stopCheckpointPruning();
1102
1116
  this.liveness.shutdown();
1103
1117
  const { activeRuns, suspendedRuns, pendingThreadIds } = this.runState.shutdown();
1104
1118
  const threadsWithPendingHitl = new Set(pendingThreadIds);
@@ -1124,6 +1138,7 @@ let InstanceAiService = class InstanceAiService {
1124
1138
  status: 'cancelled',
1125
1139
  reason: 'service_shutdown',
1126
1140
  });
1141
+ this.preserveHitlOnShutdown.add(run.runId);
1127
1142
  run.abortController.abort();
1128
1143
  }
1129
1144
  for (const task of this.backgroundTasks.cancelAll()) {
@@ -1151,25 +1166,6 @@ let InstanceAiService = class InstanceAiService {
1151
1166
  await (0, instance_ai_1.shutdownProductTelemetryProviders)();
1152
1167
  this.logger.debug('Instance AI service shut down');
1153
1168
  }
1154
- startCheckpointPruning() {
1155
- if (this.checkpointPruneTimer || this.instanceAiConfig.pruneInterval <= 0)
1156
- return;
1157
- this.checkpointPruningStopped = false;
1158
- this.scheduleCheckpointPrune(0);
1159
- }
1160
- stopCheckpointPruning() {
1161
- this.checkpointPruningStopped = true;
1162
- clearTimeout(this.checkpointPruneTimer);
1163
- this.checkpointPruneTimer = undefined;
1164
- }
1165
- scheduleCheckpointPrune(delayMs = this.instanceAiConfig.pruneInterval) {
1166
- if (this.checkpointPruningStopped)
1167
- return;
1168
- this.checkpointPruneTimer = setTimeout(() => {
1169
- void this.runScheduledPrune();
1170
- }, delayMs);
1171
- this.checkpointPruneTimer.unref();
1172
- }
1173
1169
  trackInFlightExecution(promise) {
1174
1170
  const tracked = promise.finally(() => {
1175
1171
  this.inFlightExecutions.delete(tracked);
@@ -1200,26 +1196,23 @@ let InstanceAiService = class InstanceAiService {
1200
1196
  });
1201
1197
  }
1202
1198
  }
1203
- async runScheduledPrune(now = Date.now()) {
1199
+ async pruneExpiredData(now = Date.now(), signal) {
1204
1200
  const olderThan = new Date(now - this.instanceAiConfig.snapshotRetention);
1205
- try {
1206
- const count = await this.checkpointStore.markExpiredOlderThan(olderThan);
1207
- if (count > 0) {
1208
- this.logger.info('Expired stale Instance AI checkpoints', { count });
1209
- }
1210
- else {
1211
- this.logger.debug('No stale Instance AI checkpoints to expire');
1212
- }
1201
+ const count = await this.checkpointStore.markExpiredOlderThan(olderThan);
1202
+ if (count > 0) {
1203
+ this.logger.info('Expired stale Instance AI checkpoints', { count });
1204
+ }
1205
+ else {
1206
+ this.logger.debug('No stale Instance AI checkpoints to expire');
1207
+ }
1208
+ if (!signal?.aborted)
1213
1209
  await this.hardDeleteExpiredCheckpoints(now);
1210
+ if (!signal?.aborted)
1214
1211
  await this.suspendedThreads.pruneStalePendingConfirmations(now);
1215
- await this.pruneExpiredThreads();
1216
- this.scheduleCheckpointPrune();
1217
- }
1218
- catch (error) {
1219
- this.logger.warn('Failed to expire stale Instance AI checkpoints', {
1220
- error: (0, get_error_message_1.getErrorMessage)(error),
1221
- });
1222
- this.scheduleCheckpointPrune(INSTANCE_AI_CHECKPOINT_PRUNE_RETRY_MS);
1212
+ if (!signal?.aborted)
1213
+ await this.pruneExpiredThreads(signal);
1214
+ if (signal?.aborted) {
1215
+ this.logger.debug('Stopped the Instance AI prune pass early because the run was aborted');
1223
1216
  }
1224
1217
  }
1225
1218
  async hardDeleteExpiredCheckpoints(now) {
@@ -1239,9 +1232,9 @@ let InstanceAiService = class InstanceAiService {
1239
1232
  });
1240
1233
  }
1241
1234
  }
1242
- async pruneExpiredThreads() {
1235
+ async pruneExpiredThreads(signal) {
1243
1236
  try {
1244
- await this.memoryService.cleanupExpiredThreads(async (threadId) => await this.clearThreadState(threadId));
1237
+ await this.memoryService.cleanupExpiredThreads(async (threadId) => await this.clearThreadState(threadId), signal);
1245
1238
  }
1246
1239
  catch (error) {
1247
1240
  this.logger.warn('Failed to clean up expired Instance AI conversation threads', {
@@ -1254,6 +1247,7 @@ let InstanceAiService = class InstanceAiService {
1254
1247
  observationalMemory: {
1255
1248
  observerThresholdTokens: this.instanceAiConfig.observerMessageTokens,
1256
1249
  reflectorThresholdTokens: this.instanceAiConfig.reflectorObservationTokens,
1250
+ midRunObservation: this.instanceAiConfig.midRunObservation,
1257
1251
  onTaskUsage: async (report) => {
1258
1252
  try {
1259
1253
  const items = (0, instance_ai_1.tokenUsageToBuilderUsageItems)(report.model, report.usage);
@@ -1290,7 +1284,23 @@ let InstanceAiService = class InstanceAiService {
1290
1284
  await workflowTasks.updateBuildOutcome(workItemId, update);
1291
1285
  await sync();
1292
1286
  },
1287
+ beginVerification: async (outcome, state, verificationRunId) => {
1288
+ const resumed = await workflowTasks.beginVerification(outcome, state, verificationRunId);
1289
+ if (resumed)
1290
+ await sync();
1291
+ return resumed;
1292
+ },
1293
1293
  getBuildOutcome: async (workItemId) => await workflowTasks.getBuildOutcome(workItemId),
1294
+ startVerification: async (workItemId, triggerNodeName) => {
1295
+ const previousProgress = await workflowTasks.startVerification(workItemId, triggerNodeName);
1296
+ await sync();
1297
+ return previousProgress;
1298
+ },
1299
+ recordVerification: async (workItemId, verification, previousProgress) => {
1300
+ const claim = await workflowTasks.recordVerification(workItemId, verification, previousProgress);
1301
+ await sync();
1302
+ return claim;
1303
+ },
1294
1304
  getLatestBuildOutcomeForWorkflow: async (workflowId) => await workflowTasks.getLatestBuildOutcomeForWorkflow(workflowId),
1295
1305
  getWorkflowLoopState: async (workItemId) => await workflowTasks.getWorkflowLoopState(workItemId),
1296
1306
  };
@@ -1439,12 +1449,12 @@ let InstanceAiService = class InstanceAiService {
1439
1449
  const localGatewayDisabledForUser = await this.settingsService.isLocalGatewayDisabledForUser(user.id);
1440
1450
  const userGateway = this.gatewayService.findGateway(user.id);
1441
1451
  await this.creditService.ensureQuotaLockApplied(user);
1442
- const { searchProxyConfig, tracingProxyConfig, tokenManager, proxyBaseUrl } = proxyRunConfig ?? (await this.createProxyRunConfig(user));
1452
+ const { searchProxyConfig, tokenManager, proxyBaseUrl } = proxyRunConfig ?? (await this.createProxyRunConfig(user));
1443
1453
  const proxyContext = { runId, threadId };
1444
1454
  const modelId = proxyBaseUrl && tokenManager
1445
1455
  ? await this.modelService.resolveProxyModel(user, proxyBaseUrl, tokenManager, proxyContext)
1446
1456
  : await this.modelService.resolveAgentModelConfig(user, proxyContext);
1447
- const { configEvalsEnabled, mcpConnectionsEnabled, conversationHistoryEnabled, progressiveBuildingEnabled, nodeUsageEnabled, folderExplorationEnabled, } = await this.adapterService.resolveExperimentGates(user);
1457
+ const { configEvalsEnabled, mcpConnectionsEnabled, conversationHistoryEnabled, progressiveBuildingEnabled, nodeUsageEnabled, folderExplorationEnabled, aiPreferencesEnabled, } = await this.adapterService.resolveExperimentGates(user);
1448
1458
  const conversationHistory = conversationHistoryEnabled
1449
1459
  ? this.conversationHistoryService.forContext(user.id, boundProjectId, threadId)
1450
1460
  : undefined;
@@ -1490,7 +1500,23 @@ let InstanceAiService = class InstanceAiService {
1490
1500
  threadId,
1491
1501
  runId,
1492
1502
  agentId: (0, instance_ai_1.orchestratorAgentId)(runId),
1503
+ initialSnapshots: await this.eventLog.getSetupItemsSnapshots(threadId).catch((error) => {
1504
+ this.logger.warn('Failed to read setup panel snapshots', {
1505
+ threadId,
1506
+ error: (0, get_error_message_1.getErrorMessage)(error),
1507
+ });
1508
+ return [];
1509
+ }),
1510
+ readPersistedSnapshot: async (workflowId) => {
1511
+ const snapshots = await this.eventLog.getSetupItemsSnapshots(threadId);
1512
+ return snapshots.find((snapshot) => snapshot.workflowId === workflowId)?.items;
1513
+ },
1493
1514
  });
1515
+ context.markWorkflowSetupHandled = async (workflowId) => {
1516
+ await this.markWorkflowSetupHandled(threadId, workflowId, runId, {
1517
+ requirePersisted: true,
1518
+ });
1519
+ };
1494
1520
  }
1495
1521
  context.browserCredentialSetup = this.createBrowserCredentialSetupTracker(runId, user.id);
1496
1522
  const sessionGrants = await this.loadThreadSessionGrants(threadId, user.id);
@@ -1557,7 +1583,10 @@ let InstanceAiService = class InstanceAiService {
1557
1583
  if (nodeDefDirs.length > 0) {
1558
1584
  (0, workflow_sdk_1.setSchemaBaseDirs)(nodeDefDirs);
1559
1585
  }
1560
- const flagDisabledSkillIds = (0, instance_ai_1.disabledInstanceAiSkillIds)({ configEvalsEnabled });
1586
+ const flagDisabledSkillIds = (0, instance_ai_1.disabledInstanceAiSkillIds)({
1587
+ configEvalsEnabled,
1588
+ instanceContextEnabled: this.instanceAiConfig.instanceContextEnabled,
1589
+ });
1561
1590
  const selectedSkills = await (0, instance_ai_1.loadInstanceAiPromptSkills)(selectedPrompt.profile);
1562
1591
  const selectedRuntimeSkills = selectedSkills.source;
1563
1592
  const allRuntimeSkills = flagDisabledSkillIds.length > 0
@@ -1572,7 +1601,7 @@ let InstanceAiService = class InstanceAiService {
1572
1601
  if (sandboxStatus.workflowBuilderAvailable) {
1573
1602
  const sandboxConfig = await this.instanceAiErrorReporter.withBoundary('instance-ai-sandbox-setup', { threadId, runId, userId: user.id, messageGroupId }, async () => await this.sandboxService.resolveSandboxConfig(user));
1574
1603
  if (sandboxConfig.enabled) {
1575
- workspaceRoot = (0, instance_ai_1.getPromptWorkspaceRoot)(sandboxConfig.provider);
1604
+ workspaceRoot = (0, sandbox_1.getPromptWorkspaceRoot)(sandboxConfig.provider);
1576
1605
  let sandboxEntryPromise;
1577
1606
  const getSandboxEntry = async () => {
1578
1607
  sandboxEntryPromise ??= this.sandboxService
@@ -1589,7 +1618,7 @@ let InstanceAiService = class InstanceAiService {
1589
1618
  const scopeWorkspaceForAgent = async (workspace) => {
1590
1619
  if (!workspace)
1591
1620
  return undefined;
1592
- const root = await (0, instance_ai_1.getWorkspaceRoot)(workspace);
1621
+ const root = await (0, sandbox_1.getWorkspaceRoot)(workspace);
1593
1622
  return (0, agents_1.createScopedWorkspace)(workspace, root);
1594
1623
  };
1595
1624
  runtimeWorkspace = (0, instance_ai_1.createLazyRuntimeWorkspace)({
@@ -1616,7 +1645,6 @@ let InstanceAiService = class InstanceAiService {
1616
1645
  context.trackTelemetry = (eventName, properties) => {
1617
1646
  this.telemetry.track(eventName, (0, telemetry_1.redactTelemetryProperties)(properties));
1618
1647
  };
1619
- const domainTools = (0, instance_ai_1.createAllTools)(context);
1620
1648
  const orchestrationContext = {
1621
1649
  threadId,
1622
1650
  runId,
@@ -1625,9 +1653,10 @@ let InstanceAiService = class InstanceAiService {
1625
1653
  projectId: boundProjectId,
1626
1654
  promptConfiguration: promptMetadata,
1627
1655
  disabledToolNames: new Set(selectedSkills.disabledTools),
1656
+ setupPanelEnabled: (0, instance_ai_1.isSetupPanelEnabled)(context),
1628
1657
  orchestratorAgentId: (0, instance_ai_1.orchestratorAgentId)(runId),
1629
1658
  modelId,
1630
- checkpointStore: this.checkpointStore,
1659
+ modelStreamStallOptions: (0, model_stream_stall_options_1.modelStreamStallOptions)(this.aiConfig),
1631
1660
  eventBus: this.eventBus,
1632
1661
  logger: this.logger,
1633
1662
  trackTelemetry: (eventName, properties) => {
@@ -1654,7 +1683,6 @@ let InstanceAiService = class InstanceAiService {
1654
1683
  });
1655
1684
  }
1656
1685
  },
1657
- domainTools,
1658
1686
  abortSignal,
1659
1687
  taskStorage,
1660
1688
  timeZone: this.defaultTimeZone,
@@ -1664,27 +1692,7 @@ let InstanceAiService = class InstanceAiService {
1664
1692
  oauth2CallbackUrl: this.oauth2CallbackUrl,
1665
1693
  webhookBaseUrl: this.webhookBaseUrl,
1666
1694
  formBaseUrl: this.formBaseUrl,
1667
- waitForConfirmation: async (requestId) => {
1668
- this.runState.touchActiveRun(threadId);
1669
- return await new Promise((resolve) => {
1670
- this.runState.registerPendingConfirmation(requestId, {
1671
- resolve,
1672
- threadId,
1673
- userId: user.id,
1674
- createdAt: Date.now(),
1675
- });
1676
- void this.suspendedThreads.persistPendingConfirmation({
1677
- requestId,
1678
- threadId,
1679
- userId: user.id,
1680
- runId,
1681
- messageGroupId,
1682
- kind: 'inline',
1683
- });
1684
- });
1685
- },
1686
1695
  cancelBackgroundTask: async (taskId) => this.cancelBackgroundTask(threadId, taskId),
1687
- spawnBackgroundTask: (opts) => this.spawnBackgroundTask(runId, opts, messageGroupId),
1688
1696
  touchRun: () => this.runState.touchActiveRun(threadId),
1689
1697
  touchBackgroundTask: (taskId) => this.backgroundTasks.touchTask(threadId, taskId),
1690
1698
  plannedTaskService,
@@ -1696,8 +1704,6 @@ let InstanceAiService = class InstanceAiService {
1696
1704
  workspaceRoot,
1697
1705
  nodeDefinitionDirs: nodeDefDirs.length > 0 ? nodeDefDirs : undefined,
1698
1706
  domainContext: context,
1699
- tracingProxyConfig,
1700
- memory,
1701
1707
  };
1702
1708
  return {
1703
1709
  context,
@@ -1709,6 +1715,7 @@ let InstanceAiService = class InstanceAiService {
1709
1715
  modelId,
1710
1716
  orchestrationContext,
1711
1717
  conversationHistory,
1718
+ aiPreferencesEnabled,
1712
1719
  };
1713
1720
  }
1714
1721
  getAgentExecutionService() {
@@ -1879,37 +1886,26 @@ let InstanceAiService = class InstanceAiService {
1879
1886
  return;
1880
1887
  await this.schedulePlannedTasks(user, task.threadId);
1881
1888
  }
1882
- async maybeStartWorkflowVerificationFollowUp(user, task) {
1883
- if (task.role !== 'workflow-builder' || !task.workItemId)
1884
- return false;
1885
- const obligation = await this.workflowObligations.getObligation(task.threadId, task.workItemId, {
1886
- source: task.plannedTaskId ? 'planned' : 'direct',
1887
- plannedTaskId: task.plannedTaskId,
1888
- });
1889
- if (!obligation)
1890
- return false;
1891
- this.trackWorkflowVerificationObligation(obligation, 'background_task_settled');
1892
- if (obligation.status !== 'ready_to_verify' && obligation.status !== 'verifying') {
1893
- return false;
1889
+ async buildWorkflowSetupStateBlock(context) {
1890
+ const emitter = context.setupItemsEmitter;
1891
+ if (!emitter)
1892
+ return '';
1893
+ const workflowIds = emitter.workflowIds().reverse();
1894
+ if (workflowIds.length === 0)
1895
+ return '';
1896
+ try {
1897
+ const note = (0, instance_ai_1.formatWorkflowSetupStateNote)(await (0, instance_ai_1.observeWorkflowSetupStates)(context, workflowIds));
1898
+ return note
1899
+ ? `${internal_messages_1.WORKFLOW_SETUP_STATE_OPEN_TAG}\n${note}\n${internal_messages_1.WORKFLOW_SETUP_STATE_CLOSE_TAG}`
1900
+ : '';
1901
+ }
1902
+ catch (error) {
1903
+ this.logger.warn('Failed to build the workflow setup state block', {
1904
+ threadId: context.threadId,
1905
+ error: error instanceof Error ? error.message : String(error),
1906
+ });
1907
+ return '';
1894
1908
  }
1895
- const outcome = (0, workflow_verification_obligation_service_1.parseWorkflowBuildOutcome)(task.outcome);
1896
- const startedRunId = await this.startInternalFollowUpRun(user, task.threadId, this.buildWorkflowVerificationFollowUpMessage({
1897
- obligation,
1898
- outcome,
1899
- sourceTask: {
1900
- taskId: task.taskId,
1901
- role: task.role,
1902
- status: task.status,
1903
- result: task.result,
1904
- error: task.error,
1905
- plannedTaskId: task.plannedTaskId,
1906
- workItemId: task.workItemId,
1907
- },
1908
- }), task.messageGroupId, false, undefined, 'workflow_verification');
1909
- this.trackWorkflowVerificationObligation(obligation, 'follow_up_start_attempted', {
1910
- follow_up_started: startedRunId.length > 0,
1911
- });
1912
- return startedRunId.length > 0;
1913
1909
  }
1914
1910
  buildWorkflowSetupFollowUpMessage(obligation) {
1915
1911
  const payload = {
@@ -1927,7 +1923,7 @@ let InstanceAiService = class InstanceAiService {
1927
1923
  return undefined;
1928
1924
  return typeof suspendPayload.workflowId === 'string' ? suspendPayload.workflowId : undefined;
1929
1925
  }
1930
- async markWorkflowSetupHandled(threadId, workflowId, runId) {
1926
+ async markWorkflowSetupHandled(threadId, workflowId, runId, options = {}) {
1931
1927
  const records = await this.listWorkflowLoopRecords(threadId);
1932
1928
  if (records.length === 0)
1933
1929
  return false;
@@ -1954,9 +1950,19 @@ let InstanceAiService = class InstanceAiService {
1954
1950
  const claim = await this.claimWorkItemSetupRouting(threadId, record);
1955
1951
  if (!claim)
1956
1952
  continue;
1957
- const marked = await this.markWorkItemSetupRouted(threadId, record.state.workItemId, claim.claimId);
1953
+ let marked;
1954
+ try {
1955
+ marked = await this.markWorkItemSetupRouted(threadId, record.state.workItemId, claim.claimId);
1956
+ }
1957
+ catch (error) {
1958
+ await this.releaseWorkItemSetupRoutingClaim(threadId, record.state.workItemId, claim.claimId);
1959
+ throw error;
1960
+ }
1958
1961
  if (!marked) {
1959
1962
  await this.releaseWorkItemSetupRoutingClaim(threadId, record.state.workItemId, claim.claimId);
1963
+ if (options.requirePersisted) {
1964
+ throw new n8n_workflow_1.OperationalError('Workflow setup routing marker was not saved');
1965
+ }
1960
1966
  this.logger.warn('Workflow setup completed but routing marker was not saved', {
1961
1967
  threadId,
1962
1968
  workItemId: record.state.workItemId,
@@ -2162,7 +2168,7 @@ let InstanceAiService = class InstanceAiService {
2162
2168
  async doSchedulePlannedTasks(user, threadId) {
2163
2169
  const revalidated = await this.revalidateActiveUser(user.id);
2164
2170
  if (!revalidated) {
2165
- this.logger.warn('Cancelling run: user no longer authorized for AI Assistant', {
2171
+ this.logger.warn('Cancelling run: user no longer authorized for n8n Assistant', {
2166
2172
  userId: user.id,
2167
2173
  threadId,
2168
2174
  });
@@ -2358,7 +2364,7 @@ let InstanceAiService = class InstanceAiService {
2358
2364
  }
2359
2365
  const executionPushRef = this.threadPushRef.get(threadId);
2360
2366
  const environment = await this.createExecutionEnvironment(user, threadId, runId, signal, messageGroupId, executionPushRef, proxyRunConfig);
2361
- const { context, memory, taskStorage, workflowTasks, plannedTaskService, modelId, orchestrationContext, conversationHistory, } = environment;
2367
+ const { context, memory, taskStorage, workflowTasks, plannedTaskService, modelId, orchestrationContext, conversationHistory, aiPreferencesEnabled, } = environment;
2362
2368
  promptVersion = orchestrationContext.promptConfiguration?.version;
2363
2369
  (0, instance_ai_1.setTracePromptVersion)(tracing, promptVersion);
2364
2370
  aiCreatedWorkflowIds = context.aiCreatedWorkflowIds ??= new Set();
@@ -2453,9 +2459,13 @@ let InstanceAiService = class InstanceAiService {
2453
2459
  previewSession: context.agentPreviewSession,
2454
2460
  });
2455
2461
  }
2462
+ else if (handoffContext?.source === 'setup-panel-execute' && (0, instance_ai_1.isSetupPanelEnabled)(context)) {
2463
+ handoffContextBlock = (0, internal_messages_1.buildWorkflowTestRequestBlock)(handoffContext.workflowId);
2464
+ }
2456
2465
  else {
2457
2466
  handoffContextBlock = buildHandoffContextBlock(handoffContext);
2458
2467
  }
2468
+ const setupStateBlock = resumeReason === undefined ? await this.buildWorkflowSetupStateBlock(context) : '';
2459
2469
  const thread = await memory.getThread(threadId);
2460
2470
  const isOpeningTurn = Boolean(thread && !thread.title);
2461
2471
  if (isOpeningTurn) {
@@ -2473,6 +2483,13 @@ let InstanceAiService = class InstanceAiService {
2473
2483
  },
2474
2484
  });
2475
2485
  }
2486
+ const instanceContext = await this.instanceContext.buildBlock({
2487
+ user,
2488
+ ...(context.projectId !== undefined ? { projectId: context.projectId } : {}),
2489
+ cursor: (0, instance_context_service_1.readInstanceContextCursor)(thread?.metadata),
2490
+ isMachineFollowUp: checkpoint?.isCheckpointFollowUp === true ||
2491
+ plannedBuild?.isPlannedBuildFollowUp === true,
2492
+ });
2476
2493
  const existingTasks = await taskStorage.get(threadId);
2477
2494
  if (existingTasks) {
2478
2495
  this.eventBus.publish(threadId, {
@@ -2497,20 +2514,33 @@ let InstanceAiService = class InstanceAiService {
2497
2514
  : attachmentManifest
2498
2515
  ? `${enrichedMessage}\n\n${attachmentManifest}`
2499
2516
  : enrichedMessage;
2500
- const messageWithContext = [contextResourcesBlock, handoffContextBlock, messageBody]
2517
+ const messageWithContext = [
2518
+ contextResourcesBlock,
2519
+ handoffContextBlock,
2520
+ setupStateBlock,
2521
+ instanceContext?.block ?? '',
2522
+ messageBody,
2523
+ ]
2501
2524
  .filter(Boolean)
2502
2525
  .join('\n\n');
2503
- const [projectSection, pastConversationsSection] = await Promise.all([
2504
- this.resolveProjectContextSection(context),
2526
+ const [boundProject, pastConversationsSection] = await Promise.all([
2527
+ this.resolveBoundProject(context),
2505
2528
  isOpeningTurn ? conversationHistory?.getPastConversationsSection() : undefined,
2506
2529
  ]);
2530
+ const projectSection = boundProject ? (0, internal_messages_1.getProjectContextSection)(boundProject) : undefined;
2531
+ const aiPreferencesBlock = isOpeningTurn && aiPreferencesEnabled
2532
+ ? await this.resolveAiPreferencesBlock(user.id, boundProject)
2533
+ : undefined;
2507
2534
  const messageWithProject = projectSection
2508
2535
  ? (0, internal_messages_1.withProjectContext)(messageWithContext, projectSection)
2509
2536
  : messageWithContext;
2510
2537
  const messageWithPastConversations = pastConversationsSection
2511
2538
  ? (0, internal_messages_1.withPastConversations)(messageWithProject, pastConversationsSection)
2512
2539
  : messageWithProject;
2513
- const fullMessage = (0, internal_messages_1.withCurrentDateTime)(messageWithPastConversations, (0, instance_ai_1.getDateTimeSection)(timeZone ?? this.defaultTimeZone));
2540
+ const messageWithPreferences = aiPreferencesBlock
2541
+ ? (0, internal_messages_1.withAiPreferences)(messageWithPastConversations, aiPreferencesBlock)
2542
+ : messageWithPastConversations;
2543
+ const fullMessage = (0, internal_messages_1.withCurrentDateTime)(messageWithPreferences, (0, instance_ai_1.getDateTimeSection)(timeZone ?? this.defaultTimeZone));
2514
2544
  const promptBuildRun = tracing
2515
2545
  ? await tracing.startChildRun(tracing.messageRun, {
2516
2546
  name: 'prepare: prompt',
@@ -2587,6 +2617,19 @@ let InstanceAiService = class InstanceAiService {
2587
2617
  const agent = await this.createAgentFromEnvironment(environment, threadId, runId, user, tracing);
2588
2618
  const streamOptions = this.buildOrchestratorAgentStreamOptions(user, threadId, runId, signal);
2589
2619
  streamReached = true;
2620
+ if (instanceContext) {
2621
+ try {
2622
+ await (0, instance_ai_1.patchThread)(memory, {
2623
+ threadId,
2624
+ update: ({ metadata }) => ({
2625
+ metadata: { ...metadata, [instance_context_service_1.INSTANCE_CONTEXT_CURSOR]: instanceContext.cursor },
2626
+ }),
2627
+ });
2628
+ }
2629
+ catch (error) {
2630
+ this.logger.warn('Failed to store the instance-context cursor', { error });
2631
+ }
2632
+ }
2590
2633
  const result = tracing
2591
2634
  ? await tracing.withActiveSpan(tracing.actorRun, async () => {
2592
2635
  return await (0, instance_ai_1.streamAgentRun)(agent, streamInput, streamOptions, {
@@ -2639,7 +2682,7 @@ let InstanceAiService = class InstanceAiService {
2639
2682
  plannedBuild,
2640
2683
  runHandoff: runControl.state,
2641
2684
  });
2642
- void this.suspendedThreads.persistPendingConfirmation({
2685
+ await this.suspendedThreads.persistPendingConfirmation({
2643
2686
  requestId: result.suspension.requestId,
2644
2687
  threadId,
2645
2688
  userId: user.id,
@@ -2675,6 +2718,8 @@ let InstanceAiService = class InstanceAiService {
2675
2718
  });
2676
2719
  return;
2677
2720
  }
2721
+ if (signal.aborted && !this.shouldPreserveHitlOnShutdown(runId))
2722
+ return;
2678
2723
  if (result.confirmationEvent) {
2679
2724
  this.trackConfirmationRequest(user.id, threadId, result.confirmationEvent);
2680
2725
  this.eventBus.publish(threadId, result.confirmationEvent);
@@ -2912,9 +2957,6 @@ let InstanceAiService = class InstanceAiService {
2912
2957
  else if (reschedule) {
2913
2958
  await this.schedulePlannedTasks(user, threadId);
2914
2959
  }
2915
- if (reschedule) {
2916
- await this.drainPendingCheckpointReentries(user, threadId);
2917
- }
2918
2960
  await this.taskProjector.syncFromWorkflowLoop(threadId, runId);
2919
2961
  if (reschedule) {
2920
2962
  await this.maybeStartWorkflowSetupFollowUp(user, threadId);
@@ -2925,74 +2967,6 @@ let InstanceAiService = class InstanceAiService {
2925
2967
  }
2926
2968
  }
2927
2969
  }
2928
- queuePendingCheckpointReentry(threadId, checkpointTaskId) {
2929
- let set = this.pendingCheckpointReentries.get(threadId);
2930
- if (!set) {
2931
- set = new Set();
2932
- this.pendingCheckpointReentries.set(threadId, set);
2933
- }
2934
- set.add(checkpointTaskId);
2935
- }
2936
- async drainPendingCheckpointReentries(user, threadId) {
2937
- const set = this.pendingCheckpointReentries.get(threadId);
2938
- if (!set || set.size === 0)
2939
- return;
2940
- const snapshot = [...set];
2941
- for (const checkpointTaskId of snapshot) {
2942
- if (this.runState.getActiveRunId(threadId) || this.runState.hasSuspendedRun(threadId)) {
2943
- return;
2944
- }
2945
- const siblings = this.backgroundTasks.getRunningTasksByParentCheckpoint(threadId, checkpointTaskId);
2946
- if (siblings.length > 0)
2947
- continue;
2948
- set.delete(checkpointTaskId);
2949
- await this.reenterCheckpointById(user, threadId, checkpointTaskId);
2950
- }
2951
- if (set.size === 0)
2952
- this.pendingCheckpointReentries.delete(threadId);
2953
- }
2954
- async reenterCheckpointById(user, threadId, checkpointTaskId, messageGroupId) {
2955
- try {
2956
- const { plannedTaskService } = await this.createPlannedTaskState();
2957
- const graph = await plannedTaskService.getGraph(threadId);
2958
- const checkpoint = graph?.tasks.find((t) => t.id === checkpointTaskId);
2959
- if (!graph || !checkpoint || checkpoint.kind !== 'checkpoint')
2960
- return false;
2961
- if (checkpoint.status !== 'running')
2962
- return false;
2963
- const startedRunId = await this.startInternalFollowUpRun(user, threadId, this.buildPlannedTaskFollowUpMessage('checkpoint', graph, { checkpoint }), messageGroupId, false, { isCheckpointFollowUp: true, checkpointTaskId });
2964
- if (!startedRunId)
2965
- return false;
2966
- this.logger.debug('Re-entered checkpoint follow-up', {
2967
- threadId,
2968
- checkpointTaskId,
2969
- messageGroupId,
2970
- });
2971
- return true;
2972
- }
2973
- catch (error) {
2974
- this.logger.error('Failed to re-enter checkpoint follow-up', {
2975
- threadId,
2976
- checkpointTaskId,
2977
- error: error instanceof Error ? error.message : String(error),
2978
- });
2979
- return false;
2980
- }
2981
- }
2982
- async maybeReenterParentCheckpoint(user, threadId, task) {
2983
- const parentCheckpointId = task.parentCheckpointId;
2984
- if (!parentCheckpointId)
2985
- return false;
2986
- const siblings = this.backgroundTasks
2987
- .getRunningTasksByParentCheckpoint(threadId, parentCheckpointId)
2988
- .filter((t) => t.taskId !== task.taskId);
2989
- if (siblings.length > 0)
2990
- return false;
2991
- if (this.runState.getActiveRunId(threadId) || this.runState.hasSuspendedRun(threadId)) {
2992
- return false;
2993
- }
2994
- return await this.reenterCheckpointById(user, threadId, parentCheckpointId, task.messageGroupId);
2995
- }
2996
2970
  async finalizeCheckpointFollowUp(user, threadId, checkpointTaskId, { reschedule = true } = {}) {
2997
2971
  try {
2998
2972
  const { plannedTaskService } = await this.createPlannedTaskState();
@@ -3080,7 +3054,7 @@ let InstanceAiService = class InstanceAiService {
3080
3054
  if (suspended?.user.id === requestingUserId) {
3081
3055
  this.cancelRun(suspended.threadId);
3082
3056
  }
3083
- this.logger.warn('Rejecting confirmation: user no longer authorized for AI Assistant', {
3057
+ this.logger.warn('Rejecting confirmation: user no longer authorized for n8n Assistant', {
3084
3058
  userId: requestingUserId,
3085
3059
  requestId,
3086
3060
  });
@@ -3252,14 +3226,14 @@ let InstanceAiService = class InstanceAiService {
3252
3226
  return null;
3253
3227
  }
3254
3228
  }
3255
- async resolveProjectContextSection(context) {
3229
+ async resolveBoundProject(context) {
3256
3230
  const projectId = context.projectId;
3257
3231
  if (!projectId)
3258
3232
  return undefined;
3259
3233
  try {
3260
3234
  const project = await context.workspaceService?.getProject?.(projectId);
3261
3235
  if (project)
3262
- return (0, internal_messages_1.getProjectContextSection)({ name: project.name, type: project.type });
3236
+ return project;
3263
3237
  this.logger.warn('Instance AI could not name the bound project for this turn', {
3264
3238
  projectId,
3265
3239
  reason: context.workspaceService?.getProject ? 'not-readable' : 'no-workspace-adapter',
@@ -3280,6 +3254,9 @@ let InstanceAiService = class InstanceAiService {
3280
3254
  return undefined;
3281
3255
  }
3282
3256
  }
3257
+ async resolveAiPreferencesBlock(userId, project) {
3258
+ return await this.bestEffort('Instance AI failed to read the AI preferences for this turn', { userId }, async () => (0, ai_preference_service_1.renderAiPreferencesBlock)(await this.aiPreferenceService.getApplicable(userId, project ? [project] : [])));
3259
+ }
3283
3260
  async canAccessAgentPreviewHandoff(user, projectId) {
3284
3261
  const requiredScopes = ['agent:read', 'agent:update'];
3285
3262
  return await (0, check_access_1.userHasScopes)(user, requiredScopes, false, { projectId });
@@ -3332,7 +3309,7 @@ let InstanceAiService = class InstanceAiService {
3332
3309
  }
3333
3310
  const activeUser = await this.revalidateActiveUser(user.id);
3334
3311
  if (!activeUser) {
3335
- this.logger.warn('Cancelling suspended run: user no longer authorized for AI Assistant', {
3312
+ this.logger.warn('Cancelling suspended run: user no longer authorized for n8n Assistant', {
3336
3313
  userId: user.id,
3337
3314
  threadId,
3338
3315
  requestId,
@@ -3542,7 +3519,7 @@ let InstanceAiService = class InstanceAiService {
3542
3519
  plannedBuild: opts.plannedBuild,
3543
3520
  runHandoff: runControl.state,
3544
3521
  });
3545
- void this.suspendedThreads.persistPendingConfirmation({
3522
+ await this.suspendedThreads.persistPendingConfirmation({
3546
3523
  requestId: result.suspension.requestId,
3547
3524
  threadId: opts.threadId,
3548
3525
  userId: opts.user.id,
@@ -3576,6 +3553,8 @@ let InstanceAiService = class InstanceAiService {
3576
3553
  });
3577
3554
  return;
3578
3555
  }
3556
+ if (opts.signal.aborted && !this.shouldPreserveHitlOnShutdown(opts.runId))
3557
+ return;
3579
3558
  if (result.confirmationEvent) {
3580
3559
  this.trackConfirmationRequest(opts.user.id, opts.threadId, result.confirmationEvent);
3581
3560
  this.eventBus.publish(opts.threadId, result.confirmationEvent);
@@ -3825,9 +3804,6 @@ let InstanceAiService = class InstanceAiService {
3825
3804
  else if (reschedule) {
3826
3805
  await this.schedulePlannedTasks(opts.user, opts.threadId);
3827
3806
  }
3828
- if (reschedule) {
3829
- await this.drainPendingCheckpointReentries(opts.user, opts.threadId);
3830
- }
3831
3807
  if (completedSetupWorkflowId) {
3832
3808
  await this.markWorkflowSetupHandled(opts.threadId, completedSetupWorkflowId, opts.runId);
3833
3809
  }
@@ -3929,190 +3905,6 @@ let InstanceAiService = class InstanceAiService {
3929
3905
  return undefined;
3930
3906
  }
3931
3907
  }
3932
- spawnBackgroundTask(runId, opts, messageGroupIdOverride) {
3933
- const outcome = this.backgroundTasks.spawn({
3934
- taskId: opts.taskId,
3935
- threadId: opts.threadId,
3936
- runId,
3937
- role: opts.role,
3938
- agentId: opts.agentId,
3939
- messageGroupId: messageGroupIdOverride ?? this.runState.getMessageGroupId(opts.threadId),
3940
- plannedTaskId: opts.plannedTaskId,
3941
- workItemId: opts.workItemId,
3942
- traceContext: opts.traceContext,
3943
- createTraceContext: opts.createTraceContext,
3944
- dedupeKey: opts.dedupeKey,
3945
- parentCheckpointId: opts.parentCheckpointId,
3946
- run: opts.run,
3947
- onLimitReached: async (errorMessage) => {
3948
- await this.tracing.finalizeDetachedTraceRun(opts.taskId, opts.traceContext, {
3949
- status: 'failed',
3950
- outputs: {
3951
- taskId: opts.taskId,
3952
- agentId: opts.agentId,
3953
- role: opts.role,
3954
- },
3955
- error: errorMessage,
3956
- metadata: {
3957
- ...(opts.plannedTaskId ? { planned_task_id: opts.plannedTaskId } : {}),
3958
- ...(opts.workItemId ? { work_item_id: opts.workItemId } : {}),
3959
- },
3960
- });
3961
- this.eventBus.publish(opts.threadId, {
3962
- type: 'agent-completed',
3963
- runId,
3964
- agentId: opts.agentId,
3965
- payload: {
3966
- role: opts.role,
3967
- result: '',
3968
- error: errorMessage,
3969
- },
3970
- });
3971
- },
3972
- onCompleted: async (task) => {
3973
- await this.tracing.finalizeBackgroundTaskTracing(task, 'completed');
3974
- this.eventBus.publish(opts.threadId, {
3975
- type: 'agent-completed',
3976
- runId,
3977
- agentId: opts.agentId,
3978
- payload: { role: opts.role, result: task.result ?? '' },
3979
- });
3980
- const user = this.runState.getThreadUser(opts.threadId);
3981
- if (user) {
3982
- await this.handlePlannedTaskSettlement(user, task, 'succeeded');
3983
- }
3984
- },
3985
- onFailed: async (task) => {
3986
- await this.tracing.finalizeBackgroundTaskTracing(task, 'failed');
3987
- this.instanceAiErrorReporter.report(new Error(task.error ?? 'Instance AI background task failed'), {
3988
- component: 'instance-ai-background-task',
3989
- threadId: opts.threadId,
3990
- runId,
3991
- tracing: task.traceContext,
3992
- agentId: opts.agentId,
3993
- messageGroupId: task.messageGroupId,
3994
- taskId: task.taskId,
3995
- role: task.role,
3996
- });
3997
- this.eventBus.publish(opts.threadId, {
3998
- type: 'agent-completed',
3999
- runId,
4000
- agentId: opts.agentId,
4001
- payload: { role: opts.role, result: '', error: task.error ?? 'Unknown error' },
4002
- });
4003
- const user = this.runState.getThreadUser(opts.threadId);
4004
- if (user) {
4005
- await this.handlePlannedTaskSettlement(user, task, 'failed');
4006
- }
4007
- },
4008
- onSettled: async (task) => {
4009
- await this.terminalOutcome.recordBackgroundTerminalOutcome(task);
4010
- if (task.plannedTaskId)
4011
- return;
4012
- await this.taskProjector.syncFromBackgroundTask(task);
4013
- const parentCheckpointId = task.parentCheckpointId;
4014
- if (parentCheckpointId) {
4015
- const user = this.runState.getThreadUser(opts.threadId);
4016
- if (!user) {
4017
- this.queuePendingCheckpointReentry(opts.threadId, parentCheckpointId);
4018
- return;
4019
- }
4020
- const reentered = await this.maybeReenterParentCheckpoint(user, opts.threadId, task);
4021
- if (!reentered) {
4022
- this.queuePendingCheckpointReentry(opts.threadId, parentCheckpointId);
4023
- }
4024
- return;
4025
- }
4026
- const remaining = this.backgroundTasks.getRunningTasks(opts.threadId);
4027
- const hasActiveRun = !!this.runState.getActiveRunId(opts.threadId);
4028
- const hasSuspendedRun = this.runState.hasSuspendedRun(opts.threadId);
4029
- if (remaining.length === 0 && !hasActiveRun && !hasSuspendedRun) {
4030
- if (this.liveness.hasTimedOutActiveRunThread(opts.threadId)) {
4031
- this.logger.debug('Skipping background auto-follow-up after active run timeout', {
4032
- threadId: opts.threadId,
4033
- taskId: task.taskId,
4034
- });
4035
- return;
4036
- }
4037
- if (task.timeoutReason) {
4038
- this.logger.debug('Skipping background auto-follow-up after task timeout', {
4039
- threadId: opts.threadId,
4040
- taskId: task.taskId,
4041
- timeoutReason: task.timeoutReason,
4042
- });
4043
- return;
4044
- }
4045
- const user = this.runState.getThreadUser(opts.threadId);
4046
- if (user) {
4047
- const verificationFollowUpStarted = await this.maybeStartWorkflowVerificationFollowUp(user, task);
4048
- if (verificationFollowUpStarted)
4049
- return;
4050
- const setupFollowUpStarted = await this.maybeStartWorkflowSetupFollowUp(user, task.threadId);
4051
- if (setupFollowUpStarted)
4052
- return;
4053
- const payload = JSON.stringify({
4054
- role: opts.role,
4055
- status: task.result ? 'completed' : task.error ? 'failed' : 'finished',
4056
- result: task.result ?? undefined,
4057
- outcome: task.outcome ?? undefined,
4058
- error: task.error ?? undefined,
4059
- }, null, 2);
4060
- await this.startInternalFollowUpRun(user, opts.threadId, `<background-task-completed>\n${payload}\n</background-task-completed>\n\n${internal_messages_1.AUTO_FOLLOW_UP_MESSAGE}`, task.messageGroupId);
4061
- }
4062
- }
4063
- },
4064
- });
4065
- if (outcome.status === 'started') {
4066
- void this.taskProjector.syncFromBackgroundTask(outcome.task);
4067
- return { status: 'started', taskId: outcome.task.taskId, agentId: outcome.task.agentId };
4068
- }
4069
- if (outcome.status === 'duplicate') {
4070
- this.logger.warn('Background task dispatch deduped — task already in flight', {
4071
- threadId: opts.threadId,
4072
- requestedTaskId: opts.taskId,
4073
- existingTaskId: outcome.existing.taskId,
4074
- plannedTaskId: opts.dedupeKey?.plannedTaskId,
4075
- workflowId: opts.dedupeKey?.workflowId,
4076
- role: opts.role,
4077
- });
4078
- void this.tracing.finalizeDetachedTraceRun(opts.taskId, opts.traceContext, {
4079
- status: 'cancelled',
4080
- outputs: {
4081
- taskId: opts.taskId,
4082
- agentId: opts.agentId,
4083
- role: opts.role,
4084
- deduped_to: outcome.existing.taskId,
4085
- },
4086
- metadata: {
4087
- deduped: true,
4088
- existing_task_id: outcome.existing.taskId,
4089
- ...(opts.plannedTaskId ? { planned_task_id: opts.plannedTaskId } : {}),
4090
- ...(opts.workItemId ? { work_item_id: opts.workItemId } : {}),
4091
- },
4092
- });
4093
- this.eventBus.publish(opts.threadId, {
4094
- type: 'agent-completed',
4095
- runId,
4096
- agentId: opts.agentId,
4097
- payload: {
4098
- role: opts.role,
4099
- result: '',
4100
- error: `Deduped: task already in flight as ${outcome.existing.taskId}`,
4101
- },
4102
- });
4103
- return {
4104
- status: 'duplicate',
4105
- existing: {
4106
- taskId: outcome.existing.taskId,
4107
- agentId: outcome.existing.agentId,
4108
- role: outcome.existing.role,
4109
- plannedTaskId: outcome.existing.plannedTaskId,
4110
- workItemId: outcome.existing.workItemId,
4111
- },
4112
- };
4113
- }
4114
- return { status: 'limit-reached' };
4115
- }
4116
3908
  async snapshotAttachedAgents(attachments, orchestrationContext, tracing) {
4117
3909
  const delegate = orchestrationContext.domainContext?.builderDelegate;
4118
3910
  if (!delegate || !tracing)
@@ -4522,20 +4314,8 @@ __decorate([
4522
4314
  __metadata("design:paramtypes", [Object]),
4523
4315
  __metadata("design:returntype", Promise)
4524
4316
  ], InstanceAiService.prototype, "handleRelayTaskControl", null);
4525
- __decorate([
4526
- (0, decorators_1.OnLeaderTakeover)(),
4527
- __metadata("design:type", Function),
4528
- __metadata("design:paramtypes", []),
4529
- __metadata("design:returntype", void 0)
4530
- ], InstanceAiService.prototype, "startCheckpointPruning", null);
4531
- __decorate([
4532
- (0, decorators_1.OnLeaderStepdown)(),
4533
- __metadata("design:type", Function),
4534
- __metadata("design:paramtypes", []),
4535
- __metadata("design:returntype", void 0)
4536
- ], InstanceAiService.prototype, "stopCheckpointPruning", null);
4537
4317
  exports.InstanceAiService = InstanceAiService = __decorate([
4538
4318
  (0, di_1.Service)(),
4539
- __metadata("design:paramtypes", [backend_common_1.Logger, config_1.GlobalConfig, n8n_core_1.InstanceSettings, instance_ai_adapter_service_1.InstanceAiAdapterService, in_process_event_bus_1.InProcessEventBus, durable_event_log_1.DurableEventLog, interrupted_run_sweeper_1.InterruptedRunSweeper, instance_ai_settings_service_1.InstanceAiSettingsService, instance_ai_gateway_service_1.InstanceAiGatewayService, instance_ai_browser_session_service_1.InstanceAiBrowserSessionService, instance_ai_memory_service_1.InstanceAiMemoryService, typeorm_agent_memory_1.TypeORMAgentMemory, typeorm_agent_checkpoint_store_1.TypeORMAgentCheckpointStore, ai_service_1.AiService, instance_ai_thread_grant_repository_1.InstanceAiThreadGrantRepository, instance_ai_pending_confirmation_repository_1.InstanceAiPendingConfirmationRepository, url_service_1.UrlService, instance_ai_event_log_repository_1.InstanceAiEventLogRepository, db_iteration_log_storage_1.DbIterationLogStorage, instance_write_access_service_1.InstanceWriteAccessService, telemetry_2.Telemetry, mcp_1.InstanceAiMcpRegistryService, db_1.UserRepository, instance_ai_temporary_workflow_service_1.InstanceAiTemporaryWorkflowService, n8n_core_1.ErrorReporter, config_1.SsrfProtectionConfig, backend_network_1.SsrfProtectionService, event_service_1.EventService, thread_credential_allowlist_service_1.EvalThreadCredentialAllowlistService, instance_ai_run_probe_1.InstanceAiRunProbe, instance_ai_model_service_1.InstanceAiModelService, instance_ai_credit_service_1.InstanceAiCreditService, publisher_service_1.Publisher, instance_ai_error_reporter_service_1.InstanceAiErrorReporterService, canvas_node_context_flag_gate_1.CanvasNodeContextFlagGate, push_1.Push, instance_ai_conversation_history_service_1.InstanceAiConversationHistoryService])
4319
+ __metadata("design:paramtypes", [backend_common_1.Logger, config_1.GlobalConfig, n8n_core_1.InstanceSettings, instance_ai_adapter_service_1.InstanceAiAdapterService, in_process_event_bus_1.InProcessEventBus, durable_event_log_1.DurableEventLog, interrupted_run_sweeper_1.InterruptedRunSweeper, instance_ai_settings_service_1.InstanceAiSettingsService, instance_ai_gateway_service_1.InstanceAiGatewayService, instance_ai_browser_session_service_1.InstanceAiBrowserSessionService, instance_ai_memory_service_1.InstanceAiMemoryService, typeorm_agent_memory_1.TypeORMAgentMemory, typeorm_agent_checkpoint_store_1.TypeORMAgentCheckpointStore, ai_service_1.AiService, instance_ai_thread_grant_repository_1.InstanceAiThreadGrantRepository, instance_ai_pending_confirmation_repository_1.InstanceAiPendingConfirmationRepository, url_service_1.UrlService, instance_ai_event_log_repository_1.InstanceAiEventLogRepository, db_iteration_log_storage_1.DbIterationLogStorage, instance_write_access_service_1.InstanceWriteAccessService, telemetry_2.Telemetry, mcp_1.InstanceAiMcpRegistryService, db_1.UserRepository, instance_ai_temporary_workflow_service_1.InstanceAiTemporaryWorkflowService, n8n_core_1.ErrorReporter, config_1.SsrfProtectionConfig, backend_network_1.SsrfProtectionService, event_service_1.EventService, thread_credential_allowlist_service_1.EvalThreadCredentialAllowlistService, instance_ai_run_probe_1.InstanceAiRunProbe, instance_ai_model_service_1.InstanceAiModelService, instance_ai_credit_service_1.InstanceAiCreditService, publisher_service_1.Publisher, instance_ai_error_reporter_service_1.InstanceAiErrorReporterService, canvas_node_context_flag_gate_1.CanvasNodeContextFlagGate, push_1.Push, instance_ai_conversation_history_service_1.InstanceAiConversationHistoryService, instance_context_service_1.InstanceContextService, ai_preference_service_1.AiPreferenceService])
4540
4320
  ], InstanceAiService);
4541
4321
  //# sourceMappingURL=instance-ai.service.js.map