@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
package/CHANGELOG.md CHANGED
@@ -1,10 +1,15 @@
1
1
  # @langchain/langgraph
2
2
 
3
- ## 0.4.8
3
+ ## 1.0.0-alpha.0
4
+
5
+ ### Major Changes
6
+
7
+ - 445c2ae: Make Zod a peer dependency of @langchain/langgraph
4
8
 
5
9
  ### Patch Changes
6
10
 
7
- - bb0df7c: Fix "This stream has already been locked for exclusive reading by another reader" error when using `web-streams-polyfill`
11
+ - 5f9b5a0: Deprecate createReactAgent in favour of `langchain` package.
12
+ - dcc117f: feat(langgraph): add `toLangGraphEventStream` method to stream events in LGP compatible format
8
13
 
9
14
  ## 0.4.7
10
15
 
package/README.md CHANGED
@@ -18,9 +18,8 @@ To learn more about how to use LangGraph, check out [the docs](https://langchain
18
18
 
19
19
  ```ts
20
20
  // npm install @langchain-anthropic
21
- import { createReactAgent } from "@langchain/langgraph/prebuilt";
21
+ import { createReactAgent, tool } from "langchain";
22
22
  import { ChatAnthropic } from "@langchain/anthropic";
23
- import { tool } from "@langchain/core/tools";
24
23
 
25
24
  import { z } from "zod";
26
25
 
@@ -0,0 +1,25 @@
1
+ //#region rolldown:runtime
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
10
+ key = keys[i];
11
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
12
+ get: ((k) => from[k]).bind(null, key),
13
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
14
+ });
15
+ }
16
+ return to;
17
+ };
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
19
+ value: mod,
20
+ enumerable: true
21
+ }) : target, mod));
22
+
23
+ //#endregion
24
+
25
+ exports.__toESM = __toESM;
@@ -0,0 +1,26 @@
1
+ import { BaseChannel } from "./base.cjs";
2
+
3
+ //#region src/channels/any_value.d.ts
4
+
5
+ /**
6
+ * Stores the last value received, assumes that if multiple values are received, they are all equal.
7
+ *
8
+ * Note: Unlike 'LastValue' if multiple nodes write to this channel in a single step, the values
9
+ * will be continuously overwritten.
10
+ *
11
+ * @internal
12
+ */
13
+ declare class AnyValue<Value> extends BaseChannel<Value, Value, Value> {
14
+ lc_graph_name: string;
15
+ // value is an array so we don't misinterpret an update to undefined as no write
16
+ value: [Value] | [];
17
+ constructor();
18
+ fromCheckpoint(checkpoint?: Value): this;
19
+ update(values: Value[]): boolean;
20
+ get(): Value;
21
+ checkpoint(): Value;
22
+ isAvailable(): boolean;
23
+ }
24
+ //#endregion
25
+ export { AnyValue };
26
+ //# sourceMappingURL=any_value.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"any_value.d.cts","names":["BaseChannel","AnyValue","Value"],"sources":["../../src/channels/any_value.d.ts"],"sourcesContent":["import { BaseChannel } from \"./base.js\";\n/**\n * Stores the last value received, assumes that if multiple values are received, they are all equal.\n *\n * Note: Unlike 'LastValue' if multiple nodes write to this channel in a single step, the values\n * will be continuously overwritten.\n *\n * @internal\n */\nexport declare class AnyValue<Value> extends BaseChannel<Value, Value, Value> {\n lc_graph_name: string;\n // value is an array so we don't misinterpret an update to undefined as no write\n value: [Value] | [];\n constructor();\n fromCheckpoint(checkpoint?: Value): this;\n update(values: Value[]): boolean;\n get(): Value;\n checkpoint(): Value;\n isAvailable(): boolean;\n}\n"],"mappings":";;;;;;AASA;;;;;;AAKgCE,cALXD,QAKWC,CAAAA,KAAAA,CAAAA,SALaF,WAKbE,CALyBA,KAKzBA,EALgCA,KAKhCA,EALuCA,KAKvCA,CAAAA,CAAAA;eACbA,EAAAA,MAAAA;;OAEDA,EAAAA,CALNA,KAKMA,CAAAA,GAAAA,EAAAA;aAR2BF,CAAAA;8BAKbE;iBACbA;SACRA;gBACOA"}
@@ -1,4 +1,7 @@
1
1
  import { BaseChannel } from "./base.js";
2
+
3
+ //#region src/channels/any_value.d.ts
4
+
2
5
  /**
3
6
  * Stores the last value received, assumes that if multiple values are received, they are all equal.
4
7
  *
@@ -7,13 +10,17 @@ import { BaseChannel } from "./base.js";
7
10
  *
8
11
  * @internal
9
12
  */
10
- export declare class AnyValue<Value> extends BaseChannel<Value, Value, Value> {
11
- lc_graph_name: string;
12
- value: [Value] | [];
13
- constructor();
14
- fromCheckpoint(checkpoint?: Value): this;
15
- update(values: Value[]): boolean;
16
- get(): Value;
17
- checkpoint(): Value;
18
- isAvailable(): boolean;
13
+ declare class AnyValue<Value> extends BaseChannel<Value, Value, Value> {
14
+ lc_graph_name: string;
15
+ // value is an array so we don't misinterpret an update to undefined as no write
16
+ value: [Value] | [];
17
+ constructor();
18
+ fromCheckpoint(checkpoint?: Value): this;
19
+ update(values: Value[]): boolean;
20
+ get(): Value;
21
+ checkpoint(): Value;
22
+ isAvailable(): boolean;
19
23
  }
24
+ //#endregion
25
+ export { AnyValue };
26
+ //# sourceMappingURL=any_value.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"any_value.d.ts","names":["BaseChannel","AnyValue","Value"],"sources":["../../src/channels/any_value.d.ts"],"sourcesContent":["import { BaseChannel } from \"./base.js\";\n/**\n * Stores the last value received, assumes that if multiple values are received, they are all equal.\n *\n * Note: Unlike 'LastValue' if multiple nodes write to this channel in a single step, the values\n * will be continuously overwritten.\n *\n * @internal\n */\nexport declare class AnyValue<Value> extends BaseChannel<Value, Value, Value> {\n lc_graph_name: string;\n // value is an array so we don't misinterpret an update to undefined as no write\n value: [Value] | [];\n constructor();\n fromCheckpoint(checkpoint?: Value): this;\n update(values: Value[]): boolean;\n get(): Value;\n checkpoint(): Value;\n isAvailable(): boolean;\n}\n"],"mappings":";;;;;;AASA;;;;;;AAKgCE,cALXD,QAKWC,CAAAA,KAAAA,CAAAA,SALaF,WAKbE,CALyBA,KAKzBA,EALgCA,KAKhCA,EALuCA,KAKvCA,CAAAA,CAAAA;eACbA,EAAAA,MAAAA;;OAEDA,EAAAA,CALNA,KAKMA,CAAAA,GAAAA,EAAAA;aAR2BF,CAAAA;8BAKbE;iBACbA;SACRA;gBACOA"}
@@ -1,142 +1,106 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BaseChannel = void 0;
4
- exports.isBaseChannel = isBaseChannel;
5
- exports.getOnlyChannels = getOnlyChannels;
6
- exports.emptyChannels = emptyChannels;
7
- exports.createCheckpoint = createCheckpoint;
8
- const langgraph_checkpoint_1 = require("@langchain/langgraph-checkpoint");
9
- const errors_js_1 = require("../errors.cjs");
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ const require_errors = require('../errors.cjs');
3
+ const __langchain_langgraph_checkpoint = require_rolldown_runtime.__toESM(require("@langchain/langgraph-checkpoint"));
4
+
5
+ //#region src/channels/base.ts
10
6
  function isBaseChannel(obj) {
11
- return obj != null && obj.lg_is_channel === true;
12
- }
13
- class BaseChannel {
14
- constructor() {
15
- Object.defineProperty(this, "ValueType", {
16
- enumerable: true,
17
- configurable: true,
18
- writable: true,
19
- value: void 0
20
- });
21
- Object.defineProperty(this, "UpdateType", {
22
- enumerable: true,
23
- configurable: true,
24
- writable: true,
25
- value: void 0
26
- });
27
- /** @ignore */
28
- Object.defineProperty(this, "lg_is_channel", {
29
- enumerable: true,
30
- configurable: true,
31
- writable: true,
32
- value: true
33
- });
34
- }
35
- /**
36
- * Mark the current value of the channel as consumed. By default, no-op.
37
- * A channel can use this method to modify its state, preventing the value
38
- * from being consumed again.
39
- *
40
- * Returns True if the channel was updated, False otherwise.
41
- */
42
- consume() {
43
- return false;
44
- }
45
- /**
46
- * Notify the channel that the Pregel run is finishing. By default, no-op.
47
- * A channel can use this method to modify its state, preventing finish.
48
- *
49
- * Returns True if the channel was updated, False otherwise.
50
- */
51
- finish() {
52
- return false;
53
- }
54
- /**
55
- * Return True if the channel is available (not empty), False otherwise.
56
- * Subclasses should override this method to provide a more efficient
57
- * implementation than calling get() and catching EmptyChannelError.
58
- */
59
- isAvailable() {
60
- try {
61
- this.get();
62
- return true;
63
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
64
- }
65
- catch (error) {
66
- if (error.name === errors_js_1.EmptyChannelError.unminifiable_name) {
67
- return false;
68
- }
69
- throw error;
70
- }
71
- }
7
+ return obj != null && obj.lg_is_channel === true;
72
8
  }
73
- exports.BaseChannel = BaseChannel;
9
+ var BaseChannel = class {
10
+ ValueType;
11
+ UpdateType;
12
+ /** @ignore */
13
+ lg_is_channel = true;
14
+ /**
15
+ * Mark the current value of the channel as consumed. By default, no-op.
16
+ * A channel can use this method to modify its state, preventing the value
17
+ * from being consumed again.
18
+ *
19
+ * Returns True if the channel was updated, False otherwise.
20
+ */
21
+ consume() {
22
+ return false;
23
+ }
24
+ /**
25
+ * Notify the channel that the Pregel run is finishing. By default, no-op.
26
+ * A channel can use this method to modify its state, preventing finish.
27
+ *
28
+ * Returns True if the channel was updated, False otherwise.
29
+ */
30
+ finish() {
31
+ return false;
32
+ }
33
+ /**
34
+ * Return True if the channel is available (not empty), False otherwise.
35
+ * Subclasses should override this method to provide a more efficient
36
+ * implementation than calling get() and catching EmptyChannelError.
37
+ */
38
+ isAvailable() {
39
+ try {
40
+ this.get();
41
+ return true;
42
+ } catch (error) {
43
+ if (error.name === require_errors.EmptyChannelError.unminifiable_name) return false;
44
+ throw error;
45
+ }
46
+ }
47
+ };
74
48
  const IS_ONLY_BASE_CHANNEL = Symbol.for("LG_IS_ONLY_BASE_CHANNEL");
75
49
  function getOnlyChannels(channels) {
76
- // @ts-expect-error - we know it's a record of base channels
77
- if (channels[IS_ONLY_BASE_CHANNEL] === true)
78
- return channels;
79
- const newChannels = {};
80
- for (const k in channels) {
81
- if (!Object.prototype.hasOwnProperty.call(channels, k))
82
- continue;
83
- const value = channels[k];
84
- if (isBaseChannel(value))
85
- newChannels[k] = value;
86
- }
87
- Object.assign(newChannels, { [IS_ONLY_BASE_CHANNEL]: true });
88
- return newChannels;
50
+ if (channels[IS_ONLY_BASE_CHANNEL] === true) return channels;
51
+ const newChannels = {};
52
+ for (const k in channels) {
53
+ if (!Object.prototype.hasOwnProperty.call(channels, k)) continue;
54
+ const value = channels[k];
55
+ if (isBaseChannel(value)) newChannels[k] = value;
56
+ }
57
+ Object.assign(newChannels, { [IS_ONLY_BASE_CHANNEL]: true });
58
+ return newChannels;
89
59
  }
90
60
  function emptyChannels(channels, checkpoint) {
91
- const filteredChannels = getOnlyChannels(channels);
92
- const newChannels = {};
93
- for (const k in filteredChannels) {
94
- if (!Object.prototype.hasOwnProperty.call(filteredChannels, k))
95
- continue;
96
- const channelValue = checkpoint.channel_values[k];
97
- newChannels[k] = filteredChannels[k].fromCheckpoint(channelValue);
98
- }
99
- Object.assign(newChannels, { [IS_ONLY_BASE_CHANNEL]: true });
100
- return newChannels;
61
+ const filteredChannels = getOnlyChannels(channels);
62
+ const newChannels = {};
63
+ for (const k in filteredChannels) {
64
+ if (!Object.prototype.hasOwnProperty.call(filteredChannels, k)) continue;
65
+ const channelValue = checkpoint.channel_values[k];
66
+ newChannels[k] = filteredChannels[k].fromCheckpoint(channelValue);
67
+ }
68
+ Object.assign(newChannels, { [IS_ONLY_BASE_CHANNEL]: true });
69
+ return newChannels;
101
70
  }
102
71
  function createCheckpoint(checkpoint, channels, step, options) {
103
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
104
- let values;
105
- if (channels === undefined) {
106
- values = checkpoint.channel_values;
107
- }
108
- else {
109
- values = {};
110
- for (const k in channels) {
111
- if (!Object.prototype.hasOwnProperty.call(channels, k))
112
- continue;
113
- try {
114
- values[k] = channels[k].checkpoint();
115
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
116
- }
117
- catch (error) {
118
- if (error.name === errors_js_1.EmptyChannelError.unminifiable_name) {
119
- // no-op
120
- }
121
- else {
122
- throw error; // Rethrow unexpected errors
123
- }
124
- }
125
- }
126
- }
127
- const newVersionsSeen = {};
128
- for (const k in checkpoint.versions_seen) {
129
- if (!Object.prototype.hasOwnProperty.call(checkpoint.versions_seen, k))
130
- continue;
131
- newVersionsSeen[k] = { ...checkpoint.versions_seen[k] };
132
- }
133
- return {
134
- v: 4,
135
- id: options?.id ?? (0, langgraph_checkpoint_1.uuid6)(step),
136
- ts: new Date().toISOString(),
137
- channel_values: values,
138
- channel_versions: { ...checkpoint.channel_versions },
139
- versions_seen: newVersionsSeen,
140
- };
72
+ let values;
73
+ if (channels === void 0) values = checkpoint.channel_values;
74
+ else {
75
+ values = {};
76
+ for (const k in channels) {
77
+ if (!Object.prototype.hasOwnProperty.call(channels, k)) continue;
78
+ try {
79
+ values[k] = channels[k].checkpoint();
80
+ } catch (error) {
81
+ if (error.name === require_errors.EmptyChannelError.unminifiable_name) {} else throw error;
82
+ }
83
+ }
84
+ }
85
+ const newVersionsSeen = {};
86
+ for (const k in checkpoint.versions_seen) {
87
+ if (!Object.prototype.hasOwnProperty.call(checkpoint.versions_seen, k)) continue;
88
+ newVersionsSeen[k] = { ...checkpoint.versions_seen[k] };
89
+ }
90
+ return {
91
+ v: 4,
92
+ id: options?.id ?? (0, __langchain_langgraph_checkpoint.uuid6)(step),
93
+ ts: (/* @__PURE__ */ new Date()).toISOString(),
94
+ channel_values: values,
95
+ channel_versions: { ...checkpoint.channel_versions },
96
+ versions_seen: newVersionsSeen
97
+ };
141
98
  }
142
- //# sourceMappingURL=base.js.map
99
+
100
+ //#endregion
101
+ exports.BaseChannel = BaseChannel;
102
+ exports.createCheckpoint = createCheckpoint;
103
+ exports.emptyChannels = emptyChannels;
104
+ exports.getOnlyChannels = getOnlyChannels;
105
+ exports.isBaseChannel = isBaseChannel;
106
+ //# sourceMappingURL=base.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.cjs","names":["error: any","EmptyChannelError","values: Record<string, any>"],"sources":["../../src/channels/base.ts"],"sourcesContent":["import {\n ReadonlyCheckpoint,\n uuid6,\n Checkpoint,\n} from \"@langchain/langgraph-checkpoint\";\nimport { EmptyChannelError } from \"../errors.js\";\n\nexport function isBaseChannel(obj: unknown): obj is BaseChannel {\n return obj != null && (obj as BaseChannel).lg_is_channel === true;\n}\n\nexport abstract class BaseChannel<\n ValueType = unknown,\n UpdateType = unknown,\n CheckpointType = unknown\n> {\n ValueType: ValueType;\n\n UpdateType: UpdateType;\n\n /**\n * The name of the channel.\n */\n abstract lc_graph_name: string;\n\n /** @ignore */\n lg_is_channel = true;\n\n /**\n * Return a new identical channel, optionally initialized from a checkpoint.\n * Can be thought of as a \"restoration\" from a checkpoint which is a \"snapshot\" of the channel's state.\n *\n * @param {CheckpointType | undefined} checkpoint\n * @param {CheckpointType | undefined} initialValue\n * @returns {this}\n */\n abstract fromCheckpoint(checkpoint?: CheckpointType): this;\n\n /**\n * Update the channel's value with the given sequence of updates.\n * The order of the updates in the sequence is arbitrary.\n * This method is called by Pregel for all channels at the end of each step.\n * If there are no updates, it is called with an empty sequence.\n *\n * Raises InvalidUpdateError if the sequence of updates is invalid.\n * Returns True if the channel was updated, False otherwise.\n *\n * @throws {InvalidUpdateError} if the sequence of updates is invalid.\n * @param {Array<UpdateType>} values\n * @returns {void}\n */\n abstract update(values: UpdateType[]): boolean;\n\n /**\n * Return the current value of the channel.\n *\n * @throws {EmptyChannelError} if the channel is empty (never updated yet).\n * @returns {ValueType}\n */\n abstract get(): ValueType;\n\n /**\n * Return a string representation of the channel's current state.\n *\n * @throws {EmptyChannelError} if the channel is empty (never updated yet), or doesn't support checkpoints.\n * @returns {CheckpointType | undefined}\n */\n abstract checkpoint(): CheckpointType | undefined;\n\n /**\n * Mark the current value of the channel as consumed. By default, no-op.\n * A channel can use this method to modify its state, preventing the value\n * from being consumed again.\n *\n * Returns True if the channel was updated, False otherwise.\n */\n consume(): boolean {\n return false;\n }\n\n /**\n * Notify the channel that the Pregel run is finishing. By default, no-op.\n * A channel can use this method to modify its state, preventing finish.\n *\n * Returns True if the channel was updated, False otherwise.\n */\n finish(): boolean {\n return false;\n }\n\n /**\n * Return True if the channel is available (not empty), False otherwise.\n * Subclasses should override this method to provide a more efficient\n * implementation than calling get() and catching EmptyChannelError.\n */\n isAvailable(): boolean {\n try {\n this.get();\n return true;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (error: any) {\n if (error.name === EmptyChannelError.unminifiable_name) {\n return false;\n }\n throw error;\n }\n }\n}\n\nconst IS_ONLY_BASE_CHANNEL = Symbol.for(\"LG_IS_ONLY_BASE_CHANNEL\");\nexport function getOnlyChannels(\n channels: Record<string, BaseChannel>\n): Record<string, BaseChannel> {\n // @ts-expect-error - we know it's a record of base channels\n if (channels[IS_ONLY_BASE_CHANNEL] === true) return channels;\n\n const newChannels = {} as Record<string, BaseChannel>;\n for (const k in channels) {\n if (!Object.prototype.hasOwnProperty.call(channels, k)) continue;\n const value = channels[k];\n if (isBaseChannel(value)) newChannels[k] = value;\n }\n\n Object.assign(newChannels, { [IS_ONLY_BASE_CHANNEL]: true });\n return newChannels;\n}\n\nexport function emptyChannels<Cc extends Record<string, BaseChannel>>(\n channels: Cc,\n checkpoint: ReadonlyCheckpoint\n): Cc {\n const filteredChannels = getOnlyChannels(channels) as Cc;\n\n const newChannels = {} as Cc;\n for (const k in filteredChannels) {\n if (!Object.prototype.hasOwnProperty.call(filteredChannels, k)) continue;\n const channelValue = checkpoint.channel_values[k];\n newChannels[k] = filteredChannels[k].fromCheckpoint(channelValue);\n }\n Object.assign(newChannels, { [IS_ONLY_BASE_CHANNEL]: true });\n return newChannels;\n}\n\nexport function createCheckpoint<ValueType>(\n checkpoint: ReadonlyCheckpoint,\n channels: Record<string, BaseChannel<ValueType>> | undefined,\n step: number,\n options?: { id?: string }\n): Checkpoint {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let values: Record<string, any>;\n if (channels === undefined) {\n values = checkpoint.channel_values;\n } else {\n values = {};\n for (const k in channels) {\n if (!Object.prototype.hasOwnProperty.call(channels, k)) continue;\n try {\n values[k] = channels[k].checkpoint();\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (error: any) {\n if (error.name === EmptyChannelError.unminifiable_name) {\n // no-op\n } else {\n throw error; // Rethrow unexpected errors\n }\n }\n }\n }\n\n const newVersionsSeen = {} as Record<string, Record<string, number | string>>;\n for (const k in checkpoint.versions_seen) {\n if (!Object.prototype.hasOwnProperty.call(checkpoint.versions_seen, k))\n continue;\n newVersionsSeen[k] = { ...checkpoint.versions_seen[k] };\n }\n\n return {\n v: 4,\n id: options?.id ?? uuid6(step),\n ts: new Date().toISOString(),\n channel_values: values,\n channel_versions: { ...checkpoint.channel_versions },\n versions_seen: newVersionsSeen,\n };\n}\n"],"mappings":";;;;;AAOA,SAAgB,cAAc,KAAkC;AAC9D,QAAO,OAAO,QAAS,IAAoB,kBAAkB;;AAG/D,IAAsB,cAAtB,MAIE;CACA;CAEA;;CAQA,gBAAgB;;;;;;;;CAkDhB,UAAmB;AACjB,SAAO;;;;;;;;CAST,SAAkB;AAChB,SAAO;;;;;;;CAQT,cAAuB;AACrB,MAAI;AACF,QAAK;AACL,UAAO;WAEAA,OAAY;AACnB,OAAI,MAAM,SAASC,iCAAkB,kBACnC,QAAO;AAET,SAAM;;;;AAKZ,MAAM,uBAAuB,OAAO,IAAI;AACxC,SAAgB,gBACd,UAC6B;AAE7B,KAAI,SAAS,0BAA0B,KAAM,QAAO;CAEpD,MAAM,cAAc;AACpB,MAAK,MAAM,KAAK,UAAU;AACxB,MAAI,CAAC,OAAO,UAAU,eAAe,KAAK,UAAU,GAAI;EACxD,MAAM,QAAQ,SAAS;AACvB,MAAI,cAAc,OAAQ,aAAY,KAAK;;AAG7C,QAAO,OAAO,aAAa,GAAG,uBAAuB;AACrD,QAAO;;AAGT,SAAgB,cACd,UACA,YACI;CACJ,MAAM,mBAAmB,gBAAgB;CAEzC,MAAM,cAAc;AACpB,MAAK,MAAM,KAAK,kBAAkB;AAChC,MAAI,CAAC,OAAO,UAAU,eAAe,KAAK,kBAAkB,GAAI;EAChE,MAAM,eAAe,WAAW,eAAe;AAC/C,cAAY,KAAK,iBAAiB,GAAG,eAAe;;AAEtD,QAAO,OAAO,aAAa,GAAG,uBAAuB;AACrD,QAAO;;AAGT,SAAgB,iBACd,YACA,UACA,MACA,SACY;CAEZ,IAAIC;AACJ,KAAI,aAAa,OACf,UAAS,WAAW;MACf;AACL,WAAS;AACT,OAAK,MAAM,KAAK,UAAU;AACxB,OAAI,CAAC,OAAO,UAAU,eAAe,KAAK,UAAU,GAAI;AACxD,OAAI;AACF,WAAO,KAAK,SAAS,GAAG;YAEjBF,OAAY;AACnB,QAAI,MAAM,SAASC,iCAAkB,mBAAmB,OAGtD,OAAM;;;;CAMd,MAAM,kBAAkB;AACxB,MAAK,MAAM,KAAK,WAAW,eAAe;AACxC,MAAI,CAAC,OAAO,UAAU,eAAe,KAAK,WAAW,eAAe,GAClE;AACF,kBAAgB,KAAK,EAAE,GAAG,WAAW,cAAc;;AAGrD,QAAO;EACL,GAAG;EACH,IAAI,SAAS,kDAAY;EACzB,qBAAI,IAAI,QAAO;EACf,gBAAgB;EAChB,kBAAkB,EAAE,GAAG,WAAW;EAClC,eAAe"}
@@ -0,0 +1,73 @@
1
+ //#region src/channels/base.d.ts
2
+
3
+ declare abstract class BaseChannel<ValueType = unknown, UpdateType = unknown, CheckpointType = unknown> {
4
+ ValueType: ValueType;
5
+ UpdateType: UpdateType;
6
+ /**
7
+ * The name of the channel.
8
+ */
9
+ abstract lc_graph_name: string;
10
+ /** @ignore */
11
+ lg_is_channel: boolean;
12
+ /**
13
+ * Return a new identical channel, optionally initialized from a checkpoint.
14
+ * Can be thought of as a "restoration" from a checkpoint which is a "snapshot" of the channel's state.
15
+ *
16
+ * @param {CheckpointType | undefined} checkpoint
17
+ * @param {CheckpointType | undefined} initialValue
18
+ * @returns {this}
19
+ */
20
+ abstract fromCheckpoint(checkpoint?: CheckpointType): this;
21
+ /**
22
+ * Update the channel's value with the given sequence of updates.
23
+ * The order of the updates in the sequence is arbitrary.
24
+ * This method is called by Pregel for all channels at the end of each step.
25
+ * If there are no updates, it is called with an empty sequence.
26
+ *
27
+ * Raises InvalidUpdateError if the sequence of updates is invalid.
28
+ * Returns True if the channel was updated, False otherwise.
29
+ *
30
+ * @throws {InvalidUpdateError} if the sequence of updates is invalid.
31
+ * @param {Array<UpdateType>} values
32
+ * @returns {void}
33
+ */
34
+ abstract update(values: UpdateType[]): boolean;
35
+ /**
36
+ * Return the current value of the channel.
37
+ *
38
+ * @throws {EmptyChannelError} if the channel is empty (never updated yet).
39
+ * @returns {ValueType}
40
+ */
41
+ abstract get(): ValueType;
42
+ /**
43
+ * Return a string representation of the channel's current state.
44
+ *
45
+ * @throws {EmptyChannelError} if the channel is empty (never updated yet), or doesn't support checkpoints.
46
+ * @returns {CheckpointType | undefined}
47
+ */
48
+ abstract checkpoint(): CheckpointType | undefined;
49
+ /**
50
+ * Mark the current value of the channel as consumed. By default, no-op.
51
+ * A channel can use this method to modify its state, preventing the value
52
+ * from being consumed again.
53
+ *
54
+ * Returns True if the channel was updated, False otherwise.
55
+ */
56
+ consume(): boolean;
57
+ /**
58
+ * Notify the channel that the Pregel run is finishing. By default, no-op.
59
+ * A channel can use this method to modify its state, preventing finish.
60
+ *
61
+ * Returns True if the channel was updated, False otherwise.
62
+ */
63
+ finish(): boolean;
64
+ /**
65
+ * Return True if the channel is available (not empty), False otherwise.
66
+ * Subclasses should override this method to provide a more efficient
67
+ * implementation than calling get() and catching EmptyChannelError.
68
+ */
69
+ isAvailable(): boolean;
70
+ }
71
+ //#endregion
72
+ export { BaseChannel };
73
+ //# sourceMappingURL=base.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.d.cts","names":["ReadonlyCheckpoint","Checkpoint","isBaseChannel","BaseChannel","ValueType","UpdateType","CheckpointType","getOnlyChannels","Record","emptyChannels","Cc","createCheckpoint"],"sources":["../../src/channels/base.d.ts"],"sourcesContent":["import { ReadonlyCheckpoint, Checkpoint } from \"@langchain/langgraph-checkpoint\";\nexport declare function isBaseChannel(obj: unknown): obj is BaseChannel;\nexport declare abstract class BaseChannel<ValueType = unknown, UpdateType = unknown, CheckpointType = unknown> {\n ValueType: ValueType;\n UpdateType: UpdateType;\n /**\n * The name of the channel.\n */\n abstract lc_graph_name: string;\n /** @ignore */\n lg_is_channel: boolean;\n /**\n * Return a new identical channel, optionally initialized from a checkpoint.\n * Can be thought of as a \"restoration\" from a checkpoint which is a \"snapshot\" of the channel's state.\n *\n * @param {CheckpointType | undefined} checkpoint\n * @param {CheckpointType | undefined} initialValue\n * @returns {this}\n */\n abstract fromCheckpoint(checkpoint?: CheckpointType): this;\n /**\n * Update the channel's value with the given sequence of updates.\n * The order of the updates in the sequence is arbitrary.\n * This method is called by Pregel for all channels at the end of each step.\n * If there are no updates, it is called with an empty sequence.\n *\n * Raises InvalidUpdateError if the sequence of updates is invalid.\n * Returns True if the channel was updated, False otherwise.\n *\n * @throws {InvalidUpdateError} if the sequence of updates is invalid.\n * @param {Array<UpdateType>} values\n * @returns {void}\n */\n abstract update(values: UpdateType[]): boolean;\n /**\n * Return the current value of the channel.\n *\n * @throws {EmptyChannelError} if the channel is empty (never updated yet).\n * @returns {ValueType}\n */\n abstract get(): ValueType;\n /**\n * Return a string representation of the channel's current state.\n *\n * @throws {EmptyChannelError} if the channel is empty (never updated yet), or doesn't support checkpoints.\n * @returns {CheckpointType | undefined}\n */\n abstract checkpoint(): CheckpointType | undefined;\n /**\n * Mark the current value of the channel as consumed. By default, no-op.\n * A channel can use this method to modify its state, preventing the value\n * from being consumed again.\n *\n * Returns True if the channel was updated, False otherwise.\n */\n consume(): boolean;\n /**\n * Notify the channel that the Pregel run is finishing. By default, no-op.\n * A channel can use this method to modify its state, preventing finish.\n *\n * Returns True if the channel was updated, False otherwise.\n */\n finish(): boolean;\n /**\n * Return True if the channel is available (not empty), False otherwise.\n * Subclasses should override this method to provide a more efficient\n * implementation than calling get() and catching EmptyChannelError.\n */\n isAvailable(): boolean;\n}\nexport declare function getOnlyChannels(channels: Record<string, BaseChannel>): Record<string, BaseChannel>;\nexport declare function emptyChannels<Cc extends Record<string, BaseChannel>>(channels: Cc, checkpoint: ReadonlyCheckpoint): Cc;\nexport declare function createCheckpoint<ValueType>(checkpoint: ReadonlyCheckpoint, channels: Record<string, BaseChannel<ValueType>> | undefined, step: number, options?: {\n id?: string;\n}): Checkpoint;\n"],"mappings":";;AAEyC,uBAAXG,WAAW,CAAA,YAAA,OAAA,EAAA,aAAA,OAAA,EAAA,iBAAA,OAAA,CAAA,CAAA;WAC1BC,EAAAA,SAAAA;YACCC,EAAAA,UAAAA;;;;WA2CWC,aAAAA,EAAAA,MAAAA;;;;;;;;;;;uCA5BcA;;;;;;;;;;;;;;0BAcbD;;;;;;;kBAORD;;;;;;;yBAOOE"}
@@ -1,75 +1,74 @@
1
- import { ReadonlyCheckpoint, Checkpoint } from "@langchain/langgraph-checkpoint";
2
- export declare function isBaseChannel(obj: unknown): obj is BaseChannel;
3
- export declare abstract class BaseChannel<ValueType = unknown, UpdateType = unknown, CheckpointType = unknown> {
4
- ValueType: ValueType;
5
- UpdateType: UpdateType;
6
- /**
7
- * The name of the channel.
8
- */
9
- abstract lc_graph_name: string;
10
- /** @ignore */
11
- lg_is_channel: boolean;
12
- /**
13
- * Return a new identical channel, optionally initialized from a checkpoint.
14
- * Can be thought of as a "restoration" from a checkpoint which is a "snapshot" of the channel's state.
15
- *
16
- * @param {CheckpointType | undefined} checkpoint
17
- * @param {CheckpointType | undefined} initialValue
18
- * @returns {this}
19
- */
20
- abstract fromCheckpoint(checkpoint?: CheckpointType): this;
21
- /**
22
- * Update the channel's value with the given sequence of updates.
23
- * The order of the updates in the sequence is arbitrary.
24
- * This method is called by Pregel for all channels at the end of each step.
25
- * If there are no updates, it is called with an empty sequence.
26
- *
27
- * Raises InvalidUpdateError if the sequence of updates is invalid.
28
- * Returns True if the channel was updated, False otherwise.
29
- *
30
- * @throws {InvalidUpdateError} if the sequence of updates is invalid.
31
- * @param {Array<UpdateType>} values
32
- * @returns {void}
33
- */
34
- abstract update(values: UpdateType[]): boolean;
35
- /**
36
- * Return the current value of the channel.
37
- *
38
- * @throws {EmptyChannelError} if the channel is empty (never updated yet).
39
- * @returns {ValueType}
40
- */
41
- abstract get(): ValueType;
42
- /**
43
- * Return a string representation of the channel's current state.
44
- *
45
- * @throws {EmptyChannelError} if the channel is empty (never updated yet), or doesn't support checkpoints.
46
- * @returns {CheckpointType | undefined}
47
- */
48
- abstract checkpoint(): CheckpointType | undefined;
49
- /**
50
- * Mark the current value of the channel as consumed. By default, no-op.
51
- * A channel can use this method to modify its state, preventing the value
52
- * from being consumed again.
53
- *
54
- * Returns True if the channel was updated, False otherwise.
55
- */
56
- consume(): boolean;
57
- /**
58
- * Notify the channel that the Pregel run is finishing. By default, no-op.
59
- * A channel can use this method to modify its state, preventing finish.
60
- *
61
- * Returns True if the channel was updated, False otherwise.
62
- */
63
- finish(): boolean;
64
- /**
65
- * Return True if the channel is available (not empty), False otherwise.
66
- * Subclasses should override this method to provide a more efficient
67
- * implementation than calling get() and catching EmptyChannelError.
68
- */
69
- isAvailable(): boolean;
1
+ import "@langchain/langgraph-checkpoint";
2
+
3
+ //#region src/channels/base.d.ts
4
+ declare abstract class BaseChannel<ValueType = unknown, UpdateType = unknown, CheckpointType = unknown> {
5
+ ValueType: ValueType;
6
+ UpdateType: UpdateType;
7
+ /**
8
+ * The name of the channel.
9
+ */
10
+ abstract lc_graph_name: string;
11
+ /** @ignore */
12
+ lg_is_channel: boolean;
13
+ /**
14
+ * Return a new identical channel, optionally initialized from a checkpoint.
15
+ * Can be thought of as a "restoration" from a checkpoint which is a "snapshot" of the channel's state.
16
+ *
17
+ * @param {CheckpointType | undefined} checkpoint
18
+ * @param {CheckpointType | undefined} initialValue
19
+ * @returns {this}
20
+ */
21
+ abstract fromCheckpoint(checkpoint?: CheckpointType): this;
22
+ /**
23
+ * Update the channel's value with the given sequence of updates.
24
+ * The order of the updates in the sequence is arbitrary.
25
+ * This method is called by Pregel for all channels at the end of each step.
26
+ * If there are no updates, it is called with an empty sequence.
27
+ *
28
+ * Raises InvalidUpdateError if the sequence of updates is invalid.
29
+ * Returns True if the channel was updated, False otherwise.
30
+ *
31
+ * @throws {InvalidUpdateError} if the sequence of updates is invalid.
32
+ * @param {Array<UpdateType>} values
33
+ * @returns {void}
34
+ */
35
+ abstract update(values: UpdateType[]): boolean;
36
+ /**
37
+ * Return the current value of the channel.
38
+ *
39
+ * @throws {EmptyChannelError} if the channel is empty (never updated yet).
40
+ * @returns {ValueType}
41
+ */
42
+ abstract get(): ValueType;
43
+ /**
44
+ * Return a string representation of the channel's current state.
45
+ *
46
+ * @throws {EmptyChannelError} if the channel is empty (never updated yet), or doesn't support checkpoints.
47
+ * @returns {CheckpointType | undefined}
48
+ */
49
+ abstract checkpoint(): CheckpointType | undefined;
50
+ /**
51
+ * Mark the current value of the channel as consumed. By default, no-op.
52
+ * A channel can use this method to modify its state, preventing the value
53
+ * from being consumed again.
54
+ *
55
+ * Returns True if the channel was updated, False otherwise.
56
+ */
57
+ consume(): boolean;
58
+ /**
59
+ * Notify the channel that the Pregel run is finishing. By default, no-op.
60
+ * A channel can use this method to modify its state, preventing finish.
61
+ *
62
+ * Returns True if the channel was updated, False otherwise.
63
+ */
64
+ finish(): boolean;
65
+ /**
66
+ * Return True if the channel is available (not empty), False otherwise.
67
+ * Subclasses should override this method to provide a more efficient
68
+ * implementation than calling get() and catching EmptyChannelError.
69
+ */
70
+ isAvailable(): boolean;
70
71
  }
71
- export declare function getOnlyChannels(channels: Record<string, BaseChannel>): Record<string, BaseChannel>;
72
- export declare function emptyChannels<Cc extends Record<string, BaseChannel>>(channels: Cc, checkpoint: ReadonlyCheckpoint): Cc;
73
- export declare function createCheckpoint<ValueType>(checkpoint: ReadonlyCheckpoint, channels: Record<string, BaseChannel<ValueType>> | undefined, step: number, options?: {
74
- id?: string;
75
- }): Checkpoint;
72
+ //#endregion
73
+ export { BaseChannel };
74
+ //# sourceMappingURL=base.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.d.ts","names":["ReadonlyCheckpoint","Checkpoint","isBaseChannel","BaseChannel","ValueType","UpdateType","CheckpointType","getOnlyChannels","Record","emptyChannels","Cc","createCheckpoint"],"sources":["../../src/channels/base.d.ts"],"sourcesContent":["import { ReadonlyCheckpoint, Checkpoint } from \"@langchain/langgraph-checkpoint\";\nexport declare function isBaseChannel(obj: unknown): obj is BaseChannel;\nexport declare abstract class BaseChannel<ValueType = unknown, UpdateType = unknown, CheckpointType = unknown> {\n ValueType: ValueType;\n UpdateType: UpdateType;\n /**\n * The name of the channel.\n */\n abstract lc_graph_name: string;\n /** @ignore */\n lg_is_channel: boolean;\n /**\n * Return a new identical channel, optionally initialized from a checkpoint.\n * Can be thought of as a \"restoration\" from a checkpoint which is a \"snapshot\" of the channel's state.\n *\n * @param {CheckpointType | undefined} checkpoint\n * @param {CheckpointType | undefined} initialValue\n * @returns {this}\n */\n abstract fromCheckpoint(checkpoint?: CheckpointType): this;\n /**\n * Update the channel's value with the given sequence of updates.\n * The order of the updates in the sequence is arbitrary.\n * This method is called by Pregel for all channels at the end of each step.\n * If there are no updates, it is called with an empty sequence.\n *\n * Raises InvalidUpdateError if the sequence of updates is invalid.\n * Returns True if the channel was updated, False otherwise.\n *\n * @throws {InvalidUpdateError} if the sequence of updates is invalid.\n * @param {Array<UpdateType>} values\n * @returns {void}\n */\n abstract update(values: UpdateType[]): boolean;\n /**\n * Return the current value of the channel.\n *\n * @throws {EmptyChannelError} if the channel is empty (never updated yet).\n * @returns {ValueType}\n */\n abstract get(): ValueType;\n /**\n * Return a string representation of the channel's current state.\n *\n * @throws {EmptyChannelError} if the channel is empty (never updated yet), or doesn't support checkpoints.\n * @returns {CheckpointType | undefined}\n */\n abstract checkpoint(): CheckpointType | undefined;\n /**\n * Mark the current value of the channel as consumed. By default, no-op.\n * A channel can use this method to modify its state, preventing the value\n * from being consumed again.\n *\n * Returns True if the channel was updated, False otherwise.\n */\n consume(): boolean;\n /**\n * Notify the channel that the Pregel run is finishing. By default, no-op.\n * A channel can use this method to modify its state, preventing finish.\n *\n * Returns True if the channel was updated, False otherwise.\n */\n finish(): boolean;\n /**\n * Return True if the channel is available (not empty), False otherwise.\n * Subclasses should override this method to provide a more efficient\n * implementation than calling get() and catching EmptyChannelError.\n */\n isAvailable(): boolean;\n}\nexport declare function getOnlyChannels(channels: Record<string, BaseChannel>): Record<string, BaseChannel>;\nexport declare function emptyChannels<Cc extends Record<string, BaseChannel>>(channels: Cc, checkpoint: ReadonlyCheckpoint): Cc;\nexport declare function createCheckpoint<ValueType>(checkpoint: ReadonlyCheckpoint, channels: Record<string, BaseChannel<ValueType>> | undefined, step: number, options?: {\n id?: string;\n}): Checkpoint;\n"],"mappings":";;;uBAE8BG;EAAAA,SAAAA,EACfC,SAD0B;EAAA,UAAA,EAEzBC,UAFyB;;;;WA+BbA,aAAAA,EAAAA,MAAAA;;eAcDC,EAAAA,OAAAA;;;;;;;;;uCA5BcA;;;;;;;;;;;;;;0BAcbD;;;;;;;kBAORD;;;;;;;yBAOOE"}