n8n-core 1.84.0 → 1.85.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/build.tsbuildinfo +1 -1
- package/dist/execution-engine/node-execution-context/utils/get-input-connection-data.d.ts +2 -1
- package/dist/execution-engine/node-execution-context/utils/get-input-connection-data.js +31 -19
- package/dist/execution-engine/node-execution-context/utils/get-input-connection-data.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { CloseFunction, IExecuteData, INodeExecutionData, IRunExecutionData, ITaskDataConnections, IWorkflowExecuteAdditionalData, Workflow, WorkflowExecuteMode, AINodeConnectionType } from 'n8n-workflow';
|
|
1
|
+
import type { CloseFunction, IExecuteData, INodeExecutionData, IRunExecutionData, ITaskDataConnections, IWorkflowExecuteAdditionalData, Workflow, WorkflowExecuteMode, AINodeConnectionType, IDataObject, ISupplyDataFunctions, INodeType, INode } from 'n8n-workflow';
|
|
2
2
|
import type { ExecuteContext, WebhookContext } from '../../node-execution-context';
|
|
3
3
|
import { SupplyDataContext } from '../../node-execution-context/supply-data-context';
|
|
4
|
+
export declare function makeHandleToolInvocation(contextFactory: (runIndex: number) => ISupplyDataFunctions, node: INode, nodeType: INodeType): (toolArgs: IDataObject) => Promise<string>;
|
|
4
5
|
export declare function getInputConnectionData(this: ExecuteContext | WebhookContext | SupplyDataContext, workflow: Workflow, runExecutionData: IRunExecutionData, parentRunIndex: number, connectionInputData: INodeExecutionData[], parentInputData: ITaskDataConnections, additionalData: IWorkflowExecuteAdditionalData, executeData: IExecuteData, mode: WorkflowExecuteMode, closeFunctions: CloseFunction[], connectionType: AINodeConnectionType, itemIndex: number, abortSignal?: AbortSignal): Promise<unknown>;
|
|
@@ -1,9 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeHandleToolInvocation = makeHandleToolInvocation;
|
|
3
4
|
exports.getInputConnectionData = getInputConnectionData;
|
|
4
5
|
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
6
|
const create_node_as_tool_1 = require("./create-node-as-tool");
|
|
6
7
|
const supply_data_context_1 = require("../../node-execution-context/supply-data-context");
|
|
8
|
+
function makeHandleToolInvocation(contextFactory, node, nodeType) {
|
|
9
|
+
let toolRunIndex = 0;
|
|
10
|
+
return async (toolArgs) => {
|
|
11
|
+
const runIndex = toolRunIndex++;
|
|
12
|
+
const context = contextFactory(runIndex);
|
|
13
|
+
context.addInputData(n8n_workflow_1.NodeConnectionTypes.AiTool, [[{ json: toolArgs }]]);
|
|
14
|
+
try {
|
|
15
|
+
const result = await nodeType.execute?.call(context);
|
|
16
|
+
const mappedResults = result?.[0]?.flatMap((item) => item.json);
|
|
17
|
+
let response = mappedResults;
|
|
18
|
+
if (result?.some((x) => x.some((y) => y.binary))) {
|
|
19
|
+
if (!mappedResults || mappedResults.flatMap((x) => Object.keys(x ?? {})).length === 0) {
|
|
20
|
+
response =
|
|
21
|
+
'Error: The Tool attempted to return binary data, which is not supported in Agents';
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
context.logger.warn(`Response from Tool '${node.name}' included binary data, which is not supported in Agents. The binary data was omitted from the response.`);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
context.addOutputData(n8n_workflow_1.NodeConnectionTypes.AiTool, runIndex, [[{ json: { response } }]]);
|
|
28
|
+
return JSON.stringify(response);
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
const nodeError = new n8n_workflow_1.NodeOperationError(node, error);
|
|
32
|
+
context.addOutputData(n8n_workflow_1.NodeConnectionTypes.AiTool, runIndex, nodeError);
|
|
33
|
+
return 'Error during node execution: ' + (nodeError.description ?? nodeError.message);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
}
|
|
7
37
|
async function getInputConnectionData(workflow, runExecutionData, parentRunIndex, connectionInputData, parentInputData, additionalData, executeData, mode, closeFunctions, connectionType, itemIndex, abortSignal) {
|
|
8
38
|
const parentNode = this.getNode();
|
|
9
39
|
const inputConfiguration = this.nodeInputs.find((input) => input.type === connectionType);
|
|
@@ -29,28 +59,10 @@ async function getInputConnectionData(workflow, runExecutionData, parentRunIndex
|
|
|
29
59
|
const contextFactory = (runIndex, inputData) => new supply_data_context_1.SupplyDataContext(workflow, connectedNode, additionalData, mode, runExecutionData, runIndex, connectionInputData, inputData, connectionType, executeData, closeFunctions, abortSignal);
|
|
30
60
|
if (!connectedNodeType.supplyData) {
|
|
31
61
|
if (connectedNodeType.description.outputs.includes(n8n_workflow_1.NodeConnectionTypes.AiTool)) {
|
|
32
|
-
let toolRunIndex = 0;
|
|
33
62
|
const supplyData = (0, create_node_as_tool_1.createNodeAsTool)({
|
|
34
63
|
node: connectedNode,
|
|
35
64
|
nodeType: connectedNodeType,
|
|
36
|
-
handleToolInvocation:
|
|
37
|
-
const runIndex = toolRunIndex++;
|
|
38
|
-
const context = contextFactory(runIndex, {});
|
|
39
|
-
context.addInputData(n8n_workflow_1.NodeConnectionTypes.AiTool, [[{ json: toolArgs }]]);
|
|
40
|
-
try {
|
|
41
|
-
const result = await connectedNodeType.execute?.call(context);
|
|
42
|
-
const mappedResults = result?.[0]?.flatMap((item) => item.json);
|
|
43
|
-
context.addOutputData(n8n_workflow_1.NodeConnectionTypes.AiTool, runIndex, [
|
|
44
|
-
[{ json: { response: mappedResults } }],
|
|
45
|
-
]);
|
|
46
|
-
return JSON.stringify(mappedResults);
|
|
47
|
-
}
|
|
48
|
-
catch (error) {
|
|
49
|
-
const nodeError = new n8n_workflow_1.NodeOperationError(connectedNode, error);
|
|
50
|
-
context.addOutputData(n8n_workflow_1.NodeConnectionTypes.AiTool, runIndex, nodeError);
|
|
51
|
-
return 'Error during node execution: ' + nodeError.description;
|
|
52
|
-
}
|
|
53
|
-
},
|
|
65
|
+
handleToolInvocation: makeHandleToolInvocation((i) => contextFactory(i, {}), connectedNode, connectedNodeType),
|
|
54
66
|
});
|
|
55
67
|
nodes.push(supplyData);
|
|
56
68
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-input-connection-data.js","sourceRoot":"","sources":["../../../../src/execution-engine/node-execution-context/utils/get-input-connection-data.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"get-input-connection-data.js","sourceRoot":"","sources":["../../../../src/execution-engine/node-execution-context/utils/get-input-connection-data.ts"],"names":[],"mappings":";;AA8BA,4DA8CC;AAED,wDAkIC;AA9LD,+CAKsB;AAEtB,+DAAyD;AAGzD,0FAAqF;AAErF,SAAgB,wBAAwB,CACvC,cAA0D,EAC1D,IAAW,EACX,QAAmB;IAMnB,IAAI,YAAY,GAAG,CAAC,CAAC;IACrB,OAAO,KAAK,EAAE,QAAqB,EAAE,EAAE;QACtC,MAAM,QAAQ,GAAG,YAAY,EAAE,CAAC;QAChC,MAAM,OAAO,GAAG,cAAc,CAAC,QAAQ,CAAC,CAAC;QACzC,OAAO,CAAC,YAAY,CAAC,kCAAmB,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC;QAEzE,IAAI,CAAC;YAEJ,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,OAAuC,CAAC,CAAC;YAGrF,MAAM,aAAa,GAAG,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAChE,IAAI,QAAQ,GAAkC,aAAa,CAAC;YAG5D,IAAI,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC;gBAClD,IAAI,CAAC,aAAa,IAAI,aAAa,CAAC,OAAO,CA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,aAAa,EAAE,KAAK,EAAE;wBACpD,SAAS;qBACT,CAAC,CAAC;gBACJ,CAAC;gBAED,IAAI,mBAAmB,GAAG,CAAC,CAAC;gBAC5B,IAAI,gBAAgB,CAAC,UAAU,CAAC,OAAO,CAAC,cAAc,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;oBACzE,mBAAmB,GAAG,gBAAgB,CAAC,UAAU,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC;gBACnF,CAAC;gBAGD,MAAM,OAAO,CAAC,yBAAyB,CACtC,OAAO,EACP,KAAK,EACL,cAAc,EACd,UAAU,CAAC,IAAI,EACf,mBAAmB,CACnB,CAAC;gBAGF,MAAM,IAAI,iCAAkB,CAAC,aAAa,EAAE,qBAAqB,aAAa,CAAC,IAAI,EAAE,EAAE;oBACtF,SAAS;oBACT,aAAa,EAAE,oBAAoB;oBAEnC,WAAW,EAAE,KAAK,CAAC,OAAO;iBAC1B,CAAC,CAAC;YACJ,CAAC;QACF,CAAC;IACF,CAAC;IAED,OAAO,kBAAkB,CAAC,cAAc,KAAK,CAAC;QAC7C,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,QAAQ;QAC5B,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AACvC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.85.0",
|
|
4
4
|
"description": "Core functionality of n8n",
|
|
5
5
|
"main": "dist/index",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -54,8 +54,8 @@
|
|
|
54
54
|
"zod": "3.24.1",
|
|
55
55
|
"@n8n/client-oauth2": "0.23.0",
|
|
56
56
|
"@n8n/config": "1.33.0",
|
|
57
|
-
"n8n
|
|
58
|
-
"
|
|
57
|
+
"@n8n/di": "0.4.0",
|
|
58
|
+
"n8n-workflow": "1.84.0"
|
|
59
59
|
},
|
|
60
60
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
61
61
|
"homepage": "https://n8n.io",
|