n8n 2.25.6 → 2.26.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-executions.js +1 -1
- package/dist/active-executions.js.map +1 -1
- package/dist/active-workflow-manager.d.ts +7 -7
- package/dist/active-workflow-manager.js +20 -20
- package/dist/active-workflow-manager.js.map +1 -1
- package/dist/agent-library-bundle.js +42 -10
- package/dist/build.tsbuildinfo +1 -1
- package/dist/chat/chat-execution-manager.d.ts +3 -1
- package/dist/chat/chat-execution-manager.js +6 -3
- package/dist/chat/chat-execution-manager.js.map +1 -1
- package/dist/chat/chat-service.types.d.ts +4 -4
- package/dist/commands/base-command.js +2 -2
- package/dist/commands/base-command.js.map +1 -1
- package/dist/commands/execute-batch.d.ts +2 -2
- package/dist/commands/execute.d.ts +2 -2
- package/dist/commands/export/credentials.d.ts +4 -4
- package/dist/commands/export/entities.d.ts +2 -2
- package/dist/commands/export/workflow.d.ts +4 -4
- package/dist/commands/import/credentials.d.ts +2 -2
- package/dist/commands/import/workflow.d.ts +2 -2
- package/dist/commands/start.js +1 -1
- package/dist/commands/start.js.map +1 -1
- package/dist/commands/ttwf/generate.d.ts +2 -2
- package/dist/controllers/annotation-tags.controller.ee.d.ts +1 -1
- package/dist/controllers/api-keys.controller.d.ts +16 -4
- package/dist/controllers/api-keys.controller.js +11 -8
- package/dist/controllers/api-keys.controller.js.map +1 -1
- package/dist/controllers/e2e.controller.d.ts +15 -0
- package/dist/controllers/e2e.controller.js +60 -0
- package/dist/controllers/e2e.controller.js.map +1 -1
- package/dist/controllers/oauth/oauth1-credential.controller.js +7 -9
- package/dist/controllers/oauth/oauth1-credential.controller.js.map +1 -1
- package/dist/controllers/oauth/oauth2-credential.controller.js +3 -3
- package/dist/controllers/oauth/oauth2-credential.controller.js.map +1 -1
- package/dist/controllers/project.controller.d.ts +1 -1
- package/dist/controllers/project.controller.js +9 -1
- package/dist/controllers/project.controller.js.map +1 -1
- package/dist/controllers/security-settings.controller.d.ts +1 -1
- package/dist/controllers/security-settings.controller.js +18 -14
- package/dist/controllers/security-settings.controller.js.map +1 -1
- package/dist/controllers/telemetry.controller.d.ts +4 -1
- package/dist/controllers/telemetry.controller.js +61 -2
- package/dist/controllers/telemetry.controller.js.map +1 -1
- package/dist/controllers/users.controller.d.ts +2 -2
- package/dist/credentials/credential-connection-status-provider.interface.d.ts +1 -0
- package/dist/credentials/credential-connection-status-proxy.d.ts +1 -0
- package/dist/credentials/credential-connection-status-proxy.js +5 -0
- package/dist/credentials/credential-connection-status-proxy.js.map +1 -1
- package/dist/credentials/credential-resolution-provider.interface.d.ts +1 -0
- package/dist/credentials/credentials.controller.d.ts +3 -1
- package/dist/credentials/credentials.controller.js +23 -2
- package/dist/credentials/credentials.controller.js.map +1 -1
- package/dist/credentials-helper.js +3 -0
- package/dist/credentials-helper.js.map +1 -1
- package/dist/errors/http-error-serializers.js +22 -2
- package/dist/errors/http-error-serializers.js.map +1 -1
- package/dist/errors/response-errors/conflict.error.d.ts +2 -1
- package/dist/errors/response-errors/conflict.error.js +2 -1
- package/dist/errors/response-errors/conflict.error.js.map +1 -1
- package/dist/evaluation.ee/evaluation-config-validator.d.ts +1 -0
- package/dist/evaluation.ee/evaluation-config-validator.js +69 -0
- package/dist/evaluation.ee/evaluation-config-validator.js.map +1 -1
- package/dist/evaluation.ee/test-runner/evaluation-metrics.ee.js +2 -1
- package/dist/evaluation.ee/test-runner/evaluation-metrics.ee.js.map +1 -1
- package/dist/evaluation.ee/test-runner/test-runner.service.ee.d.ts +6 -2
- package/dist/evaluation.ee/test-runner/test-runner.service.ee.js +59 -16
- package/dist/evaluation.ee/test-runner/test-runner.service.ee.js.map +1 -1
- package/dist/evaluation.ee/test-runner/workflow-compiler.service.js +28 -1
- package/dist/evaluation.ee/test-runner/workflow-compiler.service.js.map +1 -1
- package/dist/evaluation.ee/test-runs.controller.ee.js +6 -1
- package/dist/evaluation.ee/test-runs.controller.ee.js.map +1 -1
- package/dist/events/event.service.d.ts +2 -1
- package/dist/events/event.service.js.map +1 -1
- package/dist/events/maps/execution-data.event-map.d.ts +14 -0
- package/dist/events/maps/execution-data.event-map.js +3 -0
- package/dist/events/maps/execution-data.event-map.js.map +1 -0
- package/dist/events/maps/relay.event-map.d.ts +19 -5
- package/dist/events/relays/log-streaming.event-relay.js +2 -0
- package/dist/events/relays/log-streaming.event-relay.js.map +1 -1
- package/dist/events/relays/telemetry.event-relay.d.ts +3 -0
- package/dist/events/relays/telemetry.event-relay.js +47 -6
- package/dist/events/relays/telemetry.event-relay.js.map +1 -1
- package/dist/execution-lifecycle/save-execution-progress.js +3 -3
- package/dist/execution-lifecycle/save-execution-progress.js.map +1 -1
- package/dist/execution-lifecycle/shared/shared-hook-functions.js +3 -3
- package/dist/execution-lifecycle/shared/shared-hook-functions.js.map +1 -1
- package/dist/executions/execution-persistence.d.ts +8 -1
- package/dist/executions/execution-persistence.js +183 -42
- package/dist/executions/execution-persistence.js.map +1 -1
- package/dist/executions/execution-recovery.service.d.ts +3 -1
- package/dist/executions/execution-recovery.service.js +7 -4
- package/dist/executions/execution-recovery.service.js.map +1 -1
- package/dist/executions/execution.service.d.ts +1 -0
- package/dist/executions/execution.service.js +21 -7
- package/dist/executions/execution.service.js.map +1 -1
- package/dist/interfaces.d.ts +1 -1
- package/dist/load-nodes-and-credentials.js +6 -0
- package/dist/load-nodes-and-credentials.js.map +1 -1
- package/dist/metrics/prometheus-metrics.service.d.ts +5 -2
- package/dist/metrics/prometheus-metrics.service.js +74 -3
- package/dist/metrics/prometheus-metrics.service.js.map +1 -1
- package/dist/metrics/types.d.ts +1 -1
- package/dist/modules/agents/agent-execution.service.d.ts +2 -0
- package/dist/modules/agents/agent-execution.service.js +2 -2
- package/dist/modules/agents/agent-execution.service.js.map +1 -1
- package/dist/modules/agents/agent-runtime-reconstruction.service.d.ts +84 -0
- package/dist/modules/agents/agent-runtime-reconstruction.service.js +362 -0
- package/dist/modules/agents/agent-runtime-reconstruction.service.js.map +1 -0
- package/dist/modules/agents/agent-sse-stream.js +15 -1
- package/dist/modules/agents/agent-sse-stream.js.map +1 -1
- package/dist/modules/agents/agents-tools.service.js +8 -1
- package/dist/modules/agents/agents-tools.service.js.map +1 -1
- package/dist/modules/agents/agents.controller.d.ts +34 -19
- package/dist/modules/agents/agents.controller.js +39 -3
- package/dist/modules/agents/agents.controller.js.map +1 -1
- package/dist/modules/agents/agents.module.d.ts +1 -1
- package/dist/modules/agents/agents.service.d.ts +13 -31
- package/dist/modules/agents/agents.service.js +154 -282
- package/dist/modules/agents/agents.service.js.map +1 -1
- package/dist/modules/agents/builder/agents-builder-prompts.js +1 -0
- package/dist/modules/agents/builder/agents-builder-prompts.js.map +1 -1
- package/dist/modules/agents/builder/agents-builder-tools.service.js +21 -2
- package/dist/modules/agents/builder/agents-builder-tools.service.js.map +1 -1
- package/dist/modules/agents/builder/agents-builder.service.js +3 -11
- package/dist/modules/agents/builder/agents-builder.service.js.map +1 -1
- package/dist/modules/agents/builder/builder-tool-names.d.ts +1 -0
- package/dist/modules/agents/builder/builder-tool-names.js +1 -0
- package/dist/modules/agents/builder/builder-tool-names.js.map +1 -1
- package/dist/modules/agents/builder/interactive/ask-question.tool.js +1 -1
- package/dist/modules/agents/builder/interactive/ask-question.tool.js.map +1 -1
- package/dist/modules/agents/builder/interactive/llm-provider-defaults.js +10 -0
- package/dist/modules/agents/builder/interactive/llm-provider-defaults.js.map +1 -1
- package/dist/modules/agents/builder/prompts/config-mutation.prompt.js +5 -3
- package/dist/modules/agents/builder/prompts/config-mutation.prompt.js.map +1 -1
- package/dist/modules/agents/builder/prompts/config-rules.prompt.js +7 -2
- package/dist/modules/agents/builder/prompts/config-rules.prompt.js.map +1 -1
- package/dist/modules/agents/builder/skills/index.js +2 -0
- package/dist/modules/agents/builder/skills/index.js.map +1 -1
- package/dist/modules/agents/builder/skills/sub-agents.skill.d.ts +2 -0
- package/dist/modules/agents/builder/skills/sub-agents.skill.js +101 -0
- package/dist/modules/agents/builder/skills/sub-agents.skill.js.map +1 -0
- package/dist/modules/agents/entities/agent-execution-thread.entity.d.ts +2 -0
- package/dist/modules/agents/entities/agent-execution-thread.entity.js +8 -0
- package/dist/modules/agents/entities/agent-execution-thread.entity.js.map +1 -1
- package/dist/modules/agents/entities/agent-execution.entity.js +1 -1
- package/dist/modules/agents/entities/agent-execution.entity.js.map +1 -1
- package/dist/modules/agents/execution-recorder.d.ts +3 -0
- package/dist/modules/agents/execution-recorder.js +75 -10
- package/dist/modules/agents/execution-recorder.js.map +1 -1
- package/dist/modules/agents/integrations/agent-chat-bridge.d.ts +4 -7
- package/dist/modules/agents/integrations/agent-chat-bridge.js +138 -105
- package/dist/modules/agents/integrations/agent-chat-bridge.js.map +1 -1
- package/dist/modules/agents/integrations/agent-chat-integration.js.map +1 -1
- package/dist/modules/agents/integrations/chat-integration.service.d.ts +5 -0
- package/dist/modules/agents/integrations/chat-integration.service.js +5 -0
- package/dist/modules/agents/integrations/chat-integration.service.js.map +1 -1
- package/dist/modules/agents/integrations/component-mapper.d.ts +21 -11
- package/dist/modules/agents/integrations/component-mapper.js +50 -20
- package/dist/modules/agents/integrations/component-mapper.js.map +1 -1
- package/dist/modules/agents/integrations/integration-action-executor.d.ts +1 -0
- package/dist/modules/agents/integrations/integration-action-executor.js +20 -9
- package/dist/modules/agents/integrations/integration-action-executor.js.map +1 -1
- package/dist/modules/agents/integrations/integration-tools.js +176 -31
- package/dist/modules/agents/integrations/integration-tools.js.map +1 -1
- package/dist/modules/agents/integrations/platforms/slack-integration.js +1 -1
- package/dist/modules/agents/integrations/platforms/slack-integration.js.map +1 -1
- package/dist/modules/agents/integrations/platforms/telegram-integration.js +1 -1
- package/dist/modules/agents/integrations/platforms/telegram-integration.js.map +1 -1
- package/dist/modules/agents/json-config/credential-field-mapping.js +1 -0
- package/dist/modules/agents/json-config/credential-field-mapping.js.map +1 -1
- package/dist/modules/agents/json-config/from-json-config.d.ts +2 -1
- package/dist/modules/agents/json-config/from-json-config.js +41 -15
- package/dist/modules/agents/json-config/from-json-config.js.map +1 -1
- package/dist/modules/agents/json-config/mcp-client-factory.d.ts +0 -6
- package/dist/modules/agents/json-config/mcp-client-factory.js +2 -31
- package/dist/modules/agents/json-config/mcp-client-factory.js.map +1 -1
- package/dist/modules/agents/json-config/model-config.d.ts +2 -0
- package/dist/modules/agents/json-config/model-config.js +11 -0
- package/dist/modules/agents/json-config/model-config.js.map +1 -0
- package/dist/modules/agents/json-config/model-id.d.ts +1 -0
- package/dist/modules/agents/json-config/model-id.js +8 -0
- package/dist/modules/agents/json-config/model-id.js.map +1 -0
- package/dist/modules/agents/json-config/native-web-search-provider-tools.d.ts +0 -1
- package/dist/modules/agents/json-config/native-web-search-provider-tools.js +3 -7
- package/dist/modules/agents/json-config/native-web-search-provider-tools.js.map +1 -1
- package/dist/modules/agents/json-config/sanitize-unknown-agent-credentials.d.ts +1 -0
- package/dist/modules/agents/json-config/sanitize-unknown-agent-credentials.js +63 -0
- package/dist/modules/agents/json-config/sanitize-unknown-agent-credentials.js.map +1 -0
- package/dist/modules/agents/model-catalog.d.ts +1 -0
- package/dist/modules/agents/model-catalog.js +15 -0
- package/dist/modules/agents/model-catalog.js.map +1 -0
- package/dist/modules/agents/repositories/agent-execution-thread.repository.d.ts +5 -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/sub-agents/delegate-sub-agent-tool.d.ts +17 -0
- package/dist/modules/agents/sub-agents/delegate-sub-agent-tool.js +66 -0
- package/dist/modules/agents/sub-agents/delegate-sub-agent-tool.js.map +1 -0
- package/dist/modules/agents/sub-agents/sub-agent-foreground-runner.d.ts +27 -0
- package/dist/modules/agents/sub-agents/sub-agent-foreground-runner.js +235 -0
- package/dist/modules/agents/sub-agents/sub-agent-foreground-runner.js.map +1 -0
- package/dist/modules/agents/sub-agents/sub-agent-source-resolver.d.ts +20 -0
- package/dist/modules/agents/sub-agents/sub-agent-source-resolver.js +87 -0
- package/dist/modules/agents/sub-agents/sub-agent-source-resolver.js.map +1 -0
- package/dist/modules/agents/tools/knowledge/csv.operation.d.ts +2 -2
- package/dist/modules/agents/tools/knowledge/schemas.d.ts +91 -91
- package/dist/modules/agents/tools/node-tool-factory.js +9 -12
- package/dist/modules/agents/tools/node-tool-factory.js.map +1 -1
- package/dist/modules/agents/tools/workflow-tool-factory.d.ts +2 -3
- package/dist/modules/agents/tools/workflow-tool-factory.js +6 -4
- package/dist/modules/agents/tools/workflow-tool-factory.js.map +1 -1
- package/dist/modules/agents/utils/agent-stream.d.ts +2 -0
- package/dist/modules/agents/utils/agent-stream.js +27 -0
- package/dist/modules/agents/utils/agent-stream.js.map +1 -0
- package/dist/modules/agents/utils/execution-to-message-mapper.js +2 -0
- package/dist/modules/agents/utils/execution-to-message-mapper.js.map +1 -1
- package/dist/modules/agents/utils/structured-output-error.d.ts +1 -0
- package/dist/modules/agents/utils/structured-output-error.js +34 -0
- package/dist/modules/agents/utils/structured-output-error.js.map +1 -0
- package/dist/modules/chat-hub/chat-hub-execution-watcher.service.d.ts +3 -3
- package/dist/modules/chat-hub/chat-hub-execution-watcher.service.js +5 -5
- package/dist/modules/chat-hub/chat-hub-execution-watcher.service.js.map +1 -1
- package/dist/modules/chat-hub/chat-hub-execution.service.d.ts +3 -1
- package/dist/modules/chat-hub/chat-hub-execution.service.js +6 -3
- package/dist/modules/chat-hub/chat-hub-execution.service.js.map +1 -1
- package/dist/modules/chat-hub/chat-hub-title.service.d.ts +4 -3
- package/dist/modules/chat-hub/chat-hub-title.service.js +5 -5
- package/dist/modules/chat-hub/chat-hub-title.service.js.map +1 -1
- package/dist/modules/chat-hub/chat-hub.module.d.ts +2 -2
- package/dist/modules/chat-hub/chat-hub.service.d.ts +4 -3
- package/dist/modules/chat-hub/chat-hub.service.js +5 -5
- package/dist/modules/chat-hub/chat-hub.service.js.map +1 -1
- 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/data-table/data-table.module.d.ts +1 -1
- package/dist/modules/dynamic-credentials.ee/credential-resolvers/identifiers/oauth2-introspection-identifier.d.ts +2 -2
- package/dist/modules/dynamic-credentials.ee/credential-resolvers/n8n-credential-resolver.d.ts +1 -0
- package/dist/modules/dynamic-credentials.ee/credential-resolvers/n8n-credential-resolver.js +3 -0
- package/dist/modules/dynamic-credentials.ee/credential-resolvers/n8n-credential-resolver.js.map +1 -1
- package/dist/modules/dynamic-credentials.ee/database/repositories/dynamic-credential-user-entry.repository.d.ts +5 -0
- package/dist/modules/dynamic-credentials.ee/database/repositories/dynamic-credential-user-entry.repository.js +15 -0
- package/dist/modules/dynamic-credentials.ee/database/repositories/dynamic-credential-user-entry.repository.js.map +1 -1
- package/dist/modules/dynamic-credentials.ee/services/credential-connection-status.service.d.ts +9 -1
- package/dist/modules/dynamic-credentials.ee/services/credential-connection-status.service.js +57 -3
- 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 +14 -3
- package/dist/modules/dynamic-credentials.ee/services/dynamic-credential.service.js.map +1 -1
- package/dist/modules/external-secrets.ee/providers/infisical.d.ts +20 -14
- package/dist/modules/external-secrets.ee/providers/infisical.js +215 -90
- package/dist/modules/external-secrets.ee/providers/infisical.js.map +1 -1
- package/dist/modules/favorites/dto/add-favorite.dto.d.ts +1 -1
- package/dist/modules/insights/database/entities/insights-shared.d.ts +1 -1
- package/dist/modules/insights/database/repositories/insights-by-period-query.helper.d.ts +2 -1
- package/dist/modules/insights/database/repositories/insights-by-period-query.helper.js +2 -3
- package/dist/modules/insights/database/repositories/insights-by-period-query.helper.js.map +1 -1
- package/dist/modules/insights/database/repositories/insights-by-period.repository.d.ts +3 -3
- package/dist/modules/insights/insights.service.d.ts +3 -3
- package/dist/modules/instance-ai/entities/index.d.ts +1 -0
- package/dist/modules/instance-ai/entities/index.js +3 -1
- package/dist/modules/instance-ai/entities/index.js.map +1 -1
- package/dist/modules/instance-ai/entities/instance-ai-mcp-registry-connection.entity.d.ts +12 -0
- package/dist/modules/instance-ai/entities/instance-ai-mcp-registry-connection.entity.js +42 -0
- package/dist/modules/instance-ai/entities/instance-ai-mcp-registry-connection.entity.js.map +1 -0
- package/dist/modules/instance-ai/entities/instance-ai-thread.entity.d.ts +3 -1
- package/dist/modules/instance-ai/entities/instance-ai-thread.entity.js +10 -0
- package/dist/modules/instance-ai/entities/instance-ai-thread.entity.js.map +1 -1
- package/dist/modules/instance-ai/eval/execution.service.d.ts +8 -2
- package/dist/modules/instance-ai/eval/execution.service.js +183 -40
- package/dist/modules/instance-ai/eval/execution.service.js.map +1 -1
- package/dist/modules/instance-ai/eval/workflow-analysis.js +5 -0
- package/dist/modules/instance-ai/eval/workflow-analysis.js.map +1 -1
- package/dist/modules/instance-ai/extract-resolved-node-parameters.d.ts +1 -2
- package/dist/modules/instance-ai/extract-resolved-node-parameters.js +4 -2
- package/dist/modules/instance-ai/extract-resolved-node-parameters.js.map +1 -1
- package/dist/modules/instance-ai/instance-ai-gateway.service.d.ts +31 -0
- package/dist/modules/instance-ai/instance-ai-gateway.service.js +84 -0
- package/dist/modules/instance-ai/instance-ai-gateway.service.js.map +1 -0
- package/dist/modules/instance-ai/instance-ai-memory.service.d.ts +1 -1
- package/dist/modules/instance-ai/instance-ai-memory.service.js +5 -4
- package/dist/modules/instance-ai/instance-ai-memory.service.js.map +1 -1
- package/dist/modules/instance-ai/instance-ai-settings.service.d.ts +10 -1
- package/dist/modules/instance-ai/instance-ai-settings.service.js +47 -5
- package/dist/modules/instance-ai/instance-ai-settings.service.js.map +1 -1
- package/dist/modules/instance-ai/instance-ai-test.controller.d.ts +6 -2
- package/dist/modules/instance-ai/instance-ai-test.controller.js +17 -3
- package/dist/modules/instance-ai/instance-ai-test.controller.js.map +1 -1
- package/dist/modules/instance-ai/instance-ai.adapter.service.d.ts +5 -5
- package/dist/modules/instance-ai/instance-ai.adapter.service.js +104 -36
- package/dist/modules/instance-ai/instance-ai.adapter.service.js.map +1 -1
- package/dist/modules/instance-ai/instance-ai.controller.d.ts +8 -6
- package/dist/modules/instance-ai/instance-ai.controller.js +31 -36
- package/dist/modules/instance-ai/instance-ai.controller.js.map +1 -1
- package/dist/modules/instance-ai/instance-ai.module.d.ts +4 -1
- package/dist/modules/instance-ai/instance-ai.module.js +7 -6
- package/dist/modules/instance-ai/instance-ai.module.js.map +1 -1
- package/dist/modules/instance-ai/instance-ai.service.d.ts +50 -41
- package/dist/modules/instance-ai/instance-ai.service.js +599 -246
- package/dist/modules/instance-ai/instance-ai.service.js.map +1 -1
- package/dist/modules/instance-ai/internal-messages.js +1 -1
- package/dist/modules/instance-ai/internal-messages.js.map +1 -1
- package/dist/modules/instance-ai/mcp/index.d.ts +1 -0
- package/dist/modules/instance-ai/mcp/index.js +18 -0
- package/dist/modules/instance-ai/mcp/index.js.map +1 -0
- package/dist/modules/instance-ai/mcp/instance-ai-mcp-connection.controller.d.ts +17 -0
- package/dist/modules/instance-ai/mcp/instance-ai-mcp-connection.controller.js +125 -0
- package/dist/modules/instance-ai/mcp/instance-ai-mcp-connection.controller.js.map +1 -0
- package/dist/modules/instance-ai/mcp/instance-ai-mcp-registry.service.d.ts +35 -0
- package/dist/modules/instance-ai/mcp/instance-ai-mcp-registry.service.js +264 -0
- package/dist/modules/instance-ai/mcp/instance-ai-mcp-registry.service.js.map +1 -0
- package/dist/modules/instance-ai/planned-task-action-runner.d.ts +91 -0
- package/dist/modules/instance-ai/planned-task-action-runner.js +138 -0
- package/dist/modules/instance-ai/planned-task-action-runner.js.map +1 -0
- package/dist/modules/instance-ai/repositories/index.d.ts +1 -0
- package/dist/modules/instance-ai/repositories/index.js +3 -1
- package/dist/modules/instance-ai/repositories/index.js.map +1 -1
- package/dist/modules/instance-ai/repositories/instance-ai-checkpoint.repository.js.map +1 -1
- package/dist/modules/instance-ai/repositories/instance-ai-mcp-registry-connection.repository.d.ts +5 -0
- package/dist/modules/instance-ai/repositories/instance-ai-mcp-registry-connection.repository.js +26 -0
- package/dist/modules/instance-ai/repositories/instance-ai-mcp-registry-connection.repository.js.map +1 -0
- package/dist/modules/instance-ai/sandbox-provider.d.ts +4 -0
- package/dist/modules/instance-ai/sandbox-provider.js +19 -0
- package/dist/modules/instance-ai/sandbox-provider.js.map +1 -0
- package/dist/modules/instance-ai/storage/typeorm-agent-checkpoint-store.js.map +1 -1
- package/dist/modules/instance-ai/storage/typeorm-agent-memory.d.ts +4 -1
- package/dist/modules/instance-ai/storage/typeorm-agent-memory.js +103 -12
- package/dist/modules/instance-ai/storage/typeorm-agent-memory.js.map +1 -1
- package/dist/modules/instance-ai/trace-replay-state.d.ts +2 -0
- package/dist/modules/instance-ai/trace-replay-state.js +56 -6
- package/dist/modules/instance-ai/trace-replay-state.js.map +1 -1
- package/dist/modules/instance-ai/workflow-verification-obligation-service.d.ts +20 -0
- package/dist/modules/instance-ai/workflow-verification-obligation-service.js +59 -0
- package/dist/modules/instance-ai/workflow-verification-obligation-service.js.map +1 -0
- package/dist/modules/instance-ai/workflow-verification-task-projector.d.ts +21 -0
- package/dist/modules/instance-ai/workflow-verification-task-projector.js +323 -0
- package/dist/modules/instance-ai/workflow-verification-task-projector.js.map +1 -0
- package/dist/modules/mcp/database/entities/oauth-authorization-code.entity.d.ts +1 -0
- package/dist/modules/mcp/database/entities/oauth-authorization-code.entity.js +4 -0
- package/dist/modules/mcp/database/entities/oauth-authorization-code.entity.js.map +1 -1
- package/dist/modules/mcp/mcp-oauth-authorization-code.service.d.ts +3 -1
- package/dist/modules/mcp/mcp-oauth-authorization-code.service.js +35 -5
- package/dist/modules/mcp/mcp-oauth-authorization-code.service.js.map +1 -1
- package/dist/modules/mcp/mcp-oauth-consent.service.js +1 -1
- package/dist/modules/mcp/mcp-oauth-consent.service.js.map +1 -1
- package/dist/modules/mcp/mcp-oauth-service.d.ts +4 -2
- package/dist/modules/mcp/mcp-oauth-service.js +60 -9
- package/dist/modules/mcp/mcp-oauth-service.js.map +1 -1
- package/dist/modules/mcp/mcp-oauth-token.service.d.ts +8 -6
- package/dist/modules/mcp/mcp-oauth-token.service.js +53 -16
- package/dist/modules/mcp/mcp-oauth-token.service.js.map +1 -1
- package/dist/modules/mcp/mcp-server-middleware.service.js +2 -1
- package/dist/modules/mcp/mcp-server-middleware.service.js.map +1 -1
- package/dist/modules/mcp/mcp.constants.d.ts +1 -0
- package/dist/modules/mcp/mcp.constants.js +2 -1
- package/dist/modules/mcp/mcp.constants.js.map +1 -1
- package/dist/modules/mcp/mcp.controller.js +1 -1
- package/dist/modules/mcp/mcp.controller.js.map +1 -1
- package/dist/modules/mcp/mcp.service.d.ts +7 -4
- package/dist/modules/mcp/mcp.service.js +60 -9
- package/dist/modules/mcp/mcp.service.js.map +1 -1
- package/dist/modules/mcp/mcp.types.d.ts +5 -4
- package/dist/modules/mcp/mcp.utils.d.ts +2 -4
- package/dist/modules/mcp/mcp.utils.js.map +1 -1
- package/dist/modules/mcp/oauth-session.service.d.ts +1 -0
- package/dist/modules/mcp/oauth-session.service.js.map +1 -1
- package/dist/modules/mcp/tools/execute-workflow.tool.d.ts +7 -7
- package/dist/modules/mcp/tools/get-execution.tool.d.ts +1 -1
- package/dist/modules/mcp/tools/get-execution.tool.js +3 -3
- package/dist/modules/mcp/tools/get-execution.tool.js.map +1 -1
- package/dist/modules/mcp/tools/schemas.d.ts +28 -28
- package/dist/modules/mcp/tools/search-projects.tool.d.ts +2 -1
- package/dist/modules/mcp/tools/search-projects.tool.js +16 -7
- package/dist/modules/mcp/tools/search-projects.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 -2
- package/dist/modules/mcp/tools/workflow-builder/constants.js.map +1 -1
- package/dist/modules/mcp/tools/workflow-builder/create-workflow-from-code.tool.d.ts +1 -0
- package/dist/modules/mcp/tools/workflow-builder/create-workflow-from-code.tool.js +9 -2
- package/dist/modules/mcp/tools/workflow-builder/create-workflow-from-code.tool.js.map +1 -1
- package/dist/modules/mcp/tools/workflow-builder/get-workflow-best-practices.tool.d.ts +27 -0
- package/dist/modules/mcp/tools/workflow-builder/get-workflow-best-practices.tool.js +123 -0
- package/dist/modules/mcp/tools/workflow-builder/get-workflow-best-practices.tool.js.map +1 -0
- package/dist/modules/mcp/tools/workflow-builder/get-workflow-node-types.tool.d.ts +2 -2
- package/dist/modules/mcp/tools/workflow-builder/mcp-instructions.js +1 -1
- package/dist/modules/mcp/tools/workflow-builder/mcp-instructions.js.map +1 -1
- package/dist/modules/mcp/tools/workflow-builder/skills-used.d.ts +1 -0
- package/dist/modules/mcp/tools/workflow-builder/skills-used.js +26 -0
- package/dist/modules/mcp/tools/workflow-builder/skills-used.js.map +1 -0
- package/dist/modules/mcp/tools/workflow-builder/update-workflow.tool.d.ts +20 -19
- package/dist/modules/mcp/tools/workflow-builder/update-workflow.tool.js +9 -2
- package/dist/modules/mcp/tools/workflow-builder/update-workflow.tool.js.map +1 -1
- package/dist/modules/mcp/tools/workflow-builder/validate-node.tool.d.ts +2 -2
- package/dist/modules/mcp/tools/workflow-builder/workflow-operations.d.ts +19 -19
- package/dist/modules/mcp-registry/mcp-registry-node-loader.js +3 -2
- package/dist/modules/mcp-registry/mcp-registry-node-loader.js.map +1 -1
- package/dist/modules/mcp-registry/mcp-registry.controller.d.ts +7 -0
- package/dist/modules/mcp-registry/mcp-registry.controller.js +54 -0
- package/dist/modules/mcp-registry/mcp-registry.controller.js.map +1 -0
- package/dist/modules/mcp-registry/mcp-registry.module.js +1 -0
- package/dist/modules/mcp-registry/mcp-registry.module.js.map +1 -1
- package/dist/modules/mcp-registry/node-description-transform.d.ts +5 -3
- package/dist/modules/mcp-registry/node-description-transform.js +82 -24
- package/dist/modules/mcp-registry/node-description-transform.js.map +1 -1
- package/dist/modules/mcp-registry/registry/mcp-registry-api.client.js +8 -4
- package/dist/modules/mcp-registry/registry/mcp-registry-api.client.js.map +1 -1
- package/dist/modules/mcp-registry/registry/mcp-registry.service.d.ts +1 -0
- package/dist/modules/mcp-registry/registry/mcp-registry.service.js +7 -0
- package/dist/modules/mcp-registry/registry/mcp-registry.service.js.map +1 -1
- package/dist/modules/mcp-registry/registry/mcp-registry.types.d.ts +35 -1
- package/dist/modules/mcp-registry/registry/mcp-registry.types.js +13 -0
- package/dist/modules/mcp-registry/registry/mcp-registry.types.js.map +1 -1
- package/dist/modules/mcp-registry/registry/mock-servers.d.ts +2 -0
- package/dist/modules/mcp-registry/registry/mock-servers.js +45 -1
- package/dist/modules/mcp-registry/registry/mock-servers.js.map +1 -1
- package/dist/modules/n8n-packages/engine/import-pipeline.d.ts +5 -3
- package/dist/modules/n8n-packages/engine/import-pipeline.js +36 -25
- package/dist/modules/n8n-packages/engine/import-pipeline.js.map +1 -1
- package/dist/modules/n8n-packages/entities/credential/credential-importer.d.ts +9 -0
- package/dist/modules/n8n-packages/entities/credential/credential-importer.js +41 -0
- package/dist/modules/n8n-packages/entities/credential/credential-importer.js.map +1 -0
- package/dist/modules/n8n-packages/entities/credential/credential-matcher-factory.d.ts +8 -0
- package/dist/modules/n8n-packages/entities/credential/credential-matcher-factory.js +35 -0
- package/dist/modules/n8n-packages/entities/credential/credential-matcher-factory.js.map +1 -0
- package/dist/modules/n8n-packages/entities/credential/credential-matcher.d.ts +18 -0
- package/dist/modules/n8n-packages/entities/credential/credential-matcher.js +34 -0
- package/dist/modules/n8n-packages/entities/credential/credential-matcher.js.map +1 -0
- package/dist/modules/n8n-packages/entities/credential/credential-missing-mode-factory.d.ts +7 -0
- package/dist/modules/n8n-packages/entities/credential/credential-missing-mode-factory.js +35 -0
- package/dist/modules/n8n-packages/entities/credential/credential-missing-mode-factory.js.map +1 -0
- package/dist/modules/n8n-packages/entities/credential/credential-missing-mode.d.ts +7 -0
- package/dist/modules/n8n-packages/entities/credential/credential-missing-mode.js +17 -0
- package/dist/modules/n8n-packages/entities/credential/credential-missing-mode.js.map +1 -0
- package/dist/modules/n8n-packages/entities/credential/credential-resolution-error.d.ts +3 -0
- package/dist/modules/n8n-packages/entities/credential/credential-resolution-error.js +14 -0
- package/dist/modules/n8n-packages/entities/credential/credential-resolution-error.js.map +1 -0
- package/dist/modules/n8n-packages/entities/credential/credential.types.d.ts +30 -0
- package/dist/modules/n8n-packages/entities/credential/credential.types.js +12 -0
- package/dist/modules/n8n-packages/entities/credential/credential.types.js.map +1 -1
- package/dist/modules/n8n-packages/entities/credential/id-based-credential-matcher.d.ts +13 -0
- package/dist/modules/n8n-packages/entities/credential/id-based-credential-matcher.js +47 -0
- package/dist/modules/n8n-packages/entities/credential/id-based-credential-matcher.js.map +1 -0
- package/dist/modules/n8n-packages/entities/workflow/workflow-conflict-policy-fail.handler.d.ts +9 -0
- package/dist/modules/n8n-packages/entities/workflow/workflow-conflict-policy-fail.handler.js +41 -0
- package/dist/modules/n8n-packages/entities/workflow/workflow-conflict-policy-fail.handler.js.map +1 -0
- package/dist/modules/n8n-packages/entities/workflow/workflow-conflict-policy-handler.d.ts +10 -0
- package/dist/modules/n8n-packages/entities/workflow/workflow-conflict-policy-handler.js +20 -0
- package/dist/modules/n8n-packages/entities/workflow/workflow-conflict-policy-handler.js.map +1 -0
- package/dist/modules/n8n-packages/entities/workflow/workflow-conflict-policy-new-version.handler.d.ts +11 -0
- package/dist/modules/n8n-packages/entities/workflow/workflow-conflict-policy-new-version.handler.js +42 -0
- package/dist/modules/n8n-packages/entities/workflow/workflow-conflict-policy-new-version.handler.js.map +1 -0
- package/dist/modules/n8n-packages/entities/workflow/workflow-conflict-policy-skip.handler.d.ts +9 -0
- package/dist/modules/n8n-packages/entities/workflow/workflow-conflict-policy-skip.handler.js +33 -0
- package/dist/modules/n8n-packages/entities/workflow/workflow-conflict-policy-skip.handler.js.map +1 -0
- package/dist/modules/n8n-packages/entities/workflow/workflow-conflict-policy.factory.d.ts +10 -0
- package/dist/modules/n8n-packages/entities/workflow/workflow-conflict-policy.factory.js +37 -0
- package/dist/modules/n8n-packages/entities/workflow/workflow-conflict-policy.factory.js.map +1 -0
- package/dist/modules/n8n-packages/entities/workflow/workflow-conflict-policy.types.d.ts +20 -0
- package/dist/modules/n8n-packages/entities/workflow/workflow-conflict-policy.types.js +3 -0
- package/dist/modules/n8n-packages/entities/workflow/workflow-conflict-policy.types.js.map +1 -0
- package/dist/modules/n8n-packages/entities/workflow/workflow-import-match.service.d.ts +7 -0
- package/dist/modules/n8n-packages/entities/workflow/workflow-import-match.service.js +54 -0
- package/dist/modules/n8n-packages/entities/workflow/workflow-import-match.service.js.map +1 -0
- package/dist/modules/n8n-packages/entities/workflow/workflow-importer.d.ts +14 -0
- package/dist/modules/n8n-packages/entities/workflow/workflow-importer.js +47 -0
- package/dist/modules/n8n-packages/entities/workflow/workflow-importer.js.map +1 -0
- package/dist/modules/n8n-packages/n8n-packages.types.d.ts +23 -1
- package/dist/modules/n8n-packages/n8n-packages.types.js +21 -0
- package/dist/modules/n8n-packages/n8n-packages.types.js.map +1 -1
- package/dist/modules/n8n-packages/spec/manifest.schema.d.ts +41 -31
- package/dist/modules/n8n-packages/spec/manifest.schema.js.map +1 -1
- package/dist/modules/n8n-packages/spec/requirements.schema.d.ts +17 -7
- package/dist/modules/n8n-packages/spec/requirements.schema.js +17 -1
- package/dist/modules/n8n-packages/spec/requirements.schema.js.map +1 -1
- package/dist/modules/n8n-packages/spec/serialized/credential.schema.d.ts +2 -2
- package/dist/modules/n8n-packages/spec/serialized/workflow.schema.d.ts +40 -33
- package/dist/modules/n8n-packages/spec/serialized/workflow.schema.js +2 -1
- package/dist/modules/n8n-packages/spec/serialized/workflow.schema.js.map +1 -1
- package/dist/modules/n8n-packages/utils/import-package-upload.js +1 -1
- package/dist/modules/oauth-jwe/oauth-jwe.schemas.d.ts +18 -18
- package/dist/modules/otel/otel-lifecycle-handler.d.ts +6 -2
- package/dist/modules/otel/otel-lifecycle-handler.js +30 -17
- package/dist/modules/otel/otel-lifecycle-handler.js.map +1 -1
- package/dist/modules/quick-connect/quick-connect.config.d.ts +29 -29
- package/dist/modules/quick-connect/quick-connect.module.d.ts +11 -11
- package/dist/modules/redaction/executions/execution-redaction.interfaces.d.ts +1 -1
- package/dist/modules/redaction/executions/execution-redaction.service.d.ts +1 -0
- package/dist/modules/redaction/executions/execution-redaction.service.js +25 -11
- package/dist/modules/redaction/executions/execution-redaction.service.js.map +1 -1
- package/dist/modules/redaction/executions/strategies/full-item-redaction.strategy.js +1 -1
- package/dist/modules/redaction/executions/strategies/full-item-redaction.strategy.js.map +1 -1
- package/dist/modules/redaction/instance-redaction-enforcement.service.d.ts +9 -7
- package/dist/modules/redaction/instance-redaction-enforcement.service.js +32 -14
- package/dist/modules/redaction/instance-redaction-enforcement.service.js.map +1 -1
- package/dist/modules/redaction/redaction-context-hook.js +14 -16
- package/dist/modules/redaction/redaction-context-hook.js.map +1 -1
- package/dist/modules/redaction/redaction-enforcement.service.d.ts +5 -5
- package/dist/modules/redaction/redaction-enforcement.service.js +13 -11
- package/dist/modules/redaction/redaction-enforcement.service.js.map +1 -1
- package/dist/modules/redaction/redaction-policy.d.ts +7 -0
- package/dist/modules/redaction/redaction-policy.js +31 -0
- package/dist/modules/redaction/redaction-policy.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/source-control-import.service.ee.js +1 -1
- package/dist/modules/source-control.ee/source-control-import.service.ee.js.map +1 -1
- package/dist/modules/source-control.ee/source-control.controller.ee.d.ts +4 -4
- package/dist/modules/source-control.ee/source-control.service.ee.d.ts +2 -2
- package/dist/modules/sso-oidc/oidc.controller.ee.d.ts +1 -1
- package/dist/modules/sso-oidc/oidc.service.ee.d.ts +2 -1
- package/dist/modules/sso-oidc/oidc.service.ee.js +35 -18
- package/dist/modules/sso-oidc/oidc.service.ee.js.map +1 -1
- package/dist/modules/token-exchange/token-exchange.schemas.d.ts +12 -12
- package/dist/node-execution/ephemeral-node-executor.js +3 -0
- package/dist/node-execution/ephemeral-node-executor.js.map +1 -1
- package/dist/oauth/oauth.service.d.ts +20 -6
- package/dist/oauth/oauth.service.js +80 -18
- package/dist/oauth/oauth.service.js.map +1 -1
- package/dist/public-api/v1/handlers/executions/executions.handler.js +4 -4
- package/dist/public-api/v1/handlers/executions/executions.handler.js.map +1 -1
- package/dist/public-api/v1/handlers/n8n-packages/n8n-packages.handler.js +3 -0
- package/dist/public-api/v1/handlers/n8n-packages/n8n-packages.handler.js.map +1 -1
- package/dist/public-api/v1/handlers/users/users.service.ee.js +1 -0
- package/dist/public-api/v1/handlers/users/users.service.ee.js.map +1 -1
- package/dist/public-api/v1/handlers/workflows/workflows.service.js +2 -0
- package/dist/public-api/v1/handlers/workflows/workflows.service.js.map +1 -1
- package/dist/public-api/v1/openapi.yml +169 -6
- package/dist/response-helper.js +16 -1
- package/dist/response-helper.js.map +1 -1
- package/dist/scaling/constants.d.ts +2 -2
- package/dist/scaling/job-processor.d.ts +3 -1
- package/dist/scaling/job-processor.js +6 -3
- package/dist/scaling/job-processor.js.map +1 -1
- package/dist/scaling/pubsub/pubsub.event-map.d.ts +1 -0
- package/dist/scaling/pubsub/pubsub.types.d.ts +2 -1
- package/dist/scaling/scaling.service.d.ts +3 -1
- package/dist/scaling/scaling.service.js +5 -2
- package/dist/scaling/scaling.service.js.map +1 -1
- package/dist/security-audit/risk-reporters/credentials-risk-reporter.d.ts +4 -3
- package/dist/security-audit/risk-reporters/credentials-risk-reporter.js +6 -4
- package/dist/security-audit/risk-reporters/credentials-risk-reporter.js.map +1 -1
- package/dist/services/ai-workflow-builder.service.d.ts +1 -2
- package/dist/services/ai-workflow-builder.service.js +2 -3
- package/dist/services/ai-workflow-builder.service.js.map +1 -1
- package/dist/services/dynamic-node-parameters.service.js +3 -5
- package/dist/services/dynamic-node-parameters.service.js.map +1 -1
- package/dist/services/frontend.service.js +2 -0
- package/dist/services/frontend.service.js.map +1 -1
- package/dist/services/project.service.ee.d.ts +1 -0
- package/dist/services/project.service.ee.js +34 -2
- package/dist/services/project.service.ee.js.map +1 -1
- package/dist/services/public-api-key.service.d.ts +25 -7
- package/dist/services/public-api-key.service.js +93 -14
- package/dist/services/public-api-key.service.js.map +1 -1
- package/dist/services/role.service.d.ts +3 -3
- package/dist/task-runners/errors/task-cancelled.error.d.ts +4 -0
- package/dist/task-runners/errors/task-cancelled.error.js +11 -0
- package/dist/task-runners/errors/task-cancelled.error.js.map +1 -0
- package/dist/task-runners/task-managers/task-requester.js +2 -1
- package/dist/task-runners/task-managers/task-requester.js.map +1 -1
- package/dist/telemetry/index.js +2 -2
- package/dist/tool-generation/hitl-tools.js +1 -1
- package/dist/tool-generation/hitl-tools.js.map +1 -1
- package/dist/utils/auth-fetch.d.ts +6 -0
- package/dist/utils/auth-fetch.js +33 -0
- package/dist/utils/auth-fetch.js.map +1 -0
- package/dist/wait-tracker.d.ts +6 -1
- package/dist/wait-tracker.js +43 -18
- package/dist/wait-tracker.js.map +1 -1
- package/dist/webhooks/waiting-webhooks.d.ts +3 -3
- package/dist/webhooks/waiting-webhooks.js +5 -5
- package/dist/webhooks/waiting-webhooks.js.map +1 -1
- package/dist/webhooks/webhook-helpers.js +1 -19
- package/dist/webhooks/webhook-helpers.js.map +1 -1
- package/dist/webhooks/webhook-server.d.ts +1 -0
- package/dist/webhooks/webhook-server.js +39 -0
- package/dist/webhooks/webhook-server.js.map +1 -1
- package/dist/workflow-execute-additional-data.d.ts +3 -2
- package/dist/workflow-execute-additional-data.js +42 -15
- package/dist/workflow-execute-additional-data.js.map +1 -1
- package/dist/workflow-helpers.d.ts +2 -2
- package/dist/workflow-helpers.js +5 -3
- package/dist/workflow-helpers.js.map +1 -1
- package/dist/workflow-runner.d.ts +3 -1
- package/dist/workflow-runner.js +8 -2
- package/dist/workflow-runner.js.map +1 -1
- package/dist/workflows/utils.d.ts +2 -0
- package/dist/workflows/utils.js +6 -0
- package/dist/workflows/utils.js.map +1 -1
- package/dist/workflows/workflow-creation.service.d.ts +7 -3
- package/dist/workflows/workflow-creation.service.js +38 -14
- package/dist/workflows/workflow-creation.service.js.map +1 -1
- package/dist/workflows/workflow-finder.service.d.ts +9 -0
- package/dist/workflows/workflow-finder.service.js +60 -16
- package/dist/workflows/workflow-finder.service.js.map +1 -1
- package/dist/workflows/workflow-publication-outbox-consumer.d.ts +31 -0
- package/dist/workflows/workflow-publication-outbox-consumer.js +209 -0
- package/dist/workflows/workflow-publication-outbox-consumer.js.map +1 -0
- package/dist/workflows/workflow-validation.service.js +1 -1
- package/dist/workflows/workflow-validation.service.js.map +1 -1
- package/dist/workflows/workflow.service.d.ts +5 -5
- package/dist/workflows/workflow.service.js +1 -1
- package/dist/workflows/workflow.service.js.map +1 -1
- package/dist/workflows/workflows.controller.d.ts +29 -29
- package/dist/workflows/workflows.controller.js +3 -4
- package/dist/workflows/workflows.controller.js.map +1 -1
- package/package.json +37 -37
- package/dist/controllers/redaction-enforcement-mapper.d.ts +0 -3
- package/dist/controllers/redaction-enforcement-mapper.js +0 -27
- package/dist/controllers/redaction-enforcement-mapper.js.map +0 -1
- package/dist/modules/agents/integrations/rich-interaction-tool.d.ts +0 -47
- package/dist/modules/agents/integrations/rich-interaction-tool.js +0 -109
- package/dist/modules/agents/integrations/rich-interaction-tool.js.map +0 -1
- package/dist/modules/instance-ai/eval/sub-agent-eval.service.d.ts +0 -13
- package/dist/modules/instance-ai/eval/sub-agent-eval.service.js +0 -154
- package/dist/modules/instance-ai/eval/sub-agent-eval.service.js.map +0 -1
- package/dist/modules/instance-ai/eval/sub-agent-roles.d.ts +0 -7
- package/dist/modules/instance-ai/eval/sub-agent-roles.js +0 -21
- package/dist/modules/instance-ai/eval/sub-agent-roles.js.map +0 -1
- package/dist/modules/mcp/tools/workflow-builder/get-suggested-workflow-nodes.tool.d.ts +0 -10
- package/dist/modules/mcp/tools/workflow-builder/get-suggested-workflow-nodes.tool.js +0 -64
- package/dist/modules/mcp/tools/workflow-builder/get-suggested-workflow-nodes.tool.js.map +0 -1
- package/dist/modules/redaction/redaction.config.d.ts +0 -3
- package/dist/modules/redaction/redaction.config.js +0 -27
- package/dist/modules/redaction/redaction.config.js.map +0 -1
- package/dist/services/ssrf/dns-resolver.d.ts +0 -13
- package/dist/services/ssrf/dns-resolver.js +0 -93
- package/dist/services/ssrf/dns-resolver.js.map +0 -1
- package/dist/services/ssrf/hostname-matcher.d.ts +0 -6
- package/dist/services/ssrf/hostname-matcher.js +0 -38
- package/dist/services/ssrf/hostname-matcher.js.map +0 -1
- package/dist/services/ssrf/in-memory-dns-cache.service.d.ts +0 -11
- package/dist/services/ssrf/in-memory-dns-cache.service.js +0 -61
- package/dist/services/ssrf/in-memory-dns-cache.service.js.map +0 -1
- package/dist/services/ssrf/ip-range-builder.d.ts +0 -10
- package/dist/services/ssrf/ip-range-builder.js +0 -52
- package/dist/services/ssrf/ip-range-builder.js.map +0 -1
- package/dist/services/ssrf/ssrf-blocked-ip.error.d.ts +0 -6
- package/dist/services/ssrf/ssrf-blocked-ip.error.js +0 -21
- package/dist/services/ssrf/ssrf-blocked-ip.error.js.map +0 -1
- package/dist/services/ssrf/ssrf-protection.service.d.ts +0 -26
- package/dist/services/ssrf/ssrf-protection.service.js +0 -159
- package/dist/services/ssrf/ssrf-protection.service.js.map +0 -1
|
@@ -46,38 +46,43 @@ exports.InstanceAiService = void 0;
|
|
|
46
46
|
const api_types_1 = require("@n8n/api-types");
|
|
47
47
|
const backend_common_1 = require("@n8n/backend-common");
|
|
48
48
|
const config_1 = require("@n8n/config");
|
|
49
|
-
const decorators_1 = require("@n8n/decorators");
|
|
50
|
-
const n8n_core_1 = require("n8n-core");
|
|
51
|
-
const ssrf_protection_service_1 = require("../../services/ssrf/ssrf-protection.service");
|
|
52
49
|
const db_1 = require("@n8n/db");
|
|
50
|
+
const decorators_1 = require("@n8n/decorators");
|
|
53
51
|
const di_1 = require("@n8n/di");
|
|
54
|
-
const url_service_1 = require("../../services/url.service");
|
|
55
52
|
const instance_ai_1 = require("@n8n/instance-ai");
|
|
56
53
|
const workflow_sdk_1 = require("@n8n/workflow-sdk");
|
|
57
|
-
const
|
|
54
|
+
const n8n_core_1 = require("n8n-core");
|
|
58
55
|
const n8n_workflow_1 = require("n8n-workflow");
|
|
56
|
+
const nanoid_1 = require("nanoid");
|
|
59
57
|
const uuid_1 = require("uuid");
|
|
60
|
-
const constants_1 = require("../../constants");
|
|
61
|
-
const event_service_1 = require("../../events/event.service");
|
|
62
|
-
const source_control_preferences_service_ee_1 = require("../../modules/source-control.ee/source-control-preferences.service.ee");
|
|
63
|
-
const ai_service_1 = require("../../services/ai.service");
|
|
64
|
-
const push_1 = require("../../push");
|
|
65
|
-
const telemetry_1 = require("../../telemetry");
|
|
66
58
|
const in_process_event_bus_1 = require("./event-bus/in-process-event-bus");
|
|
67
|
-
const
|
|
59
|
+
const instance_ai_gateway_service_1 = require("./instance-ai-gateway.service");
|
|
60
|
+
const instance_ai_memory_service_1 = require("./instance-ai-memory.service");
|
|
68
61
|
const instance_ai_settings_service_1 = require("./instance-ai-settings.service");
|
|
69
62
|
const instance_ai_adapter_service_1 = require("./instance-ai.adapter.service");
|
|
70
63
|
const internal_messages_1 = require("./internal-messages");
|
|
71
|
-
const
|
|
64
|
+
const liveness_1 = require("./liveness");
|
|
65
|
+
const mcp_1 = require("./mcp");
|
|
66
|
+
const instance_ai_pending_confirmation_repository_1 = require("./repositories/instance-ai-pending-confirmation.repository");
|
|
67
|
+
const instance_ai_thread_repository_1 = require("./repositories/instance-ai-thread.repository");
|
|
68
|
+
const run_trace_metadata_1 = require("./run-trace-metadata");
|
|
69
|
+
const sandbox_provider_1 = require("./sandbox-provider");
|
|
72
70
|
const db_iteration_log_storage_1 = require("./storage/db-iteration-log-storage");
|
|
71
|
+
const db_snapshot_storage_1 = require("./storage/db-snapshot-storage");
|
|
73
72
|
const typeorm_agent_checkpoint_store_1 = require("./storage/typeorm-agent-checkpoint-store");
|
|
74
73
|
const typeorm_agent_memory_1 = require("./storage/typeorm-agent-memory");
|
|
75
|
-
const proxy_token_manager_1 = require("../../services/proxy-token-manager");
|
|
76
|
-
const instance_ai_pending_confirmation_repository_1 = require("./repositories/instance-ai-pending-confirmation.repository");
|
|
77
|
-
const instance_ai_thread_repository_1 = require("./repositories/instance-ai-thread.repository");
|
|
78
74
|
const trace_replay_state_1 = require("./trace-replay-state");
|
|
79
|
-
const
|
|
80
|
-
const
|
|
75
|
+
const workflow_verification_obligation_service_1 = require("./workflow-verification-obligation-service");
|
|
76
|
+
const planned_task_action_runner_1 = require("./planned-task-action-runner");
|
|
77
|
+
const workflow_verification_task_projector_1 = require("./workflow-verification-task-projector");
|
|
78
|
+
const constants_1 = require("../../constants");
|
|
79
|
+
const event_service_1 = require("../../events/event.service");
|
|
80
|
+
const source_control_preferences_service_ee_1 = require("../../modules/source-control.ee/source-control-preferences.service.ee");
|
|
81
|
+
const push_1 = require("../../push");
|
|
82
|
+
const ai_service_1 = require("../../services/ai.service");
|
|
83
|
+
const proxy_token_manager_1 = require("../../services/proxy-token-manager");
|
|
84
|
+
const url_service_1 = require("../../services/url.service");
|
|
85
|
+
const telemetry_1 = require("../../telemetry");
|
|
81
86
|
function getErrorMessage(error) {
|
|
82
87
|
return error instanceof Error ? error.message : String(error);
|
|
83
88
|
}
|
|
@@ -87,6 +92,7 @@ function isTelemetryConfigurableAgent(agent) {
|
|
|
87
92
|
typeof Reflect.get(agent, 'telemetry') === 'function');
|
|
88
93
|
}
|
|
89
94
|
const INSTANCE_AI_CHECKPOINT_PRUNE_RETRY_MS = 30 * 1000;
|
|
95
|
+
const WORKFLOW_SETUP_ROUTING_CLAIM_TTL_MS = 15 * 60 * 1000;
|
|
90
96
|
const INSTANCE_AI_SHUTDOWN_DRAIN_TIMEOUT_MS = 5 * 1000;
|
|
91
97
|
function isTextMessagePart(part) {
|
|
92
98
|
return (typeof part === 'object' &&
|
|
@@ -325,11 +331,13 @@ let InstanceAiService = class InstanceAiService {
|
|
|
325
331
|
}
|
|
326
332
|
return this._mcpClientManager;
|
|
327
333
|
}
|
|
328
|
-
constructor(logger, globalConfig, instanceSettings, adapterService, eventBus, settingsService, agentMemory, checkpointStore, aiService, push, threadRepo, pendingConfirmationRepo, urlService, dbSnapshotStorage, dbIterationLogStorage, sourceControlPreferencesService, telemetry, userRepository, aiBuilderTemporaryWorkflowRepository, errorReporter, ssrfProtectionConfig, ssrfProtectionService, eventService) {
|
|
334
|
+
constructor(logger, globalConfig, instanceSettings, adapterService, eventBus, settingsService, gatewayService, memoryService, agentMemory, checkpointStore, aiService, push, threadRepo, pendingConfirmationRepo, urlService, dbSnapshotStorage, dbIterationLogStorage, sourceControlPreferencesService, telemetry, mcpRegistryService, userRepository, aiBuilderTemporaryWorkflowRepository, errorReporter, ssrfProtectionConfig, ssrfProtectionService, eventService) {
|
|
329
335
|
this.instanceSettings = instanceSettings;
|
|
330
336
|
this.adapterService = adapterService;
|
|
331
337
|
this.eventBus = eventBus;
|
|
332
338
|
this.settingsService = settingsService;
|
|
339
|
+
this.gatewayService = gatewayService;
|
|
340
|
+
this.memoryService = memoryService;
|
|
333
341
|
this.agentMemory = agentMemory;
|
|
334
342
|
this.checkpointStore = checkpointStore;
|
|
335
343
|
this.aiService = aiService;
|
|
@@ -341,6 +349,7 @@ let InstanceAiService = class InstanceAiService {
|
|
|
341
349
|
this.dbIterationLogStorage = dbIterationLogStorage;
|
|
342
350
|
this.sourceControlPreferencesService = sourceControlPreferencesService;
|
|
343
351
|
this.telemetry = telemetry;
|
|
352
|
+
this.mcpRegistryService = mcpRegistryService;
|
|
344
353
|
this.userRepository = userRepository;
|
|
345
354
|
this.aiBuilderTemporaryWorkflowRepository = aiBuilderTemporaryWorkflowRepository;
|
|
346
355
|
this.errorReporter = errorReporter;
|
|
@@ -350,7 +359,6 @@ let InstanceAiService = class InstanceAiService {
|
|
|
350
359
|
this.traceContextsByRunId = new Map();
|
|
351
360
|
this.sandboxes = new Map();
|
|
352
361
|
this.sandboxCreations = new Map();
|
|
353
|
-
this.gatewayRegistry = new filesystem_1.LocalGatewayRegistry();
|
|
354
362
|
this.domainAccessTrackersByThread = new Map();
|
|
355
363
|
this.threadPushRef = new Map();
|
|
356
364
|
this.planRequestsByThread = new Map();
|
|
@@ -364,6 +372,8 @@ let InstanceAiService = class InstanceAiService {
|
|
|
364
372
|
this.preserveHitlOnShutdown = new Set();
|
|
365
373
|
this.userMessagePersistenceByRun = new Map();
|
|
366
374
|
this.logger = logger.scoped('instance-ai');
|
|
375
|
+
this.workflowObligations = new workflow_verification_obligation_service_1.WorkflowVerificationObligationService(this.agentMemory);
|
|
376
|
+
this.taskProjector = new workflow_verification_task_projector_1.WorkflowVerificationTaskProjector(this.agentMemory, this.eventBus, this.logger, this.workflowObligations);
|
|
367
377
|
this.instanceAiConfig = globalConfig.instanceAi;
|
|
368
378
|
const livenessPolicyConfig = (0, instance_ai_1.createInstanceAiLivenessPolicyConfig)({
|
|
369
379
|
confirmationTimeoutMs: this.instanceAiConfig.confirmationTimeout,
|
|
@@ -406,18 +416,15 @@ let InstanceAiService = class InstanceAiService {
|
|
|
406
416
|
}
|
|
407
417
|
getSandboxConfigFromEnv() {
|
|
408
418
|
const { sandboxEnabled, sandboxProvider, daytonaApiUrl, daytonaApiKey, n8nSandboxServiceUrl, n8nSandboxServiceApiKey, sandboxImage, sandboxTimeout, sandboxNamePrefix, daytonaTokenRefreshSkewMs, } = this.instanceAiConfig;
|
|
419
|
+
const provider = (0, sandbox_provider_1.normalizeSandboxProvider)(sandboxProvider);
|
|
409
420
|
if (!sandboxEnabled) {
|
|
410
421
|
return {
|
|
411
422
|
enabled: false,
|
|
412
|
-
provider
|
|
413
|
-
? 'n8n-sandbox'
|
|
414
|
-
: sandboxProvider === 'daytona'
|
|
415
|
-
? 'daytona'
|
|
416
|
-
: 'local',
|
|
423
|
+
provider,
|
|
417
424
|
timeout: sandboxTimeout,
|
|
418
425
|
};
|
|
419
426
|
}
|
|
420
|
-
if (
|
|
427
|
+
if (provider === 'daytona') {
|
|
421
428
|
return {
|
|
422
429
|
enabled: true,
|
|
423
430
|
provider: 'daytona',
|
|
@@ -430,18 +437,11 @@ let InstanceAiService = class InstanceAiService {
|
|
|
430
437
|
refreshSkewMs: daytonaTokenRefreshSkewMs,
|
|
431
438
|
};
|
|
432
439
|
}
|
|
433
|
-
if (sandboxProvider === 'n8n-sandbox') {
|
|
434
|
-
return {
|
|
435
|
-
enabled: true,
|
|
436
|
-
provider: 'n8n-sandbox',
|
|
437
|
-
serviceUrl: n8nSandboxServiceUrl || undefined,
|
|
438
|
-
apiKey: n8nSandboxServiceApiKey || undefined,
|
|
439
|
-
timeout: sandboxTimeout,
|
|
440
|
-
};
|
|
441
|
-
}
|
|
442
440
|
return {
|
|
443
441
|
enabled: true,
|
|
444
|
-
provider: '
|
|
442
|
+
provider: 'n8n-sandbox',
|
|
443
|
+
serviceUrl: (0, sandbox_provider_1.requireN8nSandboxServiceUrl)(n8nSandboxServiceUrl),
|
|
444
|
+
apiKey: n8nSandboxServiceApiKey || undefined,
|
|
445
445
|
timeout: sandboxTimeout,
|
|
446
446
|
};
|
|
447
447
|
}
|
|
@@ -471,15 +471,12 @@ let InstanceAiService = class InstanceAiService {
|
|
|
471
471
|
daytonaApiKey: daytona.apiKey ?? base.daytonaApiKey,
|
|
472
472
|
};
|
|
473
473
|
}
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
};
|
|
481
|
-
}
|
|
482
|
-
return base;
|
|
474
|
+
const sandbox = await this.settingsService.resolveN8nSandboxConfig(user);
|
|
475
|
+
return {
|
|
476
|
+
...base,
|
|
477
|
+
serviceUrl: sandbox.serviceUrl ?? base.serviceUrl,
|
|
478
|
+
apiKey: sandbox.apiKey ?? base.apiKey,
|
|
479
|
+
};
|
|
483
480
|
}
|
|
484
481
|
async getOrCreateWorkspaceEntry(threadId, user) {
|
|
485
482
|
const existing = this.sandboxes.get(threadId);
|
|
@@ -755,6 +752,12 @@ let InstanceAiService = class InstanceAiService {
|
|
|
755
752
|
return this.runState.getThreadStatus(threadId, this.backgroundTasks.getTaskSnapshots(threadId));
|
|
756
753
|
}
|
|
757
754
|
storeTraceContext(runId, threadId, tracing, messageGroupId) {
|
|
755
|
+
const existing = this.traceContextsByRunId.get(runId);
|
|
756
|
+
if (existing?.tracing.traceWriter &&
|
|
757
|
+
existing.traceSlug &&
|
|
758
|
+
existing.tracing.traceWriter !== tracing.traceWriter) {
|
|
759
|
+
this.traceReplay.preserveWriterEvents(existing.traceSlug, existing.tracing.traceWriter.getEvents());
|
|
760
|
+
}
|
|
758
761
|
this.traceContextsByRunId.set(runId, {
|
|
759
762
|
threadId,
|
|
760
763
|
messageGroupId,
|
|
@@ -881,6 +884,20 @@ let InstanceAiService = class InstanceAiService {
|
|
|
881
884
|
}
|
|
882
885
|
}
|
|
883
886
|
}
|
|
887
|
+
deleteTraceContextsForSlug(slug) {
|
|
888
|
+
for (const [runId, entry] of this.traceContextsByRunId) {
|
|
889
|
+
if (entry.traceSlug === slug) {
|
|
890
|
+
(0, instance_ai_1.releaseTraceClient)(entry.tracing.rootRun.traceId);
|
|
891
|
+
this.traceContextsByRunId.delete(runId);
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
clearTraceContextsForTest() {
|
|
896
|
+
for (const entry of this.traceContextsByRunId.values()) {
|
|
897
|
+
(0, instance_ai_1.releaseTraceClient)(entry.tracing.rootRun.traceId);
|
|
898
|
+
}
|
|
899
|
+
this.traceContextsByRunId.clear();
|
|
900
|
+
}
|
|
884
901
|
async finalizeDetachedTraceRun(taskId, traceContext, options) {
|
|
885
902
|
if (!traceContext)
|
|
886
903
|
return;
|
|
@@ -1233,66 +1250,23 @@ let InstanceAiService = class InstanceAiService {
|
|
|
1233
1250
|
getTraceEvents(slug) {
|
|
1234
1251
|
return this.traceReplay.getEventsWithWriterFallback(slug, this.traceContextsByRunId.values());
|
|
1235
1252
|
}
|
|
1253
|
+
hasRunningWorkForTest() {
|
|
1254
|
+
const threadIds = new Set([...this.traceContextsByRunId.values()].map((entry) => entry.threadId));
|
|
1255
|
+
for (const threadId of threadIds) {
|
|
1256
|
+
if (this.runState.getActiveRunId(threadId))
|
|
1257
|
+
return true;
|
|
1258
|
+
if (this.backgroundTasks.getRunningTasks(threadId).length > 0)
|
|
1259
|
+
return true;
|
|
1260
|
+
}
|
|
1261
|
+
return false;
|
|
1262
|
+
}
|
|
1236
1263
|
activateTraceSlug(slug) {
|
|
1237
1264
|
this.traceReplay.activateSlug(slug);
|
|
1238
1265
|
}
|
|
1239
1266
|
clearTraceEvents(slug) {
|
|
1267
|
+
this.deleteTraceContextsForSlug(slug);
|
|
1240
1268
|
this.traceReplay.clearEvents(slug);
|
|
1241
1269
|
}
|
|
1242
|
-
getUserIdForApiKey(key) {
|
|
1243
|
-
return this.gatewayRegistry.getUserIdForApiKey(key);
|
|
1244
|
-
}
|
|
1245
|
-
generatePairingToken(userId) {
|
|
1246
|
-
return this.gatewayRegistry.generatePairingToken(userId);
|
|
1247
|
-
}
|
|
1248
|
-
getGatewayApiKeyExpiresAt(userId, key) {
|
|
1249
|
-
return this.gatewayRegistry.getApiKeyExpiresAt(userId, key);
|
|
1250
|
-
}
|
|
1251
|
-
getPairingToken(userId) {
|
|
1252
|
-
return this.gatewayRegistry.getPairingToken(userId);
|
|
1253
|
-
}
|
|
1254
|
-
consumePairingToken(userId, token) {
|
|
1255
|
-
return this.gatewayRegistry.consumePairingToken(userId, token);
|
|
1256
|
-
}
|
|
1257
|
-
getActiveSessionKey(userId) {
|
|
1258
|
-
return this.gatewayRegistry.getActiveSessionKey(userId);
|
|
1259
|
-
}
|
|
1260
|
-
clearActiveSessionKey(userId) {
|
|
1261
|
-
this.gatewayRegistry.clearActiveSessionKey(userId);
|
|
1262
|
-
}
|
|
1263
|
-
getLocalGateway(userId) {
|
|
1264
|
-
return this.gatewayRegistry.getGateway(userId);
|
|
1265
|
-
}
|
|
1266
|
-
initGateway(userId, data) {
|
|
1267
|
-
this.gatewayRegistry.initGateway(userId, data);
|
|
1268
|
-
this.telemetry.track('User connected to Computer Use', {
|
|
1269
|
-
user_id: userId,
|
|
1270
|
-
tool_groups: data.toolCategories.filter((c) => c.enabled).map((c) => c.name),
|
|
1271
|
-
});
|
|
1272
|
-
}
|
|
1273
|
-
resolveGatewayRequest(userId, requestId, result, error) {
|
|
1274
|
-
return this.gatewayRegistry.resolveGatewayRequest(userId, requestId, result, error);
|
|
1275
|
-
}
|
|
1276
|
-
disconnectGateway(userId) {
|
|
1277
|
-
this.gatewayRegistry.disconnectGateway(userId);
|
|
1278
|
-
}
|
|
1279
|
-
disconnectAllGateways() {
|
|
1280
|
-
const connectedUserIds = this.gatewayRegistry.getConnectedUserIds();
|
|
1281
|
-
this.gatewayRegistry.disconnectAll();
|
|
1282
|
-
return connectedUserIds;
|
|
1283
|
-
}
|
|
1284
|
-
isLocalGatewayDisabled() {
|
|
1285
|
-
return this.settingsService.isLocalGatewayDisabled();
|
|
1286
|
-
}
|
|
1287
|
-
getGatewayStatus(userId) {
|
|
1288
|
-
return this.gatewayRegistry.getGatewayStatus(userId);
|
|
1289
|
-
}
|
|
1290
|
-
startDisconnectTimer(userId, onDisconnect) {
|
|
1291
|
-
this.gatewayRegistry.startDisconnectTimer(userId, onDisconnect);
|
|
1292
|
-
}
|
|
1293
|
-
clearDisconnectTimer(userId) {
|
|
1294
|
-
this.gatewayRegistry.clearDisconnectTimer(userId);
|
|
1295
|
-
}
|
|
1296
1270
|
async clearThreadState(threadId) {
|
|
1297
1271
|
this.liveness.clearThreadState(threadId);
|
|
1298
1272
|
const { active, suspended } = this.runState.clearThread(threadId);
|
|
@@ -1373,7 +1347,7 @@ let InstanceAiService = class InstanceAiService {
|
|
|
1373
1347
|
metadata: { completion_source: 'service_cleanup' },
|
|
1374
1348
|
});
|
|
1375
1349
|
}
|
|
1376
|
-
this.
|
|
1350
|
+
this.gatewayService.disconnectAll();
|
|
1377
1351
|
this.stopSandboxExpiryTimers();
|
|
1378
1352
|
this.domainAccessTrackersByThread.clear();
|
|
1379
1353
|
this.traceContextsByRunId.clear();
|
|
@@ -1382,7 +1356,7 @@ let InstanceAiService = class InstanceAiService {
|
|
|
1382
1356
|
this.logger.debug('Instance AI service shut down');
|
|
1383
1357
|
}
|
|
1384
1358
|
startCheckpointPruning() {
|
|
1385
|
-
if (this.checkpointPruneTimer || this.instanceAiConfig.
|
|
1359
|
+
if (this.checkpointPruneTimer || this.instanceAiConfig.pruneInterval <= 0)
|
|
1386
1360
|
return;
|
|
1387
1361
|
this.checkpointPruningStopped = false;
|
|
1388
1362
|
this.scheduleCheckpointPrune(0);
|
|
@@ -1392,11 +1366,11 @@ let InstanceAiService = class InstanceAiService {
|
|
|
1392
1366
|
clearTimeout(this.checkpointPruneTimer);
|
|
1393
1367
|
this.checkpointPruneTimer = undefined;
|
|
1394
1368
|
}
|
|
1395
|
-
scheduleCheckpointPrune(delayMs = this.instanceAiConfig.
|
|
1369
|
+
scheduleCheckpointPrune(delayMs = this.instanceAiConfig.pruneInterval) {
|
|
1396
1370
|
if (this.checkpointPruningStopped)
|
|
1397
1371
|
return;
|
|
1398
1372
|
this.checkpointPruneTimer = setTimeout(() => {
|
|
1399
|
-
void this.
|
|
1373
|
+
void this.runScheduledPrune();
|
|
1400
1374
|
}, delayMs);
|
|
1401
1375
|
this.checkpointPruneTimer.unref();
|
|
1402
1376
|
}
|
|
@@ -1438,7 +1412,7 @@ let InstanceAiService = class InstanceAiService {
|
|
|
1438
1412
|
});
|
|
1439
1413
|
}
|
|
1440
1414
|
}
|
|
1441
|
-
async
|
|
1415
|
+
async runScheduledPrune(now = Date.now()) {
|
|
1442
1416
|
const olderThan = new Date(now - this.instanceAiConfig.snapshotRetention);
|
|
1443
1417
|
try {
|
|
1444
1418
|
const count = await this.checkpointStore.markExpiredOlderThan(olderThan);
|
|
@@ -1449,6 +1423,7 @@ let InstanceAiService = class InstanceAiService {
|
|
|
1449
1423
|
this.logger.debug('No stale Instance AI checkpoints to expire');
|
|
1450
1424
|
}
|
|
1451
1425
|
await this.pruneStalePendingConfirmations(now);
|
|
1426
|
+
await this.pruneExpiredThreads();
|
|
1452
1427
|
this.scheduleCheckpointPrune();
|
|
1453
1428
|
}
|
|
1454
1429
|
catch (error) {
|
|
@@ -1458,6 +1433,16 @@ let InstanceAiService = class InstanceAiService {
|
|
|
1458
1433
|
this.scheduleCheckpointPrune(INSTANCE_AI_CHECKPOINT_PRUNE_RETRY_MS);
|
|
1459
1434
|
}
|
|
1460
1435
|
}
|
|
1436
|
+
async pruneExpiredThreads() {
|
|
1437
|
+
try {
|
|
1438
|
+
await this.memoryService.cleanupExpiredThreads(async (threadId) => await this.clearThreadState(threadId));
|
|
1439
|
+
}
|
|
1440
|
+
catch (error) {
|
|
1441
|
+
this.logger.warn('Failed to clean up expired Instance AI conversation threads', {
|
|
1442
|
+
error: getErrorMessage(error),
|
|
1443
|
+
});
|
|
1444
|
+
}
|
|
1445
|
+
}
|
|
1461
1446
|
async pruneStalePendingConfirmations(now) {
|
|
1462
1447
|
try {
|
|
1463
1448
|
const count = await this.pendingConfirmationRepo.deleteExpired(new Date(now));
|
|
@@ -1568,31 +1553,56 @@ let InstanceAiService = class InstanceAiService {
|
|
|
1568
1553
|
},
|
|
1569
1554
|
};
|
|
1570
1555
|
}
|
|
1571
|
-
|
|
1572
|
-
const
|
|
1573
|
-
if (existingThread)
|
|
1574
|
-
return;
|
|
1575
|
-
await memory.saveThread({
|
|
1576
|
-
id: threadId,
|
|
1577
|
-
resourceId,
|
|
1578
|
-
title: '',
|
|
1579
|
-
});
|
|
1580
|
-
}
|
|
1581
|
-
projectPlannedTaskList(graph) {
|
|
1556
|
+
createWorkflowTaskServiceWithUiSync(threadId, runId, workflowTasks) {
|
|
1557
|
+
const sync = async () => await this.taskProjector.syncFromWorkflowLoop(threadId, runId);
|
|
1582
1558
|
return {
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1559
|
+
reportBuildOutcome: async (outcome) => {
|
|
1560
|
+
const action = await workflowTasks.reportBuildOutcome(outcome);
|
|
1561
|
+
await sync();
|
|
1562
|
+
return action;
|
|
1563
|
+
},
|
|
1564
|
+
reportVerificationVerdict: async (verdict) => {
|
|
1565
|
+
const action = await workflowTasks.reportVerificationVerdict(verdict);
|
|
1566
|
+
await sync();
|
|
1567
|
+
return action;
|
|
1568
|
+
},
|
|
1569
|
+
updateBuildOutcome: async (workItemId, update) => {
|
|
1570
|
+
await workflowTasks.updateBuildOutcome(workItemId, update);
|
|
1571
|
+
await sync();
|
|
1572
|
+
},
|
|
1573
|
+
getBuildOutcome: async (workItemId) => await workflowTasks.getBuildOutcome(workItemId),
|
|
1574
|
+
getWorkflowLoopState: async (workItemId) => await workflowTasks.getWorkflowLoopState(workItemId),
|
|
1594
1575
|
};
|
|
1595
1576
|
}
|
|
1577
|
+
trackWorkflowVerificationObligation(obligation, event, extra = {}) {
|
|
1578
|
+
try {
|
|
1579
|
+
this.telemetry?.track('instance_ai_workflow_verification_obligation', {
|
|
1580
|
+
event,
|
|
1581
|
+
thread_id: obligation.threadId,
|
|
1582
|
+
run_id: obligation.runId,
|
|
1583
|
+
task_id: obligation.taskId,
|
|
1584
|
+
planned_task_id: obligation.plannedTaskId,
|
|
1585
|
+
work_item_id: obligation.workItemId,
|
|
1586
|
+
workflow_id: obligation.workflowId,
|
|
1587
|
+
source: obligation.source,
|
|
1588
|
+
policy: obligation.policy,
|
|
1589
|
+
status: obligation.status,
|
|
1590
|
+
readiness_status: obligation.readiness?.status,
|
|
1591
|
+
setup_status: obligation.setupRequirement?.status,
|
|
1592
|
+
has_evidence: obligation.evidence?.attempted === true,
|
|
1593
|
+
evidence_success: obligation.evidence?.success,
|
|
1594
|
+
blocking_reason: obligation.blockingReason,
|
|
1595
|
+
...extra,
|
|
1596
|
+
});
|
|
1597
|
+
}
|
|
1598
|
+
catch (error) {
|
|
1599
|
+
this.logger.warn('Failed to track workflow verification obligation telemetry', {
|
|
1600
|
+
threadId: obligation.threadId,
|
|
1601
|
+
workItemId: obligation.workItemId,
|
|
1602
|
+
error: getErrorMessage(error),
|
|
1603
|
+
});
|
|
1604
|
+
}
|
|
1605
|
+
}
|
|
1596
1606
|
buildPlannedTaskFollowUpMessage(type, graph, options = {}) {
|
|
1597
1607
|
const payload = {
|
|
1598
1608
|
tasks: graph.tasks.map((task) => ({
|
|
@@ -1632,8 +1642,27 @@ let InstanceAiService = class InstanceAiService {
|
|
|
1632
1642
|
dependsOn: depOutcomes,
|
|
1633
1643
|
};
|
|
1634
1644
|
}
|
|
1645
|
+
if (options.buildTask) {
|
|
1646
|
+
payload.buildTask = {
|
|
1647
|
+
id: options.buildTask.id,
|
|
1648
|
+
title: options.buildTask.title,
|
|
1649
|
+
kind: options.buildTask.kind,
|
|
1650
|
+
spec: options.buildTask.spec,
|
|
1651
|
+
workflowId: options.buildTask.workflowId,
|
|
1652
|
+
isSupportingWorkflow: options.buildTask.isSupportingWorkflow,
|
|
1653
|
+
deps: options.buildTask.deps,
|
|
1654
|
+
};
|
|
1655
|
+
}
|
|
1635
1656
|
return `<planned-task-follow-up type="${type}">\n${JSON.stringify(payload, null, 2)}\n</planned-task-follow-up>\n\n${internal_messages_1.AUTO_FOLLOW_UP_MESSAGE}`;
|
|
1636
1657
|
}
|
|
1658
|
+
buildWorkflowVerificationFollowUpMessage(input) {
|
|
1659
|
+
const payload = {
|
|
1660
|
+
obligation: input.obligation,
|
|
1661
|
+
outcome: input.outcome,
|
|
1662
|
+
sourceTask: input.sourceTask,
|
|
1663
|
+
};
|
|
1664
|
+
return `<workflow-verification-follow-up>\n${JSON.stringify(payload, null, 2)}\n</workflow-verification-follow-up>\n\n${internal_messages_1.AUTO_FOLLOW_UP_MESSAGE}`;
|
|
1665
|
+
}
|
|
1637
1666
|
async createPlannedTaskState() {
|
|
1638
1667
|
const memory = this.agentMemory;
|
|
1639
1668
|
const taskStorage = new instance_ai_1.ThreadTaskStorage(memory);
|
|
@@ -1651,6 +1680,7 @@ let InstanceAiService = class InstanceAiService {
|
|
|
1651
1680
|
const decision = guard.evaluateTerminal(this.getTerminalGuardEvents(threadId, runId, options.messageGroupId), status, {
|
|
1652
1681
|
workSummary: options.workSummary,
|
|
1653
1682
|
errorMessage: options.errorMessage,
|
|
1683
|
+
suppressCompletedFallback: options.suppressCompletedFallback,
|
|
1654
1684
|
});
|
|
1655
1685
|
this.handleTerminalResponseDecision(threadId, runId, decision, options.messageGroupId);
|
|
1656
1686
|
return decision;
|
|
@@ -1930,7 +1960,7 @@ let InstanceAiService = class InstanceAiService {
|
|
|
1930
1960
|
}
|
|
1931
1961
|
async syncPlannedTasksToUi(threadId, graph) {
|
|
1932
1962
|
const { taskStorage } = await this.createPlannedTaskState();
|
|
1933
|
-
const tasks = this.projectPlannedTaskList(graph);
|
|
1963
|
+
const tasks = await this.taskProjector.projectPlannedTaskList(threadId, graph);
|
|
1934
1964
|
await taskStorage.save(threadId, tasks);
|
|
1935
1965
|
this.eventBus.publish(threadId, {
|
|
1936
1966
|
type: 'tasks-update',
|
|
@@ -1962,10 +1992,15 @@ let InstanceAiService = class InstanceAiService {
|
|
|
1962
1992
|
}
|
|
1963
1993
|
}
|
|
1964
1994
|
async createExecutionEnvironment(user, threadId, runId, abortSignal, messageGroupId, pushRef) {
|
|
1995
|
+
const memory = this.agentMemory;
|
|
1996
|
+
const boundProjectId = await memory.getThreadProjectId(threadId);
|
|
1997
|
+
if (!boundProjectId) {
|
|
1998
|
+
throw new n8n_workflow_1.UnexpectedError(`Instance AI thread "${threadId}" has no bound project; it must be created via POST /instance-ai/threads before a run can start`);
|
|
1999
|
+
}
|
|
1965
2000
|
const adminSettings = this.settingsService.getAdminSettings();
|
|
1966
2001
|
const localGatewayDisabledGlobally = adminSettings.localGatewayDisabled;
|
|
1967
2002
|
const localGatewayDisabledForUser = await this.settingsService.isLocalGatewayDisabledForUser(user.id);
|
|
1968
|
-
const userGateway = this.
|
|
2003
|
+
const userGateway = this.gatewayService.findGateway(user.id);
|
|
1969
2004
|
let searchProxyConfig;
|
|
1970
2005
|
let tracingProxyConfig;
|
|
1971
2006
|
let tokenManager;
|
|
@@ -2000,6 +2035,7 @@ let InstanceAiService = class InstanceAiService {
|
|
|
2000
2035
|
searchProxyConfig,
|
|
2001
2036
|
pushRef,
|
|
2002
2037
|
threadId,
|
|
2038
|
+
projectId: boundProjectId,
|
|
2003
2039
|
});
|
|
2004
2040
|
if (!localGatewayDisabledForUser && userGateway?.isConnected) {
|
|
2005
2041
|
context.localMcpServer = userGateway;
|
|
@@ -2036,13 +2072,11 @@ let InstanceAiService = class InstanceAiService {
|
|
|
2036
2072
|
const modelId = proxyBaseUrl && tokenManager
|
|
2037
2073
|
? await this.resolveProxyModel(user, proxyBaseUrl, tokenManager)
|
|
2038
2074
|
: await this.resolveAgentModelConfig(user);
|
|
2039
|
-
const memory = this.agentMemory;
|
|
2040
|
-
await this.ensureThreadExists(memory, threadId, user.id);
|
|
2041
2075
|
const taskStorage = new instance_ai_1.ThreadTaskStorage(memory);
|
|
2042
2076
|
const iterationLog = this.dbIterationLogStorage;
|
|
2043
2077
|
const snapshotStorage = this.dbSnapshotStorage;
|
|
2044
2078
|
const workflowLoopStorage = new instance_ai_1.WorkflowLoopStorage(memory);
|
|
2045
|
-
const workflowTasks = new instance_ai_1.WorkflowTaskCoordinator(threadId, workflowLoopStorage);
|
|
2079
|
+
const workflowTasks = this.createWorkflowTaskServiceWithUiSync(threadId, runId, new instance_ai_1.WorkflowTaskCoordinator(threadId, workflowLoopStorage));
|
|
2046
2080
|
const plannedTaskStorage = new instance_ai_1.PlannedTaskStorage(memory);
|
|
2047
2081
|
const plannedTaskService = new instance_ai_1.PlannedTaskCoordinator(plannedTaskStorage);
|
|
2048
2082
|
const nodeDefDirs = this.adapterService.getNodeDefinitionDirs();
|
|
@@ -2053,37 +2087,50 @@ let InstanceAiService = class InstanceAiService {
|
|
|
2053
2087
|
const baseRuntimeSkills = (0, instance_ai_1.loadInstanceAiRuntimeSkillSource)();
|
|
2054
2088
|
let runtimeSkills = baseRuntimeSkills;
|
|
2055
2089
|
let runtimeWorkspace;
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2090
|
+
let workspaceRoot;
|
|
2091
|
+
const sandboxStatus = this.settingsService.getSandboxStatus();
|
|
2092
|
+
if (sandboxStatus.workflowBuilderAvailable) {
|
|
2093
|
+
const sandboxConfig = await this.resolveSandboxConfig(user);
|
|
2094
|
+
if (sandboxConfig.enabled) {
|
|
2095
|
+
workspaceRoot = (0, instance_ai_1.getPromptWorkspaceRoot)(sandboxConfig.provider);
|
|
2096
|
+
let sandboxEntryPromise;
|
|
2097
|
+
const getSandboxEntry = async () => {
|
|
2098
|
+
sandboxEntryPromise ??= this.getOrCreateWorkspaceEntry(threadId, user).catch((error) => {
|
|
2099
|
+
sandboxEntryPromise = undefined;
|
|
2100
|
+
throw error;
|
|
2101
|
+
});
|
|
2102
|
+
return await sandboxEntryPromise;
|
|
2103
|
+
};
|
|
2104
|
+
const getSetupSandboxEntry = async () => {
|
|
2105
|
+
return await this.getOrCreateWorkspace(threadId, user, context);
|
|
2106
|
+
};
|
|
2107
|
+
const scopeWorkspaceForAgent = async (workspace) => {
|
|
2108
|
+
if (!workspace)
|
|
2109
|
+
return undefined;
|
|
2110
|
+
const root = await (0, instance_ai_1.getWorkspaceRoot)(workspace);
|
|
2111
|
+
return (0, instance_ai_1.createScopedWorkspace)(workspace, root);
|
|
2112
|
+
};
|
|
2113
|
+
runtimeWorkspace = (0, instance_ai_1.createLazyRuntimeWorkspace)({
|
|
2114
|
+
ensureWorkspace: async () => await scopeWorkspaceForAgent((await getSetupSandboxEntry())?.workspace),
|
|
2062
2115
|
});
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
ensureWorkspace: async () => (await getSandboxEntry())?.workspace,
|
|
2075
|
-
});
|
|
2076
|
-
runtimeSkills = (0, instance_ai_1.createLazyWorkspaceRuntimeSkillSource)({
|
|
2077
|
-
source: baseRuntimeSkills,
|
|
2078
|
-
workspace: runtimeSkillWorkspace,
|
|
2079
|
-
logger: this.logger,
|
|
2080
|
-
});
|
|
2116
|
+
const runtimeSkillWorkspace = (0, instance_ai_1.createLazyRuntimeWorkspace)({
|
|
2117
|
+
id: 'instance-ai-runtime-skill-workspace',
|
|
2118
|
+
name: 'Instance AI runtime skill workspace',
|
|
2119
|
+
ensureWorkspace: async () => await scopeWorkspaceForAgent((await getSandboxEntry())?.workspace),
|
|
2120
|
+
});
|
|
2121
|
+
runtimeSkills = (0, instance_ai_1.createLazyWorkspaceRuntimeSkillSource)({
|
|
2122
|
+
source: baseRuntimeSkills,
|
|
2123
|
+
workspace: runtimeSkillWorkspace,
|
|
2124
|
+
logger: this.logger,
|
|
2125
|
+
});
|
|
2126
|
+
}
|
|
2081
2127
|
}
|
|
2082
2128
|
const orchestrationContext = {
|
|
2083
2129
|
threadId,
|
|
2084
2130
|
runId,
|
|
2085
2131
|
messageGroupId,
|
|
2086
2132
|
userId: user.id,
|
|
2133
|
+
projectId: boundProjectId,
|
|
2087
2134
|
orchestratorAgentId: ORCHESTRATOR_AGENT_ID,
|
|
2088
2135
|
modelId,
|
|
2089
2136
|
checkpointStore: this.checkpointStore,
|
|
@@ -2134,12 +2181,12 @@ let InstanceAiService = class InstanceAiService {
|
|
|
2134
2181
|
schedulePlannedTasks: async () => await this.schedulePlannedTasks(user, threadId),
|
|
2135
2182
|
iterationLog,
|
|
2136
2183
|
sendCorrectionToTask: (taskId, correction) => this.sendCorrectionToTask(threadId, taskId, correction),
|
|
2137
|
-
findSubAgentResumeInfo: async (agentKind) => await this.checkpointStore.findSuspendedSubAgentResumeInfo((0, instance_ai_1.createSubAgentResourceId)(threadId, agentKind)),
|
|
2138
2184
|
persistInFlightUserMessage: async () => {
|
|
2139
2185
|
await this.persistUserMessageOnFirstSuspend(threadId, runId);
|
|
2140
2186
|
},
|
|
2141
2187
|
workflowTaskService: workflowTasks,
|
|
2142
2188
|
workspace: runtimeWorkspace,
|
|
2189
|
+
workspaceRoot,
|
|
2143
2190
|
nodeDefinitionDirs: nodeDefDirs.length > 0 ? nodeDefDirs : undefined,
|
|
2144
2191
|
domainContext: context,
|
|
2145
2192
|
tracingProxyConfig,
|
|
@@ -2161,24 +2208,14 @@ let InstanceAiService = class InstanceAiService {
|
|
|
2161
2208
|
const taskContext = this.createPlannedTaskContext(task.kind, context);
|
|
2162
2209
|
const conversationContext = buildPlannedTaskConversationContext(task, graph);
|
|
2163
2210
|
let started = null;
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
break;
|
|
2173
|
-
case 'delegate':
|
|
2174
|
-
started = await (0, instance_ai_1.startDetachedDelegateTask)(taskContext, {
|
|
2175
|
-
title: task.title,
|
|
2176
|
-
spec: task.spec,
|
|
2177
|
-
tools: task.tools ?? [],
|
|
2178
|
-
plannedTaskId: task.id,
|
|
2179
|
-
conversationContext,
|
|
2180
|
-
});
|
|
2181
|
-
break;
|
|
2211
|
+
if (task.kind === 'delegate') {
|
|
2212
|
+
started = await (0, instance_ai_1.startDetachedDelegateTask)(taskContext, {
|
|
2213
|
+
title: task.title,
|
|
2214
|
+
spec: task.spec,
|
|
2215
|
+
tools: task.tools ?? [],
|
|
2216
|
+
plannedTaskId: task.id,
|
|
2217
|
+
conversationContext,
|
|
2218
|
+
});
|
|
2182
2219
|
}
|
|
2183
2220
|
if (!started?.taskId) {
|
|
2184
2221
|
await context.plannedTaskService?.markFailed(context.threadId, task.id, {
|
|
@@ -2207,24 +2244,79 @@ let InstanceAiService = class InstanceAiService {
|
|
|
2207
2244
|
domainTools: (0, instance_ai_1.createAllTools)(taskDomainContext),
|
|
2208
2245
|
};
|
|
2209
2246
|
}
|
|
2210
|
-
|
|
2247
|
+
collectWorkflowIds(value, workflowIds) {
|
|
2248
|
+
if (value === null || value === undefined || typeof value !== 'object')
|
|
2249
|
+
return;
|
|
2250
|
+
if (Array.isArray(value)) {
|
|
2251
|
+
for (const item of value) {
|
|
2252
|
+
this.collectWorkflowIds(item, workflowIds);
|
|
2253
|
+
}
|
|
2254
|
+
return;
|
|
2255
|
+
}
|
|
2256
|
+
for (const [key, child] of Object.entries(value)) {
|
|
2257
|
+
if (key === 'workflowId' && typeof child === 'string' && child.length > 0) {
|
|
2258
|
+
workflowIds.add(child);
|
|
2259
|
+
continue;
|
|
2260
|
+
}
|
|
2261
|
+
if (key === 'supportingWorkflowIds' && Array.isArray(child)) {
|
|
2262
|
+
for (const workflowId of child) {
|
|
2263
|
+
if (typeof workflowId === 'string' && workflowId.length > 0) {
|
|
2264
|
+
workflowIds.add(workflowId);
|
|
2265
|
+
}
|
|
2266
|
+
}
|
|
2267
|
+
continue;
|
|
2268
|
+
}
|
|
2269
|
+
this.collectWorkflowIds(child, workflowIds);
|
|
2270
|
+
}
|
|
2271
|
+
}
|
|
2272
|
+
getBuildTaskWorkflowName(task) {
|
|
2273
|
+
if (task.kind !== 'build-workflow')
|
|
2274
|
+
return undefined;
|
|
2275
|
+
const titleMatch = task.title.match(/^Build '(.+)' workflow$/) ?? task.title.match(/^Build "(.+)" workflow$/);
|
|
2276
|
+
return titleMatch?.[1];
|
|
2277
|
+
}
|
|
2278
|
+
checkpointRequiresRunApproval(graph, _checkpoint) {
|
|
2279
|
+
return graph.postBuildRunApprovalRequired === true;
|
|
2280
|
+
}
|
|
2281
|
+
async getCheckpointRunPolicy(threadId, checkpointTaskId) {
|
|
2211
2282
|
try {
|
|
2212
2283
|
const { plannedTaskService } = await this.createPlannedTaskState();
|
|
2213
2284
|
const graph = await plannedTaskService.getGraph(threadId);
|
|
2214
2285
|
const checkpoint = graph?.tasks.find((t) => t.id === checkpointTaskId);
|
|
2215
|
-
if (!graph || !checkpoint)
|
|
2216
|
-
return
|
|
2286
|
+
if (!graph || !checkpoint) {
|
|
2287
|
+
return {
|
|
2288
|
+
allowedWorkflowIds: new Set(),
|
|
2289
|
+
allowedWorkflowNames: new Set(),
|
|
2290
|
+
requireApproval: false,
|
|
2291
|
+
};
|
|
2292
|
+
}
|
|
2217
2293
|
const deps = new Set(checkpoint.deps);
|
|
2218
|
-
const
|
|
2294
|
+
const ids = new Set();
|
|
2295
|
+
const names = new Set();
|
|
2219
2296
|
for (const task of graph.tasks) {
|
|
2220
2297
|
if (!deps.has(task.id))
|
|
2221
2298
|
continue;
|
|
2222
|
-
const
|
|
2223
|
-
if (
|
|
2224
|
-
|
|
2299
|
+
const workflowName = this.getBuildTaskWorkflowName(task);
|
|
2300
|
+
if (workflowName) {
|
|
2301
|
+
names.add(workflowName);
|
|
2302
|
+
}
|
|
2303
|
+
if (task.workflowId) {
|
|
2304
|
+
ids.add(task.workflowId);
|
|
2305
|
+
}
|
|
2306
|
+
this.collectWorkflowIds(task.outcome, ids);
|
|
2307
|
+
}
|
|
2308
|
+
const tracing = this.getTraceContextForContinuation(threadId);
|
|
2309
|
+
for (const workflowId of [...ids]) {
|
|
2310
|
+
const remappedWorkflowId = tracing?.idRemapper?.remapOutput(workflowId);
|
|
2311
|
+
if (typeof remappedWorkflowId === 'string' && remappedWorkflowId.length > 0) {
|
|
2312
|
+
ids.add(remappedWorkflowId);
|
|
2225
2313
|
}
|
|
2226
2314
|
}
|
|
2227
|
-
return
|
|
2315
|
+
return {
|
|
2316
|
+
allowedWorkflowIds: ids,
|
|
2317
|
+
allowedWorkflowNames: names,
|
|
2318
|
+
requireApproval: this.checkpointRequiresRunApproval(graph, checkpoint),
|
|
2319
|
+
};
|
|
2228
2320
|
}
|
|
2229
2321
|
catch (error) {
|
|
2230
2322
|
this.logger.warn('Failed to resolve checkpoint allowed workflow IDs', {
|
|
@@ -2232,7 +2324,11 @@ let InstanceAiService = class InstanceAiService {
|
|
|
2232
2324
|
checkpointTaskId,
|
|
2233
2325
|
error: error instanceof Error ? error.message : String(error),
|
|
2234
2326
|
});
|
|
2235
|
-
return
|
|
2327
|
+
return {
|
|
2328
|
+
allowedWorkflowIds: new Set(),
|
|
2329
|
+
allowedWorkflowNames: new Set(),
|
|
2330
|
+
requireApproval: false,
|
|
2331
|
+
};
|
|
2236
2332
|
}
|
|
2237
2333
|
}
|
|
2238
2334
|
async handlePlannedTaskSettlement(user, task, status) {
|
|
@@ -2261,7 +2357,108 @@ let InstanceAiService = class InstanceAiService {
|
|
|
2261
2357
|
}
|
|
2262
2358
|
await this.schedulePlannedTasks(user, task.threadId);
|
|
2263
2359
|
}
|
|
2264
|
-
async
|
|
2360
|
+
async maybeStartWorkflowVerificationFollowUp(user, task) {
|
|
2361
|
+
if (task.role !== 'workflow-builder' || !task.workItemId)
|
|
2362
|
+
return false;
|
|
2363
|
+
const obligation = await this.workflowObligations.getObligation(task.threadId, task.workItemId, {
|
|
2364
|
+
source: task.plannedTaskId ? 'planned' : 'direct',
|
|
2365
|
+
plannedTaskId: task.plannedTaskId,
|
|
2366
|
+
});
|
|
2367
|
+
if (!obligation)
|
|
2368
|
+
return false;
|
|
2369
|
+
this.trackWorkflowVerificationObligation(obligation, 'background_task_settled');
|
|
2370
|
+
if (obligation.status !== 'ready_to_verify' && obligation.status !== 'verifying') {
|
|
2371
|
+
return false;
|
|
2372
|
+
}
|
|
2373
|
+
const outcome = (0, workflow_verification_obligation_service_1.parseWorkflowBuildOutcome)(task.outcome);
|
|
2374
|
+
const startedRunId = await this.startInternalFollowUpRun(user, task.threadId, this.buildWorkflowVerificationFollowUpMessage({
|
|
2375
|
+
obligation,
|
|
2376
|
+
outcome,
|
|
2377
|
+
sourceTask: {
|
|
2378
|
+
taskId: task.taskId,
|
|
2379
|
+
role: task.role,
|
|
2380
|
+
status: task.status,
|
|
2381
|
+
result: task.result,
|
|
2382
|
+
error: task.error,
|
|
2383
|
+
plannedTaskId: task.plannedTaskId,
|
|
2384
|
+
workItemId: task.workItemId,
|
|
2385
|
+
},
|
|
2386
|
+
}), task.messageGroupId, false, undefined, 'workflow_verification');
|
|
2387
|
+
this.trackWorkflowVerificationObligation(obligation, 'follow_up_start_attempted', {
|
|
2388
|
+
follow_up_started: startedRunId.length > 0,
|
|
2389
|
+
});
|
|
2390
|
+
return startedRunId.length > 0;
|
|
2391
|
+
}
|
|
2392
|
+
buildWorkflowSetupFollowUpMessage(obligation) {
|
|
2393
|
+
const payload = {
|
|
2394
|
+
workflowId: obligation.workflowId,
|
|
2395
|
+
workItemId: obligation.workItemId,
|
|
2396
|
+
setupRequirement: obligation.setupRequirement,
|
|
2397
|
+
verificationReadiness: obligation.readiness,
|
|
2398
|
+
};
|
|
2399
|
+
return `<workflow-setup-required>\n${JSON.stringify(payload, null, 2)}\n</workflow-setup-required>\n\n${internal_messages_1.AUTO_FOLLOW_UP_MESSAGE}`;
|
|
2400
|
+
}
|
|
2401
|
+
async maybeStartWorkflowSetupFollowUp(user, threadId) {
|
|
2402
|
+
const records = await this.listWorkflowLoopRecords(threadId);
|
|
2403
|
+
if (records.length === 0)
|
|
2404
|
+
return false;
|
|
2405
|
+
for (const record of records) {
|
|
2406
|
+
if (record.state.setupRoutedAt)
|
|
2407
|
+
continue;
|
|
2408
|
+
if (this.workflowObligations.isPlannedRecord(record))
|
|
2409
|
+
continue;
|
|
2410
|
+
const obligation = this.workflowObligations.obligationFromRecord(threadId, record, {
|
|
2411
|
+
source: 'direct',
|
|
2412
|
+
});
|
|
2413
|
+
const verificationConcluded = obligation.status === 'verified' || obligation.status === 'needs_setup';
|
|
2414
|
+
if (!verificationConcluded)
|
|
2415
|
+
continue;
|
|
2416
|
+
if (obligation.setupRequirement?.status !== 'required' || !obligation.workflowId)
|
|
2417
|
+
continue;
|
|
2418
|
+
const claim = await this.claimWorkItemSetupRouting(threadId, record);
|
|
2419
|
+
if (!claim)
|
|
2420
|
+
continue;
|
|
2421
|
+
const startedRunId = await this.startInternalFollowUpRun(user, threadId, this.buildWorkflowSetupFollowUpMessage(obligation), this.runState.getMessageGroupId(threadId), false, undefined, 'workflow_setup');
|
|
2422
|
+
if (startedRunId.length === 0) {
|
|
2423
|
+
await this.releaseWorkItemSetupRoutingClaim(threadId, record.state.workItemId, claim.claimId);
|
|
2424
|
+
return false;
|
|
2425
|
+
}
|
|
2426
|
+
const marked = await this.markWorkItemSetupRouted(threadId, record.state.workItemId, claim.claimId);
|
|
2427
|
+
if (!marked) {
|
|
2428
|
+
this.logger.warn('Workflow setup follow-up started but routing marker was not saved', {
|
|
2429
|
+
threadId,
|
|
2430
|
+
workItemId: record.state.workItemId,
|
|
2431
|
+
});
|
|
2432
|
+
}
|
|
2433
|
+
this.trackWorkflowVerificationObligation(obligation, 'setup_follow_up_started');
|
|
2434
|
+
return true;
|
|
2435
|
+
}
|
|
2436
|
+
return false;
|
|
2437
|
+
}
|
|
2438
|
+
async listWorkflowLoopRecords(threadId) {
|
|
2439
|
+
return await new instance_ai_1.WorkflowLoopStorage(this.agentMemory).listWorkItems(threadId);
|
|
2440
|
+
}
|
|
2441
|
+
createWorkflowSetupRoutingClaim() {
|
|
2442
|
+
const claimedAt = new Date();
|
|
2443
|
+
const expiresAt = new Date(claimedAt.getTime() + WORKFLOW_SETUP_ROUTING_CLAIM_TTL_MS);
|
|
2444
|
+
return {
|
|
2445
|
+
claimId: `setup:${(0, nanoid_1.nanoid)()}`,
|
|
2446
|
+
claimedAt: claimedAt.toISOString(),
|
|
2447
|
+
expiresAt: expiresAt.toISOString(),
|
|
2448
|
+
};
|
|
2449
|
+
}
|
|
2450
|
+
async claimWorkItemSetupRouting(threadId, record) {
|
|
2451
|
+
const claim = this.createWorkflowSetupRoutingClaim();
|
|
2452
|
+
const claimed = await new instance_ai_1.WorkflowLoopStorage(this.agentMemory).claimSetupRouting(threadId, record.state.workItemId, claim);
|
|
2453
|
+
return claimed ? claim : null;
|
|
2454
|
+
}
|
|
2455
|
+
async markWorkItemSetupRouted(threadId, workItemId, claimId) {
|
|
2456
|
+
return await new instance_ai_1.WorkflowLoopStorage(this.agentMemory).markSetupRouted(threadId, workItemId, claimId, new Date().toISOString());
|
|
2457
|
+
}
|
|
2458
|
+
async releaseWorkItemSetupRoutingClaim(threadId, workItemId, claimId) {
|
|
2459
|
+
await new instance_ai_1.WorkflowLoopStorage(this.agentMemory).releaseSetupRoutingClaim(threadId, workItemId, claimId);
|
|
2460
|
+
}
|
|
2461
|
+
async startInternalFollowUpRun(user, threadId, message, messageGroupId, isReplanFollowUp = false, checkpoint, resumeReasonOverride, plannedBuild) {
|
|
2265
2462
|
if (this.runState.hasLiveRun(threadId)) {
|
|
2266
2463
|
this.logger.warn('Skipping internal follow-up: active run exists', { threadId });
|
|
2267
2464
|
return '';
|
|
@@ -2272,12 +2469,13 @@ let InstanceAiService = class InstanceAiService {
|
|
|
2272
2469
|
messageGroupId,
|
|
2273
2470
|
});
|
|
2274
2471
|
const timeZone = this.runState.getTimeZone(threadId) ?? this.defaultTimeZone;
|
|
2275
|
-
const resumeReason =
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2472
|
+
const resumeReason = resumeReasonOverride ??
|
|
2473
|
+
(checkpoint
|
|
2474
|
+
? 'planned_checkpoint'
|
|
2475
|
+
: isReplanFollowUp
|
|
2476
|
+
? 'replan'
|
|
2477
|
+
: 'background_task_completed');
|
|
2478
|
+
this.startExecuteRun(user, threadId, runId, message, abortController, undefined, messageGroupId, timeZone, isReplanFollowUp, checkpoint, resumeReason, plannedBuild);
|
|
2281
2479
|
return runId;
|
|
2282
2480
|
}
|
|
2283
2481
|
async schedulePlannedTasks(user, threadId) {
|
|
@@ -2286,6 +2484,90 @@ let InstanceAiService = class InstanceAiService {
|
|
|
2286
2484
|
this.schedulerLocks.set(threadId, current);
|
|
2287
2485
|
await current;
|
|
2288
2486
|
}
|
|
2487
|
+
createPlannedTaskActionRunner(activeUser, threadId, plannedTaskService) {
|
|
2488
|
+
const scope = { user: activeUser, threadId };
|
|
2489
|
+
return new planned_task_action_runner_1.PlannedTaskActionRunner({
|
|
2490
|
+
scope,
|
|
2491
|
+
plannedTaskService,
|
|
2492
|
+
logger: this.logger,
|
|
2493
|
+
view: this.createPlannedTaskView(),
|
|
2494
|
+
runGate: this.createPlannedTaskRunGate(),
|
|
2495
|
+
dispatcher: this.createPlannedTaskDispatcher(),
|
|
2496
|
+
followUps: this.createPlannedTaskFollowUps(),
|
|
2497
|
+
workflowVerificationGate: this.createPlannedWorkflowVerificationGate(threadId),
|
|
2498
|
+
workflowVerificationTracker: this.createPlannedWorkflowVerificationTracker(),
|
|
2499
|
+
});
|
|
2500
|
+
}
|
|
2501
|
+
createPlannedTaskView() {
|
|
2502
|
+
return {
|
|
2503
|
+
sync: async (scope, graph) => await this.syncPlannedTasksToUi(scope.threadId, graph),
|
|
2504
|
+
};
|
|
2505
|
+
}
|
|
2506
|
+
createPlannedTaskRunGate() {
|
|
2507
|
+
return {
|
|
2508
|
+
hasLiveRun: (threadId) => this.runState.hasLiveRun(threadId),
|
|
2509
|
+
};
|
|
2510
|
+
}
|
|
2511
|
+
createPlannedTaskDispatcher() {
|
|
2512
|
+
return {
|
|
2513
|
+
dispatch: async ({ scope, graph, tasks }) => {
|
|
2514
|
+
const context = await this.createPlannedTaskDispatchContext(scope.user, scope.threadId, graph);
|
|
2515
|
+
for (const task of tasks) {
|
|
2516
|
+
await this.dispatchPlannedTask(task, context, graph);
|
|
2517
|
+
}
|
|
2518
|
+
},
|
|
2519
|
+
};
|
|
2520
|
+
}
|
|
2521
|
+
createPlannedTaskFollowUps() {
|
|
2522
|
+
return {
|
|
2523
|
+
startReplan: async ({ scope, graph, failedTask }) => await this.startInternalFollowUpRun(scope.user, scope.threadId, this.buildPlannedTaskFollowUpMessage('replan', graph, { failedTask }), graph.messageGroupId, true, undefined, undefined, undefined),
|
|
2524
|
+
startWorkflowVerification: async ({ scope, graph, verification }) => await this.startInternalFollowUpRun(scope.user, scope.threadId, this.buildWorkflowVerificationFollowUpMessage({
|
|
2525
|
+
obligation: verification.obligation,
|
|
2526
|
+
outcome: verification.outcome,
|
|
2527
|
+
sourceTask: this.toWorkflowVerificationSourceTask(verification),
|
|
2528
|
+
}), graph.messageGroupId, false, undefined, 'workflow_verification', undefined),
|
|
2529
|
+
startSynthesis: async ({ scope, graph }) => await this.startInternalFollowUpRun(scope.user, scope.threadId, this.buildPlannedTaskFollowUpMessage('synthesize', graph), graph.messageGroupId, false, undefined, 'synthesize', undefined),
|
|
2530
|
+
startWorkflowBuild: async ({ scope, graph, task, workItemId }) => {
|
|
2531
|
+
const plannedBuild = {
|
|
2532
|
+
isPlannedBuildFollowUp: true,
|
|
2533
|
+
buildTaskId: task.id,
|
|
2534
|
+
workItemId,
|
|
2535
|
+
isSupportingWorkflowTask: task.isSupportingWorkflow === true,
|
|
2536
|
+
};
|
|
2537
|
+
return await this.startInternalFollowUpRun(scope.user, scope.threadId, this.buildPlannedTaskFollowUpMessage('build-workflow', graph, { buildTask: task }), graph.messageGroupId, false, undefined, undefined, plannedBuild);
|
|
2538
|
+
},
|
|
2539
|
+
startCheckpoint: async ({ scope, graph, task }) => await this.startInternalFollowUpRun(scope.user, scope.threadId, this.buildPlannedTaskFollowUpMessage('checkpoint', graph, { checkpoint: task }), graph.messageGroupId, false, { isCheckpointFollowUp: true, checkpointTaskId: task.id }, undefined, undefined),
|
|
2540
|
+
};
|
|
2541
|
+
}
|
|
2542
|
+
createPlannedWorkflowVerificationGate(threadId) {
|
|
2543
|
+
return {
|
|
2544
|
+
revalidate: async (verification) => await this.workflowObligations.revalidatePlannedWorkflowVerification(threadId, verification),
|
|
2545
|
+
};
|
|
2546
|
+
}
|
|
2547
|
+
toWorkflowVerificationSourceTask(verification) {
|
|
2548
|
+
return {
|
|
2549
|
+
taskId: verification.task.backgroundTaskId ?? verification.task.id,
|
|
2550
|
+
role: 'workflow-builder',
|
|
2551
|
+
status: 'completed',
|
|
2552
|
+
result: verification.task.result,
|
|
2553
|
+
error: verification.task.error,
|
|
2554
|
+
plannedTaskId: verification.task.id,
|
|
2555
|
+
workItemId: verification.obligation.workItemId,
|
|
2556
|
+
};
|
|
2557
|
+
}
|
|
2558
|
+
createPlannedWorkflowVerificationTracker() {
|
|
2559
|
+
return {
|
|
2560
|
+
scheduled: ({ obligation }) => this.trackWorkflowVerificationObligation(obligation, 'planned_verification_scheduled'),
|
|
2561
|
+
followUpStartAttempted: ({ obligation }, started) => this.trackWorkflowVerificationObligation(obligation, 'follow_up_start_attempted', {
|
|
2562
|
+
follow_up_started: started,
|
|
2563
|
+
}),
|
|
2564
|
+
};
|
|
2565
|
+
}
|
|
2566
|
+
async createPlannedTaskDispatchContext(user, threadId, graph) {
|
|
2567
|
+
const environment = await this.createExecutionEnvironment(user, threadId, graph.planRunId, createInertAbortSignal(), graph.messageGroupId, this.threadPushRef.get(threadId));
|
|
2568
|
+
environment.orchestrationContext.tracing = this.getTraceContext(graph.planRunId);
|
|
2569
|
+
return environment.orchestrationContext;
|
|
2570
|
+
}
|
|
2289
2571
|
async doSchedulePlannedTasks(user, threadId) {
|
|
2290
2572
|
const revalidated = await this.revalidateActiveUser(user.id);
|
|
2291
2573
|
if (!revalidated) {
|
|
@@ -2298,61 +2580,27 @@ let InstanceAiService = class InstanceAiService {
|
|
|
2298
2580
|
}
|
|
2299
2581
|
const activeUser = revalidated;
|
|
2300
2582
|
const { plannedTaskService } = await this.createPlannedTaskState();
|
|
2301
|
-
const
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
const availableSlots = Math.max(0, MAX_CONCURRENT_BACKGROUND_TASKS_PER_THREAD -
|
|
2306
|
-
this.backgroundTasks.getRunningTasks(threadId).length);
|
|
2307
|
-
const action = await plannedTaskService.tick(threadId, { availableSlots });
|
|
2308
|
-
if (action.type === 'none')
|
|
2309
|
-
return;
|
|
2310
|
-
if (action.type === 'replan') {
|
|
2311
|
-
await this.syncPlannedTasksToUi(threadId, action.graph);
|
|
2312
|
-
const startedRunId = await this.startInternalFollowUpRun(activeUser, threadId, this.buildPlannedTaskFollowUpMessage('replan', action.graph, {
|
|
2313
|
-
failedTask: action.failedTask,
|
|
2314
|
-
}), action.graph.messageGroupId, true);
|
|
2315
|
-
if (!startedRunId) {
|
|
2316
|
-
await plannedTaskService.revertToActive(threadId);
|
|
2317
|
-
}
|
|
2318
|
-
return;
|
|
2319
|
-
}
|
|
2320
|
-
if (action.type === 'synthesize') {
|
|
2321
|
-
await this.syncPlannedTasksToUi(threadId, action.graph);
|
|
2322
|
-
const startedRunId = await this.startInternalFollowUpRun(activeUser, threadId, this.buildPlannedTaskFollowUpMessage('synthesize', action.graph), action.graph.messageGroupId);
|
|
2323
|
-
if (!startedRunId) {
|
|
2324
|
-
await plannedTaskService.revertToActive(threadId);
|
|
2325
|
-
}
|
|
2326
|
-
return;
|
|
2327
|
-
}
|
|
2328
|
-
if (action.type === 'orchestrate-checkpoint') {
|
|
2329
|
-
if (this.runState.hasLiveRun(threadId)) {
|
|
2583
|
+
const actionRunner = this.createPlannedTaskActionRunner(activeUser, threadId, plannedTaskService);
|
|
2584
|
+
while (true) {
|
|
2585
|
+
const graph = await plannedTaskService.getGraph(threadId);
|
|
2586
|
+
if (!graph)
|
|
2330
2587
|
return;
|
|
2331
|
-
|
|
2332
|
-
const
|
|
2333
|
-
|
|
2334
|
-
|
|
2588
|
+
await this.syncPlannedTasksToUi(threadId, graph);
|
|
2589
|
+
const availableSlots = Math.max(0, MAX_CONCURRENT_BACKGROUND_TASKS_PER_THREAD -
|
|
2590
|
+
this.backgroundTasks.getRunningTasks(threadId).length);
|
|
2591
|
+
const pendingWorkflowVerification = await this.workflowObligations.findPendingPlannedWorkflowVerification(threadId, graph);
|
|
2592
|
+
const action = await plannedTaskService.tick(threadId, {
|
|
2593
|
+
availableSlots,
|
|
2594
|
+
pendingWorkflowVerification,
|
|
2335
2595
|
});
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
const
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
}), action.graph.messageGroupId, false, { isCheckpointFollowUp: true, checkpointTaskId: checkpoint.id });
|
|
2342
|
-
if (!startedRunId) {
|
|
2343
|
-
this.logger.warn('Checkpoint follow-up run did not start — reverting checkpoint to planned for retry', { threadId, checkpointTaskId: checkpoint.id });
|
|
2344
|
-
await plannedTaskService.revertCheckpointToPlanned(threadId, checkpoint.id);
|
|
2345
|
-
}
|
|
2346
|
-
return;
|
|
2347
|
-
}
|
|
2348
|
-
const environment = await this.createExecutionEnvironment(activeUser, threadId, action.graph.planRunId, createInertAbortSignal(), action.graph.messageGroupId, this.threadPushRef.get(threadId));
|
|
2349
|
-
environment.orchestrationContext.tracing = this.getTraceContext(action.graph.planRunId);
|
|
2350
|
-
for (const task of action.tasks) {
|
|
2351
|
-
await this.dispatchPlannedTask(task, environment.orchestrationContext, action.graph);
|
|
2596
|
+
if (action.type === 'none')
|
|
2597
|
+
return;
|
|
2598
|
+
const result = await actionRunner.run(action);
|
|
2599
|
+
if (result.type !== 'continue-scheduling')
|
|
2600
|
+
return;
|
|
2352
2601
|
}
|
|
2353
|
-
await this.doSchedulePlannedTasks(activeUser, threadId);
|
|
2354
2602
|
}
|
|
2355
|
-
async executeRun(user, threadId, runId, message, abortController, attachments, messageGroupId, timeZone, isReplanFollowUp = false, checkpoint, resumeReason) {
|
|
2603
|
+
async executeRun(user, threadId, runId, message, abortController, attachments, messageGroupId, timeZone, isReplanFollowUp = false, checkpoint, resumeReason, plannedBuild) {
|
|
2356
2604
|
const userMessagePersistence = this.userMessagePersistenceByRun.get(runId)?.message;
|
|
2357
2605
|
const signal = abortController.signal;
|
|
2358
2606
|
let tracing;
|
|
@@ -2382,12 +2630,15 @@ let InstanceAiService = class InstanceAiService {
|
|
|
2382
2630
|
});
|
|
2383
2631
|
return;
|
|
2384
2632
|
}
|
|
2385
|
-
const
|
|
2633
|
+
const staticMcpServers = this.parseMcpServers(this.instanceAiConfig.mcpServers);
|
|
2634
|
+
const registryMcpServers = await this.mcpRegistryService.getRegistryMcpServers(user);
|
|
2635
|
+
const mcpServers = [...staticMcpServers, ...registryMcpServers];
|
|
2386
2636
|
const executionPushRef = this.threadPushRef.get(threadId);
|
|
2387
2637
|
const environment = await this.createExecutionEnvironment(user, threadId, runId, signal, messageGroupId, executionPushRef);
|
|
2388
2638
|
activeSnapshotStorage = environment.snapshotStorage;
|
|
2389
|
-
const { context, memory, taskStorage, snapshotStorage, modelId, orchestrationContext } = environment;
|
|
2639
|
+
const { context, memory, taskStorage, snapshotStorage, workflowTasks, plannedTaskService, modelId, orchestrationContext, } = environment;
|
|
2390
2640
|
aiCreatedWorkflowIds = context.aiCreatedWorkflowIds ??= new Set();
|
|
2641
|
+
const isPostPlanFollowUp = isReplanFollowUp || checkpoint?.isCheckpointFollowUp === true;
|
|
2391
2642
|
orchestrationContext.currentUserMessage = message;
|
|
2392
2643
|
orchestrationContext.isReplanFollowUp = isReplanFollowUp;
|
|
2393
2644
|
orchestrationContext.timeZone = timeZone ?? this.defaultTimeZone;
|
|
@@ -2398,7 +2649,39 @@ let InstanceAiService = class InstanceAiService {
|
|
|
2398
2649
|
...context.permissions,
|
|
2399
2650
|
...(instance_ai_1.PLANNED_TASK_PERMISSION_OVERRIDES.checkpoint ?? {}),
|
|
2400
2651
|
};
|
|
2401
|
-
|
|
2652
|
+
const runPolicy = await this.getCheckpointRunPolicy(threadId, checkpoint.checkpointTaskId);
|
|
2653
|
+
context.allowedRunWorkflowIds = runPolicy.allowedWorkflowIds;
|
|
2654
|
+
context.allowedRunWorkflowNames = runPolicy.allowedWorkflowNames;
|
|
2655
|
+
context.requireRunWorkflowApproval = runPolicy.requireApproval;
|
|
2656
|
+
}
|
|
2657
|
+
if (plannedBuild?.isPlannedBuildFollowUp) {
|
|
2658
|
+
context.permissions = {
|
|
2659
|
+
...context.permissions,
|
|
2660
|
+
...(instance_ai_1.PLANNED_TASK_PERMISSION_OVERRIDES['build-workflow'] ?? {}),
|
|
2661
|
+
};
|
|
2662
|
+
context.workflowBuildContext = {
|
|
2663
|
+
threadId,
|
|
2664
|
+
runId,
|
|
2665
|
+
taskId: plannedBuild.buildTaskId,
|
|
2666
|
+
workItemId: plannedBuild.workItemId,
|
|
2667
|
+
allowPostPlanWorkflowCreate: true,
|
|
2668
|
+
isSupportingWorkflowTask: plannedBuild.isSupportingWorkflowTask,
|
|
2669
|
+
plannedTaskService,
|
|
2670
|
+
workflowTaskService: workflowTasks,
|
|
2671
|
+
onBuildOutcome: (outcome) => {
|
|
2672
|
+
plannedBuild.savedOutcome = outcome;
|
|
2673
|
+
},
|
|
2674
|
+
};
|
|
2675
|
+
}
|
|
2676
|
+
else {
|
|
2677
|
+
context.workflowBuildContext = {
|
|
2678
|
+
threadId,
|
|
2679
|
+
runId,
|
|
2680
|
+
taskId: `build-${runId}`,
|
|
2681
|
+
workItemId: `wi_${(0, nanoid_1.nanoid)(8)}`,
|
|
2682
|
+
allowPostPlanWorkflowCreate: isPostPlanFollowUp,
|
|
2683
|
+
workflowTaskService: workflowTasks,
|
|
2684
|
+
};
|
|
2402
2685
|
}
|
|
2403
2686
|
if (attachments && attachments.length > 0) {
|
|
2404
2687
|
context.currentUserAttachments = attachments;
|
|
@@ -2431,6 +2714,9 @@ let InstanceAiService = class InstanceAiService {
|
|
|
2431
2714
|
...(checkpoint?.isCheckpointFollowUp
|
|
2432
2715
|
? { checkpoint_task_id: checkpoint.checkpointTaskId }
|
|
2433
2716
|
: {}),
|
|
2717
|
+
...(plannedBuild?.isPlannedBuildFollowUp
|
|
2718
|
+
? { build_task_id: plannedBuild.buildTaskId }
|
|
2719
|
+
: {}),
|
|
2434
2720
|
},
|
|
2435
2721
|
})
|
|
2436
2722
|
: await (0, instance_ai_1.createInstanceAiTraceContext)({
|
|
@@ -2628,6 +2914,7 @@ let InstanceAiService = class InstanceAiService {
|
|
|
2628
2914
|
tracing,
|
|
2629
2915
|
modelId,
|
|
2630
2916
|
checkpoint,
|
|
2917
|
+
plannedBuild,
|
|
2631
2918
|
});
|
|
2632
2919
|
void this.persistPendingConfirmation({
|
|
2633
2920
|
requestId: result.suspension.requestId,
|
|
@@ -2715,6 +3002,8 @@ let InstanceAiService = class InstanceAiService {
|
|
|
2715
3002
|
messageGroupId,
|
|
2716
3003
|
correlationId: messageId,
|
|
2717
3004
|
workSummary: result.workSummary,
|
|
3005
|
+
suppressCompletedFallback: checkpoint?.isCheckpointFollowUp === true ||
|
|
3006
|
+
plannedBuild?.isPlannedBuildFollowUp === true,
|
|
2718
3007
|
});
|
|
2719
3008
|
const finalStatus = result.status === 'errored' ? 'error' : result.status;
|
|
2720
3009
|
await this.finalizeRunTracing(runId, tracing, {
|
|
@@ -2831,10 +3120,15 @@ let InstanceAiService = class InstanceAiService {
|
|
|
2831
3120
|
if (checkpoint?.isCheckpointFollowUp) {
|
|
2832
3121
|
await this.finalizeCheckpointFollowUp(user, threadId, checkpoint.checkpointTaskId);
|
|
2833
3122
|
}
|
|
3123
|
+
else if (plannedBuild?.isPlannedBuildFollowUp) {
|
|
3124
|
+
await this.finalizePlannedBuildFollowUp(user, threadId, plannedBuild);
|
|
3125
|
+
}
|
|
2834
3126
|
else {
|
|
2835
3127
|
await this.schedulePlannedTasks(user, threadId);
|
|
2836
3128
|
}
|
|
2837
3129
|
await this.drainPendingCheckpointReentries(user, threadId);
|
|
3130
|
+
await this.taskProjector.syncFromWorkflowLoop(threadId, runId);
|
|
3131
|
+
await this.maybeStartWorkflowSetupFollowUp(user, threadId);
|
|
2838
3132
|
}
|
|
2839
3133
|
}
|
|
2840
3134
|
}
|
|
@@ -2944,6 +3238,42 @@ let InstanceAiService = class InstanceAiService {
|
|
|
2944
3238
|
}
|
|
2945
3239
|
await this.schedulePlannedTasks(user, threadId);
|
|
2946
3240
|
}
|
|
3241
|
+
async finalizePlannedBuildFollowUp(user, threadId, plannedBuild) {
|
|
3242
|
+
try {
|
|
3243
|
+
const { plannedTaskService } = await this.createPlannedTaskState();
|
|
3244
|
+
const graph = await plannedTaskService.getGraph(threadId);
|
|
3245
|
+
const task = graph?.tasks.find((t) => t.id === plannedBuild.buildTaskId);
|
|
3246
|
+
if (task && task.status === 'running') {
|
|
3247
|
+
if (plannedBuild.savedOutcome?.submitted === true) {
|
|
3248
|
+
await plannedTaskService.markSucceeded(threadId, plannedBuild.buildTaskId, {
|
|
3249
|
+
result: plannedBuild.savedOutcome.summary,
|
|
3250
|
+
outcome: plannedBuild.savedOutcome,
|
|
3251
|
+
});
|
|
3252
|
+
}
|
|
3253
|
+
else {
|
|
3254
|
+
this.logger.warn('Build workflow follow-up ended without saving — marking failed', {
|
|
3255
|
+
threadId,
|
|
3256
|
+
buildTaskId: plannedBuild.buildTaskId,
|
|
3257
|
+
});
|
|
3258
|
+
await plannedTaskService.markFailed(threadId, plannedBuild.buildTaskId, {
|
|
3259
|
+
error: 'Workflow build run ended without saving a workflow',
|
|
3260
|
+
});
|
|
3261
|
+
}
|
|
3262
|
+
const nextGraph = await plannedTaskService.getGraph(threadId);
|
|
3263
|
+
if (nextGraph) {
|
|
3264
|
+
await this.syncPlannedTasksToUi(threadId, nextGraph);
|
|
3265
|
+
}
|
|
3266
|
+
}
|
|
3267
|
+
}
|
|
3268
|
+
catch (error) {
|
|
3269
|
+
this.logger.error('Build workflow finalization failed', {
|
|
3270
|
+
threadId,
|
|
3271
|
+
buildTaskId: plannedBuild.buildTaskId,
|
|
3272
|
+
error: error instanceof Error ? error.message : String(error),
|
|
3273
|
+
});
|
|
3274
|
+
}
|
|
3275
|
+
await this.schedulePlannedTasks(user, threadId);
|
|
3276
|
+
}
|
|
2947
3277
|
async resolveConfirmation(requestingUserId, requestId, request) {
|
|
2948
3278
|
const data = toConfirmationData(request);
|
|
2949
3279
|
const freshUser = await this.revalidateActiveUser(requestingUserId);
|
|
@@ -3151,7 +3481,7 @@ let InstanceAiService = class InstanceAiService {
|
|
|
3151
3481
|
});
|
|
3152
3482
|
return false;
|
|
3153
3483
|
}
|
|
3154
|
-
const { agent, runId, agentRunId, threadId, user, toolCallId, abortController, tracing, modelId, messageGroupId, checkpoint, } = suspended;
|
|
3484
|
+
const { agent, runId, agentRunId, threadId, user, toolCallId, abortController, tracing, modelId, messageGroupId, checkpoint, plannedBuild, } = suspended;
|
|
3155
3485
|
if (user.id !== requestingUserId)
|
|
3156
3486
|
return false;
|
|
3157
3487
|
const activeUser = await this.revalidateActiveUser(user.id);
|
|
@@ -3200,6 +3530,9 @@ let InstanceAiService = class InstanceAiService {
|
|
|
3200
3530
|
...(checkpoint?.isCheckpointFollowUp
|
|
3201
3531
|
? { checkpoint_task_id: checkpoint.checkpointTaskId }
|
|
3202
3532
|
: {}),
|
|
3533
|
+
...(plannedBuild?.isPlannedBuildFollowUp
|
|
3534
|
+
? { build_task_id: plannedBuild.buildTaskId }
|
|
3535
|
+
: {}),
|
|
3203
3536
|
},
|
|
3204
3537
|
});
|
|
3205
3538
|
this.startProcessResumedStream(agent, resumeData, {
|
|
@@ -3214,6 +3547,7 @@ let InstanceAiService = class InstanceAiService {
|
|
|
3214
3547
|
tracing: resumeTracing ?? tracing,
|
|
3215
3548
|
modelId,
|
|
3216
3549
|
checkpoint,
|
|
3550
|
+
plannedBuild,
|
|
3217
3551
|
});
|
|
3218
3552
|
return true;
|
|
3219
3553
|
}
|
|
@@ -3284,6 +3618,7 @@ let InstanceAiService = class InstanceAiService {
|
|
|
3284
3618
|
tracing: opts.tracing,
|
|
3285
3619
|
...(opts.modelId !== undefined ? { modelId: opts.modelId } : {}),
|
|
3286
3620
|
checkpoint: opts.checkpoint,
|
|
3621
|
+
plannedBuild: opts.plannedBuild,
|
|
3287
3622
|
});
|
|
3288
3623
|
void this.persistPendingConfirmation({
|
|
3289
3624
|
requestId: result.suspension.requestId,
|
|
@@ -3369,6 +3704,8 @@ let InstanceAiService = class InstanceAiService {
|
|
|
3369
3704
|
this.evaluateTerminalResponse(opts.threadId, opts.runId, result.status, {
|
|
3370
3705
|
messageGroupId,
|
|
3371
3706
|
workSummary: result.workSummary,
|
|
3707
|
+
suppressCompletedFallback: opts.checkpoint?.isCheckpointFollowUp === true ||
|
|
3708
|
+
opts.plannedBuild?.isPlannedBuildFollowUp === true,
|
|
3372
3709
|
});
|
|
3373
3710
|
const finalStatus = result.status === 'errored' ? 'error' : result.status;
|
|
3374
3711
|
await this.finalizeRunTracing(opts.runId, opts.tracing, {
|
|
@@ -3479,10 +3816,15 @@ let InstanceAiService = class InstanceAiService {
|
|
|
3479
3816
|
if (opts.checkpoint?.isCheckpointFollowUp) {
|
|
3480
3817
|
await this.finalizeCheckpointFollowUp(opts.user, opts.threadId, opts.checkpoint.checkpointTaskId);
|
|
3481
3818
|
}
|
|
3819
|
+
else if (opts.plannedBuild?.isPlannedBuildFollowUp) {
|
|
3820
|
+
await this.finalizePlannedBuildFollowUp(opts.user, opts.threadId, opts.plannedBuild);
|
|
3821
|
+
}
|
|
3482
3822
|
else {
|
|
3483
3823
|
await this.schedulePlannedTasks(opts.user, opts.threadId);
|
|
3484
3824
|
}
|
|
3485
3825
|
await this.drainPendingCheckpointReentries(opts.user, opts.threadId);
|
|
3826
|
+
await this.taskProjector.syncFromWorkflowLoop(opts.threadId, opts.runId);
|
|
3827
|
+
await this.maybeStartWorkflowSetupFollowUp(opts.user, opts.threadId);
|
|
3486
3828
|
}
|
|
3487
3829
|
}
|
|
3488
3830
|
}
|
|
@@ -3557,6 +3899,7 @@ let InstanceAiService = class InstanceAiService {
|
|
|
3557
3899
|
await this.saveAgentTreeSnapshot(opts.threadId, runId, snapshotStorage, true, task.messageGroupId);
|
|
3558
3900
|
if (task.plannedTaskId)
|
|
3559
3901
|
return;
|
|
3902
|
+
await this.taskProjector.syncFromBackgroundTask(task);
|
|
3560
3903
|
const parentCheckpointId = task.parentCheckpointId;
|
|
3561
3904
|
if (parentCheckpointId) {
|
|
3562
3905
|
const user = this.runState.getThreadUser(opts.threadId);
|
|
@@ -3583,6 +3926,12 @@ let InstanceAiService = class InstanceAiService {
|
|
|
3583
3926
|
}
|
|
3584
3927
|
const user = this.runState.getThreadUser(opts.threadId);
|
|
3585
3928
|
if (user) {
|
|
3929
|
+
const verificationFollowUpStarted = await this.maybeStartWorkflowVerificationFollowUp(user, task);
|
|
3930
|
+
if (verificationFollowUpStarted)
|
|
3931
|
+
return;
|
|
3932
|
+
const setupFollowUpStarted = await this.maybeStartWorkflowSetupFollowUp(user, task.threadId);
|
|
3933
|
+
if (setupFollowUpStarted)
|
|
3934
|
+
return;
|
|
3586
3935
|
const payload = JSON.stringify({
|
|
3587
3936
|
role: opts.role,
|
|
3588
3937
|
status: task.result ? 'completed' : task.error ? 'failed' : 'finished',
|
|
@@ -3596,6 +3945,7 @@ let InstanceAiService = class InstanceAiService {
|
|
|
3596
3945
|
},
|
|
3597
3946
|
});
|
|
3598
3947
|
if (outcome.status === 'started') {
|
|
3948
|
+
void this.taskProjector.syncFromBackgroundTask(outcome.task);
|
|
3599
3949
|
return { status: 'started', taskId: outcome.task.taskId, agentId: outcome.task.agentId };
|
|
3600
3950
|
}
|
|
3601
3951
|
if (outcome.status === 'duplicate') {
|
|
@@ -4026,6 +4376,8 @@ exports.InstanceAiService = InstanceAiService = __decorate([
|
|
|
4026
4376
|
instance_ai_adapter_service_1.InstanceAiAdapterService,
|
|
4027
4377
|
in_process_event_bus_1.InProcessEventBus,
|
|
4028
4378
|
instance_ai_settings_service_1.InstanceAiSettingsService,
|
|
4379
|
+
instance_ai_gateway_service_1.InstanceAiGatewayService,
|
|
4380
|
+
instance_ai_memory_service_1.InstanceAiMemoryService,
|
|
4029
4381
|
typeorm_agent_memory_1.TypeORMAgentMemory,
|
|
4030
4382
|
typeorm_agent_checkpoint_store_1.TypeORMAgentCheckpointStore,
|
|
4031
4383
|
ai_service_1.AiService,
|
|
@@ -4037,11 +4389,12 @@ exports.InstanceAiService = InstanceAiService = __decorate([
|
|
|
4037
4389
|
db_iteration_log_storage_1.DbIterationLogStorage,
|
|
4038
4390
|
source_control_preferences_service_ee_1.SourceControlPreferencesService,
|
|
4039
4391
|
telemetry_1.Telemetry,
|
|
4392
|
+
mcp_1.InstanceAiMcpRegistryService,
|
|
4040
4393
|
db_1.UserRepository,
|
|
4041
4394
|
db_1.AiBuilderTemporaryWorkflowRepository,
|
|
4042
4395
|
n8n_core_1.ErrorReporter,
|
|
4043
4396
|
config_1.SsrfProtectionConfig,
|
|
4044
|
-
|
|
4397
|
+
n8n_core_1.SsrfProtectionService,
|
|
4045
4398
|
event_service_1.EventService])
|
|
4046
4399
|
], InstanceAiService);
|
|
4047
4400
|
//# sourceMappingURL=instance-ai.service.js.map
|