@langchain/langgraph 0.4.8 → 1.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (494) hide show
  1. package/CHANGELOG.md +7 -2
  2. package/README.md +1 -2
  3. package/dist/_virtual/rolldown_runtime.cjs +25 -0
  4. package/dist/channels/any_value.d.cts +26 -0
  5. package/dist/channels/any_value.d.cts.map +1 -0
  6. package/dist/channels/any_value.d.ts +16 -9
  7. package/dist/channels/any_value.d.ts.map +1 -0
  8. package/dist/channels/base.cjs +97 -133
  9. package/dist/channels/base.cjs.map +1 -0
  10. package/dist/channels/base.d.cts +73 -0
  11. package/dist/channels/base.d.cts.map +1 -0
  12. package/dist/channels/base.d.ts +73 -74
  13. package/dist/channels/base.d.ts.map +1 -0
  14. package/dist/channels/base.js +94 -127
  15. package/dist/channels/base.js.map +1 -1
  16. package/dist/channels/binop.cjs +47 -77
  17. package/dist/channels/binop.cjs.map +1 -0
  18. package/dist/channels/binop.d.cts +22 -0
  19. package/dist/channels/binop.d.cts.map +1 -0
  20. package/dist/channels/binop.d.ts +17 -12
  21. package/dist/channels/binop.d.ts.map +1 -0
  22. package/dist/channels/binop.js +45 -71
  23. package/dist/channels/binop.js.map +1 -1
  24. package/dist/channels/dynamic_barrier_value.d.cts +43 -0
  25. package/dist/channels/dynamic_barrier_value.d.cts.map +1 -0
  26. package/dist/channels/dynamic_barrier_value.d.ts +20 -34
  27. package/dist/channels/dynamic_barrier_value.d.ts.map +1 -0
  28. package/dist/channels/ephemeral_value.cjs +46 -70
  29. package/dist/channels/ephemeral_value.cjs.map +1 -0
  30. package/dist/channels/ephemeral_value.d.cts +23 -0
  31. package/dist/channels/ephemeral_value.d.cts.map +1 -0
  32. package/dist/channels/ephemeral_value.d.ts +18 -11
  33. package/dist/channels/ephemeral_value.d.ts.map +1 -0
  34. package/dist/channels/ephemeral_value.js +45 -65
  35. package/dist/channels/ephemeral_value.js.map +1 -1
  36. package/dist/channels/index.cjs +2 -10
  37. package/dist/channels/index.js +4 -3
  38. package/dist/channels/last_value.cjs +91 -140
  39. package/dist/channels/last_value.cjs.map +1 -0
  40. package/dist/channels/last_value.d.cts +30 -0
  41. package/dist/channels/last_value.d.cts.map +1 -0
  42. package/dist/channels/last_value.d.ts +15 -23
  43. package/dist/channels/last_value.d.ts.map +1 -0
  44. package/dist/channels/last_value.js +88 -133
  45. package/dist/channels/last_value.js.map +1 -1
  46. package/dist/channels/named_barrier_value.cjs +114 -170
  47. package/dist/channels/named_barrier_value.cjs.map +1 -0
  48. package/dist/channels/named_barrier_value.d.cts +33 -0
  49. package/dist/channels/named_barrier_value.d.cts.map +1 -0
  50. package/dist/channels/named_barrier_value.d.ts +19 -29
  51. package/dist/channels/named_barrier_value.d.ts.map +1 -0
  52. package/dist/channels/named_barrier_value.js +112 -163
  53. package/dist/channels/named_barrier_value.js.map +1 -1
  54. package/dist/channels/topic.cjs +63 -96
  55. package/dist/channels/topic.cjs.map +1 -0
  56. package/dist/channels/topic.d.cts +26 -0
  57. package/dist/channels/topic.d.cts.map +1 -0
  58. package/dist/channels/topic.d.ts +21 -18
  59. package/dist/channels/topic.d.ts.map +1 -0
  60. package/dist/channels/topic.js +61 -90
  61. package/dist/channels/topic.js.map +1 -1
  62. package/dist/constants.cjs +373 -452
  63. package/dist/constants.cjs.map +1 -0
  64. package/dist/constants.d.cts +284 -0
  65. package/dist/constants.d.cts.map +1 -0
  66. package/dist/constants.d.ts +112 -148
  67. package/dist/constants.d.ts.map +1 -0
  68. package/dist/constants.js +333 -444
  69. package/dist/constants.js.map +1 -1
  70. package/dist/errors.cjs +150 -179
  71. package/dist/errors.cjs.map +1 -0
  72. package/dist/errors.d.cts +80 -0
  73. package/dist/errors.d.cts.map +1 -0
  74. package/dist/errors.d.ts +55 -46
  75. package/dist/errors.d.ts.map +1 -0
  76. package/dist/errors.js +139 -165
  77. package/dist/errors.js.map +1 -1
  78. package/dist/func/index.cjs +289 -290
  79. package/dist/func/index.cjs.map +1 -0
  80. package/dist/func/index.d.cts +289 -0
  81. package/dist/func/index.d.cts.map +1 -0
  82. package/dist/func/index.d.ts +81 -71
  83. package/dist/func/index.d.ts.map +1 -0
  84. package/dist/func/index.js +285 -284
  85. package/dist/func/index.js.map +1 -1
  86. package/dist/func/types.d.cts +64 -0
  87. package/dist/func/types.d.cts.map +1 -0
  88. package/dist/func/types.d.ts +24 -19
  89. package/dist/func/types.d.ts.map +1 -0
  90. package/dist/graph/annotation.cjs +96 -120
  91. package/dist/graph/annotation.cjs.map +1 -0
  92. package/dist/graph/annotation.d.cts +116 -0
  93. package/dist/graph/annotation.d.cts.map +1 -0
  94. package/dist/graph/annotation.d.ts +33 -34
  95. package/dist/graph/annotation.d.ts.map +1 -0
  96. package/dist/graph/annotation.js +91 -112
  97. package/dist/graph/annotation.js.map +1 -1
  98. package/dist/graph/graph.cjs +419 -723
  99. package/dist/graph/graph.cjs.map +1 -0
  100. package/dist/graph/graph.d.cts +131 -0
  101. package/dist/graph/graph.d.cts.map +1 -0
  102. package/dist/graph/graph.d.ts +122 -91
  103. package/dist/graph/graph.d.ts.map +1 -0
  104. package/dist/graph/graph.js +412 -713
  105. package/dist/graph/graph.js.map +1 -1
  106. package/dist/graph/index.cjs +4 -17
  107. package/dist/graph/index.js +6 -5
  108. package/dist/graph/message.cjs +59 -104
  109. package/dist/graph/message.cjs.map +1 -0
  110. package/dist/graph/message.d.cts +19 -0
  111. package/dist/graph/message.d.cts.map +1 -0
  112. package/dist/graph/message.d.ts +11 -10
  113. package/dist/graph/message.d.ts.map +1 -0
  114. package/dist/graph/message.js +56 -98
  115. package/dist/graph/message.js.map +1 -1
  116. package/dist/graph/messages_annotation.cjs +106 -106
  117. package/dist/graph/messages_annotation.cjs.map +1 -0
  118. package/dist/graph/messages_annotation.d.cts +111 -0
  119. package/dist/graph/messages_annotation.d.cts.map +1 -0
  120. package/dist/graph/messages_annotation.d.ts +18 -9
  121. package/dist/graph/messages_annotation.d.ts.map +1 -0
  122. package/dist/graph/messages_annotation.js +100 -100
  123. package/dist/graph/messages_annotation.js.map +1 -1
  124. package/dist/graph/state.cjs +476 -777
  125. package/dist/graph/state.cjs.map +1 -0
  126. package/dist/graph/state.d.cts +216 -0
  127. package/dist/graph/state.d.cts.map +1 -0
  128. package/dist/graph/state.d.ts +129 -134
  129. package/dist/graph/state.d.ts.map +1 -0
  130. package/dist/graph/state.js +470 -768
  131. package/dist/graph/state.js.map +1 -1
  132. package/dist/graph/zod/index.cjs +10 -21
  133. package/dist/graph/zod/index.d.cts +3 -0
  134. package/dist/graph/zod/index.d.ts +3 -3
  135. package/dist/graph/zod/index.js +4 -4
  136. package/dist/graph/zod/meta.cjs +142 -177
  137. package/dist/graph/zod/meta.cjs.map +1 -0
  138. package/dist/graph/zod/meta.d.cts +116 -0
  139. package/dist/graph/zod/meta.d.cts.map +1 -0
  140. package/dist/graph/zod/meta.d.ts +99 -97
  141. package/dist/graph/zod/meta.d.ts.map +1 -0
  142. package/dist/graph/zod/meta.js +136 -170
  143. package/dist/graph/zod/meta.js.map +1 -1
  144. package/dist/graph/zod/plugin.cjs +36 -39
  145. package/dist/graph/zod/plugin.cjs.map +1 -0
  146. package/dist/graph/zod/plugin.js +34 -35
  147. package/dist/graph/zod/plugin.js.map +1 -1
  148. package/dist/graph/zod/schema.cjs +82 -110
  149. package/dist/graph/zod/schema.cjs.map +1 -0
  150. package/dist/graph/zod/schema.d.cts +38 -0
  151. package/dist/graph/zod/schema.d.cts.map +1 -0
  152. package/dist/graph/zod/schema.d.ts +12 -6
  153. package/dist/graph/zod/schema.d.ts.map +1 -0
  154. package/dist/graph/zod/schema.js +77 -103
  155. package/dist/graph/zod/schema.js.map +1 -1
  156. package/dist/graph/zod/zod-registry.cjs +41 -47
  157. package/dist/graph/zod/zod-registry.cjs.map +1 -0
  158. package/dist/graph/zod/zod-registry.d.cts +51 -0
  159. package/dist/graph/zod/zod-registry.d.cts.map +1 -0
  160. package/dist/graph/zod/zod-registry.d.ts +34 -26
  161. package/dist/graph/zod/zod-registry.d.ts.map +1 -0
  162. package/dist/graph/zod/zod-registry.js +37 -41
  163. package/dist/graph/zod/zod-registry.js.map +1 -1
  164. package/dist/hash.cjs +205 -267
  165. package/dist/hash.cjs.map +1 -0
  166. package/dist/hash.js +205 -265
  167. package/dist/hash.js.map +1 -1
  168. package/dist/index.cjs +110 -33
  169. package/dist/index.cjs.map +1 -0
  170. package/dist/index.d.cts +25 -0
  171. package/dist/index.d.ts +25 -5
  172. package/dist/index.js +18 -7
  173. package/dist/index.js.map +1 -1
  174. package/dist/interrupt.cjs +79 -85
  175. package/dist/interrupt.cjs.map +1 -0
  176. package/dist/interrupt.d.cts +49 -0
  177. package/dist/interrupt.d.cts.map +1 -0
  178. package/dist/interrupt.d.ts +6 -1
  179. package/dist/interrupt.d.ts.map +1 -0
  180. package/dist/interrupt.js +76 -80
  181. package/dist/interrupt.js.map +1 -1
  182. package/dist/prebuilt/agentName.cjs +139 -172
  183. package/dist/prebuilt/agentName.cjs.map +1 -0
  184. package/dist/prebuilt/agentName.d.cts +42 -0
  185. package/dist/prebuilt/agentName.d.cts.map +1 -0
  186. package/dist/prebuilt/agentName.d.ts +13 -21
  187. package/dist/prebuilt/agentName.d.ts.map +1 -0
  188. package/dist/prebuilt/agentName.js +139 -168
  189. package/dist/prebuilt/agentName.js.map +1 -1
  190. package/dist/prebuilt/agent_executor.cjs +42 -80
  191. package/dist/prebuilt/agent_executor.cjs.map +1 -0
  192. package/dist/prebuilt/agent_executor.d.cts +57 -0
  193. package/dist/prebuilt/agent_executor.d.cts.map +1 -0
  194. package/dist/prebuilt/agent_executor.d.ts +46 -37
  195. package/dist/prebuilt/agent_executor.d.ts.map +1 -0
  196. package/dist/prebuilt/agent_executor.js +40 -75
  197. package/dist/prebuilt/agent_executor.js.map +1 -1
  198. package/dist/prebuilt/chat_agent_executor.cjs +66 -128
  199. package/dist/prebuilt/chat_agent_executor.cjs.map +1 -0
  200. package/dist/prebuilt/chat_agent_executor.d.cts +23 -0
  201. package/dist/prebuilt/chat_agent_executor.d.cts.map +1 -0
  202. package/dist/prebuilt/chat_agent_executor.d.ts +18 -10
  203. package/dist/prebuilt/chat_agent_executor.d.ts.map +1 -0
  204. package/dist/prebuilt/chat_agent_executor.js +63 -123
  205. package/dist/prebuilt/chat_agent_executor.js.map +1 -1
  206. package/dist/prebuilt/index.cjs +15 -18
  207. package/dist/prebuilt/index.d.cts +8 -0
  208. package/dist/prebuilt/index.d.ts +8 -8
  209. package/dist/prebuilt/index.js +8 -7
  210. package/dist/prebuilt/interrupt.d.cts +73 -0
  211. package/dist/prebuilt/interrupt.d.cts.map +1 -0
  212. package/dist/prebuilt/interrupt.d.ts +32 -15
  213. package/dist/prebuilt/interrupt.d.ts.map +1 -0
  214. package/dist/prebuilt/react_agent_executor.cjs +317 -473
  215. package/dist/prebuilt/react_agent_executor.cjs.map +1 -0
  216. package/dist/prebuilt/react_agent_executor.d.cts +229 -0
  217. package/dist/prebuilt/react_agent_executor.d.cts.map +1 -0
  218. package/dist/prebuilt/react_agent_executor.d.ts +171 -143
  219. package/dist/prebuilt/react_agent_executor.d.ts.map +1 -0
  220. package/dist/prebuilt/react_agent_executor.js +315 -465
  221. package/dist/prebuilt/react_agent_executor.js.map +1 -1
  222. package/dist/prebuilt/tool_executor.cjs +45 -67
  223. package/dist/prebuilt/tool_executor.cjs.map +1 -0
  224. package/dist/prebuilt/tool_executor.d.cts +42 -0
  225. package/dist/prebuilt/tool_executor.d.cts.map +1 -0
  226. package/dist/prebuilt/tool_executor.d.ts +30 -24
  227. package/dist/prebuilt/tool_executor.d.ts.map +1 -0
  228. package/dist/prebuilt/tool_executor.js +44 -63
  229. package/dist/prebuilt/tool_executor.js.map +1 -1
  230. package/dist/prebuilt/tool_node.cjs +213 -275
  231. package/dist/prebuilt/tool_node.cjs.map +1 -0
  232. package/dist/prebuilt/tool_node.d.cts +151 -0
  233. package/dist/prebuilt/tool_node.d.cts.map +1 -0
  234. package/dist/prebuilt/tool_node.d.ts +30 -17
  235. package/dist/prebuilt/tool_node.d.ts.map +1 -0
  236. package/dist/prebuilt/tool_node.js +209 -268
  237. package/dist/prebuilt/tool_node.js.map +1 -1
  238. package/dist/pregel/algo.cjs +521 -692
  239. package/dist/pregel/algo.cjs.map +1 -0
  240. package/dist/pregel/algo.d.cts +13 -0
  241. package/dist/pregel/algo.d.cts.map +1 -0
  242. package/dist/pregel/algo.d.ts +8 -38
  243. package/dist/pregel/algo.d.ts.map +1 -0
  244. package/dist/pregel/algo.js +516 -683
  245. package/dist/pregel/algo.js.map +1 -1
  246. package/dist/pregel/call.cjs +46 -42
  247. package/dist/pregel/call.cjs.map +1 -0
  248. package/dist/pregel/call.js +43 -37
  249. package/dist/pregel/call.js.map +1 -1
  250. package/dist/pregel/debug.cjs +153 -223
  251. package/dist/pregel/debug.cjs.map +1 -0
  252. package/dist/pregel/debug.js +152 -215
  253. package/dist/pregel/debug.js.map +1 -1
  254. package/dist/pregel/index.cjs +1134 -1604
  255. package/dist/pregel/index.cjs.map +1 -0
  256. package/dist/pregel/index.d.cts +534 -0
  257. package/dist/pregel/index.d.cts.map +1 -0
  258. package/dist/pregel/index.d.ts +458 -422
  259. package/dist/pregel/index.d.ts.map +1 -0
  260. package/dist/pregel/index.js +1125 -1592
  261. package/dist/pregel/index.js.map +1 -1
  262. package/dist/pregel/io.cjs +127 -234
  263. package/dist/pregel/io.cjs.map +1 -0
  264. package/dist/pregel/io.js +122 -225
  265. package/dist/pregel/io.js.map +1 -1
  266. package/dist/pregel/loop.cjs +539 -954
  267. package/dist/pregel/loop.cjs.map +1 -0
  268. package/dist/pregel/loop.js +536 -948
  269. package/dist/pregel/loop.js.map +1 -1
  270. package/dist/pregel/messages.cjs +104 -196
  271. package/dist/pregel/messages.cjs.map +1 -0
  272. package/dist/pregel/messages.js +102 -191
  273. package/dist/pregel/messages.js.map +1 -1
  274. package/dist/pregel/read.cjs +150 -280
  275. package/dist/pregel/read.cjs.map +1 -0
  276. package/dist/pregel/read.d.cts +51 -0
  277. package/dist/pregel/read.d.cts.map +1 -0
  278. package/dist/pregel/read.d.ts +48 -46
  279. package/dist/pregel/read.d.ts.map +1 -0
  280. package/dist/pregel/read.js +147 -274
  281. package/dist/pregel/read.js.map +1 -1
  282. package/dist/pregel/remote.cjs +339 -458
  283. package/dist/pregel/remote.cjs.map +1 -0
  284. package/dist/pregel/remote.d.cts +121 -0
  285. package/dist/pregel/remote.d.cts.map +1 -0
  286. package/dist/pregel/remote.d.ts +79 -69
  287. package/dist/pregel/remote.d.ts.map +1 -0
  288. package/dist/pregel/remote.js +337 -453
  289. package/dist/pregel/remote.js.map +1 -1
  290. package/dist/pregel/retry.cjs +87 -138
  291. package/dist/pregel/retry.cjs.map +1 -0
  292. package/dist/pregel/retry.js +83 -130
  293. package/dist/pregel/retry.js.map +1 -1
  294. package/dist/pregel/runnable_types.d.cts +25 -0
  295. package/dist/pregel/runnable_types.d.cts.map +1 -0
  296. package/dist/pregel/runnable_types.d.ts +22 -16
  297. package/dist/pregel/runnable_types.d.ts.map +1 -0
  298. package/dist/pregel/runner.cjs +222 -315
  299. package/dist/pregel/runner.cjs.map +1 -0
  300. package/dist/pregel/runner.js +219 -308
  301. package/dist/pregel/runner.js.map +1 -1
  302. package/dist/pregel/stream.cjs +89 -130
  303. package/dist/pregel/stream.cjs.map +1 -0
  304. package/dist/pregel/stream.js +87 -125
  305. package/dist/pregel/stream.js.map +1 -1
  306. package/dist/pregel/types.cjs +25 -62
  307. package/dist/pregel/types.cjs.map +1 -0
  308. package/dist/pregel/types.d.cts +437 -0
  309. package/dist/pregel/types.d.cts.map +1 -0
  310. package/dist/pregel/types.d.ts +377 -431
  311. package/dist/pregel/types.d.ts.map +1 -0
  312. package/dist/pregel/types.js +23 -57
  313. package/dist/pregel/types.js.map +1 -1
  314. package/dist/pregel/utils/config.cjs +100 -147
  315. package/dist/pregel/utils/config.cjs.map +1 -0
  316. package/dist/pregel/utils/config.d.cts +36 -0
  317. package/dist/pregel/utils/config.d.cts.map +1 -0
  318. package/dist/pregel/utils/config.d.ts +12 -9
  319. package/dist/pregel/utils/config.d.ts.map +1 -0
  320. package/dist/pregel/utils/config.js +98 -143
  321. package/dist/pregel/utils/config.js.map +1 -1
  322. package/dist/pregel/utils/index.cjs +87 -125
  323. package/dist/pregel/utils/index.cjs.map +1 -0
  324. package/dist/pregel/utils/index.d.cts +51 -0
  325. package/dist/pregel/utils/index.d.cts.map +1 -0
  326. package/dist/pregel/utils/index.d.ts +45 -61
  327. package/dist/pregel/utils/index.d.ts.map +1 -0
  328. package/dist/pregel/utils/index.js +86 -120
  329. package/dist/pregel/utils/index.js.map +1 -1
  330. package/dist/pregel/utils/subgraph.cjs +15 -26
  331. package/dist/pregel/utils/subgraph.cjs.map +1 -0
  332. package/dist/pregel/utils/subgraph.js +12 -21
  333. package/dist/pregel/utils/subgraph.js.map +1 -1
  334. package/dist/pregel/validate.cjs +42 -92
  335. package/dist/pregel/validate.cjs.map +1 -0
  336. package/dist/pregel/validate.js +39 -84
  337. package/dist/pregel/validate.js.map +1 -1
  338. package/dist/pregel/write.cjs +87 -137
  339. package/dist/pregel/write.cjs.map +1 -0
  340. package/dist/pregel/write.d.cts +35 -0
  341. package/dist/pregel/write.d.cts.map +1 -0
  342. package/dist/pregel/write.d.ts +27 -23
  343. package/dist/pregel/write.d.ts.map +1 -0
  344. package/dist/pregel/write.js +83 -131
  345. package/dist/pregel/write.js.map +1 -1
  346. package/dist/remote.cjs +3 -6
  347. package/dist/remote.d.cts +2 -0
  348. package/dist/remote.d.ts +2 -1
  349. package/dist/remote.js +3 -2
  350. package/dist/setup/async_local_storage.cjs +10 -7
  351. package/dist/setup/async_local_storage.cjs.map +1 -0
  352. package/dist/setup/async_local_storage.js +7 -2
  353. package/dist/setup/async_local_storage.js.map +1 -1
  354. package/dist/ui/index.cjs +4 -0
  355. package/dist/ui/index.d.cts +5 -0
  356. package/dist/ui/index.d.ts +5 -0
  357. package/dist/ui/index.js +3 -0
  358. package/dist/ui/stream.cjs +145 -0
  359. package/dist/ui/stream.cjs.map +1 -0
  360. package/dist/ui/stream.d.cts +25 -0
  361. package/dist/ui/stream.d.cts.map +1 -0
  362. package/dist/ui/stream.d.ts +25 -0
  363. package/dist/ui/stream.d.ts.map +1 -0
  364. package/dist/ui/stream.js +143 -0
  365. package/dist/ui/stream.js.map +1 -0
  366. package/dist/ui/types.infer.d.cts +53 -0
  367. package/dist/ui/types.infer.d.cts.map +1 -0
  368. package/dist/ui/types.infer.d.ts +53 -0
  369. package/dist/ui/types.infer.d.ts.map +1 -0
  370. package/dist/ui/types.message.d.cts +95 -0
  371. package/dist/ui/types.message.d.cts.map +1 -0
  372. package/dist/ui/types.message.d.ts +95 -0
  373. package/dist/ui/types.message.d.ts.map +1 -0
  374. package/dist/ui/types.schema.d.cts +228 -0
  375. package/dist/ui/types.schema.d.cts.map +1 -0
  376. package/dist/ui/types.schema.d.ts +228 -0
  377. package/dist/ui/types.schema.d.ts.map +1 -0
  378. package/dist/utils.cjs +77 -147
  379. package/dist/utils.cjs.map +1 -0
  380. package/dist/utils.d.cts +32 -0
  381. package/dist/utils.d.cts.map +1 -0
  382. package/dist/utils.d.ts +29 -25
  383. package/dist/utils.d.ts.map +1 -0
  384. package/dist/utils.js +73 -140
  385. package/dist/utils.js.map +1 -1
  386. package/dist/web.cjs +97 -55
  387. package/dist/web.d.cts +23 -0
  388. package/dist/web.d.ts +23 -14
  389. package/dist/web.js +15 -8
  390. package/package.json +83 -86
  391. package/dist/channels/any_value.cjs +0 -65
  392. package/dist/channels/any_value.js +0 -61
  393. package/dist/channels/any_value.js.map +0 -1
  394. package/dist/channels/dynamic_barrier_value.cjs +0 -212
  395. package/dist/channels/dynamic_barrier_value.js +0 -207
  396. package/dist/channels/dynamic_barrier_value.js.map +0 -1
  397. package/dist/channels/index.d.ts +0 -7
  398. package/dist/channels/index.js.map +0 -1
  399. package/dist/func/types.cjs +0 -15
  400. package/dist/func/types.js +0 -12
  401. package/dist/func/types.js.map +0 -1
  402. package/dist/graph/index.d.ts +0 -4
  403. package/dist/graph/index.js.map +0 -1
  404. package/dist/graph/message.test.cjs +0 -196
  405. package/dist/graph/message.test.d.ts +0 -1
  406. package/dist/graph/message.test.js +0 -194
  407. package/dist/graph/message.test.js.map +0 -1
  408. package/dist/graph/zod/index.js.map +0 -1
  409. package/dist/graph/zod/plugin.d.ts +0 -28
  410. package/dist/hash.d.ts +0 -2
  411. package/dist/prebuilt/index.js.map +0 -1
  412. package/dist/prebuilt/interrupt.cjs +0 -3
  413. package/dist/prebuilt/interrupt.js +0 -2
  414. package/dist/prebuilt/interrupt.js.map +0 -1
  415. package/dist/pregel/call.d.ts +0 -16
  416. package/dist/pregel/debug.d.ts +0 -41
  417. package/dist/pregel/debug.test.cjs +0 -258
  418. package/dist/pregel/debug.test.d.ts +0 -1
  419. package/dist/pregel/debug.test.js +0 -256
  420. package/dist/pregel/debug.test.js.map +0 -1
  421. package/dist/pregel/io.d.ts +0 -30
  422. package/dist/pregel/io.mapCommand.test.cjs +0 -150
  423. package/dist/pregel/io.mapCommand.test.d.ts +0 -1
  424. package/dist/pregel/io.mapCommand.test.js +0 -148
  425. package/dist/pregel/io.mapCommand.test.js.map +0 -1
  426. package/dist/pregel/loop.d.ts +0 -147
  427. package/dist/pregel/messages.d.ts +0 -30
  428. package/dist/pregel/messages.test.cjs +0 -369
  429. package/dist/pregel/messages.test.d.ts +0 -1
  430. package/dist/pregel/messages.test.js +0 -367
  431. package/dist/pregel/messages.test.js.map +0 -1
  432. package/dist/pregel/read.test.cjs +0 -194
  433. package/dist/pregel/read.test.d.ts +0 -1
  434. package/dist/pregel/read.test.js +0 -192
  435. package/dist/pregel/read.test.js.map +0 -1
  436. package/dist/pregel/retry.d.ts +0 -17
  437. package/dist/pregel/runnable_types.cjs +0 -3
  438. package/dist/pregel/runnable_types.js +0 -2
  439. package/dist/pregel/runnable_types.js.map +0 -1
  440. package/dist/pregel/runner.d.ts +0 -79
  441. package/dist/pregel/runner.test.cjs +0 -66
  442. package/dist/pregel/runner.test.d.ts +0 -1
  443. package/dist/pregel/runner.test.js +0 -64
  444. package/dist/pregel/runner.test.js.map +0 -1
  445. package/dist/pregel/stream.d.ts +0 -40
  446. package/dist/pregel/utils/config.test.cjs +0 -214
  447. package/dist/pregel/utils/config.test.d.ts +0 -1
  448. package/dist/pregel/utils/config.test.js +0 -212
  449. package/dist/pregel/utils/config.test.js.map +0 -1
  450. package/dist/pregel/utils/subgraph.d.ts +0 -4
  451. package/dist/pregel/utils/subgraph.test.cjs +0 -83
  452. package/dist/pregel/utils/subgraph.test.d.ts +0 -1
  453. package/dist/pregel/utils/subgraph.test.js +0 -81
  454. package/dist/pregel/utils/subgraph.test.js.map +0 -1
  455. package/dist/pregel/validate.d.ts +0 -16
  456. package/dist/pregel/validate.test.cjs +0 -220
  457. package/dist/pregel/validate.test.d.ts +0 -1
  458. package/dist/pregel/validate.test.js +0 -218
  459. package/dist/pregel/validate.test.js.map +0 -1
  460. package/dist/pregel/write.test.cjs +0 -181
  461. package/dist/pregel/write.test.d.ts +0 -1
  462. package/dist/pregel/write.test.js +0 -179
  463. package/dist/pregel/write.test.js.map +0 -1
  464. package/dist/remote.js.map +0 -1
  465. package/dist/setup/async_local_storage.d.ts +0 -1
  466. package/dist/web.js.map +0 -1
  467. package/index.cjs +0 -1
  468. package/index.d.cts +0 -1
  469. package/index.d.ts +0 -1
  470. package/index.js +0 -1
  471. package/prebuilt.cjs +0 -1
  472. package/prebuilt.d.cts +0 -1
  473. package/prebuilt.d.ts +0 -1
  474. package/prebuilt.js +0 -1
  475. package/pregel.cjs +0 -1
  476. package/pregel.d.cts +0 -1
  477. package/pregel.d.ts +0 -1
  478. package/pregel.js +0 -1
  479. package/remote.cjs +0 -1
  480. package/remote.d.cts +0 -1
  481. package/remote.d.ts +0 -1
  482. package/remote.js +0 -1
  483. package/web.cjs +0 -1
  484. package/web.d.cts +0 -1
  485. package/web.d.ts +0 -1
  486. package/web.js +0 -1
  487. package/zod/schema.cjs +0 -1
  488. package/zod/schema.d.cts +0 -1
  489. package/zod/schema.d.ts +0 -1
  490. package/zod/schema.js +0 -1
  491. package/zod.cjs +0 -1
  492. package/zod.d.cts +0 -1
  493. package/zod.d.ts +0 -1
  494. package/zod.js +0 -1
