n8n 2.23.2 → 2.25.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/active-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-data/db-store.d.ts +1 -0
- package/dist/executions/execution-data/db-store.js +26 -0
- package/dist/executions/execution-data/db-store.js.map +1 -1
- package/dist/executions/execution-data/fs-store.d.ts +2 -0
- package/dist/executions/execution-data/fs-store.js +27 -0
- package/dist/executions/execution-data/fs-store.js.map +1 -1
- package/dist/executions/execution-data/types.d.ts +1 -0
- package/dist/executions/execution-persistence.d.ts +38 -4
- package/dist/executions/execution-persistence.js +127 -2
- 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 +39 -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/constants.d.ts +1 -1
- package/dist/modules/mcp/tools/workflow-builder/constants.js +2 -1
- package/dist/modules/mcp/tools/workflow-builder/constants.js.map +1 -1
- package/dist/modules/mcp/tools/workflow-builder/mcp-instructions.js +6 -4
- package/dist/modules/mcp/tools/workflow-builder/mcp-instructions.js.map +1 -1
- package/dist/modules/mcp/tools/workflow-builder/update-workflow.tool.d.ts +67 -6
- package/dist/modules/mcp/tools/workflow-builder/validate-node.tool.d.ts +30 -0
- package/dist/modules/mcp/tools/workflow-builder/validate-node.tool.js +161 -0
- package/dist/modules/mcp/tools/workflow-builder/validate-node.tool.js.map +1 -0
- 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-execution.service.js +2 -0
- package/dist/workflows/workflow-execution.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 +45 -37
- 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
|
@@ -5,9 +5,48 @@ const di_1 = require("@n8n/di");
|
|
|
5
5
|
const agent_memory_scope_1 = require("../utils/agent-memory-scope");
|
|
6
6
|
const agent_chat_integration_1 = require("./agent-chat-integration");
|
|
7
7
|
const callback_store_1 = require("./callback-store");
|
|
8
|
+
const component_mapper_1 = require("./component-mapper");
|
|
9
|
+
const integration_message_context_service_1 = require("./integration-message-context.service");
|
|
10
|
+
const integration_tools_1 = require("./integration-tools");
|
|
8
11
|
const types_1 = require("./types");
|
|
12
|
+
const SLACK_THINKING_STATUS = 'Thinking...';
|
|
13
|
+
const SLACK_STATUS_RETRY_DELAY_MS = 750;
|
|
14
|
+
function isIntegrationActionSuspendPayload(value) {
|
|
15
|
+
return (typeof value === 'object' &&
|
|
16
|
+
value !== null &&
|
|
17
|
+
'type' in value &&
|
|
18
|
+
value.type === 'integration_action');
|
|
19
|
+
}
|
|
20
|
+
function toIntegrationMessageSubject(subject) {
|
|
21
|
+
if (!subject || typeof subject.type !== 'string' || typeof subject.id !== 'string') {
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
const assignee = toIntegrationSubjectPerson(subject.assignee);
|
|
25
|
+
const author = toIntegrationSubjectPerson(subject.author);
|
|
26
|
+
const labels = subject.labels?.filter((label) => typeof label === 'string');
|
|
27
|
+
return {
|
|
28
|
+
type: subject.type,
|
|
29
|
+
id: subject.id,
|
|
30
|
+
...(typeof subject.title === 'string' ? { title: subject.title } : {}),
|
|
31
|
+
...(typeof subject.description === 'string' ? { description: subject.description } : {}),
|
|
32
|
+
...(typeof subject.url === 'string' ? { url: subject.url } : {}),
|
|
33
|
+
...(typeof subject.status === 'string' ? { status: subject.status } : {}),
|
|
34
|
+
...(labels && labels.length > 0 ? { labels } : {}),
|
|
35
|
+
...(assignee ? { assignee } : {}),
|
|
36
|
+
...(author ? { author } : {}),
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
function toIntegrationSubjectPerson(person) {
|
|
40
|
+
if (!person || typeof person.id !== 'string' || typeof person.name !== 'string') {
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
id: person.id,
|
|
45
|
+
name: person.name,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
9
48
|
class AgentChatBridge {
|
|
10
|
-
constructor(chat, agentId, agentService, componentMapper, logger, n8nProjectId, integration) {
|
|
49
|
+
constructor(chat, agentId, agentService, componentMapper, logger, n8nProjectId, integration, messageContextStore) {
|
|
11
50
|
this.chat = chat;
|
|
12
51
|
this.agentId = agentId;
|
|
13
52
|
this.agentService = agentService;
|
|
@@ -15,6 +54,7 @@ class AgentChatBridge {
|
|
|
15
54
|
this.logger = logger;
|
|
16
55
|
this.n8nProjectId = n8nProjectId;
|
|
17
56
|
this.integration = integration;
|
|
57
|
+
this.messageContextStore = messageContextStore;
|
|
18
58
|
this.activeResumedRuns = new Set();
|
|
19
59
|
this.richInteractionInputs = new Map();
|
|
20
60
|
this.integrationImpl = di_1.Container.get(agent_chat_integration_1.ChatIntegrationRegistry).get(integration.type);
|
|
@@ -45,7 +85,7 @@ class AgentChatBridge {
|
|
|
45
85
|
yield* agentService.resumeForChat(config);
|
|
46
86
|
},
|
|
47
87
|
};
|
|
48
|
-
return new AgentChatBridge(chat, agentId, agentExecutor, componentMapper, logger, n8nProjectId, integration);
|
|
88
|
+
return new AgentChatBridge(chat, agentId, agentExecutor, componentMapper, logger, n8nProjectId, integration, di_1.Container.get(integration_message_context_service_1.IntegrationMessageContextService));
|
|
49
89
|
}
|
|
50
90
|
registerHandlers() {
|
|
51
91
|
this.chat.onNewMention(async (thread, message) => {
|
|
@@ -102,11 +142,25 @@ class AgentChatBridge {
|
|
|
102
142
|
};
|
|
103
143
|
}
|
|
104
144
|
async executeAndStream(thread, message) {
|
|
105
|
-
const
|
|
145
|
+
const platformAgentContext = this.getPlatformAgentContext();
|
|
146
|
+
const text = this.prepareInboundText(message.text, platformAgentContext).trim();
|
|
106
147
|
if (!text)
|
|
107
148
|
return;
|
|
108
149
|
const platformThreadId = this.resolvePlatformThreadId(thread);
|
|
109
150
|
const threadId = this.toAgentThreadId(platformThreadId);
|
|
151
|
+
const slackThreadContext = this.getSlackThreadContext(message);
|
|
152
|
+
const useNativeSlackThreadFeatures = this.integration.type !== 'slack' || slackThreadContext?.hasRealThreadTs === true;
|
|
153
|
+
const statusRetry = new AbortController();
|
|
154
|
+
const [, subject] = await Promise.all([
|
|
155
|
+
this.startThinkingStatus(thread, slackThreadContext, statusRetry.signal),
|
|
156
|
+
this.resolveMessageSubject(message),
|
|
157
|
+
]);
|
|
158
|
+
await this.updateLatestMessageContext(threadId.id, message.author.userId, thread, {
|
|
159
|
+
messageId: message.id,
|
|
160
|
+
interactingUserId: message.author.userId,
|
|
161
|
+
...platformAgentContext,
|
|
162
|
+
subject,
|
|
163
|
+
});
|
|
110
164
|
const stream = this.agentService.executeForChatPublished({
|
|
111
165
|
agentId: this.agentId,
|
|
112
166
|
projectId: this.n8nProjectId,
|
|
@@ -117,10 +171,17 @@ class AgentChatBridge {
|
|
|
117
171
|
},
|
|
118
172
|
integrationType: this.integration.type,
|
|
119
173
|
});
|
|
120
|
-
|
|
174
|
+
try {
|
|
175
|
+
await this.consumeStream(stream, thread, {
|
|
176
|
+
forceBuffered: this.integration.type === 'slack' && !useNativeSlackThreadFeatures,
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
finally {
|
|
180
|
+
statusRetry.abort();
|
|
181
|
+
}
|
|
121
182
|
}
|
|
122
|
-
async consumeStream(stream, thread) {
|
|
123
|
-
if (this.disableStreaming) {
|
|
183
|
+
async consumeStream(stream, thread, options = {}) {
|
|
184
|
+
if (this.disableStreaming || options.forceBuffered) {
|
|
124
185
|
await this.consumeStreamBuffered(stream, thread);
|
|
125
186
|
return;
|
|
126
187
|
}
|
|
@@ -192,50 +253,55 @@ class AgentChatBridge {
|
|
|
192
253
|
if (!streamingPost)
|
|
193
254
|
startStreamingPost();
|
|
194
255
|
};
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
case 'reasoning-delta': {
|
|
204
|
-
const { delta } = chunk;
|
|
205
|
-
ensureStreamingPost();
|
|
206
|
-
textStream.yield?.(`_${delta}_`);
|
|
207
|
-
break;
|
|
208
|
-
}
|
|
209
|
-
case 'tool-call':
|
|
210
|
-
this.stashRichInteractionInput(chunk);
|
|
211
|
-
break;
|
|
212
|
-
case 'tool-call-suspended':
|
|
213
|
-
this.richInteractionInputs.delete(chunk.toolCallId);
|
|
214
|
-
await endStreamingPost();
|
|
215
|
-
await this.handleSuspension(chunk, thread);
|
|
216
|
-
break;
|
|
217
|
-
case 'tool-result':
|
|
218
|
-
if (this.isRichInteractionDisplayOnly(chunk)) {
|
|
219
|
-
await endStreamingPost();
|
|
220
|
-
await this.handleDisplayOnly(chunk, thread);
|
|
256
|
+
try {
|
|
257
|
+
for await (const chunk of stream) {
|
|
258
|
+
switch (chunk.type) {
|
|
259
|
+
case 'text-delta': {
|
|
260
|
+
const { delta } = chunk;
|
|
261
|
+
ensureStreamingPost();
|
|
262
|
+
textStream.yield?.(delta);
|
|
263
|
+
break;
|
|
221
264
|
}
|
|
222
|
-
|
|
223
|
-
|
|
265
|
+
case 'reasoning-delta': {
|
|
266
|
+
const { delta } = chunk;
|
|
267
|
+
ensureStreamingPost();
|
|
268
|
+
textStream.yield?.(`_${delta}_`);
|
|
269
|
+
break;
|
|
224
270
|
}
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
271
|
+
case 'tool-call':
|
|
272
|
+
this.stashRichInteractionInput(chunk);
|
|
273
|
+
break;
|
|
274
|
+
case 'tool-call-suspended':
|
|
275
|
+
this.richInteractionInputs.delete(chunk.toolCallId);
|
|
276
|
+
await endStreamingPost();
|
|
277
|
+
await this.handleSuspension(chunk, thread);
|
|
278
|
+
break;
|
|
279
|
+
case 'tool-result':
|
|
280
|
+
if (this.isRichInteractionDisplayOnly(chunk)) {
|
|
281
|
+
await endStreamingPost();
|
|
282
|
+
await this.handleDisplayOnly(chunk, thread);
|
|
283
|
+
}
|
|
284
|
+
else {
|
|
285
|
+
this.richInteractionInputs.delete(chunk.toolCallId);
|
|
286
|
+
}
|
|
287
|
+
break;
|
|
288
|
+
case 'message':
|
|
289
|
+
await endStreamingPost();
|
|
290
|
+
await this.handleMessage(chunk, thread);
|
|
291
|
+
break;
|
|
292
|
+
case 'error':
|
|
293
|
+
await endStreamingPost();
|
|
294
|
+
await this.postErrorToThread(thread, chunk.error);
|
|
295
|
+
break;
|
|
296
|
+
default:
|
|
297
|
+
break;
|
|
298
|
+
}
|
|
236
299
|
}
|
|
237
300
|
}
|
|
238
|
-
|
|
301
|
+
finally {
|
|
302
|
+
await endStreamingPost();
|
|
303
|
+
this.richInteractionInputs.clear();
|
|
304
|
+
}
|
|
239
305
|
}
|
|
240
306
|
async consumeStreamBuffered(stream, thread) {
|
|
241
307
|
let buffer = '';
|
|
@@ -254,44 +320,49 @@ class AgentChatBridge {
|
|
|
254
320
|
});
|
|
255
321
|
}
|
|
256
322
|
};
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
await flushBuffer();
|
|
271
|
-
await this.handleSuspension(chunk, thread);
|
|
272
|
-
break;
|
|
273
|
-
case 'tool-result':
|
|
274
|
-
if (this.isRichInteractionDisplayOnly(chunk)) {
|
|
275
|
-
await flushBuffer();
|
|
276
|
-
await this.handleDisplayOnly(chunk, thread);
|
|
277
|
-
}
|
|
278
|
-
else {
|
|
323
|
+
try {
|
|
324
|
+
for await (const chunk of stream) {
|
|
325
|
+
switch (chunk.type) {
|
|
326
|
+
case 'text-delta':
|
|
327
|
+
buffer += chunk.delta;
|
|
328
|
+
break;
|
|
329
|
+
case 'reasoning-delta':
|
|
330
|
+
buffer += `_${chunk.delta}_`;
|
|
331
|
+
break;
|
|
332
|
+
case 'tool-call':
|
|
333
|
+
this.stashRichInteractionInput(chunk);
|
|
334
|
+
break;
|
|
335
|
+
case 'tool-call-suspended':
|
|
279
336
|
this.richInteractionInputs.delete(chunk.toolCallId);
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
337
|
+
await flushBuffer();
|
|
338
|
+
await this.handleSuspension(chunk, thread);
|
|
339
|
+
break;
|
|
340
|
+
case 'tool-result':
|
|
341
|
+
if (this.isRichInteractionDisplayOnly(chunk)) {
|
|
342
|
+
await flushBuffer();
|
|
343
|
+
await this.handleDisplayOnly(chunk, thread);
|
|
344
|
+
}
|
|
345
|
+
else {
|
|
346
|
+
this.richInteractionInputs.delete(chunk.toolCallId);
|
|
347
|
+
}
|
|
348
|
+
break;
|
|
349
|
+
case 'message':
|
|
350
|
+
await flushBuffer();
|
|
351
|
+
await this.handleMessage(chunk, thread);
|
|
352
|
+
break;
|
|
353
|
+
case 'error':
|
|
354
|
+
await flushBuffer();
|
|
355
|
+
await this.postErrorToThread(thread, chunk.error);
|
|
356
|
+
break;
|
|
357
|
+
default:
|
|
358
|
+
break;
|
|
359
|
+
}
|
|
292
360
|
}
|
|
293
361
|
}
|
|
294
|
-
|
|
362
|
+
finally {
|
|
363
|
+
await flushBuffer();
|
|
364
|
+
this.richInteractionInputs.clear();
|
|
365
|
+
}
|
|
295
366
|
}
|
|
296
367
|
async handleSuspension(chunk, thread) {
|
|
297
368
|
const { runId, toolCallId, suspendPayload } = chunk;
|
|
@@ -304,6 +375,9 @@ class AgentChatBridge {
|
|
|
304
375
|
return;
|
|
305
376
|
}
|
|
306
377
|
const payload = suspendPayload;
|
|
378
|
+
if (isIntegrationActionSuspendPayload(payload)) {
|
|
379
|
+
return;
|
|
380
|
+
}
|
|
307
381
|
const hasComponents = payload &&
|
|
308
382
|
'components' in payload &&
|
|
309
383
|
Array.isArray(payload.components) &&
|
|
@@ -344,15 +418,8 @@ class AgentChatBridge {
|
|
|
344
418
|
this.logger.warn('[AgentChatBridge] rich_interaction has no components');
|
|
345
419
|
return;
|
|
346
420
|
}
|
|
347
|
-
const riResumeSchema = {
|
|
348
|
-
type: 'object',
|
|
349
|
-
properties: {
|
|
350
|
-
type: { type: 'string' },
|
|
351
|
-
value: { type: 'string' },
|
|
352
|
-
},
|
|
353
|
-
};
|
|
354
421
|
try {
|
|
355
|
-
const card = await this.componentMapper.toCard(payload, runId, toolCallId,
|
|
422
|
+
const card = await this.componentMapper.toCard(payload, runId, toolCallId, component_mapper_1.RICH_INTERACTION_RESUME_JSON_SCHEMA, this.getShortenCallback(), this.integration.type);
|
|
356
423
|
await thread.post(card);
|
|
357
424
|
}
|
|
358
425
|
catch (error) {
|
|
@@ -386,12 +453,8 @@ class AgentChatBridge {
|
|
|
386
453
|
});
|
|
387
454
|
return;
|
|
388
455
|
}
|
|
389
|
-
const displayResumeSchema = {
|
|
390
|
-
type: 'object',
|
|
391
|
-
properties: { type: { type: 'string' }, value: { type: 'string' } },
|
|
392
|
-
};
|
|
393
456
|
try {
|
|
394
|
-
const card = await this.componentMapper.toCard(cardPayload, '', toolCallId,
|
|
457
|
+
const card = await this.componentMapper.toCard(cardPayload, '', toolCallId, component_mapper_1.RICH_INTERACTION_RESUME_JSON_SCHEMA, this.getShortenCallback(), this.integration.type);
|
|
395
458
|
await thread.post({ card });
|
|
396
459
|
}
|
|
397
460
|
catch (error) {
|
|
@@ -422,21 +485,6 @@ class AgentChatBridge {
|
|
|
422
485
|
}
|
|
423
486
|
}
|
|
424
487
|
parseActionId(actionId, value) {
|
|
425
|
-
if (actionId.startsWith('ri-btn:')) {
|
|
426
|
-
const parts = actionId.split(':');
|
|
427
|
-
if (parts.length < 4) {
|
|
428
|
-
this.logger.warn('[AgentChatBridge] Malformed ri-btn action ID', { actionId });
|
|
429
|
-
return null;
|
|
430
|
-
}
|
|
431
|
-
let resumeData;
|
|
432
|
-
try {
|
|
433
|
-
resumeData = JSON.parse(value ?? '');
|
|
434
|
-
}
|
|
435
|
-
catch {
|
|
436
|
-
resumeData = { type: 'button', value };
|
|
437
|
-
}
|
|
438
|
-
return { runId: parts[1], toolCallId: parts.slice(2, -1).join(':'), resumeData };
|
|
439
|
-
}
|
|
440
488
|
if (actionId.startsWith('ri-sel:')) {
|
|
441
489
|
const parts = actionId.split(':');
|
|
442
490
|
if (parts.length < 4) {
|
|
@@ -486,13 +534,6 @@ class AgentChatBridge {
|
|
|
486
534
|
error: deleteError instanceof Error ? deleteError.message : String(deleteError),
|
|
487
535
|
});
|
|
488
536
|
}
|
|
489
|
-
const threadInternal = event.thread;
|
|
490
|
-
if (threadInternal?._currentMessage?.raw) {
|
|
491
|
-
const raw = threadInternal._currentMessage.raw;
|
|
492
|
-
if (raw.team && typeof raw.team === 'object' && !raw.team_id) {
|
|
493
|
-
raw.team_id = raw.team.id;
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
537
|
}
|
|
497
538
|
async executeResume(thread, runId, toolCallId, resumeData) {
|
|
498
539
|
if (this.activeResumedRuns.has(runId)) {
|
|
@@ -502,6 +543,7 @@ class AgentChatBridge {
|
|
|
502
543
|
}
|
|
503
544
|
this.activeResumedRuns.add(runId);
|
|
504
545
|
try {
|
|
546
|
+
await this.startThinkingStatus(thread);
|
|
505
547
|
const stream = this.agentService.resumeForChat({
|
|
506
548
|
agentId: this.agentId,
|
|
507
549
|
projectId: this.n8nProjectId,
|
|
@@ -516,6 +558,169 @@ class AgentChatBridge {
|
|
|
516
558
|
this.activeResumedRuns.delete(runId);
|
|
517
559
|
}
|
|
518
560
|
}
|
|
561
|
+
async startThinkingStatus(thread, slackThreadContext, statusRetrySignal) {
|
|
562
|
+
if (this.integration.type !== 'slack')
|
|
563
|
+
return;
|
|
564
|
+
if (slackThreadContext && !slackThreadContext.hasRealThreadTs) {
|
|
565
|
+
this.setSlackAssistantStatus(slackThreadContext, statusRetrySignal);
|
|
566
|
+
return;
|
|
567
|
+
}
|
|
568
|
+
try {
|
|
569
|
+
await thread.startTyping(SLACK_THINKING_STATUS);
|
|
570
|
+
}
|
|
571
|
+
catch (error) {
|
|
572
|
+
this.logger.warn('[AgentChatBridge] Failed to set Slack assistant status', {
|
|
573
|
+
agentId: this.agentId,
|
|
574
|
+
threadId: thread.id,
|
|
575
|
+
error: error instanceof Error ? error.message : String(error),
|
|
576
|
+
});
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
setSlackAssistantStatus(context, statusRetrySignal) {
|
|
580
|
+
const adapter = this.getSlackAssistantStatusAdapter();
|
|
581
|
+
if (!adapter)
|
|
582
|
+
return;
|
|
583
|
+
void this.setSlackAssistantStatusWithRetry(adapter, context, statusRetrySignal);
|
|
584
|
+
}
|
|
585
|
+
async setSlackAssistantStatusWithRetry(adapter, context, statusRetrySignal) {
|
|
586
|
+
try {
|
|
587
|
+
await adapter.setAssistantStatus(context.channelId, context.threadTs, SLACK_THINKING_STATUS, [
|
|
588
|
+
SLACK_THINKING_STATUS,
|
|
589
|
+
]);
|
|
590
|
+
return;
|
|
591
|
+
}
|
|
592
|
+
catch (error) {
|
|
593
|
+
if (getSlackErrorCode(error) !== 'invalid_thread_ts') {
|
|
594
|
+
this.logger.warn('[AgentChatBridge] Failed to set Slack assistant status', {
|
|
595
|
+
agentId: this.agentId,
|
|
596
|
+
channelId: context.channelId,
|
|
597
|
+
threadTs: context.threadTs,
|
|
598
|
+
error: error instanceof Error ? error.message : String(error),
|
|
599
|
+
});
|
|
600
|
+
return;
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
if (!(await sleep(SLACK_STATUS_RETRY_DELAY_MS, statusRetrySignal)))
|
|
604
|
+
return;
|
|
605
|
+
try {
|
|
606
|
+
await adapter.setAssistantStatus(context.channelId, context.threadTs, SLACK_THINKING_STATUS, [
|
|
607
|
+
SLACK_THINKING_STATUS,
|
|
608
|
+
]);
|
|
609
|
+
}
|
|
610
|
+
catch (error) {
|
|
611
|
+
const errorCode = getSlackErrorCode(error);
|
|
612
|
+
const logPayload = {
|
|
613
|
+
agentId: this.agentId,
|
|
614
|
+
channelId: context.channelId,
|
|
615
|
+
threadTs: context.threadTs,
|
|
616
|
+
error: error instanceof Error ? error.message : String(error),
|
|
617
|
+
...(errorCode ? { errorCode } : {}),
|
|
618
|
+
};
|
|
619
|
+
if (errorCode === 'invalid_thread_ts') {
|
|
620
|
+
this.logger.debug('[AgentChatBridge] Slack assistant status unavailable for thread', logPayload);
|
|
621
|
+
return;
|
|
622
|
+
}
|
|
623
|
+
this.logger.warn('[AgentChatBridge] Failed to set Slack assistant status', logPayload);
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
getSlackThreadContext(message) {
|
|
627
|
+
if (this.integration.type !== 'slack')
|
|
628
|
+
return undefined;
|
|
629
|
+
const raw = message.raw;
|
|
630
|
+
if (!isRecord(raw))
|
|
631
|
+
return undefined;
|
|
632
|
+
const channelId = stringValue(raw.channel);
|
|
633
|
+
const realThreadTs = stringValue(raw.thread_ts);
|
|
634
|
+
const threadTs = realThreadTs ?? stringValue(raw.ts);
|
|
635
|
+
if (!channelId || !threadTs)
|
|
636
|
+
return undefined;
|
|
637
|
+
return {
|
|
638
|
+
channelId,
|
|
639
|
+
threadTs,
|
|
640
|
+
hasRealThreadTs: realThreadTs !== undefined,
|
|
641
|
+
};
|
|
642
|
+
}
|
|
643
|
+
getSlackAssistantStatusAdapter() {
|
|
644
|
+
const adapter = this.chat.getAdapter('slack');
|
|
645
|
+
return isSlackAssistantStatusAdapter(adapter) ? adapter : undefined;
|
|
646
|
+
}
|
|
647
|
+
async updateLatestMessageContext(threadId, resourceId, thread, options = {}) {
|
|
648
|
+
if (!this.messageContextStore)
|
|
649
|
+
return undefined;
|
|
650
|
+
const integrationConnectionId = (0, integration_tools_1.buildIntegrationConnectionId)(this.integration);
|
|
651
|
+
const previousContext = await this.getPreviousContext(threadId, integrationConnectionId);
|
|
652
|
+
const agentUserId = options.agentUserId ?? previousContext?.agentUserId;
|
|
653
|
+
const context = {
|
|
654
|
+
integrationConnectionId,
|
|
655
|
+
platform: this.integration.type,
|
|
656
|
+
target: {
|
|
657
|
+
type: 'thread',
|
|
658
|
+
threadId: thread.id,
|
|
659
|
+
channelId: thread.channelId,
|
|
660
|
+
},
|
|
661
|
+
...(options.messageId ? { messageId: options.messageId } : {}),
|
|
662
|
+
...(options.interactingUserId ? { interactingUserId: options.interactingUserId } : {}),
|
|
663
|
+
...(agentUserId ? { agentUserId } : {}),
|
|
664
|
+
...(options.subject ? { subject: options.subject } : {}),
|
|
665
|
+
...(!options.subject && previousContext?.subject ? { subject: previousContext.subject } : {}),
|
|
666
|
+
updatedAt: new Date().toISOString(),
|
|
667
|
+
};
|
|
668
|
+
try {
|
|
669
|
+
await this.messageContextStore.setLatest(threadId, resourceId, context);
|
|
670
|
+
return context;
|
|
671
|
+
}
|
|
672
|
+
catch (error) {
|
|
673
|
+
this.logger.warn('[AgentChatBridge] Failed to update latest message context', {
|
|
674
|
+
agentId: this.agentId,
|
|
675
|
+
threadId,
|
|
676
|
+
error: error instanceof Error ? error.message : String(error),
|
|
677
|
+
});
|
|
678
|
+
return undefined;
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
getPlatformAgentContext() {
|
|
682
|
+
if (this.integration.type !== 'slack')
|
|
683
|
+
return {};
|
|
684
|
+
const adapter = this.chat.getAdapter(this.integration.type);
|
|
685
|
+
if (!isRecord(adapter))
|
|
686
|
+
return {};
|
|
687
|
+
const agentUserId = stringValue(adapter.botUserId);
|
|
688
|
+
return agentUserId ? { agentUserId } : {};
|
|
689
|
+
}
|
|
690
|
+
prepareInboundText(text, context) {
|
|
691
|
+
const trimmed = text?.trim() ?? '';
|
|
692
|
+
if (this.integration.type !== 'slack' || !context.agentUserId)
|
|
693
|
+
return trimmed;
|
|
694
|
+
return stripSlackSelfMention(trimmed, context.agentUserId);
|
|
695
|
+
}
|
|
696
|
+
async getPreviousContext(threadId, integrationConnectionId) {
|
|
697
|
+
if (!this.messageContextStore)
|
|
698
|
+
return undefined;
|
|
699
|
+
try {
|
|
700
|
+
const previousContext = await this.messageContextStore.getLatest(threadId);
|
|
701
|
+
if (previousContext?.integrationConnectionId !== integrationConnectionId) {
|
|
702
|
+
return undefined;
|
|
703
|
+
}
|
|
704
|
+
return previousContext;
|
|
705
|
+
}
|
|
706
|
+
catch (error) {
|
|
707
|
+
this.logger.warn('[AgentChatBridge] Failed to read previous message context', {
|
|
708
|
+
agentId: this.agentId,
|
|
709
|
+
threadId,
|
|
710
|
+
error: error instanceof Error ? error.message : String(error),
|
|
711
|
+
});
|
|
712
|
+
return undefined;
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
async resolveMessageSubject(message) {
|
|
716
|
+
try {
|
|
717
|
+
return toIntegrationMessageSubject(await message.subject);
|
|
718
|
+
}
|
|
719
|
+
catch (error) {
|
|
720
|
+
this.logger.debug(`[AgentChatBridge] Failed to fetch message subject: ${error instanceof Error ? error.message : String(error)}`);
|
|
721
|
+
return undefined;
|
|
722
|
+
}
|
|
723
|
+
}
|
|
519
724
|
async handleAction(event) {
|
|
520
725
|
const { thread } = event;
|
|
521
726
|
if (!thread) {
|
|
@@ -531,6 +736,13 @@ class AgentChatBridge {
|
|
|
531
736
|
const parsed = this.parseActionId(callbackData.actionId, callbackData.value);
|
|
532
737
|
if (!parsed)
|
|
533
738
|
return;
|
|
739
|
+
const platformThreadId = this.resolvePlatformThreadId(thread);
|
|
740
|
+
const threadId = this.toAgentThreadId(platformThreadId);
|
|
741
|
+
await this.updateLatestMessageContext(threadId.id, event.user.userId, thread, {
|
|
742
|
+
messageId: event.messageId,
|
|
743
|
+
interactingUserId: event.user.userId,
|
|
744
|
+
...this.getPlatformAgentContext(),
|
|
745
|
+
});
|
|
534
746
|
await this.cleanUpBeforeResume(event);
|
|
535
747
|
await this.executeResume(thread, parsed.runId, parsed.toolCallId, parsed.resumeData);
|
|
536
748
|
}
|
|
@@ -560,4 +772,48 @@ class AgentChatBridge {
|
|
|
560
772
|
}
|
|
561
773
|
}
|
|
562
774
|
exports.AgentChatBridge = AgentChatBridge;
|
|
775
|
+
function stripSlackSelfMention(text, userId) {
|
|
776
|
+
const escapedUserId = escapeRegExp(userId);
|
|
777
|
+
return text
|
|
778
|
+
.replace(new RegExp(`(^|\\s)<@!?${escapedUserId}(?:\\|[^>]+)?>`, 'gi'), '$1')
|
|
779
|
+
.replace(new RegExp(`(^|\\s)@${escapedUserId}\\b`, 'gi'), '$1')
|
|
780
|
+
.replace(/\s+/g, ' ')
|
|
781
|
+
.trim();
|
|
782
|
+
}
|
|
783
|
+
function isRecord(value) {
|
|
784
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
785
|
+
}
|
|
786
|
+
function isSlackAssistantStatusAdapter(value) {
|
|
787
|
+
return isRecord(value) && typeof value.setAssistantStatus === 'function';
|
|
788
|
+
}
|
|
789
|
+
function stringValue(value) {
|
|
790
|
+
return typeof value === 'string' && value.length > 0 ? value : undefined;
|
|
791
|
+
}
|
|
792
|
+
function escapeRegExp(value) {
|
|
793
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
794
|
+
}
|
|
795
|
+
function getSlackErrorCode(error) {
|
|
796
|
+
if (!isRecord(error))
|
|
797
|
+
return undefined;
|
|
798
|
+
const data = error.data;
|
|
799
|
+
if (!isRecord(data))
|
|
800
|
+
return undefined;
|
|
801
|
+
return stringValue(data.error);
|
|
802
|
+
}
|
|
803
|
+
async function sleep(ms, signal) {
|
|
804
|
+
if (signal?.aborted)
|
|
805
|
+
return false;
|
|
806
|
+
return await new Promise((resolve) => {
|
|
807
|
+
const timeout = setTimeout(() => {
|
|
808
|
+
signal?.removeEventListener('abort', abort);
|
|
809
|
+
resolve(true);
|
|
810
|
+
}, ms);
|
|
811
|
+
const abort = () => {
|
|
812
|
+
clearTimeout(timeout);
|
|
813
|
+
signal?.removeEventListener('abort', abort);
|
|
814
|
+
resolve(false);
|
|
815
|
+
};
|
|
816
|
+
signal?.addEventListener('abort', abort, { once: true });
|
|
817
|
+
});
|
|
818
|
+
}
|
|
563
819
|
//# sourceMappingURL=agent-chat-bridge.js.map
|