@langchain/langgraph 0.1.10-rc.1 → 0.1.10-rc.2

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.
@@ -1,4 +1,4 @@
1
1
  export { Annotation, type StateType, type UpdateType, type NodeType, AnnotationRoot, type StateDefinition, type SingleReducer, } from "./annotation.js";
2
2
  export { END, START, Graph, type CompiledGraph } from "./graph.js";
3
3
  export { type StateGraphArgs, StateGraph, type CompiledStateGraph, } from "./state.js";
4
- export { MessageGraph, messagesStateReducer, type Messages } from "./message.js";
4
+ export { MessageGraph, messagesStateReducer, type Messages, } from "./message.js";
@@ -1,4 +1,4 @@
1
1
  export { Annotation, AnnotationRoot, } from "./annotation.js";
2
2
  export { END, START, Graph } from "./graph.js";
3
3
  export { StateGraph, } from "./state.js";
4
- export { MessageGraph, messagesStateReducer } from "./message.js";
4
+ export { MessageGraph, messagesStateReducer, } from "./message.js";
@@ -91,18 +91,21 @@ class StateGraph extends graph_js_1.Graph {
91
91
  writable: true,
92
92
  value: new Set()
93
93
  });
94
+ /** @internal */
94
95
  Object.defineProperty(this, "_schemaDefinition", {
95
96
  enumerable: true,
96
97
  configurable: true,
97
98
  writable: true,
98
99
  value: void 0
99
100
  });
101
+ /** @internal */
100
102
  Object.defineProperty(this, "_inputDefinition", {
101
103
  enumerable: true,
102
104
  configurable: true,
103
105
  writable: true,
104
106
  value: void 0
105
107
  });
