@langchain/langgraph 0.4.7 → 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 +11 -0
  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 +77 -80
  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,67 +1,51 @@
1
- import { Callbacks } from "@langchain/core/callbacks/manager";
1
+ import { CheckpointMetadata } from "@langchain/langgraph-checkpoint";
2
2
  import { RunnableConfig } from "@langchain/core/runnables";
3
- import type { ChannelVersions, CheckpointMetadata } from "@langchain/langgraph-checkpoint";
4
- export declare function getNullChannelVersion(currentVersions: ChannelVersions): 0 | "" | undefined;
5
- export declare function getNewChannelVersions(previousVersions: ChannelVersions, currentVersions: ChannelVersions): ChannelVersions;
6
- export declare function _coerceToDict(value: any, defaultKey: string): any;
7
- export type RetryPolicy = {
8
- /**
9
- * Amount of time that must elapse before the first retry occurs in milliseconds.
10
- * @default 500
11
- */
12
- initialInterval?: number;
13
- /**
14
- * Multiplier by which the interval increases after each retry.
15
- * @default 2
16
- */
17
- backoffFactor?: number;
18
- /**
19
- * Maximum amount of time that may elapse between retries in milliseconds.
20
- * @default 128000
21
- */
22
- maxInterval?: number;
23
- /**
24
- * Maximum amount of time that may elapse between retries.
25
- * @default 3
26
- */
27
- maxAttempts?: number;
28
- /** Whether to add random jitter to the interval between retries. */
29
- jitter?: boolean;
30
- /** A function that returns True for exceptions that should trigger a retry. */
31
- retryOn?: (e: any) => boolean;
32
- /** Whether to log a warning when a retry is attempted. Defaults to true. */
33
- logWarning?: boolean;
3
+
4
+ //#region src/pregel/utils/index.d.ts
5
+
6
+ type RetryPolicy = {
7
+ /**
8
+ * Amount of time that must elapse before the first retry occurs in milliseconds.
9
+ * @default 500
10
+ */
11
+ initialInterval?: number;
12
+ /**
13
+ * Multiplier by which the interval increases after each retry.
14
+ * @default 2
15
+ */
16
+ backoffFactor?: number;
17
+ /**
18
+ * Maximum amount of time that may elapse between retries in milliseconds.
19
+ * @default 128000
20
+ */
21
+ maxInterval?: number;
22
+ /**
23
+ * Maximum amount of time that may elapse between retries.
24
+ * @default 3
25
+ */
26
+ maxAttempts?: number;
27
+ /** Whether to add random jitter to the interval between retries. */
28
+ jitter?: boolean;
29
+ /** A function that returns True for exceptions that should trigger a retry. */
30
+ retryOn?: (e: any) => boolean; // eslint-disable-line @typescript-eslint/no-explicit-any
31
+ /** Whether to log a warning when a retry is attempted. Defaults to true. */
32
+ logWarning?: boolean;
34
33
  };
35
34
  /**
36
35
  * Configuration for caching nodes.
37
36
  */
38
- export type CachePolicy = {
39
- /**
40
- * A function used to generate a cache key from node's input.
41
- * @returns A key for the cache.
42
- */
43
- keyFunc?: (args: unknown[]) => string;
44
- /**
45
- * The time to live for the cache in seconds.
46
- * If not defined, the entry will never expire.
47
- */
48
- ttl?: number;
37
+ type CachePolicy = {
38
+ /**
39
+ * A function used to generate a cache key from node's input.
40
+ * @returns A key for the cache.
41
+ */
42
+ keyFunc?: (args: unknown[]) => string;
43
+ /**
44
+ * The time to live for the cache in seconds.
45
+ * If not defined, the entry will never expire.
46
+ */
47
+ ttl?: number;
49
48
  };
50
- export declare function patchConfigurable(config: RunnableConfig | undefined, patch: Record<string, any>): RunnableConfig;
51
- export declare function patchCheckpointMap(config: RunnableConfig, metadata?: CheckpointMetadata): RunnableConfig;
52
- /**
53
- * Combine multiple abort signals into a single abort signal.
54
- * @param signals - The abort signals to combine.
55
- * @returns A combined abort signal and a dispose function to remove the abort listener if unused.
56
- */
57
- export declare function combineAbortSignals(...x: (AbortSignal | undefined)[]): {
58
- signal: AbortSignal | undefined;
59
- dispose?: () => void;
60
- };
61
- /**
62
- * Combine multiple callbacks into a single callback.
63
- * @param callback1 - The first callback to combine.
64
- * @param callback2 - The second callback to combine.
65
- * @returns A single callback that is a combination of the input callbacks.
66
- */
67
- export declare const combineCallbacks: (callback1?: Callbacks, callback2?: Callbacks) => Callbacks | undefined;
49
+ //#endregion
50
+ export { CachePolicy, RetryPolicy };
51
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":["Callbacks","RunnableConfig","ChannelVersions","CheckpointMetadata","getNullChannelVersion","getNewChannelVersions","_coerceToDict","RetryPolicy","CachePolicy","patchConfigurable","Record","patchCheckpointMap","combineAbortSignals","AbortSignal","combineCallbacks"],"sources":["../../../src/pregel/utils/index.d.ts"],"sourcesContent":["import { Callbacks } from \"@langchain/core/callbacks/manager\";\nimport { RunnableConfig } from \"@langchain/core/runnables\";\nimport type { ChannelVersions, CheckpointMetadata } from \"@langchain/langgraph-checkpoint\";\nexport declare function getNullChannelVersion(currentVersions: ChannelVersions): \"\" | 0 | undefined;\nexport declare function getNewChannelVersions(previousVersions: ChannelVersions, currentVersions: ChannelVersions): ChannelVersions;\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport declare function _coerceToDict(value: any, defaultKey: string): any;\nexport type RetryPolicy = {\n /**\n * Amount of time that must elapse before the first retry occurs in milliseconds.\n * @default 500\n */\n initialInterval?: number;\n /**\n * Multiplier by which the interval increases after each retry.\n * @default 2\n */\n backoffFactor?: number;\n /**\n * Maximum amount of time that may elapse between retries in milliseconds.\n * @default 128000\n */\n maxInterval?: number;\n /**\n * Maximum amount of time that may elapse between retries.\n * @default 3\n */\n maxAttempts?: number;\n /** Whether to add random jitter to the interval between retries. */\n jitter?: boolean;\n /** A function that returns True for exceptions that should trigger a retry. */\n retryOn?: (e: any) => boolean; // eslint-disable-line @typescript-eslint/no-explicit-any\n /** Whether to log a warning when a retry is attempted. Defaults to true. */\n logWarning?: boolean;\n};\n/**\n * Configuration for caching nodes.\n */\nexport type CachePolicy = {\n /**\n * A function used to generate a cache key from node's input.\n * @returns A key for the cache.\n */\n keyFunc?: (args: unknown[]) => string;\n /**\n * The time to live for the cache in seconds.\n * If not defined, the entry will never expire.\n */\n ttl?: number;\n};\nexport declare function patchConfigurable(config: RunnableConfig | undefined, \n// eslint-disable-next-line @typescript-eslint/no-explicit-any\npatch: Record<string, any>): RunnableConfig;\nexport declare function patchCheckpointMap(config: RunnableConfig, metadata?: CheckpointMetadata): RunnableConfig;\n/**\n * Combine multiple abort signals into a single abort signal.\n * @param signals - The abort signals to combine.\n * @returns A combined abort signal and a dispose function to remove the abort listener if unused.\n */\nexport declare function combineAbortSignals(...x: (AbortSignal | undefined)[]): {\n signal: AbortSignal | undefined;\n dispose?: () => void;\n};\n/**\n * Combine multiple callbacks into a single callback.\n * @param callback1 - The first callback to combine.\n * @param callback2 - The second callback to combine.\n * @returns A single callback that is a combination of the input callbacks.\n */\nexport declare const combineCallbacks: (callback1?: Callbacks | undefined, callback2?: Callbacks | undefined) => Callbacks | undefined;\n"],"mappings":";;;;;KAOYO,WAAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA+BAC,WAAAA"}
@@ -1,131 +1,97 @@
1
1
  import { CONFIG_KEY_CHECKPOINT_MAP, START } from "../../constants.js";
