@n8n/ai-workflow-builder 0.32.1 → 0.33.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/agents/responder.agent.d.ts +20 -0
- package/dist/agents/responder.agent.js +95 -0
- package/dist/agents/responder.agent.js.map +1 -0
- package/dist/agents/supervisor.agent.d.ts +30 -0
- package/dist/agents/supervisor.agent.js +99 -0
- package/dist/agents/supervisor.agent.js.map +1 -0
- package/dist/ai-workflow-builder-agent.service.js +4 -0
- package/dist/ai-workflow-builder-agent.service.js.map +1 -1
- package/dist/build.tsbuildinfo +1 -1
- package/dist/constants.d.ts +4 -0
- package/dist/constants.js +5 -1
- package/dist/constants.js.map +1 -1
- package/dist/llm-config.d.ts +1 -0
- package/dist/llm-config.js +20 -1
- package/dist/llm-config.js.map +1 -1
- package/dist/multi-agent-workflow-subgraphs.d.ts +85 -0
- package/dist/multi-agent-workflow-subgraphs.js +121 -0
- package/dist/multi-agent-workflow-subgraphs.js.map +1 -0
- package/dist/parent-graph-state.d.ts +23 -0
- package/dist/parent-graph-state.js +34 -0
- package/dist/parent-graph-state.js.map +1 -0
- package/dist/subgraphs/builder.subgraph.d.ts +120 -0
- package/dist/subgraphs/builder.subgraph.js +322 -0
- package/dist/subgraphs/builder.subgraph.js.map +1 -0
- package/dist/subgraphs/configurator.subgraph.d.ts +130 -0
- package/dist/subgraphs/configurator.subgraph.js +242 -0
- package/dist/subgraphs/configurator.subgraph.js.map +1 -0
- package/dist/subgraphs/discovery.subgraph.d.ts +140 -0
- package/dist/subgraphs/discovery.subgraph.js +415 -0
- package/dist/subgraphs/discovery.subgraph.js.map +1 -0
- package/dist/subgraphs/subgraph-interface.d.ts +23 -0
- package/dist/subgraphs/subgraph-interface.js +7 -0
- package/dist/subgraphs/subgraph-interface.js.map +1 -0
- package/dist/tools/builder-tools.d.ts +5 -2
- package/dist/tools/builder-tools.js +15 -25
- package/dist/tools/builder-tools.js.map +1 -1
- package/dist/tools/get-best-practices.tool.d.ts +1 -1
- package/dist/tools/get-workflow-examples.tool.d.ts +34 -0
- package/dist/tools/get-workflow-examples.tool.js +172 -0
- package/dist/tools/get-workflow-examples.tool.js.map +1 -0
- package/dist/tools/node-details.tool.d.ts +4 -4
- package/dist/tools/node-details.tool.js +30 -2
- package/dist/tools/node-details.tool.js.map +1 -1
- package/dist/tools/node-search.tool.d.ts +1 -1
- package/dist/tools/prompts/main-agent.prompt.d.ts +4 -0
- package/dist/tools/prompts/main-agent.prompt.js +113 -57
- package/dist/tools/prompts/main-agent.prompt.js.map +1 -1
- package/dist/tools/utils/markdown-workflow.utils.d.ts +14 -0
- package/dist/tools/utils/markdown-workflow.utils.js +174 -0
- package/dist/tools/utils/markdown-workflow.utils.js.map +1 -0
- package/dist/tools/utils/test/workflows/ai-assistant.workflow.d.ts +2 -0
- package/dist/tools/utils/test/workflows/ai-assistant.workflow.js +541 -0
- package/dist/tools/utils/test/workflows/ai-assistant.workflow.js.map +1 -0
- package/dist/tools/validate-configuration.tool.d.ts +4 -0
- package/dist/tools/validate-configuration.tool.js +70 -0
- package/dist/tools/validate-configuration.tool.js.map +1 -0
- package/dist/tools/validate-structure.tool.d.ts +4 -0
- package/dist/tools/validate-structure.tool.js +66 -0
- package/dist/tools/validate-structure.tool.js.map +1 -0
- package/dist/tools/web/templates.d.ts +7 -0
- package/dist/tools/web/templates.js +71 -0
- package/dist/tools/web/templates.js.map +1 -0
- package/dist/types/coordination.d.ts +36 -0
- package/dist/types/coordination.js +19 -0
- package/dist/types/coordination.js.map +1 -0
- package/dist/types/discovery-types.d.ts +12 -0
- package/dist/types/discovery-types.js +3 -0
- package/dist/types/discovery-types.js.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +15 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/langchain.d.ts +1 -0
- package/dist/types/langchain.js +8 -0
- package/dist/types/langchain.js.map +1 -1
- package/dist/types/tools.d.ts +20 -0
- package/dist/types/web/templates.d.ts +44 -0
- package/dist/types/web/templates.js +37 -0
- package/dist/types/web/templates.js.map +1 -0
- package/dist/utils/cache-control/helpers.d.ts +1 -0
- package/dist/utils/cache-control/helpers.js +36 -0
- package/dist/utils/cache-control/helpers.js.map +1 -1
- package/dist/utils/cache-control/index.d.ts +1 -1
- package/dist/utils/cache-control/index.js +2 -1
- package/dist/utils/cache-control/index.js.map +1 -1
- package/dist/utils/context-builders.d.ts +10 -0
- package/dist/utils/context-builders.js +71 -0
- package/dist/utils/context-builders.js.map +1 -0
- package/dist/utils/coordination-log.d.ts +14 -0
- package/dist/utils/coordination-log.js +75 -0
- package/dist/utils/coordination-log.js.map +1 -0
- package/dist/utils/operations-processor.d.ts +4 -2
- package/dist/utils/operations-processor.js.map +1 -1
- package/dist/utils/stream-processor.d.ts +6 -2
- package/dist/utils/stream-processor.js +164 -81
- package/dist/utils/stream-processor.js.map +1 -1
- package/dist/utils/subgraph-helpers.d.ts +13 -0
- package/dist/utils/subgraph-helpers.js +95 -0
- package/dist/utils/subgraph-helpers.js.map +1 -0
- package/dist/utils/token-usage.js +4 -1
- package/dist/utils/token-usage.js.map +1 -1
- package/dist/utils/tool-executor.js +55 -38
- package/dist/utils/tool-executor.js.map +1 -1
- package/dist/utils/workflow-validation.js +1 -0
- package/dist/utils/workflow-validation.js.map +1 -1
- package/dist/validation/checks/index.d.ts +2 -1
- package/dist/validation/checks/index.js +3 -1
- package/dist/validation/checks/index.js.map +1 -1
- package/dist/validation/checks/nodes.d.ts +4 -0
- package/dist/validation/checks/nodes.js +36 -0
- package/dist/validation/checks/nodes.js.map +1 -0
- package/dist/validation/checks/trigger.js +0 -6
- package/dist/validation/checks/trigger.js.map +1 -1
- package/dist/validation/programmatic.js +2 -0
- package/dist/validation/programmatic.js.map +1 -1
- package/dist/validation/types.d.ts +5 -1
- package/dist/validation/types.js +8 -0
- package/dist/validation/types.js.map +1 -1
- package/dist/workflow-builder-agent.d.ts +8 -0
- package/dist/workflow-builder-agent.js +38 -9
- package/dist/workflow-builder-agent.js.map +1 -1
- package/dist/workflow-state.d.ts +4 -2
- package/dist/workflow-state.js +20 -0
- package/dist/workflow-state.js.map +1 -1
- package/package.json +9 -8
package/dist/constants.d.ts
CHANGED
|
@@ -6,3 +6,7 @@ export declare const MAX_PARAMETER_VALUE_LENGTH = 30000;
|
|
|
6
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 = 3.5;
|
|
9
|
+
export declare const MAX_NODE_EXAMPLE_CHARS: number;
|
|
10
|
+
export declare const MAX_BUILDER_ITERATIONS = 30;
|
|
11
|
+
export declare const MAX_CONFIGURATOR_ITERATIONS = 30;
|
|
12
|
+
export declare const MAX_DISCOVERY_ITERATIONS = 50;
|
package/dist/constants.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
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;
|
|
3
|
+
exports.MAX_DISCOVERY_ITERATIONS = exports.MAX_CONFIGURATOR_ITERATIONS = exports.MAX_BUILDER_ITERATIONS = exports.MAX_NODE_EXAMPLE_CHARS = 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
4
|
exports.MAX_AI_BUILDER_PROMPT_LENGTH = 5000;
|
|
5
5
|
exports.MAX_TOTAL_TOKENS = 200_000;
|
|
6
6
|
exports.MAX_OUTPUT_TOKENS = 16_000;
|
|
@@ -9,4 +9,8 @@ exports.MAX_PARAMETER_VALUE_LENGTH = 30_000;
|
|
|
9
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 = 3.5;
|
|
12
|
+
exports.MAX_NODE_EXAMPLE_CHARS = 5000 * exports.AVG_CHARS_PER_TOKEN_ANTHROPIC;
|
|
13
|
+
exports.MAX_BUILDER_ITERATIONS = 30;
|
|
14
|
+
exports.MAX_CONFIGURATOR_ITERATIONS = 30;
|
|
15
|
+
exports.MAX_DISCOVERY_ITERATIONS = 50;
|
|
12
16
|
//# 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,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"}
|
|
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;AAOpC,QAAA,sBAAsB,GAAG,IAAI,GAAG,qCAA6B,CAAC;AAM9D,QAAA,sBAAsB,GAAG,EAAE,CAAC;AAC5B,QAAA,2BAA2B,GAAG,EAAE,CAAC;AACjC,QAAA,wBAAwB,GAAG,EAAE,CAAC"}
|
package/dist/llm-config.d.ts
CHANGED
|
@@ -7,4 +7,5 @@ export declare const o4mini: (config: LLMProviderConfig) => Promise<import("@lan
|
|
|
7
7
|
export declare const gpt41mini: (config: LLMProviderConfig) => Promise<import("@langchain/openai").ChatOpenAI<import("@langchain/openai").ChatOpenAICallOptions>>;
|
|
8
8
|
export declare const gpt41: (config: LLMProviderConfig) => Promise<import("@langchain/openai").ChatOpenAI<import("@langchain/openai").ChatOpenAICallOptions>>;
|
|
9
9
|
export declare const anthropicClaudeSonnet45: (config: LLMProviderConfig) => Promise<import("@langchain/anthropic").ChatAnthropic>;
|
|
10
|
+
export declare const anthropicHaiku45: (config: LLMProviderConfig) => Promise<import("@langchain/anthropic").ChatAnthropic>;
|
|
10
11
|
export {};
|
package/dist/llm-config.js
CHANGED
|
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.anthropicClaudeSonnet45 = exports.gpt41 = exports.gpt41mini = exports.o4mini = void 0;
|
|
36
|
+
exports.anthropicHaiku45 = exports.anthropicClaudeSonnet45 = exports.gpt41 = exports.gpt41mini = exports.o4mini = void 0;
|
|
37
37
|
const constants_1 = require("./constants");
|
|
38
38
|
const http_proxy_agent_1 = require("./utils/http-proxy-agent");
|
|
39
39
|
const o4mini = async (config) => {
|
|
@@ -104,4 +104,23 @@ const anthropicClaudeSonnet45 = async (config) => {
|
|
|
104
104
|
return model;
|
|
105
105
|
};
|
|
106
106
|
exports.anthropicClaudeSonnet45 = anthropicClaudeSonnet45;
|
|
107
|
+
const anthropicHaiku45 = async (config) => {
|
|
108
|
+
const { ChatAnthropic } = await Promise.resolve().then(() => __importStar(require('@langchain/anthropic')));
|
|
109
|
+
const model = new ChatAnthropic({
|
|
110
|
+
model: 'claude-haiku-4-5-20251001',
|
|
111
|
+
apiKey: config.apiKey,
|
|
112
|
+
temperature: 0,
|
|
113
|
+
maxTokens: constants_1.MAX_OUTPUT_TOKENS,
|
|
114
|
+
anthropicApiUrl: config.baseUrl,
|
|
115
|
+
clientOptions: {
|
|
116
|
+
defaultHeaders: config.headers,
|
|
117
|
+
fetchOptions: {
|
|
118
|
+
dispatcher: (0, http_proxy_agent_1.getProxyAgent)(config.baseUrl),
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
});
|
|
122
|
+
delete model.topP;
|
|
123
|
+
return model;
|
|
124
|
+
};
|
|
125
|
+
exports.anthropicHaiku45 = anthropicHaiku45;
|
|
107
126
|
//# sourceMappingURL=llm-config.js.map
|
package/dist/llm-config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"llm-config.js","sourceRoot":"","sources":["../src/llm-config.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAAgD;AAEhD,+DAAyD;AAQlD,MAAM,MAAM,GAAG,KAAK,EAAE,MAAyB,EAAE,EAAE;IACzD,MAAM,EAAE,UAAU,EAAE,GAA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aver } from '@langchain/langgraph';
|
|
3
|
+
import type { Logger } from '@n8n/backend-common';
|
|
4
|
+
import type { INodeTypeDescription } from 'n8n-workflow';
|
|
5
|
+
export interface MultiAgentSubgraphConfig {
|
|
6
|
+
parsedNodeTypes: INodeTypeDescription[];
|
|
7
|
+
llmSimpleTask: BaseChatModel;
|
|
8
|
+
llmComplexTask: BaseChatModel;
|
|
9
|
+
logger?: Logger;
|
|
10
|
+
instanceUrl?: string;
|
|
11
|
+
checkpointer?: MemorySaver;
|
|
12
|
+
}
|
|
13
|
+
export declare function createMultiAgentWorkflowWithSubgraphs(config: MultiAgentSubgraphConfig): import("@langchain/langgraph").CompiledStateGraph<{
|
|
14
|
+
messages: import("@langchain/core/messages").BaseMessage<import("@langchain/core/messages").MessageStructure, import("@langchain/core/messages").MessageType>[];
|
|
15
|
+
workflowJSON: import("./types").SimpleWorkflow;
|
|
16
|
+
workflowContext: {
|
|
17
|
+
executionSchema?: import("n8n-workflow").NodeExecutionSchema[];
|
|
18
|
+
currentWorkflow?: Partial<import("n8n-workflow").IWorkflowBase>;
|
|
19
|
+
executionData?: import("n8n-workflow").IRunExecutionData["resultData"];
|
|
20
|
+
expressionValues?: Record<string, import("./workflow-builder-agent").ExpressionValue[]>;
|
|
21
|
+
} | undefined;
|
|
22
|
+
nextPhase: string;
|
|
23
|
+
discoveryContext: import("./types/discovery-types").DiscoveryContext | null;
|
|
24
|
+
workflowOperations: import("./types").WorkflowOperation[];
|
|
25
|
+
coordinationLog: import("./types/coordination").CoordinationLogEntry[];
|
|
26
|
+
}, {
|
|
27
|
+
messages?: import("@langchain/core/messages").BaseMessage<import("@langchain/core/messages").MessageStructure, import("@langchain/core/messages").MessageType>[] | undefined;
|
|
28
|
+
workflowJSON?: import("./types").SimpleWorkflow | undefined;
|
|
29
|
+
workflowContext?: {
|
|
30
|
+
executionSchema?: import("n8n-workflow").NodeExecutionSchema[];
|
|
31
|
+
currentWorkflow?: Partial<import("n8n-workflow").IWorkflowBase>;
|
|
32
|
+
executionData?: import("n8n-workflow").IRunExecutionData["resultData"];
|
|
33
|
+
expressionValues?: Record<string, import("./workflow-builder-agent").ExpressionValue[]>;
|
|
34
|
+
} | undefined;
|
|
35
|
+
nextPhase?: string | undefined;
|
|
36
|
+
discoveryContext?: import("./types/discovery-types").DiscoveryContext | null | undefined;
|
|
37
|
+
workflowOperations?: import("./types").WorkflowOperation[] | undefined;
|
|
38
|
+
coordinationLog?: import("./types/coordination").CoordinationLogEntry[] | undefined;
|
|
39
|
+
}, "responder" | "supervisor" | "configurator_subgraph" | "discovery_subgraph" | "builder_subgraph" | "process_operations" | "__start__", {
|
|
40
|
+
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>[]>;
|
|
41
|
+
workflowJSON: import("@langchain/langgraph").BinaryOperatorAggregate<import("./types").SimpleWorkflow, import("./types").SimpleWorkflow>;
|
|
42
|
+
workflowContext: import("@langchain/langgraph").BinaryOperatorAggregate<{
|
|
43
|
+
executionSchema?: import("n8n-workflow").NodeExecutionSchema[];
|
|
44
|
+
currentWorkflow?: Partial<import("n8n-workflow").IWorkflowBase>;
|
|
45
|
+
executionData?: import("n8n-workflow").IRunExecutionData["resultData"];
|
|
46
|
+
expressionValues?: Record<string, import("./workflow-builder-agent").ExpressionValue[]>;
|
|
47
|
+
} | undefined, {
|
|
48
|
+
executionSchema?: import("n8n-workflow").NodeExecutionSchema[];
|
|
49
|
+
currentWorkflow?: Partial<import("n8n-workflow").IWorkflowBase>;
|
|
50
|
+
executionData?: import("n8n-workflow").IRunExecutionData["resultData"];
|
|
51
|
+
expressionValues?: Record<string, import("./workflow-builder-agent").ExpressionValue[]>;
|
|
52
|
+
} | undefined>;
|
|
53
|
+
nextPhase: import("@langchain/langgraph").BinaryOperatorAggregate<string, string>;
|
|
54
|
+
discoveryContext: import("@langchain/langgraph").BinaryOperatorAggregate<import("./types/discovery-types").DiscoveryContext | null, import("./types/discovery-types").DiscoveryContext | null>;
|
|
55
|
+
workflowOperations: import("@langchain/langgraph").BinaryOperatorAggregate<import("./types").WorkflowOperation[], import("./types").WorkflowOperation[]>;
|
|
56
|
+
coordinationLog: import("@langchain/langgraph").BinaryOperatorAggregate<import("./types/coordination").CoordinationLogEntry[], import("./types/coordination").CoordinationLogEntry[]>;
|
|
57
|
+
}, {
|
|
58
|
+
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>[]>;
|
|
59
|
+
workflowJSON: import("@langchain/langgraph").BinaryOperatorAggregate<import("./types").SimpleWorkflow, import("./types").SimpleWorkflow>;
|
|
60
|
+
workflowContext: import("@langchain/langgraph").BinaryOperatorAggregate<{
|
|
61
|
+
executionSchema?: import("n8n-workflow").NodeExecutionSchema[];
|
|
62
|
+
currentWorkflow?: Partial<import("n8n-workflow").IWorkflowBase>;
|
|
63
|
+
executionData?: import("n8n-workflow").IRunExecutionData["resultData"];
|
|
64
|
+
expressionValues?: Record<string, import("./workflow-builder-agent").ExpressionValue[]>;
|
|
65
|
+
} | undefined, {
|
|
66
|
+
executionSchema?: import("n8n-workflow").NodeExecutionSchema[];
|
|
67
|
+
currentWorkflow?: Partial<import("n8n-workflow").IWorkflowBase>;
|
|
68
|
+
executionData?: import("n8n-workflow").IRunExecutionData["resultData"];
|
|
69
|
+
expressionValues?: Record<string, import("./workflow-builder-agent").ExpressionValue[]>;
|
|
70
|
+
} | undefined>;
|
|
71
|
+
nextPhase: import("@langchain/langgraph").BinaryOperatorAggregate<string, string>;
|
|
72
|
+
discoveryContext: import("@langchain/langgraph").BinaryOperatorAggregate<import("./types/discovery-types").DiscoveryContext | null, import("./types/discovery-types").DiscoveryContext | null>;
|
|
73
|
+
workflowOperations: import("@langchain/langgraph").BinaryOperatorAggregate<import("./types").WorkflowOperation[], import("./types").WorkflowOperation[]>;
|
|
74
|
+
coordinationLog: import("@langchain/langgraph").BinaryOperatorAggregate<import("./types/coordination").CoordinationLogEntry[], import("./types/coordination").CoordinationLogEntry[]>;
|
|
75
|
+
}, import("@langchain/langgraph").StateDefinition, {
|
|
76
|
+
supervisor: {
|
|
77
|
+
nextPhase: "responder" | "discovery" | "builder" | "configurator";
|
|
78
|
+
};
|
|
79
|
+
responder: {
|
|
80
|
+
messages: import("@langchain/core/messages").AIMessage<import("@langchain/core/messages").MessageStructure>[];
|
|
81
|
+
};
|
|
82
|
+
discovery_subgraph: Partial<Record<string, unknown>>;
|
|
83
|
+
builder_subgraph: Partial<Record<string, unknown>>;
|
|
84
|
+
configurator_subgraph: Partial<Record<string, unknown>>;
|
|
85
|
+
}, unknown, unknown>;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createMultiAgentWorkflowWithSubgraphs = createMultiAgentWorkflowWithSubgraphs;
|
|
4
|
+
const messages_1 = require("@langchain/core/messages");
|
|
5
|
+
const langgraph_1 = require("@langchain/langgraph");
|
|
6
|
+
const responder_agent_1 = require("./agents/responder.agent");
|
|
7
|
+
const supervisor_agent_1 = require("./agents/supervisor.agent");
|
|
8
|
+
const constants_1 = require("./constants");
|
|
9
|
+
const parent_graph_state_1 = require("./parent-graph-state");
|
|
10
|
+
const builder_subgraph_1 = require("./subgraphs/builder.subgraph");
|
|
11
|
+
const configurator_subgraph_1 = require("./subgraphs/configurator.subgraph");
|
|
12
|
+
const discovery_subgraph_1 = require("./subgraphs/discovery.subgraph");
|
|
13
|
+
const coordination_1 = require("./types/coordination");
|
|
14
|
+
const coordination_log_1 = require("./utils/coordination-log");
|
|
15
|
+
const operations_processor_1 = require("./utils/operations-processor");
|
|
16
|
+
function routeToNode(next) {
|
|
17
|
+
const nodeMapping = {
|
|
18
|
+
responder: 'responder',
|
|
19
|
+
discovery: 'discovery_subgraph',
|
|
20
|
+
builder: 'builder_subgraph',
|
|
21
|
+
configurator: 'configurator_subgraph',
|
|
22
|
+
};
|
|
23
|
+
return nodeMapping[next] ?? 'responder';
|
|
24
|
+
}
|
|
25
|
+
function createSubgraphNodeHandler(subgraph, compiledGraph, name, logger, recursionLimit) {
|
|
26
|
+
return async (state) => {
|
|
27
|
+
try {
|
|
28
|
+
const input = subgraph.transformInput(state);
|
|
29
|
+
const result = await compiledGraph.invoke(input, { recursionLimit });
|
|
30
|
+
const output = subgraph.transformOutput(result, state);
|
|
31
|
+
return output;
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
logger?.error(`[${name}] ERROR:`, { error });
|
|
35
|
+
const errorMessage = error instanceof Error ? error.message : `An error occurred in ${name}: ${String(error)}`;
|
|
36
|
+
const phase = name.replace('_subgraph', '');
|
|
37
|
+
return {
|
|
38
|
+
nextPhase: 'responder',
|
|
39
|
+
messages: [
|
|
40
|
+
new messages_1.HumanMessage({
|
|
41
|
+
content: `Error in ${name}: ${errorMessage}`,
|
|
42
|
+
name: 'system_error',
|
|
43
|
+
}),
|
|
44
|
+
],
|
|
45
|
+
coordinationLog: [
|
|
46
|
+
{
|
|
47
|
+
phase,
|
|
48
|
+
status: 'error',
|
|
49
|
+
timestamp: Date.now(),
|
|
50
|
+
summary: `Error: ${errorMessage}`,
|
|
51
|
+
metadata: (0, coordination_1.createErrorMetadata)({
|
|
52
|
+
failedSubgraph: phase,
|
|
53
|
+
errorMessage,
|
|
54
|
+
}),
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function createMultiAgentWorkflowWithSubgraphs(config) {
|
|
62
|
+
const { parsedNodeTypes, llmComplexTask, logger, instanceUrl, checkpointer } = config;
|
|
63
|
+
const supervisorAgent = new supervisor_agent_1.SupervisorAgent({ llm: llmComplexTask });
|
|
64
|
+
const responderAgent = new responder_agent_1.ResponderAgent({ llm: llmComplexTask });
|
|
65
|
+
const discoverySubgraph = new discovery_subgraph_1.DiscoverySubgraph();
|
|
66
|
+
const builderSubgraph = new builder_subgraph_1.BuilderSubgraph();
|
|
67
|
+
const configuratorSubgraph = new configurator_subgraph_1.ConfiguratorSubgraph();
|
|
68
|
+
const compiledDiscovery = discoverySubgraph.create({
|
|
69
|
+
parsedNodeTypes,
|
|
70
|
+
llm: llmComplexTask,
|
|
71
|
+
logger,
|
|
72
|
+
});
|
|
73
|
+
const compiledBuilder = builderSubgraph.create({ parsedNodeTypes, llm: llmComplexTask, logger });
|
|
74
|
+
const compiledConfigurator = configuratorSubgraph.create({
|
|
75
|
+
parsedNodeTypes,
|
|
76
|
+
llm: llmComplexTask,
|
|
77
|
+
logger,
|
|
78
|
+
instanceUrl,
|
|
79
|
+
});
|
|
80
|
+
return (new langgraph_1.StateGraph(parent_graph_state_1.ParentGraphState)
|
|
81
|
+
.addNode('supervisor', async (state) => {
|
|
82
|
+
const routing = await supervisorAgent.invoke({
|
|
83
|
+
messages: state.messages,
|
|
84
|
+
workflowJSON: state.workflowJSON,
|
|
85
|
+
coordinationLog: state.coordinationLog,
|
|
86
|
+
});
|
|
87
|
+
return {
|
|
88
|
+
nextPhase: routing.next,
|
|
89
|
+
};
|
|
90
|
+
})
|
|
91
|
+
.addNode('responder', async (state) => {
|
|
92
|
+
const response = await responderAgent.invoke({
|
|
93
|
+
messages: state.messages,
|
|
94
|
+
coordinationLog: state.coordinationLog,
|
|
95
|
+
discoveryContext: state.discoveryContext,
|
|
96
|
+
workflowJSON: state.workflowJSON,
|
|
97
|
+
});
|
|
98
|
+
return {
|
|
99
|
+
messages: [response],
|
|
100
|
+
};
|
|
101
|
+
})
|
|
102
|
+
.addNode('process_operations', (state) => {
|
|
103
|
+
const result = (0, operations_processor_1.processOperations)(state);
|
|
104
|
+
return {
|
|
105
|
+
...result,
|
|
106
|
+
workflowOperations: [],
|
|
107
|
+
};
|
|
108
|
+
})
|
|
109
|
+
.addNode('discovery_subgraph', createSubgraphNodeHandler(discoverySubgraph, compiledDiscovery, 'discovery_subgraph', logger, constants_1.MAX_DISCOVERY_ITERATIONS))
|
|
110
|
+
.addNode('builder_subgraph', createSubgraphNodeHandler(builderSubgraph, compiledBuilder, 'builder_subgraph', logger, constants_1.MAX_BUILDER_ITERATIONS))
|
|
111
|
+
.addNode('configurator_subgraph', createSubgraphNodeHandler(configuratorSubgraph, compiledConfigurator, 'configurator_subgraph', logger, constants_1.MAX_CONFIGURATOR_ITERATIONS))
|
|
112
|
+
.addEdge('discovery_subgraph', 'process_operations')
|
|
113
|
+
.addEdge('builder_subgraph', 'process_operations')
|
|
114
|
+
.addEdge('configurator_subgraph', 'process_operations')
|
|
115
|
+
.addEdge(langgraph_1.START, 'supervisor')
|
|
116
|
+
.addConditionalEdges('supervisor', (state) => routeToNode(state.nextPhase))
|
|
117
|
+
.addConditionalEdges('process_operations', (state) => routeToNode((0, coordination_log_1.getNextPhaseFromLog)(state.coordinationLog)))
|
|
118
|
+
.addEdge('responder', langgraph_1.END)
|
|
119
|
+
.compile({ checkpointer }));
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=multi-agent-workflow-subgraphs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multi-agent-workflow-subgraphs.js","sourceRoot":"","sources":["../src/multi-agent-workflow-subgraphs.ts"],"names":[],"mappings":";;AA0GA,sFA+GC;AAxND,uDAAwD;AACxD,oDAAgF;AAIhF,8DAA0D;AAC1D,gEAA4D;AAC5D,2CAIqB;AACrB,6DAAwD;AACxD,mEAA+D;AAC/D,6EAAyE;AACzE,uEAAmE;AAGnE,uDAA2D;AAC3D,+DAA+D;AAC/D,uEAAiE;AAMjE,SAAS,WAAW,CAAC,IAAY;IAChC,MAAM,WAAW,GAA2B;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AAC,iBAAK,EAAE,YAAY,CAAC;SAE5B,mBAAmB,CAAC,YAAY,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;SAE1E,mBAAmB,CAAC,oBAAoB,EAAE,CAAC,KAAK,EAAE,EAAE,CACpD,WAAW,CAAC,IAAA,sCAAmB,EAAC,KAAK,CAAC,eAAe,CAAC,CAAC,CACvD;SAEA,OAAO,CAAC,WAAW,EAAE,eAAG,CAAC;SAEzB,OAAO,CAAC,EAAE,YAAY,EAAE,CAAC,CAC3B,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { BaseMessage } from '@langchain/core/messages';
|
|
2
|
+
import type { CoordinationLogEntry } from './types/coordination';
|
|
3
|
+
import type { DiscoveryContext } from './types/discovery-types';
|
|
4
|
+
import type { SimpleWorkflow, WorkflowOperation } from './types/workflow';
|
|
5
|
+
export declare const ParentGraphState: import("@langchain/langgraph").AnnotationRoot<{
|
|
6
|
+
messages: import("@langchain/langgraph").BinaryOperatorAggregate<BaseMessage<import("@langchain/core/messages").MessageStructure, import("@langchain/core/messages").MessageType>[], BaseMessage<import("@langchain/core/messages").MessageStructure, import("@langchain/core/messages").MessageType>[]>;
|
|
7
|
+
workflowJSON: import("@langchain/langgraph").BinaryOperatorAggregate<SimpleWorkflow, SimpleWorkflow>;
|
|
8
|
+
workflowContext: import("@langchain/langgraph").BinaryOperatorAggregate<{
|
|
9
|
+
executionSchema?: import("n8n-workflow").NodeExecutionSchema[];
|
|
10
|
+
currentWorkflow?: Partial<import("n8n-workflow").IWorkflowBase>;
|
|
11
|
+
executionData?: import("n8n-workflow").IRunExecutionData["resultData"];
|
|
12
|
+
expressionValues?: Record<string, import("./workflow-builder-agent").ExpressionValue[]>;
|
|
13
|
+
} | undefined, {
|
|
14
|
+
executionSchema?: import("n8n-workflow").NodeExecutionSchema[];
|
|
15
|
+
currentWorkflow?: Partial<import("n8n-workflow").IWorkflowBase>;
|
|
16
|
+
executionData?: import("n8n-workflow").IRunExecutionData["resultData"];
|
|
17
|
+
expressionValues?: Record<string, import("./workflow-builder-agent").ExpressionValue[]>;
|
|
18
|
+
} | undefined>;
|
|
19
|
+
nextPhase: import("@langchain/langgraph").BinaryOperatorAggregate<string, string>;
|
|
20
|
+
discoveryContext: import("@langchain/langgraph").BinaryOperatorAggregate<DiscoveryContext | null, DiscoveryContext | null>;
|
|
21
|
+
workflowOperations: import("@langchain/langgraph").BinaryOperatorAggregate<WorkflowOperation[], WorkflowOperation[]>;
|
|
22
|
+
coordinationLog: import("@langchain/langgraph").BinaryOperatorAggregate<CoordinationLogEntry[], CoordinationLogEntry[]>;
|
|
23
|
+
}>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ParentGraphState = void 0;
|
|
4
|
+
const langgraph_1 = require("@langchain/langgraph");
|
|
5
|
+
exports.ParentGraphState = langgraph_1.Annotation.Root({
|
|
6
|
+
messages: (0, langgraph_1.Annotation)({
|
|
7
|
+
reducer: (x, y) => x.concat(y),
|
|
8
|
+
default: () => [],
|
|
9
|
+
}),
|
|
10
|
+
workflowJSON: (0, langgraph_1.Annotation)({
|
|
11
|
+
reducer: (x, y) => y ?? x,
|
|
12
|
+
default: () => ({ nodes: [], connections: {}, name: '' }),
|
|
13
|
+
}),
|
|
14
|
+
workflowContext: (0, langgraph_1.Annotation)({
|
|
15
|
+
reducer: (x, y) => y ?? x,
|
|
16
|
+
}),
|
|
17
|
+
nextPhase: (0, langgraph_1.Annotation)({
|
|
18
|
+
reducer: (x, y) => y ?? x,
|
|
19
|
+
default: () => '',
|
|
20
|
+
}),
|
|
21
|
+
discoveryContext: (0, langgraph_1.Annotation)({
|
|
22
|
+
reducer: (x, y) => y ?? x,
|
|
23
|
+
default: () => null,
|
|
24
|
+
}),
|
|
25
|
+
workflowOperations: (0, langgraph_1.Annotation)({
|
|
26
|
+
reducer: (x, y) => x.concat(y),
|
|
27
|
+
default: () => [],
|
|
28
|
+
}),
|
|
29
|
+
coordinationLog: (0, langgraph_1.Annotation)({
|
|
30
|
+
reducer: (x, y) => x.concat(y),
|
|
31
|
+
default: () => [],
|
|
32
|
+
}),
|
|
33
|
+
});
|
|
34
|
+
//# sourceMappingURL=parent-graph-state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parent-graph-state.js","sourceRoot":"","sources":["../src/parent-graph-state.ts"],"names":[],"mappings":";;;AACA,oDAAkD;AAarC,QAAA,gBAAgB,GAAG,sBAAU,CAAC,IAAI,CAAC;IAE/C,QAAQ,EAAE,IAAA,sBAAU,EAAgB;QACnC,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;QAC9B,OAAO,EAAE,GAAG,EAAE,CAAC,EAAE;KACjB,CAAC;IAGF,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,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC;KACzB,CAAC;IAGF,SAAS,EAAE,IAAA,sBAAU,EAAS;QAC7B,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC;QACzB,OAAO,EAAE,GAAG,EAAE,CAAC,EAAE;KACjB,CAAC;IAGF,gBAAgB,EAAE,IAAA,sBAAU,EAA0B;QACrD,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC;QACzB,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI;KACnB,CAAC;IAGF,kBAAkB,EAAE,IAAA,sBAAU,EAAsB;QACnD,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;QAC9B,OAAO,EAAE,GAAG,EAAE,CAAC,EAAE;KACjB,CAAC;IAGF,eAAe,EAAE,IAAA,sBAAU,EAAyB;QACnD,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;QAC9B,OAAO,EAAE,GAAG,EAAE,CAAC,EAAE;KACjB,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import type { BaseChatModel } from '@langchain/core/language_models/chat_models';
|
|
2
|
+
import type { BaseMessage } from '@langchain/core/messages';
|
|
3
|
+
import type { Logger } from '@n8n/backend-common';
|
|
4
|
+
import type { INodeTypeDescription } from 'n8n-workflow';
|
|
5
|
+
import { BaseSubgraph } from './subgraph-interface';
|
|
6
|
+
import type { ParentGraphState } from '../parent-graph-state';
|
|
7
|
+
import type { CoordinationLogEntry } from '../types/coordination';
|
|
8
|
+
import type { DiscoveryContext } from '../types/discovery-types';
|
|
9
|
+
import type { SimpleWorkflow, WorkflowOperation } from '../types/workflow';
|
|
10
|
+
export declare const BuilderSubgraphState: import("@langchain/langgraph").AnnotationRoot<{
|
|
11
|
+
workflowJSON: import("@langchain/langgraph").BinaryOperatorAggregate<SimpleWorkflow, SimpleWorkflow>;
|
|
12
|
+
userRequest: import("@langchain/langgraph").BinaryOperatorAggregate<string, string>;
|
|
13
|
+
workflowContext: import("@langchain/langgraph").BinaryOperatorAggregate<{
|
|
14
|
+
executionSchema?: import("n8n-workflow").NodeExecutionSchema[];
|
|
15
|
+
currentWorkflow?: Partial<import("n8n-workflow").IWorkflowBase>;
|
|
16
|
+
executionData?: import("n8n-workflow").IRunExecutionData["resultData"];
|
|
17
|
+
expressionValues?: Record<string, import("../workflow-builder-agent").ExpressionValue[]>;
|
|
18
|
+
} | undefined, {
|
|
19
|
+
executionSchema?: import("n8n-workflow").NodeExecutionSchema[];
|
|
20
|
+
currentWorkflow?: Partial<import("n8n-workflow").IWorkflowBase>;
|
|
21
|
+
executionData?: import("n8n-workflow").IRunExecutionData["resultData"];
|
|
22
|
+
expressionValues?: Record<string, import("../workflow-builder-agent").ExpressionValue[]>;
|
|
23
|
+
} | undefined>;
|
|
24
|
+
discoveryContext: import("@langchain/langgraph").BinaryOperatorAggregate<DiscoveryContext | null, DiscoveryContext | null>;
|
|
25
|
+
messages: import("@langchain/langgraph").BinaryOperatorAggregate<BaseMessage<import("@langchain/core/messages").MessageStructure, import("@langchain/core/messages").MessageType>[], BaseMessage<import("@langchain/core/messages").MessageStructure, import("@langchain/core/messages").MessageType>[]>;
|
|
26
|
+
workflowOperations: import("@langchain/langgraph").BinaryOperatorAggregate<WorkflowOperation[] | null, WorkflowOperation[] | null>;
|
|
27
|
+
}>;
|
|
28
|
+
export interface BuilderSubgraphConfig {
|
|
29
|
+
parsedNodeTypes: INodeTypeDescription[];
|
|
30
|
+
llm: BaseChatModel;
|
|
31
|
+
logger?: Logger;
|
|
32
|
+
}
|
|
33
|
+
export declare class BuilderSubgraph extends BaseSubgraph<BuilderSubgraphConfig, typeof BuilderSubgraphState.State, typeof ParentGraphState.State> {
|
|
34
|
+
name: string;
|
|
35
|
+
description: string;
|
|
36
|
+
create(config: BuilderSubgraphConfig): import("@langchain/langgraph").CompiledStateGraph<{
|
|
37
|
+
workflowJSON: SimpleWorkflow;
|
|
38
|
+
userRequest: string;
|
|
39
|
+
workflowContext: {
|
|
40
|
+
executionSchema?: import("n8n-workflow").NodeExecutionSchema[];
|
|
41
|
+
currentWorkflow?: Partial<import("n8n-workflow").IWorkflowBase>;
|
|
42
|
+
executionData?: import("n8n-workflow").IRunExecutionData["resultData"];
|
|
43
|
+
expressionValues?: Record<string, import("../workflow-builder-agent").ExpressionValue[]>;
|
|
44
|
+
} | undefined;
|
|
45
|
+
discoveryContext: DiscoveryContext | null;
|
|
46
|
+
messages: BaseMessage<import("@langchain/core/messages").MessageStructure, import("@langchain/core/messages").MessageType>[];
|
|
47
|
+
workflowOperations: WorkflowOperation[] | null;
|
|
48
|
+
}, {
|
|
49
|
+
workflowJSON?: SimpleWorkflow | undefined;
|
|
50
|
+
userRequest?: string | undefined;
|
|
51
|
+
workflowContext?: {
|
|
52
|
+
executionSchema?: import("n8n-workflow").NodeExecutionSchema[];
|
|
53
|
+
currentWorkflow?: Partial<import("n8n-workflow").IWorkflowBase>;
|
|
54
|
+
executionData?: import("n8n-workflow").IRunExecutionData["resultData"];
|
|
55
|
+
expressionValues?: Record<string, import("../workflow-builder-agent").ExpressionValue[]>;
|
|
56
|
+
} | undefined;
|
|
57
|
+
discoveryContext?: DiscoveryContext | null | undefined;
|
|
58
|
+
messages?: BaseMessage<import("@langchain/core/messages").MessageStructure, import("@langchain/core/messages").MessageType>[] | undefined;
|
|
59
|
+
workflowOperations?: WorkflowOperation[] | null | undefined;
|
|
60
|
+
}, "agent" | "tools" | "process_operations" | "__start__", {
|
|
61
|
+
workflowJSON: import("@langchain/langgraph").BinaryOperatorAggregate<SimpleWorkflow, SimpleWorkflow>;
|
|
62
|
+
userRequest: import("@langchain/langgraph").BinaryOperatorAggregate<string, string>;
|
|
63
|
+
workflowContext: import("@langchain/langgraph").BinaryOperatorAggregate<{
|
|
64
|
+
executionSchema?: import("n8n-workflow").NodeExecutionSchema[];
|
|
65
|
+
currentWorkflow?: Partial<import("n8n-workflow").IWorkflowBase>;
|
|
66
|
+
executionData?: import("n8n-workflow").IRunExecutionData["resultData"];
|
|
67
|
+
expressionValues?: Record<string, import("../workflow-builder-agent").ExpressionValue[]>;
|
|
68
|
+
} | undefined, {
|
|
69
|
+
executionSchema?: import("n8n-workflow").NodeExecutionSchema[];
|
|
70
|
+
currentWorkflow?: Partial<import("n8n-workflow").IWorkflowBase>;
|
|
71
|
+
executionData?: import("n8n-workflow").IRunExecutionData["resultData"];
|
|
72
|
+
expressionValues?: Record<string, import("../workflow-builder-agent").ExpressionValue[]>;
|
|
73
|
+
} | undefined>;
|
|
74
|
+
discoveryContext: import("@langchain/langgraph").BinaryOperatorAggregate<DiscoveryContext | null, DiscoveryContext | null>;
|
|
75
|
+
messages: import("@langchain/langgraph").BinaryOperatorAggregate<BaseMessage<import("@langchain/core/messages").MessageStructure, import("@langchain/core/messages").MessageType>[], BaseMessage<import("@langchain/core/messages").MessageStructure, import("@langchain/core/messages").MessageType>[]>;
|
|
76
|
+
workflowOperations: import("@langchain/langgraph").BinaryOperatorAggregate<WorkflowOperation[] | null, WorkflowOperation[] | null>;
|
|
77
|
+
}, {
|
|
78
|
+
workflowJSON: import("@langchain/langgraph").BinaryOperatorAggregate<SimpleWorkflow, SimpleWorkflow>;
|
|
79
|
+
userRequest: import("@langchain/langgraph").BinaryOperatorAggregate<string, string>;
|
|
80
|
+
workflowContext: import("@langchain/langgraph").BinaryOperatorAggregate<{
|
|
81
|
+
executionSchema?: import("n8n-workflow").NodeExecutionSchema[];
|
|
82
|
+
currentWorkflow?: Partial<import("n8n-workflow").IWorkflowBase>;
|
|
83
|
+
executionData?: import("n8n-workflow").IRunExecutionData["resultData"];
|
|
84
|
+
expressionValues?: Record<string, import("../workflow-builder-agent").ExpressionValue[]>;
|
|
85
|
+
} | undefined, {
|
|
86
|
+
executionSchema?: import("n8n-workflow").NodeExecutionSchema[];
|
|
87
|
+
currentWorkflow?: Partial<import("n8n-workflow").IWorkflowBase>;
|
|
88
|
+
executionData?: import("n8n-workflow").IRunExecutionData["resultData"];
|
|
89
|
+
expressionValues?: Record<string, import("../workflow-builder-agent").ExpressionValue[]>;
|
|
90
|
+
} | undefined>;
|
|
91
|
+
discoveryContext: import("@langchain/langgraph").BinaryOperatorAggregate<DiscoveryContext | null, DiscoveryContext | null>;
|
|
92
|
+
messages: import("@langchain/langgraph").BinaryOperatorAggregate<BaseMessage<import("@langchain/core/messages").MessageStructure, import("@langchain/core/messages").MessageType>[], BaseMessage<import("@langchain/core/messages").MessageStructure, import("@langchain/core/messages").MessageType>[]>;
|
|
93
|
+
workflowOperations: import("@langchain/langgraph").BinaryOperatorAggregate<WorkflowOperation[] | null, WorkflowOperation[] | null>;
|
|
94
|
+
}, import("@langchain/langgraph").StateDefinition, {
|
|
95
|
+
agent: {
|
|
96
|
+
messages: import("@langchain/core/messages").AIMessageChunk<import("@langchain/core/messages").MessageStructure>[];
|
|
97
|
+
};
|
|
98
|
+
tools: {
|
|
99
|
+
messages?: BaseMessage[];
|
|
100
|
+
workflowOperations?: WorkflowOperation[] | null;
|
|
101
|
+
};
|
|
102
|
+
}, unknown, unknown>;
|
|
103
|
+
transformInput(parentState: typeof ParentGraphState.State): {
|
|
104
|
+
userRequest: string;
|
|
105
|
+
workflowJSON: SimpleWorkflow;
|
|
106
|
+
workflowContext: {
|
|
107
|
+
executionSchema?: import("n8n-workflow").NodeExecutionSchema[];
|
|
108
|
+
currentWorkflow?: Partial<import("n8n-workflow").IWorkflowBase>;
|
|
109
|
+
executionData?: import("n8n-workflow").IRunExecutionData["resultData"];
|
|
110
|
+
expressionValues?: Record<string, import("../workflow-builder-agent").ExpressionValue[]>;
|
|
111
|
+
} | undefined;
|
|
112
|
+
discoveryContext: DiscoveryContext | null;
|
|
113
|
+
messages: import("@langchain/core/messages").HumanMessage<import("@langchain/core/messages").MessageStructure>[];
|
|
114
|
+
};
|
|
115
|
+
transformOutput(subgraphOutput: typeof BuilderSubgraphState.State, _parentState: typeof ParentGraphState.State): {
|
|
116
|
+
workflowJSON: SimpleWorkflow;
|
|
117
|
+
workflowOperations: WorkflowOperation[];
|
|
118
|
+
coordinationLog: CoordinationLogEntry[];
|
|
119
|
+
};
|
|
120
|
+
}
|