@n8n/ai-workflow-builder 1.4.1 → 1.5.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/dist/agents/responder.agent.d.ts +4 -2
- package/dist/agents/responder.agent.js +9 -2
- package/dist/agents/responder.agent.js.map +1 -1
- package/dist/agents/supervisor.agent.d.ts +2 -1
- package/dist/agents/supervisor.agent.js +2 -2
- package/dist/agents/supervisor.agent.js.map +1 -1
- package/dist/ai-workflow-builder-agent.service.js +11 -7
- package/dist/ai-workflow-builder-agent.service.js.map +1 -1
- package/dist/build.tsbuildinfo +1 -1
- package/dist/chains/conversation-compact.d.ts +2 -1
- package/dist/chains/conversation-compact.js +2 -2
- package/dist/chains/conversation-compact.js.map +1 -1
- package/dist/chains/workflow-name.d.ts +2 -1
- package/dist/chains/workflow-name.js +3 -2
- package/dist/chains/workflow-name.js.map +1 -1
- package/dist/constants.d.ts +0 -1
- package/dist/constants.js +1 -2
- package/dist/constants.js.map +1 -1
- package/dist/llm-config.d.ts +14 -5
- package/dist/llm-config.js +90 -35
- package/dist/llm-config.js.map +1 -1
- package/dist/multi-agent-workflow-subgraphs.d.ts +2 -4
- package/dist/multi-agent-workflow-subgraphs.js +20 -15
- package/dist/multi-agent-workflow-subgraphs.js.map +1 -1
- package/dist/prompts/agents/builder.prompt.js +211 -33
- package/dist/prompts/agents/builder.prompt.js.map +1 -1
- package/dist/prompts/agents/configurator.prompt.js +24 -2
- package/dist/prompts/agents/configurator.prompt.js.map +1 -1
- package/dist/prompts/agents/discovery.prompt.js +84 -7
- package/dist/prompts/agents/discovery.prompt.js.map +1 -1
- package/dist/prompts/chains/parameter-updater/guides/gmail.js +27 -2
- package/dist/prompts/chains/parameter-updater/guides/gmail.js.map +1 -1
- package/dist/prompts/chains/parameter-updater/guides/index.d.ts +1 -0
- package/dist/prompts/chains/parameter-updater/guides/index.js +3 -1
- package/dist/prompts/chains/parameter-updater/guides/index.js.map +1 -1
- package/dist/prompts/chains/parameter-updater/guides/predecessor-output.d.ts +2 -0
- package/dist/prompts/chains/parameter-updater/guides/predecessor-output.js +25 -0
- package/dist/prompts/chains/parameter-updater/guides/predecessor-output.js.map +1 -0
- package/dist/prompts/chains/parameter-updater/registry.js +1 -0
- package/dist/prompts/chains/parameter-updater/registry.js.map +1 -1
- package/dist/prompts/index.d.ts +0 -1
- package/dist/prompts/index.js +1 -4
- package/dist/prompts/index.js.map +1 -1
- package/dist/prompts/shared/node-guidance/structured-output-parser.js +1 -1
- package/dist/prompts/shared/node-recommendations/audio-generation.d.ts +2 -0
- package/dist/prompts/shared/node-recommendations/audio-generation.js +18 -0
- package/dist/prompts/shared/node-recommendations/audio-generation.js.map +1 -0
- package/dist/prompts/shared/node-recommendations/image-generation.d.ts +2 -0
- package/dist/prompts/shared/node-recommendations/image-generation.js +18 -0
- package/dist/prompts/shared/node-recommendations/image-generation.js.map +1 -0
- package/dist/prompts/shared/node-recommendations/index.d.ts +3 -0
- package/dist/prompts/shared/node-recommendations/index.js +17 -0
- package/dist/prompts/shared/node-recommendations/index.js.map +1 -0
- package/dist/prompts/shared/node-recommendations/text-manipulation.d.ts +2 -0
- package/dist/prompts/shared/node-recommendations/text-manipulation.js +27 -0
- package/dist/prompts/shared/node-recommendations/text-manipulation.js.map +1 -0
- package/dist/prompts/shared/node-recommendations/utils/format-recommendation.d.ts +2 -0
- package/dist/prompts/shared/node-recommendations/utils/format-recommendation.js +24 -0
- package/dist/prompts/shared/node-recommendations/utils/format-recommendation.js.map +1 -0
- package/dist/prompts/shared/node-recommendations/video-generation.d.ts +2 -0
- package/dist/prompts/shared/node-recommendations/video-generation.js +15 -0
- package/dist/prompts/shared/node-recommendations/video-generation.js.map +1 -0
- package/dist/subgraphs/builder.subgraph.d.ts +3 -1
- package/dist/subgraphs/builder.subgraph.js +28 -4
- package/dist/subgraphs/builder.subgraph.js.map +1 -1
- package/dist/subgraphs/configurator.subgraph.d.ts +3 -1
- package/dist/subgraphs/configurator.subgraph.js +5 -3
- package/dist/subgraphs/configurator.subgraph.js.map +1 -1
- package/dist/subgraphs/discovery.subgraph.d.ts +81 -1
- package/dist/subgraphs/discovery.subgraph.js +67 -8
- package/dist/subgraphs/discovery.subgraph.js.map +1 -1
- package/dist/tools/add-node.tool.d.ts +12 -12
- package/dist/tools/add-node.tool.js +25 -30
- package/dist/tools/add-node.tool.js.map +1 -1
- package/dist/tools/best-practices/data-persistence.js +5 -0
- package/dist/tools/best-practices/data-persistence.js.map +1 -1
- package/dist/tools/best-practices/index.js +2 -1
- package/dist/tools/best-practices/index.js.map +1 -1
- package/dist/tools/best-practices/scheduling.js +41 -168
- package/dist/tools/best-practices/scheduling.js.map +1 -1
- package/dist/tools/builder-tools.d.ts +1 -10
- package/dist/tools/builder-tools.js +6 -17
- package/dist/tools/builder-tools.js.map +1 -1
- package/dist/tools/get-documentation.tool.d.ts +79 -0
- package/dist/tools/get-documentation.tool.js +164 -0
- package/dist/tools/get-documentation.tool.js.map +1 -0
- package/dist/tools/helpers/state.d.ts +1 -0
- package/dist/tools/helpers/state.js +6 -0
- package/dist/tools/helpers/state.js.map +1 -1
- package/dist/tools/node-details.tool.js +14 -3
- package/dist/tools/node-details.tool.js.map +1 -1
- package/dist/tools/rename-node.tool.d.ts +15 -0
- package/dist/tools/rename-node.tool.js +141 -0
- package/dist/tools/rename-node.tool.js.map +1 -0
- package/dist/tools/update-node-parameters.tool.d.ts +1 -1
- package/dist/tools/update-node-parameters.tool.js +131 -2
- package/dist/tools/update-node-parameters.tool.js.map +1 -1
- package/dist/tools/utils/mermaid.utils.js +12 -10
- package/dist/tools/utils/mermaid.utils.js.map +1 -1
- package/dist/tools/validate-structure.tool.js +3 -2
- package/dist/tools/validate-structure.tool.js.map +1 -1
- package/dist/types/discovery-types.d.ts +2 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +1 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/node-recommendations.d.ts +26 -0
- package/dist/types/node-recommendations.js +16 -0
- package/dist/types/node-recommendations.js.map +1 -0
- package/dist/types/tools.d.ts +5 -3
- package/dist/types/workflow.d.ts +5 -0
- package/dist/utils/context-builders.js +17 -2
- package/dist/utils/context-builders.js.map +1 -1
- package/dist/utils/operations-processor.js +37 -5
- package/dist/utils/operations-processor.js.map +1 -1
- package/dist/utils/resource-operation-extractor.d.ts +16 -0
- package/dist/utils/resource-operation-extractor.js +148 -0
- package/dist/utils/resource-operation-extractor.js.map +1 -0
- package/dist/utils/state-modifier.d.ts +3 -2
- package/dist/utils/state-modifier.js +4 -4
- package/dist/utils/state-modifier.js.map +1 -1
- package/dist/utils/stream-processor.js +1 -1
- package/dist/utils/stream-processor.js.map +1 -1
- package/dist/utils/subgraph-helpers.d.ts +1 -0
- package/dist/utils/subgraph-helpers.js +12 -0
- package/dist/utils/subgraph-helpers.js.map +1 -1
- package/dist/validation/auto-fix/auto-fix-connections.d.ts +21 -0
- package/dist/validation/auto-fix/auto-fix-connections.js +207 -0
- package/dist/validation/auto-fix/auto-fix-connections.js.map +1 -0
- package/dist/validation/auto-fix/index.d.ts +2 -0
- package/dist/validation/auto-fix/index.js +6 -0
- package/dist/validation/auto-fix/index.js.map +1 -0
- package/dist/validation/checks/connections.js +10 -0
- package/dist/validation/checks/connections.js.map +1 -1
- package/dist/validation/checks/credentials.js +6 -6
- package/dist/validation/checks/credentials.js.map +1 -1
- package/dist/validation/types.d.ts +1 -1
- package/dist/workflow-builder-agent.d.ts +14 -14
- package/dist/workflow-builder-agent.js +22 -239
- package/dist/workflow-builder-agent.js.map +1 -1
- package/dist/workflow-state.d.ts +0 -1
- package/dist/workflow-state.js +0 -17
- package/dist/workflow-state.js.map +1 -1
- package/package.json +15 -12
- package/dist/prompts/legacy-agent.prompt.d.ts +0 -6
- package/dist/prompts/legacy-agent.prompt.js +0 -587
- package/dist/prompts/legacy-agent.prompt.js.map +0 -1
- package/dist/tools/categorize-prompt.tool.d.ts +0 -5
- package/dist/tools/categorize-prompt.tool.js +0 -85
- package/dist/tools/categorize-prompt.tool.js.map +0 -1
- package/dist/tools/get-best-practices.tool.d.ts +0 -34
- package/dist/tools/get-best-practices.tool.js +0 -94
- package/dist/tools/get-best-practices.tool.js.map +0 -1
- package/dist/tools/validate-workflow.tool.d.ts +0 -5
- package/dist/tools/validate-workflow.tool.js +0 -73
- package/dist/tools/validate-workflow.tool.js.map +0 -1
- package/dist/utils/workflow-validation.d.ts +0 -2
- package/dist/utils/workflow-validation.js +0 -37
- package/dist/utils/workflow-validation.js.map +0 -1
|
@@ -9,9 +9,9 @@ class SchedulingBestPractices {
|
|
|
9
9
|
|
|
10
10
|
## Workflow Design
|
|
11
11
|
|
|
12
|
-
Structure scheduled workflows to perform focused, well-defined tasks.
|
|
12
|
+
Structure scheduled workflows to perform focused, well-defined tasks.
|
|
13
13
|
|
|
14
|
-
For recurring tasks, use Schedule Trigger node with clear naming (e.g., "Daily 08:00 Trigger", "Every 6h Cron").
|
|
14
|
+
For recurring tasks, use Schedule Trigger node with clear naming (e.g., "Daily 08:00 Trigger", "Every 6h Cron").
|
|
15
15
|
|
|
16
16
|
Prevent overlapping executions by ensuring worst-case execution time < schedule interval. For frequent schedules, implement mutex/lock mechanisms using external systems if needed.
|
|
17
17
|
|
|
@@ -29,66 +29,35 @@ Multiple schedules can be combined in single Schedule Trigger node using multipl
|
|
|
29
29
|
|
|
30
30
|
### One-Time Events
|
|
31
31
|
|
|
32
|
-
For
|
|
33
|
-
IMPORTANT: Deactivate workflow after execution to prevent yearly recurrence.
|
|
32
|
+
For event-relative scheduling, use Wait node to pause workflow until specified time/date.
|
|
34
33
|
|
|
35
|
-
|
|
34
|
+
Note: Cron expressions with specific dates (e.g., \`0 12 22 10 *\` for Oct 22 at 12:00) will repeat annually on that date.
|
|
36
35
|
|
|
37
36
|
### Conditional Scheduling
|
|
38
37
|
|
|
39
|
-
Use IF/Switch nodes after Schedule Trigger for runtime conditions:
|
|
38
|
+
PREFER conditional logic over complex cron expressions. Use IF/Switch nodes after Schedule Trigger for runtime conditions:
|
|
40
39
|
- Check if today is last day of month before running monthly reports
|
|
41
|
-
- Skip execution on holidays
|
|
42
|
-
- Route
|
|
40
|
+
- Skip execution on holidays by checking against a holiday list in a data table
|
|
41
|
+
- Route to "weekday" vs "weekend" processing based on current day
|
|
43
42
|
|
|
44
|
-
|
|
43
|
+
This approach is more readable and maintainable than complex cron patterns.
|
|
45
44
|
|
|
46
|
-
## Time Zone
|
|
45
|
+
## Time Zone Handling
|
|
47
46
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
-
|
|
52
|
-
- Set instance timezone via Admin Panel
|
|
53
|
-
- Override per-workflow as needed
|
|
54
|
-
|
|
55
|
-
Schedule Trigger uses workflow timezone if set, otherwise instance timezone. Cron schedules automatically adjust for DST when using region timezones (Europe/London, America/New_York).
|
|
56
|
-
|
|
57
|
-
WARNING: Wait node uses server system time, ignoring workflow timezone settings. Account for this when using Wait with specific clock times.
|
|
58
|
-
|
|
59
|
-
## Error Handling & Monitoring
|
|
60
|
-
|
|
61
|
-
Build robust error handling for unattended execution:
|
|
62
|
-
- Use Error Trigger for global error workflow
|
|
63
|
-
- Implement retry logic with Wait node for transient failures
|
|
64
|
-
- Add email/Slack notifications for failures
|
|
65
|
-
- Log timestamps with Console node to detect timing issues
|
|
66
|
-
|
|
67
|
-
Monitor Executions list regularly for:
|
|
68
|
-
- Expected trigger times
|
|
69
|
-
- Duplicates or gaps
|
|
70
|
-
- Failed executions
|
|
71
|
-
- Long-running workflows
|
|
47
|
+
When building scheduled workflows:
|
|
48
|
+
- If user specifies a timezone, set it in the Schedule Trigger node's timezone parameter
|
|
49
|
+
- If user mentions times without timezone, use the schedule as specified (instance default will apply)
|
|
50
|
+
- For Wait nodes, be aware they use server system time, not workflow timezone
|
|
72
51
|
|
|
73
52
|
## Recommended Nodes
|
|
74
53
|
|
|
75
54
|
### Schedule Trigger (n8n-nodes-base.scheduleTrigger)
|
|
76
55
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
Modes:
|
|
80
|
-
- Interval: Simple recurring schedules via UI
|
|
81
|
-
- Cron: Complex patterns via expressions
|
|
82
|
-
|
|
83
|
-
Best Practices:
|
|
84
|
-
- Activate workflow for schedule to work
|
|
85
|
-
- Use descriptive names including schedule
|
|
86
|
-
- Test with manual execution during development
|
|
87
|
-
- Consider DST impacts for region timezones
|
|
56
|
+
Primary node for running workflows on schedule. Supports interval mode for simple schedules and cron mode for complex patterns.
|
|
88
57
|
|
|
89
58
|
### Wait (n8n-nodes-base.wait)
|
|
90
59
|
|
|
91
|
-
|
|
60
|
+
Pause workflow execution until specified time or duration.
|
|
92
61
|
|
|
93
62
|
Use Cases:
|
|
94
63
|
- Delay actions relative to events
|
|
@@ -96,142 +65,54 @@ Use Cases:
|
|
|
96
65
|
- Follow-up actions after specific duration
|
|
97
66
|
|
|
98
67
|
Best Practices:
|
|
99
|
-
- Use
|
|
100
|
-
- Avoid
|
|
101
|
-
- Remember Wait uses server time, not workflow timezone
|
|
102
|
-
- State persists across n8n restarts
|
|
68
|
+
- Use n8n Data Tables for waits longer than 24 hours (store scheduled time, check periodically)
|
|
69
|
+
- Avoid wait times longer than 7 days - use a polling pattern instead
|
|
103
70
|
|
|
104
71
|
### IF (n8n-nodes-base.if)
|
|
105
72
|
|
|
106
|
-
|
|
73
|
+
Add conditional logic to scheduled workflows.
|
|
107
74
|
|
|
108
75
|
Use Cases:
|
|
109
|
-
- Check date conditions (last day of month)
|
|
110
|
-
- Skip execution based on external data
|
|
76
|
+
- Check date conditions (last day of month using expression: \`{{ $now.day === $now.endOf('month').day }}\`)
|
|
77
|
+
- Skip execution based on external data (e.g., holiday check)
|
|
111
78
|
- Route to different actions conditionally
|
|
112
79
|
|
|
113
80
|
Best Practices:
|
|
114
81
|
- Enable "Convert types where required" for comparisons
|
|
115
|
-
-
|
|
116
|
-
- Prefer IF nodes over complex cron expressions
|
|
82
|
+
- Prefer IF nodes over complex cron expressions for readability
|
|
117
83
|
|
|
118
84
|
### Switch (n8n-nodes-base.switch)
|
|
119
85
|
|
|
120
|
-
|
|
86
|
+
Multiple conditional branches for complex routing.
|
|
121
87
|
|
|
122
88
|
Use Cases:
|
|
123
|
-
- Different actions based on day of week
|
|
124
|
-
- Time-based routing
|
|
89
|
+
- Different actions based on day of week (e.g., \`{{ $now.weekday }}\` returns 1-7)
|
|
90
|
+
- Time-based routing (morning vs afternoon processing)
|
|
125
91
|
- Multi-path conditional execution
|
|
126
92
|
|
|
127
|
-
###
|
|
93
|
+
### n8n Data Tables (n8n-nodes-base.n8nTables)
|
|
128
94
|
|
|
129
|
-
Purpose:
|
|
95
|
+
Purpose: Store scheduling state and pending tasks
|
|
130
96
|
|
|
131
97
|
Use Cases:
|
|
132
|
-
-
|
|
133
|
-
-
|
|
134
|
-
- Implement
|
|
98
|
+
- Track last execution time for catch-up logic
|
|
99
|
+
- Store list of pending one-time tasks with scheduled times
|
|
100
|
+
- Implement custom scheduling queue with polling
|
|
135
101
|
|
|
136
102
|
Best Practices:
|
|
137
|
-
-
|
|
138
|
-
-
|
|
139
|
-
- Consider severity levels for different failures
|
|
140
|
-
|
|
141
|
-
### Execute Workflow (n8n-nodes-base.executeWorkflow)
|
|
142
|
-
|
|
143
|
-
Purpose: Call sub-workflows for modular scheduling
|
|
144
|
-
|
|
145
|
-
Use Cases:
|
|
146
|
-
- Break complex scheduled tasks into modules
|
|
147
|
-
- Reuse common scheduled operations
|
|
148
|
-
- Isolate failures to specific components
|
|
149
|
-
|
|
150
|
-
Best Practices:
|
|
151
|
-
- Pass parameters for configuration
|
|
152
|
-
- Handle sub-workflow errors appropriately
|
|
153
|
-
- Use for maintainable, focused workflows
|
|
154
|
-
|
|
155
|
-
### Database Nodes
|
|
156
|
-
|
|
157
|
-
Purpose: Check pending tasks or store execution history
|
|
158
|
-
|
|
159
|
-
- MySQL (n8n-nodes-base.mySql)
|
|
160
|
-
- Postgres (n8n-nodes-base.postgres)
|
|
161
|
-
- MongoDB (n8n-nodes-base.mongoDb)
|
|
162
|
-
|
|
163
|
-
Use Cases:
|
|
164
|
-
- Store list of pending one-time tasks
|
|
165
|
-
- Log execution history
|
|
166
|
-
- Implement custom scheduling queue
|
|
167
|
-
|
|
168
|
-
Best Practices:
|
|
169
|
-
- Query efficiently with proper indexes
|
|
170
|
-
- Clean up old execution logs periodically
|
|
171
|
-
- Use for dynamic scheduling requirements
|
|
172
|
-
|
|
173
|
-
### HTTP Request (n8n-nodes-base.httpRequest)
|
|
174
|
-
|
|
175
|
-
Purpose: Call external APIs or monitoring services
|
|
176
|
-
|
|
177
|
-
Use Cases:
|
|
178
|
-
- Send heartbeat to monitoring service
|
|
179
|
-
- Check external conditions before execution
|
|
180
|
-
- Trigger external scheduled jobs
|
|
181
|
-
|
|
182
|
-
### Email/Slack
|
|
183
|
-
|
|
184
|
-
- Email (n8n-nodes-base.emailSend)
|
|
185
|
-
- Slack (n8n-nodes-base.slack)
|
|
186
|
-
|
|
187
|
-
Purpose: Send notifications for scheduled workflow events
|
|
188
|
-
|
|
189
|
-
Use Cases:
|
|
190
|
-
- Daily report delivery
|
|
191
|
-
- Failure notifications
|
|
192
|
-
- Completion confirmations
|
|
103
|
+
- Query efficiently with proper filters
|
|
104
|
+
- Clean up completed tasks periodically
|
|
193
105
|
|
|
194
106
|
## Common Pitfalls to Avoid
|
|
195
107
|
|
|
196
|
-
### Time Zone Mismatch
|
|
197
|
-
|
|
198
|
-
**Problem**: Workflows run at wrong time due to incorrect timezone configuration. Schedule set for 08:00 runs at 07:00 or 09:00.
|
|
199
|
-
|
|
200
|
-
**Solution**:
|
|
201
|
-
- Explicitly set workflow or instance timezone
|
|
202
|
-
- Verify timezone after DST changes
|
|
203
|
-
- Use UTC for consistency if timezone complexity is problematic
|
|
204
|
-
- Remember self-hosted defaults to America/New_York
|
|
205
|
-
|
|
206
|
-
### Daylight Saving Time Issues
|
|
207
|
-
|
|
208
|
-
**Problem**: Missed or duplicate executions during DST transitions. Jobs may not run or run twice when clocks change.
|
|
209
|
-
|
|
210
|
-
**Solution**:
|
|
211
|
-
- Use region timezones for automatic DST handling
|
|
212
|
-
- Test critical schedules around DST dates
|
|
213
|
-
- Consider fixed-offset timezone for year-round consistency
|
|
214
|
-
- Update n8n version for latest timezone database
|
|
215
|
-
|
|
216
|
-
### Duplicate Trigger Executions
|
|
217
|
-
|
|
218
|
-
**Problem**: Workflows triggering multiple times at scheduled time, especially in multi-instance setups.
|
|
219
|
-
|
|
220
|
-
**Solution**:
|
|
221
|
-
- Upgrade to n8n ≥1.107.0 (fixes duplicate cron registrations)
|
|
222
|
-
- Configure N8N_MULTI_MAIN_PROCESS=true for multi-instance setups
|
|
223
|
-
- Disable and re-enable workflow if duplicates persist
|
|
224
|
-
- Restart n8n process if issues occur after editing
|
|
225
|
-
|
|
226
108
|
### Missed Schedules During Downtime
|
|
227
109
|
|
|
228
110
|
**Problem**: Scheduled runs missed when n8n instance is down. No automatic catch-up for missed triggers.
|
|
229
111
|
|
|
230
|
-
**Solution**:
|
|
231
|
-
-
|
|
232
|
-
-
|
|
233
|
-
-
|
|
234
|
-
- Implement external monitoring for uptime
|
|
112
|
+
**Solution**: Design idempotent workflows with catch-up logic:
|
|
113
|
+
- Store last successful run timestamp in n8n Data Tables
|
|
114
|
+
- On each run, check if enough time has passed since last run
|
|
115
|
+
- Example: For a task that should run once per 24 hours, schedule it every 4 hours but only execute if last run was >20 hours ago
|
|
235
116
|
|
|
236
117
|
### Overlapping Executions
|
|
237
118
|
|
|
@@ -239,9 +120,8 @@ Use Cases:
|
|
|
239
120
|
|
|
240
121
|
**Solution**:
|
|
241
122
|
- Increase interval to exceed worst-case execution time
|
|
242
|
-
- Implement mutex/lock using
|
|
123
|
+
- Implement mutex/lock using n8n Data Tables (check/set "running" flag at start, clear at end)
|
|
243
124
|
- Add execution check at workflow start
|
|
244
|
-
- Configure single worker for workflow in queue mode
|
|
245
125
|
|
|
246
126
|
### Wait Node Timezone Confusion
|
|
247
127
|
|
|
@@ -249,8 +129,7 @@ Use Cases:
|
|
|
249
129
|
|
|
250
130
|
**Solution**:
|
|
251
131
|
- Account for server timezone when setting Wait times
|
|
252
|
-
- Use
|
|
253
|
-
- Run server in target timezone if possible
|
|
132
|
+
- Use relative durations (e.g., "wait 2 hours") instead of absolute times when possible
|
|
254
133
|
- Prefer Schedule Trigger for timezone-aware scheduling
|
|
255
134
|
|
|
256
135
|
### First Execution Timing
|
|
@@ -258,20 +137,14 @@ Use Cases:
|
|
|
258
137
|
**Problem**: First execution after activation doesn't match expected schedule. Activation time affects next run calculation.
|
|
259
138
|
|
|
260
139
|
**Solution**:
|
|
261
|
-
-
|
|
262
|
-
- Use manual execution for immediate first run
|
|
140
|
+
- Use manual execution for immediate first run if needed
|
|
263
141
|
- Understand that schedule recalculates from activation moment
|
|
264
|
-
- Document expected first run time
|
|
265
142
|
|
|
266
|
-
### Cron Syntax
|
|
143
|
+
### Cron Syntax
|
|
267
144
|
|
|
268
|
-
|
|
145
|
+
n8n supports both 5-field and 6-field (with seconds) cron syntax. Use 6 fields if you want to specify seconds (e.g., prefix with 0 for seconds: \`0 0 9 * * *\` for 9 AM daily).
|
|
269
146
|
|
|
270
|
-
|
|
271
|
-
- Use crontab.guru to validate expressions
|
|
272
|
-
- Remember n8n supports 5 or 6 field syntax
|
|
273
|
-
- n8n supports both 5-field and 6-field (with seconds) cron syntax; use 6 fields if you want to specify seconds (e.g., prefix with 0 for seconds: \`0 0 * * * *\`)
|
|
274
|
-
- Use interval mode for simple schedules
|
|
147
|
+
For simple schedules, prefer Interval mode over cron for better readability.
|
|
275
148
|
`;
|
|
276
149
|
getDocumentation() {
|
|
277
150
|
return this.documentation;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scheduling.js","sourceRoot":"","sources":["../../../src/tools/best-practices/scheduling.ts"],"names":[],"mappings":";;;AACA,2DAA2D;AAE3D,MAAa,uBAAuB;IAC1B,SAAS,GAAG,kCAAiB,CAAC,UAAU,CAAC;IACzC,OAAO,GAAG,OAAO,CAAC;IAEV,aAAa,GAAG
|
|
1
|
+
{"version":3,"file":"scheduling.js","sourceRoot":"","sources":["../../../src/tools/best-practices/scheduling.ts"],"names":[],"mappings":";;;AACA,2DAA2D;AAE3D,MAAa,uBAAuB;IAC1B,SAAS,GAAG,kCAAiB,CAAC,UAAU,CAAC;IACzC,OAAO,GAAG,OAAO,CAAC;IAEV,aAAa,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4IjC,CAAC;IAED,gBAAgB;QACf,OAAO,IAAI,CAAC,aAAa,CAAC;IAC3B,CAAC;CACD;AArJD,0DAqJC"}
|
|
@@ -1,15 +1,6 @@
|
|
|
1
|
-
import type { BaseChatModel } from '@langchain/core/language_models/chat_models';
|
|
2
|
-
import type { Logger } from '@n8n/backend-common';
|
|
3
1
|
import type { INodeTypeDescription } from 'n8n-workflow';
|
|
4
|
-
import type {
|
|
2
|
+
import type { BuilderToolBase } from '../utils/stream-processor';
|
|
5
3
|
import type { BuilderFeatureFlags } from '../workflow-builder-agent';
|
|
6
|
-
export declare function getBuilderTools({ parsedNodeTypes, logger, llmComplexTask, instanceUrl, featureFlags, }: {
|
|
7
|
-
parsedNodeTypes: INodeTypeDescription[];
|
|
8
|
-
llmComplexTask: BaseChatModel;
|
|
9
|
-
logger?: Logger;
|
|
10
|
-
instanceUrl?: string;
|
|
11
|
-
featureFlags?: BuilderFeatureFlags;
|
|
12
|
-
}): BuilderTool[];
|
|
13
4
|
export declare function getBuilderToolsForDisplay({ nodeTypes, featureFlags, }: {
|
|
14
5
|
nodeTypes: INodeTypeDescription[];
|
|
15
6
|
featureFlags?: BuilderFeatureFlags;
|
|
@@ -1,36 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getBuilderTools = getBuilderTools;
|
|
4
3
|
exports.getBuilderToolsForDisplay = getBuilderToolsForDisplay;
|
|
5
4
|
const add_node_tool_1 = require("./add-node.tool");
|
|
6
|
-
const categorize_prompt_tool_1 = require("./categorize-prompt.tool");
|
|
7
5
|
const connect_nodes_tool_1 = require("./connect-nodes.tool");
|
|
8
|
-
const
|
|
6
|
+
const get_documentation_tool_1 = require("./get-documentation.tool");
|
|
9
7
|
const get_node_parameter_tool_1 = require("./get-node-parameter.tool");
|
|
10
8
|
const get_workflow_examples_tool_1 = require("./get-workflow-examples.tool");
|
|
11
9
|
const node_details_tool_1 = require("./node-details.tool");
|
|
12
10
|
const node_search_tool_1 = require("./node-search.tool");
|
|
13
11
|
const remove_connection_tool_1 = require("./remove-connection.tool");
|
|
14
12
|
const remove_node_tool_1 = require("./remove-node.tool");
|
|
13
|
+
const rename_node_tool_1 = require("./rename-node.tool");
|
|
15
14
|
const update_node_parameters_tool_1 = require("./update-node-parameters.tool");
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
const tools = [
|
|
19
|
-
(0, categorize_prompt_tool_1.createCategorizePromptTool)(llmComplexTask, logger),
|
|
20
|
-
(0, get_best_practices_tool_1.createGetBestPracticesTool)(),
|
|
21
|
-
];
|
|
22
|
-
if (featureFlags?.templateExamples === true) {
|
|
23
|
-
tools.push((0, get_workflow_examples_tool_1.createGetWorkflowExamplesTool)(logger));
|
|
24
|
-
}
|
|
25
|
-
tools.push((0, node_search_tool_1.createNodeSearchTool)(parsedNodeTypes), (0, node_details_tool_1.createNodeDetailsTool)(parsedNodeTypes, logger), (0, add_node_tool_1.createAddNodeTool)(parsedNodeTypes), (0, connect_nodes_tool_1.createConnectNodesTool)(parsedNodeTypes, logger), (0, remove_connection_tool_1.createRemoveConnectionTool)(logger), (0, remove_node_tool_1.createRemoveNodeTool)(logger), (0, update_node_parameters_tool_1.createUpdateNodeParametersTool)(parsedNodeTypes, llmComplexTask, logger, instanceUrl), (0, get_node_parameter_tool_1.createGetNodeParameterTool)(), (0, validate_workflow_tool_1.createValidateWorkflowTool)(parsedNodeTypes, logger));
|
|
26
|
-
return tools;
|
|
27
|
-
}
|
|
15
|
+
const validate_configuration_tool_1 = require("./validate-configuration.tool");
|
|
16
|
+
const validate_structure_tool_1 = require("./validate-structure.tool");
|
|
28
17
|
function getBuilderToolsForDisplay({ nodeTypes, featureFlags, }) {
|
|
29
|
-
const tools = [
|
|
18
|
+
const tools = [get_documentation_tool_1.GET_DOCUMENTATION_TOOL];
|
|
30
19
|
if (featureFlags?.templateExamples === true) {
|
|
31
20
|
tools.push(get_workflow_examples_tool_1.GET_WORKFLOW_EXAMPLES_TOOL);
|
|
32
21
|
}
|
|
33
|
-
tools.push(node_search_tool_1.NODE_SEARCH_TOOL, node_details_tool_1.NODE_DETAILS_TOOL, (0, add_node_tool_1.getAddNodeToolBase)(nodeTypes), connect_nodes_tool_1.CONNECT_NODES_TOOL, remove_connection_tool_1.REMOVE_CONNECTION_TOOL, remove_node_tool_1.REMOVE_NODE_TOOL, update_node_parameters_tool_1.UPDATING_NODE_PARAMETER_TOOL, get_node_parameter_tool_1.GET_NODE_PARAMETER_TOOL,
|
|
22
|
+
tools.push(node_search_tool_1.NODE_SEARCH_TOOL, node_details_tool_1.NODE_DETAILS_TOOL, (0, add_node_tool_1.getAddNodeToolBase)(nodeTypes), connect_nodes_tool_1.CONNECT_NODES_TOOL, remove_connection_tool_1.REMOVE_CONNECTION_TOOL, remove_node_tool_1.REMOVE_NODE_TOOL, rename_node_tool_1.RENAME_NODE_TOOL, update_node_parameters_tool_1.UPDATING_NODE_PARAMETER_TOOL, get_node_parameter_tool_1.GET_NODE_PARAMETER_TOOL, validate_structure_tool_1.VALIDATE_STRUCTURE_TOOL, validate_configuration_tool_1.VALIDATE_CONFIGURATION_TOOL);
|
|
34
23
|
return tools;
|
|
35
24
|
}
|
|
36
25
|
//# sourceMappingURL=builder-tools.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builder-tools.js","sourceRoot":"","sources":["../../src/tools/builder-tools.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"builder-tools.js","sourceRoot":"","sources":["../../src/tools/builder-tools.ts"],"names":[],"mappings":";;AAwBA,8DA+BC;AAlDD,mDAAqD;AACrD,6DAA0D;AAC1D,qEAAkE;AAClE,uEAAoE;AACpE,6EAA0E;AAC1E,2DAAwD;AACxD,yDAAsD;AACtD,qEAAkE;AAClE,yDAAsD;AACtD,yDAAsD;AACtD,+EAA6E;AAC7E,+EAA4E;AAC5E,uEAAoE;AAOpE,SAAgB,yBAAyB,CAAC,EACzC,SAAS,EACT,YAAY,GAIZ;IACA,MAAM,KAAK,GAAsB,CAAC,+CAAsB,CAAC,CAAC;IAI1D,IAAI,YAAY,EAAE,gBAAgB,KAAK,IAAI,EAAE,CAAC;QAC7C,KAAK,CAAC,IAAI,CAAC,uDAA0B,CAAC,CAAC;IACxC,CAAC;IAGD,KAAK,CAAC,IAAI,CACT,mCAAgB,EAChB,qCAAiB,EACjB,IAAA,kCAAkB,EAAC,SAAS,CAAC,EAC7B,uCAAkB,EAClB,+CAAsB,EACtB,mCAAgB,EAChB,mCAAgB,EAChB,0DAA4B,EAC5B,iDAAuB,EACvB,iDAAuB,EACvB,yDAA2B,CAC3B,CAAC;IAEF,OAAO,KAAK,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { BuilderToolBase } from '../utils/stream-processor';
|
|
3
|
+
export declare const DocumentationType: {
|
|
4
|
+
readonly BEST_PRACTICES: "best_practices";
|
|
5
|
+
readonly NODE_RECOMMENDATIONS: "node_recommendations";
|
|
6
|
+
};
|
|
7
|
+
export declare const GET_DOCUMENTATION_TOOL: BuilderToolBase;
|
|
8
|
+
export declare function createGetDocumentationTool(): {
|
|
9
|
+
toolName: string;
|
|
10
|
+
displayTitle: string;
|
|
11
|
+
getCustomDisplayTitle?: (values: Record<string, unknown>) => string;
|
|
12
|
+
tool: import("@langchain/core/tools").DynamicStructuredTool<z.ZodObject<{
|
|
13
|
+
requests: z.ZodArray<z.ZodUnion<[z.ZodObject<{
|
|
14
|
+
type: z.ZodLiteral<"best_practices">;
|
|
15
|
+
techniques: z.ZodArray<z.ZodNativeEnum<{
|
|
16
|
+
readonly SCHEDULING: "scheduling";
|
|
17
|
+
readonly CHATBOT: "chatbot";
|
|
18
|
+
readonly FORM_INPUT: "form_input";
|
|
19
|
+
readonly SCRAPING_AND_RESEARCH: "scraping_and_research";
|
|
20
|
+
readonly MONITORING: "monitoring";
|
|
21
|
+
readonly ENRICHMENT: "enrichment";
|
|
22
|
+
readonly TRIAGE: "triage";
|
|
23
|
+
readonly CONTENT_GENERATION: "content_generation";
|
|
24
|
+
readonly DOCUMENT_PROCESSING: "document_processing";
|
|
25
|
+
readonly DATA_EXTRACTION: "data_extraction";
|
|
26
|
+
readonly DATA_ANALYSIS: "data_analysis";
|
|
27
|
+
readonly DATA_TRANSFORMATION: "data_transformation";
|
|
28
|
+
readonly DATA_PERSISTENCE: "data_persistence";
|
|
29
|
+
readonly NOTIFICATION: "notification";
|
|
30
|
+
readonly KNOWLEDGE_BASE: "knowledge_base";
|
|
31
|
+
readonly HUMAN_IN_THE_LOOP: "human_in_the_loop";
|
|
32
|
+
}>, "many">;
|
|
33
|
+
}, "strip", z.ZodTypeAny, {
|
|
34
|
+
type: "best_practices";
|
|
35
|
+
techniques: ("scheduling" | "chatbot" | "form_input" | "scraping_and_research" | "monitoring" | "enrichment" | "triage" | "content_generation" | "document_processing" | "data_extraction" | "data_analysis" | "data_transformation" | "data_persistence" | "notification" | "knowledge_base" | "human_in_the_loop")[];
|
|
36
|
+
}, {
|
|
37
|
+
type: "best_practices";
|
|
38
|
+
techniques: ("scheduling" | "chatbot" | "form_input" | "scraping_and_research" | "monitoring" | "enrichment" | "triage" | "content_generation" | "document_processing" | "data_extraction" | "data_analysis" | "data_transformation" | "data_persistence" | "notification" | "knowledge_base" | "human_in_the_loop")[];
|
|
39
|
+
}>, z.ZodObject<{
|
|
40
|
+
type: z.ZodLiteral<"node_recommendations">;
|
|
41
|
+
categories: z.ZodArray<z.ZodNativeEnum<{
|
|
42
|
+
readonly TEXT_MANIPULATION: "text_manipulation";
|
|
43
|
+
readonly IMAGE_GENERATION: "image_generation";
|
|
44
|
+
readonly VIDEO_GENERATION: "video_generation";
|
|
45
|
+
readonly AUDIO_GENERATION: "audio_generation";
|
|
46
|
+
}>, "many">;
|
|
47
|
+
}, "strip", z.ZodTypeAny, {
|
|
48
|
+
type: "node_recommendations";
|
|
49
|
+
categories: ("image_generation" | "text_manipulation" | "video_generation" | "audio_generation")[];
|
|
50
|
+
}, {
|
|
51
|
+
type: "node_recommendations";
|
|
52
|
+
categories: ("image_generation" | "text_manipulation" | "video_generation" | "audio_generation")[];
|
|
53
|
+
}>]>, "many">;
|
|
54
|
+
}, "strip", z.ZodTypeAny, {
|
|
55
|
+
requests: ({
|
|
56
|
+
type: "best_practices";
|
|
57
|
+
techniques: ("scheduling" | "chatbot" | "form_input" | "scraping_and_research" | "monitoring" | "enrichment" | "triage" | "content_generation" | "document_processing" | "data_extraction" | "data_analysis" | "data_transformation" | "data_persistence" | "notification" | "knowledge_base" | "human_in_the_loop")[];
|
|
58
|
+
} | {
|
|
59
|
+
type: "node_recommendations";
|
|
60
|
+
categories: ("image_generation" | "text_manipulation" | "video_generation" | "audio_generation")[];
|
|
61
|
+
})[];
|
|
62
|
+
}, {
|
|
63
|
+
requests: ({
|
|
64
|
+
type: "best_practices";
|
|
65
|
+
techniques: ("scheduling" | "chatbot" | "form_input" | "scraping_and_research" | "monitoring" | "enrichment" | "triage" | "content_generation" | "document_processing" | "data_extraction" | "data_analysis" | "data_transformation" | "data_persistence" | "notification" | "knowledge_base" | "human_in_the_loop")[];
|
|
66
|
+
} | {
|
|
67
|
+
type: "node_recommendations";
|
|
68
|
+
categories: ("image_generation" | "text_manipulation" | "video_generation" | "audio_generation")[];
|
|
69
|
+
})[];
|
|
70
|
+
}>, unknown, {
|
|
71
|
+
requests: ({
|
|
72
|
+
type: "best_practices";
|
|
73
|
+
techniques: ("scheduling" | "chatbot" | "form_input" | "scraping_and_research" | "monitoring" | "enrichment" | "triage" | "content_generation" | "document_processing" | "data_extraction" | "data_analysis" | "data_transformation" | "data_persistence" | "notification" | "knowledge_base" | "human_in_the_loop")[];
|
|
74
|
+
} | {
|
|
75
|
+
type: "node_recommendations";
|
|
76
|
+
categories: ("image_generation" | "text_manipulation" | "video_generation" | "audio_generation")[];
|
|
77
|
+
})[];
|
|
78
|
+
}, import("@langchain/langgraph").Command<unknown, Record<string, unknown>, string>>;
|
|
79
|
+
};
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GET_DOCUMENTATION_TOOL = exports.DocumentationType = void 0;
|
|
4
|
+
exports.createGetDocumentationTool = createGetDocumentationTool;
|
|
5
|
+
const tools_1 = require("@langchain/core/tools");
|
|
6
|
+
const zod_1 = require("zod");
|
|
7
|
+
const errors_1 = require("../errors");
|
|
8
|
+
const builder_1 = require("../prompts/builder");
|
|
9
|
+
const node_recommendations_1 = require("../prompts/shared/node-recommendations");
|
|
10
|
+
const best_practices_1 = require("../tools/best-practices");
|
|
11
|
+
const progress_1 = require("../tools/helpers/progress");
|
|
12
|
+
const response_1 = require("../tools/helpers/response");
|
|
13
|
+
const categorization_1 = require("../types/categorization");
|
|
14
|
+
const node_recommendations_2 = require("../types/node-recommendations");
|
|
15
|
+
exports.DocumentationType = {
|
|
16
|
+
BEST_PRACTICES: 'best_practices',
|
|
17
|
+
NODE_RECOMMENDATIONS: 'node_recommendations',
|
|
18
|
+
};
|
|
19
|
+
const bestPracticesRequestSchema = zod_1.z.object({
|
|
20
|
+
type: zod_1.z.literal(exports.DocumentationType.BEST_PRACTICES),
|
|
21
|
+
techniques: zod_1.z
|
|
22
|
+
.array(zod_1.z.nativeEnum(categorization_1.WorkflowTechnique))
|
|
23
|
+
.min(1)
|
|
24
|
+
.describe('Workflow techniques to get best practices for'),
|
|
25
|
+
});
|
|
26
|
+
const nodeRecommendationsRequestSchema = zod_1.z.object({
|
|
27
|
+
type: zod_1.z.literal(exports.DocumentationType.NODE_RECOMMENDATIONS),
|
|
28
|
+
categories: zod_1.z
|
|
29
|
+
.array(zod_1.z.nativeEnum(node_recommendations_2.RecommendationCategory))
|
|
30
|
+
.min(1)
|
|
31
|
+
.describe('Task categories to get node recommendations for'),
|
|
32
|
+
});
|
|
33
|
+
const getDocumentationSchema = zod_1.z.object({
|
|
34
|
+
requests: zod_1.z
|
|
35
|
+
.array(zod_1.z.union([bestPracticesRequestSchema, nodeRecommendationsRequestSchema]))
|
|
36
|
+
.min(1)
|
|
37
|
+
.describe('Array of documentation requests to retrieve'),
|
|
38
|
+
});
|
|
39
|
+
function formatBestPractices(techniques) {
|
|
40
|
+
const foundDocs = [];
|
|
41
|
+
for (const technique of techniques) {
|
|
42
|
+
const doc = best_practices_1.documentation[technique];
|
|
43
|
+
if (doc) {
|
|
44
|
+
foundDocs.push(doc.getDocumentation());
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
if (foundDocs.length === 0) {
|
|
48
|
+
return '';
|
|
49
|
+
}
|
|
50
|
+
return (0, builder_1.prompt)().section('best_practices', foundDocs.join('\n---\n')).build();
|
|
51
|
+
}
|
|
52
|
+
function formatCategory(category, content) {
|
|
53
|
+
return (0, builder_1.prompt)().section(category, content).build();
|
|
54
|
+
}
|
|
55
|
+
function formatNodeRecommendations(categories) {
|
|
56
|
+
const foundRecs = [];
|
|
57
|
+
for (const category of categories) {
|
|
58
|
+
const rec = node_recommendations_1.recommendations[category];
|
|
59
|
+
if (rec) {
|
|
60
|
+
foundRecs.push(formatCategory(category, (0, node_recommendations_1.formatRecommendation)(rec.recommendation)));
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
if (foundRecs.length === 0) {
|
|
64
|
+
return '';
|
|
65
|
+
}
|
|
66
|
+
return (0, builder_1.prompt)().section('node_recommendations', foundRecs.join('\n')).build();
|
|
67
|
+
}
|
|
68
|
+
exports.GET_DOCUMENTATION_TOOL = {
|
|
69
|
+
toolName: 'get_documentation',
|
|
70
|
+
displayTitle: 'Getting documentation',
|
|
71
|
+
};
|
|
72
|
+
function createGetDocumentationTool() {
|
|
73
|
+
const dynamicTool = (0, tools_1.tool)((input, config) => {
|
|
74
|
+
const reporter = (0, progress_1.createProgressReporter)(config, exports.GET_DOCUMENTATION_TOOL.toolName, exports.GET_DOCUMENTATION_TOOL.displayTitle);
|
|
75
|
+
try {
|
|
76
|
+
const validatedInput = getDocumentationSchema.parse(input);
|
|
77
|
+
const { requests } = validatedInput;
|
|
78
|
+
reporter.start(validatedInput);
|
|
79
|
+
reporter.progress(`Processing ${requests.length} documentation request(s)...`);
|
|
80
|
+
const results = [];
|
|
81
|
+
let bestPracticesContent;
|
|
82
|
+
const allTechniques = [];
|
|
83
|
+
for (const request of requests) {
|
|
84
|
+
if (request.type === exports.DocumentationType.BEST_PRACTICES) {
|
|
85
|
+
const { techniques } = request;
|
|
86
|
+
const availableDocs = techniques.filter((t) => best_practices_1.documentation[t]);
|
|
87
|
+
if (availableDocs.length > 0) {
|
|
88
|
+
const content = formatBestPractices(techniques);
|
|
89
|
+
results.push(content);
|
|
90
|
+
bestPracticesContent = content;
|
|
91
|
+
allTechniques.push(...techniques);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
const { categories } = request;
|
|
96
|
+
const availableRecs = categories.filter((c) => node_recommendations_1.recommendations[c]);
|
|
97
|
+
if (availableRecs.length > 0) {
|
|
98
|
+
results.push(formatNodeRecommendations(categories));
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
if (results.length === 0) {
|
|
103
|
+
const message = 'No documentation available for the requested items.';
|
|
104
|
+
reporter.complete({ requests: requests.length, found: 0 });
|
|
105
|
+
return (0, response_1.createSuccessResponse)(config, message);
|
|
106
|
+
}
|
|
107
|
+
const message = results.join('\n\n');
|
|
108
|
+
reporter.complete({ requests: requests.length, found: results.length });
|
|
109
|
+
const stateUpdates = {};
|
|
110
|
+
if (bestPracticesContent) {
|
|
111
|
+
stateUpdates.bestPractices = bestPracticesContent;
|
|
112
|
+
stateUpdates.techniqueCategories = allTechniques;
|
|
113
|
+
}
|
|
114
|
+
return (0, response_1.createSuccessResponse)(config, message, Object.keys(stateUpdates).length > 0 ? stateUpdates : undefined);
|
|
115
|
+
}
|
|
116
|
+
catch (error) {
|
|
117
|
+
if (error instanceof zod_1.z.ZodError) {
|
|
118
|
+
const validationError = new errors_1.ValidationError('Invalid input parameters', {
|
|
119
|
+
extra: { errors: error.errors },
|
|
120
|
+
});
|
|
121
|
+
reporter.error(validationError);
|
|
122
|
+
return (0, response_1.createErrorResponse)(config, validationError);
|
|
123
|
+
}
|
|
124
|
+
const toolError = new errors_1.ToolExecutionError(error instanceof Error ? error.message : 'Unknown error occurred', {
|
|
125
|
+
toolName: exports.GET_DOCUMENTATION_TOOL.toolName,
|
|
126
|
+
cause: error instanceof Error ? error : undefined,
|
|
127
|
+
});
|
|
128
|
+
reporter.error(toolError);
|
|
129
|
+
return (0, response_1.createErrorResponse)(config, toolError);
|
|
130
|
+
}
|
|
131
|
+
}, {
|
|
132
|
+
name: exports.GET_DOCUMENTATION_TOOL.toolName,
|
|
133
|
+
description: `Retrieve documentation to guide workflow building.
|
|
134
|
+
|
|
135
|
+
TYPE: best_practices
|
|
136
|
+
Use when you need guidance on workflow patterns and implementation.
|
|
137
|
+
Requires: techniques array (workflow techniques to get practices for)
|
|
138
|
+
Returns: Best practices including recommended nodes, common pitfalls, performance tips.
|
|
139
|
+
|
|
140
|
+
TYPE: node_recommendations
|
|
141
|
+
Use when user wants AI capabilities but doesn't specify exact nodes/providers.
|
|
142
|
+
Requires: categories array (task categories to get recommendations for)
|
|
143
|
+
Returns: Default node recommendations with alternatives.
|
|
144
|
+
|
|
145
|
+
Do NOT use node_recommendations when:
|
|
146
|
+
- User explicitly names a provider (e.g., "use Claude", "with OpenAI", "using Gemini")
|
|
147
|
+
- User specifies exact node names
|
|
148
|
+
|
|
149
|
+
Available techniques for best_practices:
|
|
150
|
+
- trigger, loop, branch, subroutine, pagination, parallel_execution, error_handling, scheduling, rate_limiting, batch_processing, ai_agent, ai_chain, rag, data_transformation, http_request
|
|
151
|
+
|
|
152
|
+
Available categories for node_recommendations:
|
|
153
|
+
- text_manipulation: summarization, analysis, extraction, classification, chat
|
|
154
|
+
- image_generation: generate, analyze, edit images
|
|
155
|
+
- video_generation: create videos from text/images
|
|
156
|
+
- audio_generation: text-to-speech, transcription, translation`,
|
|
157
|
+
schema: getDocumentationSchema,
|
|
158
|
+
});
|
|
159
|
+
return {
|
|
160
|
+
tool: dynamicTool,
|
|
161
|
+
...exports.GET_DOCUMENTATION_TOOL,
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
//# sourceMappingURL=get-documentation.tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-documentation.tool.js","sourceRoot":"","sources":["../../src/tools/get-documentation.tool.ts"],"names":[],"mappings":";;;AAgHA,gEAqHC;AArOD,iDAA6C;AAC7C,6BAAwB;AAExB,qCAA+D;AAC/D,+CAA2C;AAC3C,gFAA8F;AAC9F,2DAAuD;AACvD,uDAAkE;AAClE,uDAAsF;AACtF,2DAAuF;AACvF,uEAGsC;AAMzB,QAAA,iBAAiB,GAAG;IAChC,cAAc,EAAE,gBAAgB;IAChC,oBAAoB,EAAE,sBAAsB;CACnC,CAAC;AAKX,MAAM,0BAA0B,GAAG,OAAC,CAAC,MAAM,CAAC;IAC3C,IAAI,EAAE,OAAC,CAAC,OAAO,CAAC,yBAAiB,CAAC,cAAc,CAAC;IACjD,UAAU,EAAE,OAAC;SACX,KAAK,CAAC,OAAC,CAAC,UAA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,CAAC,CAAC,SAAS;aACjD,CACD,CAAC;YACF,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;YAC1B,OAAO,IAAA,8BAAmB,EAAC,MAAM,EAAE,SAAS,CAAC,CAAC;QAC/C,CAAC;IACF,CAAC,EACD;QACC,IAAI,EAAE,8BAAsB,CAAC,QAAQ;QACrC,WAAW,EAAE;;;;;;;;;;;;;;;;;;;;;;;+DAuB+C;QAC5D,MAAM,EAAE,sBAAsB;KAC9B,CACD,CAAC;IAEF,OAAO;QACN,IAAI,EAAE,WAAW;QACjB,GAAG,8BAAsB;KACzB,CAAC;AACH,CAAC"}
|
|
@@ -12,3 +12,4 @@ export declare function removeNodesFromWorkflow(nodeIds: string[]): Partial<type
|
|
|
12
12
|
export declare function updateNodeInWorkflow(state: typeof WorkflowState.State, nodeId: string, updates: Partial<INode>): Partial<typeof WorkflowState.State>;
|
|
13
13
|
export declare function addConnectionToWorkflow(sourceNodeId: string, _targetNodeId: string, connection: IConnection): Partial<typeof WorkflowState.State>;
|
|
14
14
|
export declare function removeConnectionFromWorkflow(sourceNode: string, targetNode: string, connectionType: string, sourceOutputIndex: number, targetInputIndex: number): Partial<typeof WorkflowState.State>;
|
|
15
|
+
export declare function renameNodeInWorkflow(nodeId: string, oldName: string, newName: string): Partial<typeof WorkflowState.State>;
|