@n8n/ai-workflow-builder 1.2.2 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agents/responder.agent.js +18 -2
- package/dist/agents/responder.agent.js.map +1 -1
- package/dist/build.tsbuildinfo +1 -1
- package/dist/multi-agent-workflow-subgraphs.d.ts +4 -1
- package/dist/multi-agent-workflow-subgraphs.js +3 -0
- package/dist/multi-agent-workflow-subgraphs.js.map +1 -1
- package/dist/prompts/agents/builder.prompt.js +6 -0
- package/dist/prompts/agents/builder.prompt.js.map +1 -1
- package/dist/prompts/agents/configurator.prompt.d.ts +1 -0
- package/dist/prompts/agents/configurator.prompt.js +13 -0
- package/dist/prompts/agents/configurator.prompt.js.map +1 -1
- package/dist/prompts/agents/responder.prompt.d.ts +3 -0
- package/dist/prompts/agents/responder.prompt.js +23 -0
- package/dist/prompts/agents/responder.prompt.js.map +1 -1
- package/dist/subgraphs/configurator.subgraph.js +14 -0
- package/dist/subgraphs/configurator.subgraph.js.map +1 -1
- package/dist/tools/best-practices/chatbot.js +1 -0
- package/dist/tools/best-practices/chatbot.js.map +1 -1
- package/dist/tools/best-practices/data-transformation.js +11 -25
- package/dist/tools/best-practices/data-transformation.js.map +1 -1
- package/dist/tools/best-practices/form-input.js +2 -2
- package/dist/tools/best-practices/scraping-and-research.js +4 -0
- package/dist/tools/best-practices/scraping-and-research.js.map +1 -1
- package/dist/types/coordination.d.ts +5 -0
- package/dist/types/coordination.js.map +1 -1
- package/dist/utils/coordination-log.d.ts +1 -0
- package/dist/utils/coordination-log.js +20 -2
- package/dist/utils/coordination-log.js.map +1 -1
- package/dist/utils/state-modifier.d.ts +5 -1
- package/dist/utils/state-modifier.js +46 -1
- package/dist/utils/state-modifier.js.map +1 -1
- package/package.json +7 -7
|
@@ -45,7 +45,7 @@ export declare function createMultiAgentWorkflowWithSubgraphs(config: MultiAgent
|
|
|
45
45
|
previousSummary?: string | undefined;
|
|
46
46
|
templateIds?: number[] | undefined;
|
|
47
47
|
cachedTemplates?: import("./types").WorkflowMetadata[] | undefined;
|
|
48
|
-
}, "responder" | "supervisor" | "create_workflow_name" | "configurator_subgraph" | "discovery_subgraph" | "builder_subgraph" | "delete_messages" | "compact_messages" | "process_operations" | "__start__" | "cleanup_dangling" | "check_state", {
|
|
48
|
+
}, "responder" | "supervisor" | "create_workflow_name" | "configurator_subgraph" | "discovery_subgraph" | "builder_subgraph" | "delete_messages" | "compact_messages" | "process_operations" | "__start__" | "cleanup_dangling" | "clear_error_state" | "check_state", {
|
|
49
49
|
messages: import("@langchain/langgraph").BinaryOperatorAggregate<import("@langchain/core/messages").BaseMessage<import("@langchain/core/messages").MessageStructure, import("@langchain/core/messages").MessageType>[], import("@langchain/core/messages").BaseMessage<import("@langchain/core/messages").MessageStructure, import("@langchain/core/messages").MessageType>[]>;
|
|
50
50
|
workflowJSON: import("@langchain/langgraph").BinaryOperatorAggregate<import("./types").SimpleWorkflow, import("./types").SimpleWorkflow>;
|
|
51
51
|
workflowContext: import("@langchain/langgraph").BinaryOperatorAggregate<{
|
|
@@ -113,6 +113,9 @@ export declare function createMultiAgentWorkflowWithSubgraphs(config: MultiAgent
|
|
|
113
113
|
coordinationLog: import("./types/coordination").CoordinationLogEntry[];
|
|
114
114
|
workflowOperations: [];
|
|
115
115
|
};
|
|
116
|
+
clear_error_state: {
|
|
117
|
+
coordinationLog: import("./types/coordination").CoordinationLogEntry[];
|
|
118
|
+
};
|
|
116
119
|
create_workflow_name: {
|
|
117
120
|
workflowJSON: import("./types").SimpleWorkflow;
|
|
118
121
|
};
|
|
@@ -125,6 +125,7 @@ function createMultiAgentWorkflowWithSubgraphs(config) {
|
|
|
125
125
|
return await (0, state_modifier_1.handleCompactMessages)(state.messages, state.previousSummary ?? '', llmComplexTask, isAutoCompact);
|
|
126
126
|
})
|
|
127
127
|
.addNode('delete_messages', (state) => (0, state_modifier_1.handleDeleteMessages)(state.messages))
|
|
128
|
+
.addNode('clear_error_state', (state) => (0, state_modifier_1.handleClearErrorState)(state.coordinationLog, logger))
|
|
128
129
|
.addNode('create_workflow_name', async (state) => await (0, state_modifier_1.handleCreateWorkflowName)(state.messages, state.workflowJSON, llmComplexTask, logger))
|
|
129
130
|
.addNode('discovery_subgraph', createSubgraphNodeHandler(discoverySubgraph, compiledDiscovery, 'discovery_subgraph', logger, constants_1.MAX_DISCOVERY_ITERATIONS))
|
|
130
131
|
.addNode('builder_subgraph', createSubgraphNodeHandler(builderSubgraph, compiledBuilder, 'builder_subgraph', logger, constants_1.MAX_BUILDER_ITERATIONS))
|
|
@@ -140,12 +141,14 @@ function createMultiAgentWorkflowWithSubgraphs(config) {
|
|
|
140
141
|
delete_messages: 'delete_messages',
|
|
141
142
|
create_workflow_name: 'create_workflow_name',
|
|
142
143
|
auto_compact_messages: 'compact_messages',
|
|
144
|
+
clear_error_state: 'clear_error_state',
|
|
143
145
|
continue: 'supervisor',
|
|
144
146
|
};
|
|
145
147
|
return routes[state.nextPhase] ?? 'supervisor';
|
|
146
148
|
})
|
|
147
149
|
.addEdge('cleanup_dangling', 'check_state')
|
|
148
150
|
.addEdge('delete_messages', 'responder')
|
|
151
|
+
.addEdge('clear_error_state', 'check_state')
|
|
149
152
|
.addEdge('create_workflow_name', 'supervisor')
|
|
150
153
|
.addConditionalEdges('compact_messages', (state) => {
|
|
151
154
|
const hasMessages = state.messages.length > 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multi-agent-workflow-subgraphs.js","sourceRoot":"","sources":["../src/multi-agent-workflow-subgraphs.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"multi-agent-workflow-subgraphs.js","sourceRoot":"","sources":["../src/multi-agent-workflow-subgraphs.ts"],"names":[],"mappings":";;AAuHA,sFAmLC;AAzSD,uDAAwD;AACxD,oDAAgF;AAIhF,8DAA0D;AAC1D,gEAA4D;AAC5D,2CAKqB;AACrB,6DAAwD;AACxD,mEAA+D;AAC/D,6E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|
@@ -277,6 +277,11 @@ COMMON MISTAKES TO AVOID:
|
|
|
277
277
|
✅ Calculator Tool → AI Agent (CORRECT)
|
|
278
278
|
✅ Window Buffer Memory → AI Agent (CORRECT)
|
|
279
279
|
</connection_type_reference>`;
|
|
280
|
+
const DATA_TABLES = `**Data Tables VS 3rd party services**
|
|
281
|
+
- Data Tables provide built-in data storage within n8n, allowing you to persist and manage data directly in your workflows without external databases.
|
|
282
|
+
- Use the Data table node (n8n-nodes-base.dataTable) in workflows to retrieve, insert, update, or delete records.
|
|
283
|
+
- When storing, retrieving, or managing structured data within workflows, always prefer using n8n's native Data tables over external services like Google Sheets, Airtable, or other third-party databases if not specified otherwise.
|
|
284
|
+
`;
|
|
280
285
|
const RESTRICTIONS = `- Respond before calling validate_structure
|
|
281
286
|
- Skip validation even if you think structure is correct
|
|
282
287
|
- Add commentary between tool calls - execute tools silently
|
|
@@ -307,6 +312,7 @@ function buildBuilderPrompt() {
|
|
|
307
312
|
.section('switch_node_pattern', SWITCH_NODE_PATTERN)
|
|
308
313
|
.section('node_connection_examples', NODE_CONNECTION_EXAMPLES)
|
|
309
314
|
.section('connection_type_examples', CONNECTION_TYPES)
|
|
315
|
+
.section('data_tables', DATA_TABLES)
|
|
310
316
|
.section('do_not', RESTRICTIONS)
|
|
311
317
|
.section('response_format', RESPONSE_FORMAT)
|
|
312
318
|
.build();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builder.prompt.js","sourceRoot":"","sources":["../../../src/prompts/agents/builder.prompt.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"builder.prompt.js","sourceRoot":"","sources":["../../../src/prompts/agents/builder.prompt.ts"],"names":[],"mappings":";;AAgUA,gDAuBC;AAhVD,wCAAoC;AAEpC,MAAM,YAAY,GAAG,oEAAoE,CAAC;AAE1F,MAAM,kBAAkB,GAAG;;;;;;;;;;;;;;;;;;;;mEAoBwC,CAAC;AAEpE,MAAM,aAAa,GAAG;;;;oFAI8D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AAE,YAAY,CAAC;SAC9C,OAAO,CAAC,kBAAkB,EAAE,gBAAgB,CAAC;SAC7C,OAAO,CAAC,uBAAuB,EAAE,aAAa,CAAC;SAC/C,OAAO,CAAC,gCAAgC,EAAE,qBAAqB,CAAC;SAChE,OAAO,CAAC,mCAAmC,EAAE,wBAAwB,CAAC;SACtE,OAAO,CAAC,gCAAgC,EAAE,cAAc,CAAC;SACzD,OAAO,CAAC,WAAW,EAAE,SAAS,CAAC;SAC/B,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC;SAC3B,OAAO,CAAC,wBAAwB,EAAE,sBAAsB,CAAC;SACzD,OAAO,CAAC,sBAAsB,EAAE,WAAW,CAAC;SAC5C,OAAO,CAAC,qBAAqB,EAAE,mBAAmB,CAAC;SACnD,OAAO,CAAC,0BAA0B,EAAE,wBAAwB,CAAC;SAC7D,OAAO,CAAC,0BAA0B,EAAE,gBAAgB,CAAC;SACrD,OAAO,CAAC,aAAa,EAAE,WAAW,CAAC;SACnC,OAAO,CAAC,QAAQ,EAAE,YAAY,CAAC;SAC/B,OAAO,CAAC,iBAAiB,EAAE,eAAe,CAAC;SAC3C,KAAK,EAAE,CAAC;AACX,CAAC"}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export declare const INSTANCE_URL_PROMPT = "\n<instance_url>\nThe n8n instance base URL is: {instanceUrl}\n\nThis URL is essential for webhook nodes and chat triggers as it provides the base URL for:\n- Webhook URLs that external services need to call\n- Chat trigger URLs for conversational interfaces\n- Any node that requires the full instance URL to generate proper callback URLs\n\nWhen working with webhook or chat trigger nodes, use this URL as the base for constructing proper endpoint URLs.\n</instance_url>\n";
|
|
2
|
+
export declare function buildRecoveryModeContext(nodeCount: number, nodeNames: string[]): string;
|
|
2
3
|
export declare function buildConfiguratorPrompt(): string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.INSTANCE_URL_PROMPT = void 0;
|
|
4
|
+
exports.buildRecoveryModeContext = buildRecoveryModeContext;
|
|
4
5
|
exports.buildConfiguratorPrompt = buildConfiguratorPrompt;
|
|
5
6
|
const builder_1 = require("../builder");
|
|
6
7
|
const CONFIGURATOR_ROLE = 'You are a Configurator Agent specialized in setting up n8n node parameters.';
|
|
@@ -124,6 +125,18 @@ This URL is essential for webhook nodes and chat triggers as it provides the bas
|
|
|
124
125
|
When working with webhook or chat trigger nodes, use this URL as the base for constructing proper endpoint URLs.
|
|
125
126
|
</instance_url>
|
|
126
127
|
`;
|
|
128
|
+
function buildRecoveryModeContext(nodeCount, nodeNames) {
|
|
129
|
+
return ('=== CRITICAL: RECOVERY MODE ===\n\n' +
|
|
130
|
+
'WORKFLOW RECOVERY SCENARIO:\n' +
|
|
131
|
+
`The builder created ${nodeCount} node${nodeCount === 1 ? '' : 's'} (${nodeNames.join(', ')}) before hitting a recursion limit.\n\n` +
|
|
132
|
+
'REQUIRED ACTIONS - DO NOT SKIP:\n' +
|
|
133
|
+
'1. Call update_node_parameters for EVERY node listed above to ensure proper configuration\n' +
|
|
134
|
+
'2. Call validate_configuration to check for issues\n' +
|
|
135
|
+
'3. Scan the workflow for placeholders (format: <__PLACEHOLDER_VALUE__*__>) and missing credentials\n' +
|
|
136
|
+
'4. List ALL placeholders and missing credentials in your final response\n\n' +
|
|
137
|
+
'DO NOT respond with "workflow already exists" or "no changes needed". ' +
|
|
138
|
+
'You MUST use tools to analyze this recovered workflow.');
|
|
139
|
+
}
|
|
127
140
|
function buildConfiguratorPrompt() {
|
|
128
141
|
return (0, builder_1.prompt)()
|
|
129
142
|
.section('role', CONFIGURATOR_ROLE)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configurator.prompt.js","sourceRoot":"","sources":["../../../src/prompts/agents/configurator.prompt.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"configurator.prompt.js","sourceRoot":"","sources":["../../../src/prompts/agents/configurator.prompt.ts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AC,yBAAyB,EAAE,uBAAuB,CAAC;SAC3D,OAAO,CAAC,yBAAyB,EAAE,uBAAuB,CAAC;SAC3D,OAAO,CAAC,kBAAkB,EAAE,gBAAgB,CAAC;SAC7C,OAAO,CAAC,uBAAuB,EAAE,qBAAqB,CAAC;SACvD,OAAO,CAAC,qBAAqB,EAAE,mBAAmB,CAAC;SACnD,OAAO,CAAC,wBAAwB,EAAE,sBAAsB,CAAC;SACzD,OAAO,CAAC,2BAA2B,EAAE,yBAAyB,CAAC;SAC/D,OAAO,CAAC,6BAA6B,EAAE,2BAA2B,CAAC;SACnE,OAAO,CAAC,iBAAiB,EAAE,eAAe,CAAC;SAC3C,OAAO,CAAC,QAAQ,EAAE,YAAY,CAAC;SAC/B,KAAK,EAAE,CAAC;AACX,CAAC"}
|
|
@@ -1 +1,4 @@
|
|
|
1
|
+
export declare function buildRecursionErrorWithWorkflowGuidance(nodeCount: number): string[];
|
|
2
|
+
export declare function buildRecursionErrorNoWorkflowGuidance(): string[];
|
|
3
|
+
export declare function buildGeneralErrorGuidance(): string;
|
|
1
4
|
export declare function buildResponderPrompt(): string;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildRecursionErrorWithWorkflowGuidance = buildRecursionErrorWithWorkflowGuidance;
|
|
4
|
+
exports.buildRecursionErrorNoWorkflowGuidance = buildRecursionErrorNoWorkflowGuidance;
|
|
5
|
+
exports.buildGeneralErrorGuidance = buildGeneralErrorGuidance;
|
|
3
6
|
exports.buildResponderPrompt = buildResponderPrompt;
|
|
4
7
|
const builder_1 = require("../builder");
|
|
5
8
|
const RESPONDER_ROLE = `You are a helpful AI assistant for n8n workflow automation.
|
|
@@ -30,6 +33,26 @@ const RESPONSE_STYLE = `- Keep responses focused and not overly long
|
|
|
30
33
|
- Use markdown formatting for readability
|
|
31
34
|
- Be conversational and helpful
|
|
32
35
|
- Do not use emojis in your response`;
|
|
36
|
+
function buildRecursionErrorWithWorkflowGuidance(nodeCount) {
|
|
37
|
+
return [
|
|
38
|
+
`**Workflow Status:** ${nodeCount} node${nodeCount === 1 ? '' : 's'} ${nodeCount === 1 ? 'was' : 'were'} created before the complexity limit was reached.`,
|
|
39
|
+
"Tell the user that you've created their workflow but reached a complexity limit while fine-tuning. " +
|
|
40
|
+
'The workflow should work and they can test it. ' +
|
|
41
|
+
'If they need adjustments or want to continue building, they can ask you to make specific changes.',
|
|
42
|
+
];
|
|
43
|
+
}
|
|
44
|
+
function buildRecursionErrorNoWorkflowGuidance() {
|
|
45
|
+
return [
|
|
46
|
+
'**Workflow Status:** No nodes were created - the request was too complex to process automatically.',
|
|
47
|
+
'Explain that the workflow design became too complex for automatic generation. ' +
|
|
48
|
+
'Suggest options: (1) Break the request into smaller steps, (2) Simplify the workflow, ' +
|
|
49
|
+
'or (3) Start with a basic version and iteratively add complexity.',
|
|
50
|
+
];
|
|
51
|
+
}
|
|
52
|
+
function buildGeneralErrorGuidance() {
|
|
53
|
+
return ('Apologize and explain that a technical error occurred. ' +
|
|
54
|
+
'Ask if they would like to try again or approach the problem differently.');
|
|
55
|
+
}
|
|
33
56
|
function buildResponderPrompt() {
|
|
34
57
|
return (0, builder_1.prompt)()
|
|
35
58
|
.section('role', RESPONDER_ROLE)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"responder.prompt.js","sourceRoot":"","sources":["../../../src/prompts/agents/responder.prompt.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"responder.prompt.js","sourceRoot":"","sources":["../../../src/prompts/agents/responder.prompt.ts"],"names":[],"mappings":";;AA8CA,0FAOC;AAGD,sFAOC;AAGD,8DAKC;AAED,oDAOC;AAzED,wCAAoC;AAEpC,MAAM,cAAc,GAAG;;;;;6CAKsB,CAAC;AAE9C,MAAM,mBAAmB,GAAG;;;;;;;;;;;;;;+CAcmB,CAAC;AAEhD,MAAM,wBAAwB,GAAG;;0CAES,CAAC;AAE3C,MAAM,cAAc,GAAG;;;qCAGc,CAAC;AAOtC,SAAgB,uCAAuC,CAAC,SAAiB;IACxE,OAAO;QACN,wBAAwB,SAAS,QAAQ,SAAS,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,SAAS,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,mDAAmD;QAC1J,qGAAqG;YACpG,iDAAiD;YACjD,mGAAmG;KACpG,CAAC;AACH,CAAC;AAGD,SAAgB,qCAAqC;IACpD,OAAO;QACN,oGAAoG;QACpG,gFAAgF;YAC/E,wFAAwF;YACxF,mEAAmE;KACpE,CAAC;AACH,CAAC;AAGD,SAAgB,yBAAyB;IACxC,OAAO,CACN,yDAAyD;QACzD,0EAA0E,CAC1E,CAAC;AACH,CAAC;AAED,SAAgB,oBAAoB;IACnC,OAAO,IAAA,gBAAM,GAAE;SACb,OAAO,CAAC,MAAM,EAAE,cAAc,CAAC;SAC/B,OAAO,CAAC,+BAA+B,EAAE,mBAAmB,CAAC;SAC7D,OAAO,CAAC,0BAA0B,EAAE,wBAAwB,CAAC;SAC7D,OAAO,CAAC,gBAAgB,EAAE,cAAc,CAAC;SACzC,KAAK,EAAE,CAAC;AACX,CAAC"}
|
|
@@ -128,6 +128,20 @@ class ConfiguratorSubgraph extends subgraph_interface_1.BaseSubgraph {
|
|
|
128
128
|
if (parentState.discoveryContext?.bestPractices) {
|
|
129
129
|
contextParts.push(parentState.discoveryContext.bestPractices);
|
|
130
130
|
}
|
|
131
|
+
const builderErrorEntry = parentState.coordinationLog?.find((entry) => {
|
|
132
|
+
if (entry.status !== 'error')
|
|
133
|
+
return false;
|
|
134
|
+
if (entry.phase !== 'builder')
|
|
135
|
+
return false;
|
|
136
|
+
return (entry.metadata.phase === 'error' &&
|
|
137
|
+
'partialBuilderData' in entry.metadata &&
|
|
138
|
+
entry.metadata.partialBuilderData);
|
|
139
|
+
});
|
|
140
|
+
if (builderErrorEntry?.metadata.phase === 'error' &&
|
|
141
|
+
builderErrorEntry.metadata.partialBuilderData) {
|
|
142
|
+
const { nodeCount, nodeNames } = builderErrorEntry.metadata.partialBuilderData;
|
|
143
|
+
contextParts.push((0, configurator_prompt_1.buildRecoveryModeContext)(nodeCount, nodeNames));
|
|
144
|
+
}
|
|
131
145
|
contextParts.push('=== WORKFLOW TO CONFIGURE ===');
|
|
132
146
|
contextParts.push((0, context_builders_1.buildWorkflowJsonBlock)(parentState.workflowJSON));
|
|
133
147
|
contextParts.push('=== EXECUTION CONTEXT ===');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configurator.subgraph.js","sourceRoot":"","sources":["../../src/subgraphs/configurator.subgraph.ts"],"names":[],"mappings":";;;AAEA,qDAA6D;AAG7D,oDAA8D;AAI9D,qCAA2C;AAC3C,
|
|
1
|
+
{"version":3,"file":"configurator.subgraph.js","sourceRoot":"","sources":["../../src/subgraphs/configurator.subgraph.ts"],"names":[],"mappings":";;;AAEA,qDAA6D;AAG7D,oDAA8D;AAI9D,qCAA2C;AAC3C,8EAI8C;AAG9C,6DAAoD;AAEpD,4EAAyF;AACzF,8EAA8E;AAC9E,sFAAsF;AACtF,sFAAuF;AAEvF,wDAAmE;AAEnE,kDAAmD;AAGnD,0DAAmE;AACnE,gEAImC;AACnC,wEAAkE;AAClE,4DAAiE;AACjE,gEAImC;AAKtB,QAAA,yBAAyB,GAAG,sBAAU,CAAC,IAAI,CAAC;IAExD,YAAY,EAAE,IAAA,sBAAU,EAAiB;QACxC,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC;QACzB,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,WAAW,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;KACzD,CAAC;IAGF,eAAe,EAAE,IAAA,sBAAU,EAA6C;QACvE,OAA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O,CAAC;YACnC,iBAAiB,CAAC,QAAQ,CAAC,OAAO,CAAC;YACnC,iBAAiB,CAAC,MAAM,GAAG,EAAE,CAAC;QAG/B,MAAM,QAAQ,GAAyB;YACtC,KAAK,EAAE,cAAc;YACrB,MAAM,EAAE,WAAW;YACnB,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;YACrB,OAAO,EAAE,cAAc,eAAe,QAAQ;YAC9C,MAAM,EAAE,iBAAiB;YACzB,QAAQ,EAAE,IAAA,yCAA0B,EAAC;gBACpC,eAAe;gBACf,oBAAoB;aACpB,CAAC;SACF,CAAC;QAEF,OAAO;YACN,YAAY,EAAE,cAAc,CAAC,YAAY;YACzC,kBAAkB,EAAE,cAAc,CAAC,kBAAkB,IAAI,EAAE;YAC3D,eAAe,EAAE,CAAC,QAAQ,CAAC;YAE3B,eAAe,EAAE,cAAc,CAAC,eAAe;SAE/C,CAAC;IACH,CAAC;CACD;AAhMD,oDAgMC"}
|
|
@@ -79,6 +79,7 @@ Purpose: Fetches external data to enrich chatbot responses with real-time or org
|
|
|
79
79
|
|
|
80
80
|
### Database Nodes & Google Sheets
|
|
81
81
|
|
|
82
|
+
- Data Table (n8n-nodes-base.dataTable)
|
|
82
83
|
- Postgres (n8n-nodes-base.postgres)
|
|
83
84
|
- MySQL (n8n-nodes-base.mySql)
|
|
84
85
|
- MongoDB (n8n-nodes-base.mongoDb)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chatbot.js","sourceRoot":"","sources":["../../../src/tools/best-practices/chatbot.ts"],"names":[],"mappings":";;;AACA,2DAA2D;AAE3D,MAAa,oBAAoB;IACvB,SAAS,GAAG,kCAAiB,CAAC,OAAO,CAAC;IACtC,OAAO,GAAG,OAAO,CAAC;IAEV,aAAa,GAAG
|
|
1
|
+
{"version":3,"file":"chatbot.js","sourceRoot":"","sources":["../../../src/tools/best-practices/chatbot.ts"],"names":[],"mappings":";;;AACA,2DAA2D;AAE3D,MAAa,oBAAoB;IACvB,SAAS,GAAG,kCAAiB,CAAC,OAAO,CAAC;IACtC,OAAO,GAAG,OAAO,CAAC;IAEV,aAAa,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwGjC,CAAC;IAED,gBAAgB;QACf,OAAO,IAAI,CAAC,aAAa,CAAC;IAC3B,CAAC;CACD;AAjHD,oDAiHC"}
|
|
@@ -69,12 +69,17 @@ class DataTransformationBestPractices {
|
|
|
69
69
|
|
|
70
70
|
#### Code Node (n8n-nodes-base.code)
|
|
71
71
|
|
|
72
|
-
**
|
|
72
|
+
**Built-in Nodes vs. Code Node**
|
|
73
|
+
- Prefer basic built-in nodes (Edit Fields, Filter, Split Out, Summarize, Aggregate, etc.) over Code node. Use Code only for complex logic that can't be achieved otherwise.
|
|
74
|
+
- Rule of thumb: if the goal can be achieved with fewer than 5 basic nodes, use basic nodes
|
|
75
|
+
|
|
76
|
+
**When NOT to Use**: Code node may be slower than core nodes (like Edit Fields, If, Switch, Split Out, Aggregate, etc.) as Code nodes run in a sandboxed environment. Avoid the code node where possible — it should only be used for complex transformations that can't be done with other nodes. For example, DO NOT use it for:
|
|
73
77
|
- Adding or removing fields from items (use the 'edit fields' node instead)
|
|
74
78
|
- Single-line data transformations of item fields (use the 'edit fields' node instead)
|
|
75
79
|
- Filtering items based on their fields (use the 'filter' node instead)
|
|
76
|
-
- Pivoting
|
|
80
|
+
- Pivoting or summarizing data across multiple items (use the 'summarize' node instead)
|
|
77
81
|
- Splitting arrays inside items out into multiple items (use the 'split out' node instead)
|
|
82
|
+
- Aggregating multiple items into a single item (use the 'aggregate' node instead)
|
|
78
83
|
- Sorting items in an array based on their fields (use the 'Sort' node instead)
|
|
79
84
|
- Generating HTML from text or formatting text as HTML (use the 'HTML' node set to operation 'Generate HTML Template' or 'Convert to HTML Table' instead)
|
|
80
85
|
|
|
@@ -118,15 +123,8 @@ return items; // or return [{ json: {...} }];
|
|
|
118
123
|
- **Purpose**: Process large datasets in chunks
|
|
119
124
|
- **Use When**: Handling 100+ items with expensive operations (API calls, AI)
|
|
120
125
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
**Execute Workflow** (n8n-nodes-base.executeWorkflow):
|
|
124
|
-
- **Purpose**: Call sub-workflows for modular design
|
|
125
|
-
- **Best Practice**: Create reusable sub-workflows for common tasks like "Data Cleaning" or "Error Handler"
|
|
126
|
-
|
|
127
|
-
**Error Trigger** (n8n-nodes-base.errorTrigger):
|
|
128
|
-
- **Purpose**: Create global error handling workflow
|
|
129
|
-
- **Best Practice**: Use as safety net to catch all workflow errors
|
|
126
|
+
## Input Data Validation
|
|
127
|
+
- Validate external data before processing: check for nulls, empty values, and edge cases (special chars, empty arrays)
|
|
130
128
|
|
|
131
129
|
## Common Pitfalls to Avoid
|
|
132
130
|
|
|
@@ -145,28 +143,16 @@ return items; // or return [{ json: {...} }];
|
|
|
145
143
|
- **Fix**: Keep code nodes focused on single transformation aspect
|
|
146
144
|
|
|
147
145
|
#### Merge Node Problems
|
|
148
|
-
- **Missing Keys**: Trying to merge on non-existent fields
|
|
149
|
-
- **Fix**: Validate both inputs have matching key fields
|
|
150
146
|
- **Field Name Mismatch**: Different field names in sources
|
|
151
|
-
- **Fix**:
|
|
152
|
-
|
|
153
|
-
### General Workflow Issues
|
|
154
|
-
- **No Error Handling**: Workflow crashes on unexpected data. **Fix**: Add IF nodes for validation, use error outputs
|
|
155
|
-
- **Hard-coded Values**: URLs, credentials, config in nodes. **Fix**: Use environment variables or config nodes
|
|
156
|
-
- **Missing Documentation**: No comments or descriptions
|
|
157
|
-
- **Fix**: Add sticky notes, node descriptions, code comments
|
|
147
|
+
- **Fix**: Normalize field names with Edit Fields before merging
|
|
158
148
|
|
|
159
149
|
### Performance Pitfalls
|
|
160
150
|
- Processing large datasets without batching → timeouts
|
|
161
151
|
- Not filtering early → unnecessary processing overhead
|
|
162
152
|
- Excessive node chaining → visual clutter and slow execution
|
|
163
|
-
- Not using sub-workflows → unmaintainable monolithic workflows
|
|
164
153
|
|
|
165
154
|
### Data Validation Pitfalls
|
|
166
|
-
- Assuming input data is always perfect
|
|
167
|
-
- Not handling empty/null values
|
|
168
|
-
- Ignoring data type mismatches
|
|
169
|
-
- Missing edge case handling (special characters, empty arrays)
|
|
155
|
+
- Assuming input data is always perfect → runtime errors
|
|
170
156
|
`;
|
|
171
157
|
getDocumentation() {
|
|
172
158
|
return this.documentation;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-transformation.js","sourceRoot":"","sources":["../../../src/tools/best-practices/data-transformation.ts"],"names":[],"mappings":";;;AACA,2DAA2D;AAE3D,MAAa,+BAA+B;IAClC,SAAS,GAAG,kCAAiB,CAAC,mBAAmB,CAAC;IAClD,OAAO,GAAG,OAAO,CAAC;IAEV,aAAa,GAAG
|
|
1
|
+
{"version":3,"file":"data-transformation.js","sourceRoot":"","sources":["../../../src/tools/best-practices/data-transformation.ts"],"names":[],"mappings":";;;AACA,2DAA2D;AAE3D,MAAa,+BAA+B;IAClC,SAAS,GAAG,kCAAiB,CAAC,mBAAmB,CAAC;IAClD,OAAO,GAAG,OAAO,CAAC;IAEV,aAAa,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoJjC,CAAC;IAED,gBAAgB;QACf,OAAO,IAAI,CAAC,aAAa,CAAC;IAC3B,CAAC;CACD;AA7JD,0EA6JC"}
|
|
@@ -44,7 +44,7 @@ sequence. Use the n8n Form Trigger node to start the workflow and display the fi
|
|
|
44
44
|
|
|
45
45
|
## Data Collection & Aggregation
|
|
46
46
|
|
|
47
|
-
Collect and merge all user responses from each form step before writing to your destination (e.g.,
|
|
47
|
+
Collect and merge all user responses from each form step before writing to your destination (e.g., Data Table). Use
|
|
48
48
|
Set or Merge nodes to combine data as needed. Make sure your JSON keys match the column names in your destination for
|
|
49
49
|
automatic mapping.
|
|
50
50
|
|
|
@@ -91,7 +91,7 @@ Purpose: Persist raw form data to a storage destination, preference should be fo
|
|
|
91
91
|
but use the most applicable node depending on the user's request.
|
|
92
92
|
|
|
93
93
|
Required nodes (use at least one):
|
|
94
|
-
- Data table (n8n-nodes-base.dataTable): Built-in n8n storage for quick setup
|
|
94
|
+
- Data table (n8n-nodes-base.dataTable): Built-in n8n storage for quick setup - preferred
|
|
95
95
|
- Google Sheets (n8n-nodes-base.googleSheets): Best for simple spreadsheet storage
|
|
96
96
|
- Airtable (n8n-nodes-base.airtable): Best for structured database with relationships
|
|
97
97
|
- Postgres (n8n-nodes-base.postgres) / MySQL (n8n-nodes-base.mySql) / MongoDB (n8n-nodes-base.mongoDb): For production database storage
|
|
@@ -104,6 +104,10 @@ Pitfalls:
|
|
|
104
104
|
|
|
105
105
|
Purpose: Introduces delays to respect rate limits and avoid overloading servers
|
|
106
106
|
|
|
107
|
+
### Data Tables (n8n-nodes-base.dataTable)
|
|
108
|
+
|
|
109
|
+
Purpose: Stores scraped data in n8n's built-in persistent data storage
|
|
110
|
+
|
|
107
111
|
### Google Sheets (n8n-nodes-base.googleSheets)
|
|
108
112
|
|
|
109
113
|
Purpose: Stores scraped data in spreadsheets for easy access and sharing
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scraping-and-research.js","sourceRoot":"","sources":["../../../src/tools/best-practices/scraping-and-research.ts"],"names":[],"mappings":";;;AACA,2DAA2D;AAE3D,MAAa,gCAAgC;IACnC,SAAS,GAAG,kCAAiB,CAAC,qBAAqB,CAAC;IACpD,OAAO,GAAG,OAAO,CAAC;IAEV,aAAa,GAAG
|
|
1
|
+
{"version":3,"file":"scraping-and-research.js","sourceRoot":"","sources":["../../../src/tools/best-practices/scraping-and-research.ts"],"names":[],"mappings":";;;AACA,2DAA2D;AAE3D,MAAa,gCAAgC;IACnC,SAAS,GAAG,kCAAiB,CAAC,qBAAqB,CAAC;IACpD,OAAO,GAAG,OAAO,CAAC;IAEV,aAAa,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmJjC,CAAC;IAED,gBAAgB;QACf,OAAO,IAAI,CAAC,aAAa,CAAC;IAC3B,CAAC;CACD;AA5JD,4EA4JC"}
|
|
@@ -29,6 +29,11 @@ export interface ErrorMetadata {
|
|
|
29
29
|
phase: 'error';
|
|
30
30
|
failedSubgraph: SubgraphPhase;
|
|
31
31
|
errorMessage: string;
|
|
32
|
+
partialBuilderData?: {
|
|
33
|
+
nodeCount: number;
|
|
34
|
+
connectionCount: number;
|
|
35
|
+
nodeNames: string[];
|
|
36
|
+
};
|
|
32
37
|
}
|
|
33
38
|
export interface StateManagementMetadata {
|
|
34
39
|
phase: 'state_management';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coordination.js","sourceRoot":"","sources":["../../src/types/coordination.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"coordination.js","sourceRoot":"","sources":["../../src/types/coordination.ts"],"names":[],"mappings":";;AA6FA,0DAEC;AAED,sDAEC;AAED,gEAIC;AAED,kDAEC;AAED,sEAIC;AAtBD,SAAgB,uBAAuB,CAAC,IAAsC;IAC7E,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,IAAI,EAAE,CAAC;AACxC,CAAC;AAED,SAAgB,qBAAqB,CAAC,IAAoC;IACzE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,CAAC;AACtC,CAAC;AAED,SAAgB,0BAA0B,CACzC,IAAyC;IAEzC,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,GAAG,IAAI,EAAE,CAAC;AAC3C,CAAC;AAED,SAAgB,mBAAmB,CAAC,IAAkC;IACrE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,IAAI,EAAE,CAAC;AACpC,CAAC;AAED,SAAgB,6BAA6B,CAC5C,IAA4C;IAE5C,OAAO,EAAE,KAAK,EAAE,kBAAkB,EAAE,GAAG,IAAI,EAAE,CAAC;AAC/C,CAAC"}
|
|
@@ -11,5 +11,6 @@ export declare function getPhaseMetadata(log: CoordinationLogEntry[], phase: 'co
|
|
|
11
11
|
export declare function getPhaseMetadata(log: CoordinationLogEntry[], phase: 'state_management'): StateManagementMetadata | null;
|
|
12
12
|
export declare function hasErrorInLog(log: CoordinationLogEntry[]): boolean;
|
|
13
13
|
export declare function getErrorEntry(log: CoordinationLogEntry[]): CoordinationLogEntry | null;
|
|
14
|
+
export declare function hasRecursionErrorsCleared(log: CoordinationLogEntry[]): boolean;
|
|
14
15
|
export declare function getNextPhaseFromLog(log: CoordinationLogEntry[]): RoutingDecision;
|
|
15
16
|
export declare function summarizeCoordinationLog(log: CoordinationLogEntry[]): string;
|
|
@@ -8,6 +8,7 @@ exports.getBuilderOutput = getBuilderOutput;
|
|
|
8
8
|
exports.getPhaseMetadata = getPhaseMetadata;
|
|
9
9
|
exports.hasErrorInLog = hasErrorInLog;
|
|
10
10
|
exports.getErrorEntry = getErrorEntry;
|
|
11
|
+
exports.hasRecursionErrorsCleared = hasRecursionErrorsCleared;
|
|
11
12
|
exports.getNextPhaseFromLog = getNextPhaseFromLog;
|
|
12
13
|
exports.summarizeCoordinationLog = summarizeCoordinationLog;
|
|
13
14
|
function getLastCompletedPhase(log) {
|
|
@@ -48,9 +49,26 @@ function hasErrorInLog(log) {
|
|
|
48
49
|
function getErrorEntry(log) {
|
|
49
50
|
return log.find((entry) => entry.status === 'error') ?? null;
|
|
50
51
|
}
|
|
52
|
+
function hasRecursionErrorsCleared(log) {
|
|
53
|
+
return log.some((entry) => entry.phase === 'state_management' &&
|
|
54
|
+
entry.summary.includes('Cleared') &&
|
|
55
|
+
entry.summary.includes('recursion'));
|
|
56
|
+
}
|
|
51
57
|
function getNextPhaseFromLog(log) {
|
|
52
|
-
|
|
53
|
-
|
|
58
|
+
const hasErrors = hasErrorInLog(log);
|
|
59
|
+
if (hasErrors) {
|
|
60
|
+
if (!hasRecursionErrorsCleared(log)) {
|
|
61
|
+
return 'responder';
|
|
62
|
+
}
|
|
63
|
+
const lastClearIndex = log.findLastIndex((entry) => entry.phase === 'state_management' &&
|
|
64
|
+
entry.summary.includes('Cleared') &&
|
|
65
|
+
entry.summary.includes('recursion'));
|
|
66
|
+
const hasErrorsAfterClear = log
|
|
67
|
+
.slice(lastClearIndex + 1)
|
|
68
|
+
.some((entry) => entry.status === 'error');
|
|
69
|
+
if (hasErrorsAfterClear) {
|
|
70
|
+
return 'responder';
|
|
71
|
+
}
|
|
54
72
|
}
|
|
55
73
|
const lastPhase = getLastCompletedPhase(log);
|
|
56
74
|
if (lastPhase === 'discovery') {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coordination-log.js","sourceRoot":"","sources":["../../src/utils/coordination-log.ts"],"names":[],"mappings":";;AAuBA,sDAUC;AAKD,sCAKC;AAKD,8CAEC;AAKD,sDAGC;AAKD,4CAGC;AAqBD,4CAWC;AAKD,sCAEC;AAKD,sCAEC;AAMD,
|
|
1
|
+
{"version":3,"file":"coordination-log.js","sourceRoot":"","sources":["../../src/utils/coordination-log.ts"],"names":[],"mappings":";;AAuBA,sDAUC;AAKD,sCAKC;AAKD,8CAEC;AAKD,sDAGC;AAKD,4CAGC;AAqBD,4CAWC;AAKD,sCAEC;AAKD,sCAEC;AAMD,8DAOC;AAMD,kDAgDC;AAKD,4DAOC;AAxKD,SAAgB,qBAAqB,CAAC,GAA2B;IAChE,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAGlC,KAAK,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AAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,KAAK,OAAO,CAAC,CAAC;QAE5C,IAAI,mBAAmB,EAAE,CAAC;YACzB,OAAO,WAAW,CAAC;QACpB,CAAC;IACF,CAAC;IAED,MAAM,SAAS,GAAG,qBAAqB,CAAC,GAAG,CAAC,CAAC;IAE7C,IAAI,SAAS,KAAK,WAAW,EAAE,CAAC;QAC/B,OAAO,SAAS,CAAC;IAClB,CAAC;IAGD,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;QAC7B,OAAO,cAAc,CAAC;IACvB,CAAC;IAGD,IAAI,SAAS,KAAK,cAAc,EAAE,CAAC;QAClC,OAAO,WAAW,CAAC;IACpB,CAAC;IAGD,OAAO,WAAW,CAAC;AACpB,CAAC;AAKD,SAAgB,wBAAwB,CAAC,GAA2B;IACnE,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,qBAAqB,CAAC;IAEnD,OAAO,GAAG;SACR,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,WAAW,CAAC;SACvC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC;SACtC,IAAI,CAAC,KAAK,CAAC,CAAC;AACf,CAAC"}
|
|
@@ -4,11 +4,12 @@ import { RemoveMessage } from '@langchain/core/messages';
|
|
|
4
4
|
import type { Logger } from '@n8n/backend-common';
|
|
5
5
|
import type { CoordinationLogEntry } from '../types/coordination';
|
|
6
6
|
import type { SimpleWorkflow } from '../types/workflow';
|
|
7
|
-
export type StateModificationAction = 'compact_messages' | 'delete_messages' | 'create_workflow_name' | 'auto_compact_messages' | 'cleanup_dangling' | 'continue';
|
|
7
|
+
export type StateModificationAction = 'compact_messages' | 'delete_messages' | 'create_workflow_name' | 'auto_compact_messages' | 'cleanup_dangling' | 'clear_error_state' | 'continue';
|
|
8
8
|
export interface StateModifierInput {
|
|
9
9
|
messages: BaseMessage[];
|
|
10
10
|
workflowJSON: SimpleWorkflow;
|
|
11
11
|
previousSummary?: string;
|
|
12
|
+
coordinationLog?: CoordinationLogEntry[];
|
|
12
13
|
}
|
|
13
14
|
export declare function determineStateAction(input: StateModifierInput, autoCompactThresholdTokens: number): StateModificationAction;
|
|
14
15
|
export declare function handleCleanupDangling(messages: BaseMessage[], logger?: Logger): {
|
|
@@ -27,6 +28,9 @@ export declare function handleDeleteMessages(messages: BaseMessage[]): {
|
|
|
27
28
|
coordinationLog: CoordinationLogEntry[];
|
|
28
29
|
workflowOperations: [];
|
|
29
30
|
};
|
|
31
|
+
export declare function handleClearErrorState(coordinationLog: CoordinationLogEntry[], logger?: Logger): {
|
|
32
|
+
coordinationLog: CoordinationLogEntry[];
|
|
33
|
+
};
|
|
30
34
|
export declare function handleCreateWorkflowName(messages: BaseMessage[], workflowJSON: SimpleWorkflow, llm: BaseChatModel, logger?: Logger): Promise<{
|
|
31
35
|
workflowJSON: SimpleWorkflow;
|
|
32
36
|
}>;
|
|
@@ -4,6 +4,7 @@ exports.determineStateAction = determineStateAction;
|
|
|
4
4
|
exports.handleCleanupDangling = handleCleanupDangling;
|
|
5
5
|
exports.handleCompactMessages = handleCompactMessages;
|
|
6
6
|
exports.handleDeleteMessages = handleDeleteMessages;
|
|
7
|
+
exports.handleClearErrorState = handleClearErrorState;
|
|
7
8
|
exports.handleCreateWorkflowName = handleCreateWorkflowName;
|
|
8
9
|
const messages_1 = require("@langchain/core/messages");
|
|
9
10
|
const cleanup_dangling_tool_call_messages_1 = require("./cleanup-dangling-tool-call-messages");
|
|
@@ -11,8 +12,32 @@ const token_usage_1 = require("./token-usage");
|
|
|
11
12
|
const conversation_compact_1 = require("../chains/conversation-compact");
|
|
12
13
|
const workflow_name_1 = require("../chains/workflow-name");
|
|
13
14
|
const coordination_1 = require("../types/coordination");
|
|
15
|
+
function hasUnclearedRecursionError(coordinationLog) {
|
|
16
|
+
let lastRecursionErrorIndex = -1;
|
|
17
|
+
for (let i = coordinationLog.length - 1; i >= 0; i--) {
|
|
18
|
+
const entry = coordinationLog[i];
|
|
19
|
+
if (entry.status !== 'error')
|
|
20
|
+
continue;
|
|
21
|
+
const errorMessage = entry.summary.toLowerCase();
|
|
22
|
+
if (errorMessage.includes('recursion') ||
|
|
23
|
+
errorMessage.includes('maximum number of steps') ||
|
|
24
|
+
errorMessage.includes('iteration limit')) {
|
|
25
|
+
lastRecursionErrorIndex = i;
|
|
26
|
+
break;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
if (lastRecursionErrorIndex >= 0) {
|
|
30
|
+
const hasAlreadyCleared = coordinationLog
|
|
31
|
+
.slice(lastRecursionErrorIndex + 1)
|
|
32
|
+
.some((entry) => entry.phase === 'state_management' &&
|
|
33
|
+
entry.summary.includes('Cleared') &&
|
|
34
|
+
entry.summary.includes('recursion'));
|
|
35
|
+
return !hasAlreadyCleared;
|
|
36
|
+
}
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
14
39
|
function determineStateAction(input, autoCompactThresholdTokens) {
|
|
15
|
-
const { messages, workflowJSON } = input;
|
|
40
|
+
const { messages, workflowJSON, coordinationLog } = input;
|
|
16
41
|
const danglingMessages = (0, cleanup_dangling_tool_call_messages_1.cleanupDanglingToolCallMessages)(messages);
|
|
17
42
|
if (danglingMessages.length > 0) {
|
|
18
43
|
return 'cleanup_dangling';
|
|
@@ -20,6 +45,9 @@ function determineStateAction(input, autoCompactThresholdTokens) {
|
|
|
20
45
|
const lastHumanMessage = messages.findLast((m) => m instanceof messages_1.HumanMessage);
|
|
21
46
|
if (!lastHumanMessage)
|
|
22
47
|
return 'continue';
|
|
48
|
+
if (coordinationLog && hasUnclearedRecursionError(coordinationLog)) {
|
|
49
|
+
return 'clear_error_state';
|
|
50
|
+
}
|
|
23
51
|
if (lastHumanMessage.content === '/compact') {
|
|
24
52
|
return 'compact_messages';
|
|
25
53
|
}
|
|
@@ -94,6 +122,23 @@ function handleDeleteMessages(messages) {
|
|
|
94
122
|
workflowOperations: [],
|
|
95
123
|
};
|
|
96
124
|
}
|
|
125
|
+
function handleClearErrorState(coordinationLog, logger) {
|
|
126
|
+
const errorCount = coordinationLog.filter((entry) => entry.status === 'error').length;
|
|
127
|
+
if (errorCount > 0) {
|
|
128
|
+
logger?.info('Marking error state as cleared to allow continuation', { errorCount });
|
|
129
|
+
}
|
|
130
|
+
return {
|
|
131
|
+
coordinationLog: [
|
|
132
|
+
{
|
|
133
|
+
phase: 'state_management',
|
|
134
|
+
status: 'completed',
|
|
135
|
+
timestamp: Date.now(),
|
|
136
|
+
summary: `Cleared ${errorCount} recursion error ${errorCount === 1 ? 'entry' : 'entries'} to allow continuation`,
|
|
137
|
+
metadata: (0, coordination_1.createStateManagementMetadata)({ action: 'clear' }),
|
|
138
|
+
},
|
|
139
|
+
],
|
|
140
|
+
};
|
|
141
|
+
}
|
|
97
142
|
async function handleCreateWorkflowName(messages, workflowJSON, llm, logger) {
|
|
98
143
|
if (messages.length === 1 && messages[0] instanceof messages_1.HumanMessage) {
|
|
99
144
|
const initialMessage = messages[0];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state-modifier.js","sourceRoot":"","sources":["../../src/utils/state-modifier.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"state-modifier.js","sourceRoot":"","sources":["../../src/utils/state-modifier.ts"],"names":[],"mappings":";;AAuEA,oDAgDC;AAMD,sDAWC;AASD,sDA0CC;AAKD,oDAwBC;AAWD,sDAuBC;AAKD,4DAqBC;AAlRD,uDAAuE;AAGvE,+FAAwF;AACxF,+CAA+D;AAC/D,yEAA0E;AAC1E,2DAA4D;AAE5D,wDAAsE;AAuBtE,SAAS,0BAA0B,CAAC,eAAuC;IAE1E,IAAI,uBAAuB,GAAG,CAAC,CAAC,CAAC;IACjC,KAAK,IAAI,CAAC,GAAG,eAAe,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAA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