@langchain/langgraph 1.0.12 → 1.0.13

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 (381) hide show
  1. package/dist/channels/any_value.cjs +46 -0
  2. package/dist/channels/any_value.cjs.map +1 -0
  3. package/dist/channels/any_value.d.cts +23 -0
  4. package/dist/channels/any_value.d.cts.map +1 -0
  5. package/dist/channels/any_value.d.ts +23 -0
  6. package/dist/channels/any_value.d.ts.map +1 -0
  7. package/dist/channels/any_value.js +46 -0
  8. package/dist/channels/any_value.js.map +1 -0
  9. package/dist/channels/base.cjs +101 -0
  10. package/dist/channels/base.cjs.map +1 -0
  11. package/dist/channels/base.d.cts +79 -0
  12. package/dist/channels/base.d.cts.map +1 -0
  13. package/dist/channels/base.d.ts +79 -0
  14. package/dist/channels/base.d.ts.map +1 -0
  15. package/dist/channels/base.js +97 -0
  16. package/dist/channels/base.js.map +1 -0
  17. package/dist/channels/binop.cjs +49 -0
  18. package/dist/channels/binop.cjs.map +1 -0
  19. package/dist/channels/binop.d.cts +22 -0
  20. package/dist/channels/binop.d.cts.map +1 -0
  21. package/dist/channels/binop.d.ts +22 -0
  22. package/dist/channels/binop.d.ts.map +1 -0
  23. package/dist/channels/binop.js +49 -0
  24. package/dist/channels/binop.js.map +1 -0
  25. package/dist/channels/dynamic_barrier_value.cjs +75 -0
  26. package/dist/channels/dynamic_barrier_value.cjs.map +1 -0
  27. package/dist/channels/dynamic_barrier_value.d.cts +40 -0
  28. package/dist/channels/dynamic_barrier_value.d.cts.map +1 -0
  29. package/dist/channels/dynamic_barrier_value.d.ts +40 -0
  30. package/dist/channels/dynamic_barrier_value.d.ts.map +1 -0
  31. package/dist/channels/dynamic_barrier_value.js +75 -0
  32. package/dist/channels/dynamic_barrier_value.js.map +1 -0
  33. package/dist/channels/ephemeral_value.cjs +46 -0
  34. package/dist/channels/ephemeral_value.cjs.map +1 -0
  35. package/dist/channels/ephemeral_value.d.cts +21 -0
  36. package/dist/channels/ephemeral_value.d.cts.map +1 -0
  37. package/dist/channels/ephemeral_value.d.ts +21 -0
  38. package/dist/channels/ephemeral_value.d.ts.map +1 -0
  39. package/dist/channels/ephemeral_value.js +46 -0
  40. package/dist/channels/ephemeral_value.js.map +1 -0
  41. package/dist/channels/index.cjs +21 -0
  42. package/dist/channels/index.d.cts +9 -0
  43. package/dist/channels/index.d.ts +9 -0
  44. package/dist/channels/index.js +10 -0
  45. package/dist/channels/last_value.cjs +98 -0
  46. package/dist/channels/last_value.cjs.map +1 -0
  47. package/dist/channels/last_value.d.cts +42 -0
  48. package/dist/channels/last_value.d.cts.map +1 -0
  49. package/dist/channels/last_value.d.ts +42 -0
  50. package/dist/channels/last_value.d.ts.map +1 -0
  51. package/dist/channels/last_value.js +97 -0
  52. package/dist/channels/last_value.js.map +1 -0
  53. package/dist/channels/named_barrier_value.cjs +116 -0
  54. package/dist/channels/named_barrier_value.cjs.map +1 -0
  55. package/dist/channels/named_barrier_value.d.cts +44 -0
  56. package/dist/channels/named_barrier_value.d.cts.map +1 -0
  57. package/dist/channels/named_barrier_value.d.ts +44 -0
  58. package/dist/channels/named_barrier_value.d.ts.map +1 -0
  59. package/dist/channels/named_barrier_value.js +114 -0
  60. package/dist/channels/named_barrier_value.js.map +1 -0
  61. package/dist/channels/topic.cjs +65 -0
  62. package/dist/channels/topic.cjs.map +1 -0
  63. package/dist/channels/topic.d.cts +32 -0
  64. package/dist/channels/topic.d.cts.map +1 -0
  65. package/dist/channels/topic.d.ts +32 -0
  66. package/dist/channels/topic.d.ts.map +1 -0
  67. package/dist/channels/topic.js +65 -0
  68. package/dist/channels/topic.js.map +1 -0
  69. package/dist/constants.cjs +406 -0
  70. package/dist/constants.cjs.map +1 -0
  71. package/dist/constants.d.cts +281 -0
  72. package/dist/constants.d.cts.map +1 -0
  73. package/dist/constants.d.ts +281 -0
  74. package/dist/constants.d.ts.map +1 -0
  75. package/dist/constants.js +362 -0
  76. package/dist/constants.js.map +1 -0
  77. package/dist/errors.cjs +163 -0
  78. package/dist/errors.cjs.map +1 -0
  79. package/dist/errors.d.cts +77 -0
  80. package/dist/errors.d.cts.map +1 -0
  81. package/dist/errors.d.ts +77 -0
  82. package/dist/errors.d.ts.map +1 -0
  83. package/dist/errors.js +146 -0
  84. package/dist/errors.js.map +1 -0
  85. package/dist/func/index.cjs +299 -0
  86. package/dist/func/index.cjs.map +1 -0
  87. package/dist/func/index.d.cts +288 -0
  88. package/dist/func/index.d.cts.map +1 -0
  89. package/dist/func/index.d.ts +288 -0
  90. package/dist/func/index.d.ts.map +1 -0
  91. package/dist/func/index.js +297 -0
  92. package/dist/func/index.js.map +1 -0
  93. package/dist/func/types.d.cts +62 -0
  94. package/dist/func/types.d.cts.map +1 -0
  95. package/dist/func/types.d.ts +62 -0
  96. package/dist/func/types.d.ts.map +1 -0
  97. package/dist/graph/annotation.cjs +101 -0
  98. package/dist/graph/annotation.cjs.map +1 -0
  99. package/dist/graph/annotation.d.cts +116 -0
  100. package/dist/graph/annotation.d.cts.map +1 -0
  101. package/dist/graph/annotation.d.ts +116 -0
  102. package/dist/graph/annotation.d.ts.map +1 -0
  103. package/dist/graph/annotation.js +99 -0
  104. package/dist/graph/annotation.js.map +1 -0
  105. package/dist/graph/graph.cjs +420 -0
  106. package/dist/graph/graph.cjs.map +1 -0
  107. package/dist/graph/graph.d.cts +108 -0
  108. package/dist/graph/graph.d.cts.map +1 -0
  109. package/dist/graph/graph.d.ts +108 -0
  110. package/dist/graph/graph.d.ts.map +1 -0
  111. package/dist/graph/graph.js +418 -0
  112. package/dist/graph/graph.js.map +1 -0
  113. package/dist/graph/index.cjs +5 -0
  114. package/dist/graph/index.js +7 -0
  115. package/dist/graph/message.cjs +97 -0
  116. package/dist/graph/message.cjs.map +1 -0
  117. package/dist/graph/message.d.cts +40 -0
  118. package/dist/graph/message.d.cts.map +1 -0
  119. package/dist/graph/message.d.ts +40 -0
  120. package/dist/graph/message.d.ts.map +1 -0
  121. package/dist/graph/message.js +94 -0
  122. package/dist/graph/message.js.map +1 -0
  123. package/dist/graph/messages_annotation.cjs +109 -0
  124. package/dist/graph/messages_annotation.cjs.map +1 -0
  125. package/dist/graph/messages_annotation.d.cts +112 -0
  126. package/dist/graph/messages_annotation.d.cts.map +1 -0
  127. package/dist/graph/messages_annotation.d.ts +112 -0
  128. package/dist/graph/messages_annotation.d.ts.map +1 -0
  129. package/dist/graph/messages_annotation.js +107 -0
  130. package/dist/graph/messages_annotation.js.map +1 -0
  131. package/dist/graph/state.cjs +494 -0
  132. package/dist/graph/state.cjs.map +1 -0
  133. package/dist/graph/state.d.cts +229 -0
  134. package/dist/graph/state.d.cts.map +1 -0
  135. package/dist/graph/state.d.ts +229 -0
  136. package/dist/graph/state.d.ts.map +1 -0
  137. package/dist/graph/state.js +493 -0
  138. package/dist/graph/state.js.map +1 -0
  139. package/dist/graph/zod/index.cjs +10 -0
  140. package/dist/graph/zod/index.d.cts +3 -0
  141. package/dist/graph/zod/index.d.ts +3 -0
  142. package/dist/graph/zod/index.js +5 -0
  143. package/dist/graph/zod/meta.cjs +144 -0
  144. package/dist/graph/zod/meta.cjs.map +1 -0
  145. package/dist/graph/zod/meta.d.cts +115 -0
  146. package/dist/graph/zod/meta.d.cts.map +1 -0
  147. package/dist/graph/zod/meta.d.ts +115 -0
  148. package/dist/graph/zod/meta.d.ts.map +1 -0
  149. package/dist/graph/zod/meta.js +141 -0
  150. package/dist/graph/zod/meta.js.map +1 -0
  151. package/dist/graph/zod/plugin.cjs +39 -0
  152. package/dist/graph/zod/plugin.cjs.map +1 -0
  153. package/dist/graph/zod/plugin.js +40 -0
  154. package/dist/graph/zod/plugin.js.map +1 -0
  155. package/dist/graph/zod/schema.cjs +98 -0
  156. package/dist/graph/zod/schema.cjs.map +1 -0
  157. package/dist/graph/zod/schema.d.cts +38 -0
  158. package/dist/graph/zod/schema.d.cts.map +1 -0
  159. package/dist/graph/zod/schema.d.ts +38 -0
  160. package/dist/graph/zod/schema.d.ts.map +1 -0
  161. package/dist/graph/zod/schema.js +94 -0
  162. package/dist/graph/zod/schema.js.map +1 -0
  163. package/dist/graph/zod/zod-registry.cjs +42 -0
  164. package/dist/graph/zod/zod-registry.cjs.map +1 -0
  165. package/dist/graph/zod/zod-registry.d.cts +49 -0
  166. package/dist/graph/zod/zod-registry.d.cts.map +1 -0
  167. package/dist/graph/zod/zod-registry.d.ts +49 -0
  168. package/dist/graph/zod/zod-registry.d.ts.map +1 -0
  169. package/dist/graph/zod/zod-registry.js +41 -0
  170. package/dist/graph/zod/zod-registry.js.map +1 -0
  171. package/dist/hash.cjs +265 -0
  172. package/dist/hash.cjs.map +1 -0
  173. package/dist/hash.js +263 -0
  174. package/dist/hash.js.map +1 -0
  175. package/dist/index.cjs +111 -0
  176. package/dist/index.cjs.map +1 -0
  177. package/dist/index.d.cts +26 -0
  178. package/dist/index.d.ts +26 -0
  179. package/dist/index.js +22 -0
  180. package/dist/index.js.map +1 -0
  181. package/dist/interrupt.cjs +79 -0
  182. package/dist/interrupt.cjs.map +1 -0
  183. package/dist/interrupt.d.cts +55 -0
  184. package/dist/interrupt.d.cts.map +1 -0
  185. package/dist/interrupt.d.ts +55 -0
  186. package/dist/interrupt.d.ts.map +1 -0
  187. package/dist/interrupt.js +79 -0
  188. package/dist/interrupt.js.map +1 -0
  189. package/dist/prebuilt/agentName.cjs +148 -0
  190. package/dist/prebuilt/agentName.cjs.map +1 -0
  191. package/dist/prebuilt/agentName.d.cts +42 -0
  192. package/dist/prebuilt/agentName.d.cts.map +1 -0
  193. package/dist/prebuilt/agentName.d.ts +42 -0
  194. package/dist/prebuilt/agentName.d.ts.map +1 -0
  195. package/dist/prebuilt/agentName.js +148 -0
  196. package/dist/prebuilt/agentName.js.map +1 -0
  197. package/dist/prebuilt/agent_executor.cjs +41 -0
  198. package/dist/prebuilt/agent_executor.cjs.map +1 -0
  199. package/dist/prebuilt/agent_executor.d.cts +58 -0
  200. package/dist/prebuilt/agent_executor.d.cts.map +1 -0
  201. package/dist/prebuilt/agent_executor.d.ts +58 -0
  202. package/dist/prebuilt/agent_executor.d.ts.map +1 -0
  203. package/dist/prebuilt/agent_executor.js +41 -0
  204. package/dist/prebuilt/agent_executor.js.map +1 -0
  205. package/dist/prebuilt/chat_agent_executor.cjs +62 -0
  206. package/dist/prebuilt/chat_agent_executor.cjs.map +1 -0
  207. package/dist/prebuilt/chat_agent_executor.d.cts +23 -0
  208. package/dist/prebuilt/chat_agent_executor.d.cts.map +1 -0
  209. package/dist/prebuilt/chat_agent_executor.d.ts +23 -0
  210. package/dist/prebuilt/chat_agent_executor.d.ts.map +1 -0
  211. package/dist/prebuilt/chat_agent_executor.js +62 -0
  212. package/dist/prebuilt/chat_agent_executor.js.map +1 -0
  213. package/dist/prebuilt/index.cjs +15 -0
  214. package/dist/prebuilt/index.d.cts +8 -0
  215. package/dist/prebuilt/index.d.ts +8 -0
  216. package/dist/prebuilt/index.js +8 -0
  217. package/dist/prebuilt/interrupt.d.cts +60 -0
  218. package/dist/prebuilt/interrupt.d.cts.map +1 -0
  219. package/dist/prebuilt/interrupt.d.ts +60 -0
  220. package/dist/prebuilt/interrupt.d.ts.map +1 -0
  221. package/dist/prebuilt/react_agent_executor.cjs +339 -0
  222. package/dist/prebuilt/react_agent_executor.cjs.map +1 -0
  223. package/dist/prebuilt/react_agent_executor.d.cts +211 -0
  224. package/dist/prebuilt/react_agent_executor.d.cts.map +1 -0
  225. package/dist/prebuilt/react_agent_executor.d.ts +211 -0
  226. package/dist/prebuilt/react_agent_executor.d.ts.map +1 -0
  227. package/dist/prebuilt/react_agent_executor.js +338 -0
  228. package/dist/prebuilt/react_agent_executor.js.map +1 -0
  229. package/dist/prebuilt/tool_executor.cjs +43 -0
  230. package/dist/prebuilt/tool_executor.cjs.map +1 -0
  231. package/dist/prebuilt/tool_executor.d.cts +40 -0
  232. package/dist/prebuilt/tool_executor.d.cts.map +1 -0
  233. package/dist/prebuilt/tool_executor.d.ts +40 -0
  234. package/dist/prebuilt/tool_executor.d.ts.map +1 -0
  235. package/dist/prebuilt/tool_executor.js +43 -0
  236. package/dist/prebuilt/tool_executor.js.map +1 -0
  237. package/dist/prebuilt/tool_node.cjs +247 -0
  238. package/dist/prebuilt/tool_node.cjs.map +1 -0
  239. package/dist/prebuilt/tool_node.d.cts +180 -0
  240. package/dist/prebuilt/tool_node.d.cts.map +1 -0
  241. package/dist/prebuilt/tool_node.d.ts +180 -0
  242. package/dist/prebuilt/tool_node.d.ts.map +1 -0
  243. package/dist/prebuilt/tool_node.js +246 -0
  244. package/dist/prebuilt/tool_node.js.map +1 -0
  245. package/dist/pregel/algo.cjs +565 -0
  246. package/dist/pregel/algo.cjs.map +1 -0
  247. package/dist/pregel/algo.d.cts +13 -0
  248. package/dist/pregel/algo.d.cts.map +1 -0
  249. package/dist/pregel/algo.d.ts +13 -0
  250. package/dist/pregel/algo.d.ts.map +1 -0
  251. package/dist/pregel/algo.js +560 -0
  252. package/dist/pregel/algo.js.map +1 -0
  253. package/dist/pregel/call.cjs +50 -0
  254. package/dist/pregel/call.cjs.map +1 -0
  255. package/dist/pregel/call.js +48 -0
  256. package/dist/pregel/call.js.map +1 -0
  257. package/dist/pregel/debug.cjs +172 -0
  258. package/dist/pregel/debug.cjs.map +1 -0
  259. package/dist/pregel/debug.js +166 -0
  260. package/dist/pregel/debug.js.map +1 -0
  261. package/dist/pregel/index.cjs +1163 -0
  262. package/dist/pregel/index.cjs.map +1 -0
  263. package/dist/pregel/index.d.cts +498 -0
  264. package/dist/pregel/index.d.cts.map +1 -0
  265. package/dist/pregel/index.d.ts +498 -0
  266. package/dist/pregel/index.d.ts.map +1 -0
  267. package/dist/pregel/index.js +1162 -0
  268. package/dist/pregel/index.js.map +1 -0
  269. package/dist/pregel/io.cjs +140 -0
  270. package/dist/pregel/io.cjs.map +1 -0
  271. package/dist/pregel/io.js +135 -0
  272. package/dist/pregel/io.js.map +1 -0
  273. package/dist/pregel/loop.cjs +545 -0
  274. package/dist/pregel/loop.cjs.map +1 -0
  275. package/dist/pregel/loop.js +545 -0
  276. package/dist/pregel/loop.js.map +1 -0
  277. package/dist/pregel/messages.cjs +107 -0
  278. package/dist/pregel/messages.cjs.map +1 -0
  279. package/dist/pregel/messages.js +107 -0
  280. package/dist/pregel/messages.js.map +1 -0
  281. package/dist/pregel/read.cjs +151 -0
  282. package/dist/pregel/read.cjs.map +1 -0
  283. package/dist/pregel/read.d.cts +45 -0
  284. package/dist/pregel/read.d.cts.map +1 -0
  285. package/dist/pregel/read.d.ts +45 -0
  286. package/dist/pregel/read.d.ts.map +1 -0
  287. package/dist/pregel/read.js +150 -0
  288. package/dist/pregel/read.js.map +1 -0
  289. package/dist/pregel/remote.cjs +341 -0
  290. package/dist/pregel/remote.cjs.map +1 -0
  291. package/dist/pregel/remote.d.cts +118 -0
  292. package/dist/pregel/remote.d.cts.map +1 -0
  293. package/dist/pregel/remote.d.ts +118 -0
  294. package/dist/pregel/remote.d.ts.map +1 -0
  295. package/dist/pregel/remote.js +341 -0
  296. package/dist/pregel/remote.js.map +1 -0
  297. package/dist/pregel/retry.cjs +91 -0
  298. package/dist/pregel/retry.cjs.map +1 -0
  299. package/dist/pregel/retry.js +91 -0
  300. package/dist/pregel/retry.js.map +1 -0
  301. package/dist/pregel/runnable_types.d.cts +43 -0
  302. package/dist/pregel/runnable_types.d.cts.map +1 -0
  303. package/dist/pregel/runnable_types.d.ts +43 -0
  304. package/dist/pregel/runnable_types.d.ts.map +1 -0
  305. package/dist/pregel/runner.cjs +228 -0
  306. package/dist/pregel/runner.cjs.map +1 -0
  307. package/dist/pregel/runner.js +228 -0
  308. package/dist/pregel/runner.js.map +1 -0
  309. package/dist/pregel/stream.cjs +197 -0
  310. package/dist/pregel/stream.cjs.map +1 -0
  311. package/dist/pregel/stream.js +195 -0
  312. package/dist/pregel/stream.js.map +1 -0
  313. package/dist/pregel/types.cjs +27 -0
  314. package/dist/pregel/types.cjs.map +1 -0
  315. package/dist/pregel/types.d.cts +440 -0
  316. package/dist/pregel/types.d.cts.map +1 -0
  317. package/dist/pregel/types.d.ts +440 -0
  318. package/dist/pregel/types.d.ts.map +1 -0
  319. package/dist/pregel/types.js +25 -0
  320. package/dist/pregel/types.js.map +1 -0
  321. package/dist/pregel/utils/config.cjs +121 -0
  322. package/dist/pregel/utils/config.cjs.map +1 -0
  323. package/dist/pregel/utils/config.d.cts +36 -0
  324. package/dist/pregel/utils/config.d.cts.map +1 -0
  325. package/dist/pregel/utils/config.d.ts +36 -0
  326. package/dist/pregel/utils/config.d.ts.map +1 -0
  327. package/dist/pregel/utils/config.js +115 -0
  328. package/dist/pregel/utils/config.js.map +1 -0
  329. package/dist/pregel/utils/index.cjs +102 -0
  330. package/dist/pregel/utils/index.cjs.map +1 -0
  331. package/dist/pregel/utils/index.d.cts +51 -0
  332. package/dist/pregel/utils/index.d.cts.map +1 -0
  333. package/dist/pregel/utils/index.d.ts +51 -0
  334. package/dist/pregel/utils/index.d.ts.map +1 -0
  335. package/dist/pregel/utils/index.js +96 -0
  336. package/dist/pregel/utils/index.js.map +1 -0
  337. package/dist/pregel/utils/subgraph.cjs +18 -0
  338. package/dist/pregel/utils/subgraph.cjs.map +1 -0
  339. package/dist/pregel/utils/subgraph.js +16 -0
  340. package/dist/pregel/utils/subgraph.js.map +1 -0
  341. package/dist/pregel/validate.cjs +45 -0
  342. package/dist/pregel/validate.cjs.map +1 -0
  343. package/dist/pregel/validate.js +44 -0
  344. package/dist/pregel/validate.js.map +1 -0
  345. package/dist/pregel/write.cjs +96 -0
  346. package/dist/pregel/write.cjs.map +1 -0
  347. package/dist/pregel/write.d.cts +31 -0
  348. package/dist/pregel/write.d.cts.map +1 -0
  349. package/dist/pregel/write.d.ts +31 -0
  350. package/dist/pregel/write.d.ts.map +1 -0
  351. package/dist/pregel/write.js +95 -0
  352. package/dist/pregel/write.js.map +1 -0
  353. package/dist/remote.cjs +3 -0
  354. package/dist/remote.d.cts +2 -0
  355. package/dist/remote.d.ts +2 -0
  356. package/dist/remote.js +3 -0
  357. package/dist/setup/async_local_storage.cjs +11 -0
  358. package/dist/setup/async_local_storage.cjs.map +1 -0
  359. package/dist/setup/async_local_storage.js +11 -0
  360. package/dist/setup/async_local_storage.js.map +1 -0
  361. package/dist/utils.cjs +86 -0
  362. package/dist/utils.cjs.map +1 -0
  363. package/dist/utils.d.cts +25 -0
  364. package/dist/utils.d.cts.map +1 -0
  365. package/dist/utils.d.ts +25 -0
  366. package/dist/utils.d.ts.map +1 -0
  367. package/dist/utils.js +80 -0
  368. package/dist/utils.js.map +1 -0
  369. package/dist/web.cjs +95 -0
  370. package/dist/web.d.cts +23 -0
  371. package/dist/web.d.ts +23 -0
  372. package/dist/web.js +15 -0
  373. package/dist/writer.cjs +14 -0
  374. package/dist/writer.cjs.map +1 -0
  375. package/dist/writer.d.cts +6 -0
  376. package/dist/writer.d.cts.map +1 -0
  377. package/dist/writer.d.ts +6 -0
  378. package/dist/writer.d.ts.map +1 -0
  379. package/dist/writer.js +14 -0
  380. package/dist/writer.js.map +1 -0
  381. package/package.json +2 -2
