n8n 2.28.4 → 2.29.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/abstract-server.js +1 -1
- package/dist/abstract-server.js.map +1 -1
- package/dist/active-executions.js +2 -2
- package/dist/active-executions.js.map +1 -1
- package/dist/active-workflow-manager.js +1 -1
- package/dist/active-workflow-manager.js.map +1 -1
- package/dist/auth/auth.service.js +12 -12
- package/dist/auth/auth.service.js.map +1 -1
- package/dist/blob-storage/azure-byte-store.ee.d.ts +10 -0
- package/dist/blob-storage/azure-byte-store.ee.js +57 -0
- package/dist/blob-storage/azure-byte-store.ee.js.map +1 -0
- package/dist/blob-storage/fs-byte-store.d.ts +14 -0
- package/dist/blob-storage/fs-byte-store.js +97 -0
- package/dist/blob-storage/fs-byte-store.js.map +1 -0
- package/dist/blob-storage/json-store.d.ts +18 -0
- package/dist/blob-storage/json-store.js +125 -0
- package/dist/blob-storage/json-store.js.map +1 -0
- package/dist/blob-storage/s3-byte-store.ee.d.ts +10 -0
- package/dist/blob-storage/s3-byte-store.ee.js +52 -0
- package/dist/blob-storage/s3-byte-store.ee.js.map +1 -0
- package/dist/blob-storage/skipped-entry-deletion.error.d.ts +5 -0
- package/dist/blob-storage/skipped-entry-deletion.error.js +13 -0
- package/dist/blob-storage/skipped-entry-deletion.error.js.map +1 -0
- package/dist/blob-storage/types.d.ts +23 -0
- package/dist/blob-storage/types.js +3 -0
- package/dist/blob-storage/types.js.map +1 -0
- package/dist/build.tsbuildinfo +1 -1
- package/dist/chat/chat-server.js +1 -1
- package/dist/chat/chat-server.js.map +1 -1
- package/dist/chat/chat-service.js +1 -1
- package/dist/chat/chat-service.js.map +1 -1
- package/dist/chat/chat-service.types.d.ts +2 -2
- package/dist/collaboration/collaboration.service.d.ts +2 -2
- package/dist/collaboration/collaboration.service.js +2 -2
- package/dist/collaboration/collaboration.service.js.map +1 -1
- package/dist/commands/base-command.d.ts +1 -1
- package/dist/commands/base-command.js +30 -4
- package/dist/commands/base-command.js.map +1 -1
- package/dist/commands/export/entities.js +3 -3
- package/dist/commands/export/entities.js.map +1 -1
- package/dist/commands/export/workflow.js.map +1 -1
- package/dist/commands/import/entities.js +3 -3
- package/dist/commands/import/entities.js.map +1 -1
- package/dist/commands/import/workflow.js +1 -1
- package/dist/commands/import/workflow.js.map +1 -1
- package/dist/commands/start.js +5 -5
- package/dist/commands/start.js.map +1 -1
- package/dist/controller.registry.d.ts +1 -1
- package/dist/controller.registry.js +8 -8
- package/dist/controller.registry.js.map +1 -1
- package/dist/controllers/ai.controller.d.ts +1 -0
- package/dist/controllers/ai.controller.js +20 -11
- package/dist/controllers/ai.controller.js.map +1 -1
- package/dist/controllers/e2e.controller.js +1 -0
- package/dist/controllers/e2e.controller.js.map +1 -1
- package/dist/controllers/folder.controller.d.ts +1 -1
- package/dist/controllers/folder.controller.js +1 -1
- package/dist/controllers/folder.controller.js.map +1 -1
- package/dist/controllers/invitation.controller.d.ts +1 -1
- package/dist/controllers/invitation.controller.js +5 -5
- package/dist/controllers/invitation.controller.js.map +1 -1
- package/dist/controllers/oauth/oauth1-credential.controller.d.ts +1 -1
- package/dist/controllers/oauth/oauth1-credential.controller.js +1 -1
- package/dist/controllers/oauth/oauth1-credential.controller.js.map +1 -1
- package/dist/controllers/oauth/oauth2-credential.controller.js +1 -1
- package/dist/controllers/oauth/oauth2-credential.controller.js.map +1 -1
- package/dist/controllers/orchestration.controller.js.map +1 -1
- package/dist/controllers/owner.controller.d.ts +1 -1
- package/dist/controllers/owner.controller.js +1 -1
- package/dist/controllers/owner.controller.js.map +1 -1
- package/dist/controllers/password-reset.controller.d.ts +1 -1
- package/dist/controllers/password-reset.controller.js +3 -3
- package/dist/controllers/password-reset.controller.js.map +1 -1
- package/dist/controllers/posthog.controller.d.ts +2 -5
- package/dist/controllers/posthog.controller.js.map +1 -1
- package/dist/controllers/role.controller.d.ts +2 -1
- package/dist/controllers/role.controller.js +12 -0
- package/dist/controllers/role.controller.js.map +1 -1
- package/dist/controllers/security-settings.controller.d.ts +1 -1
- package/dist/controllers/third-party-licenses.controller.js +1 -1
- package/dist/controllers/third-party-licenses.controller.js.map +1 -1
- package/dist/controllers/translation.controller.js +1 -1
- package/dist/controllers/translation.controller.js.map +1 -1
- package/dist/controllers/users.controller.d.ts +8 -6
- package/dist/controllers/users.controller.js +59 -9
- package/dist/controllers/users.controller.js.map +1 -1
- package/dist/credentials/credentials.service.ee.js +7 -0
- package/dist/credentials/credentials.service.ee.js.map +1 -1
- package/dist/credentials/credentials.service.js +1 -1
- package/dist/credentials/credentials.service.js.map +1 -1
- package/dist/credentials/validation.js +1 -1
- package/dist/credentials/validation.js.map +1 -1
- package/dist/credentials-helper.d.ts +3 -1
- package/dist/credentials-helper.js +33 -5
- package/dist/credentials-helper.js.map +1 -1
- package/dist/credentials-overwrites.js.map +1 -1
- package/dist/evaluation.ee/evaluation-config.service.js +1 -1
- package/dist/evaluation.ee/evaluation-config.service.js.map +1 -1
- package/dist/evaluation.ee/test-runner/test-runner.service.ee.d.ts +3 -3
- package/dist/evaluation.ee/test-runner/test-runner.service.ee.js +11 -5
- package/dist/evaluation.ee/test-runner/test-runner.service.ee.js.map +1 -1
- package/dist/evaluation.ee/test-runs.controller.ee.js.map +1 -1
- package/dist/events/relays/workflow-failure-notification.event-relay.js +1 -1
- package/dist/events/relays/workflow-failure-notification.event-relay.js.map +1 -1
- package/dist/execution-lifecycle/shared/shared-hook-functions.js +1 -0
- package/dist/execution-lifecycle/shared/shared-hook-functions.js.map +1 -1
- package/dist/executions/execution-data/azure-store.ee.js +2 -2
- package/dist/executions/execution-data/azure-store.ee.js.map +1 -1
- package/dist/executions/execution-data/types.d.ts +1 -1
- package/dist/executions/execution-persistence.js +11 -4
- package/dist/executions/execution-persistence.js.map +1 -1
- package/dist/executions/execution.service.js +5 -4
- package/dist/executions/execution.service.js.map +1 -1
- package/dist/executions/executions.controller.d.ts +2 -2
- package/dist/executions/executions.controller.js +4 -4
- package/dist/executions/executions.controller.js.map +1 -1
- package/dist/instance-settings-loader/loaders/log-streaming.instance-settings-loader.js +1 -1
- package/dist/instance-settings-loader/loaders/log-streaming.instance-settings-loader.js.map +1 -1
- package/dist/instance-settings-loader/loaders/owner.instance-settings-loader.js +1 -1
- package/dist/instance-settings-loader/loaders/owner.instance-settings-loader.js.map +1 -1
- package/dist/license/license.controller.js +1 -0
- package/dist/license/license.controller.js.map +1 -1
- package/dist/license/license.service.js +3 -4
- package/dist/license/license.service.js.map +1 -1
- package/dist/metrics/prometheus/db-pool-metrics.service.d.ts +13 -0
- package/dist/metrics/prometheus/db-pool-metrics.service.js +71 -0
- package/dist/metrics/prometheus/db-pool-metrics.service.js.map +1 -0
- package/dist/metrics/prometheus/prometheus.service.d.ts +2 -1
- package/dist/metrics/prometheus/prometheus.service.js +5 -2
- package/dist/metrics/prometheus/prometheus.service.js.map +1 -1
- package/dist/mfa/mfa.service.d.ts +1 -1
- package/dist/mfa/mfa.service.js +1 -1
- package/dist/mfa/mfa.service.js.map +1 -1
- package/dist/mfa/totp.service.js +41 -11
- package/dist/mfa/totp.service.js.map +1 -1
- package/dist/modules/agents/agent-builder.controller.d.ts +28 -0
- package/dist/modules/agents/agent-builder.controller.js +168 -0
- package/dist/modules/agents/agent-builder.controller.js.map +1 -0
- package/dist/modules/agents/agent-chat.controller.d.ts +41 -0
- package/dist/modules/agents/agent-chat.controller.js +206 -0
- package/dist/modules/agents/agent-chat.controller.js.map +1 -0
- package/dist/modules/agents/agent-config.service.d.ts +33 -0
- package/dist/modules/agents/agent-config.service.js +288 -0
- package/dist/modules/agents/agent-config.service.js.map +1 -0
- package/dist/modules/agents/agent-custom-tools.service.d.ts +22 -0
- package/dist/modules/agents/agent-custom-tools.service.js +98 -0
- package/dist/modules/agents/agent-custom-tools.service.js.map +1 -0
- package/dist/modules/agents/agent-execution-orchestrator.service.d.ts +110 -0
- package/dist/modules/agents/agent-execution-orchestrator.service.js +482 -0
- package/dist/modules/agents/agent-execution-orchestrator.service.js.map +1 -0
- package/dist/modules/agents/agent-execution.service.d.ts +4 -4
- package/dist/modules/agents/agent-execution.service.js +6 -5
- package/dist/modules/agents/agent-execution.service.js.map +1 -1
- package/dist/modules/agents/agent-integration-persistence.service.d.ts +19 -0
- package/dist/modules/agents/agent-integration-persistence.service.js +90 -0
- package/dist/modules/agents/agent-integration-persistence.service.js.map +1 -0
- package/dist/modules/agents/agent-integrations.controller.d.ts +60 -0
- package/dist/modules/agents/agent-integrations.controller.js +275 -0
- package/dist/modules/agents/agent-integrations.controller.js.map +1 -0
- package/dist/modules/agents/agent-knowledge-sandbox.service.d.ts +1 -1
- package/dist/modules/agents/agent-knowledge-sandbox.service.js +3 -3
- package/dist/modules/agents/agent-knowledge-sandbox.service.js.map +1 -1
- package/dist/modules/agents/agent-knowledge.controller.d.ts +26 -0
- package/dist/modules/agents/agent-knowledge.controller.js +112 -0
- package/dist/modules/agents/agent-knowledge.controller.js.map +1 -0
- package/dist/modules/agents/agent-publish.controller.d.ts +38 -0
- package/dist/modules/agents/agent-publish.controller.js +94 -0
- package/dist/modules/agents/agent-publish.controller.js.map +1 -0
- package/dist/modules/agents/agent-publish.service.d.ts +30 -0
- package/dist/modules/agents/agent-publish.service.js +293 -0
- package/dist/modules/agents/agent-publish.service.js.map +1 -0
- package/dist/modules/agents/agent-runnable-state.service.d.ts +15 -0
- package/dist/modules/agents/agent-runnable-state.service.js +43 -0
- package/dist/modules/agents/agent-runnable-state.service.js.map +1 -0
- package/dist/modules/agents/agent-runtime-cache.service.d.ts +44 -0
- package/dist/modules/agents/agent-runtime-cache.service.js +169 -0
- package/dist/modules/agents/agent-runtime-cache.service.js.map +1 -0
- package/dist/modules/agents/agent-runtime-reconstruction.service.d.ts +5 -9
- package/dist/modules/agents/agent-runtime-reconstruction.service.js +68 -41
- package/dist/modules/agents/agent-runtime-reconstruction.service.js.map +1 -1
- package/dist/modules/agents/agent-sandbox.controller.d.ts +3 -3
- package/dist/modules/agents/agent-sandbox.controller.js +9 -8
- package/dist/modules/agents/agent-sandbox.controller.js.map +1 -1
- package/dist/modules/agents/agent-skills.service.d.ts +3 -4
- package/dist/modules/agents/agent-skills.service.js +54 -28
- package/dist/modules/agents/agent-skills.service.js.map +1 -1
- package/dist/modules/agents/agent-task.service.d.ts +5 -5
- package/dist/modules/agents/agent-task.service.js +46 -46
- package/dist/modules/agents/agent-task.service.js.map +1 -1
- package/dist/modules/agents/agent-tasks.controller.d.ts +30 -0
- package/dist/modules/agents/agent-tasks.controller.js +106 -0
- package/dist/modules/agents/agent-tasks.controller.js.map +1 -0
- package/dist/modules/agents/agent-telemetry.js +0 -4
- package/dist/modules/agents/agent-telemetry.js.map +1 -1
- package/dist/modules/agents/agent-test-chat.service.d.ts +9 -0
- package/dist/modules/agents/agent-test-chat.service.js +49 -0
- package/dist/modules/agents/agent-test-chat.service.js.map +1 -0
- package/dist/modules/agents/agent-threads.controller.d.ts +28 -0
- package/dist/modules/agents/agent-threads.controller.js +66 -0
- package/dist/modules/agents/agent-threads.controller.js.map +1 -0
- package/dist/modules/agents/agent-validation.service.d.ts +13 -0
- package/dist/modules/agents/agent-validation.service.js +142 -0
- package/dist/modules/agents/agent-validation.service.js.map +1 -0
- package/dist/modules/agents/agents-catalog.controller.d.ts +8 -0
- package/dist/modules/agents/agents-catalog.controller.js +80 -0
- package/dist/modules/agents/agents-catalog.controller.js.map +1 -0
- package/dist/modules/agents/agents-config.controller.d.ts +181 -0
- package/dist/modules/agents/agents-config.controller.js +71 -0
- package/dist/modules/agents/agents-config.controller.js.map +1 -0
- package/dist/modules/agents/agents-skills.controller.d.ts +33 -0
- package/dist/modules/agents/agents-skills.controller.js +94 -0
- package/dist/modules/agents/agents-skills.controller.js.map +1 -0
- package/dist/modules/agents/agents-tools.service.d.ts +1 -7
- package/dist/modules/agents/agents-tools.service.js +3 -80
- package/dist/modules/agents/agents-tools.service.js.map +1 -1
- package/dist/modules/agents/agents.controller.d.ts +7 -393
- package/dist/modules/agents/agents.controller.js +6 -990
- package/dist/modules/agents/agents.controller.js.map +1 -1
- package/dist/modules/agents/agents.module.d.ts +2 -2
- package/dist/modules/agents/agents.module.js +12 -0
- package/dist/modules/agents/agents.module.js.map +1 -1
- package/dist/modules/agents/agents.service.d.ts +8 -166
- package/dist/modules/agents/agents.service.js +10 -1287
- package/dist/modules/agents/agents.service.js.map +1 -1
- package/dist/modules/agents/builder/agents-builder-prompts.d.ts +2 -2
- package/dist/modules/agents/builder/agents-builder-prompts.js +3 -5
- package/dist/modules/agents/builder/agents-builder-prompts.js.map +1 -1
- package/dist/modules/agents/builder/agents-builder-tools.service.d.ts +11 -1
- package/dist/modules/agents/builder/agents-builder-tools.service.js +60 -25
- package/dist/modules/agents/builder/agents-builder-tools.service.js.map +1 -1
- package/dist/modules/agents/builder/interactive/ask-credential.tool.d.ts +4 -0
- package/dist/modules/agents/builder/interactive/ask-credential.tool.js +36 -12
- package/dist/modules/agents/builder/interactive/ask-credential.tool.js.map +1 -1
- package/dist/modules/agents/builder/interactive/ask-llm.tool.js +1 -3
- package/dist/modules/agents/builder/interactive/ask-llm.tool.js.map +1 -1
- package/dist/modules/agents/builder/interactive/ask-question.tool.js.map +1 -1
- package/dist/modules/agents/builder/interactive/index.d.ts +1 -1
- package/dist/modules/agents/builder/interactive/index.js +2 -1
- package/dist/modules/agents/builder/interactive/index.js.map +1 -1
- package/dist/modules/agents/builder/interactive/llm-provider-defaults.js +1 -1
- package/dist/modules/agents/builder/interactive/llm-provider-defaults.js.map +1 -1
- package/dist/modules/agents/builder/interactive/resolve-llm.tool.js +3 -2
- package/dist/modules/agents/builder/interactive/resolve-llm.tool.js.map +1 -1
- package/dist/modules/agents/builder/prompts/config-mutation.prompt.js +3 -5
- package/dist/modules/agents/builder/prompts/config-mutation.prompt.js.map +1 -1
- package/dist/modules/agents/builder/prompts/config-rules.prompt.js +4 -6
- package/dist/modules/agents/builder/prompts/config-rules.prompt.js.map +1 -1
- package/dist/modules/agents/builder/prompts/llm-selection.prompt.js +1 -1
- package/dist/modules/agents/builder/prompts/memory.prompt.d.ts +1 -1
- package/dist/modules/agents/builder/prompts/memory.prompt.js +4 -4
- package/dist/modules/agents/builder/prompts/tools.prompt.d.ts +1 -1
- package/dist/modules/agents/builder/prompts/tools.prompt.js +8 -3
- package/dist/modules/agents/builder/prompts/tools.prompt.js.map +1 -1
- package/dist/modules/agents/builder/skills/integrations.skill.js +8 -0
- package/dist/modules/agents/builder/skills/integrations.skill.js.map +1 -1
- package/dist/modules/agents/builder/skills/mcp.skill.js +16 -0
- package/dist/modules/agents/builder/skills/mcp.skill.js.map +1 -1
- package/dist/modules/agents/builder/skills/resource-locators.skill.js +18 -0
- package/dist/modules/agents/builder/skills/resource-locators.skill.js.map +1 -1
- package/dist/modules/agents/builder/skills/sub-agents.skill.js +34 -8
- package/dist/modules/agents/builder/skills/sub-agents.skill.js.map +1 -1
- package/dist/modules/agents/builder/skills/target-skills.skill.js +22 -3
- package/dist/modules/agents/builder/skills/target-skills.skill.js.map +1 -1
- package/dist/modules/agents/builder/skills/target-tasks.skill.js +12 -0
- package/dist/modules/agents/builder/skills/target-tasks.skill.js.map +1 -1
- package/dist/modules/agents/entities/agent-memory-entry.entity.d.ts +1 -1
- package/dist/modules/agents/entities/agent-memory-entry.entity.js.map +1 -1
- package/dist/modules/agents/entities/agent.entity.d.ts +1 -2
- package/dist/modules/agents/entities/agent.entity.js +0 -4
- package/dist/modules/agents/entities/agent.entity.js.map +1 -1
- package/dist/modules/agents/integrations/agent-chat-bridge.d.ts +7 -23
- package/dist/modules/agents/integrations/agent-chat-bridge.js +60 -646
- package/dist/modules/agents/integrations/agent-chat-bridge.js.map +1 -1
- package/dist/modules/agents/integrations/agent-chat-hitl-resume-handler.d.ts +44 -0
- package/dist/modules/agents/integrations/agent-chat-hitl-resume-handler.js +110 -0
- package/dist/modules/agents/integrations/agent-chat-hitl-resume-handler.js.map +1 -0
- package/dist/modules/agents/integrations/agent-chat-integration.d.ts +38 -4
- package/dist/modules/agents/integrations/agent-chat-integration.js +10 -3
- package/dist/modules/agents/integrations/agent-chat-integration.js.map +1 -1
- package/dist/modules/agents/integrations/agent-chat-message-context.d.ts +22 -0
- package/dist/modules/agents/integrations/agent-chat-message-context.js +104 -0
- package/dist/modules/agents/integrations/agent-chat-message-context.js.map +1 -0
- package/dist/modules/agents/integrations/agent-chat-stream-consumer.d.ts +29 -0
- package/dist/modules/agents/integrations/agent-chat-stream-consumer.js +205 -0
- package/dist/modules/agents/integrations/agent-chat-stream-consumer.js.map +1 -0
- package/dist/modules/agents/integrations/agent-chat-suspension-cards.d.ts +10 -0
- package/dist/modules/agents/integrations/agent-chat-suspension-cards.js +90 -0
- package/dist/modules/agents/integrations/agent-chat-suspension-cards.js.map +1 -0
- package/dist/modules/agents/integrations/chat-integration.service.js +6 -3
- package/dist/modules/agents/integrations/chat-integration.service.js.map +1 -1
- package/dist/modules/agents/integrations/integration-message-context.service.d.ts +1 -1
- package/dist/modules/agents/integrations/integration-message-context.service.js.map +1 -1
- package/dist/modules/agents/integrations/integration-tool-definitions.d.ts +6037 -0
- package/dist/modules/agents/integrations/integration-tool-definitions.js +231 -0
- package/dist/modules/agents/integrations/integration-tool-definitions.js.map +1 -0
- package/dist/modules/agents/integrations/integration-tool-descriptions.d.ts +3 -0
- package/dist/modules/agents/integrations/integration-tool-descriptions.js +100 -0
- package/dist/modules/agents/integrations/integration-tool-descriptions.js.map +1 -0
- package/dist/modules/agents/integrations/integration-tool-execution.d.ts +27 -0
- package/dist/modules/agents/integrations/integration-tool-execution.js +278 -0
- package/dist/modules/agents/integrations/integration-tool-execution.js.map +1 -0
- package/dist/modules/agents/integrations/integration-tool-factory.d.ts +121 -0
- package/dist/modules/agents/integrations/integration-tool-factory.js +133 -0
- package/dist/modules/agents/integrations/integration-tool-factory.js.map +1 -0
- package/dist/modules/agents/integrations/integration-tool-schema.d.ts +107 -0
- package/dist/modules/agents/integrations/integration-tool-schema.js +140 -0
- package/dist/modules/agents/integrations/integration-tool-schema.js.map +1 -0
- package/dist/modules/agents/integrations/integration-tool-types.d.ts +105 -0
- package/dist/modules/agents/integrations/integration-tool-types.js +3 -0
- package/dist/modules/agents/integrations/integration-tool-types.js.map +1 -0
- package/dist/modules/agents/integrations/integration-tools.d.ts +3 -213
- package/dist/modules/agents/integrations/integration-tools.js +16 -998
- package/dist/modules/agents/integrations/integration-tools.js.map +1 -1
- package/dist/modules/agents/integrations/integrations-sync.d.ts +1 -1
- package/dist/modules/agents/integrations/n8n-memory.d.ts +1 -1
- package/dist/modules/agents/integrations/n8n-memory.js +2 -2
- package/dist/modules/agents/integrations/n8n-memory.js.map +1 -1
- package/dist/modules/agents/integrations/platforms/linear-integration.d.ts +3 -3
- package/dist/modules/agents/integrations/platforms/linear-integration.js +14 -19
- package/dist/modules/agents/integrations/platforms/linear-integration.js.map +1 -1
- package/dist/modules/agents/integrations/platforms/linear-tool-definitions.d.ts +473 -0
- package/dist/modules/agents/integrations/platforms/linear-tool-definitions.js +270 -0
- package/dist/modules/agents/integrations/platforms/linear-tool-definitions.js.map +1 -0
- package/dist/modules/agents/integrations/platforms/n8n-chat-integration.d.ts +4 -3
- package/dist/modules/agents/integrations/platforms/n8n-chat-integration.js +6 -2
- package/dist/modules/agents/integrations/platforms/n8n-chat-integration.js.map +1 -1
- package/dist/modules/agents/integrations/platforms/slack-bridge-behavior.d.ts +12 -0
- package/dist/modules/agents/integrations/platforms/slack-bridge-behavior.js +198 -0
- package/dist/modules/agents/integrations/platforms/slack-bridge-behavior.js.map +1 -0
- package/dist/modules/agents/integrations/platforms/slack-integration.d.ts +14 -4
- package/dist/modules/agents/integrations/platforms/slack-integration.js +20 -7
- package/dist/modules/agents/integrations/platforms/slack-integration.js.map +1 -1
- package/dist/modules/agents/integrations/platforms/slack-operations.js +1 -1
- package/dist/modules/agents/integrations/platforms/slack-operations.js.map +1 -1
- package/dist/modules/agents/integrations/platforms/slack-tool-definitions.d.ts +35 -0
- package/dist/modules/agents/integrations/platforms/slack-tool-definitions.js +33 -0
- package/dist/modules/agents/integrations/platforms/slack-tool-definitions.js.map +1 -0
- package/dist/modules/agents/integrations/platforms/telegram-integration.d.ts +1 -2
- package/dist/modules/agents/integrations/platforms/telegram-integration.js +2 -1
- package/dist/modules/agents/integrations/platforms/telegram-integration.js.map +1 -1
- package/dist/modules/agents/integrations/slack-app-setup.service.d.ts +5 -3
- package/dist/modules/agents/integrations/slack-app-setup.service.js +11 -6
- package/dist/modules/agents/integrations/slack-app-setup.service.js.map +1 -1
- package/dist/modules/agents/json-config/from-json-config.d.ts +7 -0
- package/dist/modules/agents/json-config/from-json-config.js +60 -15
- package/dist/modules/agents/json-config/from-json-config.js.map +1 -1
- package/dist/modules/agents/json-config/sanitize-unknown-agent-credentials.js +17 -6
- package/dist/modules/agents/json-config/sanitize-unknown-agent-credentials.js.map +1 -1
- package/dist/modules/agents/repositories/agent-execution-thread.repository.d.ts +1 -1
- package/dist/modules/agents/repositories/agent-execution-thread.repository.js +2 -5
- package/dist/modules/agents/repositories/agent-execution-thread.repository.js.map +1 -1
- package/dist/modules/agents/repositories/agent-history.repository.d.ts +1 -1
- package/dist/modules/agents/repositories/agent-history.repository.js.map +1 -1
- package/dist/modules/agents/sub-agents/delegate-sub-agent-tool.d.ts +1 -1
- package/dist/modules/agents/sub-agents/sub-agent-source-resolver.d.ts +1 -1
- package/dist/modules/agents/sub-agents/sub-agent-source-resolver.js.map +1 -1
- package/dist/modules/agents/tools/agent-data-utils.d.ts +22 -0
- package/dist/modules/agents/tools/agent-data-utils.js +64 -0
- package/dist/modules/agents/tools/agent-data-utils.js.map +1 -0
- package/dist/modules/agents/tools/input-data-tool.d.ts +3 -0
- package/dist/modules/agents/tools/input-data-tool.js +40 -0
- package/dist/modules/agents/tools/input-data-tool.js.map +1 -0
- package/dist/modules/agents/tools/node-tool-factory.d.ts +1 -1
- package/dist/modules/agents/tools/node-tool-factory.js +1 -1
- package/dist/modules/agents/tools/node-tool-factory.js.map +1 -1
- package/dist/modules/agents/tools/workflow-context-tool.d.ts +3 -0
- package/dist/modules/agents/tools/workflow-context-tool.js +84 -0
- package/dist/modules/agents/tools/workflow-context-tool.js.map +1 -0
- package/dist/modules/agents/utils/agent-credential-provider.d.ts +4 -0
- package/dist/modules/agents/utils/agent-credential-provider.js +8 -0
- package/dist/modules/agents/utils/agent-credential-provider.js.map +1 -0
- package/dist/modules/agents/utils/agent-missing-skill-ids.d.ts +2 -0
- package/dist/modules/agents/utils/agent-missing-skill-ids.js +17 -0
- package/dist/modules/agents/utils/agent-missing-skill-ids.js.map +1 -0
- package/dist/modules/agents/utils/agent-published-snapshot.d.ts +2 -0
- package/dist/modules/agents/utils/agent-published-snapshot.js +17 -0
- package/dist/modules/agents/utils/agent-published-snapshot.js.map +1 -0
- package/dist/modules/agents/utils/agent-resource-id.d.ts +1 -1
- package/dist/modules/agents/utils/sub-agent-resolver.d.ts +14 -0
- package/dist/modules/agents/utils/sub-agent-resolver.js +23 -0
- package/dist/modules/agents/utils/sub-agent-resolver.js.map +1 -0
- package/dist/modules/breaking-changes/rules/v2/file-access.rule.js.map +1 -1
- package/dist/modules/breaking-changes/rules/v2/oauth-callback-auth.rule.js.map +1 -1
- package/dist/modules/breaking-changes/rules/v2/process-env-access.rule.js.map +1 -1
- package/dist/modules/breaking-changes/rules/v2/pyodide-removed.rule.js.map +1 -1
- package/dist/modules/breaking-changes/rules/v2/queue-worker-max-stalled-count.rule.js.map +1 -1
- package/dist/modules/breaking-changes/rules/v2/removed-nodes.rule.js.map +1 -1
- package/dist/modules/breaking-changes/rules/v2/settings-file-permissions.rule.js.map +1 -1
- package/dist/modules/breaking-changes/rules/v2/start-node-removed.rule.js.map +1 -1
- package/dist/modules/breaking-changes/rules/v2/task-runner-docker-image.rule.js.map +1 -1
- package/dist/modules/breaking-changes/rules/v2/tunnel-option.rule.js.map +1 -1
- package/dist/modules/breaking-changes/rules/v2/wait-node-subworkflow.rule.js +1 -1
- package/dist/modules/breaking-changes/rules/v2/wait-node-subworkflow.rule.js.map +1 -1
- package/dist/modules/breaking-changes/rules/v2/workflow-hooks-deprecated.rule.js.map +1 -1
- package/dist/modules/chat-hub/chat-hub-agent.service.d.ts +5 -5
- package/dist/modules/chat-hub/chat-hub-agent.service.js +9 -9
- package/dist/modules/chat-hub/chat-hub-agent.service.js.map +1 -1
- package/dist/modules/chat-hub/chat-hub-message.entity.d.ts +2 -2
- package/dist/modules/chat-hub/chat-hub-message.entity.js.map +1 -1
- package/dist/modules/chat-hub/chat-hub-session.entity.d.ts +1 -1
- package/dist/modules/chat-hub/chat-hub.controller.d.ts +5 -2
- package/dist/modules/chat-hub/chat-hub.controller.js +23 -5
- package/dist/modules/chat-hub/chat-hub.controller.js.map +1 -1
- package/dist/modules/chat-hub/chat-hub.module.d.ts +1 -1
- package/dist/modules/chat-hub/chat-hub.service.js +1 -1
- package/dist/modules/chat-hub/chat-hub.service.js.map +1 -1
- package/dist/modules/chat-hub/chat-hub.settings.controller.d.ts +8 -4
- package/dist/modules/chat-hub/chat-hub.settings.controller.js +28 -18
- package/dist/modules/chat-hub/chat-hub.settings.controller.js.map +1 -1
- package/dist/modules/chat-hub/chat-hub.settings.service.js +3 -3
- package/dist/modules/chat-hub/chat-hub.settings.service.js.map +1 -1
- package/dist/modules/chat-hub/chat-hub.types.d.ts +1 -1
- package/dist/modules/chat-hub/chat-session.repository.js +1 -1
- package/dist/modules/chat-hub/chat-session.repository.js.map +1 -1
- package/dist/modules/community-packages/community-node-types.service.js +2 -2
- package/dist/modules/community-packages/community-node-types.service.js.map +1 -1
- package/dist/modules/community-packages/community-packages.config.d.ts +2 -0
- package/dist/modules/community-packages/community-packages.config.js +10 -0
- package/dist/modules/community-packages/community-packages.config.js.map +1 -1
- package/dist/modules/community-packages/community-packages.lifecycle.service.d.ts +3 -3
- package/dist/modules/community-packages/community-packages.lifecycle.service.js +3 -3
- package/dist/modules/community-packages/community-packages.lifecycle.service.js.map +1 -1
- package/dist/modules/community-packages/community-packages.service.js +3 -3
- package/dist/modules/community-packages/community-packages.service.js.map +1 -1
- package/dist/modules/community-packages/npm-utils.js +1 -1
- package/dist/modules/community-packages/npm-utils.js.map +1 -1
- package/dist/modules/data-table/data-table-aggregate.service.js +1 -1
- package/dist/modules/data-table/data-table-aggregate.service.js.map +1 -1
- package/dist/modules/data-table/data-table-file-cleanup.service.js +1 -1
- package/dist/modules/data-table/data-table-file-cleanup.service.js.map +1 -1
- package/dist/modules/data-table/data-table-proxy.service.d.ts +2 -2
- package/dist/modules/data-table/data-table-proxy.service.js +3 -3
- package/dist/modules/data-table/data-table-proxy.service.js.map +1 -1
- package/dist/modules/data-table/data-table.controller.d.ts +2 -2
- package/dist/modules/data-table/data-table.controller.js +3 -3
- package/dist/modules/data-table/data-table.controller.js.map +1 -1
- package/dist/modules/data-table/utils/sql-utils.js.map +1 -1
- package/dist/modules/dynamic-credentials.ee/context-establishment-hooks/slack-signature-extractor.js +1 -1
- package/dist/modules/dynamic-credentials.ee/context-establishment-hooks/slack-signature-extractor.js.map +1 -1
- package/dist/modules/dynamic-credentials.ee/credential-resolvers/identifiers/oauth2-introspection-identifier.js +0 -1
- package/dist/modules/dynamic-credentials.ee/credential-resolvers/identifiers/oauth2-introspection-identifier.js.map +1 -1
- package/dist/modules/dynamic-credentials.ee/credential-resolvers/identifiers/oauth2-metadata-http-client.d.ts +0 -1
- package/dist/modules/dynamic-credentials.ee/credential-resolvers/identifiers/oauth2-metadata-http-client.js +3 -3
- package/dist/modules/dynamic-credentials.ee/credential-resolvers/identifiers/oauth2-metadata-http-client.js.map +1 -1
- package/dist/modules/dynamic-credentials.ee/credential-resolvers/identifiers/oauth2-userinfo-identifier.js +0 -1
- package/dist/modules/dynamic-credentials.ee/credential-resolvers/identifiers/oauth2-userinfo-identifier.js.map +1 -1
- package/dist/modules/dynamic-credentials.ee/credential-resolvers/identifiers/slack-signature-identifier.js +2 -2
- package/dist/modules/dynamic-credentials.ee/credential-resolvers/identifiers/slack-signature-identifier.js.map +1 -1
- package/dist/modules/dynamic-credentials.ee/credential-resolvers/slack-credential-resolver.js.map +1 -1
- package/dist/modules/dynamic-credentials.ee/credential-resolvers/storage/dynamic-credential-entry-storage.d.ts +1 -1
- package/dist/modules/dynamic-credentials.ee/credential-resolvers/storage/dynamic-credential-entry-storage.js.map +1 -1
- package/dist/modules/dynamic-credentials.ee/services/dynamic-credential-cors.service.d.ts +1 -1
- package/dist/modules/dynamic-credentials.ee/services/dynamic-credential-cors.service.js +1 -1
- package/dist/modules/dynamic-credentials.ee/services/dynamic-credential-cors.service.js.map +1 -1
- package/dist/modules/dynamic-credentials.ee/services/dynamic-credential-storage.service.d.ts +2 -2
- package/dist/modules/dynamic-credentials.ee/services/dynamic-credential-storage.service.js +2 -2
- package/dist/modules/dynamic-credentials.ee/services/dynamic-credential-storage.service.js.map +1 -1
- package/dist/modules/dynamic-credentials.ee/services/dynamic-credential-web.service.d.ts +2 -2
- package/dist/modules/dynamic-credentials.ee/services/dynamic-credential-web.service.js +2 -2
- package/dist/modules/dynamic-credentials.ee/services/dynamic-credential-web.service.js.map +1 -1
- package/dist/modules/dynamic-credentials.ee/services/dynamic-credential.service.d.ts +1 -1
- package/dist/modules/dynamic-credentials.ee/services/dynamic-credential.service.js.map +1 -1
- package/dist/modules/dynamic-credentials.ee/services/n8n-resolver-seeder.service.d.ts +1 -1
- package/dist/modules/dynamic-credentials.ee/services/n8n-resolver-seeder.service.js +1 -1
- package/dist/modules/dynamic-credentials.ee/services/n8n-resolver-seeder.service.js.map +1 -1
- package/dist/modules/dynamic-credentials.ee/utils.js.map +1 -1
- package/dist/modules/dynamic-credentials.ee/workflow-status.controller.d.ts +3 -1
- package/dist/modules/dynamic-credentials.ee/workflow-status.controller.js +14 -2
- package/dist/modules/dynamic-credentials.ee/workflow-status.controller.js.map +1 -1
- package/dist/modules/external-secrets.ee/external-secrets-manager.ee.d.ts +3 -4
- package/dist/modules/external-secrets.ee/external-secrets-manager.ee.js +20 -46
- package/dist/modules/external-secrets.ee/external-secrets-manager.ee.js.map +1 -1
- package/dist/modules/external-secrets.ee/external-secrets-provider-connection-manager.ee.d.ts +21 -0
- package/dist/modules/external-secrets.ee/external-secrets-provider-connection-manager.ee.js +142 -0
- package/dist/modules/external-secrets.ee/external-secrets-provider-connection-manager.ee.js.map +1 -0
- package/dist/modules/external-secrets.ee/external-secrets-settings.controller.ee.d.ts +1 -1
- package/dist/modules/external-secrets.ee/external-secrets-settings.controller.ee.js +1 -1
- package/dist/modules/external-secrets.ee/external-secrets-settings.controller.ee.js.map +1 -1
- package/dist/modules/external-secrets.ee/provider-registry.service.d.ts +1 -1
- package/dist/modules/external-secrets.ee/provider-registry.service.js +1 -1
- package/dist/modules/external-secrets.ee/providers/aws-secrets-manager.js +5 -1
- package/dist/modules/external-secrets.ee/providers/aws-secrets-manager.js.map +1 -1
- package/dist/modules/external-secrets.ee/providers/infisical.js +4 -4
- package/dist/modules/external-secrets.ee/providers/infisical.js.map +1 -1
- package/dist/modules/external-secrets.ee/providers/vault.js +10 -10
- package/dist/modules/external-secrets.ee/providers/vault.js.map +1 -1
- package/dist/modules/external-secrets.ee/redaction.service.ee.js.map +1 -1
- package/dist/modules/external-secrets.ee/secrets-providers-connections.service.ee.d.ts +1 -1
- package/dist/modules/external-secrets.ee/secrets-providers-connections.service.ee.js +1 -1
- package/dist/modules/external-secrets.ee/secrets-providers-connections.service.ee.js.map +1 -1
- package/dist/modules/external-secrets.ee/secrets-providers-types.controller.ee.d.ts +1 -1
- package/dist/modules/external-secrets.ee/secrets-providers-types.controller.ee.js +2 -2
- package/dist/modules/external-secrets.ee/secrets-providers-types.controller.ee.js.map +1 -1
- package/dist/modules/favorites/favorites.controller.d.ts +1 -1
- package/dist/modules/favorites/favorites.controller.js +2 -2
- package/dist/modules/favorites/favorites.controller.js.map +1 -1
- package/dist/modules/favorites/favorites.event-relay.d.ts +1 -1
- package/dist/modules/favorites/favorites.event-relay.js +1 -1
- package/dist/modules/favorites/favorites.event-relay.js.map +1 -1
- package/dist/modules/favorites/favorites.service.d.ts +2 -2
- package/dist/modules/favorites/favorites.service.js +2 -2
- package/dist/modules/favorites/favorites.service.js.map +1 -1
- package/dist/modules/insights/database/repositories/insights-by-period.repository.d.ts +1 -0
- package/dist/modules/insights/database/repositories/insights-by-period.repository.js +6 -0
- package/dist/modules/insights/database/repositories/insights-by-period.repository.js.map +1 -1
- package/dist/modules/insights/insights.module.d.ts +1 -0
- package/dist/modules/insights/insights.module.js +1 -1
- package/dist/modules/insights/insights.module.js.map +1 -1
- package/dist/modules/insights/insights.settings.d.ts +6 -3
- package/dist/modules/insights/insights.settings.js +8 -3
- package/dist/modules/insights/insights.settings.js.map +1 -1
- package/dist/modules/instance-ai/browser/browser-local-mcp-server.d.ts +23 -0
- package/dist/modules/instance-ai/browser/browser-local-mcp-server.js +123 -0
- package/dist/modules/instance-ai/browser/browser-local-mcp-server.js.map +1 -0
- package/dist/modules/instance-ai/browser/browser-use-server.d.ts +11 -0
- package/dist/modules/instance-ai/browser/browser-use-server.js +68 -0
- package/dist/modules/instance-ai/browser/browser-use-server.js.map +1 -0
- package/dist/modules/instance-ai/browser/browser-use-ws.constants.d.ts +7 -0
- package/dist/modules/instance-ai/browser/browser-use-ws.constants.js +6 -0
- package/dist/modules/instance-ai/browser/browser-use-ws.constants.js.map +1 -0
- package/dist/modules/instance-ai/browser/composite-local-mcp-server.d.ts +14 -0
- package/dist/modules/instance-ai/browser/composite-local-mcp-server.js +57 -0
- package/dist/modules/instance-ai/browser/composite-local-mcp-server.js.map +1 -0
- package/dist/modules/instance-ai/browser/instance-ai-browser-session.service.d.ts +40 -0
- package/dist/modules/instance-ai/browser/instance-ai-browser-session.service.js +297 -0
- package/dist/modules/instance-ai/browser/instance-ai-browser-session.service.js.map +1 -0
- package/dist/modules/instance-ai/eval/execution.service.js +2 -2
- package/dist/modules/instance-ai/eval/execution.service.js.map +1 -1
- package/dist/modules/instance-ai/eval/mock-handler.js +5 -1
- package/dist/modules/instance-ai/eval/mock-handler.js.map +1 -1
- package/dist/modules/instance-ai/eval/pin-data-generator.js +1 -1
- package/dist/modules/instance-ai/eval/pin-data-generator.js.map +1 -1
- package/dist/modules/instance-ai/eval/thread-restore.service.d.ts +14 -0
- package/dist/modules/instance-ai/eval/thread-restore.service.js +149 -0
- package/dist/modules/instance-ai/eval/thread-restore.service.js.map +1 -0
- package/dist/modules/instance-ai/eval/workflow-analysis.js +1 -1
- package/dist/modules/instance-ai/event-bus/in-process-event-bus.js.map +1 -1
- package/dist/modules/instance-ai/filesystem/local-gateway-registry.js.map +1 -1
- package/dist/modules/instance-ai/filesystem/local-gateway.d.ts +3 -0
- package/dist/modules/instance-ai/filesystem/local-gateway.js +20 -3
- package/dist/modules/instance-ai/filesystem/local-gateway.js.map +1 -1
- package/dist/modules/instance-ai/instance-ai-event-relay.service.d.ts +12 -0
- package/dist/modules/instance-ai/instance-ai-event-relay.service.js +56 -0
- package/dist/modules/instance-ai/instance-ai-event-relay.service.js.map +1 -0
- package/dist/modules/instance-ai/instance-ai-gateway.service.d.ts +5 -1
- package/dist/modules/instance-ai/instance-ai-gateway.service.js +10 -3
- package/dist/modules/instance-ai/instance-ai-gateway.service.js.map +1 -1
- package/dist/modules/instance-ai/instance-ai-memory.service.d.ts +5 -0
- package/dist/modules/instance-ai/instance-ai-memory.service.js +38 -0
- package/dist/modules/instance-ai/instance-ai-memory.service.js.map +1 -1
- package/dist/modules/instance-ai/instance-ai-run-pin-data.d.ts +29 -0
- package/dist/modules/instance-ai/instance-ai-run-pin-data.js +222 -0
- package/dist/modules/instance-ai/instance-ai-run-pin-data.js.map +1 -0
- package/dist/modules/instance-ai/instance-ai-settings.service.d.ts +1 -0
- package/dist/modules/instance-ai/instance-ai-settings.service.js +9 -0
- package/dist/modules/instance-ai/instance-ai-settings.service.js.map +1 -1
- package/dist/modules/instance-ai/instance-ai-terminal-outcome.service.d.ts +72 -0
- package/dist/modules/instance-ai/instance-ai-terminal-outcome.service.js +352 -0
- package/dist/modules/instance-ai/instance-ai-terminal-outcome.service.js.map +1 -0
- package/dist/modules/instance-ai/instance-ai-test.controller.d.ts +2 -2
- package/dist/modules/instance-ai/instance-ai-test.controller.js +2 -2
- package/dist/modules/instance-ai/instance-ai-test.controller.js.map +1 -1
- package/dist/modules/instance-ai/instance-ai.adapter.service.js +78 -193
- package/dist/modules/instance-ai/instance-ai.adapter.service.js.map +1 -1
- package/dist/modules/instance-ai/instance-ai.controller.d.ts +19 -2
- package/dist/modules/instance-ai/instance-ai.controller.js +96 -6
- package/dist/modules/instance-ai/instance-ai.controller.js.map +1 -1
- package/dist/modules/instance-ai/instance-ai.module.d.ts +1 -0
- package/dist/modules/instance-ai/instance-ai.module.js +4 -0
- package/dist/modules/instance-ai/instance-ai.module.js.map +1 -1
- package/dist/modules/instance-ai/instance-ai.service.d.ts +10 -33
- package/dist/modules/instance-ai/instance-ai.service.js +293 -767
- package/dist/modules/instance-ai/instance-ai.service.js.map +1 -1
- package/dist/modules/instance-ai/internal-messages.d.ts +2 -0
- package/dist/modules/instance-ai/internal-messages.js +4 -2
- package/dist/modules/instance-ai/internal-messages.js.map +1 -1
- package/dist/modules/instance-ai/liveness/index.d.ts +1 -1
- package/dist/modules/instance-ai/liveness/index.js.map +1 -1
- package/dist/modules/instance-ai/liveness/instance-ai-liveness.service.d.ts +4 -7
- package/dist/modules/instance-ai/liveness/instance-ai-liveness.service.js +2 -2
- package/dist/modules/instance-ai/liveness/instance-ai-liveness.service.js.map +1 -1
- package/dist/modules/instance-ai/mcp/instance-ai-mcp-connection.controller.js.map +1 -1
- package/dist/modules/instance-ai/message-parser.js +4 -3
- package/dist/modules/instance-ai/message-parser.js.map +1 -1
- package/dist/modules/instance-ai/node-definition-resolver.js +2 -1
- package/dist/modules/instance-ai/node-definition-resolver.js.map +1 -1
- package/dist/modules/instance-ai/planned-task-action-runner.d.ts +1 -1
- package/dist/modules/instance-ai/planned-task-action-runner.js +3 -3
- package/dist/modules/instance-ai/planned-task-action-runner.js.map +1 -1
- package/dist/modules/instance-ai/repositories/instance-ai-checkpoint.repository.js.map +1 -1
- package/dist/modules/instance-ai/storage/typeorm-agent-memory.d.ts +1 -0
- package/dist/modules/instance-ai/storage/typeorm-agent-memory.js +29 -0
- package/dist/modules/instance-ai/storage/typeorm-agent-memory.js.map +1 -1
- package/dist/modules/instance-ai/suspended-run-restorer.service.d.ts +4 -8
- package/dist/modules/instance-ai/suspended-run-restorer.service.js +2 -2
- package/dist/modules/instance-ai/suspended-run-restorer.service.js.map +1 -1
- package/dist/modules/instance-ai/suspended-thread-persistence.service.d.ts +0 -14
- package/dist/modules/instance-ai/suspended-thread-persistence.service.js +0 -26
- package/dist/modules/instance-ai/suspended-thread-persistence.service.js.map +1 -1
- package/dist/modules/instance-ai/tracing/index.d.ts +1 -0
- package/dist/modules/instance-ai/tracing/index.js +6 -0
- package/dist/modules/instance-ai/tracing/index.js.map +1 -0
- package/dist/modules/instance-ai/tracing/instance-ai-tracing.service.d.ts +81 -0
- package/dist/modules/instance-ai/tracing/instance-ai-tracing.service.js +341 -0
- package/dist/modules/instance-ai/tracing/instance-ai-tracing.service.js.map +1 -0
- package/dist/modules/instance-ai/workflow-verification-task-projector.js +1 -2
- package/dist/modules/instance-ai/workflow-verification-task-projector.js.map +1 -1
- package/dist/modules/instance-registry/instance-registry.controller.js +1 -0
- package/dist/modules/instance-registry/instance-registry.controller.js.map +1 -1
- package/dist/modules/instance-registry/instance-registry.service.js +1 -1
- package/dist/modules/instance-registry/instance-registry.service.js.map +1 -1
- package/dist/modules/instance-version-history/instance-version-history.service.d.ts +1 -1
- package/dist/modules/instance-version-history/instance-version-history.service.js +1 -1
- package/dist/modules/instance-version-history/instance-version-history.service.js.map +1 -1
- package/dist/modules/ldap.ee/ldap.service.ee.d.ts +1 -1
- package/dist/modules/ldap.ee/ldap.service.ee.js +1 -1
- package/dist/modules/ldap.ee/ldap.service.ee.js.map +1 -1
- package/dist/modules/log-streaming.ee/destinations/message-event-bus-destination-sentry.ee.js.map +1 -1
- package/dist/modules/mcp/dto/update-allowed-redirect-uris.dto.js +1 -1
- package/dist/modules/mcp/dto/update-allowed-redirect-uris.dto.js.map +1 -1
- package/dist/modules/mcp/mcp.service.d.ts +5 -1
- package/dist/modules/mcp/mcp.service.js +18 -3
- package/dist/modules/mcp/mcp.service.js.map +1 -1
- package/dist/modules/mcp/tools/data-table/add-data-table-column.tool.d.ts +1 -1
- package/dist/modules/mcp/tools/data-table/add-data-table-column.tool.js.map +1 -1
- package/dist/modules/mcp/tools/data-table/add-data-table-rows.tool.d.ts +1 -1
- package/dist/modules/mcp/tools/data-table/add-data-table-rows.tool.js.map +1 -1
- package/dist/modules/mcp/tools/data-table/create-data-table.tool.d.ts +1 -1
- package/dist/modules/mcp/tools/data-table/create-data-table.tool.js.map +1 -1
- package/dist/modules/mcp/tools/data-table/delete-data-table-column.tool.d.ts +1 -1
- package/dist/modules/mcp/tools/data-table/delete-data-table-column.tool.js.map +1 -1
- package/dist/modules/mcp/tools/data-table/rename-data-table-column.tool.d.ts +1 -1
- package/dist/modules/mcp/tools/data-table/rename-data-table-column.tool.js.map +1 -1
- package/dist/modules/mcp/tools/data-table/rename-data-table.tool.d.ts +1 -1
- package/dist/modules/mcp/tools/data-table/rename-data-table.tool.js.map +1 -1
- package/dist/modules/mcp/tools/data-table/search-data-tables.tool.d.ts +1 -1
- package/dist/modules/mcp/tools/data-table/search-data-tables.tool.js.map +1 -1
- package/dist/modules/mcp/tools/execute-workflow.tool.d.ts +2 -2
- package/dist/modules/mcp/tools/execution-utils.js.map +1 -1
- package/dist/modules/mcp/tools/get-workflow-details.tool.d.ts +3 -3
- package/dist/modules/mcp/tools/get-workflow-details.tool.js.map +1 -1
- package/dist/modules/mcp/tools/get-workflow-history.tool.d.ts +49 -0
- package/dist/modules/mcp/tools/get-workflow-history.tool.js +115 -0
- package/dist/modules/mcp/tools/get-workflow-history.tool.js.map +1 -0
- package/dist/modules/mcp/tools/get-workflow-version.tool.d.ts +30 -0
- package/dist/modules/mcp/tools/get-workflow-version.tool.js +118 -0
- package/dist/modules/mcp/tools/get-workflow-version.tool.js.map +1 -0
- package/dist/modules/mcp/tools/prepare-workflow-pin-data.tool.d.ts +2 -2
- package/dist/modules/mcp/tools/prepare-workflow-pin-data.tool.js.map +1 -1
- package/dist/modules/mcp/tools/publish-workflow.tool.d.ts +1 -1
- package/dist/modules/mcp/tools/publish-workflow.tool.js.map +1 -1
- package/dist/modules/mcp/tools/schemas.d.ts +25 -11
- package/dist/modules/mcp/tools/schemas.js +7 -4
- package/dist/modules/mcp/tools/schemas.js.map +1 -1
- package/dist/modules/mcp/tools/search-folders.tool.d.ts +1 -1
- package/dist/modules/mcp/tools/search-folders.tool.js.map +1 -1
- package/dist/modules/mcp/tools/search-projects.tool.d.ts +1 -1
- package/dist/modules/mcp/tools/search-projects.tool.js.map +1 -1
- package/dist/modules/mcp/tools/test-workflow.tool.d.ts +2 -2
- package/dist/modules/mcp/tools/test-workflow.tool.js.map +1 -1
- package/dist/modules/mcp/tools/unpublish-workflow.tool.d.ts +1 -1
- package/dist/modules/mcp/tools/unpublish-workflow.tool.js.map +1 -1
- package/dist/modules/mcp/tools/webhook-utils.js.map +1 -1
- package/dist/modules/mcp/tools/workflow-builder/connection-structure-check.d.ts +1 -1
- package/dist/modules/mcp/tools/workflow-builder/connection-structure-check.js.map +1 -1
- package/dist/modules/mcp/tools/workflow-builder/create-workflow-from-code.tool.js +18 -2
- package/dist/modules/mcp/tools/workflow-builder/create-workflow-from-code.tool.js.map +1 -1
- package/dist/modules/mcp/tools/workflow-builder/delete-workflow.tool.d.ts +1 -1
- package/dist/modules/mcp/tools/workflow-builder/delete-workflow.tool.js +1 -1
- package/dist/modules/mcp/tools/workflow-builder/delete-workflow.tool.js.map +1 -1
- package/dist/modules/mcp/tools/workflow-builder/get-workflow-node-types.tool.d.ts +1 -1
- package/dist/modules/mcp/tools/workflow-builder/get-workflow-node-types.tool.js +1 -1
- package/dist/modules/mcp/tools/workflow-builder/get-workflow-node-types.tool.js.map +1 -1
- package/dist/modules/mcp/tools/workflow-builder/get-workflow-sdk-reference.tool.d.ts +1 -1
- package/dist/modules/mcp/tools/workflow-builder/get-workflow-sdk-reference.tool.js +1 -1
- package/dist/modules/mcp/tools/workflow-builder/get-workflow-sdk-reference.tool.js.map +1 -1
- package/dist/modules/mcp/tools/workflow-builder/mcp-instructions.js +4 -2
- package/dist/modules/mcp/tools/workflow-builder/mcp-instructions.js.map +1 -1
- package/dist/modules/mcp/tools/workflow-builder/restore-workflow-version.tool.d.ts +20 -0
- package/dist/modules/mcp/tools/workflow-builder/restore-workflow-version.tool.js +108 -0
- package/dist/modules/mcp/tools/workflow-builder/restore-workflow-version.tool.js.map +1 -0
- package/dist/modules/mcp/tools/workflow-builder/search-workflow-nodes.tool.d.ts +1 -1
- package/dist/modules/mcp/tools/workflow-builder/search-workflow-nodes.tool.js +1 -1
- package/dist/modules/mcp/tools/workflow-builder/search-workflow-nodes.tool.js.map +1 -1
- package/dist/modules/mcp/tools/workflow-builder/update-workflow.tool.d.ts +3 -1
- package/dist/modules/mcp/tools/workflow-builder/update-workflow.tool.js +117 -4
- package/dist/modules/mcp/tools/workflow-builder/update-workflow.tool.js.map +1 -1
- package/dist/modules/mcp/tools/workflow-builder/validate-node.tool.d.ts +1 -1
- package/dist/modules/mcp/tools/workflow-builder/validate-node.tool.js +1 -1
- package/dist/modules/mcp/tools/workflow-builder/validate-node.tool.js.map +1 -1
- package/dist/modules/mcp/tools/workflow-builder/validate-workflow-code.tool.d.ts +1 -1
- package/dist/modules/mcp/tools/workflow-builder/validate-workflow-code.tool.js +4 -1
- package/dist/modules/mcp/tools/workflow-builder/validate-workflow-code.tool.js.map +1 -1
- package/dist/modules/mcp/tools/workflow-builder/workflow-operations.d.ts +195 -3
- package/dist/modules/mcp/tools/workflow-builder/workflow-operations.js +69 -1
- package/dist/modules/mcp/tools/workflow-builder/workflow-operations.js.map +1 -1
- package/dist/modules/mcp/tools/workflow-history.utils.d.ts +3 -0
- package/dist/modules/mcp/tools/workflow-history.utils.js +18 -0
- package/dist/modules/mcp/tools/workflow-history.utils.js.map +1 -0
- package/dist/modules/mcp-registry/registry/mcp-registry.service.js +4 -1
- package/dist/modules/mcp-registry/registry/mcp-registry.service.js.map +1 -1
- package/dist/modules/mcp-registry/synthesize-type-def.d.ts +1 -1
- package/dist/modules/mcp-registry/synthesize-type-def.js +3 -3
- package/dist/modules/mcp-registry/synthesize-type-def.js.map +1 -1
- package/dist/modules/n8n-packages/n8n-packages.service.d.ts +1 -1
- package/dist/modules/n8n-packages/n8n-packages.service.js +1 -1
- package/dist/modules/n8n-packages/n8n-packages.service.js.map +1 -1
- package/dist/modules/n8n-packages/utils/import-package-upload.js +1 -1
- package/dist/modules/n8n-packages/utils/import-package-upload.js.map +1 -1
- package/dist/modules/oauth-server/oauth-consent.service.d.ts +3 -1
- package/dist/modules/oauth-server/oauth-consent.service.js +8 -4
- package/dist/modules/oauth-server/oauth-consent.service.js.map +1 -1
- package/dist/modules/oauth-server/oauth.controller.js +1 -0
- package/dist/modules/oauth-server/oauth.controller.js.map +1 -1
- package/dist/modules/oauth-server/oauth.helpers.d.ts +2 -2
- package/dist/modules/oauth-server/oauth.helpers.js +4 -2
- package/dist/modules/oauth-server/oauth.helpers.js.map +1 -1
- package/dist/modules/provisioning.ee/provisioning.module.js +4 -0
- package/dist/modules/provisioning.ee/provisioning.module.js.map +1 -1
- package/dist/modules/provisioning.ee/role-deletion-checker.ee.d.ts +7 -0
- package/dist/modules/provisioning.ee/role-deletion-checker.ee.js +33 -0
- package/dist/modules/provisioning.ee/role-deletion-checker.ee.js.map +1 -0
- package/dist/modules/quick-connect/handlers/firecrawl.handler.js +3 -3
- package/dist/modules/quick-connect/handlers/firecrawl.handler.js.map +1 -1
- package/dist/modules/quick-connect/quick-connect.config.d.ts +10 -10
- package/dist/modules/quick-connect/quick-connect.module.d.ts +2 -2
- package/dist/modules/quick-connect/quick-connect.service.js +1 -1
- package/dist/modules/quick-connect/quick-connect.service.js.map +1 -1
- package/dist/modules/redaction/executions/execution-redaction.service.d.ts +1 -1
- package/dist/modules/redaction/executions/execution-redaction.service.js.map +1 -1
- package/dist/modules/runtime-credentials/runtime-credentials.service.js +1 -1
- package/dist/modules/runtime-credentials/runtime-credentials.service.js.map +1 -1
- package/dist/modules/source-control.ee/source-control-context.factory.js.map +1 -1
- package/dist/modules/source-control.ee/source-control-export.service.ee.d.ts +1 -1
- package/dist/modules/source-control.ee/source-control-export.service.ee.js +2 -2
- package/dist/modules/source-control.ee/source-control-export.service.ee.js.map +1 -1
- package/dist/modules/source-control.ee/source-control-scoped.service.d.ts +3 -2
- package/dist/modules/source-control.ee/source-control-scoped.service.js +10 -1
- package/dist/modules/source-control.ee/source-control-scoped.service.js.map +1 -1
- package/dist/modules/source-control.ee/source-control-status.service.ee.d.ts +2 -2
- package/dist/modules/source-control.ee/source-control-status.service.ee.js +3 -3
- package/dist/modules/source-control.ee/source-control-status.service.ee.js.map +1 -1
- package/dist/modules/source-control.ee/source-control.controller.ee.d.ts +4 -4
- package/dist/modules/source-control.ee/source-control.controller.ee.js +5 -4
- package/dist/modules/source-control.ee/source-control.controller.ee.js.map +1 -1
- package/dist/modules/source-control.ee/source-control.service.ee.d.ts +8 -5
- package/dist/modules/source-control.ee/source-control.service.ee.js +25 -10
- package/dist/modules/source-control.ee/source-control.service.ee.js.map +1 -1
- package/dist/modules/sso-saml/saml-helpers.js.map +1 -1
- package/dist/modules/sso-saml/saml.controller.ee.d.ts +1 -1
- package/dist/modules/sso-saml/saml.controller.ee.js +4 -3
- package/dist/modules/sso-saml/saml.controller.ee.js.map +1 -1
- package/dist/modules/token-exchange/controllers/embed-auth.controller.js +1 -1
- package/dist/modules/token-exchange/controllers/embed-auth.controller.js.map +1 -1
- package/dist/modules/token-exchange/services/jwks-resolver.js +1 -1
- package/dist/modules/token-exchange/services/jwks-resolver.js.map +1 -1
- package/dist/modules/token-exchange/services/trusted-key.service.js +1 -1
- package/dist/modules/token-exchange/services/trusted-key.service.js.map +1 -1
- package/dist/modules/token-exchange/token-exchange.schemas.d.ts +2 -2
- package/dist/modules/workflow-builder/workflow-builder-session.entity.js +1 -1
- package/dist/modules/workflow-builder/workflow-builder-session.entity.js.map +1 -1
- package/dist/modules/workflow-builder/workflow-builder-session.repository.js +1 -1
- package/dist/modules/workflow-builder/workflow-builder-session.repository.js.map +1 -1
- package/dist/node-catalog/node-catalog.service.d.ts +3 -2
- package/dist/node-catalog/node-catalog.service.js +50 -18
- package/dist/node-catalog/node-catalog.service.js.map +1 -1
- package/dist/oauth/oauth.service.d.ts +1 -1
- package/dist/oauth/oauth.service.js +7 -6
- package/dist/oauth/oauth.service.js.map +1 -1
- package/dist/permissions.ee/check-access.js +1 -1
- package/dist/permissions.ee/check-access.js.map +1 -1
- package/dist/public-api/index.js +24 -3
- package/dist/public-api/index.js.map +1 -1
- package/dist/public-api/v1/handlers/discover/discover.service.js +38 -2
- package/dist/public-api/v1/handlers/discover/discover.service.js.map +1 -1
- package/dist/public-api/v1/handlers/n8n-packages/n8n-packages.handler.js +1 -1
- package/dist/public-api/v1/handlers/n8n-packages/n8n-packages.handler.js.map +1 -1
- package/dist/scaling/job-processor.js +1 -0
- package/dist/scaling/job-processor.js.map +1 -1
- package/dist/scaling/leader-election-client.d.ts +1 -1
- package/dist/scaling/leader-election-client.js +1 -1
- package/dist/scaling/leader-election-client.js.map +1 -1
- package/dist/scaling/pubsub/subscriber.service.js +1 -1
- package/dist/scaling/pubsub/subscriber.service.js.map +1 -1
- package/dist/scaling/redis/redis.types.d.ts +1 -1
- package/dist/scaling/redis-lock.service.d.ts +15 -0
- package/dist/scaling/redis-lock.service.js +154 -0
- package/dist/scaling/redis-lock.service.js.map +1 -0
- package/dist/security-audit/risk-reporters/instance-risk-reporter.js +3 -3
- package/dist/security-audit/risk-reporters/instance-risk-reporter.js.map +1 -1
- package/dist/server.js +4 -0
- package/dist/server.js.map +1 -1
- package/dist/services/ai-gateway.service.d.ts +1 -1
- package/dist/services/ai-gateway.service.js +1 -1
- package/dist/services/ai-gateway.service.js.map +1 -1
- package/dist/services/ai-workflow-builder.service.js +5 -4
- package/dist/services/ai-workflow-builder.service.js.map +1 -1
- package/dist/services/credentials-tester.service.d.ts +1 -1
- package/dist/services/credentials-tester.service.js +3 -3
- package/dist/services/credentials-tester.service.js.map +1 -1
- package/dist/services/dynamic-node-parameters.service.d.ts +3 -3
- package/dist/services/dynamic-node-parameters.service.js +4 -4
- package/dist/services/dynamic-node-parameters.service.js.map +1 -1
- package/dist/services/dynamic-templates.service.js +3 -3
- package/dist/services/dynamic-templates.service.js.map +1 -1
- package/dist/services/export.service.js +3 -3
- package/dist/services/export.service.js.map +1 -1
- package/dist/services/frontend.service.js.map +1 -1
- package/dist/services/import.service.js.map +1 -1
- package/dist/services/ownership.service.d.ts +3 -3
- package/dist/services/ownership.service.js +5 -5
- package/dist/services/ownership.service.js.map +1 -1
- package/dist/services/project.service.ee.js +2 -2
- package/dist/services/project.service.ee.js.map +1 -1
- package/dist/services/pruning/workflow-history-compaction.service.d.ts +1 -1
- package/dist/services/pruning/workflow-history-compaction.service.js +1 -1
- package/dist/services/pruning/workflow-history-compaction.service.js.map +1 -1
- package/dist/services/rate-limit.service.d.ts +1 -1
- package/dist/services/rate-limit.service.js.map +1 -1
- package/dist/services/role-deletion-check-proxy.service.d.ts +8 -0
- package/dist/services/role-deletion-check-proxy.service.js +28 -0
- package/dist/services/role-deletion-check-proxy.service.js.map +1 -0
- package/dist/services/role.service.d.ts +5 -2
- package/dist/services/role.service.js +18 -2
- package/dist/services/role.service.js.map +1 -1
- package/dist/services/user.service.js +5 -0
- package/dist/services/user.service.js.map +1 -1
- package/dist/task-runners/task-managers/data-request-response-builder.js +1 -0
- package/dist/task-runners/task-managers/data-request-response-builder.js.map +1 -1
- package/dist/task-runners/task-runner-process-js.js +2 -0
- package/dist/task-runners/task-runner-process-js.js.map +1 -1
- package/dist/tool-generation/hitl-tools.js.map +1 -1
- package/dist/utils/compression.util.js +2 -2
- package/dist/utils/compression.util.js.map +1 -1
- package/dist/utils/health-endpoint.util.js.map +1 -1
- package/dist/utils/strapi-utils.js +2 -3
- package/dist/utils/strapi-utils.js.map +1 -1
- package/dist/webhooks/test-webhook-registrations.service.js +1 -1
- package/dist/webhooks/test-webhook-registrations.service.js.map +1 -1
- package/dist/webhooks/test-webhooks.d.ts +1 -1
- package/dist/webhooks/test-webhooks.js.map +1 -1
- package/dist/webhooks/waiting-forms.js +2 -2
- package/dist/webhooks/waiting-forms.js.map +1 -1
- package/dist/webhooks/webhook.service.d.ts +1 -0
- package/dist/webhooks/webhook.service.js +4 -1
- package/dist/webhooks/webhook.service.js.map +1 -1
- package/dist/workflow-execute-additional-data.d.ts +2 -2
- package/dist/workflow-execute-additional-data.js +5 -4
- package/dist/workflow-execute-additional-data.js.map +1 -1
- package/dist/workflow-runner.js +1 -0
- package/dist/workflow-runner.js.map +1 -1
- package/dist/workflows/publication/workflow-publication-applier.d.ts +3 -1
- package/dist/workflows/publication/workflow-publication-applier.js +10 -2
- package/dist/workflows/publication/workflow-publication-applier.js.map +1 -1
- package/dist/workflows/triggers/non-webhook-trigger-registrar.d.ts +1 -1
- package/dist/workflows/triggers/trigger-execution-context.factory.d.ts +1 -1
- package/dist/workflows/triggers/trigger-execution-context.factory.js +4 -5
- package/dist/workflows/triggers/trigger-execution-context.factory.js.map +1 -1
- package/dist/workflows/triggers/webhook-trigger-registrar.d.ts +4 -1
- package/dist/workflows/triggers/webhook-trigger-registrar.js +36 -9
- package/dist/workflows/triggers/webhook-trigger-registrar.js.map +1 -1
- package/dist/workflows/triggers/workflow-trigger-activator.d.ts +3 -0
- package/dist/workflows/triggers/workflow-trigger-activator.js +66 -32
- package/dist/workflows/triggers/workflow-trigger-activator.js.map +1 -1
- package/dist/workflows/workflow-creation.service.js +1 -1
- package/dist/workflows/workflow-creation.service.js.map +1 -1
- package/dist/workflows/workflow-history/workflow-history.service.d.ts +4 -3
- package/dist/workflows/workflow-history/workflow-history.service.js +4 -3
- package/dist/workflows/workflow-history/workflow-history.service.js.map +1 -1
- package/dist/workflows/workflow-published-data.service.d.ts +16 -6
- package/dist/workflows/workflow-published-data.service.js +42 -2
- package/dist/workflows/workflow-published-data.service.js.map +1 -1
- package/dist/workflows/workflow-validation.service.js +4 -22
- package/dist/workflows/workflow-validation.service.js.map +1 -1
- package/dist/workflows/workflow.service.d.ts +2 -2
- package/dist/workflows/workflow.service.ee.d.ts +1 -1
- package/dist/workflows/workflow.service.ee.js +1 -1
- package/dist/workflows/workflow.service.ee.js.map +1 -1
- package/dist/workflows/workflow.service.js +7 -7
- package/dist/workflows/workflow.service.js.map +1 -1
- package/dist/workflows/workflows.controller.d.ts +6 -6
- package/dist/workflows/workflows.controller.js +3 -3
- package/dist/workflows/workflows.controller.js.map +1 -1
- package/package.json +68 -56
- package/dist/modules/instance-ai/eval/proxy-loopback.d.ts +0 -1
- package/dist/modules/instance-ai/eval/proxy-loopback.js +0 -44
- package/dist/modules/instance-ai/eval/proxy-loopback.js.map +0 -1
|
@@ -43,187 +43,22 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
43
43
|
};
|
|
44
44
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
45
|
exports.AgentsService = void 0;
|
|
46
|
-
exports.chatThreadId = chatThreadId;
|
|
47
|
-
const api_types_1 = require("@n8n/api-types");
|
|
48
|
-
const fromai_helpers_1 = require("@n8n/ai-utilities/fromai-helpers");
|
|
49
46
|
const backend_common_1 = require("@n8n/backend-common");
|
|
50
|
-
const config_1 = require("@n8n/config");
|
|
51
|
-
const constants_1 = require("@n8n/constants");
|
|
52
|
-
const utils_1 = require("@n8n/utils");
|
|
53
47
|
const db_1 = require("@n8n/db");
|
|
54
|
-
const decorators_1 = require("@n8n/decorators");
|
|
55
48
|
const di_1 = require("@n8n/di");
|
|
56
|
-
const n8n_workflow_1 = require("n8n-workflow");
|
|
57
49
|
const uuid_1 = require("uuid");
|
|
58
|
-
const credentials_service_1 = require("../../credentials/credentials.service");
|
|
59
|
-
const conflict_error_1 = require("../../errors/response-errors/conflict.error");
|
|
60
|
-
const not_found_error_1 = require("../../errors/response-errors/not-found.error");
|
|
61
|
-
const node_definition_resolver_1 = require("../../modules/instance-ai/node-definition-resolver");
|
|
62
|
-
const publisher_service_1 = require("../../scaling/pubsub/publisher.service");
|
|
63
|
-
const telemetry_1 = require("../../telemetry");
|
|
64
|
-
const ttl_map_1 = require("../../utils/ttl-map");
|
|
65
|
-
const agents_credential_provider_1 = require("./adapters/agents-credential-provider");
|
|
66
|
-
const agent_telemetry_1 = require("./agent-telemetry");
|
|
67
|
-
const agent_draft_utils_1 = require("./utils/agent-draft.utils");
|
|
68
|
-
const agent_memory_scope_1 = require("./utils/agent-memory-scope");
|
|
69
|
-
const execution_to_message_mapper_1 = require("./utils/execution-to-message-mapper");
|
|
70
|
-
const agent_resource_id_1 = require("./utils/agent-resource-id");
|
|
71
|
-
const agent_stream_1 = require("./utils/agent-stream");
|
|
72
|
-
const structured_output_error_1 = require("./utils/structured-output-error");
|
|
73
|
-
const agent_execution_service_1 = require("./agent-execution.service");
|
|
74
|
-
const agent_skills_service_1 = require("./agent-skills.service");
|
|
75
|
-
const builder_tool_names_1 = require("./builder/builder-tool-names");
|
|
76
|
-
const llm_provider_defaults_1 = require("./builder/interactive/llm-provider-defaults");
|
|
77
|
-
const agent_task_entity_1 = require("./entities/agent-task.entity");
|
|
78
|
-
const execution_recorder_1 = require("./execution-recorder");
|
|
79
|
-
const agent_chat_integration_1 = require("./integrations/agent-chat-integration");
|
|
80
|
-
const integration_message_context_service_1 = require("./integrations/integration-message-context.service");
|
|
81
|
-
const integrations_sync_1 = require("./integrations/integrations-sync");
|
|
82
|
-
const n8n_checkpoint_storage_1 = require("./integrations/n8n-checkpoint-storage");
|
|
83
|
-
const n8n_memory_1 = require("./integrations/n8n-memory");
|
|
84
|
-
const agent_config_composition_1 = require("./json-config/agent-config-composition");
|
|
85
|
-
const model_id_1 = require("./json-config/model-id");
|
|
86
|
-
const sanitize_unknown_agent_credentials_1 = require("./json-config/sanitize-unknown-agent-credentials");
|
|
87
|
-
const agent_runtime_reconstruction_service_1 = require("./agent-runtime-reconstruction.service");
|
|
88
|
-
const agent_history_repository_1 = require("./repositories/agent-history.repository");
|
|
89
|
-
const agent_task_snapshot_repository_1 = require("./repositories/agent-task-snapshot.repository");
|
|
90
|
-
const agent_task_repository_1 = require("./repositories/agent-task.repository");
|
|
91
|
-
const agent_repository_1 = require("./repositories/agent.repository");
|
|
92
|
-
const chat_integration_service_1 = require("./integrations/chat-integration.service");
|
|
93
50
|
const agent_knowledge_service_1 = require("./agent-knowledge.service");
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
return userId ? `${baseThreadId}:${userId}` : baseThreadId;
|
|
98
|
-
}
|
|
99
|
-
function getMaxIterationsChunks() {
|
|
100
|
-
const id = crypto.randomUUID();
|
|
101
|
-
return [
|
|
102
|
-
{ type: 'text-start', id },
|
|
103
|
-
{
|
|
104
|
-
type: 'text-delta',
|
|
105
|
-
id,
|
|
106
|
-
delta: 'The agent has reached the maximum number of iterations and has stopped.',
|
|
107
|
-
},
|
|
108
|
-
{ type: 'text-end', id },
|
|
109
|
-
];
|
|
110
|
-
}
|
|
51
|
+
const agent_runtime_cache_service_1 = require("./agent-runtime-cache.service");
|
|
52
|
+
const agent_test_chat_service_1 = require("./agent-test-chat.service");
|
|
53
|
+
const agent_repository_1 = require("./repositories/agent.repository");
|
|
111
54
|
let AgentsService = class AgentsService {
|
|
112
|
-
|
|
113
|
-
if (params.usePublishedVersion) {
|
|
114
|
-
const parts = [params.agentId, 'published'];
|
|
115
|
-
if (params.integrationType)
|
|
116
|
-
parts.push(params.integrationType);
|
|
117
|
-
return parts.join(':');
|
|
118
|
-
}
|
|
119
|
-
const parts = [params.agentId, 'draft'];
|
|
120
|
-
if (params.n8nUserId)
|
|
121
|
-
parts.push(params.n8nUserId);
|
|
122
|
-
if (params.integrationType)
|
|
123
|
-
parts.push(params.integrationType);
|
|
124
|
-
return parts.join(':');
|
|
125
|
-
}
|
|
126
|
-
clearRuntimes(agentId, options = {}) {
|
|
127
|
-
for (const key of this.runtimes.keys()) {
|
|
128
|
-
if (key === agentId || key.startsWith(`${agentId}:`)) {
|
|
129
|
-
const entry = this.runtimes.get(key);
|
|
130
|
-
this.runtimes.delete(key);
|
|
131
|
-
if (entry)
|
|
132
|
-
this.closeAgentResources(entry.agent, agentId);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
if (options.skipBroadcast)
|
|
136
|
-
return;
|
|
137
|
-
if (!this.globalConfig.multiMainSetup.enabled)
|
|
138
|
-
return;
|
|
139
|
-
void this.publisher
|
|
140
|
-
.publishCommand({
|
|
141
|
-
command: 'agent-config-changed',
|
|
142
|
-
payload: { agentId },
|
|
143
|
-
})
|
|
144
|
-
.catch((error) => {
|
|
145
|
-
this.logger.warn(`[AgentsService] Failed to publish agent-config-changed for ${agentId}`, {
|
|
146
|
-
error: error instanceof Error ? error.message : String(error),
|
|
147
|
-
});
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
clearRuntimeCacheForAgent(agentId) {
|
|
151
|
-
this.clearRuntimes(agentId);
|
|
152
|
-
}
|
|
153
|
-
handleAgentConfigChanged(payload) {
|
|
154
|
-
this.clearRuntimes(payload.agentId, { skipBroadcast: true });
|
|
155
|
-
}
|
|
156
|
-
constructor(logger, agentRepository, projectRelationRepository, n8nCheckpointStorage, n8nMemory, agentExecutionService, agentHistoryRepository, agentSkillsService, agentTaskRepository, agentTaskSnapshotRepository, publisher, agentsConfig, globalConfig, telemetry, chatIntegrationService, agentKnowledgeService, agentRuntimeReconstructionService, integrationMessageContextService) {
|
|
55
|
+
constructor(logger, agentRepository, projectRelationRepository, agentKnowledgeService, runtimeCacheService, testChatService) {
|
|
157
56
|
this.logger = logger;
|
|
158
57
|
this.agentRepository = agentRepository;
|
|
159
58
|
this.projectRelationRepository = projectRelationRepository;
|
|
160
|
-
this.n8nCheckpointStorage = n8nCheckpointStorage;
|
|
161
|
-
this.n8nMemory = n8nMemory;
|
|
162
|
-
this.agentExecutionService = agentExecutionService;
|
|
163
|
-
this.agentHistoryRepository = agentHistoryRepository;
|
|
164
|
-
this.agentSkillsService = agentSkillsService;
|
|
165
|
-
this.agentTaskRepository = agentTaskRepository;
|
|
166
|
-
this.agentTaskSnapshotRepository = agentTaskSnapshotRepository;
|
|
167
|
-
this.publisher = publisher;
|
|
168
|
-
this.agentsConfig = agentsConfig;
|
|
169
|
-
this.globalConfig = globalConfig;
|
|
170
|
-
this.telemetry = telemetry;
|
|
171
|
-
this.chatIntegrationService = chatIntegrationService;
|
|
172
59
|
this.agentKnowledgeService = agentKnowledgeService;
|
|
173
|
-
this.
|
|
174
|
-
this.
|
|
175
|
-
this.runtimes = new ttl_map_1.TtlMap(30 * constants_1.Time.minutes.toMilliseconds);
|
|
176
|
-
}
|
|
177
|
-
isNodeToolsModuleEnabled() {
|
|
178
|
-
return this.agentsConfig.modules.includes('node-tools-searcher');
|
|
179
|
-
}
|
|
180
|
-
isKnowledgeBaseEnabled() {
|
|
181
|
-
return (0, agent_knowledge_gate_1.isAgentKnowledgeBaseEnabled)(this.agentsConfig);
|
|
182
|
-
}
|
|
183
|
-
closeAgentResources(agent, agentId) {
|
|
184
|
-
agent.close().catch((error) => {
|
|
185
|
-
this.logger.warn('[AgentsService] Failed to close agent resources on eviction', {
|
|
186
|
-
agentId,
|
|
187
|
-
error: error instanceof Error ? error.message : String(error),
|
|
188
|
-
});
|
|
189
|
-
});
|
|
190
|
-
}
|
|
191
|
-
createAgentExecutionCounter({ agentId, userId, }) {
|
|
192
|
-
const attribution = userId ? { user_id: userId } : {};
|
|
193
|
-
return {
|
|
194
|
-
incrementMessageCount: () => this.telemetry.trackAgentExecution({
|
|
195
|
-
agent_id: agentId,
|
|
196
|
-
...attribution,
|
|
197
|
-
message_count: 1,
|
|
198
|
-
}),
|
|
199
|
-
incrementTokenCount: (tokenCount) => this.telemetry.trackAgentExecution({
|
|
200
|
-
agent_id: agentId,
|
|
201
|
-
...attribution,
|
|
202
|
-
token_count: tokenCount,
|
|
203
|
-
}),
|
|
204
|
-
incrementToolCallCount: () => this.telemetry.trackAgentExecution({
|
|
205
|
-
agent_id: agentId,
|
|
206
|
-
...attribution,
|
|
207
|
-
tool_call_count: 1,
|
|
208
|
-
}),
|
|
209
|
-
};
|
|
210
|
-
}
|
|
211
|
-
listChatIntegrations() {
|
|
212
|
-
return di_1.Container.get(agent_chat_integration_1.ChatIntegrationRegistry)
|
|
213
|
-
.listPublic()
|
|
214
|
-
.map((i) => ({
|
|
215
|
-
type: i.type,
|
|
216
|
-
label: i.displayLabel,
|
|
217
|
-
icon: i.displayIcon,
|
|
218
|
-
credentialTypes: i.credentialTypes,
|
|
219
|
-
...(i.builderGuidance
|
|
220
|
-
? {
|
|
221
|
-
capabilities: i.builderGuidance.capabilities,
|
|
222
|
-
useIntegrationWhen: i.builderGuidance.useIntegrationWhen,
|
|
223
|
-
useNodeToolWhen: i.builderGuidance.useNodeToolWhen,
|
|
224
|
-
}
|
|
225
|
-
: {}),
|
|
226
|
-
}));
|
|
60
|
+
this.runtimeCacheService = runtimeCacheService;
|
|
61
|
+
this.testChatService = testChatService;
|
|
227
62
|
}
|
|
228
63
|
async create(projectId, name) {
|
|
229
64
|
const defaultConfig = {
|
|
@@ -252,37 +87,6 @@ let AgentsService = class AgentsService {
|
|
|
252
87
|
async findById(agentId, projectId) {
|
|
253
88
|
return await this.agentRepository.findByIdAndProjectId(agentId, projectId);
|
|
254
89
|
}
|
|
255
|
-
async updateName(agentId, projectId, name) {
|
|
256
|
-
const agent = await this.agentRepository.findByIdAndProjectId(agentId, projectId);
|
|
257
|
-
if (!agent) {
|
|
258
|
-
return null;
|
|
259
|
-
}
|
|
260
|
-
agent.name = name;
|
|
261
|
-
if (agent.schema) {
|
|
262
|
-
agent.schema = { ...agent.schema, name };
|
|
263
|
-
}
|
|
264
|
-
(0, agent_draft_utils_1.markAgentDraftDirty)(agent);
|
|
265
|
-
const saved = await this.agentRepository.save(agent);
|
|
266
|
-
this.logger.debug('Updated SDK agent name', { agentId, projectId, name });
|
|
267
|
-
return saved;
|
|
268
|
-
}
|
|
269
|
-
async updateDescription(agentId, projectId, description, updatedAt) {
|
|
270
|
-
const agent = await this.agentRepository.findByIdAndProjectId(agentId, projectId);
|
|
271
|
-
if (!agent) {
|
|
272
|
-
return null;
|
|
273
|
-
}
|
|
274
|
-
if (updatedAt && agent.updatedAt.toISOString() !== updatedAt) {
|
|
275
|
-
throw new conflict_error_1.ConflictError('Agent has been modified');
|
|
276
|
-
}
|
|
277
|
-
agent.description = description;
|
|
278
|
-
if (agent.schema) {
|
|
279
|
-
agent.schema = { ...agent.schema, description };
|
|
280
|
-
}
|
|
281
|
-
(0, agent_draft_utils_1.markAgentDraftDirty)(agent);
|
|
282
|
-
const saved = await this.agentRepository.save(agent);
|
|
283
|
-
this.logger.debug('Updated SDK agent description', { agentId, projectId });
|
|
284
|
-
return saved;
|
|
285
|
-
}
|
|
286
90
|
async findByUser(userId) {
|
|
287
91
|
const projectRelations = await this.projectRelationRepository.findAllByUser(userId);
|
|
288
92
|
const projectIds = projectRelations.map((pr) => pr.projectId);
|
|
@@ -310,152 +114,6 @@ let AgentsService = class AgentsService {
|
|
|
310
114
|
});
|
|
311
115
|
return agents.filter((agent) => agent.activeVersionId !== null);
|
|
312
116
|
}
|
|
313
|
-
async publishAgent(agentId, projectId, user, versionId, options = {}) {
|
|
314
|
-
const agent = await this.agentRepository.findByIdAndProjectId(agentId, projectId);
|
|
315
|
-
if (!agent) {
|
|
316
|
-
throw new not_found_error_1.NotFoundError(`Agent "${agentId}" not found`);
|
|
317
|
-
}
|
|
318
|
-
if (!versionId && agent.versionId !== null && agent.versionId === agent.activeVersionId) {
|
|
319
|
-
return agent;
|
|
320
|
-
}
|
|
321
|
-
if (versionId !== undefined && versionId === agent.activeVersionId) {
|
|
322
|
-
return agent;
|
|
323
|
-
}
|
|
324
|
-
await this.agentRepository.manager.transaction(async (trx) => {
|
|
325
|
-
if (versionId) {
|
|
326
|
-
const existing = await this.agentHistoryRepository.findByVersionAndAgentId(versionId, agentId, trx);
|
|
327
|
-
if (!existing) {
|
|
328
|
-
throw new not_found_error_1.NotFoundError(`Version "${versionId}" not found for agent "${agentId}"`);
|
|
329
|
-
}
|
|
330
|
-
agent.activeVersionId = existing.versionId;
|
|
331
|
-
agent.activeVersion = existing;
|
|
332
|
-
agent.versionId = (0, uuid_1.v4)();
|
|
333
|
-
}
|
|
334
|
-
else {
|
|
335
|
-
agent.versionId ??= (0, uuid_1.v4)();
|
|
336
|
-
agent.activeVersion = await this.agentHistoryRepository.saveVersion({
|
|
337
|
-
versionId: agent.versionId,
|
|
338
|
-
agentId: agent.id,
|
|
339
|
-
schema: agent.schema,
|
|
340
|
-
tools: this.snapshotConfiguredTools(agent.schema, agent.tools ?? {}),
|
|
341
|
-
skills: this.agentSkillsService.snapshotConfiguredSkills(agent.schema, agent.skills ?? {}),
|
|
342
|
-
publishedBy: user,
|
|
343
|
-
}, trx);
|
|
344
|
-
await this.snapshotConfiguredTasks(trx, agent.versionId, agent.id, agent.schema);
|
|
345
|
-
agent.activeVersionId = agent.versionId;
|
|
346
|
-
}
|
|
347
|
-
await trx.save(agent);
|
|
348
|
-
});
|
|
349
|
-
this.clearRuntimes(agentId);
|
|
350
|
-
const credentialIntegrations = agent.integrations ?? [];
|
|
351
|
-
if (credentialIntegrations.length > 0 && options.syncIntegrations !== false) {
|
|
352
|
-
const { ChatIntegrationService } = await Promise.resolve().then(() => __importStar(require('./integrations/chat-integration.service')));
|
|
353
|
-
await di_1.Container.get(ChatIntegrationService)
|
|
354
|
-
.syncToConfig(agent, [], credentialIntegrations)
|
|
355
|
-
.catch((error) => this.logger.warn('Failed to connect integrations on publish', {
|
|
356
|
-
agentId,
|
|
357
|
-
error,
|
|
358
|
-
}));
|
|
359
|
-
}
|
|
360
|
-
const { AgentTaskService } = await Promise.resolve().then(() => __importStar(require('./agent-task.service')));
|
|
361
|
-
await di_1.Container.get(AgentTaskService)
|
|
362
|
-
.requestReconcile(agentId)
|
|
363
|
-
.catch((error) => this.logger.warn('Failed to register agent tasks on publish', { agentId, error }));
|
|
364
|
-
this.logger.debug('Published SDK agent', { agentId, projectId, userId: user.id });
|
|
365
|
-
return agent;
|
|
366
|
-
}
|
|
367
|
-
async unpublishAgent(agentId, projectId) {
|
|
368
|
-
const agent = await this.agentRepository.findByIdAndProjectId(agentId, projectId);
|
|
369
|
-
if (!agent) {
|
|
370
|
-
throw new not_found_error_1.NotFoundError(`Agent "${agentId}" not found`);
|
|
371
|
-
}
|
|
372
|
-
await this.agentRepository.manager.transaction(async (trx) => {
|
|
373
|
-
agent.activeVersionId = null;
|
|
374
|
-
agent.activeVersion = null;
|
|
375
|
-
agent.versionId = (0, uuid_1.v4)();
|
|
376
|
-
await trx.save(agent);
|
|
377
|
-
});
|
|
378
|
-
this.clearRuntimes(agentId);
|
|
379
|
-
const { ChatIntegrationService } = await Promise.resolve().then(() => __importStar(require('./integrations/chat-integration.service')));
|
|
380
|
-
await di_1.Container.get(ChatIntegrationService).disconnect(agentId);
|
|
381
|
-
const { AgentTaskService } = await Promise.resolve().then(() => __importStar(require('./agent-task.service')));
|
|
382
|
-
await di_1.Container.get(AgentTaskService)
|
|
383
|
-
.requestReconcile(agentId)
|
|
384
|
-
.catch((error) => this.logger.warn('Failed to stop agent tasks on unpublish', { agentId, error }));
|
|
385
|
-
this.logger.debug('Unpublished SDK agent', { agentId, projectId });
|
|
386
|
-
return agent;
|
|
387
|
-
}
|
|
388
|
-
async revertToPublishedAgent(agentId, projectId) {
|
|
389
|
-
const agent = await this.agentRepository.findByIdAndProjectId(agentId, projectId);
|
|
390
|
-
if (!agent) {
|
|
391
|
-
throw new not_found_error_1.NotFoundError(`Agent "${agentId}" not found`);
|
|
392
|
-
}
|
|
393
|
-
const activeVersion = agent.activeVersion;
|
|
394
|
-
if (!activeVersion) {
|
|
395
|
-
throw new conflict_error_1.ConflictError(`Agent "${agentId}" is not published`);
|
|
396
|
-
}
|
|
397
|
-
await this.agentRepository.manager.transaction(async (trx) => {
|
|
398
|
-
agent.schema = activeVersion.schema ? (0, n8n_workflow_1.deepCopy)(activeVersion.schema) : null;
|
|
399
|
-
agent.tools = (0, n8n_workflow_1.deepCopy)(activeVersion.tools ?? {});
|
|
400
|
-
agent.skills = (0, n8n_workflow_1.deepCopy)(activeVersion.skills ?? {});
|
|
401
|
-
agent.versionId = activeVersion.versionId;
|
|
402
|
-
if (agent.schema) {
|
|
403
|
-
agent.name = agent.schema.name;
|
|
404
|
-
agent.description = agent.schema.description ?? null;
|
|
405
|
-
}
|
|
406
|
-
await trx.save(agent);
|
|
407
|
-
await this.restoreTasksFromSnapshot(trx, agentId, activeVersion.versionId);
|
|
408
|
-
});
|
|
409
|
-
this.clearRuntimes(agentId);
|
|
410
|
-
this.logger.debug('Reverted SDK agent to published version', { agentId, projectId });
|
|
411
|
-
return agent;
|
|
412
|
-
}
|
|
413
|
-
async revertToVersion(agentId, projectId, versionId) {
|
|
414
|
-
const agent = await this.agentRepository.findByIdAndProjectId(agentId, projectId);
|
|
415
|
-
if (!agent) {
|
|
416
|
-
throw new not_found_error_1.NotFoundError(`Agent "${agentId}" not found`);
|
|
417
|
-
}
|
|
418
|
-
await this.agentRepository.manager.transaction(async (trx) => {
|
|
419
|
-
const target = await this.agentHistoryRepository.findByVersionAndAgentId(versionId, agentId, trx);
|
|
420
|
-
if (!target) {
|
|
421
|
-
throw new not_found_error_1.NotFoundError(`Version "${versionId}" not found`);
|
|
422
|
-
}
|
|
423
|
-
agent.schema = target.schema ? (0, n8n_workflow_1.deepCopy)(target.schema) : null;
|
|
424
|
-
agent.tools = (0, n8n_workflow_1.deepCopy)(target.tools ?? {});
|
|
425
|
-
agent.skills = (0, n8n_workflow_1.deepCopy)(target.skills ?? {});
|
|
426
|
-
agent.versionId = (0, uuid_1.v4)();
|
|
427
|
-
if (agent.schema) {
|
|
428
|
-
agent.name = agent.schema.name;
|
|
429
|
-
agent.description = agent.schema.description ?? null;
|
|
430
|
-
}
|
|
431
|
-
await trx.save(agent);
|
|
432
|
-
});
|
|
433
|
-
this.clearRuntimes(agentId);
|
|
434
|
-
this.logger.debug('Reverted SDK agent to a specific version', {
|
|
435
|
-
agentId,
|
|
436
|
-
projectId,
|
|
437
|
-
versionId,
|
|
438
|
-
});
|
|
439
|
-
return agent;
|
|
440
|
-
}
|
|
441
|
-
async hasPublishHistory(agentId) {
|
|
442
|
-
return await this.agentHistoryRepository.existsForAgent(agentId);
|
|
443
|
-
}
|
|
444
|
-
async listPublishHistory(agentId, projectId, take, skip) {
|
|
445
|
-
const agent = await this.agentRepository.findByIdAndProjectId(agentId, projectId);
|
|
446
|
-
if (!agent) {
|
|
447
|
-
throw new not_found_error_1.NotFoundError(`Agent "${agentId}" not found`);
|
|
448
|
-
}
|
|
449
|
-
const versions = await this.agentHistoryRepository.findByAgentId(agentId, take, skip);
|
|
450
|
-
return versions.map((v) => ({
|
|
451
|
-
versionId: v.versionId,
|
|
452
|
-
agentId: v.agentId,
|
|
453
|
-
createdAt: v.createdAt.toISOString(),
|
|
454
|
-
updatedAt: v.updatedAt.toISOString(),
|
|
455
|
-
author: v.author,
|
|
456
|
-
isActive: v.versionId === agent.activeVersionId,
|
|
457
|
-
}));
|
|
458
|
-
}
|
|
459
117
|
async delete(agentId, projectId, userId) {
|
|
460
118
|
const agent = await this.agentRepository.findByIdAndProjectId(agentId, projectId);
|
|
461
119
|
if (!agent) {
|
|
@@ -471,7 +129,7 @@ let AgentsService = class AgentsService {
|
|
|
471
129
|
});
|
|
472
130
|
}
|
|
473
131
|
await this.agentRepository.remove(agent);
|
|
474
|
-
this.clearRuntimes(agentId);
|
|
132
|
+
this.runtimeCacheService.clearRuntimes(agentId);
|
|
475
133
|
try {
|
|
476
134
|
const { AgentTaskService } = await Promise.resolve().then(() => __importStar(require('./agent-task.service')));
|
|
477
135
|
await di_1.Container.get(AgentTaskService).requestReconcile(agentId);
|
|
@@ -483,7 +141,7 @@ let AgentsService = class AgentsService {
|
|
|
483
141
|
});
|
|
484
142
|
}
|
|
485
143
|
try {
|
|
486
|
-
await this.clearAllTestChatMessages(agentId);
|
|
144
|
+
await this.testChatService.clearAllTestChatMessages(agentId);
|
|
487
145
|
}
|
|
488
146
|
catch (error) {
|
|
489
147
|
this.logger.warn('Failed to clear test chat on agent delete', {
|
|
@@ -494,950 +152,15 @@ let AgentsService = class AgentsService {
|
|
|
494
152
|
this.logger.debug('Deleted SDK agent', { agentId, projectId });
|
|
495
153
|
return true;
|
|
496
154
|
}
|
|
497
|
-
async getConversationHistory(params) {
|
|
498
|
-
const { threadId, projectId, agentId } = params;
|
|
499
|
-
const detail = await this.agentExecutionService.getThreadDetail(threadId, projectId, agentId);
|
|
500
|
-
if (!detail)
|
|
501
|
-
return null;
|
|
502
|
-
return (0, execution_to_message_mapper_1.executionsToMessagesDto)(detail.executions);
|
|
503
|
-
}
|
|
504
|
-
createCredentialProvider(projectId) {
|
|
505
|
-
return new agents_credential_provider_1.AgentsCredentialProvider(di_1.Container.get(credentials_service_1.CredentialsService), projectId);
|
|
506
|
-
}
|
|
507
|
-
async getRuntime(params) {
|
|
508
|
-
const { agentId, projectId, integrationType, usePublishedVersion } = params;
|
|
509
|
-
const cacheKey = this.computeRuntimeCacheKey(params);
|
|
510
|
-
const cached = this.runtimes.get(cacheKey);
|
|
511
|
-
if (cached)
|
|
512
|
-
return cached;
|
|
513
|
-
const agentEntity = await this.agentRepository.findByIdAndProjectId(agentId, projectId);
|
|
514
|
-
if (!agentEntity)
|
|
515
|
-
throw new not_found_error_1.NotFoundError(`Agent ${agentId} not found`);
|
|
516
|
-
let n8nUserId = params.n8nUserId;
|
|
517
|
-
let agentData = agentEntity;
|
|
518
|
-
if (usePublishedVersion) {
|
|
519
|
-
agentData = this.getPublishedAgent(agentEntity);
|
|
520
|
-
n8nUserId ??= agentEntity.activeVersion?.publishedById ?? undefined;
|
|
521
|
-
}
|
|
522
|
-
if (!n8nUserId) {
|
|
523
|
-
throw new n8n_workflow_1.UserError('Agent user owner id is required');
|
|
524
|
-
}
|
|
525
|
-
const credentialProvider = this.createCredentialProvider(projectId);
|
|
526
|
-
const { agent: agentInstance, toolRegistry } = await this.reconstructFromConfig(agentData, credentialProvider, n8nUserId, integrationType);
|
|
527
|
-
this.runtimes.set(cacheKey, {
|
|
528
|
-
agent: agentInstance,
|
|
529
|
-
agentId,
|
|
530
|
-
toolRegistry,
|
|
531
|
-
projectId,
|
|
532
|
-
telemetryConfiguration: (0, agent_telemetry_1.buildAgentConfigurationTelemetry)(agentData),
|
|
533
|
-
});
|
|
534
|
-
const runtime = this.runtimes.get(cacheKey);
|
|
535
|
-
if (!runtime)
|
|
536
|
-
throw new Error(`Agent ${agentId} failed to reconstruct`);
|
|
537
|
-
return runtime;
|
|
538
|
-
}
|
|
539
|
-
async *resumeForChat(config) {
|
|
540
|
-
const { agentId, projectId, runId, toolCallId, resumeData, integrationType, userId, usePublishedVersion = true, } = config;
|
|
541
|
-
const checkpointStatus = await this.n8nCheckpointStorage.getStatus(runId);
|
|
542
|
-
if (checkpointStatus.status === 'expired') {
|
|
543
|
-
throw new n8n_workflow_1.UserError(`Checkpoint ${runId} is expired and cannot be resumed`);
|
|
544
|
-
}
|
|
545
|
-
if (checkpointStatus.status === 'not-found') {
|
|
546
|
-
throw new n8n_workflow_1.UserError(`Checkpoint ${runId} not found and cannot be resumed`);
|
|
547
|
-
}
|
|
548
|
-
const memoryScope = checkpointStatus.checkpoint?.persistence;
|
|
549
|
-
if (!memoryScope) {
|
|
550
|
-
throw new n8n_workflow_1.UserError(`Checkpoint ${runId} has no memory data and cannot be resumed`);
|
|
551
|
-
}
|
|
552
|
-
const threadId = memoryScope.threadId;
|
|
553
|
-
const runtime = await this.getRuntime({
|
|
554
|
-
agentId,
|
|
555
|
-
projectId,
|
|
556
|
-
...(userId ? { n8nUserId: userId } : {}),
|
|
557
|
-
usePublishedVersion,
|
|
558
|
-
integrationType,
|
|
559
|
-
});
|
|
560
|
-
const { agent: agentInstance, toolRegistry } = runtime;
|
|
561
|
-
const recorder = new execution_recorder_1.ExecutionRecorder(toolRegistry);
|
|
562
|
-
const runType = usePublishedVersion ? 'production' : 'test';
|
|
563
|
-
try {
|
|
564
|
-
const resultStream = await agentInstance.resume('stream', resumeData, {
|
|
565
|
-
runId,
|
|
566
|
-
toolCallId,
|
|
567
|
-
executionCounter: this.createAgentExecutionCounter({ agentId, userId }),
|
|
568
|
-
});
|
|
569
|
-
for await (const value of (0, agent_stream_1.streamAgentChunks)(resultStream.stream)) {
|
|
570
|
-
recorder.record(value);
|
|
571
|
-
yield value;
|
|
572
|
-
}
|
|
573
|
-
}
|
|
574
|
-
catch (error) {
|
|
575
|
-
recorder.record({ type: 'error', error });
|
|
576
|
-
recorder.record({ type: 'finish', finishReason: 'error' });
|
|
577
|
-
throw error;
|
|
578
|
-
}
|
|
579
|
-
finally {
|
|
580
|
-
const messageRecord = recorder.getMessageRecord();
|
|
581
|
-
void this.agentExecutionService
|
|
582
|
-
.recordMessage({
|
|
583
|
-
threadId,
|
|
584
|
-
agentId,
|
|
585
|
-
agentName: agentInstance.name,
|
|
586
|
-
projectId,
|
|
587
|
-
userMessage: '',
|
|
588
|
-
record: messageRecord,
|
|
589
|
-
telemetry: {
|
|
590
|
-
runType,
|
|
591
|
-
configuration: runtime.telemetryConfiguration,
|
|
592
|
-
},
|
|
593
|
-
hitlStatus: recorder.suspended ? 'suspended' : 'resumed',
|
|
594
|
-
})
|
|
595
|
-
.catch((error) => {
|
|
596
|
-
this.logger.warn('Failed to record resumed agent execution', {
|
|
597
|
-
agentId,
|
|
598
|
-
threadId,
|
|
599
|
-
error: error instanceof Error ? error.message : String(error),
|
|
600
|
-
});
|
|
601
|
-
});
|
|
602
|
-
}
|
|
603
|
-
}
|
|
604
|
-
async validateAgentIsRunnable(agentId, projectId, credentialProvider) {
|
|
605
|
-
const agentEntity = await this.agentRepository.findByIdAndProjectId(agentId, projectId);
|
|
606
|
-
if (!agentEntity) {
|
|
607
|
-
return { missing: ['agent'] };
|
|
608
|
-
}
|
|
609
|
-
const config = agentEntity.schema;
|
|
610
|
-
const missing = [];
|
|
611
|
-
if (!config) {
|
|
612
|
-
return { missing: ['instructions', 'model', 'credential'] };
|
|
613
|
-
}
|
|
614
|
-
if (!config.instructions?.trim()) {
|
|
615
|
-
missing.push('instructions');
|
|
616
|
-
}
|
|
617
|
-
if (!config.model?.trim() || !api_types_1.AgentModelSchema.safeParse(config.model).success) {
|
|
618
|
-
missing.push('model');
|
|
619
|
-
}
|
|
620
|
-
let credentialList;
|
|
621
|
-
const findCredential = async (credentialId) => {
|
|
622
|
-
credentialList ??= await credentialProvider.list();
|
|
623
|
-
return credentialList.find((credential) => credential.id === credentialId);
|
|
624
|
-
};
|
|
625
|
-
const credentialExists = async (credentialId) => {
|
|
626
|
-
return (await findCredential(credentialId)) !== undefined;
|
|
627
|
-
};
|
|
628
|
-
if (!config.credential?.trim()) {
|
|
629
|
-
missing.push('credential');
|
|
630
|
-
}
|
|
631
|
-
else {
|
|
632
|
-
try {
|
|
633
|
-
const credentialId = config.credential.trim();
|
|
634
|
-
if (!(await credentialExists(credentialId)))
|
|
635
|
-
missing.push('credential');
|
|
636
|
-
}
|
|
637
|
-
catch {
|
|
638
|
-
}
|
|
639
|
-
}
|
|
640
|
-
const episodicMemory = config.memory?.episodicMemory;
|
|
641
|
-
if (config.memory?.enabled) {
|
|
642
|
-
try {
|
|
643
|
-
await this.validateMemoryWorkerModel(config.memory.observationalMemory?.observerModel, 'memory.observationalMemory.observerModel', findCredential, missing);
|
|
644
|
-
await this.validateMemoryWorkerModel(config.memory.observationalMemory?.reflectorModel, 'memory.observationalMemory.reflectorModel', findCredential, missing);
|
|
645
|
-
if (episodicMemory?.enabled === true) {
|
|
646
|
-
if (!(await credentialExists(episodicMemory.credential.trim()))) {
|
|
647
|
-
missing.push('episodicMemory.credential');
|
|
648
|
-
}
|
|
649
|
-
await this.validateMemoryWorkerModel(episodicMemory.extractorModel, 'memory.episodicMemory.extractorModel', findCredential, missing);
|
|
650
|
-
await this.validateMemoryWorkerModel(episodicMemory.reflectorModel, 'memory.episodicMemory.reflectorModel', findCredential, missing);
|
|
651
|
-
}
|
|
652
|
-
}
|
|
653
|
-
catch {
|
|
654
|
-
}
|
|
655
|
-
}
|
|
656
|
-
const webSearch = config.config?.webSearch;
|
|
657
|
-
if (webSearch?.enabled &&
|
|
658
|
-
(webSearch.provider === 'brave' || webSearch.provider === 'searxng')) {
|
|
659
|
-
const webSearchCredentialId = webSearch.credential?.trim();
|
|
660
|
-
if (!webSearchCredentialId) {
|
|
661
|
-
missing.push('webSearch.credential');
|
|
662
|
-
}
|
|
663
|
-
else {
|
|
664
|
-
try {
|
|
665
|
-
if (!(await credentialExists(webSearchCredentialId))) {
|
|
666
|
-
missing.push('webSearch.credential');
|
|
667
|
-
}
|
|
668
|
-
}
|
|
669
|
-
catch {
|
|
670
|
-
}
|
|
671
|
-
}
|
|
672
|
-
}
|
|
673
|
-
try {
|
|
674
|
-
const modelsByDifficulty = config.subAgents?.modelsByDifficulty;
|
|
675
|
-
if (modelsByDifficulty) {
|
|
676
|
-
for (const difficulty of api_types_1.SUB_AGENT_TASK_DIFFICULTIES) {
|
|
677
|
-
await this.validateMemoryWorkerModel(modelsByDifficulty[difficulty], `subAgents.modelsByDifficulty.${difficulty}`, findCredential, missing);
|
|
678
|
-
}
|
|
679
|
-
}
|
|
680
|
-
}
|
|
681
|
-
catch {
|
|
682
|
-
}
|
|
683
|
-
missing.push(...this.agentSkillsService
|
|
684
|
-
.getMissingSkillIds(config, agentEntity.skills ?? {})
|
|
685
|
-
.map((skillId) => `skill:${skillId}`));
|
|
686
|
-
return { missing };
|
|
687
|
-
}
|
|
688
|
-
async validateMemoryWorkerModel(modelConfig, path, findCredential, missing) {
|
|
689
|
-
if (modelConfig === undefined || modelConfig === null)
|
|
690
|
-
return;
|
|
691
|
-
if (typeof modelConfig === 'string') {
|
|
692
|
-
missing.push(`${path}.credential`);
|
|
693
|
-
return;
|
|
694
|
-
}
|
|
695
|
-
if (!modelConfig.model?.trim() || !api_types_1.AgentModelSchema.safeParse(modelConfig.model).success) {
|
|
696
|
-
missing.push(`${path}.model`);
|
|
697
|
-
}
|
|
698
|
-
const credentialId = modelConfig.credential?.trim();
|
|
699
|
-
if (!credentialId) {
|
|
700
|
-
missing.push(`${path}.credential`);
|
|
701
|
-
return;
|
|
702
|
-
}
|
|
703
|
-
const credential = await findCredential(credentialId);
|
|
704
|
-
if (!credential ||
|
|
705
|
-
!this.workerCredentialSupportsModel(credential.type, modelConfig.model ?? '')) {
|
|
706
|
-
missing.push(`${path}.credential`);
|
|
707
|
-
}
|
|
708
|
-
}
|
|
709
|
-
workerCredentialSupportsModel(credentialType, model) {
|
|
710
|
-
return llm_provider_defaults_1.LLM_PROVIDER_DEFAULTS[credentialType]?.provider === (0, model_id_1.getProviderPrefix)(model);
|
|
711
|
-
}
|
|
712
|
-
async *executeForChat(config) {
|
|
713
|
-
const { agentId, projectId, message, userId, memory } = config;
|
|
714
|
-
const runtime = await this.getRuntime({
|
|
715
|
-
agentId,
|
|
716
|
-
projectId,
|
|
717
|
-
n8nUserId: userId,
|
|
718
|
-
integrationType: api_types_1.N8N_CHAT_INTEGRATION_TYPE,
|
|
719
|
-
});
|
|
720
|
-
await this.integrationMessageContextService.setLatest(memory.threadId, memory.resourceId, {
|
|
721
|
-
integrationConnectionId: api_types_1.N8N_CHAT_INTEGRATION_TYPE,
|
|
722
|
-
platform: api_types_1.N8N_CHAT_INTEGRATION_TYPE,
|
|
723
|
-
target: { type: 'dm', userId, threadId: memory.threadId },
|
|
724
|
-
interactingUserId: userId,
|
|
725
|
-
updatedAt: new Date().toISOString(),
|
|
726
|
-
});
|
|
727
|
-
yield* this.streamChatResponse({
|
|
728
|
-
agentInstance: runtime.agent,
|
|
729
|
-
toolRegistry: runtime.toolRegistry,
|
|
730
|
-
agentId,
|
|
731
|
-
userId,
|
|
732
|
-
message,
|
|
733
|
-
memory,
|
|
734
|
-
projectId: runtime.projectId,
|
|
735
|
-
telemetry: {
|
|
736
|
-
runType: 'test',
|
|
737
|
-
configuration: runtime.telemetryConfiguration,
|
|
738
|
-
},
|
|
739
|
-
});
|
|
740
|
-
}
|
|
741
|
-
async getTestChatMessages(agentId, userId) {
|
|
742
|
-
return await this.n8nMemory
|
|
743
|
-
.getImplementation(agentId)
|
|
744
|
-
.getMessages(chatThreadId(agentId, userId), {
|
|
745
|
-
resourceId: (0, agent_memory_scope_1.draftChatMemoryResourceId)(userId),
|
|
746
|
-
});
|
|
747
|
-
}
|
|
748
|
-
async clearTestChatMessages(agentId, userId) {
|
|
749
|
-
await this.n8nMemory.getImplementation(agentId).deleteThread(chatThreadId(agentId, userId));
|
|
750
|
-
}
|
|
751
|
-
async clearAllTestChatMessages(agentId) {
|
|
752
|
-
const threadId = chatThreadId(agentId);
|
|
753
|
-
const memory = this.n8nMemory.getImplementation(agentId);
|
|
754
|
-
await memory.deleteThreadsByPrefix(threadId);
|
|
755
|
-
await memory.deleteMessagesByThread(threadId);
|
|
756
|
-
await memory.deleteThread(threadId);
|
|
757
|
-
}
|
|
758
|
-
async *executeForChatPublished(config) {
|
|
759
|
-
const { agentId, projectId, message, memory, integrationType } = config;
|
|
760
|
-
const runtime = await this.getRuntime({
|
|
761
|
-
agentId,
|
|
762
|
-
projectId,
|
|
763
|
-
integrationType,
|
|
764
|
-
usePublishedVersion: true,
|
|
765
|
-
});
|
|
766
|
-
yield* this.streamChatResponse({
|
|
767
|
-
agentInstance: runtime.agent,
|
|
768
|
-
toolRegistry: runtime.toolRegistry,
|
|
769
|
-
agentId,
|
|
770
|
-
message,
|
|
771
|
-
memory,
|
|
772
|
-
projectId: runtime.projectId,
|
|
773
|
-
source: integrationType,
|
|
774
|
-
telemetry: {
|
|
775
|
-
runType: 'production',
|
|
776
|
-
configuration: runtime.telemetryConfiguration,
|
|
777
|
-
},
|
|
778
|
-
});
|
|
779
|
-
}
|
|
780
|
-
async *executeForTaskPublished(config) {
|
|
781
|
-
const { agentId, projectId, message, memory, taskId, taskVersionId } = config;
|
|
782
|
-
const runtime = await this.getRuntime({
|
|
783
|
-
agentId,
|
|
784
|
-
projectId,
|
|
785
|
-
integrationType: 'task',
|
|
786
|
-
usePublishedVersion: true,
|
|
787
|
-
});
|
|
788
|
-
yield* this.streamChatResponse({
|
|
789
|
-
agentInstance: runtime.agent,
|
|
790
|
-
toolRegistry: runtime.toolRegistry,
|
|
791
|
-
agentId,
|
|
792
|
-
message,
|
|
793
|
-
memory,
|
|
794
|
-
projectId: runtime.projectId,
|
|
795
|
-
source: 'task',
|
|
796
|
-
taskId,
|
|
797
|
-
taskVersionId,
|
|
798
|
-
telemetry: {
|
|
799
|
-
runType: 'production',
|
|
800
|
-
configuration: runtime.telemetryConfiguration,
|
|
801
|
-
},
|
|
802
|
-
});
|
|
803
|
-
}
|
|
804
|
-
async *executeForTaskNow(config) {
|
|
805
|
-
const { agentId, projectId, userId, message, memory, taskId } = config;
|
|
806
|
-
const runtime = await this.getRuntime({ agentId, projectId, n8nUserId: userId });
|
|
807
|
-
yield* this.streamChatResponse({
|
|
808
|
-
agentInstance: runtime.agent,
|
|
809
|
-
toolRegistry: runtime.toolRegistry,
|
|
810
|
-
agentId,
|
|
811
|
-
userId,
|
|
812
|
-
message,
|
|
813
|
-
memory,
|
|
814
|
-
projectId: runtime.projectId,
|
|
815
|
-
source: 'task',
|
|
816
|
-
taskId,
|
|
817
|
-
telemetry: {
|
|
818
|
-
runType: 'test',
|
|
819
|
-
configuration: runtime.telemetryConfiguration,
|
|
820
|
-
},
|
|
821
|
-
});
|
|
822
|
-
}
|
|
823
|
-
async *streamChatResponse(config) {
|
|
824
|
-
const { agentInstance, toolRegistry, agentId, userId, message, memory, projectId, source, taskId, taskVersionId, telemetry, } = config;
|
|
825
|
-
const { threadId, resourceId } = memory;
|
|
826
|
-
const recorder = new execution_recorder_1.ExecutionRecorder(toolRegistry);
|
|
827
|
-
try {
|
|
828
|
-
const resultStream = await agentInstance.stream(message, {
|
|
829
|
-
persistence: { threadId, resourceId },
|
|
830
|
-
executionCounter: this.createAgentExecutionCounter({ agentId, userId }),
|
|
831
|
-
});
|
|
832
|
-
for await (const value of (0, agent_stream_1.streamAgentChunks)(resultStream.stream)) {
|
|
833
|
-
recorder.record(value);
|
|
834
|
-
if (value.type === 'tool-call-suspended') {
|
|
835
|
-
this.logger.info('Chat: tool-call-suspended chunk received', {
|
|
836
|
-
agentId,
|
|
837
|
-
toolCallId: value.toolCallId,
|
|
838
|
-
toolName: value.toolName,
|
|
839
|
-
});
|
|
840
|
-
}
|
|
841
|
-
if (value.type === 'finish' && value.finishReason === 'max-iterations') {
|
|
842
|
-
for (const chunk of getMaxIterationsChunks()) {
|
|
843
|
-
yield chunk;
|
|
844
|
-
}
|
|
845
|
-
}
|
|
846
|
-
yield value;
|
|
847
|
-
}
|
|
848
|
-
}
|
|
849
|
-
catch (error) {
|
|
850
|
-
recorder.record({ type: 'error', error });
|
|
851
|
-
recorder.record({ type: 'finish', finishReason: 'error' });
|
|
852
|
-
throw error;
|
|
853
|
-
}
|
|
854
|
-
finally {
|
|
855
|
-
const messageRecord = recorder.getMessageRecord();
|
|
856
|
-
void this.agentExecutionService
|
|
857
|
-
.recordMessage({
|
|
858
|
-
threadId,
|
|
859
|
-
agentId,
|
|
860
|
-
agentName: agentInstance.name,
|
|
861
|
-
projectId,
|
|
862
|
-
userMessage: message,
|
|
863
|
-
record: messageRecord,
|
|
864
|
-
hitlStatus: recorder.suspended ? 'suspended' : undefined,
|
|
865
|
-
source,
|
|
866
|
-
taskId,
|
|
867
|
-
taskVersionId,
|
|
868
|
-
telemetry,
|
|
869
|
-
})
|
|
870
|
-
.catch((error) => {
|
|
871
|
-
this.logger.warn('Failed to record agent execution', {
|
|
872
|
-
agentId,
|
|
873
|
-
threadId,
|
|
874
|
-
error: error instanceof Error ? error.message : String(error),
|
|
875
|
-
});
|
|
876
|
-
});
|
|
877
|
-
}
|
|
878
|
-
}
|
|
879
|
-
async compileIsolated(agentEntity, credentialProvider, userId, outputSchema) {
|
|
880
|
-
if (!agentEntity.schema) {
|
|
881
|
-
return { ok: false, error: 'Agent has no JSON config. Create a config first.' };
|
|
882
|
-
}
|
|
883
|
-
try {
|
|
884
|
-
const { agent: reconstructed } = await this.reconstructFromConfig(agentEntity, credentialProvider, userId);
|
|
885
|
-
if (outputSchema) {
|
|
886
|
-
reconstructed.structuredOutput(outputSchema);
|
|
887
|
-
}
|
|
888
|
-
return { ok: true, agent: reconstructed };
|
|
889
|
-
}
|
|
890
|
-
catch (e) {
|
|
891
|
-
return {
|
|
892
|
-
ok: false,
|
|
893
|
-
error: e instanceof Error ? e.message : 'Unknown compilation error',
|
|
894
|
-
};
|
|
895
|
-
}
|
|
896
|
-
}
|
|
897
|
-
getPublishedAgent(agentEntity) {
|
|
898
|
-
const activeVersionSchema = agentEntity.activeVersion?.schema;
|
|
899
|
-
if (!activeVersionSchema) {
|
|
900
|
-
throw new n8n_workflow_1.OperationalError('Agent is not published. Publish the agent before using it in a workflow.');
|
|
901
|
-
}
|
|
902
|
-
return {
|
|
903
|
-
...agentEntity,
|
|
904
|
-
schema: activeVersionSchema,
|
|
905
|
-
tools: agentEntity.activeVersion?.tools ?? agentEntity.tools ?? {},
|
|
906
|
-
skills: agentEntity.activeVersion?.skills ?? agentEntity.skills ?? {},
|
|
907
|
-
};
|
|
908
|
-
}
|
|
909
|
-
async executeForWorkflow(agentId, message, executionId, threadId, userId, projectId, telemetryUserId, useDraftVersion, outputSchema) {
|
|
910
|
-
const agentEntity = await this.agentRepository.findByIdAndProjectId(agentId, projectId);
|
|
911
|
-
if (!agentEntity) {
|
|
912
|
-
throw new n8n_workflow_1.OperationalError('Agent not found or not accessible.');
|
|
913
|
-
}
|
|
914
|
-
const credentialProvider = new agents_credential_provider_1.AgentsCredentialProvider(di_1.Container.get(credentials_service_1.CredentialsService), projectId);
|
|
915
|
-
let agentData = agentEntity;
|
|
916
|
-
if (!useDraftVersion) {
|
|
917
|
-
agentData = this.getPublishedAgent(agentEntity);
|
|
918
|
-
}
|
|
919
|
-
const telemetryConfiguration = (0, agent_telemetry_1.buildAgentConfigurationTelemetry)(agentData);
|
|
920
|
-
const compiled = await this.compileIsolated(agentData, credentialProvider, userId, outputSchema);
|
|
921
|
-
if (!compiled.ok || !compiled.agent) {
|
|
922
|
-
throw new n8n_workflow_1.OperationalError(`Failed to compile agent: ${compiled.error ?? 'unknown error'}`);
|
|
923
|
-
}
|
|
924
|
-
const agentInstance = compiled.agent;
|
|
925
|
-
const recorder = new execution_recorder_1.ExecutionRecorder();
|
|
926
|
-
let structuredOutput = null;
|
|
927
|
-
const toolCalls = [];
|
|
928
|
-
const toolInputs = new Map();
|
|
929
|
-
let streamError;
|
|
930
|
-
try {
|
|
931
|
-
const resultStream = await agentInstance.stream(message, {
|
|
932
|
-
persistence: { resourceId: executionId, threadId },
|
|
933
|
-
executionCounter: this.createAgentExecutionCounter({ agentId, userId: telemetryUserId }),
|
|
934
|
-
});
|
|
935
|
-
for await (const value of (0, agent_stream_1.streamAgentChunks)(resultStream.stream)) {
|
|
936
|
-
recorder.record(value);
|
|
937
|
-
if (value.type === 'tool-call') {
|
|
938
|
-
toolInputs.set(value.toolCallId, { toolName: value.toolName, input: value.input });
|
|
939
|
-
}
|
|
940
|
-
else if (value.type === 'tool-result') {
|
|
941
|
-
const pending = toolInputs.get(value.toolCallId);
|
|
942
|
-
toolCalls.push({
|
|
943
|
-
toolName: value.toolName,
|
|
944
|
-
input: pending?.input ?? null,
|
|
945
|
-
result: value.output,
|
|
946
|
-
});
|
|
947
|
-
toolInputs.delete(value.toolCallId);
|
|
948
|
-
}
|
|
949
|
-
else if (value.type === 'finish' && value.structuredOutput !== undefined) {
|
|
950
|
-
structuredOutput = value.structuredOutput;
|
|
951
|
-
}
|
|
952
|
-
}
|
|
953
|
-
}
|
|
954
|
-
catch (error) {
|
|
955
|
-
recorder.record({ type: 'error', error });
|
|
956
|
-
recorder.record({ type: 'finish', finishReason: 'error' });
|
|
957
|
-
streamError = error instanceof Error ? error : new Error(String(error));
|
|
958
|
-
}
|
|
959
|
-
const messageRecord = recorder.getMessageRecord();
|
|
960
|
-
void this.agentExecutionService
|
|
961
|
-
.recordMessage({
|
|
962
|
-
threadId,
|
|
963
|
-
agentId,
|
|
964
|
-
agentName: agentInstance.name,
|
|
965
|
-
projectId,
|
|
966
|
-
userMessage: message,
|
|
967
|
-
record: messageRecord,
|
|
968
|
-
source: api_types_1.AGENT_WORKFLOW_TRIGGER_TYPE,
|
|
969
|
-
telemetry: {
|
|
970
|
-
runType: useDraftVersion ? 'test' : 'production',
|
|
971
|
-
configuration: telemetryConfiguration,
|
|
972
|
-
},
|
|
973
|
-
})
|
|
974
|
-
.catch((error) => {
|
|
975
|
-
this.logger.warn('Failed to record agent execution from workflow', {
|
|
976
|
-
agentId,
|
|
977
|
-
threadId,
|
|
978
|
-
error: error instanceof Error ? error.message : String(error),
|
|
979
|
-
});
|
|
980
|
-
});
|
|
981
|
-
if (streamError !== undefined) {
|
|
982
|
-
throw streamError;
|
|
983
|
-
}
|
|
984
|
-
if (recorder.suspended) {
|
|
985
|
-
throw new n8n_workflow_1.OperationalError('Agent execution suspended waiting for tool approval. ' +
|
|
986
|
-
'Suspend/resume is not supported in workflow execution context.');
|
|
987
|
-
}
|
|
988
|
-
if (messageRecord.error) {
|
|
989
|
-
if (outputSchema) {
|
|
990
|
-
const structuredOutputError = (0, structured_output_error_1.describeStructuredOutputError)(messageRecord.error);
|
|
991
|
-
if (structuredOutputError) {
|
|
992
|
-
throw new n8n_workflow_1.OperationalError(structuredOutputError);
|
|
993
|
-
}
|
|
994
|
-
}
|
|
995
|
-
throw new n8n_workflow_1.OperationalError(`Agent execution failed: ${messageRecord.error}`);
|
|
996
|
-
}
|
|
997
|
-
if (messageRecord.finishReason === 'error') {
|
|
998
|
-
throw new n8n_workflow_1.OperationalError(outputSchema
|
|
999
|
-
? 'Agent execution finished with an error while producing structured output. ' +
|
|
1000
|
-
"The agent's model or provider may not support JSON Schema structured output."
|
|
1001
|
-
: 'Agent execution finished with an error.');
|
|
1002
|
-
}
|
|
1003
|
-
return {
|
|
1004
|
-
response: messageRecord.assistantResponse,
|
|
1005
|
-
structuredOutput: structuredOutput ?? null,
|
|
1006
|
-
usage: messageRecord.usage
|
|
1007
|
-
? {
|
|
1008
|
-
promptTokens: messageRecord.usage.promptTokens,
|
|
1009
|
-
completionTokens: messageRecord.usage.completionTokens,
|
|
1010
|
-
totalTokens: messageRecord.usage.totalTokens,
|
|
1011
|
-
}
|
|
1012
|
-
: null,
|
|
1013
|
-
toolCalls,
|
|
1014
|
-
finishReason: messageRecord.finishReason,
|
|
1015
|
-
session: {
|
|
1016
|
-
agentId,
|
|
1017
|
-
projectId,
|
|
1018
|
-
sessionId: threadId,
|
|
1019
|
-
},
|
|
1020
|
-
};
|
|
1021
|
-
}
|
|
1022
|
-
async getConfig(agentId, projectId) {
|
|
1023
|
-
const entity = await this.agentRepository.findByIdAndProjectId(agentId, projectId);
|
|
1024
|
-
if (!entity)
|
|
1025
|
-
throw new not_found_error_1.NotFoundError('Agent not found');
|
|
1026
|
-
const config = (0, agent_config_composition_1.composeJsonConfig)(entity);
|
|
1027
|
-
if (!config) {
|
|
1028
|
-
throw new n8n_workflow_1.UserError('Agent has no JSON config yet.');
|
|
1029
|
-
}
|
|
1030
|
-
return config;
|
|
1031
|
-
}
|
|
1032
|
-
async validateConfig(raw) {
|
|
1033
|
-
if (hasNodeToolInputSchema(raw)) {
|
|
1034
|
-
return { valid: false, error: 'Node tool configs must not include inputSchema.' };
|
|
1035
|
-
}
|
|
1036
|
-
const parsed = api_types_1.AgentJsonConfigSchema.safeParse((0, api_types_1.sanitizeAgentJsonConfig)(raw));
|
|
1037
|
-
if (!parsed.success) {
|
|
1038
|
-
return { valid: false, error: parsed.error.message };
|
|
1039
|
-
}
|
|
1040
|
-
const config = parsed.data;
|
|
1041
|
-
if ((0, api_types_1.isNodeToolsEnabled)(config.config) && !this.isNodeToolsModuleEnabled()) {
|
|
1042
|
-
return {
|
|
1043
|
-
valid: false,
|
|
1044
|
-
error: 'config.nodeTools.enabled requires the node-tools-searcher agents module to be enabled.',
|
|
1045
|
-
};
|
|
1046
|
-
}
|
|
1047
|
-
try {
|
|
1048
|
-
this.validateNodeToolExpressions(config);
|
|
1049
|
-
}
|
|
1050
|
-
catch (error) {
|
|
1051
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
1052
|
-
return {
|
|
1053
|
-
valid: false,
|
|
1054
|
-
error: `Invalid $fromAI expression in node tool config: ${message}`,
|
|
1055
|
-
};
|
|
1056
|
-
}
|
|
1057
|
-
const nodeError = await this.validateNodeToolConfigs(config);
|
|
1058
|
-
if (nodeError) {
|
|
1059
|
-
return { valid: false, error: nodeError };
|
|
1060
|
-
}
|
|
1061
|
-
return { valid: true, config };
|
|
1062
|
-
}
|
|
1063
|
-
validateNodeToolExpressions(config) {
|
|
1064
|
-
for (const tool of config.tools ?? []) {
|
|
1065
|
-
if (tool.type !== 'node')
|
|
1066
|
-
continue;
|
|
1067
|
-
(0, fromai_helpers_1.extractFromAIParameters)((tool.node.nodeParameters ?? {}));
|
|
1068
|
-
}
|
|
1069
|
-
}
|
|
1070
|
-
async updateConfig(agentId, projectId, config) {
|
|
1071
|
-
const entity = await this.agentRepository.findByIdAndProjectId(agentId, projectId);
|
|
1072
|
-
if (!entity)
|
|
1073
|
-
throw new not_found_error_1.NotFoundError('Agent not found');
|
|
1074
|
-
const credentialProvider = this.createCredentialProvider(projectId);
|
|
1075
|
-
const accessibleCredentialIds = new Set((await credentialProvider.list()).map((credential) => credential.id));
|
|
1076
|
-
const sanitizedConfig = (0, sanitize_unknown_agent_credentials_1.sanitizeUnknownAgentCredentials)((0, api_types_1.sanitizeAgentJsonConfig)(config), accessibleCredentialIds);
|
|
1077
|
-
const result = await this.validateConfig(sanitizedConfig);
|
|
1078
|
-
if (!result.valid) {
|
|
1079
|
-
throw new n8n_workflow_1.UserError(`Invalid agent config: ${result.error}`);
|
|
1080
|
-
}
|
|
1081
|
-
const tasksProvided = result.config.tasks !== undefined;
|
|
1082
|
-
const existingTaskIds = tasksProvided
|
|
1083
|
-
? (await this.agentTaskRepository.findByAgentId(agentId)).map((task) => task.id)
|
|
1084
|
-
: [];
|
|
1085
|
-
const resolvedSubAgents = await this.removeMissingConfigRefs(result.config, entity, new Set(existingTaskIds));
|
|
1086
|
-
this.validateSubAgentRefs(resolvedSubAgents, entity);
|
|
1087
|
-
const previousIntegrations = entity.integrations ?? [];
|
|
1088
|
-
const previousSchema = entity.schema ?? null;
|
|
1089
|
-
const integrationsProvided = result.config.integrations !== undefined;
|
|
1090
|
-
const toolsProvided = result.config.tools !== undefined;
|
|
1091
|
-
const skillsProvided = result.config.skills !== undefined;
|
|
1092
|
-
const descriptionProvided = result.config.description !== undefined;
|
|
1093
|
-
const credentialProvided = result.config.credential !== undefined;
|
|
1094
|
-
const memoryProvided = result.config.memory !== undefined;
|
|
1095
|
-
const subAgentsProvided = result.config.subAgents !== undefined;
|
|
1096
|
-
const providerToolsProvided = result.config.providerTools !== undefined;
|
|
1097
|
-
const configBlockProvided = result.config.config !== undefined;
|
|
1098
|
-
const mcpServersProvided = result.config.mcpServers !== undefined;
|
|
1099
|
-
const { schemaConfig: decomposedSchema, integrations: decomposedIntegrations } = (0, agent_config_composition_1.decomposeJsonConfig)(result.config);
|
|
1100
|
-
const nextIntegrations = integrationsProvided ? decomposedIntegrations : previousIntegrations;
|
|
1101
|
-
const nextSchema = {
|
|
1102
|
-
...(previousSchema ?? {}),
|
|
1103
|
-
name: decomposedSchema.name,
|
|
1104
|
-
model: decomposedSchema.model,
|
|
1105
|
-
instructions: decomposedSchema.instructions,
|
|
1106
|
-
...(descriptionProvided ? { description: decomposedSchema.description } : {}),
|
|
1107
|
-
...(credentialProvided ? { credential: decomposedSchema.credential } : {}),
|
|
1108
|
-
...(memoryProvided ? { memory: decomposedSchema.memory } : {}),
|
|
1109
|
-
...(subAgentsProvided ? { subAgents: decomposedSchema.subAgents } : {}),
|
|
1110
|
-
...(toolsProvided ? { tools: decomposedSchema.tools } : {}),
|
|
1111
|
-
...(skillsProvided ? { skills: decomposedSchema.skills } : {}),
|
|
1112
|
-
...(tasksProvided ? { tasks: decomposedSchema.tasks } : {}),
|
|
1113
|
-
...(providerToolsProvided ? { providerTools: decomposedSchema.providerTools } : {}),
|
|
1114
|
-
...(configBlockProvided ? { config: decomposedSchema.config } : {}),
|
|
1115
|
-
...(mcpServersProvided ? { mcpServers: decomposedSchema.mcpServers } : {}),
|
|
1116
|
-
};
|
|
1117
|
-
entity.schema = nextSchema;
|
|
1118
|
-
entity.name = result.config.name;
|
|
1119
|
-
if (descriptionProvided)
|
|
1120
|
-
entity.description = result.config.description ?? null;
|
|
1121
|
-
entity.integrations = nextIntegrations;
|
|
1122
|
-
(0, agent_draft_utils_1.markAgentDraftDirty)(entity);
|
|
1123
|
-
if (toolsProvided) {
|
|
1124
|
-
const referencedIds = new Set((result.config.tools ?? [])
|
|
1125
|
-
.filter((t) => t.type === 'custom')
|
|
1126
|
-
.map((t) => t.id));
|
|
1127
|
-
const orphanIds = Object.keys(entity.tools).filter((id) => !referencedIds.has(id));
|
|
1128
|
-
if (orphanIds.length > 0) {
|
|
1129
|
-
const tools = { ...entity.tools };
|
|
1130
|
-
for (const id of orphanIds) {
|
|
1131
|
-
delete tools[id];
|
|
1132
|
-
}
|
|
1133
|
-
entity.tools = tools;
|
|
1134
|
-
}
|
|
1135
|
-
}
|
|
1136
|
-
if (skillsProvided) {
|
|
1137
|
-
this.agentSkillsService.removeUnreferencedSkills(entity, result.config);
|
|
1138
|
-
}
|
|
1139
|
-
this.clearRuntimes(agentId);
|
|
1140
|
-
const saved = await this.agentRepository.save(entity);
|
|
1141
|
-
this.logger.debug('Updated agent JSON config', { agentId, projectId });
|
|
1142
|
-
if (tasksProvided) {
|
|
1143
|
-
const referencedTaskIds = new Set((result.config.tasks ?? []).map((ref) => ref.id));
|
|
1144
|
-
const orphanTaskIds = existingTaskIds.filter((id) => !referencedTaskIds.has(id));
|
|
1145
|
-
if (orphanTaskIds.length > 0) {
|
|
1146
|
-
await this.agentTaskRepository.delete(orphanTaskIds);
|
|
1147
|
-
}
|
|
1148
|
-
}
|
|
1149
|
-
if (integrationsProvided) {
|
|
1150
|
-
await (0, integrations_sync_1.syncAgentIntegrations)(saved, previousIntegrations, nextIntegrations, this.logger);
|
|
1151
|
-
}
|
|
1152
|
-
return {
|
|
1153
|
-
config: (0, agent_config_composition_1.composeJsonConfig)(saved) ?? result.config,
|
|
1154
|
-
updatedAt: saved.updatedAt.toISOString(),
|
|
1155
|
-
versionId: saved.versionId,
|
|
1156
|
-
};
|
|
1157
|
-
}
|
|
1158
|
-
async saveCredentialIntegration(agent, integration, options = {}) {
|
|
1159
|
-
const parseResult = api_types_1.AgentIntegrationSchema.safeParse(integration);
|
|
1160
|
-
if (!parseResult.success) {
|
|
1161
|
-
throw new n8n_workflow_1.UserError(`Invalid credential integration: ${parseResult.error.message}`);
|
|
1162
|
-
}
|
|
1163
|
-
const validated = parseResult.data;
|
|
1164
|
-
const { type, credentialId } = validated;
|
|
1165
|
-
if (credentialId === '') {
|
|
1166
|
-
throw new n8n_workflow_1.UserError('Credential integration requires a credential ID.');
|
|
1167
|
-
}
|
|
1168
|
-
const existing = agent.integrations ?? [];
|
|
1169
|
-
const alreadyExists = existing.some((i) => i.type === type && i.credentialId === credentialId);
|
|
1170
|
-
agent.integrations = alreadyExists
|
|
1171
|
-
? existing.map((existingIntegration) => existingIntegration.type === type && existingIntegration.credentialId === credentialId
|
|
1172
|
-
? validated
|
|
1173
|
-
: existingIntegration)
|
|
1174
|
-
: [...existing, validated];
|
|
1175
|
-
(0, agent_draft_utils_1.markAgentDraftDirty)(agent);
|
|
1176
|
-
this.clearRuntimes(agent.id);
|
|
1177
|
-
const result = await this.agentRepository.save(agent);
|
|
1178
|
-
if (options.broadcast !== false) {
|
|
1179
|
-
await this.chatIntegrationService.broadcastIntegrationChange(agent.id, integration, 'connect');
|
|
1180
|
-
}
|
|
1181
|
-
return result;
|
|
1182
|
-
}
|
|
1183
|
-
async removeCredentialIntegration(agent, type, credentialId) {
|
|
1184
|
-
if (!agent.integrations?.length)
|
|
1185
|
-
return agent;
|
|
1186
|
-
const integration = agent.integrations.find((i) => i.type === type && i.credentialId === credentialId);
|
|
1187
|
-
if (!integration)
|
|
1188
|
-
return agent;
|
|
1189
|
-
agent.integrations = agent.integrations.filter((i) => i !== integration);
|
|
1190
|
-
(0, agent_draft_utils_1.markAgentDraftDirty)(agent);
|
|
1191
|
-
this.clearRuntimes(agent.id);
|
|
1192
|
-
const result = await this.agentRepository.save(agent);
|
|
1193
|
-
await this.chatIntegrationService.broadcastIntegrationChange(agent.id, integration, 'disconnect');
|
|
1194
|
-
return result;
|
|
1195
|
-
}
|
|
1196
|
-
async buildCustomTool(agentId, projectId, code, descriptor) {
|
|
1197
|
-
const entity = await this.agentRepository.findByIdAndProjectId(agentId, projectId);
|
|
1198
|
-
if (!entity)
|
|
1199
|
-
throw new not_found_error_1.NotFoundError('Agent not found');
|
|
1200
|
-
const toolId = (0, agent_resource_id_1.generateAgentResourceId)('tool', Object.keys(entity.tools ?? {}));
|
|
1201
|
-
entity.tools = {
|
|
1202
|
-
...entity.tools,
|
|
1203
|
-
[toolId]: { code, descriptor },
|
|
1204
|
-
};
|
|
1205
|
-
(0, agent_draft_utils_1.markAgentDraftDirty)(entity);
|
|
1206
|
-
this.clearRuntimes(agentId);
|
|
1207
|
-
await this.agentRepository.save(entity);
|
|
1208
|
-
this.logger.debug('Built custom tool', { agentId, projectId, toolId });
|
|
1209
|
-
return { ok: true, id: toolId, descriptor };
|
|
1210
|
-
}
|
|
1211
|
-
async listSkills(agentId, projectId) {
|
|
1212
|
-
return await this.agentSkillsService.listSkills(agentId, projectId);
|
|
1213
|
-
}
|
|
1214
|
-
async getSkill(agentId, projectId, skillId) {
|
|
1215
|
-
return await this.agentSkillsService.getSkill(agentId, projectId, skillId);
|
|
1216
|
-
}
|
|
1217
|
-
async createSkill(agentId, projectId, skill) {
|
|
1218
|
-
const result = await this.agentSkillsService.createSkill(agentId, projectId, skill);
|
|
1219
|
-
this.clearRuntimes(agentId);
|
|
1220
|
-
return result;
|
|
1221
|
-
}
|
|
1222
|
-
async createAndAttachSkill(agentId, projectId, skill) {
|
|
1223
|
-
const result = await this.agentSkillsService.createAndAttachSkill(agentId, projectId, skill);
|
|
1224
|
-
this.clearRuntimes(agentId);
|
|
1225
|
-
return result;
|
|
1226
|
-
}
|
|
1227
|
-
async updateSkill(agentId, projectId, skillId, updates) {
|
|
1228
|
-
const result = await this.agentSkillsService.updateSkill(agentId, projectId, skillId, updates);
|
|
1229
|
-
this.clearRuntimes(agentId);
|
|
1230
|
-
return result;
|
|
1231
|
-
}
|
|
1232
|
-
async deleteCustomTool(agentId, projectId, toolId) {
|
|
1233
|
-
const entity = await this.agentRepository.findByIdAndProjectId(agentId, projectId);
|
|
1234
|
-
if (!entity)
|
|
1235
|
-
throw new not_found_error_1.NotFoundError('Agent not found');
|
|
1236
|
-
const tools = { ...entity.tools };
|
|
1237
|
-
delete tools[toolId];
|
|
1238
|
-
entity.tools = tools;
|
|
1239
|
-
if (entity.schema?.tools) {
|
|
1240
|
-
entity.schema.tools = entity.schema.tools.filter((t) => !(t.type === 'custom' && 'id' in t && t.id === toolId));
|
|
1241
|
-
}
|
|
1242
|
-
(0, agent_draft_utils_1.markAgentDraftDirty)(entity);
|
|
1243
|
-
this.clearRuntimes(agentId);
|
|
1244
|
-
await this.agentRepository.save(entity);
|
|
1245
|
-
this.logger.debug('Deleted custom tool', { agentId, projectId, toolId });
|
|
1246
|
-
}
|
|
1247
|
-
async deleteSkill(agentId, projectId, skillId) {
|
|
1248
|
-
await this.agentSkillsService.deleteSkill(agentId, projectId, skillId);
|
|
1249
|
-
this.clearRuntimes(agentId);
|
|
1250
|
-
}
|
|
1251
|
-
async validateNodeToolConfigs(config) {
|
|
1252
|
-
const nodeTools = (config.tools ?? []).filter((t) => t.type === 'node');
|
|
1253
|
-
if (nodeTools.length === 0)
|
|
1254
|
-
return null;
|
|
1255
|
-
const { setSchemaBaseDirs, validateNodeConfig } = await Promise.resolve().then(() => __importStar(require('@n8n/workflow-sdk')));
|
|
1256
|
-
const dirs = (0, node_definition_resolver_1.resolveBuiltinNodeDefinitionDirs)();
|
|
1257
|
-
if (dirs.length > 0) {
|
|
1258
|
-
setSchemaBaseDirs(dirs);
|
|
1259
|
-
}
|
|
1260
|
-
const errors = [];
|
|
1261
|
-
for (const tool of nodeTools) {
|
|
1262
|
-
const nodeType = tool.node.nodeType;
|
|
1263
|
-
const nodeTypeVersion = tool.node.nodeTypeVersion;
|
|
1264
|
-
const nodeParameters = tool.node.nodeParameters ?? {};
|
|
1265
|
-
const result = validateNodeConfig(nodeType, nodeTypeVersion, { parameters: nodeParameters }, { isToolNode: true });
|
|
1266
|
-
if (!result.valid) {
|
|
1267
|
-
const messages = result.errors
|
|
1268
|
-
.map((e) => e.message)
|
|
1269
|
-
.join('; ');
|
|
1270
|
-
errors.push(`Node tool "${tool.name}" (${nodeType}@${nodeTypeVersion}): ${messages}`);
|
|
1271
|
-
}
|
|
1272
|
-
}
|
|
1273
|
-
return errors.length > 0 ? errors.join('\n') : null;
|
|
1274
|
-
}
|
|
1275
|
-
async removeMissingConfigRefs(config, entity, existingTaskIds) {
|
|
1276
|
-
if (config.skills !== undefined) {
|
|
1277
|
-
const skills = entity.skills ?? {};
|
|
1278
|
-
config.skills = config.skills.filter((ref) => Boolean(skills[ref.id]));
|
|
1279
|
-
}
|
|
1280
|
-
if (config.tools !== undefined) {
|
|
1281
|
-
const tools = entity.tools ?? {};
|
|
1282
|
-
config.tools = config.tools.filter((ref) => ref.type !== 'custom' || Boolean(tools[ref.id]));
|
|
1283
|
-
}
|
|
1284
|
-
if (config.tasks !== undefined) {
|
|
1285
|
-
config.tasks = config.tasks.filter((ref) => existingTaskIds.has(ref.id));
|
|
1286
|
-
}
|
|
1287
|
-
if (config.subAgents?.agents !== undefined) {
|
|
1288
|
-
const resolvedSubAgents = await this.fetchUniqueSubAgents(config.subAgents.agents, entity.projectId);
|
|
1289
|
-
const existingSubAgentIds = new Set(resolvedSubAgents.filter(({ agent }) => agent !== null).map(({ agentId }) => agentId));
|
|
1290
|
-
config.subAgents.agents = config.subAgents.agents.filter(({ agentId }) => existingSubAgentIds.has(agentId));
|
|
1291
|
-
return resolvedSubAgents;
|
|
1292
|
-
}
|
|
1293
|
-
return [];
|
|
1294
|
-
}
|
|
1295
|
-
async fetchUniqueSubAgents(refs, projectId) {
|
|
1296
|
-
const seen = new Set();
|
|
1297
|
-
const resolved = [];
|
|
1298
|
-
for (const { agentId } of refs) {
|
|
1299
|
-
if (seen.has(agentId))
|
|
1300
|
-
continue;
|
|
1301
|
-
seen.add(agentId);
|
|
1302
|
-
resolved.push({
|
|
1303
|
-
agentId,
|
|
1304
|
-
agent: await this.agentRepository.findByIdAndProjectId(agentId, projectId),
|
|
1305
|
-
});
|
|
1306
|
-
}
|
|
1307
|
-
return resolved;
|
|
1308
|
-
}
|
|
1309
|
-
validateSubAgentRefs(resolvedSubAgents, entity) {
|
|
1310
|
-
for (const { agentId, agent } of resolvedSubAgents) {
|
|
1311
|
-
if (!agent)
|
|
1312
|
-
continue;
|
|
1313
|
-
if (agentId === entity.id) {
|
|
1314
|
-
throw new n8n_workflow_1.UserError('Invalid agent config: An agent cannot use itself as a subagent');
|
|
1315
|
-
}
|
|
1316
|
-
if (!agent.activeVersionId) {
|
|
1317
|
-
throw new n8n_workflow_1.UserError(`Invalid agent config: Subagent "${agentId}" must be published`);
|
|
1318
|
-
}
|
|
1319
|
-
}
|
|
1320
|
-
}
|
|
1321
|
-
getMissingCustomToolIds(config, tools) {
|
|
1322
|
-
const refs = (config?.tools ?? []).filter((ref) => ref.type === 'custom');
|
|
1323
|
-
const seen = new Set();
|
|
1324
|
-
const missing = [];
|
|
1325
|
-
for (const ref of refs) {
|
|
1326
|
-
if (seen.has(ref.id))
|
|
1327
|
-
continue;
|
|
1328
|
-
seen.add(ref.id);
|
|
1329
|
-
if (!tools[ref.id])
|
|
1330
|
-
missing.push(ref.id);
|
|
1331
|
-
}
|
|
1332
|
-
return missing;
|
|
1333
|
-
}
|
|
1334
|
-
snapshotConfiguredTools(config, tools) {
|
|
1335
|
-
if (!config)
|
|
1336
|
-
return null;
|
|
1337
|
-
const missing = this.getMissingCustomToolIds(config, tools);
|
|
1338
|
-
if (missing.length > 0) {
|
|
1339
|
-
throw new n8n_workflow_1.UserError(`Cannot publish agent with missing custom tools: ${missing.join(', ')}`);
|
|
1340
|
-
}
|
|
1341
|
-
const snapshot = {};
|
|
1342
|
-
for (const ref of config.tools ?? []) {
|
|
1343
|
-
if (ref.type !== 'custom')
|
|
1344
|
-
continue;
|
|
1345
|
-
const tool = tools[ref.id];
|
|
1346
|
-
if (tool)
|
|
1347
|
-
snapshot[ref.id] = tool;
|
|
1348
|
-
}
|
|
1349
|
-
return snapshot;
|
|
1350
|
-
}
|
|
1351
|
-
async snapshotConfiguredTasks(trx, versionId, agentId, config) {
|
|
1352
|
-
if (!config)
|
|
1353
|
-
return;
|
|
1354
|
-
const refs = config.tasks ?? [];
|
|
1355
|
-
if (refs.length === 0)
|
|
1356
|
-
return;
|
|
1357
|
-
const bodies = await trx.getRepository(agent_task_entity_1.AgentTask).findBy({ agentId });
|
|
1358
|
-
const byId = new Map(bodies.map((body) => [body.id, body]));
|
|
1359
|
-
const missing = refs.filter((ref) => !byId.has(ref.id)).map((ref) => ref.id);
|
|
1360
|
-
if (missing.length > 0) {
|
|
1361
|
-
throw new n8n_workflow_1.UserError(`Cannot publish agent with missing task bodies: ${missing.join(', ')}`);
|
|
1362
|
-
}
|
|
1363
|
-
await this.agentTaskSnapshotRepository.saveForVersion(refs.map((ref) => {
|
|
1364
|
-
const body = byId.get(ref.id);
|
|
1365
|
-
if (!body) {
|
|
1366
|
-
throw new n8n_workflow_1.UserError(`Cannot publish agent with missing task body: ${ref.id}`);
|
|
1367
|
-
}
|
|
1368
|
-
return {
|
|
1369
|
-
versionId,
|
|
1370
|
-
taskId: ref.id,
|
|
1371
|
-
enabled: ref.enabled,
|
|
1372
|
-
name: body.name,
|
|
1373
|
-
objective: body.objective,
|
|
1374
|
-
cronExpression: body.cronExpression,
|
|
1375
|
-
};
|
|
1376
|
-
}), trx);
|
|
1377
|
-
}
|
|
1378
|
-
async restoreTasksFromSnapshot(trx, agentId, versionId) {
|
|
1379
|
-
const repo = trx.getRepository(agent_task_entity_1.AgentTask);
|
|
1380
|
-
const existing = await repo.findBy({ agentId });
|
|
1381
|
-
const snapshots = await this.agentTaskSnapshotRepository.findByVersionId(versionId, trx);
|
|
1382
|
-
const snapshotIds = new Set(snapshots.map((snapshot) => snapshot.taskId));
|
|
1383
|
-
const orphanIds = existing.filter((row) => !snapshotIds.has(row.id)).map((row) => row.id);
|
|
1384
|
-
if (orphanIds.length > 0)
|
|
1385
|
-
await repo.delete(orphanIds);
|
|
1386
|
-
const existingIds = new Set(existing.map((row) => row.id));
|
|
1387
|
-
for (const snapshot of snapshots) {
|
|
1388
|
-
if (existingIds.has(snapshot.taskId)) {
|
|
1389
|
-
await repo.update(snapshot.taskId, {
|
|
1390
|
-
name: snapshot.name,
|
|
1391
|
-
objective: snapshot.objective,
|
|
1392
|
-
cronExpression: snapshot.cronExpression,
|
|
1393
|
-
});
|
|
1394
|
-
}
|
|
1395
|
-
else {
|
|
1396
|
-
await repo.insert({
|
|
1397
|
-
id: snapshot.taskId,
|
|
1398
|
-
agentId,
|
|
1399
|
-
name: snapshot.name,
|
|
1400
|
-
objective: snapshot.objective,
|
|
1401
|
-
cronExpression: snapshot.cronExpression,
|
|
1402
|
-
});
|
|
1403
|
-
}
|
|
1404
|
-
}
|
|
1405
|
-
}
|
|
1406
|
-
async reconstructFromConfig(agentEntity, credentialProvider, userId, integrationType) {
|
|
1407
|
-
return await this.agentRuntimeReconstructionService.reconstructFromAgentEntity(agentEntity, credentialProvider, userId, integrationType);
|
|
1408
|
-
}
|
|
1409
155
|
};
|
|
1410
156
|
exports.AgentsService = AgentsService;
|
|
1411
|
-
__decorate([
|
|
1412
|
-
(0, decorators_1.OnPubSubEvent)('agent-config-changed', { instanceType: 'main' }),
|
|
1413
|
-
__metadata("design:type", Function),
|
|
1414
|
-
__metadata("design:paramtypes", [Object]),
|
|
1415
|
-
__metadata("design:returntype", void 0)
|
|
1416
|
-
], AgentsService.prototype, "handleAgentConfigChanged", null);
|
|
1417
157
|
exports.AgentsService = AgentsService = __decorate([
|
|
1418
158
|
(0, di_1.Service)(),
|
|
1419
159
|
__metadata("design:paramtypes", [backend_common_1.Logger,
|
|
1420
160
|
agent_repository_1.AgentRepository,
|
|
1421
161
|
db_1.ProjectRelationRepository,
|
|
1422
|
-
n8n_checkpoint_storage_1.N8NCheckpointStorage,
|
|
1423
|
-
n8n_memory_1.N8nMemory,
|
|
1424
|
-
agent_execution_service_1.AgentExecutionService,
|
|
1425
|
-
agent_history_repository_1.AgentHistoryRepository,
|
|
1426
|
-
agent_skills_service_1.AgentSkillsService,
|
|
1427
|
-
agent_task_repository_1.AgentTaskRepository,
|
|
1428
|
-
agent_task_snapshot_repository_1.AgentTaskSnapshotRepository,
|
|
1429
|
-
publisher_service_1.Publisher,
|
|
1430
|
-
config_1.AgentsConfig,
|
|
1431
|
-
config_1.GlobalConfig,
|
|
1432
|
-
telemetry_1.Telemetry,
|
|
1433
|
-
chat_integration_service_1.ChatIntegrationService,
|
|
1434
162
|
agent_knowledge_service_1.AgentKnowledgeService,
|
|
1435
|
-
|
|
1436
|
-
|
|
163
|
+
agent_runtime_cache_service_1.AgentRuntimeCacheService,
|
|
164
|
+
agent_test_chat_service_1.AgentTestChatService])
|
|
1437
165
|
], AgentsService);
|
|
1438
|
-
function hasNodeToolInputSchema(raw) {
|
|
1439
|
-
if (!(0, utils_1.isRecord)(raw) || !Array.isArray(raw.tools))
|
|
1440
|
-
return false;
|
|
1441
|
-
return raw.tools.some((tool) => (0, utils_1.isRecord)(tool) && tool.type === 'node' && 'inputSchema' in tool);
|
|
1442
|
-
}
|
|
1443
166
|
//# sourceMappingURL=agents.service.js.map
|