@n8n/ai-workflow-builder 0.18.0 → 0.20.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.
Files changed (84) hide show
  1. package/dist/agents/workflow-planner-agent.d.ts +58 -0
  2. package/dist/agents/workflow-planner-agent.js +269 -0
  3. package/dist/agents/workflow-planner-agent.js.map +1 -0
  4. package/dist/ai-workflow-builder-agent.service.d.ts +2 -1
  5. package/dist/ai-workflow-builder-agent.service.js +6 -3
  6. package/dist/ai-workflow-builder-agent.service.js.map +1 -1
  7. package/dist/build.tsbuildinfo +1 -1
  8. package/dist/chains/parameter-updater.js +5 -1
  9. package/dist/chains/parameter-updater.js.map +1 -1
  10. package/dist/chains/prompts/instance-url.d.ts +1 -0
  11. package/dist/chains/prompts/instance-url.js +16 -0
  12. package/dist/chains/prompts/instance-url.js.map +1 -0
  13. package/dist/chains/prompts/prompt-builder.js +1 -1
  14. package/dist/chains/prompts/prompt-builder.js.map +1 -1
  15. package/dist/chains/workflow-name.js +1 -1
  16. package/dist/constants.d.ts +7 -0
  17. package/dist/constants.js +8 -1
  18. package/dist/constants.js.map +1 -1
  19. package/dist/errors/index.d.ts +7 -0
  20. package/dist/errors/index.js +16 -1
  21. package/dist/errors/index.js.map +1 -1
  22. package/dist/index.d.ts +1 -1
  23. package/dist/index.js +0 -1
  24. package/dist/index.js.map +1 -1
  25. package/dist/llm-config.js +2 -1
  26. package/dist/llm-config.js.map +1 -1
  27. package/dist/tools/add-node.tool.d.ts +38 -34
  28. package/dist/tools/add-node.tool.js +17 -2
  29. package/dist/tools/add-node.tool.js.map +1 -1
  30. package/dist/tools/connect-nodes.tool.d.ts +29 -26
  31. package/dist/tools/connect-nodes.tool.js +7 -2
  32. package/dist/tools/connect-nodes.tool.js.map +1 -1
  33. package/dist/tools/get-node-parameter.tool.d.ts +18 -0
  34. package/dist/tools/get-node-parameter.tool.js +109 -0
  35. package/dist/tools/get-node-parameter.tool.js.map +1 -0
  36. package/dist/tools/helpers/progress.d.ts +1 -1
  37. package/dist/tools/helpers/progress.js +14 -2
  38. package/dist/tools/helpers/progress.js.map +1 -1
  39. package/dist/tools/helpers/validation.d.ts +1 -0
  40. package/dist/tools/helpers/validation.js +13 -0
  41. package/dist/tools/helpers/validation.js.map +1 -1
  42. package/dist/tools/node-details.tool.d.ts +20 -17
  43. package/dist/tools/node-details.tool.js +7 -2
  44. package/dist/tools/node-details.tool.js.map +1 -1
  45. package/dist/tools/node-search.tool.d.ts +54 -45
  46. package/dist/tools/node-search.tool.js +7 -2
  47. package/dist/tools/node-search.tool.js.map +1 -1
  48. package/dist/tools/prompts/main-agent.prompt.d.ts +2 -0
  49. package/dist/tools/prompts/main-agent.prompt.js +96 -41
  50. package/dist/tools/prompts/main-agent.prompt.js.map +1 -1
  51. package/dist/tools/remove-node.tool.d.ts +14 -11
  52. package/dist/tools/remove-node.tool.js +7 -2
  53. package/dist/tools/remove-node.tool.js.map +1 -1
  54. package/dist/tools/update-node-parameters.tool.d.ts +19 -16
  55. package/dist/tools/update-node-parameters.tool.js +60 -38
  56. package/dist/tools/update-node-parameters.tool.js.map +1 -1
  57. package/dist/types/index.d.ts +8 -8
  58. package/dist/types/index.js +0 -22
  59. package/dist/types/index.js.map +1 -1
  60. package/dist/types/langchain.d.ts +2 -0
  61. package/dist/types/langchain.js +7 -0
  62. package/dist/types/langchain.js.map +1 -0
  63. package/dist/types/messages.d.ts +1 -7
  64. package/dist/types/streaming.d.ts +6 -1
  65. package/dist/types/tools.d.ts +8 -1
  66. package/dist/utils/stream-processor.d.ts +7 -1
  67. package/dist/utils/stream-processor.js +121 -63
  68. package/dist/utils/stream-processor.js.map +1 -1
  69. package/dist/utils/token-usage.d.ts +14 -0
  70. package/dist/utils/token-usage.js +27 -0
  71. package/dist/utils/token-usage.js.map +1 -1
  72. package/dist/utils/trim-workflow-context.d.ts +2 -0
  73. package/dist/utils/trim-workflow-context.js +53 -0
  74. package/dist/utils/trim-workflow-context.js.map +1 -0
  75. package/dist/workflow-builder-agent.d.ts +11 -1
  76. package/dist/workflow-builder-agent.js +205 -24
  77. package/dist/workflow-builder-agent.js.map +1 -1
  78. package/dist/workflow-state.d.ts +17 -0
  79. package/dist/workflow-state.js +12 -0
  80. package/dist/workflow-state.js.map +1 -1
  81. package/package.json +9 -7
  82. package/dist/chains/planner.d.ts +0 -4
  83. package/dist/chains/planner.js +0 -87
  84. package/dist/chains/planner.js.map +0 -1
