@langchain/langgraph 1.3.4 → 1.3.6

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 (73) hide show
  1. package/dist/index.cjs +4 -3
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.d.cts +2 -2
  4. package/dist/index.d.ts +2 -2
  5. package/dist/index.js +3 -3
  6. package/dist/index.js.map +1 -1
  7. package/dist/{setup/async_local_storage.cjs → node.cjs} +2 -2
  8. package/dist/node.cjs.map +1 -0
  9. package/dist/{setup/async_local_storage.js → node.js} +2 -2
  10. package/dist/node.js.map +1 -0
  11. package/dist/pregel/index.cjs +13 -12
  12. package/dist/pregel/index.cjs.map +1 -1
  13. package/dist/pregel/index.d.cts.map +1 -1
  14. package/dist/pregel/index.d.ts.map +1 -1
  15. package/dist/pregel/index.js +13 -12
  16. package/dist/pregel/index.js.map +1 -1
  17. package/dist/pregel/loop.cjs +19 -33
  18. package/dist/pregel/loop.cjs.map +1 -1
  19. package/dist/pregel/loop.js +19 -33
  20. package/dist/pregel/loop.js.map +1 -1
  21. package/dist/pregel/remote.cjs +1 -1
  22. package/dist/pregel/remote.cjs.map +1 -1
  23. package/dist/pregel/remote.d.cts +4 -3
  24. package/dist/pregel/remote.d.cts.map +1 -1
  25. package/dist/pregel/remote.d.ts +4 -3
  26. package/dist/pregel/remote.d.ts.map +1 -1
  27. package/dist/pregel/remote.js +1 -1
  28. package/dist/pregel/remote.js.map +1 -1
  29. package/dist/pregel/stream.cjs +12 -0
  30. package/dist/pregel/stream.cjs.map +1 -1
  31. package/dist/pregel/stream.d.cts +2 -24
  32. package/dist/pregel/stream.d.cts.map +1 -1
  33. package/dist/pregel/stream.d.ts +2 -24
  34. package/dist/pregel/stream.d.ts.map +1 -1
  35. package/dist/pregel/stream.js +12 -1
  36. package/dist/pregel/stream.js.map +1 -1
  37. package/dist/stream/convert.cjs +29 -23
  38. package/dist/stream/convert.cjs.map +1 -1
  39. package/dist/stream/convert.d.cts +9 -38
  40. package/dist/stream/convert.d.cts.map +1 -1
  41. package/dist/stream/convert.d.ts +9 -38
  42. package/dist/stream/convert.d.ts.map +1 -1
  43. package/dist/stream/convert.js +29 -24
  44. package/dist/stream/convert.js.map +1 -1
  45. package/dist/stream/index.cjs +1 -1
  46. package/dist/stream/index.d.cts +1 -1
  47. package/dist/stream/index.d.ts +1 -1
  48. package/dist/stream/index.js +1 -1
  49. package/dist/stream/mux.cjs +16 -7
  50. package/dist/stream/mux.cjs.map +1 -1
  51. package/dist/stream/mux.d.cts +2 -2
  52. package/dist/stream/mux.d.cts.map +1 -1
  53. package/dist/stream/mux.d.ts +2 -2
  54. package/dist/stream/mux.d.ts.map +1 -1
  55. package/dist/stream/mux.js +16 -7
  56. package/dist/stream/mux.js.map +1 -1
  57. package/dist/stream/stream-channel.cjs +3 -3
  58. package/dist/stream/stream-channel.cjs.map +1 -1
  59. package/dist/stream/stream-channel.d.cts +3 -3
  60. package/dist/stream/stream-channel.d.ts +3 -3
  61. package/dist/stream/stream-channel.js +3 -3
  62. package/dist/stream/stream-channel.js.map +1 -1
  63. package/dist/stream/types.cjs.map +1 -1
  64. package/dist/stream/types.d.cts +4 -4
  65. package/dist/stream/types.d.ts +4 -4
  66. package/dist/stream/types.js.map +1 -1
  67. package/dist/web.cjs +2 -1
  68. package/dist/web.d.cts +2 -2
  69. package/dist/web.d.ts +2 -2
  70. package/dist/web.js +2 -2
  71. package/package.json +13 -12
  72. package/dist/setup/async_local_storage.cjs.map +0 -1
  73. package/dist/setup/async_local_storage.js.map +0 -1
package/dist/index.cjs CHANGED
@@ -1,13 +1,13 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_async_local_storage = require("./setup/async_local_storage.cjs");
2
+ const require_node = require("./node.cjs");
3
3
  const require_constants = require("./constants.cjs");
4
4
  const require_errors = require("./errors.cjs");
5
5
  const require_base = require("./channels/base.cjs");
6
6
  const require_binop = require("./channels/binop.cjs");
7
7
  const require_annotation = require("./graph/annotation.cjs");
8
8
  const require_config = require("./pregel/utils/config.cjs");
9
- const require_stream_channel = require("./stream/stream-channel.cjs");
10
9
  const require_convert = require("./stream/convert.cjs");
10
+ const require_stream_channel = require("./stream/stream-channel.cjs");
11
11
  const require_lifecycle = require("./stream/transformers/lifecycle.cjs");
12
12
  const require_messages = require("./stream/transformers/messages.cjs");
13
13
  const require_subgraphs = require("./stream/transformers/subgraphs.cjs");
