@langchain/langgraph 0.2.7 → 0.2.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.
Files changed (45) hide show
  1. package/dist/constants.cjs +12 -2
  2. package/dist/constants.d.ts +7 -1
  3. package/dist/constants.js +11 -1
  4. package/dist/errors.cjs +5 -4
  5. package/dist/errors.d.ts +1 -1
  6. package/dist/errors.js +5 -4
  7. package/dist/graph/graph.cjs +7 -2
  8. package/dist/graph/graph.js +8 -3
  9. package/dist/graph/message.cjs +2 -0
  10. package/dist/graph/message.js +2 -0
  11. package/dist/graph/state.cjs +9 -7
  12. package/dist/graph/state.d.ts +2 -2
  13. package/dist/graph/state.js +10 -8
  14. package/dist/managed/shared_value.cjs +1 -1
  15. package/dist/managed/shared_value.js +1 -1
  16. package/dist/pregel/algo.cjs +119 -54
  17. package/dist/pregel/algo.d.ts +5 -2
  18. package/dist/pregel/algo.js +117 -53
  19. package/dist/pregel/debug.cjs +15 -18
  20. package/dist/pregel/debug.d.ts +3 -2
  21. package/dist/pregel/debug.js +16 -19
  22. package/dist/pregel/index.cjs +295 -123
  23. package/dist/pregel/index.d.ts +16 -5
  24. package/dist/pregel/index.js +292 -123
  25. package/dist/pregel/io.cjs +15 -8
  26. package/dist/pregel/io.d.ts +2 -2
  27. package/dist/pregel/io.js +15 -8
  28. package/dist/pregel/loop.cjs +256 -111
  29. package/dist/pregel/loop.d.ts +21 -5
  30. package/dist/pregel/loop.js +256 -109
  31. package/dist/pregel/read.cjs +9 -2
  32. package/dist/pregel/read.d.ts +2 -1
  33. package/dist/pregel/read.js +9 -2
  34. package/dist/pregel/retry.d.ts +1 -1
  35. package/dist/pregel/types.d.ts +5 -2
  36. package/dist/pregel/utils/config.cjs +72 -0
  37. package/dist/pregel/utils/config.d.ts +2 -0
  38. package/dist/pregel/utils/config.js +68 -0
  39. package/dist/pregel/{utils.cjs → utils/index.cjs} +33 -10
  40. package/dist/pregel/{utils.d.ts → utils/index.d.ts} +4 -7
  41. package/dist/pregel/{utils.js → utils/index.js} +30 -8
  42. package/dist/utils.cjs +5 -3
  43. package/dist/utils.js +5 -3
  44. package/dist/web.d.ts +2 -1
  45. package/package.json +1 -1
@@ -1,12 +1,12 @@
1
1
  import { Runnable, RunnableConfig, RunnableFunc } from "@langchain/core/runnables";
2
2
  import { IterableReadableStream } from "@langchain/core/utils/stream";
3
- import { All, BaseCheckpointSaver, CheckpointListOptions } from "@langchain/langgraph-checkpoint";
3
+ import { All, BaseCheckpointSaver, CheckpointListOptions, CheckpointTuple } from "@langchain/langgraph-checkpoint";
4
4
  import { BaseChannel } from "../channels/base.js";
5
5
  import { PregelNode } from "./read.js";
6
6
  import { ChannelWrite } from "./write.js";
7
7
  import { PregelInterface, PregelParams, StateSnapshot, StreamMode } from "./types.js";
8
8
  import { StrRecord } from "./algo.js";
9
- import { RetryPolicy } from "./utils.js";
9
+ import { RetryPolicy } from "./utils/index.js";
10
10
  import { BaseStore } from "../store/base.js";
11
11
  import { ManagedValueMapping, type ManagedValueSpec } from "../managed/base.js";
12
12
  type WriteValue = Runnable | RunnableFunc<unknown, unknown> | unknown;
@@ -35,6 +35,8 @@ export interface PregelOptions<Nn extends StrRecord<string, PregelNode>, Cc exte
35
35
  interruptAfter?: All | Array<keyof Nn>;
36
36
  /** Enable debug mode for the graph run. */
37
37
  debug?: boolean;
38
+ /** Whether to stream subgraphs. */
39
+ subgraphs?: boolean;
38
40
  }
39
41
  export type PregelInputType = any;
40
42
  export type PregelOutputType = any;
@@ -45,7 +47,6 @@ export declare class Pregel<Nn extends StrRecord<string, PregelNode>, Cc extends
45
47
  channels: Cc;
46
48
  inputChannels: keyof Cc | Array<keyof Cc>;
47
49
  outputChannels: keyof Cc | Array<keyof Cc>;
48
- configKeys?: string[];
49
50
  autoValidate: boolean;
50
51
  streamMode: StreamMode[];
51
52
  streamChannels?: keyof Cc | Array<keyof Cc>;
@@ -55,15 +56,25 @@ export declare class Pregel<Nn extends StrRecord<string, PregelNode>, Cc extends
55
56
  debug: boolean;
56
57
  checkpointer?: BaseCheckpointSaver;
57
58
  retryPolicy?: RetryPolicy;
59
+ config?: RunnableConfig;
58
60
  store?: BaseStore;
59
61
  constructor(fields: PregelParams<Nn, Cc>);
62
+ withConfig(config: RunnableConfig): typeof this;
60
63
  validate(): this;
61
64
  get streamChannelsList(): Array<keyof Cc>;
62
65
  get streamChannelsAsIs(): keyof Cc | Array<keyof Cc>;
66
+ getSubgraphs(namespace?: string, recurse?: boolean): Generator<[string, Pregel<any, any>]>;
67
+ protected _prepareStateSnapshot({ config, saved, subgraphCheckpointer, }: {
68
+ config: RunnableConfig;
69
+ saved?: CheckpointTuple;
70
+ subgraphCheckpointer?: BaseCheckpointSaver;
71
+ }): Promise<StateSnapshot>;
63
72
  /**
64
73
  * Get the current state of the graph.
65
74
  */
66
- getState(config: RunnableConfig): Promise<StateSnapshot>;
75
+ getState(config: RunnableConfig, options?: {
76
+ subgraphs?: boolean;
77
+ }): Promise<StateSnapshot>;
67
78
  /**
68
79
  * Get the history of the state of the graph.
69
80
  */
@@ -73,7 +84,7 @@ export declare class Pregel<Nn extends StrRecord<string, PregelNode>, Cc extends
73
84
  * node `as_node`. If `as_node` is not provided, it will be set to the last node
74
85
  * that updated the state, if not ambiguous.
75
86
  */
76
- updateState(config: RunnableConfig, values: Record<string, unknown> | unknown, asNode?: keyof Nn): Promise<RunnableConfig>;
87
+ updateState(inputConfig: RunnableConfig, values: Record<string, unknown> | unknown, asNode?: keyof Nn | string): Promise<RunnableConfig>;
77
88
  _defaults(config: PregelOptions<Nn, Cc>): [
78
89
  boolean,
79
90
  StreamMode[],