n8n 2.41.3 → 2.42.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 (1376) hide show
  1. package/bin/n8n +4 -0
  2. package/dist/active-workflow-manager.js +6 -7
  3. package/dist/active-workflow-manager.js.map +1 -1
  4. package/dist/auth/auth.service.d.ts +1 -1
  5. package/dist/auth/auth.service.js +17 -2
  6. package/dist/auth/auth.service.js.map +1 -1
  7. package/dist/build.tsbuildinfo +1 -1
  8. package/dist/collaboration/collaboration.message.d.ts +123 -1
  9. package/dist/collaboration/collaboration.message.js +37 -1
  10. package/dist/collaboration/collaboration.message.js.map +1 -1
  11. package/dist/collaboration/collaboration.service.d.ts +22 -1
  12. package/dist/collaboration/collaboration.service.js +185 -16
  13. package/dist/collaboration/collaboration.service.js.map +1 -1
  14. package/dist/collaboration/collaboration.state.d.ts +24 -4
  15. package/dist/collaboration/collaboration.state.js +160 -16
  16. package/dist/collaboration/collaboration.state.js.map +1 -1
  17. package/dist/commands/base-command.d.ts +3 -0
  18. package/dist/commands/base-command.js +35 -22
  19. package/dist/commands/base-command.js.map +1 -1
  20. package/dist/commands/engine.d.ts +12 -0
  21. package/dist/commands/engine.js +83 -0
  22. package/dist/commands/engine.js.map +1 -0
  23. package/dist/commands/export/credentials.js +2 -0
  24. package/dist/commands/export/credentials.js.map +1 -1
  25. package/dist/commands/import/credentials.d.ts +2 -0
  26. package/dist/commands/import/credentials.js +66 -12
  27. package/dist/commands/import/credentials.js.map +1 -1
  28. package/dist/commands/start.js +3 -8
  29. package/dist/commands/start.js.map +1 -1
  30. package/dist/commands/webhook.js +1 -0
  31. package/dist/commands/webhook.js.map +1 -1
  32. package/dist/commands/worker.js +1 -0
  33. package/dist/commands/worker.js.map +1 -1
  34. package/dist/constants/credential-sharing.d.ts +1 -0
  35. package/dist/constants/credential-sharing.js +8 -0
  36. package/dist/constants/credential-sharing.js.map +1 -0
  37. package/dist/controllers/ai.controller.d.ts +1 -0
  38. package/dist/controllers/auth.controller.js +1 -1
  39. package/dist/controllers/auth.controller.js.map +1 -1
  40. package/dist/controllers/e2e.controller.js +2 -1
  41. package/dist/controllers/e2e.controller.js.map +1 -1
  42. package/dist/controllers/project.controller.js +12 -2
  43. package/dist/controllers/project.controller.js.map +1 -1
  44. package/dist/controllers/users.controller.d.ts +1 -1
  45. package/dist/controllers/users.controller.js +2 -2
  46. package/dist/controllers/users.controller.js.map +1 -1
  47. package/dist/credential-types.d.ts +1 -0
  48. package/dist/credential-types.js +3 -0
  49. package/dist/credential-types.js.map +1 -1
  50. package/dist/credentials/credential-descriptions.service.d.ts +9 -0
  51. package/dist/credentials/credential-descriptions.service.js +35 -0
  52. package/dist/credentials/credential-descriptions.service.js.map +1 -0
  53. package/dist/credentials/credentials-finder.service.d.ts +23 -3
  54. package/dist/credentials/credentials-finder.service.js +76 -31
  55. package/dist/credentials/credentials-finder.service.js.map +1 -1
  56. package/dist/credentials/credentials.controller.d.ts +10 -2
  57. package/dist/credentials/credentials.controller.js +30 -7
  58. package/dist/credentials/credentials.controller.js.map +1 -1
  59. package/dist/credentials/credentials.service.d.ts +12 -3
  60. package/dist/credentials/credentials.service.ee.d.ts +2 -0
  61. package/dist/credentials/credentials.service.ee.js +1 -1
  62. package/dist/credentials/credentials.service.ee.js.map +1 -1
  63. package/dist/credentials/credentials.service.js +84 -20
  64. package/dist/credentials/credentials.service.js.map +1 -1
  65. package/dist/credentials/pending-authorization-cleanup.task.d.ts +14 -0
  66. package/dist/credentials/pending-authorization-cleanup.task.js +42 -0
  67. package/dist/credentials/pending-authorization-cleanup.task.js.map +1 -0
  68. package/dist/credentials-helper.js +8 -4
  69. package/dist/credentials-helper.js.map +1 -1
  70. package/dist/encryption/key-manager.service.js +10 -36
  71. package/dist/encryption/key-manager.service.js.map +1 -1
  72. package/dist/errors/response-errors/ai-preference-scope-full.error.d.ts +12 -0
  73. package/dist/errors/response-errors/ai-preference-scope-full.error.js +13 -0
  74. package/dist/errors/response-errors/ai-preference-scope-full.error.js.map +1 -0
  75. package/dist/eventbus/message-event-bus/event-bus-unsent-message-flush.task.d.ts +14 -0
  76. package/dist/eventbus/message-event-bus/event-bus-unsent-message-flush.task.js +37 -0
  77. package/dist/eventbus/message-event-bus/event-bus-unsent-message-flush.task.js.map +1 -0
  78. package/dist/eventbus/message-event-bus/message-event-bus.d.ts +1 -2
  79. package/dist/eventbus/message-event-bus/message-event-bus.js +1 -9
  80. package/dist/eventbus/message-event-bus/message-event-bus.js.map +1 -1
  81. package/dist/events/maps/relay.event-map.d.ts +28 -3
  82. package/dist/events/maps/system-task-metrics.event-map.d.ts +1 -1
  83. package/dist/events/relays/activity.event-relay.js +2 -2
  84. package/dist/events/relays/activity.event-relay.js.map +1 -1
  85. package/dist/events/relays/telemetry.event-relay.d.ts +5 -1
  86. package/dist/events/relays/telemetry.event-relay.js +51 -17
  87. package/dist/events/relays/telemetry.event-relay.js.map +1 -1
  88. package/dist/execution-lifecycle/execute-error-workflow.js +2 -2
  89. package/dist/execution-lifecycle/execute-error-workflow.js.map +1 -1
  90. package/dist/executions/engine-v2-execution-reader.service.js +3 -3
  91. package/dist/executions/engine-v2-execution-reader.service.js.map +1 -1
  92. package/dist/executions/engine-v2-mapping.d.ts +3 -3
  93. package/dist/executions/engine-v2-mapping.js +11 -6
  94. package/dist/executions/engine-v2-mapping.js.map +1 -1
  95. package/dist/executions/enqueued-execution-recovery.service.d.ts +3 -1
  96. package/dist/executions/enqueued-execution-recovery.service.js +7 -4
  97. package/dist/executions/enqueued-execution-recovery.service.js.map +1 -1
  98. package/dist/executions/execution-crash.service.d.ts +9 -3
  99. package/dist/executions/execution-crash.service.js +33 -6
  100. package/dist/executions/execution-crash.service.js.map +1 -1
  101. package/dist/executions/execution-recovery.service.js +1 -1
  102. package/dist/executions/execution-recovery.service.js.map +1 -1
  103. package/dist/executions/executions.controller.js +1 -1
  104. package/dist/executions/executions.controller.js.map +1 -1
  105. package/dist/executions/pre-execution-checks/credentials-permission-checker.d.ts +25 -5
  106. package/dist/executions/pre-execution-checks/credentials-permission-checker.js +132 -38
  107. package/dist/executions/pre-execution-checks/credentials-permission-checker.js.map +1 -1
  108. package/dist/executions/pre-execution-checks/subworkflow-policy-checker.d.ts +1 -1
  109. package/dist/executions/pre-execution-checks/subworkflow-policy-checker.js +2 -2
  110. package/dist/executions/pre-execution-checks/subworkflow-policy-checker.js.map +1 -1
  111. package/dist/license/license-renewal.task.d.ts +2 -3
  112. package/dist/license/license-renewal.task.js +6 -7
  113. package/dist/license/license-renewal.task.js.map +1 -1
  114. package/dist/license/license.controller.d.ts +1 -1
  115. package/dist/license/license.controller.js +2 -2
  116. package/dist/license/license.controller.js.map +1 -1
  117. package/dist/license/license.service.d.ts +1 -1
  118. package/dist/license/license.service.js +2 -2
  119. package/dist/license/license.service.js.map +1 -1
  120. package/dist/metrics/prometheus/system-task-metrics.service.d.ts +1 -3
  121. package/dist/metrics/prometheus/system-task-metrics.service.js +20 -22
  122. package/dist/metrics/prometheus/system-task-metrics.service.js.map +1 -1
  123. package/dist/middlewares/list-query/dtos/workflow.filter.dto.d.ts +1 -0
  124. package/dist/middlewares/list-query/dtos/workflow.filter.dto.js +9 -0
  125. package/dist/middlewares/list-query/dtos/workflow.filter.dto.js.map +1 -1
  126. package/dist/modules/agents/adapters/agents-credential-provider.d.ts +4 -2
  127. package/dist/modules/agents/adapters/agents-credential-provider.js +11 -10
  128. package/dist/modules/agents/adapters/agents-credential-provider.js.map +1 -1
  129. package/dist/modules/agents/agent-change-publisher.service.d.ts +15 -0
  130. package/dist/modules/agents/agent-change-publisher.service.js +47 -0
  131. package/dist/modules/agents/agent-change-publisher.service.js.map +1 -0
  132. package/dist/modules/agents/agent-chat-attachment.service.d.ts +5 -7
  133. package/dist/modules/agents/agent-chat-attachment.service.js +29 -9
  134. package/dist/modules/agents/agent-chat-attachment.service.js.map +1 -1
  135. package/dist/modules/agents/agent-chat-execution.service.d.ts +38 -0
  136. package/dist/modules/agents/agent-chat-execution.service.js +213 -0
  137. package/dist/modules/agents/agent-chat-execution.service.js.map +1 -0
  138. package/dist/modules/agents/agent-chat.controller.d.ts +62 -2
  139. package/dist/modules/agents/agent-chat.controller.js +458 -36
  140. package/dist/modules/agents/agent-chat.controller.js.map +1 -1
  141. package/dist/modules/agents/agent-checkpoint-pruning.task.d.ts +2 -3
  142. package/dist/modules/agents/agent-checkpoint-pruning.task.js +6 -6
  143. package/dist/modules/agents/agent-checkpoint-pruning.task.js.map +1 -1
  144. package/dist/modules/agents/agent-config.service.d.ts +17 -6
  145. package/dist/modules/agents/agent-config.service.js +140 -109
  146. package/dist/modules/agents/agent-config.service.js.map +1 -1
  147. package/dist/modules/agents/agent-context-readers.d.ts +28 -0
  148. package/dist/modules/agents/agent-context-readers.js +33 -0
  149. package/dist/modules/agents/agent-context-readers.js.map +1 -0
  150. package/dist/modules/agents/agent-conversation-state.service.d.ts +1 -0
  151. package/dist/modules/agents/agent-conversation-state.service.js +4 -0
  152. package/dist/modules/agents/agent-conversation-state.service.js.map +1 -1
  153. package/dist/modules/agents/agent-custom-tools.service.d.ts +2 -0
  154. package/dist/modules/agents/agent-custom-tools.service.js +18 -40
  155. package/dist/modules/agents/agent-custom-tools.service.js.map +1 -1
  156. package/dist/modules/agents/agent-default-model-resolver.service.d.ts +3 -6
  157. package/dist/modules/agents/agent-default-model-resolver.service.js.map +1 -1
  158. package/dist/modules/agents/agent-execution-orchestrator.service.d.ts +60 -42
  159. package/dist/modules/agents/agent-execution-orchestrator.service.js +514 -301
  160. package/dist/modules/agents/agent-execution-orchestrator.service.js.map +1 -1
  161. package/dist/modules/agents/agent-execution-update-broadcaster.d.ts +7 -3
  162. package/dist/modules/agents/agent-execution-update-broadcaster.js +44 -6
  163. package/dist/modules/agents/agent-execution-update-broadcaster.js.map +1 -1
  164. package/dist/modules/agents/agent-execution.service.d.ts +66 -19
  165. package/dist/modules/agents/agent-execution.service.js +404 -171
  166. package/dist/modules/agents/agent-execution.service.js.map +1 -1
  167. package/dist/modules/agents/agent-integration-management.service.d.ts +6 -2
  168. package/dist/modules/agents/agent-integration-management.service.js +61 -59
  169. package/dist/modules/agents/agent-integration-management.service.js.map +1 -1
  170. package/dist/modules/agents/agent-integration-persistence.service.d.ts +4 -8
  171. package/dist/modules/agents/agent-integration-persistence.service.js +45 -30
  172. package/dist/modules/agents/agent-integration-persistence.service.js.map +1 -1
  173. package/dist/modules/agents/agent-integrations.controller.d.ts +3 -1
  174. package/dist/modules/agents/agent-integrations.controller.js +17 -3
  175. package/dist/modules/agents/agent-integrations.controller.js.map +1 -1
  176. package/dist/modules/agents/agent-interrupted-execution-sweeper.js +1 -1
  177. package/dist/modules/agents/agent-interrupted-execution-sweeper.js.map +1 -1
  178. package/dist/modules/agents/agent-knowledge-commands.js.map +1 -1
  179. package/dist/modules/agents/agent-knowledge-mirror.service.d.ts +4 -0
  180. package/dist/modules/agents/agent-knowledge-mirror.service.js +79 -79
  181. package/dist/modules/agents/agent-knowledge-mirror.service.js.map +1 -1
  182. package/dist/modules/agents/agent-knowledge-retrieval.d.ts +6 -16
  183. package/dist/modules/agents/agent-knowledge-retrieval.js.map +1 -1
  184. package/dist/modules/agents/agent-knowledge.service.d.ts +0 -1
  185. package/dist/modules/agents/agent-knowledge.service.js +5 -12
  186. package/dist/modules/agents/agent-knowledge.service.js.map +1 -1
  187. package/dist/modules/agents/agent-mcp-access.controller.js +1 -1
  188. package/dist/modules/agents/agent-mcp-access.controller.js.map +1 -1
  189. package/dist/modules/agents/agent-mcp-access.service.d.ts +6 -8
  190. package/dist/modules/agents/agent-mcp-access.service.js +8 -3
  191. package/dist/modules/agents/agent-mcp-access.service.js.map +1 -1
  192. package/dist/modules/agents/agent-message-queue-consumer.service.d.ts +36 -0
  193. package/dist/modules/agents/agent-message-queue-consumer.service.js +238 -0
  194. package/dist/modules/agents/agent-message-queue-consumer.service.js.map +1 -0
  195. package/dist/modules/agents/agent-message-queue.service.d.ts +68 -0
  196. package/dist/modules/agents/agent-message-queue.service.js +221 -0
  197. package/dist/modules/agents/agent-message-queue.service.js.map +1 -0
  198. package/dist/modules/agents/agent-model-catalog.service.d.ts +5 -0
  199. package/dist/modules/agents/agent-model-catalog.service.js +48 -56
  200. package/dist/modules/agents/agent-model-catalog.service.js.map +1 -1
  201. package/dist/modules/agents/agent-modification-telemetry.service.d.ts +365 -9
  202. package/dist/modules/agents/agent-modification-telemetry.service.js +56 -36
  203. package/dist/modules/agents/agent-modification-telemetry.service.js.map +1 -1
  204. package/dist/modules/agents/agent-publish.controller.d.ts +3 -1
  205. package/dist/modules/agents/agent-publish.controller.js +12 -2
  206. package/dist/modules/agents/agent-publish.controller.js.map +1 -1
  207. package/dist/modules/agents/agent-publish.service.d.ts +6 -0
  208. package/dist/modules/agents/agent-publish.service.js +116 -131
  209. package/dist/modules/agents/agent-publish.service.js.map +1 -1
  210. package/dist/modules/agents/agent-push-recipients.service.d.ts +8 -0
  211. package/dist/modules/agents/agent-push-recipients.service.js +38 -0
  212. package/dist/modules/agents/agent-push-recipients.service.js.map +1 -0
  213. package/dist/modules/agents/agent-queued-preview-stream.service.d.ts +33 -0
  214. package/dist/modules/agents/agent-queued-preview-stream.service.js +158 -0
  215. package/dist/modules/agents/agent-queued-preview-stream.service.js.map +1 -0
  216. package/dist/modules/agents/agent-run-tracing.service.d.ts +2 -5
  217. package/dist/modules/agents/agent-run-tracing.service.js +8 -7
  218. package/dist/modules/agents/agent-run-tracing.service.js.map +1 -1
  219. package/dist/modules/agents/agent-runtime-cache.service.d.ts +8 -11
  220. package/dist/modules/agents/agent-runtime-cache.service.js +62 -67
  221. package/dist/modules/agents/agent-runtime-cache.service.js.map +1 -1
  222. package/dist/modules/agents/agent-runtime-instrumentation.d.ts +2 -1
  223. package/dist/modules/agents/agent-runtime-reconstruction.service.d.ts +28 -23
  224. package/dist/modules/agents/agent-runtime-reconstruction.service.js +266 -241
  225. package/dist/modules/agents/agent-runtime-reconstruction.service.js.map +1 -1
  226. package/dist/modules/agents/agent-sandbox-principal.js.map +1 -1
  227. package/dist/modules/agents/agent-sandbox-runtime.service.js +2 -5
  228. package/dist/modules/agents/agent-sandbox-runtime.service.js.map +1 -1
  229. package/dist/modules/agents/agent-session-langsmith-export.service.js +107 -89
  230. package/dist/modules/agents/agent-session-langsmith-export.service.js.map +1 -1
  231. package/dist/modules/agents/agent-skills.service.d.ts +1 -0
  232. package/dist/modules/agents/agent-skills.service.js +19 -58
  233. package/dist/modules/agents/agent-skills.service.js.map +1 -1
  234. package/dist/modules/agents/agent-sse-stream.js +28 -21
  235. package/dist/modules/agents/agent-sse-stream.js.map +1 -1
  236. package/dist/modules/agents/agent-task.service.d.ts +9 -3
  237. package/dist/modules/agents/agent-task.service.js +75 -104
  238. package/dist/modules/agents/agent-task.service.js.map +1 -1
  239. package/dist/modules/agents/agent-tasks.controller.d.ts +3 -2
  240. package/dist/modules/agents/agent-tasks.controller.js +16 -14
  241. package/dist/modules/agents/agent-tasks.controller.js.map +1 -1
  242. package/dist/modules/agents/agent-teams-integrations.controller.d.ts +26 -0
  243. package/dist/modules/agents/agent-teams-integrations.controller.js +106 -0
  244. package/dist/modules/agents/agent-teams-integrations.controller.js.map +1 -0
  245. package/dist/modules/agents/agent-telemetry.d.ts +21 -1
  246. package/dist/modules/agents/agent-telemetry.js +16 -0
  247. package/dist/modules/agents/agent-telemetry.js.map +1 -1
  248. package/dist/modules/agents/agent-test-chat.service.js +0 -2
  249. package/dist/modules/agents/agent-test-chat.service.js.map +1 -1
  250. package/dist/modules/agents/agent-test-run.service.d.ts +9 -1
  251. package/dist/modules/agents/agent-test-run.service.js +89 -78
  252. package/dist/modules/agents/agent-test-run.service.js.map +1 -1
  253. package/dist/modules/agents/agent-threads.controller.d.ts +29 -1
  254. package/dist/modules/agents/agent-threads.controller.js +10 -4
  255. package/dist/modules/agents/agent-threads.controller.js.map +1 -1
  256. package/dist/modules/agents/agent-turn-already-running.error.d.ts +4 -0
  257. package/dist/modules/agents/agent-turn-already-running.error.js +11 -0
  258. package/dist/modules/agents/agent-turn-already-running.error.js.map +1 -0
  259. package/dist/modules/agents/agent-turn-execution.service.d.ts +27 -5
  260. package/dist/modules/agents/agent-turn-execution.service.js +166 -47
  261. package/dist/modules/agents/agent-turn-execution.service.js.map +1 -1
  262. package/dist/modules/agents/agent-update-broadcaster.d.ts +3 -5
  263. package/dist/modules/agents/agent-update-broadcaster.js +5 -15
  264. package/dist/modules/agents/agent-update-broadcaster.js.map +1 -1
  265. package/dist/modules/agents/agent-validation.service.d.ts +5 -1
  266. package/dist/modules/agents/agent-validation.service.js +66 -47
  267. package/dist/modules/agents/agent-validation.service.js.map +1 -1
  268. package/dist/modules/agents/agent-vector-stores.service.d.ts +2 -0
  269. package/dist/modules/agents/agent-vector-stores.service.js +25 -18
  270. package/dist/modules/agents/agent-vector-stores.service.js.map +1 -1
  271. package/dist/modules/agents/agent-workflow-execution.service.d.ts +11 -0
  272. package/dist/modules/agents/agent-workflow-execution.service.js +204 -150
  273. package/dist/modules/agents/agent-workflow-execution.service.js.map +1 -1
  274. package/dist/modules/agents/agent-workflow-tool-resume.service.d.ts +8 -1
  275. package/dist/modules/agents/agent-workflow-tool-resume.service.js +97 -38
  276. package/dist/modules/agents/agent-workflow-tool-resume.service.js.map +1 -1
  277. package/dist/modules/agents/agents-config.controller.d.ts +48 -1
  278. package/dist/modules/agents/agents-config.controller.js +8 -2
  279. package/dist/modules/agents/agents-config.controller.js.map +1 -1
  280. package/dist/modules/agents/agents-skills.controller.d.ts +3 -1
  281. package/dist/modules/agents/agents-skills.controller.js +10 -2
  282. package/dist/modules/agents/agents-skills.controller.js.map +1 -1
  283. package/dist/modules/agents/agents-tools.service.js +6 -4
  284. package/dist/modules/agents/agents-tools.service.js.map +1 -1
  285. package/dist/modules/agents/agents.controller.d.ts +10 -1
  286. package/dist/modules/agents/agents.controller.js +15 -2
  287. package/dist/modules/agents/agents.controller.js.map +1 -1
  288. package/dist/modules/agents/agents.module.d.ts +1 -1
  289. package/dist/modules/agents/agents.module.js +9 -0
  290. package/dist/modules/agents/agents.module.js.map +1 -1
  291. package/dist/modules/agents/agents.service.d.ts +14 -14
  292. package/dist/modules/agents/agents.service.js +106 -77
  293. package/dist/modules/agents/agents.service.js.map +1 -1
  294. package/dist/modules/agents/background/agent-background-job.service.d.ts +2 -0
  295. package/dist/modules/agents/background/agent-background-job.service.js +65 -58
  296. package/dist/modules/agents/background/agent-background-job.service.js.map +1 -1
  297. package/dist/modules/agents/background/agent-wake.service.d.ts +2 -0
  298. package/dist/modules/agents/background/agent-wake.service.js +39 -29
  299. package/dist/modules/agents/background/agent-wake.service.js.map +1 -1
  300. package/dist/modules/agents/background/background-job-tools.d.ts +4 -9
  301. package/dist/modules/agents/background/background-job-tools.js.map +1 -1
  302. package/dist/modules/agents/background/sub-agent-background-runner.d.ts +2 -1
  303. package/dist/modules/agents/background/sub-agent-background-runner.js.map +1 -1
  304. package/dist/modules/agents/builder/agents-builder-prompts.d.ts +8 -7
  305. package/dist/modules/agents/builder/agents-builder-prompts.js +51 -33
  306. package/dist/modules/agents/builder/agents-builder-prompts.js.map +1 -1
  307. package/dist/modules/agents/builder/agents-builder-tools.service.d.ts +35 -4
  308. package/dist/modules/agents/builder/agents-builder-tools.service.js +592 -675
  309. package/dist/modules/agents/builder/agents-builder-tools.service.js.map +1 -1
  310. package/dist/modules/agents/builder/agents-builder.service.d.ts +5 -0
  311. package/dist/modules/agents/builder/agents-builder.service.js +67 -53
  312. package/dist/modules/agents/builder/agents-builder.service.js.map +1 -1
  313. package/dist/modules/agents/builder/builder-model-live-lookup.service.d.ts +3 -9
  314. package/dist/modules/agents/builder/builder-model-live-lookup.service.js +12 -11
  315. package/dist/modules/agents/builder/builder-model-live-lookup.service.js.map +1 -1
  316. package/dist/modules/agents/builder/builder-tool-names.d.ts +0 -9
  317. package/dist/modules/agents/builder/builder-tool-names.js +0 -9
  318. package/dist/modules/agents/builder/builder-tool-names.js.map +1 -1
  319. package/dist/modules/agents/builder/format-preview-context.js +10 -2
  320. package/dist/modules/agents/builder/format-preview-context.js.map +1 -1
  321. package/dist/modules/agents/builder/get-resource-locator-options.tool.d.ts +2 -2
  322. package/dist/modules/agents/builder/interactive/ask-credential.tool.d.ts +3 -11
  323. package/dist/modules/agents/builder/interactive/ask-credential.tool.js.map +1 -1
  324. package/dist/modules/agents/builder/interactive/configure-channel.tool.d.ts +2 -8
  325. package/dist/modules/agents/builder/interactive/configure-channel.tool.js +3 -3
  326. package/dist/modules/agents/builder/interactive/configure-channel.tool.js.map +1 -1
  327. package/dist/modules/agents/builder/interactive/finish-setup.tool.d.ts +2 -10
  328. package/dist/modules/agents/builder/interactive/finish-setup.tool.js +2 -2
  329. package/dist/modules/agents/builder/interactive/finish-setup.tool.js.map +1 -1
  330. package/dist/modules/agents/builder/interactive/resolve-llm.tool.d.ts +2 -4
  331. package/dist/modules/agents/builder/interactive/resolve-llm.tool.js +1 -1
  332. package/dist/modules/agents/builder/interactive/resolve-llm.tool.js.map +1 -1
  333. package/dist/modules/agents/builder/interactive/setup-tool.types.d.ts +16 -0
  334. package/dist/modules/agents/{types/components.js → builder/interactive/setup-tool.types.js} +1 -1
  335. package/dist/modules/agents/builder/interactive/setup-tool.types.js.map +1 -0
  336. package/dist/modules/agents/builder/model-lookup.types.d.ts +4 -0
  337. package/dist/modules/agents/{types/index.js → builder/model-lookup.types.js} +1 -1
  338. package/dist/modules/agents/builder/model-lookup.types.js.map +1 -0
  339. package/dist/modules/agents/builder/prompts/config-mutation.prompt.js +6 -6
  340. package/dist/modules/agents/builder/prompts/initial-build.prompt.d.ts +1 -1
  341. package/dist/modules/agents/builder/prompts/initial-build.prompt.js +28 -4
  342. package/dist/modules/agents/builder/prompts/initial-build.prompt.js.map +1 -1
  343. package/dist/modules/agents/builder/prompts/llm-selection.prompt.js +5 -3
  344. package/dist/modules/agents/builder/prompts/llm-selection.prompt.js.map +1 -1
  345. package/dist/modules/agents/builder/prompts/tools.prompt.d.ts +1 -1
  346. package/dist/modules/agents/builder/prompts/tools.prompt.js +14 -15
  347. package/dist/modules/agents/builder/prompts/tools.prompt.js.map +1 -1
  348. package/dist/modules/agents/builder/skills/custom-tools.skill.js +2 -2
  349. package/dist/modules/agents/builder/skills/custom-tools.skill.js.map +1 -1
  350. package/dist/modules/agents/builder/skills/external-services.skill.js +25 -29
  351. package/dist/modules/agents/builder/skills/external-services.skill.js.map +1 -1
  352. package/dist/modules/agents/builder/skills/memory.skill.js +2 -2
  353. package/dist/modules/agents/builder/skills/memory.skill.js.map +1 -1
  354. package/dist/modules/agents/builder/skills/node-tools.skill.js +11 -12
  355. package/dist/modules/agents/builder/skills/node-tools.skill.js.map +1 -1
  356. package/dist/modules/agents/builder/skills/resource-locators.skill.js +2 -2
  357. package/dist/modules/agents/builder/skills/resource-locators.skill.js.map +1 -1
  358. package/dist/modules/agents/builder/skills/sub-agents.skill.js +15 -19
  359. package/dist/modules/agents/builder/skills/sub-agents.skill.js.map +1 -1
  360. package/dist/modules/agents/builder/skills/target-skills.skill.js +7 -11
  361. package/dist/modules/agents/builder/skills/target-skills.skill.js.map +1 -1
  362. package/dist/modules/agents/builder/skills/target-tasks.skill.js +4 -7
  363. package/dist/modules/agents/builder/skills/target-tasks.skill.js.map +1 -1
  364. package/dist/modules/agents/builder/verify-mcp-server.tool.js +1 -1
  365. package/dist/modules/agents/builder/verify-mcp-server.tool.js.map +1 -1
  366. package/dist/modules/agents/entities/agent-background-job.entity.d.ts +3 -2
  367. package/dist/modules/agents/entities/agent-background-job.entity.js.map +1 -1
  368. package/dist/modules/agents/entities/agent-checkpoint.entity.js +1 -0
  369. package/dist/modules/agents/entities/agent-checkpoint.entity.js.map +1 -1
  370. package/dist/modules/agents/entities/agent-execution-message-link.entity.d.ts +12 -0
  371. package/dist/modules/agents/entities/agent-execution-message-link.entity.js +51 -0
  372. package/dist/modules/agents/entities/agent-execution-message-link.entity.js.map +1 -0
  373. package/dist/modules/agents/entities/agent-execution-thread.entity.d.ts +6 -1
  374. package/dist/modules/agents/entities/agent-execution-thread.entity.js +19 -0
  375. package/dist/modules/agents/entities/agent-execution-thread.entity.js.map +1 -1
  376. package/dist/modules/agents/entities/agent-execution.entity.d.ts +5 -8
  377. package/dist/modules/agents/entities/agent-execution.entity.js.map +1 -1
  378. package/dist/modules/agents/entities/agent-history.entity.d.ts +1 -5
  379. package/dist/modules/agents/entities/agent-history.entity.js.map +1 -1
  380. package/dist/modules/agents/entities/agent-memory-entry.entity.d.ts +2 -3
  381. package/dist/modules/agents/entities/agent-memory-entry.entity.js.map +1 -1
  382. package/dist/modules/agents/entities/agent-message-queue.entity.d.ts +14 -0
  383. package/dist/modules/agents/entities/agent-message-queue.entity.js +66 -0
  384. package/dist/modules/agents/entities/agent-message-queue.entity.js.map +1 -0
  385. package/dist/modules/agents/entities/agent-message.entity.d.ts +14 -1
  386. package/dist/modules/agents/entities/agent-message.entity.js +18 -1
  387. package/dist/modules/agents/entities/agent-message.entity.js.map +1 -1
  388. package/dist/modules/agents/entities/agent-observation-lock.entity.d.ts +2 -2
  389. package/dist/modules/agents/entities/agent-observation-lock.entity.js.map +1 -1
  390. package/dist/modules/agents/entities/agent-observation.entity.d.ts +3 -4
  391. package/dist/modules/agents/entities/agent-observation.entity.js.map +1 -1
  392. package/dist/modules/agents/execution-recorder.d.ts +4 -4
  393. package/dist/modules/agents/execution-recorder.js +8 -2
  394. package/dist/modules/agents/execution-recorder.js.map +1 -1
  395. package/dist/modules/agents/instance-ai-agent-context.adapter.d.ts +23 -0
  396. package/dist/modules/agents/instance-ai-agent-context.adapter.js +222 -0
  397. package/dist/modules/agents/instance-ai-agent-context.adapter.js.map +1 -0
  398. package/dist/modules/agents/instance-ai-builder-delegate.adapter.d.ts +2 -4
  399. package/dist/modules/agents/instance-ai-builder-delegate.adapter.js +6 -25
  400. package/dist/modules/agents/instance-ai-builder-delegate.adapter.js.map +1 -1
  401. package/dist/modules/agents/integrations/adapter-logger.d.ts +3 -0
  402. package/dist/modules/agents/integrations/adapter-logger.js +17 -0
  403. package/dist/modules/agents/integrations/adapter-logger.js.map +1 -0
  404. package/dist/modules/agents/integrations/agent-channel-reconciler.service.d.ts +3 -1
  405. package/dist/modules/agents/integrations/agent-channel-reconciler.service.js +51 -56
  406. package/dist/modules/agents/integrations/agent-channel-reconciler.service.js.map +1 -1
  407. package/dist/modules/agents/integrations/agent-channel-status-reporter.d.ts +2 -1
  408. package/dist/modules/agents/integrations/agent-channel-status-reporter.js.map +1 -1
  409. package/dist/modules/agents/integrations/agent-chat-bridge.d.ts +20 -6
  410. package/dist/modules/agents/integrations/agent-chat-bridge.js +205 -107
  411. package/dist/modules/agents/integrations/agent-chat-bridge.js.map +1 -1
  412. package/dist/modules/agents/integrations/agent-chat-hitl-resume-handler.d.ts +11 -3
  413. package/dist/modules/agents/integrations/agent-chat-hitl-resume-handler.js +46 -16
  414. package/dist/modules/agents/integrations/agent-chat-hitl-resume-handler.js.map +1 -1
  415. package/dist/modules/agents/integrations/agent-chat-integration.d.ts +12 -10
  416. package/dist/modules/agents/integrations/agent-chat-integration.js +13 -0
  417. package/dist/modules/agents/integrations/agent-chat-integration.js.map +1 -1
  418. package/dist/modules/agents/integrations/agent-chat-stream-consumer.d.ts +4 -1
  419. package/dist/modules/agents/integrations/agent-chat-stream-consumer.js +50 -18
  420. package/dist/modules/agents/integrations/agent-chat-stream-consumer.js.map +1 -1
  421. package/dist/modules/agents/integrations/agent-chat-subscription-state.adapter.d.ts +3 -3
  422. package/dist/modules/agents/integrations/agent-chat-subscription-state.adapter.js +2 -5
  423. package/dist/modules/agents/integrations/agent-chat-subscription-state.adapter.js.map +1 -1
  424. package/dist/modules/agents/integrations/agent-chat-subscription-state.service.d.ts +3 -8
  425. package/dist/modules/agents/integrations/agent-chat-subscription-state.service.js +12 -39
  426. package/dist/modules/agents/integrations/agent-chat-subscription-state.service.js.map +1 -1
  427. package/dist/modules/agents/integrations/agent-credential-lookup.service.d.ts +8 -0
  428. package/dist/modules/agents/integrations/agent-credential-lookup.service.js +41 -0
  429. package/dist/modules/agents/integrations/agent-credential-lookup.service.js.map +1 -0
  430. package/dist/modules/agents/integrations/callback-store.d.ts +1 -2
  431. package/dist/modules/agents/integrations/callback-store.js.map +1 -1
  432. package/dist/modules/agents/integrations/channel-status-report.d.ts +1 -1
  433. package/dist/modules/agents/integrations/channel-status-report.js +9 -1
  434. package/dist/modules/agents/integrations/channel-status-report.js.map +1 -1
  435. package/dist/modules/agents/integrations/chat-integration.service.d.ts +26 -31
  436. package/dist/modules/agents/integrations/chat-integration.service.js +240 -170
  437. package/dist/modules/agents/integrations/chat-integration.service.js.map +1 -1
  438. package/dist/modules/agents/integrations/component-mapper.d.ts +1 -0
  439. package/dist/modules/agents/integrations/component-mapper.js +14 -0
  440. package/dist/modules/agents/integrations/component-mapper.js.map +1 -1
  441. package/dist/modules/agents/integrations/credential-fields.d.ts +2 -0
  442. package/dist/modules/agents/integrations/credential-fields.js +19 -0
  443. package/dist/modules/agents/integrations/credential-fields.js.map +1 -0
  444. package/dist/modules/agents/integrations/esm-loader.d.ts +1 -0
  445. package/dist/modules/agents/integrations/esm-loader.js +4 -0
  446. package/dist/modules/agents/integrations/esm-loader.js.map +1 -1
  447. package/dist/modules/agents/integrations/integration-action-executor.d.ts +2 -10
  448. package/dist/modules/agents/integrations/integration-action-executor.js +1 -5
  449. package/dist/modules/agents/integrations/integration-action-executor.js.map +1 -1
  450. package/dist/modules/agents/integrations/integration-context-query-executor.d.ts +2 -10
  451. package/dist/modules/agents/integrations/integration-context-query-executor.js +1 -5
  452. package/dist/modules/agents/integrations/integration-context-query-executor.js.map +1 -1
  453. package/dist/modules/agents/integrations/integration-error-codes.d.ts +2 -0
  454. package/dist/modules/agents/integrations/integration-error-codes.js +2 -0
  455. package/dist/modules/agents/integrations/integration-error-codes.js.map +1 -1
  456. package/dist/modules/agents/integrations/integration-helpers.d.ts +5 -6
  457. package/dist/modules/agents/integrations/integration-helpers.js +32 -0
  458. package/dist/modules/agents/integrations/integration-helpers.js.map +1 -1
  459. package/dist/modules/agents/integrations/integration-message-context.service.d.ts +0 -1
  460. package/dist/modules/agents/integrations/integration-message-context.service.js +3 -9
  461. package/dist/modules/agents/integrations/integration-message-context.service.js.map +1 -1
  462. package/dist/modules/agents/integrations/integration-tool-definitions.d.ts +8 -1
  463. package/dist/modules/agents/integrations/integration-tool-definitions.js +13 -0
  464. package/dist/modules/agents/integrations/integration-tool-definitions.js.map +1 -1
  465. package/dist/modules/agents/integrations/integration-tool-execution.d.ts +4 -1
  466. package/dist/modules/agents/integrations/integration-tool-execution.js +30 -2
  467. package/dist/modules/agents/integrations/integration-tool-execution.js.map +1 -1
  468. package/dist/modules/agents/integrations/integration-tool-factory.d.ts +17 -2
  469. package/dist/modules/agents/integrations/integration-tool-factory.js +30 -5
  470. package/dist/modules/agents/integrations/integration-tool-factory.js.map +1 -1
  471. package/dist/modules/agents/integrations/integration-tool-types.d.ts +25 -20
  472. package/dist/modules/agents/integrations/n8n-checkpoint-storage.d.ts +14 -3
  473. package/dist/modules/agents/integrations/n8n-checkpoint-storage.js +80 -22
  474. package/dist/modules/agents/integrations/n8n-checkpoint-storage.js.map +1 -1
  475. package/dist/modules/agents/integrations/n8n-memory.d.ts +3 -8
  476. package/dist/modules/agents/integrations/n8n-memory.js +21 -77
  477. package/dist/modules/agents/integrations/n8n-memory.js.map +1 -1
  478. package/dist/modules/agents/integrations/platforms/discord-integration.d.ts +1 -3
  479. package/dist/modules/agents/integrations/platforms/discord-integration.js +9 -38
  480. package/dist/modules/agents/integrations/platforms/discord-integration.js.map +1 -1
  481. package/dist/modules/agents/integrations/platforms/linear-tool-definitions.d.ts +3 -0
  482. package/dist/modules/agents/integrations/platforms/linear-tool-definitions.js +3 -0
  483. package/dist/modules/agents/integrations/platforms/linear-tool-definitions.js.map +1 -1
  484. package/dist/modules/agents/integrations/platforms/slack/slack-bridge-behavior.d.ts +8 -0
  485. package/dist/modules/agents/integrations/platforms/slack/slack-bridge-behavior.js +5 -1
  486. package/dist/modules/agents/integrations/platforms/slack/slack-bridge-behavior.js.map +1 -1
  487. package/dist/modules/agents/integrations/platforms/slack/slack-integration.d.ts +2 -0
  488. package/dist/modules/agents/integrations/platforms/slack/slack-integration.js.map +1 -1
  489. package/dist/modules/agents/integrations/platforms/slack/slack-managed-setup.service.d.ts +11 -9
  490. package/dist/modules/agents/integrations/platforms/slack/slack-managed-setup.service.js +153 -161
  491. package/dist/modules/agents/integrations/platforms/slack/slack-managed-setup.service.js.map +1 -1
  492. package/dist/modules/agents/integrations/platforms/slack/slack-manual-setup.service.d.ts +4 -3
  493. package/dist/modules/agents/integrations/platforms/slack/slack-manual-setup.service.js +40 -59
  494. package/dist/modules/agents/integrations/platforms/slack/slack-manual-setup.service.js.map +1 -1
  495. package/dist/modules/agents/integrations/platforms/slack/slack-methods.service.d.ts +2 -1
  496. package/dist/modules/agents/integrations/platforms/slack/slack-methods.service.js +16 -7
  497. package/dist/modules/agents/integrations/platforms/slack/slack-methods.service.js.map +1 -1
  498. package/dist/modules/agents/integrations/platforms/slack/slack-setup.types.d.ts +8 -0
  499. package/dist/modules/agents/integrations/platforms/slack/slack-setup.types.js +29 -0
  500. package/dist/modules/agents/integrations/platforms/slack/slack-setup.types.js.map +1 -1
  501. package/dist/modules/agents/integrations/platforms/teams/assets/color.png +0 -0
  502. package/dist/modules/agents/integrations/platforms/teams/assets/outline.png +0 -0
  503. package/dist/modules/agents/integrations/platforms/teams/teams-arm-template.service.d.ts +21 -0
  504. package/dist/modules/agents/integrations/platforms/teams/teams-arm-template.service.js +135 -0
  505. package/dist/modules/agents/integrations/platforms/teams/teams-arm-template.service.js.map +1 -0
  506. package/dist/modules/agents/integrations/platforms/teams/teams-credential-check.service.d.ts +12 -0
  507. package/dist/modules/agents/integrations/platforms/teams/teams-credential-check.service.js +82 -0
  508. package/dist/modules/agents/integrations/platforms/teams/teams-credential-check.service.js.map +1 -0
  509. package/dist/modules/agents/integrations/platforms/teams/teams-integration.d.ts +38 -0
  510. package/dist/modules/agents/integrations/platforms/teams/teams-integration.js +145 -0
  511. package/dist/modules/agents/integrations/platforms/teams/teams-integration.js.map +1 -0
  512. package/dist/modules/agents/integrations/platforms/teams/teams-manifest.service.d.ts +21 -0
  513. package/dist/modules/agents/integrations/platforms/teams/teams-manifest.service.js +138 -0
  514. package/dist/modules/agents/integrations/platforms/teams/teams-manifest.service.js.map +1 -0
  515. package/dist/modules/agents/integrations/platforms/teams/teams-setup.service.d.ts +33 -0
  516. package/dist/modules/agents/integrations/platforms/teams/teams-setup.service.js +130 -0
  517. package/dist/modules/agents/integrations/platforms/teams/teams-setup.service.js.map +1 -0
  518. package/dist/modules/agents/integrations/platforms/telegram-bridge-behavior.js +6 -4
  519. package/dist/modules/agents/integrations/platforms/telegram-bridge-behavior.js.map +1 -1
  520. package/dist/modules/agents/integrations/platforms/telegram-integration.d.ts +1 -1
  521. package/dist/modules/agents/integrations/platforms/telegram-integration.js +2 -2
  522. package/dist/modules/agents/integrations/platforms/telegram-integration.js.map +1 -1
  523. package/dist/modules/agents/json-config/agent-config-composition.js +4 -1
  524. package/dist/modules/agents/json-config/agent-config-composition.js.map +1 -1
  525. package/dist/modules/agents/json-config/from-json-config.d.ts +1 -1
  526. package/dist/modules/agents/json-config/from-json-config.js +18 -11
  527. package/dist/modules/agents/json-config/from-json-config.js.map +1 -1
  528. package/dist/modules/agents/json-config/mcp-client-factory.d.ts +2 -5
  529. package/dist/modules/agents/json-config/mcp-client-factory.js.map +1 -1
  530. package/dist/modules/agents/json-config/sanitize-unknown-agent-credentials.js +5 -1
  531. package/dist/modules/agents/json-config/sanitize-unknown-agent-credentials.js.map +1 -1
  532. package/dist/modules/agents/json-config/web-search-credential.d.ts +10 -0
  533. package/dist/modules/agents/json-config/web-search-credential.js +29 -0
  534. package/dist/modules/agents/json-config/web-search-credential.js.map +1 -0
  535. package/dist/modules/agents/repositories/agent-channel-status.repository.d.ts +1 -5
  536. package/dist/modules/agents/repositories/agent-channel-status.repository.js.map +1 -1
  537. package/dist/modules/agents/repositories/agent-chat-subscription.repository.d.ts +6 -10
  538. package/dist/modules/agents/repositories/agent-chat-subscription.repository.js.map +1 -1
  539. package/dist/modules/agents/repositories/agent-checkpoint.repository.d.ts +12 -9
  540. package/dist/modules/agents/repositories/agent-checkpoint.repository.js +24 -17
  541. package/dist/modules/agents/repositories/agent-checkpoint.repository.js.map +1 -1
  542. package/dist/modules/agents/repositories/agent-execution-thread.repository.d.ts +29 -9
  543. package/dist/modules/agents/repositories/agent-execution-thread.repository.js +228 -79
  544. package/dist/modules/agents/repositories/agent-execution-thread.repository.js.map +1 -1
  545. package/dist/modules/agents/repositories/agent-execution.repository.d.ts +14 -10
  546. package/dist/modules/agents/repositories/agent-execution.repository.js +57 -30
  547. package/dist/modules/agents/repositories/agent-execution.repository.js.map +1 -1
  548. package/dist/modules/agents/repositories/agent-message-queue.repository.d.ts +91 -0
  549. package/dist/modules/agents/repositories/agent-message-queue.repository.js +92 -0
  550. package/dist/modules/agents/repositories/agent-message-queue.repository.js.map +1 -0
  551. package/dist/modules/agents/repositories/agent-message.repository.d.ts +37 -4
  552. package/dist/modules/agents/repositories/agent-message.repository.js +195 -4
  553. package/dist/modules/agents/repositories/agent-message.repository.js.map +1 -1
  554. package/dist/modules/agents/repositories/agent-resource.repository.d.ts +7 -0
  555. package/dist/modules/agents/repositories/agent-resource.repository.js +35 -0
  556. package/dist/modules/agents/repositories/agent-resource.repository.js.map +1 -1
  557. package/dist/modules/agents/repositories/agent-thread.repository.d.ts +4 -3
  558. package/dist/modules/agents/repositories/agent-thread.repository.js +5 -4
  559. package/dist/modules/agents/repositories/agent-thread.repository.js.map +1 -1
  560. package/dist/modules/agents/repositories/agent.repository.d.ts +8 -4
  561. package/dist/modules/agents/repositories/agent.repository.js +17 -0
  562. package/dist/modules/agents/repositories/agent.repository.js.map +1 -1
  563. package/dist/modules/agents/sub-agents/delegate-sub-agent-tool.d.ts +2 -6
  564. package/dist/modules/agents/sub-agents/delegate-sub-agent-tool.js.map +1 -1
  565. package/dist/modules/agents/sub-agents/sub-agent-runner.d.ts +1 -1
  566. package/dist/modules/agents/sub-agents/sub-agent-runner.js +17 -8
  567. package/dist/modules/agents/sub-agents/sub-agent-runner.js.map +1 -1
  568. package/dist/modules/agents/sub-agents/sub-agent-source-resolver.d.ts +3 -6
  569. package/dist/modules/agents/sub-agents/sub-agent-source-resolver.js +6 -20
  570. package/dist/modules/agents/sub-agents/sub-agent-source-resolver.js.map +1 -1
  571. package/dist/modules/agents/tool-registry.d.ts +1 -0
  572. package/dist/modules/agents/tool-registry.js.map +1 -1
  573. package/dist/modules/agents/tools/workflow-tool-factory.d.ts +1 -0
  574. package/dist/modules/agents/tools/workflow-tool-factory.js +1 -0
  575. package/dist/modules/agents/tools/workflow-tool-factory.js.map +1 -1
  576. package/dist/modules/agents/types/agent-chat-attachment.d.ts +6 -0
  577. package/dist/modules/agents/types/agent-chat-attachment.js +3 -0
  578. package/dist/modules/agents/types/agent-chat-attachment.js.map +1 -0
  579. package/dist/modules/agents/types/agent-queued-message.d.ts +36 -0
  580. package/dist/modules/agents/types/agent-queued-message.js +12 -0
  581. package/dist/modules/agents/types/agent-queued-message.js.map +1 -0
  582. package/dist/modules/agents/utils/agent-channel.d.ts +11 -0
  583. package/dist/modules/agents/utils/agent-channel.js +11 -0
  584. package/dist/modules/agents/utils/agent-channel.js.map +1 -0
  585. package/dist/modules/agents/utils/agent-memory-scope.d.ts +2 -0
  586. package/dist/modules/agents/utils/agent-memory-scope.js +12 -0
  587. package/dist/modules/agents/utils/agent-memory-scope.js.map +1 -1
  588. package/dist/modules/agents/utils/agent-runtime-assets.d.ts +9 -0
  589. package/dist/modules/agents/utils/agent-runtime-assets.js +13 -0
  590. package/dist/modules/agents/utils/agent-runtime-assets.js.map +1 -0
  591. package/dist/modules/agents/utils/agent-thread-access.d.ts +7 -0
  592. package/dist/modules/agents/utils/agent-thread-access.js +23 -0
  593. package/dist/modules/agents/utils/agent-thread-access.js.map +1 -0
  594. package/dist/modules/agents/utils/decrypt-agent-credential.d.ts +7 -0
  595. package/dist/modules/agents/utils/decrypt-agent-credential.js +9 -0
  596. package/dist/modules/agents/utils/decrypt-agent-credential.js.map +1 -0
  597. package/dist/modules/agents/utils/delegated-child-checkpoints.d.ts +6 -0
  598. package/dist/modules/agents/utils/delegated-child-checkpoints.js +45 -0
  599. package/dist/modules/agents/utils/delegated-child-checkpoints.js.map +1 -0
  600. package/dist/modules/agents/utils/execution-failure-summary.d.ts +2 -1
  601. package/dist/modules/agents/utils/execution-failure-summary.js.map +1 -1
  602. package/dist/modules/agents/utils/execution-input.d.ts +2 -0
  603. package/dist/modules/agents/utils/execution-input.js +16 -0
  604. package/dist/modules/agents/utils/execution-input.js.map +1 -0
  605. package/dist/modules/agents/utils/execution-to-message-mapper.d.ts +1 -1
  606. package/dist/modules/agents/utils/execution-to-message-mapper.js +4 -1
  607. package/dist/modules/agents/utils/execution-to-message-mapper.js.map +1 -1
  608. package/dist/modules/agents/utils/get-agent-or-throw.d.ts +3 -0
  609. package/dist/modules/agents/utils/get-agent-or-throw.js +11 -0
  610. package/dist/modules/agents/utils/get-agent-or-throw.js.map +1 -0
  611. package/dist/modules/agents/utils/inbound-attachments.d.ts +3 -3
  612. package/dist/modules/agents/workflow-agent-stream.d.ts +4 -0
  613. package/dist/modules/breaking-changes/breaking-changes.module.d.ts +1 -0
  614. package/dist/modules/breaking-changes/breaking-changes.module.js +5 -0
  615. package/dist/modules/breaking-changes/breaking-changes.module.js.map +1 -1
  616. package/dist/modules/breaking-changes/breaking-changes.service.js +1 -1
  617. package/dist/modules/breaking-changes/breaking-changes.service.js.map +1 -1
  618. package/dist/modules/breaking-changes/database/entities/migration-finding-sync.entity.d.ts +7 -0
  619. package/dist/modules/breaking-changes/database/entities/migration-finding-sync.entity.js +33 -0
  620. package/dist/modules/breaking-changes/database/entities/migration-finding-sync.entity.js.map +1 -0
  621. package/dist/modules/breaking-changes/database/entities/migration-finding.entity.d.ts +15 -0
  622. package/dist/modules/breaking-changes/database/entities/migration-finding.entity.js +60 -0
  623. package/dist/modules/breaking-changes/database/entities/migration-finding.entity.js.map +1 -0
  624. package/dist/modules/breaking-changes/rules/index.d.ts +0 -2
  625. package/dist/modules/breaking-changes/rules/index.js +0 -2
  626. package/dist/modules/breaking-changes/rules/index.js.map +1 -1
  627. package/dist/modules/breaking-changes/rules/v2/file-access.rule.js +1 -1
  628. package/dist/modules/breaking-changes/rules/v2/file-access.rule.js.map +1 -1
  629. package/dist/modules/breaking-changes/rules/v2/pyodide-removed.rule.js +2 -2
  630. package/dist/modules/breaking-changes/rules/v2/pyodide-removed.rule.js.map +1 -1
  631. package/dist/modules/breaking-changes/rules/v2/queue-worker-max-stalled-count.rule.js +1 -1
  632. package/dist/modules/breaking-changes/rules/v2/queue-worker-max-stalled-count.rule.js.map +1 -1
  633. package/dist/modules/breaking-changes/rules/v2/wait-node-subworkflow.rule.js +1 -1
  634. package/dist/modules/breaking-changes/rules/v2/wait-node-subworkflow.rule.js.map +1 -1
  635. package/dist/modules/data-table/data-table.service.js +6 -0
  636. package/dist/modules/data-table/data-table.service.js.map +1 -1
  637. package/dist/modules/dynamic-credentials.ee/dynamic-credentials.controller.d.ts +1 -1
  638. package/dist/modules/dynamic-credentials.ee/dynamic-credentials.controller.js +2 -2
  639. package/dist/modules/dynamic-credentials.ee/dynamic-credentials.controller.js.map +1 -1
  640. package/dist/modules/dynamic-credentials.ee/services/credential-check-proxy.service.d.ts +1 -1
  641. package/dist/modules/dynamic-credentials.ee/services/credential-check-proxy.service.js +2 -2
  642. package/dist/modules/dynamic-credentials.ee/services/credential-check-proxy.service.js.map +1 -1
  643. package/dist/modules/dynamic-credentials.ee/workflow-status.controller.d.ts +1 -1
  644. package/dist/modules/dynamic-credentials.ee/workflow-status.controller.js +2 -2
  645. package/dist/modules/dynamic-credentials.ee/workflow-status.controller.js.map +1 -1
  646. package/dist/modules/engine-v2/engine-additional-data.d.ts +15 -0
  647. package/dist/modules/engine-v2/engine-additional-data.js +115 -0
  648. package/dist/modules/engine-v2/engine-additional-data.js.map +1 -0
  649. package/dist/modules/engine-v2/engine-control-plane-server.js +3 -3
  650. package/dist/modules/engine-v2/engine-control-plane-server.js.map +1 -1
  651. package/dist/modules/engine-v2/engine-credentials.service.js +1 -1
  652. package/dist/modules/engine-v2/engine-credentials.service.js.map +1 -1
  653. package/dist/modules/engine-v2/engine-lifecycle-event-push-relay.js +1 -1
  654. package/dist/modules/engine-v2/engine-lifecycle-event-push-relay.js.map +1 -1
  655. package/dist/modules/engine-v2/engine-v2.module.d.ts +3 -1
  656. package/dist/modules/engine-v2/engine-v2.module.js +43 -9
  657. package/dist/modules/engine-v2/engine-v2.module.js.map +1 -1
  658. package/dist/modules/engine-v2/engine-v2.runtime.d.ts +5 -3
  659. package/dist/modules/engine-v2/engine-v2.runtime.js +17 -55
  660. package/dist/modules/engine-v2/engine-v2.runtime.js.map +1 -1
  661. package/dist/modules/engine-v2/remote-credentials-helper.js +6 -6
  662. package/dist/modules/engine-v2/remote-credentials-helper.js.map +1 -1
  663. package/dist/modules/engine-v2/response-channel/execution-response-frame.d.ts +13 -0
  664. package/dist/modules/engine-v2/response-channel/execution-response-frame.js +61 -0
  665. package/dist/modules/engine-v2/response-channel/execution-response-frame.js.map +1 -0
  666. package/dist/modules/engine-v2/response-channel/execution-response-receiver.d.ts +6 -0
  667. package/dist/modules/engine-v2/response-channel/execution-response-receiver.js +3 -0
  668. package/dist/modules/engine-v2/response-channel/execution-response-receiver.js.map +1 -0
  669. package/dist/modules/engine-v2/response-channel/in-memory-execution-response-channel.d.ts +6 -0
  670. package/dist/modules/engine-v2/response-channel/in-memory-execution-response-channel.js +18 -0
  671. package/dist/modules/engine-v2/response-channel/in-memory-execution-response-channel.js.map +1 -0
  672. package/dist/modules/engine-v2/response-channel/in-memory-execution-response-receiver.d.ts +13 -0
  673. package/dist/modules/engine-v2/response-channel/in-memory-execution-response-receiver.js +45 -0
  674. package/dist/modules/engine-v2/response-channel/in-memory-execution-response-receiver.js.map +1 -0
  675. package/dist/modules/engine-v2/response-channel/in-memory-execution-response-sender.d.ts +14 -0
  676. package/dist/modules/engine-v2/response-channel/in-memory-execution-response-sender.js +32 -0
  677. package/dist/modules/engine-v2/response-channel/in-memory-execution-response-sender.js.map +1 -0
  678. package/dist/modules/engine-v2/response-channel/redis-execution-response-channel.d.ts +4 -0
  679. package/dist/modules/engine-v2/response-channel/redis-execution-response-channel.js +31 -0
  680. package/dist/modules/engine-v2/response-channel/redis-execution-response-channel.js.map +1 -0
  681. package/dist/modules/engine-v2/response-channel/redis-execution-response-receiver.d.ts +34 -0
  682. package/dist/modules/engine-v2/response-channel/redis-execution-response-receiver.js +115 -0
  683. package/dist/modules/engine-v2/response-channel/redis-execution-response-receiver.js.map +1 -0
  684. package/dist/modules/engine-v2/response-channel/redis-execution-response-sender.d.ts +21 -0
  685. package/dist/modules/engine-v2/response-channel/redis-execution-response-sender.js +66 -0
  686. package/dist/modules/engine-v2/response-channel/redis-execution-response-sender.js.map +1 -0
  687. package/dist/modules/insights/insights-compaction.task.d.ts +2 -2
  688. package/dist/modules/insights/insights-compaction.task.js +2 -5
  689. package/dist/modules/insights/insights-compaction.task.js.map +1 -1
  690. package/dist/modules/insights/insights-pruning.task.d.ts +2 -2
  691. package/dist/modules/insights/insights-pruning.task.js +2 -5
  692. package/dist/modules/insights/insights-pruning.task.js.map +1 -1
  693. package/dist/modules/instance-ai/agent-preview-handoff.d.ts +1 -0
  694. package/dist/modules/instance-ai/agent-preview-handoff.js +1 -1
  695. package/dist/modules/instance-ai/agent-preview-handoff.js.map +1 -1
  696. package/dist/modules/instance-ai/browser/instance-ai-browser-session.service.d.ts +1 -1
  697. package/dist/modules/instance-ai/browser/instance-ai-browser-session.service.js +2 -2
  698. package/dist/modules/instance-ai/browser/instance-ai-browser-session.service.js.map +1 -1
  699. package/dist/modules/instance-ai/entities/index.d.ts +1 -0
  700. package/dist/modules/instance-ai/entities/index.js +3 -1
  701. package/dist/modules/instance-ai/entities/index.js.map +1 -1
  702. package/dist/modules/instance-ai/entities/instance-ai-thread-tabs.entity.d.ts +10 -0
  703. package/dist/modules/instance-ai/entities/instance-ai-thread-tabs.entity.js +45 -0
  704. package/dist/modules/instance-ai/entities/instance-ai-thread-tabs.entity.js.map +1 -0
  705. package/dist/modules/instance-ai/eval/data-table-pin-filter.d.ts +7 -0
  706. package/dist/modules/instance-ai/eval/data-table-pin-filter.js +171 -0
  707. package/dist/modules/instance-ai/eval/data-table-pin-filter.js.map +1 -0
  708. package/dist/modules/instance-ai/eval/execution.service.d.ts +2 -0
  709. package/dist/modules/instance-ai/eval/execution.service.js +48 -2
  710. package/dist/modules/instance-ai/eval/execution.service.js.map +1 -1
  711. package/dist/modules/instance-ai/eval/scoped-credential-provider.d.ts +4 -0
  712. package/dist/modules/instance-ai/eval/scoped-credential-provider.js +19 -0
  713. package/dist/modules/instance-ai/eval/scoped-credential-provider.js.map +1 -0
  714. package/dist/modules/instance-ai/eval/workflow-analysis.d.ts +1 -0
  715. package/dist/modules/instance-ai/eval/workflow-analysis.js +13 -2
  716. package/dist/modules/instance-ai/eval/workflow-analysis.js.map +1 -1
  717. package/dist/modules/instance-ai/event-bus/durable-event-log.d.ts +22 -0
  718. package/dist/modules/instance-ai/event-bus/durable-event-log.js +7 -0
  719. package/dist/modules/instance-ai/event-bus/durable-event-log.js.map +1 -1
  720. package/dist/modules/instance-ai/instance-ai-checkpoint-pruning.task.d.ts +2 -3
  721. package/dist/modules/instance-ai/instance-ai-checkpoint-pruning.task.js +6 -7
  722. package/dist/modules/instance-ai/instance-ai-checkpoint-pruning.task.js.map +1 -1
  723. package/dist/modules/instance-ai/instance-ai-memory.service.d.ts +4 -1
  724. package/dist/modules/instance-ai/instance-ai-memory.service.js +32 -3
  725. package/dist/modules/instance-ai/instance-ai-memory.service.js.map +1 -1
  726. package/dist/modules/instance-ai/instance-ai-preference-card.service.d.ts +14 -0
  727. package/dist/modules/instance-ai/instance-ai-preference-card.service.js +112 -0
  728. package/dist/modules/instance-ai/instance-ai-preference-card.service.js.map +1 -0
  729. package/dist/modules/instance-ai/instance-ai-step-run.d.ts +25 -2
  730. package/dist/modules/instance-ai/instance-ai-step-run.js +227 -10
  731. package/dist/modules/instance-ai/instance-ai-step-run.js.map +1 -1
  732. package/dist/modules/instance-ai/instance-ai.adapter.service.d.ts +17 -7
  733. package/dist/modules/instance-ai/instance-ai.adapter.service.js +195 -44
  734. package/dist/modules/instance-ai/instance-ai.adapter.service.js.map +1 -1
  735. package/dist/modules/instance-ai/instance-ai.controller.d.ts +34 -5
  736. package/dist/modules/instance-ai/instance-ai.controller.js +77 -7
  737. package/dist/modules/instance-ai/instance-ai.controller.js.map +1 -1
  738. package/dist/modules/instance-ai/instance-ai.module.d.ts +2 -1
  739. package/dist/modules/instance-ai/instance-ai.module.js +4 -0
  740. package/dist/modules/instance-ai/instance-ai.module.js.map +1 -1
  741. package/dist/modules/instance-ai/instance-ai.service.d.ts +20 -7
  742. package/dist/modules/instance-ai/instance-ai.service.js +452 -56
  743. package/dist/modules/instance-ai/instance-ai.service.js.map +1 -1
  744. package/dist/modules/instance-ai/instance-context.service.d.ts +11 -2
  745. package/dist/modules/instance-ai/instance-context.service.js +48 -14
  746. package/dist/modules/instance-ai/instance-context.service.js.map +1 -1
  747. package/dist/modules/instance-ai/internal-messages.d.ts +17 -1
  748. package/dist/modules/instance-ai/internal-messages.js +58 -6
  749. package/dist/modules/instance-ai/internal-messages.js.map +1 -1
  750. package/dist/modules/instance-ai/onboarding-opening.d.ts +9 -0
  751. package/dist/modules/instance-ai/onboarding-opening.js +41 -0
  752. package/dist/modules/instance-ai/onboarding-opening.js.map +1 -0
  753. package/dist/modules/instance-ai/onboarding.d.ts +27 -0
  754. package/dist/modules/instance-ai/onboarding.js +272 -0
  755. package/dist/modules/instance-ai/onboarding.js.map +1 -0
  756. package/dist/modules/instance-ai/repositories/index.d.ts +1 -0
  757. package/dist/modules/instance-ai/repositories/index.js +3 -1
  758. package/dist/modules/instance-ai/repositories/index.js.map +1 -1
  759. package/dist/modules/instance-ai/repositories/instance-ai-conversation-history.repository.d.ts +1 -0
  760. package/dist/modules/instance-ai/repositories/instance-ai-conversation-history.repository.js +6 -11
  761. package/dist/modules/instance-ai/repositories/instance-ai-conversation-history.repository.js.map +1 -1
  762. package/dist/modules/instance-ai/repositories/instance-ai-event-log.repository.d.ts +4 -1
  763. package/dist/modules/instance-ai/repositories/instance-ai-event-log.repository.js +19 -0
  764. package/dist/modules/instance-ai/repositories/instance-ai-event-log.repository.js.map +1 -1
  765. package/dist/modules/instance-ai/repositories/instance-ai-observation-cursor.repository.d.ts +1 -0
  766. package/dist/modules/instance-ai/repositories/instance-ai-observation-cursor.repository.js +3 -0
  767. package/dist/modules/instance-ai/repositories/instance-ai-observation-cursor.repository.js.map +1 -1
  768. package/dist/modules/instance-ai/repositories/instance-ai-observation.repository.d.ts +1 -0
  769. package/dist/modules/instance-ai/repositories/instance-ai-observation.repository.js +6 -0
  770. package/dist/modules/instance-ai/repositories/instance-ai-observation.repository.js.map +1 -1
  771. package/dist/modules/instance-ai/repositories/instance-ai-thread-tabs.repository.d.ts +8 -0
  772. package/dist/modules/instance-ai/repositories/instance-ai-thread-tabs.repository.js +33 -0
  773. package/dist/modules/instance-ai/repositories/instance-ai-thread-tabs.repository.js.map +1 -0
  774. package/dist/modules/instance-registry/checks/instance-registry-reconciliation.task.d.ts +2 -3
  775. package/dist/modules/instance-registry/checks/instance-registry-reconciliation.task.js +6 -7
  776. package/dist/modules/instance-registry/checks/instance-registry-reconciliation.task.js.map +1 -1
  777. package/dist/modules/instance-registry/stale-member-cleanup.task.d.ts +2 -2
  778. package/dist/modules/instance-registry/stale-member-cleanup.task.js +2 -6
  779. package/dist/modules/instance-registry/stale-member-cleanup.task.js.map +1 -1
  780. package/dist/modules/instance-reporting.ee/database/entities/instance-monitoring-report.d.ts +1 -0
  781. package/dist/modules/instance-reporting.ee/database/entities/instance-monitoring-report.js +6 -1
  782. package/dist/modules/instance-reporting.ee/database/entities/instance-monitoring-report.js.map +1 -1
  783. package/dist/modules/instance-reporting.ee/database/repositories/instance-monitoring-report.repository.d.ts +1 -1
  784. package/dist/modules/instance-reporting.ee/database/repositories/instance-monitoring-report.repository.js +20 -9
  785. package/dist/modules/instance-reporting.ee/database/repositories/instance-monitoring-report.repository.js.map +1 -1
  786. package/dist/modules/instance-reporting.ee/instance-reporting-scheduler.service.d.ts +1 -0
  787. package/dist/modules/instance-reporting.ee/instance-reporting-scheduler.service.js +16 -4
  788. package/dist/modules/instance-reporting.ee/instance-reporting-scheduler.service.js.map +1 -1
  789. package/dist/modules/instance-reporting.ee/instance-reporting.service.d.ts +7 -3
  790. package/dist/modules/instance-reporting.ee/instance-reporting.service.js +37 -18
  791. package/dist/modules/instance-reporting.ee/instance-reporting.service.js.map +1 -1
  792. package/dist/modules/mcp/mcp-protected-resource.d.ts +2 -1
  793. package/dist/modules/mcp/mcp-protected-resource.js +14 -6
  794. package/dist/modules/mcp/mcp-protected-resource.js.map +1 -1
  795. package/dist/modules/mcp/mcp-scopes.js +5 -0
  796. package/dist/modules/mcp/mcp-scopes.js.map +1 -1
  797. package/dist/modules/mcp/mcp-tool-availability.d.ts +2 -0
  798. package/dist/modules/mcp/mcp-tool-availability.js +5 -0
  799. package/dist/modules/mcp/mcp-tool-availability.js.map +1 -1
  800. package/dist/modules/mcp/mcp.constants.d.ts +3 -0
  801. package/dist/modules/mcp/mcp.constants.js +4 -1
  802. package/dist/modules/mcp/mcp.constants.js.map +1 -1
  803. package/dist/modules/mcp/mcp.service.d.ts +5 -3
  804. package/dist/modules/mcp/mcp.service.js +19 -5
  805. package/dist/modules/mcp/mcp.service.js.map +1 -1
  806. package/dist/modules/mcp/mcp.types.d.ts +6 -5
  807. package/dist/modules/mcp/mcp.types.js.map +1 -1
  808. package/dist/modules/mcp/tools/agents/agent-tools.service.d.ts +1 -1
  809. package/dist/modules/mcp/tools/agents/agent-tools.service.js +3 -3
  810. package/dist/modules/mcp/tools/agents/agent-tools.service.js.map +1 -1
  811. package/dist/modules/mcp/tools/data-table/add-data-table-column.tool.js +5 -9
  812. package/dist/modules/mcp/tools/data-table/add-data-table-column.tool.js.map +1 -1
  813. package/dist/modules/mcp/tools/data-table/add-data-table-rows.tool.js +5 -11
  814. package/dist/modules/mcp/tools/data-table/add-data-table-rows.tool.js.map +1 -1
  815. package/dist/modules/mcp/tools/data-table/create-data-table.tool.js +2 -12
  816. package/dist/modules/mcp/tools/data-table/create-data-table.tool.js.map +1 -1
  817. package/dist/modules/mcp/tools/data-table/delete-data-table-column.tool.js +5 -9
  818. package/dist/modules/mcp/tools/data-table/delete-data-table-column.tool.js.map +1 -1
  819. package/dist/modules/mcp/tools/data-table/get-data-table-rows.tool.js +6 -12
  820. package/dist/modules/mcp/tools/data-table/get-data-table-rows.tool.js.map +1 -1
  821. package/dist/modules/mcp/tools/data-table/rename-data-table-column.tool.js +5 -9
  822. package/dist/modules/mcp/tools/data-table/rename-data-table-column.tool.js.map +1 -1
  823. package/dist/modules/mcp/tools/data-table/rename-data-table.tool.js +5 -9
  824. package/dist/modules/mcp/tools/data-table/rename-data-table.tool.js.map +1 -1
  825. package/dist/modules/mcp/tools/data-table/search-data-tables.tool.js +6 -12
  826. package/dist/modules/mcp/tools/data-table/search-data-tables.tool.js.map +1 -1
  827. package/dist/modules/mcp/tools/get-instance-context.tool.js +1 -1
  828. package/dist/modules/mcp/tools/get-instance-context.tool.js.map +1 -1
  829. package/dist/modules/mcp/tools/get-user-preferences.tool.js +11 -2
  830. package/dist/modules/mcp/tools/get-user-preferences.tool.js.map +1 -1
  831. package/dist/modules/mcp/tools/get-workflow-details.tool.js +2 -6
  832. package/dist/modules/mcp/tools/get-workflow-details.tool.js.map +1 -1
  833. package/dist/modules/mcp/tools/list-credentials.tool.d.ts +7 -7
  834. package/dist/modules/mcp/tools/list-credentials.tool.js +24 -27
  835. package/dist/modules/mcp/tools/list-credentials.tool.js.map +1 -1
  836. package/dist/modules/mcp/tools/list-tags.tool.js +2 -6
  837. package/dist/modules/mcp/tools/list-tags.tool.js.map +1 -1
  838. package/dist/modules/mcp/tools/save-user-preference.tool.d.ts +12 -0
  839. package/dist/modules/mcp/tools/save-user-preference.tool.js +261 -0
  840. package/dist/modules/mcp/tools/save-user-preference.tool.js.map +1 -0
  841. package/dist/modules/mcp/tools/search-folders.tool.js +6 -12
  842. package/dist/modules/mcp/tools/search-folders.tool.js.map +1 -1
  843. package/dist/modules/mcp/tools/search-projects.tool.js +6 -12
  844. package/dist/modules/mcp/tools/search-projects.tool.js.map +1 -1
  845. package/dist/modules/mcp/tools/tool-error.utils.d.ts +11 -0
  846. package/dist/modules/mcp/tools/tool-error.utils.js +26 -0
  847. package/dist/modules/mcp/tools/tool-error.utils.js.map +1 -0
  848. package/dist/modules/mcp/tools/undo-user-preference.tool.d.ts +11 -0
  849. package/dist/modules/mcp/tools/undo-user-preference.tool.js +101 -0
  850. package/dist/modules/mcp/tools/undo-user-preference.tool.js.map +1 -0
  851. package/dist/modules/mcp/tools/update-user-preference.tool.d.ts +15 -0
  852. package/dist/modules/mcp/tools/update-user-preference.tool.js +192 -0
  853. package/dist/modules/mcp/tools/update-user-preference.tool.js.map +1 -0
  854. package/dist/modules/mcp/tools/user-preference-tool.utils.d.ts +35 -0
  855. package/dist/modules/mcp/tools/user-preference-tool.utils.js +56 -0
  856. package/dist/modules/mcp/tools/user-preference-tool.utils.js.map +1 -0
  857. package/dist/modules/mcp/tools/workflow-builder/create-workflow-from-code.tool.d.ts +1 -1
  858. package/dist/modules/mcp/tools/workflow-builder/get-workflow-best-practices.tool.js +2 -6
  859. package/dist/modules/mcp/tools/workflow-builder/get-workflow-best-practices.tool.js.map +1 -1
  860. package/dist/modules/mcp/tools/workflow-builder/get-workflow-node-types.tool.js +2 -6
  861. package/dist/modules/mcp/tools/workflow-builder/get-workflow-node-types.tool.js.map +1 -1
  862. package/dist/modules/mcp/tools/workflow-builder/mcp-instructions.d.ts +1 -0
  863. package/dist/modules/mcp/tools/workflow-builder/mcp-instructions.js +1 -1
  864. package/dist/modules/mcp/tools/workflow-builder/mcp-instructions.js.map +1 -1
  865. package/dist/modules/mcp/tools/workflow-builder/search-workflow-nodes.tool.js +2 -6
  866. package/dist/modules/mcp/tools/workflow-builder/search-workflow-nodes.tool.js.map +1 -1
  867. package/dist/modules/mcp/tools/workflow-builder/update-workflow.tool.d.ts +1 -1
  868. package/dist/modules/mcp/tools/workflow-builder/workflow-operations.js +1 -1
  869. package/dist/modules/mcp/tools/workflow-builder/workflow-operations.js.map +1 -1
  870. package/dist/modules/mcp/tools/workflow-validation.utils.js +7 -1
  871. package/dist/modules/mcp/tools/workflow-validation.utils.js.map +1 -1
  872. package/dist/modules/mcp-registry/mcp-registry-refresh.task.d.ts +2 -3
  873. package/dist/modules/mcp-registry/mcp-registry-refresh.task.js +6 -6
  874. package/dist/modules/mcp-registry/mcp-registry-refresh.task.js.map +1 -1
  875. package/dist/modules/mcp-registry/registry/mcp-registry-server.repository.d.ts +3 -0
  876. package/dist/modules/mcp-registry/registry/mcp-registry-server.repository.js +22 -0
  877. package/dist/modules/mcp-registry/registry/mcp-registry-server.repository.js.map +1 -1
  878. package/dist/modules/mcp-registry/registry/mcp-registry.service.js +4 -3
  879. package/dist/modules/mcp-registry/registry/mcp-registry.service.js.map +1 -1
  880. package/dist/modules/mcp-registry/registry/mcp-registry.types.d.ts +1 -2
  881. package/dist/modules/n8n-packages/engine/import-blocked.error.js +1 -0
  882. package/dist/modules/n8n-packages/engine/import-blocked.error.js.map +1 -1
  883. package/dist/modules/n8n-packages/engine/import-orchestrator.d.ts +1 -0
  884. package/dist/modules/n8n-packages/engine/import-orchestrator.js +2 -0
  885. package/dist/modules/n8n-packages/engine/import-orchestrator.js.map +1 -1
  886. package/dist/modules/n8n-packages/engine/project-package-importer.js +22 -3
  887. package/dist/modules/n8n-packages/engine/project-package-importer.js.map +1 -1
  888. package/dist/modules/n8n-packages/entities/credential/credential.serializer.js.map +1 -1
  889. package/dist/modules/n8n-packages/entities/project/project-importer.js +1 -1
  890. package/dist/modules/n8n-packages/entities/project/project-importer.js.map +1 -1
  891. package/dist/modules/n8n-packages/entities/workflow/workflow-removal.types.d.ts +3 -1
  892. package/dist/modules/n8n-packages/entities/workflow/workflow-remover.d.ts +1 -0
  893. package/dist/modules/n8n-packages/entities/workflow/workflow-remover.js +46 -0
  894. package/dist/modules/n8n-packages/entities/workflow/workflow-remover.js.map +1 -1
  895. package/dist/modules/n8n-packages/io/directory/package-directory-inventory-reader.d.ts +2 -3
  896. package/dist/modules/n8n-packages/io/directory/package-directory-inventory-reader.js +7 -7
  897. package/dist/modules/n8n-packages/io/directory/package-directory-inventory-reader.js.map +1 -1
  898. package/dist/modules/n8n-packages/n8n-packages.service.d.ts +7 -1
  899. package/dist/modules/n8n-packages/n8n-packages.service.js +67 -7
  900. package/dist/modules/n8n-packages/n8n-packages.service.js.map +1 -1
  901. package/dist/modules/n8n-packages/n8n-packages.types.d.ts +23 -0
  902. package/dist/modules/n8n-packages/n8n-packages.types.js.map +1 -1
  903. package/dist/modules/n8n-packages/utils/import-package-upload.d.ts +3 -1
  904. package/dist/modules/n8n-packages/utils/import-package-upload.js +8 -3
  905. package/dist/modules/n8n-packages/utils/import-package-upload.js.map +1 -1
  906. package/dist/modules/oauth-jwe/oauth-jwe-decrypt.service.d.ts +1 -1
  907. package/dist/modules/oauth-jwe/oauth-jwe-decrypt.service.js +2 -2
  908. package/dist/modules/oauth-jwe/oauth-jwe-decrypt.service.js.map +1 -1
  909. package/dist/modules/oauth-jwe/oauth-jwe-key.service.js +2 -14
  910. package/dist/modules/oauth-jwe/oauth-jwe-key.service.js.map +1 -1
  911. package/dist/modules/oauth-jwe/oauth-jwe.constants.d.ts +1 -1
  912. package/dist/modules/oauth-jwe/oauth-jwe.constants.js +2 -1
  913. package/dist/modules/oauth-jwe/oauth-jwe.constants.js.map +1 -1
  914. package/dist/modules/oauth-server/oauth-consent.service.d.ts +1 -1
  915. package/dist/modules/oauth-server/oauth-consent.service.js +2 -2
  916. package/dist/modules/oauth-server/oauth-consent.service.js.map +1 -1
  917. package/dist/modules/oauth-server/oauth-flow.service.d.ts +1 -1
  918. package/dist/modules/oauth-server/oauth-flow.service.js +2 -2
  919. package/dist/modules/oauth-server/oauth-flow.service.js.map +1 -1
  920. package/dist/modules/oauth-server/oauth-server.service.d.ts +1 -1
  921. package/dist/modules/oauth-server/oauth-server.service.js +7 -2
  922. package/dist/modules/oauth-server/oauth-server.service.js.map +1 -1
  923. package/dist/modules/oauth-server/oauth-session.service.d.ts +21 -4
  924. package/dist/modules/oauth-server/oauth-session.service.js +11 -1
  925. package/dist/modules/oauth-server/oauth-session.service.js.map +1 -1
  926. package/dist/modules/oauth-server/oauth-token.service.d.ts +1 -1
  927. package/dist/modules/oauth-server/oauth-token.service.js +2 -2
  928. package/dist/modules/oauth-server/oauth-token.service.js.map +1 -1
  929. package/dist/modules/oauth-server/oauth.controller.d.ts +1 -1
  930. package/dist/modules/oauth-server/oauth.controller.js +3 -3
  931. package/dist/modules/oauth-server/oauth.controller.js.map +1 -1
  932. package/dist/modules/oauth-server/protected-resource-resolvers/chat-trigger-resource.resolver.d.ts +1 -1
  933. package/dist/modules/oauth-server/protected-resource-resolvers/chat-trigger-resource.resolver.js +2 -2
  934. package/dist/modules/oauth-server/protected-resource-resolvers/chat-trigger-resource.resolver.js.map +1 -1
  935. package/dist/modules/oauth-server/protected-resource-resolvers/chat-trigger-test-resource.resolver.d.ts +1 -1
  936. package/dist/modules/oauth-server/protected-resource-resolvers/chat-trigger-test-resource.resolver.js +2 -2
  937. package/dist/modules/oauth-server/protected-resource-resolvers/chat-trigger-test-resource.resolver.js.map +1 -1
  938. package/dist/modules/oauth-server/protected-resource-resolvers/form-trigger-resource.resolver.d.ts +1 -1
  939. package/dist/modules/oauth-server/protected-resource-resolvers/form-trigger-resource.resolver.js +2 -2
  940. package/dist/modules/oauth-server/protected-resource-resolvers/form-trigger-resource.resolver.js.map +1 -1
  941. package/dist/modules/oauth-server/protected-resource-resolvers/form-trigger-test-resource.resolver.d.ts +1 -1
  942. package/dist/modules/oauth-server/protected-resource-resolvers/form-trigger-test-resource.resolver.js +2 -2
  943. package/dist/modules/oauth-server/protected-resource-resolvers/form-trigger-test-resource.resolver.js.map +1 -1
  944. package/dist/modules/oauth-server/protected-resource-resolvers/utils.d.ts +1 -0
  945. package/dist/modules/oauth-server/protected-resource-resolvers/utils.js +6 -0
  946. package/dist/modules/oauth-server/protected-resource-resolvers/utils.js.map +1 -1
  947. package/dist/modules/oauth-server/protected-resource-resolvers/workflow-mcp-test-trigger-resource.resolver.d.ts +1 -1
  948. package/dist/modules/oauth-server/protected-resource-resolvers/workflow-mcp-test-trigger-resource.resolver.js +2 -2
  949. package/dist/modules/oauth-server/protected-resource-resolvers/workflow-mcp-test-trigger-resource.resolver.js.map +1 -1
  950. package/dist/modules/oauth-server/protected-resource-resolvers/workflow-mcp-trigger-resource.resolver.d.ts +1 -1
  951. package/dist/modules/oauth-server/protected-resource-resolvers/workflow-mcp-trigger-resource.resolver.js +2 -2
  952. package/dist/modules/oauth-server/protected-resource-resolvers/workflow-mcp-trigger-resource.resolver.js.map +1 -1
  953. package/dist/modules/oauth-server/protected-resource-resolvers/workflow-webhook-test-trigger-resource.resolver.d.ts +1 -1
  954. package/dist/modules/oauth-server/protected-resource-resolvers/workflow-webhook-test-trigger-resource.resolver.js +3 -2
  955. package/dist/modules/oauth-server/protected-resource-resolvers/workflow-webhook-test-trigger-resource.resolver.js.map +1 -1
  956. package/dist/modules/oauth-server/protected-resource-resolvers/workflow-webhook-trigger-resource.resolver.d.ts +1 -1
  957. package/dist/modules/oauth-server/protected-resource-resolvers/workflow-webhook-trigger-resource.resolver.js +3 -2
  958. package/dist/modules/oauth-server/protected-resource-resolvers/workflow-webhook-trigger-resource.resolver.js.map +1 -1
  959. package/dist/modules/otel/execution-level-tracer.d.ts +3 -1
  960. package/dist/modules/otel/execution-level-tracer.js +47 -2
  961. package/dist/modules/otel/execution-level-tracer.js.map +1 -1
  962. package/dist/modules/otel/execution-level-tracer.types.d.ts +18 -1
  963. package/dist/modules/otel/execution-level-tracer.types.js.map +1 -1
  964. package/dist/modules/otel/otel-lifecycle-handler.d.ts +6 -1
  965. package/dist/modules/otel/otel-lifecycle-handler.js +36 -6
  966. package/dist/modules/otel/otel-lifecycle-handler.js.map +1 -1
  967. package/dist/modules/otel/otel.constants.d.ts +2 -0
  968. package/dist/modules/otel/otel.constants.js +2 -0
  969. package/dist/modules/otel/otel.constants.js.map +1 -1
  970. package/dist/modules/otel/otel.module.js +2 -1
  971. package/dist/modules/otel/otel.module.js.map +1 -1
  972. package/dist/modules/policy-infrastructure/policy-decision-audit.js +15 -1
  973. package/dist/modules/policy-infrastructure/policy-decision-audit.js.map +1 -1
  974. package/dist/modules/promotions.ee/constants.d.ts +1 -0
  975. package/dist/modules/promotions.ee/constants.js +2 -1
  976. package/dist/modules/promotions.ee/constants.js.map +1 -1
  977. package/dist/modules/promotions.ee/promotion-binding-preflight.service.js +11 -0
  978. package/dist/modules/promotions.ee/promotion-binding-preflight.service.js.map +1 -1
  979. package/dist/modules/promotions.ee/promotion-change.service.js +4 -6
  980. package/dist/modules/promotions.ee/promotion-change.service.js.map +1 -1
  981. package/dist/modules/promotions.ee/promotion-changes.controller.js +1 -1
  982. package/dist/modules/promotions.ee/promotion-changes.controller.js.map +1 -1
  983. package/dist/modules/promotions.ee/promotions.module.js.map +1 -1
  984. package/dist/modules/promotions.ee/promotions.service.d.ts +10 -6
  985. package/dist/modules/promotions.ee/promotions.service.js +53 -23
  986. package/dist/modules/promotions.ee/promotions.service.js.map +1 -1
  987. package/dist/modules/redaction/executions/execution-redaction.interfaces.d.ts +1 -0
  988. package/dist/modules/redaction/executions/execution-redaction.service.d.ts +4 -1
  989. package/dist/modules/redaction/executions/execution-redaction.service.js +61 -13
  990. package/dist/modules/redaction/executions/execution-redaction.service.js.map +1 -1
  991. package/dist/modules/redaction/executions/strategies/full-item-redaction.strategy.js +5 -3
  992. package/dist/modules/redaction/executions/strategies/full-item-redaction.strategy.js.map +1 -1
  993. package/dist/modules/source-control.ee/source-control-import.service.ee.d.ts +2 -6
  994. package/dist/modules/source-control.ee/source-control-import.service.ee.js +24 -5
  995. package/dist/modules/source-control.ee/source-control-import.service.ee.js.map +1 -1
  996. package/dist/modules/source-control.ee/source-control.service.ee.js +13 -1
  997. package/dist/modules/source-control.ee/source-control.service.ee.js.map +1 -1
  998. package/dist/modules/source-control.ee/types/import-result.d.ts +7 -5
  999. package/dist/modules/sso-oidc/oidc.controller.ee.d.ts +4 -2
  1000. package/dist/modules/sso-oidc/oidc.controller.ee.js +7 -5
  1001. package/dist/modules/sso-oidc/oidc.controller.ee.js.map +1 -1
  1002. package/dist/modules/sso-oidc/oidc.service.ee.d.ts +4 -3
  1003. package/dist/modules/sso-oidc/oidc.service.ee.js +15 -6
  1004. package/dist/modules/sso-oidc/oidc.service.ee.js.map +1 -1
  1005. package/dist/modules/sso-saml/saml.controller.ee.d.ts +1 -1
  1006. package/dist/modules/sso-saml/saml.controller.ee.js +2 -2
  1007. package/dist/modules/sso-saml/saml.controller.ee.js.map +1 -1
  1008. package/dist/modules/sso-saml/saml.service.ee.d.ts +1 -1
  1009. package/dist/modules/sso-saml/saml.service.ee.js +2 -2
  1010. package/dist/modules/sso-saml/saml.service.ee.js.map +1 -1
  1011. package/dist/modules/sso-saml/service-provider.ee.js +4 -4
  1012. package/dist/modules/sso-saml/service-provider.ee.js.map +1 -1
  1013. package/dist/modules/token-exchange/controllers/embed-auth.controller.d.ts +1 -1
  1014. package/dist/modules/token-exchange/controllers/embed-auth.controller.js +2 -2
  1015. package/dist/modules/token-exchange/controllers/embed-auth.controller.js.map +1 -1
  1016. package/dist/modules/token-exchange/services/jti-cleanup.task.d.ts +2 -2
  1017. package/dist/modules/token-exchange/services/jti-cleanup.task.js +2 -5
  1018. package/dist/modules/token-exchange/services/jti-cleanup.task.js.map +1 -1
  1019. package/dist/modules/token-exchange/services/trusted-key-refresh.task.d.ts +2 -2
  1020. package/dist/modules/token-exchange/services/trusted-key-refresh.task.js +2 -5
  1021. package/dist/modules/token-exchange/services/trusted-key-refresh.task.js.map +1 -1
  1022. package/dist/modules/type-availability-policies/available-credential-types.controller.d.ts +10 -0
  1023. package/dist/modules/type-availability-policies/available-credential-types.controller.js +57 -0
  1024. package/dist/modules/type-availability-policies/available-credential-types.controller.js.map +1 -0
  1025. package/dist/modules/type-availability-policies/available-types.controller.js +1 -1
  1026. package/dist/modules/type-availability-policies/available-types.controller.js.map +1 -1
  1027. package/dist/modules/type-availability-policies/constants.js.map +1 -1
  1028. package/dist/modules/type-availability-policies/credential-type-policy-instance.controller.d.ts +38 -0
  1029. package/dist/modules/type-availability-policies/credential-type-policy-instance.controller.js +148 -0
  1030. package/dist/modules/type-availability-policies/credential-type-policy-instance.controller.js.map +1 -0
  1031. package/dist/modules/type-availability-policies/credential-type-policy-project.controller.d.ts +25 -0
  1032. package/dist/modules/type-availability-policies/credential-type-policy-project.controller.js +67 -0
  1033. package/dist/modules/type-availability-policies/credential-type-policy-project.controller.js.map +1 -0
  1034. package/dist/modules/type-availability-policies/credential-type-policy.check.d.ts +18 -0
  1035. package/dist/modules/type-availability-policies/credential-type-policy.check.js +98 -0
  1036. package/dist/modules/type-availability-policies/credential-type-policy.check.js.map +1 -0
  1037. package/dist/modules/type-availability-policies/database/repositories/type-availability-policy-scope.repository.d.ts +1 -0
  1038. package/dist/modules/type-availability-policies/database/repositories/type-availability-policy-scope.repository.js +7 -0
  1039. package/dist/modules/type-availability-policies/database/repositories/type-availability-policy-scope.repository.js.map +1 -1
  1040. package/dist/modules/type-availability-policies/node-type-policy.check.d.ts +1 -1
  1041. package/dist/modules/type-availability-policies/node-type-policy.check.js +5 -3
  1042. package/dist/modules/type-availability-policies/node-type-policy.check.js.map +1 -1
  1043. package/dist/modules/type-availability-policies/package-resolver.d.ts +3 -1
  1044. package/dist/modules/type-availability-policies/package-resolver.js +6 -0
  1045. package/dist/modules/type-availability-policies/package-resolver.js.map +1 -1
  1046. package/dist/modules/type-availability-policies/policy-evaluator.d.ts +8 -4
  1047. package/dist/modules/type-availability-policies/policy-evaluator.js +15 -15
  1048. package/dist/modules/type-availability-policies/policy-evaluator.js.map +1 -1
  1049. package/dist/modules/type-availability-policies/policy-shadow-lint.d.ts +2 -2
  1050. package/dist/modules/type-availability-policies/policy-shadow-lint.js +2 -2
  1051. package/dist/modules/type-availability-policies/policy-shadow-lint.js.map +1 -1
  1052. package/dist/modules/type-availability-policies/type-availability-policies.module.js +5 -1
  1053. package/dist/modules/type-availability-policies/type-availability-policies.module.js.map +1 -1
  1054. package/dist/modules/type-availability-policies/type-availability-policy-instance.controller.js +9 -9
  1055. package/dist/modules/type-availability-policies/type-availability-policy-instance.controller.js.map +1 -1
  1056. package/dist/modules/type-availability-policies/type-availability-policy-project.controller.js +2 -2
  1057. package/dist/modules/type-availability-policies/type-availability-policy-project.controller.js.map +1 -1
  1058. package/dist/modules/type-availability-policies/type-availability-policy.service.d.ts +4 -2
  1059. package/dist/modules/type-availability-policies/type-availability-policy.service.js +12 -9
  1060. package/dist/modules/type-availability-policies/type-availability-policy.service.js.map +1 -1
  1061. package/dist/modules/workflow-index/workflow-dependency-query.service.js +1 -1
  1062. package/dist/modules/workflow-index/workflow-dependency-query.service.js.map +1 -1
  1063. package/dist/node-execution/ephemeral-node-executor.js +5 -4
  1064. package/dist/node-execution/ephemeral-node-executor.js.map +1 -1
  1065. package/dist/node-types.d.ts +4 -1
  1066. package/dist/node-types.js.map +1 -1
  1067. package/dist/oauth/oauth.service.d.ts +1 -1
  1068. package/dist/oauth/oauth.service.js +7 -5
  1069. package/dist/oauth/oauth.service.js.map +1 -1
  1070. package/dist/policy/enforce-workflow-publish.d.ts +6 -0
  1071. package/dist/policy/enforce-workflow-publish.js +10 -0
  1072. package/dist/policy/enforce-workflow-publish.js.map +1 -0
  1073. package/dist/policy/policy-enforcement.service.js +4 -1
  1074. package/dist/policy/policy-enforcement.service.js.map +1 -1
  1075. package/dist/posthog/index.js +17 -5
  1076. package/dist/posthog/index.js.map +1 -1
  1077. package/dist/public-api/index.js +2 -2
  1078. package/dist/public-api/index.js.map +1 -1
  1079. package/dist/public-api/public-api-controller.registry.d.ts +1 -0
  1080. package/dist/public-api/public-api-controller.registry.js +18 -0
  1081. package/dist/public-api/public-api-controller.registry.js.map +1 -1
  1082. package/dist/public-api/public-api-route-resolver.d.ts +12 -9
  1083. package/dist/public-api/public-api-route-resolver.js +8 -5
  1084. package/dist/public-api/public-api-route-resolver.js.map +1 -1
  1085. package/dist/public-api/types.d.ts +8 -79
  1086. package/dist/public-api/v1/controllers/audit.public.controller.d.ts +9 -0
  1087. package/dist/public-api/v1/controllers/audit.public.controller.js +45 -0
  1088. package/dist/public-api/v1/controllers/audit.public.controller.js.map +1 -0
  1089. package/dist/public-api/v1/controllers/community-packages.public.controller.d.ts +12 -0
  1090. package/dist/public-api/v1/controllers/community-packages.public.controller.js +97 -0
  1091. package/dist/public-api/v1/controllers/community-packages.public.controller.js.map +1 -0
  1092. package/dist/public-api/v1/controllers/credential-type-policies.public.controller.d.ts +19 -0
  1093. package/dist/public-api/v1/controllers/credential-type-policies.public.controller.js +289 -0
  1094. package/dist/public-api/v1/controllers/credential-type-policies.public.controller.js.map +1 -0
  1095. package/dist/public-api/v1/controllers/credentials.public.controller.d.ts +5 -2
  1096. package/dist/public-api/v1/controllers/credentials.public.controller.js +37 -11
  1097. package/dist/public-api/v1/controllers/credentials.public.controller.js.map +1 -1
  1098. package/dist/public-api/v1/controllers/data-tables.public.controller.d.ts +17 -0
  1099. package/dist/public-api/v1/controllers/data-tables.public.controller.js +240 -0
  1100. package/dist/public-api/v1/controllers/data-tables.public.controller.js.map +1 -0
  1101. package/dist/public-api/v1/controllers/discover.public.controller.d.ts +6 -0
  1102. package/dist/public-api/v1/controllers/discover.public.controller.js +50 -0
  1103. package/dist/public-api/v1/controllers/discover.public.controller.js.map +1 -0
  1104. package/dist/public-api/v1/controllers/evaluations.public.controller.d.ts +22 -0
  1105. package/dist/public-api/v1/controllers/evaluations.public.controller.js +221 -0
  1106. package/dist/public-api/v1/controllers/evaluations.public.controller.js.map +1 -0
  1107. package/dist/public-api/v1/controllers/folders.public.controller.d.ts +8 -2
  1108. package/dist/public-api/v1/controllers/folders.public.controller.js +106 -2
  1109. package/dist/public-api/v1/controllers/folders.public.controller.js.map +1 -1
  1110. package/dist/public-api/v1/controllers/index.d.ts +9 -0
  1111. package/dist/public-api/v1/controllers/index.js +9 -0
  1112. package/dist/public-api/v1/controllers/index.js.map +1 -1
  1113. package/dist/public-api/v1/controllers/node-type-policies.public.controller.d.ts +10 -10
  1114. package/dist/public-api/v1/controllers/node-type-policies.public.controller.js +31 -31
  1115. package/dist/public-api/v1/controllers/node-type-policies.public.controller.js.map +1 -1
  1116. package/dist/public-api/v1/controllers/projects.public.controller.js +6 -2
  1117. package/dist/public-api/v1/controllers/projects.public.controller.js.map +1 -1
  1118. package/dist/public-api/v1/controllers/promotions.public.controller.d.ts +2 -1
  1119. package/dist/public-api/v1/controllers/promotions.public.controller.js +24 -1
  1120. package/dist/public-api/v1/controllers/promotions.public.controller.js.map +1 -1
  1121. package/dist/public-api/v1/controllers/security-policy.public.controller.d.ts +12 -0
  1122. package/dist/public-api/v1/controllers/security-policy.public.controller.js +81 -0
  1123. package/dist/public-api/v1/controllers/security-policy.public.controller.js.map +1 -0
  1124. package/dist/public-api/v1/controllers/sso-oidc.public.controller.d.ts +12 -0
  1125. package/dist/public-api/v1/controllers/sso-oidc.public.controller.js +84 -0
  1126. package/dist/public-api/v1/controllers/sso-oidc.public.controller.js.map +1 -0
  1127. package/dist/public-api/v1/controllers/users.public.controller.d.ts +17 -0
  1128. package/dist/public-api/v1/controllers/users.public.controller.js +161 -0
  1129. package/dist/public-api/v1/controllers/users.public.controller.js.map +1 -0
  1130. package/dist/public-api/v1/handlers/community-packages/community-packages.mapper.d.ts +2 -26
  1131. package/dist/public-api/v1/handlers/community-packages/community-packages.mapper.js +3 -7
  1132. package/dist/public-api/v1/handlers/community-packages/community-packages.mapper.js.map +1 -1
  1133. package/dist/public-api/v1/handlers/credentials/credentials.utils.js +7 -2
  1134. package/dist/public-api/v1/handlers/credentials/credentials.utils.js.map +1 -1
  1135. package/dist/public-api/v1/handlers/data-tables/data-tables.columns.handler.d.ts +0 -1
  1136. package/dist/public-api/v1/handlers/data-tables/data-tables.columns.handler.js +0 -9
  1137. package/dist/public-api/v1/handlers/data-tables/data-tables.columns.handler.js.map +1 -1
  1138. package/dist/public-api/v1/handlers/discover/discover.service.d.ts +2 -23
  1139. package/dist/public-api/v1/handlers/discover/discover.service.js +1 -1
  1140. package/dist/public-api/v1/handlers/discover/discover.service.js.map +1 -1
  1141. package/dist/public-api/v1/handlers/n8n-packages/n8n-packages.handler.d.ts +4 -0
  1142. package/dist/public-api/v1/handlers/n8n-packages/n8n-packages.handler.js +34 -0
  1143. package/dist/public-api/v1/handlers/n8n-packages/n8n-packages.handler.js.map +1 -1
  1144. package/dist/public-api/v1/openapi-gen/decorator-routes.d.ts +3 -0
  1145. package/dist/public-api/v1/openapi-gen/decorator-routes.js +2 -0
  1146. package/dist/public-api/v1/openapi-gen/decorator-routes.js.map +1 -1
  1147. package/dist/public-api/v1/openapi-gen/generate.js +16 -0
  1148. package/dist/public-api/v1/openapi-gen/generate.js.map +1 -1
  1149. package/dist/public-api/v1/openapi.yml +6480 -4544
  1150. package/dist/requests.d.ts +12 -11
  1151. package/dist/scaling/constants.d.ts +2 -2
  1152. package/dist/scaling/constants.js +3 -0
  1153. package/dist/scaling/constants.js.map +1 -1
  1154. package/dist/scaling/job-processor.js +1 -0
  1155. package/dist/scaling/job-processor.js.map +1 -1
  1156. package/dist/scaling/pubsub/pubsub.event-map.d.ts +18 -1
  1157. package/dist/scaling/pubsub/pubsub.types.d.ts +4 -1
  1158. package/dist/scaling/scaling.service.js +4 -4
  1159. package/dist/scaling/scaling.service.js.map +1 -1
  1160. package/dist/scaling/webhook-response-relay.d.ts +0 -2
  1161. package/dist/scaling/webhook-response-relay.js +2 -27
  1162. package/dist/scaling/webhook-response-relay.js.map +1 -1
  1163. package/dist/scheduling/durable-job-provisioner.d.ts +1 -2
  1164. package/dist/scheduling/durable-job-provisioner.js +75 -72
  1165. package/dist/scheduling/durable-job-provisioner.js.map +1 -1
  1166. package/dist/scheduling/schedule-trigger-node/schedule-trigger-task-handler.d.ts +3 -1
  1167. package/dist/scheduling/schedule-trigger-node/schedule-trigger-task-handler.js +5 -2
  1168. package/dist/scheduling/schedule-trigger-node/schedule-trigger-task-handler.js.map +1 -1
  1169. package/dist/scheduling/system-tasks/in-memory-system-task-runner.d.ts +39 -0
  1170. package/dist/scheduling/system-tasks/in-memory-system-task-runner.js +164 -0
  1171. package/dist/scheduling/system-tasks/in-memory-system-task-runner.js.map +1 -0
  1172. package/dist/scheduling/system-tasks/instance-system-tasks.d.ts +3 -0
  1173. package/dist/scheduling/system-tasks/instance-system-tasks.js +16 -0
  1174. package/dist/scheduling/system-tasks/instance-system-tasks.js.map +1 -0
  1175. package/dist/scheduling/system-tasks/main-system-tasks.js +6 -0
  1176. package/dist/scheduling/system-tasks/main-system-tasks.js.map +1 -1
  1177. package/dist/scheduling/system-tasks/system-task-job-registrar.js +3 -1
  1178. package/dist/scheduling/system-tasks/system-task-job-registrar.js.map +1 -1
  1179. package/dist/scheduling/system-tasks/system-task-run-observer.js +1 -3
  1180. package/dist/scheduling/system-tasks/system-task-run-observer.js.map +1 -1
  1181. package/dist/scheduling/system-tasks/system-task-runner.d.ts +10 -14
  1182. package/dist/scheduling/system-tasks/system-task-runner.js +85 -175
  1183. package/dist/scheduling/system-tasks/system-task-runner.js.map +1 -1
  1184. package/dist/scheduling/system-tasks/system-task-timer.d.ts +1 -0
  1185. package/dist/scheduling/system-tasks/system-task-timer.js +13 -3
  1186. package/dist/scheduling/system-tasks/system-task-timer.js.map +1 -1
  1187. package/dist/security-audit/constants.d.ts +1 -2
  1188. package/dist/security-audit/constants.js +2 -7
  1189. package/dist/security-audit/constants.js.map +1 -1
  1190. package/dist/security-audit/types.d.ts +5 -4
  1191. package/dist/services/ai-gateway.service.d.ts +1 -1
  1192. package/dist/services/ai-gateway.service.js +2 -2
  1193. package/dist/services/ai-gateway.service.js.map +1 -1
  1194. package/dist/services/ai-preference-write.d.ts +36 -0
  1195. package/dist/services/ai-preference-write.js +79 -0
  1196. package/dist/services/ai-preference-write.js.map +1 -0
  1197. package/dist/services/ai-preference.service.d.ts +17 -2
  1198. package/dist/services/ai-preference.service.js +72 -7
  1199. package/dist/services/ai-preference.service.js.map +1 -1
  1200. package/dist/services/ai-workflow-builder.service.d.ts +1 -1
  1201. package/dist/services/ai-workflow-builder.service.js +2 -2
  1202. package/dist/services/ai-workflow-builder.service.js.map +1 -1
  1203. package/dist/services/cache/cache.service.d.ts +1 -0
  1204. package/dist/services/cache/cache.service.js +7 -0
  1205. package/dist/services/cache/cache.service.js.map +1 -1
  1206. package/dist/services/engine-data-plane-proxy.service.js +1 -1
  1207. package/dist/services/engine-data-plane-proxy.service.js.map +1 -1
  1208. package/dist/services/engine-v2-dispatcher.service.js +14 -9
  1209. package/dist/services/engine-v2-dispatcher.service.js.map +1 -1
  1210. package/dist/services/engine-v2-payload-guard.service.js +1 -1
  1211. package/dist/services/engine-v2-payload-guard.service.js.map +1 -1
  1212. package/dist/services/engine-v2-webhook-responder.service.d.ts +21 -0
  1213. package/dist/services/engine-v2-webhook-responder.service.js +132 -0
  1214. package/dist/services/engine-v2-webhook-responder.service.js.map +1 -0
  1215. package/dist/services/free-ai-credits.service.d.ts +1 -0
  1216. package/dist/services/frontend.service.d.ts +1 -1
  1217. package/dist/services/frontend.service.js +9 -2
  1218. package/dist/services/frontend.service.js.map +1 -1
  1219. package/dist/services/ownership.service.d.ts +1 -0
  1220. package/dist/services/ownership.service.js +27 -10
  1221. package/dist/services/ownership.service.js.map +1 -1
  1222. package/dist/services/pending-webhook-response.d.ts +46 -0
  1223. package/dist/services/pending-webhook-response.js +27 -0
  1224. package/dist/services/pending-webhook-response.js.map +1 -0
  1225. package/dist/services/project.service.ee.d.ts +10 -4
  1226. package/dist/services/project.service.ee.js +66 -32
  1227. package/dist/services/project.service.ee.js.map +1 -1
  1228. package/dist/services/pruning/activity-pruning.task.d.ts +2 -3
  1229. package/dist/services/pruning/activity-pruning.task.js +6 -3
  1230. package/dist/services/pruning/activity-pruning.task.js.map +1 -1
  1231. package/dist/services/pruning/execution-pruning-soft-delete.task.d.ts +2 -2
  1232. package/dist/services/pruning/execution-pruning-soft-delete.task.js +2 -5
  1233. package/dist/services/pruning/execution-pruning-soft-delete.task.js.map +1 -1
  1234. package/dist/services/pruning/workflow-history-compaction-optimize.task.d.ts +2 -2
  1235. package/dist/services/pruning/workflow-history-compaction-optimize.task.js +2 -5
  1236. package/dist/services/pruning/workflow-history-compaction-optimize.task.js.map +1 -1
  1237. package/dist/services/pruning/workflow-history-compaction-trim.task.d.ts +2 -2
  1238. package/dist/services/pruning/workflow-history-compaction-trim.task.js +2 -5
  1239. package/dist/services/pruning/workflow-history-compaction-trim.task.js.map +1 -1
  1240. package/dist/services/user.service.d.ts +1 -1
  1241. package/dist/services/user.service.js +2 -2
  1242. package/dist/services/user.service.js.map +1 -1
  1243. package/dist/telemetry/index.d.ts +3 -3
  1244. package/dist/telemetry/index.js +21 -20
  1245. package/dist/telemetry/index.js.map +1 -1
  1246. package/dist/telemetry/telemetry-buffer-flush.task.d.ts +12 -0
  1247. package/dist/telemetry/telemetry-buffer-flush.task.js +36 -0
  1248. package/dist/telemetry/telemetry-buffer-flush.task.js.map +1 -0
  1249. package/dist/telemetry/telemetry-pulse.task.d.ts +14 -0
  1250. package/dist/telemetry/telemetry-pulse.task.js +35 -0
  1251. package/dist/telemetry/telemetry-pulse.task.js.map +1 -0
  1252. package/dist/user-management/email/user-management-mailer.d.ts +1 -1
  1253. package/dist/user-management/email/user-management-mailer.js +2 -2
  1254. package/dist/user-management/email/user-management-mailer.js.map +1 -1
  1255. package/dist/utils/validate-redirect-url.js +12 -0
  1256. package/dist/utils/validate-redirect-url.js.map +1 -1
  1257. package/dist/wait-tracker.d.ts +3 -1
  1258. package/dist/wait-tracker.js +5 -2
  1259. package/dist/wait-tracker.js.map +1 -1
  1260. package/dist/webhooks/engine-v2-webhooks.d.ts +8 -2
  1261. package/dist/webhooks/engine-v2-webhooks.js +51 -8
  1262. package/dist/webhooks/engine-v2-webhooks.js.map +1 -1
  1263. package/dist/webhooks/live-webhooks.d.ts +3 -1
  1264. package/dist/webhooks/live-webhooks.js +5 -2
  1265. package/dist/webhooks/live-webhooks.js.map +1 -1
  1266. package/dist/webhooks/test-webhooks.js +0 -1
  1267. package/dist/webhooks/test-webhooks.js.map +1 -1
  1268. package/dist/webhooks/webhook-helpers.d.ts +33 -6
  1269. package/dist/webhooks/webhook-helpers.js +280 -198
  1270. package/dist/webhooks/webhook-helpers.js.map +1 -1
  1271. package/dist/webhooks/webhook-responder.d.ts +16 -0
  1272. package/dist/webhooks/webhook-responder.js +29 -0
  1273. package/dist/webhooks/webhook-responder.js.map +1 -0
  1274. package/dist/webhooks/webhook.service.js +1 -0
  1275. package/dist/webhooks/webhook.service.js.map +1 -1
  1276. package/dist/workflow-execute-additional-data.js +11 -5
  1277. package/dist/workflow-execute-additional-data.js.map +1 -1
  1278. package/dist/workflow-helpers.d.ts +2 -2
  1279. package/dist/workflow-helpers.js +2 -1
  1280. package/dist/workflow-helpers.js.map +1 -1
  1281. package/dist/workflow-runner.d.ts +3 -1
  1282. package/dist/workflow-runner.js +14 -4
  1283. package/dist/workflow-runner.js.map +1 -1
  1284. package/dist/workflows/node-group-rules-flag-gate.d.ts +8 -0
  1285. package/dist/{modules/instance-ai/canvas-node-context-flag-gate.js → workflows/node-group-rules-flag-gate.js} +13 -15
  1286. package/dist/workflows/node-group-rules-flag-gate.js.map +1 -0
  1287. package/dist/workflows/publication/publication-status-reporter.d.ts +4 -2
  1288. package/dist/workflows/publication/publication-status-reporter.js +20 -12
  1289. package/dist/workflows/publication/publication-status-reporter.js.map +1 -1
  1290. package/dist/workflows/publication/workflow-publication-applier.js +5 -6
  1291. package/dist/workflows/publication/workflow-publication-applier.js.map +1 -1
  1292. package/dist/workflows/publication/workflow-publication-outbox-cleanup.service.js +2 -6
  1293. package/dist/workflows/publication/workflow-publication-outbox-cleanup.service.js.map +1 -1
  1294. package/dist/workflows/publication/workflow-publication-outbox-cleanup.task.d.ts +3 -3
  1295. package/dist/workflows/publication/workflow-publication-outbox-cleanup.task.js +7 -6
  1296. package/dist/workflows/publication/workflow-publication-outbox-cleanup.task.js.map +1 -1
  1297. package/dist/workflows/triggers/engine-v2-active-triggers.js +2 -2
  1298. package/dist/workflows/triggers/engine-v2-active-triggers.js.map +1 -1
  1299. package/dist/workflows/triggers/trigger-execution-context.factory.d.ts +4 -1
  1300. package/dist/workflows/triggers/trigger-execution-context.factory.js +15 -6
  1301. package/dist/workflows/triggers/trigger-execution-context.factory.js.map +1 -1
  1302. package/dist/workflows/workflow-creation.service.d.ts +3 -1
  1303. package/dist/workflows/workflow-creation.service.js +8 -3
  1304. package/dist/workflows/workflow-creation.service.js.map +1 -1
  1305. package/dist/workflows/workflow-execution.service.js +2 -1
  1306. package/dist/workflows/workflow-execution.service.js.map +1 -1
  1307. package/dist/workflows/workflow-finder.service.d.ts +5 -0
  1308. package/dist/workflows/workflow-finder.service.js +3 -0
  1309. package/dist/workflows/workflow-finder.service.js.map +1 -1
  1310. package/dist/workflows/workflow-publisher.service.d.ts +13 -0
  1311. package/dist/workflows/workflow-publisher.service.js +62 -0
  1312. package/dist/workflows/workflow-publisher.service.js.map +1 -0
  1313. package/dist/workflows/workflow-validation.service.d.ts +5 -1
  1314. package/dist/workflows/workflow-validation.service.js +23 -2
  1315. package/dist/workflows/workflow-validation.service.js.map +1 -1
  1316. package/dist/workflows/workflow.service.d.ts +4 -1
  1317. package/dist/workflows/workflow.service.js +28 -14
  1318. package/dist/workflows/workflow.service.js.map +1 -1
  1319. package/package.json +45 -42
  1320. package/dist/modules/agents/builder/resolve-integration.tool.d.ts +0 -8
  1321. package/dist/modules/agents/builder/resolve-integration.tool.js +0 -31
  1322. package/dist/modules/agents/builder/resolve-integration.tool.js.map +0 -1
  1323. package/dist/modules/agents/builder/search-mcp-servers.tool.d.ts +0 -6
  1324. package/dist/modules/agents/builder/search-mcp-servers.tool.js +0 -23
  1325. package/dist/modules/agents/builder/search-mcp-servers.tool.js.map +0 -1
  1326. package/dist/modules/agents/types/components.d.ts +0 -71
  1327. package/dist/modules/agents/types/components.js.map +0 -1
  1328. package/dist/modules/agents/types/index.d.ts +0 -1
  1329. package/dist/modules/agents/types/index.js.map +0 -1
  1330. package/dist/modules/breaking-changes/rules/v3/caller-policy-any-removed.rule.d.ts +0 -10
  1331. package/dist/modules/breaking-changes/rules/v3/caller-policy-any-removed.rule.js +0 -54
  1332. package/dist/modules/breaking-changes/rules/v3/caller-policy-any-removed.rule.js.map +0 -1
  1333. package/dist/modules/breaking-changes/rules/v3/caller-policy-default-any.rule.d.ts +0 -10
  1334. package/dist/modules/breaking-changes/rules/v3/caller-policy-default-any.rule.js +0 -64
  1335. package/dist/modules/breaking-changes/rules/v3/caller-policy-default-any.rule.js.map +0 -1
  1336. package/dist/modules/instance-ai/canvas-node-context-flag-gate.d.ts +0 -7
  1337. package/dist/modules/instance-ai/canvas-node-context-flag-gate.js.map +0 -1
  1338. package/dist/public-api/v1/handlers/audit/audit.handler.d.ts +0 -7
  1339. package/dist/public-api/v1/handlers/audit/audit.handler.js +0 -15
  1340. package/dist/public-api/v1/handlers/audit/audit.handler.js.map +0 -1
  1341. package/dist/public-api/v1/handlers/community-packages/community-packages.handler.d.ts +0 -23
  1342. package/dist/public-api/v1/handlers/community-packages/community-packages.handler.js +0 -45
  1343. package/dist/public-api/v1/handlers/community-packages/community-packages.handler.js.map +0 -1
  1344. package/dist/public-api/v1/handlers/data-tables/data-tables.handler.d.ts +0 -11
  1345. package/dist/public-api/v1/handlers/data-tables/data-tables.handler.js +0 -157
  1346. package/dist/public-api/v1/handlers/data-tables/data-tables.handler.js.map +0 -1
  1347. package/dist/public-api/v1/handlers/discover/discover.handler.d.ts +0 -12
  1348. package/dist/public-api/v1/handlers/discover/discover.handler.js +0 -29
  1349. package/dist/public-api/v1/handlers/discover/discover.handler.js.map +0 -1
  1350. package/dist/public-api/v1/handlers/evaluations/evaluations.handler.d.ts +0 -11
  1351. package/dist/public-api/v1/handlers/evaluations/evaluations.handler.js +0 -113
  1352. package/dist/public-api/v1/handlers/evaluations/evaluations.handler.js.map +0 -1
  1353. package/dist/public-api/v1/handlers/evaluations/evaluations.mapper.d.ts +0 -9
  1354. package/dist/public-api/v1/handlers/evaluations/evaluations.mapper.js +0 -34
  1355. package/dist/public-api/v1/handlers/evaluations/evaluations.mapper.js.map +0 -1
  1356. package/dist/public-api/v1/handlers/folders/folders.handler.d.ts +0 -17
  1357. package/dist/public-api/v1/handlers/folders/folders.handler.js +0 -89
  1358. package/dist/public-api/v1/handlers/folders/folders.handler.js.map +0 -1
  1359. package/dist/public-api/v1/handlers/security-policy/security-policy.handler.d.ts +0 -8
  1360. package/dist/public-api/v1/handlers/security-policy/security-policy.handler.js +0 -39
  1361. package/dist/public-api/v1/handlers/security-policy/security-policy.handler.js.map +0 -1
  1362. package/dist/public-api/v1/handlers/sso-oidc/sso-oidc.handler.d.ts +0 -8
  1363. package/dist/public-api/v1/handlers/sso-oidc/sso-oidc.handler.js +0 -38
  1364. package/dist/public-api/v1/handlers/sso-oidc/sso-oidc.handler.js.map +0 -1
  1365. package/dist/public-api/v1/handlers/sso-oidc/sso-oidc.mapper.d.ts +0 -5
  1366. package/dist/public-api/v1/handlers/sso-oidc/sso-oidc.mapper.js +0 -13
  1367. package/dist/public-api/v1/handlers/sso-oidc/sso-oidc.mapper.js.map +0 -1
  1368. package/dist/public-api/v1/handlers/users/users.handler.ee.d.ts +0 -18
  1369. package/dist/public-api/v1/handlers/users/users.handler.ee.js +0 -92
  1370. package/dist/public-api/v1/handlers/users/users.handler.ee.js.map +0 -1
  1371. package/dist/public-api/v1/handlers/users/users.mapper.d.ts +0 -12
  1372. package/dist/public-api/v1/handlers/users/users.mapper.js +0 -27
  1373. package/dist/public-api/v1/handlers/users/users.mapper.js.map +0 -1
  1374. package/dist/services/url.service.d.ts +0 -12
  1375. package/dist/services/url.service.js +0 -55
  1376. package/dist/services/url.service.js.map +0 -1