@@ -33,7 +33,7 @@ require("./web.cjs");
33
33
  let _langchain_langgraph_checkpoint = require("@langchain/langgraph-checkpoint");
34
34
  let _langchain_core_language_models_stream = require("@langchain/core/language_models/stream");
35
35
  //#region src/index.ts
36
- require_async_local_storage.initializeAsyncLocalStorageSingleton();
36
+ require_node.initializeAsyncLocalStorageSingleton();
37
37
  //#endregion
38
38
  exports.Annotation = require_annotation.Annotation;
39
39
  Object.defineProperty(exports, "AsyncBatchedStore", {
@@ -145,6 +145,7 @@ exports.getStore = require_config.getStore;
145
145
  exports.getSubgraphsSeenSet = require_errors.getSubgraphsSeenSet;
146
146
  exports.getWriter = require_config.getWriter;
147
147
  exports.interrupt = require_interrupt.interrupt;
148
+ exports.isCheckpointEnvelope = require_convert.isCheckpointEnvelope;
148
149
  exports.isCommand = require_constants.isCommand;
149
150
  exports.isGraphBubbleUp = require_errors.isGraphBubbleUp;
150
151
  exports.isGraphInterrupt = require_errors.isGraphInterrupt;
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["initializeAsyncLocalStorageSingleton"],"sources":["../src/index.ts"],"sourcesContent":["/* __LC_ALLOW_ENTRYPOINT_SIDE_EFFECTS__ */\n\nimport { initializeAsyncLocalStorageSingleton } from \"./setup/async_local_storage.js\";\n\n// Initialize global async local storage instance for tracing\ninitializeAsyncLocalStorageSingleton();\n\nexport * from \"./web.js\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKAA,4BAAAA,sCAAsC"}
1
+ {"version":3,"file":"index.cjs","names":["initializeAsyncLocalStorageSingleton"],"sources":["../src/index.ts"],"sourcesContent":["/* __LC_ALLOW_ENTRYPOINT_SIDE_EFFECTS__ */\n\nimport { initializeAsyncLocalStorageSingleton } from \"./node.js\";\n\n// Initialize global async local storage instance for tracing\ninitializeAsyncLocalStorageSingleton();\n\nexport * from \"./web.js\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKAA,aAAAA,sCAAsC"}
package/dist/index.d.cts CHANGED
@@ -15,7 +15,7 @@ import { PregelNode } from "./pregel/read.cjs";
15
15
  import { AgentStatus, ChatModelStream, InferExtensions, InterruptPayload, LifecycleCause, LifecycleData, MessagesEventData, Namespace, NativeStreamTransformer, ProtocolEvent, StreamEmitter, StreamTransformer, ToolCallStatus, ToolCallStream, ToolsEventData, UpdatesEventData, UsageInfo, isNativeTransformer } from "./stream/types.cjs";
16
16
  import { GetStateOptions, MultipleChannelSubscriptionOptions, PregelOptions, PregelParams, SingleChannelSubscriptionOptions, StateSnapshot, StreamMode, StreamOutputMap } from "./pregel/types.cjs";
17
17
  import { StreamChannel } from "./stream/stream-channel.cjs";
18
- import { ConvertToProtocolEventOptions, STREAM_EVENTS_V3_MODES, convertToProtocolEvent } from "./stream/convert.cjs";
18
+ import { ConvertToProtocolEventOptions, STREAM_EVENTS_V3_MODES, convertToProtocolEvent, isCheckpointEnvelope } from "./stream/convert.cjs";
19
19
  import { LifecycleEntry, LifecycleTransformerOptions } from "./stream/transformers/types.cjs";
20
20
  import { LifecycleProjection, createLifecycleTransformer, filterLifecycleEntries } from "./stream/transformers/lifecycle.cjs";
21
21
  import { createMessagesTransformer } from "./stream/transformers/messages.cjs";
@@ -42,4 +42,4 @@ import { getJsonSchemaFromSchema, getSchemaDefaultGetter } from "./state/adapter
42
42
  import { MessagesValue } from "./state/prebuilt/messages.cjs";
43
43
  import { getConfig, getCurrentTaskInput, getStore, getWriter } from "./pregel/utils/config.cjs";
44
44
  import { AsyncBatchedStore, BaseCheckpointSaver, BaseStore, Checkpoint, CheckpointMetadata, CheckpointTuple, GetOperation, InMemoryStore, Item, ListNamespacesOperation, MatchCondition, MemorySaver, NameSpacePath, NamespaceMatchType, Operation, OperationResults, PutOperation, SearchOperation, copyCheckpoint, emptyCheckpoint } from "./web.cjs";
45
- export { AddNodeOptions, AgentStatus, Annotation, AnnotationRoot, AnyStateSchema, AnyValue, AsyncBatchedStore, BaseChannel, BaseCheckpointSaver, BaseLangGraphError, BaseLangGraphErrorFields, BaseStore, BinaryOperator, BinaryOperatorAggregate, COMMAND_SYMBOL, CachePolicy, ChatModelStream, ChatModelStreamImpl, Checkpoint, CheckpointMetadata, CheckpointTuple, Command, CommandInstance, CommandParams, CompiledGraph, CompiledGraphType, CompiledStateGraph, ConditionalEdgeRouter, ConditionalEdgeRouterTypes, ContextSchemaInit, ConvertToProtocolEventOptions, CreateGraphRunStreamOptions, DynamicBarrierValue, END, EmptyChannelError, EmptyInputError, EntrypointOptions, EphemeralValue, StreamChannel as EventLog, ExecutionInfo, ExtractStateType, ExtractUpdateType, GetOperation, GetStateOptions, Graph, GraphBubbleUp, GraphInterrupt, GraphNode, GraphNodeReturnValue, GraphNodeTypes, GraphRecursionError, GraphRunStream, GraphValueError, INTERRUPT, InMemoryStore, InferExtensions, InferInterruptInputType, InferInterruptResumeType, InferStateSchemaUpdate, InferStateSchemaValue, InferWriterType, Interrupt, InterruptPayload, InvalidUpdateError, Item, LangGraphRunnableConfig, LastValue, LifecycleCause, LifecycleData, LifecycleEntry, LifecycleProjection, LifecycleTransformerOptions, ListNamespacesOperation, MatchCondition, MemorySaver, MessageGraph, Messages, MessagesAnnotation, MessagesEventData, MessagesValue, MessagesZodMeta, MessagesZodState, MultipleChannelSubscriptionOptions, MultipleSubgraphsError, NameSpacePath, NamedBarrierValue, Namespace, NamespaceMatchType, NativeStreamTransformer, NodeInterrupt, NodeSpec, NodeType, Operation, OperationResults, Overwrite, OverwriteValue, ParentCommand, Pregel, PregelNode, PregelOptions, PregelParams, ProtocolEvent, PutOperation, REMOVE_ALL_MESSAGES, ReducedValue, ReducedValueInit, RemoteException, RetryPolicy, Runtime, START, STREAM_EVENTS_V3_MODES, SearchOperation, Send, ServerInfo, SingleChannelSubscriptionOptions, SingleReducer, StateDefinition, StateDefinitionInit, StateGraph, StateGraphAddNodeOptions, StateGraphArgs, StateGraphArgsWithInputOutputSchemas, StateGraphArgsWithStateSchema, StateGraphInit, StateGraphInputError, StateGraphNodeSpec, StateGraphOptions, StateSchema, StateSchemaField, StateSchemaFieldToChannel, StateSchemaFields, StateSchemaFieldsToStateDefinition, StateSnapshot, StateType, StreamChannel, StreamEmitter, StreamMode, StreamOutputMap, StreamTransformer, SubgraphDiscoveryProjection, SubgraphDiscoveryTransformerOptions, SubgraphRunStream, TaskOptions, ToStateDefinition, ToolCallStatus, ToolCallStream, ToolsEventData, Topic, UnreachableNodeError, UntrackedValue, UntrackedValueChannel, UntrackedValueInit, UpdateType, UpdatesEventData, UsageInfo, WaitForNames, messagesStateReducer as addMessages, convertToProtocolEvent, copyCheckpoint, createGraphRunStream, createLifecycleTransformer, createMessagesTransformer, createSubgraphDiscoveryTransformer, createValuesTransformer, emptyCheckpoint, entrypoint, filterLifecycleEntries, filterSubgraphHandles, getConfig, getCurrentTaskInput, getJsonSchemaFromSchema, getPreviousState, getSchemaDefaultGetter, getStore, getSubgraphsSeenSet, getWriter, interrupt, isCommand, isGraphBubbleUp, isGraphInterrupt, isInterrupted, isNativeTransformer, isParentCommand, isSerializableSchema, isStandardSchema, messagesStateReducer, pushMessage, task, writer };
45
+ export { AddNodeOptions, AgentStatus, Annotation, AnnotationRoot, AnyStateSchema, AnyValue, AsyncBatchedStore, BaseChannel, BaseCheckpointSaver, BaseLangGraphError, BaseLangGraphErrorFields, BaseStore, BinaryOperator, BinaryOperatorAggregate, COMMAND_SYMBOL, CachePolicy, ChatModelStream, ChatModelStreamImpl, Checkpoint, CheckpointMetadata, CheckpointTuple, Command, CommandInstance, CommandParams, CompiledGraph, CompiledGraphType, CompiledStateGraph, ConditionalEdgeRouter, ConditionalEdgeRouterTypes, ContextSchemaInit, ConvertToProtocolEventOptions, CreateGraphRunStreamOptions, DynamicBarrierValue, END, EmptyChannelError, EmptyInputError, EntrypointOptions, EphemeralValue, StreamChannel as EventLog, ExecutionInfo, ExtractStateType, ExtractUpdateType, GetOperation, GetStateOptions, Graph, GraphBubbleUp, GraphInterrupt, GraphNode, GraphNodeReturnValue, GraphNodeTypes, GraphRecursionError, GraphRunStream, GraphValueError, INTERRUPT, InMemoryStore, InferExtensions, InferInterruptInputType, InferInterruptResumeType, InferStateSchemaUpdate, InferStateSchemaValue, InferWriterType, Interrupt, InterruptPayload, InvalidUpdateError, Item, LangGraphRunnableConfig, LastValue, LifecycleCause, LifecycleData, LifecycleEntry, LifecycleProjection, LifecycleTransformerOptions, ListNamespacesOperation, MatchCondition, MemorySaver, MessageGraph, Messages, MessagesAnnotation, MessagesEventData, MessagesValue, MessagesZodMeta, MessagesZodState, MultipleChannelSubscriptionOptions, MultipleSubgraphsError, NameSpacePath, NamedBarrierValue, Namespace, NamespaceMatchType, NativeStreamTransformer, NodeInterrupt, NodeSpec, NodeType, Operation, OperationResults, Overwrite, OverwriteValue, ParentCommand, Pregel, PregelNode, PregelOptions, PregelParams, ProtocolEvent, PutOperation, REMOVE_ALL_MESSAGES, ReducedValue, ReducedValueInit, RemoteException, RetryPolicy, Runtime, START, STREAM_EVENTS_V3_MODES, SearchOperation, Send, ServerInfo, SingleChannelSubscriptionOptions, SingleReducer, StateDefinition, StateDefinitionInit, StateGraph, StateGraphAddNodeOptions, StateGraphArgs, StateGraphArgsWithInputOutputSchemas, StateGraphArgsWithStateSchema, StateGraphInit, StateGraphInputError, StateGraphNodeSpec, StateGraphOptions, StateSchema, StateSchemaField, StateSchemaFieldToChannel, StateSchemaFields, StateSchemaFieldsToStateDefinition, StateSnapshot, StateType, StreamChannel, StreamEmitter, StreamMode, StreamOutputMap, StreamTransformer, SubgraphDiscoveryProjection, SubgraphDiscoveryTransformerOptions, SubgraphRunStream, TaskOptions, ToStateDefinition, ToolCallStatus, ToolCallStream, ToolsEventData, Topic, UnreachableNodeError, UntrackedValue, UntrackedValueChannel, UntrackedValueInit, UpdateType, UpdatesEventData, UsageInfo, WaitForNames, messagesStateReducer as addMessages, convertToProtocolEvent, copyCheckpoint, createGraphRunStream, createLifecycleTransformer, createMessagesTransformer, createSubgraphDiscoveryTransformer, createValuesTransformer, emptyCheckpoint, entrypoint, filterLifecycleEntries, filterSubgraphHandles, getConfig, getCurrentTaskInput, getJsonSchemaFromSchema, getPreviousState, getSchemaDefaultGetter, getStore, getSubgraphsSeenSet, getWriter, interrupt, isCheckpointEnvelope, isCommand, isGraphBubbleUp, isGraphInterrupt, isInterrupted, isNativeTransformer, isParentCommand, isSerializableSchema, isStandardSchema, messagesStateReducer, pushMessage, task, writer };
package/dist/index.d.ts CHANGED
@@ -15,7 +15,7 @@ import { PregelNode } from "./pregel/read.js";
15
15
  import { AgentStatus, ChatModelStream, InferExtensions, InterruptPayload, LifecycleCause, LifecycleData, MessagesEventData, Namespace, NativeStreamTransformer, ProtocolEvent, StreamEmitter, StreamTransformer, ToolCallStatus, ToolCallStream, ToolsEventData, UpdatesEventData, UsageInfo, isNativeTransformer } from "./stream/types.js";
16
16
  import { GetStateOptions, MultipleChannelSubscriptionOptions, PregelOptions, PregelParams, SingleChannelSubscriptionOptions, StateSnapshot, StreamMode, StreamOutputMap } from "./pregel/types.js";
17
17
  import { StreamChannel } from "./stream/stream-channel.js";
18
- import { ConvertToProtocolEventOptions, STREAM_EVENTS_V3_MODES, convertToProtocolEvent } from "./stream/convert.js";
18
+ import { ConvertToProtocolEventOptions, STREAM_EVENTS_V3_MODES, convertToProtocolEvent, isCheckpointEnvelope } from "./stream/convert.js";
19
19
  import { LifecycleEntry, LifecycleTransformerOptions } from "./stream/transformers/types.js";
20
20
  import { LifecycleProjection, createLifecycleTransformer, filterLifecycleEntries } from "./stream/transformers/lifecycle.js";
21
21
  import { createMessagesTransformer } from "./stream/transformers/messages.js";
@@ -42,4 +42,4 @@ import { getJsonSchemaFromSchema, getSchemaDefaultGetter } from "./state/adapter
42
42
  import { MessagesValue } from "./state/prebuilt/messages.js";
43
43
  import { getConfig, getCurrentTaskInput, getStore, getWriter } from "./pregel/utils/config.js";
44
44
  import { AsyncBatchedStore, BaseCheckpointSaver, BaseStore, Checkpoint, CheckpointMetadata, CheckpointTuple, GetOperation, InMemoryStore, Item, ListNamespacesOperation, MatchCondition, MemorySaver, NameSpacePath, NamespaceMatchType, Operation, OperationResults, PutOperation, SearchOperation, copyCheckpoint, emptyCheckpoint } from "./web.js";
45
- export { AddNodeOptions, AgentStatus, Annotation, AnnotationRoot, AnyStateSchema, AnyValue, AsyncBatchedStore, BaseChannel, BaseCheckpointSaver, BaseLangGraphError, BaseLangGraphErrorFields, BaseStore, BinaryOperator, BinaryOperatorAggregate, COMMAND_SYMBOL, CachePolicy, ChatModelStream, ChatModelStreamImpl, Checkpoint, CheckpointMetadata, CheckpointTuple, Command, CommandInstance, CommandParams, CompiledGraph, CompiledGraphType, CompiledStateGraph, ConditionalEdgeRouter, ConditionalEdgeRouterTypes, ContextSchemaInit, ConvertToProtocolEventOptions, CreateGraphRunStreamOptions, DynamicBarrierValue, END, EmptyChannelError, EmptyInputError, EntrypointOptions, EphemeralValue, StreamChannel as EventLog, ExecutionInfo, ExtractStateType, ExtractUpdateType, GetOperation, GetStateOptions, Graph, GraphBubbleUp, GraphInterrupt, GraphNode, GraphNodeReturnValue, GraphNodeTypes, GraphRecursionError, GraphRunStream, GraphValueError, INTERRUPT, InMemoryStore, InferExtensions, InferInterruptInputType, InferInterruptResumeType, InferStateSchemaUpdate, InferStateSchemaValue, InferWriterType, Interrupt, InterruptPayload, InvalidUpdateError, Item, LangGraphRunnableConfig, LastValue, LifecycleCause, LifecycleData, LifecycleEntry, LifecycleProjection, LifecycleTransformerOptions, ListNamespacesOperation, MatchCondition, MemorySaver, MessageGraph, Messages, MessagesAnnotation, MessagesEventData, MessagesValue, MessagesZodMeta, MessagesZodState, MultipleChannelSubscriptionOptions, MultipleSubgraphsError, NameSpacePath, NamedBarrierValue, Namespace, NamespaceMatchType, NativeStreamTransformer, NodeInterrupt, NodeSpec, NodeType, Operation, OperationResults, Overwrite, OverwriteValue, ParentCommand, Pregel, PregelNode, PregelOptions, PregelParams, ProtocolEvent, PutOperation, REMOVE_ALL_MESSAGES, ReducedValue, ReducedValueInit, RemoteException, RetryPolicy, Runtime, START, STREAM_EVENTS_V3_MODES, SearchOperation, Send, ServerInfo, SingleChannelSubscriptionOptions, SingleReducer, StateDefinition, StateDefinitionInit, StateGraph, StateGraphAddNodeOptions, StateGraphArgs, StateGraphArgsWithInputOutputSchemas, StateGraphArgsWithStateSchema, StateGraphInit, StateGraphInputError, StateGraphNodeSpec, StateGraphOptions, StateSchema, StateSchemaField, StateSchemaFieldToChannel, StateSchemaFields, StateSchemaFieldsToStateDefinition, StateSnapshot, StateType, StreamChannel, StreamEmitter, StreamMode, StreamOutputMap, StreamTransformer, SubgraphDiscoveryProjection, SubgraphDiscoveryTransformerOptions, SubgraphRunStream, TaskOptions, ToStateDefinition, ToolCallStatus, ToolCallStream, ToolsEventData, Topic, UnreachableNodeError, UntrackedValue, UntrackedValueChannel, UntrackedValueInit, UpdateType, UpdatesEventData, UsageInfo, WaitForNames, messagesStateReducer as addMessages, convertToProtocolEvent, copyCheckpoint, createGraphRunStream, createLifecycleTransformer, createMessagesTransformer, createSubgraphDiscoveryTransformer, createValuesTransformer, emptyCheckpoint, entrypoint, filterLifecycleEntries, filterSubgraphHandles, getConfig, getCurrentTaskInput, getJsonSchemaFromSchema, getPreviousState, getSchemaDefaultGetter, getStore, getSubgraphsSeenSet, getWriter, interrupt, isCommand, isGraphBubbleUp, isGraphInterrupt, isInterrupted, isNativeTransformer, isParentCommand, isSerializableSchema, isStandardSchema, messagesStateReducer, pushMessage, task, writer };
45
+ export { AddNodeOptions, AgentStatus, Annotation, AnnotationRoot, AnyStateSchema, AnyValue, AsyncBatchedStore, BaseChannel, BaseCheckpointSaver, BaseLangGraphError, BaseLangGraphErrorFields, BaseStore, BinaryOperator, BinaryOperatorAggregate, COMMAND_SYMBOL, CachePolicy, ChatModelStream, ChatModelStreamImpl, Checkpoint, CheckpointMetadata, CheckpointTuple, Command, CommandInstance, CommandParams, CompiledGraph, CompiledGraphType, CompiledStateGraph, ConditionalEdgeRouter, ConditionalEdgeRouterTypes, ContextSchemaInit, ConvertToProtocolEventOptions, CreateGraphRunStreamOptions, DynamicBarrierValue, END, EmptyChannelError, EmptyInputError, EntrypointOptions, EphemeralValue, StreamChannel as EventLog, ExecutionInfo, ExtractStateType, ExtractUpdateType, GetOperation, GetStateOptions, Graph, GraphBubbleUp, GraphInterrupt, GraphNode, GraphNodeReturnValue, GraphNodeTypes, GraphRecursionError, GraphRunStream, GraphValueError, INTERRUPT, InMemoryStore, InferExtensions, InferInterruptInputType, InferInterruptResumeType, InferStateSchemaUpdate, InferStateSchemaValue, InferWriterType, Interrupt, InterruptPayload, InvalidUpdateError, Item, LangGraphRunnableConfig, LastValue, LifecycleCause, LifecycleData, LifecycleEntry, LifecycleProjection, LifecycleTransformerOptions, ListNamespacesOperation, MatchCondition, MemorySaver, MessageGraph, Messages, MessagesAnnotation, MessagesEventData, MessagesValue, MessagesZodMeta, MessagesZodState, MultipleChannelSubscriptionOptions, MultipleSubgraphsError, NameSpacePath, NamedBarrierValue, Namespace, NamespaceMatchType, NativeStreamTransformer, NodeInterrupt, NodeSpec, NodeType, Operation, OperationResults, Overwrite, OverwriteValue, ParentCommand, Pregel, PregelNode, PregelOptions, PregelParams, ProtocolEvent, PutOperation, REMOVE_ALL_MESSAGES, ReducedValue, ReducedValueInit, RemoteException, RetryPolicy, Runtime, START, STREAM_EVENTS_V3_MODES, SearchOperation, Send, ServerInfo, SingleChannelSubscriptionOptions, SingleReducer, StateDefinition, StateDefinitionInit, StateGraph, StateGraphAddNodeOptions, StateGraphArgs, StateGraphArgsWithInputOutputSchemas, StateGraphArgsWithStateSchema, StateGraphInit, StateGraphInputError, StateGraphNodeSpec, StateGraphOptions, StateSchema, StateSchemaField, StateSchemaFieldToChannel, StateSchemaFields, StateSchemaFieldsToStateDefinition, StateSnapshot, StateType, StreamChannel, StreamEmitter, StreamMode, StreamOutputMap, StreamTransformer, SubgraphDiscoveryProjection, SubgraphDiscoveryTransformerOptions, SubgraphRunStream, TaskOptions, ToStateDefinition, ToolCallStatus, ToolCallStream, ToolsEventData, Topic, UnreachableNodeError, UntrackedValue, UntrackedValueChannel, UntrackedValueInit, UpdateType, UpdatesEventData, UsageInfo, WaitForNames, messagesStateReducer as addMessages, convertToProtocolEvent, copyCheckpoint, createGraphRunStream, createLifecycleTransformer, createMessagesTransformer, createSubgraphDiscoveryTransformer, createValuesTransformer, emptyCheckpoint, entrypoint, filterLifecycleEntries, filterSubgraphHandles, getConfig, getCurrentTaskInput, getJsonSchemaFromSchema, getPreviousState, getSchemaDefaultGetter, getStore, getSubgraphsSeenSet, getWriter, interrupt, isCheckpointEnvelope, isCommand, isGraphBubbleUp, isGraphInterrupt, isInterrupted, isNativeTransformer, isParentCommand, isSerializableSchema, isStandardSchema, messagesStateReducer, pushMessage, task, writer };
package/dist/index.js CHANGED
@@ -1,12 +1,12 @@
1
- import { initializeAsyncLocalStorageSingleton } from "./setup/async_local_storage.js";
1
+ import { initializeAsyncLocalStorageSingleton } from "./node.js";
2
2
  import { COMMAND_SYMBOL, Command, CommandInstance, END, INTERRUPT, Overwrite, START, Send, isCommand, isInterrupted } from "./constants.js";
3
3
  import { BaseLangGraphError, EmptyChannelError, EmptyInputError, GraphBubbleUp, GraphInterrupt, GraphRecursionError, GraphValueError, InvalidUpdateError, MultipleSubgraphsError, NodeInterrupt, ParentCommand, RemoteException, StateGraphInputError, UnreachableNodeError, getSubgraphsSeenSet, isGraphBubbleUp, isGraphInterrupt, isParentCommand } from "./errors.js";
4
4
  import { BaseChannel } from "./channels/base.js";
5
5
  import { BinaryOperatorAggregate } from "./channels/binop.js";
6
6
  import { Annotation } from "./graph/annotation.js";
7
7
  import { getConfig, getCurrentTaskInput, getStore, getWriter } from "./pregel/utils/config.js";
8
+ import { STREAM_EVENTS_V3_MODES, convertToProtocolEvent, isCheckpointEnvelope } from "./stream/convert.js";
8
9
  import { StreamChannel } from "./stream/stream-channel.js";
9
- import { STREAM_EVENTS_V3_MODES, convertToProtocolEvent } from "./stream/convert.js";
10
10
  import { createLifecycleTransformer, filterLifecycleEntries } from "./stream/transformers/lifecycle.js";
11
11
  import { createMessagesTransformer } from "./stream/transformers/messages.js";
12
12
  import { createSubgraphDiscoveryTransformer, filterSubgraphHandles } from "./stream/transformers/subgraphs.js";
@@ -33,6 +33,6 @@ import { AsyncBatchedStore, BaseCheckpointSaver, BaseStore, InMemoryStore, Memor
33
33
  //#region src/index.ts
34
34
  initializeAsyncLocalStorageSingleton();
35
35
  //#endregion
36
- export { Annotation, AsyncBatchedStore, BaseChannel, BaseCheckpointSaver, BaseLangGraphError, BaseStore, BinaryOperatorAggregate, COMMAND_SYMBOL, ChatModelStreamImpl, Command, CommandInstance, CompiledStateGraph, END, EmptyChannelError, EmptyInputError, StreamChannel as EventLog, Graph, GraphBubbleUp, GraphInterrupt, GraphRecursionError, GraphRunStream, GraphValueError, INTERRUPT, InMemoryStore, InvalidUpdateError, MemorySaver, MessageGraph, MessagesAnnotation, MessagesValue, MessagesZodMeta, MessagesZodState, MultipleSubgraphsError, NodeInterrupt, Overwrite, ParentCommand, REMOVE_ALL_MESSAGES, ReducedValue, RemoteException, START, STREAM_EVENTS_V3_MODES, Send, StateGraph, StateGraphInputError, StateSchema, StreamChannel, SubgraphRunStream, UnreachableNodeError, UntrackedValue, UntrackedValueChannel, messagesStateReducer as addMessages, convertToProtocolEvent, copyCheckpoint, createGraphRunStream, createLifecycleTransformer, createMessagesTransformer, createSubgraphDiscoveryTransformer, createValuesTransformer, emptyCheckpoint, entrypoint, filterLifecycleEntries, filterSubgraphHandles, getConfig, getCurrentTaskInput, getJsonSchemaFromSchema, getPreviousState, getSchemaDefaultGetter, getStore, getSubgraphsSeenSet, getWriter, interrupt, isCommand, isGraphBubbleUp, isGraphInterrupt, isInterrupted, isNativeTransformer, isParentCommand, isSerializableSchema, isStandardSchema, messagesStateReducer, pushMessage, task, writer };
36
+ export { Annotation, AsyncBatchedStore, BaseChannel, BaseCheckpointSaver, BaseLangGraphError, BaseStore, BinaryOperatorAggregate, COMMAND_SYMBOL, ChatModelStreamImpl, Command, CommandInstance, CompiledStateGraph, END, EmptyChannelError, EmptyInputError, StreamChannel as EventLog, Graph, GraphBubbleUp, GraphInterrupt, GraphRecursionError, GraphRunStream, GraphValueError, INTERRUPT, InMemoryStore, InvalidUpdateError, MemorySaver, MessageGraph, MessagesAnnotation, MessagesValue, MessagesZodMeta, MessagesZodState, MultipleSubgraphsError, NodeInterrupt, Overwrite, ParentCommand, REMOVE_ALL_MESSAGES, ReducedValue, RemoteException, START, STREAM_EVENTS_V3_MODES, Send, StateGraph, StateGraphInputError, StateSchema, StreamChannel, SubgraphRunStream, UnreachableNodeError, UntrackedValue, UntrackedValueChannel, messagesStateReducer as addMessages, convertToProtocolEvent, copyCheckpoint, createGraphRunStream, createLifecycleTransformer, createMessagesTransformer, createSubgraphDiscoveryTransformer, createValuesTransformer, emptyCheckpoint, entrypoint, filterLifecycleEntries, filterSubgraphHandles, getConfig, getCurrentTaskInput, getJsonSchemaFromSchema, getPreviousState, getSchemaDefaultGetter, getStore, getSubgraphsSeenSet, getWriter, interrupt, isCheckpointEnvelope, isCommand, isGraphBubbleUp, isGraphInterrupt, isInterrupted, isNativeTransformer, isParentCommand, isSerializableSchema, isStandardSchema, messagesStateReducer, pushMessage, task, writer };
37
37
 
38
38
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["/* __LC_ALLOW_ENTRYPOINT_SIDE_EFFECTS__ */\n\nimport { initializeAsyncLocalStorageSingleton } from \"./setup/async_local_storage.js\";\n\n// Initialize global async local storage instance for tracing\ninitializeAsyncLocalStorageSingleton();\n\nexport * from \"./web.js\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,sCAAsC"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["/* __LC_ALLOW_ENTRYPOINT_SIDE_EFFECTS__ */\n\nimport { initializeAsyncLocalStorageSingleton } from \"./node.js\";\n\n// Initialize global async local storage instance for tracing\ninitializeAsyncLocalStorageSingleton();\n\nexport * from \"./web.js\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,sCAAsC"}
@@ -1,10 +1,10 @@
1
1
  let _langchain_core_singletons = require("@langchain/core/singletons");
2
2
  let node_async_hooks = require("node:async_hooks");
3
- //#region src/setup/async_local_storage.ts
3
+ //#region src/node.ts
4
4
  function initializeAsyncLocalStorageSingleton() {
5
5
  _langchain_core_singletons.AsyncLocalStorageProviderSingleton.initializeGlobalInstance(new node_async_hooks.AsyncLocalStorage());
6
6
  }
7
7
  //#endregion
8
8
  exports.initializeAsyncLocalStorageSingleton = initializeAsyncLocalStorageSingleton;
9
9
 
10
- //# sourceMappingURL=async_local_storage.cjs.map
10
+ //# sourceMappingURL=node.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node.cjs","names":["AsyncLocalStorage"],"sources":["../src/node.ts"],"sourcesContent":["import { AsyncLocalStorageProviderSingleton } from \"@langchain/core/singletons\";\nimport { AsyncLocalStorage } from \"node:async_hooks\";\n\nexport function initializeAsyncLocalStorageSingleton() {\n AsyncLocalStorageProviderSingleton.initializeGlobalInstance(\n new AsyncLocalStorage()\n );\n}\n"],"mappings":";;;AAGA,SAAgB,uCAAuC;AACrD,4BAAA,mCAAmC,yBACjC,IAAIA,iBAAAA,mBAAmB,CACxB"}
@@ -1,10 +1,10 @@
1
1
  import { AsyncLocalStorageProviderSingleton } from "@langchain/core/singletons";
2
2
  import { AsyncLocalStorage } from "node:async_hooks";
3
- //#region src/setup/async_local_storage.ts
3
+ //#region src/node.ts
4
4
  function initializeAsyncLocalStorageSingleton() {
5
5
  AsyncLocalStorageProviderSingleton.initializeGlobalInstance(new AsyncLocalStorage());
6
6
  }
7
7
  //#endregion
8
8
  export { initializeAsyncLocalStorageSingleton };
9
9
 
10
- //# sourceMappingURL=async_local_storage.js.map
10
+ //# sourceMappingURL=node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node.js","names":[],"sources":["../src/node.ts"],"sourcesContent":["import { AsyncLocalStorageProviderSingleton } from \"@langchain/core/singletons\";\nimport { AsyncLocalStorage } from \"node:async_hooks\";\n\nexport function initializeAsyncLocalStorageSingleton() {\n AsyncLocalStorageProviderSingleton.initializeGlobalInstance(\n new AsyncLocalStorage()\n );\n}\n"],"mappings":";;;AAGA,SAAgB,uCAAuC;AACrD,oCAAmC,yBACjC,IAAI,mBAAmB,CACxB"}
@@ -11,12 +11,12 @@ const require_index = require("./utils/index.cjs");
11
11
  const require_algo = require("./algo.cjs");
12
12
  const require_subgraph = require("./utils/subgraph.cjs");
13
13
  const require_debug = require("./debug.cjs");
14
+ const require_convert = require("../stream/convert.cjs");
14
15
  const require_stream = require("./stream.cjs");
15
16
  const require_loop = require("./loop.cjs");
16
17
  const require_messages = require("./messages.cjs");
17
18
  const require_messages_v2 = require("./messages-v2.cjs");
18
19
  const require_runner = require("./runner.cjs");
19
- const require_convert = require("../stream/convert.cjs");
20
20
  const require_run_stream = require("../stream/run-stream.cjs");
21
21
  require("../stream/index.cjs");
22
22
  const require_validate = require("./validate.cjs");
@@ -992,6 +992,7 @@ var Pregel = class extends PartialRunnable {
992
992
  async *_streamIterator(input, options) {
993
993
  const streamEncoding = "version" in (options ?? {}) ? void 0 : options?.encoding ?? void 0;
994
994
  const streamSubgraphs = options?.subgraphs;
995
+ const isV3 = options?.version === "v3";
995
996
  const inputConfig = require_config.ensureLangGraphConfig(this.config, options);
996
997
  if (inputConfig.recursionLimit === void 0 || inputConfig.recursionLimit < 1) throw new Error(`Passed "recursionLimit" must be at least 1.`);
997
998
  if (this.checkpointer !== void 0 && this.checkpointer !== false && inputConfig.configurable === void 0) throw new Error(`Checkpointer requires one or more of the following "configurable" keys: "thread_id", "checkpoint_ns", "checkpoint_id"`);
@@ -1011,7 +1012,7 @@ var Pregel = class extends PartialRunnable {
1011
1012
  config.configurable[require_constants.CONFIG_KEY_CHECKPOINT_NS] = ns.split("|").map((part) => part.split(":")[0]).join("|");
1012
1013
  }
1013
1014
  if (streamMode.includes("messages")) {
1014
- const messageStreamer = options?.version === "v3" ? new require_messages_v2.StreamProtocolMessagesHandler((chunk) => stream.push(chunk)) : new require_messages.StreamMessagesHandler((chunk) => stream.push(chunk));
1015
+ const messageStreamer = isV3 ? new require_messages_v2.StreamProtocolMessagesHandler((chunk) => stream.push(chunk)) : new require_messages.StreamMessagesHandler((chunk) => stream.push(chunk));
1015
1016
  const { callbacks } = config;
1016
1017
  if (callbacks === void 0) config.callbacks = [messageStreamer];
1017
1018
  else if (Array.isArray(callbacks)) config.callbacks = callbacks.concat(messageStreamer);
@@ -1103,16 +1104,21 @@ var Pregel = class extends PartialRunnable {
1103
1104
  } catch (e) {
1104
1105
  loopError = loopError ?? e;
1105
1106
  }
1106
- if (loopError) stream.error(loopError);
1107
- else stream.close();
1107
+ if (loopError) {
1108
+ await new Promise((resolve) => {
1109
+ queueMicrotask(resolve);
1110
+ });
1111
+ stream.error(loopError);
1112
+ } else stream.close();
1108
1113
  }
1109
1114
  };
1110
1115
  const runLoopPromise = createAndRunLoop();
1111
1116
  try {
1112
1117
  for await (const chunk of stream) {
1113
1118
  if (chunk === void 0) throw new Error("Data structure error.");
1114
- const [namespace, mode, payload, meta] = chunk;
1115
- if (streamMode.includes(mode)) {
1119
+ const [namespace, mode, payload] = chunk;
1120
+ const isStreamEvents = "version" in (options ?? {});
1121
+ if (streamMode.includes(mode) || mode === "checkpoints" && require_convert.isCheckpointEnvelope(payload) && (isV3 || isStreamEvents && streamSubgraphs && streamMode.includes("values"))) {
1116
1122
  if (streamEncoding === "text/event-stream") {
1117
1123
  if (streamSubgraphs) yield [
1118
1124
  namespace,
@@ -1126,12 +1132,7 @@ var Pregel = class extends PartialRunnable {
1126
1132
  ];
1127
1133
  continue;
1128
1134
  }
1129
- if (streamSubgraphs && !streamModeSingle) yield meta !== void 0 ? [
1130
- namespace,
1131
- mode,
1132
- payload,
1133
- meta
1134
- ] : [
1135
+ if (streamSubgraphs && !streamModeSingle) yield [
1135
1136
  namespace,
1136
1137
  mode,
1137
1138
  payload