@@ -0,0 +1,11 @@
1
+ import { AsyncLocalStorageProviderSingleton } from "@langchain/core/singletons";
2
+ import { AsyncLocalStorage } from "node:async_hooks";
3
+
4
+ //#region src/setup/async_local_storage.ts
5
+ function initializeAsyncLocalStorageSingleton() {
6
+ AsyncLocalStorageProviderSingleton.initializeGlobalInstance(new AsyncLocalStorage());
7
+ }
8
+
9
+ //#endregion
10
+ export { initializeAsyncLocalStorageSingleton };
11
+ //# sourceMappingURL=async_local_storage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"async_local_storage.js","names":[],"sources":["../../src/setup/async_local_storage.ts"],"sourcesContent":["import { AsyncLocalStorageProviderSingleton } from \"@langchain/core/singletons\";\nimport { AsyncLocalStorage } from \"node:async_hooks\";\n\nexport function initializeAsyncLocalStorageSingleton() {\n AsyncLocalStorageProviderSingleton.initializeGlobalInstance(\n new AsyncLocalStorage()\n );\n}\n"],"mappings":";;;;AAGA,SAAgB,uCAAuC;AACrD,oCAAmC,yBACjC,IAAI,mBAAmB,CACxB"}
package/dist/utils.cjs ADDED
@@ -0,0 +1,86 @@
1
+ const require_config = require('./pregel/utils/config.cjs');
2
+ let _langchain_core_singletons = require("@langchain/core/singletons");
3
+ let _langchain_core_runnables = require("@langchain/core/runnables");
4
+
5
+ //#region src/utils.ts
6
+ var RunnableCallable = class extends _langchain_core_runnables.Runnable {
7
+ lc_namespace = ["langgraph"];
8
+ func;
9
+ tags;
10
+ config;
11
+ trace = true;
12
+ recurse = true;
13
+ constructor(fields) {
14
+ super();
15
+ this.name = fields.name ?? fields.func.name;
16
+ this.func = fields.func;
17
+ this.config = fields.tags ? { tags: fields.tags } : void 0;
18
+ this.trace = fields.trace ?? this.trace;
19
+ this.recurse = fields.recurse ?? this.recurse;
20
+ }
21
+ async _tracedInvoke(input, config, runManager) {
22
+ return new Promise((resolve, reject) => {
23
+ const childConfig = (0, _langchain_core_runnables.patchConfig)(config, { callbacks: runManager?.getChild() });
24
+ _langchain_core_singletons.AsyncLocalStorageProviderSingleton.runWithConfig(childConfig, async () => {
25
+ try {
26
+ resolve(await this.func(input, childConfig));
27
+ } catch (e) {
28
+ reject(e);
29
+ }
30
+ });
31
+ });
32
+ }
33
+ async invoke(input, options) {
34
+ let returnValue;
35
+ const config = require_config.ensureLangGraphConfig(options);
36
+ const mergedConfig = (0, _langchain_core_runnables.mergeConfigs)(this.config, config);
37
+ if (this.trace) returnValue = await this._callWithConfig(this._tracedInvoke, input, mergedConfig);
38
+ else returnValue = await _langchain_core_singletons.AsyncLocalStorageProviderSingleton.runWithConfig(mergedConfig, async () => this.func(input, mergedConfig));
39
+ if (_langchain_core_runnables.Runnable.isRunnable(returnValue) && this.recurse) return await _langchain_core_singletons.AsyncLocalStorageProviderSingleton.runWithConfig(mergedConfig, async () => returnValue.invoke(input, mergedConfig));
40
+ return returnValue;
41
+ }
42
+ };
43
+ function* prefixGenerator(generator, prefix) {
44
+ if (prefix === void 0) yield* generator;
45
+ else for (const value of generator) yield [prefix, value];
46
+ }
47
+ async function gatherIterator(i) {
48
+ const out = [];
49
+ for await (const item of await i) out.push(item);
50
+ return out;
51
+ }
52
+ function gatherIteratorSync(i) {
53
+ const out = [];
54
+ for (const item of i) out.push(item);
55
+ return out;
56
+ }
57
+ function patchConfigurable(config, patch) {
58
+ if (!config) return { configurable: patch };
59
+ else if (!("configurable" in config)) return {
60
+ ...config,
61
+ configurable: patch
62
+ };
63
+ else return {
64
+ ...config,
65
+ configurable: {
66
+ ...config.configurable,
67
+ ...patch
68
+ }
69
+ };
70
+ }
71
+ function isAsyncGeneratorFunction(val) {
72
+ return val != null && typeof val === "function" && val instanceof Object.getPrototypeOf(async function* () {}).constructor;
73
+ }
74
+ function isGeneratorFunction(val) {
75
+ return val != null && typeof val === "function" && val instanceof Object.getPrototypeOf(function* () {}).constructor;
76
+ }
77
+
78
+ //#endregion
79
+ exports.RunnableCallable = RunnableCallable;
80
+ exports.gatherIterator = gatherIterator;
81
+ exports.gatherIteratorSync = gatherIteratorSync;
82
+ exports.isAsyncGeneratorFunction = isAsyncGeneratorFunction;
83
+ exports.isGeneratorFunction = isGeneratorFunction;
84
+ exports.patchConfigurable = patchConfigurable;
85
+ exports.prefixGenerator = prefixGenerator;
86
+ //# sourceMappingURL=utils.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.cjs","names":["Runnable","AsyncLocalStorageProviderSingleton","ensureLangGraphConfig"],"sources":["../src/utils.ts"],"sourcesContent":["import { CallbackManagerForChainRun } from \"@langchain/core/callbacks/manager\";\nimport {\n mergeConfigs,\n patchConfig,\n Runnable,\n RunnableConfig,\n} from \"@langchain/core/runnables\";\nimport { AsyncLocalStorageProviderSingleton } from \"@langchain/core/singletons\";\nimport { ensureLangGraphConfig } from \"./pregel/utils/config.js\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface RunnableCallableArgs extends Partial<any> {\n name?: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n func: (...args: any[]) => any;\n tags?: string[];\n trace?: boolean;\n recurse?: boolean;\n}\n\nexport class RunnableCallable<I = unknown, O = unknown> extends Runnable<I, O> {\n lc_namespace: string[] = [\"langgraph\"];\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n func: (...args: any[]) => any;\n\n tags?: string[];\n\n config?: RunnableConfig;\n\n trace: boolean = true;\n\n recurse: boolean = true;\n\n constructor(fields: RunnableCallableArgs) {\n super();\n this.name = fields.name ?? fields.func.name;\n this.func = fields.func;\n this.config = fields.tags ? { tags: fields.tags } : undefined;\n this.trace = fields.trace ?? this.trace;\n this.recurse = fields.recurse ?? this.recurse;\n }\n\n protected async _tracedInvoke(\n input: I,\n config?: Partial<RunnableConfig>,\n runManager?: CallbackManagerForChainRun\n ) {\n return new Promise<O>((resolve, reject) => {\n const childConfig = patchConfig(config, {\n callbacks: runManager?.getChild(),\n });\n void AsyncLocalStorageProviderSingleton.runWithConfig(\n childConfig,\n async () => {\n try {\n const output = await this.func(input, childConfig);\n resolve(output);\n } catch (e) {\n reject(e);\n }\n }\n );\n });\n }\n\n async invoke(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n input: I,\n options?: Partial<RunnableConfig> | undefined\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ): Promise<O> {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let returnValue: any;\n const config = ensureLangGraphConfig(options);\n const mergedConfig = mergeConfigs(this.config, config);\n\n if (this.trace) {\n returnValue = await this._callWithConfig(\n this._tracedInvoke,\n input,\n mergedConfig\n );\n } else {\n returnValue = await AsyncLocalStorageProviderSingleton.runWithConfig(\n mergedConfig,\n async () => this.func(input, mergedConfig)\n );\n }\n\n if (Runnable.isRunnable(returnValue) && this.recurse) {\n return await AsyncLocalStorageProviderSingleton.runWithConfig(\n mergedConfig,\n async () => returnValue.invoke(input, mergedConfig)\n );\n }\n\n return returnValue;\n }\n}\n\nexport function prefixGenerator<T, Prefix extends string>(\n generator: Generator<T>,\n prefix: Prefix\n): Generator<[Prefix, T]>;\n\nexport function prefixGenerator<T>(\n generator: Generator<T>,\n prefix?: undefined\n): Generator<T>;\n\nexport function prefixGenerator<\n T,\n Prefix extends string | undefined = undefined\n>(\n generator: Generator<T>,\n prefix?: Prefix | undefined\n): Generator<Prefix extends string ? [Prefix, T] : T>;\nexport function* prefixGenerator<\n T,\n Prefix extends string | undefined = undefined\n>(\n generator: Generator<T>,\n prefix?: Prefix | undefined\n): Generator<Prefix extends string ? [Prefix, T] : T> {\n if (prefix === undefined) {\n yield* generator as Generator<Prefix extends string ? [Prefix, T] : T>;\n } else {\n for (const value of generator) {\n yield [prefix, value] as Prefix extends string ? [Prefix, T] : T;\n }\n }\n}\n\n// https://github.com/tc39/proposal-array-from-async\nexport async function gatherIterator<T>(\n i:\n | AsyncIterable<T>\n | Promise<AsyncIterable<T>>\n | Iterable<T>\n | Promise<Iterable<T>>\n): Promise<Array<T>> {\n const out: T[] = [];\n for await (const item of await i) {\n out.push(item);\n }\n return out;\n}\n\nexport function gatherIteratorSync<T>(i: Iterable<T>): Array<T> {\n const out: T[] = [];\n for (const item of i) {\n out.push(item);\n }\n return out;\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) {\n return {\n configurable: patch,\n };\n } else if (!(\"configurable\" in config)) {\n return {\n ...config,\n configurable: patch,\n };\n } else {\n return {\n ...config,\n configurable: {\n ...config.configurable,\n ...patch,\n },\n };\n }\n}\n\nexport function isAsyncGeneratorFunction(\n val: unknown\n): val is AsyncGeneratorFunction {\n return (\n val != null &&\n typeof val === \"function\" &&\n // eslint-disable-next-line no-instanceof/no-instanceof\n val instanceof Object.getPrototypeOf(async function* () {}).constructor\n );\n}\n\nexport function isGeneratorFunction(val: unknown): val is GeneratorFunction {\n return (\n val != null &&\n typeof val === \"function\" &&\n // eslint-disable-next-line no-instanceof/no-instanceof\n val instanceof Object.getPrototypeOf(function* () {}).constructor\n );\n}\n"],"mappings":";;;;;AAoBA,IAAa,mBAAb,cAAgEA,mCAAe;CAC7E,eAAyB,CAAC,YAAY;CAGtC;CAEA;CAEA;CAEA,QAAiB;CAEjB,UAAmB;CAEnB,YAAY,QAA8B;AACxC,SAAO;AACP,OAAK,OAAO,OAAO,QAAQ,OAAO,KAAK;AACvC,OAAK,OAAO,OAAO;AACnB,OAAK,SAAS,OAAO,OAAO,EAAE,MAAM,OAAO,MAAM,GAAG;AACpD,OAAK,QAAQ,OAAO,SAAS,KAAK;AAClC,OAAK,UAAU,OAAO,WAAW,KAAK;;CAGxC,MAAgB,cACd,OACA,QACA,YACA;AACA,SAAO,IAAI,SAAY,SAAS,WAAW;GACzC,MAAM,yDAA0B,QAAQ,EACtC,WAAW,YAAY,UAAU,EAClC,CAAC;AACF,GAAKC,8DAAmC,cACtC,aACA,YAAY;AACV,QAAI;AAEF,aADe,MAAM,KAAK,KAAK,OAAO,YAAY,CACnC;aACR,GAAG;AACV,YAAO,EAAE;;KAGd;IACD;;CAGJ,MAAM,OAEJ,OACA,SAEY;EAEZ,IAAI;EACJ,MAAM,SAASC,qCAAsB,QAAQ;EAC7C,MAAM,2DAA4B,KAAK,QAAQ,OAAO;AAEtD,MAAI,KAAK,MACP,eAAc,MAAM,KAAK,gBACvB,KAAK,eACL,OACA,aACD;MAED,eAAc,MAAMD,8DAAmC,cACrD,cACA,YAAY,KAAK,KAAK,OAAO,aAAa,CAC3C;AAGH,MAAID,mCAAS,WAAW,YAAY,IAAI,KAAK,QAC3C,QAAO,MAAMC,8DAAmC,cAC9C,cACA,YAAY,YAAY,OAAO,OAAO,aAAa,CACpD;AAGH,SAAO;;;AAqBX,UAAiB,gBAIf,WACA,QACoD;AACpD,KAAI,WAAW,OACb,QAAO;KAEP,MAAK,MAAM,SAAS,UAClB,OAAM,CAAC,QAAQ,MAAM;;AAM3B,eAAsB,eACpB,GAKmB;CACnB,MAAM,MAAW,EAAE;AACnB,YAAW,MAAM,QAAQ,MAAM,EAC7B,KAAI,KAAK,KAAK;AAEhB,QAAO;;AAGT,SAAgB,mBAAsB,GAA0B;CAC9D,MAAM,MAAW,EAAE;AACnB,MAAK,MAAM,QAAQ,EACjB,KAAI,KAAK,KAAK;AAEhB,QAAO;;AAGT,SAAgB,kBACd,QAEA,OACgB;AAChB,KAAI,CAAC,OACH,QAAO,EACL,cAAc,OACf;UACQ,EAAE,kBAAkB,QAC7B,QAAO;EACL,GAAG;EACH,cAAc;EACf;KAED,QAAO;EACL,GAAG;EACH,cAAc;GACZ,GAAG,OAAO;GACV,GAAG;GACJ;EACF;;AAIL,SAAgB,yBACd,KAC+B;AAC/B,QACE,OAAO,QACP,OAAO,QAAQ,cAEf,eAAe,OAAO,eAAe,mBAAmB,GAAG,CAAC;;AAIhE,SAAgB,oBAAoB,KAAwC;AAC1E,QACE,OAAO,QACP,OAAO,QAAQ,cAEf,eAAe,OAAO,eAAe,aAAa,GAAG,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { Runnable, RunnableConfig } from "@langchain/core/runnables";
2
+ import { CallbackManagerForChainRun } from "@langchain/core/callbacks/manager";
3
+
4
+ //#region src/utils.d.ts
5
+ interface RunnableCallableArgs extends Partial<any> {
6
+ name?: string;
7
+ func: (...args: any[]) => any;
8
+ tags?: string[];
9
+ trace?: boolean;
10
+ recurse?: boolean;
11
+ }
12
+ declare class RunnableCallable<I = unknown, O = unknown> extends Runnable<I, O> {
13
+ lc_namespace: string[];
14
+ func: (...args: any[]) => any;
15
+ tags?: string[];
16
+ config?: RunnableConfig;
17
+ trace: boolean;
18
+ recurse: boolean;
19
+ constructor(fields: RunnableCallableArgs);
20
+ protected _tracedInvoke(input: I, config?: Partial<RunnableConfig>, runManager?: CallbackManagerForChainRun): Promise<O>;
21
+ invoke(input: I, options?: Partial<RunnableConfig> | undefined): Promise<O>;
22
+ }
23
+ //#endregion
24
+ export { RunnableCallable };
25
+ //# sourceMappingURL=utils.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.cts","names":["CallbackManagerForChainRun","Runnable","RunnableConfig","RunnableCallableArgs","Partial","RunnableCallable","I","O","Promise","prefixGenerator","T","Generator","Prefix","gatherIterator","AsyncIterable","Iterable","Array","gatherIteratorSync","patchConfigurable","Record","isAsyncGeneratorFunction","AsyncGeneratorFunction","isGeneratorFunction","GeneratorFunction"],"sources":["../src/utils.d.ts"],"sourcesContent":["import { CallbackManagerForChainRun } from \"@langchain/core/callbacks/manager\";\nimport { Runnable, RunnableConfig } from \"@langchain/core/runnables\";\nexport interface RunnableCallableArgs extends Partial<any> {\n name?: string;\n func: (...args: any[]) => any;\n tags?: string[];\n trace?: boolean;\n recurse?: boolean;\n}\nexport declare class RunnableCallable<I = unknown, O = unknown> extends Runnable<I, O> {\n lc_namespace: string[];\n func: (...args: any[]) => any;\n tags?: string[];\n config?: RunnableConfig;\n trace: boolean;\n recurse: boolean;\n constructor(fields: RunnableCallableArgs);\n protected _tracedInvoke(input: I, config?: Partial<RunnableConfig>, runManager?: CallbackManagerForChainRun): Promise<O>;\n invoke(input: I, options?: Partial<RunnableConfig> | undefined): Promise<O>;\n}\nexport declare function prefixGenerator<T, Prefix extends string>(generator: Generator<T>, prefix: Prefix): Generator<[Prefix, T]>;\nexport declare function prefixGenerator<T>(generator: Generator<T>, prefix?: undefined): Generator<T>;\nexport declare function prefixGenerator<T, Prefix extends string | undefined = undefined>(generator: Generator<T>, prefix?: Prefix | undefined): Generator<Prefix extends string ? [Prefix, T] : T>;\nexport declare function gatherIterator<T>(i: AsyncIterable<T> | Promise<AsyncIterable<T>> | Iterable<T> | Promise<Iterable<T>>): Promise<Array<T>>;\nexport declare function gatherIteratorSync<T>(i: Iterable<T>): Array<T>;\nexport declare function patchConfigurable(config: RunnableConfig | undefined, patch: Record<string, any>): RunnableConfig;\nexport declare function isAsyncGeneratorFunction(val: unknown): val is AsyncGeneratorFunction;\nexport declare function isGeneratorFunction(val: unknown): val is GeneratorFunction;\n"],"mappings":";;;;UAEiBG,oBAAAA,SAA6BC;;EAA7BD,IAAAA,EAAAA,CAAAA,GAAAA,IAAAA,EAAAA,GAAAA,EAAAA,EAAoB,GAAA,GAAA;EAOhBE,IAAAA,CAAAA,EAAAA,MAAAA,EAAAA;EAAgB,KAAA,CAAA,EAAA,OAAA;SAA4CC,CAAAA,EAAAA,OAAAA;;AAIpEJ,cAJQG,gBAIRH,CAAAA,IAAAA,OAAAA,EAAAA,IAAAA,OAAAA,CAAAA,SAJ2DD,QAI3DC,CAJoEI,CAIpEJ,EAJuEK,CAIvEL,CAAAA,CAAAA;cAGWC,EAAAA,MAAAA,EAAAA;MACWG,EAAAA,CAAAA,GAAAA,IAAAA,EAAAA,GAAAA,EAAAA,EAAAA,GAAAA,GAAAA;MAAoBJ,CAAAA,EAAAA,MAAAA,EAAAA;QAARE,CAAAA,EAJlCF,cAIkCE;OAAsCJ,EAAAA,OAAAA;SAAqCO,EAAAA,OAAAA;aAARC,CAAAA,MAAAA,EAD1FL,oBAC0FK;YAChGF,aAAAA,CAAAA,KAAAA,EADiBA,CACjBA,EAAAA,MAAAA,CAAAA,EAD6BF,OAC7BE,CADqCJ,cACrCI,CAAAA,EAAAA,UAAAA,CAAAA,EADmEN,0BACnEM,CAAAA,EADgGE,OAChGF,CADwGC,CACxGD,CAAAA;QAAqBJ,CAAAA,KAAAA,EAArBI,CAAqBJ,EAAAA,OAAAA,CAAAA,EAARE,OAAQF,CAAAA,cAAAA,CAAAA,GAAAA,SAAAA,CAAAA,EAA8BM,OAA9BN,CAAsCK,CAAtCL,CAAAA"}
@@ -0,0 +1,25 @@
1
+ import { Runnable, RunnableConfig } from "@langchain/core/runnables";
2
+ import { CallbackManagerForChainRun } from "@langchain/core/callbacks/manager";
3
+
4
+ //#region src/utils.d.ts
5
+ interface RunnableCallableArgs extends Partial<any> {
6
+ name?: string;
7
+ func: (...args: any[]) => any;
8
+ tags?: string[];
9
+ trace?: boolean;
10
+ recurse?: boolean;
11
+ }
12
+ declare class RunnableCallable<I = unknown, O = unknown> extends Runnable<I, O> {
13
+ lc_namespace: string[];
14
+ func: (...args: any[]) => any;
15
+ tags?: string[];
16
+ config?: RunnableConfig;
17
+ trace: boolean;
18
+ recurse: boolean;
19
+ constructor(fields: RunnableCallableArgs);
20
+ protected _tracedInvoke(input: I, config?: Partial<RunnableConfig>, runManager?: CallbackManagerForChainRun): Promise<O>;
21
+ invoke(input: I, options?: Partial<RunnableConfig> | undefined): Promise<O>;
22
+ }
23
+ //#endregion
24
+ export { RunnableCallable };
25
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","names":["CallbackManagerForChainRun","Runnable","RunnableConfig","RunnableCallableArgs","Partial","RunnableCallable","I","O","Promise","prefixGenerator","T","Generator","Prefix","gatherIterator","AsyncIterable","Iterable","Array","gatherIteratorSync","patchConfigurable","Record","isAsyncGeneratorFunction","AsyncGeneratorFunction","isGeneratorFunction","GeneratorFunction"],"sources":["../src/utils.d.ts"],"sourcesContent":["import { CallbackManagerForChainRun } from \"@langchain/core/callbacks/manager\";\nimport { Runnable, RunnableConfig } from \"@langchain/core/runnables\";\nexport interface RunnableCallableArgs extends Partial<any> {\n name?: string;\n func: (...args: any[]) => any;\n tags?: string[];\n trace?: boolean;\n recurse?: boolean;\n}\nexport declare class RunnableCallable<I = unknown, O = unknown> extends Runnable<I, O> {\n lc_namespace: string[];\n func: (...args: any[]) => any;\n tags?: string[];\n config?: RunnableConfig;\n trace: boolean;\n recurse: boolean;\n constructor(fields: RunnableCallableArgs);\n protected _tracedInvoke(input: I, config?: Partial<RunnableConfig>, runManager?: CallbackManagerForChainRun): Promise<O>;\n invoke(input: I, options?: Partial<RunnableConfig> | undefined): Promise<O>;\n}\nexport declare function prefixGenerator<T, Prefix extends string>(generator: Generator<T>, prefix: Prefix): Generator<[Prefix, T]>;\nexport declare function prefixGenerator<T>(generator: Generator<T>, prefix?: undefined): Generator<T>;\nexport declare function prefixGenerator<T, Prefix extends string | undefined = undefined>(generator: Generator<T>, prefix?: Prefix | undefined): Generator<Prefix extends string ? [Prefix, T] : T>;\nexport declare function gatherIterator<T>(i: AsyncIterable<T> | Promise<AsyncIterable<T>> | Iterable<T> | Promise<Iterable<T>>): Promise<Array<T>>;\nexport declare function gatherIteratorSync<T>(i: Iterable<T>): Array<T>;\nexport declare function patchConfigurable(config: RunnableConfig | undefined, patch: Record<string, any>): RunnableConfig;\nexport declare function isAsyncGeneratorFunction(val: unknown): val is AsyncGeneratorFunction;\nexport declare function isGeneratorFunction(val: unknown): val is GeneratorFunction;\n"],"mappings":";;;;UAEiBG,oBAAAA,SAA6BC;;EAA7BD,IAAAA,EAAAA,CAAAA,GAAAA,IAAAA,EAAAA,GAAAA,EAAAA,EAAoB,GAAA,GAAA;EAOhBE,IAAAA,CAAAA,EAAAA,MAAAA,EAAAA;EAAgB,KAAA,CAAA,EAAA,OAAA;SAA4CC,CAAAA,EAAAA,OAAAA;;AAIpEJ,cAJQG,gBAIRH,CAAAA,IAAAA,OAAAA,EAAAA,IAAAA,OAAAA,CAAAA,SAJ2DD,QAI3DC,CAJoEI,CAIpEJ,EAJuEK,CAIvEL,CAAAA,CAAAA;cAGWC,EAAAA,MAAAA,EAAAA;MACWG,EAAAA,CAAAA,GAAAA,IAAAA,EAAAA,GAAAA,EAAAA,EAAAA,GAAAA,GAAAA;MAAoBJ,CAAAA,EAAAA,MAAAA,EAAAA;QAARE,CAAAA,EAJlCF,cAIkCE;OAAsCJ,EAAAA,OAAAA;SAAqCO,EAAAA,OAAAA;aAARC,CAAAA,MAAAA,EAD1FL,oBAC0FK;YAChGF,aAAAA,CAAAA,KAAAA,EADiBA,CACjBA,EAAAA,MAAAA,CAAAA,EAD6BF,OAC7BE,CADqCJ,cACrCI,CAAAA,EAAAA,UAAAA,CAAAA,EADmEN,0BACnEM,CAAAA,EADgGE,OAChGF,CADwGC,CACxGD,CAAAA;QAAqBJ,CAAAA,KAAAA,EAArBI,CAAqBJ,EAAAA,OAAAA,CAAAA,EAARE,OAAQF,CAAAA,cAAAA,CAAAA,GAAAA,SAAAA,CAAAA,EAA8BM,OAA9BN,CAAsCK,CAAtCL,CAAAA"}
package/dist/utils.js ADDED
@@ -0,0 +1,80 @@
1
+ import { ensureLangGraphConfig } from "./pregel/utils/config.js";
2
+ import { AsyncLocalStorageProviderSingleton } from "@langchain/core/singletons";
3
+ import { Runnable, mergeConfigs, patchConfig } from "@langchain/core/runnables";
4
+
5
+ //#region src/utils.ts
6
+ var RunnableCallable = class extends Runnable {
7
+ lc_namespace = ["langgraph"];
8
+ func;
9
+ tags;
10
+ config;
11
+ trace = true;
12
+ recurse = true;
13
+ constructor(fields) {
14
+ super();
15
+ this.name = fields.name ?? fields.func.name;
16
+ this.func = fields.func;
17
+ this.config = fields.tags ? { tags: fields.tags } : void 0;
18
+ this.trace = fields.trace ?? this.trace;
19
+ this.recurse = fields.recurse ?? this.recurse;
20
+ }
21
+ async _tracedInvoke(input, config, runManager) {
22
+ return new Promise((resolve, reject) => {
23
+ const childConfig = patchConfig(config, { callbacks: runManager?.getChild() });
24
+ AsyncLocalStorageProviderSingleton.runWithConfig(childConfig, async () => {
25
+ try {
26
+ resolve(await this.func(input, childConfig));
27
+ } catch (e) {
28
+ reject(e);
29
+ }
30
+ });
31
+ });
32
+ }
33
+ async invoke(input, options) {
34
+ let returnValue;
35
+ const config = ensureLangGraphConfig(options);
36
+ const mergedConfig = mergeConfigs(this.config, config);
37
+ if (this.trace) returnValue = await this._callWithConfig(this._tracedInvoke, input, mergedConfig);
38
+ else returnValue = await AsyncLocalStorageProviderSingleton.runWithConfig(mergedConfig, async () => this.func(input, mergedConfig));
39
+ if (Runnable.isRunnable(returnValue) && this.recurse) return await AsyncLocalStorageProviderSingleton.runWithConfig(mergedConfig, async () => returnValue.invoke(input, mergedConfig));
40
+ return returnValue;
41
+ }
42
+ };
43
+ function* prefixGenerator(generator, prefix) {
44
+ if (prefix === void 0) yield* generator;
45
+ else for (const value of generator) yield [prefix, value];
46
+ }
47
+ async function gatherIterator(i) {
48
+ const out = [];
49
+ for await (const item of await i) out.push(item);
50
+ return out;
51
+ }
52
+ function gatherIteratorSync(i) {
53
+ const out = [];
54
+ for (const item of i) out.push(item);
55
+ return out;
56
+ }
57
+ function patchConfigurable(config, patch) {
58
+ if (!config) return { configurable: patch };
59
+ else if (!("configurable" in config)) return {
60
+ ...config,
61
+ configurable: patch
62
+ };
63
+ else return {
64
+ ...config,
65
+ configurable: {
66
+ ...config.configurable,
67
+ ...patch
68
+ }
69
+ };
70
+ }
71
+ function isAsyncGeneratorFunction(val) {
72
+ return val != null && typeof val === "function" && val instanceof Object.getPrototypeOf(async function* () {}).constructor;
73
+ }
74
+ function isGeneratorFunction(val) {
75
+ return val != null && typeof val === "function" && val instanceof Object.getPrototypeOf(function* () {}).constructor;
76
+ }
77
+
78
+ //#endregion
79
+ export { RunnableCallable, gatherIterator, gatherIteratorSync, isAsyncGeneratorFunction, isGeneratorFunction, patchConfigurable, prefixGenerator };
80
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","names":[],"sources":["../src/utils.ts"],"sourcesContent":["import { CallbackManagerForChainRun } from \"@langchain/core/callbacks/manager\";\nimport {\n mergeConfigs,\n patchConfig,\n Runnable,\n RunnableConfig,\n} from \"@langchain/core/runnables\";\nimport { AsyncLocalStorageProviderSingleton } from \"@langchain/core/singletons\";\nimport { ensureLangGraphConfig } from \"./pregel/utils/config.js\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface RunnableCallableArgs extends Partial<any> {\n name?: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n func: (...args: any[]) => any;\n tags?: string[];\n trace?: boolean;\n recurse?: boolean;\n}\n\nexport class RunnableCallable<I = unknown, O = unknown> extends Runnable<I, O> {\n lc_namespace: string[] = [\"langgraph\"];\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n func: (...args: any[]) => any;\n\n tags?: string[];\n\n config?: RunnableConfig;\n\n trace: boolean = true;\n\n recurse: boolean = true;\n\n constructor(fields: RunnableCallableArgs) {\n super();\n this.name = fields.name ?? fields.func.name;\n this.func = fields.func;\n this.config = fields.tags ? { tags: fields.tags } : undefined;\n this.trace = fields.trace ?? this.trace;\n this.recurse = fields.recurse ?? this.recurse;\n }\n\n protected async _tracedInvoke(\n input: I,\n config?: Partial<RunnableConfig>,\n runManager?: CallbackManagerForChainRun\n ) {\n return new Promise<O>((resolve, reject) => {\n const childConfig = patchConfig(config, {\n callbacks: runManager?.getChild(),\n });\n void AsyncLocalStorageProviderSingleton.runWithConfig(\n childConfig,\n async () => {\n try {\n const output = await this.func(input, childConfig);\n resolve(output);\n } catch (e) {\n reject(e);\n }\n }\n );\n });\n }\n\n async invoke(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n input: I,\n options?: Partial<RunnableConfig> | undefined\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ): Promise<O> {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let returnValue: any;\n const config = ensureLangGraphConfig(options);\n const mergedConfig = mergeConfigs(this.config, config);\n\n if (this.trace) {\n returnValue = await this._callWithConfig(\n this._tracedInvoke,\n input,\n mergedConfig\n );\n } else {\n returnValue = await AsyncLocalStorageProviderSingleton.runWithConfig(\n mergedConfig,\n async () => this.func(input, mergedConfig)\n );\n }\n\n if (Runnable.isRunnable(returnValue) && this.recurse) {\n return await AsyncLocalStorageProviderSingleton.runWithConfig(\n mergedConfig,\n async () => returnValue.invoke(input, mergedConfig)\n );\n }\n\n return returnValue;\n }\n}\n\nexport function prefixGenerator<T, Prefix extends string>(\n generator: Generator<T>,\n prefix: Prefix\n): Generator<[Prefix, T]>;\n\nexport function prefixGenerator<T>(\n generator: Generator<T>,\n prefix?: undefined\n): Generator<T>;\n\nexport function prefixGenerator<\n T,\n Prefix extends string | undefined = undefined\n>(\n generator: Generator<T>,\n prefix?: Prefix | undefined\n): Generator<Prefix extends string ? [Prefix, T] : T>;\nexport function* prefixGenerator<\n T,\n Prefix extends string | undefined = undefined\n>(\n generator: Generator<T>,\n prefix?: Prefix | undefined\n): Generator<Prefix extends string ? [Prefix, T] : T> {\n if (prefix === undefined) {\n yield* generator as Generator<Prefix extends string ? [Prefix, T] : T>;\n } else {\n for (const value of generator) {\n yield [prefix, value] as Prefix extends string ? [Prefix, T] : T;\n }\n }\n}\n\n// https://github.com/tc39/proposal-array-from-async\nexport async function gatherIterator<T>(\n i:\n | AsyncIterable<T>\n | Promise<AsyncIterable<T>>\n | Iterable<T>\n | Promise<Iterable<T>>\n): Promise<Array<T>> {\n const out: T[] = [];\n for await (const item of await i) {\n out.push(item);\n }\n return out;\n}\n\nexport function gatherIteratorSync<T>(i: Iterable<T>): Array<T> {\n const out: T[] = [];\n for (const item of i) {\n out.push(item);\n }\n return out;\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) {\n return {\n configurable: patch,\n };\n } else if (!(\"configurable\" in config)) {\n return {\n ...config,\n configurable: patch,\n };\n } else {\n return {\n ...config,\n configurable: {\n ...config.configurable,\n ...patch,\n },\n };\n }\n}\n\nexport function isAsyncGeneratorFunction(\n val: unknown\n): val is AsyncGeneratorFunction {\n return (\n val != null &&\n typeof val === \"function\" &&\n // eslint-disable-next-line no-instanceof/no-instanceof\n val instanceof Object.getPrototypeOf(async function* () {}).constructor\n );\n}\n\nexport function isGeneratorFunction(val: unknown): val is GeneratorFunction {\n return (\n val != null &&\n typeof val === \"function\" &&\n // eslint-disable-next-line no-instanceof/no-instanceof\n val instanceof Object.getPrototypeOf(function* () {}).constructor\n );\n}\n"],"mappings":";;;;;AAoBA,IAAa,mBAAb,cAAgE,SAAe;CAC7E,eAAyB,CAAC,YAAY;CAGtC;CAEA;CAEA;CAEA,QAAiB;CAEjB,UAAmB;CAEnB,YAAY,QAA8B;AACxC,SAAO;AACP,OAAK,OAAO,OAAO,QAAQ,OAAO,KAAK;AACvC,OAAK,OAAO,OAAO;AACnB,OAAK,SAAS,OAAO,OAAO,EAAE,MAAM,OAAO,MAAM,GAAG;AACpD,OAAK,QAAQ,OAAO,SAAS,KAAK;AAClC,OAAK,UAAU,OAAO,WAAW,KAAK;;CAGxC,MAAgB,cACd,OACA,QACA,YACA;AACA,SAAO,IAAI,SAAY,SAAS,WAAW;GACzC,MAAM,cAAc,YAAY,QAAQ,EACtC,WAAW,YAAY,UAAU,EAClC,CAAC;AACF,GAAK,mCAAmC,cACtC,aACA,YAAY;AACV,QAAI;AAEF,aADe,MAAM,KAAK,KAAK,OAAO,YAAY,CACnC;aACR,GAAG;AACV,YAAO,EAAE;;KAGd;IACD;;CAGJ,MAAM,OAEJ,OACA,SAEY;EAEZ,IAAI;EACJ,MAAM,SAAS,sBAAsB,QAAQ;EAC7C,MAAM,eAAe,aAAa,KAAK,QAAQ,OAAO;AAEtD,MAAI,KAAK,MACP,eAAc,MAAM,KAAK,gBACvB,KAAK,eACL,OACA,aACD;MAED,eAAc,MAAM,mCAAmC,cACrD,cACA,YAAY,KAAK,KAAK,OAAO,aAAa,CAC3C;AAGH,MAAI,SAAS,WAAW,YAAY,IAAI,KAAK,QAC3C,QAAO,MAAM,mCAAmC,cAC9C,cACA,YAAY,YAAY,OAAO,OAAO,aAAa,CACpD;AAGH,SAAO;;;AAqBX,UAAiB,gBAIf,WACA,QACoD;AACpD,KAAI,WAAW,OACb,QAAO;KAEP,MAAK,MAAM,SAAS,UAClB,OAAM,CAAC,QAAQ,MAAM;;AAM3B,eAAsB,eACpB,GAKmB;CACnB,MAAM,MAAW,EAAE;AACnB,YAAW,MAAM,QAAQ,MAAM,EAC7B,KAAI,KAAK,KAAK;AAEhB,QAAO;;AAGT,SAAgB,mBAAsB,GAA0B;CAC9D,MAAM,MAAW,EAAE;AACnB,MAAK,MAAM,QAAQ,EACjB,KAAI,KAAK,KAAK;AAEhB,QAAO;;AAGT,SAAgB,kBACd,QAEA,OACgB;AAChB,KAAI,CAAC,OACH,QAAO,EACL,cAAc,OACf;UACQ,EAAE,kBAAkB,QAC7B,QAAO;EACL,GAAG;EACH,cAAc;EACf;KAED,QAAO;EACL,GAAG;EACH,cAAc;GACZ,GAAG,OAAO;GACV,GAAG;GACJ;EACF;;AAIL,SAAgB,yBACd,KAC+B;AAC/B,QACE,OAAO,QACP,OAAO,QAAQ,cAEf,eAAe,OAAO,eAAe,mBAAmB,GAAG,CAAC;;AAIhE,SAAgB,oBAAoB,KAAwC;AAC1E,QACE,OAAO,QACP,OAAO,QAAQ,cAEf,eAAe,OAAO,eAAe,aAAa,GAAG,CAAC"}
package/dist/web.cjs ADDED
@@ -0,0 +1,95 @@
1
+ const require_errors = require('./errors.cjs');
2
+ const require_base = require('./channels/base.cjs');
3
+ const require_binop = require('./channels/binop.cjs');
4
+ const require_annotation = require('./graph/annotation.cjs');
5
+ const require_constants = require('./constants.cjs');
6
+ const require_graph = require('./graph/graph.cjs');
7
+ const require_state = require('./graph/state.cjs');
8
+ const require_message = require('./graph/message.cjs');
9
+ require('./graph/index.cjs');
10
+ require('./channels/index.cjs');
11
+ const require_index$1 = require('./func/index.cjs');
12
+ const require_messages_annotation = require('./graph/messages_annotation.cjs');
13
+ let _langchain_langgraph_checkpoint = require("@langchain/langgraph-checkpoint");
14
+
15
+ exports.Annotation = require_annotation.Annotation;
16
+ Object.defineProperty(exports, 'AsyncBatchedStore', {
17
+ enumerable: true,
18
+ get: function () {
19
+ return _langchain_langgraph_checkpoint.AsyncBatchedStore;
20
+ }
21
+ });
22
+ exports.BaseChannel = require_base.BaseChannel;
23
+ Object.defineProperty(exports, 'BaseCheckpointSaver', {
24
+ enumerable: true,
25
+ get: function () {
26
+ return _langchain_langgraph_checkpoint.BaseCheckpointSaver;
27
+ }
28
+ });
29
+ exports.BaseLangGraphError = require_errors.BaseLangGraphError;
30
+ Object.defineProperty(exports, 'BaseStore', {
31
+ enumerable: true,
32
+ get: function () {
33
+ return _langchain_langgraph_checkpoint.BaseStore;
34
+ }
35
+ });
36
+ exports.BinaryOperatorAggregate = require_binop.BinaryOperatorAggregate;
37
+ exports.Command = require_constants.Command;
38
+ exports.CompiledStateGraph = require_state.CompiledStateGraph;
39
+ exports.END = require_constants.END;
40
+ exports.EmptyChannelError = require_errors.EmptyChannelError;
41
+ exports.EmptyInputError = require_errors.EmptyInputError;
42
+ exports.Graph = require_graph.Graph;
43
+ exports.GraphBubbleUp = require_errors.GraphBubbleUp;
44
+ exports.GraphInterrupt = require_errors.GraphInterrupt;
45
+ exports.GraphRecursionError = require_errors.GraphRecursionError;
46
+ exports.GraphValueError = require_errors.GraphValueError;
47
+ exports.INTERRUPT = require_constants.INTERRUPT;
48
+ Object.defineProperty(exports, 'InMemoryStore', {
49
+ enumerable: true,
50
+ get: function () {
51
+ return _langchain_langgraph_checkpoint.InMemoryStore;
52
+ }
53
+ });
54
+ exports.InvalidUpdateError = require_errors.InvalidUpdateError;
55
+ Object.defineProperty(exports, 'MemorySaver', {
56
+ enumerable: true,
57
+ get: function () {
58
+ return _langchain_langgraph_checkpoint.MemorySaver;
59
+ }
60
+ });
61
+ exports.MessageGraph = require_message.MessageGraph;
62
+ exports.MessagesAnnotation = require_messages_annotation.MessagesAnnotation;
63
+ exports.MessagesZodMeta = require_messages_annotation.MessagesZodMeta;
64
+ exports.MessagesZodState = require_messages_annotation.MessagesZodState;
65
+ exports.MultipleSubgraphsError = require_errors.MultipleSubgraphsError;
66
+ exports.NodeInterrupt = require_errors.NodeInterrupt;
67
+ exports.ParentCommand = require_errors.ParentCommand;
68
+ exports.REMOVE_ALL_MESSAGES = require_message.REMOVE_ALL_MESSAGES;
69
+ exports.RemoteException = require_errors.RemoteException;
70
+ exports.START = require_constants.START;
71
+ exports.Send = require_constants.Send;
72
+ exports.StateGraph = require_state.StateGraph;
73
+ exports.UnreachableNodeError = require_errors.UnreachableNodeError;
74
+ exports.addMessages = require_message.messagesStateReducer;
75
+ Object.defineProperty(exports, 'copyCheckpoint', {
76
+ enumerable: true,
77
+ get: function () {
78
+ return _langchain_langgraph_checkpoint.copyCheckpoint;
79
+ }
80
+ });
81
+ Object.defineProperty(exports, 'emptyCheckpoint', {
82
+ enumerable: true,
83
+ get: function () {
84
+ return _langchain_langgraph_checkpoint.emptyCheckpoint;
85
+ }
86
+ });
87
+ exports.entrypoint = require_index$1.entrypoint;
88
+ exports.getSubgraphsSeenSet = require_errors.getSubgraphsSeenSet;
89
+ exports.isCommand = require_constants.isCommand;
90
+ exports.isGraphBubbleUp = require_errors.isGraphBubbleUp;
91
+ exports.isGraphInterrupt = require_errors.isGraphInterrupt;
92
+ exports.isInterrupted = require_constants.isInterrupted;
93
+ exports.isParentCommand = require_errors.isParentCommand;
94
+ exports.messagesStateReducer = require_message.messagesStateReducer;
95
+ exports.task = require_index$1.task;
package/dist/web.d.cts ADDED
@@ -0,0 +1,23 @@
1
+ import { BaseChannel } from "./channels/base.cjs";
2
+ import { BinaryOperator, BinaryOperatorAggregate } from "./channels/binop.cjs";
3
+ import { AnyValue } from "./channels/any_value.cjs";
4
+ import { LastValue } from "./channels/last_value.cjs";
5
+ import { DynamicBarrierValue, WaitForNames } from "./channels/dynamic_barrier_value.cjs";
6
+ import { EphemeralValue } from "./channels/ephemeral_value.cjs";
7
+ import { NamedBarrierValue } from "./channels/named_barrier_value.cjs";
8
+ import { Topic } from "./channels/topic.cjs";
9
+ import { LangGraphRunnableConfig, Runtime } from "./pregel/runnable_types.cjs";
10
+ import { Annotation, AnnotationRoot, NodeType, SingleReducer, StateDefinition, StateType, UpdateType } from "./graph/annotation.cjs";
11
+ import { RetryPolicy } from "./pregel/utils/index.cjs";
12
+ import { PregelNode } from "./pregel/read.cjs";
13
+ import { Command, CommandParams, END, INTERRUPT, Interrupt, START, Send, isCommand, isInterrupted } from "./constants.cjs";
14
+ import { GetStateOptions, MultipleChannelSubscriptionOptions, PregelOptions, PregelParams, SingleChannelSubscriptionOptions, StateSnapshot, StreamMode, StreamOutputMap } from "./pregel/types.cjs";
15
+ import { Pregel } from "./pregel/index.cjs";
16
+ import { CompiledGraph, Graph } from "./graph/graph.cjs";
17
+ import { CompiledStateGraph, StateGraph, StateGraphArgs } from "./graph/state.cjs";
18
+ import { MessageGraph, Messages, REMOVE_ALL_MESSAGES, messagesStateReducer } from "./graph/message.cjs";
19
+ import { BaseLangGraphError, BaseLangGraphErrorFields, EmptyChannelError, EmptyInputError, GraphBubbleUp, GraphInterrupt, GraphRecursionError, GraphValueError, InvalidUpdateError, MultipleSubgraphsError, NodeInterrupt, ParentCommand, RemoteException, UnreachableNodeError, getSubgraphsSeenSet, isGraphBubbleUp, isGraphInterrupt, isParentCommand } from "./errors.cjs";
20
+ import { EntrypointOptions, TaskOptions, entrypoint, task } from "./func/index.cjs";
21
+ import { MessagesAnnotation, MessagesZodMeta, MessagesZodState } from "./graph/messages_annotation.cjs";
22
+ import { AsyncBatchedStore, BaseCheckpointSaver, BaseStore, Checkpoint, CheckpointMetadata, CheckpointTuple, GetOperation, InMemoryStore, Item, ListNamespacesOperation, MatchCondition, MemorySaver, NameSpacePath, NamespaceMatchType, Operation, OperationResults, PutOperation, SearchOperation, copyCheckpoint, emptyCheckpoint } from "@langchain/langgraph-checkpoint";
23
+ export { Annotation, type AnnotationRoot, type AnyValue, AsyncBatchedStore, BaseChannel, BaseCheckpointSaver, BaseLangGraphError, BaseLangGraphErrorFields, BaseStore, type BinaryOperator, BinaryOperatorAggregate, type Checkpoint, type CheckpointMetadata, type CheckpointTuple, Command, type CommandParams, type CompiledGraph, CompiledStateGraph, type DynamicBarrierValue, END, EmptyChannelError, EmptyInputError, type EntrypointOptions, type EphemeralValue, type GetOperation, type GetStateOptions, Graph, GraphBubbleUp, GraphInterrupt, GraphRecursionError, GraphValueError, INTERRUPT, InMemoryStore, type Interrupt, InvalidUpdateError, type Item, type LangGraphRunnableConfig, type LastValue, type ListNamespacesOperation, type MatchCondition, MemorySaver, MessageGraph, type Messages, MessagesAnnotation, MessagesZodMeta, MessagesZodState, type MultipleChannelSubscriptionOptions, MultipleSubgraphsError, type NameSpacePath, type NamedBarrierValue, type NamespaceMatchType, NodeInterrupt, type NodeType, type Operation, type OperationResults, ParentCommand, type Pregel, type PregelNode, type PregelOptions, type PregelParams, type PutOperation, REMOVE_ALL_MESSAGES, RemoteException, type RetryPolicy, type Runtime, START, type SearchOperation, Send, type SingleChannelSubscriptionOptions, type SingleReducer, type StateDefinition, StateGraph, type StateGraphArgs, type StateSnapshot, type StateType, type StreamMode, type StreamOutputMap, type TaskOptions, type Topic, UnreachableNodeError, type UpdateType, type WaitForNames, messagesStateReducer as addMessages, copyCheckpoint, emptyCheckpoint, entrypoint, getSubgraphsSeenSet, isCommand, isGraphBubbleUp, isGraphInterrupt, isInterrupted, isParentCommand, messagesStateReducer, task };
package/dist/web.d.ts ADDED
@@ -0,0 +1,23 @@
1
+ import { BaseChannel } from "./channels/base.js";
2
+ import { BinaryOperator, BinaryOperatorAggregate } from "./channels/binop.js";
3
+ import { AnyValue } from "./channels/any_value.js";
4
+ import { LastValue } from "./channels/last_value.js";
5
+ import { DynamicBarrierValue, WaitForNames } from "./channels/dynamic_barrier_value.js";
6
+ import { EphemeralValue } from "./channels/ephemeral_value.js";
7
+ import { NamedBarrierValue } from "./channels/named_barrier_value.js";
8
+ import { Topic } from "./channels/topic.js";
9
+ import { LangGraphRunnableConfig, Runtime } from "./pregel/runnable_types.js";
10
+ import { Annotation, AnnotationRoot, NodeType, SingleReducer, StateDefinition, StateType, UpdateType } from "./graph/annotation.js";
11
+ import { RetryPolicy } from "./pregel/utils/index.js";
12
+ import { PregelNode } from "./pregel/read.js";
13
+ import { Command, CommandParams, END, INTERRUPT, Interrupt, START, Send, isCommand, isInterrupted } from "./constants.js";
14
+ import { GetStateOptions, MultipleChannelSubscriptionOptions, PregelOptions, PregelParams, SingleChannelSubscriptionOptions, StateSnapshot, StreamMode, StreamOutputMap } from "./pregel/types.js";
15
+ import { Pregel } from "./pregel/index.js";
16
+ import { CompiledGraph, Graph } from "./graph/graph.js";
17
+ import { CompiledStateGraph, StateGraph, StateGraphArgs } from "./graph/state.js";
18
+ import { MessageGraph, Messages, REMOVE_ALL_MESSAGES, messagesStateReducer } from "./graph/message.js";
19
+ import { BaseLangGraphError, BaseLangGraphErrorFields, EmptyChannelError, EmptyInputError, GraphBubbleUp, GraphInterrupt, GraphRecursionError, GraphValueError, InvalidUpdateError, MultipleSubgraphsError, NodeInterrupt, ParentCommand, RemoteException, UnreachableNodeError, getSubgraphsSeenSet, isGraphBubbleUp, isGraphInterrupt, isParentCommand } from "./errors.js";
20
+ import { EntrypointOptions, TaskOptions, entrypoint, task } from "./func/index.js";
21
+ import { MessagesAnnotation, MessagesZodMeta, MessagesZodState } from "./graph/messages_annotation.js";
22
+ import { AsyncBatchedStore, BaseCheckpointSaver, BaseStore, Checkpoint, CheckpointMetadata, CheckpointTuple, GetOperation, InMemoryStore, Item, ListNamespacesOperation, MatchCondition, MemorySaver, NameSpacePath, NamespaceMatchType, Operation, OperationResults, PutOperation, SearchOperation, copyCheckpoint, emptyCheckpoint } from "@langchain/langgraph-checkpoint";
23
+ export { Annotation, type AnnotationRoot, type AnyValue, AsyncBatchedStore, BaseChannel, BaseCheckpointSaver, BaseLangGraphError, BaseLangGraphErrorFields, BaseStore, type BinaryOperator, BinaryOperatorAggregate, type Checkpoint, type CheckpointMetadata, type CheckpointTuple, Command, type CommandParams, type CompiledGraph, CompiledStateGraph, type DynamicBarrierValue, END, EmptyChannelError, EmptyInputError, type EntrypointOptions, type EphemeralValue, type GetOperation, type GetStateOptions, Graph, GraphBubbleUp, GraphInterrupt, GraphRecursionError, GraphValueError, INTERRUPT, InMemoryStore, type Interrupt, InvalidUpdateError, type Item, type LangGraphRunnableConfig, type LastValue, type ListNamespacesOperation, type MatchCondition, MemorySaver, MessageGraph, type Messages, MessagesAnnotation, MessagesZodMeta, MessagesZodState, type MultipleChannelSubscriptionOptions, MultipleSubgraphsError, type NameSpacePath, type NamedBarrierValue, type NamespaceMatchType, NodeInterrupt, type NodeType, type Operation, type OperationResults, ParentCommand, type Pregel, type PregelNode, type PregelOptions, type PregelParams, type PutOperation, REMOVE_ALL_MESSAGES, RemoteException, type RetryPolicy, type Runtime, START, type SearchOperation, Send, type SingleChannelSubscriptionOptions, type SingleReducer, type StateDefinition, StateGraph, type StateGraphArgs, type StateSnapshot, type StateType, type StreamMode, type StreamOutputMap, type TaskOptions, type Topic, UnreachableNodeError, type UpdateType, type WaitForNames, messagesStateReducer as addMessages, copyCheckpoint, emptyCheckpoint, entrypoint, getSubgraphsSeenSet, isCommand, isGraphBubbleUp, isGraphInterrupt, isInterrupted, isParentCommand, messagesStateReducer, task };
package/dist/web.js ADDED
@@ -0,0 +1,15 @@
1
+ import { BaseLangGraphError, EmptyChannelError, EmptyInputError, GraphBubbleUp, GraphInterrupt, GraphRecursionError, GraphValueError, InvalidUpdateError, MultipleSubgraphsError, NodeInterrupt, ParentCommand, RemoteException, UnreachableNodeError, getSubgraphsSeenSet, isGraphBubbleUp, isGraphInterrupt, isParentCommand } from "./errors.js";
2
+ import { BaseChannel } from "./channels/base.js";
3
+ import { BinaryOperatorAggregate } from "./channels/binop.js";
4
+ import { Annotation } from "./graph/annotation.js";
5
+ import { Command, END, INTERRUPT, START, Send, isCommand, isInterrupted } from "./constants.js";
6
+ import { Graph } from "./graph/graph.js";
7
+ import { CompiledStateGraph, StateGraph } from "./graph/state.js";
8
+ import { MessageGraph, REMOVE_ALL_MESSAGES, messagesStateReducer } from "./graph/message.js";
9
+ import "./graph/index.js";
10
+ import "./channels/index.js";
11
+ import { entrypoint, task } from "./func/index.js";
12
+ import { MessagesAnnotation, MessagesZodMeta, MessagesZodState } from "./graph/messages_annotation.js";
13
+ import { AsyncBatchedStore, BaseCheckpointSaver, BaseStore, InMemoryStore, MemorySaver, copyCheckpoint, emptyCheckpoint } from "@langchain/langgraph-checkpoint";
14
+
15
+ export { Annotation, AsyncBatchedStore, BaseChannel, BaseCheckpointSaver, BaseLangGraphError, BaseStore, BinaryOperatorAggregate, Command, CompiledStateGraph, END, EmptyChannelError, EmptyInputError, Graph, GraphBubbleUp, GraphInterrupt, GraphRecursionError, GraphValueError, INTERRUPT, InMemoryStore, InvalidUpdateError, MemorySaver, MessageGraph, MessagesAnnotation, MessagesZodMeta, MessagesZodState, MultipleSubgraphsError, NodeInterrupt, ParentCommand, REMOVE_ALL_MESSAGES, RemoteException, START, Send, StateGraph, UnreachableNodeError, messagesStateReducer as addMessages, copyCheckpoint, emptyCheckpoint, entrypoint, getSubgraphsSeenSet, isCommand, isGraphBubbleUp, isGraphInterrupt, isInterrupted, isParentCommand, messagesStateReducer, task };
@@ -0,0 +1,14 @@
1
+ let _langchain_core_singletons = require("@langchain/core/singletons");
2
+
3
+ //#region src/writer.ts
4
+ function writer(chunk) {
5
+ const config = _langchain_core_singletons.AsyncLocalStorageProviderSingleton.getRunnableConfig();
6
+ if (!config) throw new Error("Called interrupt() outside the context of a graph.");
7
+ const conf = config.configurable;
8
+ if (!conf) throw new Error("No configurable found in config");
9
+ return conf.writer?.(chunk);
10
+ }
11
+
12
+ //#endregion
13
+ exports.writer = writer;
14
+ //# sourceMappingURL=writer.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"writer.cjs","names":["AsyncLocalStorageProviderSingleton"],"sources":["../src/writer.ts"],"sourcesContent":["import { AsyncLocalStorageProviderSingleton } from \"@langchain/core/singletons\";\nimport { LangGraphRunnableConfig } from \"./pregel/runnable_types.js\";\n\nexport function writer<T>(chunk: T): void {\n const config: LangGraphRunnableConfig | undefined =\n AsyncLocalStorageProviderSingleton.getRunnableConfig();\n if (!config) {\n throw new Error(\"Called interrupt() outside the context of a graph.\");\n }\n\n const conf = config.configurable;\n if (!conf) {\n throw new Error(\"No configurable found in config\");\n }\n\n return conf.writer?.(chunk);\n}\n\nexport type InferWriterType<T> = T extends typeof writer<infer C> ? C : any; // eslint-disable-line @typescript-eslint/no-explicit-any\n"],"mappings":";;;AAGA,SAAgB,OAAU,OAAgB;CACxC,MAAM,SACJA,8DAAmC,mBAAmB;AACxD,KAAI,CAAC,OACH,OAAM,IAAI,MAAM,qDAAqD;CAGvE,MAAM,OAAO,OAAO;AACpB,KAAI,CAAC,KACH,OAAM,IAAI,MAAM,kCAAkC;AAGpD,QAAO,KAAK,SAAS,MAAM"}
@@ -0,0 +1,6 @@
1
+ //#region src/writer.d.ts
2
+ declare function writer<T>(chunk: T): void;
3
+ type InferWriterType<T> = T extends typeof writer<infer C> ? C : any;
4
+ //#endregion
5
+ export { InferWriterType, writer };
6
+ //# sourceMappingURL=writer.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"writer.d.cts","names":["writer","T","InferWriterType","C"],"sources":["../src/writer.d.ts"],"sourcesContent":["export declare function writer<T>(chunk: T): void;\nexport type InferWriterType<T> = T extends typeof writer<infer C> ? C : any;\n"],"mappings":";iBAAwBA,iBAAiBC;AAAjBD,KACZE,eAD8B,CAAA,CAAA,CAAA,GACTD,CADS,SAAA,OACQD,MADR,CAAA,KAAA,EAAA,CAAA,GAC0BG,CAD1B,GAAA,GAAA"}
@@ -0,0 +1,6 @@
1
+ //#region src/writer.d.ts
2
+ declare function writer<T>(chunk: T): void;
3
+ type InferWriterType<T> = T extends typeof writer<infer C> ? C : any;
4
+ //#endregion
5
+ export { InferWriterType, writer };
6
+ //# sourceMappingURL=writer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"writer.d.ts","names":["writer","T","InferWriterType","C"],"sources":["../src/writer.d.ts"],"sourcesContent":["export declare function writer<T>(chunk: T): void;\nexport type InferWriterType<T> = T extends typeof writer<infer C> ? C : any;\n"],"mappings":";iBAAwBA,iBAAiBC;AAAjBD,KACZE,eAD8B,CAAA,CAAA,CAAA,GACTD,CADS,SAAA,OACQD,MADR,CAAA,KAAA,EAAA,CAAA,GAC0BG,CAD1B,GAAA,GAAA"}
package/dist/writer.js ADDED
@@ -0,0 +1,14 @@
1
+ import { AsyncLocalStorageProviderSingleton } from "@langchain/core/singletons";
2
+
3
+ //#region src/writer.ts
4
+ function writer(chunk) {
5
+ const config = AsyncLocalStorageProviderSingleton.getRunnableConfig();
6
+ if (!config) throw new Error("Called interrupt() outside the context of a graph.");
7
+ const conf = config.configurable;
8
+ if (!conf) throw new Error("No configurable found in config");
9
+ return conf.writer?.(chunk);
10
+ }
11
+
12
+ //#endregion
13
+ export { writer };
14
+ //# sourceMappingURL=writer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"writer.js","names":[],"sources":["../src/writer.ts"],"sourcesContent":["import { AsyncLocalStorageProviderSingleton } from \"@langchain/core/singletons\";\nimport { LangGraphRunnableConfig } from \"./pregel/runnable_types.js\";\n\nexport function writer<T>(chunk: T): void {\n const config: LangGraphRunnableConfig | undefined =\n AsyncLocalStorageProviderSingleton.getRunnableConfig();\n if (!config) {\n throw new Error(\"Called interrupt() outside the context of a graph.\");\n }\n\n const conf = config.configurable;\n if (!conf) {\n throw new Error(\"No configurable found in config\");\n }\n\n return conf.writer?.(chunk);\n}\n\nexport type InferWriterType<T> = T extends typeof writer<infer C> ? C : any; // eslint-disable-line @typescript-eslint/no-explicit-any\n"],"mappings":";;;AAGA,SAAgB,OAAU,OAAgB;CACxC,MAAM,SACJ,mCAAmC,mBAAmB;AACxD,KAAI,CAAC,OACH,OAAM,IAAI,MAAM,qDAAqD;CAGvE,MAAM,OAAO,OAAO;AACpB,KAAI,CAAC,KACH,OAAM,IAAI,MAAM,kCAAkC;AAGpD,QAAO,KAAK,SAAS,MAAM"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@langchain/langgraph",
3
- "version": "1.0.12",
3
+ "version": "1.0.13",
4
4
  "description": "LangGraph",
5
5
  "type": "module",
6
6
  "engines": {
@@ -34,7 +34,7 @@
34
34
  "license": "MIT",
35
35
  "dependencies": {
36
36
  "@langchain/langgraph-checkpoint": "^1.0.0",
37
- "@langchain/langgraph-sdk": "~1.4.4",
37
+ "@langchain/langgraph-sdk": "~1.4.5",
38
38
  "uuid": "^10.0.0"
39
39
  },
40
40
  "peerDependencies": {