@n8n/instance-ai 1.0.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.md +88 -0
- package/dist/agent/instance-agent.d.ts +3 -0
- package/dist/agent/instance-agent.js +215 -0
- package/dist/agent/instance-agent.js.map +1 -0
- package/dist/agent/register-with-mastra.d.ts +3 -0
- package/dist/agent/register-with-mastra.js +19 -0
- package/dist/agent/register-with-mastra.js.map +1 -0
- package/dist/agent/sanitize-mcp-schemas.d.ts +2 -0
- package/dist/agent/sanitize-mcp-schemas.js +91 -0
- package/dist/agent/sanitize-mcp-schemas.js.map +1 -0
- package/dist/agent/sub-agent-factory.d.ts +14 -0
- package/dist/agent/sub-agent-factory.js +48 -0
- package/dist/agent/sub-agent-factory.js.map +1 -0
- package/dist/agent/system-prompt.d.ts +13 -0
- package/dist/agent/system-prompt.js +226 -0
- package/dist/agent/system-prompt.js.map +1 -0
- package/dist/build.tsbuildinfo +1 -0
- package/dist/compaction/compaction-helper.d.ts +9 -0
- package/dist/compaction/compaction-helper.js +58 -0
- package/dist/compaction/compaction-helper.js.map +1 -0
- package/dist/compaction/index.d.ts +2 -0
- package/dist/compaction/index.js +6 -0
- package/dist/compaction/index.js.map +1 -0
- package/dist/domain-access/domain-access-tracker.d.ts +9 -0
- package/dist/domain-access/domain-access-tracker.js +46 -0
- package/dist/domain-access/domain-access-tracker.js.map +1 -0
- package/dist/domain-access/domain-gating.d.ts +65 -0
- package/dist/domain-access/domain-gating.js +68 -0
- package/dist/domain-access/domain-gating.js.map +1 -0
- package/dist/domain-access/index.d.ts +4 -0
- package/dist/domain-access/index.js +11 -0
- package/dist/domain-access/index.js.map +1 -0
- package/dist/event-bus/event-bus.interface.d.ts +15 -0
- package/dist/event-bus/event-bus.interface.js +3 -0
- package/dist/event-bus/event-bus.interface.js.map +1 -0
- package/dist/event-bus/index.d.ts +1 -0
- package/dist/event-bus/index.js +3 -0
- package/dist/event-bus/index.js.map +1 -0
- package/dist/index.d.ts +46 -0
- package/dist/index.js +89 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp/mcp-client-manager.d.ts +6 -0
- package/dist/mcp/mcp-client-manager.js +34 -0
- package/dist/mcp/mcp-client-manager.js.map +1 -0
- package/dist/memory/memory-config.d.ts +3 -0
- package/dist/memory/memory-config.js +29 -0
- package/dist/memory/memory-config.js.map +1 -0
- package/dist/memory/title-utils.d.ts +3 -0
- package/dist/memory/title-utils.js +42 -0
- package/dist/memory/title-utils.js.map +1 -0
- package/dist/memory/working-memory-template.d.ts +1 -0
- package/dist/memory/working-memory-template.js +25 -0
- package/dist/memory/working-memory-template.js.map +1 -0
- package/dist/planned-tasks/planned-task-service.d.ts +33 -0
- package/dist/planned-tasks/planned-task-service.js +151 -0
- package/dist/planned-tasks/planned-task-service.js.map +1 -0
- package/dist/runtime/background-task-manager.d.ts +53 -0
- package/dist/runtime/background-task-manager.js +127 -0
- package/dist/runtime/background-task-manager.js.map +1 -0
- package/dist/runtime/resumable-stream-executor.d.ts +75 -0
- package/dist/runtime/resumable-stream-executor.js +1552 -0
- package/dist/runtime/resumable-stream-executor.js.map +1 -0
- package/dist/runtime/run-state-registry.d.ts +109 -0
- package/dist/runtime/run-state-registry.js +210 -0
- package/dist/runtime/run-state-registry.js.map +1 -0
- package/dist/runtime/stream-runner.d.ts +27 -0
- package/dist/runtime/stream-runner.js +87 -0
- package/dist/runtime/stream-runner.js.map +1 -0
- package/dist/runtime/working-memory-tracing.d.ts +19 -0
- package/dist/runtime/working-memory-tracing.js +111 -0
- package/dist/runtime/working-memory-tracing.js.map +1 -0
- package/dist/storage/agent-tree-snapshot.d.ts +7 -0
- package/dist/storage/agent-tree-snapshot.js +3 -0
- package/dist/storage/agent-tree-snapshot.js.map +1 -0
- package/dist/storage/index.d.ts +10 -0
- package/dist/storage/index.js +17 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/storage/iteration-log.d.ts +30 -0
- package/dist/storage/iteration-log.js +31 -0
- package/dist/storage/iteration-log.js.map +1 -0
- package/dist/storage/mastra-iteration-log-storage.d.ts +10 -0
- package/dist/storage/mastra-iteration-log-storage.js +57 -0
- package/dist/storage/mastra-iteration-log-storage.js.map +1 -0
- package/dist/storage/mastra-task-storage.d.ts +9 -0
- package/dist/storage/mastra-task-storage.js +35 -0
- package/dist/storage/mastra-task-storage.js.map +1 -0
- package/dist/storage/planned-task-storage.d.ts +10 -0
- package/dist/storage/planned-task-storage.js +97 -0
- package/dist/storage/planned-task-storage.js.map +1 -0
- package/dist/storage/thread-patch.d.ts +16 -0
- package/dist/storage/thread-patch.js +50 -0
- package/dist/storage/thread-patch.js.map +1 -0
- package/dist/storage/workflow-loop-storage.d.ts +217 -0
- package/dist/storage/workflow-loop-storage.js +59 -0
- package/dist/storage/workflow-loop-storage.js.map +1 -0
- package/dist/stream/consume-with-hitl.d.ts +22 -0
- package/dist/stream/consume-with-hitl.js +29 -0
- package/dist/stream/consume-with-hitl.js.map +1 -0
- package/dist/stream/map-chunk.d.ts +2 -0
- package/dist/stream/map-chunk.js +224 -0
- package/dist/stream/map-chunk.js.map +1 -0
- package/dist/tools/best-practices/get-best-practices.tool.d.ts +12 -0
- package/dist/tools/best-practices/get-best-practices.tool.js +64 -0
- package/dist/tools/best-practices/get-best-practices.tool.js.map +1 -0
- package/dist/tools/best-practices/guides/chatbot.d.ts +1 -0
- package/dist/tools/best-practices/guides/chatbot.js +111 -0
- package/dist/tools/best-practices/guides/chatbot.js.map +1 -0
- package/dist/tools/best-practices/guides/content-generation.d.ts +1 -0
- package/dist/tools/best-practices/guides/content-generation.js +108 -0
- package/dist/tools/best-practices/guides/content-generation.js.map +1 -0
- package/dist/tools/best-practices/guides/data-extraction.d.ts +1 -0
- package/dist/tools/best-practices/guides/data-extraction.js +115 -0
- package/dist/tools/best-practices/guides/data-extraction.js.map +1 -0
- package/dist/tools/best-practices/guides/data-persistence.d.ts +1 -0
- package/dist/tools/best-practices/guides/data-persistence.js +198 -0
- package/dist/tools/best-practices/guides/data-persistence.js.map +1 -0
- package/dist/tools/best-practices/guides/data-transformation.d.ts +1 -0
- package/dist/tools/best-practices/guides/data-transformation.js +139 -0
- package/dist/tools/best-practices/guides/data-transformation.js.map +1 -0
- package/dist/tools/best-practices/guides/document-processing.d.ts +1 -0
- package/dist/tools/best-practices/guides/document-processing.js +326 -0
- package/dist/tools/best-practices/guides/document-processing.js.map +1 -0
- package/dist/tools/best-practices/guides/form-input.d.ts +1 -0
- package/dist/tools/best-practices/guides/form-input.js +166 -0
- package/dist/tools/best-practices/guides/form-input.js.map +1 -0
- package/dist/tools/best-practices/guides/notification.d.ts +1 -0
- package/dist/tools/best-practices/guides/notification.js +128 -0
- package/dist/tools/best-practices/guides/notification.js.map +1 -0
- package/dist/tools/best-practices/guides/scheduling.d.ts +1 -0
- package/dist/tools/best-practices/guides/scheduling.js +145 -0
- package/dist/tools/best-practices/guides/scheduling.js.map +1 -0
- package/dist/tools/best-practices/guides/scraping-and-research.d.ts +1 -0
- package/dist/tools/best-practices/guides/scraping-and-research.js +151 -0
- package/dist/tools/best-practices/guides/scraping-and-research.js.map +1 -0
- package/dist/tools/best-practices/guides/triage.d.ts +1 -0
- package/dist/tools/best-practices/guides/triage.js +142 -0
- package/dist/tools/best-practices/guides/triage.js.map +1 -0
- package/dist/tools/best-practices/index.d.ts +2 -0
- package/dist/tools/best-practices/index.js +34 -0
- package/dist/tools/best-practices/index.js.map +1 -0
- package/dist/tools/best-practices/techniques.d.ts +20 -0
- package/dist/tools/best-practices/techniques.js +40 -0
- package/dist/tools/best-practices/techniques.js.map +1 -0
- package/dist/tools/credentials/delete-credential.tool.d.ts +21 -0
- package/dist/tools/credentials/delete-credential.tool.js +51 -0
- package/dist/tools/credentials/delete-credential.tool.js.map +1 -0
- package/dist/tools/credentials/get-credential.tool.d.ts +4 -0
- package/dist/tools/credentials/get-credential.tool.js +26 -0
- package/dist/tools/credentials/get-credential.tool.js.map +1 -0
- package/dist/tools/credentials/list-credentials.tool.d.ts +6 -0
- package/dist/tools/credentials/list-credentials.tool.js +30 -0
- package/dist/tools/credentials/list-credentials.tool.js.map +1 -0
- package/dist/tools/credentials/search-credential-types.tool.d.ts +6 -0
- package/dist/tools/credentials/search-credential-types.tool.js +44 -0
- package/dist/tools/credentials/search-credential-types.tool.js.map +1 -0
- package/dist/tools/credentials/setup-credentials.tool.d.ts +73 -0
- package/dist/tools/credentials/setup-credentials.tool.js +134 -0
- package/dist/tools/credentials/setup-credentials.tool.js.map +1 -0
- package/dist/tools/credentials/test-credential.tool.d.ts +7 -0
- package/dist/tools/credentials/test-credential.tool.js +30 -0
- package/dist/tools/credentials/test-credential.tool.js.map +1 -0
- package/dist/tools/data-tables/add-data-table-column.tool.d.ts +27 -0
- package/dist/tools/data-tables/add-data-table-column.tool.js +60 -0
- package/dist/tools/data-tables/add-data-table-column.tool.js.map +1 -0
- package/dist/tools/data-tables/create-data-table.tool.d.ts +36 -0
- package/dist/tools/data-tables/create-data-table.tool.js +79 -0
- package/dist/tools/data-tables/create-data-table.tool.js.map +1 -0
- package/dist/tools/data-tables/delete-data-table-column.tool.d.ts +21 -0
- package/dist/tools/data-tables/delete-data-table-column.tool.js +48 -0
- package/dist/tools/data-tables/delete-data-table-column.tool.js.map +1 -0
- package/dist/tools/data-tables/delete-data-table-rows.tool.d.ts +29 -0
- package/dist/tools/data-tables/delete-data-table-rows.tool.js +63 -0
- package/dist/tools/data-tables/delete-data-table-rows.tool.js.map +1 -0
- package/dist/tools/data-tables/delete-data-table.tool.d.ts +20 -0
- package/dist/tools/data-tables/delete-data-table.tool.js +46 -0
- package/dist/tools/data-tables/delete-data-table.tool.js.map +1 -0
- package/dist/tools/data-tables/get-data-table-schema.tool.d.ts +11 -0
- package/dist/tools/data-tables/get-data-table-schema.tool.js +27 -0
- package/dist/tools/data-tables/get-data-table-schema.tool.js.map +1 -0
- package/dist/tools/data-tables/insert-data-table-rows.tool.d.ts +21 -0
- package/dist/tools/data-tables/insert-data-table-rows.tool.js +52 -0
- package/dist/tools/data-tables/insert-data-table-rows.tool.js.map +1 -0
- package/dist/tools/data-tables/list-data-tables.tool.d.ts +6 -0
- package/dist/tools/data-tables/list-data-tables.tool.js +32 -0
- package/dist/tools/data-tables/list-data-tables.tool.js.map +1 -0
- package/dist/tools/data-tables/query-data-table-rows.tool.d.ts +21 -0
- package/dist/tools/data-tables/query-data-table-rows.tool.js +54 -0
- package/dist/tools/data-tables/query-data-table-rows.tool.js.map +1 -0
- package/dist/tools/data-tables/rename-data-table-column.tool.d.ts +22 -0
- package/dist/tools/data-tables/rename-data-table-column.tool.js +49 -0
- package/dist/tools/data-tables/rename-data-table-column.tool.js.map +1 -0
- package/dist/tools/data-tables/update-data-table-rows.tool.d.ts +29 -0
- package/dist/tools/data-tables/update-data-table-rows.tool.js +57 -0
- package/dist/tools/data-tables/update-data-table-rows.tool.js.map +1 -0
- package/dist/tools/executions/debug-execution.tool.d.ts +4 -0
- package/dist/tools/executions/debug-execution.tool.js +41 -0
- package/dist/tools/executions/debug-execution.tool.js.map +1 -0
- package/dist/tools/executions/get-execution.tool.d.ts +4 -0
- package/dist/tools/executions/get-execution.tool.js +26 -0
- package/dist/tools/executions/get-execution.tool.js.map +1 -0
- package/dist/tools/executions/get-node-output.tool.d.ts +7 -0
- package/dist/tools/executions/get-node-output.tool.js +44 -0
- package/dist/tools/executions/get-node-output.tool.js.map +1 -0
- package/dist/tools/executions/list-executions.tool.d.ts +8 -0
- package/dist/tools/executions/list-executions.tool.js +45 -0
- package/dist/tools/executions/list-executions.tool.js.map +1 -0
- package/dist/tools/executions/run-workflow.tool.d.ts +24 -0
- package/dist/tools/executions/run-workflow.tool.js +82 -0
- package/dist/tools/executions/run-workflow.tool.js.map +1 -0
- package/dist/tools/executions/stop-execution.tool.d.ts +7 -0
- package/dist/tools/executions/stop-execution.tool.js +22 -0
- package/dist/tools/executions/stop-execution.tool.js.map +1 -0
- package/dist/tools/filesystem/create-tools-from-mcp-server.d.ts +3 -0
- package/dist/tools/filesystem/create-tools-from-mcp-server.js +61 -0
- package/dist/tools/filesystem/create-tools-from-mcp-server.js.map +1 -0
- package/dist/tools/filesystem/get-file-tree.tool.d.ts +22 -0
- package/dist/tools/filesystem/get-file-tree.tool.js +64 -0
- package/dist/tools/filesystem/get-file-tree.tool.js.map +1 -0
- package/dist/tools/filesystem/list-files.tool.d.ts +30 -0
- package/dist/tools/filesystem/list-files.tool.js +100 -0
- package/dist/tools/filesystem/list-files.tool.js.map +1 -0
- package/dist/tools/filesystem/read-file.tool.d.ts +25 -0
- package/dist/tools/filesystem/read-file.tool.js +83 -0
- package/dist/tools/filesystem/read-file.tool.js.map +1 -0
- package/dist/tools/filesystem/search-files.tool.d.ts +31 -0
- package/dist/tools/filesystem/search-files.tool.js +96 -0
- package/dist/tools/filesystem/search-files.tool.js.map +1 -0
- package/dist/tools/index.d.ts +2385 -0
- package/dist/tools/index.js +195 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/nodes/explore-node-resources.tool.d.ts +21 -0
- package/dist/tools/nodes/explore-node-resources.tool.js +71 -0
- package/dist/tools/nodes/explore-node-resources.tool.js.map +1 -0
- package/dist/tools/nodes/get-node-description.tool.d.ts +23 -0
- package/dist/tools/nodes/get-node-description.tool.js +52 -0
- package/dist/tools/nodes/get-node-description.tool.js.map +1 -0
- package/dist/tools/nodes/get-node-type-definition.tool.d.ts +17 -0
- package/dist/tools/nodes/get-node-type-definition.tool.js +73 -0
- package/dist/tools/nodes/get-node-type-definition.tool.js.map +1 -0
- package/dist/tools/nodes/get-suggested-nodes.tool.d.ts +14 -0
- package/dist/tools/nodes/get-suggested-nodes.tool.js +54 -0
- package/dist/tools/nodes/get-suggested-nodes.tool.js.map +1 -0
- package/dist/tools/nodes/list-nodes.tool.d.ts +6 -0
- package/dist/tools/nodes/list-nodes.tool.js +33 -0
- package/dist/tools/nodes/list-nodes.tool.js.map +1 -0
- package/dist/tools/nodes/node-search-engine.d.ts +18 -0
- package/dist/tools/nodes/node-search-engine.js +266 -0
- package/dist/tools/nodes/node-search-engine.js.map +1 -0
- package/dist/tools/nodes/node-search-engine.types.d.ts +38 -0
- package/dist/tools/nodes/node-search-engine.types.js +18 -0
- package/dist/tools/nodes/node-search-engine.types.js.map +1 -0
- package/dist/tools/nodes/search-nodes.tool.d.ts +28 -0
- package/dist/tools/nodes/search-nodes.tool.js +87 -0
- package/dist/tools/nodes/search-nodes.tool.js.map +1 -0
- package/dist/tools/nodes/suggested-nodes-data.d.ts +11 -0
- package/dist/tools/nodes/suggested-nodes-data.js +326 -0
- package/dist/tools/nodes/suggested-nodes-data.js.map +1 -0
- package/dist/tools/orchestration/browser-credential-setup.tool.d.ts +14 -0
- package/dist/tools/orchestration/browser-credential-setup.tool.js +429 -0
- package/dist/tools/orchestration/browser-credential-setup.tool.js.map +1 -0
- package/dist/tools/orchestration/build-workflow-agent.prompt.d.ts +2 -0
- package/dist/tools/orchestration/build-workflow-agent.prompt.js +836 -0
- package/dist/tools/orchestration/build-workflow-agent.prompt.js.map +1 -0
- package/dist/tools/orchestration/build-workflow-agent.tool.d.ts +23 -0
- package/dist/tools/orchestration/build-workflow-agent.tool.js +503 -0
- package/dist/tools/orchestration/build-workflow-agent.tool.js.map +1 -0
- package/dist/tools/orchestration/cancel-background-task.tool.d.ts +6 -0
- package/dist/tools/orchestration/cancel-background-task.tool.js +24 -0
- package/dist/tools/orchestration/cancel-background-task.tool.js.map +1 -0
- package/dist/tools/orchestration/correct-background-task.tool.d.ts +7 -0
- package/dist/tools/orchestration/correct-background-task.tool.js +41 -0
- package/dist/tools/orchestration/correct-background-task.tool.js.map +1 -0
- package/dist/tools/orchestration/data-table-agent.prompt.d.ts +1 -0
- package/dist/tools/orchestration/data-table-agent.prompt.js +29 -0
- package/dist/tools/orchestration/data-table-agent.prompt.js.map +1 -0
- package/dist/tools/orchestration/data-table-agent.tool.d.ts +21 -0
- package/dist/tools/orchestration/data-table-agent.tool.js +171 -0
- package/dist/tools/orchestration/data-table-agent.tool.js.map +1 -0
- package/dist/tools/orchestration/delegate.schemas.d.ts +32 -0
- package/dist/tools/orchestration/delegate.schemas.js +29 -0
- package/dist/tools/orchestration/delegate.schemas.js.map +1 -0
- package/dist/tools/orchestration/delegate.tool.d.ts +27 -0
- package/dist/tools/orchestration/delegate.tool.js +307 -0
- package/dist/tools/orchestration/delegate.tool.js.map +1 -0
- package/dist/tools/orchestration/display-utils.d.ts +1 -0
- package/dist/tools/orchestration/display-utils.js +8 -0
- package/dist/tools/orchestration/display-utils.js.map +1 -0
- package/dist/tools/orchestration/plan.tool.d.ts +45 -0
- package/dist/tools/orchestration/plan.tool.js +99 -0
- package/dist/tools/orchestration/plan.tool.js.map +1 -0
- package/dist/tools/orchestration/report-verification-verdict.tool.d.ts +14 -0
- package/dist/tools/orchestration/report-verification-verdict.tool.js +66 -0
- package/dist/tools/orchestration/report-verification-verdict.tool.js.map +1 -0
- package/dist/tools/orchestration/research-agent-prompt.d.ts +1 -0
- package/dist/tools/orchestration/research-agent-prompt.js +28 -0
- package/dist/tools/orchestration/research-agent-prompt.js.map +1 -0
- package/dist/tools/orchestration/research-with-agent.tool.d.ts +23 -0
- package/dist/tools/orchestration/research-with-agent.tool.js +160 -0
- package/dist/tools/orchestration/research-with-agent.tool.js.map +1 -0
- package/dist/tools/orchestration/tracing-utils.d.ts +20 -0
- package/dist/tools/orchestration/tracing-utils.js +102 -0
- package/dist/tools/orchestration/tracing-utils.js.map +1 -0
- package/dist/tools/orchestration/update-tasks.tool.d.ts +10 -0
- package/dist/tools/orchestration/update-tasks.tool.js +26 -0
- package/dist/tools/orchestration/update-tasks.tool.js.map +1 -0
- package/dist/tools/orchestration/verify-built-workflow.tool.d.ts +13 -0
- package/dist/tools/orchestration/verify-built-workflow.tool.js +58 -0
- package/dist/tools/orchestration/verify-built-workflow.tool.js.map +1 -0
- package/dist/tools/shared/ask-user.tool.d.ts +61 -0
- package/dist/tools/shared/ask-user.tool.js +98 -0
- package/dist/tools/shared/ask-user.tool.js.map +1 -0
- package/dist/tools/templates/search-template-parameters.tool.d.ts +11 -0
- package/dist/tools/templates/search-template-parameters.tool.js +55 -0
- package/dist/tools/templates/search-template-parameters.tool.js.map +1 -0
- package/dist/tools/templates/search-template-structures.tool.d.ts +12 -0
- package/dist/tools/templates/search-template-structures.tool.js +45 -0
- package/dist/tools/templates/search-template-structures.tool.js.map +1 -0
- package/dist/tools/templates/template-api.d.ts +21 -0
- package/dist/tools/templates/template-api.js +104 -0
- package/dist/tools/templates/template-api.js.map +1 -0
- package/dist/tools/templates/types.d.ts +52 -0
- package/dist/tools/templates/types.js +37 -0
- package/dist/tools/templates/types.js.map +1 -0
- package/dist/tools/utils/mermaid.utils.d.ts +15 -0
- package/dist/tools/utils/mermaid.utils.js +622 -0
- package/dist/tools/utils/mermaid.utils.js.map +1 -0
- package/dist/tools/utils/node-configuration.utils.d.ts +6 -0
- package/dist/tools/utils/node-configuration.utils.js +77 -0
- package/dist/tools/utils/node-configuration.utils.js.map +1 -0
- package/dist/tools/web-research/fetch-url.tool.d.ts +27 -0
- package/dist/tools/web-research/fetch-url.tool.js +116 -0
- package/dist/tools/web-research/fetch-url.tool.js.map +1 -0
- package/dist/tools/web-research/index.d.ts +1 -0
- package/dist/tools/web-research/index.js +6 -0
- package/dist/tools/web-research/index.js.map +1 -0
- package/dist/tools/web-research/sanitize-web-content.d.ts +3 -0
- package/dist/tools/web-research/sanitize-web-content.js +36 -0
- package/dist/tools/web-research/sanitize-web-content.js.map +1 -0
- package/dist/tools/web-research/web-search.tool.d.ts +6 -0
- package/dist/tools/web-research/web-search.tool.js +57 -0
- package/dist/tools/web-research/web-search.tool.js.map +1 -0
- package/dist/tools/workflows/apply-workflow-credentials.tool.d.ts +10 -0
- package/dist/tools/workflows/apply-workflow-credentials.tool.js +87 -0
- package/dist/tools/workflows/apply-workflow-credentials.tool.js.map +1 -0
- package/dist/tools/workflows/build-workflow.tool.d.ts +16 -0
- package/dist/tools/workflows/build-workflow.tool.js +163 -0
- package/dist/tools/workflows/build-workflow.tool.js.map +1 -0
- package/dist/tools/workflows/delete-workflow.tool.d.ts +21 -0
- package/dist/tools/workflows/delete-workflow.tool.js +51 -0
- package/dist/tools/workflows/delete-workflow.tool.js.map +1 -0
- package/dist/tools/workflows/get-workflow-as-code.tool.d.ts +14 -0
- package/dist/tools/workflows/get-workflow-as-code.tool.js +37 -0
- package/dist/tools/workflows/get-workflow-as-code.tool.js.map +1 -0
- package/dist/tools/workflows/get-workflow-version.tool.d.ts +21 -0
- package/dist/tools/workflows/get-workflow-version.tool.js +38 -0
- package/dist/tools/workflows/get-workflow-version.tool.js.map +1 -0
- package/dist/tools/workflows/get-workflow.tool.d.ts +18 -0
- package/dist/tools/workflows/get-workflow.tool.js +36 -0
- package/dist/tools/workflows/get-workflow.tool.js.map +1 -0
- package/dist/tools/workflows/list-workflow-versions.tool.d.ts +8 -0
- package/dist/tools/workflows/list-workflow-versions.tool.js +47 -0
- package/dist/tools/workflows/list-workflow-versions.tool.js.map +1 -0
- package/dist/tools/workflows/list-workflows.tool.d.ts +14 -0
- package/dist/tools/workflows/list-workflows.tool.js +42 -0
- package/dist/tools/workflows/list-workflows.tool.js.map +1 -0
- package/dist/tools/workflows/materialize-node-type.tool.d.ts +23 -0
- package/dist/tools/workflows/materialize-node-type.tool.js +105 -0
- package/dist/tools/workflows/materialize-node-type.tool.js.map +1 -0
- package/dist/tools/workflows/publish-workflow.tool.d.ts +24 -0
- package/dist/tools/workflows/publish-workflow.tool.js +92 -0
- package/dist/tools/workflows/publish-workflow.tool.js.map +1 -0
- package/dist/tools/workflows/resolve-credentials.d.ts +14 -0
- package/dist/tools/workflows/resolve-credentials.js +89 -0
- package/dist/tools/workflows/resolve-credentials.js.map +1 -0
- package/dist/tools/workflows/restore-workflow-version.tool.d.ts +22 -0
- package/dist/tools/workflows/restore-workflow-version.tool.js +65 -0
- package/dist/tools/workflows/restore-workflow-version.tool.js.map +1 -0
- package/dist/tools/workflows/setup-workflow.schema.d.ts +331 -0
- package/dist/tools/workflows/setup-workflow.schema.js +21 -0
- package/dist/tools/workflows/setup-workflow.schema.js.map +1 -0
- package/dist/tools/workflows/setup-workflow.service.d.ts +40 -0
- package/dist/tools/workflows/setup-workflow.service.js +470 -0
- package/dist/tools/workflows/setup-workflow.service.js.map +1 -0
- package/dist/tools/workflows/setup-workflow.tool.d.ts +150 -0
- package/dist/tools/workflows/setup-workflow.tool.js +219 -0
- package/dist/tools/workflows/setup-workflow.tool.js.map +1 -0
- package/dist/tools/workflows/submit-workflow.tool.d.ts +33 -0
- package/dist/tools/workflows/submit-workflow.tool.js +258 -0
- package/dist/tools/workflows/submit-workflow.tool.js.map +1 -0
- package/dist/tools/workflows/unpublish-workflow.tool.d.ts +22 -0
- package/dist/tools/workflows/unpublish-workflow.tool.js +61 -0
- package/dist/tools/workflows/unpublish-workflow.tool.js.map +1 -0
- package/dist/tools/workflows/update-workflow-version.tool.d.ts +9 -0
- package/dist/tools/workflows/update-workflow-version.tool.js +35 -0
- package/dist/tools/workflows/update-workflow-version.tool.js.map +1 -0
- package/dist/tools/workflows/write-sandbox-file.tool.d.ts +13 -0
- package/dist/tools/workflows/write-sandbox-file.tool.js +53 -0
- package/dist/tools/workflows/write-sandbox-file.tool.js.map +1 -0
- package/dist/tools/workspace/cleanup-test-executions.tool.d.ts +22 -0
- package/dist/tools/workspace/cleanup-test-executions.tool.js +58 -0
- package/dist/tools/workspace/cleanup-test-executions.tool.js.map +1 -0
- package/dist/tools/workspace/create-folder.tool.d.ts +24 -0
- package/dist/tools/workspace/create-folder.tool.js +59 -0
- package/dist/tools/workspace/create-folder.tool.js.map +1 -0
- package/dist/tools/workspace/delete-folder.tool.d.ts +24 -0
- package/dist/tools/workspace/delete-folder.tool.js +60 -0
- package/dist/tools/workspace/delete-folder.tool.js.map +1 -0
- package/dist/tools/workspace/list-folders.tool.d.ts +6 -0
- package/dist/tools/workspace/list-folders.tool.js +26 -0
- package/dist/tools/workspace/list-folders.tool.js.map +1 -0
- package/dist/tools/workspace/list-projects.tool.d.ts +4 -0
- package/dist/tools/workspace/list-projects.tool.js +24 -0
- package/dist/tools/workspace/list-projects.tool.js.map +1 -0
- package/dist/tools/workspace/list-tags.tool.d.ts +7 -0
- package/dist/tools/workspace/list-tags.tool.js +23 -0
- package/dist/tools/workspace/list-tags.tool.js.map +1 -0
- package/dist/tools/workspace/move-workflow-to-folder.tool.d.ts +23 -0
- package/dist/tools/workspace/move-workflow-to-folder.tool.js +56 -0
- package/dist/tools/workspace/move-workflow-to-folder.tool.js.map +1 -0
- package/dist/tools/workspace/tag-workflow.tool.d.ts +22 -0
- package/dist/tools/workspace/tag-workflow.tool.js +52 -0
- package/dist/tools/workspace/tag-workflow.tool.js.map +1 -0
- package/dist/tracing/langsmith-tracing.d.ts +56 -0
- package/dist/tracing/langsmith-tracing.js +810 -0
- package/dist/tracing/langsmith-tracing.js.map +1 -0
- package/dist/types.d.ts +709 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/agent-tree.d.ts +3 -0
- package/dist/utils/agent-tree.js +23 -0
- package/dist/utils/agent-tree.js.map +1 -0
- package/dist/utils/format-timestamp.d.ts +1 -0
- package/dist/utils/format-timestamp.js +19 -0
- package/dist/utils/format-timestamp.js.map +1 -0
- package/dist/utils/stream-helpers.d.ts +15 -0
- package/dist/utils/stream-helpers.js +26 -0
- package/dist/utils/stream-helpers.js.map +1 -0
- package/dist/workflow-builder/extract-code.d.ts +5 -0
- package/dist/workflow-builder/extract-code.js +105 -0
- package/dist/workflow-builder/extract-code.js.map +1 -0
- package/dist/workflow-builder/index.d.ts +5 -0
- package/dist/workflow-builder/index.js +19 -0
- package/dist/workflow-builder/index.js.map +1 -0
- package/dist/workflow-builder/parse-validate.d.ts +6 -0
- package/dist/workflow-builder/parse-validate.js +49 -0
- package/dist/workflow-builder/parse-validate.js.map +1 -0
- package/dist/workflow-builder/patch-code.d.ts +14 -0
- package/dist/workflow-builder/patch-code.js +117 -0
- package/dist/workflow-builder/patch-code.js.map +1 -0
- package/dist/workflow-builder/sdk-prompt-sections.d.ts +4 -0
- package/dist/workflow-builder/sdk-prompt-sections.js +517 -0
- package/dist/workflow-builder/sdk-prompt-sections.js.map +1 -0
- package/dist/workflow-builder/types.d.ts +11 -0
- package/dist/workflow-builder/types.js +3 -0
- package/dist/workflow-builder/types.js.map +1 -0
- package/dist/workflow-loop/guidance.d.ts +5 -0
- package/dist/workflow-loop/guidance.js +37 -0
- package/dist/workflow-loop/guidance.js.map +1 -0
- package/dist/workflow-loop/index.d.ts +5 -0
- package/dist/workflow-loop/index.js +25 -0
- package/dist/workflow-loop/index.js.map +1 -0
- package/dist/workflow-loop/runtime.d.ts +8 -0
- package/dist/workflow-loop/runtime.js +40 -0
- package/dist/workflow-loop/runtime.js.map +1 -0
- package/dist/workflow-loop/workflow-loop-controller.d.ts +11 -0
- package/dist/workflow-loop/workflow-loop-controller.js +212 -0
- package/dist/workflow-loop/workflow-loop-controller.js.map +1 -0
- package/dist/workflow-loop/workflow-loop-state.d.ts +189 -0
- package/dist/workflow-loop/workflow-loop-state.js +77 -0
- package/dist/workflow-loop/workflow-loop-state.js.map +1 -0
- package/dist/workflow-loop/workflow-task-service.d.ts +13 -0
- package/dist/workflow-loop/workflow-task-service.js +35 -0
- package/dist/workflow-loop/workflow-task-service.js.map +1 -0
- package/dist/workspace/builder-sandbox-factory.d.ts +25 -0
- package/dist/workspace/builder-sandbox-factory.js +199 -0
- package/dist/workspace/builder-sandbox-factory.js.map +1 -0
- package/dist/workspace/create-workspace.d.ts +33 -0
- package/dist/workspace/create-workspace.js +56 -0
- package/dist/workspace/create-workspace.js.map +1 -0
- package/dist/workspace/daytona-filesystem.d.ts +25 -0
- package/dist/workspace/daytona-filesystem.js +109 -0
- package/dist/workspace/daytona-filesystem.js.map +1 -0
- package/dist/workspace/n8n-sandbox-client.d.ts +105 -0
- package/dist/workspace/n8n-sandbox-client.js +335 -0
- package/dist/workspace/n8n-sandbox-client.js.map +1 -0
- package/dist/workspace/n8n-sandbox-filesystem.d.ts +25 -0
- package/dist/workspace/n8n-sandbox-filesystem.js +128 -0
- package/dist/workspace/n8n-sandbox-filesystem.js.map +1 -0
- package/dist/workspace/n8n-sandbox-image-manager.d.ts +5 -0
- package/dist/workspace/n8n-sandbox-image-manager.js +25 -0
- package/dist/workspace/n8n-sandbox-image-manager.js.map +1 -0
- package/dist/workspace/n8n-sandbox-sandbox.d.ts +27 -0
- package/dist/workspace/n8n-sandbox-sandbox.js +103 -0
- package/dist/workspace/n8n-sandbox-sandbox.js.map +1 -0
- package/dist/workspace/sandbox-fs.d.ts +9 -0
- package/dist/workspace/sandbox-fs.js +43 -0
- package/dist/workspace/sandbox-fs.js.map +1 -0
- package/dist/workspace/sandbox-setup.d.ts +11 -0
- package/dist/workspace/sandbox-setup.js +139 -0
- package/dist/workspace/sandbox-setup.js.map +1 -0
- package/dist/workspace/snapshot-manager.d.ts +8 -0
- package/dist/workspace/snapshot-manager.js +31 -0
- package/dist/workspace/snapshot-manager.js.map +1 -0
- package/package.json +54 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-workflow-agent.prompt.js","sourceRoot":"","sources":["../../../src/tools/orchestration/build-workflow-agent.prompt.ts"],"names":[],"mappings":";;;AA6hBA,0EAuTC;AA50BD,6DAKgC;AAIhC,MAAM,sBAAsB,GAAG;;;;;;;;;;;;EAY7B,iCAAc;;;;EAId,wCAAqB;;;;EAIrB,uCAAoB;;;;EAIpB,uCAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2FA2bqE,CAAC;AAI/E,QAAA,oBAAoB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgDlC,sBAAsB;CACvB,CAAC;AAIF,SAAgB,+BAA+B,CAAC,aAAqB;IACpE,OAAO;;;;;;;;;;;0BAWkB,aAAa,6DAA6D,aAAa;;;EAG/G,aAAa;;;;;;;;;;;;;;;;;;KAkBV,aAAa;;;;;;;;;;;;;;;KAeb,aAAa;;;;;;;;;;;;;;;;;;;;;KAqBb,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAqDb,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sCAoHoB,aAAa;;;;;;;;;;;;kCAYjB,aAAa;;;;;;;;;;;;;;;;;;;;;;;;6BAwBlB,aAAa;;;;sCAIJ,aAAa;;;;;;;;yFAQsC,aAAa;;;;;;;;;;;;;;;;;;;;;;;EAuBpG,sBAAsB;CACvB,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { OrchestrationContext } from '../../types';
|
|
2
|
+
export interface StartBuildWorkflowAgentInput {
|
|
3
|
+
task: string;
|
|
4
|
+
workflowId?: string;
|
|
5
|
+
conversationContext?: string;
|
|
6
|
+
taskId?: string;
|
|
7
|
+
agentId?: string;
|
|
8
|
+
plannedTaskId?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface StartedWorkflowBuildTask {
|
|
11
|
+
result: string;
|
|
12
|
+
taskId: string;
|
|
13
|
+
agentId: string;
|
|
14
|
+
}
|
|
15
|
+
export declare function startBuildWorkflowAgentTask(context: OrchestrationContext, input: StartBuildWorkflowAgentInput): Promise<StartedWorkflowBuildTask>;
|
|
16
|
+
export declare function createBuildWorkflowAgentTool(context: OrchestrationContext): import("@mastra/core/tools").Tool<{
|
|
17
|
+
task: string;
|
|
18
|
+
workflowId?: string | undefined;
|
|
19
|
+
conversationContext?: string | undefined;
|
|
20
|
+
}, {
|
|
21
|
+
result: string;
|
|
22
|
+
taskId: string;
|
|
23
|
+
}, unknown, unknown, import("@mastra/core/tools").ToolExecutionContext<unknown, unknown, unknown>, "build-workflow-with-agent", unknown>;
|
|
@@ -0,0 +1,503 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.startBuildWorkflowAgentTask = startBuildWorkflowAgentTask;
|
|
4
|
+
exports.createBuildWorkflowAgentTool = createBuildWorkflowAgentTool;
|
|
5
|
+
const agent_1 = require("@mastra/core/agent");
|
|
6
|
+
const tools_1 = require("@mastra/core/tools");
|
|
7
|
+
const workflow_sdk_1 = require("@n8n/workflow-sdk");
|
|
8
|
+
const nanoid_1 = require("nanoid");
|
|
9
|
+
const node_crypto_1 = require("node:crypto");
|
|
10
|
+
const zod_1 = require("zod");
|
|
11
|
+
const browser_credential_setup_tool_1 = require("./browser-credential-setup.tool");
|
|
12
|
+
const build_workflow_agent_prompt_1 = require("./build-workflow-agent.prompt");
|
|
13
|
+
const display_utils_1 = require("./display-utils");
|
|
14
|
+
const tracing_utils_1 = require("./tracing-utils");
|
|
15
|
+
const verify_built_workflow_tool_1 = require("./verify-built-workflow.tool");
|
|
16
|
+
const register_with_mastra_1 = require("../../agent/register-with-mastra");
|
|
17
|
+
const resumable_stream_executor_1 = require("../../runtime/resumable-stream-executor");
|
|
18
|
+
const working_memory_tracing_1 = require("../../runtime/working-memory-tracing");
|
|
19
|
+
const iteration_log_1 = require("../../storage/iteration-log");
|
|
20
|
+
const consume_with_hitl_1 = require("../../stream/consume-with-hitl");
|
|
21
|
+
const langsmith_tracing_1 = require("../../tracing/langsmith-tracing");
|
|
22
|
+
const extract_code_1 = require("../../workflow-builder/extract-code");
|
|
23
|
+
const sandbox_fs_1 = require("../../workspace/sandbox-fs");
|
|
24
|
+
const sandbox_setup_1 = require("../../workspace/sandbox-setup");
|
|
25
|
+
const apply_workflow_credentials_tool_1 = require("../workflows/apply-workflow-credentials.tool");
|
|
26
|
+
const resolve_credentials_1 = require("../workflows/resolve-credentials");
|
|
27
|
+
const submit_workflow_tool_1 = require("../workflows/submit-workflow.tool");
|
|
28
|
+
const UNTESTABLE_TRIGGERS = new Set([
|
|
29
|
+
'n8n-nodes-base.webhook',
|
|
30
|
+
'n8n-nodes-base.formTrigger',
|
|
31
|
+
'@n8n/n8n-nodes-langchain.mcpTrigger',
|
|
32
|
+
'@n8n/n8n-nodes-langchain.chatTrigger',
|
|
33
|
+
]);
|
|
34
|
+
function triggerLabel(nodeType) {
|
|
35
|
+
const short = nodeType.split('.').pop() ?? nodeType;
|
|
36
|
+
return short.replace(/Trigger$/i, '').toLowerCase() || short.toLowerCase();
|
|
37
|
+
}
|
|
38
|
+
const UNTESTABLE_TRIGGER_LABELS = [...UNTESTABLE_TRIGGERS].map(triggerLabel).join(', ');
|
|
39
|
+
function detectTriggerType(attempt) {
|
|
40
|
+
if (!attempt?.triggerNodeTypes || attempt.triggerNodeTypes.length === 0) {
|
|
41
|
+
return 'manual_or_testable';
|
|
42
|
+
}
|
|
43
|
+
const allUntestable = attempt.triggerNodeTypes.every((t) => UNTESTABLE_TRIGGERS.has(t));
|
|
44
|
+
return allUntestable ? 'trigger_only' : 'manual_or_testable';
|
|
45
|
+
}
|
|
46
|
+
function buildOutcome(workItemId, taskId, attempt, finalText) {
|
|
47
|
+
if (!attempt?.success) {
|
|
48
|
+
return {
|
|
49
|
+
workItemId,
|
|
50
|
+
taskId,
|
|
51
|
+
submitted: false,
|
|
52
|
+
triggerType: 'manual_or_testable',
|
|
53
|
+
needsUserInput: false,
|
|
54
|
+
failureSignature: attempt?.errors?.join('; '),
|
|
55
|
+
summary: finalText,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
return {
|
|
59
|
+
workItemId,
|
|
60
|
+
taskId,
|
|
61
|
+
workflowId: attempt.workflowId,
|
|
62
|
+
submitted: true,
|
|
63
|
+
triggerType: detectTriggerType(attempt),
|
|
64
|
+
needsUserInput: false,
|
|
65
|
+
mockedNodeNames: attempt.mockedNodeNames,
|
|
66
|
+
mockedCredentialTypes: attempt.mockedCredentialTypes,
|
|
67
|
+
mockedCredentialsByNode: attempt.mockedCredentialsByNode,
|
|
68
|
+
verificationPinData: attempt.verificationPinData,
|
|
69
|
+
summary: finalText,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
const BUILDER_MAX_STEPS = 30;
|
|
73
|
+
const DETACHED_BUILDER_REQUIREMENTS = `## Detached Task Contract
|
|
74
|
+
|
|
75
|
+
You are running as a detached background task. Do not stop after a successful submit — verify the workflow works.
|
|
76
|
+
|
|
77
|
+
### Completion criteria
|
|
78
|
+
|
|
79
|
+
Your job is done when ONE of these is true:
|
|
80
|
+
- the workflow is verified (ran successfully or publish-workflow succeeded)
|
|
81
|
+
- the workflow uses only event triggers (${UNTESTABLE_TRIGGER_LABELS}) and cannot be runtime-tested — publish it and stop
|
|
82
|
+
- you are blocked after one repair attempt per unique failure
|
|
83
|
+
|
|
84
|
+
### Submit discipline
|
|
85
|
+
|
|
86
|
+
**Every file edit MUST be followed by submit-workflow before you do anything else.**
|
|
87
|
+
The system tracks file hashes. If you edit the code and then call publish-workflow, run-workflow, or finish without re-submitting, your work is discarded. The sequence is always: edit → submit → then verify/publish.
|
|
88
|
+
|
|
89
|
+
### Verification
|
|
90
|
+
|
|
91
|
+
- If submit-workflow returned mocked credentials, call verify-built-workflow with the workItemId
|
|
92
|
+
- Otherwise call run-workflow to test (skip for trigger-only workflows)
|
|
93
|
+
- If verification fails, call debug-execution, fix the code, re-submit, and retry once
|
|
94
|
+
- If the same failure signature repeats, stop and explain the block
|
|
95
|
+
|
|
96
|
+
### Credential finalization
|
|
97
|
+
|
|
98
|
+
If verification succeeds with mocked credentials:
|
|
99
|
+
1. call setup-credentials with credentialFlow stage "finalize"
|
|
100
|
+
2. if it returns needsBrowserSetup=true, call browser-credential-setup then setup-credentials again
|
|
101
|
+
3. call apply-workflow-credentials with the workItemId and selected credentials
|
|
102
|
+
|
|
103
|
+
### Resource discovery
|
|
104
|
+
|
|
105
|
+
Before writing code that uses external services, **resolve real resource IDs**:
|
|
106
|
+
- Call explore-node-resources for any parameter with searchListMethod (calendars, spreadsheets, channels, models, etc.)
|
|
107
|
+
- Do NOT use "primary", "default", or any assumed identifier — look up the actual value
|
|
108
|
+
- Call get-suggested-nodes early if the workflow fits a known category (web_app, form_input, data_persistence, etc.) — the pattern hints prevent common mistakes
|
|
109
|
+
- Check @builderHint annotations in node type definitions for critical configuration guidance
|
|
110
|
+
|
|
111
|
+
### Publish validation errors
|
|
112
|
+
|
|
113
|
+
If publish-workflow fails with node configuration issues, the error tells you which node and what's wrong. Fix the parameter, re-submit, then try publishing again. Common causes:
|
|
114
|
+
- Resource list parameters (calendar, spreadsheet) need a real ID from explore-node-resources, not "primary"
|
|
115
|
+
- Expression parameters need the correct n8n expression syntax
|
|
116
|
+
- Required parameters missing from the node config
|
|
117
|
+
`;
|
|
118
|
+
function hashContent(content) {
|
|
119
|
+
return (0, node_crypto_1.createHash)('sha256')
|
|
120
|
+
.update(content ?? '', 'utf8')
|
|
121
|
+
.digest('hex');
|
|
122
|
+
}
|
|
123
|
+
async function startBuildWorkflowAgentTask(context, input) {
|
|
124
|
+
if (!context.spawnBackgroundTask) {
|
|
125
|
+
return {
|
|
126
|
+
result: 'Error: background task support not available.',
|
|
127
|
+
taskId: '',
|
|
128
|
+
agentId: '',
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
const factory = context.builderSandboxFactory;
|
|
132
|
+
const domainContext = context.domainContext;
|
|
133
|
+
const useSandbox = !!factory && !!domainContext;
|
|
134
|
+
let builderTools;
|
|
135
|
+
let prompt = build_workflow_agent_prompt_1.BUILDER_AGENT_PROMPT;
|
|
136
|
+
let credMap;
|
|
137
|
+
if (useSandbox) {
|
|
138
|
+
credMap = await (0, resolve_credentials_1.buildCredentialMap)(domainContext.credentialService);
|
|
139
|
+
const toolNames = [
|
|
140
|
+
'search-nodes',
|
|
141
|
+
'get-suggested-nodes',
|
|
142
|
+
'get-workflow-as-code',
|
|
143
|
+
'get-node-type-definition',
|
|
144
|
+
'explore-node-resources',
|
|
145
|
+
'list-workflows',
|
|
146
|
+
'list-credentials',
|
|
147
|
+
'test-credential',
|
|
148
|
+
'setup-credentials',
|
|
149
|
+
'ask-user',
|
|
150
|
+
'run-workflow',
|
|
151
|
+
'get-execution',
|
|
152
|
+
'debug-execution',
|
|
153
|
+
'publish-workflow',
|
|
154
|
+
'unpublish-workflow',
|
|
155
|
+
'list-data-tables',
|
|
156
|
+
'create-data-table',
|
|
157
|
+
'get-data-table-schema',
|
|
158
|
+
'add-data-table-column',
|
|
159
|
+
'query-data-table-rows',
|
|
160
|
+
'insert-data-table-rows',
|
|
161
|
+
];
|
|
162
|
+
builderTools = {};
|
|
163
|
+
for (const name of toolNames) {
|
|
164
|
+
if (context.domainTools[name]) {
|
|
165
|
+
builderTools[name] = context.domainTools[name];
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
if (context.workflowTaskService && context.domainContext) {
|
|
169
|
+
builderTools['verify-built-workflow'] = (0, verify_built_workflow_tool_1.createVerifyBuiltWorkflowTool)(context);
|
|
170
|
+
builderTools['apply-workflow-credentials'] = (0, apply_workflow_credentials_tool_1.createApplyWorkflowCredentialsTool)(context);
|
|
171
|
+
}
|
|
172
|
+
if (context.browserMcpConfig) {
|
|
173
|
+
builderTools['browser-credential-setup'] = (0, browser_credential_setup_tool_1.createBrowserCredentialSetupTool)(context);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
builderTools = {};
|
|
178
|
+
const toolNames = [
|
|
179
|
+
'build-workflow',
|
|
180
|
+
'get-node-type-definition',
|
|
181
|
+
'get-workflow-as-code',
|
|
182
|
+
'list-workflows',
|
|
183
|
+
'search-nodes',
|
|
184
|
+
'get-suggested-nodes',
|
|
185
|
+
'ask-user',
|
|
186
|
+
'list-data-tables',
|
|
187
|
+
'create-data-table',
|
|
188
|
+
'get-data-table-schema',
|
|
189
|
+
'add-data-table-column',
|
|
190
|
+
'query-data-table-rows',
|
|
191
|
+
'insert-data-table-rows',
|
|
192
|
+
...(context.researchMode ? ['web-search', 'fetch-url'] : []),
|
|
193
|
+
];
|
|
194
|
+
for (const name of toolNames) {
|
|
195
|
+
if (name in context.domainTools) {
|
|
196
|
+
builderTools[name] = context.domainTools[name];
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
if (!builderTools['build-workflow']) {
|
|
200
|
+
return { result: 'Error: build-workflow tool not available.', taskId: '', agentId: '' };
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
const subAgentId = input.agentId ?? `agent-builder-${(0, nanoid_1.nanoid)(6)}`;
|
|
204
|
+
const taskId = input.taskId ?? `build-${(0, nanoid_1.nanoid)(8)}`;
|
|
205
|
+
const workItemId = `wi_${(0, nanoid_1.nanoid)(8)}`;
|
|
206
|
+
context.eventBus.publish(context.threadId, {
|
|
207
|
+
type: 'agent-spawned',
|
|
208
|
+
runId: context.runId,
|
|
209
|
+
agentId: subAgentId,
|
|
210
|
+
payload: {
|
|
211
|
+
parentId: context.orchestratorAgentId,
|
|
212
|
+
role: 'workflow-builder',
|
|
213
|
+
tools: Object.keys(builderTools),
|
|
214
|
+
taskId,
|
|
215
|
+
kind: 'builder',
|
|
216
|
+
title: 'Building workflow',
|
|
217
|
+
subtitle: (0, display_utils_1.truncateLabel)(input.task),
|
|
218
|
+
goal: input.task,
|
|
219
|
+
targetResource: input.workflowId
|
|
220
|
+
? { type: 'workflow', id: input.workflowId }
|
|
221
|
+
: { type: 'workflow' },
|
|
222
|
+
},
|
|
223
|
+
});
|
|
224
|
+
const { workflowId } = input;
|
|
225
|
+
let iterationContext = '';
|
|
226
|
+
if (context.iterationLog) {
|
|
227
|
+
const taskKey = `build:${workflowId ?? 'new'}`;
|
|
228
|
+
try {
|
|
229
|
+
const entries = await context.iterationLog.getForTask(context.threadId, taskKey);
|
|
230
|
+
iterationContext = (0, iteration_log_1.formatPreviousAttempts)(entries);
|
|
231
|
+
}
|
|
232
|
+
catch {
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
const conversationCtx = input.conversationContext
|
|
236
|
+
? `\n\n[CONVERSATION CONTEXT: ${input.conversationContext}]`
|
|
237
|
+
: '';
|
|
238
|
+
let briefing;
|
|
239
|
+
if (useSandbox) {
|
|
240
|
+
if (workflowId) {
|
|
241
|
+
briefing = `${input.task}${conversationCtx}\n\n[CONTEXT: Modifying existing workflow ${workflowId}. The current code is pre-loaded in ~/workspace/src/workflow.ts — read it first, then edit. Use workflowId "${workflowId}" when calling submit-workflow.]\n\n[WORK ITEM ID: ${workItemId}]\n\n${DETACHED_BUILDER_REQUIREMENTS}${iterationContext ? `\n\n${iterationContext}` : ''}`;
|
|
242
|
+
}
|
|
243
|
+
else {
|
|
244
|
+
briefing = `${input.task}${conversationCtx}\n\n[WORK ITEM ID: ${workItemId}]\n\n${DETACHED_BUILDER_REQUIREMENTS}${iterationContext ? `\n\n${iterationContext}` : ''}`;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
else if (workflowId) {
|
|
248
|
+
briefing = `${input.task}${conversationCtx}\n\n[CONTEXT: Modifying existing workflow ${workflowId}. Use workflowId "${workflowId}" when calling build-workflow.]${iterationContext ? `\n\n${iterationContext}` : ''}`;
|
|
249
|
+
}
|
|
250
|
+
else {
|
|
251
|
+
briefing = `${input.task}${conversationCtx}${iterationContext ? `\n\n${iterationContext}` : ''}`;
|
|
252
|
+
}
|
|
253
|
+
const traceContext = await (0, tracing_utils_1.createDetachedSubAgentTracing)(context, {
|
|
254
|
+
agentId: subAgentId,
|
|
255
|
+
role: 'workflow-builder',
|
|
256
|
+
kind: 'builder',
|
|
257
|
+
taskId,
|
|
258
|
+
plannedTaskId: input.plannedTaskId,
|
|
259
|
+
workItemId,
|
|
260
|
+
inputs: {
|
|
261
|
+
task: input.task,
|
|
262
|
+
workflowId: input.workflowId,
|
|
263
|
+
conversationContext: input.conversationContext,
|
|
264
|
+
},
|
|
265
|
+
});
|
|
266
|
+
context.spawnBackgroundTask({
|
|
267
|
+
taskId,
|
|
268
|
+
threadId: context.threadId,
|
|
269
|
+
agentId: subAgentId,
|
|
270
|
+
role: 'workflow-builder',
|
|
271
|
+
traceContext,
|
|
272
|
+
plannedTaskId: input.plannedTaskId,
|
|
273
|
+
workItemId,
|
|
274
|
+
run: async (signal, drainCorrections) => await (0, tracing_utils_1.withTraceContextActor)(traceContext, async () => {
|
|
275
|
+
let builderWs;
|
|
276
|
+
const submitAttempts = new Map();
|
|
277
|
+
try {
|
|
278
|
+
if (useSandbox) {
|
|
279
|
+
builderWs = await factory.create(subAgentId, domainContext);
|
|
280
|
+
const workspace = builderWs.workspace;
|
|
281
|
+
const root = await (0, sandbox_setup_1.getWorkspaceRoot)(workspace);
|
|
282
|
+
prompt = (0, build_workflow_agent_prompt_1.createSandboxBuilderAgentPrompt)(root);
|
|
283
|
+
if (workflowId && domainContext) {
|
|
284
|
+
try {
|
|
285
|
+
const json = await domainContext.workflowService.getAsWorkflowJSON(workflowId);
|
|
286
|
+
let rawCode = (0, workflow_sdk_1.generateWorkflowCode)(json);
|
|
287
|
+
rawCode = rawCode.replace(/newCredential\('([^']*)',\s*'[^']*'\)/g, "newCredential('$1')");
|
|
288
|
+
const code = `${extract_code_1.SDK_IMPORT_STATEMENT}\n\n${rawCode}`;
|
|
289
|
+
if (workspace.filesystem) {
|
|
290
|
+
await workspace.filesystem.writeFile(`${root}/src/workflow.ts`, code, {
|
|
291
|
+
recursive: true,
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
catch {
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
const mainWorkflowPath = `${root}/src/workflow.ts`;
|
|
299
|
+
builderTools['submit-workflow'] = (0, submit_workflow_tool_1.createSubmitWorkflowTool)(domainContext, workspace, credMap, async (attempt) => {
|
|
300
|
+
submitAttempts.set(attempt.filePath, attempt);
|
|
301
|
+
if (attempt.filePath !== mainWorkflowPath || !context.workflowTaskService) {
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
304
|
+
await context.workflowTaskService.reportBuildOutcome(buildOutcome(workItemId, taskId, attempt, attempt.success
|
|
305
|
+
? 'Workflow submitted and ready for verification.'
|
|
306
|
+
: (attempt.errors?.join(' ') ?? 'Workflow submission failed.')));
|
|
307
|
+
});
|
|
308
|
+
const tracedBuilderTools = (0, tracing_utils_1.traceSubAgentTools)(context, builderTools, 'workflow-builder');
|
|
309
|
+
const subAgent = new agent_1.Agent({
|
|
310
|
+
id: subAgentId,
|
|
311
|
+
name: 'Workflow Builder Agent',
|
|
312
|
+
instructions: {
|
|
313
|
+
role: 'system',
|
|
314
|
+
content: prompt,
|
|
315
|
+
providerOptions: {
|
|
316
|
+
anthropic: { cacheControl: { type: 'ephemeral' } },
|
|
317
|
+
},
|
|
318
|
+
},
|
|
319
|
+
model: context.modelId,
|
|
320
|
+
tools: tracedBuilderTools,
|
|
321
|
+
workspace,
|
|
322
|
+
});
|
|
323
|
+
(0, langsmith_tracing_1.mergeTraceRunInputs)(traceContext?.actorRun, (0, langsmith_tracing_1.buildAgentTraceInputs)({
|
|
324
|
+
systemPrompt: prompt,
|
|
325
|
+
tools: tracedBuilderTools,
|
|
326
|
+
modelId: context.modelId,
|
|
327
|
+
}));
|
|
328
|
+
(0, register_with_mastra_1.registerWithMastra)(subAgentId, subAgent, context.storage);
|
|
329
|
+
const traceParent = (0, langsmith_tracing_1.getTraceParentRun)();
|
|
330
|
+
const hitlResult = await (0, langsmith_tracing_1.withTraceParentContext)(traceParent, async () => {
|
|
331
|
+
const llmStepTraceHooks = (0, resumable_stream_executor_1.createLlmStepTraceHooks)(traceParent);
|
|
332
|
+
const stream = await (0, working_memory_tracing_1.traceWorkingMemoryContext)({
|
|
333
|
+
phase: 'initial',
|
|
334
|
+
agentId: subAgentId,
|
|
335
|
+
agentRole: 'workflow-builder',
|
|
336
|
+
threadId: context.threadId,
|
|
337
|
+
input: briefing,
|
|
338
|
+
}, async () => await subAgent.stream(briefing, {
|
|
339
|
+
maxSteps: BUILDER_MAX_STEPS,
|
|
340
|
+
abortSignal: signal,
|
|
341
|
+
providerOptions: {
|
|
342
|
+
anthropic: { cacheControl: { type: 'ephemeral' } },
|
|
343
|
+
},
|
|
344
|
+
...(llmStepTraceHooks?.executionOptions ?? {}),
|
|
345
|
+
}));
|
|
346
|
+
return await (0, consume_with_hitl_1.consumeStreamWithHitl)({
|
|
347
|
+
agent: subAgent,
|
|
348
|
+
stream: stream,
|
|
349
|
+
runId: context.runId,
|
|
350
|
+
agentId: subAgentId,
|
|
351
|
+
eventBus: context.eventBus,
|
|
352
|
+
threadId: context.threadId,
|
|
353
|
+
abortSignal: signal,
|
|
354
|
+
waitForConfirmation: context.waitForConfirmation,
|
|
355
|
+
drainCorrections,
|
|
356
|
+
llmStepTraceHooks,
|
|
357
|
+
workingMemoryEnabled: false,
|
|
358
|
+
});
|
|
359
|
+
});
|
|
360
|
+
const finalText = await hitlResult.text;
|
|
361
|
+
const mainWorkflowAttempt = submitAttempts.get(mainWorkflowPath);
|
|
362
|
+
const currentMainWorkflow = await (0, sandbox_fs_1.readFileViaSandbox)(workspace, mainWorkflowPath);
|
|
363
|
+
const currentMainWorkflowHash = hashContent(currentMainWorkflow);
|
|
364
|
+
if (!mainWorkflowAttempt) {
|
|
365
|
+
const text = 'Error: workflow builder finished without submitting /src/workflow.ts.';
|
|
366
|
+
return {
|
|
367
|
+
text,
|
|
368
|
+
outcome: buildOutcome(workItemId, taskId, undefined, text),
|
|
369
|
+
};
|
|
370
|
+
}
|
|
371
|
+
if (!mainWorkflowAttempt.success) {
|
|
372
|
+
const errorText = mainWorkflowAttempt.errors?.join(' ') ?? 'Unknown submit-workflow failure.';
|
|
373
|
+
const text = `Error: workflow builder stopped after a failed submit-workflow for /src/workflow.ts. ${errorText}`;
|
|
374
|
+
return {
|
|
375
|
+
text,
|
|
376
|
+
outcome: buildOutcome(workItemId, taskId, mainWorkflowAttempt, text),
|
|
377
|
+
};
|
|
378
|
+
}
|
|
379
|
+
if (mainWorkflowAttempt.sourceHash !== currentMainWorkflowHash) {
|
|
380
|
+
const submitTool = tracedBuilderTools['submit-workflow'];
|
|
381
|
+
if (submitTool && 'execute' in submitTool) {
|
|
382
|
+
const resubmit = await submitTool.execute({
|
|
383
|
+
filePath: mainWorkflowPath,
|
|
384
|
+
workflowId: mainWorkflowAttempt.workflowId,
|
|
385
|
+
});
|
|
386
|
+
const refreshedAttempt = submitAttempts.get(mainWorkflowPath);
|
|
387
|
+
if (refreshedAttempt?.success) {
|
|
388
|
+
return {
|
|
389
|
+
text: finalText,
|
|
390
|
+
outcome: buildOutcome(workItemId, taskId, refreshedAttempt, finalText),
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
const resubmitErrors = refreshedAttempt?.errors?.join(' ') ??
|
|
394
|
+
(typeof resubmit?.errors === 'string'
|
|
395
|
+
? resubmit.errors
|
|
396
|
+
: 'Auto-re-submit failed.');
|
|
397
|
+
const text = `Error: auto-re-submit of edited /src/workflow.ts failed. ${resubmitErrors}`;
|
|
398
|
+
return {
|
|
399
|
+
text,
|
|
400
|
+
outcome: buildOutcome(workItemId, taskId, refreshedAttempt ?? undefined, text),
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
return {
|
|
405
|
+
text: finalText,
|
|
406
|
+
outcome: buildOutcome(workItemId, taskId, mainWorkflowAttempt, finalText),
|
|
407
|
+
};
|
|
408
|
+
}
|
|
409
|
+
const tracedBuilderTools = (0, tracing_utils_1.traceSubAgentTools)(context, builderTools, 'workflow-builder');
|
|
410
|
+
const subAgent = new agent_1.Agent({
|
|
411
|
+
id: subAgentId,
|
|
412
|
+
name: 'Workflow Builder Agent',
|
|
413
|
+
instructions: {
|
|
414
|
+
role: 'system',
|
|
415
|
+
content: prompt,
|
|
416
|
+
providerOptions: {
|
|
417
|
+
anthropic: { cacheControl: { type: 'ephemeral' } },
|
|
418
|
+
},
|
|
419
|
+
},
|
|
420
|
+
model: context.modelId,
|
|
421
|
+
tools: tracedBuilderTools,
|
|
422
|
+
});
|
|
423
|
+
(0, langsmith_tracing_1.mergeTraceRunInputs)(traceContext?.actorRun, (0, langsmith_tracing_1.buildAgentTraceInputs)({
|
|
424
|
+
systemPrompt: prompt,
|
|
425
|
+
tools: tracedBuilderTools,
|
|
426
|
+
modelId: context.modelId,
|
|
427
|
+
}));
|
|
428
|
+
(0, register_with_mastra_1.registerWithMastra)(subAgentId, subAgent, context.storage);
|
|
429
|
+
const traceParent = (0, langsmith_tracing_1.getTraceParentRun)();
|
|
430
|
+
const hitlResult = await (0, langsmith_tracing_1.withTraceParentContext)(traceParent, async () => {
|
|
431
|
+
const llmStepTraceHooks = (0, resumable_stream_executor_1.createLlmStepTraceHooks)(traceParent);
|
|
432
|
+
const stream = await (0, working_memory_tracing_1.traceWorkingMemoryContext)({
|
|
433
|
+
phase: 'initial',
|
|
434
|
+
agentId: subAgentId,
|
|
435
|
+
agentRole: 'workflow-builder',
|
|
436
|
+
threadId: context.threadId,
|
|
437
|
+
input: briefing,
|
|
438
|
+
}, async () => await subAgent.stream(briefing, {
|
|
439
|
+
maxSteps: BUILDER_MAX_STEPS,
|
|
440
|
+
abortSignal: signal,
|
|
441
|
+
providerOptions: {
|
|
442
|
+
anthropic: { cacheControl: { type: 'ephemeral' } },
|
|
443
|
+
},
|
|
444
|
+
...(llmStepTraceHooks?.executionOptions ?? {}),
|
|
445
|
+
}));
|
|
446
|
+
return await (0, consume_with_hitl_1.consumeStreamWithHitl)({
|
|
447
|
+
agent: subAgent,
|
|
448
|
+
stream: stream,
|
|
449
|
+
runId: context.runId,
|
|
450
|
+
agentId: subAgentId,
|
|
451
|
+
eventBus: context.eventBus,
|
|
452
|
+
threadId: context.threadId,
|
|
453
|
+
abortSignal: signal,
|
|
454
|
+
waitForConfirmation: context.waitForConfirmation,
|
|
455
|
+
drainCorrections,
|
|
456
|
+
llmStepTraceHooks,
|
|
457
|
+
workingMemoryEnabled: false,
|
|
458
|
+
});
|
|
459
|
+
});
|
|
460
|
+
const toolFinalText = await hitlResult.text;
|
|
461
|
+
return { text: toolFinalText };
|
|
462
|
+
}
|
|
463
|
+
finally {
|
|
464
|
+
await builderWs?.cleanup();
|
|
465
|
+
}
|
|
466
|
+
}),
|
|
467
|
+
});
|
|
468
|
+
return {
|
|
469
|
+
result: `Workflow build started (task: ${taskId}). Reply with one short sentence — e.g. name what's being built. Do NOT summarize the plan or list details.`,
|
|
470
|
+
taskId,
|
|
471
|
+
agentId: subAgentId,
|
|
472
|
+
};
|
|
473
|
+
}
|
|
474
|
+
function createBuildWorkflowAgentTool(context) {
|
|
475
|
+
return (0, tools_1.createTool)({
|
|
476
|
+
id: 'build-workflow-with-agent',
|
|
477
|
+
description: 'Build or modify an n8n workflow using a specialized builder agent. ' +
|
|
478
|
+
'The agent handles node discovery, schema lookups, code generation, ' +
|
|
479
|
+
'and validation internally.',
|
|
480
|
+
inputSchema: zod_1.z.object({
|
|
481
|
+
task: zod_1.z
|
|
482
|
+
.string()
|
|
483
|
+
.describe('What to build and any context: user requirements, available credential names/types.'),
|
|
484
|
+
workflowId: zod_1.z
|
|
485
|
+
.string()
|
|
486
|
+
.optional()
|
|
487
|
+
.describe('Existing workflow ID to modify. When provided, the agent starts with the current workflow code pre-loaded.'),
|
|
488
|
+
conversationContext: zod_1.z
|
|
489
|
+
.string()
|
|
490
|
+
.optional()
|
|
491
|
+
.describe('Brief summary of the conversation so far — what was discussed, decisions made, and information gathered (e.g., which credentials are available). The builder uses this to avoid repeating information the user already knows.'),
|
|
492
|
+
}),
|
|
493
|
+
outputSchema: zod_1.z.object({
|
|
494
|
+
result: zod_1.z.string(),
|
|
495
|
+
taskId: zod_1.z.string(),
|
|
496
|
+
}),
|
|
497
|
+
execute: async (input) => {
|
|
498
|
+
const result = await startBuildWorkflowAgentTask(context, input);
|
|
499
|
+
return { result: result.result, taskId: result.taskId };
|
|
500
|
+
},
|
|
501
|
+
});
|
|
502
|
+
}
|
|
503
|
+
//# sourceMappingURL=build-workflow-agent.tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-workflow-agent.tool.js","sourceRoot":"","sources":["../../../src/tools/orchestration/build-workflow-agent.tool.ts"],"names":[],"mappings":";;AAkLA,kEAmbC;AAED,oEAmCC;AAjoBD,8CAA2C;AAE3C,8CAAgD;AAChD,oDAAyD;AACzD,mCAAgC;AAChC,6CAAyC;AACzC,6BAAwB;AAExB,mFAAmF;AACnF,+EAGuC;AACvC,mDAAgD;AAChD,mDAIyB;AACzB,6EAA6E;AAC7E,2EAAsE;AACtE,uFAAkF;AAClF,iFAAiF;AACjF,+DAAqE;AACrE,sEAAuE;AACvE,uEAKyC;AAEzC,sEAA2E;AAG3E,2DAAgE;AAChE,iEAAiE;AACjE,kGAAkG;AAClG,0EAA0F;AAC1F,4EAG2C;AAG3C,MAAM,mBAAmB,GAAG,IAAI,GAAG,CAAC;IACnC,wBAAwB;IACxB,4BAA4B;IAC5B,qCAAqC;IACrC,sCAAsC;CACtC,CAAC,CAAC;AAGH,SAAS,YAAY,CAAC,QAAgB;IACrC,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,IAAI,QAAQ,CAAC;IACpD,OAAO,KAAK,CAAC,OAAO,CAAC,WA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YACrB,IAAI,EAAE,OAAC;iBACL,MAAM,EAAE;iBACR,QAAQ,CACR,qFAAqF,CACrF;YACF,UAAU,EAAE,OAAC;iBACX,MAAM,EAAE;iBACR,QAAQ,EAAE;iBACV,QAAQ,CACR,4GAA4G,CAC5G;YACF,mBAAmB,EAAE,OAAC;iBACpB,MAAM,EAAE;iBACR,QAAQ,EAAE;iBACV,QAAQ,CACR,+NAA+N,CAC/N;SACF,CAAC;QACF,YAAY,EAAE,OAAC,CAAC,MAAM,CAAC;YACtB,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE;YAClB,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE;SAClB,CAAC;QACF,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;YACxB,MAAM,MAAM,GAAG,MAAM,2BAA2B,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;YACjE,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC;QACzD,CAAC;KACD,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { OrchestrationContext } from '../../types';
|
|
2
|
+
export declare function createCancelBackgroundTaskTool(context: OrchestrationContext): import("@mastra/core/tools").Tool<{
|
|
3
|
+
taskId: string;
|
|
4
|
+
}, {
|
|
5
|
+
result: string;
|
|
6
|
+
}, unknown, unknown, import("@mastra/core/tools").ToolExecutionContext<unknown, unknown, unknown>, "cancel-background-task", unknown>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createCancelBackgroundTaskTool = createCancelBackgroundTaskTool;
|
|
4
|
+
const tools_1 = require("@mastra/core/tools");
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
function createCancelBackgroundTaskTool(context) {
|
|
7
|
+
return (0, tools_1.createTool)({
|
|
8
|
+
id: 'cancel-background-task',
|
|
9
|
+
description: 'Cancel a running background task (workflow builder, data table manager) by its task ID. ' +
|
|
10
|
+
'Use when the user asks to stop a background task. ' +
|
|
11
|
+
'Running task IDs are listed in the <running-tasks> section of the message.',
|
|
12
|
+
inputSchema: zod_1.z.object({
|
|
13
|
+
taskId: zod_1.z.string().describe('The task ID to cancel (e.g. build-XXXXXXXX)'),
|
|
14
|
+
}),
|
|
15
|
+
execute: async (input) => {
|
|
16
|
+
if (!context.cancelBackgroundTask) {
|
|
17
|
+
return { result: 'Error: background task cancellation not available.' };
|
|
18
|
+
}
|
|
19
|
+
await context.cancelBackgroundTask(input.taskId);
|
|
20
|
+
return { result: `Background task ${input.taskId} cancelled.` };
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=cancel-background-task.tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cancel-background-task.tool.js","sourceRoot":"","sources":["../../../src/tools/orchestration/cancel-background-task.tool.ts"],"names":[],"mappings":";;AAUA,wEAkBC;AA5BD,8CAAgD;AAChD,6BAAwB;AASxB,SAAgB,8BAA8B,CAAC,OAA6B;IAC3E,OAAO,IAAA,kBAAU,EAAC;QACjB,EAAE,EAAE,wBAAwB;QAC5B,WAAW,EACV,0FAA0F;YAC1F,oDAAoD;YACpD,4EAA4E;QAC7E,WAAW,EAAE,OAAC,CAAC,MAAM,CAAC;YACrB,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,6CAA6C,CAAC;SAC1E,CAAC;QACF,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;YACxB,IAAI,CAAC,OAAO,CAAC,oBAAoB,EAAE,CAAC;gBACnC,OAAO,EAAE,MAAM,EAAE,oDAAoD,EAAE,CAAC;YACzE,CAAC;YACD,MAAM,OAAO,CAAC,oBAAoB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;YACjD,OAAO,EAAE,MAAM,EAAE,mBAAmB,KAAK,CAAC,MAAM,aAAa,EAAE,CAAC;QACjE,CAAC;KACD,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { OrchestrationContext } from '../../types';
|
|
2
|
+
export declare function createCorrectBackgroundTaskTool(context: OrchestrationContext): import("@mastra/core/tools").Tool<{
|
|
3
|
+
taskId: string;
|
|
4
|
+
correction: string;
|
|
5
|
+
}, {
|
|
6
|
+
result: string;
|
|
7
|
+
}, unknown, unknown, import("@mastra/core/tools").ToolExecutionContext<unknown, unknown, unknown>, "correct-background-task", unknown>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createCorrectBackgroundTaskTool = createCorrectBackgroundTaskTool;
|
|
4
|
+
const tools_1 = require("@mastra/core/tools");
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
function createCorrectBackgroundTaskTool(context) {
|
|
7
|
+
return (0, tools_1.createTool)({
|
|
8
|
+
id: 'correct-background-task',
|
|
9
|
+
description: 'Send a correction to a running background task (e.g. a workflow builder). ' +
|
|
10
|
+
'Use when the user sends a message that is clearly a correction for an in-progress build ' +
|
|
11
|
+
'(mentions specific nodes, databases, credentials, or says "wait"/"use X instead"). ' +
|
|
12
|
+
'Running task IDs are listed in the <running-tasks> section of the message.',
|
|
13
|
+
inputSchema: zod_1.z.object({
|
|
14
|
+
taskId: zod_1.z.string().describe('The task ID to send the correction to (e.g. build-XXXXXXXX)'),
|
|
15
|
+
correction: zod_1.z
|
|
16
|
+
.string()
|
|
17
|
+
.describe("The correction message from the user (e.g. 'use the Projects database')"),
|
|
18
|
+
}),
|
|
19
|
+
execute: async (input) => {
|
|
20
|
+
if (!context.sendCorrectionToTask) {
|
|
21
|
+
return await Promise.resolve({ result: 'Error: correction delivery not available.' });
|
|
22
|
+
}
|
|
23
|
+
const status = context.sendCorrectionToTask(input.taskId, input.correction);
|
|
24
|
+
if (status === 'task-not-found') {
|
|
25
|
+
return await Promise.resolve({
|
|
26
|
+
result: `Task ${input.taskId} not found. It may have already been cleaned up.`,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
if (status === 'task-completed') {
|
|
30
|
+
return await Promise.resolve({
|
|
31
|
+
result: `Task ${input.taskId} has already completed. The correction was not delivered. ` +
|
|
32
|
+
`Incorporate "${input.correction}" into a new follow-up task instead.`,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
return await Promise.resolve({
|
|
36
|
+
result: `Correction sent to task ${input.taskId}: "${input.correction}". The builder will see this on its next step.`,
|
|
37
|
+
});
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=correct-background-task.tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"correct-background-task.tool.js","sourceRoot":"","sources":["../../../src/tools/orchestration/correct-background-task.tool.ts"],"names":[],"mappings":";;AAUA,0EAoCC;AA9CD,8CAAgD;AAChD,6BAAwB;AASxB,SAAgB,+BAA+B,CAAC,OAA6B;IAC5E,OAAO,IAAA,kBAAU,EAAC;QACjB,EAAE,EAAE,yBAAyB;QAC7B,WAAW,EACV,4EAA4E;YAC5E,0FAA0F;YAC1F,qFAAqF;YACrF,4EAA4E;QAC7E,WAAW,EAAE,OAAC,CAAC,MAAM,CAAC;YACrB,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,6DAA6D,CAAC;YAC1F,UAAU,EAAE,OAAC;iBACX,MAAM,EAAE;iBACR,QAAQ,CAAC,yEAAyE,CAAC;SACrF,CAAC;QACF,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;YACxB,IAAI,CAAC,OAAO,CAAC,oBAAoB,EAAE,CAAC;gBACnC,OAAO,MAAM,OAAO,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,2CAA2C,EAAE,CAAC,CA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