@n8n/workflow-sdk 0.9.0 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/build.tsbuildinfo +1 -1
- package/dist/generate-types/generate-types.js +1 -1
- package/dist/generate-types/generate-types.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/prompts/best-practices/guides/chatbot.d.ts +7 -0
- package/dist/prompts/best-practices/guides/chatbot.js +120 -0
- package/dist/prompts/best-practices/guides/chatbot.js.map +1 -0
- package/dist/prompts/best-practices/guides/content-generation.d.ts +7 -0
- package/dist/prompts/best-practices/guides/content-generation.js +117 -0
- package/dist/prompts/best-practices/guides/content-generation.js.map +1 -0
- package/dist/prompts/best-practices/guides/data-analysis.d.ts +7 -0
- package/dist/prompts/best-practices/guides/data-analysis.js +369 -0
- package/dist/prompts/best-practices/guides/data-analysis.js.map +1 -0
- package/dist/prompts/best-practices/guides/data-extraction.d.ts +7 -0
- package/dist/prompts/best-practices/guides/data-extraction.js +124 -0
- package/dist/prompts/best-practices/guides/data-extraction.js.map +1 -0
- package/dist/prompts/best-practices/guides/data-persistence.d.ts +7 -0
- package/dist/prompts/best-practices/guides/data-persistence.js +199 -0
- package/dist/prompts/best-practices/guides/data-persistence.js.map +1 -0
- package/dist/prompts/best-practices/guides/data-transformation.d.ts +7 -0
- package/dist/prompts/best-practices/guides/data-transformation.js +148 -0
- package/dist/prompts/best-practices/guides/data-transformation.js.map +1 -0
- package/dist/prompts/best-practices/guides/document-processing.d.ts +7 -0
- package/dist/prompts/best-practices/guides/document-processing.js +334 -0
- package/dist/prompts/best-practices/guides/document-processing.js.map +1 -0
- package/dist/prompts/best-practices/guides/enrichment.d.ts +7 -0
- package/dist/prompts/best-practices/guides/enrichment.js +273 -0
- package/dist/prompts/best-practices/guides/enrichment.js.map +1 -0
- package/dist/prompts/best-practices/guides/form-input.d.ts +7 -0
- package/dist/prompts/best-practices/guides/form-input.js +175 -0
- package/dist/prompts/best-practices/guides/form-input.js.map +1 -0
- package/dist/prompts/best-practices/guides/human-in-the-loop.d.ts +7 -0
- package/dist/prompts/best-practices/guides/human-in-the-loop.js +270 -0
- package/dist/prompts/best-practices/guides/human-in-the-loop.js.map +1 -0
- package/dist/prompts/best-practices/guides/knowledge-base.d.ts +7 -0
- package/dist/prompts/best-practices/guides/knowledge-base.js +270 -0
- package/dist/prompts/best-practices/guides/knowledge-base.js.map +1 -0
- package/dist/prompts/best-practices/guides/monitoring.d.ts +7 -0
- package/dist/prompts/best-practices/guides/monitoring.js +173 -0
- package/dist/prompts/best-practices/guides/monitoring.js.map +1 -0
- package/dist/prompts/best-practices/guides/notification.d.ts +7 -0
- package/dist/prompts/best-practices/guides/notification.js +137 -0
- package/dist/prompts/best-practices/guides/notification.js.map +1 -0
- package/dist/prompts/best-practices/guides/scheduling.d.ts +7 -0
- package/dist/prompts/best-practices/guides/scheduling.js +154 -0
- package/dist/prompts/best-practices/guides/scheduling.js.map +1 -0
- package/dist/prompts/best-practices/guides/scraping-and-research.d.ts +7 -0
- package/dist/prompts/best-practices/guides/scraping-and-research.js +160 -0
- package/dist/prompts/best-practices/guides/scraping-and-research.js.map +1 -0
- package/dist/prompts/best-practices/guides/triage.d.ts +7 -0
- package/dist/prompts/best-practices/guides/triage.js +151 -0
- package/dist/prompts/best-practices/guides/triage.js.map +1 -0
- package/dist/prompts/best-practices/index.d.ts +20 -0
- package/dist/prompts/best-practices/index.js +69 -0
- package/dist/prompts/best-practices/index.js.map +1 -0
- package/dist/prompts/best-practices/types.d.ts +25 -0
- package/dist/prompts/best-practices/types.js +40 -0
- package/dist/prompts/best-practices/types.js.map +1 -0
- package/dist/prompts/index.d.ts +3 -0
- package/dist/prompts/index.js +25 -0
- package/dist/prompts/index.js.map +1 -0
- package/dist/prompts/node-guidance/index.d.ts +3 -0
- package/dist/prompts/node-guidance/index.js +20 -0
- package/dist/prompts/node-guidance/index.js.map +1 -0
- package/dist/prompts/node-guidance/node-recommendations/audio-generation.d.ts +2 -0
- package/dist/prompts/node-guidance/node-recommendations/audio-generation.js +18 -0
- package/dist/prompts/node-guidance/node-recommendations/audio-generation.js.map +1 -0
- package/dist/prompts/node-guidance/node-recommendations/format-recommendation.d.ts +2 -0
- package/dist/prompts/node-guidance/node-recommendations/format-recommendation.js +27 -0
- package/dist/prompts/node-guidance/node-recommendations/format-recommendation.js.map +1 -0
- package/dist/prompts/node-guidance/node-recommendations/image-generation.d.ts +2 -0
- package/dist/prompts/node-guidance/node-recommendations/image-generation.js +18 -0
- package/dist/prompts/node-guidance/node-recommendations/image-generation.js.map +1 -0
- package/dist/prompts/node-guidance/node-recommendations/index.d.ts +6 -0
- package/dist/prompts/node-guidance/node-recommendations/index.js +17 -0
- package/dist/prompts/node-guidance/node-recommendations/index.js.map +1 -0
- package/dist/prompts/node-guidance/node-recommendations/text-manipulation.d.ts +2 -0
- package/dist/prompts/node-guidance/node-recommendations/text-manipulation.js +27 -0
- package/dist/prompts/node-guidance/node-recommendations/text-manipulation.js.map +1 -0
- package/dist/prompts/node-guidance/node-recommendations/types.d.ts +26 -0
- package/dist/prompts/node-guidance/node-recommendations/types.js +16 -0
- package/dist/prompts/node-guidance/node-recommendations/types.js.map +1 -0
- package/dist/prompts/node-guidance/node-recommendations/video-generation.d.ts +2 -0
- package/dist/prompts/node-guidance/node-recommendations/video-generation.js +15 -0
- package/dist/prompts/node-guidance/node-recommendations/video-generation.js.map +1 -0
- package/dist/prompts/node-guidance/node-tips/index.d.ts +3 -0
- package/dist/prompts/node-guidance/node-tips/index.js +8 -0
- package/dist/prompts/node-guidance/node-tips/index.js.map +1 -0
- package/dist/prompts/node-guidance/node-tips/structured-output-parser.d.ts +2 -0
- package/dist/prompts/node-guidance/node-tips/structured-output-parser.js +35 -0
- package/dist/prompts/node-guidance/node-tips/structured-output-parser.js.map +1 -0
- package/dist/prompts/node-guidance/node-tips/types.d.ts +7 -0
- package/dist/prompts/node-guidance/node-tips/types.js +3 -0
- package/dist/prompts/node-guidance/node-tips/types.js.map +1 -0
- package/dist/prompts/node-guidance/node-tips/webhook.d.ts +2 -0
- package/dist/prompts/node-guidance/node-tips/webhook.js +38 -0
- package/dist/prompts/node-guidance/node-tips/webhook.js.map +1 -0
- package/dist/prompts/node-guidance/parameter-guides/embedding-nodes.d.ts +2 -0
- package/dist/prompts/node-guidance/parameter-guides/embedding-nodes.js +70 -0
- package/dist/prompts/node-guidance/parameter-guides/embedding-nodes.js.map +1 -0
- package/dist/prompts/node-guidance/parameter-guides/gmail.d.ts +2 -0
- package/dist/prompts/node-guidance/parameter-guides/gmail.js +53 -0
- package/dist/prompts/node-guidance/parameter-guides/gmail.js.map +1 -0
- package/dist/prompts/node-guidance/parameter-guides/http-request.d.ts +2 -0
- package/dist/prompts/node-guidance/parameter-guides/http-request.js +139 -0
- package/dist/prompts/node-guidance/parameter-guides/http-request.js.map +1 -0
- package/dist/prompts/node-guidance/parameter-guides/if-node.d.ts +2 -0
- package/dist/prompts/node-guidance/parameter-guides/if-node.js +159 -0
- package/dist/prompts/node-guidance/parameter-guides/if-node.js.map +1 -0
- package/dist/prompts/node-guidance/parameter-guides/index.d.ts +12 -0
- package/dist/prompts/node-guidance/parameter-guides/index.js +26 -0
- package/dist/prompts/node-guidance/parameter-guides/index.js.map +1 -0
- package/dist/prompts/node-guidance/parameter-guides/predecessor-output.d.ts +2 -0
- package/dist/prompts/node-guidance/parameter-guides/predecessor-output.js +25 -0
- package/dist/prompts/node-guidance/parameter-guides/predecessor-output.js.map +1 -0
- package/dist/prompts/node-guidance/parameter-guides/resource-locator.d.ts +2 -0
- package/dist/prompts/node-guidance/parameter-guides/resource-locator.js +40 -0
- package/dist/prompts/node-guidance/parameter-guides/resource-locator.js.map +1 -0
- package/dist/prompts/node-guidance/parameter-guides/set-node.d.ts +2 -0
- package/dist/prompts/node-guidance/parameter-guides/set-node.js +94 -0
- package/dist/prompts/node-guidance/parameter-guides/set-node.js.map +1 -0
- package/dist/prompts/node-guidance/parameter-guides/switch-node.d.ts +2 -0
- package/dist/prompts/node-guidance/parameter-guides/switch-node.js +75 -0
- package/dist/prompts/node-guidance/parameter-guides/switch-node.js.map +1 -0
- package/dist/prompts/node-guidance/parameter-guides/system-message.d.ts +2 -0
- package/dist/prompts/node-guidance/parameter-guides/system-message.js +96 -0
- package/dist/prompts/node-guidance/parameter-guides/system-message.js.map +1 -0
- package/dist/prompts/node-guidance/parameter-guides/text-fields.d.ts +2 -0
- package/dist/prompts/node-guidance/parameter-guides/text-fields.js +31 -0
- package/dist/prompts/node-guidance/parameter-guides/text-fields.js.map +1 -0
- package/dist/prompts/node-guidance/parameter-guides/tool-nodes.d.ts +2 -0
- package/dist/prompts/node-guidance/parameter-guides/tool-nodes.js +76 -0
- package/dist/prompts/node-guidance/parameter-guides/tool-nodes.js.map +1 -0
- package/dist/prompts/node-guidance/parameter-guides/types.d.ts +18 -0
- package/dist/prompts/node-guidance/parameter-guides/types.js +3 -0
- package/dist/prompts/node-guidance/parameter-guides/types.js.map +1 -0
- package/dist/prompts/node-selection/ai-nodes.d.ts +2 -0
- package/dist/prompts/node-selection/ai-nodes.js +35 -0
- package/dist/prompts/node-selection/ai-nodes.js.map +1 -0
- package/dist/prompts/node-selection/connection-parameters.d.ts +1 -0
- package/dist/prompts/node-selection/connection-parameters.js +13 -0
- package/dist/prompts/node-selection/connection-parameters.js.map +1 -0
- package/dist/prompts/node-selection/index.d.ts +5 -0
- package/dist/prompts/node-selection/index.js +16 -0
- package/dist/prompts/node-selection/index.js.map +1 -0
- package/dist/prompts/node-selection/native-preference.d.ts +1 -0
- package/dist/prompts/node-selection/native-preference.js +18 -0
- package/dist/prompts/node-selection/native-preference.js.map +1 -0
- package/dist/prompts/node-selection/trigger-selection.d.ts +1 -0
- package/dist/prompts/node-selection/trigger-selection.js +23 -0
- package/dist/prompts/node-selection/trigger-selection.js.map +1 -0
- package/dist/prompts/node-selection/use-case-patterns.d.ts +2 -0
- package/dist/prompts/node-selection/use-case-patterns.js +58 -0
- package/dist/prompts/node-selection/use-case-patterns.js.map +1 -0
- package/dist/prompts/sdk-reference/additional-functions.d.ts +1 -0
- package/dist/prompts/sdk-reference/additional-functions.js +20 -0
- package/dist/prompts/sdk-reference/additional-functions.js.map +1 -0
- package/dist/prompts/sdk-reference/expressions.d.ts +1 -0
- package/dist/prompts/sdk-reference/expressions.js +34 -0
- package/dist/prompts/sdk-reference/expressions.js.map +1 -0
- package/dist/prompts/sdk-reference/index.d.ts +5 -0
- package/dist/prompts/sdk-reference/index.js +14 -0
- package/dist/prompts/sdk-reference/index.js.map +1 -0
- package/dist/prompts/sdk-reference/workflow-patterns-detailed.d.ts +1 -0
- package/dist/prompts/sdk-reference/workflow-patterns-detailed.js +398 -0
- package/dist/prompts/sdk-reference/workflow-patterns-detailed.js.map +1 -0
- package/dist/prompts/sdk-reference/workflow-patterns.d.ts +2 -0
- package/dist/prompts/sdk-reference/workflow-patterns.js +479 -0
- package/dist/prompts/sdk-reference/workflow-patterns.js.map +1 -0
- package/dist/prompts/sdk-reference/workflow-rules.d.ts +1 -0
- package/dist/prompts/sdk-reference/workflow-rules.js +23 -0
- package/dist/prompts/sdk-reference/workflow-rules.js.map +1 -0
- package/dist/workflow-builder/plugins/defaults.js +1 -0
- package/dist/workflow-builder/plugins/defaults.js.map +1 -1
- package/dist/workflow-builder/plugins/validators/filter-node-validator.d.ts +2 -0
- package/dist/workflow-builder/plugins/validators/filter-node-validator.js +90 -0
- package/dist/workflow-builder/plugins/validators/filter-node-validator.js.map +1 -0
- package/dist/workflow-builder/plugins/validators/index.d.ts +1 -0
- package/dist/workflow-builder/plugins/validators/index.js +3 -1
- package/dist/workflow-builder/plugins/validators/index.js.map +1 -1
- package/package.json +50 -4
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SYSTEM_MESSAGE_GUIDE = void 0;
|
|
4
|
+
function hasSystemMessageParameters(nodeDefinition) {
|
|
5
|
+
if (!nodeDefinition.properties)
|
|
6
|
+
return false;
|
|
7
|
+
return nodeDefinition.properties.some((prop) => {
|
|
8
|
+
if (prop.name === 'messages' &&
|
|
9
|
+
(prop.type === 'fixedCollection' || prop.type === 'collection')) {
|
|
10
|
+
return true;
|
|
11
|
+
}
|
|
12
|
+
if (prop.name === 'options' && prop.type === 'collection' && Array.isArray(prop.options)) {
|
|
13
|
+
return prop.options.some((opt) => typeof opt === 'object' &&
|
|
14
|
+
opt !== null &&
|
|
15
|
+
'name' in opt &&
|
|
16
|
+
(opt.name === 'systemMessage' || opt.name === 'system'));
|
|
17
|
+
}
|
|
18
|
+
return false;
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
exports.SYSTEM_MESSAGE_GUIDE = {
|
|
22
|
+
patterns: ['*'],
|
|
23
|
+
condition: (ctx) => hasSystemMessageParameters(ctx.nodeDefinition),
|
|
24
|
+
content: `
|
|
25
|
+
## CRITICAL: System Message vs User Prompt Separation
|
|
26
|
+
|
|
27
|
+
AI nodes (AI Agent, LLM Chain, Anthropic, OpenAI, etc.) have TWO distinct prompt fields that MUST be used correctly:
|
|
28
|
+
|
|
29
|
+
### Field Separation
|
|
30
|
+
1. **System Message** - Model's persistent identity, role, and instructions
|
|
31
|
+
2. **User Message/Text** - Dynamic user context and data references per execution
|
|
32
|
+
|
|
33
|
+
**Node-specific field names:**
|
|
34
|
+
- AI Agent: \`options.systemMessage\` and \`text\`
|
|
35
|
+
- LLM Chain: \`messages.messageValues[]\` with system role and \`text\`
|
|
36
|
+
- Anthropic: \`options.system\` and \`messages.values[]\`
|
|
37
|
+
- OpenAI: \`messages.values[]\` with role "system" vs "user"
|
|
38
|
+
|
|
39
|
+
### System Message
|
|
40
|
+
Use for STATIC, ROLE-DEFINING content:
|
|
41
|
+
- Agent identity: "You are a [role] agent..."
|
|
42
|
+
- Task description: "Your task is to..."
|
|
43
|
+
- Step-by-step instructions: "1. Do X, 2. Do Y, 3. Do Z"
|
|
44
|
+
- Behavioral guidelines: "Always...", "Never..."
|
|
45
|
+
- Tool coordination: "Call the Research Tool to..., then call..."
|
|
46
|
+
|
|
47
|
+
### Text Parameter
|
|
48
|
+
Use for DYNAMIC, EXECUTION-SPECIFIC content:
|
|
49
|
+
- User input: "={{ $json.chatInput }}"
|
|
50
|
+
- Workflow context: "=The research topic is: {{ $json.topic }}"
|
|
51
|
+
- Data from previous nodes: "=Process this data: {{ $json.data }}"
|
|
52
|
+
- Variable context: "=Analyze for user: {{ $json.userId }}"
|
|
53
|
+
|
|
54
|
+
### Common Mistakes to Avoid
|
|
55
|
+
|
|
56
|
+
**WRONG - Everything in text field:**
|
|
57
|
+
{
|
|
58
|
+
"text": "=You are an orchestrator agent that coordinates specialized agents. Your task is to: 1) Call Research Agent Tool, 2) Call Fact-Check Agent Tool, 3) Generate report. Research topic: {{ $json.researchTopic }}"
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
**CORRECT - Properly separated:**
|
|
62
|
+
{
|
|
63
|
+
"text": "=The research topic is: {{ $json.researchTopic }}",
|
|
64
|
+
"options": {
|
|
65
|
+
"systemMessage": "You are an orchestrator agent that coordinates specialized agents.\\n\\nYour task is to:\\n1. Call the Research Agent Tool to gather information\\n2. Call the Fact-Check Agent Tool to verify findings\\n3. Generate a comprehensive report\\n\\nReturn ONLY the final report."
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
### Update Pattern Examples
|
|
70
|
+
|
|
71
|
+
Example 1 - AI Agent with orchestration:
|
|
72
|
+
Instructions: [
|
|
73
|
+
"Set text to '=Research topic: {{ $json.researchTopic }}'",
|
|
74
|
+
"Set system message to 'You are an orchestrator coordinating research tasks.\\n\\nSteps:\\n1. Call Research Agent Tool\\n2. Call Fact-Check Agent Tool\\n3. Call Report Writer Agent Tool\\n4. Return final HTML report'"
|
|
75
|
+
]
|
|
76
|
+
|
|
77
|
+
Example 2 - Chat-based AI node:
|
|
78
|
+
Instructions: [
|
|
79
|
+
"Set text to '=User question: {{ $json.chatInput }}'",
|
|
80
|
+
"Set system message to 'You are a helpful customer support assistant. Answer questions clearly and professionally. Escalate to human if needed.'"
|
|
81
|
+
]
|
|
82
|
+
|
|
83
|
+
Example 3 - Data processing with AI:
|
|
84
|
+
Instructions: [
|
|
85
|
+
"Set text to '=Process this data: {{ $json.inputData }}'",
|
|
86
|
+
"Set system message to 'You are a data analysis assistant.\\n\\nTasks:\\n1. Validate data structure\\n2. Calculate statistics\\n3. Identify anomalies\\n4. Return JSON with findings'"
|
|
87
|
+
]
|
|
88
|
+
|
|
89
|
+
### Why This Matters
|
|
90
|
+
- **Consistency**: System message stays the same across executions
|
|
91
|
+
- **Maintainability**: Easy to update AI behavior without touching data flow
|
|
92
|
+
- **Best Practice**: Follows standard AI prompt engineering patterns
|
|
93
|
+
- **Clarity**: Separates "what the AI model is" from "what data to process"
|
|
94
|
+
`,
|
|
95
|
+
};
|
|
96
|
+
//# sourceMappingURL=system-message.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system-message.js","sourceRoot":"","sources":["../../../../src/prompts/node-guidance/parameter-guides/system-message.ts"],"names":[],"mappings":";;;AAMA,SAAS,0BAA0B,CAAC,cAEnC;IACA,IAAI,CAAC,cAAc,CAAC,UAAU;QAAE,OAAO,KAAK,CAAC;IAE7C,OAAO,cAAc,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE;QAE9C,IACC,IAAI,CAAC,IAAI,KAAK,UAAU;YACxB,CAAC,IAAI,CAAC,IAAI,KAAK,iBAAiB,IAAI,IAAI,CAAC,IAAI,KAAK,YAAY,CAAC,EAC9D,CAAC;YACF,OAAO,IAAI,CAAC;QACb,CAAC;QAGD,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS,IAAI,IAAI,CAAC,IAAI,KAAK,YAAY,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;YAC1F,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CACvB,CAAC,GAAG,EAAE,EAAE,CACP,OAAO,GAAG,KAAK,QAAQ;gBACvB,GAAG,KAAK,IAAI;gBACZ,MAAM,IAAI,GAAG;gBACb,CAAC,GAAG,CAAC,IAAI,KAAK,eAAe,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ,CAAC,CACxD,CAAC;QACH,CAAC;QAED,OAAO,KAAK,CAAC;IACd,CAAC,CAAC,CAAC;AACJ,CAAC;AAEY,QAAA,oBAAoB,GAAkB;IAClD,QAAQ,EAAE,CAAC,GAAG,CAAC;IACf,SAAS,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,0BAA0B,CAAC,GAAG,CAAC,cAAc,CAAC;IAClE,OAAO,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsET;CACA,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TEXT_FIELDS_GUIDE = void 0;
|
|
4
|
+
function hasTextFields(nodeDefinition) {
|
|
5
|
+
if (!nodeDefinition.properties)
|
|
6
|
+
return false;
|
|
7
|
+
return nodeDefinition.properties.some((prop) => prop.type === 'string' && prop.typeOptions?.multipleValues !== true);
|
|
8
|
+
}
|
|
9
|
+
exports.TEXT_FIELDS_GUIDE = {
|
|
10
|
+
patterns: ['*'],
|
|
11
|
+
condition: (ctx) => hasTextFields(ctx.nodeDefinition),
|
|
12
|
+
content: `
|
|
13
|
+
## Text Field Expression Formatting
|
|
14
|
+
|
|
15
|
+
### PREFERRED METHOD: Embedding expressions directly within text
|
|
16
|
+
\`\`\`
|
|
17
|
+
"text": "=ALERT: It is currently {{ $('Weather Node').item.json.weather }} in {{ $('Weather Node').item.json.city }}!"
|
|
18
|
+
\`\`\`
|
|
19
|
+
|
|
20
|
+
### Alternative method: Using string concatenation (use only when needed)
|
|
21
|
+
\`\`\`
|
|
22
|
+
"text": "={{ 'ALERT: It is currently ' + $('Weather Node').item.json.weather + ' in ' + $('Weather Node').item.json.city + '!' }}"
|
|
23
|
+
\`\`\`
|
|
24
|
+
|
|
25
|
+
### Key Points:
|
|
26
|
+
- Use the embedded expression format when mixing static text with dynamic values
|
|
27
|
+
- The entire string must start with = when using expressions
|
|
28
|
+
- Expressions within text use single curly braces {{ }}
|
|
29
|
+
- The outer expression wrapper uses double curly braces ={{ }}`,
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=text-fields.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text-fields.js","sourceRoot":"","sources":["../../../../src/prompts/node-guidance/parameter-guides/text-fields.ts"],"names":[],"mappings":";;;AAKA,SAAS,aAAa,CAAC,cAEtB;IACA,IAAI,CAAC,cAAc,CAAC,UAAU;QAAE,OAAO,KAAK,CAAC;IAE7C,OAAO,cAAc,CAAC,UAAU,CAAC,IAAI,CACpC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,WAAW,EAAE,cAAc,KAAK,IAAI,CAC7E,CAAC;AACH,CAAC;AAEY,QAAA,iBAAiB,GAAkB;IAC/C,QAAQ,EAAE,CAAC,GAAG,CAAC;IACf,SAAS,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,aAAa,CAAC,GAAG,CAAC,cAAc,CAAC;IACrD,OAAO,EAAE;;;;;;;;;;;;;;;;;+DAiBqD;CAC9D,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TOOL_NODES_GUIDE = void 0;
|
|
4
|
+
exports.TOOL_NODES_GUIDE = {
|
|
5
|
+
patterns: ['*Tool'],
|
|
6
|
+
content: `
|
|
7
|
+
## CRITICAL: $fromAI Expression Support for Tool Nodes
|
|
8
|
+
|
|
9
|
+
Tool nodes (nodes ending with "Tool" like Gmail Tool, Google Calendar Tool, etc.) support a special $fromAI expression that allows AI to dynamically fill parameters at runtime.
|
|
10
|
+
|
|
11
|
+
### When to Use $fromAI
|
|
12
|
+
- ONLY available in tool nodes (node types ending with "Tool")
|
|
13
|
+
- Use when the AI should determine the value based on context
|
|
14
|
+
- Ideal for parameters that vary based on user input or conversation context
|
|
15
|
+
|
|
16
|
+
### $fromAI Syntax
|
|
17
|
+
\`={{ $fromAI('key', 'description', 'type', defaultValue) }}\`
|
|
18
|
+
|
|
19
|
+
### Parameters
|
|
20
|
+
- key: Unique identifier (1-64 chars, alphanumeric/underscore/hyphen)
|
|
21
|
+
- description: Optional description for the AI (use empty string '' if not needed)
|
|
22
|
+
- type: 'string' | 'number' | 'boolean' | 'json' (defaults to 'string')
|
|
23
|
+
- defaultValue: Optional fallback value
|
|
24
|
+
|
|
25
|
+
### Tool Node Examples
|
|
26
|
+
|
|
27
|
+
#### Gmail Tool - Sending Email
|
|
28
|
+
{
|
|
29
|
+
"sendTo": "={{ $fromAI('to') }}",
|
|
30
|
+
"subject": "={{ $fromAI('subject') }}",
|
|
31
|
+
"message": "={{ $fromAI('message_html') }}"
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
#### Google Calendar Tool - Filtering Events
|
|
35
|
+
{
|
|
36
|
+
"timeMin": "={{ $fromAI('After', '', 'string') }}",
|
|
37
|
+
"timeMax": "={{ $fromAI('Before', '', 'string') }}"
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
### Mixed Usage Examples
|
|
41
|
+
You can combine $fromAI with regular text:
|
|
42
|
+
- "Subject: {{ $fromAI('subject') }} - Automated"
|
|
43
|
+
- "Dear {{ $fromAI('recipientName', 'Customer name', 'string', 'Customer') }},"
|
|
44
|
+
|
|
45
|
+
### Important Rules
|
|
46
|
+
1. ONLY use $fromAI in tool nodes (check if node type ends with "Tool")
|
|
47
|
+
2. For timeMin/timeMax and similar date fields, use appropriate key names
|
|
48
|
+
3. The AI will fill these values based on context during execution
|
|
49
|
+
4. Don't use $fromAI in regular nodes like Set, IF, HTTP Request, etc.
|
|
50
|
+
|
|
51
|
+
## Tool Node Parameter Guidelines
|
|
52
|
+
|
|
53
|
+
### Identifying Tool Nodes
|
|
54
|
+
1. CHECK NODE TYPE: If the node type ends with "Tool", it supports $fromAI expressions
|
|
55
|
+
2. COMMON TOOL NODES:
|
|
56
|
+
- Gmail Tool (gmailTool): to, subject, message → use $fromAI
|
|
57
|
+
- Google Calendar Tool (googleCalendarTool): timeMin, timeMax → use $fromAI
|
|
58
|
+
- Slack Tool (slackTool): channel, message → use $fromAI
|
|
59
|
+
- Microsoft Teams Tool: channel, message → use $fromAI
|
|
60
|
+
- Telegram Tool: chatId, text → use $fromAI
|
|
61
|
+
- Other communication/document tools: content fields → use $fromAI
|
|
62
|
+
|
|
63
|
+
### When to Use $fromAI in Tool Nodes
|
|
64
|
+
1. DYNAMIC VALUES: Use $fromAI for values that should be determined by AI based on context
|
|
65
|
+
2. USER INPUT FIELDS: Recipients, subjects, messages, date ranges
|
|
66
|
+
3. PRESERVE EXISTING: If a parameter already uses $fromAI, keep it unless explicitly asked to change
|
|
67
|
+
4. DATE/TIME FIELDS: Use descriptive key names for clarity
|
|
68
|
+
|
|
69
|
+
### Tool Node Parameter Patterns
|
|
70
|
+
- Email recipients: "={{ $fromAI('to') }}"
|
|
71
|
+
- Email subjects: "={{ $fromAI('subject') }}"
|
|
72
|
+
- Message content: "={{ $fromAI('message_html') }}" or "={{ $fromAI('message') }}"
|
|
73
|
+
- Date ranges: "={{ $fromAI('After', '', 'string') }}"
|
|
74
|
+
- Channel IDs: "={{ $fromAI('channel') }}"`,
|
|
75
|
+
};
|
|
76
|
+
//# sourceMappingURL=tool-nodes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-nodes.js","sourceRoot":"","sources":["../../../../src/prompts/node-guidance/parameter-guides/tool-nodes.ts"],"names":[],"mappings":";;;AAEa,QAAA,gBAAgB,GAAkB;IAC9C,QAAQ,EAAE,CAAC,OAAO,CAAC;IACnB,OAAO,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2CAoEiC;CAC1C,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { INodeTypeDescription } from 'n8n-workflow';
|
|
2
|
+
export type NodeTypePattern = string;
|
|
3
|
+
export interface PromptContext {
|
|
4
|
+
nodeType: string;
|
|
5
|
+
nodeDefinition: INodeTypeDescription;
|
|
6
|
+
requestedChanges: string[];
|
|
7
|
+
hasResourceLocatorParams?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface NodeTypeGuide {
|
|
10
|
+
patterns: NodeTypePattern[];
|
|
11
|
+
content: string;
|
|
12
|
+
condition?: (context: PromptContext) => boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface NodeTypeExamples {
|
|
15
|
+
patterns: NodeTypePattern[];
|
|
16
|
+
content: string;
|
|
17
|
+
condition?: (context: PromptContext) => boolean;
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/prompts/node-guidance/parameter-guides/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const AI_NODE_SELECTION = "AI node selection guidance:\n\nAI Agent: Use for text analysis, summarization, classification, or any AI reasoning tasks.\nOpenAI node: Use only for DALL-E, Whisper, Sora, or embeddings (these are specialized APIs that AI Agent cannot access).\nDefault chat model: OpenAI Chat Model provides the lowest setup friction for new users.\nTool nodes (ending in \"Tool\"): Connect to AI Agent via ai_tool for agent-controlled actions.\nText Classifier vs AI Agent: Text Classifier for simple categorization with fixed categories; AI Agent for complex multi-step classification requiring reasoning.\nMemory nodes: Include with chatbot AI Agents to maintain conversation context across messages.\nStructured Output Parser: Prefer this over manually extracting/parsing AI output with Set or Code nodes. Define the desired schema and the LLM handles parsing automatically. Use for classification, data extraction, or any workflow where AI output feeds into database storage, API calls, or Switch routing.\n\nMulti-agent systems:\nAI Agent Tool (@n8n/n8n-nodes-langchain.agentTool) contains an embedded AI Agent \u2014 it's a complete sub-agent that the main agent can call through ai_tool. Each AgentTool needs its own Chat Model. Node selection: 1 AI Agent + N AgentTools + (N+1) Chat Models.";
|
|
2
|
+
export declare const AI_TOOL_PATTERNS = "AI Agent tool connection patterns:\n\nWhen AI Agent needs external capabilities, use TOOL nodes (not regular nodes):\n- Research: SerpAPI Tool, Perplexity Tool -> AI Agent [ai_tool]\n- Calendar: Google Calendar Tool -> AI Agent [ai_tool]\n- Messaging: Slack Tool, Gmail Tool -> AI Agent [ai_tool]\n- HTTP calls: HTTP Request Tool -> AI Agent [ai_tool]\n- Calculations: Calculator Tool -> AI Agent [ai_tool]\n- Sub-agents: AI Agent Tool -> AI Agent [ai_tool] (for multi-agent systems)\n\nTool nodes: AI Agent decides when/if to use them based on reasoning.\nRegular nodes: Execute at that workflow step regardless of context.\n\nVector Store patterns:\n- Insert documents: Document Loader -> Vector Store (mode='insert') [ai_document]\n- RAG with AI Agent: Vector Store (mode='retrieve-as-tool') -> AI Agent [ai_tool]\n The retrieve-as-tool mode makes the Vector Store act as a tool the Agent can call.\n\nStructured Output Parser: Connect to AI Agent when structured JSON output is required.";
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AI_TOOL_PATTERNS = exports.AI_NODE_SELECTION = void 0;
|
|
4
|
+
exports.AI_NODE_SELECTION = `AI node selection guidance:
|
|
5
|
+
|
|
6
|
+
AI Agent: Use for text analysis, summarization, classification, or any AI reasoning tasks.
|
|
7
|
+
OpenAI node: Use only for DALL-E, Whisper, Sora, or embeddings (these are specialized APIs that AI Agent cannot access).
|
|
8
|
+
Default chat model: OpenAI Chat Model provides the lowest setup friction for new users.
|
|
9
|
+
Tool nodes (ending in "Tool"): Connect to AI Agent via ai_tool for agent-controlled actions.
|
|
10
|
+
Text Classifier vs AI Agent: Text Classifier for simple categorization with fixed categories; AI Agent for complex multi-step classification requiring reasoning.
|
|
11
|
+
Memory nodes: Include with chatbot AI Agents to maintain conversation context across messages.
|
|
12
|
+
Structured Output Parser: Prefer this over manually extracting/parsing AI output with Set or Code nodes. Define the desired schema and the LLM handles parsing automatically. Use for classification, data extraction, or any workflow where AI output feeds into database storage, API calls, or Switch routing.
|
|
13
|
+
|
|
14
|
+
Multi-agent systems:
|
|
15
|
+
AI Agent Tool (@n8n/n8n-nodes-langchain.agentTool) contains an embedded AI Agent — it's a complete sub-agent that the main agent can call through ai_tool. Each AgentTool needs its own Chat Model. Node selection: 1 AI Agent + N AgentTools + (N+1) Chat Models.`;
|
|
16
|
+
exports.AI_TOOL_PATTERNS = `AI Agent tool connection patterns:
|
|
17
|
+
|
|
18
|
+
When AI Agent needs external capabilities, use TOOL nodes (not regular nodes):
|
|
19
|
+
- Research: SerpAPI Tool, Perplexity Tool -> AI Agent [ai_tool]
|
|
20
|
+
- Calendar: Google Calendar Tool -> AI Agent [ai_tool]
|
|
21
|
+
- Messaging: Slack Tool, Gmail Tool -> AI Agent [ai_tool]
|
|
22
|
+
- HTTP calls: HTTP Request Tool -> AI Agent [ai_tool]
|
|
23
|
+
- Calculations: Calculator Tool -> AI Agent [ai_tool]
|
|
24
|
+
- Sub-agents: AI Agent Tool -> AI Agent [ai_tool] (for multi-agent systems)
|
|
25
|
+
|
|
26
|
+
Tool nodes: AI Agent decides when/if to use them based on reasoning.
|
|
27
|
+
Regular nodes: Execute at that workflow step regardless of context.
|
|
28
|
+
|
|
29
|
+
Vector Store patterns:
|
|
30
|
+
- Insert documents: Document Loader -> Vector Store (mode='insert') [ai_document]
|
|
31
|
+
- RAG with AI Agent: Vector Store (mode='retrieve-as-tool') -> AI Agent [ai_tool]
|
|
32
|
+
The retrieve-as-tool mode makes the Vector Store act as a tool the Agent can call.
|
|
33
|
+
|
|
34
|
+
Structured Output Parser: Connect to AI Agent when structured JSON output is required.`;
|
|
35
|
+
//# sourceMappingURL=ai-nodes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-nodes.js","sourceRoot":"","sources":["../../../src/prompts/node-selection/ai-nodes.ts"],"names":[],"mappings":";;;AAAa,QAAA,iBAAiB,GAAG;;;;;;;;;;;mQAWkO,CAAC;AAEvP,QAAA,gBAAgB,GAAG;;;;;;;;;;;;;;;;;;uFAkBuD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const CONNECTION_CHANGING_PARAMETERS = "Connection-changing parameters (affect node inputs/outputs):\n\nCommon connection-changing parameters:\n- Vector Store: mode (insert/retrieve/retrieve-as-tool) \u2014 changes output type between main, ai_vectorStore, and ai_tool\n- AI Agent: hasOutputParser (true/false) \u2014 enables ai_outputParser input\n- Merge: numberInputs (default 2) \u2014 requires mode=\"append\" OR mode=\"combine\" + combineBy=\"combineByPosition\"\n- Switch: mode (expression/rules) \u2014 affects routing behavior\n\nA parameter is connection-changing if it appears in node input/output expressions (patterns like $parameter.mode, $parameter.hasOutputParser).";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CONNECTION_CHANGING_PARAMETERS = void 0;
|
|
4
|
+
exports.CONNECTION_CHANGING_PARAMETERS = `Connection-changing parameters (affect node inputs/outputs):
|
|
5
|
+
|
|
6
|
+
Common connection-changing parameters:
|
|
7
|
+
- Vector Store: mode (insert/retrieve/retrieve-as-tool) — changes output type between main, ai_vectorStore, and ai_tool
|
|
8
|
+
- AI Agent: hasOutputParser (true/false) — enables ai_outputParser input
|
|
9
|
+
- Merge: numberInputs (default 2) — requires mode="append" OR mode="combine" + combineBy="combineByPosition"
|
|
10
|
+
- Switch: mode (expression/rules) — affects routing behavior
|
|
11
|
+
|
|
12
|
+
A parameter is connection-changing if it appears in node input/output expressions (patterns like $parameter.mode, $parameter.hasOutputParser).`;
|
|
13
|
+
//# sourceMappingURL=connection-parameters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connection-parameters.js","sourceRoot":"","sources":["../../../src/prompts/node-selection/connection-parameters.ts"],"names":[],"mappings":";;;AAAa,QAAA,8BAA8B,GAAG;;;;;;;;+IAQiG,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { AI_NODE_SELECTION, AI_TOOL_PATTERNS } from './ai-nodes';
|
|
2
|
+
export { NODE_SELECTION_PATTERNS, BASELINE_FLOW_CONTROL } from './use-case-patterns';
|
|
3
|
+
export { TRIGGER_SELECTION } from './trigger-selection';
|
|
4
|
+
export { NATIVE_NODE_PREFERENCE } from './native-preference';
|
|
5
|
+
export { CONNECTION_CHANGING_PARAMETERS } from './connection-parameters';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CONNECTION_CHANGING_PARAMETERS = exports.NATIVE_NODE_PREFERENCE = exports.TRIGGER_SELECTION = exports.BASELINE_FLOW_CONTROL = exports.NODE_SELECTION_PATTERNS = exports.AI_TOOL_PATTERNS = exports.AI_NODE_SELECTION = void 0;
|
|
4
|
+
var ai_nodes_1 = require("./ai-nodes");
|
|
5
|
+
Object.defineProperty(exports, "AI_NODE_SELECTION", { enumerable: true, get: function () { return ai_nodes_1.AI_NODE_SELECTION; } });
|
|
6
|
+
Object.defineProperty(exports, "AI_TOOL_PATTERNS", { enumerable: true, get: function () { return ai_nodes_1.AI_TOOL_PATTERNS; } });
|
|
7
|
+
var use_case_patterns_1 = require("./use-case-patterns");
|
|
8
|
+
Object.defineProperty(exports, "NODE_SELECTION_PATTERNS", { enumerable: true, get: function () { return use_case_patterns_1.NODE_SELECTION_PATTERNS; } });
|
|
9
|
+
Object.defineProperty(exports, "BASELINE_FLOW_CONTROL", { enumerable: true, get: function () { return use_case_patterns_1.BASELINE_FLOW_CONTROL; } });
|
|
10
|
+
var trigger_selection_1 = require("./trigger-selection");
|
|
11
|
+
Object.defineProperty(exports, "TRIGGER_SELECTION", { enumerable: true, get: function () { return trigger_selection_1.TRIGGER_SELECTION; } });
|
|
12
|
+
var native_preference_1 = require("./native-preference");
|
|
13
|
+
Object.defineProperty(exports, "NATIVE_NODE_PREFERENCE", { enumerable: true, get: function () { return native_preference_1.NATIVE_NODE_PREFERENCE; } });
|
|
14
|
+
var connection_parameters_1 = require("./connection-parameters");
|
|
15
|
+
Object.defineProperty(exports, "CONNECTION_CHANGING_PARAMETERS", { enumerable: true, get: function () { return connection_parameters_1.CONNECTION_CHANGING_PARAMETERS; } });
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/prompts/node-selection/index.ts"],"names":[],"mappings":";;;AAAA,uCAAiE;AAAxD,6GAAA,iBAAiB,OAAA;AAAE,4GAAA,gBAAgB,OAAA;AAC5C,yDAAqF;AAA5E,4HAAA,uBAAuB,OAAA;AAAE,0HAAA,qBAAqB,OAAA;AACvD,yDAAwD;AAA/C,sHAAA,iBAAiB,OAAA;AAC1B,yDAA6D;AAApD,2HAAA,sBAAsB,OAAA;AAC/B,iEAAyE;AAAhE,uIAAA,8BAA8B,OAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const NATIVE_NODE_PREFERENCE = "Prefer native n8n nodes over Code node \u2014 native nodes provide better UX, visual debugging, and are easier for users to modify.\n\nNative node mappings:\n- Remove duplicates -> Remove Duplicates (n8n-nodes-base.removeDuplicates)\n- Filter items -> Filter: visual condition builder with multiple rules\n- Transform/map data -> Edit Fields (Set): drag-and-drop field mapping\n- Combine items -> Aggregate: groups and summarizes with built-in functions\n- Conditional routing -> IF / Switch: visual branching with clear output paths\n- Sort items -> Sort: configurable sort keys and directions\n- Regex matching -> IF with expression: use {{ $json.field.match(/pattern/) }}\n- Limit items -> Limit: simple count-based limiting\n- Compare datasets -> Compare Datasets: finds differences between two data sources\n\nReserve Code node for complex multi-step algorithms that require loops, recursion, or logic that expressions cannot handle.";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NATIVE_NODE_PREFERENCE = void 0;
|
|
4
|
+
exports.NATIVE_NODE_PREFERENCE = `Prefer native n8n nodes over Code node — native nodes provide better UX, visual debugging, and are easier for users to modify.
|
|
5
|
+
|
|
6
|
+
Native node mappings:
|
|
7
|
+
- Remove duplicates -> Remove Duplicates (n8n-nodes-base.removeDuplicates)
|
|
8
|
+
- Filter items -> Filter: visual condition builder with multiple rules
|
|
9
|
+
- Transform/map data -> Edit Fields (Set): drag-and-drop field mapping
|
|
10
|
+
- Combine items -> Aggregate: groups and summarizes with built-in functions
|
|
11
|
+
- Conditional routing -> IF / Switch: visual branching with clear output paths
|
|
12
|
+
- Sort items -> Sort: configurable sort keys and directions
|
|
13
|
+
- Regex matching -> IF with expression: use {{ $json.field.match(/pattern/) }}
|
|
14
|
+
- Limit items -> Limit: simple count-based limiting
|
|
15
|
+
- Compare datasets -> Compare Datasets: finds differences between two data sources
|
|
16
|
+
|
|
17
|
+
Reserve Code node for complex multi-step algorithms that require loops, recursion, or logic that expressions cannot handle.`;
|
|
18
|
+
//# sourceMappingURL=native-preference.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"native-preference.js","sourceRoot":"","sources":["../../../src/prompts/node-selection/native-preference.ts"],"names":[],"mappings":";;;AAAa,QAAA,sBAAsB,GAAG;;;;;;;;;;;;;4HAasF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const TRIGGER_SELECTION = "Trigger type selection:\n\nWebhook (n8n-nodes-base.webhook): External systems calling your workflow via HTTP POST/GET.\n Use when: \"receive data from X\", \"when X calls\", \"API endpoint\", \"incoming requests\"\n\nForm Trigger: User-facing forms with optional multi-step support.\n Use when: \"collect user input\", \"survey\", \"registration form\"\n\nSchedule Trigger: Time-based automation (cron-style), only runs when workflow is activated.\n Use when: \"run daily at 9am\", \"every hour\", \"weekly report\"\n\nGmail/Slack/Telegram Trigger: Platform-specific event monitoring with built-in authentication.\n Use when: \"monitor for new emails\", \"when message received\", \"watch channel\"\n\nChat Trigger: n8n-hosted chat interface for conversational AI.\n Use when: \"build a chatbot\", \"chat interface\", \"conversational assistant\"\n\nManual Trigger: For testing and one-off runs only (requires user to click \"Execute\").\n Use when: explicitly testing or debugging workflows";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TRIGGER_SELECTION = void 0;
|
|
4
|
+
exports.TRIGGER_SELECTION = `Trigger type selection:
|
|
5
|
+
|
|
6
|
+
Webhook (n8n-nodes-base.webhook): External systems calling your workflow via HTTP POST/GET.
|
|
7
|
+
Use when: "receive data from X", "when X calls", "API endpoint", "incoming requests"
|
|
8
|
+
|
|
9
|
+
Form Trigger: User-facing forms with optional multi-step support.
|
|
10
|
+
Use when: "collect user input", "survey", "registration form"
|
|
11
|
+
|
|
12
|
+
Schedule Trigger: Time-based automation (cron-style), only runs when workflow is activated.
|
|
13
|
+
Use when: "run daily at 9am", "every hour", "weekly report"
|
|
14
|
+
|
|
15
|
+
Gmail/Slack/Telegram Trigger: Platform-specific event monitoring with built-in authentication.
|
|
16
|
+
Use when: "monitor for new emails", "when message received", "watch channel"
|
|
17
|
+
|
|
18
|
+
Chat Trigger: n8n-hosted chat interface for conversational AI.
|
|
19
|
+
Use when: "build a chatbot", "chat interface", "conversational assistant"
|
|
20
|
+
|
|
21
|
+
Manual Trigger: For testing and one-off runs only (requires user to click "Execute").
|
|
22
|
+
Use when: explicitly testing or debugging workflows`;
|
|
23
|
+
//# sourceMappingURL=trigger-selection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trigger-selection.js","sourceRoot":"","sources":["../../../src/prompts/node-selection/trigger-selection.ts"],"names":[],"mappings":";;;AAAa,QAAA,iBAAiB,GAAG;;;;;;;;;;;;;;;;;;sDAkBqB,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const NODE_SELECTION_PATTERNS = "Node selection by use case:\n\nDOCUMENTS:\n- Document Loader: Loads documents from various sources\n- Extract From File: Extracts text content from binary files\n- AWS Textract: OCR for scanned documents\n\nDATA PROCESSING & TRANSFORMATION:\n- Aggregate: Combines multiple items into one\n- Split Out: Expands arrays into separate items\n- Loop Over Items: Processes large item sets\n- Set: Adds, modifies, or removes fields from items\n- Filter: Removes items based on conditions\n- Sort: Orders items by field values\n\nSTORAGE:\n- n8n Data Tables: Built-in database storage (no credentials required). Recommend as the default storage option.\n- Google Sheets: Spreadsheet storage and collaboration\n- Airtable: Relational database with rich field types\n\nTRIGGERS:\n- Schedule Trigger: Time-based automation\n- Gmail Trigger: Monitors for new emails\n- Form Trigger: Collects user submissions\n- Webhook: Receives HTTP requests from external services\n\nSCRAPING:\n- HTTP Request + HTML Extract: Web page content extraction\n\nNOTIFICATIONS:\n- Email nodes (Gmail, Outlook, Send Email)\n- Slack: Team messaging\n- Telegram: Bot messaging\n- Twilio: SMS messaging\n\nRESEARCH:\n- SerpAPI Tool: Web search capabilities for AI Agents\n- Perplexity Tool: AI-powered search for AI Agents\n\nCHATBOTS:\n- Slack/Telegram/WhatsApp nodes: Platform-specific chatbots\n- Chat Trigger: n8n-hosted chat interface\n\nMEDIA:\n- OpenAI: DALL-E image generation, Sora video, Whisper transcription\n- Google Gemini: Imagen image generation";
|
|
2
|
+
export declare const BASELINE_FLOW_CONTROL = "Baseline flow control nodes (used in most workflows):\n\n- n8n-nodes-base.aggregate: Combines multiple items into one item\n- n8n-nodes-base.if: Routes items based on true/false condition\n- n8n-nodes-base.switch: Routes items to different paths based on rules or expressions\n- n8n-nodes-base.splitOut: Expands a single item containing an array into multiple individual items\n- n8n-nodes-base.merge: Combines data from multiple parallel branches (for 3+ inputs: mode=\"append\" + numberInputs)\n- n8n-nodes-base.set: Transforms and restructures data fields";
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BASELINE_FLOW_CONTROL = exports.NODE_SELECTION_PATTERNS = void 0;
|
|
4
|
+
exports.NODE_SELECTION_PATTERNS = `Node selection by use case:
|
|
5
|
+
|
|
6
|
+
DOCUMENTS:
|
|
7
|
+
- Document Loader: Loads documents from various sources
|
|
8
|
+
- Extract From File: Extracts text content from binary files
|
|
9
|
+
- AWS Textract: OCR for scanned documents
|
|
10
|
+
|
|
11
|
+
DATA PROCESSING & TRANSFORMATION:
|
|
12
|
+
- Aggregate: Combines multiple items into one
|
|
13
|
+
- Split Out: Expands arrays into separate items
|
|
14
|
+
- Loop Over Items: Processes large item sets
|
|
15
|
+
- Set: Adds, modifies, or removes fields from items
|
|
16
|
+
- Filter: Removes items based on conditions
|
|
17
|
+
- Sort: Orders items by field values
|
|
18
|
+
|
|
19
|
+
STORAGE:
|
|
20
|
+
- n8n Data Tables: Built-in database storage (no credentials required). Recommend as the default storage option.
|
|
21
|
+
- Google Sheets: Spreadsheet storage and collaboration
|
|
22
|
+
- Airtable: Relational database with rich field types
|
|
23
|
+
|
|
24
|
+
TRIGGERS:
|
|
25
|
+
- Schedule Trigger: Time-based automation
|
|
26
|
+
- Gmail Trigger: Monitors for new emails
|
|
27
|
+
- Form Trigger: Collects user submissions
|
|
28
|
+
- Webhook: Receives HTTP requests from external services
|
|
29
|
+
|
|
30
|
+
SCRAPING:
|
|
31
|
+
- HTTP Request + HTML Extract: Web page content extraction
|
|
32
|
+
|
|
33
|
+
NOTIFICATIONS:
|
|
34
|
+
- Email nodes (Gmail, Outlook, Send Email)
|
|
35
|
+
- Slack: Team messaging
|
|
36
|
+
- Telegram: Bot messaging
|
|
37
|
+
- Twilio: SMS messaging
|
|
38
|
+
|
|
39
|
+
RESEARCH:
|
|
40
|
+
- SerpAPI Tool: Web search capabilities for AI Agents
|
|
41
|
+
- Perplexity Tool: AI-powered search for AI Agents
|
|
42
|
+
|
|
43
|
+
CHATBOTS:
|
|
44
|
+
- Slack/Telegram/WhatsApp nodes: Platform-specific chatbots
|
|
45
|
+
- Chat Trigger: n8n-hosted chat interface
|
|
46
|
+
|
|
47
|
+
MEDIA:
|
|
48
|
+
- OpenAI: DALL-E image generation, Sora video, Whisper transcription
|
|
49
|
+
- Google Gemini: Imagen image generation`;
|
|
50
|
+
exports.BASELINE_FLOW_CONTROL = `Baseline flow control nodes (used in most workflows):
|
|
51
|
+
|
|
52
|
+
- n8n-nodes-base.aggregate: Combines multiple items into one item
|
|
53
|
+
- n8n-nodes-base.if: Routes items based on true/false condition
|
|
54
|
+
- n8n-nodes-base.switch: Routes items to different paths based on rules or expressions
|
|
55
|
+
- n8n-nodes-base.splitOut: Expands a single item containing an array into multiple individual items
|
|
56
|
+
- n8n-nodes-base.merge: Combines data from multiple parallel branches (for 3+ inputs: mode="append" + numberInputs)
|
|
57
|
+
- n8n-nodes-base.set: Transforms and restructures data fields`;
|
|
58
|
+
//# sourceMappingURL=use-case-patterns.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-case-patterns.js","sourceRoot":"","sources":["../../../src/prompts/node-selection/use-case-patterns.ts"],"names":[],"mappings":";;;AAAa,QAAA,uBAAuB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yCA6CE,CAAC;AAE7B,QAAA,qBAAqB,GAAG;;;;;;;8DAOyB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ADDITIONAL_FUNCTIONS = "Additional SDK functions:\n\n- `placeholder('hint')` \u2014 marks a parameter value for user input. Use directly as the parameter value \u2014 never wrap in `expr()`, objects, or arrays.\n Example: `parameters: { url: placeholder('Your API URL (e.g. https://api.example.com/v1)') }`\n\n- `sticky('content', nodes?, config?)` \u2014 creates a sticky note on the canvas.\n Example: `sticky('## Data Processing', [httpNode, setNode], { color: 2 })`\n\n- `.output(n)` \u2014 selects a specific output index for multi-output nodes. IF and Switch have dedicated methods (`onTrue/onFalse`, `onCase`), but `.output(n)` works as a generic alternative.\n Example: `classifier.output(1).to(categoryB)`\n\n- `.onError(handler)` \u2014 connects a node's error output to a handler node. Requires `onError: 'continueErrorOutput'` in the node config.\n Example: `httpNode.onError(errorHandler)` (with `config: { onError: 'continueErrorOutput' }`)\n\n- Additional subnode factories (all follow the same pattern as `languageModel()` and `tool()`):\n `memory()`, `outputParser()`, `embeddings()`, `vectorStore()`, `retriever()`, `documentLoader()`, `textSplitter()`";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ADDITIONAL_FUNCTIONS = void 0;
|
|
4
|
+
exports.ADDITIONAL_FUNCTIONS = `Additional SDK functions:
|
|
5
|
+
|
|
6
|
+
- \`placeholder('hint')\` — marks a parameter value for user input. Use directly as the parameter value — never wrap in \`expr()\`, objects, or arrays.
|
|
7
|
+
Example: \`parameters: { url: placeholder('Your API URL (e.g. https://api.example.com/v1)') }\`
|
|
8
|
+
|
|
9
|
+
- \`sticky('content', nodes?, config?)\` — creates a sticky note on the canvas.
|
|
10
|
+
Example: \`sticky('## Data Processing', [httpNode, setNode], { color: 2 })\`
|
|
11
|
+
|
|
12
|
+
- \`.output(n)\` — selects a specific output index for multi-output nodes. IF and Switch have dedicated methods (\`onTrue/onFalse\`, \`onCase\`), but \`.output(n)\` works as a generic alternative.
|
|
13
|
+
Example: \`classifier.output(1).to(categoryB)\`
|
|
14
|
+
|
|
15
|
+
- \`.onError(handler)\` — connects a node's error output to a handler node. Requires \`onError: 'continueErrorOutput'\` in the node config.
|
|
16
|
+
Example: \`httpNode.onError(errorHandler)\` (with \`config: { onError: 'continueErrorOutput' }\`)
|
|
17
|
+
|
|
18
|
+
- Additional subnode factories (all follow the same pattern as \`languageModel()\` and \`tool()\`):
|
|
19
|
+
\`memory()\`, \`outputParser()\`, \`embeddings()\`, \`vectorStore()\`, \`retriever()\`, \`documentLoader()\`, \`textSplitter()\``;
|
|
20
|
+
//# sourceMappingURL=additional-functions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"additional-functions.js","sourceRoot":"","sources":["../../../src/prompts/sdk-reference/additional-functions.ts"],"names":[],"mappings":";;;AAQa,QAAA,oBAAoB,GAAG;;;;;;;;;;;;;;;mIAe+F,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const EXPRESSION_REFERENCE = "Available variables inside `expr('{{ ... }}')`:\n\n- `$json` \u2014 current item's JSON data from the immediate predecessor node\n- `$('NodeName').item.json` \u2014 access any node's output by name\n- `$input.first()` \u2014 first item from immediate predecessor\n- `$input.all()` \u2014 all items from immediate predecessor\n- `$input.item` \u2014 current item being processed\n- `$binary` \u2014 binary data of current item from immediate predecessor\n- `$now` \u2014 current date/time (Luxon DateTime). Example: `$now.toISO()`\n- `$today` \u2014 start of today (Luxon DateTime). Example: `$today.plus(1, 'days')`\n- `$itemIndex` \u2014 index of current item being processed\n- `$runIndex` \u2014 current run index\n- `$execution.id` \u2014 unique execution ID\n- `$execution.mode` \u2014 'test' or 'production'\n- `$workflow.id` \u2014 workflow ID\n- `$workflow.name` \u2014 workflow name\n\nString composition \u2014 variables MUST always be inside `{{ }}`, never outside as JS variables:\n\n- `expr('Hello {{ $json.name }}, welcome!')` \u2014 variable embedded in text\n- `expr('Report for {{ $now.toFormat(\"MMMM d, yyyy\") }} - {{ $json.title }}')` \u2014 multiple variables with method call\n- `expr('{{ $json.firstName }} {{ $json.lastName }}')` \u2014 combining multiple fields\n- `expr('Total: {{ $json.items.length }} items, updated {{ $now.toISO() }}')` \u2014 expressions with method calls\n- `expr('Status: {{ $json.count > 0 ? \"active\" : \"empty\" }}')` \u2014 inline ternary\n\nDynamic data from other nodes \u2014 `$()` MUST always be inside `{{ }}`, never used as plain JavaScript:\n\n- WRONG: `expr('{{ ' + JSON.stringify($('Source').all().map(i => i.json.name)) + ' }}')` \u2014 $() outside {{ }}\n- CORRECT: `expr('{{ $(\"Source\").all().map(i => ({ option: i.json.name })) }}')` \u2014 $() inside {{ }}\n- CORRECT: `expr('{{ { \"fields\": [{ \"values\": $(\"Fetch Projects\").all().map(i => ({ option: i.json.name })) }] } }}')` \u2014 complex JSON inside {{ }}";
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EXPRESSION_REFERENCE = void 0;
|
|
4
|
+
exports.EXPRESSION_REFERENCE = `Available variables inside \`expr('{{ ... }}')\`:
|
|
5
|
+
|
|
6
|
+
- \`$json\` — current item's JSON data from the immediate predecessor node
|
|
7
|
+
- \`$('NodeName').item.json\` — access any node's output by name
|
|
8
|
+
- \`$input.first()\` — first item from immediate predecessor
|
|
9
|
+
- \`$input.all()\` — all items from immediate predecessor
|
|
10
|
+
- \`$input.item\` — current item being processed
|
|
11
|
+
- \`$binary\` — binary data of current item from immediate predecessor
|
|
12
|
+
- \`$now\` — current date/time (Luxon DateTime). Example: \`$now.toISO()\`
|
|
13
|
+
- \`$today\` — start of today (Luxon DateTime). Example: \`$today.plus(1, 'days')\`
|
|
14
|
+
- \`$itemIndex\` — index of current item being processed
|
|
15
|
+
- \`$runIndex\` — current run index
|
|
16
|
+
- \`$execution.id\` — unique execution ID
|
|
17
|
+
- \`$execution.mode\` — 'test' or 'production'
|
|
18
|
+
- \`$workflow.id\` — workflow ID
|
|
19
|
+
- \`$workflow.name\` — workflow name
|
|
20
|
+
|
|
21
|
+
String composition — variables MUST always be inside \`{{ }}\`, never outside as JS variables:
|
|
22
|
+
|
|
23
|
+
- \`expr('Hello {{ $json.name }}, welcome!')\` — variable embedded in text
|
|
24
|
+
- \`expr('Report for {{ $now.toFormat("MMMM d, yyyy") }} - {{ $json.title }}')\` — multiple variables with method call
|
|
25
|
+
- \`expr('{{ $json.firstName }} {{ $json.lastName }}')\` — combining multiple fields
|
|
26
|
+
- \`expr('Total: {{ $json.items.length }} items, updated {{ $now.toISO() }}')\` — expressions with method calls
|
|
27
|
+
- \`expr('Status: {{ $json.count > 0 ? "active" : "empty" }}')\` — inline ternary
|
|
28
|
+
|
|
29
|
+
Dynamic data from other nodes — \`$()\` MUST always be inside \`{{ }}\`, never used as plain JavaScript:
|
|
30
|
+
|
|
31
|
+
- WRONG: \`expr('{{ ' + JSON.stringify($('Source').all().map(i => i.json.name)) + ' }}')\` — $() outside {{ }}
|
|
32
|
+
- CORRECT: \`expr('{{ $("Source").all().map(i => ({ option: i.json.name })) }}')\` — $() inside {{ }}
|
|
33
|
+
- CORRECT: \`expr('{{ { "fields": [{ "values": $("Fetch Projects").all().map(i => ({ option: i.json.name })) }] } }}')\` — complex JSON inside {{ }}`;
|
|
34
|
+
//# sourceMappingURL=expressions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expressions.js","sourceRoot":"","sources":["../../../src/prompts/sdk-reference/expressions.ts"],"names":[],"mappings":";;;AAQa,QAAA,oBAAoB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qJA6BiH,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { EXPRESSION_REFERENCE } from './expressions';
|
|
2
|
+
export { ADDITIONAL_FUNCTIONS } from './additional-functions';
|
|
3
|
+
export { WORKFLOW_RULES } from './workflow-rules';
|
|
4
|
+
export { WORKFLOW_SDK_PATTERNS } from './workflow-patterns';
|
|
5
|
+
export { WORKFLOW_PATTERNS_DETAILED } from './workflow-patterns-detailed';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WORKFLOW_PATTERNS_DETAILED = exports.WORKFLOW_SDK_PATTERNS = exports.WORKFLOW_RULES = exports.ADDITIONAL_FUNCTIONS = exports.EXPRESSION_REFERENCE = void 0;
|
|
4
|
+
var expressions_1 = require("./expressions");
|
|
5
|
+
Object.defineProperty(exports, "EXPRESSION_REFERENCE", { enumerable: true, get: function () { return expressions_1.EXPRESSION_REFERENCE; } });
|
|
6
|
+
var additional_functions_1 = require("./additional-functions");
|
|
7
|
+
Object.defineProperty(exports, "ADDITIONAL_FUNCTIONS", { enumerable: true, get: function () { return additional_functions_1.ADDITIONAL_FUNCTIONS; } });
|
|
8
|
+
var workflow_rules_1 = require("./workflow-rules");
|
|
9
|
+
Object.defineProperty(exports, "WORKFLOW_RULES", { enumerable: true, get: function () { return workflow_rules_1.WORKFLOW_RULES; } });
|
|
10
|
+
var workflow_patterns_1 = require("./workflow-patterns");
|
|
11
|
+
Object.defineProperty(exports, "WORKFLOW_SDK_PATTERNS", { enumerable: true, get: function () { return workflow_patterns_1.WORKFLOW_SDK_PATTERNS; } });
|
|
12
|
+
var workflow_patterns_detailed_1 = require("./workflow-patterns-detailed");
|
|
13
|
+
Object.defineProperty(exports, "WORKFLOW_PATTERNS_DETAILED", { enumerable: true, get: function () { return workflow_patterns_detailed_1.WORKFLOW_PATTERNS_DETAILED; } });
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/prompts/sdk-reference/index.ts"],"names":[],"mappings":";;;AAAA,6CAAqD;AAA5C,mHAAA,oBAAoB,OAAA;AAC7B,+DAA8D;AAArD,4HAAA,oBAAoB,OAAA;AAC7B,mDAAkD;AAAzC,gHAAA,cAAc,OAAA;AACvB,yDAA4D;AAAnD,0HAAA,qBAAqB,OAAA;AAC9B,2EAA0E;AAAjE,wIAAA,0BAA0B,OAAA"}
|