@@ -14,11 +14,15 @@ const agents_1 = require("@n8n/agents");
14
14
  const tool_1 = require("@n8n/agents/tool");
15
15
  const agent_config_1 = require("@n8n/ai-utilities/agent-config");
16
16
  const api_types_1 = require("@n8n/api-types");
17
+ const backend_common_1 = require("@n8n/backend-common");
17
18
  const backend_network_1 = require("@n8n/backend-network");
18
19
  const di_1 = require("@n8n/di");
20
+ const instance_ai_1 = require("@n8n/instance-ai");
19
21
  const zod_1 = require("zod");
20
22
  const credential_types_1 = require("../../../credential-types");
23
+ const collaboration_service_1 = require("../../../collaboration/collaboration.service");
21
24
  const conflict_error_1 = require("../../../errors/response-errors/conflict.error");
25
+ const locked_error_1 = require("../../../errors/response-errors/locked.error");
22
26
  const mcp_registry_service_1 = require("../../../modules/mcp-registry/registry/mcp-registry.service");
23
27
  const node_types_1 = require("../../../node-types");
24
28
  const oauth_service_1 = require("../../../oauth/oauth.service");
@@ -32,21 +36,19 @@ const ai_proxy_fetch_1 = require("../../../utils/ai-proxy-fetch");
32
36
  const agent_config_service_1 = require("../agent-config.service");
