@n8n/ai-workflow-builder 0.25.1 → 0.27.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.
- package/dist/ai-workflow-builder-agent.service.d.ts +4 -6
- package/dist/ai-workflow-builder-agent.service.js +10 -28
- package/dist/ai-workflow-builder-agent.service.js.map +1 -1
- package/dist/build.tsbuildinfo +1 -1
- package/dist/chains/prompts/base/core-instructions.d.ts +1 -1
- package/dist/chains/prompts/base/core-instructions.js +2 -1
- package/dist/chains/prompts/base/core-instructions.js.map +1 -1
- package/dist/constants.d.ts +2 -2
- package/dist/constants.js +3 -3
- package/dist/constants.js.map +1 -1
- package/dist/tools/builder-tools.js +3 -0
- package/dist/tools/builder-tools.js.map +1 -1
- package/dist/tools/helpers/state.d.ts +1 -0
- package/dist/tools/helpers/state.js +15 -0
- package/dist/tools/helpers/state.js.map +1 -1
- package/dist/tools/prompts/main-agent.prompt.js +6 -32
- package/dist/tools/prompts/main-agent.prompt.js.map +1 -1
- package/dist/tools/remove-connection.tool.d.ts +24 -0
- package/dist/tools/remove-connection.tool.js +234 -0
- package/dist/tools/remove-connection.tool.js.map +1 -0
- package/dist/types/tools.d.ts +8 -0
- package/dist/types/workflow.d.ts +7 -0
- package/dist/utils/cache-control/helpers.d.ts +4 -0
- package/dist/utils/cache-control/helpers.js +90 -0
- package/dist/utils/cache-control/helpers.js.map +1 -0
- package/dist/utils/cache-control/index.d.ts +1 -0
- package/dist/utils/cache-control/index.js +8 -0
- package/dist/utils/cache-control/index.js.map +1 -0
- package/dist/utils/cleanup-dangling-tool-call-messages.d.ts +3 -0
- package/dist/utils/cleanup-dangling-tool-call-messages.js +10 -0
- package/dist/utils/cleanup-dangling-tool-call-messages.js.map +1 -0
- package/dist/utils/operations-processor.js +165 -85
- package/dist/utils/operations-processor.js.map +1 -1
- package/dist/utils/token-usage.d.ts +2 -0
- package/dist/utils/token-usage.js.map +1 -1
- package/dist/workflow-builder-agent.d.ts +6 -0
- package/dist/workflow-builder-agent.js +46 -16
- package/dist/workflow-builder-agent.js.map +1 -1
- package/dist/workflow-state.d.ts +2 -0
- package/package.json +7 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const CORE_INSTRUCTIONS = "You are an expert n8n workflow architect who updates node parameters based on natural language instructions.\n\n## Your Task\nUpdate the parameters of an existing n8n node based on the requested changes. Return the COMPLETE parameters object with both modified and unmodified parameters. Only modify the parameters that are explicitly mentioned in the changes, preserving all other existing parameters exactly as they are.\n\n## Reference Information\nYou will receive:\n1. The original user workflow request\n2. The current workflow JSON\n3. The selected node's current configuration (id, name, type, parameters)\n4. The node type's parameter definitions\n5. Natural language changes to apply\n\n## Parameter Update Guidelines\n1. START WITH CURRENT: If current parameters is empty {}, start with an empty object and add the requested parameters\n2. PRESERVE EXISTING VALUES: Only modify parameters mentioned in the requested changes\n3. MAINTAIN STRUCTURE: Keep the exact parameter structure required by the node type\n4. CHECK FOR RESOURCELOCATOR: If a parameter is type 'resourceLocator' in the node definition, it MUST use the ResourceLocator structure with __rl, mode, and value fields\n5. USE PROPER EXPRESSIONS: Follow n8n expression syntax when referencing other nodes\n6. VALIDATE TYPES: Ensure parameter values match their expected types\n7. HANDLE NESTED PARAMETERS: Correctly update nested structures like headers, conditions, etc.\n8. SIMPLE VALUES: For simple parameter updates like \"Set X to Y\", directly set the parameter without unnecessary nesting\n9. GENERATE IDS: When adding new items to arrays (like assignments, headers, etc.), generate unique IDs using a simple pattern like \"id-1\", \"id-2\", etc.\n10. TOOL NODE DETECTION: Check if node type ends with \"Tool\" to determine if $fromAI expressions are available";
|
|
1
|
+
export declare const CORE_INSTRUCTIONS = "You are an expert n8n workflow architect who updates node parameters based on natural language instructions.\n\n## Your Task\nUpdate the parameters of an existing n8n node based on the requested changes. Return the COMPLETE parameters object with both modified and unmodified parameters. Only modify the parameters that are explicitly mentioned in the changes, preserving all other existing parameters exactly as they are.\n\n## Reference Information\nYou will receive:\n1. The original user workflow request\n2. The current workflow JSON\n3. The selected node's current configuration (id, name, type, parameters)\n4. The node type's parameter definitions\n5. Natural language changes to apply\n\n## Parameter Update Guidelines\n1. START WITH CURRENT: If current parameters is empty {}, start with an empty object and add the requested parameters\n2. PRESERVE EXISTING VALUES: Only modify parameters mentioned in the requested changes\n3. MAINTAIN STRUCTURE: Keep the exact parameter structure required by the node type\n4. CHECK FOR RESOURCELOCATOR: If a parameter is type 'resourceLocator' in the node definition, it MUST use the ResourceLocator structure with __rl, mode, and value fields\n5. USE PROPER EXPRESSIONS: Follow n8n expression syntax when referencing other nodes\n6. VALIDATE TYPES: Ensure parameter values match their expected types\n7. HANDLE NESTED PARAMETERS: Correctly update nested structures like headers, conditions, etc.\n8. SIMPLE VALUES: For simple parameter updates like \"Set X to Y\", directly set the parameter without unnecessary nesting\n9. GENERATE IDS: When adding new items to arrays (like assignments, headers, etc.), generate unique IDs using a simple pattern like \"id-1\", \"id-2\", etc.\n10. TOOL NODE DETECTION: Check if node type ends with \"Tool\" to determine if $fromAI expressions are available\n11. PLACEHOLDER FORMAT: When changes specify a placeholder, copy it exactly as \"<__PLACEHOLDER_VALUE__VALUE_LABEL__>\" (no extra quotes or expressions) and keep VALUE_LABEL descriptive for the user";
|
|
@@ -24,5 +24,6 @@ You will receive:
|
|
|
24
24
|
7. HANDLE NESTED PARAMETERS: Correctly update nested structures like headers, conditions, etc.
|
|
25
25
|
8. SIMPLE VALUES: For simple parameter updates like "Set X to Y", directly set the parameter without unnecessary nesting
|
|
26
26
|
9. GENERATE IDS: When adding new items to arrays (like assignments, headers, etc.), generate unique IDs using a simple pattern like "id-1", "id-2", etc.
|
|
27
|
-
10. TOOL NODE DETECTION: Check if node type ends with "Tool" to determine if $fromAI expressions are available
|
|
27
|
+
10. TOOL NODE DETECTION: Check if node type ends with "Tool" to determine if $fromAI expressions are available
|
|
28
|
+
11. PLACEHOLDER FORMAT: When changes specify a placeholder, copy it exactly as "<__PLACEHOLDER_VALUE__VALUE_LABEL__>" (no extra quotes or expressions) and keep VALUE_LABEL descriptive for the user`;
|
|
28
29
|
//# sourceMappingURL=core-instructions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core-instructions.js","sourceRoot":"","sources":["../../../../src/chains/prompts/base/core-instructions.ts"],"names":[],"mappings":";;;AAAa,QAAA,iBAAiB,GAAG
|
|
1
|
+
{"version":3,"file":"core-instructions.js","sourceRoot":"","sources":["../../../../src/chains/prompts/base/core-instructions.ts"],"names":[],"mappings":";;;AAAa,QAAA,iBAAiB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;qMAwBoK,CAAC"}
|
package/dist/constants.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export declare const MAX_AI_BUILDER_PROMPT_LENGTH =
|
|
1
|
+
export declare const MAX_AI_BUILDER_PROMPT_LENGTH = 5000;
|
|
2
2
|
export declare const MAX_TOTAL_TOKENS = 200000;
|
|
3
3
|
export declare const MAX_OUTPUT_TOKENS = 16000;
|
|
4
4
|
export declare const MAX_INPUT_TOKENS: number;
|
|
5
5
|
export declare const MAX_PARAMETER_VALUE_LENGTH = 30000;
|
|
6
|
-
export declare const DEFAULT_AUTO_COMPACT_THRESHOLD_TOKENS
|
|
6
|
+
export declare const DEFAULT_AUTO_COMPACT_THRESHOLD_TOKENS: number;
|
|
7
7
|
export declare const MAX_WORKFLOW_LENGTH_TOKENS = 30000;
|
|
8
8
|
export declare const AVG_CHARS_PER_TOKEN_ANTHROPIC = 2.5;
|
package/dist/constants.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AVG_CHARS_PER_TOKEN_ANTHROPIC = exports.MAX_WORKFLOW_LENGTH_TOKENS = exports.DEFAULT_AUTO_COMPACT_THRESHOLD_TOKENS = exports.MAX_PARAMETER_VALUE_LENGTH = exports.MAX_INPUT_TOKENS = exports.MAX_OUTPUT_TOKENS = exports.MAX_TOTAL_TOKENS = exports.MAX_AI_BUILDER_PROMPT_LENGTH = void 0;
|
|
4
|
-
exports.MAX_AI_BUILDER_PROMPT_LENGTH =
|
|
4
|
+
exports.MAX_AI_BUILDER_PROMPT_LENGTH = 5000;
|
|
5
5
|
exports.MAX_TOTAL_TOKENS = 200_000;
|
|
6
6
|
exports.MAX_OUTPUT_TOKENS = 16_000;
|
|
7
|
-
exports.MAX_INPUT_TOKENS = exports.MAX_TOTAL_TOKENS - exports.MAX_OUTPUT_TOKENS -
|
|
7
|
+
exports.MAX_INPUT_TOKENS = exports.MAX_TOTAL_TOKENS - exports.MAX_OUTPUT_TOKENS - 5_000;
|
|
8
8
|
exports.MAX_PARAMETER_VALUE_LENGTH = 30_000;
|
|
9
|
-
exports.DEFAULT_AUTO_COMPACT_THRESHOLD_TOKENS =
|
|
9
|
+
exports.DEFAULT_AUTO_COMPACT_THRESHOLD_TOKENS = exports.MAX_TOTAL_TOKENS - 50_000;
|
|
10
10
|
exports.MAX_WORKFLOW_LENGTH_TOKENS = 30_000;
|
|
11
11
|
exports.AVG_CHARS_PER_TOKEN_ANTHROPIC = 2.5;
|
|
12
12
|
//# sourceMappingURL=constants.js.map
|
package/dist/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;AAIa,QAAA,4BAA4B,GAAG,IAAI,CAAC;AAKpC,QAAA,gBAAgB,GAAG,OAAO,CAAC;AAC3B,QAAA,iBAAiB,GAAG,MAAM,CAAC;AAC3B,QAAA,gBAAgB,GAAG,wBAAgB,GAAG,yBAAiB,GAAG,
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;AAIa,QAAA,4BAA4B,GAAG,IAAI,CAAC;AAKpC,QAAA,gBAAgB,GAAG,OAAO,CAAC;AAC3B,QAAA,iBAAiB,GAAG,MAAM,CAAC;AAC3B,QAAA,gBAAgB,GAAG,wBAAgB,GAAG,yBAAiB,GAAG,KAAK,CAAC;AAMhE,QAAA,0BAA0B,GAAG,MAAM,CAAC;AAQpC,QAAA,qCAAqC,GAAG,wBAAgB,GAAG,MAAM,CAAC;AAMlE,QAAA,0BAA0B,GAAG,MAAM,CAAC;AAMpC,QAAA,6BAA6B,GAAG,GAAG,CAAC"}
|
|
@@ -7,6 +7,7 @@ const connect_nodes_tool_1 = require("./connect-nodes.tool");
|
|
|
7
7
|
const get_node_parameter_tool_1 = require("./get-node-parameter.tool");
|
|
8
8
|
const node_details_tool_1 = require("./node-details.tool");
|
|
9
9
|
const node_search_tool_1 = require("./node-search.tool");
|
|
10
|
+
const remove_connection_tool_1 = require("./remove-connection.tool");
|
|
10
11
|
const remove_node_tool_1 = require("./remove-node.tool");
|
|
11
12
|
const update_node_parameters_tool_1 = require("./update-node-parameters.tool");
|
|
12
13
|
function getBuilderTools({ parsedNodeTypes, logger, llmComplexTask, instanceUrl, }) {
|
|
@@ -15,6 +16,7 @@ function getBuilderTools({ parsedNodeTypes, logger, llmComplexTask, instanceUrl,
|
|
|
15
16
|
(0, node_details_tool_1.createNodeDetailsTool)(parsedNodeTypes),
|
|
16
17
|
(0, add_node_tool_1.createAddNodeTool)(parsedNodeTypes),
|
|
17
18
|
(0, connect_nodes_tool_1.createConnectNodesTool)(parsedNodeTypes, logger),
|
|
19
|
+
(0, remove_connection_tool_1.createRemoveConnectionTool)(logger),
|
|
18
20
|
(0, remove_node_tool_1.createRemoveNodeTool)(logger),
|
|
19
21
|
(0, update_node_parameters_tool_1.createUpdateNodeParametersTool)(parsedNodeTypes, llmComplexTask, logger, instanceUrl),
|
|
20
22
|
(0, get_node_parameter_tool_1.createGetNodeParameterTool)(),
|
|
@@ -26,6 +28,7 @@ function getBuilderToolsForDisplay({ nodeTypes, }) {
|
|
|
26
28
|
node_details_tool_1.NODE_DETAILS_TOOL,
|
|
27
29
|
(0, add_node_tool_1.getAddNodeToolBase)(nodeTypes),
|
|
28
30
|
connect_nodes_tool_1.CONNECT_NODES_TOOL,
|
|
31
|
+
remove_connection_tool_1.REMOVE_CONNECTION_TOOL,
|
|
29
32
|
remove_node_tool_1.REMOVE_NODE_TOOL,
|
|
30
33
|
update_node_parameters_tool_1.UPDATING_NODE_PARAMETER_TOOL,
|
|
31
34
|
get_node_parameter_tool_1.GET_NODE_PARAMETER_TOOL,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builder-tools.js","sourceRoot":"","sources":["../../src/tools/builder-tools.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"builder-tools.js","sourceRoot":"","sources":["../../src/tools/builder-tools.ts"],"names":[],"mappings":";;AAkBA,0CAqBC;AAOD,8DAaC;AArDD,mDAAwE;AACxE,6DAAkF;AAClF,uEAAgG;AAChG,2DAA+E;AAC/E,yDAA4E;AAC5E,qEAA8F;AAC9F,yDAA4E;AAC5E,+EAGuC;AAEvC,SAAgB,eAAe,CAAC,EAC/B,eAAe,EACf,MAAM,EACN,cAAc,EACd,WAAW,GAMX;IACA,OAAO;QACN,IAAA,uCAAoB,EAAC,eAAe,CAAC;QACrC,IAAA,yCAAqB,EAAC,eAAe,CAAC;QACtC,IAAA,iCAAiB,EAAC,eAAe,CAAC;QAClC,IAAA,2CAAsB,EAAC,eAAe,EAAE,MAAM,CAAC;QAC/C,IAAA,mDAA0B,EAAC,MAAM,CAAC;QAClC,IAAA,uCAAoB,EAAC,MAAM,CAAC;QAC5B,IAAA,4DAA8B,EAAC,eAAe,EAAE,cAAc,EAAE,MAAM,EAAE,WAAW,CAAC;QACpF,IAAA,oDAA0B,GAAE;KAC5B,CAAC;AACH,CAAC;AAOD,SAAgB,yBAAyB,CAAC,EACzC,SAAS,GAC8B;IACvC,OAAO;QACN,mCAAgB;QAChB,qCAAiB;QACjB,IAAA,kCAAkB,EAAC,SAAS,CAAC;QAC7B,uCAAkB;QAClB,+CAAsB;QACtB,mCAAgB;QAChB,0DAA4B;QAC5B,iDAAuB;KACvB,CAAC;AACH,CAAC"}
|
|
@@ -11,3 +11,4 @@ export declare function removeNodeFromWorkflow(nodeId: string): Partial<typeof W
|
|
|
11
11
|
export declare function removeNodesFromWorkflow(nodeIds: string[]): Partial<typeof WorkflowState.State>;
|
|
12
12
|
export declare function updateNodeInWorkflow(state: typeof WorkflowState.State, nodeId: string, updates: Partial<INode>): Partial<typeof WorkflowState.State>;
|
|
13
13
|
export declare function addConnectionToWorkflow(sourceNodeId: string, _targetNodeId: string, connection: IConnection): Partial<typeof WorkflowState.State>;
|
|
14
|
+
export declare function removeConnectionFromWorkflow(sourceNode: string, targetNode: string, connectionType: string, sourceOutputIndex: number, targetInputIndex: number): Partial<typeof WorkflowState.State>;
|
|
@@ -10,6 +10,7 @@ exports.removeNodeFromWorkflow = removeNodeFromWorkflow;
|
|
|
10
10
|
exports.removeNodesFromWorkflow = removeNodesFromWorkflow;
|
|
11
11
|
exports.updateNodeInWorkflow = updateNodeInWorkflow;
|
|
12
12
|
exports.addConnectionToWorkflow = addConnectionToWorkflow;
|
|
13
|
+
exports.removeConnectionFromWorkflow = removeConnectionFromWorkflow;
|
|
13
14
|
const langgraph_1 = require("@langchain/langgraph");
|
|
14
15
|
function getCurrentWorkflow(state) {
|
|
15
16
|
return state.workflowJSON;
|
|
@@ -67,4 +68,18 @@ function addConnectionToWorkflow(sourceNodeId, _targetNodeId, connection) {
|
|
|
67
68
|
],
|
|
68
69
|
};
|
|
69
70
|
}
|
|
71
|
+
function removeConnectionFromWorkflow(sourceNode, targetNode, connectionType, sourceOutputIndex, targetInputIndex) {
|
|
72
|
+
return {
|
|
73
|
+
workflowOperations: [
|
|
74
|
+
{
|
|
75
|
+
type: 'removeConnection',
|
|
76
|
+
sourceNode,
|
|
77
|
+
targetNode,
|
|
78
|
+
connectionType,
|
|
79
|
+
sourceOutputIndex,
|
|
80
|
+
targetInputIndex,
|
|
81
|
+
},
|
|
82
|
+
],
|
|
83
|
+
};
|
|
84
|
+
}
|
|
70
85
|
//# sourceMappingURL=state.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../../src/tools/helpers/state.ts"],"names":[],"mappings":";;AASA,gDAEC;AAED,4CAEC;AAKD,0EAGC;AAKD,8DAOC;AAKD,8CAEC;AAKD,gDAKC;AAKD,wDAKC;AAKD,0DAKC;AAKD,oDAcC;AAKD,0DAiBC;
|
|
1
|
+
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../../src/tools/helpers/state.ts"],"names":[],"mappings":";;AASA,gDAEC;AAED,4CAEC;AAKD,0EAGC;AAKD,8DAOC;AAKD,8CAEC;AAKD,gDAKC;AAKD,wDAKC;AAKD,0DAKC;AAKD,oDAcC;AAKD,0DAiBC;AAKD,oEAmBC;AAzID,oDAA2D;AAS3D,SAAgB,kBAAkB,CAAC,KAAiC;IACnE,OAAO,KAAK,CAAC,YAAY,CAAC;AAC3B,CAAC;AAED,SAAgB,gBAAgB;IAC/B,OAAO,IAAA,+BAAmB,GAAE,CAAC;AAC9B,CAAC;AAKD,SAAgB,+BAA+B;IAC9C,MAAM,KAAK,GAAG,gBAAgB,EAAE,CAAC;IACjC,OAAO,kBAAkB,CAAC,KAAK,CAAC,CAAC;AAClC,CAAC;AAKD,SAAgB,yBAAyB,CACxC,WAA0C;IAG1C,OAAO;QACN,kBAAkB,EAAE,CAAC,EAAE,IAAI,EAAE,kBAAkB,EAAE,WAAW,EAAE,CAAC;KAC/D,CAAC;AACH,CAAC;AAKD,SAAgB,iBAAiB,CAAC,IAAW;IAC5C,OAAO,kBAAkB,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;AACnC,CAAC;AAKD,SAAgB,kBAAkB,CAAC,KAAc;IAEhD,OAAO;QACN,kBAAkB,EAAE,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC;KACjD,CAAC;AACH,CAAC;AAKD,SAAgB,sBAAsB,CAAC,MAAc;IAEpD,OA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
|
|
342
342
|
<handling_uncertainty>
|
|
343
343
|
When unsure about specific values:
|
|
344
344
|
- Add nodes and connections confidently
|
|
345
|
-
- For uncertain parameters, use update_node_parameters with
|
|
345
|
+
- For uncertain parameters, use update_node_parameters with placeholders formatted exactly as "<__PLACEHOLDER_VALUE__VALUE_LABEL__>"
|
|
346
|
+
- Make VALUE_LABEL descriptive (e.g., "API endpoint URL", "Auth token header") so users know what to supply
|
|
346
347
|
- For tool nodes with dynamic values, use $fromAI expressions instead of placeholders
|
|
347
348
|
- Always mention what needs user to configure in the setup response
|
|
348
349
|
|
|
349
350
|
Example for regular nodes:
|
|
350
351
|
update_node_parameters({{
|
|
351
352
|
nodeId: "httpRequest1",
|
|
352
|
-
instructions: [
|
|
353
|
+
instructions: [
|
|
354
|
+
"Set URL to <__PLACEHOLDER_VALUE__API endpoint URL__>",
|
|
355
|
+
"Add header Authorization: <__PLACEHOLDER_VALUE__Bearer token__>"
|
|
356
|
+
]
|
|
353
357
|
}})
|
|
354
358
|
|
|
355
359
|
Example for tool nodes:
|
|
@@ -400,22 +404,6 @@ ABSOLUTELY FORBIDDEN IN BUILDING MODE:
|
|
|
400
404
|
- Status updates while tools are running
|
|
401
405
|
</response_patterns>
|
|
402
406
|
`;
|
|
403
|
-
const currentWorkflowJson = `
|
|
404
|
-
<current_workflow_json>
|
|
405
|
-
{workflowJSON}
|
|
406
|
-
</current_workflow_json>
|
|
407
|
-
<trimmed_workflow_json_note>
|
|
408
|
-
Note: Large property values of the nodes in the workflow JSON above may be trimmed to fit within token limits.
|
|
409
|
-
Use get_node_parameter tool to get full details when needed.
|
|
410
|
-
</trimmed_workflow_json_note>`;
|
|
411
|
-
const currentExecutionData = `
|
|
412
|
-
<current_simplified_execution_data>
|
|
413
|
-
{executionData}
|
|
414
|
-
</current_simplified_execution_data>`;
|
|
415
|
-
const currentExecutionNodesSchemas = `
|
|
416
|
-
<current_execution_nodes_schemas>
|
|
417
|
-
{executionSchema}
|
|
418
|
-
</current_execution_nodes_schemas>`;
|
|
419
407
|
const previousConversationSummary = `
|
|
420
408
|
<previous_summary>
|
|
421
409
|
{previousSummary}
|
|
@@ -427,28 +415,14 @@ exports.mainAgentPrompt = prompts_1.ChatPromptTemplate.fromMessages([
|
|
|
427
415
|
{
|
|
428
416
|
type: 'text',
|
|
429
417
|
text: systemPrompt,
|
|
430
|
-
cache_control: { type: 'ephemeral' },
|
|
431
418
|
},
|
|
432
419
|
{
|
|
433
420
|
type: 'text',
|
|
434
421
|
text: instance_url_1.instanceUrlPrompt,
|
|
435
422
|
},
|
|
436
|
-
{
|
|
437
|
-
type: 'text',
|
|
438
|
-
text: currentWorkflowJson,
|
|
439
|
-
},
|
|
440
|
-
{
|
|
441
|
-
type: 'text',
|
|
442
|
-
text: currentExecutionData,
|
|
443
|
-
},
|
|
444
|
-
{
|
|
445
|
-
type: 'text',
|
|
446
|
-
text: currentExecutionNodesSchemas,
|
|
447
|
-
},
|
|
448
423
|
{
|
|
449
424
|
type: 'text',
|
|
450
425
|
text: responsePatterns,
|
|
451
|
-
cache_control: { type: 'ephemeral' },
|
|
452
426
|
},
|
|
453
427
|
{
|
|
454
428
|
type: 'text',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main-agent.prompt.js","sourceRoot":"","sources":["../../../src/tools/prompts/main-agent.prompt.ts"],"names":[],"mappings":";;;AAAA,qDAA6D;AAE7D,oEAAsE;AAEtE,MAAM,YAAY,GAAG
|
|
1
|
+
{"version":3,"file":"main-agent.prompt.js","sourceRoot":"","sources":["../../../src/tools/prompts/main-agent.prompt.ts"],"names":[],"mappings":";;;AAAA,qDAA6D;AAE7D,oEAAsE;AAEtE,MAAM,YAAY,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwWpB,CAAC;AAEF,MAAM,gBAAgB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuCxB,CAAC;AAEF,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;aAClB;YACD;gBACC,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,gCAAiB;aACvB;YACD;gBACC,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,gBAAgB;aACtB;YACD;gBACC,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,2BAA2B;gBACjC,aAAa,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE;aACpC;SACD;KACD;IACD,CAAC,aAAa,EAAE,YAAY,CAAC;CAC7B,CAAC,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Logger } from '@n8n/backend-common';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import type { BuilderTool, BuilderToolBase } from '../utils/stream-processor';
|
|
4
|
+
export declare const removeConnectionSchema: z.ZodObject<{
|
|
5
|
+
sourceNodeId: z.ZodString;
|
|
6
|
+
targetNodeId: z.ZodString;
|
|
7
|
+
connectionType: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
8
|
+
sourceOutputIndex: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
9
|
+
targetInputIndex: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
10
|
+
}, "strip", z.ZodTypeAny, {
|
|
11
|
+
connectionType: string;
|
|
12
|
+
sourceOutputIndex: number;
|
|
13
|
+
targetInputIndex: number;
|
|
14
|
+
sourceNodeId: string;
|
|
15
|
+
targetNodeId: string;
|
|
16
|
+
}, {
|
|
17
|
+
sourceNodeId: string;
|
|
18
|
+
targetNodeId: string;
|
|
19
|
+
connectionType?: string | undefined;
|
|
20
|
+
sourceOutputIndex?: number | undefined;
|
|
21
|
+
targetInputIndex?: number | undefined;
|
|
22
|
+
}>;
|
|
23
|
+
export declare const REMOVE_CONNECTION_TOOL: BuilderToolBase;
|
|
24
|
+
export declare function createRemoveConnectionTool(logger?: Logger): BuilderTool;
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.REMOVE_CONNECTION_TOOL = exports.removeConnectionSchema = void 0;
|
|
4
|
+
exports.createRemoveConnectionTool = createRemoveConnectionTool;
|
|
5
|
+
const tools_1 = require("@langchain/core/tools");
|
|
6
|
+
const zod_1 = require("zod");
|
|
7
|
+
const errors_1 = require("../errors");
|
|
8
|
+
const progress_1 = require("./helpers/progress");
|
|
9
|
+
const response_1 = require("./helpers/response");
|
|
10
|
+
const state_1 = require("./helpers/state");
|
|
11
|
+
const validation_1 = require("./helpers/validation");
|
|
12
|
+
exports.removeConnectionSchema = zod_1.z.object({
|
|
13
|
+
sourceNodeId: zod_1.z
|
|
14
|
+
.string()
|
|
15
|
+
.describe('The UUID of the source node where the connection originates from'),
|
|
16
|
+
targetNodeId: zod_1.z.string().describe('The UUID of the target node where the connection goes to'),
|
|
17
|
+
connectionType: zod_1.z
|
|
18
|
+
.string()
|
|
19
|
+
.optional()
|
|
20
|
+
.default('main')
|
|
21
|
+
.describe('The type of connection to remove (default: "main")'),
|
|
22
|
+
sourceOutputIndex: zod_1.z
|
|
23
|
+
.number()
|
|
24
|
+
.optional()
|
|
25
|
+
.default(0)
|
|
26
|
+
.describe('The index of the output to disconnect from (default: 0)'),
|
|
27
|
+
targetInputIndex: zod_1.z
|
|
28
|
+
.number()
|
|
29
|
+
.optional()
|
|
30
|
+
.default(0)
|
|
31
|
+
.describe('The index of the input to disconnect from (default: 0)'),
|
|
32
|
+
});
|
|
33
|
+
exports.REMOVE_CONNECTION_TOOL = {
|
|
34
|
+
toolName: 'remove_connection',
|
|
35
|
+
displayTitle: 'Removing connection',
|
|
36
|
+
};
|
|
37
|
+
function buildResponseMessage(sourceNodeName, targetNodeName, connectionType, sourceOutputIndex, targetInputIndex) {
|
|
38
|
+
const parts = [
|
|
39
|
+
`Successfully removed connection: ${sourceNodeName} → ${targetNodeName} (${connectionType})`,
|
|
40
|
+
];
|
|
41
|
+
if (sourceOutputIndex !== 0 || targetInputIndex !== 0) {
|
|
42
|
+
parts.push(`Output index: ${sourceOutputIndex}, Input index: ${targetInputIndex}`);
|
|
43
|
+
}
|
|
44
|
+
return parts.join('\n');
|
|
45
|
+
}
|
|
46
|
+
function createRemoveConnectionTool(logger) {
|
|
47
|
+
const dynamicTool = (0, tools_1.tool)((input, config) => {
|
|
48
|
+
const reporter = (0, progress_1.createProgressReporter)(config, exports.REMOVE_CONNECTION_TOOL.toolName, exports.REMOVE_CONNECTION_TOOL.displayTitle);
|
|
49
|
+
try {
|
|
50
|
+
const validatedInput = exports.removeConnectionSchema.parse(input);
|
|
51
|
+
reporter.start(validatedInput);
|
|
52
|
+
const state = (0, state_1.getWorkflowState)();
|
|
53
|
+
const workflow = (0, state_1.getCurrentWorkflow)(state);
|
|
54
|
+
(0, progress_1.reportProgress)(reporter, 'Finding nodes to disconnect...');
|
|
55
|
+
const sourceNode = (0, validation_1.validateNodeExists)(validatedInput.sourceNodeId, workflow.nodes);
|
|
56
|
+
const targetNode = (0, validation_1.validateNodeExists)(validatedInput.targetNodeId, workflow.nodes);
|
|
57
|
+
if (!sourceNode || !targetNode) {
|
|
58
|
+
const missingNodeId = !sourceNode
|
|
59
|
+
? validatedInput.sourceNodeId
|
|
60
|
+
: validatedInput.targetNodeId;
|
|
61
|
+
const nodeError = new errors_1.NodeNotFoundError(missingNodeId);
|
|
62
|
+
const error = {
|
|
63
|
+
message: nodeError.message,
|
|
64
|
+
code: 'NODES_NOT_FOUND',
|
|
65
|
+
details: {
|
|
66
|
+
sourceNodeId: validatedInput.sourceNodeId,
|
|
67
|
+
targetNodeId: validatedInput.targetNodeId,
|
|
68
|
+
foundSource: !!sourceNode,
|
|
69
|
+
foundTarget: !!targetNode,
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
reporter.error(error);
|
|
73
|
+
return (0, response_1.createErrorResponse)(config, error);
|
|
74
|
+
}
|
|
75
|
+
logger?.debug('\n=== Remove Connection Tool ===');
|
|
76
|
+
logger?.debug(`Attempting to remove connection: ${sourceNode.name} -> ${targetNode.name} (${validatedInput.connectionType})`);
|
|
77
|
+
(0, progress_1.reportProgress)(reporter, `Removing connection from ${sourceNode.name} to ${targetNode.name}...`);
|
|
78
|
+
const sourceConnections = workflow.connections[sourceNode.name];
|
|
79
|
+
if (!sourceConnections) {
|
|
80
|
+
const connectionError = new errors_1.ConnectionError(`Source node "${sourceNode.name}" has no outgoing connections`, {
|
|
81
|
+
fromNodeId: sourceNode.id,
|
|
82
|
+
toNodeId: targetNode.id,
|
|
83
|
+
});
|
|
84
|
+
const error = {
|
|
85
|
+
message: connectionError.message,
|
|
86
|
+
code: 'CONNECTION_NOT_FOUND',
|
|
87
|
+
details: {
|
|
88
|
+
sourceNode: sourceNode.name,
|
|
89
|
+
targetNode: targetNode.name,
|
|
90
|
+
connectionType: validatedInput.connectionType,
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
reporter.error(error);
|
|
94
|
+
return (0, response_1.createErrorResponse)(config, error);
|
|
95
|
+
}
|
|
96
|
+
const connectionTypeOutputs = sourceConnections[validatedInput.connectionType];
|
|
97
|
+
if (!connectionTypeOutputs || !Array.isArray(connectionTypeOutputs)) {
|
|
98
|
+
const connectionError = new errors_1.ConnectionError(`Source node "${sourceNode.name}" has no connections of type "${validatedInput.connectionType}"`, {
|
|
99
|
+
fromNodeId: sourceNode.id,
|
|
100
|
+
toNodeId: targetNode.id,
|
|
101
|
+
});
|
|
102
|
+
const error = {
|
|
103
|
+
message: connectionError.message,
|
|
104
|
+
code: 'CONNECTION_TYPE_NOT_FOUND',
|
|
105
|
+
details: {
|
|
106
|
+
sourceNode: sourceNode.name,
|
|
107
|
+
targetNode: targetNode.name,
|
|
108
|
+
connectionType: validatedInput.connectionType,
|
|
109
|
+
availableConnectionTypes: Object.keys(sourceConnections),
|
|
110
|
+
},
|
|
111
|
+
};
|
|
112
|
+
reporter.error(error);
|
|
113
|
+
return (0, response_1.createErrorResponse)(config, error);
|
|
114
|
+
}
|
|
115
|
+
const outputConnections = connectionTypeOutputs[validatedInput.sourceOutputIndex];
|
|
116
|
+
if (!outputConnections || !Array.isArray(outputConnections)) {
|
|
117
|
+
const connectionError = new errors_1.ConnectionError(`Source node "${sourceNode.name}" has no connections at output index ${validatedInput.sourceOutputIndex}`, {
|
|
118
|
+
fromNodeId: sourceNode.id,
|
|
119
|
+
toNodeId: targetNode.id,
|
|
120
|
+
});
|
|
121
|
+
const error = {
|
|
122
|
+
message: connectionError.message,
|
|
123
|
+
code: 'OUTPUT_INDEX_NOT_FOUND',
|
|
124
|
+
details: {
|
|
125
|
+
sourceNode: sourceNode.name,
|
|
126
|
+
targetNode: targetNode.name,
|
|
127
|
+
connectionType: validatedInput.connectionType,
|
|
128
|
+
sourceOutputIndex: validatedInput.sourceOutputIndex,
|
|
129
|
+
},
|
|
130
|
+
};
|
|
131
|
+
reporter.error(error);
|
|
132
|
+
return (0, response_1.createErrorResponse)(config, error);
|
|
133
|
+
}
|
|
134
|
+
const connectionExists = outputConnections.some((conn) => conn.node === targetNode.name &&
|
|
135
|
+
conn.type === validatedInput.connectionType &&
|
|
136
|
+
conn.index === validatedInput.targetInputIndex);
|
|
137
|
+
if (!connectionExists) {
|
|
138
|
+
const connectionError = new errors_1.ConnectionError(`Connection not found: ${sourceNode.name} → ${targetNode.name} (${validatedInput.connectionType}) at output ${validatedInput.sourceOutputIndex} to input ${validatedInput.targetInputIndex}`, {
|
|
139
|
+
fromNodeId: sourceNode.id,
|
|
140
|
+
toNodeId: targetNode.id,
|
|
141
|
+
});
|
|
142
|
+
const error = {
|
|
143
|
+
message: connectionError.message,
|
|
144
|
+
code: 'SPECIFIC_CONNECTION_NOT_FOUND',
|
|
145
|
+
details: {
|
|
146
|
+
sourceNode: sourceNode.name,
|
|
147
|
+
targetNode: targetNode.name,
|
|
148
|
+
connectionType: validatedInput.connectionType,
|
|
149
|
+
sourceOutputIndex: validatedInput.sourceOutputIndex,
|
|
150
|
+
targetInputIndex: validatedInput.targetInputIndex,
|
|
151
|
+
existingConnections: outputConnections.map((conn) => ({
|
|
152
|
+
node: conn.node,
|
|
153
|
+
type: conn.type,
|
|
154
|
+
index: conn.index,
|
|
155
|
+
})),
|
|
156
|
+
},
|
|
157
|
+
};
|
|
158
|
+
reporter.error(error);
|
|
159
|
+
return (0, response_1.createErrorResponse)(config, error);
|
|
160
|
+
}
|
|
161
|
+
const message = buildResponseMessage(sourceNode.name, targetNode.name, validatedInput.connectionType, validatedInput.sourceOutputIndex, validatedInput.targetInputIndex);
|
|
162
|
+
logger?.debug('Connection found and will be removed');
|
|
163
|
+
const output = {
|
|
164
|
+
sourceNode: sourceNode.name,
|
|
165
|
+
targetNode: targetNode.name,
|
|
166
|
+
connectionType: validatedInput.connectionType,
|
|
167
|
+
sourceOutputIndex: validatedInput.sourceOutputIndex,
|
|
168
|
+
targetInputIndex: validatedInput.targetInputIndex,
|
|
169
|
+
message,
|
|
170
|
+
};
|
|
171
|
+
reporter.complete(output);
|
|
172
|
+
const stateUpdates = (0, state_1.removeConnectionFromWorkflow)(sourceNode.name, targetNode.name, validatedInput.connectionType, validatedInput.sourceOutputIndex, validatedInput.targetInputIndex);
|
|
173
|
+
return (0, response_1.createSuccessResponse)(config, message, stateUpdates);
|
|
174
|
+
}
|
|
175
|
+
catch (error) {
|
|
176
|
+
let toolError;
|
|
177
|
+
if (error instanceof zod_1.z.ZodError) {
|
|
178
|
+
const validationError = new errors_1.ValidationError('Invalid connection removal parameters', {
|
|
179
|
+
field: error.errors[0]?.path.join('.'),
|
|
180
|
+
value: error.errors[0]?.message,
|
|
181
|
+
});
|
|
182
|
+
toolError = {
|
|
183
|
+
message: validationError.message,
|
|
184
|
+
code: 'VALIDATION_ERROR',
|
|
185
|
+
details: error.errors,
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
toolError = {
|
|
190
|
+
message: error instanceof Error ? error.message : 'Unknown error occurred',
|
|
191
|
+
code: 'EXECUTION_ERROR',
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
reporter.error(toolError);
|
|
195
|
+
return (0, response_1.createErrorResponse)(config, toolError);
|
|
196
|
+
}
|
|
197
|
+
}, {
|
|
198
|
+
name: exports.REMOVE_CONNECTION_TOOL.toolName,
|
|
199
|
+
description: `Remove a specific connection between two nodes in the workflow. This allows you to disconnect nodes without deleting them.
|
|
200
|
+
|
|
201
|
+
USAGE:
|
|
202
|
+
Use this tool when you need to break an existing connection while keeping both nodes in the workflow.
|
|
203
|
+
|
|
204
|
+
PARAMETERS:
|
|
205
|
+
- sourceNodeId: The UUID of the node that is the source of the connection (where the data comes from)
|
|
206
|
+
- targetNodeId: The UUID of the node that receives the connection (where the data goes to)
|
|
207
|
+
- connectionType: The type of connection to remove (default: "main")
|
|
208
|
+
* For regular data flow: "main"
|
|
209
|
+
* For AI connections: "ai_languageModel", "ai_tool", "ai_memory", "ai_embedding", "ai_document", etc.
|
|
210
|
+
- sourceOutputIndex: Which output of the source node to disconnect from (default: 0)
|
|
211
|
+
- targetInputIndex: Which input of the target node to disconnect from (default: 0)
|
|
212
|
+
|
|
213
|
+
EXAMPLES:
|
|
214
|
+
1. Remove main data connection:
|
|
215
|
+
sourceNodeId: "abc-123", targetNodeId: "def-456", connectionType: "main"
|
|
216
|
+
|
|
217
|
+
2. Remove AI model from AI Agent:
|
|
218
|
+
sourceNodeId: "model-id", targetNodeId: "agent-id", connectionType: "ai_languageModel"
|
|
219
|
+
|
|
220
|
+
3. Remove specific connection when multiple exist:
|
|
221
|
+
sourceNodeId: "node-1", targetNodeId: "node-2", connectionType: "main", sourceOutputIndex: 1, targetInputIndex: 0
|
|
222
|
+
|
|
223
|
+
NOTES:
|
|
224
|
+
- Both nodes must exist in the workflow
|
|
225
|
+
- The specific connection must exist or an error will be returned
|
|
226
|
+
- Use this when restructuring workflows or replacing connections`,
|
|
227
|
+
schema: exports.removeConnectionSchema,
|
|
228
|
+
});
|
|
229
|
+
return {
|
|
230
|
+
tool: dynamicTool,
|
|
231
|
+
...exports.REMOVE_CONNECTION_TOOL,
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
//# sourceMappingURL=remove-connection.tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove-connection.tool.js","sourceRoot":"","sources":["../../src/tools/remove-connection.tool.ts"],"names":[],"mappings":";;;AAuEA,gEAiQC;AAxUD,iDAA6C;AAE7C,6BAAwB;AAIxB,sCAAgF;AAEhF,iDAA4E;AAC5E,iDAAgF;AAChF,2CAIyB;AACzB,qDAA0D;AAK7C,QAAA,sBAAsB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC9C,YAAY,EAAE,OAAC;SACb,MAAM,EAAE;SACR,QAAQ,CAAC,kEAAkE,CAAC;IAC9E,YAAY,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,0DAA0D,CAAC;IAC7F,cAAc,EAAE,OAAC;SACf,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,OAAO,CAAC,MAAM,CAAC;SACf,QAAQ,CAAC,oDAAoD,CAAC;IAChE,iBAAiB,EAAE,OAAC;SAClB,MAAM,EAAE;SACR,QA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M,EAAE,SAAS,CAAC,CAAC;QAC/C,CAAC;IACF,CAAC,EACD;QACC,IAAI,EAAE,8BAAsB,CAAC,QAAQ;QACrC,WAAW,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;iEA2BiD;QAC9D,MAAM,EAAE,8BAAsB;KAC9B,CACD,CAAC;IAEF,OAAO;QACN,IAAI,EAAE,WAAW;QACjB,GAAG,8BAAsB;KACzB,CAAC;AACH,CAAC"}
|
package/dist/types/tools.d.ts
CHANGED
|
@@ -81,3 +81,11 @@ export interface NodeSearchOutput {
|
|
|
81
81
|
export interface GetNodeParameterOutput {
|
|
82
82
|
message: string;
|
|
83
83
|
}
|
|
84
|
+
export interface RemoveConnectionOutput {
|
|
85
|
+
sourceNode: string;
|
|
86
|
+
targetNode: string;
|
|
87
|
+
connectionType: string;
|
|
88
|
+
sourceOutputIndex: number;
|
|
89
|
+
targetInputIndex: number;
|
|
90
|
+
message: string;
|
|
91
|
+
}
|
package/dist/types/workflow.d.ts
CHANGED
|
@@ -18,6 +18,13 @@ export type WorkflowOperation = {
|
|
|
18
18
|
} | {
|
|
19
19
|
type: 'mergeConnections';
|
|
20
20
|
connections: IConnections;
|
|
21
|
+
} | {
|
|
22
|
+
type: 'removeConnection';
|
|
23
|
+
sourceNode: string;
|
|
24
|
+
targetNode: string;
|
|
25
|
+
connectionType: string;
|
|
26
|
+
sourceOutputIndex: number;
|
|
27
|
+
targetInputIndex: number;
|
|
21
28
|
} | {
|
|
22
29
|
type: 'setName';
|
|
23
30
|
name: string;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { BaseMessage } from '@langchain/core/messages';
|
|
2
|
+
export declare function findUserToolMessageIndices(messages: BaseMessage[]): number[];
|
|
3
|
+
export declare function cleanStaleWorkflowContext(messages: BaseMessage[], userToolIndices: number[]): void;
|
|
4
|
+
export declare function applyCacheControlMarkers(messages: BaseMessage[], userToolIndices: number[], workflowContext: string): void;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.findUserToolMessageIndices = findUserToolMessageIndices;
|
|
4
|
+
exports.cleanStaleWorkflowContext = cleanStaleWorkflowContext;
|
|
5
|
+
exports.applyCacheControlMarkers = applyCacheControlMarkers;
|
|
6
|
+
const messages_1 = require("@langchain/core/messages");
|
|
7
|
+
function isTextBlock(block) {
|
|
8
|
+
return (typeof block === 'object' &&
|
|
9
|
+
block !== null &&
|
|
10
|
+
'text' in block &&
|
|
11
|
+
typeof block.text === 'string');
|
|
12
|
+
}
|
|
13
|
+
function hasCacheControl(block) {
|
|
14
|
+
return typeof block === 'object' && block !== null && 'cache_control' in block;
|
|
15
|
+
}
|
|
16
|
+
function findUserToolMessageIndices(messages) {
|
|
17
|
+
const userToolIndices = [];
|
|
18
|
+
for (let i = 0; i < messages.length; i++) {
|
|
19
|
+
if (messages[i] instanceof messages_1.HumanMessage || messages[i] instanceof messages_1.ToolMessage) {
|
|
20
|
+
userToolIndices.push(i);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return userToolIndices;
|
|
24
|
+
}
|
|
25
|
+
function cleanStaleWorkflowContext(messages, userToolIndices) {
|
|
26
|
+
if (userToolIndices.length === 0) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
for (let i = 0; i < userToolIndices.length - 1; i++) {
|
|
30
|
+
const idx = userToolIndices[i];
|
|
31
|
+
const message = messages[idx];
|
|
32
|
+
if (typeof message.content === 'string') {
|
|
33
|
+
message.content = message.content.replace(/\n*<current_workflow_json>[\s\S]*?<\/current_execution_nodes_schemas>/, '');
|
|
34
|
+
}
|
|
35
|
+
if (Array.isArray(message.content)) {
|
|
36
|
+
for (const block of message.content) {
|
|
37
|
+
if (hasCacheControl(block)) {
|
|
38
|
+
delete block.cache_control;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function applyCacheControlMarkers(messages, userToolIndices, workflowContext) {
|
|
45
|
+
if (userToolIndices.length === 0) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const lastIdx = userToolIndices[userToolIndices.length - 1];
|
|
49
|
+
const lastMessage = messages[lastIdx];
|
|
50
|
+
if (typeof lastMessage.content === 'string') {
|
|
51
|
+
lastMessage.content = lastMessage.content + workflowContext;
|
|
52
|
+
}
|
|
53
|
+
if (userToolIndices.length > 1) {
|
|
54
|
+
const secondToLastIdx = userToolIndices[userToolIndices.length - 2];
|
|
55
|
+
const secondToLastMessage = messages[secondToLastIdx];
|
|
56
|
+
if (typeof secondToLastMessage.content === 'string') {
|
|
57
|
+
secondToLastMessage.content = [
|
|
58
|
+
{
|
|
59
|
+
type: 'text',
|
|
60
|
+
text: secondToLastMessage.content,
|
|
61
|
+
cache_control: { type: 'ephemeral' },
|
|
62
|
+
},
|
|
63
|
+
];
|
|
64
|
+
}
|
|
65
|
+
else if (Array.isArray(secondToLastMessage.content)) {
|
|
66
|
+
const lastBlock = secondToLastMessage.content[secondToLastMessage.content.length - 1];
|
|
67
|
+
if (isTextBlock(lastBlock)) {
|
|
68
|
+
lastBlock.cache_control = { type: 'ephemeral' };
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
const lastUserToolIdx = userToolIndices[userToolIndices.length - 1];
|
|
73
|
+
const lastUserToolMessage = messages[lastUserToolIdx];
|
|
74
|
+
if (typeof lastUserToolMessage.content === 'string') {
|
|
75
|
+
lastUserToolMessage.content = [
|
|
76
|
+
{
|
|
77
|
+
type: 'text',
|
|
78
|
+
text: lastUserToolMessage.content,
|
|
79
|
+
cache_control: { type: 'ephemeral' },
|
|
80
|
+
},
|
|
81
|
+
];
|
|
82
|
+
}
|
|
83
|
+
else if (Array.isArray(lastUserToolMessage.content)) {
|
|
84
|
+
const lastBlock = lastUserToolMessage.content[lastUserToolMessage.content.length - 1];
|
|
85
|
+
if (isTextBlock(lastBlock)) {
|
|
86
|
+
lastBlock.cache_control = { type: 'ephemeral' };
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/utils/cache-control/helpers.ts"],"names":[],"mappings":";;AAgCA,gEASC;AAiBD,8DA8BC;AAkBD,4DAuDC;AAjKD,uDAAqE;AAOrE,SAAS,WAAW,CACnB,KAAc;IAEd,OAAO,CACN,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,MAAM,IAAI,KAAK;QACf,OAAQ,KAA2B,CAAC,IAAI,KAAK,QAAQ,CACrD,CAAC;AACH,CAAC;AAKD,SAAS,eAAe,CAAC,KAAc;IACtC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,eAAe,IAAI,KAAK,CAAC;AAChF,CAAC;AASD,SAAgB,0BAA0B,CAAC,QAAuB;IACjE,MAAM,eAAe,GAAa,EAAE,CAAC;IACrC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAC1C,IAAI,QAAQ,CAAC,CAAC,CAAC,YAAY,uBAAY,IAAI,QAAQ,CAAC,CAAC,CAAC,YAAY,sBAAW,EAAE,CAAC;YAC/E,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACzB,CAAC;IACF,CAAC;IAED,OAAO,eAAe,CAAC;AACxB,CAAC;AAiBD,SAAgB,yBAAyB,CACxC,QAAuB,EACvB,eAAyB;IAEzB,IAAI,eAAe,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAClC,OAAO;IACR,CAAC;IAGD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,eAAe,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,EAAE,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