n8n 2.20.7 → 2.21.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/abstract-server.d.ts +1 -0
- package/dist/abstract-server.js +10 -3
- package/dist/abstract-server.js.map +1 -1
- package/dist/agent-library-bundle.js +5989 -0
- package/dist/auth/auth.service.js +3 -3
- package/dist/auth/auth.service.js.map +1 -1
- package/dist/build.tsbuildinfo +1 -1
- package/dist/commands/execute-batch.d.ts +2 -2
- package/dist/commands/export/workflow.d.ts +2 -2
- package/dist/commands/import/workflow.d.ts +3 -0
- package/dist/commands/import/workflow.js +15 -1
- package/dist/commands/import/workflow.js.map +1 -1
- package/dist/commands/start.js +2 -0
- package/dist/commands/start.js.map +1 -1
- package/dist/constants.d.ts +1 -0
- package/dist/constants.js +6 -1
- package/dist/constants.js.map +1 -1
- package/dist/controller.registry.js +6 -0
- package/dist/controller.registry.js.map +1 -1
- package/dist/controllers/auth.controller.js +7 -2
- package/dist/controllers/auth.controller.js.map +1 -1
- package/dist/controllers/me.controller.d.ts +1 -0
- package/dist/controllers/me.controller.js +4 -1
- package/dist/controllers/me.controller.js.map +1 -1
- package/dist/controllers/users.controller.d.ts +2 -2
- package/dist/credentials/credentials.service.d.ts +1 -0
- package/dist/credentials/credentials.service.js +11 -4
- package/dist/credentials/credentials.service.js.map +1 -1
- package/dist/evaluation.ee/evaluation-api-error.d.ts +7 -0
- package/dist/evaluation.ee/evaluation-api-error.js +16 -0
- package/dist/evaluation.ee/evaluation-api-error.js.map +1 -0
- package/dist/evaluation.ee/evaluation-config-validator.d.ts +30 -0
- package/dist/evaluation.ee/evaluation-config-validator.js +236 -0
- package/dist/evaluation.ee/evaluation-config-validator.js.map +1 -0
- package/dist/evaluation.ee/evaluation-config.controller.d.ts +24 -0
- package/dist/evaluation.ee/evaluation-config.controller.js +94 -0
- package/dist/evaluation.ee/evaluation-config.controller.js.map +1 -0
- package/dist/evaluation.ee/evaluation-config.service.d.ts +18 -0
- package/dist/evaluation.ee/evaluation-config.service.js +74 -0
- package/dist/evaluation.ee/evaluation-config.service.js.map +1 -0
- package/dist/evaluation.ee/llm-judge-provider-registry.d.ts +13 -0
- package/dist/evaluation.ee/llm-judge-provider-registry.js +122 -0
- package/dist/evaluation.ee/llm-judge-provider-registry.js.map +1 -0
- package/dist/evaluation.ee/test-runner/test-runner.service.ee.d.ts +5 -0
- package/dist/evaluation.ee/test-runner/test-runner.service.ee.js +32 -10
- package/dist/evaluation.ee/test-runner/test-runner.service.ee.js.map +1 -1
- package/dist/evaluation.ee/test-runner/workflow-compiler.service.d.ts +22 -0
- package/dist/evaluation.ee/test-runner/workflow-compiler.service.js +285 -0
- package/dist/evaluation.ee/test-runner/workflow-compiler.service.js.map +1 -0
- package/dist/evaluation.ee/test-runs.controller.ee.d.ts +3 -0
- package/dist/evaluation.ee/test-runs.controller.ee.js +26 -9
- package/dist/evaluation.ee/test-runs.controller.ee.js.map +1 -1
- package/dist/evaluation.ee/test-runs.types.ee.d.ts +3 -0
- package/dist/eventbus/message-event-bus/message-event-bus.d.ts +2 -0
- package/dist/eventbus/message-event-bus/message-event-bus.js +54 -46
- package/dist/eventbus/message-event-bus/message-event-bus.js.map +1 -1
- package/dist/events/maps/relay.event-map.d.ts +3 -0
- package/dist/instance-settings-loader/instance-settings-loader.service.d.ts +4 -2
- package/dist/instance-settings-loader/instance-settings-loader.service.js +7 -3
- package/dist/instance-settings-loader/instance-settings-loader.service.js.map +1 -1
- package/dist/instance-settings-loader/loaders/community-packages.instance-settings-loader.d.ts +20 -0
- package/dist/instance-settings-loader/loaders/community-packages.instance-settings-loader.js +235 -0
- package/dist/instance-settings-loader/loaders/community-packages.instance-settings-loader.js.map +1 -0
- package/dist/instance-settings-loader/loaders/{sso.instance-settings-loader.d.ts → sso/oidc.instance-settings-loader.d.ts} +4 -10
- package/dist/instance-settings-loader/loaders/sso/oidc.instance-settings-loader.js +98 -0
- package/dist/instance-settings-loader/loaders/sso/oidc.instance-settings-loader.js.map +1 -0
- package/dist/instance-settings-loader/loaders/sso/provisioning.instance-settings-loader.d.ts +10 -0
- package/dist/instance-settings-loader/loaders/sso/provisioning.instance-settings-loader.js +65 -0
- package/dist/instance-settings-loader/loaders/sso/provisioning.instance-settings-loader.js.map +1 -0
- package/dist/instance-settings-loader/loaders/sso/saml.instance-settings-loader.d.ts +12 -0
- package/dist/instance-settings-loader/loaders/sso/saml.instance-settings-loader.js +75 -0
- package/dist/instance-settings-loader/loaders/sso/saml.instance-settings-loader.js.map +1 -0
- package/dist/instance-settings-loader/loaders/sso/sso.instance-settings-loader.d.ts +15 -0
- package/dist/instance-settings-loader/loaders/sso/sso.instance-settings-loader.js +75 -0
- package/dist/instance-settings-loader/loaders/sso/sso.instance-settings-loader.js.map +1 -0
- package/dist/load-nodes-and-credentials.d.ts +3 -3
- package/dist/load-nodes-and-credentials.js +25 -17
- package/dist/load-nodes-and-credentials.js.map +1 -1
- package/dist/modules/agents/adapters/agents-credential-provider.d.ts +12 -0
- package/dist/modules/agents/adapters/agents-credential-provider.js +63 -0
- package/dist/modules/agents/adapters/agents-credential-provider.js.map +1 -0
- package/dist/modules/agents/agent-execution.service.d.ts +42 -0
- package/dist/modules/agents/agent-execution.service.js +153 -0
- package/dist/modules/agents/agent-execution.service.js.map +1 -0
- package/dist/modules/agents/agent-message-mapper.d.ts +5 -0
- package/dist/modules/agents/agent-message-mapper.js +43 -0
- package/dist/modules/agents/agent-message-mapper.js.map +1 -0
- package/dist/modules/agents/agent-skills.service.d.ts +24 -0
- package/dist/modules/agents/agent-skills.service.js +166 -0
- package/dist/modules/agents/agent-skills.service.js.map +1 -0
- package/dist/modules/agents/agent-sse-stream.d.ts +15 -0
- package/dist/modules/agents/agent-sse-stream.js +194 -0
- package/dist/modules/agents/agent-sse-stream.js.map +1 -0
- package/dist/modules/agents/agents-tools.service.d.ts +18 -0
- package/dist/modules/agents/agents-tools.service.js +193 -0
- package/dist/modules/agents/agents-tools.service.js.map +1 -0
- package/dist/modules/agents/agents.controller.d.ts +260 -0
- package/dist/modules/agents/agents.controller.js +818 -0
- package/dist/modules/agents/agents.controller.js.map +1 -0
- package/dist/modules/agents/agents.module.d.ts +12 -0
- package/dist/modules/agents/agents.module.js +136 -0
- package/dist/modules/agents/agents.module.js.map +1 -0
- package/dist/modules/agents/agents.service.d.ts +151 -0
- package/dist/modules/agents/agents.service.js +1134 -0
- package/dist/modules/agents/agents.service.js.map +1 -0
- package/dist/modules/agents/builder/agents-builder-prompts.d.ts +27 -0
- package/dist/modules/agents/builder/agents-builder-prompts.js +584 -0
- package/dist/modules/agents/builder/agents-builder-prompts.js.map +1 -0
- package/dist/modules/agents/builder/agents-builder-settings.controller.d.ts +11 -0
- package/dist/modules/agents/builder/agents-builder-settings.controller.js +61 -0
- package/dist/modules/agents/builder/agents-builder-settings.controller.js.map +1 -0
- package/dist/modules/agents/builder/agents-builder-settings.service.d.ts +31 -0
- package/dist/modules/agents/builder/agents-builder-settings.service.js +199 -0
- package/dist/modules/agents/builder/agents-builder-settings.service.js.map +1 -0
- package/dist/modules/agents/builder/agents-builder-tools.service.d.ts +31 -0
- package/dist/modules/agents/builder/agents-builder-tools.service.js +420 -0
- package/dist/modules/agents/builder/agents-builder-tools.service.js.map +1 -0
- package/dist/modules/agents/builder/agents-builder.service.d.ts +26 -0
- package/dist/modules/agents/builder/agents-builder.service.js +164 -0
- package/dist/modules/agents/builder/agents-builder.service.js.map +1 -0
- package/dist/modules/agents/builder/builder-model-lookup.service.d.ts +17 -0
- package/dist/modules/agents/builder/builder-model-lookup.service.js +67 -0
- package/dist/modules/agents/builder/builder-model-lookup.service.js.map +1 -0
- package/dist/modules/agents/builder/builder-tool-names.d.ts +14 -0
- package/dist/modules/agents/builder/builder-tool-names.js +17 -0
- package/dist/modules/agents/builder/builder-tool-names.js.map +1 -0
- package/dist/modules/agents/builder/errors.d.ts +6 -0
- package/dist/modules/agents/builder/errors.js +13 -0
- package/dist/modules/agents/builder/errors.js.map +1 -0
- package/dist/modules/agents/builder/interactive/ask-credential.tool.d.ts +5 -0
- package/dist/modules/agents/builder/interactive/ask-credential.tool.js +29 -0
- package/dist/modules/agents/builder/interactive/ask-credential.tool.js.map +1 -0
- package/dist/modules/agents/builder/interactive/ask-llm.tool.d.ts +2 -0
- package/dist/modules/agents/builder/interactive/ask-llm.tool.js +27 -0
- package/dist/modules/agents/builder/interactive/ask-llm.tool.js.map +1 -0
- package/dist/modules/agents/builder/interactive/ask-question.tool.d.ts +2 -0
- package/dist/modules/agents/builder/interactive/ask-question.tool.js +26 -0
- package/dist/modules/agents/builder/interactive/ask-question.tool.js.map +1 -0
- package/dist/modules/agents/builder/interactive/index.d.ts +4 -0
- package/dist/modules/agents/builder/interactive/index.js +12 -0
- package/dist/modules/agents/builder/interactive/index.js.map +1 -0
- package/dist/modules/agents/builder/interactive/llm-provider-defaults.d.ts +17 -0
- package/dist/modules/agents/builder/interactive/llm-provider-defaults.js +60 -0
- package/dist/modules/agents/builder/interactive/llm-provider-defaults.js.map +1 -0
- package/dist/modules/agents/builder/interactive/resolve-llm.tool.d.ts +13 -0
- package/dist/modules/agents/builder/interactive/resolve-llm.tool.js +136 -0
- package/dist/modules/agents/builder/interactive/resolve-llm.tool.js.map +1 -0
- package/dist/modules/agents/entities/agent-checkpoint.entity.d.ts +9 -0
- package/dist/modules/agents/entities/agent-checkpoint.entity.js +43 -0
- package/dist/modules/agents/entities/agent-checkpoint.entity.js.map +1 -0
- package/dist/modules/agents/entities/agent-execution-thread.entity.d.ts +16 -0
- package/dist/modules/agents/entities/agent-execution-thread.entity.js +74 -0
- package/dist/modules/agents/entities/agent-execution-thread.entity.js.map +1 -0
- package/dist/modules/agents/entities/agent-execution.entity.d.ts +26 -0
- package/dist/modules/agents/entities/agent-execution.entity.js +100 -0
- package/dist/modules/agents/entities/agent-execution.entity.js.map +1 -0
- package/dist/modules/agents/entities/agent-message.entity.d.ts +10 -0
- package/dist/modules/agents/entities/agent-message.entity.js +47 -0
- package/dist/modules/agents/entities/agent-message.entity.js.map +1 -0
- package/dist/modules/agents/entities/agent-observation-cursor.entity.d.ts +8 -0
- package/dist/modules/agents/entities/agent-observation-cursor.entity.js +37 -0
- package/dist/modules/agents/entities/agent-observation-cursor.entity.js.map +1 -0
- package/dist/modules/agents/entities/agent-observation-lock.entity.d.ts +8 -0
- package/dist/modules/agents/entities/agent-observation-lock.entity.js +37 -0
- package/dist/modules/agents/entities/agent-observation-lock.entity.js.map +1 -0
- package/dist/modules/agents/entities/agent-observation.entity.d.ts +10 -0
- package/dist/modules/agents/entities/agent-observation.entity.js +47 -0
- package/dist/modules/agents/entities/agent-observation.entity.js.map +1 -0
- package/dist/modules/agents/entities/agent-published-version.entity.d.ts +22 -0
- package/dist/modules/agents/entities/agent-published-version.entity.js +67 -0
- package/dist/modules/agents/entities/agent-published-version.entity.js.map +1 -0
- package/dist/modules/agents/entities/agent-resource.entity.d.ts +5 -0
- package/dist/modules/agents/entities/agent-resource.entity.js +29 -0
- package/dist/modules/agents/entities/agent-resource.entity.js.map +1 -0
- package/dist/modules/agents/entities/agent-thread.entity.d.ts +6 -0
- package/dist/modules/agents/entities/agent-thread.entity.js +33 -0
- package/dist/modules/agents/entities/agent-thread.entity.js.map +1 -0
- package/dist/modules/agents/entities/agent.entity.d.ts +24 -0
- package/dist/modules/agents/entities/agent.entity.js +74 -0
- package/dist/modules/agents/entities/agent.entity.js.map +1 -0
- package/dist/modules/agents/execution-recorder.d.ts +82 -0
- package/dist/modules/agents/execution-recorder.js +272 -0
- package/dist/modules/agents/execution-recorder.js.map +1 -0
- package/dist/modules/agents/integrations/agent-chat-bridge.d.ts +62 -0
- package/dist/modules/agents/integrations/agent-chat-bridge.js +540 -0
- package/dist/modules/agents/integrations/agent-chat-bridge.js.map +1 -0
- package/dist/modules/agents/integrations/agent-chat-integration.d.ts +39 -0
- package/dist/modules/agents/integrations/agent-chat-integration.js +45 -0
- package/dist/modules/agents/integrations/agent-chat-integration.js.map +1 -0
- package/dist/modules/agents/integrations/agent-schedule.service.d.ts +30 -0
- package/dist/modules/agents/integrations/agent-schedule.service.js +327 -0
- package/dist/modules/agents/integrations/agent-schedule.service.js.map +1 -0
- package/dist/modules/agents/integrations/callback-store.d.ts +11 -0
- package/dist/modules/agents/integrations/callback-store.js +30 -0
- package/dist/modules/agents/integrations/callback-store.js.map +1 -0
- package/dist/modules/agents/integrations/chat-integration.service.d.ts +58 -0
- package/dist/modules/agents/integrations/chat-integration.service.js +397 -0
- package/dist/modules/agents/integrations/chat-integration.service.js.map +1 -0
- package/dist/modules/agents/integrations/component-mapper.d.ts +57 -0
- package/dist/modules/agents/integrations/component-mapper.js +223 -0
- package/dist/modules/agents/integrations/component-mapper.js.map +1 -0
- package/dist/modules/agents/integrations/cron-validation.d.ts +1 -0
- package/dist/modules/agents/integrations/cron-validation.js +8 -0
- package/dist/modules/agents/integrations/cron-validation.js.map +1 -0
- package/dist/modules/agents/integrations/esm-loader.d.ts +5 -0
- package/dist/modules/agents/integrations/esm-loader.js +24 -0
- package/dist/modules/agents/integrations/esm-loader.js.map +1 -0
- package/dist/modules/agents/integrations/integrations-sync.d.ts +4 -0
- package/dist/modules/agents/integrations/integrations-sync.js +78 -0
- package/dist/modules/agents/integrations/integrations-sync.js.map +1 -0
- package/dist/modules/agents/integrations/n8n-checkpoint-storage.d.ts +36 -0
- package/dist/modules/agents/integrations/n8n-checkpoint-storage.js +148 -0
- package/dist/modules/agents/integrations/n8n-checkpoint-storage.js.map +1 -0
- package/dist/modules/agents/integrations/n8n-memory.d.ts +76 -0
- package/dist/modules/agents/integrations/n8n-memory.js +383 -0
- package/dist/modules/agents/integrations/n8n-memory.js.map +1 -0
- package/dist/modules/agents/integrations/platforms/linear-integration.d.ts +14 -0
- package/dist/modules/agents/integrations/platforms/linear-integration.js +83 -0
- package/dist/modules/agents/integrations/platforms/linear-integration.js.map +1 -0
- package/dist/modules/agents/integrations/platforms/slack-integration.d.ts +12 -0
- package/dist/modules/agents/integrations/platforms/slack-integration.js +81 -0
- package/dist/modules/agents/integrations/platforms/slack-integration.js.map +1 -0
- package/dist/modules/agents/integrations/platforms/telegram-integration.d.ts +30 -0
- package/dist/modules/agents/integrations/platforms/telegram-integration.js +122 -0
- package/dist/modules/agents/integrations/platforms/telegram-integration.js.map +1 -0
- package/dist/modules/agents/integrations/rich-interaction-tool.d.ts +47 -0
- package/dist/modules/agents/integrations/rich-interaction-tool.js +109 -0
- package/dist/modules/agents/integrations/rich-interaction-tool.js.map +1 -0
- package/dist/modules/agents/integrations/types.d.ts +8 -0
- package/dist/modules/agents/integrations/types.js +12 -0
- package/dist/modules/agents/integrations/types.js.map +1 -0
- package/dist/modules/agents/json-config/agent-config-composition.d.ts +9 -0
- package/dist/modules/agents/json-config/agent-config-composition.js +27 -0
- package/dist/modules/agents/json-config/agent-config-composition.js.map +1 -0
- package/dist/modules/agents/json-config/agent-json-config.d.ts +1022 -0
- package/dist/modules/agents/json-config/agent-json-config.js +128 -0
- package/dist/modules/agents/json-config/agent-json-config.js.map +1 -0
- package/dist/modules/agents/json-config/credential-field-mapping.d.ts +4 -0
- package/dist/modules/agents/json-config/credential-field-mapping.js +41 -0
- package/dist/modules/agents/json-config/credential-field-mapping.js.map +1 -0
- package/dist/modules/agents/json-config/from-json-config.d.ts +18 -0
- package/dist/modules/agents/json-config/from-json-config.js +209 -0
- package/dist/modules/agents/json-config/from-json-config.js.map +1 -0
- package/dist/modules/agents/json-config/integration-config.d.ts +61 -0
- package/dist/modules/agents/json-config/integration-config.js +33 -0
- package/dist/modules/agents/json-config/integration-config.js.map +1 -0
- package/dist/modules/agents/json-config/provider-tool-aliases.d.ts +1 -0
- package/dist/modules/agents/json-config/provider-tool-aliases.js +15 -0
- package/dist/modules/agents/json-config/provider-tool-aliases.js.map +1 -0
- package/dist/modules/agents/json-config/schema-text-serializer.d.ts +2 -0
- package/dist/modules/agents/json-config/schema-text-serializer.js +205 -0
- package/dist/modules/agents/json-config/schema-text-serializer.js.map +1 -0
- package/dist/modules/agents/repositories/agent-checkpoint.repository.d.ts +6 -0
- package/dist/modules/agents/repositories/agent-checkpoint.repository.js +35 -0
- package/dist/modules/agents/repositories/agent-checkpoint.repository.js.map +1 -0
- package/dist/modules/agents/repositories/agent-execution-thread.repository.d.ts +18 -0
- package/dist/modules/agents/repositories/agent-execution-thread.repository.js +120 -0
- package/dist/modules/agents/repositories/agent-execution-thread.repository.js.map +1 -0
- package/dist/modules/agents/repositories/agent-execution.repository.d.ts +10 -0
- package/dist/modules/agents/repositories/agent-execution.repository.js +59 -0
- package/dist/modules/agents/repositories/agent-execution.repository.js.map +1 -0
- package/dist/modules/agents/repositories/agent-message.repository.d.ts +5 -0
- package/dist/modules/agents/repositories/agent-message.repository.js +26 -0
- package/dist/modules/agents/repositories/agent-message.repository.js.map +1 -0
- package/dist/modules/agents/repositories/agent-observation-cursor.repository.d.ts +5 -0
- package/dist/modules/agents/repositories/agent-observation-cursor.repository.js +26 -0
- package/dist/modules/agents/repositories/agent-observation-cursor.repository.js.map +1 -0
- package/dist/modules/agents/repositories/agent-observation-lock.repository.d.ts +5 -0
- package/dist/modules/agents/repositories/agent-observation-lock.repository.js +26 -0
- package/dist/modules/agents/repositories/agent-observation-lock.repository.js.map +1 -0
- package/dist/modules/agents/repositories/agent-observation.repository.d.ts +5 -0
- package/dist/modules/agents/repositories/agent-observation.repository.js +26 -0
- package/dist/modules/agents/repositories/agent-observation.repository.js.map +1 -0
- package/dist/modules/agents/repositories/agent-published-version.repository.d.ts +20 -0
- package/dist/modules/agents/repositories/agent-published-version.repository.js +35 -0
- package/dist/modules/agents/repositories/agent-published-version.repository.js.map +1 -0
- package/dist/modules/agents/repositories/agent-resource.repository.d.ts +5 -0
- package/dist/modules/agents/repositories/agent-resource.repository.js +26 -0
- package/dist/modules/agents/repositories/agent-resource.repository.js.map +1 -0
- package/dist/modules/agents/repositories/agent-thread.repository.d.ts +5 -0
- package/dist/modules/agents/repositories/agent-thread.repository.js +26 -0
- package/dist/modules/agents/repositories/agent-thread.repository.js.map +1 -0
- package/dist/modules/agents/repositories/agent.repository.d.ts +9 -0
- package/dist/modules/agents/repositories/agent.repository.js +50 -0
- package/dist/modules/agents/repositories/agent.repository.js.map +1 -0
- package/dist/modules/agents/runtime/agent-isolate-pool.d.ts +48 -0
- package/dist/modules/agents/runtime/agent-isolate-pool.js +246 -0
- package/dist/modules/agents/runtime/agent-isolate-pool.js.map +1 -0
- package/dist/modules/agents/runtime/agent-secure-runtime.d.ts +21 -0
- package/dist/modules/agents/runtime/agent-secure-runtime.js +281 -0
- package/dist/modules/agents/runtime/agent-secure-runtime.js.map +1 -0
- package/dist/modules/agents/runtime/sandbox-polyfills.d.ts +1 -0
- package/dist/modules/agents/runtime/sandbox-polyfills.js +74 -0
- package/dist/modules/agents/runtime/sandbox-polyfills.js.map +1 -0
- package/dist/modules/agents/tool-registry.d.ts +13 -0
- package/dist/modules/agents/tool-registry.js +42 -0
- package/dist/modules/agents/tool-registry.js.map +1 -0
- package/dist/modules/agents/tools/environment-tool.d.ts +3 -0
- package/dist/modules/agents/tools/environment-tool.js +26 -0
- package/dist/modules/agents/tools/environment-tool.js.map +1 -0
- package/dist/modules/agents/tools/node-tool-factory.d.ts +10 -0
- package/dist/modules/agents/tools/node-tool-factory.js +100 -0
- package/dist/modules/agents/tools/node-tool-factory.js.map +1 -0
- package/dist/modules/agents/tools/workflow-tool-factory.d.ts +43 -0
- package/dist/modules/agents/tools/workflow-tool-factory.js +404 -0
- package/dist/modules/agents/tools/workflow-tool-factory.js.map +1 -0
- package/dist/modules/agents/tracing/builder-telemetry.d.ts +12 -0
- package/dist/modules/agents/tracing/builder-telemetry.js +48 -0
- package/dist/modules/agents/tracing/builder-telemetry.js.map +1 -0
- package/dist/modules/agents/types/components.d.ts +71 -0
- package/dist/modules/agents/types/components.js +3 -0
- package/dist/modules/agents/types/components.js.map +1 -0
- package/dist/modules/agents/types/index.d.ts +1 -0
- package/dist/modules/agents/types/index.js +3 -0
- package/dist/modules/agents/types/index.js.map +1 -0
- package/dist/modules/agents/utils/agent-draft.utils.d.ts +2 -0
- package/dist/modules/agents/utils/agent-draft.utils.js +11 -0
- package/dist/modules/agents/utils/agent-draft.utils.js.map +1 -0
- package/dist/modules/agents/utils/agent-resource-id.d.ts +3 -0
- package/dist/modules/agents/utils/agent-resource-id.js +14 -0
- package/dist/modules/agents/utils/agent-resource-id.js.map +1 -0
- 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 +2 -2
- package/dist/modules/chat-hub/dto/chat-models-request.dto.d.ts +1 -1
- package/dist/modules/community-packages/community-packages.config.js +2 -2
- package/dist/modules/community-packages/community-packages.config.js.map +1 -1
- package/dist/modules/community-packages/community-packages.lifecycle.service.d.ts +4 -1
- package/dist/modules/community-packages/community-packages.lifecycle.service.js +14 -2
- package/dist/modules/community-packages/community-packages.lifecycle.service.js.map +1 -1
- package/dist/modules/community-packages/community-packages.module.d.ts +1 -1
- package/dist/modules/community-packages/community-packages.module.js +10 -5
- package/dist/modules/community-packages/community-packages.module.js.map +1 -1
- package/dist/modules/data-table/data-table.service.js +6 -0
- package/dist/modules/data-table/data-table.service.js.map +1 -1
- package/dist/modules/dynamic-credentials.ee/credential-resolvers/identifiers/slack-signature-identifier.d.ts +1 -1
- package/dist/modules/dynamic-credentials.ee/dynamic-credentials.config.d.ts +2 -0
- package/dist/modules/dynamic-credentials.ee/dynamic-credentials.config.js +10 -0
- package/dist/modules/dynamic-credentials.ee/dynamic-credentials.config.js.map +1 -1
- package/dist/modules/dynamic-credentials.ee/dynamic-credentials.controller.d.ts +1 -1
- package/dist/modules/dynamic-credentials.ee/dynamic-credentials.controller.js +16 -4
- package/dist/modules/dynamic-credentials.ee/dynamic-credentials.controller.js.map +1 -1
- package/dist/modules/dynamic-credentials.ee/workflow-status.controller.d.ts +3 -3
- package/dist/modules/dynamic-credentials.ee/workflow-status.controller.js +11 -3
- package/dist/modules/dynamic-credentials.ee/workflow-status.controller.js.map +1 -1
- package/dist/modules/encryption-key-manager/encryption-bootstrap.service.js +4 -2
- package/dist/modules/encryption-key-manager/encryption-bootstrap.service.js.map +1 -1
- package/dist/modules/encryption-key-manager/encryption-key-manager.module.js +5 -2
- package/dist/modules/encryption-key-manager/encryption-key-manager.module.js.map +1 -1
- package/dist/modules/encryption-key-manager/encryption-key.controller.d.ts +3 -3
- package/dist/modules/encryption-key-manager/encryption-key.controller.js +8 -2
- package/dist/modules/encryption-key-manager/encryption-key.controller.js.map +1 -1
- package/dist/modules/encryption-key-manager/key-manager.service.d.ts +5 -1
- package/dist/modules/encryption-key-manager/key-manager.service.js +11 -4
- package/dist/modules/encryption-key-manager/key-manager.service.js.map +1 -1
- package/dist/modules/insights/insights-collection.service.js +1 -0
- package/dist/modules/insights/insights-collection.service.js.map +1 -1
- package/dist/modules/instance-ai/eval/mock-handler.js +17 -49
- package/dist/modules/instance-ai/eval/mock-handler.js.map +1 -1
- package/dist/modules/instance-ai/filesystem/local-gateway-registry.d.ts +1 -0
- package/dist/modules/instance-ai/filesystem/local-gateway-registry.js +21 -3
- package/dist/modules/instance-ai/filesystem/local-gateway-registry.js.map +1 -1
- package/dist/modules/instance-ai/instance-ai-settings.service.d.ts +3 -2
- package/dist/modules/instance-ai/instance-ai-settings.service.js +10 -9
- package/dist/modules/instance-ai/instance-ai-settings.service.js.map +1 -1
- package/dist/modules/instance-ai/instance-ai-test.controller.d.ts +21 -2
- package/dist/modules/instance-ai/instance-ai-test.controller.js +35 -3
- package/dist/modules/instance-ai/instance-ai-test.controller.js.map +1 -1
- package/dist/modules/instance-ai/instance-ai.adapter.service.js +72 -42
- package/dist/modules/instance-ai/instance-ai.adapter.service.js.map +1 -1
- package/dist/modules/instance-ai/instance-ai.controller.d.ts +2 -0
- package/dist/modules/instance-ai/instance-ai.controller.js +25 -1
- package/dist/modules/instance-ai/instance-ai.controller.js.map +1 -1
- package/dist/modules/instance-ai/instance-ai.module.d.ts +0 -1
- package/dist/modules/instance-ai/instance-ai.module.js +0 -2
- package/dist/modules/instance-ai/instance-ai.module.js.map +1 -1
- package/dist/modules/instance-ai/instance-ai.service.d.ts +34 -5
- package/dist/modules/instance-ai/instance-ai.service.js +723 -76
- package/dist/modules/instance-ai/instance-ai.service.js.map +1 -1
- package/dist/modules/instance-ai/liveness/index.d.ts +1 -0
- package/dist/modules/instance-ai/liveness/index.js +7 -0
- package/dist/modules/instance-ai/liveness/index.js.map +1 -0
- package/dist/modules/instance-ai/liveness/instance-ai-liveness.service.d.ts +72 -0
- package/dist/modules/instance-ai/liveness/instance-ai-liveness.service.js +123 -0
- package/dist/modules/instance-ai/liveness/instance-ai-liveness.service.js.map +1 -0
- package/dist/modules/instance-ai/message-parser.js +85 -6
- package/dist/modules/instance-ai/message-parser.js.map +1 -1
- package/dist/modules/instance-ai/storage/db-snapshot-storage.js +4 -0
- package/dist/modules/instance-ai/storage/db-snapshot-storage.js.map +1 -1
- package/dist/modules/instance-ai/storage/typeorm-memory-storage.js +1 -0
- package/dist/modules/instance-ai/storage/typeorm-memory-storage.js.map +1 -1
- package/dist/modules/instance-ai/web-research/fetch-and-extract.js +23 -7
- package/dist/modules/instance-ai/web-research/fetch-and-extract.js.map +1 -1
- package/dist/modules/mcp/mcp.service.d.ts +3 -3
- package/dist/modules/mcp/mcp.service.js +12 -9
- package/dist/modules/mcp/mcp.service.js.map +1 -1
- package/dist/modules/mcp/tools/get-execution.tool.js +6 -4
- package/dist/modules/mcp/tools/get-execution.tool.js.map +1 -1
- package/dist/modules/mcp/tools/list-credentials.tool.d.ts +40 -0
- package/dist/modules/mcp/tools/list-credentials.tool.js +148 -0
- package/dist/modules/mcp/tools/list-credentials.tool.js.map +1 -0
- package/dist/modules/mcp/tools/workflow-builder/create-workflow-from-code.tool.js +5 -4
- package/dist/modules/mcp/tools/workflow-builder/create-workflow-from-code.tool.js.map +1 -1
- package/dist/modules/mcp/tools/workflow-builder/get-suggested-workflow-nodes.tool.d.ts +2 -2
- package/dist/modules/mcp/tools/workflow-builder/get-suggested-workflow-nodes.tool.js +3 -3
- package/dist/modules/mcp/tools/workflow-builder/get-suggested-workflow-nodes.tool.js.map +1 -1
- package/dist/modules/mcp/tools/workflow-builder/get-workflow-node-types.tool.d.ts +2 -2
- package/dist/modules/mcp/tools/workflow-builder/get-workflow-node-types.tool.js +2 -2
- package/dist/modules/mcp/tools/workflow-builder/get-workflow-node-types.tool.js.map +1 -1
- package/dist/modules/mcp/tools/workflow-builder/get-workflow-sdk-reference.tool.js +3 -2
- package/dist/modules/mcp/tools/workflow-builder/get-workflow-sdk-reference.tool.js.map +1 -1
- package/dist/modules/mcp/tools/workflow-builder/mcp-instructions.js +3 -3
- package/dist/modules/mcp/tools/workflow-builder/mcp-instructions.js.map +1 -1
- package/dist/modules/mcp/tools/workflow-builder/sdk-reference-content.d.ts +1 -1
- package/dist/modules/mcp/tools/workflow-builder/sdk-reference-content.js +12 -4
- package/dist/modules/mcp/tools/workflow-builder/sdk-reference-content.js.map +1 -1
- package/dist/modules/mcp/tools/workflow-builder/search-workflow-nodes.tool.d.ts +2 -2
- package/dist/modules/mcp/tools/workflow-builder/search-workflow-nodes.tool.js +12 -5
- package/dist/modules/mcp/tools/workflow-builder/search-workflow-nodes.tool.js.map +1 -1
- package/dist/modules/mcp/tools/workflow-builder/update-workflow.tool.js +1 -2
- package/dist/modules/mcp/tools/workflow-builder/update-workflow.tool.js.map +1 -1
- package/dist/modules/mcp/tools/workflow-builder/validate-workflow-code.tool.js +1 -1
- package/dist/modules/mcp/tools/workflow-builder/validate-workflow-code.tool.js.map +1 -1
- package/dist/modules/mcp/tools/workflow-validation.utils.d.ts +5 -1
- package/dist/modules/mcp/tools/workflow-validation.utils.js +4 -2
- package/dist/modules/mcp/tools/workflow-validation.utils.js.map +1 -1
- package/dist/modules/mcp-registry/mcp-registry-node-loader.d.ts +27 -0
- package/dist/modules/mcp-registry/mcp-registry-node-loader.js +105 -0
- package/dist/modules/mcp-registry/mcp-registry-node-loader.js.map +1 -0
- package/dist/modules/mcp-registry/mcp-registry-node-loader.test.d.ts +1 -0
- package/dist/modules/mcp-registry/mcp-registry-node-loader.test.js +244 -0
- package/dist/modules/mcp-registry/mcp-registry-node-loader.test.js.map +1 -0
- package/dist/modules/mcp-registry/mcp-registry.module.d.ts +4 -0
- package/dist/modules/mcp-registry/mcp-registry.module.js +60 -0
- package/dist/modules/mcp-registry/mcp-registry.module.js.map +1 -0
- package/dist/modules/mcp-registry/node-description-transform.d.ts +8 -0
- package/dist/modules/mcp-registry/node-description-transform.js +133 -0
- package/dist/modules/mcp-registry/node-description-transform.js.map +1 -0
- package/dist/modules/mcp-registry/node-description-transform.test.d.ts +1 -0
- package/dist/modules/mcp-registry/node-description-transform.test.js +286 -0
- package/dist/modules/mcp-registry/node-description-transform.test.js.map +1 -0
- package/dist/modules/mcp-registry/registry/mcp-registry.service.d.ts +8 -0
- package/dist/modules/mcp-registry/registry/mcp-registry.service.js +31 -0
- package/dist/modules/mcp-registry/registry/mcp-registry.service.js.map +1 -0
- package/dist/modules/mcp-registry/registry/mcp-registry.service.test.d.ts +1 -0
- package/dist/modules/mcp-registry/registry/mcp-registry.service.test.js +41 -0
- package/dist/modules/mcp-registry/registry/mcp-registry.service.test.js.map +1 -0
- package/dist/modules/mcp-registry/registry/mcp-registry.types.d.ts +36 -0
- package/dist/modules/mcp-registry/registry/mcp-registry.types.js +3 -0
- package/dist/modules/mcp-registry/registry/mcp-registry.types.js.map +1 -0
- package/dist/modules/mcp-registry/registry/mock-servers.d.ts +3 -0
- package/dist/modules/mcp-registry/registry/mock-servers.js +80 -0
- package/dist/modules/mcp-registry/registry/mock-servers.js.map +1 -0
- package/dist/modules/otel/execution-level-tracer.d.ts +1 -1
- package/dist/modules/otel/execution-level-tracer.js +24 -9
- package/dist/modules/otel/execution-level-tracer.js.map +1 -1
- package/dist/modules/otel/execution-level-tracer.types.d.ts +9 -7
- package/dist/modules/otel/execution-level-tracer.types.js +14 -0
- package/dist/modules/otel/execution-level-tracer.types.js.map +1 -1
- package/dist/modules/quick-connect/quick-connect.config.d.ts +176 -0
- package/dist/modules/quick-connect/quick-connect.config.js +8 -0
- package/dist/modules/quick-connect/quick-connect.config.js.map +1 -1
- package/dist/modules/quick-connect/quick-connect.module.d.ts +15 -0
- package/dist/modules/redaction/executions/execution-redaction.service.d.ts +1 -3
- package/dist/modules/redaction/executions/execution-redaction.service.js +2 -6
- package/dist/modules/redaction/executions/execution-redaction.service.js.map +1 -1
- package/dist/modules/source-control.ee/source-control.controller.ee.d.ts +2 -2
- package/dist/modules/source-control.ee/source-control.service.ee.d.ts +1 -1
- package/dist/modules/sso-oidc/oidc.controller.ee.d.ts +3 -1
- package/dist/modules/sso-oidc/oidc.controller.ee.js +8 -1
- package/dist/modules/sso-oidc/oidc.controller.ee.js.map +1 -1
- package/dist/node-catalog/index.d.ts +1 -0
- package/dist/node-catalog/index.js +6 -0
- package/dist/node-catalog/index.js.map +1 -0
- package/dist/{modules/mcp/tools/workflow-builder/workflow-builder-tools.service.d.ts → node-catalog/node-catalog.service.d.ts} +9 -15
- package/dist/{modules/mcp/tools/workflow-builder/workflow-builder-tools.service.js → node-catalog/node-catalog.service.js} +38 -28
- package/dist/node-catalog/node-catalog.service.js.map +1 -0
- package/dist/node-execution/ephemeral-node-executor.d.ts +47 -0
- package/dist/node-execution/ephemeral-node-executor.js +289 -0
- package/dist/node-execution/ephemeral-node-executor.js.map +1 -0
- package/dist/node-execution/index.d.ts +2 -0
- package/dist/node-execution/index.js +8 -0
- package/dist/node-execution/index.js.map +1 -0
- package/dist/public-api/v1/handlers/audit/audit.handler.d.ts +5 -4
- package/dist/public-api/v1/handlers/audit/audit.handler.js +5 -9
- package/dist/public-api/v1/handlers/audit/audit.handler.js.map +1 -1
- package/dist/public-api/v1/handlers/community-packages/community-packages.handler.d.ts +20 -17
- package/dist/public-api/v1/handlers/community-packages/community-packages.handler.js +12 -39
- package/dist/public-api/v1/handlers/community-packages/community-packages.handler.js.map +1 -1
- package/dist/public-api/v1/handlers/credentials/credentials.handler.d.ts +12 -49
- package/dist/public-api/v1/handlers/credentials/credentials.handler.js +6 -5
- package/dist/public-api/v1/handlers/credentials/credentials.handler.js.map +1 -1
- package/dist/public-api/v1/handlers/data-tables/data-tables.columns.handler.d.ts +8 -19
- package/dist/public-api/v1/handlers/data-tables/data-tables.columns.handler.js +11 -11
- package/dist/public-api/v1/handlers/data-tables/data-tables.columns.handler.js.map +1 -1
- package/dist/public-api/v1/handlers/data-tables/data-tables.handler.d.ts +9 -17
- package/dist/public-api/v1/handlers/data-tables/data-tables.handler.js +19 -23
- package/dist/public-api/v1/handlers/data-tables/data-tables.handler.js.map +1 -1
- package/dist/public-api/v1/handlers/data-tables/data-tables.rows.handler.d.ts +9 -23
- package/dist/public-api/v1/handlers/data-tables/data-tables.rows.handler.js +17 -27
- package/dist/public-api/v1/handlers/data-tables/data-tables.rows.handler.js.map +1 -1
- package/dist/public-api/v1/handlers/discover/discover.handler.d.ts +11 -9
- package/dist/public-api/v1/handlers/discover/discover.handler.js +5 -3
- package/dist/public-api/v1/handlers/discover/discover.handler.js.map +1 -1
- package/dist/public-api/v1/handlers/executions/executions.handler.d.ts +12 -11
- package/dist/public-api/v1/handlers/executions/executions.handler.js +46 -80
- package/dist/public-api/v1/handlers/executions/executions.handler.js.map +1 -1
- package/dist/public-api/v1/handlers/folders/folders.handler.d.ts +12 -17
- package/dist/public-api/v1/handlers/folders/folders.handler.js +17 -20
- package/dist/public-api/v1/handlers/folders/folders.handler.js.map +1 -1
- package/dist/public-api/v1/handlers/insights/insights.handler.d.ts +5 -4
- package/dist/public-api/v1/handlers/insights/insights.handler.js +9 -5
- package/dist/public-api/v1/handlers/insights/insights.handler.js.map +1 -1
- package/dist/public-api/v1/handlers/projects/projects.handler.d.ts +28 -11
- package/dist/public-api/v1/handlers/projects/projects.handler.js +44 -75
- package/dist/public-api/v1/handlers/projects/projects.handler.js.map +1 -1
- package/dist/public-api/v1/handlers/source-control/source-control.handler.d.ts +5 -6
- package/dist/public-api/v1/handlers/source-control/source-control.handler.js +3 -2
- package/dist/public-api/v1/handlers/source-control/source-control.handler.js.map +1 -1
- package/dist/public-api/v1/handlers/tags/tags.handler.d.ts +9 -8
- package/dist/public-api/v1/handlers/tags/tags.handler.js +11 -8
- package/dist/public-api/v1/handlers/tags/tags.handler.js.map +1 -1
- package/dist/public-api/v1/handlers/users/users.handler.ee.d.ts +14 -11
- package/dist/public-api/v1/handlers/users/users.handler.ee.js +7 -8
- package/dist/public-api/v1/handlers/users/users.handler.ee.js.map +1 -1
- package/dist/public-api/v1/handlers/variables/variables.handler.d.ts +13 -7
- package/dist/public-api/v1/handlers/variables/variables.handler.js +5 -3
- package/dist/public-api/v1/handlers/variables/variables.handler.js.map +1 -1
- package/dist/public-api/v1/handlers/workflows/workflows.handler.d.ts +17 -49
- package/dist/public-api/v1/handlers/workflows/workflows.handler.js +27 -46
- package/dist/public-api/v1/handlers/workflows/workflows.handler.js.map +1 -1
- package/dist/public-api/v1/shared/handler.types.d.ts +7 -1
- package/dist/public-api/v1/shared/middlewares/global.middleware.d.ts +1 -2
- package/dist/public-api/v1/shared/middlewares/global.middleware.js +7 -6
- package/dist/public-api/v1/shared/middlewares/global.middleware.js.map +1 -1
- package/dist/scaling/constants.d.ts +2 -2
- package/dist/scaling/job-processor.js +2 -0
- package/dist/scaling/job-processor.js.map +1 -1
- package/dist/scaling/pubsub/pubsub.event-map.d.ts +9 -0
- package/dist/scaling/pubsub/pubsub.types.d.ts +3 -1
- package/dist/scaling/scaling.types.d.ts +1 -0
- package/dist/server.d.ts +2 -0
- package/dist/server.js +2 -0
- package/dist/server.js.map +1 -1
- package/dist/services/frontend.service.js +7 -14
- package/dist/services/frontend.service.js.map +1 -1
- package/dist/services/import.service.d.ts +9 -3
- package/dist/services/import.service.js +72 -5
- package/dist/services/import.service.js.map +1 -1
- package/dist/services/proxy-token-manager.js.map +1 -0
- package/dist/services/workflow-statistics.service.js +1 -0
- package/dist/services/workflow-statistics.service.js.map +1 -1
- package/dist/task-runners/task-broker/task-broker.service.d.ts +2 -0
- package/dist/task-runners/task-broker/task-broker.service.js +13 -1
- package/dist/task-runners/task-broker/task-broker.service.js.map +1 -1
- package/dist/utils/ttl-map.d.ts +17 -0
- package/dist/utils/ttl-map.js +80 -0
- package/dist/utils/ttl-map.js.map +1 -0
- package/dist/webhooks/test-webhooks.d.ts +3 -1
- package/dist/webhooks/test-webhooks.js +11 -3
- package/dist/webhooks/test-webhooks.js.map +1 -1
- package/dist/workflow-execute-additional-data.d.ts +2 -1
- package/dist/workflow-execute-additional-data.js +34 -0
- package/dist/workflow-execute-additional-data.js.map +1 -1
- package/dist/workflow-helpers.d.ts +1 -0
- package/dist/workflow-helpers.js +15 -0
- package/dist/workflow-helpers.js.map +1 -1
- package/dist/workflow-runner.js +2 -0
- package/dist/workflow-runner.js.map +1 -1
- package/dist/workflows/workflow-creation.service.js +1 -0
- package/dist/workflows/workflow-creation.service.js.map +1 -1
- package/dist/workflows/workflow.service.js +4 -0
- package/dist/workflows/workflow.service.js.map +1 -1
- package/package.json +40 -25
- package/dist/instance-settings-loader/loaders/sso.instance-settings-loader.js +0 -203
- package/dist/instance-settings-loader/loaders/sso.instance-settings-loader.js.map +0 -1
- package/dist/modules/instance-ai/proxy-token-manager.js.map +0 -1
- package/dist/modules/mcp/tools/workflow-builder/workflow-builder-tools.service.js.map +0 -1
- /package/dist/{modules/instance-ai → services}/proxy-token-manager.d.ts +0 -0
- /package/dist/{modules/instance-ai → services}/proxy-token-manager.js +0 -0
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
19
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
20
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
21
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
22
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23
|
+
};
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
41
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
42
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
43
|
+
};
|
|
44
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
45
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
46
|
+
};
|
|
47
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
|
+
exports.AgentSecureRuntime = void 0;
|
|
49
|
+
const backend_common_1 = require("@n8n/backend-common");
|
|
50
|
+
const di_1 = require("@n8n/di");
|
|
51
|
+
const fs_1 = require("fs");
|
|
52
|
+
const path_1 = __importDefault(require("path"));
|
|
53
|
+
const sucrase_1 = require("sucrase");
|
|
54
|
+
const agent_isolate_pool_1 = require("./agent-isolate-pool");
|
|
55
|
+
const LIBRARY_BUNDLE_PATH = path_1.default.resolve(__dirname, '../../../../dist/agent-library-bundle.js');
|
|
56
|
+
let AgentSecureRuntime = class AgentSecureRuntime {
|
|
57
|
+
constructor(logger) {
|
|
58
|
+
this.logger = logger;
|
|
59
|
+
this.pool = null;
|
|
60
|
+
this.poolInitPromise = null;
|
|
61
|
+
this.disposed = false;
|
|
62
|
+
this.libraryBundle = null;
|
|
63
|
+
}
|
|
64
|
+
async getPool() {
|
|
65
|
+
if (this.pool)
|
|
66
|
+
return this.pool;
|
|
67
|
+
this.poolInitPromise ??= (async () => {
|
|
68
|
+
try {
|
|
69
|
+
const ivmModule = (await Promise.resolve().then(() => __importStar(require('isolated-vm')))).default;
|
|
70
|
+
const libraryBundle = this.getLibraryBundle();
|
|
71
|
+
const pool = new agent_isolate_pool_1.AgentIsolatePool(ivmModule, libraryBundle, {
|
|
72
|
+
logger: this.logger,
|
|
73
|
+
});
|
|
74
|
+
await pool.initialize();
|
|
75
|
+
if (this.disposed) {
|
|
76
|
+
void pool.dispose();
|
|
77
|
+
throw new Error('AgentSecureRuntime was disposed during pool initialization');
|
|
78
|
+
}
|
|
79
|
+
this.pool = pool;
|
|
80
|
+
return pool;
|
|
81
|
+
}
|
|
82
|
+
catch (e) {
|
|
83
|
+
this.poolInitPromise = null;
|
|
84
|
+
throw e;
|
|
85
|
+
}
|
|
86
|
+
})();
|
|
87
|
+
return await this.poolInitPromise;
|
|
88
|
+
}
|
|
89
|
+
async withIsolate(fn) {
|
|
90
|
+
const pool = await this.getPool();
|
|
91
|
+
const slot = await pool.acquire();
|
|
92
|
+
try {
|
|
93
|
+
return await fn(slot);
|
|
94
|
+
}
|
|
95
|
+
catch (error) {
|
|
96
|
+
if (!slot.isHealthy) {
|
|
97
|
+
this.logger.warn('[AgentSecureRuntime] Isolate OOM during execution — retrying with fresh slot');
|
|
98
|
+
const freshSlot = await pool.acquire();
|
|
99
|
+
try {
|
|
100
|
+
return await fn(freshSlot);
|
|
101
|
+
}
|
|
102
|
+
catch (retryError) {
|
|
103
|
+
if (!freshSlot.isHealthy) {
|
|
104
|
+
this.logger.error('[AgentSecureRuntime] Retry slot also OOM — both isolates will be recycled; not retrying further');
|
|
105
|
+
}
|
|
106
|
+
throw retryError;
|
|
107
|
+
}
|
|
108
|
+
finally {
|
|
109
|
+
pool.release(freshSlot);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
throw error;
|
|
113
|
+
}
|
|
114
|
+
finally {
|
|
115
|
+
pool.release(slot);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
getLibraryBundle() {
|
|
119
|
+
if (this.libraryBundle)
|
|
120
|
+
return this.libraryBundle;
|
|
121
|
+
try {
|
|
122
|
+
this.libraryBundle = (0, fs_1.readFileSync)(LIBRARY_BUNDLE_PATH, 'utf8');
|
|
123
|
+
}
|
|
124
|
+
catch (e) {
|
|
125
|
+
throw new Error(`Agent library bundle not found at ${LIBRARY_BUNDLE_PATH}. ` +
|
|
126
|
+
"Run 'pnpm build' in packages/cli to generate it.", { cause: e instanceof Error ? e : undefined });
|
|
127
|
+
}
|
|
128
|
+
return this.libraryBundle;
|
|
129
|
+
}
|
|
130
|
+
compileTs(tsCode) {
|
|
131
|
+
const { code } = (0, sucrase_1.transform)(tsCode, {
|
|
132
|
+
transforms: ['typescript', 'imports'],
|
|
133
|
+
});
|
|
134
|
+
return code;
|
|
135
|
+
}
|
|
136
|
+
parseSandboxJson(raw, context) {
|
|
137
|
+
if (typeof raw !== 'string') {
|
|
138
|
+
throw new Error(`Sandbox (${context}) produced a non-string result: ${typeof raw}. Expected JSON string.`);
|
|
139
|
+
}
|
|
140
|
+
try {
|
|
141
|
+
return JSON.parse(raw, (key, value) => (key === '__proto__' ? undefined : value));
|
|
142
|
+
}
|
|
143
|
+
catch (e) {
|
|
144
|
+
throw new Error(`Sandbox (${context}) produced invalid JSON: ${e instanceof Error ? e.message : String(e)}`);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
runInContext(context, slot, code) {
|
|
148
|
+
context.evalSync('var module = { exports: {} }; var exports = module.exports;', {
|
|
149
|
+
timeout: 5000,
|
|
150
|
+
});
|
|
151
|
+
const script = slot.isolate.compileScriptSync(code);
|
|
152
|
+
script.runSync(context, { timeout: 5000 });
|
|
153
|
+
script.release();
|
|
154
|
+
const ref = context.global.getSync('module', { reference: true });
|
|
155
|
+
const moduleObj = ref.copySync();
|
|
156
|
+
ref.release();
|
|
157
|
+
return moduleObj.exports;
|
|
158
|
+
}
|
|
159
|
+
async describeToolSecurely(tsCode) {
|
|
160
|
+
const jsCode = this.compileTs(tsCode);
|
|
161
|
+
return await this.withIsolate(async (slot) => {
|
|
162
|
+
const context = slot.createContext();
|
|
163
|
+
try {
|
|
164
|
+
const wrapper = `
|
|
165
|
+
var __me = {};
|
|
166
|
+
var __mod = { exports: __me };
|
|
167
|
+
(function(exports, require, module) {
|
|
168
|
+
${jsCode}
|
|
169
|
+
})(__me, require, __mod);
|
|
170
|
+
|
|
171
|
+
var __exported = __mod.exports.default || __mod.exports;
|
|
172
|
+
|
|
173
|
+
if (!__exported || typeof __exported !== 'object' || typeof __exported.describe !== 'function') {
|
|
174
|
+
throw new Error('No Tool found. Export a Tool as default: export default new Tool(...);');
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
module.exports = JSON.stringify(__exported.describe());
|
|
178
|
+
`;
|
|
179
|
+
const resultJson = this.runInContext(context, slot, wrapper);
|
|
180
|
+
return this.parseSandboxJson(resultJson, 'describeToolSecurely');
|
|
181
|
+
}
|
|
182
|
+
finally {
|
|
183
|
+
context.release();
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
async executeToolInIsolate(toolCode, input, ctx) {
|
|
188
|
+
const jsCode = this.compileTs(toolCode);
|
|
189
|
+
return await this.withIsolate(async (slot) => {
|
|
190
|
+
const context = slot.createContext();
|
|
191
|
+
try {
|
|
192
|
+
const setupCode = `
|
|
193
|
+
var __me = {};
|
|
194
|
+
var __mod = { exports: __me };
|
|
195
|
+
(function(exports, require, module) {
|
|
196
|
+
${jsCode}
|
|
197
|
+
})(__me, require, __mod);
|
|
198
|
+
|
|
199
|
+
globalThis.__exportedTool = __mod.exports.default || __mod.exports;
|
|
200
|
+
if (!globalThis.__exportedTool || typeof globalThis.__exportedTool !== 'object') {
|
|
201
|
+
throw new Error('No Tool found');
|
|
202
|
+
}
|
|
203
|
+
`;
|
|
204
|
+
const setupScript = slot.isolate.compileScriptSync(setupCode);
|
|
205
|
+
setupScript.runSync(context, { timeout: 5000 });
|
|
206
|
+
setupScript.release();
|
|
207
|
+
const serializedArgs = JSON.stringify({ input, ctx });
|
|
208
|
+
const invokeCode = `
|
|
209
|
+
(async function() {
|
|
210
|
+
var tool = globalThis.__exportedTool;
|
|
211
|
+
var handlerFn = tool.handlerFn || (tool.build ? tool.build().handler : null);
|
|
212
|
+
if (!handlerFn) {
|
|
213
|
+
var built = tool.build ? tool.build() : tool;
|
|
214
|
+
handlerFn = built.handler;
|
|
215
|
+
}
|
|
216
|
+
if (!handlerFn) throw new Error('Tool has no handler');
|
|
217
|
+
|
|
218
|
+
var args = ${serializedArgs};
|
|
219
|
+
var suspendPayload = { called: false, data: null };
|
|
220
|
+
var ctx = Object.assign({}, args.ctx || {}, {
|
|
221
|
+
suspend: function(payload) {
|
|
222
|
+
suspendPayload.called = true;
|
|
223
|
+
suspendPayload.data = payload;
|
|
224
|
+
return Promise.resolve({ suspended: true });
|
|
225
|
+
},
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
var result = await handlerFn(args.input, ctx);
|
|
229
|
+
|
|
230
|
+
if (suspendPayload.called) {
|
|
231
|
+
return JSON.stringify({ __suspend: true, payload: suspendPayload.data });
|
|
232
|
+
}
|
|
233
|
+
return JSON.stringify(result);
|
|
234
|
+
})()
|
|
235
|
+
`;
|
|
236
|
+
const resultJson = (await context.eval(invokeCode, {
|
|
237
|
+
timeout: 5000,
|
|
238
|
+
promise: true,
|
|
239
|
+
copy: true,
|
|
240
|
+
}));
|
|
241
|
+
const parsed = this.parseSandboxJson(resultJson, 'executeToolInIsolate');
|
|
242
|
+
if (parsed?.__suspend) {
|
|
243
|
+
return {
|
|
244
|
+
[Symbol.for('n8n.agent.suspend')]: true,
|
|
245
|
+
payload: parsed.payload,
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
return parsed;
|
|
249
|
+
}
|
|
250
|
+
finally {
|
|
251
|
+
context.release();
|
|
252
|
+
}
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
createToolExecutor(toolsByName) {
|
|
256
|
+
return {
|
|
257
|
+
executeTool: async (toolName, input, ctx) => {
|
|
258
|
+
const toolCode = toolsByName[toolName];
|
|
259
|
+
if (!toolCode) {
|
|
260
|
+
throw new Error(`Tool "${toolName}" not found in tools map`);
|
|
261
|
+
}
|
|
262
|
+
return await this.executeToolInIsolate(toolCode, input, ctx);
|
|
263
|
+
},
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
dispose() {
|
|
267
|
+
this.disposed = true;
|
|
268
|
+
const poolPromise = this.poolInitPromise;
|
|
269
|
+
this.pool = null;
|
|
270
|
+
this.poolInitPromise = null;
|
|
271
|
+
if (poolPromise) {
|
|
272
|
+
void poolPromise.then(async (pool) => await pool.dispose()).catch(() => { });
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
};
|
|
276
|
+
exports.AgentSecureRuntime = AgentSecureRuntime;
|
|
277
|
+
exports.AgentSecureRuntime = AgentSecureRuntime = __decorate([
|
|
278
|
+
(0, di_1.Service)(),
|
|
279
|
+
__metadata("design:paramtypes", [backend_common_1.Logger])
|
|
280
|
+
], AgentSecureRuntime);
|
|
281
|
+
//# sourceMappingURL=agent-secure-runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-secure-runtime.js","sourceRoot":"","sources":["../../../../src/modules/agents/runtime/agent-secure-runtime.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,wDAA6C;AAC7C,gCAAkC;AAClC,2BAAkC;AAElC,gDAAwB;AACxB,qCAAwD;AAExD,6DAA+E;AAU/E,MAAM,mBAAmB,GAAG,cAAI,CAAC,OAAO,CAAC,SAAS,EAAE,0CAA0C,CAAC,CAAC;AAkBzF,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAC9B,YAA6B,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;QAGnC,SAAI,GAA4B,IAAI,CAAC;QAGrC,oBAAe,GAAqC,IAAI,CAAC;QAGzD,aAAQ,GAAG,KAAK,CAAC;QAQjB,kBAAa,GAAkB,IAAI,CAAC;IAjBE,CAAC;IAuBvC,KAAK,CAAC,OAAO;QACpB,IAAI,IAAI,CAAC,IAAI;YAAE,OAAO,IAAI,CAAC,IAAI,CAAC;QAChC,IAAI,CAAC,eAAe,KAAK,CAAC,KAAK,IAAI,EAAE;YACpC,IAAI,CAAC;gBACJ,MAAM,SAAS,GAAG,CAAC,wDAAa,aAAa,GAAC,CAAC,CAAC,OAAO,CAAC;gBACxD,MAAM,aAAa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AAA,YAAO,GAAE;qCAE4B,uBAAM;GAD/B,kBAAkB,CAgV9B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SANDBOX_POLYFILLS = "\nif (typeof TransformStream === 'undefined') {\n\tglobalThis.TransformStream = function() {};\n\tglobalThis.ReadableStream = function() {};\n\tglobalThis.WritableStream = function() {};\n\tglobalThis.TextEncoder = function() { this.encode = function(s) { return s; }; };\n\tglobalThis.TextDecoder = function() { this.decode = function(s) { return s; }; };\n}\nif (typeof URL === 'undefined') {\n\tglobalThis.URL = function(u) { this.href = u; this.toString = function() { return u; }; };\n}\nif (typeof AbortController === 'undefined') {\n\tglobalThis.AbortController = function() { this.signal = {}; this.abort = function() {}; };\n}\nif (typeof Event === 'undefined') {\n\tglobalThis.Event = function(type) { this.type = type; };\n}\nif (typeof EventTarget === 'undefined') {\n\tglobalThis.EventTarget = function() {\n\t\tthis._listeners = {};\n\t};\n\tEventTarget.prototype.addEventListener = function(type, fn) {\n\t\tif (!this._listeners[type]) this._listeners[type] = [];\n\t\tthis._listeners[type].push(fn);\n\t};\n\tEventTarget.prototype.removeEventListener = function(type, fn) {\n\t\tif (!this._listeners[type]) return;\n\t\tthis._listeners[type] = this._listeners[type].filter(function(f) { return f !== fn; });\n\t};\n\tEventTarget.prototype.dispatchEvent = function() { return true; };\n}\nif (typeof CustomEvent === 'undefined') {\n\tglobalThis.CustomEvent = function(type, opts) {\n\t\tthis.type = type;\n\t\tthis.detail = opts && opts.detail;\n\t};\n}\nif (typeof MessageEvent === 'undefined') {\n\tglobalThis.MessageEvent = function(type, opts) {\n\t\tthis.type = type;\n\t\tthis.data = opts && opts.data;\n\t};\n}\nif (typeof Headers === 'undefined') {\n\tglobalThis.Headers = function(init) {\n\t\tthis._headers = {};\n\t\tif (init) for (var k in init) this._headers[k.toLowerCase()] = init[k];\n\t};\n\tHeaders.prototype.get = function(k) { return this._headers[k.toLowerCase()] || null; };\n\tHeaders.prototype.set = function(k, v) { this._headers[k.toLowerCase()] = v; };\n\tHeaders.prototype.has = function(k) { return k.toLowerCase() in this._headers; };\n}\nif (typeof Request === 'undefined') {\n\tglobalThis.Request = function(url) { this.url = url; };\n}\nif (typeof Response === 'undefined') {\n\tglobalThis.Response = function(body) { this.body = body; };\n\tResponse.json = function(data) { return new Response(JSON.stringify(data)); };\n}\nif (typeof console === 'undefined') {\n\tglobalThis.console = { log: function() {}, warn: function() {}, error: function() {} };\n}\nif (typeof setTimeout === 'undefined') {\n\tglobalThis.setTimeout = function(fn) { fn(); return 0; };\n\tglobalThis.clearTimeout = function() {};\n}\nif (typeof fetch === 'undefined') {\n\tglobalThis.fetch = function() { throw new Error('fetch is not available in the sandbox'); };\n}\n";
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SANDBOX_POLYFILLS = void 0;
|
|
4
|
+
exports.SANDBOX_POLYFILLS = `
|
|
5
|
+
if (typeof TransformStream === 'undefined') {
|
|
6
|
+
globalThis.TransformStream = function() {};
|
|
7
|
+
globalThis.ReadableStream = function() {};
|
|
8
|
+
globalThis.WritableStream = function() {};
|
|
9
|
+
globalThis.TextEncoder = function() { this.encode = function(s) { return s; }; };
|
|
10
|
+
globalThis.TextDecoder = function() { this.decode = function(s) { return s; }; };
|
|
11
|
+
}
|
|
12
|
+
if (typeof URL === 'undefined') {
|
|
13
|
+
globalThis.URL = function(u) { this.href = u; this.toString = function() { return u; }; };
|
|
14
|
+
}
|
|
15
|
+
if (typeof AbortController === 'undefined') {
|
|
16
|
+
globalThis.AbortController = function() { this.signal = {}; this.abort = function() {}; };
|
|
17
|
+
}
|
|
18
|
+
if (typeof Event === 'undefined') {
|
|
19
|
+
globalThis.Event = function(type) { this.type = type; };
|
|
20
|
+
}
|
|
21
|
+
if (typeof EventTarget === 'undefined') {
|
|
22
|
+
globalThis.EventTarget = function() {
|
|
23
|
+
this._listeners = {};
|
|
24
|
+
};
|
|
25
|
+
EventTarget.prototype.addEventListener = function(type, fn) {
|
|
26
|
+
if (!this._listeners[type]) this._listeners[type] = [];
|
|
27
|
+
this._listeners[type].push(fn);
|
|
28
|
+
};
|
|
29
|
+
EventTarget.prototype.removeEventListener = function(type, fn) {
|
|
30
|
+
if (!this._listeners[type]) return;
|
|
31
|
+
this._listeners[type] = this._listeners[type].filter(function(f) { return f !== fn; });
|
|
32
|
+
};
|
|
33
|
+
EventTarget.prototype.dispatchEvent = function() { return true; };
|
|
34
|
+
}
|
|
35
|
+
if (typeof CustomEvent === 'undefined') {
|
|
36
|
+
globalThis.CustomEvent = function(type, opts) {
|
|
37
|
+
this.type = type;
|
|
38
|
+
this.detail = opts && opts.detail;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
if (typeof MessageEvent === 'undefined') {
|
|
42
|
+
globalThis.MessageEvent = function(type, opts) {
|
|
43
|
+
this.type = type;
|
|
44
|
+
this.data = opts && opts.data;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
if (typeof Headers === 'undefined') {
|
|
48
|
+
globalThis.Headers = function(init) {
|
|
49
|
+
this._headers = {};
|
|
50
|
+
if (init) for (var k in init) this._headers[k.toLowerCase()] = init[k];
|
|
51
|
+
};
|
|
52
|
+
Headers.prototype.get = function(k) { return this._headers[k.toLowerCase()] || null; };
|
|
53
|
+
Headers.prototype.set = function(k, v) { this._headers[k.toLowerCase()] = v; };
|
|
54
|
+
Headers.prototype.has = function(k) { return k.toLowerCase() in this._headers; };
|
|
55
|
+
}
|
|
56
|
+
if (typeof Request === 'undefined') {
|
|
57
|
+
globalThis.Request = function(url) { this.url = url; };
|
|
58
|
+
}
|
|
59
|
+
if (typeof Response === 'undefined') {
|
|
60
|
+
globalThis.Response = function(body) { this.body = body; };
|
|
61
|
+
Response.json = function(data) { return new Response(JSON.stringify(data)); };
|
|
62
|
+
}
|
|
63
|
+
if (typeof console === 'undefined') {
|
|
64
|
+
globalThis.console = { log: function() {}, warn: function() {}, error: function() {} };
|
|
65
|
+
}
|
|
66
|
+
if (typeof setTimeout === 'undefined') {
|
|
67
|
+
globalThis.setTimeout = function(fn) { fn(); return 0; };
|
|
68
|
+
globalThis.clearTimeout = function() {};
|
|
69
|
+
}
|
|
70
|
+
if (typeof fetch === 'undefined') {
|
|
71
|
+
globalThis.fetch = function() { throw new Error('fetch is not available in the sandbox'); };
|
|
72
|
+
}
|
|
73
|
+
`;
|
|
74
|
+
//# sourceMappingURL=sandbox-polyfills.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sandbox-polyfills.js","sourceRoot":"","sources":["../../../../src/modules/agents/runtime/sandbox-polyfills.ts"],"names":[],"mappings":";;;AAUa,QAAA,iBAAiB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqEhC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { BuiltTool } from '@n8n/agents';
|
|
2
|
+
export interface ToolRegistryEntry {
|
|
3
|
+
kind: 'tool' | 'workflow' | 'node';
|
|
4
|
+
workflowId?: string;
|
|
5
|
+
workflowName?: string;
|
|
6
|
+
triggerType?: string;
|
|
7
|
+
nodeType?: string;
|
|
8
|
+
nodeTypeVersion?: number;
|
|
9
|
+
nodeDisplayName?: string;
|
|
10
|
+
nodeParameters?: Record<string, unknown>;
|
|
11
|
+
}
|
|
12
|
+
export type ToolRegistry = Map<string, ToolRegistryEntry>;
|
|
13
|
+
export declare function buildToolRegistry(tools: BuiltTool[]): ToolRegistry;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildToolRegistry = buildToolRegistry;
|
|
4
|
+
function buildToolRegistry(tools) {
|
|
5
|
+
const registry = new Map();
|
|
6
|
+
for (const tool of tools) {
|
|
7
|
+
const m = tool.metadata;
|
|
8
|
+
if (m !== undefined &&
|
|
9
|
+
m.kind === 'workflow' &&
|
|
10
|
+
typeof m.workflowId === 'string' &&
|
|
11
|
+
typeof m.workflowName === 'string') {
|
|
12
|
+
const entry = {
|
|
13
|
+
kind: 'workflow',
|
|
14
|
+
workflowId: m.workflowId,
|
|
15
|
+
workflowName: m.workflowName,
|
|
16
|
+
};
|
|
17
|
+
if (typeof m.triggerType === 'string') {
|
|
18
|
+
entry.triggerType = m.triggerType;
|
|
19
|
+
}
|
|
20
|
+
registry.set(tool.name, entry);
|
|
21
|
+
}
|
|
22
|
+
else if (m !== undefined && m.kind === 'node' && typeof m.nodeType === 'string') {
|
|
23
|
+
const entry = {
|
|
24
|
+
kind: 'node',
|
|
25
|
+
nodeType: m.nodeType,
|
|
26
|
+
};
|
|
27
|
+
if (typeof m.nodeTypeVersion === 'number')
|
|
28
|
+
entry.nodeTypeVersion = m.nodeTypeVersion;
|
|
29
|
+
if (typeof m.displayName === 'string')
|
|
30
|
+
entry.nodeDisplayName = m.displayName;
|
|
31
|
+
if (m.nodeParameters && typeof m.nodeParameters === 'object') {
|
|
32
|
+
entry.nodeParameters = m.nodeParameters;
|
|
33
|
+
}
|
|
34
|
+
registry.set(tool.name, entry);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
registry.set(tool.name, { kind: 'tool' });
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return registry;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=tool-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-registry.js","sourceRoot":"","sources":["../../../src/modules/agents/tool-registry.ts"],"names":[],"mappings":";;AAyBA,8CAmCC;AAnCD,SAAgB,iBAAiB,CAAC,KAAkB;IACnD,MAAM,QAAQ,GAAiB,IAAI,GAAG,EAAE,CAAC;IACzC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QAC1B,MAAM,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC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I,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;QAC3C,CAAC;IACF,CAAC;IACD,OAAO,QAAQ,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createGetEnvironmentTool = createGetEnvironmentTool;
|
|
4
|
+
const agents_1 = require("@n8n/agents");
|
|
5
|
+
const config_1 = require("@n8n/config");
|
|
6
|
+
const di_1 = require("@n8n/di");
|
|
7
|
+
const luxon_1 = require("luxon");
|
|
8
|
+
const zod_1 = require("zod");
|
|
9
|
+
const DESCRIPTION = 'Returns runtime info that the LLM cannot know on its own: ' +
|
|
10
|
+
'current ISO date/time, instance timezone (IANA), and day of week. ' +
|
|
11
|
+
'Call when reasoning about "today", deadlines, or scheduling.';
|
|
12
|
+
function createGetEnvironmentTool() {
|
|
13
|
+
return (new agents_1.Tool('get_environment')
|
|
14
|
+
.description(DESCRIPTION)
|
|
15
|
+
.input(zod_1.z.object({}))
|
|
16
|
+
.handler(async () => {
|
|
17
|
+
const timezone = di_1.Container.get(config_1.GlobalConfig).generic.timezone;
|
|
18
|
+
const now = luxon_1.DateTime.now().setZone(timezone);
|
|
19
|
+
return {
|
|
20
|
+
now: now.toISO(),
|
|
21
|
+
timezone,
|
|
22
|
+
dayOfWeek: now.weekdayLong,
|
|
23
|
+
};
|
|
24
|
+
}));
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=environment-tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environment-tool.js","sourceRoot":"","sources":["../../../../src/modules/agents/tools/environment-tool.ts"],"names":[],"mappings":";;AAWA,4DAgBC;AA3BD,wCAAmC;AACnC,wCAA2C;AAC3C,gCAAoC;AACpC,iCAAiC;AACjC,6BAAwB;AAExB,MAAM,WAAW,GAChB,4DAA4D;IAC5D,oEAAoE;IACpE,8DAA8D,CAAC;AAEhE,SAAgB,wBAAwB;IACvC,OAAO,CACN,IAAI,aAAI,CAAC,iBAAiB,CAAC;SACzB,WAAW,CAAC,WAAW,CAAC;SACxB,KAAK,CAAC,OAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;SAEnB,OAAO,CAAC,KAAK,IAAI,EAAE;QACnB,MAAM,QAAQ,GAAG,cAAS,CAAC,GAAG,CAAC,qBAAY,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC;QAC9D,MAAM,GAAG,GAAG,gBAAQ,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QAC7C,OAAO;YACN,GAAG,EAAE,GAAG,CAAC,KAAK,EAAE;YAChB,QAAQ;YACR,SAAS,EAAE,GAAG,CAAC,WAAW;SAC1B,CAAC;IACH,CAAC,CAAC,CACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { BuiltTool } from '@n8n/agents';
|
|
2
|
+
import type { EphemeralNodeExecutor } from '../../../node-execution';
|
|
3
|
+
import type { AgentJsonToolConfig } from '../json-config/agent-json-config';
|
|
4
|
+
export interface NodeToolFactoryContext {
|
|
5
|
+
executor: EphemeralNodeExecutor;
|
|
6
|
+
projectId: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function resolveNodeTool(toolSchema: Extract<AgentJsonToolConfig, {
|
|
9
|
+
type: 'node';
|
|
10
|
+
}>, ctx: NodeToolFactoryContext): Promise<BuiltTool>;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveNodeTool = resolveNodeTool;
|
|
4
|
+
const agents_1 = require("@n8n/agents");
|
|
5
|
+
const ai_utilities_1 = require("@n8n/ai-utilities");
|
|
6
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
7
|
+
const node_types_1 = require("../../../node-types");
|
|
8
|
+
const di_1 = require("@n8n/di");
|
|
9
|
+
function toExecutorCredentials(credentials) {
|
|
10
|
+
if (!credentials)
|
|
11
|
+
return undefined;
|
|
12
|
+
const out = {};
|
|
13
|
+
for (const [slot, ref] of Object.entries(credentials)) {
|
|
14
|
+
if (ref.id)
|
|
15
|
+
out[slot] = { id: ref.id, name: ref.name };
|
|
16
|
+
}
|
|
17
|
+
return Object.keys(out).length > 0 ? out : undefined;
|
|
18
|
+
}
|
|
19
|
+
function resolveToolNodeType(nodeType, nodeTypeVersion) {
|
|
20
|
+
if ((0, n8n_workflow_1.isToolType)(nodeType))
|
|
21
|
+
return nodeType;
|
|
22
|
+
const toolNodeType = `${nodeType}Tool`;
|
|
23
|
+
try {
|
|
24
|
+
di_1.Container.get(node_types_1.NodeTypes).getByNameAndVersion(toolNodeType, nodeTypeVersion);
|
|
25
|
+
return toolNodeType;
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
return nodeType;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
async function resolveInputSchema(toolSchema, ctx) {
|
|
32
|
+
const collectedArguments = (0, ai_utilities_1.extractFromAIParameters)((toolSchema.node.nodeParameters ?? {}));
|
|
33
|
+
if (collectedArguments.length > 0)
|
|
34
|
+
return (0, ai_utilities_1.createZodSchemaFromArgs)(collectedArguments);
|
|
35
|
+
let nodeType;
|
|
36
|
+
const nodeTypeName = resolveToolNodeType(toolSchema.node.nodeType, toolSchema.node.nodeTypeVersion);
|
|
37
|
+
try {
|
|
38
|
+
nodeType = di_1.Container.get(node_types_1.NodeTypes).getByNameAndVersion(nodeTypeName, toolSchema.node.nodeTypeVersion);
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
return { type: 'object', properties: {} };
|
|
42
|
+
}
|
|
43
|
+
if (typeof nodeType.supplyData === 'function') {
|
|
44
|
+
const introspected = await ctx.executor.introspectSupplyDataToolSchema({
|
|
45
|
+
projectId: ctx.projectId,
|
|
46
|
+
nodeType: nodeTypeName,
|
|
47
|
+
nodeTypeVersion: toolSchema.node.nodeTypeVersion,
|
|
48
|
+
nodeParameters: toolSchema.node.nodeParameters,
|
|
49
|
+
credentials: toExecutorCredentials(toolSchema.node.credentials) ?? null,
|
|
50
|
+
});
|
|
51
|
+
if (introspected)
|
|
52
|
+
return introspected;
|
|
53
|
+
return {
|
|
54
|
+
type: 'object',
|
|
55
|
+
properties: {
|
|
56
|
+
input: {
|
|
57
|
+
type: 'string',
|
|
58
|
+
description: toolSchema.description ??
|
|
59
|
+
nodeType.description.description ??
|
|
60
|
+
`The query or input text to pass to ${toolSchema.node.nodeType}.`,
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
required: ['input'],
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
return { type: 'object', properties: {} };
|
|
67
|
+
}
|
|
68
|
+
async function resolveNodeTool(toolSchema, ctx) {
|
|
69
|
+
const sanitizedName = (0, n8n_workflow_1.nodeNameToToolName)(toolSchema.name);
|
|
70
|
+
const nodeType = resolveToolNodeType(toolSchema.node.nodeType, toolSchema.node.nodeTypeVersion);
|
|
71
|
+
const built = new agents_1.Tool(sanitizedName)
|
|
72
|
+
.description(toolSchema.description ?? `Execute the ${nodeType} node`)
|
|
73
|
+
.input(await resolveInputSchema(toolSchema, ctx))
|
|
74
|
+
.handler(async (input) => {
|
|
75
|
+
const result = await ctx.executor.executeInline({
|
|
76
|
+
nodeType,
|
|
77
|
+
nodeTypeVersion: toolSchema.node.nodeTypeVersion,
|
|
78
|
+
nodeParameters: toolSchema.node.nodeParameters,
|
|
79
|
+
credentialDetails: toExecutorCredentials(toolSchema.node.credentials),
|
|
80
|
+
inputData: [{ json: input }],
|
|
81
|
+
projectId: ctx.projectId,
|
|
82
|
+
});
|
|
83
|
+
if (result.status === 'error') {
|
|
84
|
+
throw new Error(result.error ?? `Node "${toolSchema.node.nodeType}" failed to execute`);
|
|
85
|
+
}
|
|
86
|
+
return result;
|
|
87
|
+
})
|
|
88
|
+
.build();
|
|
89
|
+
return {
|
|
90
|
+
...built,
|
|
91
|
+
metadata: {
|
|
92
|
+
kind: 'node',
|
|
93
|
+
nodeType: toolSchema.node.nodeType,
|
|
94
|
+
nodeTypeVersion: toolSchema.node.nodeTypeVersion,
|
|
95
|
+
displayName: toolSchema.name,
|
|
96
|
+
nodeParameters: toolSchema.node.nodeParameters,
|
|
97
|
+
},
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=node-tool-factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-tool-factory.js","sourceRoot":"","sources":["../../../../src/modules/agents/tools/node-tool-factory.ts"],"names":[],"mappings":";;AA4HA,0CAiDC;AA5KD,wCAAmC;AACnC,oDAAqF;AAGrF,+CAA8D;AAI9D,6CAAyC;AACzC,gCAAoC;AAiBpC,SAAS,qBAAqB,CAC7B,WAAkF;IAElF,IAAI,CAAC,WAAW;QAAE,OAAO,SAAS,CAAC;IACnC,MAAM,GAAG,GAAiD,EAAE,CAAC;IAC7D,KAAK,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC;QACvD,IAAI,GAAG,CAAC,EAAE;YAAE,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,CAAC;IACxD,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC;AACtD,CAAC;AAED,SAAS,mBAAmB,CAAC,QAAgB,EAAE,eAAuB;IACrE,IAAI,IAAA,yBAAU,EAAC,QAAQ,CAAC;QAAE,OAAO,QAAQ,CAAC;IAE1C,MAAM,YAAY,GAAG,GAAG,QAAQ,MAAM,CAAC;IACvC,IAAI,CAAC;QACJ,cAAS,C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CAAC;YAC3C,SAAS,EAAE,GAAG,CAAC,SAAS;SACxB,CAAC,CAAC;QAKH,IAAI,MAAM,CAAC,MAAM,KAAK,OAAO,EAAE,CAAC;YAC/B,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,IAAI,SAAS,UAAU,CAAC,IAAI,CAAC,QAAQ,qBAAqB,CAAC,CAAC;QACzF,CAAC;QACD,OAAO,MAAM,CAAC;IACf,CAAC,CAAC;SACD,KAAK,EAAE,CAAC;IAEV,OAAO;QACN,GAAG,KAAK;QACR,QAAQ,EAAE;YACT,IAAI,EAAE,MAAM;YACZ,QAAQ,EAAE,UAAU,CAAC,IAAI,CAAC,QAAQ;YAClC,eAAe,EAAE,UAAU,CAAC,IAAI,CAAC,eAAe;YAChD,WAAW,EAAE,UAAU,CAAC,IAAI;YAM5B,cAAc,EAAE,UAAU,CAAC,IAAI,CAAC,cAAiC;SACjE;KACD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { BuiltTool } from '@n8n/agents';
|
|
2
|
+
import type { ExecutionRepository, UserRepository, WorkflowRepository, WorkflowEntity } from '@n8n/db';
|
|
3
|
+
import type { INode, IPinData } from 'n8n-workflow';
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
import type { ActiveExecutions } from '../../../active-executions';
|
|
6
|
+
import type { WorkflowRunner } from '../../../workflow-runner';
|
|
7
|
+
import type { WorkflowFinderService } from '../../../workflows/workflow-finder.service';
|
|
8
|
+
import type { AgentJsonToolConfig } from '../json-config/agent-json-config';
|
|
9
|
+
export interface WorkflowToolContext {
|
|
10
|
+
workflowRepository: WorkflowRepository;
|
|
11
|
+
workflowRunner: WorkflowRunner;
|
|
12
|
+
activeExecutions: ActiveExecutions;
|
|
13
|
+
executionRepository: ExecutionRepository;
|
|
14
|
+
workflowFinderService: WorkflowFinderService;
|
|
15
|
+
userRepository: UserRepository;
|
|
16
|
+
userId: string;
|
|
17
|
+
projectId?: string;
|
|
18
|
+
webhookBaseUrl?: string;
|
|
19
|
+
}
|
|
20
|
+
interface DetectedTrigger {
|
|
21
|
+
node: INode;
|
|
22
|
+
triggerType: string;
|
|
23
|
+
}
|
|
24
|
+
export declare function detectTriggerNode(workflow: WorkflowEntity): DetectedTrigger;
|
|
25
|
+
export declare function validateCompatibility(workflow: WorkflowEntity): void;
|
|
26
|
+
export declare function normalizeTriggerInput(triggerNode: INode, triggerType: string, inputData: Record<string, unknown>): IPinData;
|
|
27
|
+
export declare function inferInputSchema(triggerNode: INode, triggerType: string): z.ZodObject<z.ZodRawShape>;
|
|
28
|
+
export declare function executeWorkflow(workflow: WorkflowEntity, triggerNode: INode, triggerType: string, inputData: Record<string, unknown>, context: WorkflowToolContext, allOutputs?: boolean): Promise<{
|
|
29
|
+
executionId: string;
|
|
30
|
+
status: string;
|
|
31
|
+
data?: Record<string, unknown>;
|
|
32
|
+
error?: string;
|
|
33
|
+
}>;
|
|
34
|
+
export declare function extractResult(executionRepository: ExecutionRepository, executionId: string, allOutputs: boolean): Promise<{
|
|
35
|
+
executionId: string;
|
|
36
|
+
status: string;
|
|
37
|
+
data?: Record<string, unknown>;
|
|
38
|
+
error?: string;
|
|
39
|
+
}>;
|
|
40
|
+
export declare function resolveWorkflowTool(descriptor: Extract<AgentJsonToolConfig, {
|
|
41
|
+
type: 'workflow';
|
|
42
|
+
}>, context: WorkflowToolContext): Promise<BuiltTool>;
|
|
43
|
+
export {};
|