@n8n/ai-workflow-builder 0.13.0 → 0.14.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/ai-workflow-builder-agent.service.d.ts +28 -0
- package/dist/ai-workflow-builder-agent.service.js +160 -0
- package/dist/ai-workflow-builder-agent.service.js.map +1 -0
- package/dist/build.tsbuildinfo +1 -1
- package/dist/chains/conversation-compact.d.ts +8 -0
- package/dist/chains/conversation-compact.js +56 -0
- package/dist/chains/conversation-compact.js.map +1 -0
- package/dist/chains/parameter-updater.d.ts +16 -0
- package/dist/chains/parameter-updater.js +94 -0
- package/dist/chains/parameter-updater.js.map +1 -0
- package/dist/chains/planner.js +2 -2
- package/dist/chains/planner.js.map +1 -1
- package/dist/chains/prompts/base/common-patterns.d.ts +1 -0
- package/dist/chains/prompts/base/common-patterns.js +13 -0
- package/dist/chains/prompts/base/common-patterns.js.map +1 -0
- package/dist/chains/prompts/base/core-instructions.d.ts +1 -0
- package/dist/chains/prompts/base/core-instructions.js +28 -0
- package/dist/chains/prompts/base/core-instructions.js.map +1 -0
- package/dist/chains/prompts/base/expression-rules.d.ts +1 -0
- package/dist/chains/prompts/base/expression-rules.js +15 -0
- package/dist/chains/prompts/base/expression-rules.js.map +1 -0
- package/dist/chains/prompts/base/output-format.d.ts +1 -0
- package/dist/chains/prompts/base/output-format.js +7 -0
- package/dist/chains/prompts/base/output-format.js.map +1 -0
- package/dist/chains/prompts/examples/advanced/resource-locator-examples.d.ts +1 -0
- package/dist/chains/prompts/examples/advanced/resource-locator-examples.js +79 -0
- package/dist/chains/prompts/examples/advanced/resource-locator-examples.js.map +1 -0
- package/dist/chains/prompts/examples/advanced/tool-node-examples.d.ts +1 -0
- package/dist/chains/prompts/examples/advanced/tool-node-examples.js +71 -0
- package/dist/chains/prompts/examples/advanced/tool-node-examples.js.map +1 -0
- package/dist/chains/prompts/examples/basic/if-node-examples.d.ts +1 -0
- package/dist/chains/prompts/examples/basic/if-node-examples.js +138 -0
- package/dist/chains/prompts/examples/basic/if-node-examples.js.map +1 -0
- package/dist/chains/prompts/examples/basic/set-node-examples.d.ts +1 -0
- package/dist/chains/prompts/examples/basic/set-node-examples.js +148 -0
- package/dist/chains/prompts/examples/basic/set-node-examples.js.map +1 -0
- package/dist/chains/prompts/examples/basic/simple-updates.d.ts +1 -0
- package/dist/chains/prompts/examples/basic/simple-updates.js +51 -0
- package/dist/chains/prompts/examples/basic/simple-updates.js.map +1 -0
- package/dist/chains/prompts/node-types/http-request.d.ts +1 -0
- package/dist/chains/prompts/node-types/http-request.js +113 -0
- package/dist/chains/prompts/node-types/http-request.js.map +1 -0
- package/dist/chains/prompts/node-types/if-node.d.ts +1 -0
- package/dist/chains/prompts/node-types/if-node.js +158 -0
- package/dist/chains/prompts/node-types/if-node.js.map +1 -0
- package/dist/chains/prompts/node-types/set-node.d.ts +1 -0
- package/dist/chains/prompts/node-types/set-node.js +91 -0
- package/dist/chains/prompts/node-types/set-node.js.map +1 -0
- package/dist/chains/prompts/node-types/tool-nodes.d.ts +1 -0
- package/dist/chains/prompts/node-types/tool-nodes.js +73 -0
- package/dist/chains/prompts/node-types/tool-nodes.js.map +1 -0
- package/dist/chains/prompts/parameter-types/resource-locator.d.ts +1 -0
- package/dist/chains/prompts/parameter-types/resource-locator.js +95 -0
- package/dist/chains/prompts/parameter-types/resource-locator.js.map +1 -0
- package/dist/chains/prompts/parameter-types/text-fields.d.ts +1 -0
- package/dist/chains/prompts/parameter-types/text-fields.js +22 -0
- package/dist/chains/prompts/parameter-types/text-fields.js.map +1 -0
- package/dist/chains/prompts/prompt-builder.d.ts +14 -0
- package/dist/chains/prompts/prompt-builder.js +118 -0
- package/dist/chains/prompts/prompt-builder.js.map +1 -0
- package/dist/chains/prompts/prompt-config.d.ts +5 -0
- package/dist/chains/prompts/prompt-config.js +52 -0
- package/dist/chains/prompts/prompt-config.js.map +1 -0
- package/dist/errors/index.d.ts +45 -0
- package/dist/errors/index.js +122 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/llm-config.d.ts +6 -5
- package/dist/llm-config.js +19 -4
- package/dist/llm-config.js.map +1 -1
- package/dist/tools/add-node.tool.d.ts +56 -0
- package/dist/tools/add-node.tool.js +136 -0
- package/dist/tools/add-node.tool.js.map +1 -0
- package/dist/tools/connect-nodes.tool.d.ts +45 -0
- package/dist/tools/connect-nodes.tool.js +223 -0
- package/dist/tools/connect-nodes.tool.js.map +1 -0
- package/dist/tools/engines/node-search-engine.d.ts +25 -0
- package/dist/tools/engines/node-search-engine.js +121 -0
- package/dist/tools/engines/node-search-engine.js.map +1 -0
- package/dist/tools/helpers/index.d.ts +4 -0
- package/dist/tools/helpers/index.js +21 -0
- package/dist/tools/helpers/index.js.map +1 -0
- package/dist/tools/helpers/progress.d.ts +9 -0
- package/dist/tools/helpers/progress.js +114 -0
- package/dist/tools/helpers/progress.js.map +1 -0
- package/dist/tools/helpers/response.d.ts +7 -0
- package/dist/tools/helpers/response.js +31 -0
- package/dist/tools/helpers/response.js.map +1 -0
- package/dist/tools/helpers/state.d.ts +13 -0
- package/dist/tools/helpers/state.js +70 -0
- package/dist/tools/helpers/state.js.map +1 -0
- package/dist/tools/helpers/validation.d.ts +12 -0
- package/dist/tools/helpers/validation.js +69 -0
- package/dist/tools/helpers/validation.js.map +1 -0
- package/dist/tools/node-details.tool.d.ts +19 -0
- package/dist/tools/node-details.tool.js +133 -0
- package/dist/tools/node-details.tool.js.map +1 -0
- package/dist/tools/node-search.tool.d.ts +49 -0
- package/dist/tools/node-search.tool.js +146 -0
- package/dist/tools/node-search.tool.js.map +1 -0
- package/dist/tools/prompts/main-agent.prompt.d.ts +2 -0
- package/dist/tools/prompts/main-agent.prompt.js +390 -0
- package/dist/tools/prompts/main-agent.prompt.js.map +1 -0
- package/dist/tools/remove-node.tool.d.ts +13 -0
- package/dist/tools/remove-node.tool.js +97 -0
- package/dist/tools/remove-node.tool.js.map +1 -0
- package/dist/tools/update-node-parameters.tool.d.ts +19 -0
- package/dist/tools/update-node-parameters.tool.js +131 -0
- package/dist/tools/update-node-parameters.tool.js.map +1 -0
- package/dist/tools/utils/connection-parameters.utils.d.ts +8 -0
- package/dist/tools/utils/connection-parameters.utils.js +47 -0
- package/dist/tools/utils/connection-parameters.utils.js.map +1 -0
- package/dist/tools/utils/connection.utils.d.ts +15 -0
- package/dist/tools/utils/connection.utils.js +321 -0
- package/dist/tools/utils/connection.utils.js.map +1 -0
- package/dist/tools/utils/node-creation.utils.d.ts +8 -0
- package/dist/tools/utils/node-creation.utils.js +52 -0
- package/dist/tools/utils/node-creation.utils.js.map +1 -0
- package/dist/tools/utils/node-positioning.utils.d.ts +17 -0
- package/dist/tools/utils/node-positioning.utils.js +87 -0
- package/dist/tools/utils/node-positioning.utils.js.map +1 -0
- package/dist/tools/utils/parameter-update.utils.d.ts +6 -0
- package/dist/tools/utils/parameter-update.utils.js +75 -0
- package/dist/tools/utils/parameter-update.utils.js.map +1 -0
- package/dist/types/config.d.ts +53 -0
- package/dist/types/config.js +3 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/connections.d.ts +30 -0
- package/dist/types/connections.js +3 -0
- package/dist/types/connections.js.map +1 -0
- package/dist/types/index.d.ts +8 -0
- package/dist/types/index.js +25 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/messages.d.ts +38 -0
- package/dist/types/messages.js +3 -0
- package/dist/types/messages.js.map +1 -0
- package/dist/types/nodes.d.ts +26 -0
- package/dist/{types.js → types/nodes.js} +1 -1
- package/dist/types/nodes.js.map +1 -0
- package/dist/types/streaming.d.ts +33 -0
- package/dist/types/streaming.js +3 -0
- package/dist/types/streaming.js.map +1 -0
- package/dist/types/tools.d.ts +76 -0
- package/dist/types/tools.js +3 -0
- package/dist/types/tools.js.map +1 -0
- package/dist/types/utils.d.ts +2 -0
- package/dist/types/utils.js +3 -0
- package/dist/types/utils.js.map +1 -0
- package/dist/types/workflow.d.ts +21 -0
- package/dist/types/workflow.js +3 -0
- package/dist/types/workflow.js.map +1 -0
- package/dist/utils/node-helpers.d.ts +2 -0
- package/dist/utils/node-helpers.js +54 -0
- package/dist/utils/node-helpers.js.map +1 -0
- package/dist/utils/operations-processor.d.ts +10 -0
- package/dist/utils/operations-processor.js +114 -0
- package/dist/utils/operations-processor.js.map +1 -0
- package/dist/utils/stream-processor.d.ts +6 -0
- package/dist/utils/stream-processor.js +153 -0
- package/dist/utils/stream-processor.js.map +1 -0
- package/dist/utils/tool-executor.d.ts +3 -0
- package/dist/utils/tool-executor.js +86 -0
- package/dist/utils/tool-executor.js.map +1 -0
- package/dist/workflow-builder-agent.d.ts +41 -0
- package/dist/workflow-builder-agent.js +205 -0
- package/dist/workflow-builder-agent.js.map +1 -0
- package/dist/workflow-state.d.ts +12 -7
- package/dist/workflow-state.js +26 -7
- package/dist/workflow-state.js.map +1 -1
- package/package.json +24 -5
- package/dist/ai-workflow-builder.service.d.ts +0 -21
- package/dist/ai-workflow-builder.service.js +0 -294
- package/dist/ai-workflow-builder.service.js.map +0 -1
- package/dist/chains/connection-composer.d.ts +0 -10
- package/dist/chains/connection-composer.js +0 -135
- package/dist/chains/connection-composer.js.map +0 -1
- package/dist/chains/node-selector.d.ts +0 -8
- package/dist/chains/node-selector.js +0 -90
- package/dist/chains/node-selector.js.map +0 -1
- package/dist/chains/nodes-composer.d.ts +0 -8
- package/dist/chains/nodes-composer.js +0 -451
- package/dist/chains/nodes-composer.js.map +0 -1
- package/dist/chains/validator.d.ts +0 -2
- package/dist/chains/validator.js +0 -67
- package/dist/chains/validator.js.map +0 -1
- package/dist/types.d.ts +0 -87
- package/dist/types.js.map +0 -1
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TOOL_NODES_GUIDE = void 0;
|
|
4
|
+
exports.TOOL_NODES_GUIDE = `
|
|
5
|
+
## CRITICAL: $fromAI Expression Support for Tool Nodes
|
|
6
|
+
|
|
7
|
+
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.
|
|
8
|
+
|
|
9
|
+
### When to Use $fromAI
|
|
10
|
+
- ONLY available in tool nodes (node types ending with "Tool")
|
|
11
|
+
- Use when the AI should determine the value based on context
|
|
12
|
+
- Ideal for parameters that vary based on user input or conversation context
|
|
13
|
+
|
|
14
|
+
### $fromAI Syntax
|
|
15
|
+
\`={{ $fromAI('key', 'description', 'type', defaultValue) }}\`
|
|
16
|
+
|
|
17
|
+
### Parameters
|
|
18
|
+
- key: Unique identifier (1-64 chars, alphanumeric/underscore/hyphen)
|
|
19
|
+
- description: Optional description for the AI (use empty string '' if not needed)
|
|
20
|
+
- type: 'string' | 'number' | 'boolean' | 'json' (defaults to 'string')
|
|
21
|
+
- defaultValue: Optional fallback value
|
|
22
|
+
|
|
23
|
+
### Tool Node Examples
|
|
24
|
+
|
|
25
|
+
#### Gmail Tool - Sending Email
|
|
26
|
+
{
|
|
27
|
+
"sendTo": "={{ $fromAI('to') }}",
|
|
28
|
+
"subject": "={{ $fromAI('subject') }}",
|
|
29
|
+
"message": "={{ $fromAI('message_html') }}"
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
#### Google Calendar Tool - Filtering Events
|
|
33
|
+
{
|
|
34
|
+
"timeMin": "={{ $fromAI('After', '', 'string') }}",
|
|
35
|
+
"timeMax": "={{ $fromAI('Before', '', 'string') }}"
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
### Mixed Usage Examples
|
|
39
|
+
You can combine $fromAI with regular text:
|
|
40
|
+
- "Subject: {{ $fromAI('subject') }} - Automated"
|
|
41
|
+
- "Dear {{ $fromAI('recipientName', 'Customer name', 'string', 'Customer') }},"
|
|
42
|
+
|
|
43
|
+
### Important Rules
|
|
44
|
+
1. ONLY use $fromAI in tool nodes (check if node type ends with "Tool")
|
|
45
|
+
2. For timeMin/timeMax and similar date fields, use appropriate key names
|
|
46
|
+
3. The AI will fill these values based on context during execution
|
|
47
|
+
4. Don't use $fromAI in regular nodes like Set, IF, HTTP Request, etc.
|
|
48
|
+
|
|
49
|
+
## Tool Node Parameter Guidelines
|
|
50
|
+
|
|
51
|
+
### Identifying Tool Nodes
|
|
52
|
+
1. CHECK NODE TYPE: If the node type ends with "Tool", it supports $fromAI expressions
|
|
53
|
+
2. COMMON TOOL NODES:
|
|
54
|
+
- Gmail Tool (gmailTool): to, subject, message → use $fromAI
|
|
55
|
+
- Google Calendar Tool (googleCalendarTool): timeMin, timeMax → use $fromAI
|
|
56
|
+
- Slack Tool (slackTool): channel, message → use $fromAI
|
|
57
|
+
- Microsoft Teams Tool: channel, message → use $fromAI
|
|
58
|
+
- Telegram Tool: chatId, text → use $fromAI
|
|
59
|
+
- Other communication/document tools: content fields → use $fromAI
|
|
60
|
+
|
|
61
|
+
### When to Use $fromAI in Tool Nodes
|
|
62
|
+
1. DYNAMIC VALUES: Use $fromAI for values that should be determined by AI based on context
|
|
63
|
+
2. USER INPUT FIELDS: Recipients, subjects, messages, date ranges
|
|
64
|
+
3. PRESERVE EXISTING: If a parameter already uses $fromAI, keep it unless explicitly asked to change
|
|
65
|
+
4. DATE/TIME FIELDS: Use descriptive key names for clarity
|
|
66
|
+
|
|
67
|
+
### Tool Node Parameter Patterns
|
|
68
|
+
- Email recipients: "={{ $fromAI('to') }}"
|
|
69
|
+
- Email subjects: "={{ $fromAI('subject') }}"
|
|
70
|
+
- Message content: "={{ $fromAI('message_html') }}" or "={{ $fromAI('message') }}"
|
|
71
|
+
- Date ranges: "={{ $fromAI('After', '', 'string') }}"
|
|
72
|
+
- Channel IDs: "={{ $fromAI('channel') }}"`;
|
|
73
|
+
//# sourceMappingURL=tool-nodes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-nodes.js","sourceRoot":"","sources":["../../../../src/chains/prompts/node-types/tool-nodes.ts"],"names":[],"mappings":";;;AAAa,QAAA,gBAAgB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2CAoEW,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const RESOURCE_LOCATOR_GUIDE = "\n## IMPORTANT: ResourceLocator Parameter Handling\n\nResourceLocator parameters are special fields used for selecting resources like Slack channels, Google Drive files, Notion pages, etc. They MUST have a specific structure:\n\n### Required ResourceLocator Structure:\n```json\n{\n \"__rl\": true,\n \"mode\": \"id\" | \"url\" | \"list\" | \"name\",\n \"value\": \"the-actual-value\"\n}\n```\n\n### Mode Detection Guidelines:\n- Use mode \"url\" when the value is a URL (starts with http:// or https://)\n- Use mode \"id\" when the value looks like an ID (alphanumeric string)\n- Use mode \"name\" when the value has a prefix like # (Slack channels) or @ (users)\n- Use mode \"list\" when referencing a dropdown selection (rarely needed in updates)\n\n### ResourceLocator Examples:\n\n#### Example 1: Slack Channel by ID\nParameter name: channelId\nChange: \"Set channel to C0122KQ70S7E\"\nOutput:\n```json\n{\n \"channelId\": {\n \"__rl\": true,\n \"mode\": \"id\",\n \"value\": \"C0122KQ70S7E\"\n }\n}\n```\n\n#### Example 2: Google Drive File by URL\nParameter name: fileId\nChange: \"Use file https://drive.google.com/file/d/1Nvdl7bEfDW33cKQuwfItPhIk479--WYY/view\"\nOutput:\n```json\n{\n \"fileId\": {\n \"__rl\": true,\n \"mode\": \"url\",\n \"value\": \"https://drive.google.com/file/d/1Nvdl7bEfDW33cKQuwfItPhIk479--WYY/view\"\n }\n}\n```\n\n#### Example 3: Notion Page by ID\nParameter name: pageId\nChange: \"Set page ID to 123e4567-e89b-12d3\"\nOutput:\n```json\n{\n \"pageId\": {\n \"__rl\": true,\n \"mode\": \"id\",\n \"value\": \"123e4567-e89b-12d3\"\n }\n}\n```\n\n#### Example 4: Slack Channel by Name\nParameter name: channelId\nChange: \"Send to #general channel\"\nOutput:\n```json\n{\n \"channelId\": {\n \"__rl\": true,\n \"mode\": \"name\",\n \"value\": \"#general\"\n }\n}\n```\n\n#### Example 5: Using Expression with ResourceLocator\nParameter name: channelId\nChange: \"Use channel ID from previous node\"\nOutput:\n```json\n{\n \"channelId\": {\n \"__rl\": true,\n \"mode\": \"id\",\n \"value\": \"={{ $('Previous Node').item.json.channelId }}\"\n }\n}\n```";
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RESOURCE_LOCATOR_GUIDE = void 0;
|
|
4
|
+
exports.RESOURCE_LOCATOR_GUIDE = `
|
|
5
|
+
## IMPORTANT: ResourceLocator Parameter Handling
|
|
6
|
+
|
|
7
|
+
ResourceLocator parameters are special fields used for selecting resources like Slack channels, Google Drive files, Notion pages, etc. They MUST have a specific structure:
|
|
8
|
+
|
|
9
|
+
### Required ResourceLocator Structure:
|
|
10
|
+
\`\`\`json
|
|
11
|
+
{
|
|
12
|
+
"__rl": true,
|
|
13
|
+
"mode": "id" | "url" | "list" | "name",
|
|
14
|
+
"value": "the-actual-value"
|
|
15
|
+
}
|
|
16
|
+
\`\`\`
|
|
17
|
+
|
|
18
|
+
### Mode Detection Guidelines:
|
|
19
|
+
- Use mode "url" when the value is a URL (starts with http:// or https://)
|
|
20
|
+
- Use mode "id" when the value looks like an ID (alphanumeric string)
|
|
21
|
+
- Use mode "name" when the value has a prefix like # (Slack channels) or @ (users)
|
|
22
|
+
- Use mode "list" when referencing a dropdown selection (rarely needed in updates)
|
|
23
|
+
|
|
24
|
+
### ResourceLocator Examples:
|
|
25
|
+
|
|
26
|
+
#### Example 1: Slack Channel by ID
|
|
27
|
+
Parameter name: channelId
|
|
28
|
+
Change: "Set channel to C0122KQ70S7E"
|
|
29
|
+
Output:
|
|
30
|
+
\`\`\`json
|
|
31
|
+
{
|
|
32
|
+
"channelId": {
|
|
33
|
+
"__rl": true,
|
|
34
|
+
"mode": "id",
|
|
35
|
+
"value": "C0122KQ70S7E"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
\`\`\`
|
|
39
|
+
|
|
40
|
+
#### Example 2: Google Drive File by URL
|
|
41
|
+
Parameter name: fileId
|
|
42
|
+
Change: "Use file https://drive.google.com/file/d/1Nvdl7bEfDW33cKQuwfItPhIk479--WYY/view"
|
|
43
|
+
Output:
|
|
44
|
+
\`\`\`json
|
|
45
|
+
{
|
|
46
|
+
"fileId": {
|
|
47
|
+
"__rl": true,
|
|
48
|
+
"mode": "url",
|
|
49
|
+
"value": "https://drive.google.com/file/d/1Nvdl7bEfDW33cKQuwfItPhIk479--WYY/view"
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
\`\`\`
|
|
53
|
+
|
|
54
|
+
#### Example 3: Notion Page by ID
|
|
55
|
+
Parameter name: pageId
|
|
56
|
+
Change: "Set page ID to 123e4567-e89b-12d3"
|
|
57
|
+
Output:
|
|
58
|
+
\`\`\`json
|
|
59
|
+
{
|
|
60
|
+
"pageId": {
|
|
61
|
+
"__rl": true,
|
|
62
|
+
"mode": "id",
|
|
63
|
+
"value": "123e4567-e89b-12d3"
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
\`\`\`
|
|
67
|
+
|
|
68
|
+
#### Example 4: Slack Channel by Name
|
|
69
|
+
Parameter name: channelId
|
|
70
|
+
Change: "Send to #general channel"
|
|
71
|
+
Output:
|
|
72
|
+
\`\`\`json
|
|
73
|
+
{
|
|
74
|
+
"channelId": {
|
|
75
|
+
"__rl": true,
|
|
76
|
+
"mode": "name",
|
|
77
|
+
"value": "#general"
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
\`\`\`
|
|
81
|
+
|
|
82
|
+
#### Example 5: Using Expression with ResourceLocator
|
|
83
|
+
Parameter name: channelId
|
|
84
|
+
Change: "Use channel ID from previous node"
|
|
85
|
+
Output:
|
|
86
|
+
\`\`\`json
|
|
87
|
+
{
|
|
88
|
+
"channelId": {
|
|
89
|
+
"__rl": true,
|
|
90
|
+
"mode": "id",
|
|
91
|
+
"value": "={{ $('Previous Node').item.json.channelId }}"
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
\`\`\``;
|
|
95
|
+
//# sourceMappingURL=resource-locator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource-locator.js","sourceRoot":"","sources":["../../../../src/chains/prompts/parameter-types/resource-locator.ts"],"names":[],"mappings":";;;AAAa,QAAA,sBAAsB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA0F/B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const TEXT_FIELDS_GUIDE = "\n## Text Field Expression Formatting\n\n### PREFERRED METHOD: Embedding expressions directly within text\n```\n\"text\": \"=ALERT: It is currently {{ $('Weather Node').item.json.weather }} in {{ $('Weather Node').item.json.city }}!\"\n```\n\n### Alternative method: Using string concatenation (use only when needed)\n```\n\"text\": \"={{ 'ALERT: It is currently ' + $('Weather Node').item.json.weather + ' in ' + $('Weather Node').item.json.city + '!' }}\"\n```\n\n### Key Points:\n- Use the embedded expression format when mixing static text with dynamic values\n- The entire string must start with = when using expressions\n- Expressions within text use single curly braces {{ }}\n- The outer expression wrapper uses double curly braces ={{ }}";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TEXT_FIELDS_GUIDE = void 0;
|
|
4
|
+
exports.TEXT_FIELDS_GUIDE = `
|
|
5
|
+
## Text Field Expression Formatting
|
|
6
|
+
|
|
7
|
+
### PREFERRED METHOD: Embedding expressions directly within text
|
|
8
|
+
\`\`\`
|
|
9
|
+
"text": "=ALERT: It is currently {{ $('Weather Node').item.json.weather }} in {{ $('Weather Node').item.json.city }}!"
|
|
10
|
+
\`\`\`
|
|
11
|
+
|
|
12
|
+
### Alternative method: Using string concatenation (use only when needed)
|
|
13
|
+
\`\`\`
|
|
14
|
+
"text": "={{ 'ALERT: It is currently ' + $('Weather Node').item.json.weather + ' in ' + $('Weather Node').item.json.city + '!' }}"
|
|
15
|
+
\`\`\`
|
|
16
|
+
|
|
17
|
+
### Key Points:
|
|
18
|
+
- Use the embedded expression format when mixing static text with dynamic values
|
|
19
|
+
- The entire string must start with = when using expressions
|
|
20
|
+
- Expressions within text use single curly braces {{ }}
|
|
21
|
+
- The outer expression wrapper uses double curly braces ={{ }}`;
|
|
22
|
+
//# sourceMappingURL=text-fields.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text-fields.js","sourceRoot":"","sources":["../../../../src/chains/prompts/parameter-types/text-fields.ts"],"names":[],"mappings":";;;AAAa,QAAA,iBAAiB,GAAG;;;;;;;;;;;;;;;;;+DAiB8B,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { INodeTypeDescription } from 'n8n-workflow';
|
|
2
|
+
import type { PromptBuilderContext } from '../../types/config';
|
|
3
|
+
export declare class ParameterUpdatePromptBuilder {
|
|
4
|
+
static buildSystemPrompt(context: PromptBuilderContext): string;
|
|
5
|
+
private static isSetNode;
|
|
6
|
+
private static isIfNode;
|
|
7
|
+
private static isHttpRequestNode;
|
|
8
|
+
private static isToolNode;
|
|
9
|
+
private static needsResourceLocatorGuide;
|
|
10
|
+
private static hasTextFields;
|
|
11
|
+
private static selectRelevantExamples;
|
|
12
|
+
static hasResourceLocatorParameters(nodeDefinition: INodeTypeDescription): boolean;
|
|
13
|
+
static estimateTokens(prompt: string): number;
|
|
14
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ParameterUpdatePromptBuilder = void 0;
|
|
4
|
+
const common_patterns_1 = require("./base/common-patterns");
|
|
5
|
+
const core_instructions_1 = require("./base/core-instructions");
|
|
6
|
+
const expression_rules_1 = require("./base/expression-rules");
|
|
7
|
+
const output_format_1 = require("./base/output-format");
|
|
8
|
+
const resource_locator_examples_1 = require("./examples/advanced/resource-locator-examples");
|
|
9
|
+
const tool_node_examples_1 = require("./examples/advanced/tool-node-examples");
|
|
10
|
+
const if_node_examples_1 = require("./examples/basic/if-node-examples");
|
|
11
|
+
const set_node_examples_1 = require("./examples/basic/set-node-examples");
|
|
12
|
+
const simple_updates_1 = require("./examples/basic/simple-updates");
|
|
13
|
+
const http_request_1 = require("./node-types/http-request");
|
|
14
|
+
const if_node_1 = require("./node-types/if-node");
|
|
15
|
+
const set_node_1 = require("./node-types/set-node");
|
|
16
|
+
const tool_nodes_1 = require("./node-types/tool-nodes");
|
|
17
|
+
const resource_locator_1 = require("./parameter-types/resource-locator");
|
|
18
|
+
const text_fields_1 = require("./parameter-types/text-fields");
|
|
19
|
+
const prompt_config_1 = require("./prompt-config");
|
|
20
|
+
class ParameterUpdatePromptBuilder {
|
|
21
|
+
static buildSystemPrompt(context) {
|
|
22
|
+
const options = context.options ?? {};
|
|
23
|
+
const sections = [];
|
|
24
|
+
sections.push(core_instructions_1.CORE_INSTRUCTIONS);
|
|
25
|
+
sections.push(expression_rules_1.EXPRESSION_RULES);
|
|
26
|
+
if (this.isSetNode(context.nodeType)) {
|
|
27
|
+
sections.push(set_node_1.SET_NODE_GUIDE);
|
|
28
|
+
}
|
|
29
|
+
else if (this.isIfNode(context.nodeType)) {
|
|
30
|
+
sections.push(if_node_1.IF_NODE_GUIDE);
|
|
31
|
+
}
|
|
32
|
+
else if (this.isHttpRequestNode(context.nodeType)) {
|
|
33
|
+
sections.push(http_request_1.HTTP_REQUEST_GUIDE);
|
|
34
|
+
}
|
|
35
|
+
if (this.isToolNode(context.nodeType)) {
|
|
36
|
+
sections.push(tool_nodes_1.TOOL_NODES_GUIDE);
|
|
37
|
+
}
|
|
38
|
+
if (context.hasResourceLocatorParams || this.needsResourceLocatorGuide(context)) {
|
|
39
|
+
sections.push(resource_locator_1.RESOURCE_LOCATOR_GUIDE);
|
|
40
|
+
}
|
|
41
|
+
if (this.hasTextFields(context.nodeDefinition)) {
|
|
42
|
+
sections.push(text_fields_1.TEXT_FIELDS_GUIDE);
|
|
43
|
+
}
|
|
44
|
+
sections.push(common_patterns_1.COMMON_PATTERNS);
|
|
45
|
+
if (options.includeExamples !== false) {
|
|
46
|
+
const examples = this.selectRelevantExamples(context);
|
|
47
|
+
if (examples.length > 0) {
|
|
48
|
+
sections.push('\n## Relevant Examples');
|
|
49
|
+
sections.push(...examples);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
sections.push(output_format_1.OUTPUT_FORMAT);
|
|
53
|
+
const finalPrompt = sections.join('\n');
|
|
54
|
+
return finalPrompt;
|
|
55
|
+
}
|
|
56
|
+
static isSetNode(nodeType) {
|
|
57
|
+
const category = (0, prompt_config_1.getNodeTypeCategory)(nodeType);
|
|
58
|
+
return category === 'set';
|
|
59
|
+
}
|
|
60
|
+
static isIfNode(nodeType) {
|
|
61
|
+
const category = (0, prompt_config_1.getNodeTypeCategory)(nodeType);
|
|
62
|
+
return category === 'if';
|
|
63
|
+
}
|
|
64
|
+
static isHttpRequestNode(nodeType) {
|
|
65
|
+
const category = (0, prompt_config_1.getNodeTypeCategory)(nodeType);
|
|
66
|
+
return category === 'httpRequest';
|
|
67
|
+
}
|
|
68
|
+
static isToolNode(nodeType) {
|
|
69
|
+
const category = (0, prompt_config_1.getNodeTypeCategory)(nodeType);
|
|
70
|
+
return category === 'tool';
|
|
71
|
+
}
|
|
72
|
+
static needsResourceLocatorGuide(context) {
|
|
73
|
+
return (0, prompt_config_1.mentionsResourceKeywords)(context.requestedChanges, context.config);
|
|
74
|
+
}
|
|
75
|
+
static hasTextFields(nodeDefinition) {
|
|
76
|
+
if (!nodeDefinition.properties)
|
|
77
|
+
return false;
|
|
78
|
+
return nodeDefinition.properties.some((prop) => prop.type === 'string' && prop.typeOptions?.multipleValues !== true);
|
|
79
|
+
}
|
|
80
|
+
static selectRelevantExamples(context) {
|
|
81
|
+
const examples = [];
|
|
82
|
+
const config = context.config ?? prompt_config_1.DEFAULT_PROMPT_CONFIG;
|
|
83
|
+
const maxExamples = context.options?.maxExamples ?? config.maxExamples;
|
|
84
|
+
if (this.isToolNode(context.nodeType)) {
|
|
85
|
+
examples.push(tool_node_examples_1.TOOL_NODE_EXAMPLES);
|
|
86
|
+
}
|
|
87
|
+
else if (this.isSetNode(context.nodeType)) {
|
|
88
|
+
examples.push(set_node_examples_1.SET_NODE_EXAMPLES);
|
|
89
|
+
}
|
|
90
|
+
else if (this.isIfNode(context.nodeType)) {
|
|
91
|
+
examples.push(if_node_examples_1.IF_NODE_EXAMPLES);
|
|
92
|
+
}
|
|
93
|
+
if (context.hasResourceLocatorParams) {
|
|
94
|
+
examples.push(resource_locator_examples_1.RESOURCE_LOCATOR_EXAMPLES);
|
|
95
|
+
}
|
|
96
|
+
if (examples.length === 0) {
|
|
97
|
+
examples.push(simple_updates_1.SIMPLE_UPDATE_EXAMPLES);
|
|
98
|
+
}
|
|
99
|
+
return examples.slice(0, maxExamples);
|
|
100
|
+
}
|
|
101
|
+
static hasResourceLocatorParameters(nodeDefinition) {
|
|
102
|
+
if (!nodeDefinition.properties)
|
|
103
|
+
return false;
|
|
104
|
+
const checkProperties = (properties) => {
|
|
105
|
+
for (const prop of properties) {
|
|
106
|
+
if (prop.type === 'resourceLocator' || prop.type === 'fixedCollection')
|
|
107
|
+
return true;
|
|
108
|
+
}
|
|
109
|
+
return false;
|
|
110
|
+
};
|
|
111
|
+
return checkProperties(nodeDefinition.properties);
|
|
112
|
+
}
|
|
113
|
+
static estimateTokens(prompt) {
|
|
114
|
+
return Math.ceil(prompt.length / 4);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
exports.ParameterUpdatePromptBuilder = ParameterUpdatePromptBuilder;
|
|
118
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AC;QAED,IAAI,OAAO,CAAC,wBAAwB,EAAE,CAAC;YACtC,QAAQ,CAAC,IAAI,CAAC,qDAAyB,CAAC,CAAC;QAC1C,CAAC;QAGD,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC3B,QAAQ,CAAC,IAAI,CAAC,uCAAsB,CAAC,CAAC;QACvC,CAAC;QAGD,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC;IACvC,CAAC;IAKD,MAAM,CAAC,4BAA4B,CAAC,cAAoC;QACvE,IAAI,CAAC,cAAc,CAAC,UAAU;YAAE,OAAO,KAAK,CAAC;QAE7C,MAAM,eAAe,GAAG,CAAC,UAA6B,EAAW,EAAE;YAClE,KAAK,MAAM,IAAI,IAAI,UAAU,EAAE,CAAC;gBAC/B,IAAI,IAAI,CAAC,IAAI,KAAK,iBAAiB,IAAI,IAAI,CAAC,IAAI,KAAK,iBAAiB;oBAAE,OAAO,IAAI,CAAC;YACrF,CAAC;YACD,OAAO,KAAK,CAAC;QACd,CAAC,CAAC;QAEF,OAAO,eAAe,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;IACnD,CAAC;IAKD,MAAM,CAAC,cAAc,CAAC,MAAc;QAEnC,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACrC,CAAC;CACD;AA/JD,oEA+JC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { NodePromptConfig } from '../../types/config';
|
|
2
|
+
export declare const DEFAULT_PROMPT_CONFIG: NodePromptConfig;
|
|
3
|
+
export declare function getNodeTypeCategory(nodeType: string, config?: NodePromptConfig): string | null;
|
|
4
|
+
export declare function mentionsResourceKeywords(changes: string[], config?: NodePromptConfig): boolean;
|
|
5
|
+
export declare function mentionsTextKeywords(changes: string[], config?: NodePromptConfig): boolean;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DEFAULT_PROMPT_CONFIG = void 0;
|
|
4
|
+
exports.getNodeTypeCategory = getNodeTypeCategory;
|
|
5
|
+
exports.mentionsResourceKeywords = mentionsResourceKeywords;
|
|
6
|
+
exports.mentionsTextKeywords = mentionsTextKeywords;
|
|
7
|
+
exports.DEFAULT_PROMPT_CONFIG = {
|
|
8
|
+
nodeTypePatterns: {
|
|
9
|
+
set: ['n8n-nodes-base.set', 'set'],
|
|
10
|
+
if: ['n8n-nodes-base.if', 'if', 'filter'],
|
|
11
|
+
httpRequest: ['n8n-nodes-base.httpRequest', 'httprequest', 'webhook', 'n8n-nodes-base.webhook'],
|
|
12
|
+
tool: ['Tool', '.tool'],
|
|
13
|
+
},
|
|
14
|
+
parameterKeywords: {
|
|
15
|
+
resourceLocator: [
|
|
16
|
+
'channel',
|
|
17
|
+
'file',
|
|
18
|
+
'page',
|
|
19
|
+
'document',
|
|
20
|
+
'sheet',
|
|
21
|
+
'folder',
|
|
22
|
+
'database',
|
|
23
|
+
'board',
|
|
24
|
+
'list',
|
|
25
|
+
'space',
|
|
26
|
+
],
|
|
27
|
+
textExpressions: ['message', 'text', 'content', 'body', 'description', 'title', 'subject'],
|
|
28
|
+
},
|
|
29
|
+
maxExamples: 3,
|
|
30
|
+
targetTokenBudget: 3000,
|
|
31
|
+
};
|
|
32
|
+
function getNodeTypeCategory(nodeType, config = exports.DEFAULT_PROMPT_CONFIG) {
|
|
33
|
+
const lowerType = nodeType.toLowerCase();
|
|
34
|
+
for (const [category, patterns] of Object.entries(config.nodeTypePatterns)) {
|
|
35
|
+
if (patterns.some((pattern) => lowerType.includes(pattern.toLowerCase()))) {
|
|
36
|
+
return category;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
if (nodeType.endsWith('Tool') || nodeType.includes('.tool')) {
|
|
40
|
+
return 'tool';
|
|
41
|
+
}
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
function mentionsResourceKeywords(changes, config = exports.DEFAULT_PROMPT_CONFIG) {
|
|
45
|
+
const changesText = changes.join(' ').toLowerCase();
|
|
46
|
+
return config.parameterKeywords.resourceLocator.some((keyword) => changesText.includes(keyword));
|
|
47
|
+
}
|
|
48
|
+
function mentionsTextKeywords(changes, config = exports.DEFAULT_PROMPT_CONFIG) {
|
|
49
|
+
const changesText = changes.join(' ').toLowerCase();
|
|
50
|
+
return config.parameterKeywords.textExpressions.some((keyword) => changesText.includes(keyword));
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=prompt-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt-config.js","sourceRoot":"","sources":["../../../src/chains/prompts/prompt-config.ts"],"names":[],"mappings":";;;AAiCA,kDAkBC;AAKD,4DAMC;AAKD,oDAMC;AAvEY,QAAA,qBAAqB,GAAqB;IACtD,gBAAgB,EAAE;QACjB,GAAG,EAAE,CAAC,oBAAoB,EAAE,KAAK,CAAC;QAClC,EAAE,EAAE,CAAC,mBAAmB,EAAE,IAAI,EAAE,QAAQ,CAAC;QACzC,WAAW,EAAE,CAAC,4BAA4B,EAAE,aAAa,EAAE,SAAS,EAAE,wBAAwB,CAAC;QAC/F,IAAI,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC;KACvB;IAED,iBAAiB,EAAE;QAClB,eAAe,EAAE;YAChB,SAAS;YACT,MAAM;YACN,MAAM;YACN,UAAU;YACV,OAAO;YACP,QAAQ;YACR,UAAU;YACV,OAAO;YACP,MAAM;YACN,OAAO;SACP;QACD,eAAe,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,SAAS,CAAC;KAC1F;IAED,WAAW,EAAE,CAAC;IACd,iBAAiB,EAAE,IAAI;CACvB,CAAC;AAKF,SAAgB,mBAAmB,CAClC,QAAgB,EAChB,SAA2B,6BAAqB;IAEhD,MAAM,SAAS,GAAG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from 'n8n-workflow';
|
|
3
|
+
export declare abstract class AiWorkflowBuilderError extends Error {
|
|
4
|
+
constructor(message: string, options?: ErrorOptions);
|
|
5
|
+
}
|
|
6
|
+
export declare class NodeNotFoundError extends OperationalError {
|
|
7
|
+
constructor(nodeId: string, nodeType?: string, options?: OperationalErrorOptions);
|
|
8
|
+
}
|
|
9
|
+
export declare class NodeTypeNotFoundError extends OperationalError {
|
|
10
|
+
constructor(nodeType: string, options?: OperationalErrorOptions);
|
|
11
|
+
}
|
|
12
|
+
export declare class ConnectionError extends OperationalError {
|
|
13
|
+
constructor(message: string, options?: OperationalErrorOptions & {
|
|
14
|
+
fromNodeId?: string;
|
|
15
|
+
toNodeId?: string;
|
|
16
|
+
connectionType?: string;
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
export declare class LLMServiceError extends OperationalError {
|
|
20
|
+
constructor(message: string, options?: OperationalErrorOptions & {
|
|
21
|
+
llmModel?: string;
|
|
22
|
+
statusCode?: number;
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
export declare class ValidationError extends OperationalError {
|
|
26
|
+
constructor(message: string, options?: OperationalErrorOptions & {
|
|
27
|
+
field?: string;
|
|
28
|
+
value?: unknown;
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
export declare class ParameterUpdateError extends OperationalError {
|
|
32
|
+
constructor(message: string, options?: OperationalErrorOptions & {
|
|
33
|
+
nodeId?: string;
|
|
34
|
+
nodeType: string;
|
|
35
|
+
parameter?: string;
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
export declare class WorkflowStateError extends UnexpectedError {
|
|
39
|
+
constructor(message: string, options?: UnexpectedErrorOptions);
|
|
40
|
+
}
|
|
41
|
+
export declare class ToolExecutionError extends UnexpectedError {
|
|
42
|
+
constructor(message: string, options?: UnexpectedErrorOptions & {
|
|
43
|
+
toolName?: string;
|
|
44
|
+
});
|
|
45
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ToolExecutionError = exports.WorkflowStateError = exports.ParameterUpdateError = exports.ValidationError = exports.LLMServiceError = exports.ConnectionError = exports.NodeTypeNotFoundError = exports.NodeNotFoundError = exports.AiWorkflowBuilderError = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
class AiWorkflowBuilderError extends Error {
|
|
6
|
+
constructor(message, options) {
|
|
7
|
+
super(message, options);
|
|
8
|
+
this.name = this.constructor.name;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.AiWorkflowBuilderError = AiWorkflowBuilderError;
|
|
12
|
+
class NodeNotFoundError extends n8n_workflow_1.OperationalError {
|
|
13
|
+
constructor(nodeId, nodeType, options) {
|
|
14
|
+
super(`Node with ID "${nodeId}" not found in workflow`, {
|
|
15
|
+
...options,
|
|
16
|
+
tags: {
|
|
17
|
+
...options?.tags,
|
|
18
|
+
nodeId,
|
|
19
|
+
nodeType,
|
|
20
|
+
},
|
|
21
|
+
shouldReport: false,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.NodeNotFoundError = NodeNotFoundError;
|
|
26
|
+
class NodeTypeNotFoundError extends n8n_workflow_1.OperationalError {
|
|
27
|
+
constructor(nodeType, options) {
|
|
28
|
+
super(`Node type "${nodeType}" not found`, {
|
|
29
|
+
...options,
|
|
30
|
+
tags: {
|
|
31
|
+
...options?.tags,
|
|
32
|
+
nodeType,
|
|
33
|
+
},
|
|
34
|
+
shouldReport: false,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.NodeTypeNotFoundError = NodeTypeNotFoundError;
|
|
39
|
+
class ConnectionError extends n8n_workflow_1.OperationalError {
|
|
40
|
+
constructor(message, options) {
|
|
41
|
+
super(message, {
|
|
42
|
+
...options,
|
|
43
|
+
tags: {
|
|
44
|
+
...options?.tags,
|
|
45
|
+
fromNodeId: options?.fromNodeId,
|
|
46
|
+
toNodeId: options?.toNodeId,
|
|
47
|
+
connectionType: options?.connectionType,
|
|
48
|
+
},
|
|
49
|
+
shouldReport: false,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
exports.ConnectionError = ConnectionError;
|
|
54
|
+
class LLMServiceError extends n8n_workflow_1.OperationalError {
|
|
55
|
+
constructor(message, options) {
|
|
56
|
+
super(message, {
|
|
57
|
+
...options,
|
|
58
|
+
tags: {
|
|
59
|
+
...options?.tags,
|
|
60
|
+
llmModel: options?.llmModel,
|
|
61
|
+
statusCode: options?.statusCode,
|
|
62
|
+
},
|
|
63
|
+
shouldReport: true,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
exports.LLMServiceError = LLMServiceError;
|
|
68
|
+
class ValidationError extends n8n_workflow_1.OperationalError {
|
|
69
|
+
constructor(message, options) {
|
|
70
|
+
super(message, {
|
|
71
|
+
...options,
|
|
72
|
+
tags: {
|
|
73
|
+
...options?.tags,
|
|
74
|
+
field: options?.field,
|
|
75
|
+
},
|
|
76
|
+
extra: {
|
|
77
|
+
...options?.extra,
|
|
78
|
+
value: options?.value,
|
|
79
|
+
},
|
|
80
|
+
shouldReport: false,
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
exports.ValidationError = ValidationError;
|
|
85
|
+
class ParameterUpdateError extends n8n_workflow_1.OperationalError {
|
|
86
|
+
constructor(message, options) {
|
|
87
|
+
super(message, {
|
|
88
|
+
...options,
|
|
89
|
+
tags: {
|
|
90
|
+
...options?.tags,
|
|
91
|
+
nodeId: options?.nodeId,
|
|
92
|
+
nodeType: options?.nodeType,
|
|
93
|
+
parameter: options?.parameter,
|
|
94
|
+
},
|
|
95
|
+
shouldReport: false,
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
exports.ParameterUpdateError = ParameterUpdateError;
|
|
100
|
+
class WorkflowStateError extends n8n_workflow_1.UnexpectedError {
|
|
101
|
+
constructor(message, options) {
|
|
102
|
+
super(message, {
|
|
103
|
+
...options,
|
|
104
|
+
shouldReport: true,
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
exports.WorkflowStateError = WorkflowStateError;
|
|
109
|
+
class ToolExecutionError extends n8n_workflow_1.UnexpectedError {
|
|
110
|
+
constructor(message, options) {
|
|
111
|
+
super(message, {
|
|
112
|
+
...options,
|
|
113
|
+
shouldReport: true,
|
|
114
|
+
tags: {
|
|
115
|
+
...options?.tags,
|
|
116
|
+
toolName: options?.toolName,
|
|
117
|
+
},
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
exports.ToolExecutionError = ToolExecutionError;
|
|
122
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":";;;AAAA,+CAAiE;AAMjE,MAAsB,sBAAuB,SAAQ,KAAK;IACzD,YAAY,OAAe,EAAE,OAAsB;QAClD,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;IACnC,CAAC;CACD;AALD,wDAKC;AAKD,MAAa,iBAAkB,SAAQ,+BAAgB;IACtD,YAAY,MAAc,EAAE,QAAiB,EAAE,OAAiC;QAC/E,KAAK,CAAC,iBAAiB,MAAM,yBAAyB,EAAE;YACvD,GAAG,OAAO;YACV,IAAI,EAAE;gBACL,GAAG,OAAO,EAAE,IAAI;gBAChB,MAAM;gBACN,QAAQ;aACR;YACD,YAAY,EAAE,KAAK;SACnB,CAAC,CAAC;IACJ,CAAC;CACD;AAZD,8CAYC;AAKD,MAAa,qBAAsB,SAAQ,+BAAgB;IAC1D,YAAY,QAAgB,EAAE,OAAiC;QAC9D,KAAK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oBAAqB,SAAQ,+BAAgB;IACzD,YACC,OAAe,EACf,OAA6F;QAE7F,KAAK,CAAC,OAAO,EAAE;YACd,GAAG,OAAO;YACV,IAAI,EAAE;gBACL,GAAG,OAAO,EAAE,IAAI;gBAChB,MAAM,EAAE,OAAO,EAAE,MAAM;gBACvB,QAAQ,EAAE,OAAO,EAAE,QAAQ;gBAC3B,SAAS,EAAE,OAAO,EAAE,SAAS;aAC7B;YACD,YAAY,EAAE,KAAK;SACnB,CAAC,CAAC;IACJ,CAAC;CACD;AAhBD,oDAgBC;AAKD,MAAa,kBAAmB,SAAQ,8BAAe;IACtD,YAAY,OAAe,EAAE,OAAgC;QAC5D,KAAK,CAAC,OAAO,EAAE;YACd,GAAG,OAAO;YACV,YAAY,EAAE,IAAI;SAClB,CAAC,CAAC;IACJ,CAAC;CACD;AAPD,gDAOC;AAKD,MAAa,kBAAmB,SAAQ,8BAAe;IACtD,YAAY,OAAe,EAAE,OAAwD;QACpF,KAAK,CAAC,OAAO,EAAE;YACd,GAAG,OAAO;YACV,YAAY,EAAE,IAAI;YAClB,IAAI,EAAE;gBACL,GAAG,OAAO,EAAE,IAAI;gBAChB,QAAQ,EAAE,OAAO,EAAE,QAAQ;aAC3B;SACD,CAAC,CAAC;IACJ,CAAC;CACD;AAXD,gDAWC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./ai-workflow-builder.service"), exports);
|
|
17
|
+
__exportStar(require("./ai-workflow-builder-agent.service"), exports);
|
|
18
18
|
__exportStar(require("./types"), exports);
|
|
19
19
|
__exportStar(require("./workflow-state"), exports);
|
|
20
20
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sEAAoD;AACpD,0CAAwB;AACxB,mDAAiC"}
|
package/dist/llm-config.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
interface LLMProviderConfig {
|
|
2
2
|
apiKey: string;
|
|
3
3
|
baseUrl?: string;
|
|
4
4
|
headers?: Record<string, string>;
|
|
5
|
-
}
|
|
6
|
-
export declare const o4mini: (config:
|
|
7
|
-
export declare const gpt41mini: (config:
|
|
8
|
-
export declare const
|
|
5
|
+
}
|
|
6
|
+
export declare const o4mini: (config: LLMProviderConfig) => Promise<import("@langchain/openai").ChatOpenAI<import("@langchain/openai").ChatOpenAICallOptions>>;
|
|
7
|
+
export declare const gpt41mini: (config: LLMProviderConfig) => Promise<import("@langchain/openai").ChatOpenAI<import("@langchain/openai").ChatOpenAICallOptions>>;
|
|
8
|
+
export declare const gpt41: (config: LLMProviderConfig) => Promise<import("@langchain/openai").ChatOpenAI<import("@langchain/openai").ChatOpenAICallOptions>>;
|
|
9
|
+
export declare const anthropicClaudeSonnet4: (config: LLMProviderConfig) => Promise<import("@langchain/anthropic").ChatAnthropic>;
|
|
9
10
|
export {};
|