@@ -1,15 +1,18 @@
1
- import { Runnable, RunnableConfig, RunnableFunc } from "@langchain/core/runnables";
2
- import type { StreamEvent } from "@langchain/core/tracers/log_stream";
3
- import { IterableReadableStream } from "@langchain/core/utils/stream";
4
- import { All, BaseCache, BaseCheckpointSaver, BaseStore, CheckpointListOptions, CheckpointTuple } from "@langchain/langgraph-checkpoint";
5
1
  import { BaseChannel } from "../channels/base.js";
6
- import { Command, type CommandInstance } from "../constants.js";
7
- import { StrRecord } from "./algo.js";
8
- import { PregelNode } from "./read.js";
9
2
  import { LangGraphRunnableConfig } from "./runnable_types.js";
10
- import type { Durability, GetStateOptions, MultipleChannelSubscriptionOptions, PregelInputType, PregelInterface, PregelOptions, PregelOutputType, PregelParams, SingleChannelSubscriptionOptions, StateSnapshot, StreamMode, StreamOutputMap } from "./types.js";
11
3
  import { RetryPolicy } from "./utils/index.js";
4
+ import { PregelNode } from "./read.js";
5
+ import { Command, CommandInstance } from "../constants.js";
6
+ import { Durability, GetStateOptions, MultipleChannelSubscriptionOptions, PregelInputType, PregelInterface, PregelOptions, PregelOutputType, PregelParams, SingleChannelSubscriptionOptions, StateSnapshot, StreamMode, StreamOutputMap } from "./types.js";
7
+ import { StrRecord } from "./algo.js";
12
8
  import { ChannelWrite } from "./write.js";
