@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,133 +1,92 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.IterableReadableWritableStream = exports.IterableReadableStreamWithAbortSignal = void 0;
4
- const stream_1 = require("@langchain/core/utils/stream");
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ const __langchain_core_utils_stream = require_rolldown_runtime.__toESM(require("@langchain/core/utils/stream"));
3
+
4
+ //#region src/pregel/stream.ts
5
5
  /**
6
- * A wrapper around an IterableReadableStream that allows for aborting the stream when
7
- * {@link cancel} is called.
8
- */
9
- class IterableReadableStreamWithAbortSignal extends stream_1.IterableReadableStream {
10
- /**
11
- * @param readableStream - The stream to wrap.
12
- * @param abortController - The abort controller to use. Optional. One will be created if not provided.
13
- */
14
- constructor(readableStream, abortController) {
15
- const reader = readableStream.getReader();
16
- const ac = abortController ?? new AbortController();
17
- super({
18
- start(controller) {
19
- return pump();
20
- function pump() {
21
- return reader.read().then(({ done, value }) => {
22
- // When no more data needs to be consumed, close the stream
23
- if (done) {
24
- controller.close();
25
- return;
26
- }
27
- // Enqueue the next data chunk into our target stream
28
- controller.enqueue(value);
29
- return pump();
30
- });
31
- }
32
- },
33
- });
34
- Object.defineProperty(this, "_abortController", {
35
- enumerable: true,
36
- configurable: true,
37
- writable: true,
38
- value: void 0
39
- });
40
- Object.defineProperty(this, "_reader", {
41
- enumerable: true,
42
- configurable: true,
43
- writable: true,
44
- value: void 0
45
- });
46
- this._abortController = ac;
47
- this._reader = reader;
48
- }
49
- /**
50
- * Aborts the stream, abandoning any pending operations in progress. Calling this triggers an
51
- * {@link AbortSignal} that is propagated to the tasks that are producing the data for this stream.
52
- * @param reason - The reason for aborting the stream. Optional.
53
- */
54
- async cancel(reason) {
55
- this._abortController.abort(reason);
56
- this._reader.releaseLock();
57
- }
58
- /**
59
- * The {@link AbortSignal} for the stream. Aborted when {@link cancel} is called.
60
- */
61
- get signal() {
62
- return this._abortController.signal;
63
- }
64
- }
6
+ * A wrapper around an IterableReadableStream that allows for aborting the stream when
7
+ * {@link cancel} is called.
8
+ */
9
+ var IterableReadableStreamWithAbortSignal = class extends __langchain_core_utils_stream.IterableReadableStream {
10
+ _abortController;
11
+ _reader;
12
+ /**
13
+ * @param readableStream - The stream to wrap.
14
+ * @param abortController - The abort controller to use. Optional. One will be created if not provided.
15
+ */
16
+ constructor(readableStream, abortController) {
17
+ const reader = readableStream.getReader();
18
+ const ac = abortController ?? new AbortController();
19
+ super({ start(controller) {
20
+ return pump();
21
+ function pump() {
22
+ return reader.read().then(({ done, value }) => {
23
+ if (done) {
24
+ controller.close();
25
+ return;
26
+ }
27
+ controller.enqueue(value);
28
+ return pump();
29
+ });
30
+ }
31
+ } });
32
+ this._abortController = ac;
33
+ this._reader = reader;
34
+ }
35
+ /**
36
+ * Aborts the stream, abandoning any pending operations in progress. Calling this triggers an
37
+ * {@link AbortSignal} that is propagated to the tasks that are producing the data for this stream.
38
+ * @param reason - The reason for aborting the stream. Optional.
39
+ */
40
+ async cancel(reason) {
41
+ this._abortController.abort(reason);
42
+ this._reader.releaseLock();
43
+ }
44
+ /**
45
+ * The {@link AbortSignal} for the stream. Aborted when {@link cancel} is called.
46
+ */
47
+ get signal() {
48
+ return this._abortController.signal;
49
+ }
50
+ };
51
+ var IterableReadableWritableStream = class extends __langchain_core_utils_stream.IterableReadableStream {
52
+ modes;
53
+ controller;
54
+ passthroughFn;
55
+ _closed = false;
56
+ get closed() {
57
+ return this._closed;
58
+ }
59
+ constructor(params) {
60
+ let streamControllerPromiseResolver;
61
+ const streamControllerPromise = new Promise((resolve) => {
62
+ streamControllerPromiseResolver = resolve;
63
+ });
64
+ super({ start: (controller) => {
65
+ streamControllerPromiseResolver(controller);
66
+ } });
67
+ streamControllerPromise.then((controller) => {
68
+ this.controller = controller;
69
+ });
70
+ this.passthroughFn = params.passthroughFn;
71
+ this.modes = params.modes;
72
+ }
73
+ push(chunk) {
74
+ this.passthroughFn?.(chunk);
75
+ this.controller.enqueue(chunk);
76
+ }
77
+ close() {
78
+ try {
79
+ this.controller.close();
80
+ } catch (e) {} finally {
81
+ this._closed = true;
82
+ }
83
+ }
84
+ error(e) {
85
+ this.controller.error(e);
86
+ }
87
+ };
88
+
89
+ //#endregion
65
90
  exports.IterableReadableStreamWithAbortSignal = IterableReadableStreamWithAbortSignal;
66
- class IterableReadableWritableStream extends stream_1.IterableReadableStream {
67
- get closed() {
68
- return this._closed;
69
- }
70
- constructor(params) {
71
- let streamControllerPromiseResolver;
72
- const streamControllerPromise = new Promise((resolve) => {
73
- streamControllerPromiseResolver = resolve;
74
- });
75
- super({
76
- start: (controller) => {
77
- streamControllerPromiseResolver(controller);
78
- },
79
- });
80
- Object.defineProperty(this, "modes", {
81
- enumerable: true,
82
- configurable: true,
83
- writable: true,
84
- value: void 0
85
- });
86
- Object.defineProperty(this, "controller", {
87
- enumerable: true,
88
- configurable: true,
89
- writable: true,
90
- value: void 0
91
- });
92
- Object.defineProperty(this, "passthroughFn", {
93
- enumerable: true,
94
- configurable: true,
95
- writable: true,
96
- value: void 0
97
- });
98
- Object.defineProperty(this, "_closed", {
99
- enumerable: true,
100
- configurable: true,
101
- writable: true,
102
- value: false
103
- });
104
- // .start() will always be called before the stream can be interacted
105
- // with anyway
106
- void streamControllerPromise.then((controller) => {
107
- this.controller = controller;
108
- });
109
- this.passthroughFn = params.passthroughFn;
110
- this.modes = params.modes;
111
- }
112
- push(chunk) {
113
- this.passthroughFn?.(chunk);
114
- this.controller.enqueue(chunk);
115
- }
116
- close() {
117
- try {
118
- this.controller.close();
119
- }
120
- catch (e) {
121
- // pass
122
- }
123
- finally {
124
- this._closed = true;
125
- }
126
- }
127
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
128
- error(e) {
129
- this.controller.error(e);
130
- }
131
- }
132
91
  exports.IterableReadableWritableStream = IterableReadableWritableStream;
