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
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Logger } from '@n8n/backend-common';
|
|
2
|
-
import { AgentExecution } from './entities/agent-execution.entity';
|
|
3
2
|
import { AgentExecutionThread } from './entities/agent-execution-thread.entity';
|
|
3
|
+
import { AgentExecution } from './entities/agent-execution.entity';
|
|
4
4
|
import type { MessageRecord } from './execution-recorder';
|
|
5
5
|
import { N8nMemory } from './integrations/n8n-memory';
|
|
6
|
-
import { AgentExecutionRepository } from './repositories/agent-execution.repository';
|
|
7
6
|
import { AgentExecutionThreadRepository } from './repositories/agent-execution-thread.repository';
|
|
7
|
+
import { AgentExecutionRepository } from './repositories/agent-execution.repository';
|
|
8
8
|
export interface RecordMessageParams {
|
|
9
9
|
threadId: string;
|
|
10
10
|
agentId: string;
|
|
@@ -14,6 +14,8 @@ export interface RecordMessageParams {
|
|
|
14
14
|
record: MessageRecord;
|
|
15
15
|
hitlStatus?: 'suspended' | 'resumed';
|
|
16
16
|
source?: string;
|
|
17
|
+
taskId?: string;
|
|
18
|
+
taskVersionId?: string;
|
|
17
19
|
}
|
|
18
20
|
export interface ThreadDetail {
|
|
19
21
|
thread: AgentExecutionThread;
|
|
@@ -14,8 +14,8 @@ exports.threadBelongsTo = threadBelongsTo;
|
|
|
14
14
|
const backend_common_1 = require("@n8n/backend-common");
|
|
15
15
|
const di_1 = require("@n8n/di");
|
|
16
16
|
const n8n_memory_1 = require("./integrations/n8n-memory");
|
|
17
|
-
const agent_execution_repository_1 = require("./repositories/agent-execution.repository");
|
|
18
17
|
const agent_execution_thread_repository_1 = require("./repositories/agent-execution-thread.repository");
|
|
18
|
+
const agent_execution_repository_1 = require("./repositories/agent-execution.repository");
|
|
19
19
|
let AgentExecutionService = class AgentExecutionService {
|
|
20
20
|
constructor(logger, agentExecutionRepository, agentExecutionThreadRepository, n8nMemory) {
|
|
21
21
|
this.logger = logger;
|
|
@@ -24,8 +24,8 @@ let AgentExecutionService = class AgentExecutionService {
|
|
|
24
24
|
this.n8nMemory = n8nMemory;
|
|
25
25
|
}
|
|
26
26
|
async recordMessage(params) {
|
|
27
|
-
const { threadId, agentId, agentName, projectId, record, source, hitlStatus } = params;
|
|
28
|
-
const { thread, created } = await this.agentExecutionThreadRepository.findOrCreate(threadId, agentId, agentName, projectId);
|
|
27
|
+
const { threadId, agentId, agentName, projectId, record, source, hitlStatus, taskId, taskVersionId, } = params;
|
|
28
|
+
const { thread, created } = await this.agentExecutionThreadRepository.findOrCreate(threadId, agentId, agentName, projectId, taskId, taskVersionId);
|
|
29
29
|
if (!created) {
|
|
30
30
|
await this.agentExecutionThreadRepository.bumpUpdatedAt(threadId);
|
|
31
31
|
if (!thread.title) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-execution.service.js","sourceRoot":"","sources":["../../../src/modules/agents/agent-execution.service.ts"],"names":[],"mappings":";;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"agent-execution.service.js","sourceRoot":"","sources":["../../../src/modules/agents/agent-execution.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AA0QA,0CAQC;AAlRD,wDAA6C;AAC7C,gCAAkC;AAKlC,0DAAsD;AACtD,wGAAkG;AAClG,0FAAqF;AA6B9E,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IACjC,YACkB,MAAc,EACd,wBAAkD,EAClD,8BAA8D,EAC9D,SAAoB;QAHpB,WAAM,GAAN,MAAM,CAAQ;QACd,6BAAwB,GAAxB,wBAAwB,CAA0B;QAClD,mCAA8B,GAA9B,8BAA8B,CAAgC;QAC9D,cAAS,GAAT,SAAS,CAAW;IACnC,CAAC;IAMJ,KAAK,CAAC,aAAa,CAAC,MAA2B;QAC9C,MAAM,EACL,QAAQ,EACR,OAAO,EACP,SAAS,EACT,SAAS,EACT,MAAM,EACN,MAAM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MAAM,IAAI,CAAC,8BAA8B,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC;QACrF,IAAI,CAAC,MAAM,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC;YAAE,OAAO,IAAI,CAAC;QAEzE,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,wBAAwB,CAAC,qBAAqB,CAAC,QAAQ,CAAC,CAAC;QACvF,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC;IAC/B,CAAC;IAOD,KAAK,CAAC,cAAc,CAAC,QAAgB;QACpC,OAAO,MAAM,IAAI,CAAC,8BAA8B,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC;IAC9E,CAAC;CACD,CAAA;AA9NY,sDAAqB;gCAArB,qBAAqB;IADjC,IAAA,YAAO,GAAE;qCAGiB,uBAAM;QACY,qDAAwB;QAClB,kEAA8B;QACnD,sBAAS;GAL1B,qBAAqB,CA8NjC;AAOD,SAAgB,eAAe,CAC9B,MAA4B,EAC5B,SAAiB,EACjB,OAAgB;IAEhB,IAAI,MAAM,CAAC,SAAS,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IACjD,IAAI,OAAO,IAAI,MAAM,CAAC,OAAO,KAAK,OAAO;QAAE,OAAO,KAAK,CAAC;IACxD,OAAO,IAAI,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export declare const AGENT_KNOWLEDGE_COMMANDS: readonly ["git_grep", "cat", "sed"];
|
|
2
|
+
export type AgentKnowledgeCommand = (typeof AGENT_KNOWLEDGE_COMMANDS)[number];
|
|
3
|
+
export type AgentKnowledgeCommandRequest = {
|
|
4
|
+
command: 'git_grep';
|
|
5
|
+
pattern: string;
|
|
6
|
+
outputMode?: 'count';
|
|
7
|
+
caseInsensitive?: boolean;
|
|
8
|
+
fixedStrings?: boolean;
|
|
9
|
+
context?: number;
|
|
10
|
+
files?: string[];
|
|
11
|
+
} | {
|
|
12
|
+
command: 'cat';
|
|
13
|
+
file: string;
|
|
14
|
+
} | {
|
|
15
|
+
command: 'sed';
|
|
16
|
+
file: string;
|
|
17
|
+
startLine: number;
|
|
18
|
+
endLine: number;
|
|
19
|
+
};
|
|
20
|
+
export interface AgentKnowledgeCommandResult {
|
|
21
|
+
command: AgentKnowledgeCommand;
|
|
22
|
+
exitCode: number | null;
|
|
23
|
+
stdout: string;
|
|
24
|
+
stderr: string;
|
|
25
|
+
truncated: boolean;
|
|
26
|
+
}
|
|
27
|
+
export declare class AgentKnowledgeCommandService {
|
|
28
|
+
private readonly cachedWorkspaces;
|
|
29
|
+
private readonly workspaceLocks;
|
|
30
|
+
run(workspaceRoot: string, request: AgentKnowledgeCommandRequest): Promise<AgentKnowledgeCommandResult>;
|
|
31
|
+
withCachedWorkspace<T>(cacheKey: string, materialize: (workspaceRoot: string) => Promise<void>, operation: (workspaceRoot: string) => Promise<T>): Promise<T>;
|
|
32
|
+
private serializeByKey;
|
|
33
|
+
private ensureCachedWorkspace;
|
|
34
|
+
private evictStaleWorkspaces;
|
|
35
|
+
private directoryExists;
|
|
36
|
+
private toSpawnArgs;
|
|
37
|
+
private safePath;
|
|
38
|
+
private hasControlCharacters;
|
|
39
|
+
private spawnCommand;
|
|
40
|
+
}
|
|
@@ -0,0 +1,221 @@
|
|
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.AgentKnowledgeCommandService = exports.AGENT_KNOWLEDGE_COMMANDS = void 0;
|
|
13
|
+
const di_1 = require("@n8n/di");
|
|
14
|
+
const node_child_process_1 = require("node:child_process");
|
|
15
|
+
const promises_1 = require("node:fs/promises");
|
|
16
|
+
const node_os_1 = require("node:os");
|
|
17
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
18
|
+
const p_limit_1 = __importDefault(require("p-limit"));
|
|
19
|
+
const MAX_OUTPUT_BYTES = 64 * 1024;
|
|
20
|
+
const COMMAND_TIMEOUT_MS = 5_000;
|
|
21
|
+
const MAX_CONCURRENT_WORKSPACES = 4;
|
|
22
|
+
const WORKSPACE_CACHE_TTL_MS = 10 * 60_000;
|
|
23
|
+
const MAX_CACHED_WORKSPACES = 25;
|
|
24
|
+
exports.AGENT_KNOWLEDGE_COMMANDS = ['git_grep', 'cat', 'sed'];
|
|
25
|
+
const workspaceLimit = (0, p_limit_1.default)(MAX_CONCURRENT_WORKSPACES);
|
|
26
|
+
let AgentKnowledgeCommandService = class AgentKnowledgeCommandService {
|
|
27
|
+
constructor() {
|
|
28
|
+
this.cachedWorkspaces = new Map();
|
|
29
|
+
this.workspaceLocks = new Map();
|
|
30
|
+
}
|
|
31
|
+
async run(workspaceRoot, request) {
|
|
32
|
+
const root = await (0, promises_1.realpath)(workspaceRoot);
|
|
33
|
+
const { executable, args } = await this.toSpawnArgs(root, request);
|
|
34
|
+
return await this.spawnCommand(root, executable, args, request.command);
|
|
35
|
+
}
|
|
36
|
+
async withCachedWorkspace(cacheKey, materialize, operation) {
|
|
37
|
+
return await this.serializeByKey(cacheKey, async () => await workspaceLimit(async () => {
|
|
38
|
+
const workspaceRoot = await this.ensureCachedWorkspace(cacheKey, materialize);
|
|
39
|
+
return await operation(workspaceRoot);
|
|
40
|
+
}));
|
|
41
|
+
}
|
|
42
|
+
async serializeByKey(key, fn) {
|
|
43
|
+
const previous = this.workspaceLocks.get(key) ?? Promise.resolve();
|
|
44
|
+
const run = previous.then(fn, fn);
|
|
45
|
+
const tail = run.then(() => undefined, () => undefined);
|
|
46
|
+
this.workspaceLocks.set(key, tail);
|
|
47
|
+
try {
|
|
48
|
+
return await run;
|
|
49
|
+
}
|
|
50
|
+
finally {
|
|
51
|
+
if (this.workspaceLocks.get(key) === tail)
|
|
52
|
+
this.workspaceLocks.delete(key);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
async ensureCachedWorkspace(cacheKey, materialize) {
|
|
56
|
+
const existing = this.cachedWorkspaces.get(cacheKey);
|
|
57
|
+
if (existing && (await this.directoryExists(existing.root))) {
|
|
58
|
+
existing.lastUsedAt = Date.now();
|
|
59
|
+
return existing.root;
|
|
60
|
+
}
|
|
61
|
+
if (existing)
|
|
62
|
+
this.cachedWorkspaces.delete(cacheKey);
|
|
63
|
+
const workspaceRoot = await (0, promises_1.mkdtemp)(node_path_1.default.join((0, node_os_1.tmpdir)(), 'n8n-agent-knowledge-'));
|
|
64
|
+
try {
|
|
65
|
+
await materialize(workspaceRoot);
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
await (0, promises_1.rm)(workspaceRoot, { recursive: true, force: true }).catch(() => { });
|
|
69
|
+
throw error;
|
|
70
|
+
}
|
|
71
|
+
this.cachedWorkspaces.set(cacheKey, { root: workspaceRoot, lastUsedAt: Date.now() });
|
|
72
|
+
await this.evictStaleWorkspaces();
|
|
73
|
+
return workspaceRoot;
|
|
74
|
+
}
|
|
75
|
+
async evictStaleWorkspaces() {
|
|
76
|
+
const now = Date.now();
|
|
77
|
+
const evictable = [];
|
|
78
|
+
const fresh = [];
|
|
79
|
+
for (const entry of this.cachedWorkspaces) {
|
|
80
|
+
(now - entry[1].lastUsedAt > WORKSPACE_CACHE_TTL_MS ? evictable : fresh).push(entry);
|
|
81
|
+
}
|
|
82
|
+
if (fresh.length > MAX_CACHED_WORKSPACES) {
|
|
83
|
+
fresh.sort((left, right) => left[1].lastUsedAt - right[1].lastUsedAt);
|
|
84
|
+
evictable.push(...fresh.slice(0, fresh.length - MAX_CACHED_WORKSPACES));
|
|
85
|
+
}
|
|
86
|
+
for (const [key, workspace] of evictable) {
|
|
87
|
+
this.cachedWorkspaces.delete(key);
|
|
88
|
+
await (0, promises_1.rm)(workspace.root, { recursive: true, force: true }).catch(() => { });
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
async directoryExists(directory) {
|
|
92
|
+
try {
|
|
93
|
+
await (0, promises_1.realpath)(directory);
|
|
94
|
+
return true;
|
|
95
|
+
}
|
|
96
|
+
catch {
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
async toSpawnArgs(root, request) {
|
|
101
|
+
switch (request.command) {
|
|
102
|
+
case 'git_grep': {
|
|
103
|
+
if (request.pattern.trim() === '')
|
|
104
|
+
throw new Error('Search pattern is required');
|
|
105
|
+
const args = ['grep', '--no-index', '-n', '-I'];
|
|
106
|
+
if (request.caseInsensitive)
|
|
107
|
+
args.push('-i');
|
|
108
|
+
if (request.fixedStrings)
|
|
109
|
+
args.push('-F');
|
|
110
|
+
if (request.fixedStrings === false)
|
|
111
|
+
args.push('-E');
|
|
112
|
+
if (request.outputMode === 'count')
|
|
113
|
+
args.push('-c');
|
|
114
|
+
if (request.context !== undefined) {
|
|
115
|
+
args.push('-C', String(Math.min(Math.max(request.context, 0), 5)));
|
|
116
|
+
}
|
|
117
|
+
args.push('--', request.pattern);
|
|
118
|
+
const files = await Promise.all((request.files ?? ['.']).map(async (file) => await this.safePath(root, file, { allowRoot: true })));
|
|
119
|
+
args.push(...files.map((file) => node_path_1.default.relative(root, file) || '.'));
|
|
120
|
+
return { executable: 'git', args };
|
|
121
|
+
}
|
|
122
|
+
case 'cat': {
|
|
123
|
+
const file = await this.safePath(root, request.file);
|
|
124
|
+
return { executable: 'cat', args: [node_path_1.default.relative(root, file)] };
|
|
125
|
+
}
|
|
126
|
+
case 'sed': {
|
|
127
|
+
const file = await this.safePath(root, request.file);
|
|
128
|
+
const startLine = Math.max(1, request.startLine);
|
|
129
|
+
const endLine = Math.max(startLine, request.endLine);
|
|
130
|
+
return {
|
|
131
|
+
executable: 'sed',
|
|
132
|
+
args: [
|
|
133
|
+
'-n',
|
|
134
|
+
`${startLine},${Math.min(endLine, startLine + 500)}p`,
|
|
135
|
+
node_path_1.default.relative(root, file),
|
|
136
|
+
],
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
async safePath(root, requestedPath, options = {}) {
|
|
142
|
+
if (this.hasControlCharacters(requestedPath))
|
|
143
|
+
throw new Error('Invalid path');
|
|
144
|
+
if (node_path_1.default.isAbsolute(requestedPath))
|
|
145
|
+
throw new Error('Absolute paths are not allowed');
|
|
146
|
+
if (requestedPath.split(/[\\/]/).includes('..')) {
|
|
147
|
+
throw new Error('Parent path segments are not allowed');
|
|
148
|
+
}
|
|
149
|
+
const resolved = node_path_1.default.resolve(root, requestedPath);
|
|
150
|
+
const actual = await (0, promises_1.realpath)(resolved);
|
|
151
|
+
const relative = node_path_1.default.relative(root, actual);
|
|
152
|
+
if ((!options.allowRoot && relative === '') ||
|
|
153
|
+
relative.startsWith('..') ||
|
|
154
|
+
node_path_1.default.isAbsolute(relative)) {
|
|
155
|
+
throw new Error('Path escapes the knowledge workspace');
|
|
156
|
+
}
|
|
157
|
+
return actual;
|
|
158
|
+
}
|
|
159
|
+
hasControlCharacters(value) {
|
|
160
|
+
for (const character of value) {
|
|
161
|
+
const code = character.charCodeAt(0);
|
|
162
|
+
if (code <= 0x1f || code === 0x7f)
|
|
163
|
+
return true;
|
|
164
|
+
}
|
|
165
|
+
return false;
|
|
166
|
+
}
|
|
167
|
+
async spawnCommand(cwd, executable, args, command) {
|
|
168
|
+
return await new Promise((resolve, reject) => {
|
|
169
|
+
const child = (0, node_child_process_1.spawn)(executable, args, {
|
|
170
|
+
cwd,
|
|
171
|
+
shell: false,
|
|
172
|
+
env: {
|
|
173
|
+
PATH: process.env.PATH,
|
|
174
|
+
HOME: cwd,
|
|
175
|
+
GIT_CONFIG_NOSYSTEM: '1',
|
|
176
|
+
GIT_CONFIG_GLOBAL: '/dev/null',
|
|
177
|
+
GIT_TERMINAL_PROMPT: '0',
|
|
178
|
+
},
|
|
179
|
+
});
|
|
180
|
+
let stdout = '';
|
|
181
|
+
let stderr = '';
|
|
182
|
+
let truncated = false;
|
|
183
|
+
const timer = setTimeout(() => {
|
|
184
|
+
child.kill('SIGKILL');
|
|
185
|
+
truncated = true;
|
|
186
|
+
}, COMMAND_TIMEOUT_MS);
|
|
187
|
+
const append = (current, chunk) => {
|
|
188
|
+
const next = Buffer.concat([Buffer.from(current, 'utf8'), chunk]);
|
|
189
|
+
if (next.length > MAX_OUTPUT_BYTES) {
|
|
190
|
+
truncated = true;
|
|
191
|
+
return truncateBufferToUtf8String(next, MAX_OUTPUT_BYTES);
|
|
192
|
+
}
|
|
193
|
+
return next.toString('utf8');
|
|
194
|
+
};
|
|
195
|
+
child.stdout.on('data', (chunk) => {
|
|
196
|
+
stdout = append(stdout, chunk);
|
|
197
|
+
});
|
|
198
|
+
child.stderr.on('data', (chunk) => {
|
|
199
|
+
stderr = append(stderr, chunk);
|
|
200
|
+
});
|
|
201
|
+
child.on('error', reject);
|
|
202
|
+
child.on('close', (exitCode) => {
|
|
203
|
+
clearTimeout(timer);
|
|
204
|
+
resolve({ command, exitCode, stdout, stderr, truncated });
|
|
205
|
+
});
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
exports.AgentKnowledgeCommandService = AgentKnowledgeCommandService;
|
|
210
|
+
exports.AgentKnowledgeCommandService = AgentKnowledgeCommandService = __decorate([
|
|
211
|
+
(0, di_1.Service)()
|
|
212
|
+
], AgentKnowledgeCommandService);
|
|
213
|
+
function truncateBufferToUtf8String(buffer, maxBytes) {
|
|
214
|
+
for (let end = maxBytes; end >= 0; end--) {
|
|
215
|
+
const output = buffer.subarray(0, end).toString('utf8');
|
|
216
|
+
if (Buffer.byteLength(output) <= maxBytes)
|
|
217
|
+
return output;
|
|
218
|
+
}
|
|
219
|
+
return '';
|
|
220
|
+
}
|
|
221
|
+
//# sourceMappingURL=agent-knowledge-command.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-knowledge-command.service.js","sourceRoot":"","sources":["../../../src/modules/agents/agent-knowledge-command.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gCAAkC;AAClC,2DAA2C;AAC3C,+CAAyD;AACzD,qCAAiC;AACjC,0DAA6B;AAC7B,sDAA6B;AAE7B,MAAM,gBAAgB,GAAG,EAAE,GAAG,IAAI,CAAC;AACnC,MAAM,kBAAkB,GAAG,KAAK,CAAC;AAMjC,MAAM,yBAAyB,GAAG,CAAC,CAAC;AAEpC,MAAM,sBAAsB,GAAG,EAAE,GAAG,MAAM,CAAC;AAE3C,MAAM,qBAAqB,GAAG,EAAE,CAAC;AACpB,QAAA,wBAAwB,GAAG,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,CAAU,CAAC;AAG5E,MAAM,cAAc,GAAG,IAAA,iBAAM,EAAC,yBAAyB,CAAC,CAAC;AAyClD,IAAM,4BAA4B,GAAlC,MAAM,4BAA4B;IAAlC;QACW,qBAAgB,GAAG,IAAI,GAAG,EAA2B,CAAC;QACtD,mBAAc,GAAG,IAAI,GAAG,EAA4B,CAAC;IA0NvE,CAAC;IAxNA,KAAK,CAAC,GAAG,CAAC,aAAqB,EAAE,OAAqC;QACrE,MAAM,IAAI,GAAG,MAAM,IAAA,mBAAQ,EAAC,aAAa,CAAC,CAAC;QAC3C,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,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MAAM,CAAC,CAAC;YAC1B,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,EAAE;gBAC9B,YAAY,CAAC,KAAK,CAAC,CAAC;gBACpB,OAAO,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC;YAC3D,CAAC,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;IACJ,CAAC;CACD,CAAA;AA5NY,oEAA4B;uCAA5B,4BAA4B;IADxC,IAAA,YAAO,GAAE;GACG,4BAA4B,CA4NxC;AAED,SAAS,0BAA0B,CAAC,MAAc,EAAE,QAAgB;IACnE,KAAK,IAAI,GAAG,GAAG,QAAQ,EAAE,GAAG,IAAI,CAAC,EAAE,GAAG,EAAE,EAAE,CAAC;QAC1C,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QACxD,IAAI,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,QAAQ;YAAE,OAAO,MAAM,CAAC;IAC1D,CAAC;IAED,OAAO,EAAE,CAAC;AACX,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { AgentFileDto } from '@n8n/api-types';
|
|
2
|
+
import { BinaryDataService } from 'n8n-core';
|
|
3
|
+
import { AgentFileRepository } from './repositories/agent-file.repository';
|
|
4
|
+
import { AgentRepository } from './repositories/agent.repository';
|
|
5
|
+
export interface KnowledgeWorkspaceFile {
|
|
6
|
+
id: string;
|
|
7
|
+
fileName: string;
|
|
8
|
+
mimeType: string;
|
|
9
|
+
fileSizeBytes: number;
|
|
10
|
+
relativePath: string;
|
|
11
|
+
}
|
|
12
|
+
interface MaterializeWorkspaceOptions {
|
|
13
|
+
fileReferences?: string[];
|
|
14
|
+
}
|
|
15
|
+
export declare class AgentKnowledgeService {
|
|
16
|
+
private readonly agentRepository;
|
|
17
|
+
private readonly agentFileRepository;
|
|
18
|
+
private readonly binaryDataService;
|
|
19
|
+
constructor(agentRepository: AgentRepository, agentFileRepository: AgentFileRepository, binaryDataService: BinaryDataService);
|
|
20
|
+
uploadFiles(agentId: string, projectId: string, files: Express.Multer.File[]): Promise<AgentFileDto[]>;
|
|
21
|
+
listFiles(agentId: string, projectId: string): Promise<AgentFileDto[]>;
|
|
22
|
+
listWorkspaceFiles(agentId: string, projectId: string): Promise<KnowledgeWorkspaceFile[]>;
|
|
23
|
+
deleteFile(agentId: string, projectId: string, fileId: string): Promise<void>;
|
|
24
|
+
deleteAllFilesForAgent(agentId: string): Promise<void>;
|
|
25
|
+
resolveWorkspaceFiles(agentId: string, projectId: string, fileReferences?: string[]): Promise<KnowledgeWorkspaceFile[]>;
|
|
26
|
+
materializeWorkspace(agentId: string, projectId: string, workspaceRoot: string, options?: MaterializeWorkspaceOptions): Promise<KnowledgeWorkspaceFile[]>;
|
|
27
|
+
private ensureAgentBelongsToProject;
|
|
28
|
+
private storeFile;
|
|
29
|
+
private toDto;
|
|
30
|
+
private toWorkspaceFile;
|
|
31
|
+
private assertWorkspaceWithinLimits;
|
|
32
|
+
private filterFilesForWorkspace;
|
|
33
|
+
private getWorkspaceRelativePath;
|
|
34
|
+
private prepareStoredContent;
|
|
35
|
+
private isPdf;
|
|
36
|
+
private extractPdfText;
|
|
37
|
+
private validateMetadataLength;
|
|
38
|
+
private cleanupStoredFiles;
|
|
39
|
+
private cleanupUploadTempFiles;
|
|
40
|
+
private cleanupUploadTempFile;
|
|
41
|
+
}
|
|
42
|
+
export {};
|