@n8n/ai-workflow-builder 1.7.1 → 1.8.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 (148) hide show
  1. package/dist/agents/planner.agent.d.ts +80 -0
  2. package/dist/agents/planner.agent.js +133 -0
  3. package/dist/agents/planner.agent.js.map +1 -0
  4. package/dist/agents/responder.agent.d.ts +44 -9
  5. package/dist/agents/responder.agent.js +123 -85
  6. package/dist/agents/responder.agent.js.map +1 -1
  7. package/dist/agents/supervisor.agent.d.ts +5 -3
  8. package/dist/agents/supervisor.agent.js +6 -5
  9. package/dist/agents/supervisor.agent.js.map +1 -1
  10. package/dist/ai-workflow-builder-agent.service.d.ts +3 -0
  11. package/dist/ai-workflow-builder-agent.service.js +93 -3
  12. package/dist/ai-workflow-builder-agent.service.js.map +1 -1
  13. package/dist/build.tsbuildinfo +1 -1
  14. package/dist/constants.d.ts +3 -2
  15. package/dist/constants.js +5 -4
  16. package/dist/constants.js.map +1 -1
  17. package/dist/llm-config.d.ts +2 -1
  18. package/dist/llm-config.js +25 -1
  19. package/dist/llm-config.js.map +1 -1
  20. package/dist/multi-agent-workflow-subgraphs.d.ts +90 -6
  21. package/dist/multi-agent-workflow-subgraphs.js +94 -17
  22. package/dist/multi-agent-workflow-subgraphs.js.map +1 -1
  23. package/dist/parent-graph-state.d.ts +6 -0
  24. package/dist/parent-graph-state.js +20 -0
  25. package/dist/parent-graph-state.js.map +1 -1
  26. package/dist/prompts/agents/builder.prompt.d.ts +6 -1
  27. package/dist/prompts/agents/builder.prompt.js +535 -387
  28. package/dist/prompts/agents/builder.prompt.js.map +1 -1
  29. package/dist/prompts/agents/discovery.prompt.d.ts +1 -0
  30. package/dist/prompts/agents/discovery.prompt.js +334 -349
  31. package/dist/prompts/agents/discovery.prompt.js.map +1 -1
  32. package/dist/prompts/agents/index.d.ts +6 -0
  33. package/dist/prompts/agents/index.js +21 -0
  34. package/dist/prompts/agents/index.js.map +1 -0
  35. package/dist/prompts/agents/planner.prompt.d.ts +14 -0
  36. package/dist/prompts/agents/planner.prompt.js +77 -0
  37. package/dist/prompts/agents/planner.prompt.js.map +1 -0
  38. package/dist/prompts/agents/responder.prompt.js +35 -2
  39. package/dist/prompts/agents/responder.prompt.js.map +1 -1
  40. package/dist/prompts/agents/supervisor.prompt.js +3 -4
  41. package/dist/prompts/agents/supervisor.prompt.js.map +1 -1
  42. package/dist/prompts/index.d.ts +4 -4
  43. package/dist/prompts/index.js +11 -4
  44. package/dist/prompts/index.js.map +1 -1
  45. package/dist/session-manager.service.d.ts +18 -0
  46. package/dist/session-manager.service.js +154 -1
  47. package/dist/session-manager.service.js.map +1 -1
  48. package/dist/subgraphs/builder.subgraph.d.ts +31 -2
  49. package/dist/subgraphs/builder.subgraph.js +141 -35
  50. package/dist/subgraphs/builder.subgraph.js.map +1 -1
  51. package/dist/subgraphs/discovery.subgraph.d.ts +87 -27
  52. package/dist/subgraphs/discovery.subgraph.js +204 -24
  53. package/dist/subgraphs/discovery.subgraph.js.map +1 -1
  54. package/dist/tools/add-node.tool.d.ts +36 -0
  55. package/dist/tools/add-node.tool.js +28 -8
  56. package/dist/tools/add-node.tool.js.map +1 -1
  57. package/dist/tools/best-practices/triage.js +5 -5
  58. package/dist/tools/builder-tools.js +6 -1
  59. package/dist/tools/builder-tools.js.map +1 -1
  60. package/dist/tools/connect-nodes.tool.js +16 -3
  61. package/dist/tools/connect-nodes.tool.js.map +1 -1
  62. package/dist/tools/get-execution-logs.tool.d.ts +4 -0
  63. package/dist/tools/get-execution-logs.tool.js +104 -0
  64. package/dist/tools/get-execution-logs.tool.js.map +1 -0
  65. package/dist/tools/get-execution-schema.tool.d.ts +4 -0
  66. package/dist/tools/get-execution-schema.tool.js +81 -0
  67. package/dist/tools/get-execution-schema.tool.js.map +1 -0
  68. package/dist/tools/get-expression-data-mapping.tool.d.ts +4 -0
  69. package/dist/tools/get-expression-data-mapping.tool.js +85 -0
  70. package/dist/tools/get-expression-data-mapping.tool.js.map +1 -0
  71. package/dist/tools/get-node-context.tool.d.ts +13 -0
  72. package/dist/tools/get-node-context.tool.js +227 -0
  73. package/dist/tools/get-node-context.tool.js.map +1 -0
  74. package/dist/tools/get-node-parameter.tool.js +1 -2
  75. package/dist/tools/get-node-parameter.tool.js.map +1 -1
  76. package/dist/tools/get-workflow-overview.tool.d.ts +11 -0
  77. package/dist/tools/get-workflow-overview.tool.js +158 -0
  78. package/dist/tools/get-workflow-overview.tool.js.map +1 -0
  79. package/dist/tools/helpers/state.d.ts +1 -0
  80. package/dist/tools/helpers/state.js +10 -0
  81. package/dist/tools/helpers/state.js.map +1 -1
  82. package/dist/tools/submit-questions.tool.d.ts +71 -0
  83. package/dist/tools/submit-questions.tool.js +74 -0
  84. package/dist/tools/submit-questions.tool.js.map +1 -0
  85. package/dist/tools/update-node-parameters.tool.js +2 -3
  86. package/dist/tools/update-node-parameters.tool.js.map +1 -1
  87. package/dist/tools/utils/mermaid.utils.d.ts +9 -1
  88. package/dist/tools/utils/mermaid.utils.js +9 -5
  89. package/dist/tools/utils/mermaid.utils.js.map +1 -1
  90. package/dist/tools/utils/node-creation.utils.d.ts +6 -2
  91. package/dist/tools/utils/node-creation.utils.js +2 -1
  92. package/dist/tools/utils/node-creation.utils.js.map +1 -1
  93. package/dist/tools/validate-configuration.tool.js +15 -7
  94. package/dist/tools/validate-configuration.tool.js.map +1 -1
  95. package/dist/tools/validate-structure.tool.js +3 -3
  96. package/dist/tools/validate-structure.tool.js.map +1 -1
  97. package/dist/types/coordination.d.ts +9 -9
  98. package/dist/types/coordination.js +14 -4
  99. package/dist/types/coordination.js.map +1 -1
  100. package/dist/types/index.d.ts +1 -0
  101. package/dist/types/index.js.map +1 -1
  102. package/dist/types/planning.d.ts +48 -0
  103. package/dist/types/planning.js +3 -0
  104. package/dist/types/planning.js.map +1 -0
  105. package/dist/types/streaming.d.ts +14 -1
  106. package/dist/types/tools.d.ts +16 -0
  107. package/dist/utils/context-builders.d.ts +8 -0
  108. package/dist/utils/context-builders.js +249 -8
  109. package/dist/utils/context-builders.js.map +1 -1
  110. package/dist/utils/coordination-log.d.ts +2 -4
  111. package/dist/utils/coordination-log.js +0 -8
  112. package/dist/utils/coordination-log.js.map +1 -1
  113. package/dist/utils/node-helpers.d.ts +1 -0
  114. package/dist/utils/node-helpers.js +7 -0
  115. package/dist/utils/node-helpers.js.map +1 -1
  116. package/dist/utils/plan-helpers.d.ts +2 -0
  117. package/dist/utils/plan-helpers.js +26 -0
  118. package/dist/utils/plan-helpers.js.map +1 -0
  119. package/dist/utils/stream-processor.js +137 -8
  120. package/dist/utils/stream-processor.js.map +1 -1
  121. package/dist/utils/subgraph-helpers.js +7 -1
  122. package/dist/utils/subgraph-helpers.js.map +1 -1
  123. package/dist/utils/truncate-json.d.ts +5 -0
  124. package/dist/utils/truncate-json.js +18 -0
  125. package/dist/utils/truncate-json.js.map +1 -0
  126. package/dist/validation/checks/credentials.js +2 -6
  127. package/dist/validation/checks/credentials.js.map +1 -1
  128. package/dist/validation/checks/index.d.ts +1 -0
  129. package/dist/validation/checks/index.js +3 -1
  130. package/dist/validation/checks/index.js.map +1 -1
  131. package/dist/validation/checks/parameters.d.ts +4 -0
  132. package/dist/validation/checks/parameters.js +165 -0
  133. package/dist/validation/checks/parameters.js.map +1 -0
  134. package/dist/validation/programmatic.js +2 -0
  135. package/dist/validation/programmatic.js.map +1 -1
  136. package/dist/validation/types.d.ts +3 -1
  137. package/dist/validation/types.js +2 -0
  138. package/dist/validation/types.js.map +1 -1
  139. package/dist/workflow-builder-agent.d.ts +7 -1
  140. package/dist/workflow-builder-agent.js +43 -11
  141. package/dist/workflow-builder-agent.js.map +1 -1
  142. package/package.json +6 -5
  143. package/dist/prompts/agents/configurator.prompt.d.ts +0 -3
  144. package/dist/prompts/agents/configurator.prompt.js +0 -260
  145. package/dist/prompts/agents/configurator.prompt.js.map +0 -1
  146. package/dist/subgraphs/configurator.subgraph.d.ts +0 -158
  147. package/dist/subgraphs/configurator.subgraph.js +0 -234
  148. package/dist/subgraphs/configurator.subgraph.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"discovery.prompt.js","sourceRoot":"","sources":["../../../src/prompts/agents/discovery.prompt.ts"],"names":[],"mappings":";;;AA6HA,kDAIC;AAED,oEAIC;AA0RD,oDAsBC;AAhbD,mCAAiD;AACjD,2DAIgC;AAEhC,wCAAoC;AACpC,2DAAiE;AAGpD,QAAA,sBAAsB,GAG9B;IACJ;QACC,MAAM,EAAE,sFAAsF;QAC9F,UAAU,EAAE;YACX,kCAAiB,CAAC,UAAU;YAC5B,kCAAiB,CAAC,OAAO;YACzB,kCAAiB,CAAC,kBAAkB;SACpC;KACD;IACD;QACC,MAAM,EAAE,+EAA+E;QACvF,UAAU,EAAE;YACX,kCAAiB,CAAC,UAAU;YAC5B,kCAAiB,CAAC,iBAAiB;YACnC,kCAAiB,CAAC,YAAY;SAC9B;KACD;IACD;QACC,MAAM,EAAE,iFAAiF;QACzF,UAAU,EAAE;YACX,kCAAiB,CAAC,UAAU;YAC5B,kCAAiB,CAAC,qBAAqB;YACvC,kCAAiB,CAAC,eAAe;YACjC,kCAAiB,CAAC,aAAa;SAC/B;KACD;IACD;QACC,MAAM,EAAE,iFAAiF;QACzF,UAAU,EAAE;YACX,kCAAiB,CAAC,mBAAmB;YACrC,kCAAiB,CAAC,eAAe;YACjC,kCAAiB,CAAC,mBAAmB;YACrC,kCAAiB,CAAC,UAAU;SAC5B;KACD;IACD;QACC,MAAM,EAAE,sEAAsE;QAC9E,UAAU,EAAE;YACX,kCAAiB,CAAC,mBAAmB;YACrC,kCAAiB,CAAC,aAAa;YAC/B,kCAAiB,CAAC,cAAc;SAChC;KACD;IACD;QACC,MAAM,EAAE,uEAAuE;QAC/E,UAAU,EAAE,CAAC,kCAAiB,CAAC,kBAAkB,EAAE,kCAAiB,CAAC,YAAY,CAAC;KAClF;IACD;QACC,MAAM,EACL,oGAAoG;QACrG,UAAU,EAAE;YACX,kCAAi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OAAO,IAAA,gBAAM,GAAE;SACb,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC;SACrB,OAAO,CAAC,iBAAiB,EAAE,cAAc,CAAC;SAC1C,OAAO,CAAC,SAAS,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;SACjD,OAAO,CAAC,uBAAuB,EAAE,2BAA2B,CAAC,OAAO,CAAC,CAAC;SACtE,SAAS,CAAC,OAAO,CAAC,gBAAgB,EAAE,sBAAsB,EAAE,oBAAoB,CAAC;SACjF,OAAO,CAAC,qBAAqB,EAAE,mBAAmB,CAAC;SACnD,OAAO,CAAC,uBAAuB,EAAE,qBAAqB,CAAC;SACvD,OAAO,CAAC,mBAAmB,EAAE,iBAAiB,CAAC;SAC/C,OAAO,CAAC,mBAAmB,EAAE,iBAAiB,CAAC;SAC/C,OAAO,CAAC,kBAAkB,EAAE,gBAAgB,CAAC;SAC7C,OAAO,CAAC,yBAAyB,EAAE,uBAAuB,CAAC;SAC3D,OAAO,CAAC,oBAAoB,EAAE,kBAAkB,CAAC;SACjD,OAAO,CAAC,wBAAwB,EAAE,sBAAsB,CAAC;SACzD,OAAO,CAAC,0BAA0B,EAAE,wBAAwB,CAAC;SAC7D,OAAO,CAAC,uBAAuB,EAAE,qBAAqB,CAAC;SACvD,OAAO,CAAC,WAAW,EAAE,SAAS,CAAC;SAC/B,KAAK,EAAE,CAAC;AACX,CAAC"}