33
37
  const agent_custom_tools_service_1 = require("../agent-custom-tools.service");
34
38
  const agent_integration_persistence_service_1 = require("../agent-integration-persistence.service");
39
+ const instance_ai_agent_context_adapter_1 = require("../instance-ai-agent-context.adapter");
35
40
  const agent_publish_service_1 = require("../agent-publish.service");
36
41
  const agent_skills_service_1 = require("../agent-skills.service");
37
42
  const agent_task_service_1 = require("../agent-task.service");
38
43
  const agent_test_run_service_1 = require("../agent-test-run.service");
39
44
  const agents_tools_service_1 = require("../agents-tools.service");
40
45
  const agents_service_1 = require("../agents.service");
41
- const attachable_workflows_service_1 = require("../attachable-workflows.service");
42
46
  const agent_builder_preview_path_1 = require("./agent-builder-preview-path");
43
47
  const call_agent_failure_1 = require("./call-agent-failure");
44
48
  const builder_model_live_lookup_service_1 = require("./builder-model-live-lookup.service");
45
49
  const builder_tool_names_1 = require("./builder-tool-names");
46
50
  const get_resource_locator_options_tool_1 = require("./get-resource-locator-options.tool");
47
51
  const interactive_1 = require("./interactive");
48
- const resolve_integration_tool_1 = require("./resolve-integration.tool");
49
- const search_mcp_servers_tool_1 = require("./search-mcp-servers.tool");
50
52
  const skill_body_template_1 = require("./skill-body-template");
