@langchain/langgraph 1.0.7 → 1.0.13

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 (304) hide show
  1. package/dist/channels/any_value.cjs.map +1 -1
  2. package/dist/channels/any_value.d.cts +0 -1
  3. package/dist/channels/any_value.d.cts.map +1 -1
  4. package/dist/channels/any_value.d.ts +0 -1
  5. package/dist/channels/any_value.d.ts.map +1 -1
  6. package/dist/channels/any_value.js.map +1 -1
  7. package/dist/channels/base.cjs +2 -3
  8. package/dist/channels/base.cjs.map +1 -1
  9. package/dist/channels/base.d.cts.map +1 -1
  10. package/dist/channels/base.d.ts.map +1 -1
  11. package/dist/channels/base.js.map +1 -1
  12. package/dist/channels/binop.cjs.map +1 -1
  13. package/dist/channels/binop.d.cts.map +1 -1
  14. package/dist/channels/binop.d.ts.map +1 -1
  15. package/dist/channels/binop.js.map +1 -1
  16. package/dist/channels/dynamic_barrier_value.cjs +0 -1
  17. package/dist/channels/dynamic_barrier_value.cjs.map +1 -1
  18. package/dist/channels/dynamic_barrier_value.d.cts +1 -3
  19. package/dist/channels/dynamic_barrier_value.d.cts.map +1 -1
  20. package/dist/channels/dynamic_barrier_value.d.ts +1 -3
  21. package/dist/channels/dynamic_barrier_value.d.ts.map +1 -1
  22. package/dist/channels/dynamic_barrier_value.js +0 -1
  23. package/dist/channels/dynamic_barrier_value.js.map +1 -1
  24. package/dist/channels/ephemeral_value.cjs.map +1 -1
  25. package/dist/channels/ephemeral_value.d.cts +0 -1
  26. package/dist/channels/ephemeral_value.d.cts.map +1 -1
  27. package/dist/channels/ephemeral_value.d.ts +0 -1
  28. package/dist/channels/ephemeral_value.d.ts.map +1 -1
  29. package/dist/channels/ephemeral_value.js.map +1 -1
  30. package/dist/channels/last_value.cjs.map +1 -1
  31. package/dist/channels/last_value.d.cts +0 -2
  32. package/dist/channels/last_value.d.cts.map +1 -1
  33. package/dist/channels/last_value.d.ts +0 -2
  34. package/dist/channels/last_value.d.ts.map +1 -1
  35. package/dist/channels/last_value.js.map +1 -1
  36. package/dist/channels/named_barrier_value.cjs +0 -2
  37. package/dist/channels/named_barrier_value.cjs.map +1 -1
  38. package/dist/channels/named_barrier_value.d.cts +2 -4
  39. package/dist/channels/named_barrier_value.d.cts.map +1 -1
  40. package/dist/channels/named_barrier_value.d.ts +2 -4
  41. package/dist/channels/named_barrier_value.d.ts.map +1 -1
  42. package/dist/channels/named_barrier_value.js +0 -2
  43. package/dist/channels/named_barrier_value.js.map +1 -1
  44. package/dist/channels/topic.cjs.map +1 -1
  45. package/dist/channels/topic.d.cts.map +1 -1
  46. package/dist/channels/topic.d.ts.map +1 -1
  47. package/dist/channels/topic.js.map +1 -1
  48. package/dist/constants.cjs.map +1 -1
  49. package/dist/constants.d.cts +2 -6
  50. package/dist/constants.d.cts.map +1 -1
  51. package/dist/constants.d.ts +2 -6
  52. package/dist/constants.d.ts.map +1 -1
  53. package/dist/constants.js.map +1 -1
  54. package/dist/errors.cjs.map +1 -1
  55. package/dist/errors.d.cts +0 -4
  56. package/dist/errors.d.cts.map +1 -1
  57. package/dist/errors.d.ts +0 -4
  58. package/dist/errors.d.ts.map +1 -1
  59. package/dist/errors.js.map +1 -1
  60. package/dist/func/index.cjs +2 -4
  61. package/dist/func/index.cjs.map +1 -1
  62. package/dist/func/index.d.cts +1 -6
  63. package/dist/func/index.d.cts.map +1 -1
  64. package/dist/func/index.d.ts +1 -6
  65. package/dist/func/index.d.ts.map +1 -1
  66. package/dist/func/index.js +1 -2
  67. package/dist/func/index.js.map +1 -1
  68. package/dist/func/types.d.cts +2 -4
  69. package/dist/func/types.d.cts.map +1 -1
  70. package/dist/func/types.d.ts +2 -4
  71. package/dist/func/types.d.ts.map +1 -1
  72. package/dist/graph/annotation.cjs.map +1 -1
  73. package/dist/graph/annotation.d.cts.map +1 -1
  74. package/dist/graph/annotation.d.ts.map +1 -1
  75. package/dist/graph/annotation.js.map +1 -1
  76. package/dist/graph/graph.cjs +15 -18
  77. package/dist/graph/graph.cjs.map +1 -1
  78. package/dist/graph/graph.d.cts +4 -28
  79. package/dist/graph/graph.d.cts.map +1 -1
  80. package/dist/graph/graph.d.ts +4 -28
  81. package/dist/graph/graph.d.ts.map +1 -1
  82. package/dist/graph/graph.js +4 -6
  83. package/dist/graph/graph.js.map +1 -1
  84. package/dist/graph/message.cjs +8 -10
  85. package/dist/graph/message.cjs.map +1 -1
  86. package/dist/graph/message.d.cts +2 -2
  87. package/dist/graph/message.d.cts.map +1 -1
  88. package/dist/graph/message.d.ts +2 -2
  89. package/dist/graph/message.d.ts.map +1 -1
  90. package/dist/graph/message.js +3 -4
  91. package/dist/graph/message.js.map +1 -1
  92. package/dist/graph/messages_annotation.cjs +1 -2
  93. package/dist/graph/messages_annotation.cjs.map +1 -1
  94. package/dist/graph/messages_annotation.d.cts +5 -5
  95. package/dist/graph/messages_annotation.d.cts.map +1 -1
  96. package/dist/graph/messages_annotation.d.ts +5 -5
  97. package/dist/graph/messages_annotation.d.ts.map +1 -1
  98. package/dist/graph/messages_annotation.js.map +1 -1
  99. package/dist/graph/state.cjs +23 -30
  100. package/dist/graph/state.cjs.map +1 -1
  101. package/dist/graph/state.d.cts +2 -9
  102. package/dist/graph/state.d.cts.map +1 -1
  103. package/dist/graph/state.d.ts +2 -9
  104. package/dist/graph/state.d.ts.map +1 -1
  105. package/dist/graph/state.js +6 -12
  106. package/dist/graph/state.js.map +1 -1
  107. package/dist/graph/zod/meta.cjs +8 -9
  108. package/dist/graph/zod/meta.cjs.map +1 -1
  109. package/dist/graph/zod/meta.d.cts +0 -1
  110. package/dist/graph/zod/meta.d.cts.map +1 -1
  111. package/dist/graph/zod/meta.d.ts +0 -1
  112. package/dist/graph/zod/meta.d.ts.map +1 -1
  113. package/dist/graph/zod/meta.js.map +1 -1
  114. package/dist/graph/zod/plugin.cjs +4 -6
  115. package/dist/graph/zod/plugin.cjs.map +1 -1
  116. package/dist/graph/zod/plugin.js +1 -2
  117. package/dist/graph/zod/plugin.js.map +1 -1
  118. package/dist/graph/zod/schema.cjs +2 -3
  119. package/dist/graph/zod/schema.cjs.map +1 -1
  120. package/dist/graph/zod/schema.d.cts.map +1 -1
  121. package/dist/graph/zod/schema.d.ts.map +1 -1
  122. package/dist/graph/zod/schema.js.map +1 -1
  123. package/dist/graph/zod/zod-registry.cjs +3 -4
  124. package/dist/graph/zod/zod-registry.cjs.map +1 -1
  125. package/dist/graph/zod/zod-registry.d.cts +0 -2
  126. package/dist/graph/zod/zod-registry.d.cts.map +1 -1
  127. package/dist/graph/zod/zod-registry.d.ts +0 -2
  128. package/dist/graph/zod/zod-registry.d.ts.map +1 -1
  129. package/dist/graph/zod/zod-registry.js.map +1 -1
  130. package/dist/hash.cjs +4 -10
  131. package/dist/hash.cjs.map +1 -1
  132. package/dist/hash.js +4 -10
  133. package/dist/hash.js.map +1 -1
  134. package/dist/index.cjs +8 -9
  135. package/dist/index.cjs.map +1 -1
  136. package/dist/index.js.map +1 -1
  137. package/dist/interrupt.cjs +4 -7
  138. package/dist/interrupt.cjs.map +1 -1
  139. package/dist/interrupt.d.cts +1 -4
  140. package/dist/interrupt.d.cts.map +1 -1
  141. package/dist/interrupt.d.ts +1 -4
  142. package/dist/interrupt.d.ts.map +1 -1
  143. package/dist/interrupt.js +2 -4
  144. package/dist/interrupt.js.map +1 -1
  145. package/dist/prebuilt/agentName.cjs +14 -19
  146. package/dist/prebuilt/agentName.cjs.map +1 -1
  147. package/dist/prebuilt/agentName.js +6 -10
  148. package/dist/prebuilt/agentName.js.map +1 -1
  149. package/dist/prebuilt/agent_executor.cjs +4 -7
  150. package/dist/prebuilt/agent_executor.cjs.map +1 -1
  151. package/dist/prebuilt/agent_executor.d.cts +5 -5
  152. package/dist/prebuilt/agent_executor.d.cts.map +1 -1
  153. package/dist/prebuilt/agent_executor.d.ts +5 -5
  154. package/dist/prebuilt/agent_executor.d.ts.map +1 -1
  155. package/dist/prebuilt/agent_executor.js +4 -7
  156. package/dist/prebuilt/agent_executor.js.map +1 -1
  157. package/dist/prebuilt/chat_agent_executor.cjs +11 -17
  158. package/dist/prebuilt/chat_agent_executor.cjs.map +1 -1
  159. package/dist/prebuilt/chat_agent_executor.d.cts.map +1 -1
  160. package/dist/prebuilt/chat_agent_executor.d.ts.map +1 -1
  161. package/dist/prebuilt/chat_agent_executor.js +7 -12
  162. package/dist/prebuilt/chat_agent_executor.js.map +1 -1
  163. package/dist/prebuilt/interrupt.d.cts +0 -1
  164. package/dist/prebuilt/interrupt.d.cts.map +1 -1
  165. package/dist/prebuilt/interrupt.d.ts +0 -1
  166. package/dist/prebuilt/interrupt.d.ts.map +1 -1
  167. package/dist/prebuilt/react_agent_executor.cjs +35 -40
  168. package/dist/prebuilt/react_agent_executor.cjs.map +1 -1
  169. package/dist/prebuilt/react_agent_executor.d.cts +8 -27
  170. package/dist/prebuilt/react_agent_executor.d.cts.map +1 -1
  171. package/dist/prebuilt/react_agent_executor.d.ts +8 -27
  172. package/dist/prebuilt/react_agent_executor.d.ts.map +1 -1
  173. package/dist/prebuilt/react_agent_executor.js +8 -12
  174. package/dist/prebuilt/react_agent_executor.js.map +1 -1
  175. package/dist/prebuilt/tool_executor.cjs +4 -9
  176. package/dist/prebuilt/tool_executor.cjs.map +1 -1
  177. package/dist/prebuilt/tool_executor.d.cts +0 -2
  178. package/dist/prebuilt/tool_executor.d.cts.map +1 -1
  179. package/dist/prebuilt/tool_executor.d.ts +0 -2
  180. package/dist/prebuilt/tool_executor.d.ts.map +1 -1
  181. package/dist/prebuilt/tool_executor.js +1 -5
  182. package/dist/prebuilt/tool_executor.js.map +1 -1
  183. package/dist/prebuilt/tool_node.cjs +7 -8
  184. package/dist/prebuilt/tool_node.cjs.map +1 -1
  185. package/dist/prebuilt/tool_node.d.cts +0 -2
  186. package/dist/prebuilt/tool_node.d.cts.map +1 -1
  187. package/dist/prebuilt/tool_node.d.ts +0 -2
  188. package/dist/prebuilt/tool_node.d.ts.map +1 -1
  189. package/dist/prebuilt/tool_node.js.map +1 -1
  190. package/dist/pregel/algo.cjs +33 -41
  191. package/dist/pregel/algo.cjs.map +1 -1
  192. package/dist/pregel/algo.d.cts.map +1 -1
  193. package/dist/pregel/algo.d.ts.map +1 -1
  194. package/dist/pregel/algo.js +22 -29
  195. package/dist/pregel/algo.js.map +1 -1
  196. package/dist/pregel/call.cjs +11 -14
  197. package/dist/pregel/call.cjs.map +1 -1
  198. package/dist/pregel/call.js +7 -9
  199. package/dist/pregel/call.js.map +1 -1
  200. package/dist/pregel/debug.cjs +6 -9
  201. package/dist/pregel/debug.cjs.map +1 -1
  202. package/dist/pregel/debug.js +6 -9
  203. package/dist/pregel/debug.js.map +1 -1
  204. package/dist/pregel/index.cjs +28 -35
  205. package/dist/pregel/index.cjs.map +1 -1
  206. package/dist/pregel/index.d.cts +6 -54
  207. package/dist/pregel/index.d.cts.map +1 -1
  208. package/dist/pregel/index.d.ts +6 -54
  209. package/dist/pregel/index.d.ts.map +1 -1
  210. package/dist/pregel/index.js +10 -16
  211. package/dist/pregel/index.js.map +1 -1
  212. package/dist/pregel/io.cjs.map +1 -1
  213. package/dist/pregel/io.js.map +1 -1
  214. package/dist/pregel/loop.cjs +9 -12
  215. package/dist/pregel/loop.cjs.map +1 -1
  216. package/dist/pregel/loop.js +2 -4
  217. package/dist/pregel/loop.js.map +1 -1
  218. package/dist/pregel/messages.cjs +13 -14
  219. package/dist/pregel/messages.cjs.map +1 -1
  220. package/dist/pregel/messages.js.map +1 -1
  221. package/dist/pregel/read.cjs +7 -8
  222. package/dist/pregel/read.cjs.map +1 -1
  223. package/dist/pregel/read.d.cts +0 -6
  224. package/dist/pregel/read.d.cts.map +1 -1
  225. package/dist/pregel/read.d.ts +0 -6
  226. package/dist/pregel/read.d.ts.map +1 -1
  227. package/dist/pregel/read.js +1 -1
  228. package/dist/pregel/read.js.map +1 -1
  229. package/dist/pregel/remote.cjs +24 -32
  230. package/dist/pregel/remote.cjs.map +1 -1
  231. package/dist/pregel/remote.d.cts +1 -6
  232. package/dist/pregel/remote.d.cts.map +1 -1
  233. package/dist/pregel/remote.d.ts +1 -6
  234. package/dist/pregel/remote.d.ts.map +1 -1
  235. package/dist/pregel/remote.js +12 -19
  236. package/dist/pregel/remote.js.map +1 -1
  237. package/dist/pregel/retry.cjs +1 -2
  238. package/dist/pregel/retry.cjs.map +1 -1
  239. package/dist/pregel/retry.js +1 -2
  240. package/dist/pregel/retry.js.map +1 -1
  241. package/dist/pregel/runnable_types.d.cts +2 -8
  242. package/dist/pregel/runnable_types.d.cts.map +1 -1
  243. package/dist/pregel/runnable_types.d.ts +2 -8
  244. package/dist/pregel/runnable_types.d.ts.map +1 -1
  245. package/dist/pregel/runner.cjs +1 -1
  246. package/dist/pregel/runner.cjs.map +1 -1
  247. package/dist/pregel/runner.js +1 -1
  248. package/dist/pregel/runner.js.map +1 -1
  249. package/dist/pregel/stream.cjs +4 -6
  250. package/dist/pregel/stream.cjs.map +1 -1
  251. package/dist/pregel/stream.js +1 -2
  252. package/dist/pregel/stream.js.map +1 -1
  253. package/dist/pregel/types.d.cts +5 -18
  254. package/dist/pregel/types.d.cts.map +1 -1
  255. package/dist/pregel/types.d.ts +5 -18
  256. package/dist/pregel/types.d.ts.map +1 -1
  257. package/dist/pregel/utils/config.cjs +6 -7
  258. package/dist/pregel/utils/config.cjs.map +1 -1
  259. package/dist/pregel/utils/config.d.cts.map +1 -1
  260. package/dist/pregel/utils/config.d.ts.map +1 -1
  261. package/dist/pregel/utils/config.js.map +1 -1
  262. package/dist/pregel/utils/index.cjs +1 -2
  263. package/dist/pregel/utils/index.cjs.map +1 -1
  264. package/dist/pregel/utils/index.d.cts +1 -1
  265. package/dist/pregel/utils/index.d.cts.map +1 -1
  266. package/dist/pregel/utils/index.d.ts +1 -1
  267. package/dist/pregel/utils/index.d.ts.map +1 -1
  268. package/dist/pregel/utils/index.js +1 -2
  269. package/dist/pregel/utils/index.js.map +1 -1
  270. package/dist/pregel/utils/subgraph.cjs +0 -1
  271. package/dist/pregel/utils/subgraph.cjs.map +1 -1
  272. package/dist/pregel/utils/subgraph.js +0 -1
  273. package/dist/pregel/utils/subgraph.js.map +1 -1
  274. package/dist/pregel/validate.cjs.map +1 -1
  275. package/dist/pregel/validate.js.map +1 -1
  276. package/dist/pregel/write.cjs +2 -3
  277. package/dist/pregel/write.cjs.map +1 -1
  278. package/dist/pregel/write.d.cts +1 -5
  279. package/dist/pregel/write.d.cts.map +1 -1
  280. package/dist/pregel/write.d.ts +1 -5
  281. package/dist/pregel/write.d.ts.map +1 -1
  282. package/dist/pregel/write.js.map +1 -1
  283. package/dist/setup/async_local_storage.cjs +3 -4
  284. package/dist/setup/async_local_storage.cjs.map +1 -1
  285. package/dist/setup/async_local_storage.js.map +1 -1
  286. package/dist/utils.cjs +9 -11
  287. package/dist/utils.cjs.map +1 -1
  288. package/dist/utils.d.cts +1 -8
  289. package/dist/utils.d.cts.map +1 -1
  290. package/dist/utils.d.ts +1 -8
  291. package/dist/utils.d.ts.map +1 -1
  292. package/dist/utils.js +1 -2
  293. package/dist/utils.js.map +1 -1
  294. package/dist/web.cjs +8 -9
  295. package/dist/writer.cjs +2 -3
  296. package/dist/writer.cjs.map +1 -1
  297. package/dist/writer.d.cts +1 -2
  298. package/dist/writer.d.cts.map +1 -1
  299. package/dist/writer.d.ts +1 -2
  300. package/dist/writer.d.ts.map +1 -1
  301. package/dist/writer.js.map +1 -1
  302. package/package.json +7 -7
  303. package/CHANGELOG.md +0 -286
  304. package/dist/_virtual/rolldown_runtime.cjs +0 -25
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":["Runnable","RunnableConfig","RunnableFunc","StreamEvent","IterableReadableStream","All","BaseCache","BaseCheckpointSaver","BaseStore","CheckpointListOptions","CheckpointTuple","BaseChannel","Command","CommandInstance","StrRecord","PregelNode","LangGraphRunnableConfig","Durability","GetStateOptions","MultipleChannelSubscriptionOptions","PregelInputType","PregelInterface","PregelOptions","PregelOutputType","PregelParams","SingleChannelSubscriptionOptions","StateSnapshot","StreamMode","StreamOutputMap","RetryPolicy","ChannelWrite","WriteValue","StreamEventsOptions","Parameters","Channel","Record","PartialRunnable","RunInput","RunOutput","CallOptions","Partial","Promise","Pregel","InputType","OutputType","CommandType","Nodes","Channels","ContextType","Array","Omit","_langchain_core_runnables_graph0","Graph","Generator","AsyncGenerator","config","saved","subgraphCheckpointer","applyPendingWrites","AsyncIterableIterator","TStreamMode","TSubgraphs","TEncoding","StreamUpdatesType","StreamValuesType","NodeReturnType","StreamCustom","Uint8Array"],"sources":["../../src/pregel/index.d.ts"],"sourcesContent":["/* eslint-disable no-param-reassign */\nimport { Runnable, RunnableConfig, RunnableFunc } from \"@langchain/core/runnables\";\nimport type { StreamEvent } from \"@langchain/core/tracers/log_stream\";\nimport { IterableReadableStream } from \"@langchain/core/utils/stream\";\nimport { All, BaseCache, BaseCheckpointSaver, BaseStore, CheckpointListOptions, CheckpointTuple } from \"@langchain/langgraph-checkpoint\";\nimport { BaseChannel } from \"../channels/base.js\";\nimport { Command, type CommandInstance } from \"../constants.js\";\nimport { StrRecord } from \"./algo.js\";\nimport { PregelNode } from \"./read.js\";\nimport { LangGraphRunnableConfig } from \"./runnable_types.js\";\nimport type { Durability, GetStateOptions, MultipleChannelSubscriptionOptions, PregelInputType, PregelInterface, PregelOptions, PregelOutputType, PregelParams, SingleChannelSubscriptionOptions, StateSnapshot, StreamMode, StreamOutputMap } from \"./types.js\";\nimport { RetryPolicy } from \"./utils/index.js\";\nimport { ChannelWrite } from \"./write.js\";\ntype WriteValue = Runnable | RunnableFunc<unknown, unknown> | unknown;\ntype StreamEventsOptions = Parameters<Runnable[\"streamEvents\"]>[2];\n/**\n * Utility class for working with channels in the Pregel system.\n * Provides static methods for subscribing to channels and writing to them.\n *\n * Channels are the communication pathways between nodes in a Pregel graph.\n * They enable message passing and state updates between different parts of the graph.\n */\nexport declare class Channel {\n /**\n * Creates a PregelNode that subscribes to a single channel.\n * This is used to define how nodes receive input from channels.\n *\n * @example\n * ```typescript\n * // Subscribe to a single channel\n * const node = Channel.subscribeTo(\"messages\");\n *\n * // Subscribe to multiple channels\n * const node = Channel.subscribeTo([\"messages\", \"state\"]);\n *\n * // Subscribe with a custom key\n * const node = Channel.subscribeTo(\"messages\", { key: \"chat\" });\n * ```\n *\n * @param channel Single channel name to subscribe to\n * @param options Subscription options\n * @returns A PregelNode configured to receive from the specified channels\n * @throws {Error} If a key is specified when subscribing to multiple channels\n */\n static subscribeTo(channel: string, options?: SingleChannelSubscriptionOptions): PregelNode;\n /**\n * Creates a PregelNode that subscribes to multiple channels.\n * This is used to define how nodes receive input from channels.\n *\n * @example\n * ```typescript\n * // Subscribe to a single channel\n * const node = Channel.subscribeTo(\"messages\");\n *\n * // Subscribe to multiple channels\n * const node = Channel.subscribeTo([\"messages\", \"state\"]);\n *\n * // Subscribe with a custom key\n * const node = Channel.subscribeTo(\"messages\", { key: \"chat\" });\n * ```\n *\n * @param channels Single channel name to subscribe to\n * @param options Subscription options\n * @returns A PregelNode configured to receive from the specified channels\n * @throws {Error} If a key is specified when subscribing to multiple channels\n */\n static subscribeTo(channels: string[], options?: MultipleChannelSubscriptionOptions): PregelNode;\n /**\n * Creates a ChannelWrite that specifies how to write values to channels.\n * This is used to define how nodes send output to channels.\n *\n * @example\n * ```typescript\n * // Write to multiple channels\n * const write = Channel.writeTo([\"output\", \"state\"]);\n *\n * // Write with specific values\n * const write = Channel.writeTo([\"output\"], {\n * state: \"completed\",\n * result: calculateResult()\n * });\n *\n * // Write with a transformation function\n * const write = Channel.writeTo([\"output\"], {\n * result: (x) => processResult(x)\n * });\n * ```\n *\n * @param channels - Array of channel names to write to\n * @param writes - Optional map of channel names to values or transformations\n * @returns A ChannelWrite object that can be used to write to the specified channels\n */\n static writeTo(channels: string[], writes?: Record<string, WriteValue>): ChannelWrite;\n}\nexport type { PregelInputType, PregelOptions, PregelOutputType };\n// This is a workaround to allow Pregel to override `invoke` / `stream` and `withConfig`\n// without having to adhere to the types in the `Runnable` class (thanks to `any`).\n// Alternatively we could mark those methods with @ts-ignore / @ts-expect-error,\n// but these do not get carried over when building via `tsc`.\ndeclare class PartialRunnable<RunInput, RunOutput, CallOptions extends RunnableConfig> extends Runnable<RunInput, RunOutput, CallOptions> {\n lc_namespace: string[];\n invoke(_input: RunInput, _options?: Partial<CallOptions>\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ): Promise<any>;\n // Overriden by `Pregel`\n withConfig(_config: CallOptions): typeof this;\n // Overriden by `Pregel`\n stream(input: RunInput, options?: Partial<CallOptions>\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ): Promise<IterableReadableStream<any>>;\n}\n/**\n * The Pregel class is the core runtime engine of LangGraph, implementing a message-passing graph computation model\n * inspired by [Google's Pregel system](https://research.google/pubs/pregel-a-system-for-large-scale-graph-processing/).\n * It provides the foundation for building reliable, controllable agent workflows that can evolve state over time.\n *\n * Key features:\n * - Message passing between nodes in discrete \"supersteps\"\n * - Built-in persistence layer through checkpointers\n * - First-class streaming support for values, updates, and events\n * - Human-in-the-loop capabilities via interrupts\n * - Support for parallel node execution within supersteps\n *\n * The Pregel class is not intended to be instantiated directly by consumers. Instead, use the following higher-level APIs:\n * - {@link StateGraph}: The main graph class for building agent workflows\n * - Compiling a {@link StateGraph} will return a {@link CompiledGraph} instance, which extends `Pregel`\n * - Functional API: A declarative approach using tasks and entrypoints\n * - A `Pregel` instance is returned by the {@link entrypoint} function\n *\n * @example\n * ```typescript\n * // Using StateGraph API\n * const graph = new StateGraph(annotation)\n * .addNode(\"nodeA\", myNodeFunction)\n * .addEdge(\"nodeA\", \"nodeB\")\n * .compile();\n *\n * // The compiled graph is a Pregel instance\n * const result = await graph.invoke(input);\n * ```\n *\n * @example\n * ```typescript\n * // Using Functional API\n * import { task, entrypoint } from \"@langchain/langgraph\";\n * import { MemorySaver } from \"@langchain/langgraph-checkpoint\";\n *\n * // Define tasks that can be composed\n * const addOne = task(\"add\", async (x: number) => x + 1);\n *\n * // Create a workflow using the entrypoint function\n * const workflow = entrypoint({\n * name: \"workflow\",\n * checkpointer: new MemorySaver()\n * }, async (numbers: number[]) => {\n * // Tasks can be run in parallel\n * const results = await Promise.all(numbers.map(n => addOne(n)));\n * return results;\n * });\n *\n * // The workflow is a Pregel instance\n * const result = await workflow.invoke([1, 2, 3]); // Returns [2, 3, 4]\n * ```\n *\n * @typeParam Nodes - Mapping of node names to their {@link PregelNode} implementations\n * @typeParam Channels - Mapping of channel names to their {@link BaseChannel} or {@link ManagedValueSpec} implementations\n * @typeParam ContextType - Type of context that can be passed to the graph\n * @typeParam InputType - Type of input values accepted by the graph\n * @typeParam OutputType - Type of output values produced by the graph\n */\nexport declare class Pregel<Nodes extends StrRecord<string, PregelNode>, Channels extends StrRecord<string, BaseChannel>, \n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nContextType extends Record<string, any> = StrRecord<string, any>, InputType = PregelInputType, OutputType = PregelOutputType, StreamUpdatesType = InputType, StreamValuesType = OutputType, NodeReturnType = unknown, CommandType = CommandInstance, \n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nStreamCustom = any> extends PartialRunnable<InputType | CommandType | null, OutputType, PregelOptions<Nodes, Channels, ContextType>> implements PregelInterface<Nodes, Channels, ContextType> {\n /**\n * Name of the class when serialized\n * @internal\n */\n static lc_name(): string;\n /** @internal Used for type inference */\n \"~InputType\": InputType;\n /** @internal Used for type inference */\n \"~OutputType\": OutputType;\n /** @internal LangChain namespace for serialization necessary because Pregel extends Runnable */\n lc_namespace: string[];\n /** @internal Flag indicating this is a Pregel instance - necessary for serialization */\n lg_is_pregel: boolean;\n /** The nodes in the graph, mapping node names to their PregelNode instances */\n nodes: Nodes;\n /** The channels in the graph, mapping channel names to their BaseChannel or ManagedValueSpec instances */\n channels: Channels;\n /**\n * The input channels for the graph. These channels receive the initial input when the graph is invoked.\n * Can be a single channel key or an array of channel keys.\n */\n inputChannels: keyof Channels | Array<keyof Channels>;\n /**\n * The output channels for the graph. These channels contain the final output when the graph completes.\n * Can be a single channel key or an array of channel keys.\n */\n outputChannels: keyof Channels | Array<keyof Channels>;\n /** Whether to automatically validate the graph structure when it is compiled. Defaults to true. */\n autoValidate: boolean;\n /**\n * The streaming modes enabled for this graph. Defaults to [\"values\"].\n * Supported modes:\n * - \"values\": Streams the full state after each step\n * - \"updates\": Streams state updates after each step\n * - \"messages\": Streams messages from within nodes\n * - \"custom\": Streams custom events from within nodes\n * - \"debug\": Streams events related to the execution of the graph - useful for tracing & debugging graph execution\n */\n streamMode: StreamMode[];\n /**\n * Optional channels to stream. If not specified, all channels will be streamed.\n * Can be a single channel key or an array of channel keys.\n */\n streamChannels?: keyof Channels | Array<keyof Channels>;\n /**\n * Optional array of node names or \"all\" to interrupt after executing these nodes.\n * Used for implementing human-in-the-loop workflows.\n */\n interruptAfter?: Array<keyof Nodes> | All;\n /**\n * Optional array of node names or \"all\" to interrupt before executing these nodes.\n * Used for implementing human-in-the-loop workflows.\n */\n interruptBefore?: Array<keyof Nodes> | All;\n /** Optional timeout in milliseconds for the execution of each superstep */\n stepTimeout?: number;\n /** Whether to enable debug logging. Defaults to false. */\n debug: boolean;\n /**\n * Optional checkpointer for persisting graph state.\n * When provided, saves a checkpoint of the graph state at every superstep.\n * When false or undefined, checkpointing is disabled, and the graph will not be able to save or restore state.\n */\n checkpointer?: BaseCheckpointSaver | boolean;\n /** Optional retry policy for handling failures in node execution */\n retryPolicy?: RetryPolicy;\n /** The default configuration for graph execution, can be overridden on a per-invocation basis */\n config?: LangGraphRunnableConfig;\n /**\n * Optional long-term memory store for the graph, allows for persistence & retrieval of data across threads\n */\n store?: BaseStore;\n /**\n * Optional cache for the graph, useful for caching tasks.\n */\n cache?: BaseCache;\n /**\n * Optional interrupt helper function.\n * @internal\n */\n private userInterrupt?;\n /**\n * The trigger to node mapping for the graph run.\n * @internal\n */\n private triggerToNodes;\n /**\n * Constructor for Pregel - meant for internal use only.\n *\n * @internal\n */\n constructor(fields: PregelParams<Nodes, Channels>);\n /**\n * Creates a new instance of the Pregel graph with updated configuration.\n * This method follows the immutable pattern - instead of modifying the current instance,\n * it returns a new instance with the merged configuration.\n *\n * @example\n * ```typescript\n * // Create a new instance with debug enabled\n * const debugGraph = graph.withConfig({ debug: true });\n *\n * // Create a new instance with a specific thread ID\n * const threadGraph = graph.withConfig({\n * configurable: { thread_id: \"123\" }\n * });\n * ```\n *\n * @param config - The configuration to merge with the current configuration\n * @returns A new Pregel instance with the merged configuration\n */\n withConfig(config: Omit<LangGraphRunnableConfig, \"store\" | \"writer\" | \"interrupt\">): typeof this;\n /**\n * Validates the graph structure to ensure it is well-formed.\n * Checks for:\n * - No orphaned nodes\n * - Valid input/output channel configurations\n * - Valid interrupt configurations\n *\n * @returns this - The Pregel instance for method chaining\n * @throws {GraphValidationError} If the graph structure is invalid\n */\n validate(): this;\n /**\n * Gets a list of all channels that should be streamed.\n * If streamChannels is specified, returns those channels.\n * Otherwise, returns all channels in the graph.\n *\n * @returns Array of channel keys to stream\n */\n get streamChannelsList(): Array<keyof Channels>;\n /**\n * Gets the channels to stream in their original format.\n * If streamChannels is specified, returns it as-is (either single key or array).\n * Otherwise, returns all channels in the graph as an array.\n *\n * @returns Channel keys to stream, either as a single key or array\n */\n get streamChannelsAsIs(): keyof Channels | Array<keyof Channels>;\n /**\n * Gets a drawable representation of the graph structure.\n * This is an async version of getGraph() and is the preferred method to use.\n *\n * @param config - Configuration for generating the graph visualization\n * @returns A representation of the graph that can be visualized\n */\n getGraphAsync(config: RunnableConfig): Promise<import(\"@langchain/core/runnables/graph\").Graph>;\n /**\n * Gets all subgraphs within this graph.\n * A subgraph is a Pregel instance that is nested within a node of this graph.\n *\n * @deprecated Use getSubgraphsAsync instead. The async method will become the default in the next minor release.\n * @param namespace - Optional namespace to filter subgraphs\n * @param recurse - Whether to recursively get subgraphs of subgraphs\n * @returns Generator yielding tuples of [name, subgraph]\n */\n getSubgraphs(namespace?: string, recurse?: boolean\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ): Generator<[string, Pregel<any, any>]>;\n /**\n * Gets all subgraphs within this graph asynchronously.\n * A subgraph is a Pregel instance that is nested within a node of this graph.\n *\n * @param namespace - Optional namespace to filter subgraphs\n * @param recurse - Whether to recursively get subgraphs of subgraphs\n * @returns AsyncGenerator yielding tuples of [name, subgraph]\n */\n getSubgraphsAsync(namespace?: string, recurse?: boolean\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ): AsyncGenerator<[string, Pregel<any, any>]>;\n /**\n * Prepares a state snapshot from saved checkpoint data.\n * This is an internal method used by getState and getStateHistory.\n *\n * @param config - Configuration for preparing the snapshot\n * @param saved - Optional saved checkpoint data\n * @param subgraphCheckpointer - Optional checkpointer for subgraphs\n * @param applyPendingWrites - Whether to apply pending writes to tasks and then to channels\n * @returns A snapshot of the graph state\n * @internal\n */\n protected _prepareStateSnapshot({ config, saved, subgraphCheckpointer, applyPendingWrites }: {\n config: RunnableConfig;\n saved?: CheckpointTuple;\n subgraphCheckpointer?: BaseCheckpointSaver;\n applyPendingWrites?: boolean;\n }): Promise<StateSnapshot>;\n /**\n * Gets the current state of the graph.\n * Requires a checkpointer to be configured.\n *\n * @param config - Configuration for retrieving the state\n * @param options - Additional options\n * @returns A snapshot of the current graph state\n * @throws {GraphValueError} If no checkpointer is configured\n */\n getState(config: RunnableConfig, options?: GetStateOptions): Promise<StateSnapshot>;\n /**\n * Gets the history of graph states.\n * Requires a checkpointer to be configured.\n * Useful for:\n * - Debugging execution history\n * - Implementing time travel\n * - Analyzing graph behavior\n *\n * @param config - Configuration for retrieving the history\n * @param options - Options for filtering the history\n * @returns An async iterator of state snapshots\n * @throws {Error} If no checkpointer is configured\n */\n getStateHistory(config: RunnableConfig, options?: CheckpointListOptions): AsyncIterableIterator<StateSnapshot>;\n /**\n * Apply updates to the graph state in bulk.\n * Requires a checkpointer to be configured.\n *\n * This method is useful for recreating a thread\n * from a list of updates, especially if a checkpoint\n * is created as a result of multiple tasks.\n *\n * @internal The API might change in the future.\n *\n * @param startConfig - Configuration for the update\n * @param updates - The list of updates to apply to graph state\n * @returns Updated configuration\n * @throws {GraphValueError} If no checkpointer is configured\n * @throws {InvalidUpdateError} If the update cannot be attributed to a node or an update can be only applied in sequence.\n */\n bulkUpdateState(startConfig: LangGraphRunnableConfig, supersteps: Array<{\n updates: Array<{\n values?: Record<string, unknown> | unknown;\n asNode?: keyof Nodes | string;\n }>;\n }>): Promise<RunnableConfig>;\n /**\n * Updates the state of the graph with new values.\n * Requires a checkpointer to be configured.\n *\n * This method can be used for:\n * - Implementing human-in-the-loop workflows\n * - Modifying graph state during breakpoints\n * - Integrating external inputs into the graph\n *\n * @param inputConfig - Configuration for the update\n * @param values - The values to update the state with\n * @param asNode - Optional node name to attribute the update to\n * @returns Updated configuration\n * @throws {GraphValueError} If no checkpointer is configured\n * @throws {InvalidUpdateError} If the update cannot be attributed to a node\n */\n updateState(inputConfig: LangGraphRunnableConfig, values: Record<string, unknown> | unknown, asNode?: keyof Nodes | string): Promise<RunnableConfig>;\n /**\n * Gets the default values for various graph configuration options.\n * This is an internal method used to process and normalize configuration options.\n *\n * @param config - The input configuration options\n * @returns A tuple containing normalized values for:\n * - debug mode\n * - stream modes\n * - input keys\n * - output keys\n * - remaining config\n * - interrupt before nodes\n * - interrupt after nodes\n * - checkpointer\n * - store\n * - whether stream mode is single\n * - node cache\n * - whether checkpoint during is enabled\n * @internal\n */\n _defaults(config: PregelOptions<Nodes, Channels>): [\n boolean, // debug\n StreamMode[], // stream mode\n // stream mode\n string | string[], // input keys\n // input keys\n string | string[], // output keys\n LangGraphRunnableConfig, // config without pregel keys\n // config without pregel keys\n All | string[], // interrupt before\n // interrupt before\n All | string[], // interrupt after\n // interrupt after\n BaseCheckpointSaver | undefined, // checkpointer\n // checkpointer\n BaseStore | undefined, // store\n boolean, // stream mode single\n // stream mode single\n BaseCache | undefined, // node cache\n Durability // durability\n ];\n /**\n * Streams the execution of the graph, emitting state updates as they occur.\n * This is the primary method for observing graph execution in real-time.\n *\n * Stream modes:\n * - \"values\": Emits complete state after each step\n * - \"updates\": Emits only state changes after each step\n * - \"debug\": Emits detailed debug information\n * - \"messages\": Emits messages from within nodes\n * - \"custom\": Emits custom events from within nodes\n * - \"checkpoints\": Emits checkpoints from within nodes\n * - \"tasks\": Emits tasks from within nodes\n *\n * @param input - The input to start graph execution with\n * @param options - Configuration options for streaming\n * @returns An async iterable stream of graph state updates\n */\n stream<TStreamMode extends StreamMode | StreamMode[] | undefined, TSubgraphs extends boolean, TEncoding extends \"text/event-stream\" | undefined>(input: InputType | CommandType | null, options?: Partial<PregelOptions<Nodes, Channels, ContextType, TStreamMode, TSubgraphs, TEncoding>>): Promise<IterableReadableStream<StreamOutputMap<TStreamMode, TSubgraphs, StreamUpdatesType, StreamValuesType, keyof Nodes, NodeReturnType, StreamCustom, TEncoding>>>;\n /**\n * @inheritdoc\n */\n streamEvents(input: InputType | CommandType | null, options: Partial<PregelOptions<Nodes, Channels, ContextType>> & {\n version: \"v1\" | \"v2\";\n }, streamOptions?: StreamEventsOptions): IterableReadableStream<StreamEvent>;\n streamEvents(input: InputType | CommandType | null, options: Partial<PregelOptions<Nodes, Channels, ContextType>> & {\n version: \"v1\" | \"v2\";\n encoding: \"text/event-stream\";\n }, streamOptions?: StreamEventsOptions): IterableReadableStream<Uint8Array>;\n /**\n * Validates the input for the graph.\n * @param input - The input to validate\n * @returns The validated input\n * @internal\n */\n protected _validateInput(input: PregelInputType): Promise<any>;\n /**\n * Validates the context options for the graph.\n * @param context - The context options to validate\n * @returns The validated context options\n * @internal\n */\n protected _validateContext(context: Partial<LangGraphRunnableConfig[\"context\"]>): Promise<LangGraphRunnableConfig[\"context\"]>;\n /**\n * Internal iterator used by stream() to generate state updates.\n * This method handles the core logic of graph execution and streaming.\n *\n * @param input - The input to start graph execution with\n * @param options - Configuration options for streaming\n * @returns AsyncGenerator yielding state updates\n * @internal\n */\n _streamIterator(input: PregelInputType | Command, options?: Partial<PregelOptions<Nodes, Channels>>): AsyncGenerator<PregelOutputType>;\n /**\n * Run the graph with a single input and config.\n * @param input The input to the graph.\n * @param options The configuration to use for the run.\n */\n invoke(input: InputType | CommandType | null, options?: Partial<Omit<PregelOptions<Nodes, Channels, ContextType>, \"encoding\">>): Promise<OutputType>;\n private _runLoop;\n clearCache(): Promise<void>;\n}\n"],"mappings":";;;;;;;;;;;;;;;KAaK+B,UAAAA,GAAa/B,WAAWE;KACxB8B,mBAAAA,GAAsBC,WAAWjC;AAFI;;;;;AACD;;AACHA,cAQjBkC,OAAAA,CARiBlC;;;AAQtC;;;;;;;;;;AAwEiE;;;;;;;;;SAS1DyC,WAAAA,CAAAA,OAAAA,EAAAA,MAAAA,EAAAA,OAAAA,CAAAA,EA3D2ChB,gCA2D3CgB,CAAAA,EA3D8E1B,UA2D9E0B;;;;;;;;;AAmEP;;;;;;;;;;;;;SAI4CE,WAAAA,CAAAA,QAAAA,EAAAA,MAAAA,EAAAA,EAAAA,OAAAA,CAAAA,EA5GSxB,kCA4GTwB,CAAAA,EA5G8C5B,UA4G9C4B;;;;;;;;;;;;;;;;;;;;;;;;;;SAiDFtC,OAAAA,CAAAA,QAAAA,EAAAA,MAAAA,EAAAA,EAAAA,MAAAA,CAAAA,EAnIM8B,MAmIN9B,CAAAA,MAAAA,EAnIqB0B,UAmIrB1B,CAAAA,CAAAA,EAnImCyB,YAmInCzB;;;;;;cA5H5B+B,eAmJF5B,CAAAA,QAAAA,EAAAA,SAAAA,EAAAA,oBAnJ2DP,cAmJ3DO,CAAAA,SAnJmFR,QAmJnFQ,CAnJ4F6B,QAmJ5F7B,EAnJsG8B,SAmJtG9B,EAnJiH+B,WAmJjH/B,CAAAA,CAAAA;cAIAF,EAAAA,MAAAA,EAAAA;QAgByBwC,CAAAA,MAAAA,EArKlBT,QAqKkBS,EAAAA,QAAAA,CAAAA,EArKGN,OAqKHM,CArKWP,WAqKXO;;KAnK9BL,OAmKiBjB,CAAAA,GAAAA,CAAAA;;YAoBD0B,CAAAA,OAAAA,EArLCX,WAqLDW,CAA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;;;EAEAX;;;EAEAA;;;EAEAE;;;EAEAC;;;;;EAGAF;;EACAW;;;;;;;;;;;;;;;;;;;6BAmBuBU,aAAaA,gHAAgHgB,YAAYE,8BAA8BL,QAAQlB,cAAcwB,OAAOC,UAAUC,aAAaY,aAAaC,YAAYC,cAAcrB,QAAQrC,uBAAuBwB,gBAAgBgC,aAAaC,YAAYE,mBAAmBC,wBAAwBlB,OAAOmB,gBAAgBC,cAAcJ;;;;sBAIjanB,YAAYE,6BAA6BL,QAAQlB,cAAcwB,OAAOC,UAAUC;;qBAEjFhB,sBAAsB5B,uBAAuBD;sBAC5CwC,YAAYE,6BAA6BL,QAAQlB,cAAcwB,OAAOC,UAAUC;;;qBAGjFhB,sBAAsB5B,uBAAuB+D;;;;;;;kCAOhC/C,kBAAkBqB;;;;;;;sCAOdD,QAAQxB,sCAAsCyB,QAAQzB;;;;;;;;;;yBAUnEI,kBAAkBR,mBAAmB4B,QAAQlB,cAAcwB,OAAOC,aAAaO,eAAe/B;;;;;;gBAMvGoB,YAAYE,8BAA8BL,QAAQU,KAAK5B,cAAcwB,OAAOC,UAAUC,6BAA6BP,QAAQG;;gBAE3HH"}
1
+ {"version":3,"file":"index.d.cts","names":["Runnable","RunnableConfig","RunnableFunc","StreamEvent","IterableReadableStream","All","BaseCache","BaseCheckpointSaver","BaseStore","CheckpointListOptions","CheckpointTuple","BaseChannel","Command","CommandInstance","StrRecord","PregelNode","LangGraphRunnableConfig","Durability","GetStateOptions","MultipleChannelSubscriptionOptions","PregelInputType","PregelInterface","PregelOptions","PregelOutputType","PregelParams","SingleChannelSubscriptionOptions","StateSnapshot","StreamMode","StreamOutputMap","RetryPolicy","ChannelWrite","WriteValue","StreamEventsOptions","Parameters","Channel","Record","PartialRunnable","RunInput","RunOutput","CallOptions","Partial","Promise","Pregel","InputType","OutputType","CommandType","Nodes","Channels","ContextType","Array","Omit","_langchain_core_runnables_graph0","Graph","Generator","AsyncGenerator","config","saved","subgraphCheckpointer","applyPendingWrites","AsyncIterableIterator","TStreamMode","TSubgraphs","TEncoding","StreamUpdatesType","StreamValuesType","NodeReturnType","StreamCustom","Uint8Array"],"sources":["../../src/pregel/index.d.ts"],"sourcesContent":["import { Runnable, RunnableConfig, RunnableFunc } from \"@langchain/core/runnables\";\nimport type { StreamEvent } from \"@langchain/core/tracers/log_stream\";\nimport { IterableReadableStream } from \"@langchain/core/utils/stream\";\nimport { All, BaseCache, BaseCheckpointSaver, BaseStore, CheckpointListOptions, CheckpointTuple } from \"@langchain/langgraph-checkpoint\";\nimport { BaseChannel } from \"../channels/base.js\";\nimport { Command, type CommandInstance } from \"../constants.js\";\nimport { StrRecord } from \"./algo.js\";\nimport { PregelNode } from \"./read.js\";\nimport { LangGraphRunnableConfig } from \"./runnable_types.js\";\nimport type { Durability, GetStateOptions, MultipleChannelSubscriptionOptions, PregelInputType, PregelInterface, PregelOptions, PregelOutputType, PregelParams, SingleChannelSubscriptionOptions, StateSnapshot, StreamMode, StreamOutputMap } from \"./types.js\";\nimport { RetryPolicy } from \"./utils/index.js\";\nimport { ChannelWrite } from \"./write.js\";\ntype WriteValue = Runnable | RunnableFunc<unknown, unknown> | unknown;\ntype StreamEventsOptions = Parameters<Runnable[\"streamEvents\"]>[2];\n/**\n * Utility class for working with channels in the Pregel system.\n * Provides static methods for subscribing to channels and writing to them.\n *\n * Channels are the communication pathways between nodes in a Pregel graph.\n * They enable message passing and state updates between different parts of the graph.\n */\nexport declare class Channel {\n /**\n * Creates a PregelNode that subscribes to a single channel.\n * This is used to define how nodes receive input from channels.\n *\n * @example\n * ```typescript\n * // Subscribe to a single channel\n * const node = Channel.subscribeTo(\"messages\");\n *\n * // Subscribe to multiple channels\n * const node = Channel.subscribeTo([\"messages\", \"state\"]);\n *\n * // Subscribe with a custom key\n * const node = Channel.subscribeTo(\"messages\", { key: \"chat\" });\n * ```\n *\n * @param channel Single channel name to subscribe to\n * @param options Subscription options\n * @returns A PregelNode configured to receive from the specified channels\n * @throws {Error} If a key is specified when subscribing to multiple channels\n */\n static subscribeTo(channel: string, options?: SingleChannelSubscriptionOptions): PregelNode;\n /**\n * Creates a PregelNode that subscribes to multiple channels.\n * This is used to define how nodes receive input from channels.\n *\n * @example\n * ```typescript\n * // Subscribe to a single channel\n * const node = Channel.subscribeTo(\"messages\");\n *\n * // Subscribe to multiple channels\n * const node = Channel.subscribeTo([\"messages\", \"state\"]);\n *\n * // Subscribe with a custom key\n * const node = Channel.subscribeTo(\"messages\", { key: \"chat\" });\n * ```\n *\n * @param channels Single channel name to subscribe to\n * @param options Subscription options\n * @returns A PregelNode configured to receive from the specified channels\n * @throws {Error} If a key is specified when subscribing to multiple channels\n */\n static subscribeTo(channels: string[], options?: MultipleChannelSubscriptionOptions): PregelNode;\n /**\n * Creates a ChannelWrite that specifies how to write values to channels.\n * This is used to define how nodes send output to channels.\n *\n * @example\n * ```typescript\n * // Write to multiple channels\n * const write = Channel.writeTo([\"output\", \"state\"]);\n *\n * // Write with specific values\n * const write = Channel.writeTo([\"output\"], {\n * state: \"completed\",\n * result: calculateResult()\n * });\n *\n * // Write with a transformation function\n * const write = Channel.writeTo([\"output\"], {\n * result: (x) => processResult(x)\n * });\n * ```\n *\n * @param channels - Array of channel names to write to\n * @param writes - Optional map of channel names to values or transformations\n * @returns A ChannelWrite object that can be used to write to the specified channels\n */\n static writeTo(channels: string[], writes?: Record<string, WriteValue>): ChannelWrite;\n}\nexport type { PregelInputType, PregelOptions, PregelOutputType };\ndeclare class PartialRunnable<RunInput, RunOutput, CallOptions extends RunnableConfig> extends Runnable<RunInput, RunOutput, CallOptions> {\n lc_namespace: string[];\n invoke(_input: RunInput, _options?: Partial<CallOptions>): Promise<any>;\n withConfig(_config: CallOptions): typeof this;\n stream(input: RunInput, options?: Partial<CallOptions>): Promise<IterableReadableStream<any>>;\n}\n/**\n * The Pregel class is the core runtime engine of LangGraph, implementing a message-passing graph computation model\n * inspired by [Google's Pregel system](https://research.google/pubs/pregel-a-system-for-large-scale-graph-processing/).\n * It provides the foundation for building reliable, controllable agent workflows that can evolve state over time.\n *\n * Key features:\n * - Message passing between nodes in discrete \"supersteps\"\n * - Built-in persistence layer through checkpointers\n * - First-class streaming support for values, updates, and events\n * - Human-in-the-loop capabilities via interrupts\n * - Support for parallel node execution within supersteps\n *\n * The Pregel class is not intended to be instantiated directly by consumers. Instead, use the following higher-level APIs:\n * - {@link StateGraph}: The main graph class for building agent workflows\n * - Compiling a {@link StateGraph} will return a {@link CompiledGraph} instance, which extends `Pregel`\n * - Functional API: A declarative approach using tasks and entrypoints\n * - A `Pregel` instance is returned by the {@link entrypoint} function\n *\n * @example\n * ```typescript\n * // Using StateGraph API\n * const graph = new StateGraph(annotation)\n * .addNode(\"nodeA\", myNodeFunction)\n * .addEdge(\"nodeA\", \"nodeB\")\n * .compile();\n *\n * // The compiled graph is a Pregel instance\n * const result = await graph.invoke(input);\n * ```\n *\n * @example\n * ```typescript\n * // Using Functional API\n * import { task, entrypoint } from \"@langchain/langgraph\";\n * import { MemorySaver } from \"@langchain/langgraph-checkpoint\";\n *\n * // Define tasks that can be composed\n * const addOne = task(\"add\", async (x: number) => x + 1);\n *\n * // Create a workflow using the entrypoint function\n * const workflow = entrypoint({\n * name: \"workflow\",\n * checkpointer: new MemorySaver()\n * }, async (numbers: number[]) => {\n * // Tasks can be run in parallel\n * const results = await Promise.all(numbers.map(n => addOne(n)));\n * return results;\n * });\n *\n * // The workflow is a Pregel instance\n * const result = await workflow.invoke([1, 2, 3]); // Returns [2, 3, 4]\n * ```\n *\n * @typeParam Nodes - Mapping of node names to their {@link PregelNode} implementations\n * @typeParam Channels - Mapping of channel names to their {@link BaseChannel} or {@link ManagedValueSpec} implementations\n * @typeParam ContextType - Type of context that can be passed to the graph\n * @typeParam InputType - Type of input values accepted by the graph\n * @typeParam OutputType - Type of output values produced by the graph\n */\nexport declare class Pregel<Nodes extends StrRecord<string, PregelNode>, Channels extends StrRecord<string, BaseChannel>, ContextType extends Record<string, any> = StrRecord<string, any>, InputType = PregelInputType, OutputType = PregelOutputType, StreamUpdatesType = InputType, StreamValuesType = OutputType, NodeReturnType = unknown, CommandType = CommandInstance, StreamCustom = any> extends PartialRunnable<InputType | CommandType | null, OutputType, PregelOptions<Nodes, Channels, ContextType>> implements PregelInterface<Nodes, Channels, ContextType> {\n /**\n * Name of the class when serialized\n * @internal\n */\n static lc_name(): string;\n /** @internal Used for type inference */\n \"~InputType\": InputType;\n /** @internal Used for type inference */\n \"~OutputType\": OutputType;\n /** @internal LangChain namespace for serialization necessary because Pregel extends Runnable */\n lc_namespace: string[];\n /** @internal Flag indicating this is a Pregel instance - necessary for serialization */\n lg_is_pregel: boolean;\n /** The nodes in the graph, mapping node names to their PregelNode instances */\n nodes: Nodes;\n /** The channels in the graph, mapping channel names to their BaseChannel or ManagedValueSpec instances */\n channels: Channels;\n /**\n * The input channels for the graph. These channels receive the initial input when the graph is invoked.\n * Can be a single channel key or an array of channel keys.\n */\n inputChannels: keyof Channels | Array<keyof Channels>;\n /**\n * The output channels for the graph. These channels contain the final output when the graph completes.\n * Can be a single channel key or an array of channel keys.\n */\n outputChannels: keyof Channels | Array<keyof Channels>;\n /** Whether to automatically validate the graph structure when it is compiled. Defaults to true. */\n autoValidate: boolean;\n /**\n * The streaming modes enabled for this graph. Defaults to [\"values\"].\n * Supported modes:\n * - \"values\": Streams the full state after each step\n * - \"updates\": Streams state updates after each step\n * - \"messages\": Streams messages from within nodes\n * - \"custom\": Streams custom events from within nodes\n * - \"debug\": Streams events related to the execution of the graph - useful for tracing & debugging graph execution\n */\n streamMode: StreamMode[];\n /**\n * Optional channels to stream. If not specified, all channels will be streamed.\n * Can be a single channel key or an array of channel keys.\n */\n streamChannels?: keyof Channels | Array<keyof Channels>;\n /**\n * Optional array of node names or \"all\" to interrupt after executing these nodes.\n * Used for implementing human-in-the-loop workflows.\n */\n interruptAfter?: Array<keyof Nodes> | All;\n /**\n * Optional array of node names or \"all\" to interrupt before executing these nodes.\n * Used for implementing human-in-the-loop workflows.\n */\n interruptBefore?: Array<keyof Nodes> | All;\n /** Optional timeout in milliseconds for the execution of each superstep */\n stepTimeout?: number;\n /** Whether to enable debug logging. Defaults to false. */\n debug: boolean;\n /**\n * Optional checkpointer for persisting graph state.\n * When provided, saves a checkpoint of the graph state at every superstep.\n * When false or undefined, checkpointing is disabled, and the graph will not be able to save or restore state.\n */\n checkpointer?: BaseCheckpointSaver | boolean;\n /** Optional retry policy for handling failures in node execution */\n retryPolicy?: RetryPolicy;\n /** The default configuration for graph execution, can be overridden on a per-invocation basis */\n config?: LangGraphRunnableConfig;\n /**\n * Optional long-term memory store for the graph, allows for persistence & retrieval of data across threads\n */\n store?: BaseStore;\n /**\n * Optional cache for the graph, useful for caching tasks.\n */\n cache?: BaseCache;\n /**\n * Optional interrupt helper function.\n * @internal\n */\n private userInterrupt?;\n /**\n * The trigger to node mapping for the graph run.\n * @internal\n */\n private triggerToNodes;\n /**\n * Constructor for Pregel - meant for internal use only.\n *\n * @internal\n */\n constructor(fields: PregelParams<Nodes, Channels>);\n /**\n * Creates a new instance of the Pregel graph with updated configuration.\n * This method follows the immutable pattern - instead of modifying the current instance,\n * it returns a new instance with the merged configuration.\n *\n * @example\n * ```typescript\n * // Create a new instance with debug enabled\n * const debugGraph = graph.withConfig({ debug: true });\n *\n * // Create a new instance with a specific thread ID\n * const threadGraph = graph.withConfig({\n * configurable: { thread_id: \"123\" }\n * });\n * ```\n *\n * @param config - The configuration to merge with the current configuration\n * @returns A new Pregel instance with the merged configuration\n */\n withConfig(config: Omit<LangGraphRunnableConfig, \"store\" | \"writer\" | \"interrupt\">): typeof this;\n /**\n * Validates the graph structure to ensure it is well-formed.\n * Checks for:\n * - No orphaned nodes\n * - Valid input/output channel configurations\n * - Valid interrupt configurations\n *\n * @returns this - The Pregel instance for method chaining\n * @throws {GraphValidationError} If the graph structure is invalid\n */\n validate(): this;\n /**\n * Gets a list of all channels that should be streamed.\n * If streamChannels is specified, returns those channels.\n * Otherwise, returns all channels in the graph.\n *\n * @returns Array of channel keys to stream\n */\n get streamChannelsList(): Array<keyof Channels>;\n /**\n * Gets the channels to stream in their original format.\n * If streamChannels is specified, returns it as-is (either single key or array).\n * Otherwise, returns all channels in the graph as an array.\n *\n * @returns Channel keys to stream, either as a single key or array\n */\n get streamChannelsAsIs(): keyof Channels | Array<keyof Channels>;\n /**\n * Gets a drawable representation of the graph structure.\n * This is an async version of getGraph() and is the preferred method to use.\n *\n * @param config - Configuration for generating the graph visualization\n * @returns A representation of the graph that can be visualized\n */\n getGraphAsync(config: RunnableConfig): Promise<import(\"@langchain/core/runnables/graph\").Graph>;\n /**\n * Gets all subgraphs within this graph.\n * A subgraph is a Pregel instance that is nested within a node of this graph.\n *\n * @deprecated Use getSubgraphsAsync instead. The async method will become the default in the next minor release.\n * @param namespace - Optional namespace to filter subgraphs\n * @param recurse - Whether to recursively get subgraphs of subgraphs\n * @returns Generator yielding tuples of [name, subgraph]\n */\n getSubgraphs(namespace?: string, recurse?: boolean): Generator<[string, Pregel<any, any>]>;\n /**\n * Gets all subgraphs within this graph asynchronously.\n * A subgraph is a Pregel instance that is nested within a node of this graph.\n *\n * @param namespace - Optional namespace to filter subgraphs\n * @param recurse - Whether to recursively get subgraphs of subgraphs\n * @returns AsyncGenerator yielding tuples of [name, subgraph]\n */\n getSubgraphsAsync(namespace?: string, recurse?: boolean): AsyncGenerator<[string, Pregel<any, any>]>;\n /**\n * Prepares a state snapshot from saved checkpoint data.\n * This is an internal method used by getState and getStateHistory.\n *\n * @param config - Configuration for preparing the snapshot\n * @param saved - Optional saved checkpoint data\n * @param subgraphCheckpointer - Optional checkpointer for subgraphs\n * @param applyPendingWrites - Whether to apply pending writes to tasks and then to channels\n * @returns A snapshot of the graph state\n * @internal\n */\n protected _prepareStateSnapshot({ config, saved, subgraphCheckpointer, applyPendingWrites }: {\n config: RunnableConfig;\n saved?: CheckpointTuple;\n subgraphCheckpointer?: BaseCheckpointSaver;\n applyPendingWrites?: boolean;\n }): Promise<StateSnapshot>;\n /**\n * Gets the current state of the graph.\n * Requires a checkpointer to be configured.\n *\n * @param config - Configuration for retrieving the state\n * @param options - Additional options\n * @returns A snapshot of the current graph state\n * @throws {GraphValueError} If no checkpointer is configured\n */\n getState(config: RunnableConfig, options?: GetStateOptions): Promise<StateSnapshot>;\n /**\n * Gets the history of graph states.\n * Requires a checkpointer to be configured.\n * Useful for:\n * - Debugging execution history\n * - Implementing time travel\n * - Analyzing graph behavior\n *\n * @param config - Configuration for retrieving the history\n * @param options - Options for filtering the history\n * @returns An async iterator of state snapshots\n * @throws {Error} If no checkpointer is configured\n */\n getStateHistory(config: RunnableConfig, options?: CheckpointListOptions): AsyncIterableIterator<StateSnapshot>;\n /**\n * Apply updates to the graph state in bulk.\n * Requires a checkpointer to be configured.\n *\n * This method is useful for recreating a thread\n * from a list of updates, especially if a checkpoint\n * is created as a result of multiple tasks.\n *\n * @internal The API might change in the future.\n *\n * @param startConfig - Configuration for the update\n * @param updates - The list of updates to apply to graph state\n * @returns Updated configuration\n * @throws {GraphValueError} If no checkpointer is configured\n * @throws {InvalidUpdateError} If the update cannot be attributed to a node or an update can be only applied in sequence.\n */\n bulkUpdateState(startConfig: LangGraphRunnableConfig, supersteps: Array<{\n updates: Array<{\n values?: Record<string, unknown> | unknown;\n asNode?: keyof Nodes | string;\n }>;\n }>): Promise<RunnableConfig>;\n /**\n * Updates the state of the graph with new values.\n * Requires a checkpointer to be configured.\n *\n * This method can be used for:\n * - Implementing human-in-the-loop workflows\n * - Modifying graph state during breakpoints\n * - Integrating external inputs into the graph\n *\n * @param inputConfig - Configuration for the update\n * @param values - The values to update the state with\n * @param asNode - Optional node name to attribute the update to\n * @returns Updated configuration\n * @throws {GraphValueError} If no checkpointer is configured\n * @throws {InvalidUpdateError} If the update cannot be attributed to a node\n */\n updateState(inputConfig: LangGraphRunnableConfig, values: Record<string, unknown> | unknown, asNode?: keyof Nodes | string): Promise<RunnableConfig>;\n /**\n * Gets the default values for various graph configuration options.\n * This is an internal method used to process and normalize configuration options.\n *\n * @param config - The input configuration options\n * @returns A tuple containing normalized values for:\n * - debug mode\n * - stream modes\n * - input keys\n * - output keys\n * - remaining config\n * - interrupt before nodes\n * - interrupt after nodes\n * - checkpointer\n * - store\n * - whether stream mode is single\n * - node cache\n * - whether checkpoint during is enabled\n * @internal\n */\n _defaults(config: PregelOptions<Nodes, Channels>): [\n boolean,\n StreamMode[],\n string | string[],\n string | string[],\n LangGraphRunnableConfig,\n All | string[],\n All | string[],\n BaseCheckpointSaver | undefined,\n BaseStore | undefined,\n boolean,\n BaseCache | undefined,\n Durability\n ];\n /**\n * Streams the execution of the graph, emitting state updates as they occur.\n * This is the primary method for observing graph execution in real-time.\n *\n * Stream modes:\n * - \"values\": Emits complete state after each step\n * - \"updates\": Emits only state changes after each step\n * - \"debug\": Emits detailed debug information\n * - \"messages\": Emits messages from within nodes\n * - \"custom\": Emits custom events from within nodes\n * - \"checkpoints\": Emits checkpoints from within nodes\n * - \"tasks\": Emits tasks from within nodes\n *\n * @param input - The input to start graph execution with\n * @param options - Configuration options for streaming\n * @returns An async iterable stream of graph state updates\n */\n stream<TStreamMode extends StreamMode | StreamMode[] | undefined, TSubgraphs extends boolean, TEncoding extends \"text/event-stream\" | undefined>(input: InputType | CommandType | null, options?: Partial<PregelOptions<Nodes, Channels, ContextType, TStreamMode, TSubgraphs, TEncoding>>): Promise<IterableReadableStream<StreamOutputMap<TStreamMode, TSubgraphs, StreamUpdatesType, StreamValuesType, keyof Nodes, NodeReturnType, StreamCustom, TEncoding>>>;\n /**\n * @inheritdoc\n */\n streamEvents(input: InputType | CommandType | null, options: Partial<PregelOptions<Nodes, Channels, ContextType>> & {\n version: \"v1\" | \"v2\";\n }, streamOptions?: StreamEventsOptions): IterableReadableStream<StreamEvent>;\n streamEvents(input: InputType | CommandType | null, options: Partial<PregelOptions<Nodes, Channels, ContextType>> & {\n version: \"v1\" | \"v2\";\n encoding: \"text/event-stream\";\n }, streamOptions?: StreamEventsOptions): IterableReadableStream<Uint8Array>;\n /**\n * Validates the input for the graph.\n * @param input - The input to validate\n * @returns The validated input\n * @internal\n */\n protected _validateInput(input: PregelInputType): Promise<any>;\n /**\n * Validates the context options for the graph.\n * @param context - The context options to validate\n * @returns The validated context options\n * @internal\n */\n protected _validateContext(context: Partial<LangGraphRunnableConfig[\"context\"]>): Promise<LangGraphRunnableConfig[\"context\"]>;\n /**\n * Internal iterator used by stream() to generate state updates.\n * This method handles the core logic of graph execution and streaming.\n *\n * @param input - The input to start graph execution with\n * @param options - Configuration options for streaming\n * @returns AsyncGenerator yielding state updates\n * @internal\n */\n _streamIterator(input: PregelInputType | Command, options?: Partial<PregelOptions<Nodes, Channels>>): AsyncGenerator<PregelOutputType>;\n /**\n * Run the graph with a single input and config.\n * @param input The input to the graph.\n * @param options The configuration to use for the run.\n */\n invoke(input: InputType | CommandType | null, options?: Partial<Omit<PregelOptions<Nodes, Channels, ContextType>, \"encoding\">>): Promise<OutputType>;\n private _runLoop;\n clearCache(): Promise<void>;\n}\n"],"mappings":";;;;;;;;;;;;;;;KAYK+B,UAAAA,GAAa/B,WAAWE;KACxB8B,mBAAAA,GAAsBC,WAAWjC;;AAFI;;;;;AACD;AACjB,cAQHkC,OAAAA,CARG;;;;AAQxB;;;;;;;;;;AAwEiE;;;;;;;;SAGzBM,WAAAA,CAAAA,OAAAA,EAAAA,MAAAA,EAAAA,OAAAA,CAAAA,EArDUf,gCAqDVe,CAAAA,EArD6CzB,UAqD7CyB;;;;;;;;;;AA+DxC;;;;;;;;;;;;SAA8V3B,WAAAA,CAAAA,QAAAA,EAAAA,MAAAA,EAAAA,EAAAA,OAAAA,CAAAA,EA9FzSM,kCA8FySN,CAAAA,EA9FpQE,UA8FoQF;;;;;;;;;;;;;;;;;;;;;;;;;;SAiDzUoC,OAAAA,CAAAA,QAAAA,EAAAA,MAAAA,EAAAA,EAAAA,MAAAA,CAAAA,EArH2Bd,MAqH3Bc,CAAAA,MAAAA,EArH0ClB,UAqH1CkB,CAAAA,CAAAA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yBAUnEI,kBAAkBR,mBAAmB4B,QAAQlB,cAAcwB,OAAOC,aAAaO,eAAe/B;;;;;;gBAMvGoB,YAAYE,8BAA8BL,QAAQU,KAAK5B,cAAcwB,OAAOC,UAAUC,6BAA6BP,QAAQG;;gBAE3HH"}
@@ -94,21 +94,11 @@ declare class Channel {
94
94
  */
95
95
  static writeTo(channels: string[], writes?: Record<string, WriteValue>): ChannelWrite;
96
96
  }