133
- //# sourceMappingURL=stream.js.map
92
+ //# sourceMappingURL=stream.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stream.cjs","names":["IterableReadableStream","streamControllerPromiseResolver: (\n controller: ReadableStreamDefaultController\n ) => void","streamControllerPromise: Promise<ReadableStreamDefaultController>"],"sources":["../../src/pregel/stream.ts"],"sourcesContent":["import { IterableReadableStream } from \"@langchain/core/utils/stream\";\nimport { StreamMode } from \"./types.js\";\n\n// [namespace, streamMode, payload]\nexport type StreamChunk = [string[], StreamMode, unknown];\n\n/**\n * A wrapper around an IterableReadableStream that allows for aborting the stream when\n * {@link cancel} is called.\n */\nexport class IterableReadableStreamWithAbortSignal<\n T\n> extends IterableReadableStream<T> {\n protected _abortController: AbortController;\n\n protected _reader: ReadableStreamDefaultReader<T>;\n\n /**\n * @param readableStream - The stream to wrap.\n * @param abortController - The abort controller to use. Optional. One will be created if not provided.\n */\n constructor(\n readableStream: ReadableStream<T>,\n abortController?: AbortController\n ) {\n const reader = readableStream.getReader();\n const ac = abortController ?? new AbortController();\n super({\n start(controller: ReadableStreamDefaultController<T>) {\n return pump();\n function pump(): Promise<T | undefined> {\n return reader.read().then(({ done, value }) => {\n // When no more data needs to be consumed, close the stream\n if (done) {\n controller.close();\n return;\n }\n // Enqueue the next data chunk into our target stream\n controller.enqueue(value);\n return pump();\n });\n }\n },\n });\n this._abortController = ac;\n this._reader = reader;\n }\n\n /**\n * Aborts the stream, abandoning any pending operations in progress. Calling this triggers an\n * {@link AbortSignal} that is propagated to the tasks that are producing the data for this stream.\n * @param reason - The reason for aborting the stream. Optional.\n */\n override async cancel(reason?: unknown) {\n this._abortController.abort(reason);\n this._reader.releaseLock();\n }\n\n /**\n * The {@link AbortSignal} for the stream. Aborted when {@link cancel} is called.\n */\n get signal() {\n return this._abortController.signal;\n }\n}\n\nexport class IterableReadableWritableStream extends IterableReadableStream<StreamChunk> {\n modes: Set<StreamMode>;\n\n private controller: ReadableStreamDefaultController;\n\n private passthroughFn?: (chunk: StreamChunk) => void;\n\n private _closed: boolean = false;\n\n get closed() {\n return this._closed;\n }\n\n constructor(params: {\n passthroughFn?: (chunk: StreamChunk) => void;\n modes: Set<StreamMode>;\n }) {\n let streamControllerPromiseResolver: (\n controller: ReadableStreamDefaultController\n ) => void;\n const streamControllerPromise: Promise<ReadableStreamDefaultController> =\n new Promise<ReadableStreamDefaultController>((resolve) => {\n streamControllerPromiseResolver = resolve;\n });\n\n super({\n start: (controller) => {\n streamControllerPromiseResolver!(controller);\n },\n });\n\n // .start() will always be called before the stream can be interacted\n // with anyway\n void streamControllerPromise.then((controller) => {\n this.controller = controller;\n });\n\n this.passthroughFn = params.passthroughFn;\n this.modes = params.modes;\n }\n\n push(chunk: StreamChunk) {\n this.passthroughFn?.(chunk);\n this.controller.enqueue(chunk);\n }\n\n close() {\n try {\n this.controller.close();\n } catch (e) {\n // pass\n } finally {\n this._closed = true;\n }\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n error(e: any) {\n this.controller.error(e);\n }\n}\n"],"mappings":";;;;;;;;AAUA,IAAa,wCAAb,cAEUA,qDAA0B;CAClC,AAAU;CAEV,AAAU;;;;;CAMV,YACE,gBACA,iBACA;EACA,MAAM,SAAS,eAAe;EAC9B,MAAM,KAAK,mBAAmB,IAAI;AAClC,QAAM,EACJ,MAAM,YAAgD;AACpD,UAAO;GACP,SAAS,OAA+B;AACtC,WAAO,OAAO,OAAO,MAAM,EAAE,MAAM,YAAY;AAE7C,SAAI,MAAM;AACR,iBAAW;AACX;;AAGF,gBAAW,QAAQ;AACnB,YAAO;;;;AAKf,OAAK,mBAAmB;AACxB,OAAK,UAAU;;;;;;;CAQjB,MAAe,OAAO,QAAkB;AACtC,OAAK,iBAAiB,MAAM;AAC5B,OAAK,QAAQ;;;;;CAMf,IAAI,SAAS;AACX,SAAO,KAAK,iBAAiB;;;AAIjC,IAAa,iCAAb,cAAoDA,qDAAoC;CACtF;CAEA,AAAQ;CAER,AAAQ;CAER,AAAQ,UAAmB;CAE3B,IAAI,SAAS;AACX,SAAO,KAAK;;CAGd,YAAY,QAGT;EACD,IAAIC;EAGJ,MAAMC,0BACJ,IAAI,SAA0C,YAAY;AACxD,qCAAkC;;AAGtC,QAAM,EACJ,QAAQ,eAAe;AACrB,mCAAiC;;AAMrC,EAAK,wBAAwB,MAAM,eAAe;AAChD,QAAK,aAAa;;AAGpB,OAAK,gBAAgB,OAAO;AAC5B,OAAK,QAAQ,OAAO;;CAGtB,KAAK,OAAoB;AACvB,OAAK,gBAAgB;AACrB,OAAK,WAAW,QAAQ;;CAG1B,QAAQ;AACN,MAAI;AACF,QAAK,WAAW;WACT,GAAG,WAEF;AACR,QAAK,UAAU;;;CAKnB,MAAM,GAAQ;AACZ,OAAK,WAAW,MAAM"}
@@ -1,128 +1,90 @@
1
1
  import { IterableReadableStream } from "@langchain/core/utils/stream";
