n8n 2.21.6 → 2.22.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/active-workflow-manager.js +4 -0
- package/dist/active-workflow-manager.js.map +1 -1
- package/dist/build.tsbuildinfo +1 -1
- package/dist/commands/base-command.js +2 -1
- package/dist/commands/base-command.js.map +1 -1
- package/dist/commands/export/entities.d.ts +3 -0
- package/dist/commands/export/entities.js +8 -1
- package/dist/commands/export/entities.js.map +1 -1
- package/dist/concurrency/concurrency-control.service.d.ts +7 -2
- package/dist/concurrency/concurrency-control.service.js +72 -47
- package/dist/concurrency/concurrency-control.service.js.map +1 -1
- package/dist/constants.js +3 -0
- package/dist/constants.js.map +1 -1
- package/dist/controllers/e2e.controller.js +2 -0
- package/dist/controllers/e2e.controller.js.map +1 -1
- package/dist/controllers/users.controller.d.ts +1 -1
- package/dist/credentials/credentials.service.js.map +1 -1
- package/dist/evaluation.ee/evaluation-collection.service.d.ts +38 -0
- package/dist/evaluation.ee/evaluation-collection.service.js +327 -0
- package/dist/evaluation.ee/evaluation-collection.service.js.map +1 -0
- package/dist/evaluation.ee/evaluation-collections.controller.ee.d.ts +50 -0
- package/dist/evaluation.ee/evaluation-collections.controller.ee.js +148 -0
- package/dist/evaluation.ee/evaluation-collections.controller.ee.js.map +1 -0
- package/dist/evaluation.ee/evaluation-concurrency.helper.d.ts +11 -0
- package/dist/evaluation.ee/evaluation-concurrency.helper.js +40 -0
- package/dist/evaluation.ee/evaluation-concurrency.helper.js.map +1 -0
- package/dist/evaluation.ee/test-runner/test-runner.service.ee.d.ts +22 -6
- package/dist/evaluation.ee/test-runner/test-runner.service.ee.js +105 -15
- package/dist/evaluation.ee/test-runner/test-runner.service.ee.js.map +1 -1
- package/dist/evaluation.ee/test-runs.controller.ee.d.ts +5 -6
- package/dist/evaluation.ee/test-runs.controller.ee.js +4 -24
- package/dist/evaluation.ee/test-runs.controller.ee.js.map +1 -1
- package/dist/interfaces.d.ts +6 -0
- package/dist/modules/agents/adapters/agents-credential-provider.d.ts +2 -1
- package/dist/modules/agents/adapters/agents-credential-provider.js +25 -24
- package/dist/modules/agents/adapters/agents-credential-provider.js.map +1 -1
- package/dist/modules/agents/agent-execution.service.js +0 -1
- package/dist/modules/agents/agent-execution.service.js.map +1 -1
- package/dist/modules/agents/agent-skills.service.d.ts +1 -2
- package/dist/modules/agents/agent-skills.service.js.map +1 -1
- package/dist/modules/agents/agent-sse-stream.d.ts +1 -1
- package/dist/modules/agents/agent-sse-stream.js +0 -31
- package/dist/modules/agents/agent-sse-stream.js.map +1 -1
- package/dist/modules/agents/agents.controller.d.ts +64 -37
- package/dist/modules/agents/agents.controller.js +54 -40
- package/dist/modules/agents/agents.controller.js.map +1 -1
- package/dist/modules/agents/agents.service.d.ts +15 -5
- package/dist/modules/agents/agents.service.js +79 -71
- package/dist/modules/agents/agents.service.js.map +1 -1
- package/dist/modules/agents/builder/agent-builder-preview-path.d.ts +1 -0
- package/dist/modules/agents/builder/agent-builder-preview-path.js +9 -0
- package/dist/modules/agents/builder/agent-builder-preview-path.js.map +1 -0
- package/dist/modules/agents/builder/agents-builder-model-recommendations.d.ts +3 -0
- package/dist/modules/agents/builder/agents-builder-model-recommendations.js +106 -0
- package/dist/modules/agents/builder/agents-builder-model-recommendations.js.map +1 -0
- package/dist/modules/agents/builder/agents-builder-prompts.d.ts +12 -11
- package/dist/modules/agents/builder/agents-builder-prompts.js +61 -32
- package/dist/modules/agents/builder/agents-builder-prompts.js.map +1 -1
- package/dist/modules/agents/builder/agents-builder-tools.service.d.ts +1 -1
- package/dist/modules/agents/builder/agents-builder-tools.service.js +7 -8
- package/dist/modules/agents/builder/agents-builder-tools.service.js.map +1 -1
- package/dist/modules/agents/builder/agents-builder.service.js +6 -3
- package/dist/modules/agents/builder/agents-builder.service.js.map +1 -1
- package/dist/modules/agents/builder/interactive/ask-llm.tool.js +1 -1
- package/dist/modules/agents/builder/interactive/ask-llm.tool.js.map +1 -1
- package/dist/modules/agents/builder/interactive/resolve-llm.tool.js +1 -1
- package/dist/modules/agents/builder/interactive/resolve-llm.tool.js.map +1 -1
- package/dist/modules/agents/entities/agent-execution.entity.d.ts +0 -1
- package/dist/modules/agents/entities/agent-execution.entity.js +0 -4
- package/dist/modules/agents/entities/agent-execution.entity.js.map +1 -1
- package/dist/modules/agents/entities/agent-observation-lock.entity.d.ts +2 -0
- package/dist/modules/agents/entities/agent-observation-lock.entity.js +4 -0
- package/dist/modules/agents/entities/agent-observation-lock.entity.js.map +1 -1
- package/dist/modules/agents/entities/agent-observation.entity.d.ts +9 -5
- package/dist/modules/agents/entities/agent-observation.entity.js +21 -11
- package/dist/modules/agents/entities/agent-observation.entity.js.map +1 -1
- package/dist/modules/agents/entities/agent-published-version.entity.d.ts +1 -2
- package/dist/modules/agents/entities/agent-published-version.entity.js.map +1 -1
- package/dist/modules/agents/entities/agent.entity.d.ts +2 -3
- package/dist/modules/agents/entities/agent.entity.js.map +1 -1
- package/dist/modules/agents/execution-recorder.d.ts +1 -8
- package/dist/modules/agents/execution-recorder.js +67 -42
- package/dist/modules/agents/execution-recorder.js.map +1 -1
- package/dist/modules/agents/integrations/agent-chat-bridge.d.ts +6 -4
- package/dist/modules/agents/integrations/agent-chat-bridge.js +22 -13
- package/dist/modules/agents/integrations/agent-chat-bridge.js.map +1 -1
- package/dist/modules/agents/integrations/agent-chat-integration.d.ts +4 -1
- package/dist/modules/agents/integrations/agent-chat-integration.js.map +1 -1
- package/dist/modules/agents/integrations/chat-integration.service.d.ts +17 -8
- package/dist/modules/agents/integrations/chat-integration.service.js +53 -37
- package/dist/modules/agents/integrations/chat-integration.service.js.map +1 -1
- package/dist/modules/agents/integrations/integrations-sync.d.ts +2 -2
- package/dist/modules/agents/integrations/integrations-sync.js +1 -1
- package/dist/modules/agents/integrations/integrations-sync.js.map +1 -1
- package/dist/modules/agents/integrations/n8n-memory.d.ts +31 -35
- package/dist/modules/agents/integrations/n8n-memory.js +121 -127
- package/dist/modules/agents/integrations/n8n-memory.js.map +1 -1
- package/dist/modules/agents/integrations/platforms/telegram-integration.d.ts +9 -2
- package/dist/modules/agents/integrations/platforms/telegram-integration.js +51 -6
- package/dist/modules/agents/integrations/platforms/telegram-integration.js.map +1 -1
- package/dist/modules/agents/json-config/agent-config-composition.d.ts +2 -3
- package/dist/modules/agents/json-config/agent-config-composition.js.map +1 -1
- package/dist/modules/agents/json-config/from-json-config.d.ts +1 -2
- package/dist/modules/agents/json-config/from-json-config.js +31 -34
- package/dist/modules/agents/json-config/from-json-config.js.map +1 -1
- package/dist/modules/agents/observation-log-observer.d.ts +2 -0
- package/dist/modules/agents/observation-log-observer.js +10 -0
- package/dist/modules/agents/observation-log-observer.js.map +1 -0
- package/dist/modules/agents/observation-log-reflector.d.ts +2 -0
- package/dist/modules/agents/observation-log-reflector.js +9 -0
- package/dist/modules/agents/observation-log-reflector.js.map +1 -0
- package/dist/modules/agents/repositories/agent-published-version.repository.d.ts +1 -1
- package/dist/modules/agents/repositories/agent.repository.js +1 -1
- package/dist/modules/agents/repositories/agent.repository.js.map +1 -1
- package/dist/modules/agents/tools/node-tool-factory.d.ts +1 -1
- package/dist/modules/agents/tools/workflow-tool-factory.d.ts +1 -1
- package/dist/modules/agents/tools/workflow-tool-factory.js +40 -2
- package/dist/modules/agents/tools/workflow-tool-factory.js.map +1 -1
- package/dist/modules/agents/utils/execution-to-message-mapper.d.ts +6 -0
- package/dist/modules/agents/utils/execution-to-message-mapper.js +133 -0
- package/dist/modules/agents/utils/execution-to-message-mapper.js.map +1 -0
- package/dist/modules/chat-hub/chat-hub-workflow.service.js +9 -0
- package/dist/modules/chat-hub/chat-hub-workflow.service.js.map +1 -1
- package/dist/modules/chat-hub/chat-hub.constants.js +4 -0
- package/dist/modules/chat-hub/chat-hub.constants.js.map +1 -1
- package/dist/modules/chat-hub/chat-hub.models.service.d.ts +1 -0
- package/dist/modules/chat-hub/chat-hub.models.service.js +43 -0
- package/dist/modules/chat-hub/chat-hub.models.service.js.map +1 -1
- package/dist/modules/chat-hub/chat-hub.module.d.ts +3 -3
- package/dist/modules/chat-hub/chat-hub.settings.controller.d.ts +7 -7
- package/dist/modules/chat-hub/context-limits.js +1 -0
- package/dist/modules/chat-hub/context-limits.js.map +1 -1
- package/dist/modules/chat-hub/dto/chat-models-request.dto.d.ts +2 -2
- package/dist/modules/community-packages/community-node-types-utils.d.ts +1 -1
- package/dist/modules/community-packages/community-node-types-utils.js +1 -1
- package/dist/modules/community-packages/community-node-types-utils.js.map +1 -1
- package/dist/modules/community-packages/community-node-types.service.js +1 -1
- package/dist/modules/community-packages/community-node-types.service.js.map +1 -1
- package/dist/modules/data-table/utils/sql-utils.d.ts +2 -0
- package/dist/modules/data-table/utils/sql-utils.js +26 -9
- package/dist/modules/data-table/utils/sql-utils.js.map +1 -1
- package/dist/modules/inbound-secrets/inbound-secrets-context-hook.d.ts +10 -0
- package/dist/modules/inbound-secrets/inbound-secrets-context-hook.js +55 -0
- package/dist/modules/inbound-secrets/inbound-secrets-context-hook.js.map +1 -0
- package/dist/modules/inbound-secrets/inbound-secrets.config.d.ts +3 -0
- package/dist/modules/inbound-secrets/inbound-secrets.config.js +27 -0
- package/dist/modules/inbound-secrets/inbound-secrets.config.js.map +1 -0
- package/dist/modules/inbound-secrets/inbound-secrets.module.d.ts +4 -0
- package/dist/modules/inbound-secrets/inbound-secrets.module.js +61 -0
- package/dist/modules/inbound-secrets/inbound-secrets.module.js.map +1 -0
- package/dist/modules/inbound-secrets/inbound-secrets.schemas.d.ts +3 -0
- package/dist/modules/inbound-secrets/inbound-secrets.schemas.js +6 -0
- package/dist/modules/inbound-secrets/inbound-secrets.schemas.js.map +1 -0
- package/dist/modules/inbound-secrets/inbound-secrets.service.d.ts +17 -0
- package/dist/modules/inbound-secrets/inbound-secrets.service.js +76 -0
- package/dist/modules/inbound-secrets/inbound-secrets.service.js.map +1 -0
- package/dist/modules/inbound-secrets/path-traversal.d.ts +4 -0
- package/dist/modules/inbound-secrets/path-traversal.js +51 -0
- package/dist/modules/inbound-secrets/path-traversal.js.map +1 -0
- package/dist/modules/insights/database/repositories/insights-by-period.repository.d.ts +1 -0
- package/dist/modules/insights/database/repositories/insights-by-period.repository.js +19 -4
- package/dist/modules/insights/database/repositories/insights-by-period.repository.js.map +1 -1
- package/dist/modules/insights/database/repositories/insights-raw.repository.js +1 -0
- package/dist/modules/insights/database/repositories/insights-raw.repository.js.map +1 -1
- package/dist/modules/insights/insights-compaction.service.d.ts +5 -0
- package/dist/modules/insights/insights-compaction.service.js +93 -18
- package/dist/modules/insights/insights-compaction.service.js.map +1 -1
- package/dist/modules/insights/insights.config.d.ts +3 -0
- package/dist/modules/insights/insights.config.js +15 -0
- package/dist/modules/insights/insights.config.js.map +1 -1
- package/dist/modules/instance-ai/eval/eval-mocked-credentials-helper.d.ts +17 -0
- package/dist/modules/instance-ai/eval/eval-mocked-credentials-helper.js +61 -0
- package/dist/modules/instance-ai/eval/eval-mocked-credentials-helper.js.map +1 -0
- package/dist/modules/instance-ai/eval/execution.service.js +8 -2
- package/dist/modules/instance-ai/eval/execution.service.js.map +1 -1
- package/dist/modules/instance-ai/eval/mock-handler.d.ts +1 -0
- package/dist/modules/instance-ai/eval/mock-handler.js +116 -72
- package/dist/modules/instance-ai/eval/mock-handler.js.map +1 -1
- package/dist/modules/instance-ai/eval/mock-quirks.d.ts +10 -0
- package/dist/modules/instance-ai/eval/mock-quirks.js +25 -0
- package/dist/modules/instance-ai/eval/mock-quirks.js.map +1 -0
- package/dist/modules/instance-ai/instance-ai-settings.service.js +14 -0
- package/dist/modules/instance-ai/instance-ai-settings.service.js.map +1 -1
- package/dist/modules/instance-ai/instance-ai.adapter.service.js +25 -5
- package/dist/modules/instance-ai/instance-ai.adapter.service.js.map +1 -1
- package/dist/modules/instance-ai/instance-ai.controller.d.ts +10 -3
- package/dist/modules/instance-ai/instance-ai.controller.js +34 -2
- package/dist/modules/instance-ai/instance-ai.controller.js.map +1 -1
- package/dist/modules/instance-ai/instance-ai.service.d.ts +2 -1
- package/dist/modules/instance-ai/instance-ai.service.js +75 -29
- package/dist/modules/instance-ai/instance-ai.service.js.map +1 -1
- package/dist/modules/instance-ai/liveness/index.d.ts +1 -1
- package/dist/modules/instance-ai/liveness/index.js.map +1 -1
- package/dist/modules/instance-ai/liveness/instance-ai-liveness.service.d.ts +12 -3
- package/dist/modules/instance-ai/liveness/instance-ai-liveness.service.js +21 -11
- package/dist/modules/instance-ai/liveness/instance-ai-liveness.service.js.map +1 -1
- package/dist/modules/instance-ai/run-timeout-details.d.ts +8 -0
- package/dist/modules/instance-ai/run-timeout-details.js +3 -0
- package/dist/modules/instance-ai/run-timeout-details.js.map +1 -0
- package/dist/modules/instance-ai/run-trace-metadata.d.ts +15 -0
- package/dist/modules/instance-ai/run-trace-metadata.js +63 -0
- package/dist/modules/instance-ai/run-trace-metadata.js.map +1 -0
- package/dist/modules/instance-version-history/instance-version-history.controller.d.ts +5 -3
- package/dist/modules/instance-version-history/instance-version-history.controller.js +9 -9
- package/dist/modules/instance-version-history/instance-version-history.controller.js.map +1 -1
- package/dist/modules/mcp/mcp-api-key.service.js +1 -0
- package/dist/modules/mcp/mcp-api-key.service.js.map +1 -1
- package/dist/modules/mcp/mcp-oauth-token.service.d.ts +7 -2
- package/dist/modules/mcp/mcp-oauth-token.service.js +16 -6
- package/dist/modules/mcp/mcp-oauth-token.service.js.map +1 -1
- package/dist/modules/mcp/mcp-server-middleware.service.js +2 -0
- package/dist/modules/mcp/mcp-server-middleware.service.js.map +1 -1
- package/dist/modules/mcp/mcp.controller.js +1 -0
- package/dist/modules/mcp/mcp.controller.js.map +1 -1
- package/dist/modules/mcp/mcp.types.d.ts +2 -0
- package/dist/modules/mcp/tools/workflow-builder/credential-validation.d.ts +15 -0
- package/dist/modules/mcp/tools/workflow-builder/credential-validation.js +91 -0
- package/dist/modules/mcp/tools/workflow-builder/credential-validation.js.map +1 -0
- package/dist/modules/mcp/tools/workflow-builder/mcp-instructions.js +1 -1
- package/dist/modules/mcp/tools/workflow-builder/update-workflow.tool.d.ts +228 -3
- package/dist/modules/mcp/tools/workflow-builder/update-workflow.tool.js +74 -60
- package/dist/modules/mcp/tools/workflow-builder/update-workflow.tool.js.map +1 -1
- package/dist/modules/mcp/tools/workflow-builder/workflow-operations.d.ts +251 -0
- package/dist/modules/mcp/tools/workflow-builder/workflow-operations.js +447 -0
- package/dist/modules/mcp/tools/workflow-builder/workflow-operations.js.map +1 -0
- package/dist/modules/mcp-registry/mcp-registry-node-loader.d.ts +4 -3
- package/dist/modules/mcp-registry/mcp-registry-node-loader.js +6 -3
- package/dist/modules/mcp-registry/mcp-registry-node-loader.js.map +1 -1
- package/dist/modules/mcp-registry/mcp-registry-test.controller.d.ts +12 -0
- package/dist/modules/mcp-registry/mcp-registry-test.controller.js +49 -0
- package/dist/modules/mcp-registry/mcp-registry-test.controller.js.map +1 -0
- package/dist/modules/mcp-registry/mcp-registry.module.d.ts +2 -0
- package/dist/modules/mcp-registry/mcp-registry.module.js +12 -2
- package/dist/modules/mcp-registry/mcp-registry.module.js.map +1 -1
- package/dist/modules/mcp-registry/node-description-transform.js +16 -2
- package/dist/modules/mcp-registry/node-description-transform.js.map +1 -1
- package/dist/modules/mcp-registry/registry/mcp-registry-api.client.d.ts +8 -0
- package/dist/modules/mcp-registry/registry/mcp-registry-api.client.js +58 -0
- package/dist/modules/mcp-registry/registry/mcp-registry-api.client.js.map +1 -0
- package/dist/modules/mcp-registry/registry/mcp-registry-server.entity.d.ts +36 -0
- package/dist/modules/mcp-registry/registry/mcp-registry-server.entity.js +46 -0
- package/dist/modules/mcp-registry/registry/mcp-registry-server.entity.js.map +1 -0
- package/dist/modules/mcp-registry/registry/mcp-registry-server.repository.d.ts +5 -0
- package/dist/modules/mcp-registry/registry/mcp-registry-server.repository.js +26 -0
- package/dist/modules/mcp-registry/registry/mcp-registry-server.repository.js.map +1 -0
- package/dist/modules/mcp-registry/registry/mcp-registry.service.d.ts +37 -4
- package/dist/modules/mcp-registry/registry/mcp-registry.service.js +196 -12
- package/dist/modules/mcp-registry/registry/mcp-registry.service.js.map +1 -1
- package/dist/modules/mcp-registry/registry/mcp-registry.types.d.ts +9 -1
- package/dist/modules/mcp-registry/registry/mcp-registry.types.js +29 -0
- package/dist/modules/mcp-registry/registry/mcp-registry.types.js.map +1 -1
- package/dist/modules/mcp-registry/registry/mock-servers.js +2 -0
- package/dist/modules/mcp-registry/registry/mock-servers.js.map +1 -1
- package/dist/modules/otel/execution-level-tracer.js +4 -2
- package/dist/modules/otel/execution-level-tracer.js.map +1 -1
- package/dist/modules/otel/otel.constants.d.ts +1 -0
- package/dist/modules/otel/otel.constants.js +1 -0
- package/dist/modules/otel/otel.constants.js.map +1 -1
- package/dist/modules/otel/otel.module.d.ts +3 -0
- package/dist/modules/otel/otel.module.js +5 -0
- package/dist/modules/otel/otel.module.js.map +1 -1
- package/dist/modules/redaction/executions/execution-redaction.service.js +8 -3
- package/dist/modules/redaction/executions/execution-redaction.service.js.map +1 -1
- package/dist/modules/redaction/instance-redaction-enforcement.service.d.ts +14 -0
- package/dist/modules/redaction/instance-redaction-enforcement.service.js +91 -0
- package/dist/modules/redaction/instance-redaction-enforcement.service.js.map +1 -0
- package/dist/modules/redaction/redaction-enforcement.feature-flag.d.ts +2 -0
- package/dist/modules/redaction/redaction-enforcement.feature-flag.js +9 -0
- package/dist/modules/redaction/redaction-enforcement.feature-flag.js.map +1 -0
- package/dist/modules/redaction/redaction-enforcement.service.d.ts +8 -0
- package/dist/modules/redaction/redaction-enforcement.service.js +38 -0
- package/dist/modules/redaction/redaction-enforcement.service.js.map +1 -0
- package/dist/modules/redaction/redaction.config.d.ts +3 -0
- package/dist/modules/redaction/redaction.config.js +27 -0
- package/dist/modules/redaction/redaction.config.js.map +1 -0
- package/dist/modules/source-control.ee/source-control-import.service.ee.d.ts +3 -1
- package/dist/modules/source-control.ee/source-control-import.service.ee.js +14 -6
- 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 +2 -2
- package/dist/modules/source-control.ee/source-control.service.ee.d.ts +1 -1
- package/dist/modules/workflow-index/workflow-index.service.js.map +1 -1
- package/dist/oauth/oauth.service.js +1 -0
- package/dist/oauth/oauth.service.js.map +1 -1
- package/dist/posthog/index.d.ts +0 -1
- package/dist/posthog/index.js +2 -10
- package/dist/posthog/index.js.map +1 -1
- package/dist/public-api/v1/handlers/workflows/workflows.handler.js +2 -1
- package/dist/public-api/v1/handlers/workflows/workflows.handler.js.map +1 -1
- package/dist/scaling/constants.d.ts +2 -2
- package/dist/scaling/pubsub/pubsub.event-map.d.ts +6 -3
- package/dist/scaling/pubsub/pubsub.types.d.ts +3 -1
- package/dist/scaling/scaling.service.js +3 -2
- package/dist/scaling/scaling.service.js.map +1 -1
- package/dist/server.d.ts +1 -0
- package/dist/server.js +1 -0
- package/dist/server.js.map +1 -1
- package/dist/services/export.service.d.ts +6 -1
- package/dist/services/export.service.js +97 -1
- package/dist/services/export.service.js.map +1 -1
- package/dist/services/frontend.service.js +3 -1
- package/dist/services/frontend.service.js.map +1 -1
- package/dist/services/import.service.d.ts +2 -1
- package/dist/services/import.service.js +70 -22
- package/dist/services/import.service.js.map +1 -1
- package/dist/telemetry/index.d.ts +13 -1
- package/dist/telemetry/index.js +54 -18
- package/dist/telemetry/index.js.map +1 -1
- package/dist/{modules/community-packages → utils}/strapi-utils.js +2 -2
- package/dist/utils/strapi-utils.js.map +1 -0
- package/dist/workflows/workflow-history/workflow-history.controller.d.ts +9 -0
- package/dist/workflows/workflow-history/workflow-history.controller.js +17 -0
- package/dist/workflows/workflow-history/workflow-history.controller.js.map +1 -1
- package/dist/workflows/workflow-history/workflow-history.service.d.ts +16 -2
- package/dist/workflows/workflow-history/workflow-history.service.js +55 -1
- package/dist/workflows/workflow-history/workflow-history.service.js.map +1 -1
- package/dist/workflows/workflow.service.d.ts +3 -1
- package/dist/workflows/workflow.service.js +6 -2
- package/dist/workflows/workflow.service.js.map +1 -1
- package/package.json +36 -36
- package/dist/modules/agents/json-config/agent-json-config.d.ts +0 -1022
- package/dist/modules/agents/json-config/agent-json-config.js +0 -128
- package/dist/modules/agents/json-config/agent-json-config.js.map +0 -1
- package/dist/modules/agents/json-config/integration-config.d.ts +0 -61
- package/dist/modules/agents/json-config/integration-config.js +0 -33
- package/dist/modules/agents/json-config/integration-config.js.map +0 -1
- package/dist/modules/community-packages/strapi-utils.js.map +0 -1
- package/dist/modules/mcp-registry/mcp-registry-node-loader.test.d.ts +0 -1
- package/dist/modules/mcp-registry/mcp-registry-node-loader.test.js +0 -244
- package/dist/modules/mcp-registry/mcp-registry-node-loader.test.js.map +0 -1
- package/dist/modules/mcp-registry/node-description-transform.test.d.ts +0 -1
- package/dist/modules/mcp-registry/node-description-transform.test.js +0 -286
- package/dist/modules/mcp-registry/node-description-transform.test.js.map +0 -1
- package/dist/modules/mcp-registry/registry/mcp-registry.service.test.d.ts +0 -1
- package/dist/modules/mcp-registry/registry/mcp-registry.service.test.js +0 -41
- package/dist/modules/mcp-registry/registry/mcp-registry.service.test.js.map +0 -1
- /package/dist/{modules/community-packages → utils}/strapi-utils.d.ts +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agents-builder-model-recommendations.js","sourceRoot":"","sources":["../../../../src/modules/agents/builder/agents-builder-model-recommendations.ts"],"names":[],"mappings":";;AA8DA,4EA4BC;AAiBD,wEAaC;AAxHD,wCAAyF;AAEzF,MAAM,qCAAqC,GAAG,IAAI,CAAC;AACnD,MAAM,mCAAmC,GAAG,CAAC,CAAC;AAO9C,MAAM,qBAAqB,GAA0B;IACpD,EAAE,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,EAAE;IACvC,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE;IACjC,EAAE,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE;IACnC,EAAE,EAAE,EAAE,KAAK,E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CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,gCAAgC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;SAC/E,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC;SACjB,OAAO,CAAC,GAAG,EAAE;QACb,2BAA2B,GAAG,SAAS,CAAC;IACzC,CAAC,CAAC,CAAC;IAEJ,MAAM,OAAO,GAAG,MAAM,2BAA2B,CAAC;IAClD,IAAI,OAAO;QAAE,2BAA2B,GAAG,OAAO,CAAC;IACnD,OAAO,OAAO,CAAC;AAChB,CAAC"}
|
|
@@ -1,27 +1,28 @@
|
|
|
1
1
|
export declare function getAgentStateSection(configJson: string, configHash: string | null, configUpdatedAt: string | null, toolList: string): string;
|
|
2
2
|
export declare const TOOL_TYPES_SECTION = "## Tool types\n\n### Workflow tools (preferred)\nReference existing n8n workflows by name. Call list_workflows to see available ones.\n```json\n{ \"type\": \"workflow\", \"workflow\": \"Send Welcome Email\" }\n```\n\n### Node tools\nRun a single n8n node as a tool. Use search_nodes to find available nodes, then\nget_node_types to see their parameters. Add the node to the config with nodeType,\nnodeTypeVersion, and nodeParameters.\n\nget_node_types return typescript references, but you must supply json fields in node config\n\nFlow: search_nodes \u2192 get_node_types \u2192 ask_credential (per slot) \u2192 write/update config\n\n```json\n{\n \"type\": \"node\",\n \"name\": \"http_request\",\n \"description\": \"Make an HTTP request to any URL\",\n \"node\": {\n \"nodeType\": \"n8n-nodes-base.httpRequestTool\",\n \"nodeTypeVersion\": 4,\n \"nodeParameters\": {\n \"method\": \"GET\",\n \"url\": \"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('url', 'The URL to request', 'string') }}\"\n }\n }\n}\n```\n\nRules for node tools:\n- `nodeType` and `nodeTypeVersion` come from get_node_types results. Use the tool node ID from search_nodes (usually ending in `Tool`, e.g. `n8n-nodes-base.httpRequestTool`), not the base node ID.\n- `nodeParameters` sets fixed parameters (resource, operation, etc.). For any value the AI should choose at runtime, use `$fromAI`: `={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('key', 'description', 'type') }}`.\n- Match the `$fromAI` type to the node parameter type from get_node_types: use `string`, `number`, `boolean`, or `json`.\n- Do NOT pipe AI-chosen node-tool fields through `$json`; use `$fromAI` for those fields instead.\n- Do NOT include `inputSchema` for node tools. It is derived automatically from the `$fromAI` expressions in `nodeParameters`.\n- Do NOT include `toolDescription` in `nodeParameters`. Use the top-level tool `description` only.\n- For resource locator parameters (objects with `\"__rl\": true`), keep the locator shape and put the `$fromAI` expression in its `value` field.\n- For every credential slot the node requires, you MUST first call ask_credential. If it returns { credentialId, credentialName }, use the returned values in `credentials[slotName]`. Never copy ids from list_credentials directly; never invent ids; never write empty credential values.\n- Call ask_credential ONCE per slot, before the write_config / patch_config that introduces the node tool. If it returns { skipped: true }, DO NOT abort and DO NOT refuse to add the tool. Continue adding the node tool, omit that credential slot entirely, and tell the user they can configure the credential later.\n- Use search_nodes first, never guess node type names\n\n### Custom tools\nWrite TypeScript using the Tool builder, validate via build_custom_tool, then register the returned id.\n```json\n{ \"type\": \"custom\", \"id\": \"tool_7fGh2Lm9Qx0Ba8Ts\" }\n```\n\nThe tool code must follow this pattern:\n```typescript\nimport { Tool } from '@n8n/agents';\nimport { z } from 'zod';\n\nexport default new Tool('tool_name')\n .description('What the tool does')\n .input(z.object({ query: z.string() }))\n .handler(async ({ query }) => {\n return { result: query.toUpperCase() };\n });\n```\n\nCustom tools run inside a V8 isolate sandbox. Treat every handler as a pure\nfunction: take `input`, compute, return a JSON-serialisable value.\n\n- Must use `export default new Tool(...)` pattern.\n- Imports at the top of the file: only '@n8n/agents' and 'zod'. No other\n modules resolve.\n- No I/O of any kind \u2014 no network, no filesystem, no waiting for wall-clock\n time. Host globals like `crypto`, `process`, `Buffer`, `fetch`, `atob`,\n `XMLHttpRequest` are not present and will throw `ReferenceError` at runtime.\n- Some web APIs appear defined but are no-op stubs (`setTimeout` fires\n synchronously, `console.log` goes nowhere, `TextEncoder.encode` returns\n its input unchanged). Don't rely on their real behaviour.\n- Free to use: `Math`, `Date`, `JSON`, `RegExp`, `Array`, `Object`, `Map`,\n `Set`, `Promise`, typed arrays, and any method on values you already have.\n- The handler is async and receives `(input, ctx)`.\n - `input` is already validated against your zod schema.\n - `ctx.suspend(payload)` pauses the tool until the caller resumes it \u2014\n use it for human-in-the-loop flows that need to ask the user something.\n Otherwise ignore `ctx`.\n- Return a JSON-serialisable value. Execution is capped at 5 seconds and\n ~32 MB of memory.\n- If something fails at runtime, the error message is handed back to you on\n the next turn \u2014 fix the code and try again.\n- Do NOT call `.build()` \u2014 the engine handles it.\n\n### Skills\nUse skills for reusable instructions, playbooks, style guides, policies, or\ndomain knowledge the agent should follow. Call create_skill with the skill\n`name`, `description`, and `body`; the tool returns the generated skill\n`id`. Skill descriptions should describe the task/situation that should\ntrigger loading the skill. create_skill stores the skill body only; it does not\nattach the skill to the agent config. After create_skill, call read_config and\nuse patch_config (or write_config) to add\n`{ \"type\": \"skill\", \"id\": \"<returned id>\" }` to `skills`.";
|
|
3
|
-
export declare const INTERACTIVE_TOOLS_SECTION = "## Interactive tools (user-facing)\n\nThese tools render a UI card in the chat and SUSPEND your run until the user\nresponds. Treat the resume value as authoritative \u2014 it is the user's choice and\nmust be persisted into the config exactly as returned.\n\n### ask_llm\nWhen: the user must choose a model/credential because the request is ambiguous,\nresolve_llm returned an ambiguous/missing credential result, or the user asks\nto pick/change/use a different model. Call AT MOST ONCE per build turn unless\nthe user changes their mind.\nNever ask the user in plain text to choose, confirm, configure, or change the\nagent main LLM, provider, model, or main LLM credential. If the user needs to\nmake that choice, call ask_llm so the picker card is shown.\nReturns: { provider, model, credentialId, credentialName }.\nAfter: set `model = \"{provider}/{model}\"` and `credential =
|
|
4
|
-
export declare const LLM_RESOLUTION_SECTION = "## LLM model and credential resolution\n\nUse resolve_llm before ask_llm whenever the user's request contains enough\ninformation to resolve the main LLM without a picker.\n\n### resolve_llm\nWhen: the user explicitly names a provider/model, or a fresh agent needs
|
|
3
|
+
export declare const INTERACTIVE_TOOLS_SECTION = "## Interactive tools (user-facing)\n\nThese tools render a UI card in the chat and SUSPEND your run until the user\nresponds. Treat the resume value as authoritative \u2014 it is the user's choice and\nmust be persisted into the config exactly as returned.\n\n### ask_llm\nWhen: the user must choose a model/credential because the request is ambiguous,\nresolve_llm returned an ambiguous/missing credential result, or the user asks\nto pick/change/use a different model. Call AT MOST ONCE per build turn unless\nthe user changes their mind.\nNever ask the user in plain text to choose, confirm, configure, or change the\nagent main LLM, provider, model, or main LLM credential. If the user needs to\nmake that choice, call ask_llm so the picker card is shown.\nReturns: { provider, model, credentialId, credentialName }.\nAfter: set `model = \"{provider}/{model}\"` and `credential = credentialId`\nvia write_config or patch_config.\n\n### ask_credential\nWhen: about to add (or change) a node tool whose node requires credentials.\nCall ONCE per slot, BEFORE write_config / patch_config that introduces the\ntool. Pass `credentialType` (a single credential type name picked from the\nslot's accepted types in get_node_types \u2014 when the slot accepts multiple,\nchoose the most appropriate one, typically OAuth or the first listed) and\n`purpose` (one short sentence, e.g. \"Slack credential for posting messages\").\nReturns: { credentialId, credentialName } or { skipped: true }.\nAfter (success): set `tools[i].node.credentials.<slot> = { id: credentialId,\nname: credentialName }`. After (skipped): DO NOT abort and DO NOT refuse to\nadd the tool. Still add the tool, omit that credential slot, and tell the user\nthey can configure the credential later.\n\n### ask_question\nWhen: you would otherwise ask a clarifying question whose answer is one (or\nmore) of a known list. Examples: pick a Slack channel from a list,\nread-only vs read-write, which workflow to wrap.\nInputs: `question`, `options[{label,value,description?}]`, `allowMultiple?`.\nReturns: { values: string[] }. Values are selected option values unless the\nuser types into the card's Other field, in which case the freeform text appears\nin `values`.\n\n### Rules\n- Never call two interactive tools in parallel. The run suspends on the first.\n- Never re-ask a question the user already answered in this thread.\n- After resume, continue with the next concrete action (write_config /\n patch_config / next ask_*). Do not narrate the answer back to the user.\n- list_credentials remains available but is for read-only inspection only.\n Never copy ids from it into the config.";
|
|
4
|
+
export declare const LLM_RESOLUTION_SECTION = "## LLM model and credential resolution\n\nUse resolve_llm before ask_llm whenever the user's request contains enough\ninformation to resolve the main LLM without a picker.\n\n### resolve_llm\nWhen: the user explicitly names a provider/model, or a fresh agent needs its\nmain LLM set and the user did not ask to choose.\n\nInputs: optional `provider`, optional `model`.\n- If the user says \"Anthropic via OpenRouter\", pass\n `provider: \"openrouter\"` and omit `model` unless they named a concrete\n OpenRouter model id.\n- If the user names a concrete model, pass `model` without the selected\n provider prefix. For OpenRouter, use the routed model id, e.g.\n `\"anthropic/claude-sonnet-4.6\"`.\n\nOn `{ ok: true, provider, model, credentialId, credentialName }`: set\n`model = \"{provider}/{model}\"` and `credential = credentialId`. The\nreturned `model` is the canonical id resolved against the provider's live\nlist, so use it as-is \u2014 do not transform or \"correct\" it.\n\nOn `ok: false`: your NEXT action is another tool call \u2014 never reply with\nplain text asking the user to clarify. Do not guess credential names from\nlist_credentials. Pick the action by reason:\n- `missing_credential` / `ambiguous_credential` / `ambiguous_provider_or_credential` \u2192\n call ask_llm (the picker handles credential selection).\n- `unknown_model` \u2192 the response includes `availableModels: [{ name, value }]`\n (or a narrowed candidate list when the user's hint matched several). If\n one entry plausibly matches what the user named, re-call resolve_llm\n with `model` set to that exact `value`. Otherwise call ask_llm.\n- `model_lookup_failed` (the live list could not be fetched, e.g. invalid\n credentials) \u2192 call ask_llm.\n- `unsupported_provider` \u2192 call ask_llm. Do not list the supported\n providers back to the user; the picker UI handles that.\n\nRules:\n- Explicit provider/model request \u2192 resolve_llm first, not ask_llm.\n- User does not know which model to use and the Recommended LLM models section\n is present \u2192 choose from that section, then pass that provider/model to\n resolve_llm. Prefer a provider the user already has credentials for.\n- If the Recommended LLM models section is absent, do not recommend or name\n current, best, latest, or fallback model IDs from memory. Call ask_llm when\n the user needs model guidance or choice.\n- User asks to pick/change/use a different model \u2192 ask_llm.\n- User needs to choose/confirm/configure a model or main LLM credential \u2192\n ask_llm, never a plain-text question.\n- No provider specified and resolve_llm reports ambiguity \u2192 ask_llm.";
|
|
5
5
|
export declare const N8N_EXPRESSIONS_SECTION = "## n8n expressions\n\nNode tool parameters inside `nodeParameters` can use n8n expressions.\nFor node tools, prefer `$fromAI` whenever the agent should decide a value at runtime.\n\n- `={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('fieldName', 'What value to provide', 'string') }}` \u2014 let the AI provide a string\n- `={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('count', 'How many items', 'number') }}` \u2014 let the AI provide a number\n- `={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('enabled', 'Whether to enable this option', 'boolean') }}` \u2014 let the AI provide a boolean\n- `={{ $now.toISO() }}` \u2014 current date/time (Luxon DateTime)\n- `={{ $today }}` \u2014 start of today (Luxon DateTime)\n\nAlways wrap expressions in `={{ }}`. Never use bare JS variables outside the braces.";
|
|
6
6
|
export declare const PROVIDER_TOOLS_SECTION = "## Provider tools\n\nBuilt-in capabilities offered by the model provider. Pick the entry that\nmatches the agent's configured `model` provider \u2014 Anthropic tools work with\n`anthropic/*` models, OpenAI tools work with `openai/*` models.\n\nAnthropic web search:\n```json\n{ \"providerTools\": { \"anthropic.web_search\": { \"maxUses\": 5 } } }\n```\n\nOpenAI web search (requires a Responses-API-compatible model, e.g. `openai/gpt-4o`):\n```json\n{ \"providerTools\": { \"openai.web_search\": { \"searchContextSize\": \"medium\" } } }\n```\n\nOpenAI image generation:\n```json\n{ \"providerTools\": { \"openai.image_generation\": {} } }\n```";
|
|
7
|
-
export declare
|
|
7
|
+
export declare function getConversationModeSection(agentPreviewPath: string): string;
|
|
8
8
|
export declare const RESEARCH_SECTION = "## Research\n\nYou have access to Anthropic's web search tool. Use it when you encounter an\nAPI, service, product, or concept you don't fully understand. Better to search\nonce and be correct than to guess at endpoint shapes, auth methods, or node\nparameters.\n\nGood reasons to search:\n- The user named an API or service you're unsure about\n- You're unsure of an endpoint's URL shape, auth method, or request format\n- The user referenced a recent or external product, standard, or spec\n\nDon't search for things you already know (n8n internals, common JS/TS\npatterns, widely-known public APIs you've configured many times).";
|
|
9
|
-
export declare const MEMORY_PRESETS_SECTION = "## Memory\n\nUse n8n session-scoped memory only. It keeps recent conversation context and\
|
|
10
|
-
export declare const INTEGRATIONS_SECTION = "## Integrations (triggers)\n\nThe `integrations` array on the agent config defines how the agent gets triggered.\nTwo kinds:\n\n1. **Schedule trigger** \u2014 runs the agent on a cron schedule. One per agent.\n Shape:\n ```json\n { \"type\": \"schedule\", \"active\": false, \"cronExpression\": \"0 9 * * *\", \"wakeUpPrompt\": \"Daily standup ping\" }\n ```\n - `active` stays false until the agent is published. The schedule only fires once `active: true` AND the agent has a published version.\n - `cronExpression` is standard 5-field cron.\n - `wakeUpPrompt` is the message the agent receives when it fires.\n\n2. **Chat integrations** \u2014 connect the agent to a messaging platform. Multiple allowed.\n Shape:\n ```json\n { \"type\": \"slack\", \"credentialId\": \"<id>\"
|
|
11
|
-
export declare const WRITE_CONFIG_SECTION = "## write_config \u2014 full replace\n\nBefore calling write_config, call `read_config` and build the full replacement\nfrom the returned `config`. Call write_config with the complete agent\nconfiguration as a JSON string and the `baseConfigHash` from that same\n`read_config` result:\n```json\n{\n \"baseConfigHash\": \"<configHash from read_config>\",\n \"json\": \"{ \\\"name\\\": \\\"My Agent\\\", \\\"model\\\": \\\"
|
|
12
|
-
export declare const PATCH_CONFIG_SECTION = "## patch_config \u2014 RFC 6902 JSON Patch\n\nBefore calling patch_config, call `read_config` and derive the patch from the\nreturned `config`. Send an array of RFC 6902 patch operations as a JSON string\nplus the `baseConfigHash` from that same `read_config` result. Each operation\ntargets a field by its JSON Pointer path.\n\n| op | description |\n|---------|------------------------------------------|\n| add | Add or set a value at path |\n| remove | Remove the value at path |\n| replace | Replace the value at path |\n| move | Move value from `from` path to `path` |\n| copy | Copy value from `from` path to `path` |\n| test | Assert a value at path (aborts if wrong) |\n\nExamples:\n```json\n{\n \"baseConfigHash\": \"<configHash from read_config>\",\n \"operations\": \"[{ \\\"op\\\": \\\"replace\\\", \\\"path\\\": \\\"/model\\\", \\\"value\\\": \\\"
|
|
9
|
+
export declare const MEMORY_PRESETS_SECTION = "## Memory\n\nUse n8n session-scoped memory only. It keeps recent conversation context and\nan observation log for the current chat session. The agent reads the rendered\nobservation log directly as private context.\n\nShape:\n```json\n{ \"enabled\": true, \"storage\": \"n8n\", \"lastMessages\": 50, \"observationalMemory\": { \"renderTokenBudget\": 4500 } }\n```\n\nRules:\n- Set `storage` to \"n8n\".\n- `lastMessages` default: 50.\n- Observation-log memory is enabled by default when memory is enabled.\n- Keep `observationalMemory` optional; use it only for explicit memory tuning.\n- Supported tuning fields: `enabled`, `observerThresholdTokens`, `reflectorThresholdTokens`, `renderTokenBudget`, `observationLogTailLimit`, and `lockTtlMs`.";
|
|
10
|
+
export declare const INTEGRATIONS_SECTION = "## Integrations (triggers)\n\nThe `integrations` array on the agent config defines how the agent gets triggered.\nTwo kinds:\n\n1. **Schedule trigger** \u2014 runs the agent on a cron schedule. One per agent.\n Shape:\n ```json\n { \"type\": \"schedule\", \"active\": false, \"cronExpression\": \"0 9 * * *\", \"wakeUpPrompt\": \"Daily standup ping\" }\n ```\n - `active` stays false until the agent is published. The schedule only fires once `active: true` AND the agent has a published version.\n - `cronExpression` is standard 5-field cron.\n - `wakeUpPrompt` is the message the agent receives when it fires.\n\n2. **Chat integrations** \u2014 connect the agent to a messaging platform. Multiple allowed.\n Shape:\n ```json\n { \"type\": \"slack\", \"credentialId\": \"<id>\" }\n ```\n\n### Workflow for adding integrations\n\n1. Call `list_integration_types` to discover available platforms and their `credentialTypes`.\n2. For chat integrations: pick **one** entry from the `credentialTypes` array returned by `list_integration_types` (prefer the OAuth variant \u2014 e.g. `slackOAuth2Api` over `slackApi`) and pass it to `ask_credential` as the singular `credentialType` arg. It returns `{ credentialId, credentialName }`.\n3. Use `patch_config` (or `write_config`) to add an entry to `integrations`. For chat integrations, only persist `type` and `credentialId`. For schedule, write the cron expression directly.\n\nNever invent credential IDs or names. Always go through `ask_credential`.";
|
|
11
|
+
export declare const WRITE_CONFIG_SECTION = "## write_config \u2014 full replace\n\nBefore calling write_config, call `read_config` and build the full replacement\nfrom the returned `config`. Call write_config with the complete agent\nconfiguration as a JSON string and the `baseConfigHash` from that same\n`read_config` result:\n```json\n{\n \"baseConfigHash\": \"<configHash from read_config>\",\n \"json\": \"{ \\\"name\\\": \\\"My Agent\\\", \\\"model\\\": \\\"{provider}/{model}\\\", \\\"credential\\\": \\\"<credentialId>\\\", \\\"instructions\\\": \\\"You are a helpful assistant.\\\", \\\"memory\\\": { \\\"enabled\\\": true, \\\"storage\\\": \\\"n8n\\\", \\\"lastMessages\\\": 50 } }\"\n}\n```\n\nDo not use the prompt's config snapshot or your remembered state as the base\nfor write_config. The only retry exception is when write_config returns\n`stage: \"stale\"`; in that case, use the returned `config` and `configHash`\nto retry once. Do not retry from memory.";
|
|
12
|
+
export declare const PATCH_CONFIG_SECTION = "## patch_config \u2014 RFC 6902 JSON Patch\n\nBefore calling patch_config, call `read_config` and derive the patch from the\nreturned `config`. Send an array of RFC 6902 patch operations as a JSON string\nplus the `baseConfigHash` from that same `read_config` result. Each operation\ntargets a field by its JSON Pointer path.\n\n| op | description |\n|---------|------------------------------------------|\n| add | Add or set a value at path |\n| remove | Remove the value at path |\n| replace | Replace the value at path |\n| move | Move value from `from` path to `path` |\n| copy | Copy value from `from` path to `path` |\n| test | Assert a value at path (aborts if wrong) |\n\nExamples:\n```json\n{\n \"baseConfigHash\": \"<configHash from read_config>\",\n \"operations\": \"[{ \\\"op\\\": \\\"replace\\\", \\\"path\\\": \\\"/model\\\", \\\"value\\\": \\\"{provider}/{model}\\\" }, { \\\"op\\\": \\\"replace\\\", \\\"path\\\": \\\"/credential\\\", \\\"value\\\": \\\"<credentialId>\\\" }]\"\n}\n```\n```json\n{\n \"baseConfigHash\": \"<configHash from read_config>\",\n \"operations\": \"[{ \\\"op\\\": \\\"replace\\\", \\\"path\\\": \\\"/memory/lastMessages\\\", \\\"value\\\": 50 }, { \\\"op\\\": \\\"add\\\", \\\"path\\\": \\\"/tools/-\\\", \\\"value\\\": { \\\"type\\\": \\\"workflow\\\", \\\"workflow\\\": \\\"Send Email\\\" } }]\"\n}\n```\n```json\n{\n \"baseConfigHash\": \"<configHash from read_config>\",\n \"operations\": \"[{ \\\"op\\\": \\\"remove\\\", \\\"path\\\": \\\"/description\\\" }]\"\n}\n```\n\nPath syntax: `/field` for top-level fields, `/nested/field` for nested, `/array/0` for index, `/array/-` to append.\n\nWhen attaching a skill, append to `/skills/-` if `skills` exists; otherwise\nadd `/skills` with an array containing the skill ref.\n\nIf patch_config returns `stage: \"stale\"`, use the returned `config` and\n`configHash` to retry once. Do not retry from memory.\n\nOn error, the response includes a `stage` field: \"parse\" (invalid JSON), \"stale\" (config changed), \"patch\" (operation failed), or \"schema\" (config fails validation).";
|
|
13
13
|
export declare const READ_CONFIG_SECTION = "## read_config \u2014 mandatory freshness check\n\nCall `read_config` before every `write_config` or `patch_config` call. Call\nit after any interactive tool returns and immediately before composing the\nwrite or patch payload.\n\nUse the returned `config` as the only source of truth and pass the returned\n`configHash` as `baseConfigHash`. Do not patch from memory, the conversation,\nor the prompt snapshot. Do not skip this just because the prompt already\ncontains a `configHash`.\n\nIf a write_config or patch_config call returns `stage: \"stale\"`, retry once\nfrom the returned `config` and `configHash`. For any later independent config\nchange, call `read_config` again.\n\n`create_skill` stores a skill body but does not attach it. To make the agent\nuse the skill, call `read_config` after create_skill and then attach the\nreturned id through `patch_config` or `write_config`.";
|
|
14
|
-
export declare const WORKFLOW_SECTION = "## Workflow\n\n1. If the agent has no `instructions` and `credential` yet (fresh agent), FIRST call resolve_llm\n when the user specified a provider/model or
|
|
15
|
-
export declare const FEW_SHOT_FLOWS_SECTION = "## Example flows\n\n### New agent (no instructions yet), user says \"Build me a Slack triage agent\"\n1. resolve_llm({})\n \u2192 { ok: true, provider: \"anthropic\", model: \"claude-sonnet-4-5\",\n credentialId: \"abc\", credentialName: \"My Anthropic\" }\n2. search_nodes({ query: \"slack\" }) \u2192 ...\n3. get_node_types({ nodeType: \"n8n-nodes-base.slackTool\" }) \u2192 ...\n4. ask_credential({ purpose: \"Slack workspace to read/post messages\",\n nodeType: \"n8n-nodes-base.slackTool\", credentialType: \"slackApi\",\n slot: \"slackApi\" })\n \u2192 { credentialId: \"xyz\", credentialName: \"Acme Slack\" }\n5. read_config() \u2192 { configHash: \"hash1\", config: { ... } }\n6. write_config({ baseConfigHash: \"hash1\", json: \"{ ...complete config with model, credential, instructions, and Slack tool... }\" })\n7. Reply: \"Done.\"\n\n### New agent, user says \"Use Anthropic via OpenRouter\"\n1. resolve_llm({ provider: \"openrouter\" })\n \u2192 { ok: true, provider: \"openrouter\",\n model: \"anthropic/claude-sonnet-4.6\",\n credentialId: \"or1\", credentialName: \"OpenRouter\" }\n2. read_config() \u2192 { configHash: \"hash1\", config: { ... } }\n3. write_config({ baseConfigHash: \"hash1\", json: \"{ ...complete config with model: \\\"openrouter/anthropic/claude-sonnet-4.6\\\", credential: \\\"
|
|
14
|
+
export declare const WORKFLOW_SECTION = "## Workflow\n\n1. If the agent has no `instructions` and `credential` yet (fresh agent), FIRST call resolve_llm\n when the user specified a provider/model or left model choice to the builder. If\n resolve_llm reports ambiguity, or the user asks to choose/change/use a\n different model, call ask_llm. Then call read_config and write_config\n with the chosen `model` and `credential` plus a draft `instructions`.\n Never ask for the main LLM/model/credential in plain text; call ask_llm so\n the picker card is shown.\n2. Use ask_question whenever you have a clarifying question with discrete\n options (e.g. \"Which Slack channel?\" \u2192 list channels, \"Read-only or\n read-write?\"). Never put the question in plain text if options are known.\n3. Before adding any node tool that needs credentials, call ask_credential for\n each slot.\n4. PREFER attaching existing workflows or nodes as tools over custom tools.\n5. Use create_skill for reusable instruction bundles, then read_config and\n patch_config to add the returned skill id to `skills`.\n6. Before every write_config or patch_config, call read_config in the same turn\n and use the returned configHash as baseConfigHash.\n7. Use patch_config for targeted changes; write_config to replace the full config.";
|
|
15
|
+
export declare const FEW_SHOT_FLOWS_SECTION = "## Example flows\n\n### New agent (no instructions yet), user says \"Build me a Slack triage agent\"\n1. resolve_llm({})\n \u2192 { ok: true, provider: \"anthropic\", model: \"claude-sonnet-4-5\",\n credentialId: \"abc\", credentialName: \"My Anthropic\" }\n2. search_nodes({ query: \"slack\" }) \u2192 ...\n3. get_node_types({ nodeType: \"n8n-nodes-base.slackTool\" }) \u2192 ...\n4. ask_credential({ purpose: \"Slack workspace to read/post messages\",\n nodeType: \"n8n-nodes-base.slackTool\", credentialType: \"slackApi\",\n slot: \"slackApi\" })\n \u2192 { credentialId: \"xyz\", credentialName: \"Acme Slack\" }\n5. read_config() \u2192 { configHash: \"hash1\", config: { ... } }\n6. write_config({ baseConfigHash: \"hash1\", json: \"{ ...complete config with model, credential, instructions, and Slack tool... }\" })\n7. Reply: \"Done.\"\n\n### New agent, user says \"Use Anthropic via OpenRouter\"\n1. resolve_llm({ provider: \"openrouter\" })\n \u2192 { ok: true, provider: \"openrouter\",\n model: \"anthropic/claude-sonnet-4.6\",\n credentialId: \"or1\", credentialName: \"OpenRouter\" }\n2. read_config() \u2192 { configHash: \"hash1\", config: { ... } }\n3. write_config({ baseConfigHash: \"hash1\", json: \"{ ...complete config with model: \\\"openrouter/anthropic/claude-sonnet-4.6\\\", credential: \\\"or1\\\", and the requested instructions... }\" })\n\n### User says \"Use a different OpenRouter model\"\n1. ask_llm({ purpose: \"Choose a different OpenRouter model\" })\n2. read_config() \u2192 { configHash: \"hash1\", config: { ... } }\n3. patch_config with `{ baseConfigHash: \"hash1\", operations: \"[{ \\\"op\\\": \\\"replace\\\", \\\"path\\\": \\\"/model\\\", \\\"value\\\": \\\"{provider}/{model}\\\" }, { \\\"op\\\": \\\"replace\\\", \\\"path\\\": \\\"/credential\\\", \\\"value\\\": \\\"<credentialId>\\\" }]\" }`.\n\n### Adding a new node tool to an existing agent\n1. (skip ask_llm \u2014 already set)\n2. search_nodes / get_node_types\n3. ask_credential per required slot\n4. read_config() \u2192 { configHash: \"hash1\", config: { ... } }\n5. patch_config with `{ baseConfigHash: \"hash1\", operations: \"[{ op: \\\"add\\\", path: \\\"/tools/-\\\", value: { ... credentials: {...} } }]\" }`\n\n### Adding a node tool when credential setup is skipped\n1. search_nodes / get_node_types\n2. ask_credential({ purpose: \"Salesforce credential for creating leads\",\n nodeType: \"n8n-nodes-base.salesforceTool\", credentialType: \"salesforceOAuth2Api\",\n slot: \"salesforceOAuth2Api\" })\n \u2192 { skipped: true }\n3. read_config() \u2192 { configHash: \"hash1\", config: { ... } }\n4. patch_config with `{ baseConfigHash: \"hash1\", operations: \"[{ op: \\\"add\\\", path: \\\"/tools/-\\\", value: { type: \\\"node\\\",\n name: \"salesforce_create_lead\", description: \"...\", node: {\n nodeType: \"n8n-nodes-base.salesforceTool\", nodeTypeVersion: 1,\n nodeParameters: { ... } } } }]\" }`\n IMPORTANT: omit `node.credentials` or omit only the skipped credential slot.\n Do not stop. Do not say you will not add the tool.\n5. Reply: \"Done. I added the Salesforce tool without credentials; configure\n the credential later before using it.\"\n\n### Adding a skill to an existing agent\n1. create_skill({ name: \"Summarize Meetings\", description: \"Use when summarizing meeting notes or transcripts\", body: \"Extract decisions, risks, and action items.\" })\n \u2192 { id: \"skill_0Ab9ZkLm3Pq7Xy2N\", ... }\n2. read_config() \u2192 { configHash: \"hash1\", config: { ... } }\n3. patch_config with `{ baseConfigHash: \"hash1\", operations: \"[{ \\\"op\\\": \\\"add\\\", \\\"path\\\": \\\"/skills/-\\\", \\\"value\\\": { \\\"type\\\": \\\"skill\\\", \\\"id\\\": \\\"skill_0Ab9ZkLm3Pq7Xy2N\\\" } }]\" }`\n4. Reply: \"Done. I added the skill.\"\n\n### Ambiguous request: \"Make it post somewhere\"\n1. ask_question({ question: \"Where should the agent post?\",\n options: [\n { label: \"Slack\", value: \"slack\" },\n { label: \"Discord\", value: \"discord\" },\n { label: \"Email\", value: \"email\" } ] })\n2. Continue with the chosen branch (search_nodes \u2192 ask_credential \u2192 read_config \u2192 patch_config).";
|
|
16
16
|
export declare const IMPORTANT_SECTION = "## Important\n\n- Credentials are user-controlled. ALWAYS use ask_llm (for the agent's main\n LLM picker), resolve_llm (for explicit/default main LLM resolution), and\n ask_credential (for every node-tool credential slot).\n Never read credential ids from list_credentials into the config.\n- When you need to clarify an ambiguous user request and the answer is a\n choice from a small set, use ask_question instead of asking in prose.\n- Use search_nodes + get_node_types to discover nodes before adding node tools\n- Prefer workflow tools and node tools over custom tools for real-world interactions\n- n8n session-scoped memory is the default -- always enable it unless told otherwise\n- `build_custom_tool` generates an opaque custom tool id, then compiles and stores the tool code. Register the returned id in the config separately by adding a `{ type: \"custom\", id }` entry to `tools` via write_config or patch_config\n- `create_skill` stores the skill body only. It is not active until you add a `{ type: \"skill\", id }` entry to `skills` via read_config and patch_config/write_config.";
|
|
17
17
|
export declare const RESPONSE_STYLE_SECTION = "## Response style\n\nBe concise but informative.\n\n- After a build step (write_config, patch_config, build_custom_tool), give a\n 1\u20132 sentence summary of what you changed and, if useful, one thing the user\n might try next. No field-by-field narration, no JSON repetition, no\n re-stating the user's request back to them.\n- Do not narrate your reasoning before a tool call (no \"Let me check the\n credentials first\u2026\"). Just do it, then summarise the result.\n- The config and tools speak for themselves \u2014 the user can inspect them\n directly, so don't re-list what's visible in the sidebar.";
|
|
18
|
-
export declare function getConfigRulesSection(
|
|
18
|
+
export declare function getConfigRulesSection(): string;
|
|
19
19
|
export declare function getSchemaReferenceSection(): string;
|
|
20
20
|
export interface BuilderPromptContext {
|
|
21
21
|
configJson: string;
|
|
22
22
|
configHash: string | null;
|
|
23
23
|
configUpdatedAt: string | null;
|
|
24
24
|
toolList: string;
|
|
25
|
-
|
|
25
|
+
agentPreviewPath: string;
|
|
26
|
+
modelRecommendationsSection: string | null;
|
|
26
27
|
}
|
|
27
28
|
export declare function buildBuilderPrompt(ctx: BuilderPromptContext): string;
|
|
@@ -1,20 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RESPONSE_STYLE_SECTION = exports.IMPORTANT_SECTION = exports.FEW_SHOT_FLOWS_SECTION = exports.WORKFLOW_SECTION = exports.READ_CONFIG_SECTION = exports.PATCH_CONFIG_SECTION = exports.WRITE_CONFIG_SECTION = exports.INTEGRATIONS_SECTION = exports.MEMORY_PRESETS_SECTION = exports.RESEARCH_SECTION = exports.
|
|
3
|
+
exports.RESPONSE_STYLE_SECTION = exports.IMPORTANT_SECTION = exports.FEW_SHOT_FLOWS_SECTION = exports.WORKFLOW_SECTION = exports.READ_CONFIG_SECTION = exports.PATCH_CONFIG_SECTION = exports.WRITE_CONFIG_SECTION = exports.INTEGRATIONS_SECTION = exports.MEMORY_PRESETS_SECTION = exports.RESEARCH_SECTION = exports.PROVIDER_TOOLS_SECTION = exports.N8N_EXPRESSIONS_SECTION = exports.LLM_RESOLUTION_SECTION = exports.INTERACTIVE_TOOLS_SECTION = exports.TOOL_TYPES_SECTION = void 0;
|
|
4
4
|
exports.getAgentStateSection = getAgentStateSection;
|
|
5
|
+
exports.getConversationModeSection = getConversationModeSection;
|
|
5
6
|
exports.getConfigRulesSection = getConfigRulesSection;
|
|
6
7
|
exports.getSchemaReferenceSection = getSchemaReferenceSection;
|
|
7
8
|
exports.buildBuilderPrompt = buildBuilderPrompt;
|
|
8
9
|
const zod_1 = require("zod");
|
|
9
10
|
const zod_to_json_schema_1 = require("zod-to-json-schema");
|
|
10
|
-
const
|
|
11
|
+
const api_types_1 = require("@n8n/api-types");
|
|
11
12
|
const schema_text_serializer_1 = require("../json-config/schema-text-serializer");
|
|
12
13
|
const BuilderPromptMemoryConfigSchema = zod_1.z.object({
|
|
13
14
|
enabled: zod_1.z.boolean(),
|
|
14
15
|
storage: zod_1.z.literal('n8n'),
|
|
15
16
|
lastMessages: zod_1.z.number().int().min(1).max(200).optional(),
|
|
17
|
+
observationalMemory: zod_1.z
|
|
18
|
+
.object({
|
|
19
|
+
enabled: zod_1.z.boolean().optional(),
|
|
20
|
+
observerThresholdTokens: zod_1.z.number().int().min(1).optional(),
|
|
21
|
+
reflectorThresholdTokens: zod_1.z.number().int().min(1).optional(),
|
|
22
|
+
renderTokenBudget: zod_1.z.number().int().min(1).optional(),
|
|
23
|
+
observationLogTailLimit: zod_1.z.number().int().min(1).optional(),
|
|
24
|
+
lockTtlMs: zod_1.z.number().int().min(0).optional(),
|
|
25
|
+
})
|
|
26
|
+
.optional(),
|
|
16
27
|
});
|
|
17
|
-
const BuilderPromptAgentJsonConfigSchema =
|
|
28
|
+
const BuilderPromptAgentJsonConfigSchema = api_types_1.RunnableAgentJsonConfigSchema.extend({
|
|
18
29
|
memory: BuilderPromptMemoryConfigSchema.optional(),
|
|
19
30
|
});
|
|
20
31
|
function getAgentStateSection(configJson, configHash, configUpdatedAt, toolList) {
|
|
@@ -152,7 +163,7 @@ Never ask the user in plain text to choose, confirm, configure, or change the
|
|
|
152
163
|
agent main LLM, provider, model, or main LLM credential. If the user needs to
|
|
153
164
|
make that choice, call ask_llm so the picker card is shown.
|
|
154
165
|
Returns: { provider, model, credentialId, credentialName }.
|
|
155
|
-
After: set \`model = "{provider}/{model}"\` and \`credential =
|
|
166
|
+
After: set \`model = "{provider}/{model}"\` and \`credential = credentialId\`
|
|
156
167
|
via write_config or patch_config.
|
|
157
168
|
|
|
158
169
|
### ask_credential
|
|
@@ -191,8 +202,8 @@ Use resolve_llm before ask_llm whenever the user's request contains enough
|
|
|
191
202
|
information to resolve the main LLM without a picker.
|
|
192
203
|
|
|
193
204
|
### resolve_llm
|
|
194
|
-
When: the user explicitly names a provider/model, or a fresh agent needs
|
|
195
|
-
|
|
205
|
+
When: the user explicitly names a provider/model, or a fresh agent needs its
|
|
206
|
+
main LLM set and the user did not ask to choose.
|
|
196
207
|
|
|
197
208
|
Inputs: optional \`provider\`, optional \`model\`.
|
|
198
209
|
- If the user says "Anthropic via OpenRouter", pass
|
|
@@ -203,7 +214,7 @@ Inputs: optional \`provider\`, optional \`model\`.
|
|
|
203
214
|
\`"anthropic/claude-sonnet-4.6"\`.
|
|
204
215
|
|
|
205
216
|
On \`{ ok: true, provider, model, credentialId, credentialName }\`: set
|
|
206
|
-
\`model = "{provider}/{model}"\` and \`credential =
|
|
217
|
+
\`model = "{provider}/{model}"\` and \`credential = credentialId\`. The
|
|
207
218
|
returned \`model\` is the canonical id resolved against the provider's live
|
|
208
219
|
list, so use it as-is — do not transform or "correct" it.
|
|
209
220
|
|
|
@@ -223,6 +234,12 @@ list_credentials. Pick the action by reason:
|
|
|
223
234
|
|
|
224
235
|
Rules:
|
|
225
236
|
- Explicit provider/model request → resolve_llm first, not ask_llm.
|
|
237
|
+
- User does not know which model to use and the Recommended LLM models section
|
|
238
|
+
is present → choose from that section, then pass that provider/model to
|
|
239
|
+
resolve_llm. Prefer a provider the user already has credentials for.
|
|
240
|
+
- If the Recommended LLM models section is absent, do not recommend or name
|
|
241
|
+
current, best, latest, or fallback model IDs from memory. Call ask_llm when
|
|
242
|
+
the user needs model guidance or choice.
|
|
226
243
|
- User asks to pick/change/use a different model → ask_llm.
|
|
227
244
|
- User needs to choose/confirm/configure a model or main LLM credential →
|
|
228
245
|
ask_llm, never a plain-text question.
|
|
@@ -261,7 +278,8 @@ OpenAI image generation:
|
|
|
261
278
|
\`\`\`json
|
|
262
279
|
{ "providerTools": { "openai.image_generation": {} } }
|
|
263
280
|
\`\`\``;
|
|
264
|
-
|
|
281
|
+
function getConversationModeSection(agentPreviewPath) {
|
|
282
|
+
return `\
|
|
265
283
|
## When to build vs when to converse
|
|
266
284
|
|
|
267
285
|
Not every user message is a build request. Before calling \`write_config\`,
|
|
@@ -274,12 +292,15 @@ want the agent to do, what systems it needs to touch, what triggers it. Only
|
|
|
274
292
|
start building once you have a real goal.
|
|
275
293
|
|
|
276
294
|
If the user tries to test, run, chat with, or interact with the newly built
|
|
277
|
-
agent in this Build chat,
|
|
278
|
-
|
|
295
|
+
agent in this Build chat, do not call tools. Reply exactly:
|
|
296
|
+
"Head to the [Preview](${agentPreviewPath}) section to chat with your agent."
|
|
297
|
+
Do not say anything else. Keep the Preview link as a relative app path; do not
|
|
298
|
+
expand it to an absolute URL.
|
|
279
299
|
|
|
280
300
|
Never call \`write_config\` with empty, placeholder, or guessed \`instructions\`.
|
|
281
301
|
An agent without real instructions is broken and can't chat. If you don't have
|
|
282
302
|
enough detail to write meaningful instructions, ask the user first.`;
|
|
303
|
+
}
|
|
283
304
|
exports.RESEARCH_SECTION = `\
|
|
284
305
|
## Research
|
|
285
306
|
|
|
@@ -299,17 +320,20 @@ exports.MEMORY_PRESETS_SECTION = `\
|
|
|
299
320
|
## Memory
|
|
300
321
|
|
|
301
322
|
Use n8n session-scoped memory only. It keeps recent conversation context and
|
|
302
|
-
|
|
323
|
+
an observation log for the current chat session. The agent reads the rendered
|
|
324
|
+
observation log directly as private context.
|
|
303
325
|
|
|
304
326
|
Shape:
|
|
305
327
|
\`\`\`json
|
|
306
|
-
{ "enabled": true, "storage": "n8n", "lastMessages": 50 }
|
|
328
|
+
{ "enabled": true, "storage": "n8n", "lastMessages": 50, "observationalMemory": { "renderTokenBudget": 4500 } }
|
|
307
329
|
\`\`\`
|
|
308
330
|
|
|
309
331
|
Rules:
|
|
310
332
|
- Set \`storage\` to "n8n".
|
|
311
333
|
- \`lastMessages\` default: 50.
|
|
312
|
-
-
|
|
334
|
+
- Observation-log memory is enabled by default when memory is enabled.
|
|
335
|
+
- Keep \`observationalMemory\` optional; use it only for explicit memory tuning.
|
|
336
|
+
- Supported tuning fields: \`enabled\`, \`observerThresholdTokens\`, \`reflectorThresholdTokens\`, \`renderTokenBudget\`, \`observationLogTailLimit\`, and \`lockTtlMs\`.`;
|
|
313
337
|
exports.INTEGRATIONS_SECTION = `\
|
|
314
338
|
## Integrations (triggers)
|
|
315
339
|
|
|
@@ -328,14 +352,14 @@ Two kinds:
|
|
|
328
352
|
2. **Chat integrations** — connect the agent to a messaging platform. Multiple allowed.
|
|
329
353
|
Shape:
|
|
330
354
|
\`\`\`json
|
|
331
|
-
{ "type": "slack", "credentialId": "<id>"
|
|
355
|
+
{ "type": "slack", "credentialId": "<id>" }
|
|
332
356
|
\`\`\`
|
|
333
357
|
|
|
334
358
|
### Workflow for adding integrations
|
|
335
359
|
|
|
336
360
|
1. Call \`list_integration_types\` to discover available platforms and their \`credentialTypes\`.
|
|
337
361
|
2. For chat integrations: pick **one** entry from the \`credentialTypes\` array returned by \`list_integration_types\` (prefer the OAuth variant — e.g. \`slackOAuth2Api\` over \`slackApi\`) and pass it to \`ask_credential\` as the singular \`credentialType\` arg. It returns \`{ credentialId, credentialName }\`.
|
|
338
|
-
3. Use \`patch_config\` (or \`write_config\`) to add an entry to \`integrations\`. For chat integrations,
|
|
362
|
+
3. Use \`patch_config\` (or \`write_config\`) to add an entry to \`integrations\`. For chat integrations, only persist \`type\` and \`credentialId\`. For schedule, write the cron expression directly.
|
|
339
363
|
|
|
340
364
|
Never invent credential IDs or names. Always go through \`ask_credential\`.`;
|
|
341
365
|
exports.WRITE_CONFIG_SECTION = `\
|
|
@@ -348,7 +372,7 @@ configuration as a JSON string and the \`baseConfigHash\` from that same
|
|
|
348
372
|
\`\`\`json
|
|
349
373
|
{
|
|
350
374
|
"baseConfigHash": "<configHash from read_config>",
|
|
351
|
-
"json": "{ \\"name\\": \\"My Agent\\", \\"model\\": \\"
|
|
375
|
+
"json": "{ \\"name\\": \\"My Agent\\", \\"model\\": \\"{provider}/{model}\\", \\"credential\\": \\"<credentialId>\\", \\"instructions\\": \\"You are a helpful assistant.\\", \\"memory\\": { \\"enabled\\": true, \\"storage\\": \\"n8n\\", \\"lastMessages\\": 50 } }"
|
|
352
376
|
}
|
|
353
377
|
\`\`\`
|
|
354
378
|
|
|
@@ -377,7 +401,7 @@ Examples:
|
|
|
377
401
|
\`\`\`json
|
|
378
402
|
{
|
|
379
403
|
"baseConfigHash": "<configHash from read_config>",
|
|
380
|
-
"operations": "[{ \\"op\\": \\"replace\\", \\"path\\": \\"/model\\", \\"value\\": \\"
|
|
404
|
+
"operations": "[{ \\"op\\": \\"replace\\", \\"path\\": \\"/model\\", \\"value\\": \\"{provider}/{model}\\" }, { \\"op\\": \\"replace\\", \\"path\\": \\"/credential\\", \\"value\\": \\"<credentialId>\\" }]"
|
|
381
405
|
}
|
|
382
406
|
\`\`\`
|
|
383
407
|
\`\`\`json
|
|
@@ -425,7 +449,7 @@ exports.WORKFLOW_SECTION = `\
|
|
|
425
449
|
## Workflow
|
|
426
450
|
|
|
427
451
|
1. If the agent has no \`instructions\` and \`credential\` yet (fresh agent), FIRST call resolve_llm
|
|
428
|
-
when the user specified a provider/model or
|
|
452
|
+
when the user specified a provider/model or left model choice to the builder. If
|
|
429
453
|
resolve_llm reports ambiguity, or the user asks to choose/change/use a
|
|
430
454
|
different model, call ask_llm. Then call read_config and write_config
|
|
431
455
|
with the chosen \`model\` and \`credential\` plus a draft \`instructions\`.
|
|
@@ -465,12 +489,12 @@ exports.FEW_SHOT_FLOWS_SECTION = `\
|
|
|
465
489
|
model: "anthropic/claude-sonnet-4.6",
|
|
466
490
|
credentialId: "or1", credentialName: "OpenRouter" }
|
|
467
491
|
2. read_config() → { configHash: "hash1", config: { ... } }
|
|
468
|
-
3. write_config({ baseConfigHash: "hash1", json: "{ ...complete config with model: \\"openrouter/anthropic/claude-sonnet-4.6\\", credential: \\"
|
|
492
|
+
3. write_config({ baseConfigHash: "hash1", json: "{ ...complete config with model: \\"openrouter/anthropic/claude-sonnet-4.6\\", credential: \\"or1\\", and the requested instructions... }" })
|
|
469
493
|
|
|
470
494
|
### User says "Use a different OpenRouter model"
|
|
471
495
|
1. ask_llm({ purpose: "Choose a different OpenRouter model" })
|
|
472
496
|
2. read_config() → { configHash: "hash1", config: { ... } }
|
|
473
|
-
3. patch_config with \`{ baseConfigHash: "hash1", operations: "[{ \\"op\\": \\"replace\\", \\"path\\": \\"/model\\", \\"value\\": \\"{provider}/{model}\\" }, { \\"op\\": \\"replace\\", \\"path\\": \\"/credential\\", \\"value\\": \\"<
|
|
497
|
+
3. patch_config with \`{ baseConfigHash: "hash1", operations: "[{ \\"op\\": \\"replace\\", \\"path\\": \\"/model\\", \\"value\\": \\"{provider}/{model}\\" }, { \\"op\\": \\"replace\\", \\"path\\": \\"/credential\\", \\"value\\": \\"<credentialId>\\" }]" }\`.
|
|
474
498
|
|
|
475
499
|
### Adding a new node tool to an existing agent
|
|
476
500
|
1. (skip ask_llm — already set)
|
|
@@ -536,16 +560,19 @@ Be concise but informative.
|
|
|
536
560
|
credentials first…"). Just do it, then summarise the result.
|
|
537
561
|
- The config and tools speak for themselves — the user can inspect them
|
|
538
562
|
directly, so don't re-list what's visible in the sidebar.`;
|
|
539
|
-
function getConfigRulesSection(
|
|
563
|
+
function getConfigRulesSection() {
|
|
540
564
|
return `\
|
|
541
565
|
## Agent config rules
|
|
542
566
|
|
|
543
|
-
- \`model\` must be "provider/model-name" format (e.g. "anthropic/claude-sonnet-4-5")
|
|
544
|
-
- \`credential\` must be the \`
|
|
545
|
-
- \`memory.storage\` must be "n8n"
|
|
546
|
-
- \`memory.lastMessages\` default: 50
|
|
547
|
-
- Use n8n
|
|
548
|
-
-
|
|
567
|
+
- \`model\` must be "provider/model-name" format (e.g. "anthropic/claude-sonnet-4-5")
|
|
568
|
+
- \`credential\` must be the \`credentialId\` returned by a prior resolve_llm or ask_llm tool call. Do not guess.
|
|
569
|
+
- \`memory.storage\` must be "n8n"
|
|
570
|
+
- \`memory.lastMessages\` default: 50
|
|
571
|
+
- Use "n8n" as the default memory storage for all agents
|
|
572
|
+
- \`memory.observationalMemory\` tunes observation-log memory. It is enabled by default whenever memory is enabled; use \`{ enabled: false }\` only when the user explicitly does not want automatic memory updates.
|
|
573
|
+
- Defaults: \`observerThresholdTokens: 500\`, \`reflectorThresholdTokens: 4000\`, \`renderTokenBudget: 4500\`, \`observationLogTailLimit: 20\`.
|
|
574
|
+
- Cost: observing and reflecting use background LLM calls on the agent's main model. Mention this if the user asks about cost.
|
|
575
|
+
- If the agent has no \`model\`/\`credential\` yet, call resolve_llm or ask_llm before writing config. Do not write a placeholder/default model without a credential.`;
|
|
549
576
|
}
|
|
550
577
|
function getSchemaReferenceSection() {
|
|
551
578
|
const jsonSchemaText = (0, schema_text_serializer_1.jsonSchemaToCompactText)((0, zod_to_json_schema_1.zodToJsonSchema)(BuilderPromptAgentJsonConfigSchema));
|
|
@@ -557,21 +584,22 @@ ${jsonSchemaText}
|
|
|
557
584
|
\`\`\``;
|
|
558
585
|
}
|
|
559
586
|
function buildBuilderPrompt(ctx) {
|
|
560
|
-
const { configJson, configHash, configUpdatedAt, toolList,
|
|
561
|
-
|
|
587
|
+
const { configJson, configHash, configUpdatedAt, toolList, agentPreviewPath, modelRecommendationsSection, } = ctx;
|
|
588
|
+
const sections = [
|
|
562
589
|
'You are an expert agent builder. You help users create and configure AI agents by writing raw JSON configuration and building custom tools.',
|
|
563
590
|
getAgentStateSection(configJson, configHash, configUpdatedAt, toolList),
|
|
564
591
|
exports.READ_CONFIG_SECTION,
|
|
565
|
-
|
|
592
|
+
getConversationModeSection(agentPreviewPath),
|
|
566
593
|
exports.TOOL_TYPES_SECTION,
|
|
567
594
|
exports.LLM_RESOLUTION_SECTION,
|
|
595
|
+
modelRecommendationsSection,
|
|
568
596
|
exports.INTERACTIVE_TOOLS_SECTION,
|
|
569
597
|
exports.N8N_EXPRESSIONS_SECTION,
|
|
570
598
|
exports.PROVIDER_TOOLS_SECTION,
|
|
571
599
|
exports.MEMORY_PRESETS_SECTION,
|
|
572
600
|
exports.INTEGRATIONS_SECTION,
|
|
573
601
|
exports.RESEARCH_SECTION,
|
|
574
|
-
getConfigRulesSection(
|
|
602
|
+
getConfigRulesSection(),
|
|
575
603
|
getSchemaReferenceSection(),
|
|
576
604
|
exports.WORKFLOW_SECTION,
|
|
577
605
|
exports.WRITE_CONFIG_SECTION,
|
|
@@ -579,6 +607,7 @@ function buildBuilderPrompt(ctx) {
|
|
|
579
607
|
exports.FEW_SHOT_FLOWS_SECTION,
|
|
580
608
|
exports.IMPORTANT_SECTION,
|
|
581
609
|
exports.RESPONSE_STYLE_SECTION,
|
|
582
|
-
]
|
|
610
|
+
];
|
|
611
|
+
return sections.filter((section) => section !== null).join('\n\n');
|
|
583
612
|
}
|
|
584
613
|
//# sourceMappingURL=agents-builder-prompts.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agents-builder-prompts.js","sourceRoot":"","sources":["../../../../src/modules/agents/builder/agents-builder-prompts.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"agents-builder-prompts.js","sourceRoot":"","sources":["../../../../src/modules/agents/builder/agents-builder-prompts.ts"],"names":[],"mappings":";;;AA+BA,oDAwBC;AAiPD,gEAsBC;AAmRD,sDAaC;AAED,8DAUC;AAeD,gDAmCC;AA3pBD,6BAAwB;AACxB,2DAAqD;AAErD,8CAA+D;AAC/D,kFAAgF;AAEhF,MAAM,+BAA+B,GAAG,OAAC,CAAC,MAAM,CAAC;IAChD,OAAO,EAAE,OAAC,CAAC,OAAO,EAAE;IACpB,OAAO,EAAE,OAAC,CAAC,OAAO,CAAC,KAAK,CAAC;IACzB,YAAY,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE;IACzD,mBAAmB,EAAE,OAAC;SACpB,MAAM,CAAC;QACP,OAAO,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;QAC/B,uBAAuB,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;QAC3D,wBAAwB,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;QAC5D,iBAAiB,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE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AC,gBAAgB,CAAC;QAC5C,0BAAkB;QAClB,8BAAsB;QACtB,2BAA2B;QAC3B,iCAAyB;QACzB,+BAAuB;QACvB,8BAAsB;QACtB,8BAAsB;QACtB,4BAAoB;QACpB,wBAAgB;QAChB,qBAAqB,EAAE;QACvB,yBAAyB,EAAE;QAC3B,wBAAgB;QAChB,4BAAoB;QACpB,4BAAoB;QACpB,8BAAsB;QACtB,yBAAiB;QACjB,8BAAsB;KACtB,CAAC;IAEF,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,OAAO,EAAqB,EAAE,CAAC,OAAO,KAAK,IAAI,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACvF,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { BuiltTool, CredentialProvider } from '@n8n/agents';
|
|
2
|
+
import { type AgentJsonConfig } from '@n8n/api-types';
|
|
2
3
|
import type { User } from '@n8n/db';
|
|
3
4
|
import { WorkflowRepository } from '@n8n/db';
|
|
4
5
|
import { AgentsToolsService } from '../agents-tools.service';
|
|
5
6
|
import { AgentsService } from '../agents.service';
|
|
6
|
-
import type { AgentJsonConfig } from '../json-config/agent-json-config';
|
|
7
7
|
import { AgentSecureRuntime } from '../runtime/agent-secure-runtime';
|
|
8
8
|
import { BuilderModelLookupService } from './builder-model-lookup.service';
|
|
9
9
|
export interface AgentConfigSnapshot {
|
|
@@ -53,7 +53,6 @@ const zod_1 = require("zod");
|
|
|
53
53
|
const agents_tools_service_1 = require("../agents-tools.service");
|
|
54
54
|
const agents_service_1 = require("../agents.service");
|
|
55
55
|
const agent_config_composition_1 = require("../json-config/agent-config-composition");
|
|
56
|
-
const agent_json_config_1 = require("../json-config/agent-json-config");
|
|
57
56
|
const agent_secure_runtime_1 = require("../runtime/agent-secure-runtime");
|
|
58
57
|
const builder_model_lookup_service_1 = require("./builder-model-lookup.service");
|
|
59
58
|
const interactive_1 = require("./interactive");
|
|
@@ -148,7 +147,7 @@ let AgentsBuilderToolsService = class AgentsBuilderToolsService {
|
|
|
148
147
|
.describe('configHash from the immediately preceding read_config result; null only if no config exists'),
|
|
149
148
|
}))
|
|
150
149
|
.handler(async ({ json, baseConfigHash }) => {
|
|
151
|
-
const parsed = (0,
|
|
150
|
+
const parsed = (0, api_types_1.tryParseConfigJson)(json);
|
|
152
151
|
if (!parsed.ok) {
|
|
153
152
|
return { ok: false, errors: parsed.errors };
|
|
154
153
|
}
|
|
@@ -166,9 +165,9 @@ let AgentsBuilderToolsService = class AgentsBuilderToolsService {
|
|
|
166
165
|
if (baseConfigHash !== snapshot.configHash) {
|
|
167
166
|
return { ok: false, stage: 'stale', errors: [STALE_CONFIG_ERROR], ...snapshot };
|
|
168
167
|
}
|
|
169
|
-
const zodResult =
|
|
168
|
+
const zodResult = api_types_1.RunnableAgentJsonConfigSchema.safeParse(parsed.data);
|
|
170
169
|
if (!zodResult.success) {
|
|
171
|
-
return { ok: false, errors: (0,
|
|
170
|
+
return { ok: false, errors: (0, api_types_1.formatZodErrors)(zodResult.error) };
|
|
172
171
|
}
|
|
173
172
|
const emptyInstructions = rejectIfEmptyInstructions(zodResult.data);
|
|
174
173
|
if (emptyInstructions) {
|
|
@@ -207,7 +206,7 @@ let AgentsBuilderToolsService = class AgentsBuilderToolsService {
|
|
|
207
206
|
.describe('configHash from the immediately preceding read_config result; null only if no config exists'),
|
|
208
207
|
}))
|
|
209
208
|
.handler(async ({ operations, baseConfigHash, }) => {
|
|
210
|
-
const parsedOps = (0,
|
|
209
|
+
const parsedOps = (0, api_types_1.tryParseConfigJson)(operations);
|
|
211
210
|
if (!parsedOps.ok) {
|
|
212
211
|
return { ok: false, stage: 'parse', errors: parsedOps.errors };
|
|
213
212
|
}
|
|
@@ -245,9 +244,9 @@ let AgentsBuilderToolsService = class AgentsBuilderToolsService {
|
|
|
245
244
|
}
|
|
246
245
|
const patched = jsonpatch.applyPatch(jsonpatch.deepClone(snapshot.config), ops)
|
|
247
246
|
.newDocument;
|
|
248
|
-
const zodResult =
|
|
247
|
+
const zodResult = api_types_1.RunnableAgentJsonConfigSchema.safeParse(patched);
|
|
249
248
|
if (!zodResult.success) {
|
|
250
|
-
return { ok: false, stage: 'schema', errors: (0,
|
|
249
|
+
return { ok: false, stage: 'schema', errors: (0, api_types_1.formatZodErrors)(zodResult.error) };
|
|
251
250
|
}
|
|
252
251
|
const emptyInstructions = rejectIfEmptyInstructions(zodResult.data);
|
|
253
252
|
if (emptyInstructions) {
|
|
@@ -341,7 +340,7 @@ let AgentsBuilderToolsService = class AgentsBuilderToolsService {
|
|
|
341
340
|
const skill = { name, description, instructions: body };
|
|
342
341
|
const validation = api_types_1.agentSkillSchema.safeParse(skill);
|
|
343
342
|
if (!validation.success) {
|
|
344
|
-
return { ok: false, errors: (0,
|
|
343
|
+
return { ok: false, errors: (0, api_types_1.formatZodErrors)(validation.error) };
|
|
345
344
|
}
|
|
346
345
|
try {
|
|
347
346
|
const created = await this.agentsService.createSkill(agentId, projectId, skill);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agents-builder-tools.service.js","sourceRoot":"","sources":["../../../../src/modules/agents/builder/agents-builder-tools.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4EA,gDAKC;AAjFD,wCAAmC;AAEnC,8CAAkD;AAElD,gCAA6C;AAC7C,gCAAkC;AAElC,6CAAyC;AACzC,6BAAwB;AAExB,kEAA6D;AAC7D,sDAAkD;AAClD,sFAA4E;AAE5E,wEAI0C;AAC1C,0EAAqE;AACrE,iFAA2E;AAC3E,+CAKuB;AAEvB,6DAAqD;AAErD,MAAM,wBAAwB,GAA0B;IACvD,IAAI,EAAE,eAAe;IACrB,OAAO,EACN,8IAA8I;CAC/I,CAAC;AAEF,MAAM,kBAAkB,GAA0B;IACjD,IAAI,EAAE,QAAQ;IACd,OAAO,EACN,uGAAuG;CACxG,CAAC;AASF,SAAS,yBAAyB,CACjC,MAAuB;IAEvB,I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AiB,CAAC,CAAC;QAE/C,MAAM,MAAM,GAAG,IAAA,4CAAiB,EAAC,KAAK,CAAC,CAAC;QACxC,OAAO,kBAAkB,CAAC,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,EAAE,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IACnF,CAAC;CACD,CAAA;AAvZY,8DAAyB;oCAAzB,yBAAyB;IADrC,IAAA,YAAO,GAAE;qCAGwB,8BAAa;QACb,yCAAkB;QACb,uBAAkB;QAClB,yCAAkB;QACX,wDAAyB;GAN1D,yBAAyB,CAuZrC"}
|
|
1
|
+
{"version":3,"file":"agents-builder-tools.service.js","sourceRoot":"","sources":["../../../../src/modules/agents/builder/agents-builder-tools.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6EA,gDAKC;AAlFD,wCAAmC;AAEnC,8CAOwB;AAExB,gCAA6C;AAC7C,gCAAkC;AAElC,6CAAyC;AACzC,6BAAwB;AAExB,kEAA6D;AAC7D,sDAAkD;AAClD,sFAA4E;AAC5E,0EAAqE;AACrE,iFAA2E;AAC3E,+CAKuB;AAEvB,6DAAqD;AAErD,MAAM,wBAAwB,GAA0B;IACvD,IAAI,EAAE,eAAe;IACrB,OAAO,EACN,8IAA8I;CAC/I,CAAC;AAEF,MAAM,kBAAkB,GAA0B;IACjD,IAAI,EAAE,QAAQ;IACd,OAAO,EACN,uGAAuG;CACxG,CAAC;AASF,SAAS,yBAAyB,CACjC,MAAuB;IAEvB,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,EAAE,CAAC;QACjC,OAAO,EAAE,MAAM,EAAE,CAAC,wBAAwB,CAAC,EAAE,CAAC;IAC/C,CAAC;IACD,OAAO,IAAI,CAAC;AACb,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC/B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAA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8BAAa;QACb,yCAAkB;QACb,uBAAkB;QAClB,yCAAkB;QACX,wDAAyB;GAN1D,yBAAyB,CAuZrC"}
|
|
@@ -14,18 +14,19 @@ const agents_1 = require("@n8n/agents");
|
|
|
14
14
|
const backend_common_1 = require("@n8n/backend-common");
|
|
15
15
|
const di_1 = require("@n8n/di");
|
|
16
16
|
const n8n_workflow_1 = require("n8n-workflow");
|
|
17
|
+
const not_found_error_1 = require("../../../errors/response-errors/not-found.error");
|
|
17
18
|
const agents_service_1 = require("../agents.service");
|
|
18
19
|
const agent_config_composition_1 = require("../json-config/agent-config-composition");
|
|
19
20
|
const n8n_checkpoint_storage_1 = require("../integrations/n8n-checkpoint-storage");
|
|
20
21
|
const n8n_memory_1 = require("../integrations/n8n-memory");
|
|
21
22
|
const agent_checkpoint_repository_1 = require("../repositories/agent-checkpoint.repository");
|
|
23
|
+
const agent_builder_preview_path_1 = require("./agent-builder-preview-path");
|
|
22
24
|
const agents_builder_prompts_1 = require("./agents-builder-prompts");
|
|
23
25
|
const agents_builder_tools_service_1 = require("./agents-builder-tools.service");
|
|
24
26
|
const builder_tool_names_1 = require("./builder-tool-names");
|
|
25
|
-
const not_found_error_1 = require("../../../errors/response-errors/not-found.error");
|
|
26
27
|
const agents_builder_settings_service_1 = require("./agents-builder-settings.service");
|
|
27
28
|
const builder_telemetry_1 = require("../tracing/builder-telemetry");
|
|
28
|
-
const
|
|
29
|
+
const agents_builder_model_recommendations_1 = require("./agents-builder-model-recommendations");
|
|
29
30
|
function builderThreadId(agentId) {
|
|
30
31
|
return `${builder_tool_names_1.AGENT_THREAD_PREFIX.BUILDER}${agentId}`;
|
|
31
32
|
}
|
|
@@ -85,12 +86,14 @@ let AgentsBuilderService = class AgentsBuilderService {
|
|
|
85
86
|
.map(([id, t]) => `- ${id}: ${t.descriptor.name} -- ${t.descriptor.description}`)
|
|
86
87
|
.join('\n') || '(none)';
|
|
87
88
|
const configJson = currentConfig ? JSON.stringify(currentConfig, null, 2) : '(no config yet)';
|
|
89
|
+
const modelRecommendationsSection = await (0, agents_builder_model_recommendations_1.getModelRecommendationsSection)();
|
|
88
90
|
const instructions = (0, agents_builder_prompts_1.buildBuilderPrompt)({
|
|
89
91
|
configJson,
|
|
90
92
|
configHash: (0, agents_builder_tools_service_1.getAgentConfigHash)(currentConfig),
|
|
91
93
|
configUpdatedAt: agent.updatedAt.toISOString(),
|
|
92
94
|
toolList,
|
|
93
|
-
|
|
95
|
+
agentPreviewPath: (0, agent_builder_preview_path_1.buildAgentPreviewPath)(projectId, agentId),
|
|
96
|
+
modelRecommendationsSection,
|
|
94
97
|
});
|
|
95
98
|
const tools = this.agentsBuilderToolsService.getTools(agentId, projectId, credentialProvider, user);
|
|
96
99
|
const builderMemory = new agents_1.Memory().storage(this.n8nMemory).lastMessages(40);
|