97
- // This is a workaround to allow Pregel to override `invoke` / `stream` and `withConfig`
98
- // without having to adhere to the types in the `Runnable` class (thanks to `any`).
99
- // Alternatively we could mark those methods with @ts-ignore / @ts-expect-error,
100
- // but these do not get carried over when building via `tsc`.
101
97
  declare class PartialRunnable<RunInput, RunOutput, CallOptions extends RunnableConfig> extends Runnable<RunInput, RunOutput, CallOptions> {
102
98
  lc_namespace: string[];
103
- invoke(_input: RunInput, _options?: Partial<CallOptions>
104
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
105
- ): Promise<any>;
106
- // Overriden by `Pregel`
99
+ invoke(_input: RunInput, _options?: Partial<CallOptions>): Promise<any>;
107
100
  withConfig(_config: CallOptions): typeof this;
108
- // Overriden by `Pregel`
109
- stream(input: RunInput, options?: Partial<CallOptions>
110
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
111
- ): Promise<IterableReadableStream<any>>;
101
+ stream(input: RunInput, options?: Partial<CallOptions>): Promise<IterableReadableStream<any>>;
112
102
  }
113
103
  /**
114
104
  * The Pregel class is the core runtime engine of LangGraph, implementing a message-passing graph computation model
@@ -169,11 +159,7 @@ declare class PartialRunnable<RunInput, RunOutput, CallOptions extends RunnableC
169
159
  * @typeParam InputType - Type of input values accepted by the graph
170
160
  * @typeParam OutputType - Type of output values produced by the graph
171
161
  */