2
+
3
+ //#region src/pregel/stream.ts
2
4
  /**
3
- * A wrapper around an IterableReadableStream that allows for aborting the stream when
4
- * {@link cancel} is called.
5
- */
6
- export class IterableReadableStreamWithAbortSignal extends IterableReadableStream {
7
- /**
8
- * @param readableStream - The stream to wrap.
9
- * @param abortController - The abort controller to use. Optional. One will be created if not provided.
10
- */
11
- constructor(readableStream, abortController) {
12
- const reader = readableStream.getReader();
13
- const ac = abortController ?? new AbortController();
14
- super({
15
- start(controller) {
16
- return pump();
17
- function pump() {
18
- return reader.read().then(({ done, value }) => {
19
- // When no more data needs to be consumed, close the stream
20
- if (done) {
21
- controller.close();
22
- return;
23
- }
24
- // Enqueue the next data chunk into our target stream
25
- controller.enqueue(value);
26
- return pump();
27
- });
28
- }
29
- },
30
- });
31
- Object.defineProperty(this, "_abortController", {
32
- enumerable: true,
33
- configurable: true,
34
- writable: true,
35
- value: void 0
36
- });
37
- Object.defineProperty(this, "_reader", {
38
- enumerable: true,
39
- configurable: true,
40
- writable: true,
41
- value: void 0
42
- });
43
- this._abortController = ac;
44
- this._reader = reader;
45
- }
46
- /**
47
- * Aborts the stream, abandoning any pending operations in progress. Calling this triggers an
48
- * {@link AbortSignal} that is propagated to the tasks that are producing the data for this stream.
49
- * @param reason - The reason for aborting the stream. Optional.
50
- */
51
- async cancel(reason) {
52
- this._abortController.abort(reason);
53
- this._reader.releaseLock();
54
- }
55
- /**
56
- * The {@link AbortSignal} for the stream. Aborted when {@link cancel} is called.
57
- */
58
- get signal() {
59
- return this._abortController.signal;
60
- }
61
- }
62
- export class IterableReadableWritableStream extends IterableReadableStream {
63
- get closed() {
64
- return this._closed;
65
- }
66
- constructor(params) {
67
- let streamControllerPromiseResolver;
68
- const streamControllerPromise = new Promise((resolve) => {
69
- streamControllerPromiseResolver = resolve;
70
- });
71
- super({
72
- start: (controller) => {
73
- streamControllerPromiseResolver(controller);
74
- },
75
- });
76
- Object.defineProperty(this, "modes", {
77
- enumerable: true,
78
- configurable: true,
79
- writable: true,
80
- value: void 0
81
- });
82
- Object.defineProperty(this, "controller", {
83
- enumerable: true,
84
- configurable: true,
85
- writable: true,
86
- value: void 0
87
- });
88
- Object.defineProperty(this, "passthroughFn", {
89
- enumerable: true,
90
- configurable: true,
91
- writable: true,
92
- value: void 0
93
- });
94
- Object.defineProperty(this, "_closed", {
95
- enumerable: true,
96
- configurable: true,
97
- writable: true,
98
- value: false
99
- });
100
- // .start() will always be called before the stream can be interacted
101
- // with anyway
102
- void streamControllerPromise.then((controller) => {
103
- this.controller = controller;
104
- });
105
- this.passthroughFn = params.passthroughFn;
106
- this.modes = params.modes;
107
- }
108
- push(chunk) {
109
- this.passthroughFn?.(chunk);
110
- this.controller.enqueue(chunk);
111
- }
112
- close() {
113
- try {
114
- this.controller.close();
115
- }
116
- catch (e) {
117
- // pass
118
- }
119
- finally {
120
- this._closed = true;
121
- }
122
- }
123
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
124
- error(e) {
125
- this.controller.error(e);
126
- }
127
- }
5
+ * A wrapper around an IterableReadableStream that allows for aborting the stream when
6
+ * {@link cancel} is called.
7
+ */
8
+ var IterableReadableStreamWithAbortSignal = class extends IterableReadableStream {
9
+ _abortController;
10
+ _reader;
11
+ /**
12
+ * @param readableStream - The stream to wrap.
13
+ * @param abortController - The abort controller to use. Optional. One will be created if not provided.
14
+ */
15
+ constructor(readableStream, abortController) {
16
+ const reader = readableStream.getReader();
17
+ const ac = abortController ?? new AbortController();
18
+ super({ start(controller) {
19
+ return pump();
20
+ function pump() {
21
+ return reader.read().then(({ done, value }) => {
22
+ if (done) {
23
+ controller.close();
24
+ return;
25
+ }
26
+ controller.enqueue(value);
27
+ return pump();
28
+ });
29
+ }
30
+ } });
31
+ this._abortController = ac;
32
+ this._reader = reader;
33
+ }
34
+ /**
35
+ * Aborts the stream, abandoning any pending operations in progress. Calling this triggers an
36
+ * {@link AbortSignal} that is propagated to the tasks that are producing the data for this stream.
37
+ * @param reason - The reason for aborting the stream. Optional.
38
+ */
39
+ async cancel(reason) {
40
+ this._abortController.abort(reason);
41
+ this._reader.releaseLock();
42
+ }
43
+ /**
44
+ * The {@link AbortSignal} for the stream. Aborted when {@link cancel} is called.
45
+ */
46
+ get signal() {
47
+ return this._abortController.signal;
48
+ }
49
+ };
50
+ var IterableReadableWritableStream = class extends IterableReadableStream {
51
+ modes;
52
+ controller;
53
+ passthroughFn;
54
+ _closed = false;
55
+ get closed() {
56
+ return this._closed;
57
+ }
58
+ constructor(params) {
59
+ let streamControllerPromiseResolver;
60
+ const streamControllerPromise = new Promise((resolve) => {
61
+ streamControllerPromiseResolver = resolve;
62
+ });
63
+ super({ start: (controller) => {
64
+ streamControllerPromiseResolver(controller);
65
+ } });
66
+ streamControllerPromise.then((controller) => {
67
+ this.controller = controller;
68
+ });
69
+ this.passthroughFn = params.passthroughFn;
70
+ this.modes = params.modes;
71
+ }
72
+ push(chunk) {
73
+ this.passthroughFn?.(chunk);
74
+ this.controller.enqueue(chunk);
75
+ }
76
+ close() {
77
+ try {
78
+ this.controller.close();
79
+ } catch (e) {} finally {
80
+ this._closed = true;
81
+ }
82
+ }
83
+ error(e) {
84
+ this.controller.error(e);
85
+ }
86
+ };
87
+
88
+ //#endregion
89
+ export { IterableReadableStreamWithAbortSignal, IterableReadableWritableStream };
128
90
  //# sourceMappingURL=stream.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"stream.js","sourceRoot":"","sources":["../../src/pregel/stream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAMtE;;;GAGG;AACH,MAAM,OAAO,qCAEX,SAAQ,sBAAyB;IAKjC;;;OAGG;IACH,YACE,cAAiC,EACjC,eAAiC;QAEjC,MAAM,MAAM,GAAG,cAAc,CAAC,SAAS,EAAE,CAAC;QAC1C,MAAM,EAAE,GAAG,eAAe,IAAI,IAAI,eAAe,EAAE,CAAC;QACpD,KAAK,CAAC;YACJ,KAAK,CAAC,UAA8C;gBAClD,OAAO,IAAI,EAAE,CAAC;gBACd,SAAS,IAAI;oBACX,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE;wBAC5C,2DAA2D;wBAC3D,IAAI,IAAI,EAAE,CAAC;4BACT,UAAU,CAAC,KAAK,EAAE,CAAC;4BACnB,OAAO;wBACT,CAAC;wBACD,qDAAqD;wBACrD,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;wBAC1B,OAAO,IAAI,EAAE,CAAC;oBAChB,CAAC,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;SACF,CAAC,CAAC;QA9BK;;;;;WAAkC;QAElC;;;;;WAAwC;QA6BhD,IAAI,CAAC,gBAAgB,GAAG,EAAE,CAAC;QAC3B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED;;;;OAIG;IACM,KAAK,CAAC,MAAM,CAAC,MAAgB;QACpC,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QACpC,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;IAC7B,CAAC;IAED;;OAEG;IACH,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC;IACtC,CAAC;CACF;AAED,MAAM,OAAO,8BAA+B,SAAQ,sBAAmC;IASrF,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED,YAAY,MAGX;QACC,IAAI,+BAEK,CAAC;QACV,MAAM,uBAAuB,GAC3B,IAAI,OAAO,CAAkC,CAAC,OAAO,EAAE,EAAE;YACvD,+BAA+B,GAAG,OAAO,CAAC;QAC5C,CAAC,CAAC,CAAC;QAEL,KAAK,CAAC;YACJ,KAAK,EAAE,CAAC,UAAU,EAAE,EAAE;gBACpB,+BAAgC,CAAC,UAAU,CAAC,CAAC;YAC/C,CAAC;SACF,CAAC,CAAC;QA5BL;;;;;WAAuB;QAEf;;;;;WAA4C;QAE5C;;;;;WAA6C;QAE7C;;;;mBAAmB,KAAK;WAAC;QAwB/B,qEAAqE;QACrE,cAAc;QACd,KAAK,uBAAuB,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,EAAE;YAC/C,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC/B,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC,aAAa,CAAC;QAC1C,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;IAC5B,CAAC;IAED,IAAI,CAAC,KAAkB;QACrB,IAAI,CAAC,aAAa,EAAE,CAAC,KAAK,CAAC,CAAC;QAC5B,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC;IAED,KAAK;QACH,IAAI,CAAC;YACH,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;QAC1B,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO;QACT,CAAC;gBAAS,CAAC;YACT,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACtB,CAAC;IACH,CAAC;IAED,8DAA8D;IAC9D,KAAK,CAAC,CAAM;QACV,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAC3B,CAAC;CACF"}
