@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.
Files changed (189) hide show
  1. package/dist/ai-workflow-builder-agent.service.d.ts +28 -0
  2. package/dist/ai-workflow-builder-agent.service.js +160 -0
  3. package/dist/ai-workflow-builder-agent.service.js.map +1 -0
  4. package/dist/build.tsbuildinfo +1 -1
  5. package/dist/chains/conversation-compact.d.ts +8 -0
  6. package/dist/chains/conversation-compact.js +56 -0
  7. package/dist/chains/conversation-compact.js.map +1 -0
  8. package/dist/chains/parameter-updater.d.ts +16 -0
  9. package/dist/chains/parameter-updater.js +94 -0
  10. package/dist/chains/parameter-updater.js.map +1 -0
  11. package/dist/chains/planner.js +2 -2
  12. package/dist/chains/planner.js.map +1 -1
  13. package/dist/chains/prompts/base/common-patterns.d.ts +1 -0
  14. package/dist/chains/prompts/base/common-patterns.js +13 -0
  15. package/dist/chains/prompts/base/common-patterns.js.map +1 -0
  16. package/dist/chains/prompts/base/core-instructions.d.ts +1 -0
  17. package/dist/chains/prompts/base/core-instructions.js +28 -0
  18. package/dist/chains/prompts/base/core-instructions.js.map +1 -0
  19. package/dist/chains/prompts/base/expression-rules.d.ts +1 -0
  20. package/dist/chains/prompts/base/expression-rules.js +15 -0
  21. package/dist/chains/prompts/base/expression-rules.js.map +1 -0
  22. package/dist/chains/prompts/base/output-format.d.ts +1 -0
  23. package/dist/chains/prompts/base/output-format.js +7 -0
  24. package/dist/chains/prompts/base/output-format.js.map +1 -0
  25. package/dist/chains/prompts/examples/advanced/resource-locator-examples.d.ts +1 -0
  26. package/dist/chains/prompts/examples/advanced/resource-locator-examples.js +79 -0
  27. package/dist/chains/prompts/examples/advanced/resource-locator-examples.js.map +1 -0
  28. package/dist/chains/prompts/examples/advanced/tool-node-examples.d.ts +1 -0
  29. package/dist/chains/prompts/examples/advanced/tool-node-examples.js +71 -0
  30. package/dist/chains/prompts/examples/advanced/tool-node-examples.js.map +1 -0
  31. package/dist/chains/prompts/examples/basic/if-node-examples.d.ts +1 -0
  32. package/dist/chains/prompts/examples/basic/if-node-examples.js +138 -0
  33. package/dist/chains/prompts/examples/basic/if-node-examples.js.map +1 -0
  34. package/dist/chains/prompts/examples/basic/set-node-examples.d.ts +1 -0
  35. package/dist/chains/prompts/examples/basic/set-node-examples.js +148 -0
  36. package/dist/chains/prompts/examples/basic/set-node-examples.js.map +1 -0
  37. package/dist/chains/prompts/examples/basic/simple-updates.d.ts +1 -0
  38. package/dist/chains/prompts/examples/basic/simple-updates.js +51 -0
  39. package/dist/chains/prompts/examples/basic/simple-updates.js.map +1 -0
  40. package/dist/chains/prompts/node-types/http-request.d.ts +1 -0
  41. package/dist/chains/prompts/node-types/http-request.js +113 -0
  42. package/dist/chains/prompts/node-types/http-request.js.map +1 -0
  43. package/dist/chains/prompts/node-types/if-node.d.ts +1 -0
  44. package/dist/chains/prompts/node-types/if-node.js +158 -0
  45. package/dist/chains/prompts/node-types/if-node.js.map +1 -0
  46. package/dist/chains/prompts/node-types/set-node.d.ts +1 -0
  47. package/dist/chains/prompts/node-types/set-node.js +91 -0
  48. package/dist/chains/prompts/node-types/set-node.js.map +1 -0
  49. package/dist/chains/prompts/node-types/tool-nodes.d.ts +1 -0
  50. package/dist/chains/prompts/node-types/tool-nodes.js +73 -0
  51. package/dist/chains/prompts/node-types/tool-nodes.js.map +1 -0
  52. package/dist/chains/prompts/parameter-types/resource-locator.d.ts +1 -0
  53. package/dist/chains/prompts/parameter-types/resource-locator.js +95 -0
  54. package/dist/chains/prompts/parameter-types/resource-locator.js.map +1 -0
  55. package/dist/chains/prompts/parameter-types/text-fields.d.ts +1 -0
  56. package/dist/chains/prompts/parameter-types/text-fields.js +22 -0
  57. package/dist/chains/prompts/parameter-types/text-fields.js.map +1 -0
  58. package/dist/chains/prompts/prompt-builder.d.ts +14 -0
  59. package/dist/chains/prompts/prompt-builder.js +118 -0
  60. package/dist/chains/prompts/prompt-builder.js.map +1 -0
  61. package/dist/chains/prompts/prompt-config.d.ts +5 -0
  62. package/dist/chains/prompts/prompt-config.js +52 -0
  63. package/dist/chains/prompts/prompt-config.js.map +1 -0
  64. package/dist/errors/index.d.ts +45 -0
  65. package/dist/errors/index.js +122 -0
  66. package/dist/errors/index.js.map +1 -0
  67. package/dist/index.d.ts +1 -1
  68. package/dist/index.js +1 -1
  69. package/dist/index.js.map +1 -1
  70. package/dist/llm-config.d.ts +6 -5
  71. package/dist/llm-config.js +19 -4
  72. package/dist/llm-config.js.map +1 -1
  73. package/dist/tools/add-node.tool.d.ts +56 -0
  74. package/dist/tools/add-node.tool.js +136 -0
  75. package/dist/tools/add-node.tool.js.map +1 -0
  76. package/dist/tools/connect-nodes.tool.d.ts +45 -0
  77. package/dist/tools/connect-nodes.tool.js +223 -0
  78. package/dist/tools/connect-nodes.tool.js.map +1 -0
  79. package/dist/tools/engines/node-search-engine.d.ts +25 -0
  80. package/dist/tools/engines/node-search-engine.js +121 -0
  81. package/dist/tools/engines/node-search-engine.js.map +1 -0
  82. package/dist/tools/helpers/index.d.ts +4 -0
  83. package/dist/tools/helpers/index.js +21 -0
  84. package/dist/tools/helpers/index.js.map +1 -0
  85. package/dist/tools/helpers/progress.d.ts +9 -0
  86. package/dist/tools/helpers/progress.js +114 -0
  87. package/dist/tools/helpers/progress.js.map +1 -0
  88. package/dist/tools/helpers/response.d.ts +7 -0
  89. package/dist/tools/helpers/response.js +31 -0
  90. package/dist/tools/helpers/response.js.map +1 -0
  91. package/dist/tools/helpers/state.d.ts +13 -0
  92. package/dist/tools/helpers/state.js +70 -0
  93. package/dist/tools/helpers/state.js.map +1 -0
  94. package/dist/tools/helpers/validation.d.ts +12 -0
  95. package/dist/tools/helpers/validation.js +69 -0
  96. package/dist/tools/helpers/validation.js.map +1 -0
  97. package/dist/tools/node-details.tool.d.ts +19 -0
  98. package/dist/tools/node-details.tool.js +133 -0
  99. package/dist/tools/node-details.tool.js.map +1 -0
  100. package/dist/tools/node-search.tool.d.ts +49 -0
  101. package/dist/tools/node-search.tool.js +146 -0
  102. package/dist/tools/node-search.tool.js.map +1 -0
  103. package/dist/tools/prompts/main-agent.prompt.d.ts +2 -0
  104. package/dist/tools/prompts/main-agent.prompt.js +390 -0
  105. package/dist/tools/prompts/main-agent.prompt.js.map +1 -0
  106. package/dist/tools/remove-node.tool.d.ts +13 -0
  107. package/dist/tools/remove-node.tool.js +97 -0
  108. package/dist/tools/remove-node.tool.js.map +1 -0
  109. package/dist/tools/update-node-parameters.tool.d.ts +19 -0
  110. package/dist/tools/update-node-parameters.tool.js +131 -0
  111. package/dist/tools/update-node-parameters.tool.js.map +1 -0
  112. package/dist/tools/utils/connection-parameters.utils.d.ts +8 -0
  113. package/dist/tools/utils/connection-parameters.utils.js +47 -0
  114. package/dist/tools/utils/connection-parameters.utils.js.map +1 -0
  115. package/dist/tools/utils/connection.utils.d.ts +15 -0
  116. package/dist/tools/utils/connection.utils.js +321 -0
  117. package/dist/tools/utils/connection.utils.js.map +1 -0
  118. package/dist/tools/utils/node-creation.utils.d.ts +8 -0
  119. package/dist/tools/utils/node-creation.utils.js +52 -0
  120. package/dist/tools/utils/node-creation.utils.js.map +1 -0
  121. package/dist/tools/utils/node-positioning.utils.d.ts +17 -0
  122. package/dist/tools/utils/node-positioning.utils.js +87 -0
  123. package/dist/tools/utils/node-positioning.utils.js.map +1 -0
  124. package/dist/tools/utils/parameter-update.utils.d.ts +6 -0
  125. package/dist/tools/utils/parameter-update.utils.js +75 -0
  126. package/dist/tools/utils/parameter-update.utils.js.map +1 -0
  127. package/dist/types/config.d.ts +53 -0
  128. package/dist/types/config.js +3 -0
  129. package/dist/types/config.js.map +1 -0
  130. package/dist/types/connections.d.ts +30 -0
  131. package/dist/types/connections.js +3 -0
  132. package/dist/types/connections.js.map +1 -0
  133. package/dist/types/index.d.ts +8 -0
  134. package/dist/types/index.js +25 -0
  135. package/dist/types/index.js.map +1 -0
  136. package/dist/types/messages.d.ts +38 -0
  137. package/dist/types/messages.js +3 -0
  138. package/dist/types/messages.js.map +1 -0
  139. package/dist/types/nodes.d.ts +26 -0
  140. package/dist/{types.js → types/nodes.js} +1 -1
  141. package/dist/types/nodes.js.map +1 -0
  142. package/dist/types/streaming.d.ts +33 -0
  143. package/dist/types/streaming.js +3 -0
  144. package/dist/types/streaming.js.map +1 -0
  145. package/dist/types/tools.d.ts +76 -0
  146. package/dist/types/tools.js +3 -0
  147. package/dist/types/tools.js.map +1 -0
  148. package/dist/types/utils.d.ts +2 -0
  149. package/dist/types/utils.js +3 -0
  150. package/dist/types/utils.js.map +1 -0
  151. package/dist/types/workflow.d.ts +21 -0
  152. package/dist/types/workflow.js +3 -0
  153. package/dist/types/workflow.js.map +1 -0
  154. package/dist/utils/node-helpers.d.ts +2 -0
  155. package/dist/utils/node-helpers.js +54 -0
  156. package/dist/utils/node-helpers.js.map +1 -0
  157. package/dist/utils/operations-processor.d.ts +10 -0
  158. package/dist/utils/operations-processor.js +114 -0
  159. package/dist/utils/operations-processor.js.map +1 -0
  160. package/dist/utils/stream-processor.d.ts +6 -0
  161. package/dist/utils/stream-processor.js +153 -0
  162. package/dist/utils/stream-processor.js.map +1 -0
  163. package/dist/utils/tool-executor.d.ts +3 -0
  164. package/dist/utils/tool-executor.js +86 -0
  165. package/dist/utils/tool-executor.js.map +1 -0
  166. package/dist/workflow-builder-agent.d.ts +41 -0
  167. package/dist/workflow-builder-agent.js +205 -0
  168. package/dist/workflow-builder-agent.js.map +1 -0
  169. package/dist/workflow-state.d.ts +12 -7
  170. package/dist/workflow-state.js +26 -7
  171. package/dist/workflow-state.js.map +1 -1
  172. package/package.json +24 -5
  173. package/dist/ai-workflow-builder.service.d.ts +0 -21
  174. package/dist/ai-workflow-builder.service.js +0 -294
  175. package/dist/ai-workflow-builder.service.js.map +0 -1
  176. package/dist/chains/connection-composer.d.ts +0 -10
  177. package/dist/chains/connection-composer.js +0 -135
  178. package/dist/chains/connection-composer.js.map +0 -1
  179. package/dist/chains/node-selector.d.ts +0 -8
  180. package/dist/chains/node-selector.js +0 -90
  181. package/dist/chains/node-selector.js.map +0 -1
  182. package/dist/chains/nodes-composer.d.ts +0 -8
  183. package/dist/chains/nodes-composer.js +0 -451
  184. package/dist/chains/nodes-composer.js.map +0 -1
  185. package/dist/chains/validator.d.ts +0 -2
  186. package/dist/chains/validator.js +0 -67
  187. package/dist/chains/validator.js.map +0 -1
  188. package/dist/types.d.ts +0 -87
  189. package/dist/types.js.map +0 -1