9
+ import { All, BaseCache, BaseCheckpointSaver, BaseStore, CheckpointListOptions, CheckpointTuple } from "@langchain/langgraph-checkpoint";
10
+ import { Runnable, RunnableConfig, RunnableFunc } from "@langchain/core/runnables";
11
+ import * as _langchain_core_runnables_graph0 from "@langchain/core/runnables/graph";
12
+ import { IterableReadableStream } from "@langchain/core/utils/stream";
13
+ import { StreamEvent } from "@langchain/core/tracers/log_stream";
14
+
15
+ //#region src/pregel/index.d.ts
13
16
  type WriteValue = Runnable | RunnableFunc<unknown, unknown> | unknown;
14
17
  type StreamEventsOptions = Parameters<Runnable["streamEvents"]>[2];
15
18
  /**
@@ -19,84 +22,93 @@ type StreamEventsOptions = Parameters<Runnable["streamEvents"]>[2];
19
22
  * Channels are the communication pathways between nodes in a Pregel graph.
20
23
  * They enable message passing and state updates between different parts of the graph.
21
24
  */
22
- export declare class Channel {
23
- /**
24
- * Creates a PregelNode that subscribes to a single channel.
25
- * This is used to define how nodes receive input from channels.
26
- *
27
- * @example
28
- * ```typescript
29
- * // Subscribe to a single channel
30
- * const node = Channel.subscribeTo("messages");
31
- *
32
- * // Subscribe to multiple channels
33
- * const node = Channel.subscribeTo(["messages", "state"]);
34
- *
35
- * // Subscribe with a custom key
36
- * const node = Channel.subscribeTo("messages", { key: "chat" });
37
- * ```
38
- *
39
- * @param channel - Single channel name to subscribe to
40
- * @param options - Subscription options
41
- * @returns A PregelNode configured to receive from the specified channels
42
- * @throws {Error} If a key is specified when subscribing to multiple channels
43
- */
44
- static subscribeTo(channel: string, options?: SingleChannelSubscriptionOptions): PregelNode;
45
- /**
46
- * Creates a PregelNode that subscribes to multiple channels.
47
- * This is used to define how nodes receive input from channels.
48
- *
49
- * @example
50
- * ```typescript
51
- * // Subscribe to a single channel
52
- * const node = Channel.subscribeTo("messages");
53
- *
54
- * // Subscribe to multiple channels
55
- * const node = Channel.subscribeTo(["messages", "state"]);
56
- *
57
- * // Subscribe with a custom key
58
- * const node = Channel.subscribeTo("messages", { key: "chat" });
59
- * ```
60
- *
61
- * @param channel - Single channel name to subscribe to
62
- * @param options - Subscription options
63
- * @returns A PregelNode configured to receive from the specified channels
64
- * @throws {Error} If a key is specified when subscribing to multiple channels
65
- */
66
- static subscribeTo(channels: string[], options?: MultipleChannelSubscriptionOptions): PregelNode;
67
- /**
68
- * Creates a ChannelWrite that specifies how to write values to channels.
69
- * This is used to define how nodes send output to channels.
70
- *
71
- * @example
72
- * ```typescript
73
- * // Write to multiple channels
74
- * const write = Channel.writeTo(["output", "state"]);
75
- *
76
- * // Write with specific values
77
- * const write = Channel.writeTo(["output"], {
78
- * state: "completed",
79
- * result: calculateResult()
80
- * });
81
- *
82
- * // Write with a transformation function
83
- * const write = Channel.writeTo(["output"], {
84
- * result: (x) => processResult(x)
85
- * });
86
- * ```
87
- *
88
- * @param channels - Array of channel names to write to
89
- * @param writes - Optional map of channel names to values or transformations
90
- * @returns A ChannelWrite object that can be used to write to the specified channels
91
- */
92
- static writeTo(channels: string[], writes?: Record<string, WriteValue>): ChannelWrite;
25
+ declare class Channel {
26
+ /**
27
+ * Creates a PregelNode that subscribes to a single channel.
28
+ * This is used to define how nodes receive input from channels.
29
+ *
30
+ * @example
31
+ * ```typescript
32
+ * // Subscribe to a single channel
33
+ * const node = Channel.subscribeTo("messages");
34
+ *
35
+ * // Subscribe to multiple channels
36
+ * const node = Channel.subscribeTo(["messages", "state"]);
37
+ *
38
+ * // Subscribe with a custom key
39
+ * const node = Channel.subscribeTo("messages", { key: "chat" });
40
+ * ```
41
+ *
42
+ * @param channel - Single channel name to subscribe to
43
+ * @param options - Subscription options
44
+ * @returns A PregelNode configured to receive from the specified channels
45
+ * @throws {Error} If a key is specified when subscribing to multiple channels
46
+ */
47
+ static subscribeTo(channel: string, options?: SingleChannelSubscriptionOptions): PregelNode;
48
+ /**
49
+ * Creates a PregelNode that subscribes to multiple channels.
50
+ * This is used to define how nodes receive input from channels.
51
+ *
52
+ * @example
53
+ * ```typescript
54
+ * // Subscribe to a single channel
55
+ * const node = Channel.subscribeTo("messages");
56
+ *
57
+ * // Subscribe to multiple channels
58
+ * const node = Channel.subscribeTo(["messages", "state"]);
59
+ *
60
+ * // Subscribe with a custom key
61
+ * const node = Channel.subscribeTo("messages", { key: "chat" });
62
+ * ```
63
+ *
64
+ * @param channel - Single channel name to subscribe to
65
+ * @param options - Subscription options
66
+ * @returns A PregelNode configured to receive from the specified channels
67
+ * @throws {Error} If a key is specified when subscribing to multiple channels
68
+ */
69
+ static subscribeTo(channels: string[], options?: MultipleChannelSubscriptionOptions): PregelNode;
70
+ /**
71
+ * Creates a ChannelWrite that specifies how to write values to channels.
72
+ * This is used to define how nodes send output to channels.
73
+ *
74
+ * @example
75
+ * ```typescript
76
+ * // Write to multiple channels
77
+ * const write = Channel.writeTo(["output", "state"]);
78
+ *
79
+ * // Write with specific values
80
+ * const write = Channel.writeTo(["output"], {
81
+ * state: "completed",
82
+ * result: calculateResult()
83
+ * });
84
+ *
85
+ * // Write with a transformation function
86
+ * const write = Channel.writeTo(["output"], {
87
+ * result: (x) => processResult(x)
88
+ * });
89
+ * ```
90
+ *
91
+ * @param channels - Array of channel names to write to
92
+ * @param writes - Optional map of channel names to values or transformations
93
+ * @returns A ChannelWrite object that can be used to write to the specified channels
94
+ */
95
+ static writeTo(channels: string[], writes?: Record<string, WriteValue>): ChannelWrite;
93
96
  }
94
- export type { PregelInputType, PregelOptions, PregelOutputType };
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`.
95
101
  declare class PartialRunnable<RunInput, RunOutput, CallOptions extends RunnableConfig> extends Runnable<RunInput, RunOutput, CallOptions> {
96
- lc_namespace: string[];
97
- invoke(_input: RunInput, _options?: Partial<CallOptions>): Promise<any>;
98
- withConfig(_config: CallOptions): typeof this;
99
- stream(input: RunInput, options?: Partial<CallOptions>): Promise<IterableReadableStream<any>>;
102
+ 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`
107
+ 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>>;
100
112
  }
