@langchain/langgraph 1.0.6 → 1.0.12

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 (383) hide show
  1. package/package.json +7 -7
  2. package/CHANGELOG.md +0 -280
  3. package/dist/_virtual/rolldown_runtime.cjs +0 -25
  4. package/dist/channels/any_value.cjs +0 -46
  5. package/dist/channels/any_value.cjs.map +0 -1
  6. package/dist/channels/any_value.d.cts +0 -24
  7. package/dist/channels/any_value.d.cts.map +0 -1
  8. package/dist/channels/any_value.d.ts +0 -24
  9. package/dist/channels/any_value.d.ts.map +0 -1
  10. package/dist/channels/any_value.js +0 -46
  11. package/dist/channels/any_value.js.map +0 -1
  12. package/dist/channels/base.cjs +0 -102
  13. package/dist/channels/base.cjs.map +0 -1
  14. package/dist/channels/base.d.cts +0 -79
  15. package/dist/channels/base.d.cts.map +0 -1
  16. package/dist/channels/base.d.ts +0 -79
  17. package/dist/channels/base.d.ts.map +0 -1
  18. package/dist/channels/base.js +0 -97
  19. package/dist/channels/base.js.map +0 -1
  20. package/dist/channels/binop.cjs +0 -49
  21. package/dist/channels/binop.cjs.map +0 -1
  22. package/dist/channels/binop.d.cts +0 -22
  23. package/dist/channels/binop.d.cts.map +0 -1
  24. package/dist/channels/binop.d.ts +0 -22
  25. package/dist/channels/binop.d.ts.map +0 -1
  26. package/dist/channels/binop.js +0 -49
  27. package/dist/channels/binop.js.map +0 -1
  28. package/dist/channels/dynamic_barrier_value.cjs +0 -76
  29. package/dist/channels/dynamic_barrier_value.cjs.map +0 -1
  30. package/dist/channels/dynamic_barrier_value.d.cts +0 -42
  31. package/dist/channels/dynamic_barrier_value.d.cts.map +0 -1
  32. package/dist/channels/dynamic_barrier_value.d.ts +0 -42
  33. package/dist/channels/dynamic_barrier_value.d.ts.map +0 -1
  34. package/dist/channels/dynamic_barrier_value.js +0 -76
  35. package/dist/channels/dynamic_barrier_value.js.map +0 -1
  36. package/dist/channels/ephemeral_value.cjs +0 -46
  37. package/dist/channels/ephemeral_value.cjs.map +0 -1
  38. package/dist/channels/ephemeral_value.d.cts +0 -22
  39. package/dist/channels/ephemeral_value.d.cts.map +0 -1
  40. package/dist/channels/ephemeral_value.d.ts +0 -22
  41. package/dist/channels/ephemeral_value.d.ts.map +0 -1
  42. package/dist/channels/ephemeral_value.js +0 -46
  43. package/dist/channels/ephemeral_value.js.map +0 -1
  44. package/dist/channels/index.cjs +0 -21
  45. package/dist/channels/index.d.cts +0 -9
  46. package/dist/channels/index.d.ts +0 -9
  47. package/dist/channels/index.js +0 -10
  48. package/dist/channels/last_value.cjs +0 -98
  49. package/dist/channels/last_value.cjs.map +0 -1
  50. package/dist/channels/last_value.d.cts +0 -44
  51. package/dist/channels/last_value.d.cts.map +0 -1
  52. package/dist/channels/last_value.d.ts +0 -44
  53. package/dist/channels/last_value.d.ts.map +0 -1
  54. package/dist/channels/last_value.js +0 -97
  55. package/dist/channels/last_value.js.map +0 -1
  56. package/dist/channels/named_barrier_value.cjs +0 -118
  57. package/dist/channels/named_barrier_value.cjs.map +0 -1
  58. package/dist/channels/named_barrier_value.d.cts +0 -46
  59. package/dist/channels/named_barrier_value.d.cts.map +0 -1
  60. package/dist/channels/named_barrier_value.d.ts +0 -46
  61. package/dist/channels/named_barrier_value.d.ts.map +0 -1
  62. package/dist/channels/named_barrier_value.js +0 -116
  63. package/dist/channels/named_barrier_value.js.map +0 -1
  64. package/dist/channels/topic.cjs +0 -65
  65. package/dist/channels/topic.cjs.map +0 -1
  66. package/dist/channels/topic.d.cts +0 -32
  67. package/dist/channels/topic.d.cts.map +0 -1
  68. package/dist/channels/topic.d.ts +0 -32
  69. package/dist/channels/topic.d.ts.map +0 -1
  70. package/dist/channels/topic.js +0 -65
  71. package/dist/channels/topic.js.map +0 -1
  72. package/dist/constants.cjs +0 -406
  73. package/dist/constants.cjs.map +0 -1
  74. package/dist/constants.d.cts +0 -285
  75. package/dist/constants.d.cts.map +0 -1
  76. package/dist/constants.d.ts +0 -285
  77. package/dist/constants.d.ts.map +0 -1
  78. package/dist/constants.js +0 -362
  79. package/dist/constants.js.map +0 -1
  80. package/dist/errors.cjs +0 -163
  81. package/dist/errors.cjs.map +0 -1
  82. package/dist/errors.d.cts +0 -81
  83. package/dist/errors.d.cts.map +0 -1
  84. package/dist/errors.d.ts +0 -81
  85. package/dist/errors.d.ts.map +0 -1
  86. package/dist/errors.js +0 -146
  87. package/dist/errors.js.map +0 -1
  88. package/dist/func/index.cjs +0 -301
  89. package/dist/func/index.cjs.map +0 -1
  90. package/dist/func/index.d.cts +0 -293
  91. package/dist/func/index.d.cts.map +0 -1
  92. package/dist/func/index.d.ts +0 -293
  93. package/dist/func/index.d.ts.map +0 -1
  94. package/dist/func/index.js +0 -298
  95. package/dist/func/index.js.map +0 -1
  96. package/dist/func/types.d.cts +0 -64
  97. package/dist/func/types.d.cts.map +0 -1
  98. package/dist/func/types.d.ts +0 -64
  99. package/dist/func/types.d.ts.map +0 -1
  100. package/dist/graph/annotation.cjs +0 -101
  101. package/dist/graph/annotation.cjs.map +0 -1
  102. package/dist/graph/annotation.d.cts +0 -116
  103. package/dist/graph/annotation.d.cts.map +0 -1
  104. package/dist/graph/annotation.d.ts +0 -116
  105. package/dist/graph/annotation.d.ts.map +0 -1
  106. package/dist/graph/annotation.js +0 -99
  107. package/dist/graph/annotation.js.map +0 -1
  108. package/dist/graph/graph.cjs +0 -423
  109. package/dist/graph/graph.cjs.map +0 -1
  110. package/dist/graph/graph.d.cts +0 -132
  111. package/dist/graph/graph.d.cts.map +0 -1
  112. package/dist/graph/graph.d.ts +0 -132
  113. package/dist/graph/graph.d.ts.map +0 -1
  114. package/dist/graph/graph.js +0 -420
  115. package/dist/graph/graph.js.map +0 -1
  116. package/dist/graph/index.cjs +0 -5
  117. package/dist/graph/index.js +0 -7
  118. package/dist/graph/message.cjs +0 -99
  119. package/dist/graph/message.cjs.map +0 -1
  120. package/dist/graph/message.d.cts +0 -40
  121. package/dist/graph/message.d.cts.map +0 -1
  122. package/dist/graph/message.d.ts +0 -40
  123. package/dist/graph/message.d.ts.map +0 -1
  124. package/dist/graph/message.js +0 -95
  125. package/dist/graph/message.js.map +0 -1
  126. package/dist/graph/messages_annotation.cjs +0 -110
  127. package/dist/graph/messages_annotation.cjs.map +0 -1
  128. package/dist/graph/messages_annotation.d.cts +0 -112
  129. package/dist/graph/messages_annotation.d.cts.map +0 -1
  130. package/dist/graph/messages_annotation.d.ts +0 -112
  131. package/dist/graph/messages_annotation.d.ts.map +0 -1
  132. package/dist/graph/messages_annotation.js +0 -107
  133. package/dist/graph/messages_annotation.js.map +0 -1
  134. package/dist/graph/state.cjs +0 -501
  135. package/dist/graph/state.cjs.map +0 -1
  136. package/dist/graph/state.d.cts +0 -236
  137. package/dist/graph/state.d.cts.map +0 -1
  138. package/dist/graph/state.d.ts +0 -236
  139. package/dist/graph/state.d.ts.map +0 -1
  140. package/dist/graph/state.js +0 -499
  141. package/dist/graph/state.js.map +0 -1
  142. package/dist/graph/zod/index.cjs +0 -10
  143. package/dist/graph/zod/index.d.cts +0 -3
  144. package/dist/graph/zod/index.d.ts +0 -3
  145. package/dist/graph/zod/index.js +0 -5
  146. package/dist/graph/zod/meta.cjs +0 -145
  147. package/dist/graph/zod/meta.cjs.map +0 -1
  148. package/dist/graph/zod/meta.d.cts +0 -116
  149. package/dist/graph/zod/meta.d.cts.map +0 -1
  150. package/dist/graph/zod/meta.d.ts +0 -116
  151. package/dist/graph/zod/meta.d.ts.map +0 -1
  152. package/dist/graph/zod/meta.js +0 -141
  153. package/dist/graph/zod/meta.js.map +0 -1
  154. package/dist/graph/zod/plugin.cjs +0 -41
  155. package/dist/graph/zod/plugin.cjs.map +0 -1
  156. package/dist/graph/zod/plugin.js +0 -41
  157. package/dist/graph/zod/plugin.js.map +0 -1
  158. package/dist/graph/zod/schema.cjs +0 -99
  159. package/dist/graph/zod/schema.cjs.map +0 -1
  160. package/dist/graph/zod/schema.d.cts +0 -38
  161. package/dist/graph/zod/schema.d.cts.map +0 -1
  162. package/dist/graph/zod/schema.d.ts +0 -38
  163. package/dist/graph/zod/schema.d.ts.map +0 -1
  164. package/dist/graph/zod/schema.js +0 -94
  165. package/dist/graph/zod/schema.js.map +0 -1
  166. package/dist/graph/zod/zod-registry.cjs +0 -43
  167. package/dist/graph/zod/zod-registry.cjs.map +0 -1
  168. package/dist/graph/zod/zod-registry.d.cts +0 -51
  169. package/dist/graph/zod/zod-registry.d.cts.map +0 -1
  170. package/dist/graph/zod/zod-registry.d.ts +0 -51
  171. package/dist/graph/zod/zod-registry.d.ts.map +0 -1
  172. package/dist/graph/zod/zod-registry.js +0 -41
  173. package/dist/graph/zod/zod-registry.js.map +0 -1
  174. package/dist/hash.cjs +0 -271
  175. package/dist/hash.cjs.map +0 -1
  176. package/dist/hash.js +0 -269
  177. package/dist/hash.js.map +0 -1
  178. package/dist/index.cjs +0 -112
  179. package/dist/index.cjs.map +0 -1
  180. package/dist/index.d.cts +0 -26
  181. package/dist/index.d.ts +0 -26
  182. package/dist/index.js +0 -22
  183. package/dist/index.js.map +0 -1
  184. package/dist/interrupt.cjs +0 -82
  185. package/dist/interrupt.cjs.map +0 -1
  186. package/dist/interrupt.d.cts +0 -58
  187. package/dist/interrupt.d.cts.map +0 -1
  188. package/dist/interrupt.d.ts +0 -58
  189. package/dist/interrupt.d.ts.map +0 -1
  190. package/dist/interrupt.js +0 -81
  191. package/dist/interrupt.js.map +0 -1
  192. package/dist/prebuilt/agentName.cjs +0 -153
  193. package/dist/prebuilt/agentName.cjs.map +0 -1
  194. package/dist/prebuilt/agentName.d.cts +0 -42
  195. package/dist/prebuilt/agentName.d.cts.map +0 -1
  196. package/dist/prebuilt/agentName.d.ts +0 -42
  197. package/dist/prebuilt/agentName.d.ts.map +0 -1
  198. package/dist/prebuilt/agentName.js +0 -152
  199. package/dist/prebuilt/agentName.js.map +0 -1
  200. package/dist/prebuilt/agent_executor.cjs +0 -44
  201. package/dist/prebuilt/agent_executor.cjs.map +0 -1
  202. package/dist/prebuilt/agent_executor.d.cts +0 -58
  203. package/dist/prebuilt/agent_executor.d.cts.map +0 -1
  204. package/dist/prebuilt/agent_executor.d.ts +0 -58
  205. package/dist/prebuilt/agent_executor.d.ts.map +0 -1
  206. package/dist/prebuilt/agent_executor.js +0 -44
  207. package/dist/prebuilt/agent_executor.js.map +0 -1
  208. package/dist/prebuilt/chat_agent_executor.cjs +0 -68
  209. package/dist/prebuilt/chat_agent_executor.cjs.map +0 -1
  210. package/dist/prebuilt/chat_agent_executor.d.cts +0 -23
  211. package/dist/prebuilt/chat_agent_executor.d.cts.map +0 -1
  212. package/dist/prebuilt/chat_agent_executor.d.ts +0 -23
  213. package/dist/prebuilt/chat_agent_executor.d.ts.map +0 -1
  214. package/dist/prebuilt/chat_agent_executor.js +0 -67
  215. package/dist/prebuilt/chat_agent_executor.js.map +0 -1
  216. package/dist/prebuilt/index.cjs +0 -15
  217. package/dist/prebuilt/index.d.cts +0 -8
  218. package/dist/prebuilt/index.d.ts +0 -8
  219. package/dist/prebuilt/index.js +0 -8
  220. package/dist/prebuilt/interrupt.d.cts +0 -61
  221. package/dist/prebuilt/interrupt.d.cts.map +0 -1
  222. package/dist/prebuilt/interrupt.d.ts +0 -61
  223. package/dist/prebuilt/interrupt.d.ts.map +0 -1
  224. package/dist/prebuilt/react_agent_executor.cjs +0 -344
  225. package/dist/prebuilt/react_agent_executor.cjs.map +0 -1
  226. package/dist/prebuilt/react_agent_executor.d.cts +0 -230
  227. package/dist/prebuilt/react_agent_executor.d.cts.map +0 -1
  228. package/dist/prebuilt/react_agent_executor.d.ts +0 -230
  229. package/dist/prebuilt/react_agent_executor.d.ts.map +0 -1
  230. package/dist/prebuilt/react_agent_executor.js +0 -342
  231. package/dist/prebuilt/react_agent_executor.js.map +0 -1
  232. package/dist/prebuilt/tool_executor.cjs +0 -48
  233. package/dist/prebuilt/tool_executor.cjs.map +0 -1
  234. package/dist/prebuilt/tool_executor.d.cts +0 -42
  235. package/dist/prebuilt/tool_executor.d.cts.map +0 -1
  236. package/dist/prebuilt/tool_executor.d.ts +0 -42
  237. package/dist/prebuilt/tool_executor.d.ts.map +0 -1
  238. package/dist/prebuilt/tool_executor.js +0 -47
  239. package/dist/prebuilt/tool_executor.js.map +0 -1
  240. package/dist/prebuilt/tool_node.cjs +0 -248
  241. package/dist/prebuilt/tool_node.cjs.map +0 -1
  242. package/dist/prebuilt/tool_node.d.cts +0 -182
  243. package/dist/prebuilt/tool_node.d.cts.map +0 -1
  244. package/dist/prebuilt/tool_node.d.ts +0 -182
  245. package/dist/prebuilt/tool_node.d.ts.map +0 -1
  246. package/dist/prebuilt/tool_node.js +0 -246
  247. package/dist/prebuilt/tool_node.js.map +0 -1
  248. package/dist/pregel/algo.cjs +0 -573
  249. package/dist/pregel/algo.cjs.map +0 -1
  250. package/dist/pregel/algo.d.cts +0 -13
  251. package/dist/pregel/algo.d.cts.map +0 -1
  252. package/dist/pregel/algo.d.ts +0 -13
  253. package/dist/pregel/algo.d.ts.map +0 -1
  254. package/dist/pregel/algo.js +0 -567
  255. package/dist/pregel/algo.js.map +0 -1
  256. package/dist/pregel/call.cjs +0 -53
  257. package/dist/pregel/call.cjs.map +0 -1
  258. package/dist/pregel/call.js +0 -50
  259. package/dist/pregel/call.js.map +0 -1
  260. package/dist/pregel/debug.cjs +0 -175
  261. package/dist/pregel/debug.cjs.map +0 -1
  262. package/dist/pregel/debug.js +0 -169
  263. package/dist/pregel/debug.js.map +0 -1
  264. package/dist/pregel/index.cjs +0 -1170
  265. package/dist/pregel/index.cjs.map +0 -1
  266. package/dist/pregel/index.d.cts +0 -546
  267. package/dist/pregel/index.d.cts.map +0 -1
  268. package/dist/pregel/index.d.ts +0 -546
  269. package/dist/pregel/index.d.ts.map +0 -1
  270. package/dist/pregel/index.js +0 -1168
  271. package/dist/pregel/index.js.map +0 -1
  272. package/dist/pregel/io.cjs +0 -140
  273. package/dist/pregel/io.cjs.map +0 -1
  274. package/dist/pregel/io.js +0 -135
  275. package/dist/pregel/io.js.map +0 -1
  276. package/dist/pregel/loop.cjs +0 -548
  277. package/dist/pregel/loop.cjs.map +0 -1
  278. package/dist/pregel/loop.js +0 -547
  279. package/dist/pregel/loop.js.map +0 -1
  280. package/dist/pregel/messages.cjs +0 -108
  281. package/dist/pregel/messages.cjs.map +0 -1
  282. package/dist/pregel/messages.js +0 -107
  283. package/dist/pregel/messages.js.map +0 -1
  284. package/dist/pregel/read.cjs +0 -152
  285. package/dist/pregel/read.cjs.map +0 -1
  286. package/dist/pregel/read.d.cts +0 -51
  287. package/dist/pregel/read.d.cts.map +0 -1
  288. package/dist/pregel/read.d.ts +0 -51
  289. package/dist/pregel/read.d.ts.map +0 -1
  290. package/dist/pregel/read.js +0 -150
  291. package/dist/pregel/read.js.map +0 -1
  292. package/dist/pregel/remote.cjs +0 -346
  293. package/dist/pregel/remote.cjs.map +0 -1
  294. package/dist/pregel/remote.d.cts +0 -121
  295. package/dist/pregel/remote.d.cts.map +0 -1
  296. package/dist/pregel/remote.d.ts +0 -121
  297. package/dist/pregel/remote.d.ts.map +0 -1
  298. package/dist/pregel/remote.js +0 -345
  299. package/dist/pregel/remote.js.map +0 -1
  300. package/dist/pregel/retry.cjs +0 -92
  301. package/dist/pregel/retry.cjs.map +0 -1
  302. package/dist/pregel/retry.js +0 -92
  303. package/dist/pregel/retry.js.map +0 -1
  304. package/dist/pregel/runnable_types.d.cts +0 -49
  305. package/dist/pregel/runnable_types.d.cts.map +0 -1
  306. package/dist/pregel/runnable_types.d.ts +0 -49
  307. package/dist/pregel/runnable_types.d.ts.map +0 -1
  308. package/dist/pregel/runner.cjs +0 -228
  309. package/dist/pregel/runner.cjs.map +0 -1
  310. package/dist/pregel/runner.js +0 -228
  311. package/dist/pregel/runner.js.map +0 -1
  312. package/dist/pregel/stream.cjs +0 -199
  313. package/dist/pregel/stream.cjs.map +0 -1
  314. package/dist/pregel/stream.js +0 -196
  315. package/dist/pregel/stream.js.map +0 -1
  316. package/dist/pregel/types.cjs +0 -27
  317. package/dist/pregel/types.cjs.map +0 -1
  318. package/dist/pregel/types.d.cts +0 -453
  319. package/dist/pregel/types.d.cts.map +0 -1
  320. package/dist/pregel/types.d.ts +0 -453
  321. package/dist/pregel/types.d.ts.map +0 -1
  322. package/dist/pregel/types.js +0 -25
  323. package/dist/pregel/types.js.map +0 -1
  324. package/dist/pregel/utils/config.cjs +0 -122
  325. package/dist/pregel/utils/config.cjs.map +0 -1
  326. package/dist/pregel/utils/config.d.cts +0 -36
  327. package/dist/pregel/utils/config.d.cts.map +0 -1
  328. package/dist/pregel/utils/config.d.ts +0 -36
  329. package/dist/pregel/utils/config.d.ts.map +0 -1
  330. package/dist/pregel/utils/config.js +0 -115
  331. package/dist/pregel/utils/config.js.map +0 -1
  332. package/dist/pregel/utils/index.cjs +0 -103
  333. package/dist/pregel/utils/index.cjs.map +0 -1
  334. package/dist/pregel/utils/index.d.cts +0 -51
  335. package/dist/pregel/utils/index.d.cts.map +0 -1
  336. package/dist/pregel/utils/index.d.ts +0 -51
  337. package/dist/pregel/utils/index.d.ts.map +0 -1
  338. package/dist/pregel/utils/index.js +0 -97
  339. package/dist/pregel/utils/index.js.map +0 -1
  340. package/dist/pregel/utils/subgraph.cjs +0 -19
  341. package/dist/pregel/utils/subgraph.cjs.map +0 -1
  342. package/dist/pregel/utils/subgraph.js +0 -17
  343. package/dist/pregel/utils/subgraph.js.map +0 -1
  344. package/dist/pregel/validate.cjs +0 -45
  345. package/dist/pregel/validate.cjs.map +0 -1
  346. package/dist/pregel/validate.js +0 -44
  347. package/dist/pregel/validate.js.map +0 -1
  348. package/dist/pregel/write.cjs +0 -97
  349. package/dist/pregel/write.cjs.map +0 -1
  350. package/dist/pregel/write.d.cts +0 -35
  351. package/dist/pregel/write.d.cts.map +0 -1
  352. package/dist/pregel/write.d.ts +0 -35
  353. package/dist/pregel/write.d.ts.map +0 -1
  354. package/dist/pregel/write.js +0 -95
  355. package/dist/pregel/write.js.map +0 -1
  356. package/dist/remote.cjs +0 -3
  357. package/dist/remote.d.cts +0 -2
  358. package/dist/remote.d.ts +0 -2
  359. package/dist/remote.js +0 -3
  360. package/dist/setup/async_local_storage.cjs +0 -12
  361. package/dist/setup/async_local_storage.cjs.map +0 -1
  362. package/dist/setup/async_local_storage.js +0 -11
  363. package/dist/setup/async_local_storage.js.map +0 -1
  364. package/dist/utils.cjs +0 -88
  365. package/dist/utils.cjs.map +0 -1
  366. package/dist/utils.d.cts +0 -32
  367. package/dist/utils.d.cts.map +0 -1
  368. package/dist/utils.d.ts +0 -32
  369. package/dist/utils.d.ts.map +0 -1
  370. package/dist/utils.js +0 -81
  371. package/dist/utils.js.map +0 -1
  372. package/dist/web.cjs +0 -96
  373. package/dist/web.d.cts +0 -23
  374. package/dist/web.d.ts +0 -23
  375. package/dist/web.js +0 -15
  376. package/dist/writer.cjs +0 -15
  377. package/dist/writer.cjs.map +0 -1
  378. package/dist/writer.d.cts +0 -7
  379. package/dist/writer.d.cts.map +0 -1
  380. package/dist/writer.d.ts +0 -7
  381. package/dist/writer.d.ts.map +0 -1
  382. package/dist/writer.js +0 -14
  383. package/dist/writer.js.map +0 -1