@@ -0,0 +1,6 @@
1
+ export { buildSupervisorPrompt } from './supervisor.prompt';
2
+ export { buildDiscoveryPrompt, exampleCategorizations, formatTechniqueList, formatExampleCategorizations, } from './discovery.prompt';
3
+ export type { DiscoveryPromptOptions } from './discovery.prompt';
4
+ export { buildBuilderPrompt, buildRecoveryModeContext, INSTANCE_URL_PROMPT, } from './builder.prompt';
5
+ export type { BuilderPromptOptions } from './builder.prompt';
6
+ export { buildResponderPrompt, buildRecursionErrorWithWorkflowGuidance, buildRecursionErrorNoWorkflowGuidance, buildGeneralErrorGuidance, buildDataTableCreationGuidance, } from './responder.prompt';
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildDataTableCreationGuidance = exports.buildGeneralErrorGuidance = exports.buildRecursionErrorNoWorkflowGuidance = exports.buildRecursionErrorWithWorkflowGuidance = exports.buildResponderPrompt = exports.INSTANCE_URL_PROMPT = exports.buildRecoveryModeContext = exports.buildBuilderPrompt = exports.formatExampleCategorizations = exports.formatTechniqueList = exports.exampleCategorizations = exports.buildDiscoveryPrompt = exports.buildSupervisorPrompt = void 0;
4
+ var supervisor_prompt_1 = require("./supervisor.prompt");
5
+ Object.defineProperty(exports, "buildSupervisorPrompt", { enumerable: true, get: function () { return supervisor_prompt_1.buildSupervisorPrompt; } });
6
+ var discovery_prompt_1 = require("./discovery.prompt");
7
+ Object.defineProperty(exports, "buildDiscoveryPrompt", { enumerable: true, get: function () { return discovery_prompt_1.buildDiscoveryPrompt; } });
8
+ Object.defineProperty(exports, "exampleCategorizations", { enumerable: true, get: function () { return discovery_prompt_1.exampleCategorizations; } });
9
+ Object.defineProperty(exports, "formatTechniqueList", { enumerable: true, get: function () { return discovery_prompt_1.formatTechniqueList; } });
10
+ Object.defineProperty(exports, "formatExampleCategorizations", { enumerable: true, get: function () { return discovery_prompt_1.formatExampleCategorizations; } });
11
+ var builder_prompt_1 = require("./builder.prompt");
12
+ Object.defineProperty(exports, "buildBuilderPrompt", { enumerable: true, get: function () { return builder_prompt_1.buildBuilderPrompt; } });
13
+ Object.defineProperty(exports, "buildRecoveryModeContext", { enumerable: true, get: function () { return builder_prompt_1.buildRecoveryModeContext; } });
14
+ Object.defineProperty(exports, "INSTANCE_URL_PROMPT", { enumerable: true, get: function () { return builder_prompt_1.INSTANCE_URL_PROMPT; } });
15
+ var responder_prompt_1 = require("./responder.prompt");
16
+ Object.defineProperty(exports, "buildResponderPrompt", { enumerable: true, get: function () { return responder_prompt_1.buildResponderPrompt; } });
17
+ Object.defineProperty(exports, "buildRecursionErrorWithWorkflowGuidance", { enumerable: true, get: function () { return responder_prompt_1.buildRecursionErrorWithWorkflowGuidance; } });
18
+ Object.defineProperty(exports, "buildRecursionErrorNoWorkflowGuidance", { enumerable: true, get: function () { return responder_prompt_1.buildRecursionErrorNoWorkflowGuidance; } });
19
+ Object.defineProperty(exports, "buildGeneralErrorGuidance", { enumerable: true, get: function () { return responder_prompt_1.buildGeneralErrorGuidance; } });
20
+ Object.defineProperty(exports, "buildDataTableCreationGuidance", { enumerable: true, get: function () { return responder_prompt_1.buildDataTableCreationGuidance; } });
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/prompts/agents/index.ts"],"names":[],"mappings":";;;AAMA,yDAA4D;AAAnD,0HAAA,qBAAqB,OAAA;AAC9B,uDAK4B;AAJ3B,wHAAA,oBAAoB,OAAA;AACpB,0HAAA,sBAAsB,OAAA;AACtB,uHAAA,mBAAmB,OAAA;AACnB,gIAAA,4BAA4B,OAAA;AAG7B,mDAI0B;AAHzB,oHAAA,kBAAkB,OAAA;AAClB,0HAAA,wBAAwB,OAAA;AACxB,qHAAA,mBAAmB,OAAA;AAGpB,uDAM4B;AAL3B,wHAAA,oBAAoB,OAAA;AACpB,2IAAA,uCAAuC,OAAA;AACvC,yIAAA,qCAAqC,OAAA;AACrC,6HAAA,yBAAyB,OAAA;AACzB,kIAAA,8BAA8B,OAAA"}
@@ -0,0 +1,14 @@
1
+ import type { DiscoveryContext } from '../../types/discovery-types';
2
+ import type { PlanOutput } from '../../types/planning';
3
+ import type { SimpleWorkflow } from '../../types/workflow';
4
+ export declare function buildPlannerPrompt(options?: {
5
+ hasDocumentationTool?: boolean;
6
+ }): string;
7
+ export interface PlannerContextOptions {
8
+ userRequest: string;
9
+ discoveryContext: DiscoveryContext;
10
+ workflowJSON: SimpleWorkflow;
11
+ planPrevious?: PlanOutput | null;
12
+ planFeedback?: string | null;
13
+ }
14
+ export declare function buildPlannerContext(options: PlannerContextOptions): string;
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildPlannerPrompt = buildPlannerPrompt;
4
+ exports.buildPlannerContext = buildPlannerContext;
5
+ const mermaid_utils_1 = require("../../tools/utils/mermaid.utils");
6
+ const plan_helpers_1 = require("../../utils/plan-helpers");
7
+ const builder_1 = require("../builder");
8
+ const ROLE = `You are a Planner Agent for n8n AI Workflow Builder.
9
+ Write a brief, plain-language summary of what the workflow will do so the user can confirm it matches their intent before anything is built.`;
10
+ const GOAL = `Your audience is often non-technical. They want a quick "yes, that's what I meant" — not a technical blueprint.
11
+
12
+ Write the plan as if you're explaining it to a colleague in two or three sentences per step. Focus on WHAT happens and WHY, not HOW it's implemented. The builder agent handles all implementation details (credentials, configuration, node parameters, routing logic) — do not include those.`;
13
+ const BEST_PRACTICES_TOOL = `Before writing the plan, use the get_documentation tool to retrieve best practices for the relevant workflow techniques. This gives you proven n8n patterns, recommended node architectures, and common pitfalls to avoid.
14
+
15
+ For example, if the user wants a notification workflow, fetch best practices for "notification". If it involves scheduling, fetch "scheduling". Match the techniques to the user's use case.
16
+
17
+ Available techniques: trigger, loop, branch, subroutine, pagination, parallel_execution, error_handling, scheduling, rate_limiting, batch_processing, ai_agent, ai_chain, rag, data_transformation, http_request, chatbot, content_generation, data_extraction, data_persistence, document_processing, form_input, notification, triage, scraping_and_research, monitoring, enrichment, knowledge_base, human_in_the_loop, data_analysis.`;
18
+ const RULES = `<plan_style>
19
+ Keep it short. A simple workflow (3-5 nodes) needs 2-4 short steps with no sub-steps. Only complex workflows (10+ nodes, branching logic, multiple integrations) warrant sub-steps.
20
+
21
+ Each step should be one sentence describing an outcome the user cares about, not implementation detail.
22
+
23
+ Good step: "If rain is expected, send you a Slack reminder to bring an umbrella"
24
+ Bad step: "Route to 'true' branch if rain is expected, 'false' branch to end workflow"
25
+
26
+ Good step: "Check the weather forecast every morning"
27
+ Bad step: "Configure to run daily at desired time (e.g., 7:00 AM). Use interval mode for simple daily schedule."
28
+
29
+ Do not include sub-steps about configuring credentials, setting parameters, choosing modes, or routing logic. The builder handles all of that.
30
+
31
+ For additionalSpecs: NEVER mention API keys, credentials, authentication, or account setup — the user already knows they need to connect their accounts and n8n handles credentials separately. Only mention non-obvious requirements that would genuinely surprise the user (e.g., "Requires a paid Slack plan for message history access").
32
+ </plan_style>
33
+
34
+ Rules:
35
+ - Do not generate workflow JSON.
36
+ - Do not mention internal n8n node type names in steps — describe what happens in plain language.
37
+ - You may include suggestedNodes in the structured output for the builder, but the step description should be human-readable.
38
+ - If key information is missing, make reasonable assumptions. Only add to additionalSpecs if something would genuinely surprise the user — never credentials or API keys.
39
+
40
+ <modification_mode>
41
+ When an existing_workflow_summary is provided, the user is asking to MODIFY an existing workflow — not rebuild it from scratch.
42
+ - Only describe the CHANGES being made, not the entire workflow.
43
+ - The summary should explain what will be modified and why.
44
+ - Steps should only cover the modifications (e.g., "Change the AI model from GPT-4.1-mini to GPT-5-mini"), not re-describe unchanged parts of the workflow.
45
+ - Keep the trigger field as-is from the existing workflow if it isn't changing.
46
+ </modification_mode>`;
47
+ const OUTPUT_FORMAT = `Output format:
48
+ - summary: 1–2 sentences describing the workflow outcome in plain language
49
+ - trigger: what starts the workflow, described simply (e.g., "Runs every morning at 7 AM")
50
+ - steps: short list of what happens, each step is one sentence. Include suggestedNodes for the builder but keep the description non-technical.
51
+ - additionalSpecs: only non-obvious things the user must know. NEVER mention API keys, credentials, connecting accounts, or authentication — these are always required and stating them wastes the user's time. Only include genuinely surprising requirements.`;
52
+ function buildPlannerPrompt(options) {
53
+ return (0, builder_1.prompt)()
54
+ .section('role', ROLE)
55
+ .section('goal', GOAL)
56
+ .sectionIf(options?.hasDocumentationTool, 'best_practices_tool', BEST_PRACTICES_TOOL)
57
+ .section('rules', RULES)
58
+ .section('output_format', OUTPUT_FORMAT)
59
+ .build();
60
+ }
61
+ function buildPlannerContext(options) {
62
+ const { userRequest, discoveryContext, workflowJSON, planPrevious, planFeedback } = options;
63
+ const discoveredNodesList = discoveryContext.nodesFound
64
+ .map((node) => `- ${node.nodeName} v${node.version}: ${node.reasoning}`)
65
+ .join('\n');
66
+ const workflowOverview = workflowJSON.nodes.length > 0
67
+ ? (0, mermaid_utils_1.mermaidStringify)({ workflow: workflowJSON }, { includeNodeType: true, includeNodeParameters: true, includeNodeName: true })
68
+ : '';
69
+ return (0, builder_1.prompt)()
70
+ .section('user_request', userRequest)
71
+ .sectionIf(discoveryContext.nodesFound.length > 0, 'discovery_context_suggested_nodes', discoveredNodesList)
72
+ .sectionIf(workflowJSON.nodes.length > 0, 'existing_workflow', workflowOverview)
73
+ .sectionIf(planPrevious, 'previous_plan', () => (0, plan_helpers_1.formatPlanAsText)(planPrevious))
74
+ .sectionIf(planFeedback, 'user_feedback', () => planFeedback)
75
+ .build();
76
+ }
77
+ //# sourceMappingURL=planner.prompt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"planner.prompt.js","sourceRoot":"","sources":["../../../src/prompts/agents/planner.prompt.ts"],"names":[],"mappings":";;AA+DA,gDAQC;AAeD,kDA0BC;AA1GD,+DAA+D;AAI/D,uDAAwD;AAExD,wCAAoC;AAEpC,MAAM,IAAI,GAAG;6IACgI,CAAC;AAE9I,MAAM,IAAI,GAAG;;gSAEmR,CAAC;AAEjS,MAAM,mBAAmB,GAAG;;;;0aAI8Y,CAAC;AAE3a,MAAM,KAAK,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBA4BO,CAAC;AAEtB,MAAM,aAAa,GAAG;;;;gQAI0O,CAAC;AAEjQ,SAAgB,kBAAkB,CAAC,OAA4C;IAC9E,OAAO,IAAA,gBAAM,GAAE;SACb,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC;SACrB,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC;SACrB,SAAS,CAAC,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,mBAAmB,CAAC;SACpF,OAAO,CA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a helpful AI assistant for n8n workflow automati
12
12
  You have access to context about what has been built, including:
13
13
  - Discovery results (nodes found)
14
14
  - Builder output (workflow structure)
15
- - Configuration summary (setup instructions)`;
15
+ - Configuration summary (setup instructions)
16
+ - Workflow indicator showing current nodes and their connections
17
+
18
+ The other agents (Builder) have access to workflow context tools:
19
+ - get_workflow_overview: Visual Mermaid diagram and summary
20
+ - get_node_context: Full details for a specific node
21
+
22
+ When explaining the workflow to users, use the information provided in your context.`;
16
23
  const WORKFLOW_COMPLETION = `When you receive [Internal Context], synthesize a clean user-facing response:
17
24
  1. Summarize what was built in a friendly way
18
25
  2. Explain the workflow structure briefly
@@ -38,13 +45,38 @@ const CONVERSATIONAL_RESPONSES = `- Be friendly and concise
38
45
  const RESPONSE_STYLE = `- Keep responses focused and not overly long
39
46
  - Use markdown formatting for readability
40
47
  - Be conversational and helpful
41
- - Do not use emojis in your response`;
48
+ - Do not use emojis in your response
49
+
50
+ CRITICAL - Describe what was built:
51
+ - Report the ACTUAL configuration from the workflow JSON, not what you think should be there
52
+ - If the workflow uses a model name you don't recognize, describe it exactly as configured—do NOT claim it was changed to something else
53
+ - Your training has a knowledge cutoff. New models exist. Never say "X isn't available yet" about configured values`;
42
54
  const GUARDRAILS = `Your capabilities are focused on workflow building:
