n8n 2.23.2 → 2.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/active-workflow-manager.d.ts +8 -4
- package/dist/active-workflow-manager.js +26 -9
- package/dist/active-workflow-manager.js.map +1 -1
- package/dist/auth/auth.service.d.ts +1 -1
- package/dist/auth/auth.service.js +2 -1
- package/dist/auth/auth.service.js.map +1 -1
- package/dist/build.tsbuildinfo +1 -1
- package/dist/controllers/ai.controller.js +1 -1
- package/dist/controllers/ai.controller.js.map +1 -1
- package/dist/controllers/api-keys.controller.d.ts +20 -15
- package/dist/controllers/api-keys.controller.js +7 -4
- package/dist/controllers/api-keys.controller.js.map +1 -1
- package/dist/controllers/oauth/oauth1-credential.controller.d.ts +4 -2
- package/dist/controllers/oauth/oauth1-credential.controller.js +15 -5
- package/dist/controllers/oauth/oauth1-credential.controller.js.map +1 -1
- package/dist/controllers/oauth/oauth2-credential.controller.d.ts +4 -2
- package/dist/controllers/oauth/oauth2-credential.controller.js +15 -6
- package/dist/controllers/oauth/oauth2-credential.controller.js.map +1 -1
- package/dist/controllers/project.controller.d.ts +8 -0
- package/dist/controllers/project.controller.js +2 -1
- package/dist/controllers/project.controller.js.map +1 -1
- package/dist/controllers/security-settings.controller.js +18 -1
- package/dist/controllers/security-settings.controller.js.map +1 -1
- package/dist/controllers/telemetry.controller.js +4 -1
- package/dist/controllers/telemetry.controller.js.map +1 -1
- package/dist/credentials/credential-connection-status-provider.interface.d.ts +3 -0
- package/dist/credentials/credential-connection-status-proxy.d.ts +3 -0
- package/dist/credentials/credential-connection-status-proxy.js +10 -0
- package/dist/credentials/credential-connection-status-proxy.js.map +1 -1
- package/dist/credentials/credentials.controller.d.ts +6 -0
- package/dist/credentials/credentials.controller.js +39 -2
- package/dist/credentials/credentials.controller.js.map +1 -1
- package/dist/credentials/credentials.service.d.ts +29 -13
- package/dist/credentials/credentials.service.ee.d.ts +2 -0
- package/dist/credentials/credentials.service.ee.js +3 -0
- package/dist/credentials/credentials.service.ee.js.map +1 -1
- package/dist/credentials/credentials.service.js +27 -6
- package/dist/credentials/credentials.service.js.map +1 -1
- package/dist/credentials-helper.d.ts +1 -0
- package/dist/credentials-helper.js +14 -4
- package/dist/credentials-helper.js.map +1 -1
- package/dist/errors/credential-missing-id.error.d.ts +4 -0
- package/dist/errors/credential-missing-id.error.js +14 -0
- package/dist/errors/credential-missing-id.error.js.map +1 -0
- package/dist/eventbus/event-message-classes/index.d.ts +2 -2
- package/dist/eventbus/event-message-classes/index.js +3 -0
- package/dist/eventbus/event-message-classes/index.js.map +1 -1
- package/dist/events/maps/relay.event-map.d.ts +54 -2
- package/dist/events/relays/log-streaming.event-relay.d.ts +3 -0
- package/dist/events/relays/log-streaming.event-relay.js +39 -1
- package/dist/events/relays/log-streaming.event-relay.js.map +1 -1
- package/dist/events/relays/telemetry.event-relay.d.ts +6 -0
- package/dist/events/relays/telemetry.event-relay.js +74 -3
- package/dist/events/relays/telemetry.event-relay.js.map +1 -1
- package/dist/execution-lifecycle/execution-lifecycle-hooks.js +6 -5
- package/dist/execution-lifecycle/execution-lifecycle-hooks.js.map +1 -1
- package/dist/executions/execution-persistence.js +4 -0
- package/dist/executions/execution-persistence.js.map +1 -1
- package/dist/expression-observability/expression-observability.provider.d.ts +3 -1
- package/dist/expression-observability/expression-observability.provider.js +48 -46
- package/dist/expression-observability/expression-observability.provider.js.map +1 -1
- package/dist/interfaces.d.ts +3 -1
- package/dist/modules/agents/agent-execution.service.d.ts +4 -2
- package/dist/modules/agents/agent-execution.service.js +3 -3
- package/dist/modules/agents/agent-execution.service.js.map +1 -1
- package/dist/modules/agents/agent-knowledge-command.service.d.ts +40 -0
- package/dist/modules/agents/agent-knowledge-command.service.js +221 -0
- package/dist/modules/agents/agent-knowledge-command.service.js.map +1 -0
- package/dist/modules/agents/agent-knowledge.service.d.ts +42 -0
- package/dist/modules/agents/agent-knowledge.service.js +300 -0
- package/dist/modules/agents/agent-knowledge.service.js.map +1 -0
- package/dist/modules/agents/agent-task.service.d.ts +52 -0
- package/dist/modules/agents/agent-task.service.js +487 -0
- package/dist/modules/agents/agent-task.service.js.map +1 -0
- package/dist/modules/agents/agent-upload.middleware.d.ts +7 -0
- package/dist/modules/agents/agent-upload.middleware.js +62 -0
- package/dist/modules/agents/agent-upload.middleware.js.map +1 -0
- package/dist/modules/agents/agents-tools.service.d.ts +1 -1
- package/dist/modules/agents/agents-tools.service.js +12 -3
- package/dist/modules/agents/agents-tools.service.js.map +1 -1
- package/dist/modules/agents/agents.controller.d.ts +138 -45
- package/dist/modules/agents/agents.controller.js +176 -48
- 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 +13 -5
- package/dist/modules/agents/agents.module.js.map +1 -1
- package/dist/modules/agents/agents.service.d.ts +43 -7
- package/dist/modules/agents/agents.service.js +341 -57
- package/dist/modules/agents/agents.service.js.map +1 -1
- package/dist/modules/agents/builder/agents-builder-prompts.d.ts +6 -5
- package/dist/modules/agents/builder/agents-builder-prompts.js +92 -18
- 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 +164 -26
- package/dist/modules/agents/builder/agents-builder-tools.service.js.map +1 -1
- package/dist/modules/agents/builder/agents-builder.service.d.ts +3 -1
- package/dist/modules/agents/builder/agents-builder.service.js +8 -3
- package/dist/modules/agents/builder/agents-builder.service.js.map +1 -1
- package/dist/modules/agents/builder/builder-tool-names.d.ts +3 -0
- package/dist/modules/agents/builder/builder-tool-names.js +3 -0
- package/dist/modules/agents/builder/builder-tool-names.js.map +1 -1
- package/dist/modules/agents/builder/interactive/ask-credential.tool.d.ts +1 -0
- package/dist/modules/agents/builder/interactive/ask-credential.tool.js +25 -4
- package/dist/modules/agents/builder/interactive/ask-credential.tool.js.map +1 -1
- package/dist/modules/agents/builder/interactive/ask-question.tool.js +6 -5
- package/dist/modules/agents/builder/interactive/ask-question.tool.js.map +1 -1
- package/dist/modules/agents/builder/prompts/config-mutation.prompt.js +20 -5
- package/dist/modules/agents/builder/prompts/config-mutation.prompt.js.map +1 -1
- package/dist/modules/agents/builder/prompts/config-rules.prompt.js +23 -4
- package/dist/modules/agents/builder/prompts/config-rules.prompt.js.map +1 -1
- package/dist/modules/agents/builder/prompts/llm-selection.prompt.js +18 -1
- package/dist/modules/agents/builder/prompts/llm-selection.prompt.js.map +1 -1
- package/dist/modules/agents/builder/prompts/memory.prompt.d.ts +1 -1
- package/dist/modules/agents/builder/prompts/memory.prompt.js +5 -3
- package/dist/modules/agents/builder/prompts/memory.prompt.js.map +1 -1
- package/dist/modules/agents/builder/prompts/tools.prompt.d.ts +1 -1
- package/dist/modules/agents/builder/prompts/tools.prompt.js +11 -2
- package/dist/modules/agents/builder/prompts/tools.prompt.js.map +1 -1
- package/dist/modules/agents/builder/search-mcp-servers.tool.d.ts +6 -0
- package/dist/modules/agents/builder/search-mcp-servers.tool.js +85 -0
- package/dist/modules/agents/builder/search-mcp-servers.tool.js.map +1 -0
- package/dist/modules/agents/builder/skill-body-template.d.ts +4 -0
- package/dist/modules/agents/builder/skill-body-template.js +31 -0
- package/dist/modules/agents/builder/skill-body-template.js.map +1 -0
- package/dist/modules/agents/builder/skills/index.js +6 -1
- package/dist/modules/agents/builder/skills/index.js.map +1 -1
- package/dist/modules/agents/builder/skills/integrations.skill.js +39 -18
- package/dist/modules/agents/builder/skills/integrations.skill.js.map +1 -1
- package/dist/modules/agents/builder/skills/mcp.skill.d.ts +2 -0
- package/dist/modules/agents/builder/skills/mcp.skill.js +110 -0
- package/dist/modules/agents/builder/skills/mcp.skill.js.map +1 -0
- package/dist/modules/agents/builder/skills/research.skill.js +8 -5
- package/dist/modules/agents/builder/skills/research.skill.js.map +1 -1
- package/dist/modules/agents/builder/skills/target-skills.skill.js +41 -13
- package/dist/modules/agents/builder/skills/target-skills.skill.js.map +1 -1
- package/dist/modules/agents/builder/skills/target-tasks.skill.d.ts +2 -0
- package/dist/modules/agents/builder/skills/target-tasks.skill.js +82 -0
- package/dist/modules/agents/builder/skills/target-tasks.skill.js.map +1 -0
- package/dist/modules/agents/builder/task-objective-template.d.ts +3 -0
- package/dist/modules/agents/builder/task-objective-template.js +27 -0
- package/dist/modules/agents/builder/task-objective-template.js.map +1 -0
- package/dist/modules/agents/builder/verify-mcp-server.tool.d.ts +8 -0
- package/dist/modules/agents/builder/verify-mcp-server.tool.js +79 -0
- package/dist/modules/agents/builder/verify-mcp-server.tool.js.map +1 -0
- package/dist/modules/agents/entities/agent-execution-thread.entity.d.ts +4 -0
- package/dist/modules/agents/entities/agent-execution-thread.entity.js +26 -0
- package/dist/modules/agents/entities/agent-execution-thread.entity.js.map +1 -1
- package/dist/modules/agents/entities/agent-file.entity.d.ts +11 -0
- package/dist/modules/agents/entities/agent-file.entity.js +48 -0
- package/dist/modules/agents/entities/agent-file.entity.js.map +1 -0
- package/dist/modules/agents/entities/agent-task-run-lock.entity.d.ts +10 -0
- package/dist/modules/agents/entities/agent-task-run-lock.entity.js +54 -0
- package/dist/modules/agents/entities/agent-task-run-lock.entity.js.map +1 -0
- package/dist/modules/agents/entities/agent-task-snapshot.entity.d.ts +12 -0
- package/dist/modules/agents/entities/agent-task-snapshot.entity.js +70 -0
- package/dist/modules/agents/entities/agent-task-snapshot.entity.js.map +1 -0
- package/dist/modules/agents/entities/agent-task.entity.d.ts +11 -0
- package/dist/modules/agents/entities/agent-task.entity.js +64 -0
- package/dist/modules/agents/entities/agent-task.entity.js.map +1 -0
- package/dist/modules/agents/execution-recorder.d.ts +1 -0
- package/dist/modules/agents/execution-recorder.js +9 -5
- package/dist/modules/agents/execution-recorder.js.map +1 -1
- package/dist/modules/agents/integrations/agent-chat-bridge.d.ts +16 -4
- package/dist/modules/agents/integrations/agent-chat-bridge.js +372 -116
- package/dist/modules/agents/integrations/agent-chat-bridge.js.map +1 -1
- package/dist/modules/agents/integrations/agent-chat-integration.d.ts +27 -2
- package/dist/modules/agents/integrations/agent-chat-integration.js +5 -0
- package/dist/modules/agents/integrations/agent-chat-integration.js.map +1 -1
- package/dist/modules/agents/integrations/chat-integration.service.d.ts +15 -6
- package/dist/modules/agents/integrations/chat-integration.service.js +9 -10
- package/dist/modules/agents/integrations/chat-integration.service.js.map +1 -1
- package/dist/modules/agents/integrations/component-mapper.d.ts +14 -0
- package/dist/modules/agents/integrations/component-mapper.js +9 -1
- package/dist/modules/agents/integrations/component-mapper.js.map +1 -1
- package/dist/modules/agents/integrations/integration-action-executor.d.ts +22 -0
- package/dist/modules/agents/integrations/integration-action-executor.js +171 -0
- package/dist/modules/agents/integrations/integration-action-executor.js.map +1 -0
- package/dist/modules/agents/integrations/integration-context-query-executor.d.ts +18 -0
- package/dist/modules/agents/integrations/integration-context-query-executor.js +58 -0
- package/dist/modules/agents/integrations/integration-context-query-executor.js.map +1 -0
- package/dist/modules/agents/integrations/integration-error-codes.d.ts +13 -0
- package/dist/modules/agents/integrations/integration-error-codes.js +16 -0
- package/dist/modules/agents/integrations/integration-error-codes.js.map +1 -0
- package/dist/modules/agents/integrations/integration-helpers.d.ts +21 -0
- package/dist/modules/agents/integrations/integration-helpers.js +72 -0
- package/dist/modules/agents/integrations/integration-helpers.js.map +1 -0
- package/dist/modules/agents/integrations/integration-message-context.service.d.ts +13 -0
- package/dist/modules/agents/integrations/integration-message-context.service.js +129 -0
- package/dist/modules/agents/integrations/integration-message-context.service.js.map +1 -0
- package/dist/modules/agents/integrations/integration-tools.d.ts +205 -0
- package/dist/modules/agents/integrations/integration-tools.js +955 -0
- package/dist/modules/agents/integrations/integration-tools.js.map +1 -0
- package/dist/modules/agents/integrations/integrations-sync.d.ts +1 -1
- package/dist/modules/agents/integrations/integrations-sync.js +1 -29
- package/dist/modules/agents/integrations/integrations-sync.js.map +1 -1
- package/dist/modules/agents/integrations/n8n-memory.d.ts +2 -0
- package/dist/modules/agents/integrations/n8n-memory.js +18 -11
- package/dist/modules/agents/integrations/n8n-memory.js.map +1 -1
- package/dist/modules/agents/integrations/platforms/linear-integration.d.ts +13 -2
- package/dist/modules/agents/integrations/platforms/linear-integration.js +70 -15
- package/dist/modules/agents/integrations/platforms/linear-integration.js.map +1 -1
- package/dist/modules/agents/integrations/platforms/linear-operations.d.ts +18 -0
- package/dist/modules/agents/integrations/platforms/linear-operations.js +679 -0
- package/dist/modules/agents/integrations/platforms/linear-operations.js.map +1 -0
- package/dist/modules/agents/integrations/platforms/slack-integration.d.ts +11 -1
- package/dist/modules/agents/integrations/platforms/slack-integration.js +53 -1
- package/dist/modules/agents/integrations/platforms/slack-integration.js.map +1 -1
- package/dist/modules/agents/integrations/platforms/slack-operations.d.ts +17 -0
- package/dist/modules/agents/integrations/platforms/slack-operations.js +288 -0
- package/dist/modules/agents/integrations/platforms/slack-operations.js.map +1 -0
- package/dist/modules/agents/integrations/platforms/telegram-integration.d.ts +9 -2
- package/dist/modules/agents/integrations/platforms/telegram-integration.js +17 -0
- package/dist/modules/agents/integrations/platforms/telegram-integration.js.map +1 -1
- package/dist/modules/agents/integrations/slack-app-setup.service.js +7 -1
- package/dist/modules/agents/integrations/slack-app-setup.service.js.map +1 -1
- package/dist/modules/agents/json-config/from-json-config.d.ts +4 -2
- package/dist/modules/agents/json-config/from-json-config.js +88 -11
- package/dist/modules/agents/json-config/from-json-config.js.map +1 -1
- package/dist/modules/agents/json-config/mcp-client-factory.d.ts +16 -0
- package/dist/modules/agents/json-config/mcp-client-factory.js +155 -0
- package/dist/modules/agents/json-config/mcp-client-factory.js.map +1 -0
- package/dist/modules/agents/json-config/native-web-search-provider-tools.d.ts +8 -0
- package/dist/modules/agents/json-config/native-web-search-provider-tools.js +59 -0
- package/dist/modules/agents/json-config/native-web-search-provider-tools.js.map +1 -0
- package/dist/modules/agents/json-config/schema-text-serializer.js +12 -2
- package/dist/modules/agents/json-config/schema-text-serializer.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 +5 -3
- package/dist/modules/agents/repositories/agent-execution-thread.repository.js.map +1 -1
- package/dist/modules/agents/repositories/agent-file.repository.d.ts +7 -0
- package/dist/modules/agents/repositories/agent-file.repository.js +35 -0
- package/dist/modules/agents/repositories/agent-file.repository.js.map +1 -0
- package/dist/modules/agents/repositories/agent-history.repository.d.ts +2 -0
- package/dist/modules/agents/repositories/agent-history.repository.js +18 -0
- package/dist/modules/agents/repositories/agent-history.repository.js.map +1 -1
- package/dist/modules/agents/repositories/agent-task-run-lock.repository.d.ts +12 -0
- package/dist/modules/agents/repositories/agent-task-run-lock.repository.js +72 -0
- package/dist/modules/agents/repositories/agent-task-run-lock.repository.js.map +1 -0
- package/dist/modules/agents/repositories/agent-task-snapshot.repository.d.ts +11 -0
- package/dist/modules/agents/repositories/agent-task-snapshot.repository.js +45 -0
- package/dist/modules/agents/repositories/agent-task-snapshot.repository.js.map +1 -0
- package/dist/modules/agents/repositories/agent-task.repository.d.ts +7 -0
- package/dist/modules/agents/repositories/agent-task.repository.js +32 -0
- package/dist/modules/agents/repositories/agent-task.repository.js.map +1 -0
- package/dist/modules/agents/repositories/agent.repository.js +1 -2
- package/dist/modules/agents/repositories/agent.repository.js.map +1 -1
- package/dist/modules/agents/tools/knowledge/csv-helpers.d.ts +73 -0
- package/dist/modules/agents/tools/knowledge/csv-helpers.js +341 -0
- package/dist/modules/agents/tools/knowledge/csv-helpers.js.map +1 -0
- package/dist/modules/agents/tools/knowledge/csv.operation.d.ts +61 -0
- package/dist/modules/agents/tools/knowledge/csv.operation.js +207 -0
- package/dist/modules/agents/tools/knowledge/csv.operation.js.map +1 -0
- package/dist/modules/agents/tools/knowledge/file-references.d.ts +16 -0
- package/dist/modules/agents/tools/knowledge/file-references.js +35 -0
- package/dist/modules/agents/tools/knowledge/file-references.js.map +1 -0
- package/dist/modules/agents/tools/knowledge/read.operation.d.ts +8 -0
- package/dist/modules/agents/tools/knowledge/read.operation.js +38 -0
- package/dist/modules/agents/tools/knowledge/read.operation.js.map +1 -0
- package/dist/modules/agents/tools/knowledge/schemas.d.ts +1505 -0
- package/dist/modules/agents/tools/knowledge/schemas.js +441 -0
- package/dist/modules/agents/tools/knowledge/schemas.js.map +1 -0
- package/dist/modules/agents/tools/knowledge/search.operation.d.ts +9 -0
- package/dist/modules/agents/tools/knowledge/search.operation.js +332 -0
- package/dist/modules/agents/tools/knowledge/search.operation.js.map +1 -0
- package/dist/modules/agents/tools/knowledge/tool.d.ts +8 -0
- package/dist/modules/agents/tools/knowledge/tool.js +121 -0
- package/dist/modules/agents/tools/knowledge/tool.js.map +1 -0
- package/dist/modules/agents/utils/agent-memory-scope.d.ts +1 -1
- package/dist/modules/agents/utils/agent-memory-scope.js +4 -4
- package/dist/modules/agents/utils/agent-memory-scope.js.map +1 -1
- package/dist/modules/agents/utils/agent-resource-id.d.ts +1 -1
- package/dist/modules/chat-hub/chat-hub.module.d.ts +2 -2
- package/dist/modules/chat-hub/chat-hub.settings.controller.d.ts +4 -4
- package/dist/modules/chat-hub/chat-hub.types.d.ts +5 -5
- package/dist/modules/chat-hub/dto/chat-models-request.dto.d.ts +1 -1
- package/dist/modules/dynamic-credentials.ee/constants.d.ts +1 -1
- package/dist/modules/dynamic-credentials.ee/constants.js +2 -1
- package/dist/modules/dynamic-credentials.ee/constants.js.map +1 -1
- package/dist/modules/dynamic-credentials.ee/dynamic-credentials.controller.d.ts +9 -2
- package/dist/modules/dynamic-credentials.ee/dynamic-credentials.controller.js +45 -14
- package/dist/modules/dynamic-credentials.ee/dynamic-credentials.controller.js.map +1 -1
- package/dist/modules/dynamic-credentials.ee/services/credential-connection-status.service.d.ts +4 -0
- package/dist/modules/dynamic-credentials.ee/services/credential-connection-status.service.js +16 -0
- package/dist/modules/dynamic-credentials.ee/services/credential-connection-status.service.js.map +1 -1
- package/dist/modules/dynamic-credentials.ee/services/dynamic-credential.service.js +6 -2
- package/dist/modules/dynamic-credentials.ee/services/dynamic-credential.service.js.map +1 -1
- package/dist/modules/instance-ai/eval/eval-mocked-credentials-helper.d.ts +1 -0
- package/dist/modules/instance-ai/eval/eval-mocked-credentials-helper.js +21 -2
- package/dist/modules/instance-ai/eval/eval-mocked-credentials-helper.js.map +1 -1
- package/dist/modules/instance-ai/eval/execution.service.d.ts +4 -1
- package/dist/modules/instance-ai/eval/execution.service.js +118 -24
- package/dist/modules/instance-ai/eval/execution.service.js.map +1 -1
- package/dist/modules/instance-ai/eval/llm-wire-server.d.ts +8 -3
- package/dist/modules/instance-ai/eval/llm-wire-server.js +147 -50
- package/dist/modules/instance-ai/eval/llm-wire-server.js.map +1 -1
- package/dist/modules/instance-ai/eval/mock-handler.js +45 -8
- package/dist/modules/instance-ai/eval/mock-handler.js.map +1 -1
- package/dist/modules/instance-ai/eval/mock-quirks.d.ts +4 -2
- package/dist/modules/instance-ai/eval/mock-quirks.js +83 -4
- package/dist/modules/instance-ai/eval/mock-quirks.js.map +1 -1
- package/dist/modules/instance-ai/eval/openai-envelope.d.ts +8 -0
- package/dist/modules/instance-ai/eval/openai-envelope.js +121 -8
- package/dist/modules/instance-ai/eval/openai-envelope.js.map +1 -1
- package/dist/modules/instance-ai/eval/openai-responses-envelope.d.ts +11 -0
- package/dist/modules/instance-ai/eval/openai-responses-envelope.js +238 -0
- package/dist/modules/instance-ai/eval/openai-responses-envelope.js.map +1 -0
- package/dist/modules/instance-ai/eval/request-binary-redactor.d.ts +1 -0
- package/dist/modules/instance-ai/eval/request-binary-redactor.js +74 -0
- package/dist/modules/instance-ai/eval/request-binary-redactor.js.map +1 -0
- package/dist/modules/instance-ai/eval/workflow-analysis.d.ts +19 -1
- package/dist/modules/instance-ai/eval/workflow-analysis.js +159 -76
- package/dist/modules/instance-ai/eval/workflow-analysis.js.map +1 -1
- package/dist/modules/instance-ai/extract-resolved-node-parameters.d.ts +7 -0
- package/dist/modules/instance-ai/extract-resolved-node-parameters.js +221 -0
- package/dist/modules/instance-ai/extract-resolved-node-parameters.js.map +1 -0
- package/dist/modules/instance-ai/instance-ai-memory.service.d.ts +7 -1
- package/dist/modules/instance-ai/instance-ai-memory.service.js +80 -3
- package/dist/modules/instance-ai/instance-ai-memory.service.js.map +1 -1
- package/dist/modules/instance-ai/instance-ai-settings.service.js +1 -16
- package/dist/modules/instance-ai/instance-ai-settings.service.js.map +1 -1
- package/dist/modules/instance-ai/instance-ai.adapter.service.d.ts +1 -1
- package/dist/modules/instance-ai/instance-ai.adapter.service.js +67 -7
- package/dist/modules/instance-ai/instance-ai.adapter.service.js.map +1 -1
- package/dist/modules/instance-ai/instance-ai.module.d.ts +1 -1
- package/dist/modules/instance-ai/instance-ai.service.d.ts +24 -1
- package/dist/modules/instance-ai/instance-ai.service.js +400 -26
- package/dist/modules/instance-ai/instance-ai.service.js.map +1 -1
- package/dist/modules/instance-ai/liveness/instance-ai-liveness.service.d.ts +1 -0
- package/dist/modules/instance-ai/liveness/instance-ai-liveness.service.js +1 -0
- package/dist/modules/instance-ai/liveness/instance-ai-liveness.service.js.map +1 -1
- package/dist/modules/instance-ai/message-parser.d.ts +2 -0
- package/dist/modules/instance-ai/message-parser.js +165 -36
- package/dist/modules/instance-ai/message-parser.js.map +1 -1
- package/dist/modules/instance-ai/repositories/instance-ai-checkpoint.repository.d.ts +2 -0
- package/dist/modules/instance-ai/repositories/instance-ai-checkpoint.repository.js +13 -0
- package/dist/modules/instance-ai/repositories/instance-ai-checkpoint.repository.js.map +1 -1
- package/dist/modules/instance-ai/repositories/instance-ai-pending-confirmation.repository.d.ts +12 -0
- package/dist/modules/instance-ai/repositories/instance-ai-pending-confirmation.repository.js +80 -0
- package/dist/modules/instance-ai/repositories/instance-ai-pending-confirmation.repository.js.map +1 -0
- package/dist/modules/instance-ai/storage/db-snapshot-storage.d.ts +1 -0
- package/dist/modules/instance-ai/storage/db-snapshot-storage.js +23 -0
- package/dist/modules/instance-ai/storage/db-snapshot-storage.js.map +1 -1
- package/dist/modules/instance-ai/storage/typeorm-agent-checkpoint-store.d.ts +10 -4
- package/dist/modules/instance-ai/storage/typeorm-agent-checkpoint-store.js +49 -37
- package/dist/modules/instance-ai/storage/typeorm-agent-checkpoint-store.js.map +1 -1
- package/dist/modules/instance-ai/web-research/index.d.ts +0 -2
- package/dist/modules/instance-ai/web-research/index.js +1 -5
- package/dist/modules/instance-ai/web-research/index.js.map +1 -1
- package/dist/modules/ldap.ee/helpers.ee.js +6 -2
- package/dist/modules/ldap.ee/helpers.ee.js.map +1 -1
- package/dist/modules/mcp/mcp.controller.js +13 -6
- package/dist/modules/mcp/mcp.controller.js.map +1 -1
- package/dist/modules/mcp/mcp.service.d.ts +10 -2
- package/dist/modules/mcp/mcp.service.js +36 -6
- package/dist/modules/mcp/mcp.service.js.map +1 -1
- package/dist/modules/mcp/mcp.settings.controller.d.ts +2 -0
- package/dist/modules/mcp/mcp.settings.service.d.ts +2 -0
- package/dist/modules/mcp/mcp.settings.service.js +6 -5
- package/dist/modules/mcp/mcp.settings.service.js.map +1 -1
- package/dist/modules/mcp/mcp.types.d.ts +6 -0
- package/dist/modules/mcp/mcp.types.js +9 -0
- package/dist/modules/mcp/mcp.types.js.map +1 -1
- package/dist/modules/mcp/tools/execute-workflow.tool.d.ts +6 -6
- package/dist/modules/mcp/tools/search-workflows.tool.d.ts +2 -1
- package/dist/modules/mcp/tools/search-workflows.tool.js +12 -4
- package/dist/modules/mcp/tools/search-workflows.tool.js.map +1 -1
- package/dist/modules/mcp/tools/workflow-builder/mcp-instructions.js +1 -1
- package/dist/modules/mcp/tools/workflow-builder/update-workflow.tool.d.ts +67 -6
- package/dist/modules/mcp/tools/workflow-builder/workflow-operations.d.ts +67 -6
- package/dist/modules/mcp/tools/workflow-builder/workflow-operations.js +51 -0
- package/dist/modules/mcp/tools/workflow-builder/workflow-operations.js.map +1 -1
- package/dist/modules/mcp-registry/registry/mcp-registry.types.js.map +1 -1
- package/dist/modules/mcp-registry/synthesize-type-def.d.ts +2 -0
- package/dist/modules/mcp-registry/synthesize-type-def.js +35 -0
- package/dist/modules/mcp-registry/synthesize-type-def.js.map +1 -0
- package/dist/modules/n8n-packages/engine/import-pipeline.d.ts +24 -0
- package/dist/modules/n8n-packages/engine/import-pipeline.js +206 -0
- package/dist/modules/n8n-packages/engine/import-pipeline.js.map +1 -0
- package/dist/modules/n8n-packages/entities/credential/credential-requirements.extractor.d.ts +6 -0
- package/dist/modules/n8n-packages/entities/credential/credential-requirements.extractor.js +33 -0
- package/dist/modules/n8n-packages/entities/credential/credential-requirements.extractor.js.map +1 -0
- package/dist/modules/n8n-packages/entities/credential/credential.exporter.d.ts +23 -0
- package/dist/modules/n8n-packages/entities/credential/credential.exporter.js +68 -0
- package/dist/modules/n8n-packages/entities/credential/credential.exporter.js.map +1 -0
- package/dist/modules/n8n-packages/entities/credential/credential.serializer.d.ts +5 -0
- package/dist/modules/n8n-packages/entities/credential/credential.serializer.js +25 -0
- package/dist/modules/n8n-packages/entities/credential/credential.serializer.js.map +1 -0
- package/dist/modules/n8n-packages/entities/credential/credential.types.d.ts +6 -0
- package/dist/modules/n8n-packages/entities/credential/credential.types.js +3 -0
- package/dist/modules/n8n-packages/entities/credential/credential.types.js.map +1 -0
- package/dist/modules/n8n-packages/entities/requirements-extractor.d.ts +4 -0
- package/dist/modules/n8n-packages/entities/requirements-extractor.js +3 -0
- package/dist/modules/n8n-packages/entities/requirements-extractor.js.map +1 -0
- package/dist/modules/n8n-packages/entities/workflow/workflow.exporter.d.ts +12 -3
- package/dist/modules/n8n-packages/entities/workflow/workflow.exporter.js +11 -20
- package/dist/modules/n8n-packages/entities/workflow/workflow.exporter.js.map +1 -1
- package/dist/modules/n8n-packages/entities/workflow/workflow.serializer.d.ts +3 -0
- package/dist/modules/n8n-packages/entities/workflow/workflow.serializer.js +10 -0
- package/dist/modules/n8n-packages/entities/workflow/workflow.serializer.js.map +1 -1
- package/dist/modules/n8n-packages/io/package-reader.d.ts +6 -0
- package/dist/modules/n8n-packages/io/package-reader.js +3 -0
- package/dist/modules/n8n-packages/io/package-reader.js.map +1 -0
- package/dist/modules/n8n-packages/io/slug.utils.d.ts +1 -1
- package/dist/modules/n8n-packages/io/slug.utils.js +3 -3
- package/dist/modules/n8n-packages/io/slug.utils.js.map +1 -1
- package/dist/modules/n8n-packages/io/tar/tar-package-reader.d.ts +13 -0
- package/dist/modules/n8n-packages/io/tar/tar-package-reader.js +84 -0
- package/dist/modules/n8n-packages/io/tar/tar-package-reader.js.map +1 -0
- package/dist/modules/n8n-packages/io/unique-filename-allocator.d.ts +7 -0
- package/dist/modules/n8n-packages/io/unique-filename-allocator.js +27 -0
- package/dist/modules/n8n-packages/io/unique-filename-allocator.js.map +1 -0
- package/dist/modules/n8n-packages/n8n-packages.service.d.ts +7 -2
- package/dist/modules/n8n-packages/n8n-packages.service.js +21 -3
- package/dist/modules/n8n-packages/n8n-packages.service.js.map +1 -1
- package/dist/modules/n8n-packages/n8n-packages.types.d.ts +22 -0
- package/dist/modules/n8n-packages/spec/manifest.schema.d.ts +121 -4
- package/dist/modules/n8n-packages/spec/manifest.schema.js +22 -3
- package/dist/modules/n8n-packages/spec/manifest.schema.js.map +1 -1
- package/dist/modules/n8n-packages/spec/requirements.schema.d.ts +51 -0
- package/dist/modules/n8n-packages/spec/requirements.schema.js +14 -0
- package/dist/modules/n8n-packages/spec/requirements.schema.js.map +1 -0
- package/dist/modules/n8n-packages/spec/serialized/credential.schema.d.ts +15 -0
- package/dist/modules/n8n-packages/spec/serialized/credential.schema.js +12 -0
- package/dist/modules/n8n-packages/spec/serialized/credential.schema.js.map +1 -0
- package/dist/modules/n8n-packages/spec/serialized/workflow.schema.d.ts +4 -4
- package/dist/modules/n8n-packages/utils/import-package-upload.d.ts +13 -0
- package/dist/modules/n8n-packages/utils/import-package-upload.js +59 -0
- package/dist/modules/n8n-packages/utils/import-package-upload.js.map +1 -0
- package/dist/modules/otel/execution-level-tracer.js +15 -6
- package/dist/modules/otel/execution-level-tracer.js.map +1 -1
- package/dist/modules/otel/execution-level-tracer.types.d.ts +3 -0
- package/dist/modules/otel/execution-level-tracer.types.js.map +1 -1
- package/dist/modules/otel/otel-lifecycle-handler.d.ts +4 -2
- package/dist/modules/otel/otel-lifecycle-handler.js +69 -4
- package/dist/modules/otel/otel-lifecycle-handler.js.map +1 -1
- package/dist/modules/otel/otel.config.d.ts +1 -0
- package/dist/modules/otel/otel.config.js +5 -0
- package/dist/modules/otel/otel.config.js.map +1 -1
- package/dist/modules/otel/otel.constants.d.ts +2 -0
- package/dist/modules/otel/otel.constants.js +2 -0
- package/dist/modules/otel/otel.constants.js.map +1 -1
- package/dist/modules/redaction/instance-redaction-enforcement.service.d.ts +4 -0
- package/dist/modules/redaction/instance-redaction-enforcement.service.js +8 -0
- package/dist/modules/redaction/instance-redaction-enforcement.service.js.map +1 -1
- package/dist/modules/redaction/redaction-context-hook.d.ts +9 -0
- package/dist/modules/redaction/redaction-context-hook.js +57 -0
- package/dist/modules/redaction/redaction-context-hook.js.map +1 -0
- package/dist/modules/redaction/redaction.module.js +1 -0
- package/dist/modules/redaction/redaction.module.js.map +1 -1
- package/dist/modules/source-control.ee/constants.d.ts +1 -0
- package/dist/modules/source-control.ee/constants.js +2 -1
- package/dist/modules/source-control.ee/constants.js.map +1 -1
- package/dist/modules/source-control.ee/source-control-status.service.ee.js +5 -0
- 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 -2
- package/dist/modules/source-control.ee/source-control.controller.ee.js +32 -5
- package/dist/modules/source-control.ee/source-control.controller.ee.js.map +1 -1
- package/dist/modules/source-control.ee/source-control.service.ee.js +2 -0
- package/dist/modules/source-control.ee/source-control.service.ee.js.map +1 -1
- package/dist/modules/workflow-builder/workflow-builder-session.repository.js +2 -1
- package/dist/modules/workflow-builder/workflow-builder-session.repository.js.map +1 -1
- package/dist/node-catalog/node-catalog.service.d.ts +2 -0
- package/dist/node-catalog/node-catalog.service.js +38 -2
- package/dist/node-catalog/node-catalog.service.js.map +1 -1
- package/dist/oauth/oauth-browser-binding.service.d.ts +18 -0
- package/dist/oauth/oauth-browser-binding.service.js +68 -0
- package/dist/oauth/oauth-browser-binding.service.js.map +1 -0
- package/dist/oauth/oauth.service.d.ts +10 -4
- package/dist/oauth/oauth.service.js +87 -4
- package/dist/oauth/oauth.service.js.map +1 -1
- package/dist/oauth/types.d.ts +1 -0
- package/dist/oauth/types.js.map +1 -1
- package/dist/public-api/index.js +5 -1
- package/dist/public-api/index.js.map +1 -1
- package/dist/public-api/types.d.ts +6 -0
- package/dist/public-api/v1/handlers/credentials/credentials.service.js +1 -0
- package/dist/public-api/v1/handlers/credentials/credentials.service.js.map +1 -1
- package/dist/public-api/v1/handlers/n8n-packages/n8n-packages.handler.d.ts +5 -0
- package/dist/public-api/v1/handlers/n8n-packages/n8n-packages.handler.js +22 -0
- package/dist/public-api/v1/handlers/n8n-packages/n8n-packages.handler.js.map +1 -1
- package/dist/public-api/v1/openapi.yml +207 -59
- package/dist/requests.d.ts +4 -0
- package/dist/scaling/constants.d.ts +2 -2
- package/dist/scaling/pubsub/pubsub.event-map.d.ts +5 -2
- package/dist/scaling/pubsub/pubsub.types.d.ts +2 -1
- package/dist/services/ai-workflow-builder.service.d.ts +6 -3
- package/dist/services/ai-workflow-builder.service.js +13 -5
- package/dist/services/ai-workflow-builder.service.js.map +1 -1
- package/dist/services/api-key-auth.strategy.d.ts +4 -1
- package/dist/services/api-key-auth.strategy.js +18 -2
- package/dist/services/api-key-auth.strategy.js.map +1 -1
- package/dist/services/ownership.service.d.ts +1 -0
- package/dist/services/ownership.service.js +7 -0
- package/dist/services/ownership.service.js.map +1 -1
- package/dist/services/project.service.ee.d.ts +6 -2
- package/dist/services/project.service.ee.js +30 -8
- package/dist/services/project.service.ee.js.map +1 -1
- package/dist/services/public-api-key.service.d.ts +21 -14
- package/dist/services/public-api-key.service.js +14 -9
- package/dist/services/public-api-key.service.js.map +1 -1
- package/dist/telemetry/index.d.ts +6 -9
- package/dist/telemetry/index.js +23 -9
- package/dist/telemetry/index.js.map +1 -1
- package/dist/webhooks/constants.js +5 -1
- package/dist/webhooks/constants.js.map +1 -1
- package/dist/webhooks/live-webhooks.d.ts +8 -1
- package/dist/webhooks/live-webhooks.js +37 -22
- package/dist/webhooks/live-webhooks.js.map +1 -1
- package/dist/webhooks/waiting-forms.js +8 -1
- package/dist/webhooks/waiting-forms.js.map +1 -1
- package/dist/webhooks/webhook-helpers.d.ts +1 -1
- package/dist/webhooks/webhook-helpers.js +20 -10
- package/dist/webhooks/webhook-helpers.js.map +1 -1
- package/dist/webhooks/webhook-request-handler.js +1 -1
- package/dist/webhooks/webhook-request-handler.js.map +1 -1
- package/dist/workflow-helpers.d.ts +6 -1
- package/dist/workflow-helpers.js +9 -1
- package/dist/workflow-helpers.js.map +1 -1
- package/dist/workflows/workflow-creation.service.d.ts +4 -1
- package/dist/workflows/workflow-creation.service.js +12 -3
- package/dist/workflows/workflow-creation.service.js.map +1 -1
- package/dist/workflows/workflow-finder.service.d.ts +1 -0
- package/dist/workflows/workflow-published-data.service.d.ts +11 -0
- package/dist/workflows/workflow-published-data.service.js +39 -0
- package/dist/workflows/workflow-published-data.service.js.map +1 -0
- package/dist/workflows/workflow-validation.service.d.ts +5 -1
- package/dist/workflows/workflow-validation.service.js +55 -2
- package/dist/workflows/workflow-validation.service.js.map +1 -1
- package/dist/workflows/workflow.service.js +4 -0
- package/dist/workflows/workflow.service.js.map +1 -1
- package/dist/workflows/workflows.controller.d.ts +8 -0
- package/package.json +40 -32
- package/templates/form-trigger-completion.handlebars +12 -1
- package/dist/modules/agents/integrations/agent-schedule.service.d.ts +0 -30
- package/dist/modules/agents/integrations/agent-schedule.service.js +0 -331
- package/dist/modules/agents/integrations/agent-schedule.service.js.map +0 -1
- package/dist/modules/instance-ai/web-research/brave-search.d.ts +0 -10
- package/dist/modules/instance-ai/web-research/brave-search.js +0 -44
- package/dist/modules/instance-ai/web-research/brave-search.js.map +0 -1
- package/dist/modules/instance-ai/web-research/searxng-search.d.ts +0 -6
- package/dist/modules/instance-ai/web-research/searxng-search.js +0 -39
- package/dist/modules/instance-ai/web-research/searxng-search.js.map +0 -1
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ChatIntegrationActionExecutor = void 0;
|
|
13
|
+
const di_1 = require("@n8n/di");
|
|
14
|
+
const zod_1 = require("zod");
|
|
15
|
+
const agent_chat_integration_1 = require("./agent-chat-integration");
|
|
16
|
+
const chat_integration_service_1 = require("./chat-integration.service");
|
|
17
|
+
const component_mapper_1 = require("./component-mapper");
|
|
18
|
+
const integration_error_codes_1 = require("./integration-error-codes");
|
|
19
|
+
const integration_helpers_1 = require("./integration-helpers");
|
|
20
|
+
const slack_operations_1 = require("./platforms/slack-operations");
|
|
21
|
+
const messageSchema = zod_1.z.object({
|
|
22
|
+
text: zod_1.z.string().optional(),
|
|
23
|
+
richInteraction: zod_1.z
|
|
24
|
+
.object({
|
|
25
|
+
awaitResponse: zod_1.z.boolean().optional(),
|
|
26
|
+
title: zod_1.z.string().optional(),
|
|
27
|
+
message: zod_1.z.string().optional(),
|
|
28
|
+
components: zod_1.z.array(zod_1.z.object({ type: zod_1.z.string() }).passthrough()).min(1),
|
|
29
|
+
})
|
|
30
|
+
.optional(),
|
|
31
|
+
});
|
|
32
|
+
const respondInputSchema = zod_1.z.object({ message: messageSchema });
|
|
33
|
+
const sendDmInputSchema = zod_1.z.object({
|
|
34
|
+
userId: zod_1.z.string().min(1),
|
|
35
|
+
message: messageSchema,
|
|
36
|
+
});
|
|
37
|
+
const sendChannelMessageInputSchema = zod_1.z.object({
|
|
38
|
+
channelId: zod_1.z.string().min(1),
|
|
39
|
+
message: messageSchema,
|
|
40
|
+
});
|
|
41
|
+
let ChatIntegrationActionExecutor = class ChatIntegrationActionExecutor {
|
|
42
|
+
constructor(chatIntegrationService, integrationRegistry) {
|
|
43
|
+
this.chatIntegrationService = chatIntegrationService;
|
|
44
|
+
this.integrationRegistry = integrationRegistry;
|
|
45
|
+
this.componentMapper = new component_mapper_1.ComponentMapper();
|
|
46
|
+
}
|
|
47
|
+
async execute(params) {
|
|
48
|
+
if (!params.descriptor.agentId)
|
|
49
|
+
return (0, integration_helpers_1.connectionUnavailable)();
|
|
50
|
+
const chat = this.chatIntegrationService.getChatInstance(params.descriptor.agentId, {
|
|
51
|
+
type: params.descriptor.integration.type,
|
|
52
|
+
credentialId: params.descriptor.integration.credentialId,
|
|
53
|
+
});
|
|
54
|
+
if (!chat)
|
|
55
|
+
return (0, integration_helpers_1.connectionUnavailable)();
|
|
56
|
+
try {
|
|
57
|
+
if (params.action === 'respond') {
|
|
58
|
+
return await this.respondInCurrentThread(chat, params);
|
|
59
|
+
}
|
|
60
|
+
if (params.action === 'send_dm') {
|
|
61
|
+
return await this.sendDirectMessage(chat, params);
|
|
62
|
+
}
|
|
63
|
+
const integration = this.integrationRegistry.get(params.descriptor.integration.type);
|
|
64
|
+
if (integration?.executeAction) {
|
|
65
|
+
const result = await integration.executeAction({
|
|
66
|
+
chat,
|
|
67
|
+
descriptor: params.descriptor,
|
|
68
|
+
action: params.action,
|
|
69
|
+
input: params.input,
|
|
70
|
+
currentMessageContext: params.currentMessageContext,
|
|
71
|
+
});
|
|
72
|
+
if (result !== undefined)
|
|
73
|
+
return result;
|
|
74
|
+
}
|
|
75
|
+
if (params.action === 'send_channel_message') {
|
|
76
|
+
return await this.sendChannelMessage(chat, params);
|
|
77
|
+
}
|
|
78
|
+
return (0, integration_helpers_1.integrationError)(integration_error_codes_1.INTEGRATION_ERROR_CODES.UNSUPPORTED_ACTION, `The ${params.descriptor.integration.type} integration does not support ${params.action}.`);
|
|
79
|
+
}
|
|
80
|
+
catch (error) {
|
|
81
|
+
return (0, integration_helpers_1.integrationError)(integration_error_codes_1.INTEGRATION_ERROR_CODES.ACTION_FAILED, error instanceof Error ? error.message : String(error));
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
async respondInCurrentThread(chat, params) {
|
|
85
|
+
const input = respondInputSchema.parse(params.input);
|
|
86
|
+
const threadId = params.currentMessageContext?.target.threadId;
|
|
87
|
+
if (!threadId) {
|
|
88
|
+
return (0, integration_helpers_1.integrationError)(integration_error_codes_1.INTEGRATION_ERROR_CODES.NO_MESSAGE_CONTEXT, 'There is no current message context. Use an explicit send action.');
|
|
89
|
+
}
|
|
90
|
+
const thread = chat.thread(threadId);
|
|
91
|
+
await maybeSubscribeSlackThread(params.descriptor, thread);
|
|
92
|
+
const sent = await thread.post(await this.toPostable(params.descriptor, input.message, params));
|
|
93
|
+
return {
|
|
94
|
+
ok: true,
|
|
95
|
+
messageContext: buildMessageContextFromSentMessage({
|
|
96
|
+
descriptor: params.descriptor,
|
|
97
|
+
sent,
|
|
98
|
+
target: params.currentMessageContext.target,
|
|
99
|
+
}),
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
async sendDirectMessage(chat, params) {
|
|
103
|
+
const input = sendDmInputSchema.parse(params.input);
|
|
104
|
+
const thread = await chat.openDM(input.userId);
|
|
105
|
+
await maybeSubscribeSlackThread(params.descriptor, thread);
|
|
106
|
+
const sent = await thread.post(await this.toPostable(params.descriptor, input.message, params));
|
|
107
|
+
return {
|
|
108
|
+
ok: true,
|
|
109
|
+
messageContext: buildMessageContextFromSentMessage({
|
|
110
|
+
descriptor: params.descriptor,
|
|
111
|
+
sent,
|
|
112
|
+
target: { type: 'dm', userId: input.userId, threadId: thread.id },
|
|
113
|
+
}),
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
async sendChannelMessage(chat, params) {
|
|
117
|
+
const input = sendChannelMessageInputSchema.parse(params.input);
|
|
118
|
+
const channelId = (0, integration_helpers_1.normalizePlatformId)(params.descriptor.integration.type, input.channelId);
|
|
119
|
+
const channel = chat.channel(channelId);
|
|
120
|
+
const sent = await channel.post(await this.toPostable(params.descriptor, input.message, params));
|
|
121
|
+
await maybeSubscribeSlackSentThread(params.descriptor, chat, sent.threadId);
|
|
122
|
+
return {
|
|
123
|
+
ok: true,
|
|
124
|
+
messageContext: buildMessageContextFromSentMessage({
|
|
125
|
+
descriptor: params.descriptor,
|
|
126
|
+
sent,
|
|
127
|
+
target: { type: 'channel', channelId, threadId: sent.threadId },
|
|
128
|
+
}),
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
async toPostable(descriptor, message, params) {
|
|
132
|
+
const richInteraction = message.richInteraction;
|
|
133
|
+
if (!richInteraction)
|
|
134
|
+
return message.text ?? '';
|
|
135
|
+
if (params.awaitResponse && (!params.runId || !params.toolCallId)) {
|
|
136
|
+
throw new Error('Interactive integration actions require runId and toolCallId.');
|
|
137
|
+
}
|
|
138
|
+
const card = await this.componentMapper.toCard({
|
|
139
|
+
title: richInteraction.title ?? message.text,
|
|
140
|
+
message: richInteraction.message,
|
|
141
|
+
components: richInteraction.components,
|
|
142
|
+
}, params.runId ?? '', params.toolCallId ?? '', component_mapper_1.RICH_INTERACTION_RESUME_JSON_SCHEMA, undefined, descriptor.integration.type);
|
|
143
|
+
return { card };
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
exports.ChatIntegrationActionExecutor = ChatIntegrationActionExecutor;
|
|
147
|
+
exports.ChatIntegrationActionExecutor = ChatIntegrationActionExecutor = __decorate([
|
|
148
|
+
(0, di_1.Service)(),
|
|
149
|
+
__metadata("design:paramtypes", [chat_integration_service_1.ChatIntegrationService,
|
|
150
|
+
agent_chat_integration_1.ChatIntegrationRegistry])
|
|
151
|
+
], ChatIntegrationActionExecutor);
|
|
152
|
+
function buildMessageContextFromSentMessage(params) {
|
|
153
|
+
return {
|
|
154
|
+
integrationConnectionId: params.descriptor.integrationConnectionId,
|
|
155
|
+
platform: params.descriptor.integration.type,
|
|
156
|
+
target: params.target,
|
|
157
|
+
messageId: params.sent.id,
|
|
158
|
+
updatedAt: new Date().toISOString(),
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
async function maybeSubscribeSlackThread(descriptor, thread) {
|
|
162
|
+
if (descriptor.integration.type !== 'slack')
|
|
163
|
+
return;
|
|
164
|
+
await (0, slack_operations_1.subscribeSlackThread)(thread);
|
|
165
|
+
}
|
|
166
|
+
async function maybeSubscribeSlackSentThread(descriptor, chat, threadId) {
|
|
167
|
+
if (descriptor.integration.type !== 'slack' || !threadId)
|
|
168
|
+
return;
|
|
169
|
+
await (0, slack_operations_1.subscribeSlackThread)(chat.thread(threadId));
|
|
170
|
+
}
|
|
171
|
+
//# sourceMappingURL=integration-action-executor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integration-action-executor.js","sourceRoot":"","sources":["../../../../src/modules/agents/integrations/integration-action-executor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gCAAkC;AAElC,6BAAwB;AAExB,qEAAmE;AACnE,yEAAuF;AACvF,yDAA0F;AAC1F,uEAAoE;AACpE,+DAI+B;AAQ/B,mEAAoE;AAEpE,MAAM,aAAa,GAAG,OAAC,CAAC,MAAM,CAAC;IAC9B,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC3B,eAAe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,CAAC,uBAAuB;QAClE,QAAQ,EAAE,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI;QAC5C,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,SAAS,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE;QACzB,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;KACnC,CAAC;AACH,CAAC;AAED,KAAK,UAAU,yBAAyB,CACvC,UAA+C,EAC/C,MAA2C;IAE3C,IAAI,UAAU,CAAC,WAAW,CAAC,IAAI,KAAK,OAAO;QAAE,OAAO;IACpD,MAAM,IAAA,uCAAoB,EAAC,MAAM,CAAC,CAAC;AACpC,CAAC;AAED,KAAK,UAAU,6BAA6B,CAC3C,UAA+C,EAC/C,IAAkB,EAClB,QAA4B;IAE5B,IAAI,UAAU,CAAC,WAAW,CAAC,IAAI,KAAK,OAAO,IAAI,CAAC,QAAQ;QAAE,OAAO;IACjE,MAAM,IAAA,uCAAoB,EAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;AACnD,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ChatIntegrationRegistry } from './agent-chat-integration';
|
|
2
|
+
import { ChatIntegrationService } from './chat-integration.service';
|
|
3
|
+
import type { IntegrationContextQuery, IntegrationContextQueryExecutor, IntegrationToolConnectionDescriptor } from './integration-tools';
|
|
4
|
+
export declare class ChatIntegrationContextQueryExecutor implements IntegrationContextQueryExecutor {
|
|
5
|
+
private readonly chatIntegrationService;
|
|
6
|
+
private readonly integrationRegistry;
|
|
7
|
+
constructor(chatIntegrationService: ChatIntegrationService, integrationRegistry: ChatIntegrationRegistry);
|
|
8
|
+
execute(params: {
|
|
9
|
+
descriptor: IntegrationToolConnectionDescriptor;
|
|
10
|
+
query: IntegrationContextQuery;
|
|
11
|
+
input: Record<string, unknown>;
|
|
12
|
+
persistence?: {
|
|
13
|
+
threadId: string;
|
|
14
|
+
resourceId: string;
|
|
15
|
+
};
|
|
16
|
+
}): Promise<unknown>;
|
|
17
|
+
}
|
|
18
|
+
export { normalizeLinearComment, normalizeLinearIssue } from './platforms/linear-operations';
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.normalizeLinearIssue = exports.normalizeLinearComment = exports.ChatIntegrationContextQueryExecutor = void 0;
|
|
13
|
+
const di_1 = require("@n8n/di");
|
|
14
|
+
const agent_chat_integration_1 = require("./agent-chat-integration");
|
|
15
|
+
const chat_integration_service_1 = require("./chat-integration.service");
|
|
16
|
+
const integration_error_codes_1 = require("./integration-error-codes");
|
|
17
|
+
const integration_helpers_1 = require("./integration-helpers");
|
|
18
|
+
let ChatIntegrationContextQueryExecutor = class ChatIntegrationContextQueryExecutor {
|
|
19
|
+
constructor(chatIntegrationService, integrationRegistry) {
|
|
20
|
+
this.chatIntegrationService = chatIntegrationService;
|
|
21
|
+
this.integrationRegistry = integrationRegistry;
|
|
22
|
+
}
|
|
23
|
+
async execute(params) {
|
|
24
|
+
if (!params.descriptor.agentId)
|
|
25
|
+
return (0, integration_helpers_1.connectionUnavailable)();
|
|
26
|
+
const chat = this.chatIntegrationService.getChatInstance(params.descriptor.agentId, {
|
|
27
|
+
type: params.descriptor.integration.type,
|
|
28
|
+
credentialId: params.descriptor.integration.credentialId,
|
|
29
|
+
});
|
|
30
|
+
if (!chat)
|
|
31
|
+
return (0, integration_helpers_1.connectionUnavailable)();
|
|
32
|
+
const integration = this.integrationRegistry.get(params.descriptor.integration.type);
|
|
33
|
+
if (!integration?.executeContextQuery) {
|
|
34
|
+
return (0, integration_helpers_1.integrationError)(integration_error_codes_1.INTEGRATION_ERROR_CODES.UNSUPPORTED_QUERY, `The ${params.descriptor.integration.type} integration does not support context queries.`);
|
|
35
|
+
}
|
|
36
|
+
try {
|
|
37
|
+
return await integration.executeContextQuery({
|
|
38
|
+
chat,
|
|
39
|
+
descriptor: params.descriptor,
|
|
40
|
+
query: params.query,
|
|
41
|
+
input: params.input,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
return (0, integration_helpers_1.integrationError)(integration_error_codes_1.INTEGRATION_ERROR_CODES.CONTEXT_QUERY_FAILED, error instanceof Error ? error.message : String(error));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
exports.ChatIntegrationContextQueryExecutor = ChatIntegrationContextQueryExecutor;
|
|
50
|
+
exports.ChatIntegrationContextQueryExecutor = ChatIntegrationContextQueryExecutor = __decorate([
|
|
51
|
+
(0, di_1.Service)(),
|
|
52
|
+
__metadata("design:paramtypes", [chat_integration_service_1.ChatIntegrationService,
|
|
53
|
+
agent_chat_integration_1.ChatIntegrationRegistry])
|
|
54
|
+
], ChatIntegrationContextQueryExecutor);
|
|
55
|
+
var linear_operations_1 = require("./platforms/linear-operations");
|
|
56
|
+
Object.defineProperty(exports, "normalizeLinearComment", { enumerable: true, get: function () { return linear_operations_1.normalizeLinearComment; } });
|
|
57
|
+
Object.defineProperty(exports, "normalizeLinearIssue", { enumerable: true, get: function () { return linear_operations_1.normalizeLinearIssue; } });
|
|
58
|
+
//# sourceMappingURL=integration-context-query-executor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integration-context-query-executor.js","sourceRoot":"","sources":["../../../../src/modules/agents/integrations/integration-context-query-executor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gCAAkC;AAElC,qEAAmE;AACnE,yEAAoE;AACpE,uEAAoE;AACpE,+DAAgF;AAazE,IAAM,mCAAmC,GAAzC,MAAM,mCAAmC;IAC/C,YACkB,sBAA8C,EAC9C,mBAA4C;QAD5C,2BAAsB,GAAtB,sBAAsB,CAAwB;QAC9C,wBAAmB,GAAnB,mBAAmB,CAAyB;IAC3D,CAAC;IAEJ,KAAK,CAAC,OAAO,CAAC,MAKb;QACA,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,OAAO;YAAE,OAAO,IAAA,2CAAqB,GAAE,CAAC;QAE/D,MAAM,IAAI,GAAG,IAAI,CAAC,sBAAsB,CAAC,eAAe,CAAC,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE;YACnF,IAAI,EAAE,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI;YACxC,YAAY,EAAE,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,YAAY;SACxD,CAAC,CAAC;QACH,IAAI,CAAC,IAAI;YAAE,OAAO,IAAA,2CAAqB,GAAE,CAAC;QAE1C,MAAM,WAAW,GAAG,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QACrF,IAAI,CAAC,WAAW,EAAE,mBAAmB,EAAE,CAAC;YACvC,OAAO,IAAA,sCAAgB,EACtB,iDAAuB,CAAC,iBAAiB,EACzC,OAAO,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI,gDAAgD,CACzF,CAAC;QACH,CAAC;QAED,IAAI,CAAC;YACJ,OAAO,MAAM,WAAW,CAAC,mBAAmB,CAAC;gBAC5C,IAAI;gBACJ,UAAU,EAAE,MAAM,CAAC,UAAU;gBAC7B,KAAK,EAAE,MAAM,CAAC,KAAK;gBACnB,KAAK,EAAE,MAAM,CAAC,KAAK;aACnB,CAAC,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,OAAO,IAAA,sCAAgB,EACtB,iDAAuB,CAAC,oBAAoB,EAC5C,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CACtD,CAAC;QACH,CAAC;IACF,CAAC;CACD,CAAA;AA1CY,kFAAmC;8CAAnC,mCAAmC;IAD/C,IAAA,YAAO,GAAE;qCAGiC,iDAAsB;QACzB,gDAAuB;GAHlD,mCAAmC,CA0C/C;AAID,mEAA6F;AAApF,2HAAA,sBAAsB,OAAA;AAAE,yHAAA,oBAAoB,OAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const INTEGRATION_ERROR_CODES: {
|
|
2
|
+
readonly NO_THREAD_CONTEXT: "NO_THREAD_CONTEXT";
|
|
3
|
+
readonly NO_MESSAGE_CONTEXT: "NO_MESSAGE_CONTEXT";
|
|
4
|
+
readonly NO_MESSAGE_CONTEXT_FOR_INTEGRATION: "NO_MESSAGE_CONTEXT_FOR_INTEGRATION";
|
|
5
|
+
readonly NO_INTERACTING_USER_CONTEXT: "NO_INTERACTING_USER_CONTEXT";
|
|
6
|
+
readonly NO_CHANNEL_CONTEXT: "NO_CHANNEL_CONTEXT";
|
|
7
|
+
readonly CONNECTION_NOT_AVAILABLE: "CONNECTION_NOT_AVAILABLE";
|
|
8
|
+
readonly UNSUPPORTED_QUERY: "UNSUPPORTED_QUERY";
|
|
9
|
+
readonly UNSUPPORTED_ACTION: "UNSUPPORTED_ACTION";
|
|
10
|
+
readonly CONTEXT_QUERY_FAILED: "CONTEXT_QUERY_FAILED";
|
|
11
|
+
readonly ACTION_FAILED: "ACTION_FAILED";
|
|
12
|
+
};
|
|
13
|
+
export type IntegrationErrorCode = (typeof INTEGRATION_ERROR_CODES)[keyof typeof INTEGRATION_ERROR_CODES];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.INTEGRATION_ERROR_CODES = void 0;
|
|
4
|
+
exports.INTEGRATION_ERROR_CODES = {
|
|
5
|
+
NO_THREAD_CONTEXT: 'NO_THREAD_CONTEXT',
|
|
6
|
+
NO_MESSAGE_CONTEXT: 'NO_MESSAGE_CONTEXT',
|
|
7
|
+
NO_MESSAGE_CONTEXT_FOR_INTEGRATION: 'NO_MESSAGE_CONTEXT_FOR_INTEGRATION',
|
|
8
|
+
NO_INTERACTING_USER_CONTEXT: 'NO_INTERACTING_USER_CONTEXT',
|
|
9
|
+
NO_CHANNEL_CONTEXT: 'NO_CHANNEL_CONTEXT',
|
|
10
|
+
CONNECTION_NOT_AVAILABLE: 'CONNECTION_NOT_AVAILABLE',
|
|
11
|
+
UNSUPPORTED_QUERY: 'UNSUPPORTED_QUERY',
|
|
12
|
+
UNSUPPORTED_ACTION: 'UNSUPPORTED_ACTION',
|
|
13
|
+
CONTEXT_QUERY_FAILED: 'CONTEXT_QUERY_FAILED',
|
|
14
|
+
ACTION_FAILED: 'ACTION_FAILED',
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=integration-error-codes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integration-error-codes.js","sourceRoot":"","sources":["../../../../src/modules/agents/integrations/integration-error-codes.ts"],"names":[],"mappings":";;;AAAa,QAAA,uBAAuB,GAAG;IACtC,iBAAiB,EAAE,mBAAmB;IACtC,kBAAkB,EAAE,oBAAoB;IACxC,kCAAkC,EAAE,oCAAoC;IACxE,2BAA2B,EAAE,6BAA6B;IAC1D,kBAAkB,EAAE,oBAAoB;IACxC,wBAAwB,EAAE,0BAA0B;IACpD,iBAAiB,EAAE,mBAAmB;IACtC,kBAAkB,EAAE,oBAAoB;IACxC,oBAAoB,EAAE,sBAAsB;IAC5C,aAAa,EAAE,eAAe;CACrB,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type IntegrationErrorCode } from './integration-error-codes';
|
|
2
|
+
export interface IntegrationErrorResponse {
|
|
3
|
+
ok: false;
|
|
4
|
+
error: {
|
|
5
|
+
code: IntegrationErrorCode;
|
|
6
|
+
message: string;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export declare function integrationError(code: IntegrationErrorCode, message: string): IntegrationErrorResponse;
|
|
10
|
+
export declare function connectionUnavailable(): IntegrationErrorResponse;
|
|
11
|
+
export declare function unsupportedQuery(platform: string, query: string): IntegrationErrorResponse;
|
|
12
|
+
export declare function unsupportedAction(platform: string, action: string): IntegrationErrorResponse;
|
|
13
|
+
export declare function normalizePlatformId(platform: string, id: string): string;
|
|
14
|
+
export declare function isRecord(value: unknown): value is Record<string, unknown>;
|
|
15
|
+
export declare function stringValue(value: unknown): string | undefined;
|
|
16
|
+
export declare function stringProperty(value: unknown, key: string): string | undefined;
|
|
17
|
+
export declare function numberProperty(value: unknown, key: string): number | undefined;
|
|
18
|
+
export declare function booleanProperty(value: unknown, key: string): boolean | undefined;
|
|
19
|
+
export declare function isoDateProperty(value: unknown, key: string): string | undefined;
|
|
20
|
+
export declare function removeUndefinedValues<T extends Record<string, unknown>>(value: T): Record<string, unknown>;
|
|
21
|
+
export declare function isDefined<T>(value: T | undefined): value is T;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.integrationError = integrationError;
|
|
4
|
+
exports.connectionUnavailable = connectionUnavailable;
|
|
5
|
+
exports.unsupportedQuery = unsupportedQuery;
|
|
6
|
+
exports.unsupportedAction = unsupportedAction;
|
|
7
|
+
exports.normalizePlatformId = normalizePlatformId;
|
|
8
|
+
exports.isRecord = isRecord;
|
|
9
|
+
exports.stringValue = stringValue;
|
|
10
|
+
exports.stringProperty = stringProperty;
|
|
11
|
+
exports.numberProperty = numberProperty;
|
|
12
|
+
exports.booleanProperty = booleanProperty;
|
|
13
|
+
exports.isoDateProperty = isoDateProperty;
|
|
14
|
+
exports.removeUndefinedValues = removeUndefinedValues;
|
|
15
|
+
exports.isDefined = isDefined;
|
|
16
|
+
const integration_error_codes_1 = require("./integration-error-codes");
|
|
17
|
+
function integrationError(code, message) {
|
|
18
|
+
return { ok: false, error: { code, message } };
|
|
19
|
+
}
|
|
20
|
+
function connectionUnavailable() {
|
|
21
|
+
return integrationError(integration_error_codes_1.INTEGRATION_ERROR_CODES.CONNECTION_NOT_AVAILABLE, 'The integration connection is not currently available.');
|
|
22
|
+
}
|
|
23
|
+
function unsupportedQuery(platform, query) {
|
|
24
|
+
return integrationError(integration_error_codes_1.INTEGRATION_ERROR_CODES.UNSUPPORTED_QUERY, `The active ${platform} connection does not support ${query}.`);
|
|
25
|
+
}
|
|
26
|
+
function unsupportedAction(platform, action) {
|
|
27
|
+
return integrationError(integration_error_codes_1.INTEGRATION_ERROR_CODES.UNSUPPORTED_ACTION, `The active ${platform} connection does not support ${action}.`);
|
|
28
|
+
}
|
|
29
|
+
function normalizePlatformId(platform, id) {
|
|
30
|
+
return id.includes(':') ? id : `${platform}:${id}`;
|
|
31
|
+
}
|
|
32
|
+
function isRecord(value) {
|
|
33
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
34
|
+
}
|
|
35
|
+
function stringValue(value) {
|
|
36
|
+
return typeof value === 'string' && value.length > 0 ? value : undefined;
|
|
37
|
+
}
|
|
38
|
+
function stringProperty(value, key) {
|
|
39
|
+
if (!isRecord(value))
|
|
40
|
+
return undefined;
|
|
41
|
+
return stringValue(value[key]);
|
|
42
|
+
}
|
|
43
|
+
function numberProperty(value, key) {
|
|
44
|
+
if (!isRecord(value))
|
|
45
|
+
return undefined;
|
|
46
|
+
const property = value[key];
|
|
47
|
+
return typeof property === 'number' ? property : undefined;
|
|
48
|
+
}
|
|
49
|
+
function booleanProperty(value, key) {
|
|
50
|
+
if (!isRecord(value))
|
|
51
|
+
return undefined;
|
|
52
|
+
const property = value[key];
|
|
53
|
+
return typeof property === 'boolean' ? property : undefined;
|
|
54
|
+
}
|
|
55
|
+
function isoDateProperty(value, key) {
|
|
56
|
+
if (!isRecord(value))
|
|
57
|
+
return undefined;
|
|
58
|
+
const property = value[key];
|
|
59
|
+
if (property instanceof Date)
|
|
60
|
+
return property.toISOString();
|
|
61
|
+
if (typeof property !== 'string' || property.length === 0)
|
|
62
|
+
return undefined;
|
|
63
|
+
const date = new Date(property);
|
|
64
|
+
return Number.isNaN(date.getTime()) ? undefined : date.toISOString();
|
|
65
|
+
}
|
|
66
|
+
function removeUndefinedValues(value) {
|
|
67
|
+
return Object.fromEntries(Object.entries(value).filter(([, entry]) => entry !== undefined));
|
|
68
|
+
}
|
|
69
|
+
function isDefined(value) {
|
|
70
|
+
return value !== undefined;
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=integration-helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integration-helpers.js","sourceRoot":"","sources":["../../../../src/modules/agents/integrations/integration-helpers.ts"],"names":[],"mappings":";;AAUA,4CAKC;AAED,sDAKC;AAED,4CAKC;AAED,8CAKC;AAED,kDAEC;AAED,4BAEC;AAED,kCAEC;AAED,wCAGC;AAED,wCAIC;AAED,0CAIC;AAED,0CAOC;AAED,sDAIC;AAED,8BAEC;AApFD,uEAA+F;AAU/F,SAAgB,gBAAgB,CAC/B,IAA0B,EAC1B,OAAe;IAEf,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC;AAChD,CAAC;AAED,SAAgB,qBAAqB;IACpC,OAAO,gBAAgB,CACtB,iDAAuB,CAAC,wBAAwB,EAChD,wDAAwD,CACxD,CAAC;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
|
1
|
+
import { AgentResourceRepository } from '../repositories/agent-resource.repository';
|
|
2
|
+
import { AgentThreadRepository } from '../repositories/agent-thread.repository';
|
|
3
|
+
import type { IntegrationMessageContext, IntegrationMessageContextStore } from './integration-tools';
|
|
4
|
+
export declare class IntegrationMessageContextService implements IntegrationMessageContextStore {
|
|
5
|
+
private readonly threadRepository;
|
|
6
|
+
private readonly resourceRepository;
|
|
7
|
+
constructor(threadRepository: AgentThreadRepository, resourceRepository: AgentResourceRepository);
|
|
8
|
+
getLatest(threadId: string): Promise<IntegrationMessageContext | null>;
|
|
9
|
+
setLatest(threadId: string, resourceId: string, context: IntegrationMessageContext): Promise<void>;
|
|
10
|
+
private ensureResource;
|
|
11
|
+
private parseMetadata;
|
|
12
|
+
}
|
|
13
|
+
export declare function isIntegrationMessageContext(value: unknown): value is IntegrationMessageContext;
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.IntegrationMessageContextService = void 0;
|
|
13
|
+
exports.isIntegrationMessageContext = isIntegrationMessageContext;
|
|
14
|
+
const di_1 = require("@n8n/di");
|
|
15
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
16
|
+
const agent_resource_repository_1 = require("../repositories/agent-resource.repository");
|
|
17
|
+
const agent_thread_repository_1 = require("../repositories/agent-thread.repository");
|
|
18
|
+
const MESSAGE_CONTEXT_METADATA_KEY = 'currentMessageContext';
|
|
19
|
+
let IntegrationMessageContextService = class IntegrationMessageContextService {
|
|
20
|
+
constructor(threadRepository, resourceRepository) {
|
|
21
|
+
this.threadRepository = threadRepository;
|
|
22
|
+
this.resourceRepository = resourceRepository;
|
|
23
|
+
}
|
|
24
|
+
async getLatest(threadId) {
|
|
25
|
+
const thread = await this.threadRepository.findOneBy({ id: threadId });
|
|
26
|
+
const value = this.parseMetadata(thread?.metadata)[MESSAGE_CONTEXT_METADATA_KEY];
|
|
27
|
+
return isIntegrationMessageContext(value) ? value : null;
|
|
28
|
+
}
|
|
29
|
+
async setLatest(threadId, resourceId, context) {
|
|
30
|
+
const existing = await this.threadRepository.findOneBy({ id: threadId });
|
|
31
|
+
const metadata = {
|
|
32
|
+
...this.parseMetadata(existing?.metadata),
|
|
33
|
+
[MESSAGE_CONTEXT_METADATA_KEY]: context,
|
|
34
|
+
};
|
|
35
|
+
if (existing) {
|
|
36
|
+
existing.metadata = JSON.stringify(metadata);
|
|
37
|
+
await this.threadRepository.save(existing);
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
await this.ensureResource(resourceId);
|
|
41
|
+
await this.threadRepository.save(this.threadRepository.create({
|
|
42
|
+
id: threadId,
|
|
43
|
+
resourceId,
|
|
44
|
+
title: null,
|
|
45
|
+
metadata: JSON.stringify(metadata),
|
|
46
|
+
}));
|
|
47
|
+
}
|
|
48
|
+
async ensureResource(resourceId) {
|
|
49
|
+
const exists = await this.resourceRepository.existsBy({ id: resourceId });
|
|
50
|
+
if (!exists) {
|
|
51
|
+
await this.resourceRepository.save(this.resourceRepository.create({ id: resourceId, metadata: null }));
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
parseMetadata(value) {
|
|
55
|
+
if (!value)
|
|
56
|
+
return {};
|
|
57
|
+
try {
|
|
58
|
+
const parsed = (0, n8n_workflow_1.jsonParse)(value);
|
|
59
|
+
return isRecord(parsed) ? parsed : {};
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
return {};
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
exports.IntegrationMessageContextService = IntegrationMessageContextService;
|
|
67
|
+
exports.IntegrationMessageContextService = IntegrationMessageContextService = __decorate([
|
|
68
|
+
(0, di_1.Service)(),
|
|
69
|
+
__metadata("design:paramtypes", [agent_thread_repository_1.AgentThreadRepository,
|
|
70
|
+
agent_resource_repository_1.AgentResourceRepository])
|
|
71
|
+
], IntegrationMessageContextService);
|
|
72
|
+
function isRecord(value) {
|
|
73
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
74
|
+
}
|
|
75
|
+
function isIntegrationMessageContext(value) {
|
|
76
|
+
if (!value || typeof value !== 'object')
|
|
77
|
+
return false;
|
|
78
|
+
const context = value;
|
|
79
|
+
return (typeof context.integrationConnectionId === 'string' &&
|
|
80
|
+
typeof context.platform === 'string' &&
|
|
81
|
+
isIntegrationMessageTarget(context.target) &&
|
|
82
|
+
(context.messageId === undefined || typeof context.messageId === 'string') &&
|
|
83
|
+
(context.interactingUserId === undefined || typeof context.interactingUserId === 'string') &&
|
|
84
|
+
(context.agentUserId === undefined || typeof context.agentUserId === 'string') &&
|
|
85
|
+
(context.subject === undefined || isIntegrationMessageSubject(context.subject)) &&
|
|
86
|
+
typeof context.updatedAt === 'string');
|
|
87
|
+
}
|
|
88
|
+
function isIntegrationMessageSubject(value) {
|
|
89
|
+
if (!value || typeof value !== 'object')
|
|
90
|
+
return false;
|
|
91
|
+
const subject = value;
|
|
92
|
+
return (typeof subject.type === 'string' &&
|
|
93
|
+
typeof subject.id === 'string' &&
|
|
94
|
+
(subject.title === undefined || typeof subject.title === 'string') &&
|
|
95
|
+
(subject.description === undefined || typeof subject.description === 'string') &&
|
|
96
|
+
(subject.url === undefined || typeof subject.url === 'string') &&
|
|
97
|
+
(subject.status === undefined || typeof subject.status === 'string') &&
|
|
98
|
+
(subject.labels === undefined ||
|
|
99
|
+
(Array.isArray(subject.labels) &&
|
|
100
|
+
subject.labels.every((label) => typeof label === 'string'))) &&
|
|
101
|
+
(subject.assignee === undefined || isIntegrationSubjectPerson(subject.assignee)) &&
|
|
102
|
+
(subject.author === undefined || isIntegrationSubjectPerson(subject.author)));
|
|
103
|
+
}
|
|
104
|
+
function isIntegrationSubjectPerson(value) {
|
|
105
|
+
if (!value || typeof value !== 'object')
|
|
106
|
+
return false;
|
|
107
|
+
const person = value;
|
|
108
|
+
return typeof person.id === 'string' && typeof person.name === 'string';
|
|
109
|
+
}
|
|
110
|
+
function isIntegrationMessageTarget(value) {
|
|
111
|
+
if (!value || typeof value !== 'object')
|
|
112
|
+
return false;
|
|
113
|
+
const target = value;
|
|
114
|
+
if (target.type === 'thread') {
|
|
115
|
+
return (typeof target.threadId === 'string' &&
|
|
116
|
+
(target.channelId === undefined || typeof target.channelId === 'string') &&
|
|
117
|
+
(target.userId === undefined || typeof target.userId === 'string'));
|
|
118
|
+
}
|
|
119
|
+
if (target.type === 'channel') {
|
|
120
|
+
return (typeof target.channelId === 'string' &&
|
|
121
|
+
(target.threadId === undefined || typeof target.threadId === 'string'));
|
|
122
|
+
}
|
|
123
|
+
if (target.type === 'dm') {
|
|
124
|
+
return (typeof target.userId === 'string' &&
|
|
125
|
+
(target.threadId === undefined || typeof target.threadId === 'string'));
|
|
126
|
+
}
|
|
127
|
+
return false;
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=integration-message-context.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integration-message-context.service.js","sourceRoot":"","sources":["../../../../src/modules/agents/integrations/integration-message-context.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAgFA,kEAaC;AA7FD,gCAAkC;AAClC,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