1
+ {"version":3,"file":"stream.js","names":["streamControllerPromiseResolver: (\n controller: ReadableStreamDefaultController\n ) => void","streamControllerPromise: Promise<ReadableStreamDefaultController>"],"sources":["../../src/pregel/stream.ts"],"sourcesContent":["import { IterableReadableStream } from \"@langchain/core/utils/stream\";\nimport { StreamMode } from \"./types.js\";\n\n// [namespace, streamMode, payload]\nexport type StreamChunk = [string[], StreamMode, unknown];\n\n/**\n * A wrapper around an IterableReadableStream that allows for aborting the stream when\n * {@link cancel} is called.\n */\nexport class IterableReadableStreamWithAbortSignal<\n T\n> extends IterableReadableStream<T> {\n protected _abortController: AbortController;\n\n protected _reader: ReadableStreamDefaultReader<T>;\n\n /**\n * @param readableStream - The stream to wrap.\n * @param abortController - The abort controller to use. Optional. One will be created if not provided.\n */\n constructor(\n readableStream: ReadableStream<T>,\n abortController?: AbortController\n ) {\n const reader = readableStream.getReader();\n const ac = abortController ?? new AbortController();\n super({\n start(controller: ReadableStreamDefaultController<T>) {\n return pump();\n function pump(): Promise<T | undefined> {\n return reader.read().then(({ done, value }) => {\n // When no more data needs to be consumed, close the stream\n if (done) {\n controller.close();\n return;\n }\n // Enqueue the next data chunk into our target stream\n controller.enqueue(value);\n return pump();\n });\n }\n },\n });\n this._abortController = ac;\n this._reader = reader;\n }\n\n /**\n * Aborts the stream, abandoning any pending operations in progress. Calling this triggers an\n * {@link AbortSignal} that is propagated to the tasks that are producing the data for this stream.\n * @param reason - The reason for aborting the stream. Optional.\n */\n override async cancel(reason?: unknown) {\n this._abortController.abort(reason);\n this._reader.releaseLock();\n }\n\n /**\n * The {@link AbortSignal} for the stream. Aborted when {@link cancel} is called.\n */\n get signal() {\n return this._abortController.signal;\n }\n}\n\nexport class IterableReadableWritableStream extends IterableReadableStream<StreamChunk> {\n modes: Set<StreamMode>;\n\n private controller: ReadableStreamDefaultController;\n\n private passthroughFn?: (chunk: StreamChunk) => void;\n\n private _closed: boolean = false;\n\n get closed() {\n return this._closed;\n }\n\n constructor(params: {\n passthroughFn?: (chunk: StreamChunk) => void;\n modes: Set<StreamMode>;\n }) {\n let streamControllerPromiseResolver: (\n controller: ReadableStreamDefaultController\n ) => void;\n const streamControllerPromise: Promise<ReadableStreamDefaultController> =\n new Promise<ReadableStreamDefaultController>((resolve) => {\n streamControllerPromiseResolver = resolve;\n });\n\n super({\n start: (controller) => {\n streamControllerPromiseResolver!(controller);\n },\n });\n\n // .start() will always be called before the stream can be interacted\n // with anyway\n void streamControllerPromise.then((controller) => {\n this.controller = controller;\n });\n\n this.passthroughFn = params.passthroughFn;\n this.modes = params.modes;\n }\n\n push(chunk: StreamChunk) {\n this.passthroughFn?.(chunk);\n this.controller.enqueue(chunk);\n }\n\n close() {\n try {\n this.controller.close();\n } catch (e) {\n // pass\n } finally {\n this._closed = true;\n }\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n error(e: any) {\n this.controller.error(e);\n }\n}\n"],"mappings":";;;;;;;AAUA,IAAa,wCAAb,cAEU,uBAA0B;CAClC,AAAU;CAEV,AAAU;;;;;CAMV,YACE,gBACA,iBACA;EACA,MAAM,SAAS,eAAe;EAC9B,MAAM,KAAK,mBAAmB,IAAI;AAClC,QAAM,EACJ,MAAM,YAAgD;AACpD,UAAO;GACP,SAAS,OAA+B;AACtC,WAAO,OAAO,OAAO,MAAM,EAAE,MAAM,YAAY;AAE7C,SAAI,MAAM;AACR,iBAAW;AACX;;AAGF,gBAAW,QAAQ;AACnB,YAAO;;;;AAKf,OAAK,mBAAmB;AACxB,OAAK,UAAU;;;;;;;CAQjB,MAAe,OAAO,QAAkB;AACtC,OAAK,iBAAiB,MAAM;AAC5B,OAAK,QAAQ;;;;;CAMf,IAAI,SAAS;AACX,SAAO,KAAK,iBAAiB;;;AAIjC,IAAa,iCAAb,cAAoD,uBAAoC;CACtF;CAEA,AAAQ;CAER,AAAQ;CAER,AAAQ,UAAmB;CAE3B,IAAI,SAAS;AACX,SAAO,KAAK;;CAGd,YAAY,QAGT;EACD,IAAIA;EAGJ,MAAMC,0BACJ,IAAI,SAA0C,YAAY;AACxD,qCAAkC;;AAGtC,QAAM,EACJ,QAAQ,eAAe;AACrB,mCAAiC;;AAMrC,EAAK,wBAAwB,MAAM,eAAe;AAChD,QAAK,aAAa;;AAGpB,OAAK,gBAAgB,OAAO;AAC5B,OAAK,QAAQ,OAAO;;CAGtB,KAAK,OAAoB;AACvB,OAAK,gBAAgB;AACrB,OAAK,WAAW,QAAQ;;CAG1B,QAAQ;AACN,MAAI;AACF,QAAK,WAAW;WACT,GAAG,WAEF;AACR,QAAK,UAAU;;;CAKnB,MAAM,GAAQ;AACZ,OAAK,WAAW,MAAM"}
@@ -1,64 +1,27 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Call = void 0;
4
- exports.isCall = isCall;
5
- class Call {
6
- constructor({ func, name, input, retry, cache, callbacks }) {
7
- Object.defineProperty(this, "func", {
8
- enumerable: true,
9
- configurable: true,
10
- writable: true,
11
- value: void 0
12
- });
13
- Object.defineProperty(this, "name", {
14
- enumerable: true,
15
- configurable: true,
16
- writable: true,
17
- value: void 0
18
- });
19
- Object.defineProperty(this, "input", {
20
- enumerable: true,
21
- configurable: true,
22
- writable: true,
23
- value: void 0
24
- });
25
- Object.defineProperty(this, "retry", {
26
- enumerable: true,
27
- configurable: true,
28
- writable: true,
29
- value: void 0
30
- });
31
- Object.defineProperty(this, "cache", {
32
- enumerable: true,
33
- configurable: true,
34
- writable: true,
35
- value: void 0
36
- });
37
- Object.defineProperty(this, "callbacks", {
38
- enumerable: true,
39
- configurable: true,
40
- writable: true,
41
- value: void 0
42
- });
43
- Object.defineProperty(this, "__lg_type", {
44
- enumerable: true,
45
- configurable: true,
46
- writable: true,
47
- value: "call"
48
- });
49
- this.func = func;
50
- this.name = name;
51
- this.input = input;
52
- this.retry = retry;
53
- this.cache = cache;
54
- this.callbacks = callbacks;
55
- }
56
- }
57
- exports.Call = Call;
1
+
2
+ //#region src/pregel/types.ts
3
+ var Call = class {
4
+ func;
5
+ name;
6
+ input;
7
+ retry;
8
+ cache;
9
+ callbacks;
10
+ __lg_type = "call";
11
+ constructor({ func, name, input, retry, cache, callbacks }) {
12
+ this.func = func;
13
+ this.name = name;
14
+ this.input = input;
15
+ this.retry = retry;
16
+ this.cache = cache;
17
+ this.callbacks = callbacks;
18
+ }
19
+ };
58
20
  function isCall(value) {
59
- return (typeof value === "object" &&
60
- value !== null &&
61
- "__lg_type" in value &&
62
- value.__lg_type === "call");
21
+ return typeof value === "object" && value !== null && "__lg_type" in value && value.__lg_type === "call";
63
22
  }
