@n8n/ai-workflow-builder 1.1.3 → 1.2.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/ai-workflow-builder-agent.service.d.ts +1 -0
- package/dist/ai-workflow-builder-agent.service.js +3 -0
- package/dist/ai-workflow-builder-agent.service.js.map +1 -1
- package/dist/build.tsbuildinfo +1 -1
- package/dist/multi-agent-workflow-subgraphs.d.ts +4 -4
- package/dist/multi-agent-workflow-subgraphs.js +7 -1
- package/dist/multi-agent-workflow-subgraphs.js.map +1 -1
- package/dist/parent-graph-state.d.ts +2 -2
- package/dist/parent-graph-state.js +3 -3
- package/dist/parent-graph-state.js.map +1 -1
- package/dist/prompts/agents/builder.prompt.js +88 -16
- package/dist/prompts/agents/builder.prompt.js.map +1 -1
- package/dist/prompts/agents/configurator.prompt.js +21 -3
- package/dist/prompts/agents/configurator.prompt.js.map +1 -1
- package/dist/prompts/agents/discovery.prompt.js +2 -1
- package/dist/prompts/agents/discovery.prompt.js.map +1 -1
- package/dist/prompts/chains/parameter-updater/guides/embedding-nodes.d.ts +2 -0
- package/dist/prompts/chains/parameter-updater/guides/embedding-nodes.js +70 -0
- package/dist/prompts/chains/parameter-updater/guides/embedding-nodes.js.map +1 -0
- package/dist/prompts/chains/parameter-updater/guides/index.d.ts +1 -0
- package/dist/prompts/chains/parameter-updater/guides/index.js +3 -1
- package/dist/prompts/chains/parameter-updater/guides/index.js.map +1 -1
- package/dist/prompts/chains/parameter-updater/registry.js +1 -0
- package/dist/prompts/chains/parameter-updater/registry.js.map +1 -1
- package/dist/session-manager.service.d.ts +1 -0
- package/dist/session-manager.service.js +55 -4
- package/dist/session-manager.service.js.map +1 -1
- package/dist/subgraphs/builder.subgraph.d.ts +11 -1
- package/dist/subgraphs/builder.subgraph.js +13 -1
- package/dist/subgraphs/builder.subgraph.js.map +1 -1
- package/dist/subgraphs/configurator.subgraph.d.ts +11 -1
- package/dist/subgraphs/configurator.subgraph.js +13 -1
- package/dist/subgraphs/configurator.subgraph.js.map +1 -1
- package/dist/subgraphs/discovery.subgraph.d.ts +9 -9
- package/dist/subgraphs/discovery.subgraph.js +6 -8
- package/dist/subgraphs/discovery.subgraph.js.map +1 -1
- package/dist/tools/best-practices/data-extraction.js +11 -1
- package/dist/tools/best-practices/data-extraction.js.map +1 -1
- package/dist/tools/best-practices/document-processing.js +12 -1
- package/dist/tools/best-practices/document-processing.js.map +1 -1
- package/dist/tools/best-practices/scraping-and-research.js +10 -0
- package/dist/tools/best-practices/scraping-and-research.js.map +1 -1
- package/dist/tools/builder-tools.js +1 -1
- package/dist/tools/builder-tools.js.map +1 -1
- package/dist/tools/get-node-examples.tool.d.ts +119 -0
- package/dist/tools/get-node-examples.tool.js +189 -0
- package/dist/tools/get-node-examples.tool.js.map +1 -0
- package/dist/tools/get-workflow-examples.tool.js +8 -42
- package/dist/tools/get-workflow-examples.tool.js.map +1 -1
- package/dist/tools/node-details.tool.d.ts +2 -1
- package/dist/tools/node-details.tool.js +48 -18
- package/dist/tools/node-details.tool.js.map +1 -1
- package/dist/tools/utils/{markdown-workflow.utils.d.ts → mermaid.utils.d.ts} +0 -1
- package/dist/tools/utils/mermaid.utils.js +647 -0
- package/dist/tools/utils/mermaid.utils.js.map +1 -0
- package/dist/tools/utils/node-configuration.utils.d.ts +13 -0
- package/dist/tools/utils/node-configuration.utils.js +75 -0
- package/dist/tools/utils/node-configuration.utils.js.map +1 -0
- package/dist/tools/utils/test/workflows/ai-assistant.workflow.js +1 -0
- package/dist/tools/utils/test/workflows/ai-assistant.workflow.js.map +1 -1
- package/dist/tools/web/templates.d.ts +17 -1
- package/dist/tools/web/templates.js +35 -0
- package/dist/tools/web/templates.js.map +1 -1
- package/dist/types/discovery-types.d.ts +0 -2
- package/dist/types/tools.d.ts +6 -1
- package/dist/types/web/templates.d.ts +1 -0
- package/dist/utils/state-reducers.d.ts +2 -3
- package/dist/utils/state-reducers.js +10 -15
- package/dist/utils/state-reducers.js.map +1 -1
- package/dist/utils/stream-processor.js +10 -1
- package/dist/utils/stream-processor.js.map +1 -1
- package/dist/utils/subgraph-helpers.d.ts +2 -2
- package/dist/utils/subgraph-helpers.js +8 -9
- package/dist/utils/subgraph-helpers.js.map +1 -1
- package/dist/utils/tool-executor.js +4 -18
- package/dist/utils/tool-executor.js.map +1 -1
- package/dist/validation/checks/from-ai.js +3 -1
- package/dist/validation/checks/from-ai.js.map +1 -1
- package/dist/validation/checks/nodes.js +10 -2
- package/dist/validation/checks/nodes.js.map +1 -1
- package/dist/validation/checks/tools.js +3 -1
- package/dist/validation/checks/tools.js.map +1 -1
- package/dist/validation/checks/trigger.js +3 -1
- package/dist/validation/checks/trigger.js.map +1 -1
- package/dist/workflow-builder-agent.d.ts +1 -0
- package/dist/workflow-builder-agent.js +8 -1
- package/dist/workflow-builder-agent.js.map +1 -1
- package/dist/workflow-state.d.ts +2 -2
- package/dist/workflow-state.js +4 -4
- package/dist/workflow-state.js.map +1 -1
- package/package.json +5 -5
- package/dist/tools/utils/markdown-workflow.utils.js +0 -174
- package/dist/tools/utils/markdown-workflow.utils.js.map +0 -1
|
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+IjC,CAAC;IAED,gBAAgB;QACf,OAAO,IAAI,CAAC,aAAa,CAAC;IAC3B,CAAC;CACD;AAxJD,4EAwJC"}
|
|
@@ -22,7 +22,7 @@ function getBuilderTools({ parsedNodeTypes, logger, llmComplexTask, instanceUrl,
|
|
|
22
22
|
if (featureFlags?.templateExamples === true) {
|
|
23
23
|
tools.push((0, get_workflow_examples_tool_1.createGetWorkflowExamplesTool)(logger));
|
|
24
24
|
}
|
|
25
|
-
tools.push((0, node_search_tool_1.createNodeSearchTool)(parsedNodeTypes), (0, node_details_tool_1.createNodeDetailsTool)(parsedNodeTypes), (0, add_node_tool_1.createAddNodeTool)(parsedNodeTypes), (0, connect_nodes_tool_1.createConnectNodesTool)(parsedNodeTypes, logger), (0, remove_connection_tool_1.createRemoveConnectionTool)(logger), (0, remove_node_tool_1.createRemoveNodeTool)(logger), (0, update_node_parameters_tool_1.createUpdateNodeParametersTool)(parsedNodeTypes, llmComplexTask, logger, instanceUrl), (0, get_node_parameter_tool_1.createGetNodeParameterTool)(), (0, validate_workflow_tool_1.createValidateWorkflowTool)(parsedNodeTypes, logger));
|
|
25
|
+
tools.push((0, node_search_tool_1.createNodeSearchTool)(parsedNodeTypes), (0, node_details_tool_1.createNodeDetailsTool)(parsedNodeTypes, logger), (0, add_node_tool_1.createAddNodeTool)(parsedNodeTypes), (0, connect_nodes_tool_1.createConnectNodesTool)(parsedNodeTypes, logger), (0, remove_connection_tool_1.createRemoveConnectionTool)(logger), (0, remove_node_tool_1.createRemoveNodeTool)(logger), (0, update_node_parameters_tool_1.createUpdateNodeParametersTool)(parsedNodeTypes, llmComplexTask, logger, instanceUrl), (0, get_node_parameter_tool_1.createGetNodeParameterTool)(), (0, validate_workflow_tool_1.createValidateWorkflowTool)(parsedNodeTypes, logger));
|
|
26
26
|
return tools;
|
|
27
27
|
}
|
|
28
28
|
function getBuilderToolsForDisplay({ nodeTypes, featureFlags, }) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builder-tools.js","sourceRoot":"","sources":["../../src/tools/builder-tools.ts"],"names":[],"mappings":";;AA0BA,0CAsCC;AAOD,8DA6BC;AA7FD,mDAAwE;AACxE,qEAA8F;AAC9F,6DAAkF;AAClF,uEAAgG;AAChG,uEAAgG;AAChG,6EAGsC;AACtC,2DAA+E;AAC/E,yDAA4E;AAC5E,qEAA8F;AAC9F,yDAA4E;AAC5E,+EAGuC;AACvC,qEAA8F;AAE9F,SAAgB,eAAe,CAAC,EAC/B,eAAe,EACf,MAAM,EACN,cAAc,EACd,WAAW,EACX,YAAY,GAOZ;IACA,MAAM,KAAK,GAAkB;QAC5B,IAAA,mDAA0B,EAAC,cAAc,EAAE,MAAM,CAAC;QAClD,IAAA,oDAA0B,GAAE;KAC5B,CAAC;IAIF,IAAI,YAAY,EAAE,gBAAgB,KAAK,IAAI,EAAE,CAAC;QAC7C,KAAK,CAAC,IAAI,CAAC,IAAA,0DAA6B,EAAC,MAAM,CAAC,CAAC,CAAC;IACnD,CAAC;IAGD,KAAK,CAAC,IAAI,CACT,IAAA,uCAAoB,EAAC,eAAe,CAAC,EACrC,IAAA,yCAAqB,EAAC,eAAe,CAAC,
|
|
1
|
+
{"version":3,"file":"builder-tools.js","sourceRoot":"","sources":["../../src/tools/builder-tools.ts"],"names":[],"mappings":";;AA0BA,0CAsCC;AAOD,8DA6BC;AA7FD,mDAAwE;AACxE,qEAA8F;AAC9F,6DAAkF;AAClF,uEAAgG;AAChG,uEAAgG;AAChG,6EAGsC;AACtC,2DAA+E;AAC/E,yDAA4E;AAC5E,qEAA8F;AAC9F,yDAA4E;AAC5E,+EAGuC;AACvC,qEAA8F;AAE9F,SAAgB,eAAe,CAAC,EAC/B,eAAe,EACf,MAAM,EACN,cAAc,EACd,WAAW,EACX,YAAY,GAOZ;IACA,M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
|
|
1
|
+
import type { Logger } from '@n8n/backend-common';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
export type NodeExampleType = 'configuration' | 'connections';
|
|
4
|
+
interface CreateNodeExamplesToolOptions {
|
|
5
|
+
exampleType: NodeExampleType;
|
|
6
|
+
logger?: Logger;
|
|
7
|
+
}
|
|
8
|
+
export declare function createGetNodeExamplesTool({ exampleType, logger }: CreateNodeExamplesToolOptions): {
|
|
9
|
+
toolName: string;
|
|
10
|
+
displayTitle: string;
|
|
11
|
+
getCustomDisplayTitle?: (values: Record<string, unknown>) => string;
|
|
12
|
+
tool: import("@langchain/core/tools").DynamicStructuredTool<z.ZodObject<{
|
|
13
|
+
nodes: z.ZodArray<z.ZodObject<{
|
|
14
|
+
nodeType: z.ZodString;
|
|
15
|
+
nodeVersion: z.ZodOptional<z.ZodNumber>;
|
|
16
|
+
}, "strip", z.ZodTypeAny, {
|
|
17
|
+
nodeType: string;
|
|
18
|
+
nodeVersion?: number | undefined;
|
|
19
|
+
}, {
|
|
20
|
+
nodeType: string;
|
|
21
|
+
nodeVersion?: number | undefined;
|
|
22
|
+
}>, "many">;
|
|
23
|
+
}, "strip", z.ZodTypeAny, {
|
|
24
|
+
nodes: {
|
|
25
|
+
nodeType: string;
|
|
26
|
+
nodeVersion?: number | undefined;
|
|
27
|
+
}[];
|
|
28
|
+
}, {
|
|
29
|
+
nodes: {
|
|
30
|
+
nodeType: string;
|
|
31
|
+
nodeVersion?: number | undefined;
|
|
32
|
+
}[];
|
|
33
|
+
}>, {
|
|
34
|
+
nodes: {
|
|
35
|
+
nodeType: string;
|
|
36
|
+
nodeVersion?: number | undefined;
|
|
37
|
+
}[];
|
|
38
|
+
}, {
|
|
39
|
+
nodes: {
|
|
40
|
+
nodeType: string;
|
|
41
|
+
nodeVersion?: number | undefined;
|
|
42
|
+
}[];
|
|
43
|
+
}, import("@langchain/langgraph").Command<unknown, Record<string, unknown>, string>>;
|
|
44
|
+
};
|
|
45
|
+
export declare const createGetNodeConfigurationExamplesTool: (logger?: Logger) => {
|
|
46
|
+
toolName: string;
|
|
47
|
+
displayTitle: string;
|
|
48
|
+
getCustomDisplayTitle?: (values: Record<string, unknown>) => string;
|
|
49
|
+
tool: import("@langchain/core/tools").DynamicStructuredTool<z.ZodObject<{
|
|
50
|
+
nodes: z.ZodArray<z.ZodObject<{
|
|
51
|
+
nodeType: z.ZodString;
|
|
52
|
+
nodeVersion: z.ZodOptional<z.ZodNumber>;
|
|
53
|
+
}, "strip", z.ZodTypeAny, {
|
|
54
|
+
nodeType: string;
|
|
55
|
+
nodeVersion?: number | undefined;
|
|
56
|
+
}, {
|
|
57
|
+
nodeType: string;
|
|
58
|
+
nodeVersion?: number | undefined;
|
|
59
|
+
}>, "many">;
|
|
60
|
+
}, "strip", z.ZodTypeAny, {
|
|
61
|
+
nodes: {
|
|
62
|
+
nodeType: string;
|
|
63
|
+
nodeVersion?: number | undefined;
|
|
64
|
+
}[];
|
|
65
|
+
}, {
|
|
66
|
+
nodes: {
|
|
67
|
+
nodeType: string;
|
|
68
|
+
nodeVersion?: number | undefined;
|
|
69
|
+
}[];
|
|
70
|
+
}>, {
|
|
71
|
+
nodes: {
|
|
72
|
+
nodeType: string;
|
|
73
|
+
nodeVersion?: number | undefined;
|
|
74
|
+
}[];
|
|
75
|
+
}, {
|
|
76
|
+
nodes: {
|
|
77
|
+
nodeType: string;
|
|
78
|
+
nodeVersion?: number | undefined;
|
|
79
|
+
}[];
|
|
80
|
+
}, import("@langchain/langgraph").Command<unknown, Record<string, unknown>, string>>;
|
|
81
|
+
};
|
|
82
|
+
export declare const createGetNodeConnectionExamplesTool: (logger?: Logger) => {
|
|
83
|
+
toolName: string;
|
|
84
|
+
displayTitle: string;
|
|
85
|
+
getCustomDisplayTitle?: (values: Record<string, unknown>) => string;
|
|
86
|
+
tool: import("@langchain/core/tools").DynamicStructuredTool<z.ZodObject<{
|
|
87
|
+
nodes: z.ZodArray<z.ZodObject<{
|
|
88
|
+
nodeType: z.ZodString;
|
|
89
|
+
nodeVersion: z.ZodOptional<z.ZodNumber>;
|
|
90
|
+
}, "strip", z.ZodTypeAny, {
|
|
91
|
+
nodeType: string;
|
|
92
|
+
nodeVersion?: number | undefined;
|
|
93
|
+
}, {
|
|
94
|
+
nodeType: string;
|
|
95
|
+
nodeVersion?: number | undefined;
|
|
96
|
+
}>, "many">;
|
|
97
|
+
}, "strip", z.ZodTypeAny, {
|
|
98
|
+
nodes: {
|
|
99
|
+
nodeType: string;
|
|
100
|
+
nodeVersion?: number | undefined;
|
|
101
|
+
}[];
|
|
102
|
+
}, {
|
|
103
|
+
nodes: {
|
|
104
|
+
nodeType: string;
|
|
105
|
+
nodeVersion?: number | undefined;
|
|
106
|
+
}[];
|
|
107
|
+
}>, {
|
|
108
|
+
nodes: {
|
|
109
|
+
nodeType: string;
|
|
110
|
+
nodeVersion?: number | undefined;
|
|
111
|
+
}[];
|
|
112
|
+
}, {
|
|
113
|
+
nodes: {
|
|
114
|
+
nodeType: string;
|
|
115
|
+
nodeVersion?: number | undefined;
|
|
116
|
+
}[];
|
|
117
|
+
}, import("@langchain/langgraph").Command<unknown, Record<string, unknown>, string>>;
|
|
118
|
+
};
|
|
119
|
+
export {};
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createGetNodeConnectionExamplesTool = exports.createGetNodeConfigurationExamplesTool = void 0;
|
|
4
|
+
exports.createGetNodeExamplesTool = createGetNodeExamplesTool;
|
|
5
|
+
const tools_1 = require("@langchain/core/tools");
|
|
6
|
+
const zod_1 = require("zod");
|
|
7
|
+
const errors_1 = require("../errors");
|
|
8
|
+
const helpers_1 = require("./helpers");
|
|
9
|
+
const mermaid_utils_1 = require("./utils/mermaid.utils");
|
|
10
|
+
const node_configuration_utils_1 = require("./utils/node-configuration.utils");
|
|
11
|
+
const templates_1 = require("./web/templates");
|
|
12
|
+
const nodeRequestSchema = zod_1.z.object({
|
|
13
|
+
nodeType: zod_1.z.string().describe('The exact node type name (e.g., n8n-nodes-base.httpRequest)'),
|
|
14
|
+
nodeVersion: zod_1.z
|
|
15
|
+
.number()
|
|
16
|
+
.optional()
|
|
17
|
+
.describe('Optional specific node version to filter examples by'),
|
|
18
|
+
});
|
|
19
|
+
const getNodeExamplesSchema = zod_1.z.object({
|
|
20
|
+
nodes: zod_1.z
|
|
21
|
+
.array(nodeRequestSchema)
|
|
22
|
+
.min(1)
|
|
23
|
+
.max(10)
|
|
24
|
+
.describe('List of nodes to get examples for (1-10 nodes)'),
|
|
25
|
+
});
|
|
26
|
+
const TOOL_CONFIG = {
|
|
27
|
+
configuration: {
|
|
28
|
+
meta: {
|
|
29
|
+
toolName: 'get_node_configuration_examples',
|
|
30
|
+
displayTitle: 'Getting node configuration examples',
|
|
31
|
+
},
|
|
32
|
+
description: `Get real-world parameter configuration examples for multiple node types from community templates.
|
|
33
|
+
|
|
34
|
+
Use this tool when you need reference examples for configuring node parameters:
|
|
35
|
+
- When you need to understand proper parameter structure
|
|
36
|
+
- To see how templated workflows configure specific integrations
|
|
37
|
+
|
|
38
|
+
Parameters:
|
|
39
|
+
- nodes: Array of objects with nodeType (required) and nodeVersion (optional)
|
|
40
|
+
Example: [{ nodeType: "n8n-nodes-base.httpRequest" }, { nodeType: "n8n-nodes-base.gmail", nodeVersion: 2 }]
|
|
41
|
+
|
|
42
|
+
Returns markdown-formatted examples showing proven parameter configurations for each node.`,
|
|
43
|
+
},
|
|
44
|
+
connections: {
|
|
45
|
+
meta: {
|
|
46
|
+
toolName: 'get_node_connection_examples',
|
|
47
|
+
displayTitle: 'Getting node connection examples',
|
|
48
|
+
},
|
|
49
|
+
description: `Get mermaid diagrams showing how specific node types are typically connected in real workflows.
|
|
50
|
+
|
|
51
|
+
Use this tool when you need to understand node connection patterns:
|
|
52
|
+
- When connecting nodes with non-standard output patterns (e.g., splitInBatches, Switch, IF)
|
|
53
|
+
- To see how nodes are typically placed in workflow flows
|
|
54
|
+
- To understand which nodes typically come before/after specific nodes
|
|
55
|
+
|
|
56
|
+
Parameters:
|
|
57
|
+
- nodes: Array of objects with nodeType (required) and nodeVersion (optional)
|
|
58
|
+
Example: [{ nodeType: "n8n-nodes-base.splitInBatches" }, { nodeType: "n8n-nodes-base.if" }]
|
|
59
|
+
|
|
60
|
+
Returns mermaid diagrams from community workflows containing each node.`,
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
async function getWorkflowsForNodeType(nodeType, logger) {
|
|
64
|
+
let stateCachedTemplates = [];
|
|
65
|
+
try {
|
|
66
|
+
const state = (0, helpers_1.getWorkflowState)();
|
|
67
|
+
stateCachedTemplates = state?.cachedTemplates ?? [];
|
|
68
|
+
}
|
|
69
|
+
catch {
|
|
70
|
+
}
|
|
71
|
+
const relevantFromState = stateCachedTemplates.filter((wf) => wf.workflow.nodes.some((n) => n.type === nodeType));
|
|
72
|
+
if (relevantFromState.length > 0) {
|
|
73
|
+
const nodeConfigs = (0, node_configuration_utils_1.getNodeConfigurationsFromTemplates)(relevantFromState, nodeType);
|
|
74
|
+
logger?.debug('Found node configurations in state cache', {
|
|
75
|
+
nodeType,
|
|
76
|
+
configCount: nodeConfigs.length,
|
|
77
|
+
workflowCount: relevantFromState.length,
|
|
78
|
+
});
|
|
79
|
+
return {
|
|
80
|
+
workflows: relevantFromState,
|
|
81
|
+
nodeConfigs,
|
|
82
|
+
newTemplates: [],
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
try {
|
|
86
|
+
const result = await (0, templates_1.fetchWorkflowsFromTemplates)({ nodes: nodeType, rows: 5 }, { maxTemplates: 5, logger });
|
|
87
|
+
if (result.workflows.length > 0) {
|
|
88
|
+
const nodeConfigs = (0, node_configuration_utils_1.getNodeConfigurationsFromTemplates)(result.workflows, nodeType);
|
|
89
|
+
logger?.debug('Fetched workflows from templates API', {
|
|
90
|
+
nodeType,
|
|
91
|
+
configCount: nodeConfigs.length,
|
|
92
|
+
workflowCount: result.workflows.length,
|
|
93
|
+
});
|
|
94
|
+
return {
|
|
95
|
+
workflows: result.workflows,
|
|
96
|
+
nodeConfigs,
|
|
97
|
+
newTemplates: result.workflows,
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
catch (error) {
|
|
102
|
+
logger?.warn('Failed to fetch node examples from templates', { nodeType, error });
|
|
103
|
+
}
|
|
104
|
+
return {
|
|
105
|
+
workflows: [],
|
|
106
|
+
nodeConfigs: [],
|
|
107
|
+
newTemplates: [],
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
const MAX_EXAMPLES = 1;
|
|
111
|
+
function formatConnectionExamples(nodeType, workflows) {
|
|
112
|
+
const shortNodeType = nodeType.split('.').pop() ?? nodeType;
|
|
113
|
+
if (workflows.length === 0) {
|
|
114
|
+
return `## Node Connection Examples: ${nodeType}\n\nNo connection examples found.`;
|
|
115
|
+
}
|
|
116
|
+
const lines = [
|
|
117
|
+
`## Node Connection Examples: ${nodeType}`,
|
|
118
|
+
'',
|
|
119
|
+
`These mermaid diagrams show workflows containing **${shortNodeType}**.`,
|
|
120
|
+
'',
|
|
121
|
+
'Look for the target node in each diagram to understand:',
|
|
122
|
+
'- Which nodes typically come BEFORE this node (incoming connections)',
|
|
123
|
+
'- Which nodes typically come AFTER this node (outgoing connections)',
|
|
124
|
+
'- For multi-output nodes like splitInBatches: output 0 = "done" branch, output 1 = "loop" branch',
|
|
125
|
+
'',
|
|
126
|
+
];
|
|
127
|
+
for (const workflow of workflows.slice(0, MAX_EXAMPLES)) {
|
|
128
|
+
const mermaid = (0, mermaid_utils_1.mermaidStringify)(workflow, { includeNodeParameters: false });
|
|
129
|
+
lines.push(`### Example: ${workflow.name}`, '', '```mermaid', mermaid, '```', '');
|
|
130
|
+
}
|
|
131
|
+
return lines.join('\n');
|
|
132
|
+
}
|
|
133
|
+
function handleToolError(error, reporter, toolName, config) {
|
|
134
|
+
if (error instanceof zod_1.z.ZodError) {
|
|
135
|
+
const validationError = new errors_1.ValidationError('Invalid input parameters', {
|
|
136
|
+
extra: { errors: error.errors },
|
|
137
|
+
});
|
|
138
|
+
reporter.error(validationError);
|
|
139
|
+
return (0, helpers_1.createErrorResponse)(config, validationError);
|
|
140
|
+
}
|
|
141
|
+
const toolError = new errors_1.ToolExecutionError(error instanceof Error ? error.message : 'Unknown error occurred', { toolName, cause: error instanceof Error ? error : undefined });
|
|
142
|
+
reporter.error(toolError);
|
|
143
|
+
return (0, helpers_1.createErrorResponse)(config, toolError);
|
|
144
|
+
}
|
|
145
|
+
function createGetNodeExamplesTool({ exampleType, logger }) {
|
|
146
|
+
const { meta: toolMeta, description } = TOOL_CONFIG[exampleType];
|
|
147
|
+
const dynamicTool = (0, tools_1.tool)(async (input, config) => {
|
|
148
|
+
const reporter = (0, helpers_1.createProgressReporter)(config, toolMeta.toolName, toolMeta.displayTitle);
|
|
149
|
+
try {
|
|
150
|
+
const validatedInput = getNodeExamplesSchema.parse(input);
|
|
151
|
+
const { nodes } = validatedInput;
|
|
152
|
+
reporter.start(validatedInput);
|
|
153
|
+
(0, helpers_1.reportProgress)(reporter, `Fetching examples for ${nodes.length} node(s)...`);
|
|
154
|
+
const results = await Promise.all(nodes.map(async ({ nodeType }) => await getWorkflowsForNodeType(nodeType, logger)));
|
|
155
|
+
const allNewTemplates = [];
|
|
156
|
+
let totalFound = 0;
|
|
157
|
+
const allMessages = nodes.map(({ nodeType, nodeVersion }, i) => {
|
|
158
|
+
const result = results[i];
|
|
159
|
+
allNewTemplates.push(...result.newTemplates);
|
|
160
|
+
totalFound +=
|
|
161
|
+
exampleType === 'configuration' ? result.nodeConfigs.length : result.workflows.length;
|
|
162
|
+
return exampleType === 'configuration'
|
|
163
|
+
? (0, node_configuration_utils_1.formatNodeConfigurationExamples)(nodeType, result.nodeConfigs, nodeVersion)
|
|
164
|
+
: formatConnectionExamples(nodeType, result.workflows);
|
|
165
|
+
});
|
|
166
|
+
const combinedMessage = allMessages.join('\n\n---\n\n');
|
|
167
|
+
const nodeTypes = nodes.map((n) => n.nodeType);
|
|
168
|
+
reporter.complete({ nodeTypes, totalFound, message: combinedMessage });
|
|
169
|
+
const stateUpdates = {};
|
|
170
|
+
if (allNewTemplates.length > 0) {
|
|
171
|
+
stateUpdates.cachedTemplates = allNewTemplates;
|
|
172
|
+
}
|
|
173
|
+
return (0, helpers_1.createSuccessResponse)(config, combinedMessage, Object.keys(stateUpdates).length > 0 ? stateUpdates : undefined);
|
|
174
|
+
}
|
|
175
|
+
catch (error) {
|
|
176
|
+
return handleToolError(error, reporter, toolMeta.toolName, config);
|
|
177
|
+
}
|
|
178
|
+
}, {
|
|
179
|
+
name: toolMeta.toolName,
|
|
180
|
+
description,
|
|
181
|
+
schema: getNodeExamplesSchema,
|
|
182
|
+
});
|
|
183
|
+
return { tool: dynamicTool, ...toolMeta };
|
|
184
|
+
}
|
|
185
|
+
const createGetNodeConfigurationExamplesTool = (logger) => createGetNodeExamplesTool({ exampleType: 'configuration', logger });
|
|
186
|
+
exports.createGetNodeConfigurationExamplesTool = createGetNodeConfigurationExamplesTool;
|
|
187
|
+
const createGetNodeConnectionExamplesTool = (logger) => createGetNodeExamplesTool({ exampleType: 'connections', logger });
|
|
188
|
+
exports.createGetNodeConnectionExamplesTool = createGetNodeConnectionExamplesTool;
|
|
189
|
+
//# sourceMappingURL=get-node-examples.tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-node-examples.tool.js","sourceRoot":"","sources":["../../src/tools/get-node-examples.tool.ts"],"names":[],"mappings":";;;AAwOA,8DAgEC;AAxSD,iDAA6C;AAE7C,6BAAwB;AAKxB,sCAAgE;AAChE,uCAMmB;AACnB,yDAAyD;AACzD,+EAG0C;AAE1C,+CAA8D;AAK9D,MAAM,iBAAiB,GAAG,OAAC,CAAC,MAAM,CAAC;IAClC,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,6DAA6D,CAAC;IAC5F,WAAW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AQ,EAAE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QACpE,CAAC;IACF,CAAC,EACD;QACC,IAAI,EAAE,QAAQ,CAAC,QAAQ;QACvB,WAAW;QACX,MAAM,EAAE,qBAAqB;KAC7B,CACD,CAAC;IAEF,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,GAAG,QAAQ,EAAE,CAAC;AAC3C,CAAC;AAGM,MAAM,sCAAsC,GAAG,CAAC,MAAe,EAAE,EAAE,CACzE,yBAAyB,CAAC,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,EAAE,CAAC,CAAC;AADxD,QAAA,sCAAsC,0CACkB;AAE9D,MAAM,mCAAmC,GAAG,CAAC,MAAe,EAAE,EAAE,CACtE,yBAAyB,CAAC,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,EAAE,CAAC,CAAC;AADtD,QAAA,mCAAmC,uCACmB"}
|
|
@@ -6,7 +6,7 @@ const tools_1 = require("@langchain/core/tools");
|
|
|
6
6
|
const zod_1 = require("zod");
|
|
7
7
|
const errors_1 = require("../errors");
|
|
8
8
|
const helpers_1 = require("./helpers");
|
|
9
|
-
const
|
|
9
|
+
const mermaid_utils_1 = require("./utils/mermaid.utils");
|
|
10
10
|
const templates_1 = require("./web/templates");
|
|
11
11
|
const workflowExampleQuerySchema = zod_1.z.object({
|
|
12
12
|
search: zod_1.z.string().optional().describe('Search term to find workflow examples'),
|
|
@@ -17,35 +17,6 @@ const getWorkflowExamplesSchema = zod_1.z.object({
|
|
|
17
17
|
.min(1)
|
|
18
18
|
.describe('Array of search queries to find workflow examples'),
|
|
19
19
|
});
|
|
20
|
-
async function fetchWorkflowExamples(query, logger) {
|
|
21
|
-
logger?.debug('Fetching workflow examples with query', { query });
|
|
22
|
-
const response = await (0, templates_1.fetchTemplateList)({
|
|
23
|
-
search: query.search,
|
|
24
|
-
});
|
|
25
|
-
const workflowResults = await Promise.all(response.workflows.map(async (workflow) => {
|
|
26
|
-
try {
|
|
27
|
-
const fullWorkflow = await (0, templates_1.fetchTemplateByID)(workflow.id);
|
|
28
|
-
return {
|
|
29
|
-
metadata: {
|
|
30
|
-
name: workflow.name,
|
|
31
|
-
description: workflow.description,
|
|
32
|
-
workflow: fullWorkflow.workflow,
|
|
33
|
-
},
|
|
34
|
-
templateId: workflow.id,
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
catch (error) {
|
|
38
|
-
logger?.warn(`Failed to fetch full workflow for template ${workflow.id}`, { error });
|
|
39
|
-
return undefined;
|
|
40
|
-
}
|
|
41
|
-
}));
|
|
42
|
-
const validResults = workflowResults.filter((result) => result !== undefined);
|
|
43
|
-
return {
|
|
44
|
-
workflows: validResults.map((r) => r.metadata),
|
|
45
|
-
totalFound: response.totalWorkflows,
|
|
46
|
-
templateIds: validResults.map((r) => r.templateId),
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
20
|
function buildQueryIdentifier(query) {
|
|
50
21
|
const parts = [];
|
|
51
22
|
if (query.search) {
|
|
@@ -99,7 +70,7 @@ function createGetWorkflowExamplesTool(logger) {
|
|
|
99
70
|
const identifier = buildQueryIdentifier(query);
|
|
100
71
|
try {
|
|
101
72
|
batchReporter.next(identifier);
|
|
102
|
-
const result = await
|
|
73
|
+
const result = await (0, templates_1.fetchWorkflowsFromTemplates)({ search: query.search }, { logger });
|
|
103
74
|
allResults = allResults.concat(result.workflows);
|
|
104
75
|
allTemplateIds = allTemplateIds.concat(result.templateIds);
|
|
105
76
|
}
|
|
@@ -115,17 +86,9 @@ function createGetWorkflowExamplesTool(logger) {
|
|
|
115
86
|
}
|
|
116
87
|
}
|
|
117
88
|
const deduplicatedResults = Array.from(uniqueWorkflows.values());
|
|
118
|
-
const processedResults = (0,
|
|
89
|
+
const processedResults = (0, mermaid_utils_1.processWorkflowExamples)(deduplicatedResults, {
|
|
119
90
|
includeNodeParameters: false,
|
|
120
91
|
});
|
|
121
|
-
const nodeConfigurations = processedResults.length > 0
|
|
122
|
-
? processedResults[processedResults.length - 1].nodeConfigurations
|
|
123
|
-
: {};
|
|
124
|
-
logger?.debug('Collected node configurations from workflow examples', {
|
|
125
|
-
nodeTypeCount: Object.keys(nodeConfigurations).length,
|
|
126
|
-
nodeTypes: Object.keys(nodeConfigurations),
|
|
127
|
-
configCounts: Object.fromEntries(Object.entries(nodeConfigurations).map(([type, configs]) => [type, configs.length])),
|
|
128
|
-
});
|
|
129
92
|
const formattedResults = deduplicatedResults.map((workflow, index) => ({
|
|
130
93
|
name: workflow.name,
|
|
131
94
|
description: workflow.description,
|
|
@@ -134,14 +97,17 @@ function createGetWorkflowExamplesTool(logger) {
|
|
|
134
97
|
const output = {
|
|
135
98
|
examples: formattedResults,
|
|
136
99
|
totalResults: deduplicatedResults.length,
|
|
137
|
-
nodeConfigurations,
|
|
138
100
|
};
|
|
139
101
|
const responseMessage = buildResponseMessage(output);
|
|
140
102
|
reporter.complete(output);
|
|
141
103
|
const uniqueTemplateIds = [...new Set(allTemplateIds)];
|
|
104
|
+
logger?.debug('Caching workflow templates in state', {
|
|
105
|
+
templateCount: deduplicatedResults.length,
|
|
106
|
+
templateNames: deduplicatedResults.map((w) => w.name),
|
|
107
|
+
});
|
|
142
108
|
return (0, helpers_1.createSuccessResponse)(config, responseMessage, {
|
|
143
|
-
nodeConfigurations,
|
|
144
109
|
templateIds: uniqueTemplateIds,
|
|
110
|
+
cachedTemplates: deduplicatedResults,
|
|
145
111
|
});
|
|
146
112
|
}
|
|
147
113
|
catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-workflow-examples.tool.js","sourceRoot":"","sources":["../../src/tools/get-workflow-examples.tool.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"get-workflow-examples.tool.js","sourceRoot":"","sources":["../../src/tools/get-workflow-examples.tool.ts"],"names":[],"mappings":";;;AA2FA,sEAyHC;AApND,iDAA6C;AAE7C,6BAAwB;AAKxB,sCAAgE;AAChE,uCAKmB;AACnB,yDAAgE;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AAC;IAEF,OAAO;QACN,IAAI,EAAE,WAAW;QACjB,GAAG,kCAA0B;KAC7B,CAAC;AACH,CAAC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import type { Logger } from '@n8n/backend-common';
|
|
1
2
|
import type { INodeTypeDescription } from 'n8n-workflow';
|
|
2
3
|
import { z } from 'zod';
|
|
3
4
|
import type { BuilderToolBase } from '../utils/stream-processor';
|
|
4
5
|
export declare const NODE_DETAILS_TOOL: BuilderToolBase;
|
|
5
|
-
export declare function createNodeDetailsTool(nodeTypes: INodeTypeDescription[]): {
|
|
6
|
+
export declare function createNodeDetailsTool(nodeTypes: INodeTypeDescription[], logger?: Logger): {
|
|
6
7
|
toolName: string;
|
|
7
8
|
displayTitle: string;
|
|
8
9
|
getCustomDisplayTitle?: (values: Record<string, unknown>) => string;
|
|
@@ -10,6 +10,9 @@ const progress_1 = require("./helpers/progress");
|
|
|
10
10
|
const response_1 = require("./helpers/response");
|
|
11
11
|
const state_1 = require("./helpers/state");
|
|
12
12
|
const validation_1 = require("./helpers/validation");
|
|
13
|
+
const node_configuration_utils_1 = require("./utils/node-configuration.utils");
|
|
14
|
+
const templates_1 = require("./web/templates");
|
|
15
|
+
const MAX_NODE_EXAMPLES = 5;
|
|
13
16
|
const nodeDetailsSchema = zod_1.z.object({
|
|
14
17
|
nodeName: zod_1.z.string().describe('The exact node type name (e.g., n8n-nodes-base.httpRequest)'),
|
|
15
18
|
nodeVersion: zod_1.z.number().describe('The exact node version'),
|
|
@@ -76,10 +79,11 @@ function formatNodeDetails(details, withParameters = false, withConnections = tr
|
|
|
76
79
|
parts.push('</connections>');
|
|
77
80
|
}
|
|
78
81
|
if (examples.length > 0) {
|
|
79
|
-
const
|
|
80
|
-
|
|
82
|
+
const limitedExamples = examples.slice(0, MAX_NODE_EXAMPLES);
|
|
83
|
+
const { parts: exampleParts } = limitedExamples.reduce((acc, config) => {
|
|
84
|
+
const exampleStr = JSON.stringify(config.parameters, null, 2);
|
|
81
85
|
if (acc.chars + exampleStr.length <= constants_1.MAX_NODE_EXAMPLE_CHARS) {
|
|
82
|
-
acc.parts.push(exampleStr);
|
|
86
|
+
acc.parts.push(`<example>\n${exampleStr}\n</example>`);
|
|
83
87
|
acc.chars += exampleStr.length;
|
|
84
88
|
}
|
|
85
89
|
return acc;
|
|
@@ -108,8 +112,43 @@ exports.NODE_DETAILS_TOOL = {
|
|
|
108
112
|
toolName: 'get_node_details',
|
|
109
113
|
displayTitle: 'Getting node details',
|
|
110
114
|
};
|
|
111
|
-
function
|
|
112
|
-
|
|
115
|
+
async function getNodeExamples(nodeName, nodeVersion, logger, onProgress) {
|
|
116
|
+
try {
|
|
117
|
+
const state = (0, state_1.getWorkflowState)();
|
|
118
|
+
const cachedTemplates = state?.cachedTemplates ?? [];
|
|
119
|
+
const filteredConfigs = (0, node_configuration_utils_1.getNodeConfigurationsFromTemplates)(cachedTemplates, nodeName, nodeVersion);
|
|
120
|
+
if (filteredConfigs.length > 0) {
|
|
121
|
+
logger?.debug('Found node configurations in cached templates', {
|
|
122
|
+
nodeName,
|
|
123
|
+
nodeVersion,
|
|
124
|
+
count: filteredConfigs.length,
|
|
125
|
+
});
|
|
126
|
+
return { examples: filteredConfigs };
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
catch {
|
|
130
|
+
}
|
|
131
|
+
onProgress?.(`Fetching examples for ${nodeName}...`);
|
|
132
|
+
try {
|
|
133
|
+
const result = await (0, templates_1.fetchWorkflowsFromTemplates)({ nodes: nodeName, rows: 10 }, { maxTemplates: 5, logger });
|
|
134
|
+
if (result.workflows.length > 0) {
|
|
135
|
+
const nodeConfigs = (0, node_configuration_utils_1.getNodeConfigurationsFromTemplates)(result.workflows, nodeName, nodeVersion);
|
|
136
|
+
logger?.debug('Fetched node configurations from templates API', {
|
|
137
|
+
nodeName,
|
|
138
|
+
nodeVersion,
|
|
139
|
+
count: nodeConfigs.length,
|
|
140
|
+
workflowCount: result.workflows.length,
|
|
141
|
+
});
|
|
142
|
+
return { examples: nodeConfigs, newTemplates: result.workflows };
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
catch (error) {
|
|
146
|
+
logger?.warn('Failed to fetch node examples from templates', { nodeName, error });
|
|
147
|
+
}
|
|
148
|
+
return { examples: [] };
|
|
149
|
+
}
|
|
150
|
+
function createNodeDetailsTool(nodeTypes, logger) {
|
|
151
|
+
const dynamicTool = (0, tools_1.tool)(async (input, config) => {
|
|
113
152
|
const reporter = (0, progress_1.createProgressReporter)(config, exports.NODE_DETAILS_TOOL.toolName, exports.NODE_DETAILS_TOOL.displayTitle);
|
|
114
153
|
try {
|
|
115
154
|
const validatedInput = nodeDetailsSchema.parse(input);
|
|
@@ -123,17 +162,7 @@ function createNodeDetailsTool(nodeTypes) {
|
|
|
123
162
|
return (0, response_1.createErrorResponse)(config, error);
|
|
124
163
|
}
|
|
125
164
|
const details = extractNodeDetails(nodeType);
|
|
126
|
-
|
|
127
|
-
try {
|
|
128
|
-
const state = (0, state_1.getWorkflowState)();
|
|
129
|
-
const allNodeConfigs = state?.nodeConfigurations?.[nodeName] ?? [];
|
|
130
|
-
examples = allNodeConfigs
|
|
131
|
-
.filter((config) => config.version === nodeVersion)
|
|
132
|
-
.map((config) => config.parameters);
|
|
133
|
-
}
|
|
134
|
-
catch {
|
|
135
|
-
examples = [];
|
|
136
|
-
}
|
|
165
|
+
const { examples, newTemplates } = await getNodeExamples(nodeName, nodeVersion, logger, (msg) => (0, progress_1.reportProgress)(reporter, msg));
|
|
137
166
|
const message = formatNodeDetails(details, withParameters, withConnections, examples);
|
|
138
167
|
const output = {
|
|
139
168
|
details,
|
|
@@ -141,7 +170,8 @@ function createNodeDetailsTool(nodeTypes) {
|
|
|
141
170
|
message,
|
|
142
171
|
};
|
|
143
172
|
reporter.complete(output);
|
|
144
|
-
|
|
173
|
+
const stateUpdates = newTemplates ? { cachedTemplates: newTemplates } : undefined;
|
|
174
|
+
return (0, response_1.createSuccessResponse)(config, message, stateUpdates);
|
|
145
175
|
}
|
|
146
176
|
catch (error) {
|
|
147
177
|
if (error instanceof zod_1.z.ZodError) {
|
|
@@ -160,7 +190,7 @@ function createNodeDetailsTool(nodeTypes) {
|
|
|
160
190
|
}
|
|
161
191
|
}, {
|
|
162
192
|
name: exports.NODE_DETAILS_TOOL.toolName,
|
|
163
|
-
description: 'Get detailed information about a specific n8n node type including properties and
|
|
193
|
+
description: 'Get detailed information about a specific n8n node type including properties, available connections, and up to 5 example configurations. Use this before adding nodes to understand their input/output structure.',
|
|
164
194
|
schema: nodeDetailsSchema,
|
|
165
195
|
});
|
|
166
196
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-details.tool.js","sourceRoot":"","sources":["../../src/tools/node-details.tool.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"node-details.tool.js","sourceRoot":"","sources":["../../src/tools/node-details.tool.ts"],"names":[],"mappings":";;;AA4OA,sDAwFC;AApUD,iDAA6C;AAG7C,6BAAwB;AAExB,2CAAqD;AAIrD,sCAAgE;AAChE,iDAA4E;AAC5E,iDAAgF;AAChF,2CAAmD;AACnD,qDAAiF;AAGjF,+EAAsF;AACtF,+CAA8D;AAG9D,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAK5B,MAAM,iBAAiB,GAAG,OAAC,CAAC,MAAM,CAAC;IAClC,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,6DAA6D,CAAC;IAC5F,WAAW,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,wBAAwB,CAAC;IAC1D,cAAc,EAAE,OAAC;SACf,OAAO,EAAE;SACT,QAAQ,EAAE;SACV,OAAO,CAAC,KAAK,CAAC;SACd,QAAQ,CAAC,kDAAkD,CAAC;IAC9D,eAAe,EAAE,OAAC;SAChB,OAAO,EAAE;SACT,QAAQ,EAAE;SACV,OAAO,CAAC,IAAI,CAAC;SACb,QAAQ,CAAC,6DAA6D,C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K,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS;aACjD,CACD,CAAC;YACF,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;YAC1B,OAAO,IAAA,8BAAmB,EAAC,MAAM,EAAE,SAAS,CAAC,CAAC;QAC/C,CAAC;IACF,CAAC,EACD;QACC,IAAI,EAAE,yBAAiB,CAAC,QAAQ;QAChC,WAAW,EACV,mNAAmN;QACpN,MAAM,EAAE,iBAAiB;KACzB,CACD,CAAC;IAEF,OAAO;QACN,IAAI,EAAE,WAAW;QACjB,GAAG,yBAAiB;KACpB,CAAC;AACH,CAAC"}
|
|
@@ -11,4 +11,3 @@ export interface MermaidResult {
|
|
|
11
11
|
}
|
|
12
12
|
export declare function mermaidStringify(workflow: WorkflowMetadata, options?: MermaidOptions): string;
|
|
13
13
|
export declare function processWorkflowExamples(workflows: WorkflowMetadata[], options?: Omit<MermaidOptions, 'collectNodeConfigurations'>): MermaidResult[];
|
|
14
|
-
export declare function stickyNotesStringify(workflow: WorkflowMetadata): string;
|