101
113
  /**
102
114
  * The Pregel class is the core runtime engine of LangGraph, implementing a message-passing graph computation model
@@ -157,342 +169,366 @@ declare class PartialRunnable<RunInput, RunOutput, CallOptions extends RunnableC
157
169
  * @typeParam InputType - Type of input values accepted by the graph
158
170
  * @typeParam OutputType - Type of output values produced by the graph
159
171
  */
160
- export 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> extends PartialRunnable<InputType | CommandInstance | null, OutputType, PregelOptions<Nodes, Channels, ContextType>> implements PregelInterface<Nodes, Channels, ContextType>, PregelParams<Nodes, Channels> {
161
- /**
162
- * Name of the class when serialized
163
- * @internal
164
- */
165
- static lc_name(): string;
166
- /** @internal Used for type inference */
167
- "~InputType": InputType;
168
- /** @internal Used for type inference */
169
- "~OutputType": OutputType;
170
- /** @internal LangChain namespace for serialization necessary because Pregel extends Runnable */
171
- lc_namespace: string[];
172
- /** @internal Flag indicating this is a Pregel instance - necessary for serialization */
173
- lg_is_pregel: boolean;
174
- /** The nodes in the graph, mapping node names to their PregelNode instances */
175
- nodes: Nodes;
176
- /** The channels in the graph, mapping channel names to their BaseChannel or ManagedValueSpec instances */
177
- channels: Channels;
178
- /**
179
- * The input channels for the graph. These channels receive the initial input when the graph is invoked.
180
- * Can be a single channel key or an array of channel keys.
181
- */
182
- inputChannels: keyof Channels | Array<keyof Channels>;
183
- /**
184
- * The output channels for the graph. These channels contain the final output when the graph completes.
185
- * Can be a single channel key or an array of channel keys.
186
- */
187
- outputChannels: keyof Channels | Array<keyof Channels>;
188
- /** Whether to automatically validate the graph structure when it is compiled. Defaults to true. */
189
- autoValidate: boolean;
190
- /**
191
- * The streaming modes enabled for this graph. Defaults to ["values"].
192
- * Supported modes:
193
- * - "values": Streams the full state after each step
194
- * - "updates": Streams state updates after each step
195
- * - "messages": Streams messages from within nodes
196
- * - "custom": Streams custom events from within nodes
197
- * - "debug": Streams events related to the execution of the graph - useful for tracing & debugging graph execution
198
- */
199
- streamMode: StreamMode[];
200
- /**
201
- * Optional channels to stream. If not specified, all channels will be streamed.
202
- * Can be a single channel key or an array of channel keys.
203
- */
204
- streamChannels?: keyof Channels | Array<keyof Channels>;
205
- /**
206
- * Optional array of node names or "all" to interrupt after executing these nodes.
207
- * Used for implementing human-in-the-loop workflows.
208
- */
209
- interruptAfter?: Array<keyof Nodes> | All;
210
- /**
211
- * Optional array of node names or "all" to interrupt before executing these nodes.
212
- * Used for implementing human-in-the-loop workflows.
213
- */
214
- interruptBefore?: Array<keyof Nodes> | All;
215
- /** Optional timeout in milliseconds for the execution of each superstep */
216
- stepTimeout?: number;
217
- /** Whether to enable debug logging. Defaults to false. */
218
- debug: boolean;
219
- /**
220
- * Optional checkpointer for persisting graph state.
221
- * When provided, saves a checkpoint of the graph state at every superstep.
222
- * When false or undefined, checkpointing is disabled, and the graph will not be able to save or restore state.
223
- */
224
- checkpointer?: BaseCheckpointSaver | boolean;
225
- /** Optional retry policy for handling failures in node execution */
226
- retryPolicy?: RetryPolicy;
227
- /** The default configuration for graph execution, can be overridden on a per-invocation basis */
228
- config?: LangGraphRunnableConfig;
229
- /**
230
- * Optional long-term memory store for the graph, allows for persistence & retrieval of data across threads
231
- */
232
- store?: BaseStore;
233
- triggerToNodes: Record<string, string[]>;
234
- /**
235
- * Optional cache for the graph, useful for caching tasks.
236
- */
237
- cache?: BaseCache;
238
- /**
239
- * Constructor for Pregel - meant for internal use only.
240
- *
241
- * @internal
242
- */
243
- constructor(fields: PregelParams<Nodes, Channels>);
244
- /**
245
- * Creates a new instance of the Pregel graph with updated configuration.
246
- * This method follows the immutable pattern - instead of modifying the current instance,
247
- * it returns a new instance with the merged configuration.
248
- *
249
- * @example
250
- * ```typescript
251
- * // Create a new instance with debug enabled
252
- * const debugGraph = graph.withConfig({ debug: true });
253
- *
254
- * // Create a new instance with a specific thread ID
255
- * const threadGraph = graph.withConfig({
256
- * configurable: { thread_id: "123" }
257
- * });
258
- * ```
259
- *
260
- * @param config - The configuration to merge with the current configuration
261
- * @returns A new Pregel instance with the merged configuration
262
- */
263
- withConfig(config: Omit<LangGraphRunnableConfig, "store" | "writer">): typeof this;
264
- /**
265
- * Validates the graph structure to ensure it is well-formed.
266
- * Checks for:
267
- * - No orphaned nodes
268
- * - Valid input/output channel configurations
269
- * - Valid interrupt configurations
270
- *
271
- * @returns this - The Pregel instance for method chaining
272
- * @throws {GraphValidationError} If the graph structure is invalid
273
- */
274
- validate(): this;
275
- /**
276
- * Gets a list of all channels that should be streamed.
277
- * If streamChannels is specified, returns those channels.
278
- * Otherwise, returns all channels in the graph.
279
- *
280
- * @returns Array of channel keys to stream
281
- */
282
- get streamChannelsList(): Array<keyof Channels>;
283
- /**
284
- * Gets the channels to stream in their original format.
285
- * If streamChannels is specified, returns it as-is (either single key or array).
286
- * Otherwise, returns all channels in the graph as an array.
287
- *
288
- * @returns Channel keys to stream, either as a single key or array
289
- */
290
- get streamChannelsAsIs(): keyof Channels | Array<keyof Channels>;
291
- /**
292
- * Gets a drawable representation of the graph structure.
293
- * This is an async version of getGraph() and is the preferred method to use.
294
- *
295
- * @param config - Configuration for generating the graph visualization
296
- * @returns A representation of the graph that can be visualized
297
- */
298
- getGraphAsync(config: RunnableConfig): Promise<import("@langchain/core/runnables/graph").Graph>;
299
- /**
300
- * Gets all subgraphs within this graph.
301
- * A subgraph is a Pregel instance that is nested within a node of this graph.
302
- *
303
- * @deprecated Use getSubgraphsAsync instead. The async method will become the default in the next minor release.
304
- * @param namespace - Optional namespace to filter subgraphs
305
- * @param recurse - Whether to recursively get subgraphs of subgraphs
306
- * @returns Generator yielding tuples of [name, subgraph]
307
- */
308
- getSubgraphs(namespace?: string, recurse?: boolean): Generator<[string, Pregel<any, any>]>;
309
- /**
310
- * Gets all subgraphs within this graph asynchronously.
311
- * A subgraph is a Pregel instance that is nested within a node of this graph.
312
- *
313
- * @param namespace - Optional namespace to filter subgraphs
314
- * @param recurse - Whether to recursively get subgraphs of subgraphs
315
- * @returns AsyncGenerator yielding tuples of [name, subgraph]
316
- */
317
- getSubgraphsAsync(namespace?: string, recurse?: boolean): AsyncGenerator<[string, Pregel<any, any>]>;
318
- /**
319
- * Prepares a state snapshot from saved checkpoint data.
320
- * This is an internal method used by getState and getStateHistory.
321
- *
322
- * @param config - Configuration for preparing the snapshot
323
- * @param saved - Optional saved checkpoint data
324
- * @param subgraphCheckpointer - Optional checkpointer for subgraphs
325
- * @param applyPendingWrites - Whether to apply pending writes to tasks and then to channels
326
- * @returns A snapshot of the graph state
327
- * @internal
328
- */
329
- protected _prepareStateSnapshot({ config, saved, subgraphCheckpointer, applyPendingWrites, }: {
330
- config: RunnableConfig;
331
- saved?: CheckpointTuple;
332
- subgraphCheckpointer?: BaseCheckpointSaver;
333
- applyPendingWrites?: boolean;
334
- }): Promise<StateSnapshot>;
335
- /**
336
- * Gets the current state of the graph.
337
- * Requires a checkpointer to be configured.
338
- *
339
- * @param config - Configuration for retrieving the state
340
- * @param options - Additional options
341
- * @returns A snapshot of the current graph state
342
- * @throws {GraphValueError} If no checkpointer is configured
343
- */
344
- getState(config: RunnableConfig, options?: GetStateOptions): Promise<StateSnapshot>;
345
- /**
346
- * Gets the history of graph states.
347
- * Requires a checkpointer to be configured.
348
- * Useful for:
349
- * - Debugging execution history
350
- * - Implementing time travel
351
- * - Analyzing graph behavior
352
- *
353
- * @param config - Configuration for retrieving the history
354
- * @param options - Options for filtering the history
355
- * @returns An async iterator of state snapshots
356
- * @throws {Error} If no checkpointer is configured
357
- */
358
- getStateHistory(config: RunnableConfig, options?: CheckpointListOptions): AsyncIterableIterator<StateSnapshot>;
359
- /**
360
- * Apply updates to the graph state in bulk.
361
- * Requires a checkpointer to be configured.
362
- *
363
- * This method is useful for recreating a thread
364
- * from a list of updates, especially if a checkpoint
365
- * is created as a result of multiple tasks.
366
- *
367
- * @internal The API might change in the future.
368
- *
369
- * @param startConfig - Configuration for the update
370
- * @param updates - The list of updates to apply to graph state
371
- * @returns Updated configuration
372
- * @throws {GraphValueError} If no checkpointer is configured
373
- * @throws {InvalidUpdateError} If the update cannot be attributed to a node or an update can be only applied in sequence.
374
- */
375
- bulkUpdateState(startConfig: LangGraphRunnableConfig, supersteps: Array<{
376
- updates: Array<{
377
- values?: Record<string, unknown> | unknown;
378
- asNode?: keyof Nodes | string;
379
- }>;
380
- }>): Promise<RunnableConfig>;
381
- /**
382
- * Updates the state of the graph with new values.
383
- * Requires a checkpointer to be configured.
384
- *
385
- * This method can be used for:
386
- * - Implementing human-in-the-loop workflows
387
- * - Modifying graph state during breakpoints
388
- * - Integrating external inputs into the graph
389
- *
390
- * @param inputConfig - Configuration for the update
391
- * @param values - The values to update the state with
392
- * @param asNode - Optional node name to attribute the update to
393
- * @returns Updated configuration
394
- * @throws {GraphValueError} If no checkpointer is configured
395
- * @throws {InvalidUpdateError} If the update cannot be attributed to a node
396
- */
397
- updateState(inputConfig: LangGraphRunnableConfig, values: Record<string, unknown> | unknown, asNode?: keyof Nodes | string): Promise<RunnableConfig>;
398
- /**
399
- * Gets the default values for various graph configuration options.
400
- * This is an internal method used to process and normalize configuration options.
401
- *
402
- * @param config - The input configuration options
403
- * @returns A tuple containing normalized values for:
404
- * - debug mode
405
- * - stream modes
406
- * - input keys
407
- * - output keys
408
- * - remaining config
409
- * - interrupt before nodes
410
- * - interrupt after nodes
411
- * - checkpointer
412
- * - store
413
- * - whether stream mode is single
414
- * - node cache
415
- * - whether checkpoint during is enabled
416
- * @internal
417
- */
418
- _defaults(config: PregelOptions<Nodes, Channels>): [
419
- boolean,
420
- StreamMode[],
421
- // stream mode
422
- string | string[],
423
- // input keys
424
- string | string[],
425
- LangGraphRunnableConfig,
426
- // config without pregel keys
427
- All | string[],
428
- // interrupt before
429
- All | string[],
430
- // interrupt after
431
- BaseCheckpointSaver | undefined,
432
- // checkpointer
433
- BaseStore | undefined,
434
- boolean,
435
- // stream mode single
436
- BaseCache | undefined,
437
- Durability
438
- ];
439
- /**
440
- * Streams the execution of the graph, emitting state updates as they occur.
441
- * This is the primary method for observing graph execution in real-time.
442
- *
443
- * Stream modes:
444
- * - "values": Emits complete state after each step
445
- * - "updates": Emits only state changes after each step
446
- * - "debug": Emits detailed debug information
447
- * - "messages": Emits messages from within nodes
448
- *
449
- * For more details, see the [Streaming how-to guides](../../how-tos/#streaming_1).
450
- *
451
- * @param input - The input to start graph execution with
452
- * @param options - Configuration options for streaming
453
- * @returns An async iterable stream of graph state updates
454
- */
455
- stream<TStreamMode extends StreamMode | StreamMode[] | undefined, TSubgraphs extends boolean>(input: InputType | CommandInstance | null, options?: Partial<PregelOptions<Nodes, Channels, ContextType, TStreamMode, TSubgraphs>>): Promise<IterableReadableStream<StreamOutputMap<TStreamMode, TSubgraphs, StreamUpdatesType, StreamValuesType, keyof Nodes, NodeReturnType>>>;
456
- /**
457
- * @inheritdoc
458
- */
459
- streamEvents(input: InputType | CommandInstance | null, options: Partial<PregelOptions<Nodes, Channels, ContextType>> & {
460
- version: "v1" | "v2";
461
- }, streamOptions?: StreamEventsOptions): IterableReadableStream<StreamEvent>;
462
- streamEvents(input: InputType | CommandInstance | null, options: Partial<PregelOptions<Nodes, Channels, ContextType>> & {
463
- version: "v1" | "v2";
464
- encoding: "text/event-stream";
465
- }, streamOptions?: StreamEventsOptions): IterableReadableStream<Uint8Array>;
466
- /**
467
- * Validates the input for the graph.
468
- * @param input - The input to validate
469
- * @returns The validated input
470
- * @internal
471
- */
472
- protected _validateInput(input: PregelInputType): Promise<any>;
473
- /**
474
- * Validates the context options for the graph.
475
- * @param context - The context options to validate
476
- * @returns The validated context options
477
- * @internal
478
- */
479
- protected _validateContext(context: Partial<LangGraphRunnableConfig["context"]>): Promise<LangGraphRunnableConfig["context"]>;
480
- /**
481
- * Internal iterator used by stream() to generate state updates.
482
- * This method handles the core logic of graph execution and streaming.
483
- *
484
- * @param input - The input to start graph execution with
485
- * @param options - Configuration options for streaming
486
- * @returns AsyncGenerator yielding state updates
487
- * @internal
488
- */
489
- _streamIterator(input: PregelInputType | Command, options?: Partial<PregelOptions<Nodes, Channels>>): AsyncGenerator<PregelOutputType>;
490
- /**
491
- * Run the graph with a single input and config.
492
- * @param input The input to the graph.
493
- * @param options The configuration to use for the run.
494
- */
495
- invoke(input: InputType | CommandInstance | null, options?: Partial<PregelOptions<Nodes, Channels, ContextType>>): Promise<OutputType>;
496
- private _runLoop;
497
- clearCache(): Promise<void>;
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> extends PartialRunnable<InputType | CommandInstance | null, OutputType, PregelOptions<Nodes, Channels, ContextType>> implements PregelInterface<Nodes, Channels, ContextType>, PregelParams<Nodes, Channels> {
175
+ /**
176
+ * Name of the class when serialized
177
+ * @internal
178
+ */
179
+ static lc_name(): string;
180
+ /** @internal Used for type inference */
181
+ "~InputType": InputType;
182
+ /** @internal Used for type inference */
183
+ "~OutputType": OutputType;
184
+ /** @internal LangChain namespace for serialization necessary because Pregel extends Runnable */
185
+ lc_namespace: string[];
186
+ /** @internal Flag indicating this is a Pregel instance - necessary for serialization */
187
+ lg_is_pregel: boolean;
188
+ /** The nodes in the graph, mapping node names to their PregelNode instances */
189
+ nodes: Nodes;
190
+ /** The channels in the graph, mapping channel names to their BaseChannel or ManagedValueSpec instances */
191
+ channels: Channels;
192
+ /**
193
+ * The input channels for the graph. These channels receive the initial input when the graph is invoked.
194
+ * Can be a single channel key or an array of channel keys.
195
+ */
196
+ inputChannels: keyof Channels | Array<keyof Channels>;
197
+ /**
198
+ * The output channels for the graph. These channels contain the final output when the graph completes.
199
+ * Can be a single channel key or an array of channel keys.
200
+ */
201
+ outputChannels: keyof Channels | Array<keyof Channels>;
202
+ /** Whether to automatically validate the graph structure when it is compiled. Defaults to true. */
203
+ autoValidate: boolean;
204
+ /**
205
+ * The streaming modes enabled for this graph. Defaults to ["values"].
206
+ * Supported modes:
207
+ * - "values": Streams the full state after each step
208
+ * - "updates": Streams state updates after each step
209
+ * - "messages": Streams messages from within nodes
210
+ * - "custom": Streams custom events from within nodes
211
+ * - "debug": Streams events related to the execution of the graph - useful for tracing & debugging graph execution
212
+ */
213
+ streamMode: StreamMode[];
214
+ /**
215
+ * Optional channels to stream. If not specified, all channels will be streamed.
216
+ * Can be a single channel key or an array of channel keys.
217
+ */
218
+ streamChannels?: keyof Channels | Array<keyof Channels>;
219
+ /**
220
+ * Optional array of node names or "all" to interrupt after executing these nodes.
221
+ * Used for implementing human-in-the-loop workflows.
222
+ */
223
+ interruptAfter?: Array<keyof Nodes> | All;
224
+ /**
225
+ * Optional array of node names or "all" to interrupt before executing these nodes.
226
+ * Used for implementing human-in-the-loop workflows.
227
+ */
228
+ interruptBefore?: Array<keyof Nodes> | All;
229
+ /** Optional timeout in milliseconds for the execution of each superstep */
230
+ stepTimeout?: number;
231
+ /** Whether to enable debug logging. Defaults to false. */
232
+ debug: boolean;
233
+ /**
234
+ * Optional checkpointer for persisting graph state.
235
+ * When provided, saves a checkpoint of the graph state at every superstep.
236
+ * When false or undefined, checkpointing is disabled, and the graph will not be able to save or restore state.
237
+ */
238
+ checkpointer?: BaseCheckpointSaver | boolean;
239
+ /** Optional retry policy for handling failures in node execution */
240
+ retryPolicy?: RetryPolicy;
241
+ /** The default configuration for graph execution, can be overridden on a per-invocation basis */
242
+ config?: LangGraphRunnableConfig;
243
+ /**
244
+ * Optional long-term memory store for the graph, allows for persistence & retrieval of data across threads
245
+ */
246
+ store?: BaseStore;
247
+ triggerToNodes: Record<string, string[]>;
248
+ /**
249
+ * Optional cache for the graph, useful for caching tasks.
250
+ */
251
+ cache?: BaseCache;
252
+ /**
253
+ * Constructor for Pregel - meant for internal use only.
254
+ *
255
+ * @internal
256
+ */
257
+ constructor(fields: PregelParams<Nodes, Channels>);
258
+ /**
259
+ * Creates a new instance of the Pregel graph with updated configuration.
260
+ * This method follows the immutable pattern - instead of modifying the current instance,
261
+ * it returns a new instance with the merged configuration.
262
+ *
263
+ * @example
264
+ * ```typescript
265
+ * // Create a new instance with debug enabled
266
+ * const debugGraph = graph.withConfig({ debug: true });
267
+ *
268
+ * // Create a new instance with a specific thread ID
269
+ * const threadGraph = graph.withConfig({
270
+ * configurable: { thread_id: "123" }
271
+ * });
272
+ * ```
273
+ *
274
+ * @param config - The configuration to merge with the current configuration
275
+ * @returns A new Pregel instance with the merged configuration
276
+ */
277
+ withConfig(config: Omit<LangGraphRunnableConfig, "store" | "writer">): typeof this;
278
+ /**
279
+ * Validates the graph structure to ensure it is well-formed.
280
+ * Checks for:
281
+ * - No orphaned nodes
282
+ * - Valid input/output channel configurations
283
+ * - Valid interrupt configurations
284
+ *
285
+ * @returns this - The Pregel instance for method chaining
286
+ * @throws {GraphValidationError} If the graph structure is invalid
287
+ */
288
+ validate(): this;
289
+ /**
290
+ * Gets a list of all channels that should be streamed.
291
+ * If streamChannels is specified, returns those channels.
292
+ * Otherwise, returns all channels in the graph.
293
+ *
294
+ * @returns Array of channel keys to stream
295
+ */
296
+ get streamChannelsList(): Array<keyof Channels>;
297
+ /**
298
+ * Gets the channels to stream in their original format.
299
+ * If streamChannels is specified, returns it as-is (either single key or array).
300
+ * Otherwise, returns all channels in the graph as an array.
301
+ *
302
+ * @returns Channel keys to stream, either as a single key or array
303
+ */
304
+ get streamChannelsAsIs(): keyof Channels | Array<keyof Channels>;
305
+ /**
306
+ * Gets a drawable representation of the graph structure.
307
+ * This is an async version of getGraph() and is the preferred method to use.
308
+ *
309
+ * @param config - Configuration for generating the graph visualization
310
+ * @returns A representation of the graph that can be visualized
311
+ */
312
+ getGraphAsync(config: RunnableConfig): Promise<_langchain_core_runnables_graph0.Graph>;
313
+ /**
314
+ * Gets all subgraphs within this graph.
315
+ * A subgraph is a Pregel instance that is nested within a node of this graph.
316
+ *
317
+ * @deprecated Use getSubgraphsAsync instead. The async method will become the default in the next minor release.
318
+ * @param namespace - Optional namespace to filter subgraphs
319
+ * @param recurse - Whether to recursively get subgraphs of subgraphs
320
+ * @returns Generator yielding tuples of [name, subgraph]
321
+ */
322
+ getSubgraphs(namespace?: string, recurse?: boolean
323
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
324
+ ): Generator<[string, Pregel<any, any>]>;
325
+ /**
326
+ * Gets all subgraphs within this graph asynchronously.
327
+ * A subgraph is a Pregel instance that is nested within a node of this graph.
328
+ *
329
+ * @param namespace - Optional namespace to filter subgraphs
330
+ * @param recurse - Whether to recursively get subgraphs of subgraphs
331
+ * @returns AsyncGenerator yielding tuples of [name, subgraph]
332
+ */
333
+ getSubgraphsAsync(namespace?: string, recurse?: boolean
334
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
335
+ ): AsyncGenerator<[string, Pregel<any, any>]>;
336
+ /**
337
+ * Prepares a state snapshot from saved checkpoint data.
338
+ * This is an internal method used by getState and getStateHistory.
339
+ *
340
+ * @param config - Configuration for preparing the snapshot
341
+ * @param saved - Optional saved checkpoint data
342
+ * @param subgraphCheckpointer - Optional checkpointer for subgraphs
343
+ * @param applyPendingWrites - Whether to apply pending writes to tasks and then to channels
344
+ * @returns A snapshot of the graph state
345
+ * @internal
346
+ */
347
+ protected _prepareStateSnapshot({
348
+ config,
349
+ saved,
350
+ subgraphCheckpointer,
351
+ applyPendingWrites
352
+ }: {
353
+ config: RunnableConfig;
354
+ saved?: CheckpointTuple;
355
+ subgraphCheckpointer?: BaseCheckpointSaver;
356
+ applyPendingWrites?: boolean;
357
+ }): Promise<StateSnapshot>;
358
+ /**
359
+ * Gets the current state of the graph.
360
+ * Requires a checkpointer to be configured.
361
+ *
362
+ * @param config - Configuration for retrieving the state
363
+ * @param options - Additional options
364
+ * @returns A snapshot of the current graph state
365
+ * @throws {GraphValueError} If no checkpointer is configured
366
+ */
367
+ getState(config: RunnableConfig, options?: GetStateOptions): Promise<StateSnapshot>;
368
+ /**
369
+ * Gets the history of graph states.
370
+ * Requires a checkpointer to be configured.
371
+ * Useful for:
372
+ * - Debugging execution history
373
+ * - Implementing time travel
374
+ * - Analyzing graph behavior
375
+ *
376
+ * @param config - Configuration for retrieving the history
377
+ * @param options - Options for filtering the history
378
+ * @returns An async iterator of state snapshots
379
+ * @throws {Error} If no checkpointer is configured
380
+ */
381
+ getStateHistory(config: RunnableConfig, options?: CheckpointListOptions): AsyncIterableIterator<StateSnapshot>;
382
+ /**
383
+ * Apply updates to the graph state in bulk.
384
+ * Requires a checkpointer to be configured.
385
+ *
386
+ * This method is useful for recreating a thread
387
+ * from a list of updates, especially if a checkpoint
388
+ * is created as a result of multiple tasks.
389
+ *
390
+ * @internal The API might change in the future.
391
+ *
392
+ * @param startConfig - Configuration for the update
393
+ * @param updates - The list of updates to apply to graph state
394
+ * @returns Updated configuration
395
+ * @throws {GraphValueError} If no checkpointer is configured
396
+ * @throws {InvalidUpdateError} If the update cannot be attributed to a node or an update can be only applied in sequence.
397
+ */
398
+ bulkUpdateState(startConfig: LangGraphRunnableConfig, supersteps: Array<{
399
+ updates: Array<{
400
+ values?: Record<string, unknown> | unknown;
401
+ asNode?: keyof Nodes | string;
402
+ }>;
403
+ }>): Promise<RunnableConfig>;
404
+ /**
405
+ * Updates the state of the graph with new values.
406
+ * Requires a checkpointer to be configured.
407
+ *
408
+ * This method can be used for:
409
+ * - Implementing human-in-the-loop workflows
410
+ * - Modifying graph state during breakpoints
411
+ * - Integrating external inputs into the graph
412
+ *
413
+ * @param inputConfig - Configuration for the update
414
+ * @param values - The values to update the state with
415
+ * @param asNode - Optional node name to attribute the update to
416
+ * @returns Updated configuration
417
+ * @throws {GraphValueError} If no checkpointer is configured
418
+ * @throws {InvalidUpdateError} If the update cannot be attributed to a node
419
+ */
420
+ updateState(inputConfig: LangGraphRunnableConfig, values: Record<string, unknown> | unknown, asNode?: keyof Nodes | string): Promise<RunnableConfig>;
421
+ /**
422
+ * Gets the default values for various graph configuration options.
423
+ * This is an internal method used to process and normalize configuration options.
424
+ *
425
+ * @param config - The input configuration options
426
+ * @returns A tuple containing normalized values for:
427
+ * - debug mode
428
+ * - stream modes
429
+ * - input keys
430
+ * - output keys
431
+ * - remaining config
432
+ * - interrupt before nodes
433
+ * - interrupt after nodes
434
+ * - checkpointer
435
+ * - store
436
+ * - whether stream mode is single
437
+ * - node cache
438
+ * - whether checkpoint during is enabled
439
+ * @internal
440
+ */
441
+ _defaults(config: PregelOptions<Nodes, Channels>): [boolean,
442
+ // debug
443
+ StreamMode[],
444
+ // stream mode
445
+ // stream mode
446
+ string | string[],
447
+ // input keys
448
+ // input keys
449
+ string | string[],
450
+ // output keys
451
+ LangGraphRunnableConfig,
452
+ // config without pregel keys
453
+ // config without pregel keys
454
+ All | string[],
455
+ // interrupt before
456
+ // interrupt before
457
+ All | string[],
458
+ // interrupt after
459
+ // interrupt after
460
+ BaseCheckpointSaver | undefined,
461
+ // checkpointer
462
+ // checkpointer
463
+ BaseStore | undefined,
464
+ // store
465
+ boolean,
466
+ // stream mode single
467
+ // stream mode single
468
+ BaseCache | undefined,
469
+ // node cache
470
+ Durability // durability
471
+ ];
472
+ /**
473
+ * Streams the execution of the graph, emitting state updates as they occur.
474
+ * This is the primary method for observing graph execution in real-time.
475
+ *
476
+ * Stream modes:
477
+ * - "values": Emits complete state after each step
478
+ * - "updates": Emits only state changes after each step
479
+ * - "debug": Emits detailed debug information
480
+ * - "messages": Emits messages from within nodes
481
+ *
482
+ * For more details, see the [Streaming how-to guides](../../how-tos/#streaming_1).
483
+ *
484
+ * @param input - The input to start graph execution with
485
+ * @param options - Configuration options for streaming
486
+ * @returns An async iterable stream of graph state updates
487
+ */
488
+ stream<TStreamMode extends StreamMode | StreamMode[] | undefined, TSubgraphs extends boolean>(input: InputType | CommandInstance | null, options?: Partial<PregelOptions<Nodes, Channels, ContextType, TStreamMode, TSubgraphs>>): Promise<IterableReadableStream<StreamOutputMap<TStreamMode, TSubgraphs, StreamUpdatesType, StreamValuesType, keyof Nodes, NodeReturnType>>>;
489
+ /**
490
+ * @inheritdoc
491
+ */
492
+ streamEvents(input: InputType | CommandInstance | null, options: Partial<PregelOptions<Nodes, Channels, ContextType>> & {
493
+ version: "v1" | "v2";
494
+ }, streamOptions?: StreamEventsOptions): IterableReadableStream<StreamEvent>;
495
+ streamEvents(input: InputType | CommandInstance | null, options: Partial<PregelOptions<Nodes, Channels, ContextType>> & {
496
+ version: "v1" | "v2";
497
+ encoding: "text/event-stream";
498
+ }, streamOptions?: StreamEventsOptions): IterableReadableStream<Uint8Array>;
499
+ /**
500
+ * Validates the input for the graph.
501
+ * @param input - The input to validate
502
+ * @returns The validated input
503
+ * @internal
504
+ */
505
+ protected _validateInput(input: PregelInputType): Promise<any>;
506
+ /**
507
+ * Validates the context options for the graph.
508
+ * @param context - The context options to validate
509
+ * @returns The validated context options
510
+ * @internal
511
+ */
512
+ protected _validateContext(context: Partial<LangGraphRunnableConfig["context"]>): Promise<LangGraphRunnableConfig["context"]>;
513
+ /**
514
+ * Internal iterator used by stream() to generate state updates.
515
+ * This method handles the core logic of graph execution and streaming.
516
+ *
517
+ * @param input - The input to start graph execution with
518
+ * @param options - Configuration options for streaming
519
+ * @returns AsyncGenerator yielding state updates
520
+ * @internal
521
+ */
522
+ _streamIterator(input: PregelInputType | Command, options?: Partial<PregelOptions<Nodes, Channels>>): AsyncGenerator<PregelOutputType>;
523
+ /**
524
+ * Run the graph with a single input and config.
525
+ * @param input The input to the graph.
526
+ * @param options The configuration to use for the run.
527
+ */
528
+ invoke(input: InputType | CommandInstance | null, options?: Partial<PregelOptions<Nodes, Channels, ContextType>>): Promise<OutputType>;
529
+ private _runLoop;
530
+ clearCache(): Promise<void>;
498
531
  }
532
+ //#endregion
533
+ export { Channel, Pregel, type PregelInputType, type PregelOptions, type PregelOutputType };
534
+ //# sourceMappingURL=index.d.ts.map