@@ -1,28 +1,24 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mainAgentPrompt = void 0;
3
+ exports.mainAgentPrompt = exports.planFormatter = void 0;
4
4
  const prompts_1 = require("@langchain/core/prompts");
5
+ const instance_url_1 = require("../../chains/prompts/instance-url");
5
6
  const systemPrompt = `You are an AI assistant specialized in creating and editing n8n workflows. Your goal is to help users build efficient, well-connected workflows by intelligently using the available tools.
6
-
7
- <prime_directive>
8
- ALWAYS end your workflow mutation responses with a brief note that the workflow can be adjusted if needed. For example: "Feel free to let me know if you'd like to adjust any part of this workflow!" This is mandatory for all workflow mutation responses.
9
- </prime_directive>
10
-
11
7
  <core_principle>
12
8
  After receiving tool results, reflect on their quality and determine optimal next steps. Use this reflection to plan your approach and ensure all nodes are properly configured and connected.
13
9
  </core_principle>
14
10
 
15
11
  <communication_style>
16
- Be warm, helpful, and most importantlyconcise. Focus on actionable information.
17
- - Lead with what was accomplished
18
- - Highlight only critical configuration needs
19
- - Provide clear next steps
20
- - Save detailed explanations for when users ask
21
- - One emoji per section maximum
12
+ Keep responses concise.
13
+
14
+ CRITICAL: Do NOT provide commentary between tool calls. Execute tools silently.
15
+ - NO progress messages like "Perfect!", "Now let me...", "Excellent!"
16
+ - NO descriptions of what was built or how it works
17
+ - NO workflow features or capabilities explanations
18
+ - Only respond AFTER all tools are complete
19
+ - Response should only contain setup/usage information
22
20
  </communication_style>
23
21
 
24
- <tool_execution_strategy>
25
- For maximum efficiency, invoke all relevant tools simultaneously when performing independent operations. This significantly reduces wait time and improves user experience.
26
22
 
27
23
  Parallel execution guidelines:
28
24
  - ALL tools support parallel execution, including add_nodes
@@ -182,6 +178,35 @@ Common failures from relying on defaults:
182
178
  ALWAYS check node details obtained in Analysis Phase and configure accordingly. Defaults are NOT your friend - they are traps that cause workflows to fail at runtime.
183
179
  </node_defaults_warning>
184
180
 
181
+ <workflow_configuration_node>
182
+ CRITICAL: Always include a Workflow Configuration node at the start of every workflow.
183
+
184
+ The Workflow Configuration node (n8n-nodes-base.set) is a mandatory node that should be placed immediately after the trigger node and before all other processing nodes.
185
+ This node centralizes workflow-wide settings and parameters that other nodes can reference throughout the execution with expressions.
186
+
187
+ Placement rules:
188
+ - ALWAYS add between trigger and first processing node
189
+ - Connect: Trigger → Workflow Configuration → First processing node
190
+ - This creates a single source of truth for workflow parameters
191
+
192
+ Configuration approach:
193
+ - Include URLs, thresholds, string constants and any reusable values
194
+ - Other nodes reference these via expressions: {{ $('Workflow Configuration').first().json.variableName }}
195
+ - Add only parameters that are used by other nodes, DO NOT add unnecessary fields
196
+
197
+ Workflow configuration node usage example:
198
+ 1. Schedule Trigger → Workflow Configuration → HTTP Request → Process Data
199
+ 2. Add field apiUrl to the Workflow Configuration node with value "https://api.example.com/data"
200
+ 3. Reference in HTTP Request node: "{{ $('Workflow Configuration').first().json.apiUrl }}" instead of directly setting the URL
201
+
202
+ IMPORTANT:
203
+ - Workflow Configuration node is not meant for credentials or sensitive data.
204
+ - Workflow Configuration node should always include parameter "includeOtherFields": true, to pass through any trigger data.
205
+ - Do not reference the variables from the Workflow Configuration node in Trigger nodes (as they run before it).
206
+
207
+ Why: Centralizes configuration, makes workflows maintainable, enables easy environment switching, and provides clear parameter visibility.
208
+ </workflow_configuration_node>
209
+
185
210
  <configuration_requirements>
186
211
  ALWAYS configure nodes after adding and connecting them. This is NOT optional.
187
212
 
@@ -316,7 +341,7 @@ When unsure about specific values:
316
341
  - Add nodes and connections confidently
317
342
  - For uncertain parameters, use update_node_parameters with clear placeholders
318
343
  - For tool nodes with dynamic values, use $fromAI expressions instead of placeholders
319
- - Always mention what needs user input in your response
344
+ - Always mention what needs user to configure in the setup response
320
345
 
321
346
  Example for regular nodes:
322
347
  update_node_parameters({{
@@ -329,44 +354,39 @@ update_node_parameters({{
329
354
  nodeId: "gmailTool1",
330
355
  instructions: ["Set sendTo to {{ $fromAI('to') }}", "Set subject to {{ $fromAI('subject') }}"]
331
356
  }})
357
+ </handling_uncertainty>
332
358
 
333
- Then tell the user: "I've set up the Gmail Tool node with dynamic AI parameters - it will automatically determine recipients and subjects based on context."
334
- </handling_uncertainty>`;
359
+ `;
335
360
  const responsePatterns = `