51
53
  const task_objective_template_1 = require("./task-objective-template");
52
54
  const verify_mcp_server_tool_1 = require("./verify-mcp-server.tool");
@@ -56,9 +58,14 @@ const agent_secure_runtime_1 = require("../runtime/agent-secure-runtime");
56
58
  const agent_config_hash_1 = require("../utils/agent-config-hash");
57
59
  const STALE_CONFIG_ERROR = {
58
60
  path: '(root)',
59
- message: 'Agent config changed since you last read it. Call read_config, then retry using the config and configHash it returns.',
61
+ message: 'Agent config changed. Call agent-context with type "config", then retry with its config and configHash.',
60
62
  };
61
- const STALE_SKILL_ERROR_MESSAGE = 'Skill changed since you last read it. Call read_skill, then retry using the skill and skillHash it returns.';
63
+ const AGENT_LOCKED_BY_EDITOR_ERROR = {
64
+ path: '(root)',
65
+ message: 'The agent is being edited by a user in the n8n builder right now, so it cannot be modified. ' +
66
+ 'Stop editing and tell the user to finish or close their editing session, then retry.',
67
+ };
68
+ const STALE_SKILL_ERROR_MESSAGE = 'Skill changed. Call agent-context with type "skill", then retry with its skill and skillHash.';
62
69
  const CLI_AGENT_CONFIG_MESSAGES = {
63
70
  emptyInstructionsFollowUp: 'saving the config again.',
64
71
  dynamicSelectorFollowUp: 'Load skill agent-builder-resource-locators, resolve a credential if missing, then call ' +
@@ -77,16 +84,6 @@ const createSkillInputSchema = zod_1.z
77
84
  .describe('Markdown-only supporting files under references/... paths. References are not automatically loaded; instructions must say exactly when to load each reference by path.'),
78
85
  })
