n8n 2.4.4 → 2.5.1
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.
- package/dist/active-executions.js +1 -0
- package/dist/active-executions.js.map +1 -1
- package/dist/auth/auth.service.js +2 -1
- package/dist/auth/auth.service.js.map +1 -1
- package/dist/build.tsbuildinfo +1 -1
- package/dist/chat/chat-service.d.ts +2 -1
- package/dist/chat/chat-service.js +33 -11
- package/dist/chat/chat-service.js.map +1 -1
- package/dist/chat/utils.d.ts +1 -1
- package/dist/chat/utils.js +5 -0
- package/dist/chat/utils.js.map +1 -1
- package/dist/commands/base-command.js +2 -0
- package/dist/commands/base-command.js.map +1 -1
- package/dist/commands/export/credentials.d.ts +2 -2
- package/dist/commands/export/workflow.d.ts +2 -2
- package/dist/commands/import/entities.d.ts +3 -0
- package/dist/commands/import/entities.js +11 -1
- package/dist/commands/import/entities.js.map +1 -1
- package/dist/commands/start.js +1 -4
- package/dist/commands/start.js.map +1 -1
- package/dist/commands/webhook.js +2 -0
- package/dist/commands/webhook.js.map +1 -1
- package/dist/commands/worker.js +1 -0
- package/dist/commands/worker.js.map +1 -1
- package/dist/config/index.js +0 -1
- package/dist/config/index.js.map +1 -1
- package/dist/controller.registry.js +6 -0
- package/dist/controller.registry.js.map +1 -1
- package/dist/controllers/ai.controller.d.ts +1 -2
- package/dist/controllers/ai.controller.js +0 -18
- package/dist/controllers/ai.controller.js.map +1 -1
- package/dist/controllers/auth.controller.js +2 -1
- package/dist/controllers/auth.controller.js.map +1 -1
- package/dist/controllers/e2e.controller.d.ts +3 -3
- package/dist/controllers/e2e.controller.js +10 -8
- package/dist/controllers/e2e.controller.js.map +1 -1
- package/dist/controllers/me.controller.js +13 -15
- package/dist/controllers/me.controller.js.map +1 -1
- package/dist/controllers/node-types.controller.d.ts +2 -0
- package/dist/controllers/node-types.controller.js +40 -22
- package/dist/controllers/node-types.controller.js.map +1 -1
- package/dist/controllers/orchestration.controller.d.ts +2 -1
- package/dist/controllers/orchestration.controller.js +3 -3
- package/dist/controllers/orchestration.controller.js.map +1 -1
- package/dist/credentials-helper.js +3 -1
- package/dist/credentials-helper.js.map +1 -1
- package/dist/deprecation/deprecation.service.js +5 -0
- package/dist/deprecation/deprecation.service.js.map +1 -1
- package/dist/eventbus/message-event-bus/message-event-bus.d.ts +2 -21
- package/dist/eventbus/message-event-bus/message-event-bus.js +1 -110
- package/dist/eventbus/message-event-bus/message-event-bus.js.map +1 -1
- package/dist/events/maps/relay.event-map.d.ts +6 -0
- package/dist/events/relays/telemetry.event-relay.d.ts +1 -0
- package/dist/events/relays/telemetry.event-relay.js +18 -4
- package/dist/events/relays/telemetry.event-relay.js.map +1 -1
- package/dist/events/relays/workflow-failure-notification.event-relay.d.ts +13 -0
- package/dist/events/relays/workflow-failure-notification.event-relay.js +78 -0
- package/dist/events/relays/workflow-failure-notification.event-relay.js.map +1 -0
- package/dist/executions/execution-data/types.d.ts +17 -0
- package/dist/executions/execution-data/types.js.map +1 -0
- package/dist/executions/{execution-data.service.d.ts → failed-run-factory.d.ts} +1 -1
- package/dist/executions/{execution-data.service.js → failed-run-factory.js} +6 -6
- package/dist/executions/failed-run-factory.js.map +1 -0
- package/dist/license/license.controller.js +6 -1
- package/dist/license/license.controller.js.map +1 -1
- package/dist/license/license.service.d.ts +2 -1
- package/dist/license/license.service.js +10 -2
- package/dist/license/license.service.js.map +1 -1
- package/dist/license.d.ts +2 -1
- package/dist/license.js +2 -2
- package/dist/license.js.map +1 -1
- package/dist/load-nodes-and-credentials.d.ts +1 -0
- package/dist/load-nodes-and-credentials.js +7 -0
- package/dist/load-nodes-and-credentials.js.map +1 -1
- package/dist/mfa/mfa.service.d.ts +5 -3
- package/dist/mfa/mfa.service.js +15 -10
- package/dist/mfa/mfa.service.js.map +1 -1
- package/dist/modules/breaking-changes/breaking-changes.module.js +1 -1
- package/dist/modules/breaking-changes/breaking-changes.module.js.map +1 -1
- package/dist/modules/breaking-changes/breaking-changes.service.d.ts +4 -3
- package/dist/modules/breaking-changes/breaking-changes.service.js +25 -6
- package/dist/modules/breaking-changes/breaking-changes.service.js.map +1 -1
- package/dist/modules/breaking-changes/rules/index.d.ts +1 -1
- package/dist/modules/breaking-changes/rules/v2/index.d.ts +2 -3
- package/dist/modules/breaking-changes/rules/v2/index.js +0 -4
- package/dist/modules/breaking-changes/rules/v2/index.js.map +1 -1
- package/dist/modules/chat-hub/chat-hub-agent.service.d.ts +2 -2
- package/dist/modules/chat-hub/chat-hub-agent.service.js +2 -2
- package/dist/modules/chat-hub/chat-hub-agent.service.js.map +1 -1
- package/dist/modules/chat-hub/chat-hub-extractor.d.ts +22 -0
- package/dist/modules/chat-hub/chat-hub-extractor.js +64 -0
- package/dist/modules/chat-hub/chat-hub-extractor.js.map +1 -0
- package/dist/modules/chat-hub/chat-hub-message.entity.js +1 -1
- package/dist/modules/chat-hub/chat-hub-message.entity.js.map +1 -1
- package/dist/modules/chat-hub/chat-hub-session.entity.js +1 -1
- package/dist/modules/chat-hub/chat-hub-session.entity.js.map +1 -1
- package/dist/modules/chat-hub/chat-hub-workflow.service.d.ts +1 -1
- package/dist/modules/chat-hub/chat-hub-workflow.service.js +2 -2
- package/dist/modules/chat-hub/chat-hub-workflow.service.js.map +1 -1
- package/dist/modules/chat-hub/chat-hub.constants.d.ts +2 -0
- package/dist/modules/chat-hub/chat-hub.constants.js +8 -1
- package/dist/modules/chat-hub/chat-hub.constants.js.map +1 -1
- package/dist/modules/chat-hub/chat-hub.controller.js +17 -5
- package/dist/modules/chat-hub/chat-hub.controller.js.map +1 -1
- package/dist/modules/chat-hub/chat-hub.service.d.ts +16 -3
- package/dist/modules/chat-hub/chat-hub.service.js +290 -56
- package/dist/modules/chat-hub/chat-hub.service.js.map +1 -1
- package/dist/modules/chat-hub/chat-hub.types.d.ts +8 -2
- package/dist/modules/chat-hub/chat-hub.types.js.map +1 -1
- package/dist/modules/community-packages/community-node-types.service.js +2 -5
- package/dist/modules/community-packages/community-node-types.service.js.map +1 -1
- package/dist/modules/community-packages/community-packages.module.d.ts +1 -0
- package/dist/modules/community-packages/community-packages.module.js +3 -0
- package/dist/modules/community-packages/community-packages.module.js.map +1 -1
- package/dist/modules/community-packages/community-packages.service.js +4 -0
- package/dist/modules/community-packages/community-packages.service.js.map +1 -1
- package/dist/modules/data-table/data-table-file-cleanup.service.d.ts +3 -1
- package/dist/modules/data-table/data-table-file-cleanup.service.js +7 -2
- package/dist/modules/data-table/data-table-file-cleanup.service.js.map +1 -1
- package/dist/modules/dynamic-credentials.ee/dynamic-credentials.config.d.ts +4 -0
- package/dist/modules/dynamic-credentials.ee/dynamic-credentials.config.js +32 -0
- package/dist/modules/dynamic-credentials.ee/dynamic-credentials.config.js.map +1 -0
- package/dist/modules/dynamic-credentials.ee/dynamic-credentials.controller.d.ts +9 -2
- package/dist/modules/dynamic-credentials.ee/dynamic-credentials.controller.js +63 -7
- package/dist/modules/dynamic-credentials.ee/dynamic-credentials.controller.js.map +1 -1
- package/dist/modules/dynamic-credentials.ee/services/dynamic-credential-cors.service.d.ts +12 -0
- package/dist/modules/dynamic-credentials.ee/services/dynamic-credential-cors.service.js +70 -0
- package/dist/modules/dynamic-credentials.ee/services/dynamic-credential-cors.service.js.map +1 -0
- package/dist/modules/dynamic-credentials.ee/workflow-status.controller.d.ts +5 -2
- package/dist/modules/dynamic-credentials.ee/workflow-status.controller.js +17 -3
- package/dist/modules/dynamic-credentials.ee/workflow-status.controller.js.map +1 -1
- package/dist/modules/external-secrets.ee/external-secrets.config.d.ts +1 -0
- package/dist/modules/external-secrets.ee/external-secrets.config.js +5 -0
- package/dist/modules/external-secrets.ee/external-secrets.config.js.map +1 -1
- package/dist/modules/log-streaming.ee/database/entities/event-destination.entity.d.ts +6 -0
- package/dist/modules/log-streaming.ee/database/entities/event-destination.entity.js +29 -0
- package/dist/modules/log-streaming.ee/database/entities/event-destination.entity.js.map +1 -0
- package/dist/modules/log-streaming.ee/database/entities/index.d.ts +1 -0
- package/dist/modules/log-streaming.ee/database/entities/index.js +6 -0
- package/dist/modules/log-streaming.ee/database/entities/index.js.map +1 -0
- package/dist/modules/log-streaming.ee/database/repositories/event-destination.repository.d.ts +5 -0
- package/dist/modules/log-streaming.ee/database/repositories/event-destination.repository.js +26 -0
- package/dist/modules/log-streaming.ee/database/repositories/event-destination.repository.js.map +1 -0
- package/dist/{eventbus/message-event-bus-destination → modules/log-streaming.ee/destinations}/message-event-bus-destination-from-db.d.ts +2 -2
- package/dist/modules/log-streaming.ee/destinations/message-event-bus-destination-from-db.js.map +1 -0
- package/dist/{eventbus/message-event-bus-destination → modules/log-streaming.ee/destinations}/message-event-bus-destination-sentry.ee.d.ts +1 -1
- package/dist/{eventbus/message-event-bus-destination → modules/log-streaming.ee/destinations}/message-event-bus-destination-sentry.ee.js +3 -4
- package/dist/modules/log-streaming.ee/destinations/message-event-bus-destination-sentry.ee.js.map +1 -0
- package/dist/{eventbus/message-event-bus-destination → modules/log-streaming.ee/destinations}/message-event-bus-destination-syslog.ee.d.ts +1 -1
- package/dist/{eventbus/message-event-bus-destination → modules/log-streaming.ee/destinations}/message-event-bus-destination-syslog.ee.js +1 -1
- package/dist/modules/log-streaming.ee/destinations/message-event-bus-destination-syslog.ee.js.map +1 -0
- package/dist/{eventbus/message-event-bus-destination → modules/log-streaming.ee/destinations}/message-event-bus-destination-webhook.ee.d.ts +2 -2
- package/dist/{eventbus/message-event-bus-destination → modules/log-streaming.ee/destinations}/message-event-bus-destination-webhook.ee.js +3 -3
- package/dist/modules/log-streaming.ee/destinations/message-event-bus-destination-webhook.ee.js.map +1 -0
- package/dist/{eventbus/message-event-bus-destination → modules/log-streaming.ee/destinations}/message-event-bus-destination.ee.d.ts +6 -12
- package/dist/{eventbus/message-event-bus-destination → modules/log-streaming.ee/destinations}/message-event-bus-destination.ee.js +9 -49
- package/dist/modules/log-streaming.ee/destinations/message-event-bus-destination.ee.js.map +1 -0
- package/dist/modules/log-streaming.ee/log-streaming-destination.service.d.ts +32 -0
- package/dist/modules/log-streaming.ee/log-streaming-destination.service.js +176 -0
- package/dist/modules/log-streaming.ee/log-streaming-destination.service.js.map +1 -0
- package/dist/{eventbus/event-bus.controller.d.ts → modules/log-streaming.ee/log-streaming.controller.d.ts} +5 -3
- package/dist/{eventbus/event-bus.controller.js → modules/log-streaming.ee/log-streaming.controller.js} +19 -18
- package/dist/modules/log-streaming.ee/log-streaming.controller.js.map +1 -0
- package/dist/modules/log-streaming.ee/log-streaming.module.d.ts +5 -0
- package/dist/modules/log-streaming.ee/log-streaming.module.js +67 -0
- package/dist/modules/log-streaming.ee/log-streaming.module.js.map +1 -0
- package/dist/modules/mcp/mcp.errors.d.ts +5 -0
- package/dist/modules/mcp/mcp.errors.js +9 -1
- package/dist/modules/mcp/mcp.errors.js.map +1 -1
- package/dist/modules/mcp/mcp.service.d.ts +7 -2
- package/dist/modules/mcp/mcp.service.js +13 -4
- package/dist/modules/mcp/mcp.service.js.map +1 -1
- package/dist/modules/mcp/mcp.types.d.ts +9 -5
- package/dist/modules/mcp/tools/execute-workflow.tool.d.ts +3 -3
- package/dist/modules/mcp/tools/execute-workflow.tool.js +34 -10
- package/dist/modules/mcp/tools/execute-workflow.tool.js.map +1 -1
- package/dist/modules/mcp/tools/get-workflow-details.tool.d.ts +4 -2
- package/dist/modules/mcp/tools/get-workflow-details.tool.js +9 -3
- package/dist/modules/mcp/tools/get-workflow-details.tool.js.map +1 -1
- package/dist/modules/mcp/tools/schemas.d.ts +10 -0
- package/dist/modules/mcp/tools/schemas.js +2 -0
- package/dist/modules/mcp/tools/schemas.js.map +1 -1
- package/dist/modules/mcp/tools/search-workflows.tool.js +25 -14
- package/dist/modules/mcp/tools/search-workflows.tool.js.map +1 -1
- package/dist/modules/provisioning.ee/provisioning.module.js +5 -1
- package/dist/modules/provisioning.ee/provisioning.module.js.map +1 -1
- package/dist/modules/source-control.ee/source-control-git.service.ee.d.ts +1 -0
- package/dist/modules/source-control.ee/source-control-git.service.ee.js +40 -3
- package/dist/modules/source-control.ee/source-control-git.service.ee.js.map +1 -1
- package/dist/modules/source-control.ee/source-control-preferences.service.ee.d.ts +3 -1
- package/dist/modules/source-control.ee/source-control-preferences.service.ee.js +61 -11
- package/dist/modules/source-control.ee/source-control-preferences.service.ee.js.map +1 -1
- package/dist/modules/source-control.ee/source-control.controller.ee.d.ts +1 -1
- package/dist/modules/source-control.ee/source-control.controller.ee.js +35 -5
- package/dist/modules/source-control.ee/source-control.controller.ee.js.map +1 -1
- package/dist/modules/source-control.ee/source-control.module.js +5 -1
- package/dist/modules/source-control.ee/source-control.module.js.map +1 -1
- package/dist/modules/source-control.ee/source-control.service.ee.d.ts +4 -0
- package/dist/modules/source-control.ee/source-control.service.ee.js +77 -5
- package/dist/modules/source-control.ee/source-control.service.ee.js.map +1 -1
- package/dist/modules/sso-oidc/constants.js.map +1 -0
- package/dist/{sso.ee/oidc/routes → modules/sso-oidc}/oidc.controller.ee.d.ts +4 -4
- package/dist/{sso.ee/oidc/routes → modules/sso-oidc}/oidc.controller.ee.js +6 -6
- package/dist/modules/sso-oidc/oidc.controller.ee.js.map +1 -0
- package/dist/{sso.ee/oidc → modules/sso-oidc}/oidc.service.ee.js +2 -2
- package/dist/modules/sso-oidc/oidc.service.ee.js.map +1 -0
- package/dist/modules/sso-oidc/sso-oidc.module.d.ts +4 -0
- package/dist/modules/sso-oidc/sso-oidc.module.js +56 -0
- package/dist/modules/sso-oidc/sso-oidc.module.js.map +1 -0
- package/dist/modules/sso-saml/constants.js.map +1 -0
- package/dist/modules/sso-saml/errors/invalid-saml-metadata-url.error.js.map +1 -0
- package/dist/modules/sso-saml/errors/invalid-saml-metadata.error.js.map +1 -0
- package/dist/{sso.ee/saml → modules/sso-saml}/middleware/saml-enabled-middleware.js +3 -3
- package/dist/modules/sso-saml/middleware/saml-enabled-middleware.js.map +1 -0
- package/dist/{sso.ee/saml → modules/sso-saml}/saml-helpers.d.ts +0 -4
- package/dist/{sso.ee/saml → modules/sso-saml}/saml-helpers.js +1 -18
- package/dist/modules/sso-saml/saml-helpers.js.map +1 -0
- package/dist/modules/sso-saml/saml-validator.js.map +1 -0
- package/dist/{sso.ee/saml/routes → modules/sso-saml}/saml.controller.ee.d.ts +5 -5
- package/dist/{sso.ee/saml/routes → modules/sso-saml}/saml.controller.ee.js +12 -11
- package/dist/modules/sso-saml/saml.controller.ee.js.map +1 -0
- package/dist/{sso.ee/saml → modules/sso-saml}/saml.service.ee.js +12 -12
- package/dist/modules/sso-saml/saml.service.ee.js.map +1 -0
- package/dist/modules/sso-saml/schema/metadata-exchange.xsd.js.map +1 -0
- package/dist/modules/sso-saml/schema/oasis-200401-wss-wssecurity-secext-1.0.xsd.js.map +1 -0
- package/dist/modules/sso-saml/schema/oasis-200401-wss-wssecurity-utility-1.0.xsd.js.map +1 -0
- package/dist/{sso.ee/saml → modules/sso-saml}/schema/saml-schema-assertion-2.0.xsd.js.map +1 -1
- package/dist/{sso.ee/saml → modules/sso-saml}/schema/saml-schema-metadata-2.0.xsd.js.map +1 -1
- package/dist/{sso.ee/saml → modules/sso-saml}/schema/saml-schema-protocol-2.0.xsd.js.map +1 -1
- package/dist/modules/sso-saml/schema/ws-addr.xsd.js.map +1 -0
- package/dist/modules/sso-saml/schema/ws-authorization.xsd.js.map +1 -0
- package/dist/{sso.ee/saml → modules/sso-saml}/schema/ws-federation.xsd.js.map +1 -1
- package/dist/{sso.ee/saml → modules/sso-saml}/schema/ws-securitypolicy-1.2.xsd.js.map +1 -1
- package/dist/modules/sso-saml/schema/xenc-schema.xsd.js.map +1 -0
- package/dist/modules/sso-saml/schema/xml.xsd.js.map +1 -0
- package/dist/{sso.ee/saml → modules/sso-saml}/schema/xmldsig-core-schema.xsd.js.map +1 -1
- package/dist/modules/sso-saml/service-provider.ee.js.map +1 -0
- package/dist/modules/sso-saml/sso-saml.module.d.ts +4 -0
- package/dist/modules/sso-saml/sso-saml.module.js +56 -0
- package/dist/modules/sso-saml/sso-saml.module.js.map +1 -0
- package/dist/modules/sso-saml/types.js +3 -0
- package/dist/{sso.ee/saml → modules/sso-saml}/types.js.map +1 -1
- package/dist/modules/sso-saml/views/init-sso-post.js.map +1 -0
- package/dist/modules/workflow-index/workflow-index.service.js +8 -0
- package/dist/modules/workflow-index/workflow-index.service.js.map +1 -1
- package/dist/node-types.d.ts +1 -0
- package/dist/node-types.js +17 -0
- package/dist/node-types.js.map +1 -1
- package/dist/scaling/constants.d.ts +2 -2
- package/dist/scaling/pubsub/pubsub.event-map.d.ts +7 -2
- package/dist/scaling/pubsub/pubsub.types.d.ts +2 -1
- package/dist/scaling/worker-status.service.ee.d.ts +7 -3
- package/dist/scaling/worker-status.service.ee.js +13 -7
- package/dist/scaling/worker-status.service.ee.js.map +1 -1
- package/dist/server.d.ts +0 -1
- package/dist/server.js +5 -22
- package/dist/server.js.map +1 -1
- package/dist/services/ai-workflow-builder.service.d.ts +2 -3
- package/dist/services/ai-workflow-builder.service.js +36 -36
- package/dist/services/ai-workflow-builder.service.js.map +1 -1
- package/dist/services/cors-service.d.ts +7 -0
- package/dist/services/cors-service.js +51 -0
- package/dist/services/cors-service.js.map +1 -0
- package/dist/services/frontend.service.d.ts +3 -1
- package/dist/services/frontend.service.js +19 -4
- package/dist/services/frontend.service.js.map +1 -1
- package/dist/services/import.service.d.ts +2 -4
- package/dist/services/import.service.js +11 -11
- package/dist/services/import.service.js.map +1 -1
- package/dist/services/project.service.ee.d.ts +1 -3
- package/dist/services/project.service.ee.js +4 -12
- package/dist/services/project.service.ee.js.map +1 -1
- package/dist/services/pruning/workflow-history-compaction.service.d.ts +11 -6
- package/dist/services/pruning/workflow-history-compaction.service.js +72 -25
- package/dist/services/pruning/workflow-history-compaction.service.js.map +1 -1
- package/dist/services/public-api-key.service.js +2 -1
- package/dist/services/public-api-key.service.js.map +1 -1
- package/dist/services/role-cache.service.d.ts +2 -1
- package/dist/services/role-cache.service.js +4 -4
- package/dist/services/role-cache.service.js.map +1 -1
- package/dist/services/role.service.d.ts +2 -1
- package/dist/services/role.service.js +3 -3
- package/dist/services/role.service.js.map +1 -1
- package/dist/services/user.service.d.ts +5 -3
- package/dist/services/user.service.js +15 -1
- package/dist/services/user.service.js.map +1 -1
- package/dist/services/workflow-statistics.service.d.ts +4 -2
- package/dist/services/workflow-statistics.service.js +35 -4
- package/dist/services/workflow-statistics.service.js.map +1 -1
- package/dist/sso.ee/sso-helpers.d.ts +4 -0
- package/dist/sso.ee/sso-helpers.js +17 -1
- package/dist/sso.ee/sso-helpers.js.map +1 -1
- package/dist/user-management/email/templates/workflow-failure.handlebars +211 -0
- package/dist/user-management/email/user-management-mailer.d.ts +7 -1
- package/dist/user-management/email/user-management-mailer.js +19 -0
- package/dist/user-management/email/user-management-mailer.js.map +1 -1
- package/dist/workflow-execute-additional-data.js +2 -2
- package/dist/workflow-execute-additional-data.js.map +1 -1
- package/dist/workflow-helpers.d.ts +2 -1
- package/dist/workflow-helpers.js +21 -0
- package/dist/workflow-helpers.js.map +1 -1
- package/dist/workflow-runner.d.ts +3 -3
- package/dist/workflow-runner.js +5 -5
- package/dist/workflow-runner.js.map +1 -1
- package/dist/workflows/workflow-execution.service.d.ts +4 -4
- package/dist/workflows/workflow-execution.service.js +7 -7
- package/dist/workflows/workflow-execution.service.js.map +1 -1
- package/dist/workflows/workflow-finder.service.d.ts +0 -1
- package/dist/workflows/workflow-finder.service.js +2 -2
- package/dist/workflows/workflow-finder.service.js.map +1 -1
- package/dist/workflows/workflow.service.js +10 -17
- package/dist/workflows/workflow.service.js.map +1 -1
- package/dist/workflows/workflows.controller.d.ts +0 -8
- package/package.json +16 -16
- package/dist/eventbus/event-bus.controller.js.map +0 -1
- package/dist/eventbus/message-event-bus-destination/message-event-bus-destination-from-db.js.map +0 -1
- package/dist/eventbus/message-event-bus-destination/message-event-bus-destination-sentry.ee.js.map +0 -1
- package/dist/eventbus/message-event-bus-destination/message-event-bus-destination-syslog.ee.js.map +0 -1
- package/dist/eventbus/message-event-bus-destination/message-event-bus-destination-webhook.ee.js.map +0 -1
- package/dist/eventbus/message-event-bus-destination/message-event-bus-destination.ee.js.map +0 -1
- package/dist/executions/execution-data.service.js.map +0 -1
- package/dist/executions/legacy-sqlite-execution-recovery.service.d.ts +0 -11
- package/dist/executions/legacy-sqlite-execution-recovery.service.js +0 -48
- package/dist/executions/legacy-sqlite-execution-recovery.service.js.map +0 -1
- package/dist/modules/breaking-changes/rules/v2/git-node-bare-repos.rule.d.ts +0 -10
- package/dist/modules/breaking-changes/rules/v2/git-node-bare-repos.rule.js +0 -66
- package/dist/modules/breaking-changes/rules/v2/git-node-bare-repos.rule.js.map +0 -1
- package/dist/modules/breaking-changes/rules/v2/sqlite-legacy-driver.rule.d.ts +0 -9
- package/dist/modules/breaking-changes/rules/v2/sqlite-legacy-driver.rule.js +0 -75
- package/dist/modules/breaking-changes/rules/v2/sqlite-legacy-driver.rule.js.map +0 -1
- package/dist/sso.ee/oidc/constants.js.map +0 -1
- package/dist/sso.ee/oidc/oidc.service.ee.js.map +0 -1
- package/dist/sso.ee/oidc/routes/oidc.controller.ee.js.map +0 -1
- package/dist/sso.ee/saml/constants.js.map +0 -1
- package/dist/sso.ee/saml/errors/invalid-saml-metadata-url.error.js.map +0 -1
- package/dist/sso.ee/saml/errors/invalid-saml-metadata.error.js.map +0 -1
- package/dist/sso.ee/saml/middleware/saml-enabled-middleware.js.map +0 -1
- package/dist/sso.ee/saml/routes/saml.controller.ee.js.map +0 -1
- package/dist/sso.ee/saml/saml-helpers.js.map +0 -1
- package/dist/sso.ee/saml/saml-validator.js.map +0 -1
- package/dist/sso.ee/saml/saml.service.ee.js.map +0 -1
- package/dist/sso.ee/saml/schema/metadata-exchange.xsd.js.map +0 -1
- package/dist/sso.ee/saml/schema/oasis-200401-wss-wssecurity-secext-1.0.xsd.js.map +0 -1
- package/dist/sso.ee/saml/schema/oasis-200401-wss-wssecurity-utility-1.0.xsd.js.map +0 -1
- package/dist/sso.ee/saml/schema/ws-addr.xsd.js.map +0 -1
- package/dist/sso.ee/saml/schema/ws-authorization.xsd.js.map +0 -1
- package/dist/sso.ee/saml/schema/xenc-schema.xsd.js.map +0 -1
- package/dist/sso.ee/saml/schema/xml.xsd.js.map +0 -1
- package/dist/sso.ee/saml/service-provider.ee.js.map +0 -1
- package/dist/sso.ee/saml/views/init-sso-post.js.map +0 -1
- package/dist/{sso.ee/saml → executions/execution-data}/types.js +0 -0
- package/dist/{eventbus/message-event-bus-destination → modules/log-streaming.ee/destinations}/message-event-bus-destination-from-db.js +0 -0
- package/dist/{sso.ee/oidc → modules/sso-oidc}/constants.d.ts +0 -0
- package/dist/{sso.ee/oidc → modules/sso-oidc}/constants.js +0 -0
- package/dist/{sso.ee/oidc → modules/sso-oidc}/oidc.service.ee.d.ts +0 -0
- package/dist/{sso.ee/saml → modules/sso-saml}/constants.d.ts +0 -0
- package/dist/{sso.ee/saml → modules/sso-saml}/constants.js +0 -0
- package/dist/{sso.ee/saml → modules/sso-saml}/errors/invalid-saml-metadata-url.error.d.ts +0 -0
- package/dist/{sso.ee/saml → modules/sso-saml}/errors/invalid-saml-metadata-url.error.js +0 -0
- package/dist/{sso.ee/saml → modules/sso-saml}/errors/invalid-saml-metadata.error.d.ts +0 -0
- package/dist/{sso.ee/saml → modules/sso-saml}/errors/invalid-saml-metadata.error.js +0 -0
- package/dist/{sso.ee/saml → modules/sso-saml}/middleware/saml-enabled-middleware.d.ts +0 -0
- package/dist/{sso.ee/saml → modules/sso-saml}/saml-validator.d.ts +0 -0
- package/dist/{sso.ee/saml → modules/sso-saml}/saml-validator.js +0 -0
- package/dist/{sso.ee/saml → modules/sso-saml}/saml.service.ee.d.ts +2 -2
- /package/dist/{sso.ee/saml → modules/sso-saml}/schema/metadata-exchange.xsd.d.ts +0 -0
- /package/dist/{sso.ee/saml → modules/sso-saml}/schema/metadata-exchange.xsd.js +0 -0
- /package/dist/{sso.ee/saml → modules/sso-saml}/schema/oasis-200401-wss-wssecurity-secext-1.0.xsd.d.ts +0 -0
- /package/dist/{sso.ee/saml → modules/sso-saml}/schema/oasis-200401-wss-wssecurity-secext-1.0.xsd.js +0 -0
- /package/dist/{sso.ee/saml → modules/sso-saml}/schema/oasis-200401-wss-wssecurity-utility-1.0.xsd.d.ts +0 -0
- /package/dist/{sso.ee/saml → modules/sso-saml}/schema/oasis-200401-wss-wssecurity-utility-1.0.xsd.js +0 -0
- /package/dist/{sso.ee/saml → modules/sso-saml}/schema/saml-schema-assertion-2.0.xsd.d.ts +0 -0
- /package/dist/{sso.ee/saml → modules/sso-saml}/schema/saml-schema-assertion-2.0.xsd.js +0 -0
- /package/dist/{sso.ee/saml → modules/sso-saml}/schema/saml-schema-metadata-2.0.xsd.d.ts +0 -0
- /package/dist/{sso.ee/saml → modules/sso-saml}/schema/saml-schema-metadata-2.0.xsd.js +0 -0
- /package/dist/{sso.ee/saml → modules/sso-saml}/schema/saml-schema-protocol-2.0.xsd.d.ts +0 -0
- /package/dist/{sso.ee/saml → modules/sso-saml}/schema/saml-schema-protocol-2.0.xsd.js +0 -0
- /package/dist/{sso.ee/saml → modules/sso-saml}/schema/ws-addr.xsd.d.ts +0 -0
- /package/dist/{sso.ee/saml → modules/sso-saml}/schema/ws-addr.xsd.js +0 -0
- /package/dist/{sso.ee/saml → modules/sso-saml}/schema/ws-authorization.xsd.d.ts +0 -0
- /package/dist/{sso.ee/saml → modules/sso-saml}/schema/ws-authorization.xsd.js +0 -0
- /package/dist/{sso.ee/saml → modules/sso-saml}/schema/ws-federation.xsd.d.ts +0 -0
- /package/dist/{sso.ee/saml → modules/sso-saml}/schema/ws-federation.xsd.js +0 -0
- /package/dist/{sso.ee/saml → modules/sso-saml}/schema/ws-securitypolicy-1.2.xsd.d.ts +0 -0
- /package/dist/{sso.ee/saml → modules/sso-saml}/schema/ws-securitypolicy-1.2.xsd.js +0 -0
- /package/dist/{sso.ee/saml → modules/sso-saml}/schema/xenc-schema.xsd.d.ts +0 -0
- /package/dist/{sso.ee/saml → modules/sso-saml}/schema/xenc-schema.xsd.js +0 -0
- /package/dist/{sso.ee/saml → modules/sso-saml}/schema/xml.xsd.d.ts +0 -0
- /package/dist/{sso.ee/saml → modules/sso-saml}/schema/xml.xsd.js +0 -0
- /package/dist/{sso.ee/saml → modules/sso-saml}/schema/xmldsig-core-schema.xsd.d.ts +0 -0
- /package/dist/{sso.ee/saml → modules/sso-saml}/schema/xmldsig-core-schema.xsd.js +0 -0
- /package/dist/{sso.ee/saml → modules/sso-saml}/service-provider.ee.d.ts +0 -0
- /package/dist/{sso.ee/saml → modules/sso-saml}/service-provider.ee.js +0 -0
- /package/dist/{sso.ee/saml → modules/sso-saml}/types.d.ts +0 -0
- /package/dist/{sso.ee/saml → modules/sso-saml}/views/init-sso-post.d.ts +0 -0
- /package/dist/{sso.ee/saml → modules/sso-saml}/views/init-sso-post.js +0 -0
|
@@ -17,7 +17,10 @@ const db_1 = require("@n8n/db");
|
|
|
17
17
|
const di_1 = require("@n8n/di");
|
|
18
18
|
const n8n_core_1 = require("n8n-core");
|
|
19
19
|
const n8n_workflow_1 = require("n8n-workflow");
|
|
20
|
+
const uuid_1 = require("uuid");
|
|
20
21
|
const active_executions_1 = require("../../active-executions");
|
|
22
|
+
const chat_execution_manager_1 = require("../../chat/chat-execution-manager");
|
|
23
|
+
const execution_not_found_error_1 = require("../../errors/execution-not-found-error");
|
|
21
24
|
const bad_request_error_1 = require("../../errors/response-errors/bad-request.error");
|
|
22
25
|
const not_found_error_1 = require("../../errors/response-errors/not-found.error");
|
|
23
26
|
const execution_service_1 = require("../../executions/execution.service");
|
|
@@ -34,12 +37,14 @@ const chat_hub_types_1 = require("./chat-hub.types");
|
|
|
34
37
|
const chat_message_repository_1 = require("./chat-message.repository");
|
|
35
38
|
const chat_session_repository_1 = require("./chat-session.repository");
|
|
36
39
|
const stream_capturer_1 = require("./stream-capturer");
|
|
40
|
+
const utils_1 = require("../../chat/utils");
|
|
37
41
|
let ChatHubService = class ChatHubService {
|
|
38
|
-
constructor(logger, errorReporter, executionService, executionRepository, workflowExecutionService, workflowFinderService, workflowRepository, activeExecutions, sessionRepository, messageRepository, chatHubAgentService, chatHubCredentialsService, chatHubWorkflowService, chatHubModelsService, chatHubSettingsService, chatHubAttachmentService, instanceSettings, globalConfig) {
|
|
42
|
+
constructor(logger, errorReporter, executionService, executionRepository, executionManager, workflowExecutionService, workflowFinderService, workflowRepository, activeExecutions, sessionRepository, messageRepository, chatHubAgentService, chatHubCredentialsService, chatHubWorkflowService, chatHubModelsService, chatHubSettingsService, chatHubAttachmentService, instanceSettings, globalConfig) {
|
|
39
43
|
this.logger = logger;
|
|
40
44
|
this.errorReporter = errorReporter;
|
|
41
45
|
this.executionService = executionService;
|
|
42
46
|
this.executionRepository = executionRepository;
|
|
47
|
+
this.executionManager = executionManager;
|
|
43
48
|
this.workflowExecutionService = workflowExecutionService;
|
|
44
49
|
this.workflowFinderService = workflowFinderService;
|
|
45
50
|
this.workflowRepository = workflowRepository;
|
|
@@ -92,11 +97,9 @@ let ChatHubService = class ChatHubService {
|
|
|
92
97
|
const tz = timeZone ?? this.globalConfig.generic.timezone;
|
|
93
98
|
const credentialId = this.getModelCredential(model, credentials);
|
|
94
99
|
let processedAttachments = [];
|
|
95
|
-
let
|
|
96
|
-
let workflowData;
|
|
97
|
-
let responseMode;
|
|
100
|
+
let workflow;
|
|
98
101
|
try {
|
|
99
|
-
|
|
102
|
+
workflow = await this.messageRepository.manager.transaction(async (trx) => {
|
|
100
103
|
let session = await this.getChatSession(user, sessionId, trx);
|
|
101
104
|
session ??= await this.createChatSession(user, sessionId, model, credentialId, tools, payload.agentName, trx);
|
|
102
105
|
await this.ensurePreviousMessage(previousMessageId, sessionId, trx);
|
|
@@ -106,9 +109,6 @@ let ChatHubService = class ChatHubService {
|
|
|
106
109
|
await this.saveHumanMessage(payload, processedAttachments, user, previousMessageId, model, undefined, trx);
|
|
107
110
|
return await this.prepareReplyWorkflow(user, sessionId, credentials, model, history, message, tools, processedAttachments, tz, trx);
|
|
108
111
|
});
|
|
109
|
-
executionData = result.executionData;
|
|
110
|
-
workflowData = result.workflowData;
|
|
111
|
-
responseMode = result.responseMode;
|
|
112
112
|
}
|
|
113
113
|
catch (error) {
|
|
114
114
|
if (processedAttachments.length > 0) {
|
|
@@ -121,17 +121,41 @@ let ChatHubService = class ChatHubService {
|
|
|
121
121
|
}
|
|
122
122
|
throw error;
|
|
123
123
|
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
124
|
+
if (!workflow) {
|
|
125
|
+
throw new n8n_workflow_1.UnexpectedError('Failed to prepare chat workflow.');
|
|
126
|
+
}
|
|
127
|
+
const previousMessage = await this.ensurePreviousMessage(previousMessageId, sessionId);
|
|
128
|
+
if (model.provider === 'n8n' &&
|
|
129
|
+
workflow.responseMode === 'responseNodes' &&
|
|
130
|
+
previousMessage?.status === 'waiting' &&
|
|
131
|
+
previousMessage?.executionId) {
|
|
132
|
+
const execution = await this.executionRepository.findSingleExecution(previousMessage.executionId.toString(), {
|
|
133
|
+
includeData: true,
|
|
134
|
+
unflattenData: true,
|
|
135
|
+
});
|
|
136
|
+
if (!execution) {
|
|
137
|
+
throw new n8n_workflow_1.OperationalError('Chat session has expired.');
|
|
138
|
+
}
|
|
139
|
+
this.logger.debug(`Resuming execution ${execution.id} from waiting state for session ${sessionId}`);
|
|
140
|
+
await this.messageRepository.updateChatMessage(previousMessage.id, {
|
|
141
|
+
status: 'success',
|
|
128
142
|
});
|
|
143
|
+
return await this.resumeChatExecution(execution, message, sessionId, messageId, previousMessage.id, model, res, workflow.responseMode);
|
|
144
|
+
}
|
|
145
|
+
await this.executeChatWorkflowWithCleanup(res, user, model, workflow.workflowData, workflow.executionData, sessionId, messageId, null, workflow.responseMode);
|
|
146
|
+
if (previousMessageId === null) {
|
|
147
|
+
try {
|
|
148
|
+
await this.generateSessionTitle(user, sessionId, message, processedAttachments, credentials, model);
|
|
149
|
+
}
|
|
150
|
+
catch (error) {
|
|
151
|
+
this.logger.warn(`Title generation failed: ${error}`);
|
|
152
|
+
}
|
|
129
153
|
}
|
|
130
154
|
}
|
|
131
155
|
async editMessage(res, user, payload) {
|
|
132
156
|
const { sessionId, editId, messageId, message, model, credentials, timeZone } = payload;
|
|
133
157
|
const tz = timeZone ?? this.globalConfig.generic.timezone;
|
|
134
|
-
let workflow;
|
|
158
|
+
let workflow = null;
|
|
135
159
|
let newStoredAttachments = [];
|
|
136
160
|
try {
|
|
137
161
|
workflow = await this.messageRepository.manager.transaction(async (trx) => {
|
|
@@ -141,6 +165,9 @@ let ChatHubService = class ChatHubService {
|
|
|
141
165
|
}
|
|
142
166
|
const messageToEdit = await this.getChatMessage(session.id, editId, [], trx);
|
|
143
167
|
if (messageToEdit.type === 'ai') {
|
|
168
|
+
if (model.provider === 'n8n') {
|
|
169
|
+
throw new bad_request_error_1.BadRequestError('Editing AI messages with n8n workflow agents is not supported');
|
|
170
|
+
}
|
|
144
171
|
await this.messageRepository.updateChatMessage(editId, { content: payload.message }, trx);
|
|
145
172
|
return null;
|
|
146
173
|
}
|
|
@@ -179,12 +206,12 @@ let ChatHubService = class ChatHubService {
|
|
|
179
206
|
return;
|
|
180
207
|
}
|
|
181
208
|
const { workflowData, executionData, responseMode } = workflow;
|
|
182
|
-
await this.executeChatWorkflowWithCleanup(res, user, workflowData, executionData, sessionId, messageId,
|
|
209
|
+
await this.executeChatWorkflowWithCleanup(res, user, model, workflowData, executionData, sessionId, messageId, null, responseMode);
|
|
183
210
|
}
|
|
184
211
|
async regenerateAIMessage(res, user, payload) {
|
|
185
212
|
const { sessionId, retryId, model, credentials, timeZone } = payload;
|
|
186
213
|
const tz = timeZone ?? this.globalConfig.generic.timezone;
|
|
187
|
-
const {
|
|
214
|
+
const { retryOfMessageId, previousMessageId, workflow } = await this.messageRepository.manager.transaction(async (trx) => {
|
|
188
215
|
const session = await this.getChatSession(user, sessionId, trx);
|
|
189
216
|
if (!session) {
|
|
190
217
|
throw new not_found_error_1.NotFoundError('Chat session not found');
|
|
@@ -208,16 +235,16 @@ let ChatHubService = class ChatHubService {
|
|
|
208
235
|
const attachments = lastHumanMessage.attachments ?? [];
|
|
209
236
|
const workflow = await this.prepareReplyWorkflow(user, sessionId, credentials, model, history, message, session.tools, attachments, tz, trx);
|
|
210
237
|
return {
|
|
211
|
-
workflow,
|
|
212
238
|
previousMessageId: lastHumanMessage.id,
|
|
213
239
|
retryOfMessageId,
|
|
240
|
+
workflow,
|
|
214
241
|
};
|
|
215
242
|
});
|
|
216
|
-
await this.executeChatWorkflowWithCleanup(res, user, workflowData, executionData, sessionId, previousMessageId,
|
|
243
|
+
await this.executeChatWorkflowWithCleanup(res, user, model, workflow.workflowData, workflow.executionData, sessionId, previousMessageId, retryOfMessageId, workflow.responseMode);
|
|
217
244
|
}
|
|
218
245
|
async prepareReplyWorkflow(user, sessionId, credentials, model, history, message, tools, attachments, timeZone, trx) {
|
|
219
246
|
if (model.provider === 'n8n') {
|
|
220
|
-
return await this.
|
|
247
|
+
return await this.prepareWorkflowAgentWorkflow(user, sessionId, model.workflowId, message, attachments, trx);
|
|
221
248
|
}
|
|
222
249
|
if (model.provider === 'custom-agent') {
|
|
223
250
|
return await this.prepareChatAgentWorkflow(model.agentId, user, sessionId, history, message, attachments, timeZone, trx);
|
|
@@ -231,7 +258,7 @@ let ChatHubService = class ChatHubService {
|
|
|
231
258
|
return await this.chatHubWorkflowService.createChatWorkflow(user.id, sessionId, projectId, history, message, attachments, credentials, model, systemMessage, tools, timeZone, trx);
|
|
232
259
|
}
|
|
233
260
|
async prepareChatAgentWorkflow(agentId, user, sessionId, history, message, attachments, timeZone, trx) {
|
|
234
|
-
const agent = await this.chatHubAgentService.getAgentById(agentId, user.id);
|
|
261
|
+
const agent = await this.chatHubAgentService.getAgentById(agentId, user.id, trx);
|
|
235
262
|
if (!agent) {
|
|
236
263
|
throw new bad_request_error_1.BadRequestError('Agent not found');
|
|
237
264
|
}
|
|
@@ -256,8 +283,8 @@ let ChatHubService = class ChatHubService {
|
|
|
256
283
|
const { tools } = agent;
|
|
257
284
|
return await this.prepareBaseChatWorkflow(user, sessionId, credentials, model, history, message, systemMessage, tools, attachments, timeZone, trx);
|
|
258
285
|
}
|
|
259
|
-
async
|
|
260
|
-
const workflow = await this.workflowFinderService.findWorkflowForUser(workflowId, user, ['workflow:execute-chat'], { includeTags: false, includeParentFolder: false, includeActiveVersion: true });
|
|
286
|
+
async prepareWorkflowAgentWorkflow(user, sessionId, workflowId, message, attachments, trx) {
|
|
287
|
+
const workflow = await this.workflowFinderService.findWorkflowForUser(workflowId, user, ['workflow:execute-chat'], { includeTags: false, includeParentFolder: false, includeActiveVersion: true, em: trx });
|
|
261
288
|
if (!workflow?.activeVersion) {
|
|
262
289
|
throw new bad_request_error_1.BadRequestError('Workflow not found');
|
|
263
290
|
}
|
|
@@ -277,12 +304,12 @@ let ChatHubService = class ChatHubService {
|
|
|
277
304
|
throw new bad_request_error_1.BadRequestError('Chat Trigger node must be made available in Chat');
|
|
278
305
|
}
|
|
279
306
|
const responseMode = chatTriggerParams.options?.responseMode ?? 'streaming';
|
|
280
|
-
if (responseMode
|
|
281
|
-
throw new bad_request_error_1.BadRequestError('Chat Trigger node response mode must be set to
|
|
307
|
+
if (!chat_hub_constants_1.SUPPORTED_RESPONSE_MODES.includes(responseMode)) {
|
|
308
|
+
throw new bad_request_error_1.BadRequestError('Chat Trigger node response mode must be set to "When Last Node Finishes", "Using Response Nodes" or "Streaming" to use the workflow on Chat');
|
|
282
309
|
}
|
|
283
|
-
const chatResponseNodes = workflow.activeVersion.nodes.filter((node) => node.type === n8n_workflow_1.
|
|
284
|
-
if (chatResponseNodes.length > 0) {
|
|
285
|
-
throw new bad_request_error_1.BadRequestError('
|
|
310
|
+
const chatResponseNodes = workflow.activeVersion.nodes.filter((node) => node.type === n8n_workflow_1.CHAT_NODE_TYPE);
|
|
311
|
+
if (chatResponseNodes.length > 0 && responseMode !== 'responseNodes') {
|
|
312
|
+
throw new bad_request_error_1.BadRequestError('Chat nodes are not supported with the selected response mode. Please set the response mode to "Using Response Nodes" or remove the nodes from the workflow.');
|
|
286
313
|
}
|
|
287
314
|
const agentNodes = workflow.activeVersion.nodes?.filter((node) => node.type === n8n_workflow_1.AGENT_LANGCHAIN_NODE_TYPE);
|
|
288
315
|
if (agentNodes.some((node) => node.typeVersion < chat_hub_constants_1.TOOLS_AGENT_NODE_MIN_VERSION)) {
|
|
@@ -301,6 +328,10 @@ let ChatHubService = class ChatHubService {
|
|
|
301
328
|
...workflow,
|
|
302
329
|
nodes: workflow.activeVersion.nodes,
|
|
303
330
|
connections: workflow.activeVersion.connections,
|
|
331
|
+
settings: {
|
|
332
|
+
...workflow.settings,
|
|
333
|
+
saveDataSuccessExecution: 'all',
|
|
334
|
+
},
|
|
304
335
|
};
|
|
305
336
|
return {
|
|
306
337
|
workflowData,
|
|
@@ -316,6 +347,7 @@ let ChatHubService = class ChatHubService {
|
|
|
316
347
|
if (!previousMessage) {
|
|
317
348
|
throw new bad_request_error_1.BadRequestError('The previous message does not exist in the session');
|
|
318
349
|
}
|
|
350
|
+
return previousMessage;
|
|
319
351
|
}
|
|
320
352
|
async stopGeneration(user, sessionId, messageId) {
|
|
321
353
|
await this.ensureConversation(user.id, sessionId);
|
|
@@ -335,11 +367,210 @@ let ChatHubService = class ChatHubService {
|
|
|
335
367
|
await this.executionService.stop(message.execution.id, [message.execution.workflowId]);
|
|
336
368
|
await this.messageRepository.updateChatMessage(messageId, { status: 'cancelled' });
|
|
337
369
|
}
|
|
338
|
-
async executeChatWorkflow(res, user, workflowData, executionData, sessionId, previousMessageId,
|
|
370
|
+
async executeChatWorkflow(res, user, model, workflowData, executionData, sessionId, previousMessageId, retryOfMessageId = null, executionMode = 'chat', responseMode) {
|
|
339
371
|
this.logger.debug(`Starting execution of workflow "${workflowData.name}" with ID ${workflowData.id}`);
|
|
340
|
-
if (responseMode
|
|
372
|
+
if (!chat_hub_constants_1.SUPPORTED_RESPONSE_MODES.includes(responseMode)) {
|
|
341
373
|
throw new bad_request_error_1.BadRequestError(`Response mode "${responseMode}" is not supported yet.`);
|
|
342
374
|
}
|
|
375
|
+
if (responseMode === 'lastNode' || responseMode === 'responseNodes') {
|
|
376
|
+
return await this.executeLastNode(res, user, model, workflowData, executionData, sessionId, previousMessageId, retryOfMessageId, executionMode, responseMode);
|
|
377
|
+
}
|
|
378
|
+
else if (responseMode === 'streaming') {
|
|
379
|
+
return await this.executeWithStreaming(res, user, model, workflowData, executionData, sessionId, previousMessageId, retryOfMessageId, executionMode);
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
async executeLastNode(res, user, model, workflowData, executionData, sessionId, previousMessageId, retryOfMessageId, executionMode, responseMode) {
|
|
383
|
+
const running = await this.workflowExecutionService.executeChatWorkflow(user, workflowData, executionData, undefined, false, executionMode);
|
|
384
|
+
const messageId = (0, uuid_1.v4)();
|
|
385
|
+
const executionId = running.executionId;
|
|
386
|
+
if (!executionId) {
|
|
387
|
+
throw new n8n_workflow_1.OperationalError('There was a problem starting the chat execution.');
|
|
388
|
+
}
|
|
389
|
+
await this.beginResponse(res, executionId, messageId, sessionId, model, previousMessageId, retryOfMessageId);
|
|
390
|
+
try {
|
|
391
|
+
await this.waitForExecutionCompletion(executionId);
|
|
392
|
+
const execution = await this.executionRepository.findSingleExecution(executionId, {
|
|
393
|
+
includeData: true,
|
|
394
|
+
unflattenData: true,
|
|
395
|
+
});
|
|
396
|
+
if (!execution) {
|
|
397
|
+
throw new n8n_workflow_1.OperationalError('Chat execution not found after completion - make sure your instance is saving executions.');
|
|
398
|
+
}
|
|
399
|
+
if (!['success', 'waiting', 'canceled'].includes(execution.status)) {
|
|
400
|
+
const errorMessage = this.getErrorMessage(execution) ?? 'Failed to generate a response';
|
|
401
|
+
throw new n8n_workflow_1.OperationalError(errorMessage);
|
|
402
|
+
}
|
|
403
|
+
const message = this.getMessage(execution, responseMode);
|
|
404
|
+
const status = execution?.status === 'waiting' ? 'waiting' : 'success';
|
|
405
|
+
await this.endResponse(res, message ?? '', status, executionId, messageId, previousMessageId, retryOfMessageId);
|
|
406
|
+
if (status === 'waiting' && responseMode === 'responseNodes') {
|
|
407
|
+
const lastNode = (0, utils_1.getLastNodeExecuted)(execution);
|
|
408
|
+
if (lastNode && (0, utils_1.shouldResumeImmediately)(lastNode)) {
|
|
409
|
+
this.logger.debug(`Resuming execution ${execution.id} immediately after wait in node ${lastNode.name}`);
|
|
410
|
+
await this.resumeChatExecution(execution, '', sessionId, messageId, messageId, model, res, responseMode);
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
catch (e) {
|
|
415
|
+
if (e instanceof n8n_workflow_1.ManualExecutionCancelledError) {
|
|
416
|
+
return;
|
|
417
|
+
}
|
|
418
|
+
const message = e instanceof Error ? e.message : 'Unknown error occurred during chat execution';
|
|
419
|
+
await this.endResponse(res, message ?? '', 'error', executionId, messageId, previousMessageId, retryOfMessageId);
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
async resumeChatExecution(execution, message, sessionId, messageId, previousMessageId, model, res, responseMode) {
|
|
423
|
+
await this.messageRepository.updateChatMessage(previousMessageId, {
|
|
424
|
+
status: 'success',
|
|
425
|
+
});
|
|
426
|
+
while (true) {
|
|
427
|
+
await this.resumeExecution(sessionId, execution, message);
|
|
428
|
+
previousMessageId = messageId;
|
|
429
|
+
messageId = (0, uuid_1.v4)();
|
|
430
|
+
await this.beginResponse(res, execution.id, messageId, sessionId, model, previousMessageId, null);
|
|
431
|
+
await this.waitForExecutionCompletion(execution.id);
|
|
432
|
+
const completed = await this.executionRepository.findSingleExecution(execution.id, {
|
|
433
|
+
includeData: true,
|
|
434
|
+
unflattenData: true,
|
|
435
|
+
});
|
|
436
|
+
if (!completed) {
|
|
437
|
+
throw new n8n_workflow_1.OperationalError('Chat execution not found after completion - make sure your instance is saving executions.');
|
|
438
|
+
}
|
|
439
|
+
if (!['success', 'waiting', 'canceled'].includes(completed.status)) {
|
|
440
|
+
const message = this.getErrorMessage(completed) ?? 'Failed to generate a response';
|
|
441
|
+
throw new n8n_workflow_1.OperationalError(message);
|
|
442
|
+
}
|
|
443
|
+
const reply = this.getMessage(completed, responseMode);
|
|
444
|
+
const status = completed?.status === 'waiting' ? 'waiting' : 'success';
|
|
445
|
+
await this.endResponse(res, reply ?? '', status, execution.id, messageId, previousMessageId, null);
|
|
446
|
+
const lastNode = (0, utils_1.getLastNodeExecuted)(completed);
|
|
447
|
+
if (status === 'waiting' && lastNode && (0, utils_1.shouldResumeImmediately)(lastNode)) {
|
|
448
|
+
this.logger.debug(`Resuming execution ${completed.id} immediately after wait in node ${lastNode.name}`);
|
|
449
|
+
await this.messageRepository.updateChatMessage(messageId, {
|
|
450
|
+
status: 'success',
|
|
451
|
+
});
|
|
452
|
+
message = '';
|
|
453
|
+
execution = completed;
|
|
454
|
+
}
|
|
455
|
+
else {
|
|
456
|
+
return;
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
getMessage(execution, responseMode) {
|
|
461
|
+
const nodeName = this.getLastNodeExecuted(execution);
|
|
462
|
+
if (!nodeName)
|
|
463
|
+
return undefined;
|
|
464
|
+
const outputs = this.getNodeOutputs(execution, nodeName);
|
|
465
|
+
const entry = this.getFirstOutputEntry(outputs);
|
|
466
|
+
if (!entry)
|
|
467
|
+
return undefined;
|
|
468
|
+
const message = this.extractMessage(entry, responseMode);
|
|
469
|
+
if (typeof message === 'object' && message !== null) {
|
|
470
|
+
return (0, n8n_workflow_1.jsonStringify)(message);
|
|
471
|
+
}
|
|
472
|
+
return message;
|
|
473
|
+
}
|
|
474
|
+
getLastNodeExecuted(execution) {
|
|
475
|
+
const lastNodeExecuted = execution.data.resultData.lastNodeExecuted;
|
|
476
|
+
return typeof lastNodeExecuted === 'string' ? lastNodeExecuted : undefined;
|
|
477
|
+
}
|
|
478
|
+
getNodeOutputs(execution, nodeName) {
|
|
479
|
+
const runData = execution.data.resultData.runData[nodeName];
|
|
480
|
+
if (!runData || runData.length === 0)
|
|
481
|
+
return [];
|
|
482
|
+
const runIndex = runData.length - 1;
|
|
483
|
+
const data = runData[runIndex]?.data;
|
|
484
|
+
return data?.main ?? data?.[n8n_workflow_1.NodeConnectionTypes.AiTool] ?? [];
|
|
485
|
+
}
|
|
486
|
+
getFirstOutputEntry(outputs) {
|
|
487
|
+
for (const branch of outputs) {
|
|
488
|
+
if (!Array.isArray(branch) || branch.length === 0)
|
|
489
|
+
continue;
|
|
490
|
+
return branch[0];
|
|
491
|
+
}
|
|
492
|
+
return undefined;
|
|
493
|
+
}
|
|
494
|
+
extractMessage(entry, responseMode) {
|
|
495
|
+
if (responseMode === 'responseNodes') {
|
|
496
|
+
return entry.sendMessage ?? '';
|
|
497
|
+
}
|
|
498
|
+
if (responseMode === 'lastNode') {
|
|
499
|
+
const response = entry.json ?? {};
|
|
500
|
+
const message = response.output ?? response.text ?? response.message ?? '';
|
|
501
|
+
return typeof message === 'string' ? message : (0, n8n_workflow_1.jsonStringify)(message);
|
|
502
|
+
}
|
|
503
|
+
return undefined;
|
|
504
|
+
}
|
|
505
|
+
async beginResponse(res, executionId, messageId, sessionId, model, previousMessageId, retryOfMessageId) {
|
|
506
|
+
const beginChunk = {
|
|
507
|
+
type: 'begin',
|
|
508
|
+
metadata: {
|
|
509
|
+
timestamp: Date.now(),
|
|
510
|
+
messageId,
|
|
511
|
+
previousMessageId,
|
|
512
|
+
retryOfMessageId,
|
|
513
|
+
executionId: executionId ? parseInt(executionId, 10) : null,
|
|
514
|
+
},
|
|
515
|
+
};
|
|
516
|
+
if (!res.headersSent) {
|
|
517
|
+
res.writeHead(200, chat_hub_constants_1.JSONL_STREAM_HEADERS);
|
|
518
|
+
res.flushHeaders();
|
|
519
|
+
}
|
|
520
|
+
res.write((0, n8n_workflow_1.jsonStringify)(beginChunk) + '\n');
|
|
521
|
+
res.flush();
|
|
522
|
+
await this.saveAIMessage({
|
|
523
|
+
id: messageId,
|
|
524
|
+
content: '',
|
|
525
|
+
sessionId,
|
|
526
|
+
executionId: executionId ?? undefined,
|
|
527
|
+
model,
|
|
528
|
+
previousMessageId,
|
|
529
|
+
retryOfMessageId,
|
|
530
|
+
status: 'running',
|
|
531
|
+
});
|
|
532
|
+
}
|
|
533
|
+
async endResponse(res, content, status, executionId, messageId, previousMessageId, retryOfMessageId) {
|
|
534
|
+
const contentChunk = {
|
|
535
|
+
type: status === 'error' ? 'error' : 'item',
|
|
536
|
+
content,
|
|
537
|
+
metadata: {
|
|
538
|
+
timestamp: Date.now(),
|
|
539
|
+
messageId,
|
|
540
|
+
previousMessageId,
|
|
541
|
+
retryOfMessageId,
|
|
542
|
+
executionId: executionId ? parseInt(executionId, 10) : null,
|
|
543
|
+
},
|
|
544
|
+
};
|
|
545
|
+
res.write((0, n8n_workflow_1.jsonStringify)(contentChunk) + '\n');
|
|
546
|
+
res.flush();
|
|
547
|
+
if (status !== 'error') {
|
|
548
|
+
const endChunk = {
|
|
549
|
+
type: 'end',
|
|
550
|
+
metadata: {
|
|
551
|
+
timestamp: Date.now(),
|
|
552
|
+
messageId,
|
|
553
|
+
previousMessageId,
|
|
554
|
+
retryOfMessageId,
|
|
555
|
+
executionId: executionId ? parseInt(executionId, 10) : null,
|
|
556
|
+
},
|
|
557
|
+
};
|
|
558
|
+
res.write((0, n8n_workflow_1.jsonStringify)(endChunk) + '\n');
|
|
559
|
+
res.flush();
|
|
560
|
+
}
|
|
561
|
+
await this.messageRepository.updateChatMessage(messageId, {
|
|
562
|
+
content,
|
|
563
|
+
status,
|
|
564
|
+
});
|
|
565
|
+
}
|
|
566
|
+
async resumeExecution(sessionId, execution, message) {
|
|
567
|
+
await this.executionManager.runWorkflow(execution, {
|
|
568
|
+
action: 'sendMessage',
|
|
569
|
+
chatInput: message,
|
|
570
|
+
sessionId,
|
|
571
|
+
});
|
|
572
|
+
}
|
|
573
|
+
async executeWithStreaming(res, user, model, workflowData, executionData, sessionId, previousMessageId, retryOfMessageId, executionMode) {
|
|
343
574
|
let executionId = undefined;
|
|
344
575
|
const aggregator = (0, stream_capturer_1.createStructuredChunkAggregator)(previousMessageId, retryOfMessageId, {
|
|
345
576
|
onBegin: async (message) => {
|
|
@@ -391,17 +622,17 @@ let ChatHubService = class ChatHubService {
|
|
|
391
622
|
: 'Request was not processed';
|
|
392
623
|
}
|
|
393
624
|
const message = await aggregator.ingest(chunk);
|
|
394
|
-
const
|
|
625
|
+
const messageChunk = {
|
|
395
626
|
...chunk,
|
|
396
627
|
metadata: {
|
|
397
|
-
|
|
628
|
+
timestamp: chunk.metadata.timestamp,
|
|
398
629
|
messageId: message.id,
|
|
399
630
|
previousMessageId: message.previousMessageId,
|
|
400
631
|
retryOfMessageId: message.retryOfMessageId,
|
|
401
632
|
executionId: executionId ? +executionId : null,
|
|
402
633
|
},
|
|
403
634
|
};
|
|
404
|
-
return (0, n8n_workflow_1.jsonStringify)(
|
|
635
|
+
return (0, n8n_workflow_1.jsonStringify)(messageChunk) + '\n';
|
|
405
636
|
};
|
|
406
637
|
const stream = (0, stream_capturer_1.interceptResponseWrites)(res, transform);
|
|
407
638
|
let onStreamClosed = () => { };
|
|
@@ -413,7 +644,7 @@ let ChatHubService = class ChatHubService {
|
|
|
413
644
|
stream.on('close', onStreamClosed);
|
|
414
645
|
stream.writeHead(200, chat_hub_constants_1.JSONL_STREAM_HEADERS);
|
|
415
646
|
stream.flushHeaders();
|
|
416
|
-
const execution = await this.workflowExecutionService.executeChatWorkflow(workflowData, executionData,
|
|
647
|
+
const execution = await this.workflowExecutionService.executeChatWorkflow(user, workflowData, executionData, stream, true, executionMode);
|
|
417
648
|
executionId = execution.executionId;
|
|
418
649
|
if (!executionId) {
|
|
419
650
|
throw new n8n_workflow_1.OperationalError('There was a problem starting the chat execution.');
|
|
@@ -446,14 +677,19 @@ let ChatHubService = class ChatHubService {
|
|
|
446
677
|
return await new Promise((resolve, reject) => {
|
|
447
678
|
const poller = setInterval(async () => {
|
|
448
679
|
try {
|
|
449
|
-
const
|
|
680
|
+
const execution = await this.executionRepository.findSingleExecution(executionId, {
|
|
450
681
|
includeData: false,
|
|
451
682
|
unflattenData: false,
|
|
452
683
|
});
|
|
453
|
-
if (!
|
|
454
|
-
this.logger.debug(`Execution ${executionId} finished with status ${
|
|
684
|
+
if (!execution || chat_hub_constants_1.EXECUTION_FINISHED_STATUSES.includes(execution.status)) {
|
|
685
|
+
this.logger.debug(`Execution ${executionId} finished with status ${execution?.status ?? 'missing'}`);
|
|
455
686
|
clearInterval(poller);
|
|
456
|
-
|
|
687
|
+
if (execution?.status === 'canceled') {
|
|
688
|
+
reject(new n8n_workflow_1.ManualExecutionCancelledError(executionId));
|
|
689
|
+
}
|
|
690
|
+
else {
|
|
691
|
+
resolve();
|
|
692
|
+
}
|
|
457
693
|
}
|
|
458
694
|
}
|
|
459
695
|
catch (error) {
|
|
@@ -485,19 +721,22 @@ let ChatHubService = class ChatHubService {
|
|
|
485
721
|
}
|
|
486
722
|
}
|
|
487
723
|
catch (error) {
|
|
488
|
-
if (error instanceof
|
|
724
|
+
if (error instanceof execution_not_found_error_1.ExecutionNotFoundError) {
|
|
489
725
|
return;
|
|
490
726
|
}
|
|
727
|
+
if (error instanceof n8n_workflow_1.ManualExecutionCancelledError) {
|
|
728
|
+
throw error;
|
|
729
|
+
}
|
|
491
730
|
if (error instanceof Error) {
|
|
492
731
|
this.logger.error(`Error during chat workflow execution: ${error}`);
|
|
493
732
|
}
|
|
494
733
|
throw error;
|
|
495
734
|
}
|
|
496
735
|
}
|
|
497
|
-
async executeChatWorkflowWithCleanup(res, user, workflowData, executionData, sessionId, previousMessageId,
|
|
736
|
+
async executeChatWorkflowWithCleanup(res, user, model, workflowData, executionData, sessionId, previousMessageId, retryOfMessageId, responseMode) {
|
|
498
737
|
try {
|
|
499
738
|
const executionMode = model.provider === 'n8n' ? 'webhook' : 'chat';
|
|
500
|
-
await this.executeChatWorkflow(res, user, workflowData, executionData, sessionId, previousMessageId,
|
|
739
|
+
await this.executeChatWorkflow(res, user, model, workflowData, executionData, sessionId, previousMessageId, retryOfMessageId, executionMode, responseMode);
|
|
501
740
|
}
|
|
502
741
|
finally {
|
|
503
742
|
if (model.provider !== 'n8n') {
|
|
@@ -513,12 +752,6 @@ let ChatHubService = class ChatHubService {
|
|
|
513
752
|
await this.sessionRepository.updateChatSession(sessionId, { title });
|
|
514
753
|
}
|
|
515
754
|
}
|
|
516
|
-
catch (error) {
|
|
517
|
-
if (error instanceof Error) {
|
|
518
|
-
this.logger.error(`Error during session title generation workflow execution: ${error}`);
|
|
519
|
-
}
|
|
520
|
-
throw error;
|
|
521
|
-
}
|
|
522
755
|
finally {
|
|
523
756
|
await this.deleteChatWorkflow(workflowData.id);
|
|
524
757
|
}
|
|
@@ -552,24 +785,24 @@ let ChatHubService = class ChatHubService {
|
|
|
552
785
|
async resolveFromN8nWorkflow(user, { workflowId }, trx) {
|
|
553
786
|
const workflowEntity = await this.workflowFinderService.findWorkflowForUser(workflowId, user, ['workflow:execute-chat'], { includeTags: false, includeParentFolder: false, includeActiveVersion: true, em: trx });
|
|
554
787
|
if (!workflowEntity?.activeVersion) {
|
|
555
|
-
throw new
|
|
788
|
+
throw new n8n_workflow_1.UserError('Workflow not found for title generation');
|
|
556
789
|
}
|
|
557
790
|
const modelNodes = this.findSupportedLLMNodes(workflowEntity.activeVersion.nodes);
|
|
558
791
|
this.logger.debug(`Found ${modelNodes.length} LLM nodes in workflow ${workflowEntity.id} for title generation`);
|
|
559
792
|
if (modelNodes.length === 0) {
|
|
560
|
-
throw new
|
|
793
|
+
throw new n8n_workflow_1.UserError('No supported Model nodes found in workflow for title generation');
|
|
561
794
|
}
|
|
562
795
|
const modelNode = modelNodes[0];
|
|
563
796
|
const llmModel = modelNode.node.parameters?.model?.value;
|
|
564
797
|
if (!llmModel) {
|
|
565
|
-
throw new
|
|
798
|
+
throw new n8n_workflow_1.UserError(`No model set on Model node "${modelNode.node.name}" for title generation`);
|
|
566
799
|
}
|
|
567
800
|
if (typeof llmModel !== 'string' || llmModel.length === 0 || llmModel.startsWith('=')) {
|
|
568
|
-
throw new
|
|
801
|
+
throw new n8n_workflow_1.UserError(`Invalid model set on Model node "${modelNode.node.name}" for title generation`);
|
|
569
802
|
}
|
|
570
803
|
const llmCredentials = modelNode.node.credentials;
|
|
571
804
|
if (!llmCredentials) {
|
|
572
|
-
throw new
|
|
805
|
+
throw new n8n_workflow_1.UserError(`No credentials found on Model node "${modelNode.node.name}" for title generation`);
|
|
573
806
|
}
|
|
574
807
|
const { credentialId, projectId } = await this.chatHubCredentialsService.findWorkflowCredentialAndProject(modelNode.provider, llmCredentials, workflowId);
|
|
575
808
|
const resolvedModel = {
|
|
@@ -595,7 +828,7 @@ let ChatHubService = class ChatHubService {
|
|
|
595
828
|
}, []);
|
|
596
829
|
}
|
|
597
830
|
async resolveFromCustomAgent(user, model, trx) {
|
|
598
|
-
const agent = await this.chatHubAgentService.getAgentById(model.agentId, user.id);
|
|
831
|
+
const agent = await this.chatHubAgentService.getAgentById(model.agentId, user.id, trx);
|
|
599
832
|
if (!agent) {
|
|
600
833
|
throw new bad_request_error_1.BadRequestError('Agent not found for title generation');
|
|
601
834
|
}
|
|
@@ -617,7 +850,7 @@ let ChatHubService = class ChatHubService {
|
|
|
617
850
|
return { resolvedCredentials, resolvedModel, credentialId, projectId };
|
|
618
851
|
}
|
|
619
852
|
async runTitleWorkflowAndGetTitle(user, workflowData, executionData) {
|
|
620
|
-
const { executionId } = await this.workflowExecutionService.executeChatWorkflow(workflowData, executionData,
|
|
853
|
+
const { executionId } = await this.workflowExecutionService.executeChatWorkflow(user, workflowData, executionData, undefined, false, 'chat');
|
|
621
854
|
await this.waitForExecutionCompletion(executionId);
|
|
622
855
|
const execution = await this.executionRepository.findWithUnflattenedData(executionId, [
|
|
623
856
|
workflowData.id,
|
|
@@ -668,7 +901,7 @@ let ChatHubService = class ChatHubService {
|
|
|
668
901
|
return await this.sessionRepository.getOneById(sessionId, user.id, trx);
|
|
669
902
|
}
|
|
670
903
|
async createChatSession(user, sessionId, model, credentialId, tools, agentName, trx) {
|
|
671
|
-
await this.ensureValidModel(user, model);
|
|
904
|
+
await this.ensureValidModel(user, model, trx);
|
|
672
905
|
return await this.sessionRepository.createChatSession({
|
|
673
906
|
id: sessionId,
|
|
674
907
|
ownerId: user.id,
|
|
@@ -797,15 +1030,15 @@ let ChatHubService = class ChatHubService {
|
|
|
797
1030
|
await this.sessionRepository.deleteChatHubSession(sessionId, trx);
|
|
798
1031
|
});
|
|
799
1032
|
}
|
|
800
|
-
async ensureValidModel(user, model) {
|
|
1033
|
+
async ensureValidModel(user, model, trx) {
|
|
801
1034
|
if (model.provider === 'custom-agent') {
|
|
802
|
-
const agent = await this.chatHubAgentService.getAgentById(model.agentId, user.id);
|
|
1035
|
+
const agent = await this.chatHubAgentService.getAgentById(model.agentId, user.id, trx);
|
|
803
1036
|
if (!agent) {
|
|
804
1037
|
throw new bad_request_error_1.BadRequestError('Agent not found for chat session initialization');
|
|
805
1038
|
}
|
|
806
1039
|
}
|
|
807
1040
|
if (model.provider === 'n8n') {
|
|
808
|
-
const workflowEntity = await this.workflowFinderService.findWorkflowForUser(model.workflowId, user, ['workflow:execute-chat'], { includeTags: false, includeParentFolder: false, includeActiveVersion: true });
|
|
1041
|
+
const workflowEntity = await this.workflowFinderService.findWorkflowForUser(model.workflowId, user, ['workflow:execute-chat'], { includeTags: false, includeParentFolder: false, includeActiveVersion: true, em: trx });
|
|
809
1042
|
if (!workflowEntity?.activeVersion) {
|
|
810
1043
|
throw new bad_request_error_1.BadRequestError('Workflow not found for chat session initialization');
|
|
811
1044
|
}
|
|
@@ -871,6 +1104,7 @@ exports.ChatHubService = ChatHubService = __decorate([
|
|
|
871
1104
|
n8n_core_1.ErrorReporter,
|
|
872
1105
|
execution_service_1.ExecutionService,
|
|
873
1106
|
db_1.ExecutionRepository,
|
|
1107
|
+
chat_execution_manager_1.ChatExecutionManager,
|
|
874
1108
|
workflow_execution_service_1.WorkflowExecutionService,
|
|
875
1109
|
workflow_finder_service_1.WorkflowFinderService,
|
|
876
1110
|
db_1.WorkflowRepository,
|