336
361
  <response_patterns>
337
- After completing workflow tasks, follow this structure:
362
+ IMPORTANT: Only provide ONE response AFTER all tool execution is complete.
338
363
 
339
- 1. **Brief Summary** (1-2 sentences)
340
- State what was created/modified without listing every parameter
364
+ Response format:
365
+ **⚙️ How to Setup** (numbered format)
366
+ - List credentials and parameters that need to configured
367
+ - Only list incomplete tasks that need user action (skip what's already configured)
341
368
 
342
- 2. **Key Requirements** (if any)
343
- - Credentials needed
344
- - Parameters the user should verify
345
- - Any manual configuration required
369
+ **ℹ️ How to Use**
370
+ - Only essential user actions (what to click, where to go)
346
371
 
347
- 3. **How to Use** (when relevant)
348
- Quick steps to get started
372
+ End with: "Let me know if you'd like to adjust anything."
349
373
 
350
- 4. **Next Steps** (if applicable)
351
- What the user might want to do next
352
-
353
- <communication_style>
354
- Be warm, helpful, and most importantly concise. Focus on actionable information.
355
- - Lead with what was accomplished
356
- - Provide clear next steps
357
- - Highlight only critical configuration needs
358
- - Be warm and encouraging without excessive enthusiasm
359
- - Use emojis sparingly (1-2 max per response)
360
- - Focus on what the user needs to know
361
- - Expand details only when asked
362
- - End with a brief note that the workflow can be adjusted if needed
363
- </communication_style>
374
+ ABSOLUTELY FORBIDDEN IN BUILDING MODE:
375
+ - Any text between tool calls
376
+ - Progress updates during execution
377
+ - "Perfect!", "Now let me...", "Excellent!"
378
+ - Describing what was built
379
+ - Explaining workflow functionality
364
380
  </response_patterns>
365
381
  `;
366
382
  const currentWorkflowJson = `
367
383
  <current_workflow_json>
368
384
  {workflowJSON}
369
- </current_workflow_json>`;
385
+ </current_workflow_json>
386
+ <trimmed_workflow_json_note>
387
+ Note: Large property values of the nodes in the workflow JSON above may be trimmed to fit within token limits.
388
+ Use get_node_parameter tool to get full details when needed.
389
+ </trimmed_workflow_json_note>`;
370
390
  const currentExecutionData = `
371
391
  <current_simplified_execution_data>
372
392
  {executionData}
@@ -379,6 +399,32 @@ const previousConversationSummary = `
379
399
  <previous_summary>
380
400
  {previousSummary}
381
401
  </previous_summary>`;
402
+ const workflowPlan = '{workflowPlan}';
403
+ const planFormatter = (plan) => {
404
+ if (!plan)
405
+ return '<workflow_plan>EMPTY</workflow_plan>';
406
+ const nodesPlan = plan.plan.map((node) => {
407
+ return `
408
+ <workflow_plan_node>
409
+ <type>${node.nodeType}</type>
410
+ <name>${node.nodeName}</name>
411
+ <reasoning>${node.reasoning}</reasoning>
412
+ </workflow_plan_node>
413
+ `;
414
+ });
415
+ return `
416
+ <workflow_plan>
417
+ <workflow_plan_intro>
418
+ ${plan.intro}
419
+ </workflow_plan_intro>
420
+
421
+ <workflow_plan_nodes>
422
+ ${nodesPlan.join('\n')}
423
+ </workflow_plan_nodes>
424
+ </workflow_plan>
425
+ `;
426
+ };
427
+ exports.planFormatter = planFormatter;
382
428
  exports.mainAgentPrompt = prompts_1.ChatPromptTemplate.fromMessages([
383
429
  [
384
430
  'system',
@@ -388,6 +434,10 @@ exports.mainAgentPrompt = prompts_1.ChatPromptTemplate.fromMessages([
388
434
  text: systemPrompt,
389
435
  cache_control: { type: 'ephemeral' },
390
436
  },
437
+ {
438
+ type: 'text',
439
+ text: instance_url_1.instanceUrlPrompt,
440
+ },
391
441
  {
392
442
  type: 'text',
393
443
  text: currentWorkflowJson,
@@ -410,6 +460,11 @@ exports.mainAgentPrompt = prompts_1.ChatPromptTemplate.fromMessages([
410
460
  text: previousConversationSummary,
411
461
  cache_control: { type: 'ephemeral' },
412
462
  },
463
+ {
464
+ type: 'text',
465
+ text: workflowPlan,
466
+ cache_control: { type: 'ephemeral' },
467
+ },
413
468
  ],
414
469
  ],
415
470
  ['placeholder', '{messages}'],
@@ -1 +1 @@
1
- {"version":3,"file":"main-agent.prompt.js","sourceRoot":"","sources":["../../../src/tools/prompts/main-agent.prompt.ts"],"names":[],"mappings":";;;AAAA,qDAA6D;AAE7D,MAAM,YAAY,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAyUG,CAAC;AAEzB,MAAM,gBAAgB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8BxB,CAAC;AAEF,MAAM,mBAAmB,GAAG;;;yBAGH,CAAC;AAE1B,MAAM,oBAAoB,GAAG;;;qCAGQ,CAAC;AAEtC,MAAM,4BAA4B,GAAG;;;mCAGF,CAAC;AAEpC,MAAM,2BAA2B,GAAG;;;oBAGhB,CAAC;AAER,QAAA,eAAe,GAAG,4BAAkB,CAAC,YAAY,CAAC;IAC9D;QACC,QAAQ;QACR;YACC;gBACC,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,YAAY;gBAClB,aAAa,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE;aACpC;YACD;gBACC,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,mBAAmB;aACzB;YACD;gBAC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,EAAE,IAAI,EAAE,WAAW,EAAE;aACpC;SACD;KACD;IACD,CAAC,aAAa,EAAE,YAAY,CAAC;CAC7B,CAAC,CAAC"}
@@ -1,13 +1,16 @@
1
1
  import type { Logger } from '@n8n/backend-common';
2
2
  import { z } from 'zod';
3
- export declare function createRemoveNodeTool(_logger?: Logger): import("@langchain/core/tools").DynamicStructuredTool<z.ZodObject<{
4
- nodeId: z.ZodString;
5
- }, "strip", z.ZodTypeAny, {
6
- nodeId: string;
7
- }, {
8
- nodeId: string;
9
- }>, {
10
- nodeId: string;
11
- }, {
12
- nodeId: string;
13
- }, import("@langchain/langgraph").Command<unknown>>;
3
+ export declare function createRemoveNodeTool(_logger?: Logger): {
4
+ tool: import("@langchain/core/tools").DynamicStructuredTool<z.ZodObject<{
5
+ nodeId: z.ZodString;
6
+ }, "strip", z.ZodTypeAny, {
7
+ nodeId: string;
8
+ }, {
9
+ nodeId: string;
10
+ }>, {
11
+ nodeId: string;
12
+ }, {
13
+ nodeId: string;
14
+ }, import("@langchain/langgraph").Command<unknown>>;
15
+ displayTitle: string;
16
+ };
@@ -45,8 +45,9 @@ function buildResponseMessage(nodeName, nodeType, connectionsRemoved) {
45
45
  return parts.join('\n');
46
46
  }
47
47
  function createRemoveNodeTool(_logger) {
48
- return (0, tools_1.tool)((input, config) => {
49
- const reporter = (0, progress_1.createProgressReporter)(config, 'remove_node');
48
+ const DISPLAY_TITLE = 'Removing node';
49
+ const dynamicTool = (0, tools_1.tool)((input, config) => {
50
+ const reporter = (0, progress_1.createProgressReporter)(config, 'remove_node', DISPLAY_TITLE);
50
51
  try {
51
52
  const validatedInput = removeNodeSchema.parse(input);
52
53
  const { nodeId } = validatedInput;
@@ -93,5 +94,9 @@ function createRemoveNodeTool(_logger) {
93
94
  description: 'Remove a node from the workflow by its ID. This will also remove all connections to and from the node. Use this tool when you need to delete a node that is no longer needed in the workflow.',
94
95
  schema: removeNodeSchema,
95
96
  });
97
+ return {
98
+ tool: dynamicTool,
99
+ displayTitle: DISPLAY_TITLE,
100
+ };
96
101
  }
97
102
  //# sourceMappingURL=remove-node.tool.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"remove-node.tool.js","sourceRoot":"","sources":["../../src/tools/remove-node.tool.ts"],"names":[],"mappings":";;AA0EA,oDAgFC;AA1JD,iDAA6C;AAG7C,6BAAwB;AAExB,sCAAgE;AAChE,iDAA4E;AAC5E,iDAAgF;AAChF,2CAA+F;AAC/F,qDAAmF;AAMnF,MAAM,gBAAgB,GAAG,OAAC,CAAC,MAAM,CAAC;IACjC,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,gDAAgD,CAAC;CAC7E,CAAC,CAAC;AAKH,SAAS,oBAAoB,CAAC,MAAc,EAAE,WAAyB;IACtE,IAAI,KAAK,GAAG,CAAC,CAAC;IAGd,IAAI,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC;QACzB,KAAK,MAAM,cAAc,IAAI,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC;YACjE,IAAI,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,CAAC;gBACnC,KAAK,MAAM,OAAO,IAAI,cAAc,EAAE,CAAC;oBACtC,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;wBAC5B,KAAK,IAAI,OAAO,CAAC,MAAM,CAAC;oBACzB,CAAC;gBACF,CAAC;YACF,CAAC;QACF,CAAC;IACF,CAAC;IAGD,KAAK,MAAM,CAAC,aAAa,EAAE,eAAe,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC;QAC5E,KAAK,MAAM,OAAO,IAAI,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,EAAE,CAAC;YACtD,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;gBAC5B,KAAK,MAAM,iBAAiB,IAAI,OAAO,EAAE,CAAC;oB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GAAG,IAAA,8BAAsB,EAAC,MAAM,CAAC,CAAC;YACpD,OAAO,IAAA,gCAAqB,EAAC,MAAM,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC;QAC7D,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAEhB,IAAI,KAAK,YAAY,OAAC,CAAC,QAAQ,EAAE,CAAC;gBACjC,MAAM,eAAe,GAAG,IAAI,wBAAe,CAAC,0BAA0B,EAAE;oBACvE,KAAK,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE;iBAC/B,CAAC,CAAC;gBACH,QAAQ,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;gBAChC,OAAO,IAAA,8BAAmB,EAAC,MAAM,EAAE,eAAe,CAAC,CAAC;YACrD,CAAC;YAED,MAAM,SAAS,GAAG,IAAI,2BAAkB,CACvC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,wBAAwB,EACjE;gBACC,QAAQ,EAAE,aAAa;gBACvB,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS;aACjD,CACD,CAAC;YACF,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;YAC1B,OAAO,IAAA,8BAAmB,EAAC,MAAM,EAAE,SAAS,CAAC,CAAC;QAC/C,CAAC;IACF,CAAC,EACD;QACC,IAAI,EAAE,aAAa;QACnB,WAAW,EACV,+LAA+L;QAChM,MAAM,EAAE,gBAAgB;KACxB,CACD,CAAC;IAEF,OAAO;QACN,IAAI,EAAE,WAAW;QACjB,YAAY,EAAE,aAAa;KAC3B,CAAC;AACH,CAAC"}
@@ -1,19 +1,22 @@
1
1
  import type { BaseChatModel } from '@langchain/core/language_models/chat_models';
2
2
  import type { INodeTypeDescription, Logger } from 'n8n-workflow';
3
3
  import { z } from 'zod';
4
- export declare function createUpdateNodeParametersTool(nodeTypes: INodeTypeDescription[], llm: BaseChatModel, logger?: Logger): import("@langchain/core/tools").DynamicStructuredTool<z.ZodObject<{
5
- nodeId: z.ZodString;
6
- changes: z.ZodArray<z.ZodString, "many">;
7
- }, "strip", z.ZodTypeAny, {
8
- nodeId: string;
9
- changes: string[];
10
- }, {
11
- nodeId: string;
12
- changes: string[];
13
- }>, {
14
- nodeId: string;
15
- changes: string[];
16
- }, {
17
- nodeId: string;
18
- changes: string[];
19
- }, import("@langchain/langgraph").Command<unknown>>;
4
+ export declare function createUpdateNodeParametersTool(nodeTypes: INodeTypeDescription[], llm: BaseChatModel, logger?: Logger, instanceUrl?: string): {
5
+ tool: import("@langchain/core/tools").DynamicStructuredTool<z.ZodObject<{
6
+ nodeId: z.ZodString;
7
+ changes: z.ZodArray<z.ZodString, "many">;
8
+ }, "strip", z.ZodTypeAny, {
9
+ nodeId: string;
10
+ changes: string[];
11
+ }, {
12
+ nodeId: string;
13
+ changes: string[];
14
+ }>, {
15
+ nodeId: string;
16
+ changes: string[];
17
+ }, {
18
+ nodeId: string;
19
+ changes: string[];
20
+ }, import("@langchain/langgraph").Command<unknown>>;
21
+ displayTitle: string;
22
+ };
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createUpdateNodeParametersTool = createUpdateNodeParametersTool;
4
4
  const tools_1 = require("@langchain/core/tools");
5
5
  const zod_1 = require("zod");
6
+ const trim_workflow_context_1 = require("../utils/trim-workflow-context");
6
7
  const parameter_updater_1 = require("../chains/parameter-updater");
7
8
  const errors_1 = require("../errors");
8
9
  const progress_1 = require("./helpers/progress");
@@ -10,6 +11,7 @@ const response_1 = require("./helpers/response");
10
11
  const state_1 = require("./helpers/state");
11
12
  const validation_1 = require("./helpers/validation");
12
13
  const parameter_update_utils_1 = require("./utils/parameter-update.utils");
14
+ const DISPLAY_TITLE = 'Updating node parameters';
13
15
  const updateNodeParametersSchema = zod_1.z.object({
14
16
  nodeId: zod_1.z.string().describe('The ID of the node to update'),
15
17
  changes: zod_1.z
@@ -21,15 +23,62 @@ function buildSuccessMessage(node, changes) {
21
23
  const changesList = changes.map((c) => `- ${c}`).join('\n');
22
24
  return `Successfully updated parameters for node "${node.name}" (${node.type}):\n${changesList}`;
23
25
  }
24
- function createUpdateNodeParametersTool(nodeTypes, llm, logger) {
25
- return (0, tools_1.tool)(async (input, config) => {
26
- const reporter = (0, progress_1.createProgressReporter)(config, 'update_node_parameters');
26
+ async function processParameterUpdates(node, nodeType, nodeId, changes, state, llm, logger, instanceUrl) {
27
+ const workflow = (0, state_1.getCurrentWorkflow)(state);
28
+ const currentParameters = (0, parameter_update_utils_1.extractNodeParameters)(node);
29
+ const formattedChanges = (0, parameter_update_utils_1.formatChangesForPrompt)(changes);
30
+ const nodePropertiesJson = JSON.stringify(nodeType.properties || [], null, 2);
31
+ const parametersChain = (0, parameter_updater_1.createParameterUpdaterChain)(llm, {
32
+ nodeType: node.type,
33
+ nodeDefinition: nodeType,
34
+ requestedChanges: changes,
35
+ }, logger);
36
+ const newParameters = (await parametersChain.invoke({
37
+ workflow_json: (0, trim_workflow_context_1.trimWorkflowJSON)(workflow),
38
+ execution_schema: state.workflowContext?.executionSchema ?? 'NO SCHEMA',
39
+ execution_data: state.workflowContext?.executionData ?? 'NO EXECUTION DATA YET',
40
+ node_id: nodeId,
41
+ node_name: node.name,
42
+ node_type: node.type,
43
+ current_parameters: JSON.stringify(currentParameters, null, 2),
44
+ node_definition: nodePropertiesJson,
45
+ changes: formattedChanges,
46
+ instanceUrl: instanceUrl ?? '',
47
+ }));
48
+ if (!newParameters || typeof newParameters !== 'object') {
49
+ throw new errors_1.ParameterUpdateError('Invalid parameters returned from LLM', {
50
+ nodeId,
51
+ nodeType: node.type,
52
+ });
53
+ }
54
+ if (!newParameters.parameters || typeof newParameters.parameters !== 'object') {
55
+ throw new errors_1.ParameterUpdateError('Invalid parameters structure returned from LLM', {
56
+ nodeId,
57
+ nodeType: node.type,
58
+ });
59
+ }
60
+ return (0, parameter_update_utils_1.fixExpressionPrefixes)(newParameters.parameters);
61
+ }
62
+ function getCustomNodeTitle(input, nodes) {
63
+ if ('nodeId' in input && typeof input['nodeId'] === 'string') {
64
+ const targetNode = nodes?.find((node) => node.id === input.nodeId);
65
+ if (targetNode) {
66
+ return `Updating "${targetNode.name}" node parameters`;
67
+ }
68
+ }
69
+ return DISPLAY_TITLE;
70
+ }
71
+ function createUpdateNodeParametersTool(nodeTypes, llm, logger, instanceUrl) {
72
+ const dynamicTool = (0, tools_1.tool)(async (input, config) => {
73
+ const reporter = (0, progress_1.createProgressReporter)(config, 'update_node_parameters', DISPLAY_TITLE);
27
74
  try {
28
75
  const validatedInput = updateNodeParametersSchema.parse(input);
29
76
  const { nodeId, changes } = validatedInput;
30
- reporter.start(validatedInput);
31
77
  const state = (0, state_1.getWorkflowState)();
32
78
  const workflow = (0, state_1.getCurrentWorkflow)(state);
79
+ reporter.start(validatedInput, {
80
+ customDisplayTitle: getCustomNodeTitle(input, workflow.nodes),
81
+ });
33
82
  const node = (0, validation_1.validateNodeExists)(nodeId, workflow.nodes);
34
83
  if (!node) {
35
84
  const error = (0, validation_1.createNodeNotFoundError)(nodeId);
@@ -47,45 +96,14 @@ function createUpdateNodeParametersTool(nodeTypes, llm, logger) {
47
96
  changes,
48
97
  });
49
98
  try {
50
- const currentParameters = (0, parameter_update_utils_1.extractNodeParameters)(node);
51
- const formattedChanges = (0, parameter_update_utils_1.formatChangesForPrompt)(changes);
52
- const nodePropertiesJson = JSON.stringify(nodeType.properties || [], null, 2);
53
- const parametersChain = (0, parameter_updater_1.createParameterUpdaterChain)(llm, {
54
- nodeType: node.type,
55
- nodeDefinition: nodeType,
56
- requestedChanges: changes,
57
- }, logger);
58
- const newParameters = (await parametersChain.invoke({
59
- workflow_json: workflow,
60
- execution_schema: state.workflowContext?.executionSchema ?? 'NO SCHEMA',
61
- execution_data: state.workflowContext?.executionData ?? 'NO EXECUTION DATA YET',
62
- node_id: nodeId,
63
- node_name: node.name,
64
- node_type: node.type,
65
- current_parameters: JSON.stringify(currentParameters, null, 2),
66
- node_definition: nodePropertiesJson,
67
- changes: formattedChanges,
68
- }));
69
- if (!newParameters || typeof newParameters !== 'object') {
70
- throw new errors_1.ParameterUpdateError('Invalid parameters returned from LLM', {
71
- nodeId,
72
- nodeType: node.type,
73
- });
74
- }
75
- if (!newParameters.parameters || typeof newParameters.parameters !== 'object') {
76
- throw new errors_1.ParameterUpdateError('Invalid parameters structure returned from LLM', {
77
- nodeId,
78
- nodeType: node.type,
79
- });
80
- }
81
- const fixedParameters = (0, parameter_update_utils_1.fixExpressionPrefixes)(newParameters.parameters);
82
- const updatedNode = (0, parameter_update_utils_1.updateNodeWithParameters)(node, fixedParameters);
99
+ const updatedParameters = await processParameterUpdates(node, nodeType, nodeId, changes, state, llm, logger, instanceUrl);
100
+ const updatedNode = (0, parameter_update_utils_1.updateNodeWithParameters)(node, updatedParameters);
83
101
  const message = buildSuccessMessage(node, changes);
84
102
  const output = {
85
103
  nodeId,
86
104
  nodeName: node.name,
87
105
  nodeType: node.type,
88
- updatedParameters: fixedParameters,
106
+ updatedParameters,
89
107
  appliedChanges: changes,
90
108
  message,
91
109
  };
@@ -126,5 +144,9 @@ function createUpdateNodeParametersTool(nodeTypes, llm, logger) {
126
144
  description: 'Update the parameters of an existing node in the workflow based on natural language changes. This tool intelligently modifies only the specified parameters while preserving others. Examples: "Set the URL to https://api.example.com", "Add authentication header", "Change method to POST", "Set the condition to check if status equals success".',
127
145
  schema: updateNodeParametersSchema,
128
146
  });
147
+ return {
148
+ tool: dynamicTool,
149
+ displayTitle: DISPLAY_TITLE,
150
+ };
129
151
  }
130
152
  //# sourceMappingURL=update-node-parameters.tool.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"update-node-parameters.tool.js","sourceRoot":"","sources":["../../src/tools/update-node-parameters.tool.ts"],"names":[],"mappings":";;AAgDA,wEAgKC;AA/MD,iDAA6C;AAE7C,6BAAwB;AAExB,mEAA0E;AAC1E,sCAAsF;AACtF,iDAA4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BAAkB,CACvC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,wBAAwB,EACjE;gBACC,QAAQ,EAAE,wBAAwB;gBAClC,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS;aACjD,CACD,CAAC;YACF,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;YAC1B,OAAO,IAAA,8BAAmB,EAAC,MAAM,EAAE,SAAS,CAAC,CAAC;QAC/C,CAAC;IACF,CAAC,EACD;QACC,IAAI,EAAE,wBAAwB;QAC9B,WAAW,EACV,uVAAuV;QACxV,MAAM,EAAE,0BAA0B;KAClC,CACD,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"update-node-parameters.tool.js","sourceRoot":"","sources":["../../src/tools/update-node-parameters.tool.ts"],"names":[],"mappings":";;AAmIA,wEA8HC;AAhQD,iDAA6C;AAE7C,6BAAwB;AAExB,yEAAiE;AAEjE,mEAA0E;AAC1E,sCAAsF;AAEtF,iDAA4E;AAC5E,iDAAgF;AAChF,2CAA6F;AAC7F,qDAK8B;AAC9B,2EAKwC;AAExC,MAAM,aAAa,GAAG,0BAA0B,CAAC;AAKjD,MAAM,0BAA0B,GAAG,OAAC,CAAC,MAAM,CAAC;IAC3C,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,8BAA8B,CAAC;IAC3D,OAAO,EAAE,OAAC;SACR,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC;SACjB,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CACR,0IAA0I,CAC1I;CACF,CAAC,CAAC;AAKH,SAAS,mBAAmB,CAAC,IAAW,EAAE,OAAiB;IAC1D,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CA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AAK,EAAE,CAAC;YAEhB,IAAI,KAAK,YAAY,OAAC,CAAC,QAAQ,EAAE,CAAC;gBACjC,MAAM,eAAe,GAAG,IAAI,wBAAe,CAAC,0BAA0B,EAAE;oBACvE,KAAK,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE;iBAC/B,CAAC,CAAC;gBACH,QAAQ,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;gBAChC,OAAO,IAAA,8BAAmB,EAAC,MAAM,EAAE,eAAe,CAAC,CAAC;YACrD,CAAC;YAED,MAAM,SAAS,GAAG,IAAI,2BAAkB,CACvC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,wBAAwB,EACjE;gBACC,QAAQ,EAAE,wBAAwB;gBAClC,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS;aACjD,CACD,CAAC;YACF,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;YAC1B,OAAO,IAAA,8BAAmB,EAAC,MAAM,EAAE,SAAS,CAAC,CAAC;QAC/C,CAAC;IACF,CAAC,EACD;QACC,IAAI,EAAE,wBAAwB;QAC9B,WAAW,EACV,uVAAuV;QACxV,MAAM,EAAE,0BAA0B;KAClC,CACD,CAAC;IAEF,OAAO;QACN,IAAI,EAAE,WAAW;QACjB,YAAY,EAAE,aAAa;KAC3B,CAAC;AACH,CAAC"}
@@ -1,8 +1,8 @@
1
- export * from './workflow';
2
- export * from './messages';
3
- export * from './tools';
4
- export * from './connections';
5
- export * from './streaming';
6
- export * from './nodes';
7
- export * from './config';
8
- export * from './utils';
1
+ export type * from './workflow';
2
+ export type * from './messages';
3
+ export type * from './tools';
4
+ export type * from './connections';
5
+ export type * from './streaming';
6
+ export type * from './nodes';
7
+ export type * from './config';
8
+ export type * from './utils';
@@ -1,25 +1,3 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
2
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./workflow"), exports);
18
- __exportStar(require("./messages"), exports);
19
- __exportStar(require("./tools"), exports);
20
- __exportStar(require("./connections"), exports);
21
- __exportStar(require("./streaming"), exports);
22
- __exportStar(require("./nodes"), exports);
23
- __exportStar(require("./config"), exports);
24
- __exportStar(require("./utils"), exports);
25
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAEA,6CAA2B;AAC3B,6CAA2B;AAC3B,0CAAwB;AACxB,gDAA8B;AAC9B,8CAA4B;AAC5B,0CAAwB;AACxB,2CAAyB;AACzB,0CAAwB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ import type { AIMessage, BaseMessage } from '@langchain/core/messages';
2
+ export declare function isAIMessage(msg: BaseMessage): msg is AIMessage;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isAIMessage = isAIMessage;
4
+ function isAIMessage(msg) {
5
+ return msg.getType() === 'ai';
6
+ }
7
+ //# sourceMappingURL=langchain.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"langchain.js","sourceRoot":"","sources":["../../src/types/langchain.ts"],"names":[],"mappings":";;AAEA,kCAEC;AAFD,SAAgB,WAAW,CAAC,GAAgB;IAC3C,OAAO,GAAG,CAAC,OAAO,EAAE,KAAK,IAAI,CAAC;AAC/B,CAAC"}
@@ -27,12 +27,6 @@ export interface AgentChatMessage {
27
27
  title: string;
28
28
  text: string;
29
29
  }
30
- export interface PromptValidationMessage {
31
- role: 'assistant';
32
- type: 'prompt-validation';
33
- isWorkflowPrompt: boolean;
34
- id: string;
35
- }
36
- export type MessageResponse = ((AssistantChatMessage | AssistantSummaryMessage | AgentChatMessage | PromptValidationMessage) & {
30
+ export type MessageResponse = ((AssistantChatMessage | AssistantSummaryMessage | AgentChatMessage) & {
37
31
  quickReplies?: QuickReplyOption[];
38
32
  }) | EndSessionMessage;
@@ -19,7 +19,12 @@ export interface ExecutionRequestChunk {
19
19
  type: 'execution-requested';
20
20
  reason: string;
21
21
  }
22
- export type StreamChunk = AgentMessageChunk | ToolProgressChunk | WorkflowUpdateChunk | ExecutionRequestChunk;
22
+ export interface PlanChunk {
23
+ role: 'assistant';
24
+ type: 'plan';
25
+ plan: unknown;
26
+ }
27
+ export type StreamChunk = AgentMessageChunk | ToolProgressChunk | WorkflowUpdateChunk | ExecutionRequestChunk | PlanChunk;
23
28
  export interface StreamOutput {
24
29
  messages: StreamChunk[];
25
30
  }
@@ -13,6 +13,8 @@ export interface ToolProgressMessage<TToolName extends string = string> {
13
13
  toolCallId?: string;
14
14
  status: 'running' | 'completed' | 'error';
15
15
  updates: ProgressUpdate[];
16
+ displayTitle?: string;
17
+ customDisplayTitle?: string;
16
18
  }
17
19
  export interface ToolError {
18
20
  message: string;
@@ -20,7 +22,9 @@ export interface ToolError {
20
22
  details?: ZodIssue[] | Record<string, unknown>;
21
23
  }
22
24
  export interface ProgressReporter {
23
- start: <T>(input: T) => void;
25
+ start: <T>(input: T, options?: {
26
+ customDisplayTitle: string;
27
+ }) => void;
24
28
  progress: (message: string, data?: Record<string, unknown>) => void;
25
29
  complete: <T>(output: T) => void;
26
30
  error: (error: ToolError) => void;
@@ -74,3 +78,6 @@ export interface NodeSearchOutput {
74
78
  totalResults: number;
75
79
  message: string;
76
80
  }
81
+ export interface GetNodeParameterOutput {
82
+ message: string;
83
+ }