@n8n/instance-ai 1.0.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE_EE.md +27 -0
- package/dist/agent/instance-agent.js +17 -45
- package/dist/agent/instance-agent.js.map +1 -1
- package/dist/agent/register-with-mastra.d.ts +1 -1
- package/dist/agent/register-with-mastra.js +5 -9
- package/dist/agent/register-with-mastra.js.map +1 -1
- package/dist/agent/sub-agent-briefing.d.ts +20 -0
- package/dist/agent/sub-agent-briefing.js +39 -0
- package/dist/agent/sub-agent-briefing.js.map +1 -0
- package/dist/agent/sub-agent-debriefing.d.ts +71 -0
- package/dist/agent/sub-agent-debriefing.js +39 -0
- package/dist/agent/sub-agent-debriefing.js.map +1 -0
- package/dist/agent/sub-agent-factory.d.ts +1 -1
- package/dist/agent/sub-agent-factory.js +15 -3
- package/dist/agent/sub-agent-factory.js.map +1 -1
- package/dist/agent/system-prompt.d.ts +1 -0
- package/dist/agent/system-prompt.js +67 -43
- package/dist/agent/system-prompt.js.map +1 -1
- package/dist/agent/tool-access.d.ts +2 -0
- package/dist/agent/tool-access.js +28 -0
- package/dist/agent/tool-access.js.map +1 -0
- package/dist/build.tsbuildinfo +1 -1
- package/dist/domain-access/domain-gating.d.ts +1 -0
- package/dist/domain-access/domain-gating.js +3 -0
- package/dist/domain-access/domain-gating.js.map +1 -1
- package/dist/index.d.ts +7 -3
- package/dist/index.js +15 -4
- package/dist/index.js.map +1 -1
- package/dist/logger.d.ts +6 -0
- package/dist/logger.js +3 -0
- package/dist/logger.js.map +1 -0
- package/dist/memory/memory-config.js +1 -3
- package/dist/memory/memory-config.js.map +1 -1
- package/dist/parsers/structured-file-parser.d.ts +56 -0
- package/dist/parsers/structured-file-parser.js +354 -0
- package/dist/parsers/structured-file-parser.js.map +1 -0
- package/dist/planned-tasks/planned-task-permissions.d.ts +2 -0
- package/dist/planned-tasks/planned-task-permissions.js +27 -0
- package/dist/planned-tasks/planned-task-permissions.js.map +1 -0
- package/dist/planned-tasks/planned-task-service.js +6 -0
- package/dist/planned-tasks/planned-task-service.js.map +1 -1
- package/dist/runtime/background-task-manager.d.ts +2 -1
- package/dist/runtime/background-task-manager.js +13 -1
- package/dist/runtime/background-task-manager.js.map +1 -1
- package/dist/runtime/resumable-stream-executor.d.ts +8 -3
- package/dist/runtime/resumable-stream-executor.js +67 -120
- package/dist/runtime/resumable-stream-executor.js.map +1 -1
- package/dist/runtime/run-state-registry.d.ts +1 -0
- package/dist/runtime/run-state-registry.js.map +1 -1
- package/dist/runtime/stream-runner.d.ts +4 -2
- package/dist/runtime/stream-runner.js +5 -25
- package/dist/runtime/stream-runner.js.map +1 -1
- package/dist/stream/consume-with-hitl.d.ts +6 -1
- package/dist/stream/consume-with-hitl.js +12 -2
- package/dist/stream/consume-with-hitl.js.map +1 -1
- package/dist/stream/map-chunk.d.ts +1 -1
- package/dist/stream/map-chunk.js +35 -16
- package/dist/stream/map-chunk.js.map +1 -1
- package/dist/stream/work-summary-accumulator.d.ts +63 -0
- package/dist/stream/work-summary-accumulator.js +66 -0
- package/dist/stream/work-summary-accumulator.js.map +1 -0
- package/dist/tools/attachments/parse-file.tool.d.ts +90 -0
- package/dist/tools/attachments/parse-file.tool.js +135 -0
- package/dist/tools/attachments/parse-file.tool.js.map +1 -0
- package/dist/tools/best-practices/get-best-practices.tool.d.ts +6 -9
- package/dist/tools/best-practices/get-best-practices.tool.js +7 -5
- package/dist/tools/best-practices/get-best-practices.tool.js.map +1 -1
- package/dist/tools/best-practices/index.js +5 -29
- package/dist/tools/best-practices/index.js.map +1 -1
- package/dist/tools/best-practices/techniques.d.ts +1 -20
- package/dist/tools/best-practices/techniques.js +3 -36
- package/dist/tools/best-practices/techniques.js.map +1 -1
- package/dist/tools/credentials/delete-credential.tool.d.ts +13 -14
- package/dist/tools/credentials/delete-credential.tool.js +18 -11
- package/dist/tools/credentials/delete-credential.tool.js.map +1 -1
- package/dist/tools/credentials/get-credential.tool.d.ts +8 -2
- package/dist/tools/credentials/get-credential.tool.js +13 -7
- package/dist/tools/credentials/get-credential.tool.js.map +1 -1
- package/dist/tools/credentials/list-credentials.tool.d.ts +13 -3
- package/dist/tools/credentials/list-credentials.tool.js +50 -8
- package/dist/tools/credentials/list-credentials.tool.js.map +1 -1
- package/dist/tools/credentials/search-credential-types.tool.d.ts +7 -3
- package/dist/tools/credentials/search-credential-types.tool.js +7 -5
- package/dist/tools/credentials/search-credential-types.tool.js.map +1 -1
- package/dist/tools/credentials/setup-credentials.tool.d.ts +40 -44
- package/dist/tools/credentials/setup-credentials.tool.js +37 -31
- package/dist/tools/credentials/setup-credentials.tool.js.map +1 -1
- package/dist/tools/credentials/test-credential.tool.d.ts +7 -4
- package/dist/tools/credentials/test-credential.tool.js +5 -3
- package/dist/tools/credentials/test-credential.tool.js.map +1 -1
- package/dist/tools/data-tables/add-data-table-column.tool.d.ts +15 -19
- package/dist/tools/data-tables/add-data-table-column.tool.js +16 -9
- package/dist/tools/data-tables/add-data-table-column.tool.js.map +1 -1
- package/dist/tools/data-tables/create-data-table.tool.d.ts +26 -24
- package/dist/tools/data-tables/create-data-table.tool.js +49 -22
- package/dist/tools/data-tables/create-data-table.tool.js.map +1 -1
- package/dist/tools/data-tables/delete-data-table-column.tool.d.ts +13 -14
- package/dist/tools/data-tables/delete-data-table-column.tool.js +15 -8
- package/dist/tools/data-tables/delete-data-table-column.tool.js.map +1 -1
- package/dist/tools/data-tables/delete-data-table-rows.tool.d.ts +49 -15
- package/dist/tools/data-tables/delete-data-table-rows.tool.js +25 -9
- package/dist/tools/data-tables/delete-data-table-rows.tool.js.map +1 -1
- package/dist/tools/data-tables/delete-data-table.tool.d.ts +11 -14
- package/dist/tools/data-tables/delete-data-table.tool.js +17 -9
- package/dist/tools/data-tables/delete-data-table.tool.js.map +1 -1
- package/dist/tools/data-tables/get-data-table-schema.tool.d.ts +7 -8
- package/dist/tools/data-tables/get-data-table-schema.tool.js +5 -3
- package/dist/tools/data-tables/get-data-table-schema.tool.js.map +1 -1
- package/dist/tools/data-tables/insert-data-table-rows.tool.d.ts +14 -15
- package/dist/tools/data-tables/insert-data-table-rows.tool.js +22 -12
- package/dist/tools/data-tables/insert-data-table-rows.tool.js.map +1 -1
- package/dist/tools/data-tables/list-data-tables.tool.d.ts +7 -3
- package/dist/tools/data-tables/list-data-tables.tool.js +8 -6
- package/dist/tools/data-tables/list-data-tables.tool.js.map +1 -1
- package/dist/tools/data-tables/query-data-table-rows.tool.d.ts +49 -8
- package/dist/tools/data-tables/query-data-table-rows.tool.js +14 -12
- package/dist/tools/data-tables/query-data-table-rows.tool.js.map +1 -1
- package/dist/tools/data-tables/rename-data-table-column.tool.d.ts +15 -14
- package/dist/tools/data-tables/rename-data-table-column.tool.js +16 -9
- package/dist/tools/data-tables/rename-data-table-column.tool.js.map +1 -1
- package/dist/tools/data-tables/update-data-table-rows.tool.d.ts +51 -14
- package/dist/tools/data-tables/update-data-table-rows.tool.js +19 -9
- package/dist/tools/data-tables/update-data-table-rows.tool.js.map +1 -1
- package/dist/tools/executions/debug-execution.tool.d.ts +8 -2
- package/dist/tools/executions/debug-execution.tool.js +5 -3
- package/dist/tools/executions/debug-execution.tool.js.map +1 -1
- package/dist/tools/executions/get-execution.tool.d.ts +8 -2
- package/dist/tools/executions/get-execution.tool.js +5 -3
- package/dist/tools/executions/get-execution.tool.js.map +1 -1
- package/dist/tools/executions/get-node-output.tool.d.ts +14 -2
- package/dist/tools/executions/get-node-output.tool.js +14 -17
- package/dist/tools/executions/get-node-output.tool.js.map +1 -1
- package/dist/tools/executions/list-executions.tool.d.ts +11 -3
- package/dist/tools/executions/list-executions.tool.js +16 -14
- package/dist/tools/executions/list-executions.tool.js.map +1 -1
- package/dist/tools/executions/run-workflow.tool.d.ts +17 -15
- package/dist/tools/executions/run-workflow.tool.js +35 -25
- package/dist/tools/executions/run-workflow.tool.js.map +1 -1
- package/dist/tools/executions/stop-execution.tool.d.ts +7 -4
- package/dist/tools/executions/stop-execution.tool.js +8 -3
- package/dist/tools/executions/stop-execution.tool.js.map +1 -1
- package/dist/tools/filesystem/create-tools-from-mcp-server.js +77 -6
- package/dist/tools/filesystem/create-tools-from-mcp-server.js.map +1 -1
- package/dist/tools/index.d.ts +67 -2380
- package/dist/tools/index.js +9 -15
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/nodes/explore-node-resources.tool.d.ts +23 -10
- package/dist/tools/nodes/explore-node-resources.tool.js +27 -25
- package/dist/tools/nodes/explore-node-resources.tool.js.map +1 -1
- package/dist/tools/nodes/get-node-description.tool.d.ts +7 -20
- package/dist/tools/nodes/get-node-description.tool.js +5 -3
- package/dist/tools/nodes/get-node-description.tool.js.map +1 -1
- package/dist/tools/nodes/get-node-type-definition.tool.d.ts +29 -6
- package/dist/tools/nodes/get-node-type-definition.tool.js +9 -7
- package/dist/tools/nodes/get-node-type-definition.tool.js.map +1 -1
- package/dist/tools/nodes/get-suggested-nodes.tool.d.ts +7 -12
- package/dist/tools/nodes/get-suggested-nodes.tool.js +9 -7
- package/dist/tools/nodes/get-suggested-nodes.tool.js.map +1 -1
- package/dist/tools/nodes/list-nodes.tool.d.ts +7 -3
- package/dist/tools/nodes/list-nodes.tool.js +8 -6
- package/dist/tools/nodes/list-nodes.tool.js.map +1 -1
- package/dist/tools/nodes/node-search-engine.d.ts +1 -0
- package/dist/tools/nodes/node-search-engine.js +12 -9
- package/dist/tools/nodes/node-search-engine.js.map +1 -1
- package/dist/tools/nodes/search-nodes.tool.d.ts +12 -24
- package/dist/tools/nodes/search-nodes.tool.js +21 -17
- package/dist/tools/nodes/search-nodes.tool.js.map +1 -1
- package/dist/tools/orchestration/add-plan-item.tool.d.ts +5 -0
- package/dist/tools/orchestration/add-plan-item.tool.js +91 -0
- package/dist/tools/orchestration/add-plan-item.tool.js.map +1 -0
- package/dist/tools/orchestration/blueprint-accumulator.d.ts +50 -0
- package/dist/tools/orchestration/blueprint-accumulator.js +215 -0
- package/dist/tools/orchestration/blueprint-accumulator.js.map +1 -0
- package/dist/tools/orchestration/blueprint.schema.d.ts +271 -0
- package/dist/tools/orchestration/blueprint.schema.js +61 -0
- package/dist/tools/orchestration/blueprint.schema.js.map +1 -0
- package/dist/tools/orchestration/browser-credential-setup.tool.d.ts +15 -12
- package/dist/tools/orchestration/browser-credential-setup.tool.js +27 -21
- package/dist/tools/orchestration/browser-credential-setup.tool.js.map +1 -1
- package/dist/tools/orchestration/build-workflow-agent.prompt.d.ts +1 -1
- package/dist/tools/orchestration/build-workflow-agent.prompt.js +43 -149
- package/dist/tools/orchestration/build-workflow-agent.prompt.js.map +1 -1
- package/dist/tools/orchestration/build-workflow-agent.tool.d.ts +11 -4
- package/dist/tools/orchestration/build-workflow-agent.tool.js +52 -82
- package/dist/tools/orchestration/build-workflow-agent.tool.js.map +1 -1
- package/dist/tools/orchestration/cancel-background-task.tool.d.ts +7 -3
- package/dist/tools/orchestration/cancel-background-task.tool.js +5 -3
- package/dist/tools/orchestration/cancel-background-task.tool.js.map +1 -1
- package/dist/tools/orchestration/correct-background-task.tool.d.ts +9 -3
- package/dist/tools/orchestration/correct-background-task.tool.js +8 -6
- package/dist/tools/orchestration/correct-background-task.tool.js.map +1 -1
- package/dist/tools/orchestration/data-table-agent.prompt.d.ts +1 -1
- package/dist/tools/orchestration/data-table-agent.prompt.js +20 -0
- package/dist/tools/orchestration/data-table-agent.prompt.js.map +1 -1
- package/dist/tools/orchestration/data-table-agent.tool.d.ts +9 -4
- package/dist/tools/orchestration/data-table-agent.tool.js +23 -25
- package/dist/tools/orchestration/data-table-agent.tool.js.map +1 -1
- package/dist/tools/orchestration/delegate.schemas.d.ts +12 -0
- package/dist/tools/orchestration/delegate.schemas.js +17 -0
- package/dist/tools/orchestration/delegate.schemas.js.map +1 -1
- package/dist/tools/orchestration/delegate.tool.d.ts +1 -10
- package/dist/tools/orchestration/delegate.tool.js +42 -41
- package/dist/tools/orchestration/delegate.tool.js.map +1 -1
- package/dist/tools/orchestration/plan-agent-prompt.d.ts +1 -0
- package/dist/tools/orchestration/plan-agent-prompt.js +76 -0
- package/dist/tools/orchestration/plan-agent-prompt.js.map +1 -0
- package/dist/tools/orchestration/plan-with-agent.tool.d.ts +2 -0
- package/dist/tools/orchestration/plan-with-agent.tool.js +277 -0
- package/dist/tools/orchestration/plan-with-agent.tool.js.map +1 -0
- package/dist/tools/orchestration/plan.tool.d.ts +7 -39
- package/dist/tools/orchestration/plan.tool.js +15 -13
- package/dist/tools/orchestration/plan.tool.js.map +1 -1
- package/dist/tools/orchestration/report-verification-verdict.tool.d.ts +23 -3
- package/dist/tools/orchestration/report-verification-verdict.tool.js +27 -28
- package/dist/tools/orchestration/report-verification-verdict.tool.js.map +1 -1
- package/dist/tools/orchestration/research-with-agent.tool.d.ts +11 -4
- package/dist/tools/orchestration/research-with-agent.tool.js +26 -21
- package/dist/tools/orchestration/research-with-agent.tool.js.map +1 -1
- package/dist/tools/orchestration/submit-plan.tool.d.ts +3 -0
- package/dist/tools/orchestration/submit-plan.tool.js +81 -0
- package/dist/tools/orchestration/submit-plan.tool.js.map +1 -0
- package/dist/tools/orchestration/update-tasks.tool.d.ts +1 -9
- package/dist/tools/orchestration/update-tasks.tool.js.map +1 -1
- package/dist/tools/orchestration/verify-built-workflow.tool.d.ts +13 -7
- package/dist/tools/orchestration/verify-built-workflow.tool.js +14 -15
- package/dist/tools/orchestration/verify-built-workflow.tool.js.map +1 -1
- package/dist/tools/shared/ask-user.tool.d.ts +42 -31
- package/dist/tools/shared/ask-user.tool.js +16 -15
- package/dist/tools/shared/ask-user.tool.js.map +1 -1
- package/dist/tools/templates/search-template-parameters.tool.d.ts +14 -7
- package/dist/tools/templates/search-template-parameters.tool.js +17 -15
- package/dist/tools/templates/search-template-parameters.tool.js.map +1 -1
- package/dist/tools/templates/search-template-structures.tool.d.ts +11 -8
- package/dist/tools/templates/search-template-structures.tool.js +13 -11
- package/dist/tools/templates/search-template-structures.tool.js.map +1 -1
- package/dist/tools/web-research/fetch-url.tool.d.ts +9 -23
- package/dist/tools/web-research/fetch-url.tool.js +30 -14
- package/dist/tools/web-research/fetch-url.tool.js.map +1 -1
- package/dist/tools/web-research/web-search.tool.d.ts +12 -2
- package/dist/tools/web-research/web-search.tool.js +20 -18
- package/dist/tools/web-research/web-search.tool.js.map +1 -1
- package/dist/tools/workflows/apply-workflow-credentials.tool.d.ts +11 -5
- package/dist/tools/workflows/apply-workflow-credentials.tool.js +7 -5
- package/dist/tools/workflows/apply-workflow-credentials.tool.js.map +1 -1
- package/dist/tools/workflows/build-workflow.tool.d.ts +26 -5
- package/dist/tools/workflows/build-workflow.tool.js +23 -20
- package/dist/tools/workflows/build-workflow.tool.js.map +1 -1
- package/dist/tools/workflows/delete-workflow.tool.d.ts +13 -14
- package/dist/tools/workflows/delete-workflow.tool.js +15 -11
- package/dist/tools/workflows/delete-workflow.tool.js.map +1 -1
- package/dist/tools/workflows/get-workflow-as-code.tool.d.ts +6 -10
- package/dist/tools/workflows/get-workflow-as-code.tool.js +5 -3
- package/dist/tools/workflows/get-workflow-as-code.tool.js.map +1 -1
- package/dist/tools/workflows/get-workflow-version.tool.d.ts +8 -16
- package/dist/tools/workflows/get-workflow-version.tool.js +6 -4
- package/dist/tools/workflows/get-workflow-version.tool.js.map +1 -1
- package/dist/tools/workflows/get-workflow.tool.d.ts +7 -15
- package/dist/tools/workflows/get-workflow.tool.js +5 -3
- package/dist/tools/workflows/get-workflow.tool.js.map +1 -1
- package/dist/tools/workflows/list-workflow-versions.tool.d.ts +11 -3
- package/dist/tools/workflows/list-workflow-versions.tool.js +13 -11
- package/dist/tools/workflows/list-workflow-versions.tool.js.map +1 -1
- package/dist/tools/workflows/list-workflows.tool.d.ts +9 -10
- package/dist/tools/workflows/list-workflows.tool.js +12 -10
- package/dist/tools/workflows/list-workflows.tool.js.map +1 -1
- package/dist/tools/workflows/materialize-node-type.tool.d.ts +29 -11
- package/dist/tools/workflows/materialize-node-type.tool.js +9 -7
- package/dist/tools/workflows/materialize-node-type.tool.js.map +1 -1
- package/dist/tools/workflows/publish-workflow.tool.d.ts +6 -20
- package/dist/tools/workflows/publish-workflow.tool.js +29 -24
- package/dist/tools/workflows/publish-workflow.tool.js.map +1 -1
- package/dist/tools/workflows/restore-workflow-version.tool.d.ts +13 -15
- package/dist/tools/workflows/restore-workflow-version.tool.js +15 -8
- package/dist/tools/workflows/restore-workflow-version.tool.js.map +1 -1
- package/dist/tools/workflows/setup-workflow.service.d.ts +0 -1
- package/dist/tools/workflows/setup-workflow.service.js +23 -6
- package/dist/tools/workflows/setup-workflow.service.js.map +1 -1
- package/dist/tools/workflows/setup-workflow.tool.d.ts +7 -144
- package/dist/tools/workflows/setup-workflow.tool.js +10 -14
- package/dist/tools/workflows/setup-workflow.tool.js.map +1 -1
- package/dist/tools/workflows/submit-workflow.tool.d.ts +12 -9
- package/dist/tools/workflows/submit-workflow.tool.js +15 -17
- package/dist/tools/workflows/submit-workflow.tool.js.map +1 -1
- package/dist/tools/workflows/unpublish-workflow.tool.d.ts +13 -15
- package/dist/tools/workflows/unpublish-workflow.tool.js +15 -11
- package/dist/tools/workflows/unpublish-workflow.tool.js.map +1 -1
- package/dist/tools/workflows/update-workflow-version.tool.d.ts +13 -3
- package/dist/tools/workflows/update-workflow-version.tool.js +12 -10
- package/dist/tools/workflows/update-workflow-version.tool.js.map +1 -1
- package/dist/tools/workflows/write-sandbox-file.tool.d.ts +9 -9
- package/dist/tools/workflows/write-sandbox-file.tool.js +8 -6
- package/dist/tools/workflows/write-sandbox-file.tool.js.map +1 -1
- package/dist/tools/workspace/cleanup-test-executions.tool.d.ts +15 -14
- package/dist/tools/workspace/cleanup-test-executions.tool.js +19 -15
- package/dist/tools/workspace/cleanup-test-executions.tool.js.map +1 -1
- package/dist/tools/workspace/create-folder.tool.d.ts +15 -16
- package/dist/tools/workspace/create-folder.tool.js +25 -12
- package/dist/tools/workspace/create-folder.tool.js.map +1 -1
- package/dist/tools/workspace/delete-folder.tool.d.ts +19 -14
- package/dist/tools/workspace/delete-folder.tool.js +24 -17
- package/dist/tools/workspace/delete-folder.tool.js.map +1 -1
- package/dist/tools/workspace/list-folders.tool.d.ts +7 -3
- package/dist/tools/workspace/list-folders.tool.js +5 -3
- package/dist/tools/workspace/list-folders.tool.js.map +1 -1
- package/dist/tools/workspace/list-projects.tool.d.ts +3 -3
- package/dist/tools/workspace/list-projects.tool.js +3 -1
- package/dist/tools/workspace/list-projects.tool.js.map +1 -1
- package/dist/tools/workspace/list-tags.tool.d.ts +3 -6
- package/dist/tools/workspace/list-tags.tool.js +3 -1
- package/dist/tools/workspace/list-tags.tool.js.map +1 -1
- package/dist/tools/workspace/move-workflow-to-folder.tool.d.ts +17 -14
- package/dist/tools/workspace/move-workflow-to-folder.tool.js +20 -16
- package/dist/tools/workspace/move-workflow-to-folder.tool.js.map +1 -1
- package/dist/tools/workspace/tag-workflow.tool.d.ts +15 -14
- package/dist/tools/workspace/tag-workflow.tool.js +16 -12
- package/dist/tools/workspace/tag-workflow.tool.js.map +1 -1
- package/dist/tracing/langsmith-tracing.d.ts +1 -0
- package/dist/tracing/langsmith-tracing.js +47 -57
- package/dist/tracing/langsmith-tracing.js.map +1 -1
- package/dist/types.d.ts +27 -50
- package/dist/utils/eval-agents.d.ts +10 -0
- package/dist/utils/eval-agents.js +54 -0
- package/dist/utils/eval-agents.js.map +1 -0
- package/dist/workflow-builder/sdk-prompt-sections.d.ts +1 -4
- package/dist/workflow-builder/sdk-prompt-sections.js +5 -513
- package/dist/workflow-builder/sdk-prompt-sections.js.map +1 -1
- package/dist/workflow-loop/guidance.js +3 -5
- package/dist/workflow-loop/guidance.js.map +1 -1
- package/dist/workspace/create-workspace.d.ts +1 -1
- package/dist/workspace/create-workspace.js +3 -2
- package/dist/workspace/create-workspace.js.map +1 -1
- package/dist/workspace/daytona-filesystem.js +15 -1
- package/dist/workspace/daytona-filesystem.js.map +1 -1
- package/dist/workspace/snapshot-manager.d.ts +4 -2
- package/dist/workspace/snapshot-manager.js +7 -2
- package/dist/workspace/snapshot-manager.js.map +1 -1
- package/package.json +29 -11
- package/dist/memory/working-memory-template.d.ts +0 -1
- package/dist/memory/working-memory-template.js +0 -25
- package/dist/memory/working-memory-template.js.map +0 -1
- package/dist/runtime/working-memory-tracing.d.ts +0 -19
- package/dist/runtime/working-memory-tracing.js +0 -111
- package/dist/runtime/working-memory-tracing.js.map +0 -1
- package/dist/tools/best-practices/guides/chatbot.d.ts +0 -1
- package/dist/tools/best-practices/guides/chatbot.js +0 -111
- package/dist/tools/best-practices/guides/chatbot.js.map +0 -1
- package/dist/tools/best-practices/guides/content-generation.d.ts +0 -1
- package/dist/tools/best-practices/guides/content-generation.js +0 -108
- package/dist/tools/best-practices/guides/content-generation.js.map +0 -1
- package/dist/tools/best-practices/guides/data-extraction.d.ts +0 -1
- package/dist/tools/best-practices/guides/data-extraction.js +0 -115
- package/dist/tools/best-practices/guides/data-extraction.js.map +0 -1
- package/dist/tools/best-practices/guides/data-persistence.d.ts +0 -1
- package/dist/tools/best-practices/guides/data-persistence.js +0 -198
- package/dist/tools/best-practices/guides/data-persistence.js.map +0 -1
- package/dist/tools/best-practices/guides/data-transformation.d.ts +0 -1
- package/dist/tools/best-practices/guides/data-transformation.js +0 -139
- package/dist/tools/best-practices/guides/data-transformation.js.map +0 -1
- package/dist/tools/best-practices/guides/document-processing.d.ts +0 -1
- package/dist/tools/best-practices/guides/document-processing.js +0 -326
- package/dist/tools/best-practices/guides/document-processing.js.map +0 -1
- package/dist/tools/best-practices/guides/form-input.d.ts +0 -1
- package/dist/tools/best-practices/guides/form-input.js +0 -166
- package/dist/tools/best-practices/guides/form-input.js.map +0 -1
- package/dist/tools/best-practices/guides/notification.d.ts +0 -1
- package/dist/tools/best-practices/guides/notification.js +0 -128
- package/dist/tools/best-practices/guides/notification.js.map +0 -1
- package/dist/tools/best-practices/guides/scheduling.d.ts +0 -1
- package/dist/tools/best-practices/guides/scheduling.js +0 -145
- package/dist/tools/best-practices/guides/scheduling.js.map +0 -1
- package/dist/tools/best-practices/guides/scraping-and-research.d.ts +0 -1
- package/dist/tools/best-practices/guides/scraping-and-research.js +0 -151
- package/dist/tools/best-practices/guides/scraping-and-research.js.map +0 -1
- package/dist/tools/best-practices/guides/triage.d.ts +0 -1
- package/dist/tools/best-practices/guides/triage.js +0 -142
- package/dist/tools/best-practices/guides/triage.js.map +0 -1
- package/dist/tools/filesystem/get-file-tree.tool.d.ts +0 -22
- package/dist/tools/filesystem/get-file-tree.tool.js +0 -64
- package/dist/tools/filesystem/get-file-tree.tool.js.map +0 -1
- package/dist/tools/filesystem/list-files.tool.d.ts +0 -30
- package/dist/tools/filesystem/list-files.tool.js +0 -100
- package/dist/tools/filesystem/list-files.tool.js.map +0 -1
- package/dist/tools/filesystem/read-file.tool.d.ts +0 -25
- package/dist/tools/filesystem/read-file.tool.js +0 -83
- package/dist/tools/filesystem/read-file.tool.js.map +0 -1
- package/dist/tools/filesystem/search-files.tool.d.ts +0 -31
- package/dist/tools/filesystem/search-files.tool.js +0 -96
- package/dist/tools/filesystem/search-files.tool.js.map +0 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Agent, Tool, type GenerateResult } from '@n8n/agents';
|
|
2
|
+
export { Tool };
|
|
3
|
+
export declare const SONNET_MODEL = "anthropic/claude-sonnet-4-6";
|
|
4
|
+
export declare const HAIKU_MODEL = "anthropic/claude-haiku-4-5-20251001";
|
|
5
|
+
export declare function createEvalAgent(name: string, options: {
|
|
6
|
+
model?: string;
|
|
7
|
+
instructions: string;
|
|
8
|
+
cache?: boolean;
|
|
9
|
+
}): Agent;
|
|
10
|
+
export declare function extractText(result: GenerateResult): string;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HAIKU_MODEL = exports.SONNET_MODEL = exports.Tool = void 0;
|
|
4
|
+
exports.createEvalAgent = createEvalAgent;
|
|
5
|
+
exports.extractText = extractText;
|
|
6
|
+
const agents_1 = require("@n8n/agents");
|
|
7
|
+
Object.defineProperty(exports, "Tool", { enumerable: true, get: function () { return agents_1.Tool; } });
|
|
8
|
+
exports.SONNET_MODEL = 'anthropic/claude-sonnet-4-6';
|
|
9
|
+
exports.HAIKU_MODEL = 'anthropic/claude-haiku-4-5-20251001';
|
|
10
|
+
function getApiKey() {
|
|
11
|
+
const key = process.env.N8N_INSTANCE_AI_MODEL_API_KEY ?? process.env.N8N_AI_ANTHROPIC_KEY;
|
|
12
|
+
if (!key) {
|
|
13
|
+
throw new Error('Missing API key. Set N8N_INSTANCE_AI_MODEL_API_KEY (or N8N_AI_ANTHROPIC_KEY) in your environment.');
|
|
14
|
+
}
|
|
15
|
+
return key;
|
|
16
|
+
}
|
|
17
|
+
const CACHE_PROVIDER_OPTS = {
|
|
18
|
+
providerOptions: {
|
|
19
|
+
anthropic: { cacheControl: { type: 'ephemeral' } },
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
function createEvalAgent(name, options) {
|
|
23
|
+
const agent = new agents_1.Agent(name).model({
|
|
24
|
+
id: options.model ?? exports.SONNET_MODEL,
|
|
25
|
+
apiKey: getApiKey(),
|
|
26
|
+
});
|
|
27
|
+
if (options.cache) {
|
|
28
|
+
agent.instructions(options.instructions, CACHE_PROVIDER_OPTS);
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
agent.instructions(options.instructions);
|
|
32
|
+
}
|
|
33
|
+
return agent;
|
|
34
|
+
}
|
|
35
|
+
function extractText(result) {
|
|
36
|
+
const texts = [];
|
|
37
|
+
for (const msg of result.messages) {
|
|
38
|
+
if (!('role' in msg) || msg.role !== 'assistant')
|
|
39
|
+
continue;
|
|
40
|
+
if (!('content' in msg) || !Array.isArray(msg.content))
|
|
41
|
+
continue;
|
|
42
|
+
for (const part of msg.content) {
|
|
43
|
+
if (typeof part === 'object' &&
|
|
44
|
+
part !== null &&
|
|
45
|
+
'type' in part &&
|
|
46
|
+
part.type === 'text' &&
|
|
47
|
+
'text' in part) {
|
|
48
|
+
texts.push(String(part.text));
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return texts.join('');
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=eval-agents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eval-agents.js","sourceRoot":"","sources":["../../src/utils/eval-agents.ts"],"names":[],"mappings":";;;AA0CA,0CAoBC;AAMD,kCAkBC;AA/ED,wCAA+D;AAEtD,qFAFO,aAAI,OAEP;AAMA,QAAA,YAAY,GAAG,6BAA6B,CAAC;AAC7C,QAAA,WAAW,GAAG,qCAAqC,CAAC;AAMjE,SAAS,SAAS;IACjB,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,6BAA6B,IAAI,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC;IAC1F,IAAI,CAAC,GAAG,EAAE,CAAC;QACV,MAAM,IAAI,KAAK,CACd,mGAAmG,CACnG,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACZ,CAAC;AAMD,MAAM,mBAAmB,GAAG;IAC3B,eAAe,EAAE;QAChB,SAAS,EAAE,EAAE,YAAY,EAAE,EAAE,IAAI,EAAE,WAAoB,EAAE,EAAE;KAC3D;CACD,CAAC;AAEF,SAAgB,eAAe,CAC9B,IAAY,EACZ,OAIC;IAED,MAAM,KAAK,GAAG,IAAI,cAAK,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC;QACnC,EAAE,EAAE,OAAO,CAAC,KAAK,IAAI,oBAAY;QACjC,MAAM,EAAE,SAAS,EAAE;KACnB,CAAC,CAAC;IAEH,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;QACnB,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,YAAY,EAAE,mBAAmB,CAAC,CAAC;IAC/D,CAAC;SAAM,CAAC;QACP,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;IAC1C,CAAC;IAED,OAAO,KAAK,CAAC;AACd,CAAC;AAMD,SAAgB,WAAW,CAAC,MAAsB;IACjD,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;QACnC,IAAI,CAAC,CAAC,MAAM,IAAI,GAAG,CAAC,IAAI,GAAG,CAAC,IAAI,KAAK,WAAW;YAAE,SAAS;QAC3D,IAAI,CAAC,CAAC,SAAS,IAAI,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC;YAAE,SAAS;QACjE,KAAK,MAAM,IAAI,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC;YAChC,IACC,OAAO,IAAI,KAAK,QAAQ;gBACxB,IAAI,KAAK,IAAI;gBACb,MAAM,IAAI,IAAI;gBACd,IAAI,CAAC,IAAI,KAAK,MAAM;gBACpB,MAAM,IAAI,IAAI,EACb,CAAC;gBACF,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;YAC/B,CAAC;QACF,CAAC;IACF,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACvB,CAAC"}
|
|
@@ -1,4 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
export declare const ADDITIONAL_FUNCTIONS = "Additional SDK functions:\n\n- `placeholder('hint')` \u2014 marks a parameter value for user input. Use directly as the parameter value \u2014 never wrap in `expr()`, objects, or arrays.\n Example: `parameters: { url: placeholder('Your API URL (e.g. https://api.example.com/v1)') }`\n\n- `sticky('content', nodes?, config?)` \u2014 creates a sticky note on the canvas.\n Example: `sticky('## Data Processing', [httpNode, setNode], { color: 2 })`\n\n- `.output(n)` \u2014 selects a specific output index for multi-output nodes. IF and Switch have dedicated methods (`onTrue/onFalse`, `onCase`), but `.output(n)` works as a generic alternative.\n Example: `classifier.output(1).to(categoryB)`\n\n- `.onError(handler)` \u2014 connects a node's error output to a handler node. Requires `onError: 'continueErrorOutput'` in the node config.\n Example: `httpNode.onError(errorHandler)` (with `config: { onError: 'continueErrorOutput' }`)\n\n- Additional subnode factories (all follow the same pattern as `languageModel()` and `tool()`):\n `memory()`, `outputParser()`, `embeddings()`, `vectorStore()`, `retriever()`, `documentLoader()`, `textSplitter()`";
|
|
3
|
-
export declare const WORKFLOW_RULES = "Follow these rules strictly when generating workflows:\n\n1. **Always use newCredential() for authentication**\n - When a node needs credentials, always use `newCredential('Name')` in the credentials config\n - NEVER use placeholder strings, fake API keys, or hardcoded auth values\n - Example: `credentials: { slackApi: newCredential('Slack Bot') }`\n - The credential type must match what the node expects\n\n2. **Handle empty outputs with `alwaysOutputData: true`**\n - Nodes that query data (Data Table get, Google Sheets lookup, HTTP Request, etc.) may return 0 items\n - When a node returns 0 items, all downstream nodes are SKIPPED \u2014 the workflow chain breaks silently\n - Set `alwaysOutputData: true` on any node whose output feeds downstream nodes and might return empty results\n - Common cases: fresh/empty Data Tables, filtered queries, conditional lookups, API searches with no matches\n - Example: `config: { ..., alwaysOutputData: true }`\n\n3. **Use `executeOnce: true` for single-execution nodes**\n - When a node receives N items but should only execute once (not N times), set `executeOnce: true`\n - Common cases: sending a summary notification, generating a report, calling an API that doesn't need per-item execution\n - Example: `config: { ..., executeOnce: true }`";
|
|
4
|
-
export declare const WORKFLOW_SDK_PATTERNS = "<linear_chain>\n```javascript\nimport { workflow, node, trigger, sticky, placeholder, newCredential, ifElse, switchCase, merge, splitInBatches, nextBatch, languageModel, memory, tool, outputParser, embedding, embeddings, vectorStore, retriever, documentLoader, textSplitter, fromAi, expr } from '@n8n/workflow-sdk';\n\n// 1. Define all nodes first\nconst startTrigger = trigger({\n type: 'n8n-nodes-base.manualTrigger',\n version: 1,\n config: { name: 'Start' }\n});\n\nconst fetchData = node({\n type: 'n8n-nodes-base.httpRequest',\n version: 4.3,\n config: { name: 'Fetch Data', parameters: { method: 'GET', url: '...' } }\n});\n\nconst processData = node({\n type: 'n8n-nodes-base.set',\n version: 3.4,\n config: { name: 'Process Data', parameters: {} }\n});\n\n// 2. Compose workflow\nexport default workflow('id', 'name')\n .add(startTrigger)\n .to(fetchData)\n .to(processData);\n```\n\n</linear_chain>\n\n<independent_sources>\nWhen nodes return more than 1 item, chaining causes item multiplication: if Source A returns N items, a chained Source B runs N times instead of once.\n\n**When to use `executeOnce: true`:**\n- A node fetches data independently but is chained after another data source (prevents N\u00D7M multiplication)\n- A node should summarize/aggregate all upstream items in a single call (e.g., AI summary, send one notification)\n- A node calls an API that doesn't vary per input item\n\nFix with `executeOnce: true` (simplest) or parallel branches + Merge (when combining results):\n\n```javascript\n// sourceA outputs 10 items. sourceB outputs 10 items.\n// WRONG - processResults runs 100 times\n// startTrigger.to(sourceA.to(sourceB.to(processResults)))\n\n// FIX 1 - executeOnce: sourceB runs once regardless of input items\nconst sourceB = node({ ..., config: { ..., executeOnce: true } });\nstartTrigger.to(sourceA.to(sourceB.to(processResults)));\n\n// FIX 2 - parallel branches + Merge (combine by position)\nconst combineResults = merge({\n version: 3.2,\n config: { name: 'Combine Results', parameters: { mode: 'combine', combineBy: 'combineByPosition' } }\n});\nexport default workflow('id', 'name')\n .add(startTrigger)\n .to(sourceA.to(combineResults.input(0)))\n .add(startTrigger)\n .to(sourceB.to(combineResults.input(1)))\n .add(combineResults)\n .to(processResults);\n\n// FIX 3 - parallel branches + Merge (append)\nconst allResults = merge({\n version: 3.2,\n config: { name: 'All Results', parameters: { mode: 'append' } }\n});\nexport default workflow('id', 'name')\n .add(startTrigger)\n .to(sourceA.to(allResults.input(0)))\n .add(startTrigger)\n .to(sourceB.to(allResults.input(1)))\n .add(allResults)\n .to(processResults);\n```\n\n</independent_sources>\n\n<zero_item_safety>\nNodes that fetch or filter data may return 0 items, which stops the entire downstream chain.\nUse `alwaysOutputData: true` on data-fetching nodes to ensure the chain continues with an empty item `{json: {}}`.\n\n```javascript\n// Data Table might be empty (fresh table, no matching rows)\nconst getReflections = node({\n type: 'n8n-nodes-base.dataTable',\n version: 1.1,\n config: {\n name: 'Get Reflections',\n alwaysOutputData: true, // Chain continues even if table is empty\n parameters: { resource: 'row', operation: 'get', returnAll: true }\n }\n});\n\n// Downstream Code node handles the empty case\nconst processData = node({\n type: 'n8n-nodes-base.code',\n version: 2,\n config: {\n name: 'Process Data',\n parameters: {\n mode: 'runOnceForAllItems',\n jsCode: \\`\nconst items = $input.all();\n// items will be [{json: {}}] if upstream had no data\nconst hasData = items.length > 0 && Object.keys(items[0].json).length > 0;\n// ... handle both cases\n\\`.trim()\n }\n }\n});\n```\n\n**When to use `alwaysOutputData: true`:**\n- Data Table with `operation: 'get'` (table may be empty or freshly created)\n- Any lookup/search/filter node whose result feeds into downstream processing\n- HTTP Request that may return an empty array\n\n**When NOT to use it:**\n- Trigger nodes (they always produce output)\n- Code nodes (handle empty input in your code logic instead)\n- Nodes at the end of the chain (no downstream to protect)\n\n</zero_item_safety>\n\n<conditional_branching>\n\n**CRITICAL:** Each branch defines a COMPLETE processing path. Chain multiple steps INSIDE the branch using .to().\n\n```javascript\n// Assume other nodes are declared\nconst checkValid = ifElse({ version: 2.2, config: { name: 'Check Valid', parameters: {...} } });\n\nexport default workflow('id', 'name')\n .add(startTrigger)\n .to(checkValid\n .onTrue(formatData.to(enrichData.to(saveToDb))) // Chain 3 nodes on true branch\n .onFalse(logError));\n```\n\n</conditional_branching>\n\n<multi_way_routing>\n\n```javascript\n// Assume other nodes are declared\nconst routeByPriority = switchCase({ version: 3.2, config: { name: 'Route by Priority', parameters: {...} } });\n\nexport default workflow('id', 'name')\n .add(startTrigger)\n .to(routeByPriority\n .onCase(0, processUrgent.to(notifyTeam.to(escalate))) // Chain of 3 nodes\n .onCase(1, processNormal)\n .onCase(2, archive));\n```\n\n</multi_way_routing>\n\n<parallel_execution>\n```javascript\n// First declare the Merge node using merge()\nconst combineResults = merge({\n version: 3.2,\n config: { name: 'Combine Results', parameters: { mode: 'combine' } }\n});\n\n// Declare branch nodes\nconst branch1 = node({ type: 'n8n-nodes-base.httpRequest', ... });\nconst branch2 = node({ type: 'n8n-nodes-base.httpRequest', ... });\nconst processResults = node({ type: 'n8n-nodes-base.set', ... });\n\n// Connect branches to specific merge inputs using .input(n)\nexport default workflow('id', 'name')\n .add(trigger({ ... }))\n .to(branch1.to(combineResults.input(0))) // Connect to input 0\n .add(trigger({ ... }))\n .to(branch2.to(combineResults.input(1))) // Connect to input 1\n .add(combineResults)\n .to(processResults); // Process merged results\n```\n\n</parallel_execution>\n\n<batch_processing>\n```javascript\nconst startTrigger = trigger({\n type: 'n8n-nodes-base.manualTrigger',\n version: 1,\n config: { name: 'Start' }\n});\n\nconst fetchRecords = node({\n type: 'n8n-nodes-base.httpRequest',\n version: 4.3,\n config: { name: 'Fetch Records', parameters: { method: 'GET', url: '...' } }\n});\n\nconst finalizeResults = node({\n type: 'n8n-nodes-base.set',\n version: 3.4,\n config: { name: 'Finalize', parameters: {} }\n});\n\nconst processRecord = node({\n type: 'n8n-nodes-base.httpRequest',\n version: 4.3,\n config: { name: 'Process Record', parameters: { method: 'POST', url: '...' } }\n});\n\nconst sibNode = splitInBatches({ version: 3, config: { name: 'Batch Process', parameters: { batchSize: 10 } } });\n\nexport default workflow('id', 'name')\n .add(startTrigger)\n .to(fetchRecords)\n .to(sibNode\n .onDone(finalizeResults)\n .onEachBatch(processRecord.to(nextBatch(sibNode)))\n );\n```\n\n</batch_processing>\n\n<multiple_triggers>\n```javascript\nconst webhookTrigger = trigger({\n type: 'n8n-nodes-base.webhook',\n version: 2.1,\n config: { name: 'Webhook' }\n});\n\nconst processWebhook = node({\n type: 'n8n-nodes-base.set',\n version: 3.4,\n config: { name: 'Process Webhook', parameters: {} }\n});\n\nconst scheduleTrigger = trigger({\n type: 'n8n-nodes-base.scheduleTrigger',\n version: 1.3,\n config: { name: 'Daily Schedule', parameters: {} }\n});\n\nconst processSchedule = node({\n type: 'n8n-nodes-base.set',\n version: 3.4,\n config: { name: 'Process Schedule', parameters: {} }\n});\n\nexport default workflow('id', 'name')\n .add(webhookTrigger)\n .to(processWebhook)\n .add(scheduleTrigger)\n .to(processSchedule);\n```\n\n</multiple_triggers>\n\n<fan_in>\n```javascript\n// Each trigger's execution runs in COMPLETE ISOLATION.\n// Different branches have no effect on each other.\n// Never duplicate chains for \"isolation\" - it's already guaranteed.\n\nconst webhookTrigger = trigger({\n type: 'n8n-nodes-base.webhook',\n version: 2.1,\n config: { name: 'Webhook Trigger' }\n});\n\nconst scheduleTrigger = trigger({\n type: 'n8n-nodes-base.scheduleTrigger',\n version: 1.3,\n config: { name: 'Daily Schedule' }\n});\n\nconst processData = node({\n type: 'n8n-nodes-base.set',\n version: 3.4,\n config: { name: 'Process Data', parameters: {} }\n});\n\nconst sendNotification = node({\n type: 'n8n-nodes-base.slack',\n version: 2.3,\n config: { name: 'Notify Slack', parameters: {} }\n});\n\nexport default workflow('id', 'name')\n .add(webhookTrigger)\n .to(processData)\n .to(sendNotification)\n .add(scheduleTrigger)\n .to(processData);\n```\n\n</fan_in>\n\n<ai_agent_basic>\n```javascript\nconst openAiModel = languageModel({\n type: '@n8n/n8n-nodes-langchain.lmChatOpenAi',\n version: 1.3,\n config: { name: 'OpenAI Model', parameters: {} }\n});\n\nconst startTrigger = trigger({\n type: 'n8n-nodes-base.manualTrigger',\n version: 1,\n config: { name: 'Start' }\n});\n\nconst aiAgent = node({\n type: '@n8n/n8n-nodes-langchain.agent',\n version: 3.1,\n config: {\n name: 'AI Assistant',\n parameters: { promptType: 'define', text: 'You are a helpful assistant' },\n subnodes: { model: openAiModel }\n }\n});\n\nexport default workflow('ai-assistant', 'AI Assistant')\n .add(startTrigger)\n .to(aiAgent);\n```\n\n</ai_agent_basic>\n\n<ai_agent_with_tools>\n```javascript\nconst openAiModel = languageModel({\n type: '@n8n/n8n-nodes-langchain.lmChatOpenAi',\n version: 1.3,\n config: {\n name: 'OpenAI Model',\n parameters: {},\n credentials: { openAiApi: newCredential('OpenAI') }\n }\n});\n\nconst calculatorTool = tool({\n type: '@n8n/n8n-nodes-langchain.toolCalculator',\n version: 1,\n config: { name: 'Calculator', parameters: {} }\n});\n\nconst startTrigger = trigger({\n type: 'n8n-nodes-base.manualTrigger',\n version: 1,\n config: { name: 'Start' }\n});\n\nconst aiAgent = node({\n type: '@n8n/n8n-nodes-langchain.agent',\n version: 3.1,\n config: {\n name: 'Math Agent',\n parameters: { promptType: 'define', text: 'You can use tools to help users' },\n subnodes: { model: openAiModel, tools: [calculatorTool] }\n }\n});\n\nexport default workflow('ai-calculator', 'AI Calculator')\n .add(startTrigger)\n .to(aiAgent);\n```\n\n</ai_agent_with_tools>\n\n<ai_agent_with_from_ai>\n```javascript\nconst openAiModel = languageModel({\n type: '@n8n/n8n-nodes-langchain.lmChatOpenAi',\n version: 1.3,\n config: {\n name: 'OpenAI Model',\n parameters: {},\n credentials: { openAiApi: newCredential('OpenAI') }\n }\n});\n\nconst gmailTool = tool({\n type: 'n8n-nodes-base.gmailTool',\n version: 1,\n config: {\n name: 'Gmail Tool',\n parameters: {\n sendTo: fromAi('recipient', 'Email address'),\n subject: fromAi('subject', 'Email subject'),\n message: fromAi('body', 'Email content')\n },\n credentials: { gmailOAuth2: newCredential('Gmail') }\n }\n});\n\nconst startTrigger = trigger({\n type: 'n8n-nodes-base.manualTrigger',\n version: 1,\n config: { name: 'Start' }\n});\n\nconst aiAgent = node({\n type: '@n8n/n8n-nodes-langchain.agent',\n version: 3.1,\n config: {\n name: 'Email Agent',\n parameters: { promptType: 'define', text: 'You can send emails' },\n subnodes: { model: openAiModel, tools: [gmailTool] }\n }\n});\n\nexport default workflow('ai-email', 'AI Email Sender')\n .add(startTrigger)\n .to(aiAgent);\n```\n</ai_agent_with_from_ai>\n\n<ai_agent_with_structured_output>\n```javascript\nconst structuredParser = outputParser({\n type: '@n8n/n8n-nodes-langchain.outputParserStructured',\n version: 1.3,\n config: {\n name: 'Structured Output Parser',\n parameters: {\n schemaType: 'fromJson',\n jsonSchemaExample: '{ \"sentiment\": \"positive\", \"confidence\": 0.95, \"summary\": \"brief summary\" }'\n }\n }\n});\n\nconst aiAgent = node({\n type: '@n8n/n8n-nodes-langchain.agent',\n version: 3.1,\n config: {\n name: 'Sentiment Analyzer',\n parameters: { promptType: 'define', text: 'Analyze the sentiment of the input text', hasOutputParser: true },\n subnodes: { model: openAiModel, outputParser: structuredParser }\n }\n});\n\nexport default workflow('ai-sentiment', 'AI Sentiment Analyzer')\n .add(startTrigger)\n .to(aiAgent);\n```\n</ai_agent_with_structured_output>";
|
|
1
|
+
export { EXPRESSION_REFERENCE, ADDITIONAL_FUNCTIONS, WORKFLOW_RULES, WORKFLOW_SDK_PATTERNS, } from '@n8n/workflow-sdk/prompts/sdk-reference';
|
|
@@ -1,517 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.WORKFLOW_SDK_PATTERNS = exports.WORKFLOW_RULES = exports.ADDITIONAL_FUNCTIONS = exports.EXPRESSION_REFERENCE = void 0;
|
|
4
|
-
|
|
5
|
-
exports
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
- \`$input.first()\` — first item from immediate predecessor
|
|
10
|
-
- \`$input.all()\` — all items from immediate predecessor
|
|
11
|
-
- \`$input.item\` — current item being processed
|
|
12
|
-
- \`$binary\` — binary data of current item from immediate predecessor
|
|
13
|
-
- \`$now\` — current date/time (Luxon DateTime). Example: \`$now.toISO()\`
|
|
14
|
-
- \`$today\` — start of today (Luxon DateTime). Example: \`$today.plus(1, 'days')\`
|
|
15
|
-
- \`$itemIndex\` — index of current item being processed
|
|
16
|
-
- \`$runIndex\` — current run index
|
|
17
|
-
- \`$execution.id\` — unique execution ID
|
|
18
|
-
- \`$execution.mode\` — 'test' or 'production'
|
|
19
|
-
- \`$workflow.id\` — workflow ID
|
|
20
|
-
- \`$workflow.name\` — workflow name
|
|
21
|
-
|
|
22
|
-
String composition — variables MUST always be inside \`{{ }}\`, never outside as JS variables:
|
|
23
|
-
|
|
24
|
-
- \`expr('Hello {{ $json.name }}, welcome!')\` — variable embedded in text
|
|
25
|
-
- \`expr('Report for {{ $now.toFormat("MMMM d, yyyy") }} - {{ $json.title }}')\` — multiple variables with method call
|
|
26
|
-
- \`expr('{{ $json.firstName }} {{ $json.lastName }}')\` — combining multiple fields
|
|
27
|
-
- \`expr('Total: {{ $json.items.length }} items, updated {{ $now.toISO() }}')\` — expressions with method calls
|
|
28
|
-
- \`expr('Status: {{ $json.count > 0 ? "active" : "empty" }}')\` — inline ternary
|
|
29
|
-
|
|
30
|
-
Dynamic data from other nodes — \`$()\` MUST always be inside \`{{ }}\`, never used as plain JavaScript:
|
|
31
|
-
|
|
32
|
-
- WRONG: \`expr('{{ ' + JSON.stringify($('Source').all().map(i => i.json.name)) + ' }}')\` — $() outside {{ }}
|
|
33
|
-
- CORRECT: \`expr('{{ $("Source").all().map(i => ({ option: i.json.name })) }}')\` — $() inside {{ }}`;
|
|
34
|
-
exports.ADDITIONAL_FUNCTIONS = `Additional SDK functions:
|
|
35
|
-
|
|
36
|
-
- \`placeholder('hint')\` — marks a parameter value for user input. Use directly as the parameter value — never wrap in \`expr()\`, objects, or arrays.
|
|
37
|
-
Example: \`parameters: { url: placeholder('Your API URL (e.g. https://api.example.com/v1)') }\`
|
|
38
|
-
|
|
39
|
-
- \`sticky('content', nodes?, config?)\` — creates a sticky note on the canvas.
|
|
40
|
-
Example: \`sticky('## Data Processing', [httpNode, setNode], { color: 2 })\`
|
|
41
|
-
|
|
42
|
-
- \`.output(n)\` — selects a specific output index for multi-output nodes. IF and Switch have dedicated methods (\`onTrue/onFalse\`, \`onCase\`), but \`.output(n)\` works as a generic alternative.
|
|
43
|
-
Example: \`classifier.output(1).to(categoryB)\`
|
|
44
|
-
|
|
45
|
-
- \`.onError(handler)\` — connects a node's error output to a handler node. Requires \`onError: 'continueErrorOutput'\` in the node config.
|
|
46
|
-
Example: \`httpNode.onError(errorHandler)\` (with \`config: { onError: 'continueErrorOutput' }\`)
|
|
47
|
-
|
|
48
|
-
- Additional subnode factories (all follow the same pattern as \`languageModel()\` and \`tool()\`):
|
|
49
|
-
\`memory()\`, \`outputParser()\`, \`embeddings()\`, \`vectorStore()\`, \`retriever()\`, \`documentLoader()\`, \`textSplitter()\``;
|
|
50
|
-
exports.WORKFLOW_RULES = `Follow these rules strictly when generating workflows:
|
|
51
|
-
|
|
52
|
-
1. **Always use newCredential() for authentication**
|
|
53
|
-
- When a node needs credentials, always use \`newCredential('Name')\` in the credentials config
|
|
54
|
-
- NEVER use placeholder strings, fake API keys, or hardcoded auth values
|
|
55
|
-
- Example: \`credentials: { slackApi: newCredential('Slack Bot') }\`
|
|
56
|
-
- The credential type must match what the node expects
|
|
57
|
-
|
|
58
|
-
2. **Handle empty outputs with \`alwaysOutputData: true\`**
|
|
59
|
-
- Nodes that query data (Data Table get, Google Sheets lookup, HTTP Request, etc.) may return 0 items
|
|
60
|
-
- When a node returns 0 items, all downstream nodes are SKIPPED — the workflow chain breaks silently
|
|
61
|
-
- Set \`alwaysOutputData: true\` on any node whose output feeds downstream nodes and might return empty results
|
|
62
|
-
- Common cases: fresh/empty Data Tables, filtered queries, conditional lookups, API searches with no matches
|
|
63
|
-
- Example: \`config: { ..., alwaysOutputData: true }\`
|
|
64
|
-
|
|
65
|
-
3. **Use \`executeOnce: true\` for single-execution nodes**
|
|
66
|
-
- When a node receives N items but should only execute once (not N times), set \`executeOnce: true\`
|
|
67
|
-
- Common cases: sending a summary notification, generating a report, calling an API that doesn't need per-item execution
|
|
68
|
-
- Example: \`config: { ..., executeOnce: true }\``;
|
|
69
|
-
exports.WORKFLOW_SDK_PATTERNS = `<linear_chain>
|
|
70
|
-
\`\`\`javascript
|
|
71
|
-
${extract_code_1.SDK_IMPORT_STATEMENT}
|
|
72
|
-
|
|
73
|
-
// 1. Define all nodes first
|
|
74
|
-
const startTrigger = trigger({
|
|
75
|
-
type: 'n8n-nodes-base.manualTrigger',
|
|
76
|
-
version: 1,
|
|
77
|
-
config: { name: 'Start' }
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
const fetchData = node({
|
|
81
|
-
type: 'n8n-nodes-base.httpRequest',
|
|
82
|
-
version: 4.3,
|
|
83
|
-
config: { name: 'Fetch Data', parameters: { method: 'GET', url: '...' } }
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
const processData = node({
|
|
87
|
-
type: 'n8n-nodes-base.set',
|
|
88
|
-
version: 3.4,
|
|
89
|
-
config: { name: 'Process Data', parameters: {} }
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
// 2. Compose workflow
|
|
93
|
-
export default workflow('id', 'name')
|
|
94
|
-
.add(startTrigger)
|
|
95
|
-
.to(fetchData)
|
|
96
|
-
.to(processData);
|
|
97
|
-
\`\`\`
|
|
98
|
-
|
|
99
|
-
</linear_chain>
|
|
100
|
-
|
|
101
|
-
<independent_sources>
|
|
102
|
-
When nodes return more than 1 item, chaining causes item multiplication: if Source A returns N items, a chained Source B runs N times instead of once.
|
|
103
|
-
|
|
104
|
-
**When to use \`executeOnce: true\`:**
|
|
105
|
-
- A node fetches data independently but is chained after another data source (prevents N×M multiplication)
|
|
106
|
-
- A node should summarize/aggregate all upstream items in a single call (e.g., AI summary, send one notification)
|
|
107
|
-
- A node calls an API that doesn't vary per input item
|
|
108
|
-
|
|
109
|
-
Fix with \`executeOnce: true\` (simplest) or parallel branches + Merge (when combining results):
|
|
110
|
-
|
|
111
|
-
\`\`\`javascript
|
|
112
|
-
// sourceA outputs 10 items. sourceB outputs 10 items.
|
|
113
|
-
// WRONG - processResults runs 100 times
|
|
114
|
-
// startTrigger.to(sourceA.to(sourceB.to(processResults)))
|
|
115
|
-
|
|
116
|
-
// FIX 1 - executeOnce: sourceB runs once regardless of input items
|
|
117
|
-
const sourceB = node({ ..., config: { ..., executeOnce: true } });
|
|
118
|
-
startTrigger.to(sourceA.to(sourceB.to(processResults)));
|
|
119
|
-
|
|
120
|
-
// FIX 2 - parallel branches + Merge (combine by position)
|
|
121
|
-
const combineResults = merge({
|
|
122
|
-
version: 3.2,
|
|
123
|
-
config: { name: 'Combine Results', parameters: { mode: 'combine', combineBy: 'combineByPosition' } }
|
|
124
|
-
});
|
|
125
|
-
export default workflow('id', 'name')
|
|
126
|
-
.add(startTrigger)
|
|
127
|
-
.to(sourceA.to(combineResults.input(0)))
|
|
128
|
-
.add(startTrigger)
|
|
129
|
-
.to(sourceB.to(combineResults.input(1)))
|
|
130
|
-
.add(combineResults)
|
|
131
|
-
.to(processResults);
|
|
132
|
-
|
|
133
|
-
// FIX 3 - parallel branches + Merge (append)
|
|
134
|
-
const allResults = merge({
|
|
135
|
-
version: 3.2,
|
|
136
|
-
config: { name: 'All Results', parameters: { mode: 'append' } }
|
|
137
|
-
});
|
|
138
|
-
export default workflow('id', 'name')
|
|
139
|
-
.add(startTrigger)
|
|
140
|
-
.to(sourceA.to(allResults.input(0)))
|
|
141
|
-
.add(startTrigger)
|
|
142
|
-
.to(sourceB.to(allResults.input(1)))
|
|
143
|
-
.add(allResults)
|
|
144
|
-
.to(processResults);
|
|
145
|
-
\`\`\`
|
|
146
|
-
|
|
147
|
-
</independent_sources>
|
|
148
|
-
|
|
149
|
-
<zero_item_safety>
|
|
150
|
-
Nodes that fetch or filter data may return 0 items, which stops the entire downstream chain.
|
|
151
|
-
Use \`alwaysOutputData: true\` on data-fetching nodes to ensure the chain continues with an empty item \`{json: {}}\`.
|
|
152
|
-
|
|
153
|
-
\`\`\`javascript
|
|
154
|
-
// Data Table might be empty (fresh table, no matching rows)
|
|
155
|
-
const getReflections = node({
|
|
156
|
-
type: 'n8n-nodes-base.dataTable',
|
|
157
|
-
version: 1.1,
|
|
158
|
-
config: {
|
|
159
|
-
name: 'Get Reflections',
|
|
160
|
-
alwaysOutputData: true, // Chain continues even if table is empty
|
|
161
|
-
parameters: { resource: 'row', operation: 'get', returnAll: true }
|
|
162
|
-
}
|
|
163
|
-
});
|
|
164
|
-
|
|
165
|
-
// Downstream Code node handles the empty case
|
|
166
|
-
const processData = node({
|
|
167
|
-
type: 'n8n-nodes-base.code',
|
|
168
|
-
version: 2,
|
|
169
|
-
config: {
|
|
170
|
-
name: 'Process Data',
|
|
171
|
-
parameters: {
|
|
172
|
-
mode: 'runOnceForAllItems',
|
|
173
|
-
jsCode: \\\`
|
|
174
|
-
const items = $input.all();
|
|
175
|
-
// items will be [{json: {}}] if upstream had no data
|
|
176
|
-
const hasData = items.length > 0 && Object.keys(items[0].json).length > 0;
|
|
177
|
-
// ... handle both cases
|
|
178
|
-
\\\`.trim()
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
});
|
|
182
|
-
\`\`\`
|
|
183
|
-
|
|
184
|
-
**When to use \`alwaysOutputData: true\`:**
|
|
185
|
-
- Data Table with \`operation: 'get'\` (table may be empty or freshly created)
|
|
186
|
-
- Any lookup/search/filter node whose result feeds into downstream processing
|
|
187
|
-
- HTTP Request that may return an empty array
|
|
188
|
-
|
|
189
|
-
**When NOT to use it:**
|
|
190
|
-
- Trigger nodes (they always produce output)
|
|
191
|
-
- Code nodes (handle empty input in your code logic instead)
|
|
192
|
-
- Nodes at the end of the chain (no downstream to protect)
|
|
193
|
-
|
|
194
|
-
</zero_item_safety>
|
|
195
|
-
|
|
196
|
-
<conditional_branching>
|
|
197
|
-
|
|
198
|
-
**CRITICAL:** Each branch defines a COMPLETE processing path. Chain multiple steps INSIDE the branch using .to().
|
|
199
|
-
|
|
200
|
-
\`\`\`javascript
|
|
201
|
-
// Assume other nodes are declared
|
|
202
|
-
const checkValid = ifElse({ version: 2.2, config: { name: 'Check Valid', parameters: {...} } });
|
|
203
|
-
|
|
204
|
-
export default workflow('id', 'name')
|
|
205
|
-
.add(startTrigger)
|
|
206
|
-
.to(checkValid
|
|
207
|
-
.onTrue(formatData.to(enrichData.to(saveToDb))) // Chain 3 nodes on true branch
|
|
208
|
-
.onFalse(logError));
|
|
209
|
-
\`\`\`
|
|
210
|
-
|
|
211
|
-
</conditional_branching>
|
|
212
|
-
|
|
213
|
-
<multi_way_routing>
|
|
214
|
-
|
|
215
|
-
\`\`\`javascript
|
|
216
|
-
// Assume other nodes are declared
|
|
217
|
-
const routeByPriority = switchCase({ version: 3.2, config: { name: 'Route by Priority', parameters: {...} } });
|
|
218
|
-
|
|
219
|
-
export default workflow('id', 'name')
|
|
220
|
-
.add(startTrigger)
|
|
221
|
-
.to(routeByPriority
|
|
222
|
-
.onCase(0, processUrgent.to(notifyTeam.to(escalate))) // Chain of 3 nodes
|
|
223
|
-
.onCase(1, processNormal)
|
|
224
|
-
.onCase(2, archive));
|
|
225
|
-
\`\`\`
|
|
226
|
-
|
|
227
|
-
</multi_way_routing>
|
|
228
|
-
|
|
229
|
-
<parallel_execution>
|
|
230
|
-
\`\`\`javascript
|
|
231
|
-
// First declare the Merge node using merge()
|
|
232
|
-
const combineResults = merge({
|
|
233
|
-
version: 3.2,
|
|
234
|
-
config: { name: 'Combine Results', parameters: { mode: 'combine' } }
|
|
235
|
-
});
|
|
236
|
-
|
|
237
|
-
// Declare branch nodes
|
|
238
|
-
const branch1 = node({ type: 'n8n-nodes-base.httpRequest', ... });
|
|
239
|
-
const branch2 = node({ type: 'n8n-nodes-base.httpRequest', ... });
|
|
240
|
-
const processResults = node({ type: 'n8n-nodes-base.set', ... });
|
|
241
|
-
|
|
242
|
-
// Connect branches to specific merge inputs using .input(n)
|
|
243
|
-
export default workflow('id', 'name')
|
|
244
|
-
.add(trigger({ ... }))
|
|
245
|
-
.to(branch1.to(combineResults.input(0))) // Connect to input 0
|
|
246
|
-
.add(trigger({ ... }))
|
|
247
|
-
.to(branch2.to(combineResults.input(1))) // Connect to input 1
|
|
248
|
-
.add(combineResults)
|
|
249
|
-
.to(processResults); // Process merged results
|
|
250
|
-
\`\`\`
|
|
251
|
-
|
|
252
|
-
</parallel_execution>
|
|
253
|
-
|
|
254
|
-
<batch_processing>
|
|
255
|
-
\`\`\`javascript
|
|
256
|
-
const startTrigger = trigger({
|
|
257
|
-
type: 'n8n-nodes-base.manualTrigger',
|
|
258
|
-
version: 1,
|
|
259
|
-
config: { name: 'Start' }
|
|
260
|
-
});
|
|
261
|
-
|
|
262
|
-
const fetchRecords = node({
|
|
263
|
-
type: 'n8n-nodes-base.httpRequest',
|
|
264
|
-
version: 4.3,
|
|
265
|
-
config: { name: 'Fetch Records', parameters: { method: 'GET', url: '...' } }
|
|
266
|
-
});
|
|
267
|
-
|
|
268
|
-
const finalizeResults = node({
|
|
269
|
-
type: 'n8n-nodes-base.set',
|
|
270
|
-
version: 3.4,
|
|
271
|
-
config: { name: 'Finalize', parameters: {} }
|
|
272
|
-
});
|
|
273
|
-
|
|
274
|
-
const processRecord = node({
|
|
275
|
-
type: 'n8n-nodes-base.httpRequest',
|
|
276
|
-
version: 4.3,
|
|
277
|
-
config: { name: 'Process Record', parameters: { method: 'POST', url: '...' } }
|
|
278
|
-
});
|
|
279
|
-
|
|
280
|
-
const sibNode = splitInBatches({ version: 3, config: { name: 'Batch Process', parameters: { batchSize: 10 } } });
|
|
281
|
-
|
|
282
|
-
export default workflow('id', 'name')
|
|
283
|
-
.add(startTrigger)
|
|
284
|
-
.to(fetchRecords)
|
|
285
|
-
.to(sibNode
|
|
286
|
-
.onDone(finalizeResults)
|
|
287
|
-
.onEachBatch(processRecord.to(nextBatch(sibNode)))
|
|
288
|
-
);
|
|
289
|
-
\`\`\`
|
|
290
|
-
|
|
291
|
-
</batch_processing>
|
|
292
|
-
|
|
293
|
-
<multiple_triggers>
|
|
294
|
-
\`\`\`javascript
|
|
295
|
-
const webhookTrigger = trigger({
|
|
296
|
-
type: 'n8n-nodes-base.webhook',
|
|
297
|
-
version: 2.1,
|
|
298
|
-
config: { name: 'Webhook' }
|
|
299
|
-
});
|
|
300
|
-
|
|
301
|
-
const processWebhook = node({
|
|
302
|
-
type: 'n8n-nodes-base.set',
|
|
303
|
-
version: 3.4,
|
|
304
|
-
config: { name: 'Process Webhook', parameters: {} }
|
|
305
|
-
});
|
|
306
|
-
|
|
307
|
-
const scheduleTrigger = trigger({
|
|
308
|
-
type: 'n8n-nodes-base.scheduleTrigger',
|
|
309
|
-
version: 1.3,
|
|
310
|
-
config: { name: 'Daily Schedule', parameters: {} }
|
|
311
|
-
});
|
|
312
|
-
|
|
313
|
-
const processSchedule = node({
|
|
314
|
-
type: 'n8n-nodes-base.set',
|
|
315
|
-
version: 3.4,
|
|
316
|
-
config: { name: 'Process Schedule', parameters: {} }
|
|
317
|
-
});
|
|
318
|
-
|
|
319
|
-
export default workflow('id', 'name')
|
|
320
|
-
.add(webhookTrigger)
|
|
321
|
-
.to(processWebhook)
|
|
322
|
-
.add(scheduleTrigger)
|
|
323
|
-
.to(processSchedule);
|
|
324
|
-
\`\`\`
|
|
325
|
-
|
|
326
|
-
</multiple_triggers>
|
|
327
|
-
|
|
328
|
-
<fan_in>
|
|
329
|
-
\`\`\`javascript
|
|
330
|
-
// Each trigger's execution runs in COMPLETE ISOLATION.
|
|
331
|
-
// Different branches have no effect on each other.
|
|
332
|
-
// Never duplicate chains for "isolation" - it's already guaranteed.
|
|
333
|
-
|
|
334
|
-
const webhookTrigger = trigger({
|
|
335
|
-
type: 'n8n-nodes-base.webhook',
|
|
336
|
-
version: 2.1,
|
|
337
|
-
config: { name: 'Webhook Trigger' }
|
|
338
|
-
});
|
|
339
|
-
|
|
340
|
-
const scheduleTrigger = trigger({
|
|
341
|
-
type: 'n8n-nodes-base.scheduleTrigger',
|
|
342
|
-
version: 1.3,
|
|
343
|
-
config: { name: 'Daily Schedule' }
|
|
344
|
-
});
|
|
345
|
-
|
|
346
|
-
const processData = node({
|
|
347
|
-
type: 'n8n-nodes-base.set',
|
|
348
|
-
version: 3.4,
|
|
349
|
-
config: { name: 'Process Data', parameters: {} }
|
|
350
|
-
});
|
|
351
|
-
|
|
352
|
-
const sendNotification = node({
|
|
353
|
-
type: 'n8n-nodes-base.slack',
|
|
354
|
-
version: 2.3,
|
|
355
|
-
config: { name: 'Notify Slack', parameters: {} }
|
|
356
|
-
});
|
|
357
|
-
|
|
358
|
-
export default workflow('id', 'name')
|
|
359
|
-
.add(webhookTrigger)
|
|
360
|
-
.to(processData)
|
|
361
|
-
.to(sendNotification)
|
|
362
|
-
.add(scheduleTrigger)
|
|
363
|
-
.to(processData);
|
|
364
|
-
\`\`\`
|
|
365
|
-
|
|
366
|
-
</fan_in>
|
|
367
|
-
|
|
368
|
-
<ai_agent_basic>
|
|
369
|
-
\`\`\`javascript
|
|
370
|
-
const openAiModel = languageModel({
|
|
371
|
-
type: '@n8n/n8n-nodes-langchain.lmChatOpenAi',
|
|
372
|
-
version: 1.3,
|
|
373
|
-
config: { name: 'OpenAI Model', parameters: {} }
|
|
374
|
-
});
|
|
375
|
-
|
|
376
|
-
const startTrigger = trigger({
|
|
377
|
-
type: 'n8n-nodes-base.manualTrigger',
|
|
378
|
-
version: 1,
|
|
379
|
-
config: { name: 'Start' }
|
|
380
|
-
});
|
|
381
|
-
|
|
382
|
-
const aiAgent = node({
|
|
383
|
-
type: '@n8n/n8n-nodes-langchain.agent',
|
|
384
|
-
version: 3.1,
|
|
385
|
-
config: {
|
|
386
|
-
name: 'AI Assistant',
|
|
387
|
-
parameters: { promptType: 'define', text: 'You are a helpful assistant' },
|
|
388
|
-
subnodes: { model: openAiModel }
|
|
389
|
-
}
|
|
390
|
-
});
|
|
391
|
-
|
|
392
|
-
export default workflow('ai-assistant', 'AI Assistant')
|
|
393
|
-
.add(startTrigger)
|
|
394
|
-
.to(aiAgent);
|
|
395
|
-
\`\`\`
|
|
396
|
-
|
|
397
|
-
</ai_agent_basic>
|
|
398
|
-
|
|
399
|
-
<ai_agent_with_tools>
|
|
400
|
-
\`\`\`javascript
|
|
401
|
-
const openAiModel = languageModel({
|
|
402
|
-
type: '@n8n/n8n-nodes-langchain.lmChatOpenAi',
|
|
403
|
-
version: 1.3,
|
|
404
|
-
config: {
|
|
405
|
-
name: 'OpenAI Model',
|
|
406
|
-
parameters: {},
|
|
407
|
-
credentials: { openAiApi: newCredential('OpenAI') }
|
|
408
|
-
}
|
|
409
|
-
});
|
|
410
|
-
|
|
411
|
-
const calculatorTool = tool({
|
|
412
|
-
type: '@n8n/n8n-nodes-langchain.toolCalculator',
|
|
413
|
-
version: 1,
|
|
414
|
-
config: { name: 'Calculator', parameters: {} }
|
|
415
|
-
});
|
|
416
|
-
|
|
417
|
-
const startTrigger = trigger({
|
|
418
|
-
type: 'n8n-nodes-base.manualTrigger',
|
|
419
|
-
version: 1,
|
|
420
|
-
config: { name: 'Start' }
|
|
421
|
-
});
|
|
422
|
-
|
|
423
|
-
const aiAgent = node({
|
|
424
|
-
type: '@n8n/n8n-nodes-langchain.agent',
|
|
425
|
-
version: 3.1,
|
|
426
|
-
config: {
|
|
427
|
-
name: 'Math Agent',
|
|
428
|
-
parameters: { promptType: 'define', text: 'You can use tools to help users' },
|
|
429
|
-
subnodes: { model: openAiModel, tools: [calculatorTool] }
|
|
430
|
-
}
|
|
431
|
-
});
|
|
432
|
-
|
|
433
|
-
export default workflow('ai-calculator', 'AI Calculator')
|
|
434
|
-
.add(startTrigger)
|
|
435
|
-
.to(aiAgent);
|
|
436
|
-
\`\`\`
|
|
437
|
-
|
|
438
|
-
</ai_agent_with_tools>
|
|
439
|
-
|
|
440
|
-
<ai_agent_with_from_ai>
|
|
441
|
-
\`\`\`javascript
|
|
442
|
-
const openAiModel = languageModel({
|
|
443
|
-
type: '@n8n/n8n-nodes-langchain.lmChatOpenAi',
|
|
444
|
-
version: 1.3,
|
|
445
|
-
config: {
|
|
446
|
-
name: 'OpenAI Model',
|
|
447
|
-
parameters: {},
|
|
448
|
-
credentials: { openAiApi: newCredential('OpenAI') }
|
|
449
|
-
}
|
|
450
|
-
});
|
|
451
|
-
|
|
452
|
-
const gmailTool = tool({
|
|
453
|
-
type: 'n8n-nodes-base.gmailTool',
|
|
454
|
-
version: 1,
|
|
455
|
-
config: {
|
|
456
|
-
name: 'Gmail Tool',
|
|
457
|
-
parameters: {
|
|
458
|
-
sendTo: fromAi('recipient', 'Email address'),
|
|
459
|
-
subject: fromAi('subject', 'Email subject'),
|
|
460
|
-
message: fromAi('body', 'Email content')
|
|
461
|
-
},
|
|
462
|
-
credentials: { gmailOAuth2: newCredential('Gmail') }
|
|
463
|
-
}
|
|
464
|
-
});
|
|
465
|
-
|
|
466
|
-
const startTrigger = trigger({
|
|
467
|
-
type: 'n8n-nodes-base.manualTrigger',
|
|
468
|
-
version: 1,
|
|
469
|
-
config: { name: 'Start' }
|
|
470
|
-
});
|
|
471
|
-
|
|
472
|
-
const aiAgent = node({
|
|
473
|
-
type: '@n8n/n8n-nodes-langchain.agent',
|
|
474
|
-
version: 3.1,
|
|
475
|
-
config: {
|
|
476
|
-
name: 'Email Agent',
|
|
477
|
-
parameters: { promptType: 'define', text: 'You can send emails' },
|
|
478
|
-
subnodes: { model: openAiModel, tools: [gmailTool] }
|
|
479
|
-
}
|
|
480
|
-
});
|
|
481
|
-
|
|
482
|
-
export default workflow('ai-email', 'AI Email Sender')
|
|
483
|
-
.add(startTrigger)
|
|
484
|
-
.to(aiAgent);
|
|
485
|
-
\`\`\`
|
|
486
|
-
</ai_agent_with_from_ai>
|
|
487
|
-
|
|
488
|
-
<ai_agent_with_structured_output>
|
|
489
|
-
\`\`\`javascript
|
|
490
|
-
const structuredParser = outputParser({
|
|
491
|
-
type: '@n8n/n8n-nodes-langchain.outputParserStructured',
|
|
492
|
-
version: 1.3,
|
|
493
|
-
config: {
|
|
494
|
-
name: 'Structured Output Parser',
|
|
495
|
-
parameters: {
|
|
496
|
-
schemaType: 'fromJson',
|
|
497
|
-
jsonSchemaExample: '{ "sentiment": "positive", "confidence": 0.95, "summary": "brief summary" }'
|
|
498
|
-
}
|
|
499
|
-
}
|
|
500
|
-
});
|
|
501
|
-
|
|
502
|
-
const aiAgent = node({
|
|
503
|
-
type: '@n8n/n8n-nodes-langchain.agent',
|
|
504
|
-
version: 3.1,
|
|
505
|
-
config: {
|
|
506
|
-
name: 'Sentiment Analyzer',
|
|
507
|
-
parameters: { promptType: 'define', text: 'Analyze the sentiment of the input text', hasOutputParser: true },
|
|
508
|
-
subnodes: { model: openAiModel, outputParser: structuredParser }
|
|
509
|
-
}
|
|
510
|
-
});
|
|
511
|
-
|
|
512
|
-
export default workflow('ai-sentiment', 'AI Sentiment Analyzer')
|
|
513
|
-
.add(startTrigger)
|
|
514
|
-
.to(aiAgent);
|
|
515
|
-
\`\`\`
|
|
516
|
-
</ai_agent_with_structured_output>`;
|
|
4
|
+
var sdk_reference_1 = require("@n8n/workflow-sdk/prompts/sdk-reference");
|
|
5
|
+
Object.defineProperty(exports, "EXPRESSION_REFERENCE", { enumerable: true, get: function () { return sdk_reference_1.EXPRESSION_REFERENCE; } });
|
|
6
|
+
Object.defineProperty(exports, "ADDITIONAL_FUNCTIONS", { enumerable: true, get: function () { return sdk_reference_1.ADDITIONAL_FUNCTIONS; } });
|
|
7
|
+
Object.defineProperty(exports, "WORKFLOW_RULES", { enumerable: true, get: function () { return sdk_reference_1.WORKFLOW_RULES; } });
|
|
8
|
+
Object.defineProperty(exports, "WORKFLOW_SDK_PATTERNS", { enumerable: true, get: function () { return sdk_reference_1.WORKFLOW_SDK_PATTERNS; } });
|
|
517
9
|
//# sourceMappingURL=sdk-prompt-sections.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk-prompt-sections.js","sourceRoot":"","sources":["../../src/workflow-builder/sdk-prompt-sections.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"sdk-prompt-sections.js","sourceRoot":"","sources":["../../src/workflow-builder/sdk-prompt-sections.ts"],"names":[],"mappings":";;;AAMA,yEAKiD;AAJhD,qHAAA,oBAAoB,OAAA;AACpB,qHAAA,oBAAoB,OAAA;AACpB,+GAAA,cAAc,OAAA;AACd,sHAAA,qBAAqB,OAAA"}
|
|
@@ -5,12 +5,10 @@ function formatWorkflowLoopGuidance(action, options = {}) {
|
|
|
5
5
|
switch (action.type) {
|
|
6
6
|
case 'done': {
|
|
7
7
|
if (action.mockedCredentialTypes?.length) {
|
|
8
|
-
const types = action.mockedCredentialTypes.join(', ');
|
|
9
8
|
return ('Workflow verified successfully with temporary mock data. ' +
|
|
10
|
-
`Call \`setup-
|
|
11
|
-
'
|
|
12
|
-
'
|
|
13
|
-
`with the workItemId "${options.workItemId ?? 'unknown'}" and workflowId to apply them.`);
|
|
9
|
+
`Call \`setup-workflow\` with workflowId "${action.workflowId ?? 'unknown'}" ` +
|
|
10
|
+
'to let the user configure credentials, parameters, and triggers through the setup UI. ' +
|
|
11
|
+
'Do not call `setup-credentials` or `apply-workflow-credentials` — `setup-workflow` handles everything.');
|
|
14
12
|
}
|
|
15
13
|
return `Workflow verified successfully. Report completion to the user.${action.workflowId ? ` Workflow ID: ${action.workflowId}` : ''}`;
|
|
16
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guidance.js","sourceRoot":"","sources":["../../src/workflow-loop/guidance.ts"],"names":[],"mappings":";;AAMA,
|
|
1
|
+
{"version":3,"file":"guidance.js","sourceRoot":"","sources":["../../src/workflow-loop/guidance.ts"],"names":[],"mappings":";;AAMA,gEAyCC;AAzCD,SAAgB,0BAA0B,CACzC,MAA0B,EAC1B,UAAuC,EAAE;IAEzC,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;QACrB,KAAK,MAAM,CAAC,CAAC,CAAC;YACb,IAAI,MAAM,CAAC,qBAAqB,EAAE,MAAM,EAAE,CAAC;gBAC1C,OAAO,CACN,2DAA2D;oBAC3D,4CAA4C,MAAM,CAAC,UAAU,IAAI,SAAS,IAAI;oBAC9E,wFAAwF;oBACxF,wGAAwG,CACxG,CAAC;YACH,CAAC;YACD,OAAO,iEAAiE,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,iBAAiB,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;QACzI,CAAC;QACD,KAAK,QAAQ;YACZ,OAAO,CACN,wBAAwB,MAAM,CAAC,UAAU,IAAI;gBAC7C,uFAAuF,OAAO,CAAC,UAAU,IAAI,SAAS,KAAK;gBAC3H,gCAAgC;gBAChC,kDAAkD;gBAClD,8DAA8D,OAAO,CAAC,UAAU,IAAI,SAAS,sBAAsB,CACnH,CAAC;QACH,KAAK,SAAS;YACb,OAAO,kBAAkB,MAAM,CAAC,MAAM,oDAAoD,CAAC;QAC5F,KAAK,SAAS;YACb,OAAO,CACN,mCAAmC,MAAM,CAAC,UAAU,4BAA4B;gBAChF,sDAAsD;gBACtD,4CAA4C,MAAM,CAAC,UAAU,wDAAwD,MAAM,CAAC,cAAc,EAAE,CAC5I,CAAC;QACH,KAAK,OAAO;YACX,OAAO,CACN,uBAAuB,MAAM,CAAC,cAAc,iBAAiB,MAAM,CAAC,UAAU,yBAAyB;gBACvG,cAAc,MAAM,CAAC,SAAS,IAAI;gBAClC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,kBAAkB,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;gBACxE,sDAAsD;gBACtD,2DAA2D,MAAM,CAAC,UAAU,mCAAmC,CAC/G,CAAC;IACJ,CAAC;AACF,CAAC"}
|