@n8n/ai-workflow-builder 1.16.0 → 1.17.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/build.tsbuildinfo +1 -1
- package/dist/code-builder/index.d.ts +1 -1
- package/dist/code-builder/index.js +4 -4
- package/dist/code-builder/index.js.map +1 -1
- package/dist/code-builder/prompts/index.js +4 -4
- package/dist/code-builder/prompts/index.js.map +1 -1
- package/dist/prompts/chains/parameter-updater/guides/index.d.ts +1 -11
- package/dist/prompts/chains/parameter-updater/guides/index.js +12 -22
- package/dist/prompts/chains/parameter-updater/guides/index.js.map +1 -1
- package/dist/prompts/chains/parameter-updater/types.d.ts +1 -18
- package/dist/prompts/shared/node-guidance/index.d.ts +1 -2
- package/dist/prompts/shared/node-guidance/index.js +3 -4
- package/dist/prompts/shared/node-guidance/index.js.map +1 -1
- package/dist/prompts/shared/node-recommendations/index.d.ts +2 -2
- package/dist/prompts/shared/node-recommendations/index.js +6 -11
- package/dist/prompts/shared/node-recommendations/index.js.map +1 -1
- package/dist/tools/best-practices/index.d.ts +1 -3
- package/dist/tools/best-practices/index.js +2 -30
- package/dist/tools/best-practices/index.js.map +1 -1
- package/dist/types/best-practices.d.ts +1 -6
- package/dist/types/categorization.d.ts +2 -20
- package/dist/types/categorization.js +3 -36
- package/dist/types/categorization.js.map +1 -1
- package/dist/types/node-guidance.d.ts +1 -7
- package/dist/types/node-recommendations.d.ts +1 -26
- package/dist/types/node-recommendations.js +3 -12
- package/dist/types/node-recommendations.js.map +1 -1
- package/package.json +8 -8
- package/dist/prompts/chains/parameter-updater/guides/embedding-nodes.d.ts +0 -2
- package/dist/prompts/chains/parameter-updater/guides/embedding-nodes.js +0 -70
- package/dist/prompts/chains/parameter-updater/guides/embedding-nodes.js.map +0 -1
- package/dist/prompts/chains/parameter-updater/guides/gmail.d.ts +0 -2
- package/dist/prompts/chains/parameter-updater/guides/gmail.js +0 -53
- package/dist/prompts/chains/parameter-updater/guides/gmail.js.map +0 -1
- package/dist/prompts/chains/parameter-updater/guides/http-request.d.ts +0 -2
- package/dist/prompts/chains/parameter-updater/guides/http-request.js +0 -139
- package/dist/prompts/chains/parameter-updater/guides/http-request.js.map +0 -1
- package/dist/prompts/chains/parameter-updater/guides/if-node.d.ts +0 -2
- package/dist/prompts/chains/parameter-updater/guides/if-node.js +0 -159
- package/dist/prompts/chains/parameter-updater/guides/if-node.js.map +0 -1
- package/dist/prompts/chains/parameter-updater/guides/predecessor-output.d.ts +0 -2
- package/dist/prompts/chains/parameter-updater/guides/predecessor-output.js +0 -25
- package/dist/prompts/chains/parameter-updater/guides/predecessor-output.js.map +0 -1
- package/dist/prompts/chains/parameter-updater/guides/resource-locator.d.ts +0 -2
- package/dist/prompts/chains/parameter-updater/guides/resource-locator.js +0 -40
- package/dist/prompts/chains/parameter-updater/guides/resource-locator.js.map +0 -1
- package/dist/prompts/chains/parameter-updater/guides/set-node.d.ts +0 -2
- package/dist/prompts/chains/parameter-updater/guides/set-node.js +0 -94
- package/dist/prompts/chains/parameter-updater/guides/set-node.js.map +0 -1
- package/dist/prompts/chains/parameter-updater/guides/switch-node.d.ts +0 -2
- package/dist/prompts/chains/parameter-updater/guides/switch-node.js +0 -75
- package/dist/prompts/chains/parameter-updater/guides/switch-node.js.map +0 -1
- package/dist/prompts/chains/parameter-updater/guides/system-message.d.ts +0 -2
- package/dist/prompts/chains/parameter-updater/guides/system-message.js +0 -96
- package/dist/prompts/chains/parameter-updater/guides/system-message.js.map +0 -1
- package/dist/prompts/chains/parameter-updater/guides/text-fields.d.ts +0 -2
- package/dist/prompts/chains/parameter-updater/guides/text-fields.js +0 -31
- package/dist/prompts/chains/parameter-updater/guides/text-fields.js.map +0 -1
- package/dist/prompts/chains/parameter-updater/guides/tool-nodes.d.ts +0 -2
- package/dist/prompts/chains/parameter-updater/guides/tool-nodes.js +0 -76
- package/dist/prompts/chains/parameter-updater/guides/tool-nodes.js.map +0 -1
- package/dist/prompts/shared/node-guidance/structured-output-parser.d.ts +0 -2
- package/dist/prompts/shared/node-guidance/structured-output-parser.js +0 -35
- package/dist/prompts/shared/node-guidance/structured-output-parser.js.map +0 -1
- package/dist/prompts/shared/node-guidance/webhook.d.ts +0 -2
- package/dist/prompts/shared/node-guidance/webhook.js +0 -38
- package/dist/prompts/shared/node-guidance/webhook.js.map +0 -1
- package/dist/prompts/shared/node-recommendations/audio-generation.d.ts +0 -2
- package/dist/prompts/shared/node-recommendations/audio-generation.js +0 -18
- package/dist/prompts/shared/node-recommendations/audio-generation.js.map +0 -1
- package/dist/prompts/shared/node-recommendations/image-generation.d.ts +0 -2
- package/dist/prompts/shared/node-recommendations/image-generation.js +0 -18
- package/dist/prompts/shared/node-recommendations/image-generation.js.map +0 -1
- package/dist/prompts/shared/node-recommendations/text-manipulation.d.ts +0 -2
- package/dist/prompts/shared/node-recommendations/text-manipulation.js +0 -27
- package/dist/prompts/shared/node-recommendations/text-manipulation.js.map +0 -1
- package/dist/prompts/shared/node-recommendations/utils/format-recommendation.d.ts +0 -2
- package/dist/prompts/shared/node-recommendations/utils/format-recommendation.js +0 -24
- package/dist/prompts/shared/node-recommendations/utils/format-recommendation.js.map +0 -1
- package/dist/prompts/shared/node-recommendations/video-generation.d.ts +0 -2
- package/dist/prompts/shared/node-recommendations/video-generation.js +0 -15
- package/dist/prompts/shared/node-recommendations/video-generation.js.map +0 -1
- package/dist/shared/code-builder-and-mcp-prompt-constants.d.ts +0 -3
- package/dist/shared/code-builder-and-mcp-prompt-constants.js +0 -57
- package/dist/shared/code-builder-and-mcp-prompt-constants.js.map +0 -1
- package/dist/tools/best-practices/chatbot.d.ts +0 -7
- package/dist/tools/best-practices/chatbot.js +0 -118
- package/dist/tools/best-practices/chatbot.js.map +0 -1
- package/dist/tools/best-practices/content-generation.d.ts +0 -7
- package/dist/tools/best-practices/content-generation.js +0 -115
- package/dist/tools/best-practices/content-generation.js.map +0 -1
- package/dist/tools/best-practices/data-analysis.d.ts +0 -7
- package/dist/tools/best-practices/data-analysis.js +0 -367
- package/dist/tools/best-practices/data-analysis.js.map +0 -1
- package/dist/tools/best-practices/data-extraction.d.ts +0 -7
- package/dist/tools/best-practices/data-extraction.js +0 -122
- package/dist/tools/best-practices/data-extraction.js.map +0 -1
- package/dist/tools/best-practices/data-persistence.d.ts +0 -7
- package/dist/tools/best-practices/data-persistence.js +0 -197
- package/dist/tools/best-practices/data-persistence.js.map +0 -1
- package/dist/tools/best-practices/data-transformation.d.ts +0 -7
- package/dist/tools/best-practices/data-transformation.js +0 -146
- package/dist/tools/best-practices/data-transformation.js.map +0 -1
- package/dist/tools/best-practices/document-processing.d.ts +0 -7
- package/dist/tools/best-practices/document-processing.js +0 -332
- package/dist/tools/best-practices/document-processing.js.map +0 -1
- package/dist/tools/best-practices/enrichment.d.ts +0 -7
- package/dist/tools/best-practices/enrichment.js +0 -271
- package/dist/tools/best-practices/enrichment.js.map +0 -1
- package/dist/tools/best-practices/form-input.d.ts +0 -7
- package/dist/tools/best-practices/form-input.js +0 -173
- package/dist/tools/best-practices/form-input.js.map +0 -1
- package/dist/tools/best-practices/human-in-the-loop.d.ts +0 -7
- package/dist/tools/best-practices/human-in-the-loop.js +0 -268
- package/dist/tools/best-practices/human-in-the-loop.js.map +0 -1
- package/dist/tools/best-practices/knowledge-base.d.ts +0 -7
- package/dist/tools/best-practices/knowledge-base.js +0 -268
- package/dist/tools/best-practices/knowledge-base.js.map +0 -1
- package/dist/tools/best-practices/monitoring.d.ts +0 -7
- package/dist/tools/best-practices/monitoring.js +0 -171
- package/dist/tools/best-practices/monitoring.js.map +0 -1
- package/dist/tools/best-practices/notification.d.ts +0 -7
- package/dist/tools/best-practices/notification.js +0 -135
- package/dist/tools/best-practices/notification.js.map +0 -1
- package/dist/tools/best-practices/scheduling.d.ts +0 -7
- package/dist/tools/best-practices/scheduling.js +0 -152
- package/dist/tools/best-practices/scheduling.js.map +0 -1
- package/dist/tools/best-practices/scraping-and-research.d.ts +0 -7
- package/dist/tools/best-practices/scraping-and-research.js +0 -158
- package/dist/tools/best-practices/scraping-and-research.js.map +0 -1
- package/dist/tools/best-practices/triage.d.ts +0 -7
- package/dist/tools/best-practices/triage.js +0 -149
- package/dist/tools/best-practices/triage.js.map +0 -1
|
@@ -1,96 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"system-message.js","sourceRoot":"","sources":["../../../../../src/prompts/chains/parameter-updater/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"}
|
|
@@ -1,31 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"text-fields.js","sourceRoot":"","sources":["../../../../../src/prompts/chains/parameter-updater/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"}
|
|
@@ -1,76 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tool-nodes.js","sourceRoot":"","sources":["../../../../../src/prompts/chains/parameter-updater/guides/tool-nodes.ts"],"names":[],"mappings":";;;AAEa,QAAA,gBAAgB,GAAkB;IAC9C,QAAQ,EAAE,CAAC,OAAO,CAAC;IACnB,OAAO,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2CAoEiC;CAC1C,CAAC"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.structuredOutputParser = void 0;
|
|
4
|
-
exports.structuredOutputParser = {
|
|
5
|
-
nodeType: '@n8n/n8n-nodes-langchain.outputParserStructured',
|
|
6
|
-
usage: `Search for "Structured Output Parser" (@n8n/n8n-nodes-langchain.outputParserStructured) when:
|
|
7
|
-
- AI output will be used programmatically (conditions, formatting, database storage, API calls)
|
|
8
|
-
- AI needs to extract specific fields (e.g., score, category, priority, action items)
|
|
9
|
-
- AI needs to classify/categorize data into defined categories
|
|
10
|
-
- Downstream nodes need to access specific fields from AI response (e.g., $json.score, $json.category)
|
|
11
|
-
- Output will be displayed in a formatted way (e.g., HTML email with specific sections)
|
|
12
|
-
- Data needs validation against a schema before processing
|
|
13
|
-
|
|
14
|
-
- Always use search_nodes to find the exact node names and versions - NEVER guess versions`,
|
|
15
|
-
connections: `When Discovery results include AI Agent or Structured Output Parser:
|
|
16
|
-
1. Create the Structured Output Parser node
|
|
17
|
-
2. Set AI Agent's hasOutputParser: true in initialParameters
|
|
18
|
-
3. Connect: Structured Output Parser → AI Agent (ai_outputParser connection)`,
|
|
19
|
-
configuration: `WHEN TO SET hasOutputParser: true on AI Agent:
|
|
20
|
-
- Discovery found Structured Output Parser node → MUST set hasOutputParser: true
|
|
21
|
-
- AI output will be used in conditions (IF/Switch nodes checking $json.field)
|
|
22
|
-
- AI output will be formatted/displayed (HTML emails, reports with specific sections)
|
|
23
|
-
- AI output will be stored in database/data tables with specific fields
|
|
24
|
-
- AI is classifying, scoring, or extracting specific data fields`,
|
|
25
|
-
recommendation: `For AI-generated structured data, prefer Structured Output Parser nodes over Code nodes.
|
|
26
|
-
Why: Purpose-built parsers are more reliable and handle edge cases better than custom code.
|
|
27
|
-
|
|
28
|
-
For binary file data, use Extract From File node to extract content from files before processing.
|
|
29
|
-
|
|
30
|
-
Use Code nodes only for:
|
|
31
|
-
- Simple string manipulations
|
|
32
|
-
- Already structured data (JSON, CSV)
|
|
33
|
-
- Custom business logic beyond parsing`,
|
|
34
|
-
};
|
|
35
|
-
//# sourceMappingURL=structured-output-parser.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"structured-output-parser.js","sourceRoot":"","sources":["../../../../src/prompts/shared/node-guidance/structured-output-parser.ts"],"names":[],"mappings":";;;AAEa,QAAA,sBAAsB,GAAiB;IACnD,QAAQ,EAAE,iDAAiD;IAE3D,KAAK,EAAE;;;;;;;;2FAQmF;IAE1F,WAAW,EAAE;;;6EAG+D;IAE5E,aAAa,EAAE;;;;;iEAKiD;IAEhE,cAAc,EAAE;;;;;;;;uCAQsB;CACtC,CAAC"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.webhook = void 0;
|
|
4
|
-
exports.webhook = {
|
|
5
|
-
nodeType: 'n8n-nodes-base.webhook',
|
|
6
|
-
usage: `Search for "Webhook" (n8n-nodes-base.webhook) when:
|
|
7
|
-
- Workflow needs to receive HTTP requests from external services
|
|
8
|
-
- API callbacks, webhooks, or HTTP endpoints are needed
|
|
9
|
-
- Integration requires real-time event handling from external systems`,
|
|
10
|
-
connections: `WEBHOOK RESPONSE MODE RULES - CRITICAL:
|
|
11
|
-
|
|
12
|
-
Response modes and their requirements:
|
|
13
|
-
- "onReceived" (Immediately): Responds instantly when webhook is called. No RespondToWebhook node needed.
|
|
14
|
-
- "lastNode" (When Last Node Finishes): Responds with data from last node. No RespondToWebhook node needed.
|
|
15
|
-
- "responseNode" (Using Respond to Webhook Node): REQUIRES a RespondToWebhook node connected downstream.
|
|
16
|
-
|
|
17
|
-
RULE 1: If responseMode='responseNode', you MUST add a RespondToWebhook node
|
|
18
|
-
RULE 2: If RespondToWebhook node exists, responseMode MUST be 'responseNode'
|
|
19
|
-
|
|
20
|
-
Pattern for custom response control:
|
|
21
|
-
Webhook (responseMode: responseNode) → [Processing] → RespondToWebhook`,
|
|
22
|
-
configuration: `WEBHOOK RESPONSE MODE CONFIGURATION:
|
|
23
|
-
|
|
24
|
-
Choose responseMode based on use case:
|
|
25
|
-
- "onReceived": Quick acknowledgment, processing happens async
|
|
26
|
-
- "lastNode": Return processed data, simple request-response flows
|
|
27
|
-
- "responseNode": Full control over response timing, headers, status codes
|
|
28
|
-
|
|
29
|
-
CRITICAL: When user needs to control response content/timing/headers, set responseMode='responseNode' AND add RespondToWebhook node.
|
|
30
|
-
|
|
31
|
-
When NOT to use responseNode:
|
|
32
|
-
- Simple acknowledgments (use 'onReceived')
|
|
33
|
-
- Return last node output directly (use 'lastNode')`,
|
|
34
|
-
recommendation: `For webhook workflows requiring custom response handling (status codes, headers, delayed response), use responseMode='responseNode' with a RespondToWebhook node.
|
|
35
|
-
|
|
36
|
-
For simple webhook acknowledgments or direct data return, use 'onReceived' or 'lastNode' modes respectively.`,
|
|
37
|
-
};
|
|
38
|
-
//# sourceMappingURL=webhook.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"webhook.js","sourceRoot":"","sources":["../../../../src/prompts/shared/node-guidance/webhook.ts"],"names":[],"mappings":";;;AAEa,QAAA,OAAO,GAAiB;IACpC,QAAQ,EAAE,wBAAwB;IAElC,KAAK,EAAE;;;sEAG8D;IAErE,WAAW,EAAE;;;;;;;;;;;uEAWyD;IAEtE,aAAa,EAAE;;;;;;;;;;;oDAWoC;IAEnD,cAAc,EAAE;;6GAE4F;CAC5G,CAAC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.audioGenerationRecommendation = void 0;
|
|
4
|
-
const node_recommendations_1 = require("../../../types/node-recommendations");
|
|
5
|
-
exports.audioGenerationRecommendation = {
|
|
6
|
-
category: node_recommendations_1.RecommendationCategory.AUDIO_GENERATION,
|
|
7
|
-
version: '1.0.0',
|
|
8
|
-
recommendation: {
|
|
9
|
-
defaultNode: '@n8n/n8n-nodes-langchain.openAi',
|
|
10
|
-
operations: [
|
|
11
|
-
'Generate Audio: Create speech from text using OpenAI TTS',
|
|
12
|
-
'Transcribe a Recording: Convert audio to text using Whisper',
|
|
13
|
-
'Translate a Recording: Transcribe and translate audio to English using Whisper',
|
|
14
|
-
],
|
|
15
|
-
reasoning: "OpenAI provides comprehensive audio capabilities: TTS for speech generation, Whisper for transcription and translation. Prefer OpenAI when user doesn't specify a provider.",
|
|
16
|
-
},
|
|
17
|
-
};
|
|
18
|
-
//# sourceMappingURL=audio-generation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"audio-generation.js","sourceRoot":"","sources":["../../../../src/prompts/shared/node-recommendations/audio-generation.ts"],"names":[],"mappings":";;;AAAA,uEAGsC;AAEzB,QAAA,6BAA6B,GAA+B;IACxE,QAAQ,EAAE,6CAAsB,CAAC,gBAAgB;IACjD,OAAO,EAAE,OAAO;IAChB,cAAc,EAAE;QACf,WAAW,EAAE,iCAAiC;QAC9C,UAAU,EAAE;YACX,0DAA0D;YAC1D,6DAA6D;YAC7D,gFAAgF;SAChF;QACD,SAAS,EACR,6KAA6K;KAC9K;CACD,CAAC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.imageGenerationRecommendation = void 0;
|
|
4
|
-
const node_recommendations_1 = require("../../../types/node-recommendations");
|
|
5
|
-
exports.imageGenerationRecommendation = {
|
|
6
|
-
category: node_recommendations_1.RecommendationCategory.IMAGE_GENERATION,
|
|
7
|
-
version: '1.0.0',
|
|
8
|
-
recommendation: {
|
|
9
|
-
defaultNode: '@n8n/n8n-nodes-langchain.openAi',
|
|
10
|
-
operations: [
|
|
11
|
-
'Analyze Image: Analyze and describe image content using GPT-4 Vision',
|
|
12
|
-
'Generate an Image: Create images from text prompts using DALL-E',
|
|
13
|
-
'Edit Image: Modify existing images using DALL-E',
|
|
14
|
-
],
|
|
15
|
-
reasoning: "OpenAI provides comprehensive image capabilities: DALL-E for generation/editing, GPT-4 Vision for analysis. Prefer OpenAI when user doesn't specify a provider.",
|
|
16
|
-
},
|
|
17
|
-
};
|
|
18
|
-
//# sourceMappingURL=image-generation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"image-generation.js","sourceRoot":"","sources":["../../../../src/prompts/shared/node-recommendations/image-generation.ts"],"names":[],"mappings":";;;AAAA,uEAGsC;AAEzB,QAAA,6BAA6B,GAA+B;IACxE,QAAQ,EAAE,6CAAsB,CAAC,gBAAgB;IACjD,OAAO,EAAE,OAAO;IAChB,cAAc,EAAE;QACf,WAAW,EAAE,iCAAiC;QAC9C,UAAU,EAAE;YACX,sEAAsE;YACtE,iEAAiE;YACjE,iDAAiD;SACjD;QACD,SAAS,EACR,iKAAiK;KAClK;CACD,CAAC"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.textManipulationRecommendation = void 0;
|
|
4
|
-
const node_recommendations_1 = require("../../../types/node-recommendations");
|
|
5
|
-
exports.textManipulationRecommendation = {
|
|
6
|
-
category: node_recommendations_1.RecommendationCategory.TEXT_MANIPULATION,
|
|
7
|
-
version: '1.0.0',
|
|
8
|
-
recommendation: {
|
|
9
|
-
defaultNode: '@n8n/n8n-nodes-langchain.agent',
|
|
10
|
-
operations: [
|
|
11
|
-
'Text summarization',
|
|
12
|
-
'Content analysis and extraction',
|
|
13
|
-
'Classification and categorization',
|
|
14
|
-
'Chat and conversational AI',
|
|
15
|
-
'Content generation and writing',
|
|
16
|
-
],
|
|
17
|
-
reasoning: 'The AI Agent node is the default for text manipulation tasks. New users receive free OpenAI credits. Do NOT use provider-specific nodes directly.',
|
|
18
|
-
connectedNodes: [
|
|
19
|
-
{
|
|
20
|
-
nodeType: '@n8n/n8n-nodes-langchain.lmChatOpenAi',
|
|
21
|
-
connectionType: 'ai_languageModel',
|
|
22
|
-
description: 'Required chat model for the AI Agent',
|
|
23
|
-
},
|
|
24
|
-
],
|
|
25
|
-
},
|
|
26
|
-
};
|
|
27
|
-
//# sourceMappingURL=text-manipulation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"text-manipulation.js","sourceRoot":"","sources":["../../../../src/prompts/shared/node-recommendations/text-manipulation.ts"],"names":[],"mappings":";;;AAAA,uEAGsC;AAEzB,QAAA,8BAA8B,GAA+B;IACzE,QAAQ,EAAE,6CAAsB,CAAC,iBAAiB;IAClD,OAAO,EAAE,OAAO;IAChB,cAAc,EAAE;QACf,WAAW,EAAE,gCAAgC;QAC7C,UAAU,EAAE;YACX,oBAAoB;YACpB,iCAAiC;YACjC,mCAAmC;YACnC,4BAA4B;YAC5B,gCAAgC;SAChC;QACD,SAAS,EACR,mJAAmJ;QACpJ,cAAc,EAAE;YACf;gBACC,QAAQ,EAAE,uCAAuC;gBACjD,cAAc,EAAE,kBAAkB;gBAClC,WAAW,EAAE,sCAAsC;aACnD;SACD;KACD;CACD,CAAC"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.formatRecommendation = formatRecommendation;
|
|
4
|
-
const builder_1 = require("../../../../prompts/builder");
|
|
5
|
-
function formatRecommendation(rec) {
|
|
6
|
-
const builder = (0, builder_1.prompt)()
|
|
7
|
-
.section('default_node', rec.defaultNode)
|
|
8
|
-
.section('operations', rec.operations.map((op) => `- ${op}`).join('\n'))
|
|
9
|
-
.section('reasoning', rec.reasoning);
|
|
10
|
-
if (rec.connectedNodes && rec.connectedNodes.length > 0) {
|
|
11
|
-
const connectedContent = rec.connectedNodes
|
|
12
|
-
.map((cn) => {
|
|
13
|
-
const desc = cn.description ? ` - ${cn.description}` : '';
|
|
14
|
-
return `- ${cn.nodeType} (connection: ${cn.connectionType})${desc}`;
|
|
15
|
-
})
|
|
16
|
-
.join('\n');
|
|
17
|
-
builder.section('connected_nodes', connectedContent);
|
|
18
|
-
}
|
|
19
|
-
if (rec.note) {
|
|
20
|
-
builder.section('note', rec.note);
|
|
21
|
-
}
|
|
22
|
-
return builder.build();
|
|
23
|
-
}
|
|
24
|
-
//# sourceMappingURL=format-recommendation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"format-recommendation.js","sourceRoot":"","sources":["../../../../../src/prompts/shared/node-recommendations/utils/format-recommendation.ts"],"names":[],"mappings":";;AAMA,oDAuBC;AA7BD,+CAA2C;AAM3C,SAAgB,oBAAoB,CAAC,GAAuB;IAC3D,MAAM,OAAO,GAAG,IAAA,gBAAM,GAAE;SACtB,OAAO,CAAC,cAAc,EAAE,GAAG,CAAC,WAAW,CAAC;SACxC,OAAO,CAAC,YAAY,EAAE,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SACvE,OAAO,CAAC,WAAW,EAAE,GAAG,CAAC,SAAS,CAAC,CAAC;IAGtC,IAAI,GAAG,CAAC,cAAc,IAAI,GAAG,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACzD,MAAM,gBAAgB,GAAG,GAAG,CAAC,cAAc;aACzC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE;YACX,MAAM,IAAI,GAAG,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC1D,OAAO,KAAK,EAAE,CAAC,QAAQ,iBAAiB,EAAE,CAAC,cAAc,IAAI,IAAI,EAAE,CAAC;QACrE,CAAC,CAAC;aACD,IAAI,CAAC,IAAI,CAAC,CAAC;QACb,OAAO,CAAC,OAAO,CAAC,iBAAiB,EAAE,gBAAgB,CAAC,CAAC;IACtD,CAAC;IAGD,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC;QACd,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;IAED,OAAO,OAAO,CAAC,KAAK,EAAE,CAAC;AACxB,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.videoGenerationRecommendation = void 0;
|
|
4
|
-
const node_recommendations_1 = require("../../../types/node-recommendations");
|
|
5
|
-
exports.videoGenerationRecommendation = {
|
|
6
|
-
category: node_recommendations_1.RecommendationCategory.VIDEO_GENERATION,
|
|
7
|
-
version: '1.0.0',
|
|
8
|
-
recommendation: {
|
|
9
|
-
defaultNode: '@n8n/n8n-nodes-langchain.openAi',
|
|
10
|
-
operations: ['Generate a Video: Create videos from text prompts using Sora'],
|
|
11
|
-
reasoning: "OpenAI Sora is the default for video generation. Prefer OpenAI when user doesn't specify a provider.",
|
|
12
|
-
note: 'Video generation may require async processing with Wait nodes due to longer generation times.',
|
|
13
|
-
},
|
|
14
|
-
};
|
|
15
|
-
//# sourceMappingURL=video-generation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"video-generation.js","sourceRoot":"","sources":["../../../../src/prompts/shared/node-recommendations/video-generation.ts"],"names":[],"mappings":";;;AAAA,uEAGsC;AAEzB,QAAA,6BAA6B,GAA+B;IACxE,QAAQ,EAAE,6CAAsB,CAAC,gBAAgB;IACjD,OAAO,EAAE,OAAO;IAChB,cAAc,EAAE;QACf,WAAW,EAAE,iCAAiC;QAC9C,UAAU,EAAE,CAAC,8DAA8D,CAAC;QAC5E,SAAS,EACR,sGAAsG;QACvG,IAAI,EAAE,+FAA+F;KACrG;CACD,CAAC"}
|
|
@@ -1,3 +0,0 @@
|
|
|
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 {{ }}";
|
|
2
|
-
export declare const ADDITIONAL_FUNCTIONS = "Additional SDK functions:\n\n- `placeholder('hint')` \u2014 marks a parameter value for user input. Use directly as the parameter value \u2014 never wrap in `expr()`, objects, or arrays.\n Example: `parameters: { url: placeholder('Your API URL (e.g. https://api.example.com/v1)') }`\n\n- `sticky('content', nodes?, config?)` \u2014 creates a sticky note on the canvas.\n Example: `sticky('## Data Processing', [httpNode, setNode], { color: 2 })`\n\n- `.output(n)` \u2014 selects a specific output index for multi-output nodes. IF and Switch have dedicated methods (`onTrue/onFalse`, `onCase`), but `.output(n)` works as a generic alternative.\n Example: `classifier.output(1).to(categoryB)`\n\n- `.onError(handler)` \u2014 connects a node's error output to a handler node. Requires `onError: 'continueErrorOutput'` in the node config.\n Example: `httpNode.onError(errorHandler)` (with `config: { onError: 'continueErrorOutput' }`)\n\n- Additional subnode factories (all follow the same pattern as `languageModel()` and `tool()`):\n `memory()`, `outputParser()`, `embeddings()`, `vectorStore()`, `retriever()`, `documentLoader()`, `textSplitter()`";
|
|
3
|
-
export declare const WORKFLOW_RULES = "Follow these rules strictly when generating workflows:\n\n1. **Always use newCredential() for authentication**\n - When a node needs credentials, always use `newCredential('Name')` in the credentials config\n - NEVER use placeholder strings, fake API keys, or hardcoded auth values\n - Example: `credentials: { slackApi: newCredential('Slack Bot') }`\n - The credential type must match what the node expects";
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WORKFLOW_RULES = exports.ADDITIONAL_FUNCTIONS = 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
|
-
exports.ADDITIONAL_FUNCTIONS = `Additional SDK functions:
|
|
35
|
-
|
|
36
|
-
- \`placeholder('hint')\` — marks a parameter value for user input. Use directly as the parameter value — never wrap in \`expr()\`, objects, or arrays.
|
|
37
|
-
Example: \`parameters: { url: placeholder('Your API URL (e.g. https://api.example.com/v1)') }\`
|
|
38
|
-
|
|
39
|
-
- \`sticky('content', nodes?, config?)\` — creates a sticky note on the canvas.
|
|
40
|
-
Example: \`sticky('## Data Processing', [httpNode, setNode], { color: 2 })\`
|
|
41
|
-
|
|
42
|
-
- \`.output(n)\` — selects a specific output index for multi-output nodes. IF and Switch have dedicated methods (\`onTrue/onFalse\`, \`onCase\`), but \`.output(n)\` works as a generic alternative.
|
|
43
|
-
Example: \`classifier.output(1).to(categoryB)\`
|
|
44
|
-
|
|
45
|
-
- \`.onError(handler)\` — connects a node's error output to a handler node. Requires \`onError: 'continueErrorOutput'\` in the node config.
|
|
46
|
-
Example: \`httpNode.onError(errorHandler)\` (with \`config: { onError: 'continueErrorOutput' }\`)
|
|
47
|
-
|
|
48
|
-
- Additional subnode factories (all follow the same pattern as \`languageModel()\` and \`tool()\`):
|
|
49
|
-
\`memory()\`, \`outputParser()\`, \`embeddings()\`, \`vectorStore()\`, \`retriever()\`, \`documentLoader()\`, \`textSplitter()\``;
|
|
50
|
-
exports.WORKFLOW_RULES = `Follow these rules strictly when generating workflows:
|
|
51
|
-
|
|
52
|
-
1. **Always use newCredential() for authentication**
|
|
53
|
-
- When a node needs credentials, always use \`newCredential('Name')\` in the credentials config
|
|
54
|
-
- NEVER use placeholder strings, fake API keys, or hardcoded auth values
|
|
55
|
-
- Example: \`credentials: { slackApi: newCredential('Slack Bot') }\`
|
|
56
|
-
- The credential type must match what the node expects`;
|
|
57
|
-
//# sourceMappingURL=code-builder-and-mcp-prompt-constants.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"code-builder-and-mcp-prompt-constants.js","sourceRoot":"","sources":["../../src/shared/code-builder-and-mcp-prompt-constants.ts"],"names":[],"mappings":";;;AAca,QAAA,oBAAoB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qJA6BiH,CAAC;AAKzI,QAAA,oBAAoB,GAAG;;;;;;;;;;;;;;;mIAe+F,CAAC;AAKvH,QAAA,cAAc,GAAG;;;;;;0DAM4B,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { BestPracticesDocument } from '../../types/best-practices';
|
|
2
|
-
export declare class ChatbotBestPractices implements BestPracticesDocument {
|
|
3
|
-
readonly technique: "chatbot";
|
|
4
|
-
readonly version = "1.0.0";
|
|
5
|
-
private readonly documentation;
|
|
6
|
-
getDocumentation(): string;
|
|
7
|
-
}
|