2
- export function getNullChannelVersion(currentVersions) {
3
- // Short circuit for commonly used channels such as __start__
4
- // (used by StateGraph)
5
- const startVersion = typeof currentVersions[START];
6
- if (startVersion === "number")
7
- return 0;
8
- if (startVersion === "string")
9
- return "";
10
- // Defer back to obtaining a first key from channel versions
11
- for (const key in currentVersions) {
12
- if (!Object.prototype.hasOwnProperty.call(currentVersions, key))
13
- continue;
14
- const versionType = typeof currentVersions[key];
15
- if (versionType === "number")
16
- return 0;
17
- if (versionType === "string")
18
- return "";
19
- break;
20
- }
21
- return undefined;
2
+
3
+ //#region src/pregel/utils/index.ts
4
+ function getNullChannelVersion(currentVersions) {
5
+ const startVersion = typeof currentVersions[START];
6
+ if (startVersion === "number") return 0;
7
+ if (startVersion === "string") return "";
8
+ for (const key in currentVersions) {
9
+ if (!Object.prototype.hasOwnProperty.call(currentVersions, key)) continue;
10
+ const versionType = typeof currentVersions[key];
11
+ if (versionType === "number") return 0;
12
+ if (versionType === "string") return "";
13
+ break;
14
+ }
15
+ return void 0;
22
16
  }
23
- export function getNewChannelVersions(previousVersions, currentVersions) {
24
- // Get new channel versions
25
- if (Object.keys(previousVersions).length > 0) {
26
- const nullVersion = getNullChannelVersion(currentVersions);
27
- return Object.fromEntries(Object.entries(currentVersions).filter(([k, v]) => v > (previousVersions[k] ?? nullVersion)));
28
- }
29
- else {
30
- return currentVersions;
31
- }
17
+ function getNewChannelVersions(previousVersions, currentVersions) {
18
+ if (Object.keys(previousVersions).length > 0) {
19
+ const nullVersion = getNullChannelVersion(currentVersions);
20
+ return Object.fromEntries(Object.entries(currentVersions).filter(([k, v]) => v > (previousVersions[k] ?? nullVersion)));
21
+ } else return currentVersions;
32
22
  }
33
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
34
- export function _coerceToDict(value, defaultKey) {
35
- return value &&
36
- !Array.isArray(value) &&
37
- // eslint-disable-next-line no-instanceof/no-instanceof
38
- !(value instanceof Date) &&
39
- typeof value === "object"
40
- ? value
41
- : { [defaultKey]: value };
23
+ function _coerceToDict(value, defaultKey) {
24
+ return value && !Array.isArray(value) && !(value instanceof Date) && typeof value === "object" ? value : { [defaultKey]: value };
42
25
  }
43
- export function patchConfigurable(config,
44
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
45
- patch) {
46
- if (config === null) {
47
- return { configurable: patch };
48
- }
49
- else if (config?.configurable === undefined) {
50
- return { ...config, configurable: patch };
51
- }
52
- else {
53
- return {
54
- ...config,
55
- configurable: { ...config.configurable, ...patch },
56
- };
57
- }
26
+ function patchConfigurable(config, patch) {
27
+ if (config === null) return { configurable: patch };
28
+ else if (config?.configurable === void 0) return {
29
+ ...config,
30
+ configurable: patch
31
+ };
32
+ else return {
33
+ ...config,
34
+ configurable: {
35
+ ...config.configurable,
36
+ ...patch
37
+ }
38
+ };
58
39
  }
59
- export function patchCheckpointMap(config, metadata) {
60
- const parents = metadata?.parents ?? {};
61
- if (Object.keys(parents).length > 0) {
62
- return patchConfigurable(config, {
63
- [CONFIG_KEY_CHECKPOINT_MAP]: {
64
- ...parents,
65
- [config.configurable?.checkpoint_ns ?? ""]: config.configurable?.checkpoint_id,
66
- },
67
- });
68
- }
69
- else {
70
- return config;
71
- }
40
+ function patchCheckpointMap(config, metadata) {
41
+ const parents = metadata?.parents ?? {};
42
+ if (Object.keys(parents).length > 0) return patchConfigurable(config, { [CONFIG_KEY_CHECKPOINT_MAP]: {
43
+ ...parents,
44
+ [config.configurable?.checkpoint_ns ?? ""]: config.configurable?.checkpoint_id
45
+ } });
46
+ else return config;
72
47
  }
73
48
  /**
74
- * Combine multiple abort signals into a single abort signal.
75
- * @param signals - The abort signals to combine.
76
- * @returns A combined abort signal and a dispose function to remove the abort listener if unused.
77
- */
78
- export function combineAbortSignals(...x) {
79
- const signals = [...new Set(x.filter(Boolean))];
80
- if (signals.length === 0) {
81
- return { signal: undefined, dispose: undefined };
82
- }
83
- if (signals.length === 1) {
84
- return { signal: signals[0], dispose: undefined };
85
- }
86
- const combinedController = new AbortController();
87
- const listener = () => {
88
- const reason = signals.find((s) => s.aborted)?.reason;
89
- combinedController.abort(reason);
90
- signals.forEach((s) => s.removeEventListener("abort", listener));
91
- };
92
- signals.forEach((s) => s.addEventListener("abort", listener, { once: true }));
93
- const hasAlreadyAbortedSignal = signals.find((s) => s.aborted);
94
- if (hasAlreadyAbortedSignal) {
95
- combinedController.abort(hasAlreadyAbortedSignal.reason);
96
- }
97
- return {
98
- signal: combinedController.signal,
99
- dispose: () => {
100
- signals.forEach((s) => s.removeEventListener("abort", listener));
101
- },
102
- };
49
+ * Combine multiple abort signals into a single abort signal.
50
+ * @param signals - The abort signals to combine.
51
+ * @returns A combined abort signal and a dispose function to remove the abort listener if unused.
52
+ */
53
+ function combineAbortSignals(...x) {
54
+ const signals = [...new Set(x.filter(Boolean))];
55
+ if (signals.length === 0) return {
56
+ signal: void 0,
57
+ dispose: void 0
58
+ };
59
+ if (signals.length === 1) return {
60
+ signal: signals[0],
61
+ dispose: void 0
62
+ };
63
+ const combinedController = new AbortController();
64
+ const listener = () => {
65
+ const reason = signals.find((s) => s.aborted)?.reason;
66
+ combinedController.abort(reason);
67
+ signals.forEach((s) => s.removeEventListener("abort", listener));
68
+ };
69
+ signals.forEach((s) => s.addEventListener("abort", listener, { once: true }));
70
+ const hasAlreadyAbortedSignal = signals.find((s) => s.aborted);
71
+ if (hasAlreadyAbortedSignal) combinedController.abort(hasAlreadyAbortedSignal.reason);
72
+ return {
73
+ signal: combinedController.signal,
74
+ dispose: () => {
75
+ signals.forEach((s) => s.removeEventListener("abort", listener));
76
+ }
77
+ };
103
78
  }
104
79
  /**
105
- * Combine multiple callbacks into a single callback.
106
- * @param callback1 - The first callback to combine.
107
- * @param callback2 - The second callback to combine.
108
- * @returns A single callback that is a combination of the input callbacks.
109
- */
110
- export const combineCallbacks = (callback1, callback2) => {
111
- if (!callback1 && !callback2) {
112
- return undefined;
113
- }
114
- if (!callback1) {
115
- return callback2;
116
- }
117
- if (!callback2) {
118
- return callback1;
119
- }
120
- if (Array.isArray(callback1) && Array.isArray(callback2)) {
121
- return [...callback1, ...callback2];
122
- }
123
- if (Array.isArray(callback1)) {
124
- return [...callback1, callback2];
125
- }
126
- if (Array.isArray(callback2)) {
127
- return [callback1, ...callback2];
128
- }
129
- return [callback1, callback2];
80
+ * Combine multiple callbacks into a single callback.
81
+ * @param callback1 - The first callback to combine.
82
+ * @param callback2 - The second callback to combine.
83
+ * @returns A single callback that is a combination of the input callbacks.
84
+ */
85
+ const combineCallbacks = (callback1, callback2) => {
86
+ if (!callback1 && !callback2) return void 0;
87
+ if (!callback1) return callback2;
88
+ if (!callback2) return callback1;
89
+ if (Array.isArray(callback1) && Array.isArray(callback2)) return [...callback1, ...callback2];
90
+ if (Array.isArray(callback1)) return [...callback1, callback2];
91
+ if (Array.isArray(callback2)) return [callback1, ...callback2];
92
+ return [callback1, callback2];
130
93
  };
94
+
95
+ //#endregion
96
+ export { _coerceToDict, combineAbortSignals, combineCallbacks, getNewChannelVersions, getNullChannelVersion, patchCheckpointMap, patchConfigurable };
131
97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"],"sourcesContent":["import { Callbacks } from \"@langchain/core/callbacks/manager\";\nimport { RunnableConfig } from \"@langchain/core/runnables\";\nimport type {\n ChannelVersions,\n CheckpointMetadata,\n} from \"@langchain/langgraph-checkpoint\";\nimport { CONFIG_KEY_CHECKPOINT_MAP, START } from \"../../constants.js\";\n\nexport function getNullChannelVersion(currentVersions: ChannelVersions) {\n // Short circuit for commonly used channels such as __start__\n // (used by StateGraph)\n const startVersion = typeof currentVersions[START];\n if (startVersion === \"number\") return 0;\n if (startVersion === \"string\") return \"\";\n\n // Defer back to obtaining a first key from channel versions\n for (const key in currentVersions) {\n if (!Object.prototype.hasOwnProperty.call(currentVersions, key)) continue;\n const versionType = typeof currentVersions[key];\n if (versionType === \"number\") return 0;\n if (versionType === \"string\") return \"\";\n break;\n }\n\n return undefined;\n}\n\nexport function getNewChannelVersions(\n previousVersions: ChannelVersions,\n currentVersions: ChannelVersions\n): ChannelVersions {\n // Get new channel versions\n if (Object.keys(previousVersions).length > 0) {\n const nullVersion = getNullChannelVersion(currentVersions);\n return Object.fromEntries(\n Object.entries(currentVersions).filter(\n ([k, v]) => v > (previousVersions[k] ?? nullVersion)\n )\n );\n } else {\n return currentVersions;\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function _coerceToDict(value: any, defaultKey: string) {\n return value &&\n !Array.isArray(value) &&\n // eslint-disable-next-line no-instanceof/no-instanceof\n !(value instanceof Date) &&\n typeof value === \"object\"\n ? value\n : { [defaultKey]: value };\n}\n\nexport type RetryPolicy = {\n /**\n * Amount of time that must elapse before the first retry occurs in milliseconds.\n * @default 500\n */\n initialInterval?: number;\n\n /**\n * Multiplier by which the interval increases after each retry.\n * @default 2\n */\n backoffFactor?: number;\n\n /**\n * Maximum amount of time that may elapse between retries in milliseconds.\n * @default 128000\n */\n maxInterval?: number;\n\n /**\n * Maximum amount of time that may elapse between retries.\n * @default 3\n */\n maxAttempts?: number;\n\n /** Whether to add random jitter to the interval between retries. */\n jitter?: boolean;\n\n /** A function that returns True for exceptions that should trigger a retry. */\n retryOn?: (e: any) => boolean; // eslint-disable-line @typescript-eslint/no-explicit-any\n\n /** Whether to log a warning when a retry is attempted. Defaults to true. */\n logWarning?: boolean;\n};\n\n/**\n * Configuration for caching nodes.\n */\nexport type CachePolicy = {\n /**\n * A function used to generate a cache key from node's input.\n * @returns A key for the cache.\n */\n keyFunc?: (args: unknown[]) => string;\n\n /**\n * The time to live for the cache in seconds.\n * If not defined, the entry will never expire.\n */\n ttl?: number;\n};\n\nexport function patchConfigurable(\n config: RunnableConfig | undefined,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n patch: Record<string, any>\n): RunnableConfig {\n if (config === null) {\n return { configurable: patch };\n } else if (config?.configurable === undefined) {\n return { ...config, configurable: patch };\n } else {\n return {\n ...config,\n configurable: { ...config.configurable, ...patch },\n };\n }\n}\n\nexport function patchCheckpointMap(\n config: RunnableConfig,\n metadata?: CheckpointMetadata\n): RunnableConfig {\n const parents = metadata?.parents ?? {};\n\n if (Object.keys(parents).length > 0) {\n return patchConfigurable(config, {\n [CONFIG_KEY_CHECKPOINT_MAP]: {\n ...parents,\n [config.configurable?.checkpoint_ns ?? \"\"]:\n config.configurable?.checkpoint_id,\n },\n });\n } else {\n return config;\n }\n}\n\n/**\n * Combine multiple abort signals into a single abort signal.\n * @param signals - The abort signals to combine.\n * @returns A combined abort signal and a dispose function to remove the abort listener if unused.\n */\nexport function combineAbortSignals(...x: (AbortSignal | undefined)[]): {\n signal: AbortSignal | undefined;\n dispose?: () => void;\n} {\n const signals = [...new Set(x.filter(Boolean))] as AbortSignal[];\n\n if (signals.length === 0) {\n return { signal: undefined, dispose: undefined };\n }\n\n if (signals.length === 1) {\n return { signal: signals[0], dispose: undefined };\n }\n\n const combinedController = new AbortController();\n const listener = () => {\n const reason = signals.find((s) => s.aborted)?.reason;\n combinedController.abort(reason);\n signals.forEach((s) => s.removeEventListener(\"abort\", listener));\n };\n\n signals.forEach((s) => s.addEventListener(\"abort\", listener, { once: true }));\n\n const hasAlreadyAbortedSignal = signals.find((s) => s.aborted);\n if (hasAlreadyAbortedSignal) {\n combinedController.abort(hasAlreadyAbortedSignal.reason);\n }\n\n return {\n signal: combinedController.signal,\n dispose: () => {\n signals.forEach((s) => s.removeEventListener(\"abort\", listener));\n },\n };\n}\n\n/**\n * Combine multiple callbacks into a single callback.\n * @param callback1 - The first callback to combine.\n * @param callback2 - The second callback to combine.\n * @returns A single callback that is a combination of the input callbacks.\n */\nexport const combineCallbacks = (\n callback1?: Callbacks,\n callback2?: Callbacks\n): Callbacks | undefined => {\n if (!callback1 && !callback2) {\n return undefined;\n }\n\n if (!callback1) {\n return callback2;\n }\n\n if (!callback2) {\n return callback1;\n }\n if (Array.isArray(callback1) && Array.isArray(callback2)) {\n return [...callback1, ...callback2];\n }\n if (Array.isArray(callback1)) {\n return [...callback1, callback2] as Callbacks;\n }\n if (Array.isArray(callback2)) {\n return [callback1, ...callback2];\n }\n return [callback1, callback2] as Callbacks;\n};\n"],"mappings":";;;AAQA,SAAgB,sBAAsB,iBAAkC;CAGtE,MAAM,eAAe,OAAO,gBAAgB;AAC5C,KAAI,iBAAiB,SAAU,QAAO;AACtC,KAAI,iBAAiB,SAAU,QAAO;AAGtC,MAAK,MAAM,OAAO,iBAAiB;AACjC,MAAI,CAAC,OAAO,UAAU,eAAe,KAAK,iBAAiB,KAAM;EACjE,MAAM,cAAc,OAAO,gBAAgB;AAC3C,MAAI,gBAAgB,SAAU,QAAO;AACrC,MAAI,gBAAgB,SAAU,QAAO;AACrC;;AAGF,QAAO;;AAGT,SAAgB,sBACd,kBACA,iBACiB;AAEjB,KAAI,OAAO,KAAK,kBAAkB,SAAS,GAAG;EAC5C,MAAM,cAAc,sBAAsB;AAC1C,SAAO,OAAO,YACZ,OAAO,QAAQ,iBAAiB,QAC7B,CAAC,GAAG,OAAO,KAAK,iBAAiB,MAAM;OAI5C,QAAO;;AAKX,SAAgB,cAAc,OAAY,YAAoB;AAC5D,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GT,KAAI,CAAC,UACH,QAAO;AAGT,KAAI,CAAC,UACH,QAAO;AAET,KAAI,MAAM,QAAQ,cAAc,MAAM,QAAQ,WAC5C,QAAO,CAAC,GAAG,WAAW,GAAG;AAE3B,KAAI,MAAM,QAAQ,WAChB,QAAO,CAAC,GAAG,WAAW;AAExB,KAAI,MAAM,QAAQ,WAChB,QAAO,CAAC,WAAW,GAAG;AAExB,QAAO,CAAC,WAAW"}
@@ -1,30 +1,19 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isPregelLike = isPregelLike;
4
- exports.findSubgraphPregel = findSubgraphPregel;
5
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1
+
2
+ //#region src/pregel/utils/subgraph.ts
6
3
  function isRunnableSequence(x) {
7
- return "steps" in x && Array.isArray(x.steps);
4
+ return "steps" in x && Array.isArray(x.steps);
8
5
  }
9
- function isPregelLike(
10
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
11
- x
12
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
13
- ) {
14
- return "lg_is_pregel" in x && x.lg_is_pregel === true;
6
+ function isPregelLike(x) {
7
+ return "lg_is_pregel" in x && x.lg_is_pregel === true;
15
8
  }
16
- function findSubgraphPregel(candidate
17
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
18
- ) {
19
- const candidates = [candidate];
20
- for (const candidate of candidates) {
21
- if (isPregelLike(candidate)) {
22
- return candidate;
23
- }
24
- else if (isRunnableSequence(candidate)) {
25
- candidates.push(...candidate.steps);
26
- }
27
- }
28
- return undefined;
9
+ function findSubgraphPregel(candidate) {
10
+ const candidates = [candidate];
11
+ for (const candidate$1 of candidates) if (isPregelLike(candidate$1)) return candidate$1;
12
+ else if (isRunnableSequence(candidate$1)) candidates.push(...candidate$1.steps);
13
+ return void 0;
29
14
  }
30
- //# sourceMappingURL=subgraph.js.map
15
+
16
+ //#endregion
17
+ exports.findSubgraphPregel = findSubgraphPregel;
18
+ exports.isPregelLike = isPregelLike;
19
+ //# sourceMappingURL=subgraph.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subgraph.cjs","names":["candidate"],"sources":["../../../src/pregel/utils/subgraph.ts"],"sourcesContent":["import {\n RunnableSequence,\n Runnable,\n RunnableLike,\n} from \"@langchain/core/runnables\";\nimport type { PregelInterface } from \"../types.js\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction isRunnableSequence(\n x: RunnableSequence | Runnable\n): x is RunnableSequence {\n return \"steps\" in x && Array.isArray(x.steps);\n}\n\nexport function isPregelLike(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n x: PregelInterface<any, any> | RunnableLike<any, any, any>\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): x is PregelInterface<any, any> {\n return \"lg_is_pregel\" in x && x.lg_is_pregel === true;\n}\n\nexport function findSubgraphPregel(\n candidate: Runnable\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): PregelInterface<any, any> | undefined {\n const candidates = [candidate];\n for (const candidate of candidates) {\n if (isPregelLike(candidate)) {\n return candidate;\n } else if (isRunnableSequence(candidate)) {\n candidates.push(...candidate.steps);\n }\n }\n return undefined;\n}\n"],"mappings":";;AAQA,SAAS,mBACP,GACuB;AACvB,QAAO,WAAW,KAAK,MAAM,QAAQ,EAAE;;AAGzC,SAAgB,aAEd,GAEgC;AAChC,QAAO,kBAAkB,KAAK,EAAE,iBAAiB;;AAGnD,SAAgB,mBACd,WAEuC;CACvC,MAAM,aAAa,CAAC;AACpB,MAAK,MAAMA,eAAa,WACtB,KAAI,aAAaA,aACf,QAAOA;UACE,mBAAmBA,aAC5B,YAAW,KAAK,GAAGA,YAAU;AAGjC,QAAO"}
@@ -1,26 +1,17 @@
1
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1
+ //#region src/pregel/utils/subgraph.ts
2
2
  function isRunnableSequence(x) {
3
- return "steps" in x && Array.isArray(x.steps);
3
+ return "steps" in x && Array.isArray(x.steps);
4
4
  }
5
- export function isPregelLike(
6
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
7
- x
8
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
9
- ) {
10
- return "lg_is_pregel" in x && x.lg_is_pregel === true;
5
+ function isPregelLike(x) {
6
+ return "lg_is_pregel" in x && x.lg_is_pregel === true;
11
7
  }
12
- export function findSubgraphPregel(candidate
13
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
14
- ) {
15
- const candidates = [candidate];
16
- for (const candidate of candidates) {
17
- if (isPregelLike(candidate)) {
18
- return candidate;
19
- }
20
- else if (isRunnableSequence(candidate)) {
21
- candidates.push(...candidate.steps);
22
- }
23
- }
24
- return undefined;
8
+ function findSubgraphPregel(candidate) {
9
+ const candidates = [candidate];
10
+ for (const candidate$1 of candidates) if (isPregelLike(candidate$1)) return candidate$1;
11
+ else if (isRunnableSequence(candidate$1)) candidates.push(...candidate$1.steps);
12
+ return void 0;
25
13
  }
14
+
15
+ //#endregion
16
+ export { findSubgraphPregel, isPregelLike };
26
17
  //# sourceMappingURL=subgraph.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"subgraph.js","sourceRoot":"","sources":["../../../src/pregel/utils/subgraph.ts"],"names":[],"mappings":"AAOA,8DAA8D;AAC9D,SAAS,kBAAkB,CACzB,CAA8B;IAE9B,OAAO,OAAO,IAAI,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;AAChD,CAAC;AAED,MAAM,UAAU,YAAY;AAC1B,8DAA8D;AAC9D,CAA0D;AAC1D,8DAA8D;;IAE9D,OAAO,cAAc,IAAI,CAAC,IAAI,CAAC,CAAC,YAAY,KAAK,IAAI,CAAC;AACxD,CAAC;AAED,MAAM,UAAU,kBAAkB,CAChC,SAAmB;AACnB,8DAA8D;;IAE9D,MAAM,UAAU,GAAG,CAAC,SAAS,CAAC,CAAC;IAC/B,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACnC,IAAI,YAAY,CAAC,SAAS,CAAC,EAAE,CAAC;YAC5B,OAAO,SAAS,CAAC;QACnB,CAAC;aAAM,IAAI,kBAAkB,CAAC,SAAS,CAAC,EAAE,CAAC;YACzC,UAAU,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;QACtC,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
1
+ {"version":3,"file":"subgraph.js","names":["candidate"],"sources":["../../../src/pregel/utils/subgraph.ts"],"sourcesContent":["import {\n RunnableSequence,\n Runnable,\n RunnableLike,\n} from \"@langchain/core/runnables\";\nimport type { PregelInterface } from \"../types.js\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction isRunnableSequence(\n x: RunnableSequence | Runnable\n): x is RunnableSequence {\n return \"steps\" in x && Array.isArray(x.steps);\n}\n\nexport function isPregelLike(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n x: PregelInterface<any, any> | RunnableLike<any, any, any>\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): x is PregelInterface<any, any> {\n return \"lg_is_pregel\" in x && x.lg_is_pregel === true;\n}\n\nexport function findSubgraphPregel(\n candidate: Runnable\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): PregelInterface<any, any> | undefined {\n const candidates = [candidate];\n for (const candidate of candidates) {\n if (isPregelLike(candidate)) {\n return candidate;\n } else if (isRunnableSequence(candidate)) {\n candidates.push(...candidate.steps);\n }\n }\n return undefined;\n}\n"],"mappings":";AAQA,SAAS,mBACP,GACuB;AACvB,QAAO,WAAW,KAAK,MAAM,QAAQ,EAAE;;AAGzC,SAAgB,aAEd,GAEgC;AAChC,QAAO,kBAAkB,KAAK,EAAE,iBAAiB;;AAGnD,SAAgB,mBACd,WAEuC;CACvC,MAAM,aAAa,CAAC;AACpB,MAAK,MAAMA,eAAa,WACtB,KAAI,aAAaA,aACf,QAAOA;UACE,mBAAmBA,aAC5B,YAAW,KAAK,GAAGA,YAAU;AAGjC,QAAO"}
@@ -1,95 +1,45 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GraphValidationError = void 0;
4
- exports.validateGraph = validateGraph;
5
- exports.validateKeys = validateKeys;
6
- const constants_js_1 = require("../constants.cjs");
7
- const read_js_1 = require("./read.cjs");
8
- class GraphValidationError extends Error {
9
- constructor(message) {
10
- super(message);
11
- this.name = "GraphValidationError";
12
- }
13
- }
14
- exports.GraphValidationError = GraphValidationError;
15
- function validateGraph({ nodes, channels, inputChannels, outputChannels, streamChannels, interruptAfterNodes, interruptBeforeNodes, }) {
16
- if (!channels) {
17
- throw new GraphValidationError("Channels not provided");
18
- }
19
- const subscribedChannels = new Set();
20
- const allOutputChannels = new Set();
21
- for (const [name, node] of Object.entries(nodes)) {
22
- if (name === constants_js_1.INTERRUPT) {
23
- throw new GraphValidationError(`"Node name ${constants_js_1.INTERRUPT} is reserved"`);
24
- }
25
- if (node.constructor === read_js_1.PregelNode) {
26
- node.triggers.forEach((trigger) => subscribedChannels.add(trigger));
27
- }
28
- else {
29
- throw new GraphValidationError(`Invalid node type ${typeof node}, expected PregelNode`);
30
- }
31
- }
32
- // side effect: update channels
33
- for (const chan of subscribedChannels) {
34
- if (!(chan in channels)) {
35
- throw new GraphValidationError(`Subscribed channel '${String(chan)}' not in channels`);
36
- }
37
- }
38
- if (!Array.isArray(inputChannels)) {
39
- if (!subscribedChannels.has(inputChannels)) {
40
- throw new GraphValidationError(`Input channel ${String(inputChannels)} is not subscribed to by any node`);
41
- }
42
- }
43
- else {
44
- if (inputChannels.every((channel) => !subscribedChannels.has(channel))) {
45
- throw new GraphValidationError(`None of the input channels ${inputChannels} are subscribed to by any node`);
46
- }
47
- }
48
- if (!Array.isArray(outputChannels)) {
49
- allOutputChannels.add(outputChannels);
50
- }
51
- else {
52
- outputChannels.forEach((chan) => allOutputChannels.add(chan));
53
- }
54
- if (streamChannels && !Array.isArray(streamChannels)) {
55
- allOutputChannels.add(streamChannels);
56
- }
57
- else if (Array.isArray(streamChannels)) {
58
- streamChannels.forEach((chan) => allOutputChannels.add(chan));
59
- }
60
- for (const chan of allOutputChannels) {
61
- if (!(chan in channels)) {
62
- throw new GraphValidationError(`Output channel '${String(chan)}' not in channels`);
63
- }
64
- }
65
- // validate interrupt before/after
66
- if (interruptAfterNodes && interruptAfterNodes !== "*") {
67
- for (const node of interruptAfterNodes) {
68
- if (!(node in nodes)) {
69
- throw new GraphValidationError(`Node ${String(node)} not in nodes`);
70
- }
71
- }
72
- }
73
- if (interruptBeforeNodes && interruptBeforeNodes !== "*") {
74
- for (const node of interruptBeforeNodes) {
75
- if (!(node in nodes)) {
76
- throw new GraphValidationError(`Node ${String(node)} not in nodes`);
77
- }
78
- }
79
- }
1
+ const require_constants = require('../constants.cjs');
2
+ const require_read = require('./read.cjs');
3
+
4
+ //#region src/pregel/validate.ts
5
+ var GraphValidationError = class extends Error {
6
+ constructor(message) {
7
+ super(message);
8
+ this.name = "GraphValidationError";
9
+ }
10
+ };
11
+ function validateGraph({ nodes, channels, inputChannels, outputChannels, streamChannels, interruptAfterNodes, interruptBeforeNodes }) {
12
+ if (!channels) throw new GraphValidationError("Channels not provided");
13
+ const subscribedChannels = /* @__PURE__ */ new Set();
14
+ const allOutputChannels = /* @__PURE__ */ new Set();
15
+ for (const [name, node] of Object.entries(nodes)) {
16
+ if (name === require_constants.INTERRUPT) throw new GraphValidationError(`"Node name ${require_constants.INTERRUPT} is reserved"`);
17
+ if (node.constructor === require_read.PregelNode) node.triggers.forEach((trigger) => subscribedChannels.add(trigger));
18
+ else throw new GraphValidationError(`Invalid node type ${typeof node}, expected PregelNode`);
19
+ }
20
+ for (const chan of subscribedChannels) if (!(chan in channels)) throw new GraphValidationError(`Subscribed channel '${String(chan)}' not in channels`);
21
+ if (!Array.isArray(inputChannels)) {
22
+ if (!subscribedChannels.has(inputChannels)) throw new GraphValidationError(`Input channel ${String(inputChannels)} is not subscribed to by any node`);
23
+ } else if (inputChannels.every((channel) => !subscribedChannels.has(channel))) throw new GraphValidationError(`None of the input channels ${inputChannels} are subscribed to by any node`);
24
+ if (!Array.isArray(outputChannels)) allOutputChannels.add(outputChannels);
25
+ else outputChannels.forEach((chan) => allOutputChannels.add(chan));
26
+ if (streamChannels && !Array.isArray(streamChannels)) allOutputChannels.add(streamChannels);
27
+ else if (Array.isArray(streamChannels)) streamChannels.forEach((chan) => allOutputChannels.add(chan));
28
+ for (const chan of allOutputChannels) if (!(chan in channels)) throw new GraphValidationError(`Output channel '${String(chan)}' not in channels`);
29
+ if (interruptAfterNodes && interruptAfterNodes !== "*") {
30
+ for (const node of interruptAfterNodes) if (!(node in nodes)) throw new GraphValidationError(`Node ${String(node)} not in nodes`);
31
+ }
32
+ if (interruptBeforeNodes && interruptBeforeNodes !== "*") {
33
+ for (const node of interruptBeforeNodes) if (!(node in nodes)) throw new GraphValidationError(`Node ${String(node)} not in nodes`);
34
+ }
80
35
  }
81
36
  function validateKeys(keys, channels) {
82
- if (Array.isArray(keys)) {
83
- for (const key of keys) {
84
- if (!(key in channels)) {
85
- throw new Error(`Key ${String(key)} not found in channels`);
86
- }
87
- }
88
- }
89
- else {
90
- if (!(keys in channels)) {
91
- throw new Error(`Key ${String(keys)} not found in channels`);
92
- }
93
- }
37
+ if (Array.isArray(keys)) {
38
+ for (const key of keys) if (!(key in channels)) throw new Error(`Key ${String(key)} not found in channels`);
39
+ } else if (!(keys in channels)) throw new Error(`Key ${String(keys)} not found in channels`);
94
40
  }
95
- //# sourceMappingURL=validate.js.map
41
+
42
+ //#endregion
43
+ exports.validateGraph = validateGraph;
44
+ exports.validateKeys = validateKeys;
45
+ //# sourceMappingURL=validate.cjs.map