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,332 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.runInternalCommand = runInternalCommand;
|
|
4
|
+
exports.runSearchOperation = runSearchOperation;
|
|
5
|
+
const file_references_1 = require("./file-references");
|
|
6
|
+
const DEFAULT_READ_RANGE_CONTEXT = 6;
|
|
7
|
+
const MAX_SEARCH_MATCH_TEXT_LENGTH = 500;
|
|
8
|
+
const MULTI_QUERY_WINDOW_LINES = 3;
|
|
9
|
+
async function runInternalCommand(commandService, workspaceRoot, request) {
|
|
10
|
+
const result = await commandService.run(workspaceRoot, request);
|
|
11
|
+
return { ...result, command: request.command };
|
|
12
|
+
}
|
|
13
|
+
async function runSearchOperation(input, workspaceRoot, files, commandService) {
|
|
14
|
+
if (input.query === undefined && input.queries === undefined) {
|
|
15
|
+
return {
|
|
16
|
+
operation: 'search',
|
|
17
|
+
files,
|
|
18
|
+
error: 'Either query or queries must be provided for search.',
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
const requestedFiles = (0, file_references_1.mapFileReferences)(files, input.files);
|
|
22
|
+
const primaryPattern = getPrimarySearchPattern(input);
|
|
23
|
+
const commandPattern = getSearchCommandPattern(input);
|
|
24
|
+
const commandFixedStrings = getSearchCommandFixedStrings(input);
|
|
25
|
+
let contentResult;
|
|
26
|
+
const countResult = await runInternalCommand(commandService, workspaceRoot, {
|
|
27
|
+
command: 'git_grep',
|
|
28
|
+
pattern: commandPattern,
|
|
29
|
+
outputMode: 'count',
|
|
30
|
+
caseInsensitive: input.caseInsensitive,
|
|
31
|
+
fixedStrings: commandFixedStrings,
|
|
32
|
+
files: requestedFiles,
|
|
33
|
+
});
|
|
34
|
+
let counts = parseCountOutput(countResult.stdout, files);
|
|
35
|
+
let multiQueryMatches;
|
|
36
|
+
if (input.queries) {
|
|
37
|
+
contentResult = await runInternalCommand(commandService, workspaceRoot, {
|
|
38
|
+
command: 'git_grep',
|
|
39
|
+
pattern: commandPattern,
|
|
40
|
+
caseInsensitive: input.caseInsensitive,
|
|
41
|
+
fixedStrings: commandFixedStrings,
|
|
42
|
+
context: input.context,
|
|
43
|
+
files: requestedFiles,
|
|
44
|
+
});
|
|
45
|
+
multiQueryMatches = filterMultiQueryMatches(parseSearchMatches(contentResult.stdout, files), input.queries, input.match_mode, input.caseInsensitive);
|
|
46
|
+
counts = buildCountsFromMatches(multiQueryMatches, files);
|
|
47
|
+
}
|
|
48
|
+
if (input.output_mode === 'files_with_matches') {
|
|
49
|
+
const slicedCounts = sliceResults(counts, input.offset, input.head_limit);
|
|
50
|
+
return {
|
|
51
|
+
operation: 'search',
|
|
52
|
+
files,
|
|
53
|
+
result: toDisplayResult(countResult, formatSearchFiles(counts, input.offset, input.head_limit), slicedCounts.truncated),
|
|
54
|
+
search: buildSearchResult({
|
|
55
|
+
mode: input.output_mode,
|
|
56
|
+
query: primaryPattern,
|
|
57
|
+
queries: input.queries,
|
|
58
|
+
matchMode: input.queries ? input.match_mode : undefined,
|
|
59
|
+
counts,
|
|
60
|
+
matches: [],
|
|
61
|
+
offset: input.offset,
|
|
62
|
+
headLimit: input.head_limit,
|
|
63
|
+
hint: buildSearchHint('files_with_matches', slicedCounts, input.head_limit),
|
|
64
|
+
}),
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
if (input.output_mode === 'count') {
|
|
68
|
+
const slicedCounts = sliceResults(counts, input.offset, input.head_limit);
|
|
69
|
+
return {
|
|
70
|
+
operation: 'search',
|
|
71
|
+
files,
|
|
72
|
+
result: toDisplayResult(countResult, formatSearchCounts(counts, input.offset, input.head_limit), slicedCounts.truncated),
|
|
73
|
+
search: buildSearchResult({
|
|
74
|
+
mode: input.output_mode,
|
|
75
|
+
query: primaryPattern,
|
|
76
|
+
queries: input.queries,
|
|
77
|
+
matchMode: input.queries ? input.match_mode : undefined,
|
|
78
|
+
counts,
|
|
79
|
+
matches: [],
|
|
80
|
+
offset: input.offset,
|
|
81
|
+
headLimit: input.head_limit,
|
|
82
|
+
hint: buildSearchHint('count', slicedCounts, input.head_limit),
|
|
83
|
+
}),
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
contentResult ??= await runInternalCommand(commandService, workspaceRoot, {
|
|
87
|
+
command: 'git_grep',
|
|
88
|
+
pattern: commandPattern,
|
|
89
|
+
caseInsensitive: input.caseInsensitive,
|
|
90
|
+
fixedStrings: commandFixedStrings,
|
|
91
|
+
context: input.context,
|
|
92
|
+
files: requestedFiles,
|
|
93
|
+
});
|
|
94
|
+
const parsedMatches = parseSearchMatches(contentResult.stdout, files);
|
|
95
|
+
const matches = multiQueryMatches ?? parsedMatches;
|
|
96
|
+
const slicedMatches = sliceResults(matches, input.offset, input.head_limit);
|
|
97
|
+
const displayMatches = slicedMatches.items.map(toSearchMatchOutput);
|
|
98
|
+
const search = buildSearchResult({
|
|
99
|
+
mode: input.output_mode,
|
|
100
|
+
query: primaryPattern,
|
|
101
|
+
queries: input.queries,
|
|
102
|
+
matchMode: input.queries ? input.match_mode : undefined,
|
|
103
|
+
counts,
|
|
104
|
+
matches: displayMatches,
|
|
105
|
+
offset: input.offset,
|
|
106
|
+
headLimit: input.head_limit,
|
|
107
|
+
nextOffset: slicedMatches.nextOffset,
|
|
108
|
+
hint: buildSearchHint('content', slicedMatches, input.head_limit),
|
|
109
|
+
});
|
|
110
|
+
return {
|
|
111
|
+
operation: 'search',
|
|
112
|
+
files,
|
|
113
|
+
result: toDisplayResult(contentResult, formatSearchMatches(displayMatches, slicedMatches, input.head_limit), search.truncated || contentResult.truncated),
|
|
114
|
+
search,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
function toDisplayResult(result, stdout, truncated = false) {
|
|
118
|
+
return {
|
|
119
|
+
...result,
|
|
120
|
+
stdout,
|
|
121
|
+
truncated: result.truncated || truncated,
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
function parseCountOutput(stdout, files) {
|
|
125
|
+
const byRelativePath = new Map(files.map((file) => [file.relativePath, file]));
|
|
126
|
+
const counts = stdout
|
|
127
|
+
.split('\n')
|
|
128
|
+
.flatMap((line) => {
|
|
129
|
+
if (line.trim() === '')
|
|
130
|
+
return [];
|
|
131
|
+
const separatorIndex = line.lastIndexOf(':');
|
|
132
|
+
if (separatorIndex === -1)
|
|
133
|
+
return [];
|
|
134
|
+
const relativePath = normaliseGrepPath(line.slice(0, separatorIndex));
|
|
135
|
+
const matchCount = Number(line.slice(separatorIndex + 1));
|
|
136
|
+
const file = byRelativePath.get(relativePath);
|
|
137
|
+
if (!file || !Number.isFinite(matchCount) || matchCount <= 0)
|
|
138
|
+
return [];
|
|
139
|
+
return [
|
|
140
|
+
{
|
|
141
|
+
id: file.id,
|
|
142
|
+
fileName: file.fileName,
|
|
143
|
+
relativePath: file.relativePath,
|
|
144
|
+
matchCount,
|
|
145
|
+
},
|
|
146
|
+
];
|
|
147
|
+
})
|
|
148
|
+
.sort((left, right) => right.matchCount - left.matchCount);
|
|
149
|
+
return counts;
|
|
150
|
+
}
|
|
151
|
+
function parseSearchMatches(stdout, files) {
|
|
152
|
+
const byRelativePath = new Map(files.map((file) => [file.relativePath, file]));
|
|
153
|
+
return stdout.split('\n').flatMap((line) => {
|
|
154
|
+
const parsed = parseGrepLine(line);
|
|
155
|
+
if (!parsed?.isMatch)
|
|
156
|
+
return [];
|
|
157
|
+
const file = byRelativePath.get(normaliseGrepPath(parsed.filePath));
|
|
158
|
+
if (!file || parsed.lineNumber === undefined)
|
|
159
|
+
return [];
|
|
160
|
+
const fullText = line.slice(parsed.contentStartIndex);
|
|
161
|
+
const { text, truncated } = truncateMatchText(fullText);
|
|
162
|
+
return [
|
|
163
|
+
{
|
|
164
|
+
fileId: file.id,
|
|
165
|
+
fileName: file.fileName,
|
|
166
|
+
relativePath: file.relativePath,
|
|
167
|
+
lineNumber: parsed.lineNumber,
|
|
168
|
+
fullText,
|
|
169
|
+
text,
|
|
170
|
+
readRange: toReadRange(parsed.lineNumber),
|
|
171
|
+
truncated,
|
|
172
|
+
},
|
|
173
|
+
];
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
function toSearchMatchOutput({ fullText: _fullText, ...match }) {
|
|
177
|
+
return match;
|
|
178
|
+
}
|
|
179
|
+
function truncateMatchText(text) {
|
|
180
|
+
if (text.length <= MAX_SEARCH_MATCH_TEXT_LENGTH)
|
|
181
|
+
return { text };
|
|
182
|
+
return {
|
|
183
|
+
text: `${text.slice(0, MAX_SEARCH_MATCH_TEXT_LENGTH)}... [line truncated; use read for full text]`,
|
|
184
|
+
truncated: true,
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
function filterMultiQueryMatches(matches, queries, matchMode, caseInsensitive) {
|
|
188
|
+
const normalizedQueries = queries.map((query) => normalizeSearchText(query, caseInsensitive));
|
|
189
|
+
if (matchMode === 'any') {
|
|
190
|
+
return matches.filter((match) => normalizedQueries.some((query) => normalizeSearchText(match.fullText, caseInsensitive).includes(query)));
|
|
191
|
+
}
|
|
192
|
+
if (matchMode === 'all_on_same_line') {
|
|
193
|
+
return matches.filter((match) => {
|
|
194
|
+
const text = normalizeSearchText(match.fullText, caseInsensitive);
|
|
195
|
+
return normalizedQueries.every((query) => text.includes(query));
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
return matches.filter((match) => hasAllQueriesInNearbyWindow(matches, match.relativePath, match.lineNumber, normalizedQueries, caseInsensitive));
|
|
199
|
+
}
|
|
200
|
+
function buildCountsFromMatches(matches, files) {
|
|
201
|
+
const countByRelativePath = new Map();
|
|
202
|
+
for (const match of matches) {
|
|
203
|
+
countByRelativePath.set(match.relativePath, (countByRelativePath.get(match.relativePath) ?? 0) + 1);
|
|
204
|
+
}
|
|
205
|
+
return files
|
|
206
|
+
.flatMap((file) => {
|
|
207
|
+
const matchCount = countByRelativePath.get(file.relativePath) ?? 0;
|
|
208
|
+
if (matchCount === 0)
|
|
209
|
+
return [];
|
|
210
|
+
return [
|
|
211
|
+
{
|
|
212
|
+
id: file.id,
|
|
213
|
+
fileName: file.fileName,
|
|
214
|
+
relativePath: file.relativePath,
|
|
215
|
+
matchCount,
|
|
216
|
+
},
|
|
217
|
+
];
|
|
218
|
+
})
|
|
219
|
+
.sort((left, right) => right.matchCount - left.matchCount);
|
|
220
|
+
}
|
|
221
|
+
function hasAllQueriesInNearbyWindow(matches, relativePath, lineNumber, queries, caseInsensitive) {
|
|
222
|
+
const sameFileMatches = matches.filter((match) => match.relativePath === relativePath);
|
|
223
|
+
return sameFileMatches.some((windowStart) => {
|
|
224
|
+
const start = windowStart.lineNumber;
|
|
225
|
+
const end = start + MULTI_QUERY_WINDOW_LINES - 1;
|
|
226
|
+
if (lineNumber < start || lineNumber > end)
|
|
227
|
+
return false;
|
|
228
|
+
const windowText = sameFileMatches
|
|
229
|
+
.filter((match) => match.lineNumber >= start && match.lineNumber <= end)
|
|
230
|
+
.map((match) => normalizeSearchText(match.fullText, caseInsensitive))
|
|
231
|
+
.join('\n');
|
|
232
|
+
return queries.every((query) => windowText.includes(query));
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
function normalizeSearchText(text, caseInsensitive) {
|
|
236
|
+
return caseInsensitive ? text.toLowerCase() : text;
|
|
237
|
+
}
|
|
238
|
+
function toReadRange(lineNumber) {
|
|
239
|
+
return {
|
|
240
|
+
start: Math.max(1, lineNumber - DEFAULT_READ_RANGE_CONTEXT),
|
|
241
|
+
end: lineNumber + DEFAULT_READ_RANGE_CONTEXT,
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
function getPrimarySearchPattern(input) {
|
|
245
|
+
return input.query ?? input.queries?.[0] ?? '';
|
|
246
|
+
}
|
|
247
|
+
function getSearchCommandPattern(input) {
|
|
248
|
+
if (!input.queries)
|
|
249
|
+
return input.query ?? '';
|
|
250
|
+
return input.queries.map(escapeExtendedRegex).join('|');
|
|
251
|
+
}
|
|
252
|
+
function getSearchCommandFixedStrings(input) {
|
|
253
|
+
return input.queries ? false : (input.fixedStrings ?? true);
|
|
254
|
+
}
|
|
255
|
+
function escapeExtendedRegex(pattern) {
|
|
256
|
+
return pattern.replace(/[\\^$.*+?()[\]{}|]/g, '\\$&');
|
|
257
|
+
}
|
|
258
|
+
function buildSearchResult({ mode, query, queries, matchMode, counts, matches, offset, headLimit, nextOffset, hint, }) {
|
|
259
|
+
const slicedCounts = sliceResults(counts, offset, headLimit);
|
|
260
|
+
const totalMatchingLines = counts.reduce((total, count) => total + count.matchCount, 0);
|
|
261
|
+
const effectiveNextOffset = mode === 'content' ? nextOffset : slicedCounts.nextOffset;
|
|
262
|
+
return {
|
|
263
|
+
mode,
|
|
264
|
+
query,
|
|
265
|
+
queries,
|
|
266
|
+
matchMode,
|
|
267
|
+
totalMatchingFiles: counts.length,
|
|
268
|
+
totalMatchingLines,
|
|
269
|
+
files: slicedCounts.items,
|
|
270
|
+
matches,
|
|
271
|
+
truncated: slicedCounts.truncated || effectiveNextOffset !== undefined,
|
|
272
|
+
appliedLimit: (mode === 'content' && effectiveNextOffset !== undefined) || slicedCounts.truncated
|
|
273
|
+
? headLimit
|
|
274
|
+
: undefined,
|
|
275
|
+
appliedOffset: offset > 0 ? offset : undefined,
|
|
276
|
+
nextOffset: effectiveNextOffset,
|
|
277
|
+
hint,
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
function sliceResults(items, offset, headLimit) {
|
|
281
|
+
const sliced = headLimit === 0 ? items.slice(offset) : items.slice(offset, offset + headLimit);
|
|
282
|
+
return {
|
|
283
|
+
items: sliced,
|
|
284
|
+
truncated: offset + sliced.length < items.length,
|
|
285
|
+
nextOffset: offset + sliced.length < items.length ? offset + sliced.length : undefined,
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
function buildSearchHint(mode, sliced, headLimit) {
|
|
289
|
+
if (sliced.nextOffset !== undefined) {
|
|
290
|
+
return `Additional ${mode === 'files_with_matches' ? 'files' : mode === 'count' ? 'counts' : 'matches'} omitted. Continue with offset=${sliced.nextOffset} and head_limit=${headLimit}, or ${mode === 'content' ? 'read one of the returned ranges' : 'switch to output_mode=content after choosing a file'}.`;
|
|
291
|
+
}
|
|
292
|
+
if (mode === 'content')
|
|
293
|
+
return 'Use read with the suggested line ranges for grounded citations.';
|
|
294
|
+
if (mode === 'count')
|
|
295
|
+
return 'Use output_mode=content after choosing a file or exact phrase.';
|
|
296
|
+
return 'Use read on a matching file or switch to output_mode=content for line anchors.';
|
|
297
|
+
}
|
|
298
|
+
function formatSearchFiles(counts, offset, headLimit) {
|
|
299
|
+
const sliced = sliceResults(counts, offset, headLimit);
|
|
300
|
+
const lines = sliced.items.map((file) => file.fileName);
|
|
301
|
+
if (sliced.truncated)
|
|
302
|
+
lines.push(buildSearchHint('files_with_matches', sliced, headLimit));
|
|
303
|
+
return lines.length > 0 ? `${lines.join('\n')}\n` : '';
|
|
304
|
+
}
|
|
305
|
+
function formatSearchCounts(counts, offset, headLimit) {
|
|
306
|
+
const sliced = sliceResults(counts, offset, headLimit);
|
|
307
|
+
const lines = sliced.items.map((file) => `${file.fileName}: ${file.matchCount}`);
|
|
308
|
+
if (sliced.truncated)
|
|
309
|
+
lines.push(buildSearchHint('count', sliced, headLimit));
|
|
310
|
+
return lines.length > 0 ? `${lines.join('\n')}\n` : '';
|
|
311
|
+
}
|
|
312
|
+
function formatSearchMatches(matches, sliced, headLimit) {
|
|
313
|
+
const lines = matches.map((match) => `${match.fileName}:${match.lineNumber}:${match.text} (read ${match.readRange.start}-${match.readRange.end})`);
|
|
314
|
+
if (sliced.truncated)
|
|
315
|
+
lines.push(buildSearchHint('content', sliced, headLimit));
|
|
316
|
+
return lines.length > 0 ? `${lines.join('\n')}\n` : '';
|
|
317
|
+
}
|
|
318
|
+
function parseGrepLine(line) {
|
|
319
|
+
const match = /^(?<filePath>.*)(?<separator>[:-])(?<lineNumber>\d+)(?<contentSeparator>[:-])/.exec(line);
|
|
320
|
+
if (!match?.groups)
|
|
321
|
+
return undefined;
|
|
322
|
+
return {
|
|
323
|
+
filePath: normaliseGrepPath(match.groups.filePath),
|
|
324
|
+
isMatch: match.groups.separator === ':' && match.groups.contentSeparator === ':',
|
|
325
|
+
lineNumber: Number(match.groups.lineNumber),
|
|
326
|
+
contentStartIndex: match[0].length,
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
function normaliseGrepPath(filePath) {
|
|
330
|
+
return filePath.startsWith('./') ? filePath.slice(2) : filePath;
|
|
331
|
+
}
|
|
332
|
+
//# sourceMappingURL=search.operation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.operation.js","sourceRoot":"","sources":["../../../../../src/modules/agents/tools/knowledge/search.operation.ts"],"names":[],"mappings":";;AAoBA,gDAOC;AAED,gDAgIC;AAlJD,uDAA2E;AAK3E,MAAM,0BAA0B,GAAG,CAAC,CAAC;AACrC,MAAM,4BAA4B,GAAG,GAAG,CAAC;AACzC,MAAM,wBAAwB,GAAG,CAAC,CAAC;AAE5B,KAAK,UAAU,kBAAkB,CACvC,cAA4C,EAC5C,aAAqB,EACrB,OAAwC;IAExC,MAAM,MAAM,GAAG,MAAM,cAAc,CAAC,GAAG,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;IAChE,OAAO,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC;AAChD,CAAC;AAEM,KAAK,UAAU,kBAAkB,CACvC,KAAkB,EAClB,aAAqB,EACrB,KAAqB,EACrB,cAA4C;IAE5C,IAAI,KAAK,CAAC,KAAK,KAAK,SAAS,IAAI,KAAK,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;QAC9D,OAAO;YACN,SAAS,EAAE,QAAQ;YACnB,KAAK;YACL,KAAK,EAAE,sDAAsD;SAC7D,CAAC;IACH,CAAC;IACD,MAAM,cAAc,G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KAClC,CAAC;AACH,CAAC;AAED,SAAS,iBAAiB,CAAC,QAAgB;IAC1C,OAAO,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;AACjE,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { AgentKnowledgeCommandService } from '../../agent-knowledge-command.service';
|
|
2
|
+
import type { AgentKnowledgeService } from '../../agent-knowledge.service';
|
|
3
|
+
export declare function createSearchKnowledgeTool({ agentId, projectId, knowledgeService, commandService, }: {
|
|
4
|
+
agentId: string;
|
|
5
|
+
projectId: string;
|
|
6
|
+
knowledgeService: AgentKnowledgeService;
|
|
7
|
+
commandService: AgentKnowledgeCommandService;
|
|
8
|
+
}): import("@n8n/agents").BuiltTool;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createSearchKnowledgeTool = createSearchKnowledgeTool;
|
|
4
|
+
const tool_1 = require("@n8n/agents/tool");
|
|
5
|
+
const node_crypto_1 = require("node:crypto");
|
|
6
|
+
const csv_operation_1 = require("./csv.operation");
|
|
7
|
+
const file_references_1 = require("./file-references");
|
|
8
|
+
const read_operation_1 = require("./read.operation");
|
|
9
|
+
const search_operation_1 = require("./search.operation");
|
|
10
|
+
const schemas_1 = require("./schemas");
|
|
11
|
+
function createSearchKnowledgeTool({ agentId, projectId, knowledgeService, commandService, }) {
|
|
12
|
+
return new tool_1.Tool('search_knowledge')
|
|
13
|
+
.description('List, read, search, and query files uploaded to this agent knowledge base. ' +
|
|
14
|
+
'Use this when the user asks about uploaded documents or facts likely contained in them.')
|
|
15
|
+
.systemInstruction('Use search_knowledge to inspect uploaded knowledge files. Do not claim a file says something ' +
|
|
16
|
+
'unless you found it via list, search, read, or a CSV operation. Search defaults to output_mode=files_with_matches. ' +
|
|
17
|
+
'Use output_mode=count for counts and output_mode=content only after narrowing to a file or exact phrase. ' +
|
|
18
|
+
'For conceptual multi-term lookup, use queries with match_mode instead of writing regex by hand. ' +
|
|
19
|
+
'Use read for grounded citations. Cite only file names and line ranges from read results. ' +
|
|
20
|
+
'Never mention uploaded file ids, relative paths, binary ids, or storage ids to users. ' +
|
|
21
|
+
'For unfamiliar CSVs, call csv_profile first. Use csv_query for rows, csv_distinct for possible values, and csv_aggregate for counts or numeric calculations. ' +
|
|
22
|
+
'Do not answer from the first CSV row when rowCount is high or truncated; refine filters using ambiguity hints.')
|
|
23
|
+
.input(schemas_1.searchKnowledgeInputSchema)
|
|
24
|
+
.output(schemas_1.searchKnowledgeOutputSchema)
|
|
25
|
+
.handler(async (input) => {
|
|
26
|
+
let parsedInput;
|
|
27
|
+
try {
|
|
28
|
+
parsedInput = (0, schemas_1.parseSearchKnowledgeInput)(input);
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
return {
|
|
32
|
+
operation: (0, schemas_1.getSearchKnowledgeOperation)(input),
|
|
33
|
+
files: [],
|
|
34
|
+
error: toToolErrorMessage(error),
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
if (parsedInput.operation === 'list') {
|
|
38
|
+
try {
|
|
39
|
+
return {
|
|
40
|
+
operation: 'list',
|
|
41
|
+
files: await knowledgeService.listWorkspaceFiles(agentId, projectId),
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
return {
|
|
46
|
+
operation: 'list',
|
|
47
|
+
files: [],
|
|
48
|
+
error: toToolErrorMessage(error),
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
let files = [];
|
|
53
|
+
try {
|
|
54
|
+
const fileReferences = (0, file_references_1.getRequiredFileReferences)(parsedInput);
|
|
55
|
+
files = await knowledgeService.resolveWorkspaceFiles(agentId, projectId, fileReferences);
|
|
56
|
+
const cacheKey = buildWorkspaceCacheKey(projectId, agentId, files);
|
|
57
|
+
return await commandService.withCachedWorkspace(cacheKey, async (workspaceRoot) => {
|
|
58
|
+
await knowledgeService.materializeWorkspace(agentId, projectId, workspaceRoot, {
|
|
59
|
+
fileReferences,
|
|
60
|
+
});
|
|
61
|
+
}, async (workspaceRoot) => await handleKnowledgeOperation(parsedInput, workspaceRoot, files, commandService));
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
return {
|
|
65
|
+
operation: parsedInput.operation,
|
|
66
|
+
files,
|
|
67
|
+
error: toToolErrorMessage(error),
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
})
|
|
71
|
+
.build();
|
|
72
|
+
}
|
|
73
|
+
function buildWorkspaceCacheKey(projectId, agentId, files) {
|
|
74
|
+
const signature = files
|
|
75
|
+
.map((file) => `${file.relativePath}:${file.fileSizeBytes}`)
|
|
76
|
+
.sort()
|
|
77
|
+
.join('|');
|
|
78
|
+
return `${projectId}:${agentId}:${(0, node_crypto_1.createHash)('sha1').update(signature).digest('hex')}`;
|
|
79
|
+
}
|
|
80
|
+
function toToolErrorMessage(error) {
|
|
81
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
82
|
+
return message.replace(/(^|[\s'"(])\/(?:[^\s'"()]+\/)*[^\s'"()]+/g, '$1[path]');
|
|
83
|
+
}
|
|
84
|
+
async function handleKnowledgeOperation(input, workspaceRoot, files, commandService) {
|
|
85
|
+
switch (input.operation) {
|
|
86
|
+
case 'list':
|
|
87
|
+
return {
|
|
88
|
+
operation: 'list',
|
|
89
|
+
files,
|
|
90
|
+
};
|
|
91
|
+
case 'search':
|
|
92
|
+
return await (0, search_operation_1.runSearchOperation)(input, workspaceRoot, files, commandService);
|
|
93
|
+
case 'read':
|
|
94
|
+
return await (0, read_operation_1.runReadOperation)(input, workspaceRoot, files, commandService);
|
|
95
|
+
case 'csv_query':
|
|
96
|
+
return {
|
|
97
|
+
operation: 'csv_query',
|
|
98
|
+
files,
|
|
99
|
+
csv: await (0, csv_operation_1.queryCsv)(workspaceRoot, files, input),
|
|
100
|
+
};
|
|
101
|
+
case 'csv_profile':
|
|
102
|
+
return {
|
|
103
|
+
operation: 'csv_profile',
|
|
104
|
+
files,
|
|
105
|
+
csvProfile: await (0, csv_operation_1.profileCsv)(workspaceRoot, files, input),
|
|
106
|
+
};
|
|
107
|
+
case 'csv_distinct':
|
|
108
|
+
return {
|
|
109
|
+
operation: 'csv_distinct',
|
|
110
|
+
files,
|
|
111
|
+
csvDistinct: await (0, csv_operation_1.distinctCsv)(workspaceRoot, files, input),
|
|
112
|
+
};
|
|
113
|
+
case 'csv_aggregate':
|
|
114
|
+
return {
|
|
115
|
+
operation: 'csv_aggregate',
|
|
116
|
+
files,
|
|
117
|
+
csvAggregate: await (0, csv_operation_1.aggregateCsv)(workspaceRoot, files, input),
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool.js","sourceRoot":"","sources":["../../../../../src/modules/agents/tools/knowledge/tool.ts"],"names":[],"mappings":";;AAmBA,8DA+EC;AAlGD,2CAAwC;AACxC,6CAAyC;AAKzC,mDAAkF;AAClF,uDAAmF;AACnF,qDAAoD;AACpD,yDAAwD;AACxD,uCAOmB;AAEnB,SAAgB,yBAAyB,CAAC,EACzC,OAAO,EACP,SAAS,EACT,gBAAgB,EAChB,cAAc,GAMd;IACA,OAAO,IAAI,WAAI,CAAC,kBAAkB,CAAC;SACjC,WAAW,CACX,6EAA6E;QAC5E,yFAAyF,CAC1F;SACA,iBAAiB,CACjB,+FAA+F;QAC9F,qHAAqH;QACrH,2GAA2G;QAC3G,kGAAkG;QAClG,2FAA2F;QAC3F,wFAAwF;QACxF,+JAA+J;QAC/J,gHAAgH,CACjH;SACA,KAAK,CAAC,oCAA0B,CAAC;SACjC,MAAM,CAAC,qCAA2B,CAAC;SACnC,OAAO,CAAC,KAAK,EAA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AAE,aAAa,EAAE,KAAK,EAAE,cAAc,CAAC,CAAC;QAC9E,KAAK,MAAM;YACV,OAAO,MAAM,IAAA,iCAAgB,EAAC,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,cAAc,CAAC,CAAC;QAC5E,KAAK,WAAW;YACf,OAAO;gBACN,SAAS,EAAE,WAAW;gBACtB,KAAK;gBACL,GAAG,EAAE,MAAM,IAAA,wBAAQ,EAAC,aAAa,EAAE,KAAK,EAAE,KAAK,CAAC;aAChD,CAAC;QACH,KAAK,aAAa;YACjB,OAAO;gBACN,SAAS,EAAE,aAAa;gBACxB,KAAK;gBACL,UAAU,EAAE,MAAM,IAAA,0BAAU,EAAC,aAAa,EAAE,KAAK,EAAE,KAAK,CAAC;aACzD,CAAC;QACH,KAAK,cAAc;YAClB,OAAO;gBACN,SAAS,EAAE,cAAc;gBACzB,KAAK;gBACL,WAAW,EAAE,MAAM,IAAA,2BAAW,EAAC,aAAa,EAAE,KAAK,EAAE,KAAK,CAAC;aAC3D,CAAC;QACH,KAAK,eAAe;YACnB,OAAO;gBACN,SAAS,EAAE,eAAe;gBAC1B,KAAK;gBACL,YAAY,EAAE,MAAM,IAAA,4BAAY,EAAC,aAAa,EAAE,KAAK,EAAE,KAAK,CAAC;aAC7D,CAAC;IACJ,CAAC;AACF,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export declare function draftChatMemoryResourceId(userId: string): string;
|
|
2
|
-
export declare function scheduledRunMemoryResourceId(executionUserId: string): string;
|
|
3
2
|
export declare function integrationMemoryResourceId(integrationType: string, threadId: string): string;
|
|
3
|
+
export declare function taskRunMemoryResourceId(taskId: string): string;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.draftChatMemoryResourceId = draftChatMemoryResourceId;
|
|
4
|
-
exports.scheduledRunMemoryResourceId = scheduledRunMemoryResourceId;
|
|
5
4
|
exports.integrationMemoryResourceId = integrationMemoryResourceId;
|
|
5
|
+
exports.taskRunMemoryResourceId = taskRunMemoryResourceId;
|
|
6
6
|
function draftChatMemoryResourceId(userId) {
|
|
7
7
|
return `draft-chat:${userId}`;
|
|
8
8
|
}
|
|
9
|
-
function scheduledRunMemoryResourceId(executionUserId) {
|
|
10
|
-
return `schedule:${executionUserId}`;
|
|
11
|
-
}
|
|
12
9
|
function integrationMemoryResourceId(integrationType, threadId) {
|
|
13
10
|
return `integration:${integrationType}:${threadId}`;
|
|
14
11
|
}
|
|
12
|
+
function taskRunMemoryResourceId(taskId) {
|
|
13
|
+
return `task:${taskId}`;
|
|
14
|
+
}
|
|
15
15
|
//# sourceMappingURL=agent-memory-scope.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-memory-scope.js","sourceRoot":"","sources":["../../../../src/modules/agents/utils/agent-memory-scope.ts"],"names":[],"mappings":";;AAAA,8DAEC;AAED,
|
|
1
|
+
{"version":3,"file":"agent-memory-scope.js","sourceRoot":"","sources":["../../../../src/modules/agents/utils/agent-memory-scope.ts"],"names":[],"mappings":";;AAAA,8DAEC;AAED,kEAEC;AAED,0DAEC;AAVD,SAAgB,yBAAyB,CAAC,MAAc;IACvD,OAAO,cAAc,MAAM,EAAE,CAAC;AAC/B,CAAC;AAED,SAAgB,2BAA2B,CAAC,eAAuB,EAAE,QAAgB;IACpF,OAAO,eAAe,eAAe,IAAI,QAAQ,EAAE,CAAC;AACrD,CAAC;AAED,SAAgB,uBAAuB,CAAC,MAAc;IACrD,OAAO,QAAQ,MAAM,EAAE,CAAC;AACzB,CAAC"}
|
|
@@ -3,8 +3,8 @@ export declare class ChatHubModule implements ModuleInterface {
|
|
|
3
3
|
init(): Promise<void>;
|
|
4
4
|
settings(): Promise<{
|
|
5
5
|
enabled: boolean;
|
|
6
|
-
providers: Record<"
|
|
7
|
-
provider: "anthropic" | "openai" | "google" | "
|
|
6
|
+
providers: Record<"anthropic" | "openai" | "google" | "groq" | "cohere" | "azureOpenAi" | "azureEntraId" | "ollama" | "awsBedrock" | "vercelAiGateway" | "xAiGrok" | "openRouter" | "deepSeek" | "mistralCloud" | "nvidia", {
|
|
7
|
+
provider: "anthropic" | "openai" | "google" | "groq" | "cohere" | "ollama" | "azureOpenAi" | "azureEntraId" | "awsBedrock" | "vercelAiGateway" | "xAiGrok" | "openRouter" | "deepSeek" | "mistralCloud" | "nvidia";
|
|
8
8
|
credentialId: string | null;
|
|
9
9
|
updatedAt: string | null;
|
|
10
10
|
allowedModels: {
|
|
@@ -8,8 +8,8 @@ export declare class ChatHubSettingsController {
|
|
|
8
8
|
private readonly moduleRegistry;
|
|
9
9
|
constructor(settings: ChatHubSettingsService, logger: Logger, moduleRegistry: ModuleRegistry);
|
|
10
10
|
getSettings(_req: AuthenticatedRequest, _res: Response): Promise<{
|
|
11
|
-
providers: Record<"
|
|
12
|
-
provider: "anthropic" | "openai" | "google" | "
|
|
11
|
+
providers: Record<"anthropic" | "openai" | "google" | "groq" | "cohere" | "azureOpenAi" | "azureEntraId" | "ollama" | "awsBedrock" | "vercelAiGateway" | "xAiGrok" | "openRouter" | "deepSeek" | "mistralCloud" | "nvidia", {
|
|
12
|
+
provider: "anthropic" | "openai" | "google" | "groq" | "cohere" | "ollama" | "azureOpenAi" | "azureEntraId" | "awsBedrock" | "vercelAiGateway" | "xAiGrok" | "openRouter" | "deepSeek" | "mistralCloud" | "nvidia";
|
|
13
13
|
credentialId: string | null;
|
|
14
14
|
updatedAt: string | null;
|
|
15
15
|
allowedModels: {
|
|
@@ -25,7 +25,7 @@ export declare class ChatHubSettingsController {
|
|
|
25
25
|
}>;
|
|
26
26
|
getProviderSettings(_req: AuthenticatedRequest, _res: Response, provider: ChatHubLLMProvider): Promise<{
|
|
27
27
|
settings: {
|
|
28
|
-
provider: "anthropic" | "openai" | "google" | "
|
|
28
|
+
provider: "anthropic" | "openai" | "google" | "groq" | "cohere" | "ollama" | "azureOpenAi" | "azureEntraId" | "awsBedrock" | "vercelAiGateway" | "xAiGrok" | "openRouter" | "deepSeek" | "mistralCloud" | "nvidia";
|
|
29
29
|
credentialId: string | null;
|
|
30
30
|
updatedAt: string | null;
|
|
31
31
|
allowedModels: {
|
|
@@ -40,7 +40,7 @@ export declare class ChatHubSettingsController {
|
|
|
40
40
|
};
|
|
41
41
|
}>;
|
|
42
42
|
updateSettings(_req: AuthenticatedRequest, _res: Response, body: UpdateChatSettingsRequest): Promise<{
|
|
43
|
-
provider: "anthropic" | "openai" | "google" | "
|
|
43
|
+
provider: "anthropic" | "openai" | "google" | "groq" | "cohere" | "ollama" | "azureOpenAi" | "azureEntraId" | "awsBedrock" | "vercelAiGateway" | "xAiGrok" | "openRouter" | "deepSeek" | "mistralCloud" | "nvidia";
|
|
44
44
|
credentialId: string | null;
|
|
45
45
|
updatedAt: string | null;
|
|
46
46
|
allowedModels: {
|
|
@@ -82,12 +82,12 @@ export declare const chatTriggerParamsShape: z.ZodObject<{
|
|
|
82
82
|
responseMode: z.ZodOptional<z.ZodEnum<["streaming", "lastNode", "responseNode", "responseNodes"]>>;
|
|
83
83
|
autoSaveHighlightedData: z.ZodOptional<z.ZodBoolean>;
|
|
84
84
|
}, "strip", z.ZodTypeAny, {
|
|
85
|
-
responseMode?: "
|
|
85
|
+
responseMode?: "responseNode" | "lastNode" | "streaming" | "responseNodes" | undefined;
|
|
86
86
|
allowFileUploads?: boolean | undefined;
|
|
87
87
|
allowedFilesMimeTypes?: string | undefined;
|
|
88
88
|
autoSaveHighlightedData?: boolean | undefined;
|
|
89
89
|
}, {
|
|
90
|
-
responseMode?: "
|
|
90
|
+
responseMode?: "responseNode" | "lastNode" | "streaming" | "responseNodes" | undefined;
|
|
91
91
|
allowFileUploads?: boolean | undefined;
|
|
92
92
|
allowedFilesMimeTypes?: string | undefined;
|
|
93
93
|
autoSaveHighlightedData?: boolean | undefined;
|
|
@@ -95,7 +95,7 @@ export declare const chatTriggerParamsShape: z.ZodObject<{
|
|
|
95
95
|
}, "strip", z.ZodTypeAny, {
|
|
96
96
|
availableInChat: boolean;
|
|
97
97
|
options?: {
|
|
98
|
-
responseMode?: "
|
|
98
|
+
responseMode?: "responseNode" | "lastNode" | "streaming" | "responseNodes" | undefined;
|
|
99
99
|
allowFileUploads?: boolean | undefined;
|
|
100
100
|
allowedFilesMimeTypes?: string | undefined;
|
|
101
101
|
autoSaveHighlightedData?: boolean | undefined;
|
|
@@ -111,13 +111,13 @@ export declare const chatTriggerParamsShape: z.ZodObject<{
|
|
|
111
111
|
agentIcon?: import("n8n-workflow").IconOrEmoji | undefined;
|
|
112
112
|
}, {
|
|
113
113
|
options?: {
|
|
114
|
-
responseMode?: "
|
|
114
|
+
responseMode?: "responseNode" | "lastNode" | "streaming" | "responseNodes" | undefined;
|
|
115
115
|
allowFileUploads?: boolean | undefined;
|
|
116
116
|
allowedFilesMimeTypes?: string | undefined;
|
|
117
117
|
autoSaveHighlightedData?: boolean | undefined;
|
|
118
118
|
} | undefined;
|
|
119
|
-
agentName?: string | undefined;
|
|
120
119
|
availableInChat?: boolean | undefined;
|
|
120
|
+
agentName?: string | undefined;
|
|
121
121
|
suggestedPrompts?: {
|
|
122
122
|
prompts?: {
|
|
123
123
|
text: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
declare const ChatModelsRequestDto_base: import("@n8n/api-types").ZodClass<{
|
|
2
|
-
credentials: Partial<Record<"n8n" | "
|
|
2
|
+
credentials: Partial<Record<"n8n" | "anthropic" | "openai" | "google" | "groq" | "cohere" | "azureOpenAi" | "azureEntraId" | "ollama" | "awsBedrock" | "vercelAiGateway" | "xAiGrok" | "openRouter" | "deepSeek" | "mistralCloud" | "nvidia" | "custom-agent", string | null>>;
|
|
3
3
|
}, {
|
|
4
4
|
credentials: import("zod").ZodRecord<import("zod").ZodEnum<["openai", "anthropic", "google", "azureOpenAi", "azureEntraId", "ollama", "awsBedrock", "vercelAiGateway", "xAiGrok", "groq", "openRouter", "deepSeek", "cohere", "mistralCloud", "nvidia", "n8n", "custom-agent"]>, import("zod").ZodNullable<import("zod").ZodString>>;
|
|
5
5
|
}>;
|