172
- declare class Pregel<Nodes extends StrRecord<string, PregelNode>, Channels extends StrRecord<string, BaseChannel>,
173
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
174
- ContextType extends Record<string, any> = StrRecord<string, any>, InputType = PregelInputType, OutputType = PregelOutputType, StreamUpdatesType = InputType, StreamValuesType = OutputType, NodeReturnType = unknown, CommandType = CommandInstance,
175
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
176
- StreamCustom = any> extends PartialRunnable<InputType | CommandType | null, OutputType, PregelOptions<Nodes, Channels, ContextType>> implements PregelInterface<Nodes, Channels, ContextType> {
162
+ declare class Pregel<Nodes extends StrRecord<string, PregelNode>, Channels extends StrRecord<string, BaseChannel>, ContextType extends Record<string, any> = StrRecord<string, any>, InputType = PregelInputType, OutputType = PregelOutputType, StreamUpdatesType = InputType, StreamValuesType = OutputType, NodeReturnType = unknown, CommandType = CommandInstance, StreamCustom = any> extends PartialRunnable<InputType | CommandType | null, OutputType, PregelOptions<Nodes, Channels, ContextType>> implements PregelInterface<Nodes, Channels, ContextType> {
177
163
  /**
178
164
  * Name of the class when serialized
179
165
  * @internal
@@ -330,9 +316,7 @@ StreamCustom = any> extends PartialRunnable<InputType | CommandType | null, Outp
330
316
  * @param recurse - Whether to recursively get subgraphs of subgraphs
331
317
  * @returns Generator yielding tuples of [name, subgraph]
332
318
  */
333
- getSubgraphs(namespace?: string, recurse?: boolean
334
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
335
- ): Generator<[string, Pregel<any, any>]>;
319
+ getSubgraphs(namespace?: string, recurse?: boolean): Generator<[string, Pregel<any, any>]>;
336
320
  /**
337
321
  * Gets all subgraphs within this graph asynchronously.
338
322
  * A subgraph is a Pregel instance that is nested within a node of this graph.
@@ -341,9 +325,7 @@ StreamCustom = any> extends PartialRunnable<InputType | CommandType | null, Outp
341
325
  * @param recurse - Whether to recursively get subgraphs of subgraphs
342
326
  * @returns AsyncGenerator yielding tuples of [name, subgraph]
343
327
  */
344
- getSubgraphsAsync(namespace?: string, recurse?: boolean
345
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
346
- ): AsyncGenerator<[string, Pregel<any, any>]>;
328
+ getSubgraphsAsync(namespace?: string, recurse?: boolean): AsyncGenerator<[string, Pregel<any, any>]>;
347
329
  /**
348
330
  * Prepares a state snapshot from saved checkpoint data.
349
331
  * This is an internal method used by getState and getStateHistory.
@@ -449,37 +431,7 @@ StreamCustom = any> extends PartialRunnable<InputType | CommandType | null, Outp
449
431
  * - whether checkpoint during is enabled
450
432
  * @internal
451
433
  */
452
- _defaults(config: PregelOptions<Nodes, Channels>): [boolean,
453
- // debug
454
- StreamMode[],
455
- // stream mode
456
- // stream mode
457
- string | string[],
458
- // input keys
459
- // input keys
460
- string | string[],
461
- // output keys
462
- LangGraphRunnableConfig,
463
- // config without pregel keys
464
- // config without pregel keys
465
- All | string[],
466
- // interrupt before
467
- // interrupt before
468
- All | string[],
469
- // interrupt after
470
- // interrupt after
471
- BaseCheckpointSaver | undefined,
472
- // checkpointer
473
- // checkpointer
474
- BaseStore | undefined,
475
- // store
476
- boolean,
477
- // stream mode single
478
- // stream mode single
479
- BaseCache | undefined,
480
- // node cache
481
- Durability // durability
482
- ];
434
+ _defaults(config: PregelOptions<Nodes, Channels>): [boolean, StreamMode[], string | string[], string | string[], LangGraphRunnableConfig, All | string[], All | string[], BaseCheckpointSaver | undefined, BaseStore | undefined, boolean, BaseCache | undefined, Durability];
483
435
  /**
484
436
  * Streams the execution of the graph, emitting state updates as they occur.
485
437
  * This is the primary method for observing graph execution in real-time.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":["Runnable","RunnableConfig","RunnableFunc","StreamEvent","IterableReadableStream","All","BaseCache","BaseCheckpointSaver","BaseStore","CheckpointListOptions","CheckpointTuple","BaseChannel","Command","CommandInstance","StrRecord","PregelNode","LangGraphRunnableConfig","Durability","GetStateOptions","MultipleChannelSubscriptionOptions","PregelInputType","PregelInterface","PregelOptions","PregelOutputType","PregelParams","SingleChannelSubscriptionOptions","StateSnapshot","StreamMode","StreamOutputMap","RetryPolicy","ChannelWrite","WriteValue","StreamEventsOptions","Parameters","Channel","Record","PartialRunnable","RunInput","RunOutput","CallOptions","Partial","Promise","Pregel","InputType","OutputType","CommandType","Nodes","Channels","ContextType","Array","Omit","_langchain_core_runnables_graph0","Graph","Generator","AsyncGenerator","config","saved","subgraphCheckpointer","applyPendingWrites","AsyncIterableIterator","TStreamMode","TSubgraphs","TEncoding","StreamUpdatesType","StreamValuesType","NodeReturnType","StreamCustom","Uint8Array"],"sources":["../../src/pregel/index.d.ts"],"sourcesContent":["/* eslint-disable no-param-reassign */\nimport { Runnable, RunnableConfig, RunnableFunc } from \"@langchain/core/runnables\";\nimport type { StreamEvent } from \"@langchain/core/tracers/log_stream\";\nimport { IterableReadableStream } from \"@langchain/core/utils/stream\";\nimport { All, BaseCache, BaseCheckpointSaver, BaseStore, CheckpointListOptions, CheckpointTuple } from \"@langchain/langgraph-checkpoint\";\nimport { BaseChannel } from \"../channels/base.js\";\nimport { Command, type CommandInstance } from \"../constants.js\";\nimport { StrRecord } from \"./algo.js\";\nimport { PregelNode } from \"./read.js\";\nimport { LangGraphRunnableConfig } from \"./runnable_types.js\";\nimport type { Durability, GetStateOptions, MultipleChannelSubscriptionOptions, PregelInputType, PregelInterface, PregelOptions, PregelOutputType, PregelParams, SingleChannelSubscriptionOptions, StateSnapshot, StreamMode, StreamOutputMap } from \"./types.js\";\nimport { RetryPolicy } from \"./utils/index.js\";\nimport { ChannelWrite } from \"./write.js\";\ntype WriteValue = Runnable | RunnableFunc<unknown, unknown> | unknown;\ntype StreamEventsOptions = Parameters<Runnable[\"streamEvents\"]>[2];\n/**\n * Utility class for working with channels in the Pregel system.\n * Provides static methods for subscribing to channels and writing to them.\n *\n * Channels are the communication pathways between nodes in a Pregel graph.\n * They enable message passing and state updates between different parts of the graph.\n */\nexport declare class Channel {\n /**\n * Creates a PregelNode that subscribes to a single channel.\n * This is used to define how nodes receive input from channels.\n *\n * @example\n * ```typescript\n * // Subscribe to a single channel\n * const node = Channel.subscribeTo(\"messages\");\n *\n * // Subscribe to multiple channels\n * const node = Channel.subscribeTo([\"messages\", \"state\"]);\n *\n * // Subscribe with a custom key\n * const node = Channel.subscribeTo(\"messages\", { key: \"chat\" });\n * ```\n *\n * @param channel Single channel name to subscribe to\n * @param options Subscription options\n * @returns A PregelNode configured to receive from the specified channels\n * @throws {Error} If a key is specified when subscribing to multiple channels\n */\n static subscribeTo(channel: string, options?: SingleChannelSubscriptionOptions): PregelNode;\n /**\n * Creates a PregelNode that subscribes to multiple channels.\n * This is used to define how nodes receive input from channels.\n *\n * @example\n * ```typescript\n * // Subscribe to a single channel\n * const node = Channel.subscribeTo(\"messages\");\n *\n * // Subscribe to multiple channels\n * const node = Channel.subscribeTo([\"messages\", \"state\"]);\n *\n * // Subscribe with a custom key\n * const node = Channel.subscribeTo(\"messages\", { key: \"chat\" });\n * ```\n *\n * @param channels Single channel name to subscribe to\n * @param options Subscription options\n * @returns A PregelNode configured to receive from the specified channels\n * @throws {Error} If a key is specified when subscribing to multiple channels\n */\n static subscribeTo(channels: string[], options?: MultipleChannelSubscriptionOptions): PregelNode;\n /**\n * Creates a ChannelWrite that specifies how to write values to channels.\n * This is used to define how nodes send output to channels.\n *\n * @example\n * ```typescript\n * // Write to multiple channels\n * const write = Channel.writeTo([\"output\", \"state\"]);\n *\n * // Write with specific values\n * const write = Channel.writeTo([\"output\"], {\n * state: \"completed\",\n * result: calculateResult()\n * });\n *\n * // Write with a transformation function\n * const write = Channel.writeTo([\"output\"], {\n * result: (x) => processResult(x)\n * });\n * ```\n *\n * @param channels - Array of channel names to write to\n * @param writes - Optional map of channel names to values or transformations\n * @returns A ChannelWrite object that can be used to write to the specified channels\n */\n static writeTo(channels: string[], writes?: Record<string, WriteValue>): ChannelWrite;\n}\nexport type { PregelInputType, PregelOptions, PregelOutputType };\n// This is a workaround to allow Pregel to override `invoke` / `stream` and `withConfig`\n// without having to adhere to the types in the `Runnable` class (thanks to `any`).\n// Alternatively we could mark those methods with @ts-ignore / @ts-expect-error,\n// but these do not get carried over when building via `tsc`.\ndeclare class PartialRunnable<RunInput, RunOutput, CallOptions extends RunnableConfig> extends Runnable<RunInput, RunOutput, CallOptions> {\n lc_namespace: string[];\n invoke(_input: RunInput, _options?: Partial<CallOptions>\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ): Promise<any>;\n // Overriden by `Pregel`\n withConfig(_config: CallOptions): typeof this;\n // Overriden by `Pregel`\n stream(input: RunInput, options?: Partial<CallOptions>\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ): Promise<IterableReadableStream<any>>;\n}\n/**\n * The Pregel class is the core runtime engine of LangGraph, implementing a message-passing graph computation model\n * inspired by [Google's Pregel system](https://research.google/pubs/pregel-a-system-for-large-scale-graph-processing/).\n * It provides the foundation for building reliable, controllable agent workflows that can evolve state over time.\n *\n * Key features:\n * - Message passing between nodes in discrete \"supersteps\"\n * - Built-in persistence layer through checkpointers\n * - First-class streaming support for values, updates, and events\n * - Human-in-the-loop capabilities via interrupts\n * - Support for parallel node execution within supersteps\n *\n * The Pregel class is not intended to be instantiated directly by consumers. Instead, use the following higher-level APIs:\n * - {@link StateGraph}: The main graph class for building agent workflows\n * - Compiling a {@link StateGraph} will return a {@link CompiledGraph} instance, which extends `Pregel`\n * - Functional API: A declarative approach using tasks and entrypoints\n * - A `Pregel` instance is returned by the {@link entrypoint} function\n *\n * @example\n * ```typescript\n * // Using StateGraph API\n * const graph = new StateGraph(annotation)\n * .addNode(\"nodeA\", myNodeFunction)\n * .addEdge(\"nodeA\", \"nodeB\")\n * .compile();\n *\n * // The compiled graph is a Pregel instance\n * const result = await graph.invoke(input);\n * ```\n *\n * @example\n * ```typescript\n * // Using Functional API\n * import { task, entrypoint } from \"@langchain/langgraph\";\n * import { MemorySaver } from \"@langchain/langgraph-checkpoint\";\n *\n * // Define tasks that can be composed\n * const addOne = task(\"add\", async (x: number) => x + 1);\n *\n * // Create a workflow using the entrypoint function\n * const workflow = entrypoint({\n * name: \"workflow\",\n * checkpointer: new MemorySaver()\n * }, async (numbers: number[]) => {\n * // Tasks can be run in parallel\n * const results = await Promise.all(numbers.map(n => addOne(n)));\n * return results;\n * });\n *\n * // The workflow is a Pregel instance\n * const result = await workflow.invoke([1, 2, 3]); // Returns [2, 3, 4]\n * ```\n *\n * @typeParam Nodes - Mapping of node names to their {@link PregelNode} implementations\n * @typeParam Channels - Mapping of channel names to their {@link BaseChannel} or {@link ManagedValueSpec} implementations\n * @typeParam ContextType - Type of context that can be passed to the graph\n * @typeParam InputType - Type of input values accepted by the graph\n * @typeParam OutputType - Type of output values produced by the graph\n */\nexport declare class Pregel<Nodes extends StrRecord<string, PregelNode>, Channels extends StrRecord<string, BaseChannel>, \n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nContextType extends Record<string, any> = StrRecord<string, any>, InputType = PregelInputType, OutputType = PregelOutputType, StreamUpdatesType = InputType, StreamValuesType = OutputType, NodeReturnType = unknown, CommandType = CommandInstance, \n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nStreamCustom = any> extends PartialRunnable<InputType | CommandType | null, OutputType, PregelOptions<Nodes, Channels, ContextType>> implements PregelInterface<Nodes, Channels, ContextType> {\n /**\n * Name of the class when serialized\n * @internal\n */\n static lc_name(): string;\n /** @internal Used for type inference */\n \"~InputType\": InputType;\n /** @internal Used for type inference */\n \"~OutputType\": OutputType;\n /** @internal LangChain namespace for serialization necessary because Pregel extends Runnable */\n lc_namespace: string[];\n /** @internal Flag indicating this is a Pregel instance - necessary for serialization */\n lg_is_pregel: boolean;\n /** The nodes in the graph, mapping node names to their PregelNode instances */\n nodes: Nodes;\n /** The channels in the graph, mapping channel names to their BaseChannel or ManagedValueSpec instances */\n channels: Channels;\n /**\n * The input channels for the graph. These channels receive the initial input when the graph is invoked.\n * Can be a single channel key or an array of channel keys.\n */\n inputChannels: keyof Channels | Array<keyof Channels>;\n /**\n * The output channels for the graph. These channels contain the final output when the graph completes.\n * Can be a single channel key or an array of channel keys.\n */\n outputChannels: keyof Channels | Array<keyof Channels>;\n /** Whether to automatically validate the graph structure when it is compiled. Defaults to true. */\n autoValidate: boolean;\n /**\n * The streaming modes enabled for this graph. Defaults to [\"values\"].\n * Supported modes:\n * - \"values\": Streams the full state after each step\n * - \"updates\": Streams state updates after each step\n * - \"messages\": Streams messages from within nodes\n * - \"custom\": Streams custom events from within nodes\n * - \"debug\": Streams events related to the execution of the graph - useful for tracing & debugging graph execution\n */\n streamMode: StreamMode[];\n /**\n * Optional channels to stream. If not specified, all channels will be streamed.\n * Can be a single channel key or an array of channel keys.\n */\n streamChannels?: keyof Channels | Array<keyof Channels>;\n /**\n * Optional array of node names or \"all\" to interrupt after executing these nodes.\n * Used for implementing human-in-the-loop workflows.\n */\n interruptAfter?: Array<keyof Nodes> | All;\n /**\n * Optional array of node names or \"all\" to interrupt before executing these nodes.\n * Used for implementing human-in-the-loop workflows.\n */\n interruptBefore?: Array<keyof Nodes> | All;\n /** Optional timeout in milliseconds for the execution of each superstep */\n stepTimeout?: number;\n /** Whether to enable debug logging. Defaults to false. */\n debug: boolean;\n /**\n * Optional checkpointer for persisting graph state.\n * When provided, saves a checkpoint of the graph state at every superstep.\n * When false or undefined, checkpointing is disabled, and the graph will not be able to save or restore state.\n */\n checkpointer?: BaseCheckpointSaver | boolean;\n /** Optional retry policy for handling failures in node execution */\n retryPolicy?: RetryPolicy;\n /** The default configuration for graph execution, can be overridden on a per-invocation basis */\n config?: LangGraphRunnableConfig;\n /**\n * Optional long-term memory store for the graph, allows for persistence & retrieval of data across threads\n */\n store?: BaseStore;\n /**\n * Optional cache for the graph, useful for caching tasks.\n */\n cache?: BaseCache;\n /**\n * Optional interrupt helper function.\n * @internal\n */\n private userInterrupt?;\n /**\n * The trigger to node mapping for the graph run.\n * @internal\n */\n private triggerToNodes;\n /**\n * Constructor for Pregel - meant for internal use only.\n *\n * @internal\n */\n constructor(fields: PregelParams<Nodes, Channels>);\n /**\n * Creates a new instance of the Pregel graph with updated configuration.\n * This method follows the immutable pattern - instead of modifying the current instance,\n * it returns a new instance with the merged configuration.\n *\n * @example\n * ```typescript\n * // Create a new instance with debug enabled\n * const debugGraph = graph.withConfig({ debug: true });\n *\n * // Create a new instance with a specific thread ID\n * const threadGraph = graph.withConfig({\n * configurable: { thread_id: \"123\" }\n * });\n * ```\n *\n * @param config - The configuration to merge with the current configuration\n * @returns A new Pregel instance with the merged configuration\n */\n withConfig(config: Omit<LangGraphRunnableConfig, \"store\" | \"writer\" | \"interrupt\">): typeof this;\n /**\n * Validates the graph structure to ensure it is well-formed.\n * Checks for:\n * - No orphaned nodes\n * - Valid input/output channel configurations\n * - Valid interrupt configurations\n *\n * @returns this - The Pregel instance for method chaining\n * @throws {GraphValidationError} If the graph structure is invalid\n */\n validate(): this;\n /**\n * Gets a list of all channels that should be streamed.\n * If streamChannels is specified, returns those channels.\n * Otherwise, returns all channels in the graph.\n *\n * @returns Array of channel keys to stream\n */\n get streamChannelsList(): Array<keyof Channels>;\n /**\n * Gets the channels to stream in their original format.\n * If streamChannels is specified, returns it as-is (either single key or array).\n * Otherwise, returns all channels in the graph as an array.\n *\n * @returns Channel keys to stream, either as a single key or array\n */\n get streamChannelsAsIs(): keyof Channels | Array<keyof Channels>;\n /**\n * Gets a drawable representation of the graph structure.\n * This is an async version of getGraph() and is the preferred method to use.\n *\n * @param config - Configuration for generating the graph visualization\n * @returns A representation of the graph that can be visualized\n */\n getGraphAsync(config: RunnableConfig): Promise<import(\"@langchain/core/runnables/graph\").Graph>;\n /**\n * Gets all subgraphs within this graph.\n * A subgraph is a Pregel instance that is nested within a node of this graph.\n *\n * @deprecated Use getSubgraphsAsync instead. The async method will become the default in the next minor release.\n * @param namespace - Optional namespace to filter subgraphs\n * @param recurse - Whether to recursively get subgraphs of subgraphs\n * @returns Generator yielding tuples of [name, subgraph]\n */\n getSubgraphs(namespace?: string, recurse?: boolean\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ): Generator<[string, Pregel<any, any>]>;\n /**\n * Gets all subgraphs within this graph asynchronously.\n * A subgraph is a Pregel instance that is nested within a node of this graph.\n *\n * @param namespace - Optional namespace to filter subgraphs\n * @param recurse - Whether to recursively get subgraphs of subgraphs\n * @returns AsyncGenerator yielding tuples of [name, subgraph]\n */\n getSubgraphsAsync(namespace?: string, recurse?: boolean\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ): AsyncGenerator<[string, Pregel<any, any>]>;\n /**\n * Prepares a state snapshot from saved checkpoint data.\n * This is an internal method used by getState and getStateHistory.\n *\n * @param config - Configuration for preparing the snapshot\n * @param saved - Optional saved checkpoint data\n * @param subgraphCheckpointer - Optional checkpointer for subgraphs\n * @param applyPendingWrites - Whether to apply pending writes to tasks and then to channels\n * @returns A snapshot of the graph state\n * @internal\n */\n protected _prepareStateSnapshot({ config, saved, subgraphCheckpointer, applyPendingWrites }: {\n config: RunnableConfig;\n saved?: CheckpointTuple;\n subgraphCheckpointer?: BaseCheckpointSaver;\n applyPendingWrites?: boolean;\n }): Promise<StateSnapshot>;\n /**\n * Gets the current state of the graph.\n * Requires a checkpointer to be configured.\n *\n * @param config - Configuration for retrieving the state\n * @param options - Additional options\n * @returns A snapshot of the current graph state\n * @throws {GraphValueError} If no checkpointer is configured\n */\n getState(config: RunnableConfig, options?: GetStateOptions): Promise<StateSnapshot>;\n /**\n * Gets the history of graph states.\n * Requires a checkpointer to be configured.\n * Useful for:\n * - Debugging execution history\n * - Implementing time travel\n * - Analyzing graph behavior\n *\n * @param config - Configuration for retrieving the history\n * @param options - Options for filtering the history\n * @returns An async iterator of state snapshots\n * @throws {Error} If no checkpointer is configured\n */\n getStateHistory(config: RunnableConfig, options?: CheckpointListOptions): AsyncIterableIterator<StateSnapshot>;\n /**\n * Apply updates to the graph state in bulk.\n * Requires a checkpointer to be configured.\n *\n * This method is useful for recreating a thread\n * from a list of updates, especially if a checkpoint\n * is created as a result of multiple tasks.\n *\n * @internal The API might change in the future.\n *\n * @param startConfig - Configuration for the update\n * @param updates - The list of updates to apply to graph state\n * @returns Updated configuration\n * @throws {GraphValueError} If no checkpointer is configured\n * @throws {InvalidUpdateError} If the update cannot be attributed to a node or an update can be only applied in sequence.\n */\n bulkUpdateState(startConfig: LangGraphRunnableConfig, supersteps: Array<{\n updates: Array<{\n values?: Record<string, unknown> | unknown;\n asNode?: keyof Nodes | string;\n }>;\n }>): Promise<RunnableConfig>;\n /**\n * Updates the state of the graph with new values.\n * Requires a checkpointer to be configured.\n *\n * This method can be used for:\n * - Implementing human-in-the-loop workflows\n * - Modifying graph state during breakpoints\n * - Integrating external inputs into the graph\n *\n * @param inputConfig - Configuration for the update\n * @param values - The values to update the state with\n * @param asNode - Optional node name to attribute the update to\n * @returns Updated configuration\n * @throws {GraphValueError} If no checkpointer is configured\n * @throws {InvalidUpdateError} If the update cannot be attributed to a node\n */\n updateState(inputConfig: LangGraphRunnableConfig, values: Record<string, unknown> | unknown, asNode?: keyof Nodes | string): Promise<RunnableConfig>;\n /**\n * Gets the default values for various graph configuration options.\n * This is an internal method used to process and normalize configuration options.\n *\n * @param config - The input configuration options\n * @returns A tuple containing normalized values for:\n * - debug mode\n * - stream modes\n * - input keys\n * - output keys\n * - remaining config\n * - interrupt before nodes\n * - interrupt after nodes\n * - checkpointer\n * - store\n * - whether stream mode is single\n * - node cache\n * - whether checkpoint during is enabled\n * @internal\n */\n _defaults(config: PregelOptions<Nodes, Channels>): [\n boolean, // debug\n StreamMode[], // stream mode\n // stream mode\n string | string[], // input keys\n // input keys\n string | string[], // output keys\n LangGraphRunnableConfig, // config without pregel keys\n // config without pregel keys\n All | string[], // interrupt before\n // interrupt before\n All | string[], // interrupt after\n // interrupt after\n BaseCheckpointSaver | undefined, // checkpointer\n // checkpointer\n BaseStore | undefined, // store\n boolean, // stream mode single\n // stream mode single\n BaseCache | undefined, // node cache\n Durability // durability\n ];\n /**\n * Streams the execution of the graph, emitting state updates as they occur.\n * This is the primary method for observing graph execution in real-time.\n *\n * Stream modes:\n * - \"values\": Emits complete state after each step\n * - \"updates\": Emits only state changes after each step\n * - \"debug\": Emits detailed debug information\n * - \"messages\": Emits messages from within nodes\n * - \"custom\": Emits custom events from within nodes\n * - \"checkpoints\": Emits checkpoints from within nodes\n * - \"tasks\": Emits tasks from within nodes\n *\n * @param input - The input to start graph execution with\n * @param options - Configuration options for streaming\n * @returns An async iterable stream of graph state updates\n */\n stream<TStreamMode extends StreamMode | StreamMode[] | undefined, TSubgraphs extends boolean, TEncoding extends \"text/event-stream\" | undefined>(input: InputType | CommandType | null, options?: Partial<PregelOptions<Nodes, Channels, ContextType, TStreamMode, TSubgraphs, TEncoding>>): Promise<IterableReadableStream<StreamOutputMap<TStreamMode, TSubgraphs, StreamUpdatesType, StreamValuesType, keyof Nodes, NodeReturnType, StreamCustom, TEncoding>>>;\n /**\n * @inheritdoc\n */\n streamEvents(input: InputType | CommandType | null, options: Partial<PregelOptions<Nodes, Channels, ContextType>> & {\n version: \"v1\" | \"v2\";\n }, streamOptions?: StreamEventsOptions): IterableReadableStream<StreamEvent>;\n streamEvents(input: InputType | CommandType | null, options: Partial<PregelOptions<Nodes, Channels, ContextType>> & {\n version: \"v1\" | \"v2\";\n encoding: \"text/event-stream\";\n }, streamOptions?: StreamEventsOptions): IterableReadableStream<Uint8Array>;\n /**\n * Validates the input for the graph.\n * @param input - The input to validate\n * @returns The validated input\n * @internal\n */\n protected _validateInput(input: PregelInputType): Promise<any>;\n /**\n * Validates the context options for the graph.\n * @param context - The context options to validate\n * @returns The validated context options\n * @internal\n */\n protected _validateContext(context: Partial<LangGraphRunnableConfig[\"context\"]>): Promise<LangGraphRunnableConfig[\"context\"]>;\n /**\n * Internal iterator used by stream() to generate state updates.\n * This method handles the core logic of graph execution and streaming.\n *\n * @param input - The input to start graph execution with\n * @param options - Configuration options for streaming\n * @returns AsyncGenerator yielding state updates\n * @internal\n */\n _streamIterator(input: PregelInputType | Command, options?: Partial<PregelOptions<Nodes, Channels>>): AsyncGenerator<PregelOutputType>;\n /**\n * Run the graph with a single input and config.\n * @param input The input to the graph.\n * @param options The configuration to use for the run.\n */\n invoke(input: InputType | CommandType | null, options?: Partial<Omit<PregelOptions<Nodes, Channels, ContextType>, \"encoding\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QlB,cAAcwB,OAAOC,UAAUC,aAAaY,aAAaC,YAAYC,cAAcrB,QAAQrC,uBAAuBwB,gBAAgBgC,aAAaC,YAAYE,mBAAmBC,wBAAwBlB,OAAOmB,gBAAgBC,cAAcJ;;;;sBAIjanB,YAAYE,6BAA6BL,QAAQlB,cAAcwB,OAAOC,UAAUC;;qBAEjFhB,sBAAsB5B,uBAAuBD;sBAC5CwC,YAAYE,6BAA6BL,QAAQlB,cAAcwB,OAAOC,UAAUC;;;qBAGjFhB,sBAAsB5B,uBAAuB+D;;;;;;;kCAOhC/C,kBAAkBqB;;;;;;;sCAOdD,QAAQxB,sCAAsCyB,QAAQzB;;;;;;;;;;yBAUnEI,kBAAkBR,mBAAmB4B,QAAQlB,cAAcwB,OAAOC,aAAaO,eAAe/B;;;;;;gBAMvGoB,YAAYE,8BAA8BL,QAAQU,KAAK5B,cAAcwB,OAAOC,UAAUC,6BAA6BP,QAAQG;;gBAE3HH"}
1
+ {"version":3,"file":"index.d.ts","names":["Runnable","RunnableConfig","RunnableFunc","StreamEvent","IterableReadableStream","All","BaseCache","BaseCheckpointSaver","BaseStore","CheckpointListOptions","CheckpointTuple","BaseChannel","Command","CommandInstance","StrRecord","PregelNode","LangGraphRunnableConfig","Durability","GetStateOptions","MultipleChannelSubscriptionOptions","PregelInputType","PregelInterface","PregelOptions","PregelOutputType","PregelParams","SingleChannelSubscriptionOptions","StateSnapshot","StreamMode","StreamOutputMap","RetryPolicy","ChannelWrite","WriteValue","StreamEventsOptions","Parameters","Channel","Record","PartialRunnable","RunInput","RunOutput","CallOptions","Partial","Promise","Pregel","InputType","OutputType","CommandType","Nodes","Channels","ContextType","Array","Omit","_langchain_core_runnables_graph0","Graph","Generator","AsyncGenerator","config","saved","subgraphCheckpointer","applyPendingWrites","AsyncIterableIterator","TStreamMode","TSubgraphs","TEncoding","StreamUpdatesType","StreamValuesType","NodeReturnType","StreamCustom","Uint8Array"],"sources":["../../src/pregel/index.d.ts"],"sourcesContent":["import { Runnable, RunnableConfig, RunnableFunc } from \"@langchain/core/runnables\";\nimport type { StreamEvent } from \"@langchain/core/tracers/log_stream\";\nimport { IterableReadableStream } from \"@langchain/core/utils/stream\";\nimport { All, BaseCache, BaseCheckpointSaver, BaseStore, CheckpointListOptions, CheckpointTuple } from \"@langchain/langgraph-checkpoint\";\nimport { BaseChannel } from \"../channels/base.js\";\nimport { Command, type CommandInstance } from \"../constants.js\";\nimport { StrRecord } from \"./algo.js\";\nimport { PregelNode } from \"./read.js\";\nimport { LangGraphRunnableConfig } from \"./runnable_types.js\";\nimport type { Durability, GetStateOptions, MultipleChannelSubscriptionOptions, PregelInputType, PregelInterface, PregelOptions, PregelOutputType, PregelParams, SingleChannelSubscriptionOptions, StateSnapshot, StreamMode, StreamOutputMap } from \"./types.js\";\nimport { RetryPolicy } from \"./utils/index.js\";\nimport { ChannelWrite } from \"./write.js\";\ntype WriteValue = Runnable | RunnableFunc<unknown, unknown> | unknown;\ntype StreamEventsOptions = Parameters<Runnable[\"streamEvents\"]>[2];\n/**\n * Utility class for working with channels in the Pregel system.\n * Provides static methods for subscribing to channels and writing to them.\n *\n * Channels are the communication pathways between nodes in a Pregel graph.\n * They enable message passing and state updates between different parts of the graph.\n */\nexport declare class Channel {\n /**\n * Creates a PregelNode that subscribes to a single channel.\n * This is used to define how nodes receive input from channels.\n *\n * @example\n * ```typescript\n * // Subscribe to a single channel\n * const node = Channel.subscribeTo(\"messages\");\n *\n * // Subscribe to multiple channels\n * const node = Channel.subscribeTo([\"messages\", \"state\"]);\n *\n * // Subscribe with a custom key\n * const node = Channel.subscribeTo(\"messages\", { key: \"chat\" });\n * ```\n *\n * @param channel Single channel name to subscribe to\n * @param options Subscription options\n * @returns A PregelNode configured to receive from the specified channels\n * @throws {Error} If a key is specified when subscribing to multiple channels\n */\n static subscribeTo(channel: string, options?: SingleChannelSubscriptionOptions): PregelNode;\n /**\n * Creates a PregelNode that subscribes to multiple channels.\n * This is used to define how nodes receive input from channels.\n *\n * @example\n * ```typescript\n * // Subscribe to a single channel\n * const node = Channel.subscribeTo(\"messages\");\n *\n * // Subscribe to multiple channels\n * const node = Channel.subscribeTo([\"messages\", \"state\"]);\n *\n * // Subscribe with a custom key\n * const node = Channel.subscribeTo(\"messages\", { key: \"chat\" });\n * ```\n *\n * @param channels Single channel name to subscribe to\n * @param options Subscription options\n * @returns A PregelNode configured to receive from the specified channels\n * @throws {Error} If a key is specified when subscribing to multiple channels\n */\n static subscribeTo(channels: string[], options?: MultipleChannelSubscriptionOptions): PregelNode;\n /**\n * Creates a ChannelWrite that specifies how to write values to channels.\n * This is used to define how nodes send output to channels.\n *\n * @example\n * ```typescript\n * // Write to multiple channels\n * const write = Channel.writeTo([\"output\", \"state\"]);\n *\n * // Write with specific values\n * const write = Channel.writeTo([\"output\"], {\n * state: \"completed\",\n * result: calculateResult()\n * });\n *\n * // Write with a transformation function\n * const write = Channel.writeTo([\"output\"], {\n * result: (x) => processResult(x)\n * });\n * ```\n *\n * @param channels - Array of channel names to write to\n * @param writes - Optional map of channel names to values or transformations\n * @returns A ChannelWrite object that can be used to write to the specified channels\n */\n static writeTo(channels: string[], writes?: Record<string, WriteValue>): ChannelWrite;\n}\nexport type { PregelInputType, PregelOptions, PregelOutputType };\ndeclare class PartialRunnable<RunInput, RunOutput, CallOptions extends RunnableConfig> extends Runnable<RunInput, RunOutput, CallOptions> {\n lc_namespace: string[];\n invoke(_input: RunInput, _options?: Partial<CallOptions>): Promise<any>;\n withConfig(_config: CallOptions): typeof this;\n stream(input: RunInput, options?: Partial<CallOptions>): Promise<IterableReadableStream<any>>;\n}\n/**\n * The Pregel class is the core runtime engine of LangGraph, implementing a message-passing graph computation model\n * inspired by [Google's Pregel system](https://research.google/pubs/pregel-a-system-for-large-scale-graph-processing/).\n * It provides the foundation for building reliable, controllable agent workflows that can evolve state over time.\n *\n * Key features:\n * - Message passing between nodes in discrete \"supersteps\"\n * - Built-in persistence layer through checkpointers\n * - First-class streaming support for values, updates, and events\n * - Human-in-the-loop capabilities via interrupts\n * - Support for parallel node execution within supersteps\n *\n * The Pregel class is not intended to be instantiated directly by consumers. Instead, use the following higher-level APIs:\n * - {@link StateGraph}: The main graph class for building agent workflows\n * - Compiling a {@link StateGraph} will return a {@link CompiledGraph} instance, which extends `Pregel`\n * - Functional API: A declarative approach using tasks and entrypoints\n * - A `Pregel` instance is returned by the {@link entrypoint} function\n *\n * @example\n * ```typescript\n * // Using StateGraph API\n * const graph = new StateGraph(annotation)\n * .addNode(\"nodeA\", myNodeFunction)\n * .addEdge(\"nodeA\", \"nodeB\")\n * .compile();\n *\n * // The compiled graph is a Pregel instance\n * const result = await graph.invoke(input);\n * ```\n *\n * @example\n * ```typescript\n * // Using Functional API\n * import { task, entrypoint } from \"@langchain/langgraph\";\n * import { MemorySaver } from \"@langchain/langgraph-checkpoint\";\n *\n * // Define tasks that can be composed\n * const addOne = task(\"add\", async (x: number) => x + 1);\n *\n * // Create a workflow using the entrypoint function\n * const workflow = entrypoint({\n * name: \"workflow\",\n * checkpointer: new MemorySaver()\n * }, async (numbers: number[]) => {\n * // Tasks can be run in parallel\n * const results = await Promise.all(numbers.map(n => addOne(n)));\n * return results;\n * });\n *\n * // The workflow is a Pregel instance\n * const result = await workflow.invoke([1, 2, 3]); // Returns [2, 3, 4]\n * ```\n *\n * @typeParam Nodes - Mapping of node names to their {@link PregelNode} implementations\n * @typeParam Channels - Mapping of channel names to their {@link BaseChannel} or {@link ManagedValueSpec} implementations\n * @typeParam ContextType - Type of context that can be passed to the graph\n * @typeParam InputType - Type of input values accepted by the graph\n * @typeParam OutputType - Type of output values produced by the graph\n */\nexport declare class Pregel<Nodes extends StrRecord<string, PregelNode>, Channels extends StrRecord<string, BaseChannel>, ContextType extends Record<string, any> = StrRecord<string, any>, InputType = PregelInputType, OutputType = PregelOutputType, StreamUpdatesType = InputType, StreamValuesType = OutputType, NodeReturnType = unknown, CommandType = CommandInstance, StreamCustom = any> extends PartialRunnable<InputType | CommandType | null, OutputType, PregelOptions<Nodes, Channels, ContextType>> implements PregelInterface<Nodes, Channels, ContextType> {\n /**\n * Name of the class when serialized\n * @internal\n */\n static lc_name(): string;\n /** @internal Used for type inference */\n \"~InputType\": InputType;\n /** @internal Used for type inference */\n \"~OutputType\": OutputType;\n /** @internal LangChain namespace for serialization necessary because Pregel extends Runnable */\n lc_namespace: string[];\n /** @internal Flag indicating this is a Pregel instance - necessary for serialization */\n lg_is_pregel: boolean;\n /** The nodes in the graph, mapping node names to their PregelNode instances */\n nodes: Nodes;\n /** The channels in the graph, mapping channel names to their BaseChannel or ManagedValueSpec instances */\n channels: Channels;\n /**\n * The input channels for the graph. These channels receive the initial input when the graph is invoked.\n * Can be a single channel key or an array of channel keys.\n */\n inputChannels: keyof Channels | Array<keyof Channels>;\n /**\n * The output channels for the graph. These channels contain the final output when the graph completes.\n * Can be a single channel key or an array of channel keys.\n */\n outputChannels: keyof Channels | Array<keyof Channels>;\n /** Whether to automatically validate the graph structure when it is compiled. Defaults to true. */\n autoValidate: boolean;\n /**\n * The streaming modes enabled for this graph. Defaults to [\"values\"].\n * Supported modes:\n * - \"values\": Streams the full state after each step\n * - \"updates\": Streams state updates after each step\n * - \"messages\": Streams messages from within nodes\n * - \"custom\": Streams custom events from within nodes\n * - \"debug\": Streams events related to the execution of the graph - useful for tracing & debugging graph execution\n */\n streamMode: StreamMode[];\n /**\n * Optional channels to stream. If not specified, all channels will be streamed.\n * Can be a single channel key or an array of channel keys.\n */\n streamChannels?: keyof Channels | Array<keyof Channels>;\n /**\n * Optional array of node names or \"all\" to interrupt after executing these nodes.\n * Used for implementing human-in-the-loop workflows.\n */\n interruptAfter?: Array<keyof Nodes> | All;\n /**\n * Optional array of node names or \"all\" to interrupt before executing these nodes.\n * Used for implementing human-in-the-loop workflows.\n */\n interruptBefore?: Array<keyof Nodes> | All;\n /** Optional timeout in milliseconds for the execution of each superstep */\n stepTimeout?: number;\n /** Whether to enable debug logging. Defaults to false. */\n debug: boolean;\n /**\n * Optional checkpointer for persisting graph state.\n * When provided, saves a checkpoint of the graph state at every superstep.\n * When false or undefined, checkpointing is disabled, and the graph will not be able to save or restore state.\n */\n checkpointer?: BaseCheckpointSaver | boolean;\n /** Optional retry policy for handling failures in node execution */\n retryPolicy?: RetryPolicy;\n /** The default configuration for graph execution, can be overridden on a per-invocation basis */\n config?: LangGraphRunnableConfig;\n /**\n * Optional long-term memory store for the graph, allows for persistence & retrieval of data across threads\n */\n store?: BaseStore;\n /**\n * Optional cache for the graph, useful for caching tasks.\n */\n cache?: BaseCache;\n /**\n * Optional interrupt helper function.\n * @internal\n */\n private userInterrupt?;\n /**\n * The trigger to node mapping for the graph run.\n * @internal\n */\n private triggerToNodes;\n /**\n * Constructor for Pregel - meant for internal use only.\n *\n * @internal\n */\n constructor(fields: PregelParams<Nodes, Channels>);\n /**\n * Creates a new instance of the Pregel graph with updated configuration.\n * This method follows the immutable pattern - instead of modifying the current instance,\n * it returns a new instance with the merged configuration.\n *\n * @example\n * ```typescript\n * // Create a new instance with debug enabled\n * const debugGraph = graph.withConfig({ debug: true });\n *\n * // Create a new instance with a specific thread ID\n * const threadGraph = graph.withConfig({\n * configurable: { thread_id: \"123\" }\n * });\n * ```\n *\n * @param config - The configuration to merge with the current configuration\n * @returns A new Pregel instance with the merged configuration\n */\n withConfig(config: Omit<LangGraphRunnableConfig, \"store\" | \"writer\" | \"interrupt\">): typeof this;\n /**\n * Validates the graph structure to ensure it is well-formed.\n * Checks for:\n * - No orphaned nodes\n * - Valid input/output channel configurations\n * - Valid interrupt configurations\n *\n * @returns this - The Pregel instance for method chaining\n * @throws {GraphValidationError} If the graph structure is invalid\n */\n validate(): this;\n /**\n * Gets a list of all channels that should be streamed.\n * If streamChannels is specified, returns those channels.\n * Otherwise, returns all channels in the graph.\n *\n * @returns Array of channel keys to stream\n */\n get streamChannelsList(): Array<keyof Channels>;\n /**\n * Gets the channels to stream in their original format.\n * If streamChannels is specified, returns it as-is (either single key or array).\n * Otherwise, returns all channels in the graph as an array.\n *\n * @returns Channel keys to stream, either as a single key or array\n */\n get streamChannelsAsIs(): keyof Channels | Array<keyof Channels>;\n /**\n * Gets a drawable representation of the graph structure.\n * This is an async version of getGraph() and is the preferred method to use.\n *\n * @param config - Configuration for generating the graph visualization\n * @returns A representation of the graph that can be visualized\n */\n getGraphAsync(config: RunnableConfig): Promise<import(\"@langchain/core/runnables/graph\").Graph>;\n /**\n * Gets all subgraphs within this graph.\n * A subgraph is a Pregel instance that is nested within a node of this graph.\n *\n * @deprecated Use getSubgraphsAsync instead. The async method will become the default in the next minor release.\n * @param namespace - Optional namespace to filter subgraphs\n * @param recurse - Whether to recursively get subgraphs of subgraphs\n * @returns Generator yielding tuples of [name, subgraph]\n */\n getSubgraphs(namespace?: string, recurse?: boolean): Generator<[string, Pregel<any, any>]>;\n /**\n * Gets all subgraphs within this graph asynchronously.\n * A subgraph is a Pregel instance that is nested within a node of this graph.\n *\n * @param namespace - Optional namespace to filter subgraphs\n * @param recurse - Whether to recursively get subgraphs of subgraphs\n * @returns AsyncGenerator yielding tuples of [name, subgraph]\n */\n getSubgraphsAsync(namespace?: string, recurse?: boolean): AsyncGenerator<[string, Pregel<any, any>]>;\n /**\n * Prepares a state snapshot from saved checkpoint data.\n * This is an internal method used by getState and getStateHistory.\n *\n * @param config - Configuration for preparing the snapshot\n * @param saved - Optional saved checkpoint data\n * @param subgraphCheckpointer - Optional checkpointer for subgraphs\n * @param applyPendingWrites - Whether to apply pending writes to tasks and then to channels\n * @returns A snapshot of the graph state\n * @internal\n */\n protected _prepareStateSnapshot({ config, saved, subgraphCheckpointer, applyPendingWrites }: {\n config: RunnableConfig;\n saved?: CheckpointTuple;\n subgraphCheckpointer?: BaseCheckpointSaver;\n applyPendingWrites?: boolean;\n }): Promise<StateSnapshot>;\n /**\n * Gets the current state of the graph.\n * Requires a checkpointer to be configured.\n *\n * @param config - Configuration for retrieving the state\n * @param options - Additional options\n * @returns A snapshot of the current graph state\n * @throws {GraphValueError} If no checkpointer is configured\n */\n getState(config: RunnableConfig, options?: GetStateOptions): Promise<StateSnapshot>;\n /**\n * Gets the history of graph states.\n * Requires a checkpointer to be configured.\n * Useful for:\n * - Debugging execution history\n * - Implementing time travel\n * - Analyzing graph behavior\n *\n * @param config - Configuration for retrieving the history\n * @param options - Options for filtering the history\n * @returns An async iterator of state snapshots\n * @throws {Error} If no checkpointer is configured\n */\n getStateHistory(config: RunnableConfig, options?: CheckpointListOptions): AsyncIterableIterator<StateSnapshot>;\n /**\n * Apply updates to the graph state in bulk.\n * Requires a checkpointer to be configured.\n *\n * This method is useful for recreating a thread\n * from a list of updates, especially if a checkpoint\n * is created as a result of multiple tasks.\n *\n * @internal The API might change in the future.\n *\n * @param startConfig - Configuration for the update\n * @param updates - The list of updates to apply to graph state\n * @returns Updated configuration\n * @throws {GraphValueError} If no checkpointer is configured\n * @throws {InvalidUpdateError} If the update cannot be attributed to a node or an update can be only applied in sequence.\n */\n bulkUpdateState(startConfig: LangGraphRunnableConfig, supersteps: Array<{\n updates: Array<{\n values?: Record<string, unknown> | unknown;\n asNode?: keyof Nodes | string;\n }>;\n }>): Promise<RunnableConfig>;\n /**\n * Updates the state of the graph with new values.\n * Requires a checkpointer to be configured.\n *\n * This method can be used for:\n * - Implementing human-in-the-loop workflows\n * - Modifying graph state during breakpoints\n * - Integrating external inputs into the graph\n *\n * @param inputConfig - Configuration for the update\n * @param values - The values to update the state with\n * @param asNode - Optional node name to attribute the update to\n * @returns Updated configuration\n * @throws {GraphValueError} If no checkpointer is configured\n * @throws {InvalidUpdateError} If the update cannot be attributed to a node\n */\n updateState(inputConfig: LangGraphRunnableConfig, values: Record<string, unknown> | unknown, asNode?: keyof Nodes | string): Promise<RunnableConfig>;\n /**\n * Gets the default values for various graph configuration options.\n * This is an internal method used to process and normalize configuration options.\n *\n * @param config - The input configuration options\n * @returns A tuple containing normalized values for:\n * - debug mode\n * - stream modes\n * - input keys\n * - output keys\n * - remaining config\n * - interrupt before nodes\n * - interrupt after nodes\n * - checkpointer\n * - store\n * - whether stream mode is single\n * - node cache\n * - whether checkpoint during is enabled\n * @internal\n */\n _defaults(config: PregelOptions<Nodes, Channels>): [\n boolean,\n StreamMode[],\n string | string[],\n string | string[],\n LangGraphRunnableConfig,\n All | string[],\n All | string[],\n BaseCheckpointSaver | undefined,\n BaseStore | undefined,\n boolean,\n BaseCache | undefined,\n Durability\n ];\n /**\n * Streams the execution of the graph, emitting state updates as they occur.\n * This is the primary method for observing graph execution in real-time.\n *\n * Stream modes:\n * - \"values\": Emits complete state after each step\n * - \"updates\": Emits only state changes after each step\n * - \"debug\": Emits detailed debug information\n * - \"messages\": Emits messages from within nodes\n * - \"custom\": Emits custom events from within nodes\n * - \"checkpoints\": Emits checkpoints from within nodes\n * - \"tasks\": Emits tasks from within nodes\n *\n * @param input - The input to start graph execution with\n * @param options - Configuration options for streaming\n * @returns An async iterable stream of graph state updates\n */\n stream<TStreamMode extends StreamMode | StreamMode[] | undefined, TSubgraphs extends boolean, TEncoding extends \"text/event-stream\" | undefined>(input: InputType | CommandType | null, options?: Partial<PregelOptions<Nodes, Channels, ContextType, TStreamMode, TSubgraphs, TEncoding>>): Promise<IterableReadableStream<StreamOutputMap<TStreamMode, TSubgraphs, StreamUpdatesType, StreamValuesType, keyof Nodes, NodeReturnType, StreamCustom, TEncoding>>>;\n /**\n * @inheritdoc\n */\n streamEvents(input: InputType | CommandType | null, options: Partial<PregelOptions<Nodes, Channels, ContextType>> & {\n version: \"v1\" | \"v2\";\n }, streamOptions?: StreamEventsOptions): IterableReadableStream<StreamEvent>;\n streamEvents(input: InputType | CommandType | null, options: Partial<PregelOptions<Nodes, Channels, ContextType>> & {\n version: \"v1\" | \"v2\";\n encoding: \"text/event-stream\";\n }, streamOptions?: StreamEventsOptions): IterableReadableStream<Uint8Array>;\n /**\n * Validates the input for the graph.\n * @param input - The input to validate\n * @returns The validated input\n * @internal\n */\n protected _validateInput(input: PregelInputType): Promise<any>;\n /**\n * Validates the context options for the graph.\n * @param context - The context options to validate\n * @returns The validated context options\n * @internal\n */\n protected _validateContext(context: Partial<LangGraphRunnableConfig[\"context\"]>): Promise<LangGraphRunnableConfig[\"context\"]>;\n /**\n * Internal iterator used by stream() to generate state updates.\n * This method handles the core logic of graph execution and streaming.\n *\n * @param input - The input to start graph execution with\n * @param options - Configuration options for streaming\n * @returns AsyncGenerator yielding state updates\n * @internal\n */\n _streamIterator(input: PregelInputType | Command, options?: Partial<PregelOptions<Nodes, Channels>>): AsyncGenerator<PregelOutputType>;\n /**\n * Run the graph with a single input and config.\n * @param input The input to the graph.\n * @param options The configuration to use for the run.\n */\n invoke(input: InputType | CommandType | null, options?: Partial<Omit<PregelOptions<Nodes, Channels, ContextType>, \"encoding\">>): Promise<OutputType>;\n private _runLoop;\n clearCache(): Promise<void>;\n}\n"],"mappings":";;;;;;;;;;;;;;;KAYK+B,UAAAA,GAAa/B,WAAWE;KACxB8B,mBAAAA,GAAsBC,WAAWjC;;AAFI;;;;;AACD;AACjB,cAQHkC,OAAAA,CARG;;;;AAQxB;;;;;;;;;;AAwEiE;;;;;;;;SAGzBM,WAAAA,CAAAA,OAAAA,EAAAA,MAAAA,EAAAA,OAAAA,CAAAA,EArDUf,gCAqDVe,CAAAA,EArD6CzB,UAqD7CyB;;;;;;;;;;AA+DxC;;;;;;;;;;;;SAA8V3B,WAAAA,CAAAA,QAAAA,EAAAA,MAAAA,EAAAA,EAAAA,OAAAA,CAAAA,EA9FzSM,kCA8FySN,CAAAA,EA9FpQE,UA8FoQF;;;;;;;;;;;;;;;;;;;;;;;;;;SAiDzUoC,OAAAA,CAAAA,QAAAA,EAAAA,MAAAA,EAAAA,EAAAA,MAAAA,CAAAA,EArH2Bd,MAqH3Bc,CAAAA,MAAAA,EArH0ClB,UAqH1CkB,CAAAA,CAAAA,EArHwDnB,YAqHxDmB;;cAlHPb,eAuHQa,CAAAA,QAAAA,EAAAA,SAAAA,EAAAA,oBAvHiDhD,cAuHjDgD,CAAAA,SAvHyEjD,QAuHzEiD,CA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AOC,UAAUC,6BAA6BP,QAAQG;;gBAE3HH"}
@@ -40,10 +40,9 @@ var Channel = class {
40
40
  if (typeof channels === "string") if (key) channelMappingOrArray = { [key]: channels };
41
41
  else channelMappingOrArray = [channels];
42
42
  else channelMappingOrArray = Object.fromEntries(channels.map((chan) => [chan, chan]));
43
- const triggers = Array.isArray(channels) ? channels : [channels];
44
43
  return new PregelNode({
45
44
  channels: channelMappingOrArray,
46
- triggers,
45
+ triggers: Array.isArray(channels) ? channels : [channels],
47
46
  tags
48
47
  });
49
48
  }
@@ -514,13 +513,12 @@ var Pregel = class extends PartialRunnable {
514
513
  }
515
514
  const mergedConfig = mergeConfigs(this.config, config);
516
515
  const saved = await checkpointer.getTuple(config);
517
- const snapshot = await this._prepareStateSnapshot({
516
+ return await this._prepareStateSnapshot({
518
517
  config: mergedConfig,
519
518
  saved,
520
519
  subgraphCheckpointer: options?.subgraphs ? checkpointer : void 0,
521
520
  applyPendingWrites: !config.configurable?.checkpoint_id
522
521
  });
523
- return snapshot;
524
522
  }
525
523
  /**
526
524
  * Gets the history of graph states.
@@ -598,12 +596,11 @@ var Pregel = class extends PartialRunnable {
598
596
  const { values, asNode } = updates[0];
599
597
  if (values == null && asNode === void 0) {
600
598
  if (updates.length > 1) throw new InvalidUpdateError(`Cannot create empty checkpoint with multiple updates`);
601
- const nextConfig$1 = await checkpointer.put(checkpointConfig, createCheckpoint(checkpoint, void 0, step), {
599
+ return patchCheckpointMap(await checkpointer.put(checkpointConfig, createCheckpoint(checkpoint, void 0, step), {
602
600
  source: "update",
603
601
  step: step + 1,
604
602
  parents: saved?.metadata?.parents ?? {}
605
- }, {});
606
- return patchCheckpointMap(nextConfig$1, saved ? saved.metadata : void 0);
603
+ }, {}), saved ? saved.metadata : void 0);
607
604
  }
608
605
  const channels = emptyChannels(this.channels, checkpoint);
609
606
  if (values === null && asNode === END) {
@@ -631,13 +628,12 @@ var Pregel = class extends PartialRunnable {
631
628
  }
632
629
  _applyWrites(checkpoint, channels, Object.values(nextTasks), checkpointer.getNextVersion.bind(checkpointer), this.triggerToNodes);
633
630
  }
634
- const nextConfig$1 = await checkpointer.put(checkpointConfig, createCheckpoint(checkpoint, channels, step), {
631
+ return patchCheckpointMap(await checkpointer.put(checkpointConfig, createCheckpoint(checkpoint, channels, step), {
635
632
  ...checkpointMetadata,
636
633
  source: "update",
637
634
  step: step + 1,
638
635
  parents: saved?.metadata?.parents ?? {}
639
- }, getNewChannelVersions(checkpointPreviousVersions, checkpoint.channel_versions));
640
- return patchCheckpointMap(nextConfig$1, saved ? saved.metadata : void 0);
636
+ }, getNewChannelVersions(checkpointPreviousVersions, checkpoint.channel_versions)), saved ? saved.metadata : void 0);
641
637
  }
642
638
  if (asNode === COPY) {
643
639
  if (updates.length > 1) throw new InvalidUpdateError(`Cannot copy checkpoint with multiple updates`);
@@ -842,7 +838,7 @@ var Pregel = class extends PartialRunnable {
842
838
  * @internal
843
839
  */
844
840
  _defaults(config) {
845
- const { debug, streamMode, inputKeys, outputKeys, interruptAfter, interruptBefore,...rest } = config;
841
+ const { debug, streamMode, inputKeys, outputKeys, interruptAfter, interruptBefore, ...rest } = config;
846
842
  let streamModeSingle = true;
847
843
  const defaultDebug = debug !== void 0 ? debug : this.debug;
848
844
  let defaultOutputKeys = outputKeys;
@@ -962,7 +958,7 @@ var Pregel = class extends PartialRunnable {
962
958
  if (inputConfig.recursionLimit === void 0 || inputConfig.recursionLimit < 1) throw new Error(`Passed "recursionLimit" must be at least 1.`);
963
959
  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"`);
964
960
  const validInput = await this._validateInput(input);
965
- const { runId,...restConfig } = inputConfig;
961
+ const { runId, ...restConfig } = inputConfig;
966
962
  const [debug, streamMode, , outputKeys, config, interruptBefore, interruptAfter, checkpointer, store, streamModeSingle, cache, durability] = this._defaults(restConfig);
967
963
  if (typeof config.context !== "undefined") config.context = await this._validateContext(config.context);
968
964
  else config.configurable = await this._validateContext(config.configurable);
@@ -993,8 +989,7 @@ var Pregel = class extends PartialRunnable {
993
989
  ]);
994
990
  };
995
991
  config.interrupt ??= this.userInterrupt ?? interrupt;
996
- const callbackManager = await getCallbackManagerForConfig(config);
997
- const runManager = await callbackManager?.handleChainStart(this.toJSON(), _coerceToDict(input, "input"), runId, void 0, void 0, void 0, config?.runName ?? this.getName());
992
+ const runManager = await (await getCallbackManagerForConfig(config))?.handleChainStart(this.toJSON(), _coerceToDict(input, "input"), runId, void 0, void 0, void 0, config?.runName ?? this.getName());
998
993
  const channelSpecs = getOnlyChannels(this.channels);
999
994
  let loop;
1000
995
  let loopError;
@@ -1152,8 +1147,7 @@ var Pregel = class extends PartialRunnable {
1152
1147
  ].join(" "), { lc_error_code: "GRAPH_RECURSION_LIMIT" });
1153
1148
  } catch (e) {
1154
1149
  tickError = e;
1155
- const suppress = await loop.finishAndHandleError(tickError);
1156
- if (!suppress) throw e;
1150
+ if (!await loop.finishAndHandleError(tickError)) throw e;
1157
1151
  } finally {
1158
1152
  if (tickError === void 0) await loop.finishAndHandleError();
1159
1153
  }