@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,106 +1,85 @@
1
- import type { Runnable, RunnableConfig } from "@langchain/core/runnables";
2
- import type { All, PendingWrite, CheckpointMetadata, BaseCheckpointSaver, BaseStore, CheckpointListOptions, BaseCache } from "@langchain/langgraph-checkpoint";
3
- import { Graph as DrawableGraph } from "@langchain/core/runnables/graph";
4
- import { IterableReadableStream } from "@langchain/core/utils/stream";
5
- import type { BaseMessage } from "@langchain/core/messages";
6
- import type { BaseChannel } from "../channels/base.js";
7
- import type { PregelNode } from "./read.js";
8
- import type { Interrupt } from "../constants.js";
9
- import { CachePolicy, RetryPolicy } from "./utils/index.js";
1
+ import { BaseChannel } from "../channels/base.js";
10
2
  import { LangGraphRunnableConfig } from "./runnable_types.js";
3
+ import { CachePolicy, RetryPolicy } from "./utils/index.js";
4
+ import { PregelNode } from "./read.js";
5
+ import { Interrupt } from "../constants.js";
6
+ import { All, BaseCache, BaseCheckpointSaver, BaseStore, CheckpointListOptions, CheckpointMetadata, PendingWrite } from "@langchain/langgraph-checkpoint";
7
+ import { Runnable, RunnableConfig } from "@langchain/core/runnables";
8
+ import { Graph } from "@langchain/core/runnables/graph";
9
+ import { IterableReadableStream } from "@langchain/core/utils/stream";
10
+ import { BaseMessage } from "@langchain/core/messages";
11
+
12
+ //#region src/pregel/types.d.ts
13
+
11
14
  /**
12
15
  * Selects the type of output you'll receive when streaming from the graph. See [Streaming](/langgraphjs/how-tos/#streaming) for more details.
13
16
  */
14
- export type StreamMode = "values" | "updates" | "debug" | "messages" | "checkpoints" | "tasks" | "custom";
15
- export type Durability = "exit" | "async" | "sync";
16
- export type PregelInputType = any;
17
- export type PregelOutputType = any;
17
+ type StreamMode = "values" | "updates" | "debug" | "messages" | "checkpoints" | "tasks" | "custom";
18
+ type Durability = "exit" | "async" | "sync";
19
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
20
+ type PregelInputType = any;
21
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
22
+ type PregelOutputType = any;
23
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
18
24
  type StreamMessageOutput = [BaseMessage, Record<string, any>];
25
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
19
26
  type StreamCustomOutput = any;
27
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
20
28
  type StreamDebugOutput = Record<string, any>;
21
29
  type StreamCheckpointsOutput<StreamValues> = {
22
- values: StreamValues;
23
- next: string[];
24
- config: RunnableConfig;
25
- metadata?: CheckpointMetadata;
26
- parentConfig?: RunnableConfig | undefined;
27
- tasks: PregelTaskDescription[];
30
+ values: StreamValues;
31
+ next: string[];
32
+ config: RunnableConfig;
33
+ metadata?: CheckpointMetadata;
34
+ parentConfig?: RunnableConfig | undefined;
35
+ tasks: PregelTaskDescription[];
28
36
  };
29
37
  interface StreamTasksOutputBase {
30
- id: string;
31
- name: string;
32
- interrupts: Interrupt[];
38
+ id: string;
39
+ name: string;
40
+ interrupts: Interrupt[];
33
41
  }
34
42
  interface StreamTasksCreateOutput<StreamValues> extends StreamTasksOutputBase {
35
- input: StreamValues;
36
- triggers: string[];
43
+ input: StreamValues;
44
+ triggers: string[];
37
45
  }
38
46
  interface StreamTasksResultOutput<Keys, StreamUpdates> extends StreamTasksOutputBase {
39
- result: [Keys, StreamUpdates][];
47
+ result: [Keys, StreamUpdates][];
40
48
  }
41
49
  type StreamTasksOutput<StreamUpdates, StreamValues, Nodes = string> = StreamTasksCreateOutput<StreamValues> | StreamTasksResultOutput<Nodes, StreamUpdates>;
42
50
  type DefaultStreamMode = "updates";
