@agentforge/core 0.18.8 → 0.18.9
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/index.cjs +40 -41
- package/dist/index.js +33 -34
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2130,12 +2130,11 @@ function mergeState(currentState, update, config) {
|
|
|
2130
2130
|
}
|
|
2131
2131
|
|
|
2132
2132
|
// src/langgraph/builders/sequential.ts
|
|
2133
|
+
var import_langgraph3 = require("@langchain/langgraph");
|
|
2134
|
+
|
|
2135
|
+
// src/langgraph/builders/workflow-node-registration.ts
|
|
2133
2136
|
var import_langgraph2 = require("@langchain/langgraph");
|
|
2134
|
-
function
|
|
2135
|
-
const { autoStartEnd = true } = options;
|
|
2136
|
-
if (nodes.length === 0) {
|
|
2137
|
-
throw new Error("Sequential workflow must have at least one node");
|
|
2138
|
-
}
|
|
2137
|
+
function createRegisteredWorkflowGraph(stateSchema, nodes, options = {}) {
|
|
2139
2138
|
const nodeNames = /* @__PURE__ */ new Set();
|
|
2140
2139
|
for (const node of nodes) {
|
|
2141
2140
|
if (nodeNames.has(node.name)) {
|
|
@@ -2145,25 +2144,38 @@ function createSequentialWorkflow(stateSchema, nodes, options = {}) {
|
|
|
2145
2144
|
}
|
|
2146
2145
|
let graph;
|
|
2147
2146
|
try {
|
|
2148
|
-
graph = new import_langgraph2.StateGraph(
|
|
2149
|
-
stateSchema
|
|
2150
|
-
);
|
|
2147
|
+
graph = new import_langgraph2.StateGraph(stateSchema);
|
|
2151
2148
|
} catch (error) {
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
}
|
|
2149
|
+
if (options.translateGraphConstructionError) {
|
|
2150
|
+
throw options.translateGraphConstructionError(error);
|
|
2151
|
+
}
|
|
2152
|
+
throw error;
|
|
2153
|
+
}
|
|
2154
|
+
for (const { name, node } of nodes) {
|
|
2155
|
+
graph.addNode(name, node);
|
|
2155
2156
|
}
|
|
2156
|
-
|
|
2157
|
-
|
|
2157
|
+
return graph;
|
|
2158
|
+
}
|
|
2159
|
+
|
|
2160
|
+
// src/langgraph/builders/sequential.ts
|
|
2161
|
+
function createSequentialWorkflow(stateSchema, nodes, options = {}) {
|
|
2162
|
+
const { autoStartEnd = true } = options;
|
|
2163
|
+
if (nodes.length === 0) {
|
|
2164
|
+
throw new Error("Sequential workflow must have at least one node");
|
|
2158
2165
|
}
|
|
2166
|
+
const graph = createRegisteredWorkflowGraph(stateSchema, nodes, {
|
|
2167
|
+
translateGraphConstructionError: (error) => new Error("Sequential workflow requires a LangGraph Annotation.Root schema", {
|
|
2168
|
+
cause: error
|
|
2169
|
+
})
|
|
2170
|
+
});
|
|
2159
2171
|
if (autoStartEnd) {
|
|
2160
|
-
graph.addEdge(
|
|
2172
|
+
graph.addEdge(import_langgraph3.START, nodes[0].name);
|
|
2161
2173
|
}
|
|
2162
2174
|
for (let i = 0; i < nodes.length - 1; i++) {
|
|
2163
2175
|
graph.addEdge(nodes[i].name, nodes[i + 1].name);
|
|
2164
2176
|
}
|
|
2165
2177
|
if (autoStartEnd) {
|
|
2166
|
-
graph.addEdge(nodes[nodes.length - 1].name,
|
|
2178
|
+
graph.addEdge(nodes[nodes.length - 1].name, import_langgraph3.END);
|
|
2167
2179
|
}
|
|
2168
2180
|
return graph;
|
|
2169
2181
|
}
|
|
@@ -2195,33 +2207,20 @@ function sequentialBuilder(stateSchema) {
|
|
|
2195
2207
|
}
|
|
2196
2208
|
|
|
2197
2209
|
// src/langgraph/builders/parallel.ts
|
|
2198
|
-
var
|
|
2210
|
+
var import_langgraph4 = require("@langchain/langgraph");
|
|
2199
2211
|
function createParallelWorkflow(stateSchema, config, options = {}) {
|
|
2200
2212
|
const { parallel: parallel2, aggregate } = config;
|
|
2201
2213
|
const { autoStartEnd = true } = options;
|
|
2202
2214
|
if (parallel2.length === 0) {
|
|
2203
2215
|
throw new Error("Parallel workflow must have at least one parallel node");
|
|
2204
2216
|
}
|
|
2205
|
-
const
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
}
|
|
2210
|
-
nodeNames.add(node.name);
|
|
2211
|
-
}
|
|
2212
|
-
if (aggregate && nodeNames.has(aggregate.name)) {
|
|
2213
|
-
throw new Error(`Duplicate node name: ${aggregate.name}`);
|
|
2214
|
-
}
|
|
2215
|
-
const graph = new import_langgraph3.StateGraph(stateSchema);
|
|
2216
|
-
for (const { name: nodeName, node } of parallel2) {
|
|
2217
|
-
graph.addNode(nodeName, node);
|
|
2218
|
-
}
|
|
2219
|
-
if (aggregate) {
|
|
2220
|
-
graph.addNode(aggregate.name, aggregate.node);
|
|
2221
|
-
}
|
|
2217
|
+
const graph = createRegisteredWorkflowGraph(
|
|
2218
|
+
stateSchema,
|
|
2219
|
+
aggregate ? [...parallel2, aggregate] : parallel2
|
|
2220
|
+
);
|
|
2222
2221
|
if (autoStartEnd) {
|
|
2223
2222
|
for (const { name: nodeName } of parallel2) {
|
|
2224
|
-
graph.addEdge(
|
|
2223
|
+
graph.addEdge(import_langgraph4.START, nodeName);
|
|
2225
2224
|
}
|
|
2226
2225
|
}
|
|
2227
2226
|
if (aggregate) {
|
|
@@ -2229,11 +2228,11 @@ function createParallelWorkflow(stateSchema, config, options = {}) {
|
|
|
2229
2228
|
graph.addEdge(nodeName, aggregate.name);
|
|
2230
2229
|
}
|
|
2231
2230
|
if (autoStartEnd) {
|
|
2232
|
-
graph.addEdge(aggregate.name,
|
|
2231
|
+
graph.addEdge(aggregate.name, import_langgraph4.END);
|
|
2233
2232
|
}
|
|
2234
2233
|
} else if (autoStartEnd) {
|
|
2235
2234
|
for (const { name: nodeName } of parallel2) {
|
|
2236
|
-
graph.addEdge(nodeName,
|
|
2235
|
+
graph.addEdge(nodeName, import_langgraph4.END);
|
|
2237
2236
|
}
|
|
2238
2237
|
}
|
|
2239
2238
|
return graph;
|
|
@@ -2284,9 +2283,9 @@ function createMultiRouter(config) {
|
|
|
2284
2283
|
}
|
|
2285
2284
|
|
|
2286
2285
|
// src/langgraph/builders/subgraph.ts
|
|
2287
|
-
var
|
|
2286
|
+
var import_langgraph5 = require("@langchain/langgraph");
|
|
2288
2287
|
function createSubgraph(stateSchema, builder) {
|
|
2289
|
-
const graph = new
|
|
2288
|
+
const graph = new import_langgraph5.StateGraph(stateSchema);
|
|
2290
2289
|
const configured = builder(graph);
|
|
2291
2290
|
return configured.compile();
|
|
2292
2291
|
}
|
|
@@ -3361,9 +3360,9 @@ function createSharedConcurrencyController(options = {}) {
|
|
|
3361
3360
|
}
|
|
3362
3361
|
|
|
3363
3362
|
// src/langgraph/persistence/checkpointer.ts
|
|
3364
|
-
var
|
|
3363
|
+
var import_langgraph6 = require("@langchain/langgraph");
|
|
3365
3364
|
function createMemoryCheckpointer(options) {
|
|
3366
|
-
return new
|
|
3365
|
+
return new import_langgraph6.MemorySaver();
|
|
3367
3366
|
}
|
|
3368
3367
|
async function createSqliteCheckpointer(options = {}) {
|
|
3369
3368
|
const { path = ":memory:", autoMigrate = true } = options;
|
|
@@ -3384,7 +3383,7 @@ async function createSqliteCheckpointer(options = {}) {
|
|
|
3384
3383
|
}
|
|
3385
3384
|
}
|
|
3386
3385
|
function isMemoryCheckpointer(checkpointer) {
|
|
3387
|
-
return checkpointer instanceof
|
|
3386
|
+
return checkpointer instanceof import_langgraph6.MemorySaver;
|
|
3388
3387
|
}
|
|
3389
3388
|
|
|
3390
3389
|
// src/langgraph/persistence/thread.ts
|
package/dist/index.js
CHANGED
|
@@ -1954,12 +1954,11 @@ function mergeState(currentState, update, config) {
|
|
|
1954
1954
|
}
|
|
1955
1955
|
|
|
1956
1956
|
// src/langgraph/builders/sequential.ts
|
|
1957
|
-
import {
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
}
|
|
1957
|
+
import { END, START } from "@langchain/langgraph";
|
|
1958
|
+
|
|
1959
|
+
// src/langgraph/builders/workflow-node-registration.ts
|
|
1960
|
+
import { StateGraph } from "@langchain/langgraph";
|
|
1961
|
+
function createRegisteredWorkflowGraph(stateSchema, nodes, options = {}) {
|
|
1963
1962
|
const nodeNames = /* @__PURE__ */ new Set();
|
|
1964
1963
|
for (const node of nodes) {
|
|
1965
1964
|
if (nodeNames.has(node.name)) {
|
|
@@ -1969,17 +1968,30 @@ function createSequentialWorkflow(stateSchema, nodes, options = {}) {
|
|
|
1969
1968
|
}
|
|
1970
1969
|
let graph;
|
|
1971
1970
|
try {
|
|
1972
|
-
graph = new StateGraph(
|
|
1973
|
-
stateSchema
|
|
1974
|
-
);
|
|
1971
|
+
graph = new StateGraph(stateSchema);
|
|
1975
1972
|
} catch (error) {
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
}
|
|
1973
|
+
if (options.translateGraphConstructionError) {
|
|
1974
|
+
throw options.translateGraphConstructionError(error);
|
|
1975
|
+
}
|
|
1976
|
+
throw error;
|
|
1977
|
+
}
|
|
1978
|
+
for (const { name, node } of nodes) {
|
|
1979
|
+
graph.addNode(name, node);
|
|
1979
1980
|
}
|
|
1980
|
-
|
|
1981
|
-
|
|
1981
|
+
return graph;
|
|
1982
|
+
}
|
|
1983
|
+
|
|
1984
|
+
// src/langgraph/builders/sequential.ts
|
|
1985
|
+
function createSequentialWorkflow(stateSchema, nodes, options = {}) {
|
|
1986
|
+
const { autoStartEnd = true } = options;
|
|
1987
|
+
if (nodes.length === 0) {
|
|
1988
|
+
throw new Error("Sequential workflow must have at least one node");
|
|
1982
1989
|
}
|
|
1990
|
+
const graph = createRegisteredWorkflowGraph(stateSchema, nodes, {
|
|
1991
|
+
translateGraphConstructionError: (error) => new Error("Sequential workflow requires a LangGraph Annotation.Root schema", {
|
|
1992
|
+
cause: error
|
|
1993
|
+
})
|
|
1994
|
+
});
|
|
1983
1995
|
if (autoStartEnd) {
|
|
1984
1996
|
graph.addEdge(START, nodes[0].name);
|
|
1985
1997
|
}
|
|
@@ -2019,30 +2031,17 @@ function sequentialBuilder(stateSchema) {
|
|
|
2019
2031
|
}
|
|
2020
2032
|
|
|
2021
2033
|
// src/langgraph/builders/parallel.ts
|
|
2022
|
-
import {
|
|
2034
|
+
import { END as END2, START as START2 } from "@langchain/langgraph";
|
|
2023
2035
|
function createParallelWorkflow(stateSchema, config, options = {}) {
|
|
2024
2036
|
const { parallel: parallel2, aggregate } = config;
|
|
2025
2037
|
const { autoStartEnd = true } = options;
|
|
2026
2038
|
if (parallel2.length === 0) {
|
|
2027
2039
|
throw new Error("Parallel workflow must have at least one parallel node");
|
|
2028
2040
|
}
|
|
2029
|
-
const
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
}
|
|
2034
|
-
nodeNames.add(node.name);
|
|
2035
|
-
}
|
|
2036
|
-
if (aggregate && nodeNames.has(aggregate.name)) {
|
|
2037
|
-
throw new Error(`Duplicate node name: ${aggregate.name}`);
|
|
2038
|
-
}
|
|
2039
|
-
const graph = new StateGraph2(stateSchema);
|
|
2040
|
-
for (const { name: nodeName, node } of parallel2) {
|
|
2041
|
-
graph.addNode(nodeName, node);
|
|
2042
|
-
}
|
|
2043
|
-
if (aggregate) {
|
|
2044
|
-
graph.addNode(aggregate.name, aggregate.node);
|
|
2045
|
-
}
|
|
2041
|
+
const graph = createRegisteredWorkflowGraph(
|
|
2042
|
+
stateSchema,
|
|
2043
|
+
aggregate ? [...parallel2, aggregate] : parallel2
|
|
2044
|
+
);
|
|
2046
2045
|
if (autoStartEnd) {
|
|
2047
2046
|
for (const { name: nodeName } of parallel2) {
|
|
2048
2047
|
graph.addEdge(START2, nodeName);
|
|
@@ -2108,9 +2107,9 @@ function createMultiRouter(config) {
|
|
|
2108
2107
|
}
|
|
2109
2108
|
|
|
2110
2109
|
// src/langgraph/builders/subgraph.ts
|
|
2111
|
-
import { StateGraph as
|
|
2110
|
+
import { StateGraph as StateGraph2 } from "@langchain/langgraph";
|
|
2112
2111
|
function createSubgraph(stateSchema, builder) {
|
|
2113
|
-
const graph = new
|
|
2112
|
+
const graph = new StateGraph2(stateSchema);
|
|
2114
2113
|
const configured = builder(graph);
|
|
2115
2114
|
return configured.compile();
|
|
2116
2115
|
}
|
package/package.json
CHANGED