@@ -1,122 +0,0 @@
1
- const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
- const require_constants = require('../../constants.cjs');
3
- const __langchain_core_singletons = require_rolldown_runtime.__toESM(require("@langchain/core/singletons"));
4
-
5
- //#region src/pregel/utils/config.ts
6
- const COPIABLE_KEYS = [
7
- "tags",
8
- "metadata",
9
- "callbacks",
10
- "configurable"
11
- ];
12
- const CONFIG_KEYS = [
13
- "tags",
14
- "metadata",
15
- "callbacks",
16
- "runName",
17
- "maxConcurrency",
18
- "recursionLimit",
19
- "configurable",
20
- "runId",
21
- "outputKeys",
22
- "streamMode",
23
- "store",
24
- "writer",
25
- "interrupt",
26
- "context",
27
- "interruptBefore",
28
- "interruptAfter",
29
- "checkpointDuring",
30
- "durability",
31
- "signal"
32
- ];
33
- const DEFAULT_RECURSION_LIMIT = 25;
34
- function ensureLangGraphConfig(...configs) {
35
- const empty = {
36
- tags: [],
37
- metadata: {},
38
- callbacks: void 0,
39
- recursionLimit: DEFAULT_RECURSION_LIMIT,
40
- configurable: {}
41
- };
42
- const implicitConfig = __langchain_core_singletons.AsyncLocalStorageProviderSingleton.getRunnableConfig();
43
- if (implicitConfig !== void 0) {
44
- for (const [k, v] of Object.entries(implicitConfig)) if (v !== void 0) if (COPIABLE_KEYS.includes(k)) {
45
- let copiedValue;
46
- if (Array.isArray(v)) copiedValue = [...v];
47
- else if (typeof v === "object") if (k === "callbacks" && "copy" in v && typeof v.copy === "function") copiedValue = v.copy();
48
- else copiedValue = { ...v };
49
- else copiedValue = v;
50
- empty[k] = copiedValue;
51
- } else empty[k] = v;
52
- }
53
- for (const config of configs) {
54
- if (config === void 0) continue;
55
- for (const [k, v] of Object.entries(config)) if (v !== void 0 && CONFIG_KEYS.includes(k)) empty[k] = v;
56
- }
57
- for (const [key, value] of Object.entries(empty.configurable)) {
58
- empty.metadata = empty.metadata ?? {};
59
- if (!key.startsWith("__") && (typeof value === "string" || typeof value === "number" || typeof value === "boolean") && !(key in empty.metadata)) empty.metadata[key] = value;
60
- }
61
- return empty;
62
- }
63
- /**
64
- * A helper utility function that returns the {@link BaseStore} that was set when the graph was initialized
65
- *
66
- * @returns a reference to the {@link BaseStore} that was set when the graph was initialized
67
- */
68
- function getStore(config) {
69
- const runConfig = config ?? __langchain_core_singletons.AsyncLocalStorageProviderSingleton.getRunnableConfig();
70
- if (runConfig === void 0) throw new Error(["Config not retrievable. This is likely because you are running in an environment without support for AsyncLocalStorage.", "If you're running `getStore` in such environment, pass the `config` from the node function directly."].join("\n"));
71
- return runConfig?.store;
72
- }
73
- /**
74
- * A helper utility function that returns the {@link LangGraphRunnableConfig#writer} if "custom" stream mode is enabled, otherwise undefined.
75
- *
76
- * @returns a reference to the {@link LangGraphRunnableConfig#writer} if "custom" stream mode is enabled, otherwise undefined
77
- */
78
- function getWriter(config) {
79
- const runConfig = config ?? __langchain_core_singletons.AsyncLocalStorageProviderSingleton.getRunnableConfig();
80
- if (runConfig === void 0) throw new Error(["Config not retrievable. This is likely because you are running in an environment without support for AsyncLocalStorage.", "If you're running `getWriter` in such environment, pass the `config` from the node function directly."].join("\n"));
81
- return runConfig?.writer || runConfig?.configurable?.writer;
82
- }
83
- /**
84
- * A helper utility function that returns the {@link LangGraphRunnableConfig} that was set when the graph was initialized.
85
- *
86
- * Note: This only works when running in an environment that supports node:async_hooks and AsyncLocalStorage. If you're running this in a
87
- * web environment, access the LangGraphRunnableConfig from the node function directly.
88
- *
89
- * @returns the {@link LangGraphRunnableConfig} that was set when the graph was initialized
90
- */
91
- function getConfig() {
92
- return __langchain_core_singletons.AsyncLocalStorageProviderSingleton.getRunnableConfig();
93
- }
94
- /**
95
- * A helper utility function that returns the input for the currently executing task
96
- *
97
- * @returns the input for the currently executing task
98
- */
99
- function getCurrentTaskInput(config) {
100
- const runConfig = config ?? __langchain_core_singletons.AsyncLocalStorageProviderSingleton.getRunnableConfig();
101
- if (runConfig === void 0) throw new Error(["Config not retrievable. This is likely because you are running in an environment without support for AsyncLocalStorage.", "If you're running `getCurrentTaskInput` in such environment, pass the `config` from the node function directly."].join("\n"));
102
- if (runConfig.configurable?.[require_constants.CONFIG_KEY_SCRATCHPAD]?.currentTaskInput === void 0) throw new Error("BUG: internal scratchpad not initialized.");
103
- return runConfig.configurable[require_constants.CONFIG_KEY_SCRATCHPAD].currentTaskInput;
104
- }
105
- function recastCheckpointNamespace(namespace) {
106
- return namespace.split(require_constants.CHECKPOINT_NAMESPACE_SEPARATOR).filter((part) => !part.match(/^\d+$/)).map((part) => part.split(require_constants.CHECKPOINT_NAMESPACE_END)[0]).join(require_constants.CHECKPOINT_NAMESPACE_SEPARATOR);
107
- }
108
- function getParentCheckpointNamespace(namespace) {
109
- const parts = namespace.split(require_constants.CHECKPOINT_NAMESPACE_SEPARATOR);
110
- while (parts.length > 1 && parts[parts.length - 1].match(/^\d+$/)) parts.pop();
111
- return parts.slice(0, -1).join(require_constants.CHECKPOINT_NAMESPACE_SEPARATOR);
112
- }
113
-
114
- //#endregion
115
- exports.ensureLangGraphConfig = ensureLangGraphConfig;
116
- exports.getConfig = getConfig;
117
- exports.getCurrentTaskInput = getCurrentTaskInput;
118
- exports.getParentCheckpointNamespace = getParentCheckpointNamespace;
119
- exports.getStore = getStore;
120
- exports.getWriter = getWriter;
121
- exports.recastCheckpointNamespace = recastCheckpointNamespace;
122
- //# sourceMappingURL=config.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.cjs","names":["empty: LangGraphRunnableConfig","implicitConfig: RunnableConfig","AsyncLocalStorageProviderSingleton","runConfig: LangGraphRunnableConfig","CONFIG_KEY_SCRATCHPAD","CHECKPOINT_NAMESPACE_SEPARATOR","CHECKPOINT_NAMESPACE_END"],"sources":["../../../src/pregel/utils/config.ts"],"sourcesContent":["import { RunnableConfig } from \"@langchain/core/runnables\";\nimport { AsyncLocalStorageProviderSingleton } from \"@langchain/core/singletons\";\nimport { BaseStore } from \"@langchain/langgraph-checkpoint\";\nimport { LangGraphRunnableConfig } from \"../runnable_types.js\";\nimport {\n CHECKPOINT_NAMESPACE_END,\n CHECKPOINT_NAMESPACE_SEPARATOR,\n CONFIG_KEY_SCRATCHPAD,\n} from \"../../constants.js\";\n\nconst COPIABLE_KEYS = [\"tags\", \"metadata\", \"callbacks\", \"configurable\"];\n\nconst CONFIG_KEYS = [\n \"tags\",\n \"metadata\",\n \"callbacks\",\n \"runName\",\n \"maxConcurrency\",\n \"recursionLimit\",\n \"configurable\",\n \"runId\",\n \"outputKeys\",\n \"streamMode\",\n \"store\",\n \"writer\",\n \"interrupt\",\n \"context\",\n \"interruptBefore\",\n \"interruptAfter\",\n \"checkpointDuring\",\n \"durability\",\n \"signal\",\n];\n\nconst DEFAULT_RECURSION_LIMIT = 25;\n\nexport function ensureLangGraphConfig(\n ...configs: (LangGraphRunnableConfig | undefined)[]\n): RunnableConfig {\n const empty: LangGraphRunnableConfig = {\n tags: [],\n metadata: {},\n callbacks: undefined,\n recursionLimit: DEFAULT_RECURSION_LIMIT,\n configurable: {},\n };\n\n const implicitConfig: RunnableConfig =\n AsyncLocalStorageProviderSingleton.getRunnableConfig();\n if (implicitConfig !== undefined) {\n for (const [k, v] of Object.entries(implicitConfig)) {\n if (v !== undefined) {\n if (COPIABLE_KEYS.includes(k)) {\n let copiedValue;\n if (Array.isArray(v)) {\n copiedValue = [...v];\n } else if (typeof v === \"object\") {\n if (\n k === \"callbacks\" &&\n \"copy\" in v &&\n typeof v.copy === \"function\"\n ) {\n copiedValue = v.copy();\n } else {\n copiedValue = { ...v };\n }\n } else {\n copiedValue = v;\n }\n empty[k as keyof RunnableConfig] = copiedValue;\n } else {\n empty[k as keyof RunnableConfig] = v;\n }\n }\n }\n }\n\n for (const config of configs) {\n if (config === undefined) {\n continue;\n }\n\n for (const [k, v] of Object.entries(config)) {\n if (v !== undefined && CONFIG_KEYS.includes(k)) {\n empty[k as keyof LangGraphRunnableConfig] = v;\n }\n }\n }\n\n for (const [key, value] of Object.entries(empty.configurable!)) {\n empty.metadata = empty.metadata ?? {};\n if (\n !key.startsWith(\"__\") &&\n (typeof value === \"string\" ||\n typeof value === \"number\" ||\n typeof value === \"boolean\") &&\n !(key in empty.metadata!)\n ) {\n empty.metadata[key] = value;\n }\n }\n\n return empty;\n}\n\n/**\n * A helper utility function that returns the {@link BaseStore} that was set when the graph was initialized\n *\n * @returns a reference to the {@link BaseStore} that was set when the graph was initialized\n */\nexport function getStore(\n config?: LangGraphRunnableConfig\n): BaseStore | undefined {\n const runConfig: LangGraphRunnableConfig =\n config ?? AsyncLocalStorageProviderSingleton.getRunnableConfig();\n\n if (runConfig === undefined) {\n throw new Error(\n [\n \"Config not retrievable. This is likely because you are running in an environment without support for AsyncLocalStorage.\",\n \"If you're running `getStore` in such environment, pass the `config` from the node function directly.\",\n ].join(\"\\n\")\n );\n }\n\n return runConfig?.store;\n}\n\n/**\n * A helper utility function that returns the {@link LangGraphRunnableConfig#writer} if \"custom\" stream mode is enabled, otherwise undefined.\n *\n * @returns a reference to the {@link LangGraphRunnableConfig#writer} if \"custom\" stream mode is enabled, otherwise undefined\n */\nexport function getWriter(\n config?: LangGraphRunnableConfig\n): ((chunk: unknown) => void) | undefined {\n const runConfig: LangGraphRunnableConfig =\n config ?? AsyncLocalStorageProviderSingleton.getRunnableConfig();\n\n if (runConfig === undefined) {\n throw new Error(\n [\n \"Config not retrievable. This is likely because you are running in an environment without support for AsyncLocalStorage.\",\n \"If you're running `getWriter` in such environment, pass the `config` from the node function directly.\",\n ].join(\"\\n\")\n );\n }\n\n return runConfig?.writer || runConfig?.configurable?.writer;\n}\n\n/**\n * A helper utility function that returns the {@link LangGraphRunnableConfig} that was set when the graph was initialized.\n *\n * Note: This only works when running in an environment that supports node:async_hooks and AsyncLocalStorage. If you're running this in a\n * web environment, access the LangGraphRunnableConfig from the node function directly.\n *\n * @returns the {@link LangGraphRunnableConfig} that was set when the graph was initialized\n */\nexport function getConfig(): LangGraphRunnableConfig {\n return AsyncLocalStorageProviderSingleton.getRunnableConfig();\n}\n\n/**\n * A helper utility function that returns the input for the currently executing task\n *\n * @returns the input for the currently executing task\n */\nexport function getCurrentTaskInput<T = unknown>(\n config?: LangGraphRunnableConfig\n): T {\n const runConfig: LangGraphRunnableConfig =\n config ?? AsyncLocalStorageProviderSingleton.getRunnableConfig();\n\n if (runConfig === undefined) {\n throw new Error(\n [\n \"Config not retrievable. This is likely because you are running in an environment without support for AsyncLocalStorage.\",\n \"If you're running `getCurrentTaskInput` in such environment, pass the `config` from the node function directly.\",\n ].join(\"\\n\")\n );\n }\n\n if (\n runConfig.configurable?.[CONFIG_KEY_SCRATCHPAD]?.currentTaskInput ===\n undefined\n ) {\n throw new Error(\"BUG: internal scratchpad not initialized.\");\n }\n\n return runConfig!.configurable![CONFIG_KEY_SCRATCHPAD]!.currentTaskInput as T;\n}\n\nexport function recastCheckpointNamespace(namespace: string): string {\n return namespace\n .split(CHECKPOINT_NAMESPACE_SEPARATOR)\n .filter((part) => !part.match(/^\\d+$/))\n .map((part) => part.split(CHECKPOINT_NAMESPACE_END)[0])\n .join(CHECKPOINT_NAMESPACE_SEPARATOR);\n}\n\nexport function getParentCheckpointNamespace(namespace: string): string {\n const parts = namespace.split(CHECKPOINT_NAMESPACE_SEPARATOR);\n while (parts.length > 1 && parts[parts.length - 1].match(/^\\d+$/)) {\n parts.pop();\n }\n return parts.slice(0, -1).join(CHECKPOINT_NAMESPACE_SEPARATOR);\n}\n"],"mappings":";;;;;AAUA,MAAM,gBAAgB;CAAC;CAAQ;CAAY;CAAa;;AAExD,MAAM,cAAc;CAClB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;;AAGF,MAAM,0BAA0B;AAEhC,SAAgB,sBACd,GAAG,SACa;CAChB,MAAMA,QAAiC;EACrC,MAAM;EACN,UAAU;EACV,WAAW;EACX,gBAAgB;EAChB,cAAc;;CAGhB,MAAMC,iBACJC,+DAAmC;AACrC,KAAI,mBAAmB,QACrB;OAAK,MAAM,CAAC,GAAG,MAAM,OAAO,QAAQ,gBAClC,KAAI,MAAM,OACR,KAAI,cAAc,SAAS,IAAI;GAC7B,IAAI;AACJ,OAAI,MAAM,QAAQ,GAChB,eAAc,CAAC,GAAG;YACT,OAAO,MAAM,SACtB,KACE,MAAM,eACN,UAAU,KACV,OAAO,EAAE,SAAS,WAElB,eAAc,EAAE;OAEhB,eAAc,EAAE,GAAG;OAGrB,eAAc;AAEhB,SAAM,KAA6B;QAEnC,OAAM,KAA6B;;AAM3C,MAAK,MAAM,UAAU,SAAS;AAC5B,MAAI,WAAW,OACb;AAGF,OAAK,MAAM,CAAC,GAAG,MAAM,OAAO,QAAQ,QAClC,KAAI,MAAM,UAAa,YAAY,SAAS,GAC1C,OAAM,KAAsC;;AAKlD,MAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,MAAM,eAAgB;AAC9D,QAAM,WAAW,MAAM,YAAY;AACnC,MACE,CAAC,IAAI,WAAW,UACf,OAAO,UAAU,YAChB,OAAO,UAAU,YACjB,OAAO,UAAU,cACnB,EAAE,OAAO,MAAM,UAEf,OAAM,SAAS,OAAO;;AAI1B,QAAO;;;;;;;AAQT,SAAgB,SACd,QACuB;CACvB,MAAMC,YACJ,UAAUD,+DAAmC;AAE/C,KAAI,cAAc,OAChB,OAAM,IAAI,MACR,CACE,2HACA,wGACA,KAAK;AAIX,QAAO,WAAW;;;;;;;AAQpB,SAAgB,UACd,QACwC;CACxC,MAAMC,YACJ,UAAUD,+DAAmC;AAE/C,KAAI,cAAc,OAChB,OAAM,IAAI,MACR,CACE,2HACA,yGACA,KAAK;AAIX,QAAO,WAAW,UAAU,WAAW,cAAc;;;;;;;;;;AAWvD,SAAgB,YAAqC;AACnD,QAAOA,+DAAmC;;;;;;;AAQ5C,SAAgB,oBACd,QACG;CACH,MAAMC,YACJ,UAAUD,+DAAmC;AAE/C,KAAI,cAAc,OAChB,OAAM,IAAI,MACR,CACE,2HACA,mHACA,KAAK;AAIX,KACE,UAAU,eAAeE,0CAAwB,qBACjD,OAEA,OAAM,IAAI,MAAM;AAGlB,QAAO,UAAW,aAAcA,yCAAwB;;AAG1D,SAAgB,0BAA0B,WAA2B;AACnE,QAAO,UACJ,MAAMC,kDACN,QAAQ,SAAS,CAAC,KAAK,MAAM,UAC7B,KAAK,SAAS,KAAK,MAAMC,4CAA0B,IACnD,KAAKD;;AAGV,SAAgB,6BAA6B,WAA2B;CACtE,MAAM,QAAQ,UAAU,MAAMA;AAC9B,QAAO,MAAM,SAAS,KAAK,MAAM,MAAM,SAAS,GAAG,MAAM,SACvD,OAAM;AAER,QAAO,MAAM,MAAM,GAAG,IAAI,KAAKA"}
@@ -1,36 +0,0 @@
1
- import { LangGraphRunnableConfig } from "../runnable_types.cjs";
2
- import { BaseStore } from "@langchain/langgraph-checkpoint";
3
- import { RunnableConfig } from "@langchain/core/runnables";
4
-
5
- //#region src/pregel/utils/config.d.ts
6
-
7
- /**
8
- * A helper utility function that returns the {@link BaseStore} that was set when the graph was initialized
9
- *
10
- * @returns a reference to the {@link BaseStore} that was set when the graph was initialized
11
- */
12
- declare function getStore(config?: LangGraphRunnableConfig): BaseStore | undefined;
13
- /**
14
- * A helper utility function that returns the {@link LangGraphRunnableConfig#writer} if "custom" stream mode is enabled, otherwise undefined.
15
- *
16
- * @returns a reference to the {@link LangGraphRunnableConfig#writer} if "custom" stream mode is enabled, otherwise undefined
17
- */
18
- declare function getWriter(config?: LangGraphRunnableConfig): ((chunk: unknown) => void) | undefined;
19
- /**
20
- * A helper utility function that returns the {@link LangGraphRunnableConfig} that was set when the graph was initialized.
21
- *
22
- * Note: This only works when running in an environment that supports node:async_hooks and AsyncLocalStorage. If you're running this in a
23
- * web environment, access the LangGraphRunnableConfig from the node function directly.
24
- *
25
- * @returns the {@link LangGraphRunnableConfig} that was set when the graph was initialized
26
- */
27
- declare function getConfig(): LangGraphRunnableConfig;
28
- /**
29
- * A helper utility function that returns the input for the currently executing task
30
- *
31
- * @returns the input for the currently executing task
32
- */
33
- declare function getCurrentTaskInput<T = unknown>(config?: LangGraphRunnableConfig): T;
34
- //#endregion
35
- export { getConfig, getCurrentTaskInput, getStore, getWriter };
36
- //# sourceMappingURL=config.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.d.cts","names":["RunnableConfig","BaseStore","LangGraphRunnableConfig","ensureLangGraphConfig","getStore","getWriter","getConfig","getCurrentTaskInput","T","recastCheckpointNamespace","getParentCheckpointNamespace"],"sources":["../../../src/pregel/utils/config.d.ts"],"sourcesContent":["import { RunnableConfig } from \"@langchain/core/runnables\";\nimport { BaseStore } from \"@langchain/langgraph-checkpoint\";\nimport { LangGraphRunnableConfig } from \"../runnable_types.js\";\nexport declare function ensureLangGraphConfig(...configs: (LangGraphRunnableConfig | undefined)[]): RunnableConfig;\n/**\n * A helper utility function that returns the {@link BaseStore} that was set when the graph was initialized\n *\n * @returns a reference to the {@link BaseStore} that was set when the graph was initialized\n */\nexport declare function getStore(config?: LangGraphRunnableConfig): BaseStore | undefined;\n/**\n * A helper utility function that returns the {@link LangGraphRunnableConfig#writer} if \"custom\" stream mode is enabled, otherwise undefined.\n *\n * @returns a reference to the {@link LangGraphRunnableConfig#writer} if \"custom\" stream mode is enabled, otherwise undefined\n */\nexport declare function getWriter(config?: LangGraphRunnableConfig): ((chunk: unknown) => void) | undefined;\n/**\n * A helper utility function that returns the {@link LangGraphRunnableConfig} that was set when the graph was initialized.\n *\n * Note: This only works when running in an environment that supports node:async_hooks and AsyncLocalStorage. If you're running this in a\n * web environment, access the LangGraphRunnableConfig from the node function directly.\n *\n * @returns the {@link LangGraphRunnableConfig} that was set when the graph was initialized\n */\nexport declare function getConfig(): LangGraphRunnableConfig;\n/**\n * A helper utility function that returns the input for the currently executing task\n *\n * @returns the input for the currently executing task\n */\nexport declare function getCurrentTaskInput<T = unknown>(config?: LangGraphRunnableConfig): T;\nexport declare function recastCheckpointNamespace(namespace: string): string;\nexport declare function getParentCheckpointNamespace(namespace: string): string;\n"],"mappings":";;;;;;;AASA;;;;iBAAwBI,QAAAA,UAAkBF,0BAA0BD;AAMpE;AASA;AAMA;;;AAA4FO,iBAfpEH,SAAAA,CAeoEG,MAAAA,CAAAA,EAfjDN,uBAeiDM,CAAAA,EAAAA,CAAAA,CAAAA,KAAAA,EAAAA,OAAAA,EAAAA,GAAAA,IAAAA,CAAAA,GAAAA,SAAAA;;;;;;;;;iBANpEF,SAAAA,CAAAA,GAAaJ;;;;;;iBAMbK,0CAA0CL,0BAA0BM"}
@@ -1,36 +0,0 @@
1
- import { LangGraphRunnableConfig } from "../runnable_types.js";
2
- import { BaseStore } from "@langchain/langgraph-checkpoint";
3
- import { RunnableConfig } from "@langchain/core/runnables";
4
-
5
- //#region src/pregel/utils/config.d.ts
6
-
7
- /**
8
- * A helper utility function that returns the {@link BaseStore} that was set when the graph was initialized
9
- *
10
- * @returns a reference to the {@link BaseStore} that was set when the graph was initialized
11
- */
12
- declare function getStore(config?: LangGraphRunnableConfig): BaseStore | undefined;
13
- /**
14
- * A helper utility function that returns the {@link LangGraphRunnableConfig#writer} if "custom" stream mode is enabled, otherwise undefined.
15
- *
16
- * @returns a reference to the {@link LangGraphRunnableConfig#writer} if "custom" stream mode is enabled, otherwise undefined
17
- */
18
- declare function getWriter(config?: LangGraphRunnableConfig): ((chunk: unknown) => void) | undefined;
19
- /**
20
- * A helper utility function that returns the {@link LangGraphRunnableConfig} that was set when the graph was initialized.
21
- *
22
- * Note: This only works when running in an environment that supports node:async_hooks and AsyncLocalStorage. If you're running this in a
23
- * web environment, access the LangGraphRunnableConfig from the node function directly.
24
- *
25
- * @returns the {@link LangGraphRunnableConfig} that was set when the graph was initialized
26
- */
27
- declare function getConfig(): LangGraphRunnableConfig;
28
- /**
29
- * A helper utility function that returns the input for the currently executing task
30
- *
31
- * @returns the input for the currently executing task
32
- */
33
- declare function getCurrentTaskInput<T = unknown>(config?: LangGraphRunnableConfig): T;
34
- //#endregion
35
- export { getConfig, getCurrentTaskInput, getStore, getWriter };
36
- //# sourceMappingURL=config.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.d.ts","names":["RunnableConfig","BaseStore","LangGraphRunnableConfig","ensureLangGraphConfig","getStore","getWriter","getConfig","getCurrentTaskInput","T","recastCheckpointNamespace","getParentCheckpointNamespace"],"sources":["../../../src/pregel/utils/config.d.ts"],"sourcesContent":["import { RunnableConfig } from \"@langchain/core/runnables\";\nimport { BaseStore } from \"@langchain/langgraph-checkpoint\";\nimport { LangGraphRunnableConfig } from \"../runnable_types.js\";\nexport declare function ensureLangGraphConfig(...configs: (LangGraphRunnableConfig | undefined)[]): RunnableConfig;\n/**\n * A helper utility function that returns the {@link BaseStore} that was set when the graph was initialized\n *\n * @returns a reference to the {@link BaseStore} that was set when the graph was initialized\n */\nexport declare function getStore(config?: LangGraphRunnableConfig): BaseStore | undefined;\n/**\n * A helper utility function that returns the {@link LangGraphRunnableConfig#writer} if \"custom\" stream mode is enabled, otherwise undefined.\n *\n * @returns a reference to the {@link LangGraphRunnableConfig#writer} if \"custom\" stream mode is enabled, otherwise undefined\n */\nexport declare function getWriter(config?: LangGraphRunnableConfig): ((chunk: unknown) => void) | undefined;\n/**\n * A helper utility function that returns the {@link LangGraphRunnableConfig} that was set when the graph was initialized.\n *\n * Note: This only works when running in an environment that supports node:async_hooks and AsyncLocalStorage. If you're running this in a\n * web environment, access the LangGraphRunnableConfig from the node function directly.\n *\n * @returns the {@link LangGraphRunnableConfig} that was set when the graph was initialized\n */\nexport declare function getConfig(): LangGraphRunnableConfig;\n/**\n * A helper utility function that returns the input for the currently executing task\n *\n * @returns the input for the currently executing task\n */\nexport declare function getCurrentTaskInput<T = unknown>(config?: LangGraphRunnableConfig): T;\nexport declare function recastCheckpointNamespace(namespace: string): string;\nexport declare function getParentCheckpointNamespace(namespace: string): string;\n"],"mappings":";;;;;;;AASA;;;;iBAAwBI,QAAAA,UAAkBF,0BAA0BD;AAMpE;AASA;AAMA;;;AAA4FO,iBAfpEH,SAAAA,CAeoEG,MAAAA,CAAAA,EAfjDN,uBAeiDM,CAAAA,EAAAA,CAAAA,CAAAA,KAAAA,EAAAA,OAAAA,EAAAA,GAAAA,IAAAA,CAAAA,GAAAA,SAAAA;;;;;;;;;iBANpEF,SAAAA,CAAAA,GAAaJ;;;;;;iBAMbK,0CAA0CL,0BAA0BM"}
@@ -1,115 +0,0 @@
1
- import { CHECKPOINT_NAMESPACE_END, CHECKPOINT_NAMESPACE_SEPARATOR, CONFIG_KEY_SCRATCHPAD } from "../../constants.js";
2
- import { AsyncLocalStorageProviderSingleton } from "@langchain/core/singletons";
3
-
4
- //#region src/pregel/utils/config.ts
5
- const COPIABLE_KEYS = [
6
- "tags",
7
- "metadata",
8
- "callbacks",
9
- "configurable"
10
- ];
11
- const CONFIG_KEYS = [
12
- "tags",
13
- "metadata",
14
- "callbacks",
15
- "runName",
16
- "maxConcurrency",
17
- "recursionLimit",
18
- "configurable",
19
- "runId",
20
- "outputKeys",
21
- "streamMode",
22
- "store",
23
- "writer",
24
- "interrupt",
25
- "context",
26
- "interruptBefore",
27
- "interruptAfter",
28
- "checkpointDuring",
29
- "durability",
30
- "signal"
31
- ];
32
- const DEFAULT_RECURSION_LIMIT = 25;
33
- function ensureLangGraphConfig(...configs) {
34
- const empty = {
35
- tags: [],
36
- metadata: {},
37
- callbacks: void 0,
38
- recursionLimit: DEFAULT_RECURSION_LIMIT,
39
- configurable: {}
40
- };
41
- const implicitConfig = AsyncLocalStorageProviderSingleton.getRunnableConfig();
42
- if (implicitConfig !== void 0) {
43
- for (const [k, v] of Object.entries(implicitConfig)) if (v !== void 0) if (COPIABLE_KEYS.includes(k)) {
44
- let copiedValue;
45
- if (Array.isArray(v)) copiedValue = [...v];
46
- else if (typeof v === "object") if (k === "callbacks" && "copy" in v && typeof v.copy === "function") copiedValue = v.copy();
47
- else copiedValue = { ...v };
48
- else copiedValue = v;
49
- empty[k] = copiedValue;
50
- } else empty[k] = v;
51
- }
52
- for (const config of configs) {
53
- if (config === void 0) continue;
54
- for (const [k, v] of Object.entries(config)) if (v !== void 0 && CONFIG_KEYS.includes(k)) empty[k] = v;
55
- }
56
- for (const [key, value] of Object.entries(empty.configurable)) {
57
- empty.metadata = empty.metadata ?? {};
58
- if (!key.startsWith("__") && (typeof value === "string" || typeof value === "number" || typeof value === "boolean") && !(key in empty.metadata)) empty.metadata[key] = value;
59
- }
60
- return empty;
61
- }
62
- /**
63
- * A helper utility function that returns the {@link BaseStore} that was set when the graph was initialized
64
- *
65
- * @returns a reference to the {@link BaseStore} that was set when the graph was initialized
66
- */
67
- function getStore(config) {
68
- const runConfig = config ?? AsyncLocalStorageProviderSingleton.getRunnableConfig();
69
- if (runConfig === void 0) throw new Error(["Config not retrievable. This is likely because you are running in an environment without support for AsyncLocalStorage.", "If you're running `getStore` in such environment, pass the `config` from the node function directly."].join("\n"));
70
- return runConfig?.store;
71
- }
72
- /**
73
- * A helper utility function that returns the {@link LangGraphRunnableConfig#writer} if "custom" stream mode is enabled, otherwise undefined.
74
- *
75
- * @returns a reference to the {@link LangGraphRunnableConfig#writer} if "custom" stream mode is enabled, otherwise undefined
76
- */
77
- function getWriter(config) {
78
- const runConfig = config ?? AsyncLocalStorageProviderSingleton.getRunnableConfig();
79
- if (runConfig === void 0) throw new Error(["Config not retrievable. This is likely because you are running in an environment without support for AsyncLocalStorage.", "If you're running `getWriter` in such environment, pass the `config` from the node function directly."].join("\n"));
80
- return runConfig?.writer || runConfig?.configurable?.writer;
81
- }
82
- /**
83
- * A helper utility function that returns the {@link LangGraphRunnableConfig} that was set when the graph was initialized.
84
- *
85
- * Note: This only works when running in an environment that supports node:async_hooks and AsyncLocalStorage. If you're running this in a
86
- * web environment, access the LangGraphRunnableConfig from the node function directly.
87
- *
88
- * @returns the {@link LangGraphRunnableConfig} that was set when the graph was initialized
89
- */
90
- function getConfig() {
91
- return AsyncLocalStorageProviderSingleton.getRunnableConfig();
92
- }
93
- /**
94
- * A helper utility function that returns the input for the currently executing task
95
- *
96
- * @returns the input for the currently executing task
97
- */
98
- function getCurrentTaskInput(config) {
99
- const runConfig = config ?? AsyncLocalStorageProviderSingleton.getRunnableConfig();
100
- if (runConfig === void 0) throw new Error(["Config not retrievable. This is likely because you are running in an environment without support for AsyncLocalStorage.", "If you're running `getCurrentTaskInput` in such environment, pass the `config` from the node function directly."].join("\n"));
101
- if (runConfig.configurable?.[CONFIG_KEY_SCRATCHPAD]?.currentTaskInput === void 0) throw new Error("BUG: internal scratchpad not initialized.");
102
- return runConfig.configurable[CONFIG_KEY_SCRATCHPAD].currentTaskInput;
103
- }
104
- function recastCheckpointNamespace(namespace) {
105
- return namespace.split(CHECKPOINT_NAMESPACE_SEPARATOR).filter((part) => !part.match(/^\d+$/)).map((part) => part.split(CHECKPOINT_NAMESPACE_END)[0]).join(CHECKPOINT_NAMESPACE_SEPARATOR);
106
- }
107
- function getParentCheckpointNamespace(namespace) {
108
- const parts = namespace.split(CHECKPOINT_NAMESPACE_SEPARATOR);
109
- while (parts.length > 1 && parts[parts.length - 1].match(/^\d+$/)) parts.pop();
110
- return parts.slice(0, -1).join(CHECKPOINT_NAMESPACE_SEPARATOR);
111
- }
112
-
113
- //#endregion
114
- export { ensureLangGraphConfig, getConfig, getCurrentTaskInput, getParentCheckpointNamespace, getStore, getWriter, recastCheckpointNamespace };
115
- //# sourceMappingURL=config.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.js","names":["empty: LangGraphRunnableConfig","implicitConfig: RunnableConfig","runConfig: LangGraphRunnableConfig"],"sources":["../../../src/pregel/utils/config.ts"],"sourcesContent":["import { RunnableConfig } from \"@langchain/core/runnables\";\nimport { AsyncLocalStorageProviderSingleton } from \"@langchain/core/singletons\";\nimport { BaseStore } from \"@langchain/langgraph-checkpoint\";\nimport { LangGraphRunnableConfig } from \"../runnable_types.js\";\nimport {\n CHECKPOINT_NAMESPACE_END,\n CHECKPOINT_NAMESPACE_SEPARATOR,\n CONFIG_KEY_SCRATCHPAD,\n} from \"../../constants.js\";\n\nconst COPIABLE_KEYS = [\"tags\", \"metadata\", \"callbacks\", \"configurable\"];\n\nconst CONFIG_KEYS = [\n \"tags\",\n \"metadata\",\n \"callbacks\",\n \"runName\",\n \"maxConcurrency\",\n \"recursionLimit\",\n \"configurable\",\n \"runId\",\n \"outputKeys\",\n \"streamMode\",\n \"store\",\n \"writer\",\n \"interrupt\",\n \"context\",\n \"interruptBefore\",\n \"interruptAfter\",\n \"checkpointDuring\",\n \"durability\",\n \"signal\",\n];\n\nconst DEFAULT_RECURSION_LIMIT = 25;\n\nexport function ensureLangGraphConfig(\n ...configs: (LangGraphRunnableConfig | undefined)[]\n): RunnableConfig {\n const empty: LangGraphRunnableConfig = {\n tags: [],\n metadata: {},\n callbacks: undefined,\n recursionLimit: DEFAULT_RECURSION_LIMIT,\n configurable: {},\n };\n\n const implicitConfig: RunnableConfig =\n AsyncLocalStorageProviderSingleton.getRunnableConfig();\n if (implicitConfig !== undefined) {\n for (const [k, v] of Object.entries(implicitConfig)) {\n if (v !== undefined) {\n if (COPIABLE_KEYS.includes(k)) {\n let copiedValue;\n if (Array.isArray(v)) {\n copiedValue = [...v];\n } else if (typeof v === \"object\") {\n if (\n k === \"callbacks\" &&\n \"copy\" in v &&\n typeof v.copy === \"function\"\n ) {\n copiedValue = v.copy();\n } else {\n copiedValue = { ...v };\n }\n } else {\n copiedValue = v;\n }\n empty[k as keyof RunnableConfig] = copiedValue;\n } else {\n empty[k as keyof RunnableConfig] = v;\n }\n }\n }\n }\n\n for (const config of configs) {\n if (config === undefined) {\n continue;\n }\n\n for (const [k, v] of Object.entries(config)) {\n if (v !== undefined && CONFIG_KEYS.includes(k)) {\n empty[k as keyof LangGraphRunnableConfig] = v;\n }\n }\n }\n\n for (const [key, value] of Object.entries(empty.configurable!)) {\n empty.metadata = empty.metadata ?? {};\n if (\n !key.startsWith(\"__\") &&\n (typeof value === \"string\" ||\n typeof value === \"number\" ||\n typeof value === \"boolean\") &&\n !(key in empty.metadata!)\n ) {\n empty.metadata[key] = value;\n }\n }\n\n return empty;\n}\n\n/**\n * A helper utility function that returns the {@link BaseStore} that was set when the graph was initialized\n *\n * @returns a reference to the {@link BaseStore} that was set when the graph was initialized\n */\nexport function getStore(\n config?: LangGraphRunnableConfig\n): BaseStore | undefined {\n const runConfig: LangGraphRunnableConfig =\n config ?? AsyncLocalStorageProviderSingleton.getRunnableConfig();\n\n if (runConfig === undefined) {\n throw new Error(\n [\n \"Config not retrievable. This is likely because you are running in an environment without support for AsyncLocalStorage.\",\n \"If you're running `getStore` in such environment, pass the `config` from the node function directly.\",\n ].join(\"\\n\")\n );\n }\n\n return runConfig?.store;\n}\n\n/**\n * A helper utility function that returns the {@link LangGraphRunnableConfig#writer} if \"custom\" stream mode is enabled, otherwise undefined.\n *\n * @returns a reference to the {@link LangGraphRunnableConfig#writer} if \"custom\" stream mode is enabled, otherwise undefined\n */\nexport function getWriter(\n config?: LangGraphRunnableConfig\n): ((chunk: unknown) => void) | undefined {\n const runConfig: LangGraphRunnableConfig =\n config ?? AsyncLocalStorageProviderSingleton.getRunnableConfig();\n\n if (runConfig === undefined) {\n throw new Error(\n [\n \"Config not retrievable. This is likely because you are running in an environment without support for AsyncLocalStorage.\",\n \"If you're running `getWriter` in such environment, pass the `config` from the node function directly.\",\n ].join(\"\\n\")\n );\n }\n\n return runConfig?.writer || runConfig?.configurable?.writer;\n}\n\n/**\n * A helper utility function that returns the {@link LangGraphRunnableConfig} that was set when the graph was initialized.\n *\n * Note: This only works when running in an environment that supports node:async_hooks and AsyncLocalStorage. If you're running this in a\n * web environment, access the LangGraphRunnableConfig from the node function directly.\n *\n * @returns the {@link LangGraphRunnableConfig} that was set when the graph was initialized\n */\nexport function getConfig(): LangGraphRunnableConfig {\n return AsyncLocalStorageProviderSingleton.getRunnableConfig();\n}\n\n/**\n * A helper utility function that returns the input for the currently executing task\n *\n * @returns the input for the currently executing task\n */\nexport function getCurrentTaskInput<T = unknown>(\n config?: LangGraphRunnableConfig\n): T {\n const runConfig: LangGraphRunnableConfig =\n config ?? AsyncLocalStorageProviderSingleton.getRunnableConfig();\n\n if (runConfig === undefined) {\n throw new Error(\n [\n \"Config not retrievable. This is likely because you are running in an environment without support for AsyncLocalStorage.\",\n \"If you're running `getCurrentTaskInput` in such environment, pass the `config` from the node function directly.\",\n ].join(\"\\n\")\n );\n }\n\n if (\n runConfig.configurable?.[CONFIG_KEY_SCRATCHPAD]?.currentTaskInput ===\n undefined\n ) {\n throw new Error(\"BUG: internal scratchpad not initialized.\");\n }\n\n return runConfig!.configurable![CONFIG_KEY_SCRATCHPAD]!.currentTaskInput as T;\n}\n\nexport function recastCheckpointNamespace(namespace: string): string {\n return namespace\n .split(CHECKPOINT_NAMESPACE_SEPARATOR)\n .filter((part) => !part.match(/^\\d+$/))\n .map((part) => part.split(CHECKPOINT_NAMESPACE_END)[0])\n .join(CHECKPOINT_NAMESPACE_SEPARATOR);\n}\n\nexport function getParentCheckpointNamespace(namespace: string): string {\n const parts = namespace.split(CHECKPOINT_NAMESPACE_SEPARATOR);\n while (parts.length > 1 && parts[parts.length - 1].match(/^\\d+$/)) {\n parts.pop();\n }\n return parts.slice(0, -1).join(CHECKPOINT_NAMESPACE_SEPARATOR);\n}\n"],"mappings":";;;;AAUA,MAAM,gBAAgB;CAAC;CAAQ;CAAY;CAAa;;AAExD,MAAM,cAAc;CAClB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;;AAGF,MAAM,0BAA0B;AAEhC,SAAgB,sBACd,GAAG,SACa;CAChB,MAAMA,QAAiC;EACrC,MAAM;EACN,UAAU;EACV,WAAW;EACX,gBAAgB;EAChB,cAAc;;CAGhB,MAAMC,iBACJ,mCAAmC;AACrC,KAAI,mBAAmB,QACrB;OAAK,MAAM,CAAC,GAAG,MAAM,OAAO,QAAQ,gBAClC,KAAI,MAAM,OACR,KAAI,cAAc,SAAS,IAAI;GAC7B,IAAI;AACJ,OAAI,MAAM,QAAQ,GAChB,eAAc,CAAC,GAAG;YACT,OAAO,MAAM,SACtB,KACE,MAAM,eACN,UAAU,KACV,OAAO,EAAE,SAAS,WAElB,eAAc,EAAE;OAEhB,eAAc,EAAE,GAAG;OAGrB,eAAc;AAEhB,SAAM,KAA6B;QAEnC,OAAM,KAA6B;;AAM3C,MAAK,MAAM,UAAU,SAAS;AAC5B,MAAI,WAAW,OACb;AAGF,OAAK,MAAM,CAAC,GAAG,MAAM,OAAO,QAAQ,QAClC,KAAI,MAAM,UAAa,YAAY,SAAS,GAC1C,OAAM,KAAsC;;AAKlD,MAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,MAAM,eAAgB;AAC9D,QAAM,WAAW,MAAM,YAAY;AACnC,MACE,CAAC,IAAI,WAAW,UACf,OAAO,UAAU,YAChB,OAAO,UAAU,YACjB,OAAO,UAAU,cACnB,EAAE,OAAO,MAAM,UAEf,OAAM,SAAS,OAAO;;AAI1B,QAAO;;;;;;;AAQT,SAAgB,SACd,QACuB;CACvB,MAAMC,YACJ,UAAU,mCAAmC;AAE/C,KAAI,cAAc,OAChB,OAAM,IAAI,MACR,CACE,2HACA,wGACA,KAAK;AAIX,QAAO,WAAW;;;;;;;AAQpB,SAAgB,UACd,QACwC;CACxC,MAAMA,YACJ,UAAU,mCAAmC;AAE/C,KAAI,cAAc,OAChB,OAAM,IAAI,MACR,CACE,2HACA,yGACA,KAAK;AAIX,QAAO,WAAW,UAAU,WAAW,cAAc;;;;;;;;;;AAWvD,SAAgB,YAAqC;AACnD,QAAO,mCAAmC;;;;;;;AAQ5C,SAAgB,oBACd,QACG;CACH,MAAMA,YACJ,UAAU,mCAAmC;AAE/C,KAAI,cAAc,OAChB,OAAM,IAAI,MACR,CACE,2HACA,mHACA,KAAK;AAIX,KACE,UAAU,eAAe,wBAAwB,qBACjD,OAEA,OAAM,IAAI,MAAM;AAGlB,QAAO,UAAW,aAAc,uBAAwB;;AAG1D,SAAgB,0BAA0B,WAA2B;AACnE,QAAO,UACJ,MAAM,gCACN,QAAQ,SAAS,CAAC,KAAK,MAAM,UAC7B,KAAK,SAAS,KAAK,MAAM,0BAA0B,IACnD,KAAK;;AAGV,SAAgB,6BAA6B,WAA2B;CACtE,MAAM,QAAQ,UAAU,MAAM;AAC9B,QAAO,MAAM,SAAS,KAAK,MAAM,MAAM,SAAS,GAAG,MAAM,SACvD,OAAM;AAER,QAAO,MAAM,MAAM,GAAG,IAAI,KAAK"}
@@ -1,103 +0,0 @@
1
- const require_constants = require('../../constants.cjs');
2
-
3
- //#region src/pregel/utils/index.ts
4
- function getNullChannelVersion(currentVersions) {
5
- const startVersion = typeof currentVersions[require_constants.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;
16
- }
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;
22
- }
23
- function _coerceToDict(value, defaultKey) {
24
- return value && !Array.isArray(value) && !(value instanceof Date) && typeof value === "object" ? value : { [defaultKey]: value };
25
- }
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
- };
39
- }
40
- function patchCheckpointMap(config, metadata) {
41
- const parents = metadata?.parents ?? {};
42
- if (Object.keys(parents).length > 0) return patchConfigurable(config, { [require_constants.CONFIG_KEY_CHECKPOINT_MAP]: {
43
- ...parents,
44
- [config.configurable?.checkpoint_ns ?? ""]: config.configurable?.checkpoint_id
45
- } });
46
- else return config;
47
- }
48
- /**
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
- };
78
- }
79
- /**
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];
93
- };
94
-
95
- //#endregion
96
- exports._coerceToDict = _coerceToDict;
97
- exports.combineAbortSignals = combineAbortSignals;
98
- exports.combineCallbacks = combineCallbacks;
99
- exports.getNewChannelVersions = getNewChannelVersions;
100
- exports.getNullChannelVersion = getNullChannelVersion;
101
- exports.patchCheckpointMap = patchCheckpointMap;
102
- exports.patchConfigurable = patchConfigurable;
103
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.cjs","names":["START","CONFIG_KEY_CHECKPOINT_MAP"],"sources":["../../../src/pregel/utils/index.ts"],"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,gBAAgBA;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,QAAO,SACL,CAAC,MAAM,QAAQ,UAEf,EAAE,iBAAiB,SACnB,OAAO,UAAU,WACf,QACA,GAAG,aAAa;;AAuDtB,SAAgB,kBACd,QAEA,OACgB;AAChB,KAAI,WAAW,KACb,QAAO,EAAE,cAAc;UACd,QAAQ,iBAAiB,OAClC,QAAO;EAAE,GAAG;EAAQ,cAAc;;KAElC,QAAO;EACL,GAAG;EACH,cAAc;GAAE,GAAG,OAAO;GAAc,GAAG;;;;AAKjD,SAAgB,mBACd,QACA,UACgB;CAChB,MAAM,UAAU,UAAU,WAAW;AAErC,KAAI,OAAO,KAAK,SAAS,SAAS,EAChC,QAAO,kBAAkB,QAAQ,GAC9BC,8CAA4B;EAC3B,GAAG;GACF,OAAO,cAAc,iBAAiB,KACrC,OAAO,cAAc;;KAI3B,QAAO;;;;;;;AASX,SAAgB,oBAAoB,GAAG,GAGrC;CACA,MAAM,UAAU,CAAC,GAAG,IAAI,IAAI,EAAE,OAAO;AAErC,KAAI,QAAQ,WAAW,EACrB,QAAO;EAAE,QAAQ;EAAW,SAAS;;AAGvC,KAAI,QAAQ,WAAW,EACrB,QAAO;EAAE,QAAQ,QAAQ;EAAI,SAAS;;CAGxC,MAAM,qBAAqB,IAAI;CAC/B,MAAM,iBAAiB;EACrB,MAAM,SAAS,QAAQ,MAAM,MAAM,EAAE,UAAU;AAC/C,qBAAmB,MAAM;AACzB,UAAQ,SAAS,MAAM,EAAE,oBAAoB,SAAS;;AAGxD,SAAQ,SAAS,MAAM,EAAE,iBAAiB,SAAS,UAAU,EAAE,MAAM;CAErE,MAAM,0BAA0B,QAAQ,MAAM,MAAM,EAAE;AACtD,KAAI,wBACF,oBAAmB,MAAM,wBAAwB;AAGnD,QAAO;EACL,QAAQ,mBAAmB;EAC3B,eAAe;AACb,WAAQ,SAAS,MAAM,EAAE,oBAAoB,SAAS;;;;;;;;;;AAW5D,MAAa,oBACX,WACA,cAC0B;AAC1B,KAAI,CAAC,aAAa,CAAC,UACjB,QAAO;AAGT,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,51 +0,0 @@
1
- import { CheckpointMetadata } from "@langchain/langgraph-checkpoint";
2
- import { RunnableConfig } from "@langchain/core/runnables";
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;
33
- };
34
- /**
35
- * Configuration for caching nodes.
36
- */
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;
48
- };
49
- //#endregion
50
- export { CachePolicy, RetryPolicy };
51
- //# sourceMappingURL=index.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.cts","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,51 +0,0 @@
1
- import { CheckpointMetadata } from "@langchain/langgraph-checkpoint";
2
- import { RunnableConfig } from "@langchain/core/runnables";
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;
33
- };
34
- /**
35
- * Configuration for caching nodes.
36
- */
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;
48
- };
49
- //#endregion
50
- export { CachePolicy, RetryPolicy };
51
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
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"}