79
86
  .strict();
80
- const readSkillInputSchema = zod_1.z
81
- .object({
82
- skillId: zod_1.z.string().min(1).describe('Persisted target-agent skill id to read.'),
83
- referencePaths: zod_1.z
84
- .array(zod_1.z.string().min(1))
85
- .max(api_types_1.AGENT_SKILL_REFERENCE_MAX_COUNT)
86
- .optional()
87
- .describe('Optional reference paths whose content is needed. Omit to receive paths and character counts only.'),
88
- })
89
- .strict();
90
87
  const updateSkillFieldsSchema = zod_1.z
91
88
  .object({
92
89
  name: api_types_1.agentSkillSchema.shape.name.optional(),
@@ -109,7 +106,7 @@ const updateSkillInputSchema = zod_1.z
109
106
  baseSkillHash: zod_1.z
110
107
  .string()
111
108
  .min(1)
112
- .describe('skillHash from the immediately preceding read_skill result for this skill.'),
109
+ .describe('skillHash from the immediately preceding agent-context with type "skill" result for this skill.'),
113
110
  updates: updateSkillFieldsSchema.describe('Only the fields to change. Pass null for allowedTools or references to remove that field; empty arrays are invalid.'),
114
111
  })
115
112
  .strict();
@@ -176,14 +173,14 @@ function applyPromptCachingBuilderDefaults(config) {
176
173
  };
177
174
  }
178
175
  let AgentsBuilderToolsService = class AgentsBuilderToolsService {
179
- constructor(agentsService, agentConfigService, agentCustomToolsService, agentIntegrationPersistenceService, agentSkillsService, secureRuntime, attachableWorkflowsService, agentsToolsService, builderModelLiveLookupService, mcpRegistryService, oauthService, credentialTypes, agentTaskService, agentPublishService, agentTestRunService, aiService, aiGatewayService, outboundHttp, dynamicNodeParametersService, nodeTypes, freeAiCreditsService, telemetry) {
176
+ constructor(logger, agentsService, agentConfigService, agentCustomToolsService, agentIntegrationPersistenceService, agentSkillsService, secureRuntime, agentsToolsService, builderModelLiveLookupService, mcpRegistryService, oauthService, credentialTypes, agentTaskService, agentPublishService, agentTestRunService, aiService, aiGatewayService, outboundHttp, dynamicNodeParametersService, nodeTypes, freeAiCreditsService, telemetry, agentContextAdapter, collaborationService) {
177
+ this.logger = logger;
180
178
  this.agentsService = agentsService;
181
179
  this.agentConfigService = agentConfigService;
182
180
  this.agentCustomToolsService = agentCustomToolsService;
183
181
  this.agentIntegrationPersistenceService = agentIntegrationPersistenceService;
184
182
  this.agentSkillsService = agentSkillsService;
185
183
  this.secureRuntime = secureRuntime;
186
- this.attachableWorkflowsService = attachableWorkflowsService;
187
184
  this.agentsToolsService = agentsToolsService;
188
185
  this.builderModelLiveLookupService = builderModelLiveLookupService;
189
186
  this.mcpRegistryService = mcpRegistryService;
@@ -199,6 +196,8 @@ let AgentsBuilderToolsService = class AgentsBuilderToolsService {
199
196
  this.nodeTypes = nodeTypes;
200
197
  this.freeAiCreditsService = freeAiCreditsService;
201
198
  this.telemetry = telemetry;
199
+ this.agentContextAdapter = agentContextAdapter;
200
+ this.collaborationService = collaborationService;
202
201
  }
203
202
  withConfigMutationMarker(tool, agentId) {
204
203
  const handler = tool.handler;
@@ -212,13 +211,26 @@ let AgentsBuilderToolsService = class AgentsBuilderToolsService {
212
211
  result !== null &&
213
212
  (('ok' in result && result.ok === true) ||
214
213
  ('configured' in result && result.configured === true) ||
215
- ('completed' in result && result.completed === true))) {
214
+ ('completed' in result && result.completed === true)) &&
215
+ (!('changed' in result) || result.changed !== false)) {
216
216
  return { ...result, configMutated: true, agentId };
217
217
  }
218
218
  return result;
219
219
  },
220
220
  };
221
221
  }