@@ -0,0 +1,8 @@
1
+ import type { BaseChatModel } from '@langchain/core/language_models/chat_models';
2
+ import type { BaseMessage } from '@langchain/core/messages';
3
+ export declare function conversationCompactChain(llm: BaseChatModel, messages: BaseMessage[]): Promise<{
4
+ success: boolean;
5
+ summary: Record<string, any>;
6
+ newMessages: BaseMessage[];
7
+ messagesRemoved: number;
8
+ }>;
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.conversationCompactChain = conversationCompactChain;
7
+ const messages_1 = require("@langchain/core/messages");
8
+ const zod_1 = __importDefault(require("zod"));
9
+ async function conversationCompactChain(llm, messages) {
10
+ const CompactedSession = zod_1.default.object({
11
+ summary: zod_1.default.string().describe('A concise summary of the conversation so far'),
12
+ key_decisions: zod_1.default.array(zod_1.default.string()).describe('List of key decisions and actions taken'),
13
+ current_state: zod_1.default.string().describe('Description of the current workflow state'),
14
+ next_steps: zod_1.default.string().describe('Suggested next steps based on the conversation'),
15
+ });
16
+ const modelWithStructure = llm.withStructuredOutput(CompactedSession);
17
+ const conversationText = messages
18
+ .map((msg) => {
19
+ if (msg instanceof messages_1.HumanMessage) {
20
+ return `User: ${msg.content}`;
21
+ }
22
+ else if (msg instanceof messages_1.AIMessage) {
23
+ return `Assistant: ${msg.content ?? 'Used tools'}`;
24
+ }
25
+ return '';
26
+ })
27
+ .filter(Boolean)
28
+ .join('\n');
29
+ const compactPrompt = `Please summarize the following conversation between a user and an AI assistant building an n8n workflow:
30
+
31
+ ${conversationText}
32
+
33
+ Provide a structured summary that captures the key points, decisions made, current state of the workflow, and suggested next steps.`;
34
+ const structuredOutput = await modelWithStructure.invoke(compactPrompt);
35
+ const compactedMessage = new messages_1.AIMessage({
36
+ content: `## Previous Conversation Summary
37
+
38
+ **Summary:** ${structuredOutput.summary}
39
+
40
+ **Key Decisions:**
41
+ ${structuredOutput.key_decisions.map((d) => `- ${d}`).join('\n')}
42
+
43
+ **Current State:** ${structuredOutput.current_state}
44
+
45
+ **Next Steps:** ${structuredOutput.next_steps}`,
46
+ });
47
+ const lastUserMessage = messages.slice(-1);
48
+ const newMessages = [lastUserMessage[0], compactedMessage];
49
+ return {
50
+ success: true,
51
+ summary: structuredOutput,
52
+ newMessages,
53
+ messagesRemoved: messages.length - newMessages.length,
54
+ };
55
+ }
56
+ //# sourceMappingURL=conversation-compact.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversation-compact.js","sourceRoot":"","sources":["../../src/chains/conversation-compact.ts"],"names":[],"mappings":";;;;;AAKA,4DA0DC;AA7DD,uDAAmE;AACnE,8CAAoB;AAEb,KAAK,UAAU,wBAAwB,CAAC,GAAkB,EAAE,QAAuB;IAEzF,MAAM,gBAAgB,GAAG,aAAC,CAAC,MAAM,CAAC;QACjC,OAAO,EAAE,aAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,8CAA8C,CAAC;QAC5E,aAAa,EAAE,aAAC,CAAC,KAAK,CAAC,aAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,CAAC,yCAAyC,CAAC;QACtF,aAAa,EAAE,aAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,2CAA2C,CAAC;QAC/E,UAAU,EAAE,aAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,gDAAgD,CAAC;KACjF,CAAC,CAAC;IAEH,MAAM,kBAAkB,GAAG,GAAG,CAAC,oBAAoB,CAAC,gBAAgB,CAAC,CAAC;IAGtE,MAAM,gBAAgB,GAAG,QAAQ;SAC/B,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;QACZ,IAAI,GAAG,YAAY,uBAAY,EAAE,CAAC;YAEjC,OAAO,SAAS,GAAG,CAAC,OAAO,EAAE,CAAC;QAC/B,CAAC;aAAM,IAAI,GAAG,YAAY,oBAAS,EAAE,CAAC;YAErC,OAAO,cAAc,GAAG,CAAC,OAAO,IAAI,YAAY,EAAE,CAAC;QACpD,CAAC;QACD,OAAO,EAAE,CAAC;IACX,CAAC,CAAC;SACD,MAAM,CAAC,OAAO,CAAC;SACf,IAAI,CAAC,IAAI,CAAC,CAAC;IAEb,MAAM,aAAa,GAAG;;EAErB,gBAAgB;;oIAEkH,CAAC;IAEpI,MAAM,gBAAgB,GAAG,MAAM,kBAAkB,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;IAGxE,MAAM,gBAAgB,GAAG,IAAI,oBAAS,CAAC;QACtC,OAAO,EAAE;;eAEI,gBAAgB,CAAC,OAAO;;;EAGpC,gBAAgB,CAAC,aAA0B,CAAC,GAAG,CAAC,CAAC,CAAS,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;;qBAEjE,gBAAgB,CAAC,aAAa;;kBAEjC,gBAAgB,CAAC,UAAU,EAAE;KAC7C,CAAC,CAAC;IAGH,MAAM,eAAe,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3C,MAAM,WAAW,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,gBAAgB,CAAC,CAAC;IAE3D,OAAO;QACN,OAAO,EAAE,IAAI;QACb,OAAO,EAAE,gBAAgB;QACzB,WAAW;QACX,eAAe,EAAE,QAAQ,CAAC,MAAM,GAAG,WAAW,CAAC,MAAM;KACrD,CAAC;AACH,CAAC"}
@@ -0,0 +1,16 @@
1
+ import type { BaseChatModel } from '@langchain/core/language_models/chat_models';
2
+ import type { Logger } from 'n8n-workflow';
3
+ import { z } from 'zod';
4
+ import type { ParameterUpdaterOptions } from '../types/config';
5
+ export declare const parametersSchema: z.ZodObject<{
6
+ parameters: z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>;
7
+ }, "strip", z.ZodTypeAny, {
8
+ parameters: {} & {
9
+ [k: string]: unknown;
10
+ };
11
+ }, {
12
+ parameters: {} & {
13
+ [k: string]: unknown;
14
+ };
15
+ }>;
16
+ export declare const createParameterUpdaterChain: (llm: BaseChatModel, options: ParameterUpdaterOptions, logger?: Logger) => import("@langchain/core/runnables").Runnable<any, Record<string, any>, import("@langchain/core/runnables").RunnableConfig<Record<string, any>>>;
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createParameterUpdaterChain = exports.parametersSchema = void 0;
4
+ const messages_1 = require("@langchain/core/messages");
5
+ const prompts_1 = require("@langchain/core/prompts");
6
+ const zod_1 = require("zod");
7
+ const errors_1 = require("../errors");
8
+ const prompt_builder_1 = require("./prompts/prompt-builder");
9
+ exports.parametersSchema = zod_1.z
10
+ .object({
11
+ parameters: zod_1.z
12
+ .object({})
13
+ .passthrough()
14
+ .describe("The complete updated parameters object for the node. This should be a JSON object that matches the node's parameter structure. Include ALL existing parameters plus the requested changes."),
15
+ })
16
+ .describe('The complete updated parameters object for the node. Must include only parameters from <node_properties_definition>, for example For example: { "parameters": { "method": "POST", "url": "https://api.example.com", "sendHeaders": true, "headerParameters": { "parameters": [{ "name": "Content-Type", "value": "application/json" }] } } }}');
17
+ const nodeDefinitionPrompt = `
18
+ The node accepts these properties:
19
+ <node_properties_definition>
20
+ {node_definition}
21
+ </node_properties_definition>`;
22
+ const workflowContextPrompt = `
23
+ <current_workflow_json>
24
+ {workflow_json}
25
+ </current_workflow_json>
26
+
27
+ <current_simplified_execution_data>
28
+ {execution_data}
29
+ </current_simplified_execution_data>
30
+
31
+ <current_execution_nodes_schemas>
32
+ {execution_schema}
33
+ </current_execution_nodes_schemas>
34
+
35
+
36
+ <selected_node>
37
+ Name: {node_name}
38
+ Type: {node_type}
39
+
40
+ Current Parameters: {current_parameters}
41
+ </selected_node>
42
+
43
+ <requested_changes>
44
+ {changes}
45
+ </requested_changes>
46
+
47
+ Based on the requested changes and the node's property definitions, return the complete updated parameters object.`;
48
+ const createParameterUpdaterChain = (llm, options, logger) => {
49
+ if (typeof llm.withStructuredOutput !== 'function') {
50
+ throw new errors_1.LLMServiceError("LLM doesn't support withStructuredOutput", {
51
+ llmModel: llm._llmType(),
52
+ });
53
+ }
54
+ const systemPromptContent = prompt_builder_1.ParameterUpdatePromptBuilder.buildSystemPrompt({
55
+ nodeType: options.nodeType,
56
+ nodeDefinition: options.nodeDefinition,
57
+ requestedChanges: options.requestedChanges,
58
+ hasResourceLocatorParams: prompt_builder_1.ParameterUpdatePromptBuilder.hasResourceLocatorParameters(options.nodeDefinition),
59
+ });
60
+ const tokenEstimate = prompt_builder_1.ParameterUpdatePromptBuilder.estimateTokens(systemPromptContent);
61
+ logger?.debug(`Parameter updater prompt size: ~${tokenEstimate} tokens`);
62
+ const systemPrompt = new messages_1.SystemMessage({
63
+ content: [
64
+ {
65
+ type: 'text',
66
+ text: systemPromptContent,
67
+ cache_control: { type: 'ephemeral' },
68
+ },
69
+ ],
70
+ });
71
+ const nodeDefinitionMessage = prompts_1.ChatPromptTemplate.fromMessages([
72
+ [
73
+ 'human',
74
+ [
75
+ {
76
+ type: 'text',
77
+ text: nodeDefinitionPrompt,
78
+ cache_control: { type: 'ephemeral' },
79
+ },
80
+ ],
81
+ ],
82
+ ]);
83
+ const workflowContextMessage = prompts_1.HumanMessagePromptTemplate.fromTemplate(workflowContextPrompt);
84
+ const prompt = prompts_1.ChatPromptTemplate.fromMessages([
85
+ systemPrompt,
86
+ nodeDefinitionMessage,
87
+ workflowContextMessage,
88
+ ]);
89
+ const llmWithStructuredOutput = llm.withStructuredOutput(exports.parametersSchema);
90
+ const modelWithStructure = prompt.pipe(llmWithStructuredOutput);
91
+ return modelWithStructure;
92
+ };
93
+ exports.createParameterUpdaterChain = createParameterUpdaterChain;
94
+ //# sourceMappingURL=parameter-updater.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parameter-updater.js","sourceRoot":"","sources":["../../src/chains/parameter-updater.ts"],"names":[],"mappings":";;;AACA,uDAAyD;AACzD,qDAAyF;AAEzF,6BAAwB;AAExB,sCAA4C;AAE5C,6DAAwE;AAE3D,QAAA,gBAAgB,GAAG,OAAC;KAC/B,MAAM,CAAC;IACP,UAAU,EAAE,OAAC;SACX,MAAM,CAAC,EAAE,CAAC;SACV,WAAW,EAAE;SACb,QAAQ,CACR,4LAA4L,CAC5L;CACF,CAAC;KACD,QAAQ,CACR,+UAA+U,CAC/U,CAAC;AAEH,MAAM,oBAAoB,GAAG;;;;8BAIC,CAAC;AAE/B,MAAM,qBAAqB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;mHAyBqF,CAAC;AAK7G,MAAM,2BAA2B,GAAG,CAC1C,GAAkB,EAClB,OAAgC,EAChC,MAAe,EACd,EAAE;IACH,IAAI,OAAO,GAAG,CAAC,oBAAoB,KAAK,UAAU,EAAE,CAAC;QACpD,MAAM,IAAI,wBAAe,CAAC,0CAA0C,EAAE;YACrE,QAAQ,EAAE,GAAG,CAAC,QAAQ,EAAE;SACxB,CAAC,CAAC;IACJ,CAAC;IAGD,MAAM,mBAAmB,GAAG,6CAA4B,CAAC,iBAAiB,CAAC;QAC1E,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,cAAc,EAAE,OAAO,CAAC,cAAc;QACtC,gBAAgB,EAAE,OAAO,CAAC,gBAAgB;QAC1C,wBAAwB,EAAE,6CAA4B,CAAC,4BAA4B,CAClF,OAAO,CAAC,cAAc,CACtB;KACD,CAAC,CAAC;IAGH,MAAM,aAAa,GAAG,6CAA4B,CAAC,cAAc,CAAC,mBAAmB,CAAC,CAAC;IACvF,MAAM,EAAE,KAAK,CAAC,mCAAmC,aAAa,SAAS,CAAC,CAAC;IAGzE,MAAM,YAAY,GAAG,IAAI,wBAAa,CAAC;QACtC,OAAO,EAAE;YACR;gBACC,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,mBAAmB;gBACzB,aAAa,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE;aACpC;SACD;KACD,CAAC,CAAC;IACH,MAAM,qBAAqB,GAAG,4BAAkB,CAAC,YAAY,CAAC;QAC7D;YACC,OAAO;YACP;gBACC;oBACC,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,oBAAoB;oBAC1B,aAAa,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE;iBACpC;aACD;SACD;KACD,CAAC,CAAC;IAEH,MAAM,sBAAsB,GAAG,oCAA0B,CAAC,YAAY,CAAC,qBAAqB,CAAC,CAAC;IAE9F,MAAM,MAAM,GAAG,4BAAkB,CAAC,YAAY,CAAC;QAC9C,YAAY;QACZ,qBAAqB;QACrB,sBAAsB;KACtB,CAAC,CAAC;IACH,MAAM,uBAAuB,GAAG,GAAG,CAAC,oBAAoB,CAAC,wBAAgB,CAAC,CAAC;IAC3E,MAAM,kBAAkB,GAAG,MAAM,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;IAEhE,OAAO,kBAAkB,CAAC;AAC3B,CAAC,CAAC;AA3DW,QAAA,2BAA2B,+BA2DtC"}
@@ -4,8 +4,8 @@ exports.plannerChain = exports.plannerPrompt = void 0;
4
4
  const messages_1 = require("@langchain/core/messages");
