@agentforge/core 0.15.14 → 0.16.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/index.cjs CHANGED
@@ -2297,7 +2297,7 @@ function mergeState(currentState, update, config) {
2297
2297
  // src/langgraph/builders/sequential.ts
2298
2298
  var import_langgraph2 = require("@langchain/langgraph");
2299
2299
  function createSequentialWorkflow(stateSchema, nodes, options = {}) {
2300
- const { autoStartEnd = true, name } = options;
2300
+ const { autoStartEnd = true } = options;
2301
2301
  if (nodes.length === 0) {
2302
2302
  throw new Error("Sequential workflow must have at least one node");
2303
2303
  }
@@ -2308,7 +2308,16 @@ function createSequentialWorkflow(stateSchema, nodes, options = {}) {
2308
2308
  }
2309
2309
  nodeNames.add(node.name);
2310
2310
  }
2311
- const graph = new import_langgraph2.StateGraph(stateSchema);
2311
+ let graph;
2312
+ try {
2313
+ graph = new import_langgraph2.StateGraph(
2314
+ stateSchema
2315
+ );
2316
+ } catch (error) {
2317
+ throw new Error("Sequential workflow requires a LangGraph Annotation.Root schema", {
2318
+ cause: error
2319
+ });
2320
+ }
2312
2321
  for (const { name: nodeName, node } of nodes) {
2313
2322
  graph.addNode(nodeName, node);
2314
2323
  }
package/dist/index.d.cts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { z, ZodTypeAny, output, ZodType, ZodTypeDef } from 'zod';
2
2
  import { DynamicStructuredTool } from '@langchain/core/tools';
3
- import { AnnotationRoot, BaseChannel, StateGraph, StateDefinition, UpdateType, END, MemorySaver, BaseCheckpointSaver, CheckpointTuple } from '@langchain/langgraph';
3
+ import * as _langchain_langgraph from '@langchain/langgraph';
4
+ import { AnnotationRoot, BaseChannel, StateDefinition, UpdateType, StateGraph, END, MemorySaver, BaseCheckpointSaver, CheckpointTuple } from '@langchain/langgraph';
4
5
  import { RunnableConfig } from '@langchain/core/runnables';
5
6
 
6
7
  /**
@@ -2044,20 +2045,13 @@ declare function validateState<TConfig extends StateConfigMap, TState extends Pa
2044
2045
  */
2045
2046
  declare function mergeState<TConfig extends StateConfigMap>(currentState: Partial<StateShape<TConfig>>, update: StateUpdateShape<TConfig>, config: TConfig): Partial<StateShape<TConfig>>;
2046
2047
 
2047
- /**
2048
- * Sequential Workflow Builder
2049
- *
2050
- * Provides utilities for building linear workflows where nodes execute in sequence.
2051
- * This is a thin wrapper around LangGraph's StateGraph that simplifies the common
2052
- * pattern of chaining nodes together.
2053
- *
2054
- * @module langgraph/builders/sequential
2055
- */
2056
-
2048
+ type SequentialWorkflowState<SD extends StateDefinition> = AnnotationRoot<SD>['State'];
2049
+ type SequentialNodeResult<State> = Partial<State>;
2050
+ type SequentialWorkflowGraph<SD extends StateDefinition, State, Update> = StateGraph<AnnotationRoot<SD>, State, Update, string>;
2057
2051
  /**
2058
2052
  * Configuration for a node in a sequential workflow
2059
2053
  */
2060
- interface SequentialNode<State> {
2054
+ interface SequentialNode<State, Update = SequentialNodeResult<State>> {
2061
2055
  /**
2062
2056
  * Unique name for the node
2063
2057
  */
@@ -2065,7 +2059,7 @@ interface SequentialNode<State> {
2065
2059
  /**
2066
2060
  * The node function that processes the state
2067
2061
  */
2068
- node: (state: State) => State | Promise<State> | Partial<State> | Promise<Partial<State>>;
2062
+ node: (state: State) => Update | Promise<Update>;
2069
2063
  /**
2070
2064
  * Optional description of what this node does
2071
2065
  */
@@ -2081,7 +2075,9 @@ interface SequentialWorkflowOptions {
2081
2075
  */
2082
2076
  autoStartEnd?: boolean;
2083
2077
  /**
2084
- * Custom name for the workflow (for debugging)
2078
+ * Compatibility-only no-op retained to avoid a public type break.
2079
+ *
2080
+ * @deprecated This option is currently unused and will be removed in a future major release.
2085
2081
  */
2086
2082
  name?: string;
2087
2083
  }
@@ -2108,7 +2104,7 @@ interface SequentialWorkflowOptions {
2108
2104
  * @param options - Optional configuration
2109
2105
  * @returns A configured StateGraph ready to compile
2110
2106
  */
2111
- declare function createSequentialWorkflow<State>(stateSchema: any, nodes: SequentialNode<State>[], options?: SequentialWorkflowOptions): StateGraph<State>;
2107
+ declare function createSequentialWorkflow<SD extends StateDefinition, Update extends UpdateType<SD>>(stateSchema: AnnotationRoot<SD>, nodes: SequentialNode<SequentialWorkflowState<SD>, Update>[], options?: SequentialWorkflowOptions): SequentialWorkflowGraph<SD, SequentialWorkflowState<SD>, Update>;
2112
2108
  /**
2113
2109
  * Creates a sequential workflow builder with a fluent API.
2114
2110
  *
@@ -2129,11 +2125,11 @@ declare function createSequentialWorkflow<State>(stateSchema: any, nodes: Sequen
2129
2125
  * @param stateSchema - The state annotation for the graph
2130
2126
  * @returns A fluent builder for sequential workflows
2131
2127
  */
2132
- declare function sequentialBuilder<State>(stateSchema: any): {
2128
+ declare function sequentialBuilder<SD extends StateDefinition = StateDefinition, Update extends UpdateType<SD> = UpdateType<SD>>(stateSchema: AnnotationRoot<SD>): {
2133
2129
  /**
2134
2130
  * Add a node to the sequential workflow
2135
2131
  */
2136
- addNode(name: string, node: (state: State) => State | Promise<State> | Partial<State> | Promise<Partial<State>>, description?: string): /*elided*/ any;
2132
+ addNode(name: string, node: (state: _langchain_langgraph.StateType<SD>) => Update | Promise<Update>, description?: string): /*elided*/ any;
2137
2133
  /**
2138
2134
  * Set options for the workflow
2139
2135
  */
@@ -2141,7 +2137,7 @@ declare function sequentialBuilder<State>(stateSchema: any): {
2141
2137
  /**
2142
2138
  * Build the StateGraph
2143
2139
  */
2144
- build(): StateGraph<State>;
2140
+ build(): StateGraph<AnnotationRoot<SD>, _langchain_langgraph.StateType<SD>, Update, string>;
2145
2141
  };
2146
2142
 
2147
2143
  /**
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { z, ZodTypeAny, output, ZodType, ZodTypeDef } from 'zod';
2
2
  import { DynamicStructuredTool } from '@langchain/core/tools';
3
- import { AnnotationRoot, BaseChannel, StateGraph, StateDefinition, UpdateType, END, MemorySaver, BaseCheckpointSaver, CheckpointTuple } from '@langchain/langgraph';
3
+ import * as _langchain_langgraph from '@langchain/langgraph';
4
+ import { AnnotationRoot, BaseChannel, StateDefinition, UpdateType, StateGraph, END, MemorySaver, BaseCheckpointSaver, CheckpointTuple } from '@langchain/langgraph';
4
5
  import { RunnableConfig } from '@langchain/core/runnables';
5
6
 
6
7
  /**
@@ -2044,20 +2045,13 @@ declare function validateState<TConfig extends StateConfigMap, TState extends Pa
2044
2045
  */
2045
2046
  declare function mergeState<TConfig extends StateConfigMap>(currentState: Partial<StateShape<TConfig>>, update: StateUpdateShape<TConfig>, config: TConfig): Partial<StateShape<TConfig>>;
2046
2047
 
2047
- /**
2048
- * Sequential Workflow Builder
2049
- *
2050
- * Provides utilities for building linear workflows where nodes execute in sequence.
2051
- * This is a thin wrapper around LangGraph's StateGraph that simplifies the common
2052
- * pattern of chaining nodes together.
2053
- *
2054
- * @module langgraph/builders/sequential
2055
- */
2056
-
2048
+ type SequentialWorkflowState<SD extends StateDefinition> = AnnotationRoot<SD>['State'];
2049
+ type SequentialNodeResult<State> = Partial<State>;
2050
+ type SequentialWorkflowGraph<SD extends StateDefinition, State, Update> = StateGraph<AnnotationRoot<SD>, State, Update, string>;
2057
2051
  /**
2058
2052
  * Configuration for a node in a sequential workflow
2059
2053
  */
2060
- interface SequentialNode<State> {
2054
+ interface SequentialNode<State, Update = SequentialNodeResult<State>> {
2061
2055
  /**
2062
2056
  * Unique name for the node
2063
2057
  */
@@ -2065,7 +2059,7 @@ interface SequentialNode<State> {
2065
2059
  /**
2066
2060
  * The node function that processes the state
2067
2061
  */
2068
- node: (state: State) => State | Promise<State> | Partial<State> | Promise<Partial<State>>;
2062
+ node: (state: State) => Update | Promise<Update>;
2069
2063
  /**
2070
2064
  * Optional description of what this node does
2071
2065
  */
@@ -2081,7 +2075,9 @@ interface SequentialWorkflowOptions {
2081
2075
  */
2082
2076
  autoStartEnd?: boolean;
2083
2077
  /**
2084
- * Custom name for the workflow (for debugging)
2078
+ * Compatibility-only no-op retained to avoid a public type break.
2079
+ *
2080
+ * @deprecated This option is currently unused and will be removed in a future major release.
2085
2081
  */
2086
2082
  name?: string;
2087
2083
  }
@@ -2108,7 +2104,7 @@ interface SequentialWorkflowOptions {
2108
2104
  * @param options - Optional configuration
2109
2105
  * @returns A configured StateGraph ready to compile
2110
2106
  */
2111
- declare function createSequentialWorkflow<State>(stateSchema: any, nodes: SequentialNode<State>[], options?: SequentialWorkflowOptions): StateGraph<State>;
2107
+ declare function createSequentialWorkflow<SD extends StateDefinition, Update extends UpdateType<SD>>(stateSchema: AnnotationRoot<SD>, nodes: SequentialNode<SequentialWorkflowState<SD>, Update>[], options?: SequentialWorkflowOptions): SequentialWorkflowGraph<SD, SequentialWorkflowState<SD>, Update>;
2112
2108
  /**
2113
2109
  * Creates a sequential workflow builder with a fluent API.
2114
2110
  *
@@ -2129,11 +2125,11 @@ declare function createSequentialWorkflow<State>(stateSchema: any, nodes: Sequen
2129
2125
  * @param stateSchema - The state annotation for the graph
2130
2126
  * @returns A fluent builder for sequential workflows
2131
2127
  */
2132
- declare function sequentialBuilder<State>(stateSchema: any): {
2128
+ declare function sequentialBuilder<SD extends StateDefinition = StateDefinition, Update extends UpdateType<SD> = UpdateType<SD>>(stateSchema: AnnotationRoot<SD>): {
2133
2129
  /**
2134
2130
  * Add a node to the sequential workflow
2135
2131
  */
2136
- addNode(name: string, node: (state: State) => State | Promise<State> | Partial<State> | Promise<Partial<State>>, description?: string): /*elided*/ any;
2132
+ addNode(name: string, node: (state: _langchain_langgraph.StateType<SD>) => Update | Promise<Update>, description?: string): /*elided*/ any;
2137
2133
  /**
2138
2134
  * Set options for the workflow
2139
2135
  */
@@ -2141,7 +2137,7 @@ declare function sequentialBuilder<State>(stateSchema: any): {
2141
2137
  /**
2142
2138
  * Build the StateGraph
2143
2139
  */
2144
- build(): StateGraph<State>;
2140
+ build(): StateGraph<AnnotationRoot<SD>, _langchain_langgraph.StateType<SD>, Update, string>;
2145
2141
  };
2146
2142
 
2147
2143
  /**
package/dist/index.js CHANGED
@@ -2122,7 +2122,7 @@ function mergeState(currentState, update, config) {
2122
2122
  // src/langgraph/builders/sequential.ts
2123
2123
  import { StateGraph, END, START } from "@langchain/langgraph";
2124
2124
  function createSequentialWorkflow(stateSchema, nodes, options = {}) {
2125
- const { autoStartEnd = true, name } = options;
2125
+ const { autoStartEnd = true } = options;
2126
2126
  if (nodes.length === 0) {
2127
2127
  throw new Error("Sequential workflow must have at least one node");
2128
2128
  }
@@ -2133,7 +2133,16 @@ function createSequentialWorkflow(stateSchema, nodes, options = {}) {
2133
2133
  }
2134
2134
  nodeNames.add(node.name);
2135
2135
  }
2136
- const graph = new StateGraph(stateSchema);
2136
+ let graph;
2137
+ try {
2138
+ graph = new StateGraph(
2139
+ stateSchema
2140
+ );
2141
+ } catch (error) {
2142
+ throw new Error("Sequential workflow requires a LangGraph Annotation.Root schema", {
2143
+ cause: error
2144
+ });
2145
+ }
2137
2146
  for (const { name: nodeName, node } of nodes) {
2138
2147
  graph.addNode(nodeName, node);
2139
2148
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentforge/core",
3
- "version": "0.15.14",
3
+ "version": "0.16.0",
4
4
  "description": "Production-ready TypeScript agent framework built on LangGraph with orchestration, middleware, and typed abstractions.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",