108
+ /** @internal */
106
109
  Object.defineProperty(this, "_outputDefinition", {
107
110
  enumerable: true,
108
111
  configurable: true,
@@ -116,8 +119,10 @@ class StateGraph extends graph_js_1.Graph {
116
119
  }
117
120
  else if (isStateGraphArgsWithStateSchema(fields)) {
118
121
  this._schemaDefinition = fields.stateSchema.spec;
119
- this._inputDefinition = (fields.input?.spec ?? this._schemaDefinition);
120
- this._outputDefinition = (fields.output?.spec ?? this._schemaDefinition);
122
+ this._inputDefinition = (fields.input?.spec ??
123
+ this._schemaDefinition);
124
+ this._outputDefinition = (fields.output?.spec ??
125
+ this._schemaDefinition);
121
126
  }
122
127
  else if (isStateDefinition(fields) || isAnnotationRoot(fields)) {
123
128
  const spec = isAnnotationRoot(fields) ? fields.spec : fields;
@@ -223,10 +228,10 @@ class StateGraph extends graph_js_1.Graph {
223
228
  ...(Array.isArray(interruptAfter) ? interruptAfter : []),
224
229
  ]);
225
230
  // prepare output channels
226
- const stateKeys = Object.keys(this._schemaDefinition);
227
- const outputChannels = stateKeys.length === 1 && stateKeys[0] === ROOT ? ROOT : stateKeys;
228
231
  const outputKeys = Object.keys(this._outputDefinition);
229
- const streamChannels = outputKeys.length === 1 && outputKeys[0] === ROOT ? ROOT : outputKeys;
232
+ const outputChannels = outputKeys.length === 1 && outputKeys[0] === ROOT ? ROOT : outputKeys;
233
+ const streamKeys = Object.keys(this.channels);
234
+ const streamChannels = streamKeys.length === 1 && streamKeys[0] === ROOT ? ROOT : streamKeys;
230
235
  // create empty compiled graph
231
236
  const compiled = new CompiledStateGraph({
232
237
  builder: this,
@@ -430,6 +435,7 @@ function isStateGraphArgsWithStateSchema(obj) {
430
435
  function isStateGraphArgsWithInputOutputSchemas(obj) {
431
436
  return (typeof obj === "object" &&
432
437
  obj !== null &&
438
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
433
439
  obj.stateSchema === undefined &&
434
440
  obj.input !== undefined &&
435
441
  obj.output !== undefined);
@@ -95,8 +95,11 @@ export type StateGraphArgsWithInputOutputSchemas<SD extends StateDefinition, O e
95
95
  export declare class StateGraph<SD extends StateDefinition | unknown, S = SD extends StateDefinition ? StateType<SD> : SD, U = SD extends StateDefinition ? UpdateType<SD> : Partial<S>, N extends string = typeof START, I extends StateDefinition = SD extends StateDefinition ? SD : StateDefinition, O extends StateDefinition = SD extends StateDefinition ? SD : StateDefinition> extends Graph<N, S, U, StateGraphNodeSpec<S, U>> {
96
96
  channels: Record<string, BaseChannel>;
97
97
  waitingEdges: Set<[N[], N]>;
98
+ /** @internal */
98
99
  _schemaDefinition: StateDefinition;
100
+ /** @internal */
99
101
  _inputDefinition: I;
102
+ /** @internal */
100
103
  _outputDefinition: O;
101
104
  constructor(fields: SD extends StateDefinition ? SD | AnnotationRoot<SD> | StateGraphArgs<S> | StateGraphArgsWithStateSchema<SD, I, O> | StateGraphArgsWithInputOutputSchemas<SD, O> : StateGraphArgs<S>);
102
105
  get allEdges(): Set<[string, string]>;
@@ -88,18 +88,21 @@ export class StateGraph extends Graph {
88
88
  writable: true,
89
89
  value: new Set()
90
90
  });
91
+ /** @internal */
91
92
  Object.defineProperty(this, "_schemaDefinition", {
92
93
  enumerable: true,
93
94
  configurable: true,
94
95
  writable: true,
95
96
  value: void 0
96
97
  });
98
+ /** @internal */
97
99
  Object.defineProperty(this, "_inputDefinition", {
98
100
  enumerable: true,
99
101
  configurable: true,
100
102
  writable: true,
101
103
  value: void 0
102
104
  });
105
+ /** @internal */
103
106
  Object.defineProperty(this, "_outputDefinition", {
104
107
  enumerable: true,
105
108
  configurable: true,
@@ -113,8 +116,10 @@ export class StateGraph extends Graph {
113
116
  }
114
117
  else if (isStateGraphArgsWithStateSchema(fields)) {
115
118
  this._schemaDefinition = fields.stateSchema.spec;
116
- this._inputDefinition = (fields.input?.spec ?? this._schemaDefinition);
117
- this._outputDefinition = (fields.output?.spec ?? this._schemaDefinition);
119
+ this._inputDefinition = (fields.input?.spec ??
120
+ this._schemaDefinition);
121
+ this._outputDefinition = (fields.output?.spec ??
122
+ this._schemaDefinition);
118
123
  }
119
124
  else if (isStateDefinition(fields) || isAnnotationRoot(fields)) {
120
125
  const spec = isAnnotationRoot(fields) ? fields.spec : fields;
@@ -220,10 +225,10 @@ export class StateGraph extends Graph {
220
225
  ...(Array.isArray(interruptAfter) ? interruptAfter : []),
221
226
  ]);
222
227
  // prepare output channels
223
- const stateKeys = Object.keys(this._schemaDefinition);
224
- const outputChannels = stateKeys.length === 1 && stateKeys[0] === ROOT ? ROOT : stateKeys;
225
228
  const outputKeys = Object.keys(this._outputDefinition);
226
- const streamChannels = outputKeys.length === 1 && outputKeys[0] === ROOT ? ROOT : outputKeys;
229
+ const outputChannels = outputKeys.length === 1 && outputKeys[0] === ROOT ? ROOT : outputKeys;
230
+ const streamKeys = Object.keys(this.channels);
231
+ const streamChannels = streamKeys.length === 1 && streamKeys[0] === ROOT ? ROOT : streamKeys;
227
232
  // create empty compiled graph
228
233
  const compiled = new CompiledStateGraph({
229
234
  builder: this,
@@ -425,6 +430,7 @@ function isStateGraphArgsWithStateSchema(obj) {
425
430
  function isStateGraphArgsWithInputOutputSchemas(obj) {
426
431
  return (typeof obj === "object" &&
427
432
  obj !== null &&
433
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
428
434
  obj.stateSchema === undefined &&
429
435
  obj.input !== undefined &&
430
436
  obj.output !== undefined);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@langchain/langgraph",
3
- "version": "0.1.10-rc.1",
3
+ "version": "0.1.10-rc.2",
4
4
  "description": "LangGraph",
5
5
  "type": "module",
6
6
  "engines": {