5
5
  const prompts_1 = require("@langchain/core/prompts");
6
6
  const tools_1 = require("@langchain/core/tools");
7
- const n8n_workflow_1 = require("n8n-workflow");
8
7
  const zod_1 = require("zod");
8
+ const errors_1 = require("../errors");
9
9
  exports.plannerPrompt = new messages_1.SystemMessage(`You are a Workflow Planner for n8n, a platform that helps users automate processes across different services and APIs.
10
10
 
11
11
  ## Your Task
@@ -72,7 +72,7 @@ const chatPrompt = prompts_1.ChatPromptTemplate.fromMessages([
72
72
  ]);
73
73
  const plannerChain = (llm) => {
74
74
  if (!llm.bindTools) {
75
- throw new n8n_workflow_1.OperationalError("LLM doesn't support binding tools");
75
+ throw new errors_1.LLMServiceError("LLM doesn't support binding tools", { llmModel: llm._llmType() });
76
76
  }
77
77
  return chatPrompt
78
78
  .pipe(llm.bindTools([generatePlanTool], {
@@ -1 +1 @@
1
- {"version":3,"file":"planner.js","sourceRoot":"","sources":["../../src/chains/planner.ts"],"names":[],"mappings":";;;AAEA,uDAAyD;AACzD,qDAAyF;AACzF,iDAA8D;AAC9D,+CAAgD;AAChD,6BAAwB;AAEX,QAAA,aAAa,GAAG,IAAI,wBAAa,CAC7C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4FA0C2F,CAC3F,CAAC;AAEF,MAAM,UAAU,GAAG,OAAC,CAAC,MAAM,CAAC;IAC3B,KAAK,EAAE,OAAC;SACN,KAAK,CACL,OAAC;SACC,MAAM,EAAE;SACR,QAAQ,CACR,qHAAqH,CACrH,CACF;SACA,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CACR,0KAA0K,CAC1K;CACF,CAAC,CAAC;AAEH,MAAM,gBAAgB,GAAG,IAAI,6BAAqB,CAAC;IAClD,IAAI,EAAE,eAAe;IACrB,WAAW,EACV,4HAA4H;IAC7H,MAAM,EAAE,UAAU;IAClB,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;QACrB,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC;IAC/B,CAAC;CACD,CAAC,CAAC;AAEH,MAAM,aAAa,GAAG,UAAU,CAAC;AACjC,MAAM,UAAU,GAAG,4BAAkB,CAAC,YAAY,CAAC;IAClD,qBAAa;IACb,oCAA0B,CAAC,YAAY,CAAC,aAAa,CAAC;CACtD,CAAC,CAAC;AAEI,MAAM,YAAY,GAAG,CAAC,GAAkB,EAAE,EAAE;IAClD,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC;QACpB,MAAM,IAAI,+BAAgB,CAAC,mCAAmC,CAAC,CAAC;IACjE,CAAC;IAED,OAAO,UAAU;SACf,IAAI,CACJ,GAAG,CAAC,SAAS,CAAC,CAAC,gBAAgB,CAAC,EAAE;QACjC,WAAW,EAAE,gBAAgB,CAAC,IAAI;KAClC,CAAC,CACF;SACA,IAAI,CAAC,CAAC,CAAiB,EAAE,EAAE;QAC3B,MAAM,QAAQ,GAAG,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC;QACnC,OAAO,CAAC,QAAQ,EAAE,IAAmC,CAAA,CAAC,KAAK,CAAC;IAC7D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAfW,QAAA,YAAY,gBAevB"}
1
+ {"version":3,"file":"planner.js","sourceRoot":"","sources":["../../src/chains/planner.ts"],"names":[],"mappings":";;;AAEA,uDAAyD;AACzD,qDAAyF;AACzF,iDAA8D;AAC9D,6BAAwB;AAExB,sCAA4C;AAE/B,QAAA,aAAa,GAAG,IAAI,wBAAa,CAC7C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4FA0C2F,CAC3F,CAAC;AAEF,MAAM,UAAU,GAAG,OAAC,CAAC,MAAM,CAAC;IAC3B,KAAK,EAAE,OAAC;SACN,KAAK,CACL,OAAC;SACC,MAAM,EAAE;SACR,QAAQ,CACR,qHAAqH,CACrH,CACF;SACA,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CACR,0KAA0K,CAC1K;CACF,CAAC,CAAC;AAEH,MAAM,gBAAgB,GAAG,IAAI,6BAAqB,CAAC;IAClD,IAAI,EAAE,eAAe;IACrB,WAAW,EACV,4HAA4H;IAC7H,MAAM,EAAE,UAAU;IAClB,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;QACrB,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC;IAC/B,CAAC;CACD,CAAC,CAAC;AAEH,MAAM,aAAa,GAAG,UAAU,CAAC;AACjC,MAAM,UAAU,GAAG,4BAAkB,CAAC,YAAY,CAAC;IAClD,qBAAa;IACb,oCAA0B,CAAC,YAAY,CAAC,aAAa,CAAC;CACtD,CAAC,CAAC;AAEI,MAAM,YAAY,GAAG,CAAC,GAAkB,EAAE,EAAE;IAClD,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC;QACpB,MAAM,IAAI,wBAAe,CAAC,mCAAmC,EAAE,EAAE,QAAQ,EAAE,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IAC9F,CAAC;IAED,OAAO,UAAU;SACf,IAAI,CACJ,GAAG,CAAC,SAAS,CAAC,CAAC,gBAAgB,CAAC,EAAE;QACjC,WAAW,EAAE,gBAAgB,CAAC,IAAI;KAClC,CAAC,CACF;SACA,IAAI,CAAC,CAAC,CAAiB,EAAE,EAAE;QAC3B,MAAM,QAAQ,GAAG,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC;QACnC,OAAO,CAAC,QAAQ,EAAE,IAAmC,CAAA,CAAC,KAAK,CAAC;IAC7D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAfW,QAAA,YAAY,gBAevB"}
@@ -0,0 +1 @@
1
+ export declare const COMMON_PATTERNS = "\n## Common Parameter Update Patterns\n\n### HTTP Request Node Updates\n- URL: Set directly or use expressions\n- Method: GET, POST, PUT, DELETE, etc.\n- Headers: Add/update in headerParameters.parameters array\n- Body: Update bodyParameters.parameters for POST/PUT\n- Authentication: Update authentication settings";
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.COMMON_PATTERNS = void 0;
4
+ exports.COMMON_PATTERNS = `
5
+ ## Common Parameter Update Patterns
6
+
7
+ ### HTTP Request Node Updates
8
+ - URL: Set directly or use expressions
9
+ - Method: GET, POST, PUT, DELETE, etc.
10
+ - Headers: Add/update in headerParameters.parameters array
11
+ - Body: Update bodyParameters.parameters for POST/PUT
12
+ - Authentication: Update authentication settings`;
13
+ //# sourceMappingURL=common-patterns.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common-patterns.js","sourceRoot":"","sources":["../../../../src/chains/prompts/base/common-patterns.ts"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAAG;;;;;;;;iDAQkB,CAAC"}
@@ -0,0 +1 @@
1
+ export declare const CORE_INSTRUCTIONS = "You are an expert n8n workflow architect who updates node parameters based on natural language instructions.\n\n## Your Task\nUpdate the parameters of an existing n8n node based on the requested changes. Return the COMPLETE parameters object with both modified and unmodified parameters. Only modify the parameters that are explicitly mentioned in the changes, preserving all other existing parameters exactly as they are.\n\n## Reference Information\nYou will receive:\n1. The original user workflow request\n2. The current workflow JSON\n3. The selected node's current configuration (id, name, type, parameters)\n4. The node type's parameter definitions\n5. Natural language changes to apply\n\n## Parameter Update Guidelines\n1. START WITH CURRENT: If current parameters is empty {}, start with an empty object and add the requested parameters\n2. PRESERVE EXISTING VALUES: Only modify parameters mentioned in the requested changes\n3. MAINTAIN STRUCTURE: Keep the exact parameter structure required by the node type\n4. CHECK FOR RESOURCELOCATOR: If a parameter is type 'resourceLocator' in the node definition, it MUST use the ResourceLocator structure with __rl, mode, and value fields\n5. USE PROPER EXPRESSIONS: Follow n8n expression syntax when referencing other nodes\n6. VALIDATE TYPES: Ensure parameter values match their expected types\n7. HANDLE NESTED PARAMETERS: Correctly update nested structures like headers, conditions, etc.\n8. SIMPLE VALUES: For simple parameter updates like \"Set X to Y\", directly set the parameter without unnecessary nesting\n9. GENERATE IDS: When adding new items to arrays (like assignments, headers, etc.), generate unique IDs using a simple pattern like \"id-1\", \"id-2\", etc.\n10. TOOL NODE DETECTION: Check if node type ends with \"Tool\" to determine if $fromAI expressions are available";
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CORE_INSTRUCTIONS = void 0;
4
+ exports.CORE_INSTRUCTIONS = `You are an expert n8n workflow architect who updates node parameters based on natural language instructions.
5
+
6
+ ## Your Task
7
+ Update the parameters of an existing n8n node based on the requested changes. Return the COMPLETE parameters object with both modified and unmodified parameters. Only modify the parameters that are explicitly mentioned in the changes, preserving all other existing parameters exactly as they are.
8
+
9
+ ## Reference Information
10
+ You will receive:
11
+ 1. The original user workflow request
12
+ 2. The current workflow JSON
13
+ 3. The selected node's current configuration (id, name, type, parameters)
14
+ 4. The node type's parameter definitions
15
+ 5. Natural language changes to apply
16
+
17
+ ## Parameter Update Guidelines
18
+ 1. START WITH CURRENT: If current parameters is empty {}, start with an empty object and add the requested parameters
19
+ 2. PRESERVE EXISTING VALUES: Only modify parameters mentioned in the requested changes
20
+ 3. MAINTAIN STRUCTURE: Keep the exact parameter structure required by the node type
21
+ 4. CHECK FOR RESOURCELOCATOR: If a parameter is type 'resourceLocator' in the node definition, it MUST use the ResourceLocator structure with __rl, mode, and value fields
22
+ 5. USE PROPER EXPRESSIONS: Follow n8n expression syntax when referencing other nodes
23
+ 6. VALIDATE TYPES: Ensure parameter values match their expected types
24
+ 7. HANDLE NESTED PARAMETERS: Correctly update nested structures like headers, conditions, etc.
25
+ 8. SIMPLE VALUES: For simple parameter updates like "Set X to Y", directly set the parameter without unnecessary nesting
26
+ 9. GENERATE IDS: When adding new items to arrays (like assignments, headers, etc.), generate unique IDs using a simple pattern like "id-1", "id-2", etc.
27
+ 10. TOOL NODE DETECTION: Check if node type ends with "Tool" to determine if $fromAI expressions are available`;
28
+ //# sourceMappingURL=core-instructions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core-instructions.js","sourceRoot":"","sources":["../../../../src/chains/prompts/base/core-instructions.ts"],"names":[],"mappings":";;;AAAa,QAAA,iBAAiB,GAAG;;;;;;;;;;;;;;;;;;;;;;;+GAuB8E,CAAC"}
@@ -0,0 +1 @@
1
+ export declare const EXPRESSION_RULES = "\n## CRITICAL: Correctly Formatting n8n Expressions\nWhen using expressions to reference data from other nodes:\n- ALWAYS use the format: `={{ $('Node Name').item.json.field }}`\n- NEVER omit the equals sign before the double curly braces\n- ALWAYS use DOUBLE curly braces, never single\n- NEVER use emojis or special characters inside expressions as they will break the expression\n- INCORRECT: `{ $('Node Name').item.json.field }` (missing =, single braces)\n- INCORRECT: `{{ $('Node Name').item.json.field }}` (missing =)\n- INCORRECT: `={{ $('\uD83D\uDC4D Node').item.json.field }}` (contains emoji)\n- CORRECT: `={{ $('Previous Node').item.json.field }}`";
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EXPRESSION_RULES = void 0;
4
+ exports.EXPRESSION_RULES = `
5
+ ## CRITICAL: Correctly Formatting n8n Expressions
6
+ When using expressions to reference data from other nodes:
7
+ - ALWAYS use the format: \`={{ $('Node Name').item.json.field }}\`
8
+ - NEVER omit the equals sign before the double curly braces
9
+ - ALWAYS use DOUBLE curly braces, never single
10
+ - NEVER use emojis or special characters inside expressions as they will break the expression
11
+ - INCORRECT: \`{ $('Node Name').item.json.field }\` (missing =, single braces)
12
+ - INCORRECT: \`{{ $('Node Name').item.json.field }}\` (missing =)
13
+ - INCORRECT: \`={{ $('👍 Node').item.json.field }}\` (contains emoji)
14
+ - CORRECT: \`={{ $('Previous Node').item.json.field }}\``;
15
+ //# sourceMappingURL=expression-rules.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"expression-rules.js","sourceRoot":"","sources":["../../../../src/chains/prompts/base/expression-rules.ts"],"names":[],"mappings":";;;AAAa,QAAA,gBAAgB,GAAG;;;;;;;;;;yDAUyB,CAAC"}
@@ -0,0 +1 @@
1
+ export declare const OUTPUT_FORMAT = "\n## Output Format\nReturn ONLY the complete updated parameters object that matches the node's parameter structure. Include ALL parameters, both modified and unmodified.";
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OUTPUT_FORMAT = void 0;
4
+ exports.OUTPUT_FORMAT = `
5
+ ## Output Format
6
+ Return ONLY the complete updated parameters object that matches the node's parameter structure. Include ALL parameters, both modified and unmodified.`;
7
+ //# sourceMappingURL=output-format.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"output-format.js","sourceRoot":"","sources":["../../../../src/chains/prompts/base/output-format.ts"],"names":[],"mappings":";;;AAAa,QAAA,aAAa,GAAG;;sJAEyH,CAAC"}
@@ -0,0 +1 @@
1
+ export declare const RESOURCE_LOCATOR_EXAMPLES = "\n### ResourceLocator Examples\n\n#### Example 1: Slack Node - Channel by ID\nCurrent Parameters:\n{\n \"select\": \"channel\",\n \"channelId\": {\n \"__rl\": true,\n \"value\": \"\",\n \"mode\": \"list\"\n },\n \"otherOptions\": {}\n}\n\nRequested Changes: Send to channel C0122KQ70S7E\n\nExpected Output:\n{\n \"select\": \"channel\",\n \"channelId\": {\n \"__rl\": true,\n \"mode\": \"id\",\n \"value\": \"C0122KQ70S7E\"\n },\n \"otherOptions\": {}\n}\n\n#### Example 2: Google Drive Node - File by URL\nCurrent Parameters:\n{\n \"operation\": \"download\",\n \"fileId\": {\n \"__rl\": true,\n \"value\": \"\",\n \"mode\": \"list\"\n }\n}\n\nRequested Changes: Use file https://drive.google.com/file/d/1ABC123XYZ/view\n\nExpected Output:\n{\n \"operation\": \"download\",\n \"fileId\": {\n \"__rl\": true,\n \"mode\": \"url\",\n \"value\": \"https://drive.google.com/file/d/1ABC123XYZ/view\"\n }\n}\n\n#### Example 3: Notion Node - Page ID from Expression\nCurrent Parameters:\n{\n \"resource\": \"databasePage\",\n \"operation\": \"get\",\n \"pageId\": {\n \"__rl\": true,\n \"value\": \"hardcoded-page-id\",\n \"mode\": \"id\"\n }\n}\n\nRequested Changes: Use page ID from the previous node's output\n\nExpected Output:\n{\n \"resource\": \"databasePage\",\n \"operation\": \"get\",\n \"pageId\": {\n \"__rl\": true,\n \"mode\": \"id\",\n \"value\": \"={{ $('Previous Node').item.json.pageId }}\"\n }\n}";
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RESOURCE_LOCATOR_EXAMPLES = void 0;
4
+ exports.RESOURCE_LOCATOR_EXAMPLES = `
5
+ ### ResourceLocator Examples
6
+
7
+ #### Example 1: Slack Node - Channel by ID
8
+ Current Parameters:
9
+ {
10
+ "select": "channel",
11
+ "channelId": {
12
+ "__rl": true,
13
+ "value": "",
14
+ "mode": "list"
15
+ },
16
+ "otherOptions": {}
17
+ }
18
+
19
+ Requested Changes: Send to channel C0122KQ70S7E
20
+
21
+ Expected Output:
22
+ {
23
+ "select": "channel",
24
+ "channelId": {
25
+ "__rl": true,
26
+ "mode": "id",
27
+ "value": "C0122KQ70S7E"
28
+ },
29
+ "otherOptions": {}
30
+ }
31
+
32
+ #### Example 2: Google Drive Node - File by URL
33
+ Current Parameters:
34
+ {
35
+ "operation": "download",
36
+ "fileId": {
37
+ "__rl": true,
38
+ "value": "",
39
+ "mode": "list"
40
+ }
41
+ }
42
+
43
+ Requested Changes: Use file https://drive.google.com/file/d/1ABC123XYZ/view
44
+
45
+ Expected Output:
46
+ {
47
+ "operation": "download",
48
+ "fileId": {
49
+ "__rl": true,
50
+ "mode": "url",
51
+ "value": "https://drive.google.com/file/d/1ABC123XYZ/view"
52
+ }
53
+ }
54
+
55
+ #### Example 3: Notion Node - Page ID from Expression
56
+ Current Parameters:
57
+ {
58
+ "resource": "databasePage",
59
+ "operation": "get",
60
+ "pageId": {
61
+ "__rl": true,
62
+ "value": "hardcoded-page-id",
63
+ "mode": "id"
64
+ }
65
+ }
66
+
67
+ Requested Changes: Use page ID from the previous node's output
68
+
69
+ Expected Output:
70
+ {
71
+ "resource": "databasePage",
72
+ "operation": "get",
73
+ "pageId": {
74
+ "__rl": true,
75
+ "mode": "id",
76
+ "value": "={{ $('Previous Node').item.json.pageId }}"
77
+ }
78
+ }`;
79
+ //# sourceMappingURL=resource-locator-examples.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resource-locator-examples.js","sourceRoot":"","sources":["../../../../../src/chains/prompts/examples/advanced/resource-locator-examples.ts"],"names":[],"mappings":";;;AAAa,QAAA,yBAAyB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0EvC,CAAC"}
@@ -0,0 +1 @@
1
+ export declare const TOOL_NODE_EXAMPLES = "\n### Tool Node Examples\n\n#### Example 1: Gmail Tool - Send Email with AI\nCurrent Parameters: {}\nRequested Changes: Let AI determine recipient, subject, and message\nExpected Output:\n{\n \"sendTo\": \"={{ $fromAI('to') }}\",\n \"subject\": \"={{ $fromAI('subject') }}\",\n \"message\": \"={{ $fromAI('message_html') }}\",\n \"options\": {}\n}\n\n#### Example 2: Google Calendar Tool - Filter by Date\nCurrent Parameters:\n{\n \"operation\": \"getAll\",\n \"calendar\": {\n \"__rl\": true,\n \"value\": \"primary\",\n \"mode\": \"list\"\n }\n}\n\nRequested Changes: Let AI determine date range for filtering\n\nExpected Output:\n{\n \"operation\": \"getAll\",\n \"calendar\": {\n \"__rl\": true,\n \"value\": \"primary\",\n \"mode\": \"list\"\n },\n \"timeMin\": \"={{ $fromAI('After', '', 'string') }}\",\n \"timeMax\": \"={{ $fromAI('Before', '', 'string') }}\"\n}\n\n#### Example 3: Slack Tool - Send Message\nCurrent Parameters:\n{\n \"resource\": \"message\"\n}\n\nRequested Changes: Let AI determine channel and message content\n\nExpected Output:\n{\n \"resource\": \"message\",\n \"channelId\": \"={{ $fromAI('channel') }}\",\n \"messageText\": \"={{ $fromAI('message') }}\"\n}\n\n#### Example 4: Tool Node with Mixed Content\nCurrent Parameters:\n{\n \"sendTo\": \"admin@company.com\"\n}\n\nRequested Changes: Keep admin email but let AI add additional recipients and determine subject\n\nExpected Output:\n{\n \"sendTo\": \"=admin@company.com, {{ $fromAI('additional_recipients') }}\",\n \"subject\": \"={{ $fromAI('subject') }} - Automated Report\"\n}";
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TOOL_NODE_EXAMPLES = void 0;
4
+ exports.TOOL_NODE_EXAMPLES = `
5
+ ### Tool Node Examples
6
+
7
+ #### Example 1: Gmail Tool - Send Email with AI
8
+ Current Parameters: {}
9
+ Requested Changes: Let AI determine recipient, subject, and message
10
+ Expected Output:
11
+ {
12
+ "sendTo": "={{ $fromAI('to') }}",
13
+ "subject": "={{ $fromAI('subject') }}",
14
+ "message": "={{ $fromAI('message_html') }}",
15
+ "options": {}
16
+ }
17
+
18
+ #### Example 2: Google Calendar Tool - Filter by Date
19
+ Current Parameters:
20
+ {
21
+ "operation": "getAll",
22
+ "calendar": {
23
+ "__rl": true,
24
+ "value": "primary",
25
+ "mode": "list"
26
+ }
27
+ }
28
+
29
+ Requested Changes: Let AI determine date range for filtering
30
+
31
+ Expected Output:
32
+ {
33
+ "operation": "getAll",
34
+ "calendar": {
35
+ "__rl": true,
36
+ "value": "primary",
37
+ "mode": "list"
38
+ },
39
+ "timeMin": "={{ $fromAI('After', '', 'string') }}",
40
+ "timeMax": "={{ $fromAI('Before', '', 'string') }}"
41
+ }
42
+
43
+ #### Example 3: Slack Tool - Send Message
44
+ Current Parameters:
45
+ {
46
+ "resource": "message"
47
+ }
48
+
49
+ Requested Changes: Let AI determine channel and message content
50
+
51
+ Expected Output:
52
+ {
53
+ "resource": "message",
54
+ "channelId": "={{ $fromAI('channel') }}",
55
+ "messageText": "={{ $fromAI('message') }}"
56
+ }
57
+
58
+ #### Example 4: Tool Node with Mixed Content
59
+ Current Parameters:
60
+ {
61
+ "sendTo": "admin@company.com"
62
+ }
63
+
64
+ Requested Changes: Keep admin email but let AI add additional recipients and determine subject
65
+
66
+ Expected Output:
67
+ {
68
+ "sendTo": "=admin@company.com, {{ $fromAI('additional_recipients') }}",
69
+ "subject": "={{ $fromAI('subject') }} - Automated Report"
70
+ }`;
71
+ //# sourceMappingURL=tool-node-examples.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-node-examples.js","sourceRoot":"","sources":["../../../../../src/chains/prompts/examples/advanced/tool-node-examples.ts"],"names":[],"mappings":";;;AAAa,QAAA,kBAAkB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkEhC,CAAC"}
@@ -0,0 +1 @@
1
+ export declare const IF_NODE_EXAMPLES = "\n### IF Node Examples\n\n#### Example 1: Simple String Condition\nCurrent Parameters: {}\nRequested Changes: Check if order status equals \"pending\"\nExpected Output:\n{\n \"conditions\": {\n \"options\": {\n \"caseSensitive\": false,\n \"leftValue\": \"\",\n \"typeValidation\": \"loose\"\n },\n \"conditions\": [\n {\n \"id\": \"id-1\",\n \"leftValue\": \"={{ $('Previous Node').item.json.orderStatus }}\",\n \"rightValue\": \"pending\",\n \"operator\": {\n \"type\": \"string\",\n \"operation\": \"equals\"\n }\n }\n ],\n \"combinator\": \"and\"\n }\n}\n\n#### Example 2: Check if Field Exists\nCurrent Parameters: {}\nRequested Changes: Check if email field exists in the data\nExpected Output:\n{\n \"conditions\": {\n \"options\": {\n \"caseSensitive\": false,\n \"leftValue\": \"\",\n \"typeValidation\": \"loose\"\n },\n \"conditions\": [\n {\n \"id\": \"id-1\",\n \"leftValue\": \"={{ $('Previous Node').item.json.email }}\",\n \"operator\": {\n \"type\": \"string\",\n \"operation\": \"exists\"\n }\n }\n ],\n \"combinator\": \"and\"\n }\n}\n\n#### Example 3: Multiple Conditions with AND\nCurrent Parameters: {}\nRequested Changes: Check if status is active AND score is 50 or higher\nExpected Output:\n{\n \"conditions\": {\n \"options\": {\n \"caseSensitive\": false,\n \"leftValue\": \"\",\n \"typeValidation\": \"loose\"\n },\n \"conditions\": [\n {\n \"id\": \"id-1\",\n \"leftValue\": \"={{ $('Set').item.json.status }}\",\n \"rightValue\": \"active\",\n \"operator\": {\n \"type\": \"string\",\n \"operation\": \"equals\"\n }\n },\n {\n \"id\": \"id-2\",\n \"leftValue\": \"={{ $('Set').item.json.score }}\",\n \"rightValue\": \"50\",\n \"operator\": {\n \"type\": \"number\",\n \"operation\": \"gte\"\n }\n }\n ],\n \"combinator\": \"and\"\n }\n}\n\n#### Example 3: IF Node - Complex Multi-Type Conditions\nCurrent Parameters: {}\n\nRequested Changes:\n- Check if email is not empty AND verified is true AND permissions array contains \"write\"\n\nExpected Output:\n{\n \"conditions\": {\n \"options\": {\n \"caseSensitive\": true,\n \"leftValue\": \"\",\n \"typeValidation\": \"strict\"\n },\n \"conditions\": [\n {\n \"id\": \"id-1\",\n \"leftValue\": \"={{ $('Set').item.json.email }}\",\n \"operator\": {\n \"type\": \"string\",\n \"operation\": \"notEmpty\"\n }\n },\n {\n \"id\": \"id-2\",\n \"leftValue\": \"={{ $('Set').item.json.verified }}\",\n \"operator\": {\n \"type\": \"boolean\",\n \"operation\": \"true\"\n }\n },\n {\n \"id\": \"id-3\",\n \"leftValue\": \"={{ $('Set').item.json.permissions }}\",\n \"rightValue\": \"write\",\n \"operator\": {\n \"type\": \"array\",\n \"operation\": \"contains\"\n }\n }\n ],\n \"combinator\": \"and\"\n }\n}\n";
@@ -0,0 +1,138 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.IF_NODE_EXAMPLES = void 0;
4
+ exports.IF_NODE_EXAMPLES = `
5
+ ### IF Node Examples
6
+
7
+ #### Example 1: Simple String Condition
8
+ Current Parameters: {}
9
+ Requested Changes: Check if order status equals "pending"
10
+ Expected Output:
11
+ {
12
+ "conditions": {
13
+ "options": {
14
+ "caseSensitive": false,
15
+ "leftValue": "",
16
+ "typeValidation": "loose"
17
+ },
18
+ "conditions": [
19
+ {
20
+ "id": "id-1",
21
+ "leftValue": "={{ $('Previous Node').item.json.orderStatus }}",
22
+ "rightValue": "pending",
23
+ "operator": {
24
+ "type": "string",
25
+ "operation": "equals"
26
+ }
27
+ }
28
+ ],
29
+ "combinator": "and"
30
+ }
31
+ }
32
+
33
+ #### Example 2: Check if Field Exists
34
+ Current Parameters: {}
35
+ Requested Changes: Check if email field exists in the data
36
+ Expected Output:
37
+ {
38
+ "conditions": {
39
+ "options": {
40
+ "caseSensitive": false,
41
+ "leftValue": "",
42
+ "typeValidation": "loose"
43
+ },
44
+ "conditions": [
45
+ {
46
+ "id": "id-1",
47
+ "leftValue": "={{ $('Previous Node').item.json.email }}",
48
+ "operator": {
49
+ "type": "string",
50
+ "operation": "exists"
51
+ }
52
+ }
53
+ ],
54
+ "combinator": "and"
55
+ }
56
+ }
57
+
58
+ #### Example 3: Multiple Conditions with AND
59
+ Current Parameters: {}
60
+ Requested Changes: Check if status is active AND score is 50 or higher
61
+ Expected Output:
62
+ {
63
+ "conditions": {
64
+ "options": {
65
+ "caseSensitive": false,
66
+ "leftValue": "",
67
+ "typeValidation": "loose"
68
+ },
69
+ "conditions": [
70
+ {
71
+ "id": "id-1",
72
+ "leftValue": "={{ $('Set').item.json.status }}",
73
+ "rightValue": "active",
74
+ "operator": {
75
+ "type": "string",
76
+ "operation": "equals"
77
+ }
78
+ },
79
+ {
80
+ "id": "id-2",
81
+ "leftValue": "={{ $('Set').item.json.score }}",
82
+ "rightValue": "50",
83
+ "operator": {
84
+ "type": "number",
85
+ "operation": "gte"
86
+ }
87
+ }
88
+ ],
89
+ "combinator": "and"
90
+ }
91
+ }
92
+
93
+ #### Example 3: IF Node - Complex Multi-Type Conditions
94
+ Current Parameters: {}
95
+
96
+ Requested Changes:
97
+ - Check if email is not empty AND verified is true AND permissions array contains "write"
98
+
99
+ Expected Output:
100
+ {
101
+ "conditions": {
102
+ "options": {
103
+ "caseSensitive": true,
104
+ "leftValue": "",
105
+ "typeValidation": "strict"
106
+ },
107
+ "conditions": [
108
+ {
109
+ "id": "id-1",
110
+ "leftValue": "={{ $('Set').item.json.email }}",
111
+ "operator": {
112
+ "type": "string",
113
+ "operation": "notEmpty"
114
+ }
115
+ },
116
+ {
117
+ "id": "id-2",
118
+ "leftValue": "={{ $('Set').item.json.verified }}",
119
+ "operator": {
120
+ "type": "boolean",
121
+ "operation": "true"
122
+ }
123
+ },
124
+ {
125
+ "id": "id-3",
126
+ "leftValue": "={{ $('Set').item.json.permissions }}",
127
+ "rightValue": "write",
128
+ "operator": {
129
+ "type": "array",
130
+ "operation": "contains"
131
+ }
132
+ }
133
+ ],
134
+ "combinator": "and"
135
+ }
136
+ }
137
+ `;
138
+ //# sourceMappingURL=if-node-examples.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"if-node-examples.js","sourceRoot":"","sources":["../../../../../src/chains/prompts/examples/basic/if-node-examples.ts"],"names":[],"mappings":";;;AAAa,QAAA,gBAAgB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqI/B,CAAC"}