64
- //# sourceMappingURL=types.js.map
23
+
24
+ //#endregion
25
+ exports.Call = Call;
26
+ exports.isCall = isCall;
27
+ //# sourceMappingURL=types.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.cjs","names":[],"sources":["../../src/pregel/types.ts"],"sourcesContent":["import type { Runnable, RunnableConfig } from \"@langchain/core/runnables\";\nimport type {\n All,\n PendingWrite,\n CheckpointMetadata,\n BaseCheckpointSaver,\n BaseStore,\n CheckpointListOptions,\n BaseCache,\n} from \"@langchain/langgraph-checkpoint\";\nimport { Graph as DrawableGraph } from \"@langchain/core/runnables/graph\";\nimport { IterableReadableStream } from \"@langchain/core/utils/stream\";\nimport type { BaseMessage } from \"@langchain/core/messages\";\nimport type { BaseChannel } from \"../channels/base.js\";\nimport type { PregelNode } from \"./read.js\";\nimport type { Interrupt } from \"../constants.js\";\nimport { CachePolicy, RetryPolicy } from \"./utils/index.js\";\nimport { LangGraphRunnableConfig } from \"./runnable_types.js\";\n\n/**\n * Selects the type of output you'll receive when streaming from the graph. See [Streaming](/langgraphjs/how-tos/#streaming) for more details.\n */\nexport type StreamMode =\n | \"values\"\n | \"updates\"\n | \"debug\"\n | \"messages\"\n | \"checkpoints\"\n | \"tasks\"\n | \"custom\";\n\nexport type Durability = \"exit\" | \"async\" | \"sync\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type PregelInputType = any;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type PregelOutputType = any;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype StreamMessageOutput = [BaseMessage, Record<string, any>];\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype StreamCustomOutput = any;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype StreamDebugOutput = Record<string, any>;\n\ntype StreamCheckpointsOutput<StreamValues> = {\n values: StreamValues;\n next: string[];\n config: RunnableConfig;\n metadata?: CheckpointMetadata;\n parentConfig?: RunnableConfig | undefined;\n tasks: PregelTaskDescription[];\n};\n\ninterface StreamTasksOutputBase {\n id: string;\n name: string;\n interrupts: Interrupt[];\n}\n\ninterface StreamTasksCreateOutput<StreamValues> extends StreamTasksOutputBase {\n input: StreamValues;\n triggers: string[];\n}\n\ninterface StreamTasksResultOutput<Keys, StreamUpdates>\n extends StreamTasksOutputBase {\n result: [Keys, StreamUpdates][];\n}\n\ntype StreamTasksOutput<StreamUpdates, StreamValues, Nodes = string> =\n | StreamTasksCreateOutput<StreamValues>\n | StreamTasksResultOutput<Nodes, StreamUpdates>;\n\ntype DefaultStreamMode = \"updates\";\n\nexport type StreamOutputMap<\n TStreamMode extends StreamMode | StreamMode[] | undefined,\n TStreamSubgraphs extends boolean,\n StreamUpdates,\n StreamValues,\n Nodes,\n NodeReturnType\n> = (\n undefined extends TStreamMode\n ? []\n : StreamMode | StreamMode[] extends TStreamMode\n ? TStreamMode extends StreamMode[]\n ? TStreamMode[number]\n : TStreamMode\n : TStreamMode extends StreamMode[]\n ? TStreamMode[number]\n : []\n) extends infer Multiple extends StreamMode\n ? [TStreamSubgraphs] extends [true]\n ? {\n values: [string[], \"values\", StreamValues];\n updates: [\n string[],\n \"updates\",\n NodeReturnType extends Record<string, unknown>\n ? { [K in keyof NodeReturnType]?: NodeReturnType[K] }\n : Record<Nodes extends string ? Nodes : string, StreamUpdates>\n ];\n messages: [string[], \"messages\", StreamMessageOutput];\n custom: [string[], \"custom\", StreamCustomOutput];\n checkpoints: [\n string[],\n \"checkpoints\",\n StreamCheckpointsOutput<StreamValues>\n ];\n tasks: [\n string[],\n \"tasks\",\n StreamTasksOutput<StreamUpdates, StreamValues>\n ];\n debug: [string[], \"debug\", StreamDebugOutput];\n }[Multiple]\n : {\n values: [\"values\", StreamValues];\n updates: [\n \"updates\",\n NodeReturnType extends Record<string, unknown>\n ? { [K in keyof NodeReturnType]?: NodeReturnType[K] }\n : Record<Nodes extends string ? Nodes : string, StreamUpdates>\n ];\n messages: [\"messages\", StreamMessageOutput];\n custom: [\"custom\", StreamCustomOutput];\n checkpoints: [\"checkpoints\", StreamCheckpointsOutput<StreamValues>];\n tasks: [\"tasks\", StreamTasksOutput<StreamUpdates, StreamValues, Nodes>];\n debug: [\"debug\", StreamDebugOutput];\n }[Multiple]\n : (\n undefined extends TStreamMode ? DefaultStreamMode : TStreamMode\n ) extends infer Single extends StreamMode\n ? [TStreamSubgraphs] extends [true]\n ? {\n values: [string[], StreamValues];\n updates: [\n string[],\n NodeReturnType extends Record<string, unknown>\n ? { [K in keyof NodeReturnType]?: NodeReturnType[K] }\n : Record<Nodes extends string ? Nodes : string, StreamUpdates>\n ];\n messages: [string[], StreamMessageOutput];\n custom: [string[], StreamCustomOutput];\n checkpoints: [string[], StreamCheckpointsOutput<StreamValues>];\n tasks: [\n string[],\n StreamTasksOutput<StreamUpdates, StreamValues, Nodes>\n ];\n debug: [string[], StreamDebugOutput];\n }[Single]\n : {\n values: StreamValues;\n updates: NodeReturnType extends Record<string, unknown>\n ? { [K in keyof NodeReturnType]?: NodeReturnType[K] }\n : Record<Nodes extends string ? Nodes : string, StreamUpdates>;\n messages: StreamMessageOutput;\n custom: StreamCustomOutput;\n checkpoints: StreamCheckpointsOutput<StreamValues>;\n tasks: StreamTasksOutput<StreamUpdates, StreamValues, Nodes>;\n debug: StreamDebugOutput;\n }[Single]\n : never;\n\n/**\n * Configuration options for executing a Pregel graph.\n * These options control how the graph executes, what data is streamed, and how interrupts are handled.\n *\n * @typeParam Nodes - Mapping of node names to their {@link PregelNode} implementations\n * @typeParam Channels - Mapping of channel names to their {@link BaseChannel} implementations\n * @typeParam ContextType - Type of context that can be passed to the graph\n */\nexport interface PregelOptions<\n Nodes extends StrRecord<string, PregelNode>,\n Channels extends StrRecord<string, BaseChannel>,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ContextType extends Record<string, any> = Record<string, any>,\n TStreamMode extends StreamMode | StreamMode[] | undefined =\n | StreamMode\n | StreamMode[]\n | undefined,\n TSubgraphs extends boolean = boolean\n> extends RunnableConfig<ContextType> {\n /**\n * Controls what information is streamed during graph execution.\n * Multiple modes can be enabled simultaneously.\n *\n * Supported modes:\n * - \"values\": Streams complete state after each step\n * - \"updates\": Streams only state changes after each step\n * - \"messages\": Streams messages from within nodes\n * - \"custom\": Streams custom events from within nodes\n * - \"debug\": Streams detailed execution events for tracing & debugging\n *\n * @example\n * ```typescript\n * // Stream only values\n * streamMode: \"values\"\n *\n * // Stream both values and debug info\n * streamMode: [\"values\", \"debug\"]\n * ```\n *\n * @default [\"values\"]\n */\n streamMode?: TStreamMode;\n\n /**\n * Specifies which channel keys to retrieve from the checkpoint when resuming execution.\n * This is an advanced option that you generally don't need to set manually.\n * The graph will automatically determine the appropriate input keys based on its configuration.\n */\n inputKeys?: keyof Channels | Array<keyof Channels>;\n\n /**\n * Specifies which channel keys to include in the output stream and final result.\n * Use this to filter which parts of the graph state you want to observe.\n *\n * @example\n * ```typescript\n * // Stream only the 'result' channel\n * outputKeys: \"result\"\n *\n * // Stream multiple channels\n * outputKeys: [\"result\", \"intermediateState\"]\n * ```\n */\n outputKeys?: keyof Channels | Array<keyof Channels>;\n\n /**\n * List of nodes where execution should be interrupted BEFORE the node runs.\n * Can be used for debugging and advanced state manipulation use cases. For\n * human-in-the-loop workflows, developers should prefer the\n * @link {interrupt} function instead.\n *\n * When interrupted, a resume @link {Command} must be provided to continue\n * execution.\n *\n * @example\n * ```typescript\n * // Interrupt before specific nodes\n * interruptBefore: [\"humanReview\", \"qualityCheck\"]\n *\n * // Interrupt before all nodes\n * interruptBefore: \"all\"\n * ```\n */\n interruptBefore?: All | Array<keyof Nodes>;\n\n /**\n * List of nodes where execution should be interrupted AFTER the node runs.\n * Similar to interruptBefore, but interrupts after node completion.\n * Useful when the node's output needs to be reviewed before proceeding.\n *\n * @example\n * ```typescript\n * // Interrupt after specific nodes\n * interruptAfter: [\"generateContent\", \"analyze\"]\n *\n * // Interrupt after all nodes\n * interruptAfter: \"all\"\n * ```\n */\n interruptAfter?: All | Array<keyof Nodes>;\n\n /**\n * Enables detailed debug logging during graph execution.\n * When enabled, prints information about:\n * - Task execution\n * - Channel updates\n * - Checkpoint writes\n *\n * @default false\n */\n debug?: boolean;\n\n /**\n * Whether to include subgraph execution details in the stream.\n * When true, state updates from nested graphs will also be streamed.\n *\n * @default false\n */\n subgraphs?: TSubgraphs;\n\n /**\n * Whether to checkpoint intermediate steps, defaults to `true`.\n * If `false`, only the final checkpoint is saved.\n * @deprecated Use `durability` instead.\n */\n checkpointDuring?: boolean;\n\n /**\n * Whether to checkpoint during the run (or only at the end/interruption).\n * - `\"async\"`: Save checkpoint asynchronously while the next step executes (default).\n * - `\"sync\"`: Save checkpoint synchronously before the next step starts.\n * - `\"exit\"`: Save checkpoint only when the graph exits.\n * @default \"async\"\n */\n durability?: Durability;\n\n /**\n * A shared value store that allows you to store and retrieve state across\n * threads. Useful for implementing long-term memory patterns.\n */\n store?: BaseStore;\n\n /**\n * Optional cache for the graph, useful for caching tasks.\n */\n cache?: BaseCache;\n\n /**\n * Static context for the graph run, like `userId`, `dbConnection` etc.\n */\n context?: ContextType;\n}\n\n/**\n * Construct a type with a set of properties K of type T\n */\ntype StrRecord<K extends string, T> = {\n [P in K]: T;\n};\n\nexport interface PregelInterface<\n Nodes extends StrRecord<string, PregelNode>,\n Channels extends StrRecord<string, BaseChannel>,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ContextType extends Record<string, any> = StrRecord<string, any>\n> {\n lg_is_pregel: boolean;\n\n withConfig(config: RunnableConfig): PregelInterface<Nodes, Channels>;\n\n getGraphAsync(\n config: RunnableConfig & { xray?: boolean | number }\n ): Promise<DrawableGraph>;\n\n /** @deprecated Use getSubgraphsAsync instead. The async method will become the default in the next minor release. */\n getSubgraphs(\n namespace?: string,\n recurse?: boolean\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ): Generator<[string, PregelInterface<any, any>]>;\n\n getSubgraphsAsync(\n namespace?: string,\n recurse?: boolean\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ): AsyncGenerator<[string, PregelInterface<any, any>]>;\n\n getState(\n config: RunnableConfig,\n options?: { subgraphs?: boolean }\n ): Promise<StateSnapshot>;\n\n getStateHistory(\n config: RunnableConfig,\n options?: CheckpointListOptions\n ): AsyncIterableIterator<StateSnapshot>;\n\n updateState(\n inputConfig: LangGraphRunnableConfig,\n values: Record<string, unknown> | unknown,\n asNode?: keyof Nodes | string\n ): Promise<RunnableConfig>;\n\n stream(\n input: PregelInputType,\n options?: Partial<PregelOptions<Nodes, Channels, ContextType>>\n ): Promise<IterableReadableStream<PregelOutputType>>;\n\n invoke(\n input: PregelInputType,\n options?: Partial<PregelOptions<Nodes, Channels, ContextType>>\n ): Promise<PregelOutputType>;\n}\n\n/**\n * Parameters for creating a Pregel graph.\n * @internal\n */\nexport type PregelParams<\n Nodes extends StrRecord<string, PregelNode>,\n Channels extends StrRecord<string, BaseChannel>\n> = {\n /**\n * The name of the graph. @see {@link Runnable.name}\n */\n name?: string;\n\n /**\n * The nodes in the graph.\n */\n nodes: Nodes;\n\n /**\n * The channels in the graph.\n */\n channels: Channels;\n\n /**\n * Whether to validate the graph.\n *\n * @default true\n */\n autoValidate?: boolean;\n\n /**\n * The stream mode for the graph run. See [Streaming](/langgraphjs/how-tos/#streaming) for more details.\n *\n * @default [\"values\"]\n */\n streamMode?: StreamMode | StreamMode[];\n\n /**\n * The input channels for the graph run.\n */\n inputChannels: keyof Channels | Array<keyof Channels>;\n\n /**\n * The output channels for the graph run.\n */\n outputChannels: keyof Channels | Array<keyof Channels>;\n\n /**\n * After processing one of the nodes named in this list, the graph will be interrupted and a resume {@link Command} must be provided to proceed with the execution of this thread.\n * @default []\n */\n interruptAfter?: Array<keyof Nodes> | All;\n\n /**\n * Before processing one of the nodes named in this list, the graph will be interrupted and a resume {@link Command} must be provided to proceed with the execution of this thread.\n * @default []\n */\n interruptBefore?: Array<keyof Nodes> | All;\n\n /**\n * The channels to stream from the graph run.\n * @default []\n */\n streamChannels?: keyof Channels | Array<keyof Channels>;\n\n /**\n * @default undefined\n */\n stepTimeout?: number;\n\n /**\n * @default false\n */\n debug?: boolean;\n\n /**\n * The {@link BaseCheckpointSaver | checkpointer} to use for the graph run.\n */\n checkpointer?: BaseCheckpointSaver | boolean;\n\n /**\n * The default retry policy for this graph. For defaults, see {@link RetryPolicy}.\n */\n retryPolicy?: RetryPolicy;\n\n /**\n * The configuration for the graph run.\n */\n config?: LangGraphRunnableConfig;\n\n /**\n * External key-value store.\n */\n store?: BaseStore;\n\n /**\n * Storage used for node caching.\n */\n cache?: BaseCache;\n};\n\nexport interface PregelTaskDescription {\n readonly id: string;\n readonly name: string;\n readonly error?: unknown;\n readonly interrupts: Interrupt[];\n readonly state?: LangGraphRunnableConfig | StateSnapshot;\n readonly path?: TaskPath;\n readonly result?: unknown;\n}\n\ninterface CacheKey {\n ns: string[];\n key: string;\n ttl?: number;\n}\n\nexport interface PregelExecutableTask<\n NodeKey extends PropertyKey,\n ChannelKey extends PropertyKey\n> {\n readonly name: NodeKey;\n readonly input: unknown;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n readonly proc: Runnable<any, any, LangGraphRunnableConfig>;\n readonly writes: PendingWrite<ChannelKey>[];\n readonly config?: LangGraphRunnableConfig;\n readonly triggers: Array<string>;\n readonly retry_policy?: RetryPolicy;\n readonly cache_key?: CacheKey;\n readonly id: string;\n readonly path?: TaskPath;\n readonly subgraphs?: Runnable[];\n readonly writers: Runnable[];\n}\n\nexport interface StateSnapshot {\n /**\n * Current values of channels\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n readonly values: Record<string, any> | any;\n /**\n * Nodes to execute in the next step, if any\n */\n readonly next: Array<string>;\n /**\n * Config used to fetch this snapshot\n */\n readonly config: RunnableConfig;\n /**\n * Metadata about the checkpoint\n */\n readonly metadata?: CheckpointMetadata;\n /**\n * Time when the snapshot was created\n */\n readonly createdAt?: string;\n /**\n * Config used to fetch the parent snapshot, if any\n * @default undefined\n */\n readonly parentConfig?: RunnableConfig | undefined;\n /**\n * Tasks to execute in this step. If already attempted, may contain an error.\n */\n readonly tasks: PregelTaskDescription[];\n}\n\n/**\n * Options for subscribing to multiple channels.\n */\nexport type MultipleChannelSubscriptionOptions = {\n /**\n * Optional tags to associate with the subscription.\n */\n tags?: string[];\n};\n\n/**\n * Options for subscribing to a single channel.\n */\nexport type SingleChannelSubscriptionOptions = {\n /**\n * When specified, the channel mapping will be an object with this key pointing\n * to the array of channels to subscribe to. Otherwise, the channel mapping\n * will be an array of channels.\n */\n key?: string;\n /**\n * Optional tags to associate with the subscription.\n */\n tags?: string[];\n};\n\n/**\n * Options for getting the state of the graph.\n */\nexport type GetStateOptions = {\n /**\n * Whether to include subgraph states.\n * @default false\n */\n subgraphs?: boolean;\n};\n\n/**\n * Used for storing/retrieving internal execution state.\n *\n * @internal\n */\nexport type PregelScratchpad<Resume = unknown> = {\n /** Counter for tracking call invocations */\n callCounter: number;\n /** Counter for tracking interrupts */\n interruptCounter: number;\n /** List of resume values */\n resume: Resume[];\n /** Single resume value for null task ID */\n nullResume: Resume;\n\n consumeNullResume: () => Resume | undefined;\n /** Counter for tracking subgraph invocations */\n subgraphCounter: number;\n\n /** The input to the currently executing task */\n currentTaskInput: unknown;\n};\n\n/**\n * @internal\n */\nexport type PregelAbortSignals = {\n /** Aborts when the user calls `stream.cancel()` or aborts the {@link AbortSignal} that they passed in via the `signal` option */\n externalAbortSignal?: AbortSignal;\n\n /**\n * Aborts when the currently executing task throws any error other than a {@link GraphBubbleUp}\n */\n timeoutAbortSignal?: AbortSignal;\n\n /**\n * A reference to the AbortSignal that is passed to the node. Aborts on step timeout, stream cancel, or when an error is thrown.\n */\n composedAbortSignal?: AbortSignal;\n};\n\nexport type CallOptions = {\n func: (...args: unknown[]) => unknown | Promise<unknown>;\n name: string;\n input: unknown;\n cache?: CachePolicy;\n retry?: RetryPolicy;\n callbacks?: unknown;\n};\n\nexport class Call {\n func: (...args: unknown[]) => unknown | Promise<unknown>;\n\n name: string;\n\n input: unknown;\n\n retry?: RetryPolicy;\n\n cache?: CachePolicy;\n\n callbacks?: unknown;\n\n readonly __lg_type = \"call\";\n\n constructor({ func, name, input, retry, cache, callbacks }: CallOptions) {\n this.func = func;\n this.name = name;\n this.input = input;\n this.retry = retry;\n this.cache = cache;\n this.callbacks = callbacks;\n }\n}\n\nexport function isCall(value: unknown): value is Call {\n return (\n typeof value === \"object\" &&\n value !== null &&\n \"__lg_type\" in value &&\n value.__lg_type === \"call\"\n );\n}\n\nexport type SimpleTaskPath = [string, string | number];\nexport type VariadicTaskPath = [string, ...(string | number)[], boolean];\nexport type CallTaskPath =\n | [string, ...(string | number)[], Call]\n | [string, TaskPath, ...(string | number)[], Call];\nexport type TaskPath = SimpleTaskPath | CallTaskPath | VariadicTaskPath;\n"],"mappings":";;AA+nBA,IAAa,OAAb,MAAkB;CAChB;CAEA;CAEA;CAEA;CAEA;CAEA;CAEA,AAAS,YAAY;CAErB,YAAY,EAAE,MAAM,MAAM,OAAO,OAAO,OAAO,aAA0B;AACvE,OAAK,OAAO;AACZ,OAAK,OAAO;AACZ,OAAK,QAAQ;AACb,OAAK,QAAQ;AACb,OAAK,QAAQ;AACb,OAAK,YAAY;;;AAIrB,SAAgB,OAAO,OAA+B;AACpD,QACE,OAAO,UAAU,YACjB,UAAU,QACV,eAAe,SACf,MAAM,cAAc"}