43
55
  - You work from your existing knowledge of n8n nodes and integrations
44
56
  - You help users design and configure workflows based on their requirements
45
57
  - You provide guidance on node configuration and workflow structure
46
58
 
47
59
  If a user asks you to search for information or look something up online, let them know you can help build workflows based on your existing knowledge of n8n nodes and integrations, though you don't have access to external websites or real-time information.`;
60
+ const EXECUTION_ISSUE_HANDLING = `IMPORTANT: Check the [Internal Context] to see if work was JUST COMPLETED:
61
+
62
+ **If Builder just completed** (shown in Internal Context):
63
+ - Summarize what was DONE, not what SHOULD be done
64
+ - Example: "I've fixed the Split Articles configuration to properly handle the array of articles."
65
+ - Do NOT ask "Would you like me to fix this?" when it was already fixed
66
+ - The execution status may still show old data from BEFORE the fix - trust the completion status
67
+
68
+ **If no recent work was done and execution status shows issues**:
69
+ 1. BRIEFLY explain what happened using the data_flow information
70
+ - Example: "I can see Fetch AI News returned 1 item, but Split Articles produced nothing"
71
+ - Keep it concise - one or two sentences
72
+
73
+ 2. Offer to investigate and fix
74
+ - Example: "Would you like me to investigate and fix this?"
75
+
76
+ 3. NEVER ask the user to share data or check outputs themselves
77
+ - The system has access to execution data - you don't need the user to provide it
78
+
79
+ 4. Keep explanations brief - the user wants the AI to fix it, not a debugging guide`;
48
80
  function buildRecursionErrorWithWorkflowGuidance(nodeCount) {
49
81
  return [
50
82
  `**Workflow Status:** ${nodeCount} node${nodeCount === 1 ? '' : 's'} ${nodeCount === 1 ? 'was' : 'were'} created before the complexity limit was reached.`,
@@ -103,6 +135,7 @@ function buildResponderPrompt() {
103
135
  return (0, builder_1.prompt)()
104
136
  .section('role', RESPONDER_ROLE)
105
137
  .section('guardrails', GUARDRAILS)
138
+ .section('execution_issue_handling', EXECUTION_ISSUE_HANDLING)
106
139
  .section('workflow_completion_responses', WORKFLOW_COMPLETION)
107
140
  .section('conversational_responses', CONVERSATIONAL_RESPONSES)
108
141
  .section('response_style', RESPONSE_STYLE)
@@ -1 +1 @@
1
- {"version":3,"file":"responder.prompt.js","sourceRoot":"","sources":["../../../src/prompts/agents/responder.prompt.ts"],"names":[],"mappings":";;AA2DA,0FAOC;AAGD,sFAOC;AAGD,8DAKC;AAMD,wEAwBC;AAoBD,oDAQC;AAvID,mEAA+F;AAE/F,wCAAoC;AAEpC,MAAM,cAAc,GAAG;;;;;6CAKsB,CAAC;AAE9C,MAAM,mBAAmB,GAAG;;;;;;;;;;;;;;;;;;+CAkBmB,CAAC;AAEhD,MAAM,wBAAwB,GAAG;;0CAES,CAAC;AAE3C,MAAM,cAAc,GAAG;;;qCAGc,CAAC;AAEtC,MAAM,UAAU,GAAG;;;;;iQAK8O,CAAC;AAOlQ,SAAgB,uCAAuC,CAAC,SAAiB;IACxE,OAAO;QACN,wBAAwB,SAAS,QAAQ,SA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LE = 'You are a Supervisor that routes user requests to specialist agents.';
6
6
  const AVAILABLE_AGENTS = `- discovery: Find n8n nodes for building/modifying workflows
7
- - builder: Create nodes and connections (requires discovery first for new node types)
8
- - configurator: Set parameters on EXISTING nodes (no structural changes)
7
+ - builder: Create nodes and connections (requires discovery first for new node types) and sets parameters on nodes
9
8
  - responder: Answer questions, confirm completion (TERMINAL)`;
10
9
  const ROUTING_DECISION_TREE = `1. Is user asking a question or chatting? → responder
11
10
  Examples: "what does this do?", "explain the workflow", "thanks"
@@ -20,13 +19,13 @@ const ROUTING_DECISION_TREE = `1. Is user asking a question or chatting? → res
20
19
  3. Is the request about connecting/disconnecting existing nodes? → builder
21
20
  Examples: "Connect node A to node B", "Remove the connection to X"
22
21
 
23
- 4. Is the request about changing VALUES in existing nodes? → configurator
22
+ 4. Is the request about changing VALUES in existing nodes? → builder
24
23
  Examples:
25
24
  - "Change the URL to https://..."
26
25
  - "Set the timeout to 30 seconds"
27
26
  - "Update the email subject to..."`;
28
27
  const KEY_DISTINCTION = `- "Use [ServiceB] instead of [ServiceA]" = REPLACEMENT = discovery (new node type needed)
29
- - "Change the [ServiceA] API key" = CONFIGURATION = configurator (same node, different value)`;
28
+ - "Change the [ServiceA] API key" = CONFIGURATION = builder (same node, different value)`;
30
29
  const OUTPUT_FORMAT = `- reasoning: One sentence explaining your routing decision
31
30
  - next: Agent name`;
32
31
  const INSTRUCTION = 'Given the conversation above, which agent should act next? Provide your reasoning and selection.';
@@ -1 +1 @@
1
- {"version":3,"file":"supervisor.prompt.js","sourceRoot":"","sources":["../../../src/prompts/agents/supervisor.prompt.ts"],"names":[],"mappings":";;AA6CA,sDASC;AA/CD,wCAAoC;AAEpC,MAAM,eAAe,GAAG,sEAAsE,CAAC;AAE/F,MAAM,gBAAgB,GAAG;;;6DAGoC,CAAC;AAE9D,MAAM,qBAAqB,GAAG;;;;;;;;;;;;;;;;;sCAiBQ,CAAC;AAGvC,MAAM,eAAe,GAAG;8FACsE,CAAC;AAE/F,MAAM,aAAa,GAAG;mBACH,CAAC;AAEpB,MAAM,WAAW,GAChB,kGAAkG,CAAC;AAEpG,SAAgB,qBAAqB;IACpC,OAAO,IAAA,gBAAM,GAAE;SACb,OAAO,CAAC,MAAM,EAAE,eAAe,CAAC;SAChC,OAAO,CAAC,kBAAkB,EAAE,gBAAgB,CAAC;SAC7C,OAAO,CAAC,uBAAuB,EAAE,qBAAqB,CAAC;SACvD,OAAO,CAAC,iBAAiB,EAAE,eAAe,CAAC;SAC3C,OAAO,CAAC,QAAQ,EAAE,aAAa,CAAC;SAChC,OAAO,CAAC,aAAa,EAAE,WAAW,CAAC;SACnC,KAAK,EAAE,CAAC;AACX,CAAC"}
1
+ {"version":3,"file":"supervisor.prompt.js","sourceRoot":"","sources":["../../../src/prompts/agents/supervisor.prompt.ts"],"names":[],"mappings":";;AA4CA,sDASC;AA9CD,wCAAoC;AAEpC,MAAM,eAAe,GAAG,sEAAsE,CAAC;AAE/F,MAAM,gBAAgB,GAAG;;6DAEoC,CAAC;AAE9D,MAAM,qBAAqB,GAAG;;;;;;;;;;;;;;;;;sCAiBQ,CAAC;AAGvC,MAAM,eAAe,GAAG;yFACiE,CAAC;AAE1F,MAAM,aAAa,GAAG;mBACH,CAAC;AAEpB,MAAM,WAAW,GAChB,kGAAkG,CAAC;AAEpG,SAAgB,qBAAqB;IACpC,OAAO,IAAA,gBAAM,GAAE;SACb,OAAO,CAAC,MAAM,EAAE,eAAe,CAAC;SAChC,OAAO,CAAC,kBAAkB,EAAE,gBAAgB,CAAC;SAC7C,OAAO,CAAC,uBAAuB,EAAE,qBAAqB,CAAC;SACvD,OAAO,CAAC,iBAAiB,EAAE,eAAe,CAAC;SAC3C,OAAO,CAAC,QAAQ,EAAE,aAAa,CAAC;SAChC,OAAO,CAAC,aAAa,EAAE,WAAW,CAAC;SACnC,KAAK,EAAE,CAAC;AACX,CAAC"}
@@ -1,9 +1,9 @@
1
1
  export { PromptBuilder, prompt, type ContentOrFactory, type MessageBlock, type PromptBuilderOptions, type SectionFormat, type SectionOptions, } from './builder';
2
- export { buildBuilderPrompt } from './agents/builder.prompt';
3
- export { buildDiscoveryPrompt, formatTechniqueList, formatExampleCategorizations, type DiscoveryPromptOptions, } from './agents/discovery.prompt';
4
- export { buildConfiguratorPrompt, INSTANCE_URL_PROMPT } from './agents/configurator.prompt';
2
+ export { buildBuilderPrompt, INSTANCE_URL_PROMPT, buildRecoveryModeContext, } from './agents/builder.prompt';
3
+ export { buildDiscoveryPrompt, exampleCategorizations, formatTechniqueList, formatExampleCategorizations, type DiscoveryPromptOptions, } from './agents/discovery.prompt';
5
4
  export { buildSupervisorPrompt } from './agents/supervisor.prompt';
6
- export { buildResponderPrompt } from './agents/responder.prompt';
5
+ export { buildPlannerPrompt, buildPlannerContext } from './agents/planner.prompt';
6
+ export { buildResponderPrompt, buildRecursionErrorWithWorkflowGuidance, buildRecursionErrorNoWorkflowGuidance, buildGeneralErrorGuidance, buildDataTableCreationGuidance, } from './agents/responder.prompt';
7
7
  export { promptCategorizationTemplate, examplePrompts, formatExamplePrompts, formatTechniqueList as formatCategorizationTechniqueList, } from './chains/categorization.prompt';
8
8
  export { compactPromptTemplate } from './chains/compact.prompt';
9
9
  export { workflowNamingPromptTemplate } from './chains/workflow-name.prompt';
@@ -1,22 +1,29 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TEXT_FIELDS_GUIDE = exports.SYSTEM_MESSAGE_GUIDE = exports.RESOURCE_LOCATOR_GUIDE = exports.TOOL_NODES_GUIDE = exports.HTTP_REQUEST_GUIDE = exports.SWITCH_NODE_GUIDE = exports.IF_NODE_GUIDE = exports.SET_NODE_GUIDE = exports.OUTPUT_FORMAT = exports.COMMON_PATTERNS = exports.EXPRESSION_RULES = exports.CORE_INSTRUCTIONS = exports.instanceUrlPrompt = exports.hasResourceLocatorParameters = exports.matchesPattern = exports.getMatchingExamples = exports.getMatchingGuides = exports.workflowNamingPromptTemplate = exports.compactPromptTemplate = exports.formatCategorizationTechniqueList = exports.formatExamplePrompts = exports.examplePrompts = exports.promptCategorizationTemplate = exports.buildResponderPrompt = exports.buildSupervisorPrompt = exports.INSTANCE_URL_PROMPT = exports.buildConfiguratorPrompt = exports.formatExampleCategorizations = exports.formatTechniqueList = exports.buildDiscoveryPrompt = exports.buildBuilderPrompt = exports.prompt = exports.PromptBuilder = void 0;
3
+ exports.TEXT_FIELDS_GUIDE = exports.SYSTEM_MESSAGE_GUIDE = exports.RESOURCE_LOCATOR_GUIDE = exports.TOOL_NODES_GUIDE = exports.HTTP_REQUEST_GUIDE = exports.SWITCH_NODE_GUIDE = exports.IF_NODE_GUIDE = exports.SET_NODE_GUIDE = exports.OUTPUT_FORMAT = exports.COMMON_PATTERNS = exports.EXPRESSION_RULES = exports.CORE_INSTRUCTIONS = exports.instanceUrlPrompt = exports.hasResourceLocatorParameters = exports.matchesPattern = exports.getMatchingExamples = exports.getMatchingGuides = exports.workflowNamingPromptTemplate = exports.compactPromptTemplate = exports.formatCategorizationTechniqueList = exports.formatExamplePrompts = exports.examplePrompts = exports.promptCategorizationTemplate = exports.buildDataTableCreationGuidance = exports.buildGeneralErrorGuidance = exports.buildRecursionErrorNoWorkflowGuidance = exports.buildRecursionErrorWithWorkflowGuidance = exports.buildResponderPrompt = exports.buildPlannerContext = exports.buildPlannerPrompt = exports.buildSupervisorPrompt = exports.formatExampleCategorizations = exports.formatTechniqueList = exports.exampleCategorizations = exports.buildDiscoveryPrompt = exports.buildRecoveryModeContext = exports.INSTANCE_URL_PROMPT = exports.buildBuilderPrompt = exports.prompt = exports.PromptBuilder = void 0;
4
4
  var builder_1 = require("./builder");
5
5
  Object.defineProperty(exports, "PromptBuilder", { enumerable: true, get: function () { return builder_1.PromptBuilder; } });
6
6
  Object.defineProperty(exports, "prompt", { enumerable: true, get: function () { return builder_1.prompt; } });
7
7
  var builder_prompt_1 = require("./agents/builder.prompt");
8
8
  Object.defineProperty(exports, "buildBuilderPrompt", { enumerable: true, get: function () { return builder_prompt_1.buildBuilderPrompt; } });
9
+ Object.defineProperty(exports, "INSTANCE_URL_PROMPT", { enumerable: true, get: function () { return builder_prompt_1.INSTANCE_URL_PROMPT; } });
10
+ Object.defineProperty(exports, "buildRecoveryModeContext", { enumerable: true, get: function () { return builder_prompt_1.buildRecoveryModeContext; } });
9
11
  var discovery_prompt_1 = require("./agents/discovery.prompt");
10
12
  Object.defineProperty(exports, "buildDiscoveryPrompt", { enumerable: true, get: function () { return discovery_prompt_1.buildDiscoveryPrompt; } });
13
+ Object.defineProperty(exports, "exampleCategorizations", { enumerable: true, get: function () { return discovery_prompt_1.exampleCategorizations; } });
11
14
  Object.defineProperty(exports, "formatTechniqueList", { enumerable: true, get: function () { return discovery_prompt_1.formatTechniqueList; } });
12
15
  Object.defineProperty(exports, "formatExampleCategorizations", { enumerable: true, get: function () { return discovery_prompt_1.formatExampleCategorizations; } });
13
- var configurator_prompt_1 = require("./agents/configurator.prompt");
14
- Object.defineProperty(exports, "buildConfiguratorPrompt", { enumerable: true, get: function () { return configurator_prompt_1.buildConfiguratorPrompt; } });
15
- Object.defineProperty(exports, "INSTANCE_URL_PROMPT", { enumerable: true, get: function () { return configurator_prompt_1.INSTANCE_URL_PROMPT; } });
16
16
  var supervisor_prompt_1 = require("./agents/supervisor.prompt");
17
17
  Object.defineProperty(exports, "buildSupervisorPrompt", { enumerable: true, get: function () { return supervisor_prompt_1.buildSupervisorPrompt; } });
18
+ var planner_prompt_1 = require("./agents/planner.prompt");
19
+ Object.defineProperty(exports, "buildPlannerPrompt", { enumerable: true, get: function () { return planner_prompt_1.buildPlannerPrompt; } });
20
+ Object.defineProperty(exports, "buildPlannerContext", { enumerable: true, get: function () { return planner_prompt_1.buildPlannerContext; } });
18
21
  var responder_prompt_1 = require("./agents/responder.prompt");
19
22
  Object.defineProperty(exports, "buildResponderPrompt", { enumerable: true, get: function () { return responder_prompt_1.buildResponderPrompt; } });
23
+ Object.defineProperty(exports, "buildRecursionErrorWithWorkflowGuidance", { enumerable: true, get: function () { return responder_prompt_1.buildRecursionErrorWithWorkflowGuidance; } });
24
+ Object.defineProperty(exports, "buildRecursionErrorNoWorkflowGuidance", { enumerable: true, get: function () { return responder_prompt_1.buildRecursionErrorNoWorkflowGuidance; } });
25
+ Object.defineProperty(exports, "buildGeneralErrorGuidance", { enumerable: true, get: function () { return responder_prompt_1.buildGeneralErrorGuidance; } });
26
+ Object.defineProperty(exports, "buildDataTableCreationGuidance", { enumerable: true, get: function () { return responder_prompt_1.buildDataTableCreationGuidance; } });
20
27
  var categorization_prompt_1 = require("./chains/categorization.prompt");
21
28
  Object.defineProperty(exports, "promptCategorizationTemplate", { enumerable: true, get: function () { return categorization_prompt_1.promptCategorizationTemplate; } });
22
29
  Object.defineProperty(exports, "examplePrompts", { enumerable: true, get: function () { return categorization_prompt_1.examplePrompts; } });
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/prompts/index.ts"],"names":[],"mappings":";;;AAWA,qCAQmB;AAPlB,wGAAA,aAAa,OAAA;AACb,iGAAA,MAAM,OAAA;AASP,0DAA6D;AAApD,oHAAA,kBAAkB,OAAA;AAC3B,8DAKmC;AAJlC,wHAAA,oBAAoB,OAAA;AACpB,uHAAA,mBAAmB,OAAA;AACnB,gIAAA,4BAA4B,OAAA;AAG7B,oEAA4F;AAAnF,8HAAA,uBAAuB,OAAA;AAAE,0HAAA,mBAAmB,OAAA;AACrD,gEAAmE;AAA1D,0HAAA,qBAAqB,OAAA;AAC9B,8DAAiE;AAAxD,wHAAA,oBAAoB,OAAA;AAG7B,wEAKwC;AAJvC,qIAAA,4BAA4B,OAAA;AAC5B,uHAAA,cAAc,OAAA;AACd,6HAAA,oBAAoB,OAAA;AACpB,0IAAA,mBAAmB,OAAqC;AAEzD,0DAAgE;AAAvD,uHAAA,qBAAqB,OAAA;AAC9B,sEAA6E;AAApE,oIAAA,4BAA4B,OAAA;AAGrC,gEAsBoC;AApBnC,sHAAA,iB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AqB,OAAA;AAC9B,sEAA6E;AAApE,oIAAA,4BAA4B,OAAA;AAGrC,gEAsBoC;AApBnC,sHAAA,iBAAiB,OAAA;AACjB,wHAAA,mBAAmB,OAAA;AACnB,mHAAA,cAAc,OAAA;AAEd,iIAAA,4BAA4B,OAAA;AAC5B,sHAAA,iBAAiB,OAAA;AAEjB,sHAAA,iBAAiB,OAAA;AACjB,qHAAA,gBAAgB,OAAA;AAChB,oHAAA,eAAe,OAAA;AACf,kHAAA,aAAa,OAAA;AAEb,mHAAA,cAAc,OAAA;AACd,kHAAA,aAAa,OAAA;AACb,sHAAA,iBAAiB,OAAA;AACjB,uHAAA,kBAAkB,OAAA;AAClB,qHAAA,gBAAgB,OAAA;AAChB,2HAAA,sBAAsB,OAAA;AACtB,yHAAA,oBAAoB,OAAA;AACpB,sHAAA,iBAAiB,OAAA"}
@@ -1,15 +1,33 @@
1
1
  import { MemorySaver } from '@langchain/langgraph';
2
2
  import { Logger } from '@n8n/backend-common';
3
3
  import type { INodeTypeDescription } from 'n8n-workflow';
4
+ import type { HITLHistoryEntry, HITLInterruptValue } from './types/planning';
4
5
  import { Session } from './types/sessions';
5
6
  export declare class SessionManagerService {
6
7
  private readonly logger?;
7
8
  private checkpointer;
8
9
  private nodeTypes;
10
+ private static readonly HITL_TTL_MS;
11
+ private pendingHitlByThreadId;
12
+ private hitlHistoryByThreadId;
9
13
  constructor(parsedNodeTypes: INodeTypeDescription[], logger?: Logger | undefined);
10
14
  updateNodeTypes(nodeTypes: INodeTypeDescription[]): void;
11
15
  static generateThreadId(workflowId?: string, userId?: string): string;
12
16
  getCheckpointer(): MemorySaver;
17
+ setPendingHitl(threadId: string, value: HITLInterruptValue, triggeringMessageId?: string): void;
18
+ clearPendingHitl(threadId: string): void;
19
+ getAndClearPendingHitl(threadId: string): {
20
+ value: HITLInterruptValue;
21
+ triggeringMessageId?: string;
22
+ } | undefined;
23
+ getPendingHitl(threadId: string): HITLInterruptValue | undefined;
24
+ addHitlEntry(threadId: string, entry: HITLHistoryEntry): void;
25
+ getHitlHistory(threadId: string): HITLHistoryEntry[];
26
+ private truncateHitlHistory;
27
+ private injectHitlHistory;
28
+ private hitlEntryToMessages;
29
+ private findInsertPosition;
30
+ private evictExpiredHitl;
13
31
  getSessions(workflowId: string | undefined, userId: string | undefined): Promise<{
14
32
  sessions: Session[];
15
33
  }>;
@@ -17,10 +17,14 @@ const di_1 = require("@n8n/di");
17
17
  const builder_tools_1 = require("./tools/builder-tools");
18
18
  const sessions_1 = require("./types/sessions");
19
19
  const stream_processor_1 = require("./utils/stream-processor");
20
- let SessionManagerService = SessionManagerService_1 = class SessionManagerService {
20
+ let SessionManagerService = class SessionManagerService {
21
+ static { SessionManagerService_1 = this; }
21
22
  logger;
22
23
  checkpointer;
23
24
  nodeTypes;
25
+ static HITL_TTL_MS = 24 * 60 * 60 * 1000;
26
+ pendingHitlByThreadId = new Map();
27
+ hitlHistoryByThreadId = new Map();
24
28
  constructor(parsedNodeTypes, logger) {
25
29
  this.logger = logger;
26
30
  this.nodeTypes = parsedNodeTypes;
@@ -37,6 +41,137 @@ let SessionManagerService = SessionManagerService_1 = class SessionManagerServic
37
41
  getCheckpointer() {
38
42
  return this.checkpointer;
39
43
  }
44
+ setPendingHitl(threadId, value, triggeringMessageId) {
45
+ this.evictExpiredHitl();
46
+ this.pendingHitlByThreadId.set(threadId, {
47
+ value,
48
+ triggeringMessageId,
49
+ expiresAt: Date.now() + SessionManagerService_1.HITL_TTL_MS,
50
+ });
51
+ }
52
+ clearPendingHitl(threadId) {
53
+ this.pendingHitlByThreadId.delete(threadId);
54
+ }
55
+ getAndClearPendingHitl(threadId) {
56
+ this.evictExpiredHitl();
57
+ const entry = this.pendingHitlByThreadId.get(threadId);
58
+ if (!entry)
59
+ return undefined;
60
+ if (Date.now() > entry.expiresAt) {
61
+ this.pendingHitlByThreadId.delete(threadId);
62
+ return undefined;
63
+ }
64
+ this.pendingHitlByThreadId.delete(threadId);
65
+ return { value: entry.value, triggeringMessageId: entry.triggeringMessageId };
66
+ }
67
+ getPendingHitl(threadId) {
68
+ this.evictExpiredHitl();
69
+ const entry = this.pendingHitlByThreadId.get(threadId);
70
+ if (!entry)
71
+ return undefined;
72
+ if (Date.now() > entry.expiresAt) {
73
+ this.pendingHitlByThreadId.delete(threadId);
74
+ return undefined;
75
+ }
76
+ return entry.value;
77
+ }
78
+ addHitlEntry(threadId, entry) {
79
+ const history = this.hitlHistoryByThreadId.get(threadId) ?? [];
80
+ history.push(entry);
81
+ this.hitlHistoryByThreadId.set(threadId, history);
82
+ }
83
+ getHitlHistory(threadId) {
84
+ return this.hitlHistoryByThreadId.get(threadId) ?? [];
85
+ }
86
+ truncateHitlHistory(threadId, survivingMessages) {
87
+ const history = this.hitlHistoryByThreadId.get(threadId);
88
+ if (!history || history.length === 0)
89
+ return;
90
+ const survivingIds = new Set(survivingMessages
91
+ .map((m) => m.additional_kwargs?.messageId)
92
+ .filter(Boolean));
93
+ const filtered = history.filter((entry) => !entry.afterMessageId || survivingIds.has(entry.afterMessageId));
94
+ if (filtered.length === 0) {
95
+ this.hitlHistoryByThreadId.delete(threadId);
96
+ }
97
+ else {
98
+ this.hitlHistoryByThreadId.set(threadId, filtered);
99
+ }
100
+ }
101
+ injectHitlHistory(threadId, formattedMessages) {
102
+ const history = this.getHitlHistory(threadId);
103
+ if (history.length === 0)
104
+ return;
105
+ const groups = new Map();
106
+ for (const entry of history) {
107
+ const key = entry.afterMessageId;
108
+ const msgs = groups.get(key) ?? [];
109
+ msgs.push(...this.hitlEntryToMessages(entry));
110
+ groups.set(key, msgs);
111
+ }
112
+ const keys = [...groups.keys()].reverse();
113
+ for (const afterMessageId of keys) {
114
+ const msgs = groups.get(afterMessageId);
115
+ const insertAt = this.findInsertPosition(formattedMessages, afterMessageId);
116
+ formattedMessages.splice(insertAt, 0, ...msgs);
117
+ }
118
+ }
119
+ hitlEntryToMessages(entry) {
120
+ if (entry.type === 'questions_answered') {
121
+ return [
122
+ {
123
+ role: 'assistant',
124
+ type: 'questions',
125
+ questions: entry.interrupt.questions,
126
+ ...(entry.interrupt.introMessage ? { introMessage: entry.interrupt.introMessage } : {}),
127
+ },
128
+ {
129
+ role: 'user',
130
+ type: 'user_answers',
131
+ answers: Array.isArray(entry.answers) ? entry.answers : [],
132
+ },
133
+ ];
134
+ }
135
+ const messages = [
136
+ {
137
+ role: 'assistant',
138
+ type: 'plan',
139
+ plan: entry.plan,
140
+ },
141
+ ];
142
+ if (entry.decision === 'reject') {
143
+ messages.push({
144
+ role: 'user',
145
+ type: 'message',
146
+ text: entry.feedback ?? 'Plan rejected',
147
+ });
148
+ }
149
+ else if (entry.decision === 'modify') {
150
+ messages.push({
151
+ role: 'user',
152
+ type: 'message',
153
+ text: entry.feedback ?? 'Please modify the plan',
154
+ });
155
+ }
156
+ return messages;
157
+ }
158
+ findInsertPosition(formattedMessages, afterMessageId) {
159
+ if (afterMessageId) {
160
+ const idx = formattedMessages.findIndex((m) => m.id === afterMessageId);
161
+ if (idx !== -1)
162
+ return idx + 1;
163
+ }
164
+ const firstUserIdx = formattedMessages.findIndex((m) => m.role === 'user');
165
+ return firstUserIdx !== -1 ? firstUserIdx + 1 : 0;
166
+ }
167
+ evictExpiredHitl() {
168
+ const now = Date.now();
169
+ for (const [id, entry] of this.pendingHitlByThreadId) {
170
+ if (now > entry.expiresAt) {
171
+ this.pendingHitlByThreadId.delete(id);
172
+ }
173
+ }
174
+ }
40
175
  async getSessions(workflowId, userId) {
41
176
  const sessions = [];
42
177
  if (workflowId) {
@@ -56,6 +191,22 @@ let SessionManagerService = SessionManagerService_1 = class SessionManagerServic
56
191
  const formattedMessages = (0, stream_processor_1.formatMessages)(messages, (0, builder_tools_1.getBuilderToolsForDisplay)({
57
192
  nodeTypes: this.nodeTypes,
58
193
  }));
194
+ this.injectHitlHistory(threadId, formattedMessages);
195
+ const pendingHitl = this.getPendingHitl(threadId);
196
+ if (pendingHitl) {
197
+ formattedMessages.push({
198
+ role: 'assistant',
199
+ type: pendingHitl.type,
200
+ ...(pendingHitl.type === 'questions'
201
+ ? {
202
+ questions: pendingHitl.questions,
203
+ ...(pendingHitl.introMessage ? { introMessage: pendingHitl.introMessage } : {}),
204
+ }
205
+ : {
206
+ plan: pendingHitl.plan,
207
+ }),
208
+ });
209
+ }
59
210
  sessions.push({
60
211
  sessionId: threadId,
61
212
  messages: formattedMessages,
@@ -106,6 +257,8 @@ let SessionManagerService = SessionManagerService_1 = class SessionManagerServic
106
257
  parents: {},
107
258
  };
108
259
  await this.checkpointer.put(threadConfig, updatedCheckpoint, metadata);
260
+ this.truncateHitlHistory(threadId, truncatedMessages);
261
+ this.clearPendingHitl(threadId);
109
262
  this.logger?.debug('Messages truncated successfully', {
110
263
  threadId,
111
264
  messageId,
@@ -1 +1 @@
1
- {"version":3,"file":"session-manager.service.js","sourceRoot":"","sources":["../src/session-manager.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AACA,oDAAoE;AACpE,wDAA6C;AAC7C,gCAAkC;AAGlC,yDAAkE;AAClE,+CAAuF;AACvF,+DAA0D;AAGnD,IAAM,qBAAqB,6BAA3B,MAAM,qBAAqB;IAOf;IANV,YAAY,CAAc;IAE1B,SAAS,CAAyB;IAE1C,YACC,eAAuC,EACtB,MAAe;QAAf,WAAM,GAAN,MAAM,CAAS;QAEhC,IAAI,CAAC,SAAS,GAAG,eAAe,CAAC;QACjC,IAAI,CAAC,YAAY,GAAG,IAAI,uBAAW,EAAE,CAAC;IACvC,CAAC;IAMD,eAAe,CAAC,SAAiC;QAChD,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC5B,CAAC;IAKD,MAAM,CAAC,gBAAgB,CAAC,UAAmB,EAAE,MAAe;QAC3D,OAAO,UAAU;YAChB,CAAC,CAAC,YAAY,UAAU,SAAS,MAAM,IAAI,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,EAAE;YACjE,CAAC,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC;IACxB,CAAC;IAKD,eAAe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