222
+ async getEditorLockFailure(agentId) {
223
+ try {
224
+ await this.collaborationService.ensureAgentEditable(agentId);
225
+ return null;
226
+ }
227
+ catch (error) {
228
+ if (error instanceof locked_error_1.LockedError) {
229
+ return { ok: false, errors: [AGENT_LOCKED_BY_EDITOR_ERROR] };
230
+ }
231
+ throw error;
232
+ }
233
+ }
222
234
  getTools(agentId, projectId, credentialProvider, credentialService, user, options) {
223
235
  return {
224
236
  json: this.getJsonTools(agentId, projectId, credentialProvider, credentialService, user, options),
@@ -233,206 +245,226 @@ let AgentsBuilderToolsService = class AgentsBuilderToolsService {
233
245
  ...(options?.runId ? { run_id: options.runId } : {}),
234
246
  ...properties,
235
247
  });
236
- const readConfigTool = new tool_1.Tool(builder_tool_names_1.BUILDER_TOOLS.READ_CONFIG)
237
- .description('Read the latest persisted agent configuration and its freshness token. ' +
238
- 'Returns { ok: true, config, configHash }. This is the only tool that returns the full config — ' +
239
- 'write_config, patch_config, and stale responses never echo it back. ' +
240
- 'Call this before every write_config or patch_config and use configHash as baseConfigHash.')
241
- .input(zod_1.z.object({}))
242
- .handler(async () => {
243
- try {
244
- const snapshot = await this.getConfigSnapshot(agentId, projectId);
245
- return { ok: true, ...snapshot };
246
- }
247
- catch (e) {
248
- return {
249
- ok: false,
250
- errors: [{ path: '(root)', message: e instanceof Error ? e.message : String(e) }],
251
- };
252
- }
253
- })
254
- .build();
255
- const writeConfigTool = new tool_1.Tool(builder_tool_names_1.BUILDER_TOOLS.WRITE_CONFIG)
256
- .description('Create or replace the agent configuration by writing a complete JSON string. ' +
257
- 'Requires baseConfigHash from the immediately preceding read_config result — never from a prior ' +
258
- 'write_config/patch_config success or from a stale response. ' +
259
- 'Returns { ok: true, configMutated: true, agentId } on success — no config, hash, or timestamps are returned; call ' +
260
- 'read_config again before any later inspection or mutation — or ' +
261
- '{ ok: false, stage, errors } with path, message, expected, received fields on failure. ' +
262
- 'On stage: "stale", call read_config and retry once using its fresh config and configHash.')
248
+ const writeConfigTool = this.buildWriteConfigTool(agentId, projectId, user);
249
+ const patchConfigTool = this.buildPatchConfigTool(agentId, projectId, user);
250
+ const publishAgentTool = this.buildPublishAgentTool(user, projectId, agentId);
251
+ const unpublishAgentTool = this.buildUnpublishAgentTool(user, projectId, agentId);
252
+ const callAgentTool = this.buildCallAgentTool(user, projectId, agentId, credentialProvider);
253
+ const modelLookup = this.createModelLookup(user, projectId, options);
254
+ const tools = [
255
+ this.withConfigMutationMarker(writeConfigTool, agentId),
256
+ this.withConfigMutationMarker(patchConfigTool, agentId),
257
+ this.withConfigMutationMarker(publishAgentTool, agentId),
258
+ this.withConfigMutationMarker(unpublishAgentTool, agentId),
259
+ callAgentTool,
260
+ this.createLlmTool(credentialProvider, modelLookup, user, projectId),
261
+ this.createCredentialTool(credentialService, projectId, agentId, track),
262
+ this.createEmbeddingCredentialTool(credentialService, projectId, track),
263
+ (0, interactive_1.buildAskQuestionsTool)({ track }),
264
+ this.withConfigMutationMarker(this.createConfigureChannelTool(agentId, projectId, track), agentId),
265
+ this.withConfigMutationMarker(this.createFinishSetupTool(credentialService, agentId, projectId, track), agentId),
266
+ this.createVerifyMcpServerTool(agentId, credentialProvider, projectId, user),
267
+ ];
268
+ return tools;
269
+ }
270
+ createVerifyMcpServerTool(agentId, credentialProvider, projectId, user) {
271
+ return (0, verify_mcp_server_tool_1.buildVerifyMcpServerTool)({
272
+ agentId,
273
+ credentialProvider,
274
+ oauthService: this.oauthService,
275
+ projectId,
276
+ proxyFetch: (0, ai_proxy_fetch_1.createAiMcpFetch)(this.outboundHttp),
277
+ resolveRegistryConnection: async (nodeTypeName) => await this.mcpRegistryService.getConnection(nodeTypeName),
278
+ applyCredentialToMcpServer: async (serverName, credentialId) => await this.applyCredentialToMcpServer(agentId, projectId, serverName, credentialId, user),
279
+ });
280
+ }
281
+ createFinishSetupTool(credentialService, agentId, projectId, track) {
282
+ return (0, interactive_1.buildFinishSetupTool)({
283
+ credentialService,
284
+ agentId,
285
+ projectId,
286
+ track,
287
+ isCredentialTypeKnown: (credentialType) => this.credentialTypes.recognizes(credentialType),
288
+ listIntegrationCredentialIds: async () => {
289
+ const agent = await this.agentsService.findById(agentId, projectId);
290
+ return (agent?.integrations ?? [])
291
+ .filter((integration) => (0, api_types_1.isCredentialAgentIntegration)(integration) && !(0, api_types_1.isDraftIntegration)(integration))
292
+ .map((integration) => integration.credentialId);
293
+ },
294
+ listChatIntegrationTypes: () => this.agentIntegrationPersistenceService
295
+ .listChatIntegrations()
296
+ .map((integration) => integration.type),
297
+ listAiGatewayManagedCredentialTypes: async () => {
298
+ const agent = await this.agentsService.findById(agentId, projectId);
299
+ return (0, reconcile_node_tool_gateway_credentials_1.listAiGatewayManagedCredentialTypes)(agent?.schema?.tools, this.nodeTypes);
300
+ },
301
+ });
302
+ }
303
+ createConfigureChannelTool(agentId, projectId, track) {
304
+ return (0, interactive_1.buildConfigureChannelTool)({
305
+ agentId,
306
+ projectId,
307
+ listChatIntegrationTypes: () => this.agentIntegrationPersistenceService
308
+ .listChatIntegrations()
309
+ .map((integration) => integration.type),
310
+ track,
311
+ });
312
+ }
313
+ createEmbeddingCredentialTool(credentialService, projectId, track) {
314
+ return (0, interactive_1.buildAskEmbeddingCredentialTool)({
315
+ credentialService,
316
+ projectId,
317
+ isCredentialTypeKnown: (credentialType) => this.credentialTypes.recognizes(credentialType),
318
+ isAssistantProxyEnabled: () => this.aiService.isProxyEnabled(),
319
+ track,
320
+ });
321
+ }
322
+ createCredentialTool(credentialService, projectId, agentId, track) {
323
+ return (0, interactive_1.buildAskCredentialTool)({
324
+ credentialService,
325
+ projectId,
326
+ isCredentialTypeKnown: (credentialType) => this.credentialTypes.recognizes(credentialType),
327
+ listIntegrationCredentialIds: async () => {
328
+ const agent = await this.agentsService.findById(agentId, projectId);
329
+ return (agent?.integrations ?? [])
330
+ .filter((integration) => (0, api_types_1.isCredentialAgentIntegration)(integration) && !(0, api_types_1.isDraftIntegration)(integration))
331
+ .map((integration) => integration.credentialId);
332
+ },
333
+ track,
334
+ });
335
+ }
336
+ createLlmTool(credentialProvider, modelLookup, user, projectId) {
337
+ return (0, interactive_1.buildResolveLlmTool)({
338
+ credentialProvider,
339
+ modelLookup,
340
+ isProviderServedByGateway: async (provider) => {
341
+ try {
342
+ return (await this.aiGatewayService.getCredentialTypeForProvider(provider)) !== undefined;
343
+ }
344
+ catch {
345
+ return false;
346
+ }
347
+ },
348
+ freeCredits: {
349
+ isEligible: () => this.freeAiCreditsService.isEligible(user),
350
+ claim: async () => {
351
+ const credential = await this.freeAiCreditsService.claim(user, projectId);
352
+ this.telemetry.track('User claimed OpenAI credits', {
353
+ user_id: user.id,
354
+ source: 'agentBuilderResolveLlm',
355
+ });
356
+ return { credentialId: credential.id, credentialName: credential.name };
357
+ },
358
+ },
359
+ });
360
+ }
361
+ buildCallAgentTool(user, projectId, agentId, credentialProvider) {
362
+ return new tool_1.Tool(builder_tool_names_1.BUILDER_TOOLS.CALL_AGENT)
363
+ .description('Tests the draft agent through built-in Preview chat. It does not test configured channel integrations, including their triggers, platform context, message delivery, or replies. ' +
364
+ 'Pass the returned sessionId on later calls to continue the same conversation; omit it to start a new one. ' +
365
+ 'The draft uses its real configured tools and credentials, so external side effects are possible. ' +
366
+ 'Standard tool approvals pause this test until the user approves or rejects them in chat. ' +
367
+ 'Unsupported interactive requests return approval_required with a Preview path.')
263
368
  .input(zod_1.z.object({
264
- json: zod_1.z.string().describe('Complete agent configuration as a JSON string'),
265
- baseConfigHash: zod_1.z
369
+ message: zod_1.z.string().trim().min(1).describe('Message to send to the target agent'),
370
+ sessionId: zod_1.z
266
371
  .string()
267
- .nullable()
268
- .describe('configHash from the immediately preceding read_config result; null only if no config exists'),
372
+ .trim()
373
+ .min(1)
374
+ .optional()
375
+ .describe('Session ID from a previous call_agent result'),
269
376
  }))
270
- .handler(async ({ json, baseConfigHash }) => {
271
- const parsed = (0, api_types_1.tryParseConfigJson)(json);
272
- if (!parsed.ok) {
273
- return { ok: false, errors: parsed.errors };
274
- }
275
- let snapshot;
276
- try {
277
- snapshot = await this.getConfigSnapshot(agentId, projectId);
278
- }
279
- catch (e) {
377
+ .suspend(tool_1.APPROVAL_SUSPEND_SCHEMA)
378
+ .resume(tool_1.APPROVAL_RESUME_SCHEMA)
379
+ .handler(async ({ message, sessionId }, ctx) => {
380
+ if (!(await (0, check_access_1.userHasScopes)(user, ['agent:execute'], false, { projectId }))) {
280
381
  return {
281
- ok: false,
282
- stage: 'stale',
283
- errors: [{ path: '(root)', message: e instanceof Error ? e.message : String(e) }],
382
+ status: 'error',
383
+ code: 'forbidden',
384
+ message: 'You do not have permission to run agents in this project.',
284
385
  };
285
386
  }
286
- if (baseConfigHash !== snapshot.configHash) {
287
- return { ok: false, stage: 'stale', errors: [STALE_CONFIG_ERROR] };
288
- }
289
- const zodResult = parseBuilderWriteConfig(parsed.data, snapshot.config);
290
- if (!zodResult.success) {
291
- return { ok: false, errors: (0, api_types_1.formatZodErrors)(zodResult.error) };
292
- }
293
- const emptyInstructions = (0, agent_config_1.rejectIfEmptyInstructions)(zodResult.data, CLI_AGENT_CONFIG_MESSAGES);
294
- if (emptyInstructions) {
295
- return { ok: false, errors: emptyInstructions };
296
- }
297
- const unsupportedNativeWebSearch = (0, agent_config_1.rejectIfUnsupportedNativeWebSearch)(zodResult.data);
298
- if (unsupportedNativeWebSearch) {
299
- return { ok: false, errors: unsupportedNativeWebSearch };
300
- }
301
- const dynamicSelectorFromAi = (0, agent_config_1.rejectIfDynamicSelectorUsesFromAi)(zodResult.data, snapshot.config, this.nodeTypes, CLI_AGENT_CONFIG_MESSAGES);
302
- if (dynamicSelectorFromAi) {
303
- return { ok: false, errors: dynamicSelectorFromAi };
304
- }
305
- const configWithDefaults = applyPromptCachingBuilderDefaults((0, agent_config_1.applyNativeWebSearchDefaultOn)(zodResult.data));
387
+ const previewPath = (0, agent_builder_preview_path_1.buildAgentPreviewPath)(projectId, agentId);
306
388
  try {
307
- await this.agentConfigService.updateConfig(agentId, projectId, configWithDefaults, user, { baseConfigHash: snapshot.configHash, modifiedBy: 'builder' });
308
- return { ok: true };
389
+ const result = await this.runDraftTest(ctx, agentId, projectId, message, sessionId, credentialProvider, user);
390
+ return await this.formatDraftTestResult(result, ctx, agentId, user, previewPath);
309
391
  }
310
- catch (e) {
311
- return {
312
- ok: false,
313
- stage: e instanceof conflict_error_1.ConflictError ? 'stale' : 'schema',
314
- errors: [{ path: '(root)', message: e instanceof Error ? e.message : String(e) }],
315
- };
392
+ catch (error) {
393
+ if (ctx.abortSignal ? ctx.abortSignal.aborted : (0, agents_1.isAbortError)(error))
394
+ throw error;
395
+ if (error instanceof agent_test_run_service_1.InvalidAgentTestRunCheckpointError) {
396
+ return {
397
+ status: 'error',
398
+ code: error.code,
399
+ message: error.message,
400
+ };
401
+ }
402
+ const { code, message } = (0, call_agent_failure_1.describeCallAgentFailure)(error instanceof Error ? error.message : 'Agent test run failed.');
403
+ return { status: 'error', code, message };
316
404
  }
317
405
  })
318
406
  .build();
319
- const patchConfigTool = new tool_1.Tool(builder_tool_names_1.BUILDER_TOOLS.PATCH_CONFIG)
320
- .description('Apply RFC 6902 JSON Patch operations to the current agent configuration. ' +
321
- 'Pass an array of patch operations as a JSON string. ' +
322
- 'Requires baseConfigHash from the immediately preceding read_config result — never from a prior ' +
323
- 'write_config/patch_config success or from a stale response. ' +
324
- 'Supported ops: add, remove, replace, move, copy, test. ' +
325
- 'Returns { ok: true, configMutated: true, agentId } on success — no config, hash, or timestamps are returned; call ' +
326
- 'read_config again before any later inspection or mutation — or ' +
327
- '{ ok: false, stage, errors } on failure. ' +
328
- 'stage is "parse", "stale", "patch", or "schema". On stage: "stale", call read_config and retry ' +
329
- 'once using its fresh config and configHash.')
330
- .input(zod_1.z.object({
331
- operations: zod_1.z.string().describe('RFC 6902 JSON Patch operations array as a JSON string'),
332
- baseConfigHash: zod_1.z
333
- .string()
334
- .nullable()
335
- .describe('configHash from the immediately preceding read_config result; null only if no config exists'),
336
- }))
337
- .handler(async ({ operations, baseConfigHash, }) => {
338
- const parsedOps = (0, api_types_1.tryParseConfigJson)(operations);
339
- if (!parsedOps.ok) {
340
- return { ok: false, stage: 'parse', errors: parsedOps.errors };
341
- }
342
- let snapshot;
343
- try {
344
- snapshot = await this.getConfigSnapshot(agentId, projectId);
345
- }
346
- catch (e) {
347
- return {
348
- ok: false,
349
- stage: 'stale',
350
- errors: [{ path: '(root)', message: e instanceof Error ? e.message : String(e) }],
351
- };
352
- }
353
- if (baseConfigHash !== snapshot.configHash) {
354
- return { ok: false, stage: 'stale', errors: [STALE_CONFIG_ERROR] };
355
- }
356
- if (!snapshot.config) {
357
- return {
358
- ok: false,
359
- stage: 'patch',
360
- errors: [{ path: '(root)', message: 'Agent has no JSON config yet.' }],
361
- };
362
- }
363
- const jsonpatch = (await import('fast-json-patch')).default;
364
- const ops = parsedOps.data;
365
- const patchError = jsonpatch.validate(ops, snapshot.config);
366
- if (patchError) {
367
- const opPath = patchError.operation?.path ?? '(root)';
407
+ }
408
+ async runDraftTest(ctx, agentId, projectId, message, sessionId, credentialProvider, user) {
409
+ let result;
410
+ if (ctx.resumeData === undefined) {
411
+ result = await this.agentTestRunService.executeDraftRun({
412
+ agentId,
413
+ projectId,
414
+ message,
415
+ sessionId,
416
+ credentialProvider,
417
+ user,
418
+ source: 'instance-ai',
419
+ ...(ctx.abortSignal ? { abortSignal: ctx.abortSignal } : {}),
420
+ });
421
+ }
422
+ else {
423
+ result = await this.agentTestRunService.resumeDraftApproval({
424
+ agentId,
425
+ projectId,
426
+ continuation: ctx.continuation,
427
+ approved: ctx.resumeData.approved,
428
+ user,
429
+ source: 'instance-ai',
430
+ ...(ctx.abortSignal ? { abortSignal: ctx.abortSignal } : {}),
431
+ });
432
+ }
433
+ return result;
434
+ }
435
+ buildUnpublishAgentTool(user, projectId, agentId) {
436
+ return new tool_1.Tool(builder_tool_names_1.BUILDER_TOOLS.UNPUBLISH_AGENT)
437
+ .description('Unpublish this target agent: clears the live version while preserving the draft, disconnects chat ' +
438
+ 'integrations, and stops scheduled tasks. Call when the user asks to unpublish or take the agent offline. ' +
439
+ 'Returns { ok: true, configMutated: true, agentId, activeVersionId: null } or { ok: false, errors }.')
440
+ .input(zod_1.z.object({}))
441
+ .handler(async () => {
442
+ if (!(await (0, check_access_1.userHasScopes)(user, ['agent:unpublish'], false, { projectId }))) {
368
443
  return {
369
444
  ok: false,
370
- stage: 'patch',
371
- errors: [{ path: opPath, message: patchError.message ?? 'Invalid patch operation' }],
445
+ errors: [
446
+ { message: 'You do not have permission to unpublish agents in this project.' },
447
+ ],
372
448
  };
373
449
  }
374
- const patched = jsonpatch.applyPatch(jsonpatch.deepClone(snapshot.config), ops)
375
- .newDocument;
376
- const zodResult = parseBuilderWriteConfig(patched, snapshot.config);
377
- if (!zodResult.success) {
378
- return { ok: false, stage: 'schema', errors: (0, api_types_1.formatZodErrors)(zodResult.error) };
379
- }
380
- const emptyInstructions = (0, agent_config_1.rejectIfEmptyInstructions)(zodResult.data, CLI_AGENT_CONFIG_MESSAGES);
381
- if (emptyInstructions) {
382
- return { ok: false, stage: 'schema', errors: emptyInstructions };
383
- }
384
- const unsupportedNativeWebSearch = (0, agent_config_1.rejectIfUnsupportedNativeWebSearch)(zodResult.data);
385
- if (unsupportedNativeWebSearch) {
386
- return { ok: false, stage: 'schema', errors: unsupportedNativeWebSearch };
387
- }
388
- const dynamicSelectorFromAi = (0, agent_config_1.rejectIfDynamicSelectorUsesFromAi)(zodResult.data, snapshot.config, this.nodeTypes, CLI_AGENT_CONFIG_MESSAGES);
389
- if (dynamicSelectorFromAi) {
390
- return { ok: false, stage: 'schema', errors: dynamicSelectorFromAi };
391
- }
392
- const configWithDefaults = applyPromptCachingBuilderDefaults((0, agent_config_1.applyNativeWebSearchDefaultOn)(zodResult.data));
450
+ const editorLock = await this.getEditorLockFailure(agentId);
451
+ if (editorLock)
452
+ return editorLock;
393
453
  try {
394
- await this.agentConfigService.updateConfig(agentId, projectId, configWithDefaults, user, { baseConfigHash: snapshot.configHash, modifiedBy: 'builder' });
395
- return { ok: true };
454
+ await this.agentPublishService.unpublishAgent(agentId, projectId, user, 'builder');
455
+ return { ok: true, agentId, activeVersionId: null };
396
456
  }
397
457
  catch (e) {
398
458
  return {
399
459
  ok: false,
400
- stage: e instanceof conflict_error_1.ConflictError ? 'stale' : 'schema',
401
- errors: [{ path: '(root)', message: e instanceof Error ? e.message : String(e) }],
460
+ errors: [{ message: e instanceof Error ? e.message : String(e) }],
402
461
  };
403
462
  }
404
463
  })
405
464
  .build();
406
- const listIntegrationTypesTool = new tool_1.Tool(builder_tool_names_1.BUILDER_TOOLS.LIST_INTEGRATION_TYPES)
407
- .description("List integration types that can be added to the agent's `integrations` array. " +
408
- 'Returns every available chat platform with the list of ' +
409
- 'credential types it supports (`credentialTypes: string[]`) and builder guidance ' +
410
- '(`capabilities`, `useIntegrationWhen`, `useNodeToolWhen`). ' +
411
- 'Use that guidance to decide whether the user needs a chat integration or a node tool. ' +
412
- 'For a chat integration, pass the selected integration `type` to `configure_channel`; ' +
413
- 'never use `ask_credential` for chat-channel credentials.')
414
- .input(zod_1.z.object({}))
415
- .handler(async () => this.agentIntegrationPersistenceService.listChatIntegrations())
416
- .build();
417
- const listSubAgentsTool = new tool_1.Tool(builder_tool_names_1.BUILDER_TOOLS.LIST_SUB_AGENTS)
418
- .description('List agents in the same project that can be added to the target agent as subagents. ' +
419
- 'Excludes the target agent itself. Use before asking the user which subagents to add. ' +
420
- 'Returned `agentId` values are the only valid values to write into `subAgents.agents[].agentId`; ' +
421
- 'write parent-owned routing guidance into `subAgents.agents[].useWhen`; ask a follow-up first when it is unclear when that parent should use the subagent.')
422
- .input(zod_1.z.object({}))
423
- .handler(async () => {
424
- const agents = await this.agentsService.findByProjectId(projectId);
425
- return {
426
- agents: agents
427
- .filter((agent) => agent.id !== agentId)
428
- .map((agent) => ({
429
- agentId: agent.id,
430
- name: agent.name,
431
- })),
432
- };
433
- })
434
- .build();
435
- const publishAgentTool = new tool_1.Tool(builder_tool_names_1.BUILDER_TOOLS.PUBLISH_AGENT)
465
+ }
466
+ buildPublishAgentTool(user, projectId, agentId) {
467
+ return new tool_1.Tool(builder_tool_names_1.BUILDER_TOOLS.PUBLISH_AGENT)
436
468
  .description('Publish this target agent so it becomes live: integrations sync and scheduled tasks start running. ' +
437
469
  'Idempotent when the draft is already the active published version. Pass optional `versionId` to ' +
438
470
  'activate an existing history row instead of publishing the current draft. Call only when the user ' +
@@ -452,13 +484,23 @@ let AgentsBuilderToolsService = class AgentsBuilderToolsService {
452
484
  errors: [{ message: 'You do not have permission to publish agents in this project.' }],
453
485
  };
454
486
  }
487
+ const editorLock = await this.getEditorLockFailure(agentId);
488
+ if (editorLock)
489
+ return editorLock;
455
490
  try {
491
+ const before = await this.agentsService.findById(agentId, projectId);
492
+ const beforeActiveVersionId = before?.activeVersionId;
493
+ const beforeVersionId = before?.versionId;
456
494
  const { agent } = await this.agentPublishService.publishAgent(agentId, projectId, user, { by: 'builder', trigger: 'explicit' }, versionId);
457
495
  return {
458
496
  ok: true,
459
497
  agentId,
460
498
  activeVersionId: agent.activeVersionId,
461
499
  versionId: agent.versionId,
500
+ ...(beforeActiveVersionId === agent.activeVersionId &&
501
+ beforeVersionId === agent.versionId
502
+ ? { changed: false }
503
+ : {}),
462
504
  };
463
505
  }
464
506
  catch (e) {
@@ -469,366 +511,148 @@ let AgentsBuilderToolsService = class AgentsBuilderToolsService {
469
511
  }
470
512
  })
471
513
  .build();
472
- const unpublishAgentTool = new tool_1.Tool(builder_tool_names_1.BUILDER_TOOLS.UNPUBLISH_AGENT)
473
- .description('Unpublish this target agent: clears the live version while preserving the draft, disconnects chat ' +
474
- 'integrations, and stops scheduled tasks. Call when the user asks to unpublish or take the agent offline. ' +
475
- 'Returns { ok: true, configMutated: true, agentId, activeVersionId: null } or { ok: false, errors }.')
476
- .input(zod_1.z.object({}))
477
- .handler(async () => {
478
- if (!(await (0, check_access_1.userHasScopes)(user, ['agent:unpublish'], false, { projectId }))) {
479
- return {
480
- ok: false,
481
- errors: [
482
- { message: 'You do not have permission to unpublish agents in this project.' },
483
- ],
484
- };
485
- }
486
- try {
487
- await this.agentPublishService.unpublishAgent(agentId, projectId, user, 'builder');
488
- return { ok: true, agentId, activeVersionId: null };
489
- }
490
- catch (e) {
491
- return {
492
- ok: false,
493
- errors: [{ message: e instanceof Error ? e.message : String(e) }],
494
- };
495
- }
496
- })
514
+ }
515
+ buildPatchConfigTool(agentId, projectId, user) {
516
+ return new tool_1.Tool(builder_tool_names_1.BUILDER_TOOLS.PATCH_CONFIG)
517
+ .description('Apply RFC 6902 JSON Patch operations to the current agent configuration. ' +
518
+ 'Pass an array of patch operations as a JSON string. ' +
519
+ 'Requires baseConfigHash from the immediately preceding agent-context with type "config" result — never from a prior ' +
520
+ 'write_config/patch_config success or from a stale response. ' +
521
+ 'Supported ops: add, remove, replace, move, copy, test. ' +
522
+ 'Returns { ok: true, configMutated: true, agentId } on success — no config, hash, or timestamps are returned; call ' +
523
+ 'agent-context with type "config" again before any later inspection or mutation — or ' +
524
+ '{ ok: false, stage, errors } on failure. ' +
525
+ 'stage is "locked", "parse", "stale", "patch", or "schema". On stage: "stale", call agent-context with type "config" and retry ' +
526
+ 'once using its fresh config and configHash. On stage: "locked", stop and tell the user to close ' +
527
+ 'their editing session in the n8n builder.')
528
+ .input(zod_1.z.object({
529
+ operations: zod_1.z.string().describe('RFC 6902 JSON Patch operations array as a JSON string'),
530
+ baseConfigHash: zod_1.z
531
+ .string()
532
+ .nullable()
533
+ .describe('configHash from the immediately preceding agent-context with type "config" result; null only if no config exists'),
534
+ }))
535
+ .handler(async ({ operations, baseConfigHash, }) => await this.patchBuilderConfig(agentId, projectId, user, operations, baseConfigHash))
497
536
  .build();
498
- const callAgentTool = new tool_1.Tool(builder_tool_names_1.BUILDER_TOOLS.CALL_AGENT)
499
- .description('Tests the draft agent through built-in Preview chat. It does not test configured channel integrations, including their triggers, platform context, message delivery, or replies. ' +
500
- 'Pass the returned sessionId on later calls to continue the same conversation; omit it to start a new one. ' +
501
- 'The draft uses its real configured tools and credentials, so external side effects are possible. ' +
502
- 'Standard tool approvals pause this test until the user approves or rejects them in chat. ' +
503
- 'Unsupported interactive requests return approval_required with a Preview path.')
537
+ }
538
+ buildWriteConfigTool(agentId, projectId, user) {
539
+ return new tool_1.Tool(builder_tool_names_1.BUILDER_TOOLS.WRITE_CONFIG)
540
+ .description('Create or replace the agent configuration by writing a complete JSON string. ' +
541
+ 'Requires baseConfigHash from the immediately preceding agent-context with type "config" result — never from a prior ' +
542
+ 'write_config/patch_config success or from a stale response. ' +
543
+ 'Returns { ok: true, configMutated: true, agentId } on success — no config, hash, or timestamps are returned; call ' +
544
+ 'agent-context with type "config" again before any later inspection or mutation — or ' +
545
+ '{ ok: false, stage, errors } with path, message, expected, received fields on failure. ' +
546
+ 'On stage: "stale", call agent-context with type "config" and retry once using its fresh config and configHash.')
504
547
  .input(zod_1.z.object({
505
- message: zod_1.z.string().trim().min(1).describe('Message to send to the target agent'),
506
- sessionId: zod_1.z
548
+ json: zod_1.z.string().describe('Complete agent configuration as a JSON string'),
549
+ baseConfigHash: zod_1.z
507
550
  .string()
508
- .trim()
509
- .min(1)
510
- .optional()
511
- .describe('Session ID from a previous call_agent result'),
551
+ .nullable()
552
+ .describe('configHash from the immediately preceding agent-context with type "config" result; null only if no config exists'),
512
553
  }))
513
- .suspend(tool_1.APPROVAL_SUSPEND_SCHEMA)
514
- .resume(tool_1.APPROVAL_RESUME_SCHEMA)
515
- .handler(async ({ message, sessionId }, ctx) => {
516
- if (!(await (0, check_access_1.userHasScopes)(user, ['agent:execute'], false, { projectId }))) {
517
- return {
518
- status: 'error',
519
- code: 'forbidden',
520
- message: 'You do not have permission to run agents in this project.',
521
- };
522
- }
523
- const previewPath = (0, agent_builder_preview_path_1.buildAgentPreviewPath)(projectId, agentId);
524
- try {
525
- let result;
526
- if (ctx.resumeData === undefined) {
527
- result = await this.agentTestRunService.executeDraftRun({
528
- agentId,
529
- projectId,
530
- message,
531
- sessionId,
532
- credentialProvider,
533
- user,
534
- source: 'instance-ai',
535
- ...(ctx.abortSignal ? { abortSignal: ctx.abortSignal } : {}),
536
- });
537
- }
538
- else {
539
- result = await this.agentTestRunService.resumeDraftApproval({
540
- agentId,
541
- projectId,
542
- continuation: ctx.continuation,
543
- approved: ctx.resumeData.approved,
544
- user,
545
- source: 'instance-ai',
546
- ...(ctx.abortSignal ? { abortSignal: ctx.abortSignal } : {}),
547
- });
548
- }
549
- if (result.status === 'session_not_found') {
550
- return {
551
- status: 'error',
552
- code: 'session_not_found',
553
- message: 'Session not found.',
554
- };
555
- }
556
- if (result.status === 'agent_misconfigured') {
557
- return {
558
- status: 'error',
559
- code: 'agent_misconfigured',
560
- message: "This agent isn't ready to run yet. Finish configuring it and try again.",
561
- missing: result.missing,
562
- };
563
- }
564
- if (result.status === 'completed')
565
- return result;
566
- const approvals = (0, agent_test_run_service_1.collectStandardApprovals)(result);
567
- const firstApproval = approvals?.[0];
568
- if (firstApproval) {
569
- const { continuation, ...approval } = firstApproval;
570
- return await ctx.suspend(approval, { continuation });
571
- }
572
- const cancelled = await this.agentTestRunService.cancelSuspendedRuns({
573
- agentId,
574
- suspensions: result.suspensions,
575
- userId: user.id,
576
- });
577
- if (!cancelled) {
578
- return {
579
- status: 'error',
580
- code: 'cancellation_failed',
581
- message: 'This test needs approval, but its suspended run could not be cancelled. Open Preview before continuing this session.',
582
- sessionId: result.sessionId,
583
- previewPath,
584
- };
585
- }
586
- return {
587
- status: 'approval_required',
588
- response: result.response,
589
- sessionId: result.sessionId,
590
- ...(result.executionId ? { executionId: result.executionId } : {}),
591
- suspensions: result.suspensions.map(({ runId, toolCallId, toolName }) => ({
592
- runId,
593
- toolCallId,
594
- toolName,
595
- })),
596
- previewPath,
597
- };
598
- }
599
- catch (error) {
600
- if (ctx.abortSignal ? ctx.abortSignal.aborted : (0, agents_1.isAbortError)(error))
601
- throw error;
602
- if (error instanceof agent_test_run_service_1.InvalidAgentTestRunCheckpointError) {
603
- return {
604
- status: 'error',
605
- code: error.code,
606
- message: error.message,
607
- };
608
- }
609
- const { code, message } = (0, call_agent_failure_1.describeCallAgentFailure)(error instanceof Error ? error.message : 'Agent test run failed.');
610
- return { status: 'error', code, message };
611
- }
612
- })
554
+ .handler(async ({ json, baseConfigHash }) => await this.writeBuilderConfig(agentId, projectId, user, json, baseConfigHash))
613
555
  .build();
614
- const modelLookup = {
615
- list: async (credentialId, credentialType, provider) => await this.builderModelLiveLookupService.list(user, projectId, credentialId, credentialType, provider, { useEvalModelCatalog: options?.useEvalModelCatalog === true }),
616
- };
617
- const tools = [
618
- readConfigTool,
619
- this.withConfigMutationMarker(writeConfigTool, agentId),
620
- this.withConfigMutationMarker(patchConfigTool, agentId),
621
- listIntegrationTypesTool,
622
- listSubAgentsTool,
623
- this.withConfigMutationMarker(publishAgentTool, agentId),
624
- this.withConfigMutationMarker(unpublishAgentTool, agentId),
625
- callAgentTool,
626
- (0, interactive_1.buildResolveLlmTool)({
627
- credentialProvider,
628
- modelLookup,
629
- isProviderServedByGateway: async (provider) => {
630
- try {
631
- return ((await this.aiGatewayService.getCredentialTypeForProvider(provider)) !== undefined);
632
- }
633
- catch {
634
- return false;
635
- }
636
- },
637
- freeCredits: {
638
- isEligible: () => this.freeAiCreditsService.isEligible(user),
639
- claim: async () => {
640
- const credential = await this.freeAiCreditsService.claim(user, projectId);
641
- this.telemetry.track('User claimed OpenAI credits', {
642
- user_id: user.id,
643
- source: 'agentBuilderResolveLlm',
644
- });
645
- return { credentialId: credential.id, credentialName: credential.name };
646
- },
647
- },
648
- }),
649
- (0, interactive_1.buildAskCredentialTool)({
650
- credentialService,
651
- projectId,
652
- isCredentialTypeKnown: (credentialType) => this.credentialTypes.recognizes(credentialType),
653
- listIntegrationCredentialIds: async () => {
654
- const agent = await this.agentsService.findById(agentId, projectId);
655
- return (agent?.integrations ?? [])
656
- .filter((integration) => !(0, api_types_1.isDraftIntegration)(integration))
657
- .map((integration) => integration.credentialId);
658
- },
659
- track,
660
- }),
661
- (0, interactive_1.buildAskEmbeddingCredentialTool)({
662
- credentialService,
663
- projectId,
664
- isCredentialTypeKnown: (credentialType) => this.credentialTypes.recognizes(credentialType),
665
- isAssistantProxyEnabled: () => this.aiService.isProxyEnabled(),
666
- track,
556
+ }
557
+ getSharedTools(agentId, projectId, credentialProvider, user) {
558
+ const buildCustomToolTool = this.buildCustomToolTool(agentId, projectId, user);
559
+ const createSkillsTool = this.buildCreateSkillsTool(agentId, projectId, user);
560
+ const updateSkillTool = this.buildUpdateSkillTool(agentId, projectId, user);
561
+ const updateTaskTool = this.buildUpdateTaskTool(agentId, projectId, user);
562
+ const createTasksTool = this.buildCreateTasksTool(agentId, projectId, user);
563
+ return [
564
+ (0, instance_ai_1.createAgentContextTool)({
565
+ reader: this.agentContextAdapter.createReader(user, projectId),
566
+ resolveDefaultAgentId: async () => agentId,
567
+ logger: this.logger,
667
568
  }),
668
- (0, interactive_1.buildAskQuestionsTool)({ track }),
669
- this.withConfigMutationMarker((0, interactive_1.buildConfigureChannelTool)({
670
- agentId,
671
- projectId,
672
- listChatIntegrationTypes: () => this.agentIntegrationPersistenceService
673
- .listChatIntegrations()
674
- .map((integration) => integration.type),
675
- track,
676
- }), agentId),
677
- this.withConfigMutationMarker((0, interactive_1.buildFinishSetupTool)({
678
- credentialService,
679
- agentId,
680
- projectId,
681
- track,
682
- isCredentialTypeKnown: (credentialType) => this.credentialTypes.recognizes(credentialType),
683
- listIntegrationCredentialIds: async () => {
684
- const agent = await this.agentsService.findById(agentId, projectId);
685
- return (agent?.integrations ?? [])
686
- .filter((integration) => !(0, api_types_1.isDraftIntegration)(integration))
687
- .map((integration) => integration.credentialId);
688
- },
689
- listChatIntegrationTypes: () => this.agentIntegrationPersistenceService
690
- .listChatIntegrations()
691
- .map((integration) => integration.type),
692
- listAiGatewayManagedCredentialTypes: async () => {
693
- const agent = await this.agentsService.findById(agentId, projectId);
694
- return (0, reconcile_node_tool_gateway_credentials_1.listAiGatewayManagedCredentialTypes)(agent?.schema?.tools, this.nodeTypes);
695
- },
696
- }), agentId),
697
- (0, verify_mcp_server_tool_1.buildVerifyMcpServerTool)({
698
- agentId,
699
- credentialProvider,
700
- oauthService: this.oauthService,
569
+ this.withConfigMutationMarker(buildCustomToolTool, agentId),
570
+ this.withConfigMutationMarker(createSkillsTool, agentId),
571
+ this.withConfigMutationMarker(updateSkillTool, agentId),
572
+ this.withConfigMutationMarker(createTasksTool, agentId),
573
+ this.withConfigMutationMarker(updateTaskTool, agentId),
574
+ (0, get_resource_locator_options_tool_1.buildGetResourceLocatorOptionsTool)({
575
+ dynamicNodeParametersService: this.dynamicNodeParametersService,
576
+ nodeTypes: this.nodeTypes,
577
+ user,
701
578
  projectId,
702
- proxyFetch: (0, ai_proxy_fetch_1.createAiMcpFetch)(this.outboundHttp),
703
- resolveRegistryConnection: async (nodeTypeName) => await this.mcpRegistryService.getConnection(nodeTypeName),
704
- applyCredentialToMcpServer: async (serverName, credentialId) => await this.applyCredentialToMcpServer(agentId, projectId, serverName, credentialId, user),
705
- }),
706
- (0, search_mcp_servers_tool_1.buildSearchMcpServersTool)({ mcpRegistryService: this.mcpRegistryService }),
707
- (0, resolve_integration_tool_1.buildResolveIntegrationTool)({
708
- mcpRegistryService: this.mcpRegistryService,
709
- agentsToolsService: this.agentsToolsService,
710
579
  }),
580
+ ...this.agentsToolsService.getSharedTools(credentialProvider, 'Read-only inspection of available credentials. Use ask_credential to let the user ' +
581
+ 'pick the credential to wire into a node tool — never copy ids from this list directly ' +
582
+ 'into the config.'),
711
583
  ];
712
- return tools;
713
584
  }
714
- getSharedTools(agentId, projectId, credentialProvider, user) {
715
- const buildCustomToolTool = new tool_1.Tool(builder_tool_names_1.BUILDER_TOOLS.BUILD_CUSTOM_TOOL)
716
- .description('Compile and store a custom tool. Pass the complete TypeScript source ' +
717
- 'using `export default new Tool(...)` builder chain. The code is validated in a ' +
718
- 'sandbox and saved against the agent. The returned `id` equals the tool name ' +
719
- 'declared in the code (e.g. `new Tool("my_tool")` → id `"my_tool"`). ' +
720
- 'This does NOT register the tool in the agent config — follow up with ' +
721
- 'patch_config (or write_config) to add `{ type: "custom", id: "<tool name>" }` ' +
722
- 'to `tools`.' +
723
- 'Returns { ok: true, id, name } or { ok: false, errors }.')
585
+ buildCreateTasksTool(agentId, projectId, user) {
586
+ return new tool_1.Tool(builder_tool_names_1.BUILDER_TOOLS.CREATE_TASKS)
587
+ .description('Create one or more recurring scheduled tasks for the target agent (name + objective + cron ' +
588
+ 'schedule per task) in a single call. Pass every task you currently know how to write in one ' +
589
+ "`tasks` array — do not spread multiple fully-specified tasks across separate calls; each task's " +
590
+ 'objective field carries its own structured template. The whole batch is all-or-nothing: an ' +
591
+ 'invalid cron or objective rejects every task in the call. This adds a `{ type: "task", id, ' +
592
+ 'enabled }` ref per task to the agent config (config.tasks) and each task starts running once ' +
593
+ 'the agent is (re)published via `publish_agent`. Returns { ok: true, configMutated: true, agentId, tasks: [{ id, name, enabled }, ...] } (same ' +
594
+ 'order as input, objectives and crons are not echoed back) or { ok: false, errors }.')
595
+ .systemInstruction('Never create a task with a vague, broad, or placeholder objective, an objective missing any ' +
596
+ 'required section, or an unclear schedule. Each objective must follow the required structured ' +
597
+ 'Markdown template (Objective, Context, Steps, Output, Constraints, Success criteria) with every ' +
598
+ 'section filled in with concrete, run-specific content. Agent Instructions still apply and ' +
599
+ 'configured Skills remain available during scheduled runs, so never repeat universal rules or ' +
600
+ "copy reusable procedures into an objective. If anything is ambiguous, derive it from the user's goal as " +
601
+ 'stated assumptions listed in your summary; ask the user clarifying questions with ask_questions ' +
602
+ 'only when even a reasonable assumption is impossible, before calling ' +
603
+ 'create_tasks. A task can only use tools the agent already has: if any step in an objective ' +
604
+ 'requires a tool, integration, or web search the agent is missing, you MUST add it to the agent ' +
605
+ 'config (patch_config/write_config) BEFORE calling create_tasks — otherwise the task will fail at ' +
606
+ 'runtime. Batch every task you currently know how to write into one call.')
724
607
  .input(zod_1.z.object({
725
- code: zod_1.z
726
- .string()
727
- .describe('Complete TypeScript source using export default new Tool(...)'),
608
+ tasks: zod_1.z
609
+ .array(zod_1.z.object({
610
+ name: api_types_1.agentTaskSchema.shape.name.describe('Short, human-readable task name.'),
611
+ objective: api_types_1.agentTaskSchema.shape.objective.describe(task_objective_template_1.TASK_OBJECTIVE_GUIDANCE),
612
+ cronExpression: api_types_1.agentTaskSchema.shape.cronExpression.describe('A 5-field cron expression for when the task runs, e.g. "0 9 * * 1-5" = weekdays at 09:00.'),
613
+ timezone: api_types_1.agentTaskSchema.shape.timezone.describe('IANA timezone the cron runs in, e.g. "Europe/London". Set it when the user names a timezone or a location; omit it to use the instance timezone.'),
614
+ }))
615
+ .min(1)
616
+ .max(20)
617
+ .describe('Every task to create, in the order they should be created.'),
728
618
  }))
729
- .handler(async ({ code }, ctx) => {
619
+ .handler(async ({ tasks, }) => {
620
+ const editorLock = await this.getEditorLockFailure(agentId);
621
+ if (editorLock)
622
+ return editorLock;
623
+ let created;
730
624
  try {
731
- const descriptor = await this.secureRuntime.describeToolSecurely(code);
732
- const built = await this.agentCustomToolsService.buildCustomTool(agentId, projectId, code, descriptor, { user, modifiedBy: 'builder' });
733
- return { ok: true, id: built.id, name: descriptor.name };
625
+ created = await this.agentTaskService.createTasks(agentId, projectId, tasks.map((task) => ({ ...task, enabled: true })), { user, modifiedBy: 'builder' });
734
626
  }
735
627
  catch (e) {
736
- if (ctx.abortSignal ? ctx.abortSignal.aborted : (0, agents_1.isAbortError)(e))
737
- throw e;
738
628
  return {
739
629
  ok: false,
740
630
  errors: [{ message: e instanceof Error ? e.message : String(e) }],
741
631
  };
742
632
  }
633
+ return {
634
+ ok: true,
635
+ tasks: created.map(({ id, name }) => ({ id, name, enabled: true })),
636
+ };
743
637
  })
744
638
  .build();
745
- const createSkillsTool = new tool_1.Tool(builder_tool_names_1.BUILDER_TOOLS.CREATE_SKILLS)
746
- .description('Create and store one or more agent skills (reusable, load-on-demand capabilities) in a ' +
747
- 'single call. Pass every skill you currently know how to write in one `skills` array — do ' +
748
- "not spread multiple fully-specified skills across separate calls; each skill's instructions " +
749
- 'field carries its own structured template. The whole batch is all-or-nothing: an invalid or ' +
750
- 'duplicate-named skill rejects every skill in the call. This does NOT attach the skills to the ' +
751
- 'agent config; follow up with read_config and patch_config (or write_config) to add a ' +
752
- '`{ type: "skill", id }` entry per skill to `skills`. Returns { ok: true, skills: [{ id, name }, ' +
753
- '...] } (same order as input, bodies are not echoed back) or { ok: false, errors }.')
754
- .systemInstruction('Never create a vague or placeholder skill. The description field is the routing contract the ' +
755
- 'runtime uses to decide when to load the skill; the instructions must follow the required ' +
756
- 'structured Markdown template (Overview, Inputs, Steps, Rules, Example, Gotchas) with each ' +
757
- 'applicable section filled in with concrete, specific content. If you do not have enough domain ' +
758
- "detail to write a genuinely useful skill, derive it from the user's goal as stated assumptions " +
759
- 'listed in your summary; ask the user clarifying questions only when even a reasonable ' +
760
- 'assumption is impossible. Use allowedTools only with exact target-agent tool names. Use references ' +
761
- 'only for markdown supporting files under the references/ directory — references are not ' +
762
- 'automatically loaded, so instructions must say exactly when to load each one by path; scripts and ' +
763
- 'non-markdown linked files are not supported. Do not invent tool names or reference paths. Batch ' +
764
- 'every skill you currently know how to write into one call.')
765
- .input(zod_1.z.object({
766
- skills: zod_1.z
767
- .array(createSkillInputSchema)
768
- .min(1)
769
- .max(20)
770
- .describe('Every skill to create, in the order they should be created.'),
771
- }))
772
- .handler(async ({ skills }) => {
639
+ }
640
+ buildUpdateTaskTool(agentId, projectId, user) {
641
+ return new tool_1.Tool(builder_tool_names_1.BUILDER_TOOLS.UPDATE_TASK)
642
+ .description('Update selected body fields of an existing target-agent scheduled task in place, preserving ' +
643
+ 'its id and config reference. Returns { ok: true, id, name, configMutated: true, agentId } ' +
644
+ 'or { ok: false, errors }.')
645
+ .input(updateTaskInputSchema)
646
+ .handler(async ({ taskId, updates }) => {
647
+ const editorLock = await this.getEditorLockFailure(agentId);
648
+ if (editorLock)
649
+ return editorLock;
773
650
  try {
774
- const created = await this.agentSkillsService.createSkills(agentId, projectId, skills, {
651
+ const { task, changed } = await this.agentTaskService.updateWithChange(agentId, projectId, taskId, updates, {
775
652
  user,
776
653
  modifiedBy: 'builder',
777
654
  });
778
- return {
779
- ok: true,
780
- skills: created.map(({ id, skill }) => ({ id, name: skill.name })),
781
- };
782
- }
783
- catch (e) {
784
- return {
785
- ok: false,
786
- errors: [{ message: e instanceof Error ? e.message : String(e) }],
787
- };
788
- }
789
- })
790
- .build();
791
- const readSkillTool = new tool_1.Tool(builder_tool_names_1.BUILDER_TOOLS.READ_SKILL)
792
- .description('Read an existing target-agent skill by id. The response includes its instructions, but ' +
793
- 'references are returned as { path, characterCount } metadata by default to keep context small. ' +
794
- 'Pass only the referencePaths whose content you need. Returns { ok: true, id, skill, skillHash } or ' +
795
- '{ ok: false, errors }. Call this before every update_skill and use skillHash as baseSkillHash.')
796
- .input(readSkillInputSchema)
797
- .handler(async ({ skillId, referencePaths = [] }) => {
798
- try {
799
- const skill = await this.agentSkillsService.getSkill(agentId, projectId, skillId);
800
- const skillHash = (0, agent_config_hash_1.getAgentSkillHash)(skill);
801
- const { references, ...body } = skill;
802
- const requestedPaths = new Set(referencePaths);
803
- const knownPaths = new Set(references?.map((reference) => reference.path) ?? []);
804
- const missingPaths = referencePaths.filter((path) => !knownPaths.has(path));
805
- if (missingPaths.length > 0) {
806
- return {
807
- ok: false,
808
- errors: [
809
- {
810
- message: `Reference path${missingPaths.length === 1 ? '' : 's'} not found: ${missingPaths.join(', ')}`,
811
- },
812
- ],
813
- };
814
- }
815
- return {
816
- ok: true,
817
- id: skillId,
818
- skillHash,
819
- skill: {
820
- ...body,
821
- ...(references
822
- ? {
823
- references: references.map((reference) => ({
824
- path: reference.path,
825
- characterCount: reference.content.length,
826
- ...(requestedPaths.has(reference.path) ? { content: reference.content } : {}),
827
- })),
828
- }
829
- : {}),
830
- },
831
- };
655
+ return { ok: true, id: task.id, name: task.name, ...(changed ? {} : { changed }) };
832
656
  }
833
657
  catch (e) {
834
658
  return {
@@ -838,40 +662,20 @@ let AgentsBuilderToolsService = class AgentsBuilderToolsService {
838
662
  }
839
663
  })
840
664
  .build();
841
- const listSkillsTool = new tool_1.Tool(builder_tool_names_1.BUILDER_TOOLS.LIST_SKILLS)
842
- .description('List lightweight metadata for persisted target-agent skills. Use this to identify which ' +
843
- 'existing skill owns a capability before reading or creating a skill. Returns ' +
844
- '{ ok: true, skills: [{ id, name, description }] } or { ok: false, errors }.')
845
- .input(zod_1.z.object({}).strict())
846
- .handler(async () => {
847
- try {
848
- const skills = await this.agentSkillsService.listSkills(agentId, projectId);
849
- return {
850
- ok: true,
851
- skills: Object.entries(skills).map(([id, skill]) => ({
852
- id,
853
- name: skill.name,
854
- description: skill.description,
855
- })),
856
- };
857
- }
858
- catch (e) {
859
- return {
860
- ok: false,
861
- errors: [{ message: e instanceof Error ? e.message : String(e) }],
862
- };
863
- }
864
- })
865
- .build();
866
- const updateSkillTool = new tool_1.Tool(builder_tool_names_1.BUILDER_TOOLS.UPDATE_SKILL)
665
+ }
666
+ buildUpdateSkillTool(agentId, projectId, user) {
667
+ return new tool_1.Tool(builder_tool_names_1.BUILDER_TOOLS.UPDATE_SKILL)
867
668
  .description('Update selected fields of an existing target-agent skill in place, preserving its id and ' +
868
- 'agent config reference. Requires baseSkillHash from the immediately preceding read_skill ' +
669
+ 'agent config reference. Requires baseSkillHash from the immediately preceding agent-context with type "skill" ' +
869
670
  'result. Pass null for allowedTools to remove the tool restriction, or null ' +
870
671
  'for references to remove all references; empty arrays are invalid. Returns ' +
871
672
  '{ ok: true, id, name, configMutated: true, agentId } or { ok: false, errors }. On a stale ' +
872
- 'skill error, call read_skill and retry once with its fresh skillHash.')
673
+ 'skill error, call agent-context with type "skill" and retry once with its fresh skillHash.')
873
674
  .input(updateSkillInputSchema)
874
675
  .handler(async ({ skillId, baseSkillHash, updates }) => {
676
+ const editorLock = await this.getEditorLockFailure(agentId);
677
+ if (editorLock)
678
+ return editorLock;
875
679
  const { allowedTools, references, ...requiredUpdates } = updates;
876
680
  const normalizedUpdates = {
877
681
  ...requiredUpdates,
@@ -880,62 +684,64 @@ let AgentsBuilderToolsService = class AgentsBuilderToolsService {
880
684
  };
881
685
  try {
882
686
  const updated = await this.agentSkillsService.updateSkill(agentId, projectId, skillId, normalizedUpdates, { user, modifiedBy: 'builder' }, baseSkillHash);
883
- return { ok: true, id: updated.id, name: updated.skill.name };
884
- }
885
- catch (e) {
886
- const message = e instanceof Error ? e.message : String(e);
887
- return {
888
- ok: false,
889
- errors: [{ message: e instanceof conflict_error_1.ConflictError ? STALE_SKILL_ERROR_MESSAGE : message }],
890
- };
891
- }
892
- })
893
- .build();
894
- const listTasksTool = new tool_1.Tool(builder_tool_names_1.BUILDER_TOOLS.LIST_TASKS)
895
- .description('List the target agent scheduled tasks, including each persisted body and whether its ' +
896
- 'current config reference is enabled. Use this to identify a task before updating it. Returns ' +
897
- '{ ok: true, tasks: [{ id, name, objective, cronExpression, timezone, enabled }] } or ' +
898
- '{ ok: false, errors }.')
899
- .input(zod_1.z.object({}).strict())
900
- .handler(async () => {
901
- try {
902
- const agent = await this.agentsService.findById(agentId, projectId);
903
- if (!agent)
904
- throw new Error('Agent not found');
905
- const tasks = await this.agentTaskService.list(agentId);
906
- const enabledByTaskId = new Map(((0, agent_config_composition_1.composeJsonConfig)(agent)?.tasks ?? []).map((task) => [task.id, task.enabled]));
907
687
  return {
908
688
  ok: true,
909
- tasks: tasks.map(({ id, name, objective, cronExpression, timezone }) => ({
910
- id,
911
- name,
912
- objective,
913
- cronExpression,
914
- timezone,
915
- enabled: enabledByTaskId.get(id) ?? false,
916
- })),
689
+ id: updated.id,
690
+ name: updated.skill.name,
691
+ ...(updated.skillHash === baseSkillHash ? { changed: false } : {}),
917
692
  };
918
693
  }
919
694
  catch (e) {
695
+ const message = e instanceof Error ? e.message : String(e);
920
696
  return {
921
697
  ok: false,
922
- errors: [{ message: e instanceof Error ? e.message : String(e) }],
698
+ errors: [{ message: e instanceof conflict_error_1.ConflictError ? STALE_SKILL_ERROR_MESSAGE : message }],
923
699
  };
924
700
  }
925
701
  })
926
702
  .build();
927
- const updateTaskTool = new tool_1.Tool(builder_tool_names_1.BUILDER_TOOLS.UPDATE_TASK)
928
- .description('Update selected body fields of an existing target-agent scheduled task in place, preserving ' +
929
- 'its id and config reference. Returns { ok: true, id, name, configMutated: true, agentId } ' +
930
- 'or { ok: false, errors }.')
931
- .input(updateTaskInputSchema)
932
- .handler(async ({ taskId, updates }) => {
703
+ }
704
+ buildCreateSkillsTool(agentId, projectId, user) {
705
+ return new tool_1.Tool(builder_tool_names_1.BUILDER_TOOLS.CREATE_SKILLS)
706
+ .description('Create and store one or more agent skills (reusable, load-on-demand capabilities) in a ' +
707
+ 'single call. Pass every skill you currently know how to write in one `skills` array — do ' +
708
+ "not spread multiple fully-specified skills across separate calls; each skill's instructions " +
709
+ 'field carries its own structured template. The whole batch is all-or-nothing: an invalid or ' +
710
+ 'duplicate-named skill rejects every skill in the call. This does NOT attach the skills to the ' +
711
+ 'agent config; follow up with agent-context with type "config" and patch_config (or write_config) to add a ' +
712
+ '`{ type: "skill", id }` entry per skill to `skills`. Returns { ok: true, skills: [{ id, name }, ' +
713
+ '...] } (same order as input, bodies are not echoed back) or { ok: false, errors }.')
714
+ .systemInstruction('Never create a vague or placeholder skill. The description field is the routing contract the ' +
715
+ 'runtime uses to decide when to load the skill; the instructions must follow the required ' +
716
+ 'structured Markdown template (Overview, Inputs, Steps, Rules, Example, Gotchas) with each ' +
717
+ 'applicable section filled in with concrete, specific content. If you do not have enough domain ' +
718
+ "detail to write a genuinely useful skill, derive it from the user's goal as stated assumptions " +
719
+ 'listed in your summary; ask the user clarifying questions only when even a reasonable ' +
720
+ 'assumption is impossible. Use allowedTools only with exact target-agent tool names. Use references ' +
721
+ 'only for markdown supporting files under the references/ directory — references are not ' +
722
+ 'automatically loaded, so instructions must say exactly when to load each one by path; scripts and ' +
723
+ 'non-markdown linked files are not supported. Do not invent tool names or reference paths. Batch ' +
724
+ 'every skill you currently know how to write into one call.')
725
+ .input(zod_1.z.object({
726
+ skills: zod_1.z
727
+ .array(createSkillInputSchema)
728
+ .min(1)
729
+ .max(20)
730
+ .describe('Every skill to create, in the order they should be created.'),
731
+ }))
732
+ .handler(async ({ skills }) => {
733
+ const editorLock = await this.getEditorLockFailure(agentId);
734
+ if (editorLock)
735
+ return editorLock;
933
736
  try {
934
- const updated = await this.agentTaskService.update(agentId, projectId, taskId, updates, {
737
+ const created = await this.agentSkillsService.createSkills(agentId, projectId, skills, {
935
738
  user,
936
739
  modifiedBy: 'builder',
937
740
  });
938
- return { ok: true, id: updated.id, name: updated.name };
741
+ return {
742
+ ok: true,
743
+ skills: created.map(({ id, skill }) => ({ id, name: skill.name })),
744
+ };
939
745
  }
940
746
  catch (e) {
941
747
  return {
@@ -945,94 +751,41 @@ let AgentsBuilderToolsService = class AgentsBuilderToolsService {
945
751
  }
946
752
  })
947
753
  .build();
948
- const createTasksTool = new tool_1.Tool(builder_tool_names_1.BUILDER_TOOLS.CREATE_TASKS)
949
- .description('Create one or more recurring scheduled tasks for the target agent (name + objective + cron ' +
950
- 'schedule per task) in a single call. Pass every task you currently know how to write in one ' +
951
- "`tasks` array — do not spread multiple fully-specified tasks across separate calls; each task's " +
952
- 'objective field carries its own structured template. The whole batch is all-or-nothing: an ' +
953
- 'invalid cron or objective rejects every task in the call. This adds a `{ type: "task", id, ' +
954
- 'enabled }` ref per task to the agent config (config.tasks) and each task starts running once ' +
955
- 'the agent is (re)published via `publish_agent`. Returns { ok: true, configMutated: true, agentId, tasks: [{ id, name, enabled }, ...] } (same ' +
956
- 'order as input, objectives and crons are not echoed back) or { ok: false, errors }.')
957
- .systemInstruction('Never create a task with a vague, broad, or placeholder objective, an objective missing any ' +
958
- 'required section, or an unclear schedule. Each objective must follow the required structured ' +
959
- 'Markdown template (Objective, Context, Steps, Output, Constraints, Success criteria) with every ' +
960
- 'section filled in with concrete, run-specific content. Agent Instructions still apply and ' +
961
- 'configured Skills remain available during scheduled runs, so never repeat universal rules or ' +
962
- "copy reusable procedures into an objective. If anything is ambiguous, derive it from the user's goal as " +
963
- 'stated assumptions listed in your summary; ask the user clarifying questions with ask_questions ' +
964
- 'only when even a reasonable assumption is impossible, before calling ' +
965
- 'create_tasks. A task can only use tools the agent already has: if any step in an objective ' +
966
- 'requires a tool, integration, or web search the agent is missing, you MUST add it to the agent ' +
967
- 'config (patch_config/write_config) BEFORE calling create_tasks — otherwise the task will fail at ' +
968
- 'runtime. Batch every task you currently know how to write into one call.')
754
+ }
755
+ buildCustomToolTool(agentId, projectId, user) {
756
+ return new tool_1.Tool(builder_tool_names_1.BUILDER_TOOLS.BUILD_CUSTOM_TOOL)
757
+ .description('Compile and store a custom tool. Pass the complete TypeScript source ' +
758
+ 'using `export default new Tool(...)` builder chain. The code is validated in a ' +
759
+ 'sandbox and saved against the agent. The returned `id` equals the tool name ' +
760
+ 'declared in the code (e.g. `new Tool("my_tool")` → id `"my_tool"`). ' +
761
+ 'This does NOT register the tool in the agent config — follow up with ' +
762
+ 'patch_config (or write_config) to add `{ type: "custom", id: "<tool name>" }` ' +
763
+ 'to `tools`.' +
764
+ 'Returns { ok: true, id, name } or { ok: false, errors }.')
969
765
  .input(zod_1.z.object({
970
- tasks: zod_1.z
971
- .array(zod_1.z.object({
972
- name: api_types_1.agentTaskSchema.shape.name.describe('Short, human-readable task name.'),
973
- objective: api_types_1.agentTaskSchema.shape.objective.describe(task_objective_template_1.TASK_OBJECTIVE_GUIDANCE),
974
- cronExpression: api_types_1.agentTaskSchema.shape.cronExpression.describe('A 5-field cron expression for when the task runs, e.g. "0 9 * * 1-5" = weekdays at 09:00.'),
975
- timezone: api_types_1.agentTaskSchema.shape.timezone.describe('IANA timezone the cron runs in, e.g. "Europe/London". Set it when the user names a timezone or a location; omit it to use the instance timezone.'),
976
- }))
977
- .min(1)
978
- .max(20)
979
- .describe('Every task to create, in the order they should be created.'),
766
+ code: zod_1.z
767
+ .string()
768
+ .describe('Complete TypeScript source using export default new Tool(...)'),
980
769
  }))
981
- .handler(async ({ tasks, }) => {
982
- let created;
770
+ .handler(async ({ code }, ctx) => {
771
+ const editorLock = await this.getEditorLockFailure(agentId);
772
+ if (editorLock)
773
+ return editorLock;
983
774
  try {
984
- created = await this.agentTaskService.createTasks(agentId, projectId, tasks.map((task) => ({ ...task, enabled: true })), { user, modifiedBy: 'builder' });
775
+ const descriptor = await this.secureRuntime.describeToolSecurely(code);
776
+ const built = await this.agentCustomToolsService.buildCustomTool(agentId, projectId, code, descriptor, { user, modifiedBy: 'builder' });
777
+ return { ok: true, id: built.id, name: descriptor.name, changed: built.changed };
985
778
  }
986
779
  catch (e) {
780
+ if (ctx.abortSignal ? ctx.abortSignal.aborted : (0, agents_1.isAbortError)(e))
781
+ throw e;
987
782
  return {
988
783
  ok: false,
989
784
  errors: [{ message: e instanceof Error ? e.message : String(e) }],
990
785
  };
991
786
  }
992
- return {
993
- ok: true,
994
- tasks: created.map(({ id, name }) => ({ id, name, enabled: true })),
995
- };
996
787
  })
997
788
  .build();
998
- const listWorkflowsTool = new tool_1.Tool(builder_tool_names_1.BUILDER_TOOLS.LIST_WORKFLOWS)
999
- .description('List the n8n workflows that can be attached as tools via `type: "workflow"` in the agent config. ' +
1000
- `Only returns workflows that start with a '${api_types_1.WORKFLOW_TOOL_TRIGGER_DISPLAY_NAME}' trigger. ` +
1001
- 'The published agent cannot call a workflow with `published: false` until the user publishes it. ' +
1002
- 'Pass `searchTerm` to narrow by workflow name; ' +
1003
- 'omitting it returns the 10 most recently updated attachable workflows.')
1004
- .input(zod_1.z.object({
1005
- searchTerm: zod_1.z
1006
- .string()
1007
- .optional()
1008
- .describe('Optional workflow-name search term. Omit to return the first 10 results.'),
1009
- }))
1010
- .handler(async ({ searchTerm }) => {
1011
- return {
1012
- workflows: await this.attachableWorkflowsService.list(user, projectId, searchTerm),
1013
- };
1014
- })
1015
- .build();
1016
- return [
1017
- buildCustomToolTool,
1018
- createSkillsTool,
1019
- listSkillsTool,
1020
- readSkillTool,
1021
- this.withConfigMutationMarker(updateSkillTool, agentId),
1022
- this.withConfigMutationMarker(createTasksTool, agentId),
1023
- listTasksTool,
1024
- this.withConfigMutationMarker(updateTaskTool, agentId),
1025
- listWorkflowsTool,
1026
- (0, get_resource_locator_options_tool_1.buildGetResourceLocatorOptionsTool)({
1027
- dynamicNodeParametersService: this.dynamicNodeParametersService,
1028
- nodeTypes: this.nodeTypes,
1029
- user,
1030
- projectId,
1031
- }),
1032
- ...this.agentsToolsService.getSharedTools(credentialProvider, 'Read-only inspection of available credentials. Use ask_credential to let the user ' +
1033
- 'pick the credential to wire into a node tool — never copy ids from this list directly ' +
1034
- 'into the config.'),
1035
- ];
1036
789
  }
1037
790
  async getConfigSnapshot(agentId, projectId) {
1038
791
  const agent = await this.agentsService.findById(agentId, projectId);
@@ -1042,6 +795,9 @@ let AgentsBuilderToolsService = class AgentsBuilderToolsService {
1042
795
  return snapshotFromConfig(config);
1043
796
  }
1044
797
  async applyCredentialToMcpServer(agentId, projectId, serverName, credentialId, user) {
798
+ if (await this.getEditorLockFailure(agentId)) {
799
+ return { applied: false };
800
+ }
1045
801
  const snapshot = await this.getConfigSnapshot(agentId, projectId);
1046
802
  const config = snapshot.config;
1047
803
  const servers = config?.mcpServers;
@@ -1070,10 +826,171 @@ let AgentsBuilderToolsService = class AgentsBuilderToolsService {
1070
826
  });
1071
827
  return { applied: true };
1072
828
  }
829
+ async getFreshConfigSnapshot(agentId, projectId, baseConfigHash) {
830
+ try {
831
+ const snapshot = await this.getConfigSnapshot(agentId, projectId);
832
+ if (baseConfigHash !== snapshot.configHash) {
833
+ return { ok: false, stage: 'stale', errors: [STALE_CONFIG_ERROR] };
834
+ }
835
+ return { ok: true, snapshot };
836
+ }
837
+ catch (e) {
838
+ return {
839
+ ok: false,
840
+ stage: 'stale',
841
+ errors: [{ path: '(root)', message: e instanceof Error ? e.message : String(e) }],
842
+ };
843
+ }
844
+ }
845
+ validateBuilderConfig(incoming, currentConfig) {
846
+ const parsed = parseBuilderWriteConfig(incoming, currentConfig);
847
+ if (!parsed.success)
848
+ return { ok: false, errors: (0, api_types_1.formatZodErrors)(parsed.error) };
849
+ const emptyInstructions = (0, agent_config_1.rejectIfEmptyInstructions)(parsed.data, CLI_AGENT_CONFIG_MESSAGES);
850
+ if (emptyInstructions)
851
+ return { ok: false, errors: emptyInstructions };
852
+ const unsupportedWebSearch = (0, agent_config_1.rejectIfUnsupportedNativeWebSearch)(parsed.data);
853
+ if (unsupportedWebSearch)
854
+ return { ok: false, errors: unsupportedWebSearch };
855
+ const dynamicSelectorFromAi = (0, agent_config_1.rejectIfDynamicSelectorUsesFromAi)(parsed.data, currentConfig, this.nodeTypes, CLI_AGENT_CONFIG_MESSAGES);
856
+ if (dynamicSelectorFromAi)
857
+ return { ok: false, errors: dynamicSelectorFromAi };
858
+ const config = applyPromptCachingBuilderDefaults((0, agent_config_1.applyNativeWebSearchDefaultOn)(parsed.data));
859
+ return { ok: true, config };
860
+ }
861
+ async saveBuilderConfig(agentId, projectId, user, config, baseConfigHash) {
862
+ try {
863
+ await this.agentConfigService.updateConfig(agentId, projectId, config, user, {
864
+ baseConfigHash,
865
+ modifiedBy: 'builder',
866
+ });
867
+ return { ok: true };
868
+ }
869
+ catch (e) {
870
+ return {
871
+ ok: false,
872
+ stage: e instanceof conflict_error_1.ConflictError ? 'stale' : 'schema',
873
+ errors: [{ path: '(root)', message: e instanceof Error ? e.message : String(e) }],
874
+ };
875
+ }
876
+ }
877
+ async writeBuilderConfig(agentId, projectId, user, json, baseConfigHash) {
878
+ const editorLock = await this.getEditorLockFailure(agentId);
879
+ if (editorLock)
880
+ return editorLock;
881
+ const parsed = (0, api_types_1.tryParseConfigJson)(json);
882
+ if (!parsed.ok)
883
+ return { ok: false, errors: parsed.errors };
884
+ const fresh = await this.getFreshConfigSnapshot(agentId, projectId, baseConfigHash);
885
+ if (!fresh.ok)
886
+ return fresh;
887
+ const validated = this.validateBuilderConfig(parsed.data, fresh.snapshot.config);
888
+ if (!validated.ok)
889
+ return validated;
890
+ return await this.saveBuilderConfig(agentId, projectId, user, validated.config, fresh.snapshot.configHash);
891
+ }
892
+ async patchBuilderConfig(agentId, projectId, user, operations, baseConfigHash) {
893
+ const editorLock = await this.getEditorLockFailure(agentId);
894
+ if (editorLock)
895
+ return { ...editorLock, stage: 'locked' };
896
+ const parsed = (0, api_types_1.tryParseConfigJson)(operations);
897
+ if (!parsed.ok)
898
+ return { ok: false, stage: 'parse', errors: parsed.errors };
899
+ const fresh = await this.getFreshConfigSnapshot(agentId, projectId, baseConfigHash);
900
+ if (!fresh.ok)
901
+ return fresh;
902
+ if (!fresh.snapshot.config) {
903
+ return {
904
+ ok: false,
905
+ stage: 'patch',
906
+ errors: [{ path: '(root)', message: 'Agent has no JSON config yet.' }],
907
+ };
908
+ }
909
+ const patched = await this.applyConfigPatch(parsed.data, fresh.snapshot.config);
910
+ if (!patched.ok)
911
+ return patched;
912
+ const validated = this.validateBuilderConfig(patched.config, fresh.snapshot.config);
913
+ if (!validated.ok)
914
+ return { ...validated, stage: 'schema' };
915
+ return await this.saveBuilderConfig(agentId, projectId, user, validated.config, fresh.snapshot.configHash);
916
+ }
917
+ async applyConfigPatch(operations, config) {
918
+ const jsonpatch = (await import('fast-json-patch')).default;
919
+ const ops = operations;
920
+ const patchError = jsonpatch.validate(ops, config);
921
+ if (patchError) {
922
+ const opPath = patchError.operation?.path ?? '(root)';
923
+ return {
924
+ ok: false,
925
+ stage: 'patch',
926
+ errors: [{ path: opPath, message: patchError.message ?? 'Invalid patch operation' }],
927
+ };
928
+ }
929
+ return { ok: true, config: jsonpatch.applyPatch(jsonpatch.deepClone(config), ops).newDocument };
930
+ }
931
+ async formatDraftTestResult(result, ctx, agentId, user, previewPath) {
932
+ if (result.status === 'session_not_found') {
933
+ return {
934
+ status: 'error',
935
+ code: 'session_not_found',
936
+ message: 'Session not found.',
937
+ };
938
+ }
939
+ if (result.status === 'agent_misconfigured') {
940
+ return {
941
+ status: 'error',
942
+ code: 'agent_misconfigured',
943
+ message: "This agent isn't ready to run yet. Finish configuring it and try again.",
944
+ missing: result.missing,
945
+ };
946
+ }
947
+ if (result.status === 'completed')
948
+ return result;
949
+ const approvals = (0, agent_test_run_service_1.collectStandardApprovals)(result);
950
+ const firstApproval = approvals?.[0];
951
+ if (firstApproval) {
952
+ const { continuation, ...approval } = firstApproval;
953
+ return await ctx.suspend(approval, { continuation });
954
+ }
955
+ return await this.cancelUnsupportedDraftTest(result, agentId, user, previewPath);
956
+ }
957
+ async cancelUnsupportedDraftTest(result, agentId, user, previewPath) {
958
+ const cancelled = await this.agentTestRunService.cancelSuspendedRuns({
959
+ agentId,
960
+ suspensions: result.suspensions,
961
+ userId: user.id,
962
+ });
963
+ if (!cancelled) {
964
+ return {
965
+ status: 'error',
966
+ code: 'cancellation_failed',
967
+ message: 'This test needs approval, but its suspended run could not be cancelled. Open Preview before continuing this session.',
968
+ sessionId: result.sessionId,
969
+ previewPath,
970
+ };
971
+ }
972
+ return {
973
+ status: 'approval_required',
974
+ response: result.response,
975
+ sessionId: result.sessionId,
976
+ ...(result.executionId ? { executionId: result.executionId } : {}),
977
+ suspensions: result.suspensions.map(({ runId, toolCallId, toolName }) => ({
978
+ runId,
979
+ toolCallId,
980
+ toolName,
981
+ })),
982
+ previewPath,
983
+ };
984
+ }
985
+ createModelLookup(user, projectId, options) {
986
+ return {
987
+ list: async (credentialId, credentialType, provider) => await this.builderModelLiveLookupService.list(user, projectId, credentialId, credentialType, provider, { useEvalModelCatalog: options?.useEvalModelCatalog === true }),
988
+ };
989
+ }
1073
990
  };
1074
991
  exports.AgentsBuilderToolsService = AgentsBuilderToolsService;
1075
992
  exports.AgentsBuilderToolsService = AgentsBuilderToolsService = __decorate([
1076
993
  (0, di_1.Service)(),
1077
- __metadata("design:paramtypes", [agents_service_1.AgentsService, agent_config_service_1.AgentConfigService, agent_custom_tools_service_1.AgentCustomToolsService, agent_integration_persistence_service_1.AgentIntegrationPersistenceService, agent_skills_service_1.AgentSkillsService, agent_secure_runtime_1.AgentSecureRuntime, attachable_workflows_service_1.AttachableWorkflowsService, agents_tools_service_1.AgentsToolsService, builder_model_live_lookup_service_1.BuilderModelLiveLookupService, mcp_registry_service_1.McpRegistryService, oauth_service_1.OauthService, credential_types_1.CredentialTypes, agent_task_service_1.AgentTaskService, agent_publish_service_1.AgentPublishService, agent_test_run_service_1.AgentTestRunService, ai_service_1.AiService, ai_gateway_service_1.AiGatewayService, backend_network_1.OutboundHttp, dynamic_node_parameters_service_1.DynamicNodeParametersService, node_types_1.NodeTypes, free_ai_credits_service_1.FreeAiCreditsService, telemetry_1.Telemetry])
994
+ __metadata("design:paramtypes", [backend_common_1.Logger, agents_service_1.AgentsService, agent_config_service_1.AgentConfigService, agent_custom_tools_service_1.AgentCustomToolsService, agent_integration_persistence_service_1.AgentIntegrationPersistenceService, agent_skills_service_1.AgentSkillsService, agent_secure_runtime_1.AgentSecureRuntime, agents_tools_service_1.AgentsToolsService, builder_model_live_lookup_service_1.BuilderModelLiveLookupService, mcp_registry_service_1.McpRegistryService, oauth_service_1.OauthService, credential_types_1.CredentialTypes, agent_task_service_1.AgentTaskService, agent_publish_service_1.AgentPublishService, agent_test_run_service_1.AgentTestRunService, ai_service_1.AiService, ai_gateway_service_1.AiGatewayService, backend_network_1.OutboundHttp, dynamic_node_parameters_service_1.DynamicNodeParametersService, node_types_1.NodeTypes, free_ai_credits_service_1.FreeAiCreditsService, telemetry_1.Telemetry, instance_ai_agent_context_adapter_1.InstanceAiAgentContextAdapterService, collaboration_service_1.CollaborationService])
1078
995
  ], AgentsBuilderToolsService);
1079
996
  //# sourceMappingURL=agents-builder-tools.service.js.map