43
- export type StreamOutputMap<TStreamMode extends StreamMode | StreamMode[] | undefined, TStreamSubgraphs extends boolean, StreamUpdates, StreamValues, Nodes, NodeReturnType> = (undefined extends TStreamMode ? [] : StreamMode | StreamMode[] extends TStreamMode ? TStreamMode extends StreamMode[] ? TStreamMode[number] : TStreamMode : TStreamMode extends StreamMode[] ? TStreamMode[number] : []) extends infer Multiple extends StreamMode ? [TStreamSubgraphs] extends [true] ? {
44
- values: [string[], "values", StreamValues];
45
- updates: [
46
- string[],
47
- "updates",
48
- NodeReturnType extends Record<string, unknown> ? {
49
- [K in keyof NodeReturnType]?: NodeReturnType[K];
50
- } : Record<Nodes extends string ? Nodes : string, StreamUpdates>
51
- ];
52
- messages: [string[], "messages", StreamMessageOutput];
53
- custom: [string[], "custom", StreamCustomOutput];
54
- checkpoints: [
55
- string[],
56
- "checkpoints",
57
- StreamCheckpointsOutput<StreamValues>
58
- ];
59
- tasks: [
60
- string[],
61
- "tasks",
62
- StreamTasksOutput<StreamUpdates, StreamValues>
63
- ];
64
- debug: [string[], "debug", StreamDebugOutput];
51
+ type StreamOutputMap<TStreamMode extends StreamMode | StreamMode[] | undefined, TStreamSubgraphs extends boolean, StreamUpdates, StreamValues, Nodes, NodeReturnType> = (undefined extends TStreamMode ? [] : StreamMode | StreamMode[] extends TStreamMode ? TStreamMode extends StreamMode[] ? TStreamMode[number] : TStreamMode : TStreamMode extends StreamMode[] ? TStreamMode[number] : []) extends infer Multiple extends StreamMode ? [TStreamSubgraphs] extends [true] ? {
52
+ values: [string[], "values", StreamValues];
53
+ updates: [string[], "updates", NodeReturnType extends Record<string, unknown> ? { [K in keyof NodeReturnType]?: NodeReturnType[K] } : Record<Nodes extends string ? Nodes : string, StreamUpdates>];
54
+ messages: [string[], "messages", StreamMessageOutput];
55
+ custom: [string[], "custom", StreamCustomOutput];
56
+ checkpoints: [string[], "checkpoints", StreamCheckpointsOutput<StreamValues>];
57
+ tasks: [string[], "tasks", StreamTasksOutput<StreamUpdates, StreamValues>];
58
+ debug: [string[], "debug", StreamDebugOutput];
65
59
  }[Multiple] : {
66
- values: ["values", StreamValues];
67
- updates: [
68
- "updates",
69
- NodeReturnType extends Record<string, unknown> ? {
70
- [K in keyof NodeReturnType]?: NodeReturnType[K];
71
- } : Record<Nodes extends string ? Nodes : string, StreamUpdates>
72
- ];
73
- messages: ["messages", StreamMessageOutput];
74
- custom: ["custom", StreamCustomOutput];
75
- checkpoints: ["checkpoints", StreamCheckpointsOutput<StreamValues>];
76
- tasks: ["tasks", StreamTasksOutput<StreamUpdates, StreamValues, Nodes>];
77
- debug: ["debug", StreamDebugOutput];
60
+ values: ["values", StreamValues];
61
+ updates: ["updates", NodeReturnType extends Record<string, unknown> ? { [K in keyof NodeReturnType]?: NodeReturnType[K] } : Record<Nodes extends string ? Nodes : string, StreamUpdates>];
62
+ messages: ["messages", StreamMessageOutput];
63
+ custom: ["custom", StreamCustomOutput];
64
+ checkpoints: ["checkpoints", StreamCheckpointsOutput<StreamValues>];
65
+ tasks: ["tasks", StreamTasksOutput<StreamUpdates, StreamValues, Nodes>];
66
+ debug: ["debug", StreamDebugOutput];
78
67
  }[Multiple] : (undefined extends TStreamMode ? DefaultStreamMode : TStreamMode) extends infer Single extends StreamMode ? [TStreamSubgraphs] extends [true] ? {
79
- values: [string[], StreamValues];
80
- updates: [
81
- string[],
82
- NodeReturnType extends Record<string, unknown> ? {
83
- [K in keyof NodeReturnType]?: NodeReturnType[K];
84
- } : Record<Nodes extends string ? Nodes : string, StreamUpdates>
85
- ];
86
- messages: [string[], StreamMessageOutput];
87
- custom: [string[], StreamCustomOutput];
88
- checkpoints: [string[], StreamCheckpointsOutput<StreamValues>];
89
- tasks: [
90
- string[],
91
- StreamTasksOutput<StreamUpdates, StreamValues, Nodes>
92
- ];
93
- debug: [string[], StreamDebugOutput];
68
+ values: [string[], StreamValues];
69
+ updates: [string[], NodeReturnType extends Record<string, unknown> ? { [K in keyof NodeReturnType]?: NodeReturnType[K] } : Record<Nodes extends string ? Nodes : string, StreamUpdates>];
70
+ messages: [string[], StreamMessageOutput];
71
+ custom: [string[], StreamCustomOutput];
72
+ checkpoints: [string[], StreamCheckpointsOutput<StreamValues>];
73
+ tasks: [string[], StreamTasksOutput<StreamUpdates, StreamValues, Nodes>];
74
+ debug: [string[], StreamDebugOutput];
94
75
  }[Single] : {
95
- values: StreamValues;
96
- updates: NodeReturnType extends Record<string, unknown> ? {
97
- [K in keyof NodeReturnType]?: NodeReturnType[K];
98
- } : Record<Nodes extends string ? Nodes : string, StreamUpdates>;
99
- messages: StreamMessageOutput;
100
- custom: StreamCustomOutput;
101
- checkpoints: StreamCheckpointsOutput<StreamValues>;
102
- tasks: StreamTasksOutput<StreamUpdates, StreamValues, Nodes>;
103
- debug: StreamDebugOutput;
76
+ values: StreamValues;
77
+ updates: NodeReturnType extends Record<string, unknown> ? { [K in keyof NodeReturnType]?: NodeReturnType[K] } : Record<Nodes extends string ? Nodes : string, StreamUpdates>;
78
+ messages: StreamMessageOutput;
79
+ custom: StreamCustomOutput;
80
+ checkpoints: StreamCheckpointsOutput<StreamValues>;
81
+ tasks: StreamTasksOutput<StreamUpdates, StreamValues, Nodes>;
82
+ debug: StreamDebugOutput;
104
83
  }[Single] : never;
105
84
  /**
106
85
  * Configuration options for executing a Pregel graph.
@@ -110,382 +89,349 @@ export type StreamOutputMap<TStreamMode extends StreamMode | StreamMode[] | unde
110
89
  * @typeParam Channels - Mapping of channel names to their {@link BaseChannel} implementations
111
90
  * @typeParam ContextType - Type of context that can be passed to the graph
112
91
  */
113
- export interface PregelOptions<Nodes extends StrRecord<string, PregelNode>, Channels extends StrRecord<string, BaseChannel>, ContextType extends Record<string, any> = Record<string, any>, TStreamMode extends StreamMode | StreamMode[] | undefined = StreamMode | StreamMode[] | undefined, TSubgraphs extends boolean = boolean> extends RunnableConfig<ContextType> {
114
- /**
115
- * Controls what information is streamed during graph execution.
116
- * Multiple modes can be enabled simultaneously.
117
- *
118
- * Supported modes:
119
- * - "values": Streams complete state after each step
120
- * - "updates": Streams only state changes after each step
121
- * - "messages": Streams messages from within nodes
122
- * - "custom": Streams custom events from within nodes
123
- * - "debug": Streams detailed execution events for tracing & debugging
124
- *
125
- * @example
126
- * ```typescript
127
- * // Stream only values
128
- * streamMode: "values"
129
- *
130
- * // Stream both values and debug info
131
- * streamMode: ["values", "debug"]
132
- * ```
133
- *
134
- * @default ["values"]
135
- */
136
- streamMode?: TStreamMode;
137
- /**
138
- * Specifies which channel keys to retrieve from the checkpoint when resuming execution.
139
- * This is an advanced option that you generally don't need to set manually.
140
- * The graph will automatically determine the appropriate input keys based on its configuration.
141
- */
142
- inputKeys?: keyof Channels | Array<keyof Channels>;
143
- /**
144
- * Specifies which channel keys to include in the output stream and final result.
145
- * Use this to filter which parts of the graph state you want to observe.
146
- *
147
- * @example
148
- * ```typescript
149
- * // Stream only the 'result' channel
150
- * outputKeys: "result"
151
- *
152
- * // Stream multiple channels
153
- * outputKeys: ["result", "intermediateState"]
154
- * ```
155
- */
156
- outputKeys?: keyof Channels | Array<keyof Channels>;
157
- /**
158
- * List of nodes where execution should be interrupted BEFORE the node runs.
159
- * Can be used for debugging and advanced state manipulation use cases. For
160
- * human-in-the-loop workflows, developers should prefer the
161
- * @link {interrupt} function instead.
162
- *
163
- * When interrupted, a resume @link {Command} must be provided to continue
164
- * execution.
165
- *
166
- * @example
167
- * ```typescript
168
- * // Interrupt before specific nodes
169
- * interruptBefore: ["humanReview", "qualityCheck"]
170
- *
171
- * // Interrupt before all nodes
172
- * interruptBefore: "all"
173
- * ```
174
- */
175
- interruptBefore?: All | Array<keyof Nodes>;
176
- /**
177
- * List of nodes where execution should be interrupted AFTER the node runs.
178
- * Similar to interruptBefore, but interrupts after node completion.
179
- * Useful when the node's output needs to be reviewed before proceeding.
180
- *
181
- * @example
182
- * ```typescript
183
- * // Interrupt after specific nodes
184
- * interruptAfter: ["generateContent", "analyze"]
185
- *
186
- * // Interrupt after all nodes
187
- * interruptAfter: "all"
188
- * ```
189
- */
190
- interruptAfter?: All | Array<keyof Nodes>;
191
- /**
192
- * Enables detailed debug logging during graph execution.
193
- * When enabled, prints information about:
194
- * - Task execution
195
- * - Channel updates
196
- * - Checkpoint writes
197
- *
198
- * @default false
199
- */
200
- debug?: boolean;
201
- /**
202
- * Whether to include subgraph execution details in the stream.
203
- * When true, state updates from nested graphs will also be streamed.
204
- *
205
- * @default false
206
- */
207
- subgraphs?: TSubgraphs;
208
- /**
209
- * Whether to checkpoint intermediate steps, defaults to `true`.
210
- * If `false`, only the final checkpoint is saved.
211
- * @deprecated Use `durability` instead.
212
- */
213
- checkpointDuring?: boolean;
214
- /**
215
- * Whether to checkpoint during the run (or only at the end/interruption).
216
- * - `"async"`: Save checkpoint asynchronously while the next step executes (default).
217
- * - `"sync"`: Save checkpoint synchronously before the next step starts.
218
- * - `"exit"`: Save checkpoint only when the graph exits.
219
- * @default "async"
220
- */
221
- durability?: Durability;
222
- /**
223
- * A shared value store that allows you to store and retrieve state across
224
- * threads. Useful for implementing long-term memory patterns.
225
- */
226
- store?: BaseStore;
227
- /**
228
- * Optional cache for the graph, useful for caching tasks.
229
- */
230
- cache?: BaseCache;
231
- /**
232
- * Static context for the graph run, like `userId`, `dbConnection` etc.
233
- */
234
- context?: ContextType;
92
+ interface PregelOptions<Nodes extends StrRecord<string, PregelNode>, Channels extends StrRecord<string, BaseChannel>,
93
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
94
+ ContextType extends Record<string, any> = Record<string, any>, TStreamMode extends StreamMode | StreamMode[] | undefined = StreamMode | StreamMode[] | undefined, TSubgraphs extends boolean = boolean> extends RunnableConfig<ContextType> {
95
+ /**
96
+ * Controls what information is streamed during graph execution.
97
+ * Multiple modes can be enabled simultaneously.
98
+ *
99
+ * Supported modes:
100
+ * - "values": Streams complete state after each step
101
+ * - "updates": Streams only state changes after each step
102
+ * - "messages": Streams messages from within nodes
103
+ * - "custom": Streams custom events from within nodes
104
+ * - "debug": Streams detailed execution events for tracing & debugging
105
+ *
106
+ * @example
107
+ * ```typescript
108
+ * // Stream only values
109
+ * streamMode: "values"
110
+ *
111
+ * // Stream both values and debug info
112
+ * streamMode: ["values", "debug"]
113
+ * ```
114
+ *
115
+ * @default ["values"]
116
+ */
117
+ streamMode?: TStreamMode;
118
+ /**
119
+ * Specifies which channel keys to retrieve from the checkpoint when resuming execution.
120
+ * This is an advanced option that you generally don't need to set manually.
121
+ * The graph will automatically determine the appropriate input keys based on its configuration.
122
+ */
123
+ inputKeys?: keyof Channels | Array<keyof Channels>;
124
+ /**
125
+ * Specifies which channel keys to include in the output stream and final result.
126
+ * Use this to filter which parts of the graph state you want to observe.
127
+ *
128
+ * @example
129
+ * ```typescript
130
+ * // Stream only the 'result' channel
131
+ * outputKeys: "result"
132
+ *
133
+ * // Stream multiple channels
134
+ * outputKeys: ["result", "intermediateState"]
135
+ * ```
136
+ */
137
+ outputKeys?: keyof Channels | Array<keyof Channels>;
138
+ /**
139
+ * List of nodes where execution should be interrupted BEFORE the node runs.
140
+ * Can be used for debugging and advanced state manipulation use cases. For
141
+ * human-in-the-loop workflows, developers should prefer the
142
+ * @link {interrupt} function instead.
143
+ *
144
+ * When interrupted, a resume @link {Command} must be provided to continue
145
+ * execution.
146
+ *
147
+ * @example
148
+ * ```typescript
149
+ * // Interrupt before specific nodes
150
+ * interruptBefore: ["humanReview", "qualityCheck"]
151
+ *
152
+ * // Interrupt before all nodes
153
+ * interruptBefore: "all"
154
+ * ```
155
+ */
156
+ interruptBefore?: All | Array<keyof Nodes>;
157
+ /**
158
+ * List of nodes where execution should be interrupted AFTER the node runs.
159
+ * Similar to interruptBefore, but interrupts after node completion.
160
+ * Useful when the node's output needs to be reviewed before proceeding.
161
+ *
162
+ * @example
163
+ * ```typescript
164
+ * // Interrupt after specific nodes
165
+ * interruptAfter: ["generateContent", "analyze"]
166
+ *
167
+ * // Interrupt after all nodes
168
+ * interruptAfter: "all"
169
+ * ```
170
+ */
171
+ interruptAfter?: All | Array<keyof Nodes>;
172
+ /**
173
+ * Enables detailed debug logging during graph execution.
174
+ * When enabled, prints information about:
175
+ * - Task execution
176
+ * - Channel updates
177
+ * - Checkpoint writes
178
+ *
179
+ * @default false
180
+ */
181
+ debug?: boolean;
182
+ /**
183
+ * Whether to include subgraph execution details in the stream.
184
+ * When true, state updates from nested graphs will also be streamed.
185
+ *
186
+ * @default false
187
+ */
188
+ subgraphs?: TSubgraphs;
189
+ /**
190
+ * Whether to checkpoint intermediate steps, defaults to `true`.
191
+ * If `false`, only the final checkpoint is saved.
192
+ * @deprecated Use `durability` instead.
193
+ */
194
+ checkpointDuring?: boolean;
195
+ /**
196
+ * Whether to checkpoint during the run (or only at the end/interruption).
197
+ * - `"async"`: Save checkpoint asynchronously while the next step executes (default).
198
+ * - `"sync"`: Save checkpoint synchronously before the next step starts.
199
+ * - `"exit"`: Save checkpoint only when the graph exits.
200
+ * @default "async"
201
+ */
202
+ durability?: Durability;
203
+ /**
204
+ * A shared value store that allows you to store and retrieve state across
205
+ * threads. Useful for implementing long-term memory patterns.
206
+ */
207
+ store?: BaseStore;
208
+ /**
209
+ * Optional cache for the graph, useful for caching tasks.
210
+ */
211
+ cache?: BaseCache;
212
+ /**
213
+ * Static context for the graph run, like `userId`, `dbConnection` etc.
214
+ */
215
+ context?: ContextType;
235
216
  }
236
217
  /**
237
218
  * Construct a type with a set of properties K of type T
238
219
  */
239
- type StrRecord<K extends string, T> = {
240
- [P in K]: T;
241
- };
242
- export interface PregelInterface<Nodes extends StrRecord<string, PregelNode>, Channels extends StrRecord<string, BaseChannel>, ContextType extends Record<string, any> = StrRecord<string, any>> {
243
- lg_is_pregel: boolean;
244
- withConfig(config: RunnableConfig): PregelInterface<Nodes, Channels>;
245
- getGraphAsync(config: RunnableConfig & {
246
- xray?: boolean | number;
247
- }): Promise<DrawableGraph>;
248
- /** @deprecated Use getSubgraphsAsync instead. The async method will become the default in the next minor release. */
249
- getSubgraphs(namespace?: string, recurse?: boolean): Generator<[string, PregelInterface<any, any>]>;
250
- getSubgraphsAsync(namespace?: string, recurse?: boolean): AsyncGenerator<[string, PregelInterface<any, any>]>;
251
- getState(config: RunnableConfig, options?: {
252
- subgraphs?: boolean;
253
- }): Promise<StateSnapshot>;
254
- getStateHistory(config: RunnableConfig, options?: CheckpointListOptions): AsyncIterableIterator<StateSnapshot>;
255
- updateState(inputConfig: LangGraphRunnableConfig, values: Record<string, unknown> | unknown, asNode?: keyof Nodes | string): Promise<RunnableConfig>;
256
- stream(input: PregelInputType, options?: Partial<PregelOptions<Nodes, Channels, ContextType>>): Promise<IterableReadableStream<PregelOutputType>>;
257
- invoke(input: PregelInputType, options?: Partial<PregelOptions<Nodes, Channels, ContextType>>): Promise<PregelOutputType>;
220
+ type StrRecord<K extends string, T> = { [P in K]: T };
221
+ interface PregelInterface<Nodes extends StrRecord<string, PregelNode>, Channels extends StrRecord<string, BaseChannel>,
222
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
223
+ ContextType extends Record<string, any> = StrRecord<string, any>> {
224
+ lg_is_pregel: boolean;
225
+ withConfig(config: RunnableConfig): PregelInterface<Nodes, Channels>;
226
+ getGraphAsync(config: RunnableConfig & {
227
+ xray?: boolean | number;
228
+ }): Promise<Graph>;
229
+ /** @deprecated Use getSubgraphsAsync instead. The async method will become the default in the next minor release. */
230
+ getSubgraphs(namespace?: string, recurse?: boolean
231
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
232
+ ): Generator<[string, PregelInterface<any, any>]>;
233
+ getSubgraphsAsync(namespace?: string, recurse?: boolean
234
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
235
+ ): AsyncGenerator<[string, PregelInterface<any, any>]>;
236
+ getState(config: RunnableConfig, options?: {
237
+ subgraphs?: boolean;
238
+ }): Promise<StateSnapshot>;
239
+ getStateHistory(config: RunnableConfig, options?: CheckpointListOptions): AsyncIterableIterator<StateSnapshot>;
240
+ updateState(inputConfig: LangGraphRunnableConfig, values: Record<string, unknown> | unknown, asNode?: keyof Nodes | string): Promise<RunnableConfig>;
241
+ stream(input: PregelInputType, options?: Partial<PregelOptions<Nodes, Channels, ContextType>>): Promise<IterableReadableStream<PregelOutputType>>;
242
+ invoke(input: PregelInputType, options?: Partial<PregelOptions<Nodes, Channels, ContextType>>): Promise<PregelOutputType>;
258
243
  }
259
244
  /**
260
245
  * Parameters for creating a Pregel graph.
261
246
  * @internal
262
247
  */
263
- export type PregelParams<Nodes extends StrRecord<string, PregelNode>, Channels extends StrRecord<string, BaseChannel>> = {
264
- /**
265
- * The name of the graph. @see {@link Runnable.name}
266
- */
267
- name?: string;
268
- /**
269
- * The nodes in the graph.
270
- */
271
- nodes: Nodes;
272
- /**
273
- * The channels in the graph.
274
- */
275
- channels: Channels;
276
- /**
277
- * Whether to validate the graph.
278
- *
279
- * @default true
280
- */
281
- autoValidate?: boolean;
282
- /**
283
- * The stream mode for the graph run. See [Streaming](/langgraphjs/how-tos/#streaming) for more details.
284
- *
285
- * @default ["values"]
286
- */
287
- streamMode?: StreamMode | StreamMode[];
288
- /**
289
- * The input channels for the graph run.
290
- */
291
- inputChannels: keyof Channels | Array<keyof Channels>;
292
- /**
293
- * The output channels for the graph run.
294
- */
295
- outputChannels: keyof Channels | Array<keyof Channels>;
296
- /**
297
- * After processing one of the nodes named in this list, the graph will be interrupted and a resume {@link Command} must be provided to proceed with the execution of this thread.
298
- * @default []
299
- */
300
- interruptAfter?: Array<keyof Nodes> | All;
301
- /**
302
- * Before processing one of the nodes named in this list, the graph will be interrupted and a resume {@link Command} must be provided to proceed with the execution of this thread.
303
- * @default []
304
- */
305
- interruptBefore?: Array<keyof Nodes> | All;
306
- /**
307
- * The channels to stream from the graph run.
308
- * @default []
309
- */
310
- streamChannels?: keyof Channels | Array<keyof Channels>;
311
- /**
312
- * @default undefined
313
- */
314
- stepTimeout?: number;
315
- /**
316
- * @default false
317
- */
318
- debug?: boolean;
319
- /**
320
- * The {@link BaseCheckpointSaver | checkpointer} to use for the graph run.
321
- */
322
- checkpointer?: BaseCheckpointSaver | boolean;
323
- /**
324
- * The default retry policy for this graph. For defaults, see {@link RetryPolicy}.
325
- */
326
- retryPolicy?: RetryPolicy;
327
- /**
328
- * The configuration for the graph run.
329
- */
330
- config?: LangGraphRunnableConfig;
331
- /**
332
- * External key-value store.
333
- */
334
- store?: BaseStore;
335
- /**
336
- * Storage used for node caching.
337
- */
338
- cache?: BaseCache;
248
+ type PregelParams<Nodes extends StrRecord<string, PregelNode>, Channels extends StrRecord<string, BaseChannel>> = {
249
+ /**
250
+ * The name of the graph. @see {@link Runnable.name}
251
+ */
252
+ name?: string;
253
+ /**
254
+ * The nodes in the graph.
255
+ */
256
+ nodes: Nodes;
257
+ /**
258
+ * The channels in the graph.
259
+ */
260
+ channels: Channels;
261
+ /**
262
+ * Whether to validate the graph.
263
+ *
264
+ * @default true
265
+ */
266
+ autoValidate?: boolean;
267
+ /**
268
+ * The stream mode for the graph run. See [Streaming](/langgraphjs/how-tos/#streaming) for more details.
269
+ *
270
+ * @default ["values"]
271
+ */
272
+ streamMode?: StreamMode | StreamMode[];
273
+ /**
274
+ * The input channels for the graph run.
275
+ */
276
+ inputChannels: keyof Channels | Array<keyof Channels>;
277
+ /**
278
+ * The output channels for the graph run.
279
+ */
280
+ outputChannels: keyof Channels | Array<keyof Channels>;
281
+ /**
282
+ * After processing one of the nodes named in this list, the graph will be interrupted and a resume {@link Command} must be provided to proceed with the execution of this thread.
283
+ * @default []
284
+ */
285
+ interruptAfter?: Array<keyof Nodes> | All;
286
+ /**
287
+ * Before processing one of the nodes named in this list, the graph will be interrupted and a resume {@link Command} must be provided to proceed with the execution of this thread.
288
+ * @default []
289
+ */
290
+ interruptBefore?: Array<keyof Nodes> | All;
291
+ /**
292
+ * The channels to stream from the graph run.
293
+ * @default []
294
+ */
295
+ streamChannels?: keyof Channels | Array<keyof Channels>;
296
+ /**
297
+ * @default undefined
298
+ */
299
+ stepTimeout?: number;
300
+ /**
301
+ * @default false
302
+ */
303
+ debug?: boolean;
304
+ /**
305
+ * The {@link BaseCheckpointSaver | checkpointer} to use for the graph run.
306
+ */
307
+ checkpointer?: BaseCheckpointSaver | boolean;
308
+ /**
309
+ * The default retry policy for this graph. For defaults, see {@link RetryPolicy}.
310
+ */
311
+ retryPolicy?: RetryPolicy;
312
+ /**
313
+ * The configuration for the graph run.
314
+ */
315
+ config?: LangGraphRunnableConfig;
316
+ /**
317
+ * External key-value store.
318
+ */
319
+ store?: BaseStore;
320
+ /**
321
+ * Storage used for node caching.
322
+ */
323
+ cache?: BaseCache;
339
324
  };
340
- export interface PregelTaskDescription {
341
- readonly id: string;
342
- readonly name: string;
343
- readonly error?: unknown;
344
- readonly interrupts: Interrupt[];
345
- readonly state?: LangGraphRunnableConfig | StateSnapshot;
346
- readonly path?: TaskPath;
347
- readonly result?: unknown;
348
- }
349
- interface CacheKey {
350
- ns: string[];
351
- key: string;
352
- ttl?: number;
325
+ interface PregelTaskDescription {
326
+ readonly id: string;
327
+ readonly name: string;
328
+ readonly error?: unknown;
329
+ readonly interrupts: Interrupt[];
330
+ readonly state?: LangGraphRunnableConfig | StateSnapshot;
331
+ readonly path?: TaskPath;
332
+ readonly result?: unknown;
353
333
  }
354
- export interface PregelExecutableTask<NodeKey extends PropertyKey, ChannelKey extends PropertyKey> {
355
- readonly name: NodeKey;
356
- readonly input: unknown;
357
- readonly proc: Runnable<any, any, LangGraphRunnableConfig>;
358
- readonly writes: PendingWrite<ChannelKey>[];
359
- readonly config?: LangGraphRunnableConfig;
360
- readonly triggers: Array<string>;
361
- readonly retry_policy?: RetryPolicy;
362
- readonly cache_key?: CacheKey;
363
- readonly id: string;
364
- readonly path?: TaskPath;
365
- readonly subgraphs?: Runnable[];
366
- readonly writers: Runnable[];
367
- }
368
- export interface StateSnapshot {
369
- /**
370
- * Current values of channels
371
- */
372
- readonly values: Record<string, any> | any;
373
- /**
374
- * Nodes to execute in the next step, if any
375
- */
376
- readonly next: Array<string>;
377
- /**
378
- * Config used to fetch this snapshot
379
- */
380
- readonly config: RunnableConfig;
381
- /**
382
- * Metadata about the checkpoint
383
- */
384
- readonly metadata?: CheckpointMetadata;
385
- /**
386
- * Time when the snapshot was created
387
- */
388
- readonly createdAt?: string;
389
- /**
390
- * Config used to fetch the parent snapshot, if any
391
- * @default undefined
392
- */
393
- readonly parentConfig?: RunnableConfig | undefined;
394
- /**
395
- * Tasks to execute in this step. If already attempted, may contain an error.
396
- */
397
- readonly tasks: PregelTaskDescription[];
334
+ interface StateSnapshot {
335
+ /**
336
+ * Current values of channels
337
+ */
338
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
339
+ readonly values: Record<string, any> | any;
340
+ /**
341
+ * Nodes to execute in the next step, if any
342
+ */
343
+ readonly next: Array<string>;
344
+ /**
345
+ * Config used to fetch this snapshot
346
+ */
347
+ readonly config: RunnableConfig;
348
+ /**
349
+ * Metadata about the checkpoint
350
+ */
351
+ readonly metadata?: CheckpointMetadata;
352
+ /**
353
+ * Time when the snapshot was created
354
+ */
355
+ readonly createdAt?: string;
356
+ /**
357
+ * Config used to fetch the parent snapshot, if any
358
+ * @default undefined
359
+ */
360
+ readonly parentConfig?: RunnableConfig | undefined;
361
+ /**
362
+ * Tasks to execute in this step. If already attempted, may contain an error.
363
+ */
364
+ readonly tasks: PregelTaskDescription[];
398
365
  }
399
366
  /**
400
367
  * Options for subscribing to multiple channels.
401
368
  */
402
- export type MultipleChannelSubscriptionOptions = {
403
- /**
404
- * Optional tags to associate with the subscription.
405
- */
406
- tags?: string[];
369
+ type MultipleChannelSubscriptionOptions = {
370
+ /**
371
+ * Optional tags to associate with the subscription.
372
+ */
373
+ tags?: string[];
407
374
  };
408
375
  /**
409
376
  * Options for subscribing to a single channel.
410
377
  */
411
- export type SingleChannelSubscriptionOptions = {
412
- /**
413
- * When specified, the channel mapping will be an object with this key pointing
414
- * to the array of channels to subscribe to. Otherwise, the channel mapping
415
- * will be an array of channels.
416
- */
417
- key?: string;
418
- /**
419
- * Optional tags to associate with the subscription.
420
- */
421
- tags?: string[];
378
+ type SingleChannelSubscriptionOptions = {
379
+ /**
380
+ * When specified, the channel mapping will be an object with this key pointing
381
+ * to the array of channels to subscribe to. Otherwise, the channel mapping
382
+ * will be an array of channels.
383
+ */
384
+ key?: string;
385
+ /**
386
+ * Optional tags to associate with the subscription.
387
+ */
388
+ tags?: string[];
422
389
  };
423
390
  /**
424
391
  * Options for getting the state of the graph.
425
392
  */
426
- export type GetStateOptions = {
427
- /**
428
- * Whether to include subgraph states.
429
- * @default false
430
- */
431
- subgraphs?: boolean;
393
+ type GetStateOptions = {
394
+ /**
395
+ * Whether to include subgraph states.
396
+ * @default false
397
+ */
398
+ subgraphs?: boolean;
432
399
  };
433
400
  /**
434
401
  * Used for storing/retrieving internal execution state.
435
402
  *
436
403
  * @internal
437
404
  */
438
- export type PregelScratchpad<Resume = unknown> = {
439
- /** Counter for tracking call invocations */
440
- callCounter: number;
441
- /** Counter for tracking interrupts */
442
- interruptCounter: number;
443
- /** List of resume values */
444
- resume: Resume[];
445
- /** Single resume value for null task ID */
446
- nullResume: Resume;
447
- consumeNullResume: () => Resume | undefined;
448
- /** Counter for tracking subgraph invocations */
449
- subgraphCounter: number;
450
- /** The input to the currently executing task */
451
- currentTaskInput: unknown;
452
- };
453
- /**
454
- * @internal
455
- */
456
- export type PregelAbortSignals = {
457
- /** Aborts when the user calls `stream.cancel()` or aborts the {@link AbortSignal} that they passed in via the `signal` option */
458
- externalAbortSignal?: AbortSignal;
459
- /**
460
- * Aborts when the currently executing task throws any error other than a {@link GraphBubbleUp}
461
- */
462
- timeoutAbortSignal?: AbortSignal;
463
- /**
464
- * A reference to the AbortSignal that is passed to the node. Aborts on step timeout, stream cancel, or when an error is thrown.
465
- */
466
- composedAbortSignal?: AbortSignal;
467
- };
468
- export type CallOptions = {
469
- func: (...args: unknown[]) => unknown | Promise<unknown>;
470
- name: string;
471
- input: unknown;
472
- cache?: CachePolicy;
473
- retry?: RetryPolicy;
474
- callbacks?: unknown;
405
+
406
+ type CallOptions = {
407
+ func: (...args: unknown[]) => unknown | Promise<unknown>;
408
+ name: string;
409
+ input: unknown;
410
+ cache?: CachePolicy;
411
+ retry?: RetryPolicy;
412
+ callbacks?: unknown;
475
413
  };
476
- export declare class Call {
477
- func: (...args: unknown[]) => unknown | Promise<unknown>;
478
- name: string;
479
- input: unknown;
480
- retry?: RetryPolicy;
481
- cache?: CachePolicy;
482
- callbacks?: unknown;
483
- readonly __lg_type = "call";
484
- constructor({ func, name, input, retry, cache, callbacks }: CallOptions);
414
+ declare class Call {
415
+ func: (...args: unknown[]) => unknown | Promise<unknown>;
416
+ name: string;
417
+ input: unknown;
418
+ retry?: RetryPolicy;
419
+ cache?: CachePolicy;
420
+ callbacks?: unknown;
421
+ readonly __lg_type: string;
422
+ constructor({
423
+ func,
424
+ name,
425
+ input,
426
+ retry,
427
+ cache,
428
+ callbacks
429
+ }: CallOptions);
485
430
  }
486
- export declare function isCall(value: unknown): value is Call;
487
- export type SimpleTaskPath = [string, string | number];
488
- export type VariadicTaskPath = [string, ...(string | number)[], boolean];
489
- export type CallTaskPath = [string, ...(string | number)[], Call] | [string, TaskPath, ...(string | number)[], Call];
490
- export type TaskPath = SimpleTaskPath | CallTaskPath | VariadicTaskPath;
491
- export {};
431
+ type SimpleTaskPath = [string, string | number];
432
+ type VariadicTaskPath = [string, ...(string | number)[], boolean];
433
+ type CallTaskPath = [string, ...(string | number)[], Call] | [string, TaskPath, ...(string | number)[], Call];
434
+ type TaskPath = SimpleTaskPath | CallTaskPath | VariadicTaskPath;
435
+ //#endregion
436
+ export { Durability, GetStateOptions, MultipleChannelSubscriptionOptions, PregelInputType, PregelInterface, PregelOptions, PregelOutputType, PregelParams, SingleChannelSubscriptionOptions, StateSnapshot, StreamMode, StreamOutputMap };
437
+ //# sourceMappingURL=types.d.ts.map