@langchain/langgraph 1.0.12 → 1.0.14

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 +25 -27
@@ -0,0 +1,281 @@
1
+ import { PendingWrite } from "@langchain/langgraph-checkpoint";
2
+
3
+ //#region src/constants.d.ts
4
+ /** Special reserved node name denoting the start of a graph. */
5
+ declare const START = "__start__";
6
+ /** Special reserved node name denoting the end of a graph. */
7
+ declare const END = "__end__";
8
+ /** Special channel reserved for graph interrupts */
9
+ declare const INTERRUPT = "__interrupt__";
10
+ /** Special channel reserved for graph resume */
11
+
12
+ /** Special channel reserved for graph previous state */
13
+ declare const PREVIOUS = "__previous__";
14
+ /** @internal */
15
+ declare const COMMAND_SYMBOL: unique symbol;
16
+ /**
17
+ * Instance of a {@link Command} class.
18
+ *
19
+ * This is used to avoid IntelliSense suggesting public fields
20
+ * of {@link Command} class when a plain object is expected.
21
+ *
22
+ * @see {@link Command}
23
+ * @internal
24
+ */
25
+ declare class CommandInstance<Resume = unknown, Update extends Record<string, unknown> = Record<string, unknown>, Nodes extends string = string> {
26
+ [COMMAND_SYMBOL]: CommandParams<Resume, Update, Nodes>;
27
+ constructor(args: CommandParams<Resume, Update, Nodes>);
28
+ }
29
+ interface SendInterface<Node extends string = string, Args = any> {
30
+ node: Node;
31
+ args: Args;
32
+ }
33
+ /**
34
+ *
35
+ * A message or packet to send to a specific node in the graph.
36
+ *
37
+ * The `Send` class is used within a `StateGraph`'s conditional edges to
38
+ * dynamically invoke a node with a custom state at the next step.
39
+ *
40
+ * Importantly, the sent state can differ from the core graph's state,
41
+ * allowing for flexible and dynamic workflow management.
42
+ *
43
+ * One such example is a "map-reduce" workflow where your graph invokes
44
+ * the same node multiple times in parallel with different states,
45
+ * before aggregating the results back into the main graph's state.
46
+ *
47
+ * @example
48
+ * ```typescript
49
+ * import { Annotation, Send, StateGraph } from "@langchain/langgraph";
50
+ *
51
+ * const ChainState = Annotation.Root({
52
+ * subjects: Annotation<string[]>,
53
+ * jokes: Annotation<string[]>({
54
+ * reducer: (a, b) => a.concat(b),
55
+ * }),
56
+ * });
57
+ *
58
+ * const continueToJokes = async (state: typeof ChainState.State) => {
59
+ * return state.subjects.map((subject) => {
60
+ * return new Send("generate_joke", { subjects: [subject] });
61
+ * });
62
+ * };
63
+ *
64
+ * const graph = new StateGraph(ChainState)
65
+ * .addNode("generate_joke", (state) => ({
66
+ * jokes: [`Joke about ${state.subjects}`],
67
+ * }))
68
+ * .addConditionalEdges("__start__", continueToJokes)
69
+ * .addEdge("generate_joke", "__end__")
70
+ * .compile();
71
+ *
72
+ * const res = await graph.invoke({ subjects: ["cats", "dogs"] });
73
+ * console.log(res);
74
+ *
75
+ * // Invoking with two subjects results in a generated joke for each
76
+ * // { subjects: ["cats", "dogs"], jokes: [`Joke about cats`, `Joke about dogs`] }
77
+ * ```
78
+ */
79
+ declare class Send<Node extends string = string, Args = any> implements SendInterface<Node, Args> {
80
+ lg_name: string;
81
+ node: Node;
82
+ args: Args;
83
+ constructor(node: Node, args: Args);
84
+ toJSON(): {
85
+ lg_name: string;
86
+ node: Node;
87
+ args: Args;
88
+ };
89
+ }
90
+ type Interrupt<Value = any> = {
91
+ id?: string;
92
+ value?: Value;
93
+ };
94
+ /**
95
+ * Checks if the given graph invoke / stream chunk contains interrupt.
96
+ *
97
+ * @example
98
+ * ```ts
99
+ * import { INTERRUPT, isInterrupted } from "@langchain/langgraph";
100
+ *
101
+ * const values = await graph.invoke({ foo: "bar" });
102
+ * if (isInterrupted<string>(values)) {
103
+ * const interrupt = values[INTERRUPT][0].value;
104
+ * }
105
+ * ```
106
+ *
107
+ * @param values - The values to check.
108
+ * @returns `true` if the values contain an interrupt, `false` otherwise.
109
+ */
110
+ declare function isInterrupted<Value = unknown>(values: unknown): values is {
111
+ [INTERRUPT]: Interrupt<Value>[];
112
+ };
113
+ type CommandParams<Resume = unknown, Update extends Record<string, unknown> = Record<string, unknown>, Nodes extends string = string> = {
114
+ /**
115
+ * A discriminator field used to identify the type of object. Must be populated when serializing.
116
+ *
117
+ * Optional because it's not required to specify this when directly constructing a {@link Command}
118
+ * object.
119
+ */
120
+ lg_name?: "Command";
121
+ /**
122
+ * Value to resume execution with. To be used together with {@link interrupt}.
123
+ */
124
+ resume?: Resume;
125
+ /**
126
+ * Graph to send the command to. Supported values are:
127
+ * - None: the current graph (default)
128
+ * - The specific name of the graph to send the command to
129
+ * - {@link Command.PARENT}: closest parent graph (only supported when returned from a node in a subgraph)
130
+ */
131
+ graph?: string;
132
+ /**
133
+ * Update to apply to the graph's state.
134
+ */
135
+ update?: Update | [string, unknown][];
136
+ /**
137
+ * Can be one of the following:
138
+ * - name of the node to navigate to next (any node that belongs to the specified `graph`)
139
+ * - sequence of node names to navigate to next
140
+ * - `Send` object (to execute a node with the input provided)
141
+ * - sequence of `Send` objects
142
+ */
143
+ goto?: Nodes | SendInterface<Nodes> | (Nodes | SendInterface<Nodes>)[];
144
+ };
145
+ /**
146
+ * One or more commands to update the graph's state and send messages to nodes.
147
+ * Can be used to combine routing logic with state updates in lieu of conditional edges
148
+ *
149
+ * @example
150
+ * ```ts
151
+ * import { Annotation, Command } from "@langchain/langgraph";
152
+ *
153
+ * // Define graph state
154
+ * const StateAnnotation = Annotation.Root({
155
+ * foo: Annotation<string>,
156
+ * });
157
+ *
158
+ * // Define the nodes
159
+ * const nodeA = async (_state: typeof StateAnnotation.State) => {
160
+ * console.log("Called A");
161
+ * // this is a replacement for a real conditional edge function
162
+ * const goto = Math.random() > .5 ? "nodeB" : "nodeC";
163
+ * // note how Command allows you to BOTH update the graph state AND route to the next node
164
+ * return new Command({
165
+ * // this is the state update
166
+ * update: {
167
+ * foo: "a",
168
+ * },
169
+ * // this is a replacement for an edge
170
+ * goto,
171
+ * });
172
+ * };
173
+ *
174
+ * // Nodes B and C are unchanged
175
+ * const nodeB = async (state: typeof StateAnnotation.State) => {
176
+ * console.log("Called B");
177
+ * return {
178
+ * foo: state.foo + "|b",
179
+ * };
180
+ * }
181
+ *
182
+ * const nodeC = async (state: typeof StateAnnotation.State) => {
183
+ * console.log("Called C");
184
+ * return {
185
+ * foo: state.foo + "|c",
186
+ * };
187
+ * }
188
+ *
189
+ * import { StateGraph } from "@langchain/langgraph";
190
+
191
+ * // NOTE: there are no edges between nodes A, B and C!
192
+ * const graph = new StateGraph(StateAnnotation)
193
+ * .addNode("nodeA", nodeA, {
194
+ * ends: ["nodeB", "nodeC"],
195
+ * })
196
+ * .addNode("nodeB", nodeB)
197
+ * .addNode("nodeC", nodeC)
198
+ * .addEdge("__start__", "nodeA")
199
+ * .compile();
200
+ *
201
+ * await graph.invoke({ foo: "" });
202
+ *
203
+ * // Randomly oscillates between
204
+ * // { foo: 'a|c' } and { foo: 'a|b' }
205
+ * ```
206
+ */
207
+ declare class Command<Resume = unknown, Update extends Record<string, unknown> = Record<string, unknown>, Nodes extends string = string> extends CommandInstance<Resume, Update, Nodes> {
208
+ readonly lg_name = "Command";
209
+ lc_direct_tool_output: boolean;
210
+ /**
211
+ * Graph to send the command to. Supported values are:
212
+ * - None: the current graph (default)
213
+ * - The specific name of the graph to send the command to
214
+ * - {@link Command.PARENT}: closest parent graph (only supported when returned from a node in a subgraph)
215
+ */
216
+ graph?: string;
217
+ /**
218
+ * Update to apply to the graph's state as a result of executing the node that is returning the command.
219
+ * Written to the state as if the node had simply returned this value instead of the Command object.
220
+ */
221
+ update?: Update | [string, unknown][];
222
+ /**
223
+ * Value to resume execution with. To be used together with {@link interrupt}.
224
+ */
225
+ resume?: Resume;
226
+ /**
227
+ * Can be one of the following:
228
+ * - name of the node to navigate to next (any node that belongs to the specified `graph`)
229
+ * - sequence of node names to navigate to next
230
+ * - {@link Send} object (to execute a node with the exact input provided in the {@link Send} object)
231
+ * - sequence of {@link Send} objects
232
+ */
233
+ goto?: Nodes | Send<Nodes> | (Nodes | Send<Nodes>)[];
234
+ static PARENT: string;
235
+ constructor(args: Omit<CommandParams<Resume, Update, Nodes>, "lg_name">);
236
+ /**
237
+ * Convert the update field to a list of {@link PendingWrite} tuples
238
+ * @returns List of {@link PendingWrite} tuples of the form `[channelKey, value]`.
239
+ * @internal
240
+ */
241
+ _updateAsTuples(): PendingWrite[];
242
+ toJSON(): {
243
+ lg_name: string;
244
+ update: Update | [string, unknown][] | undefined;
245
+ resume: Resume | undefined;
246
+ goto: Nodes | (Nodes | {
247
+ lg_name: string;
248
+ node: Nodes;
249
+ args: any;
250
+ })[] | {
251
+ lg_name: string;
252
+ node: Nodes;
253
+ args: any;
254
+ } | undefined;
255
+ };
256
+ }
257
+ /**
258
+ * A type guard to check if the given value is a {@link Command}.
259
+ *
260
+ * Useful for type narrowing when working with the {@link Command} object.
261
+ *
262
+ * @param x - The value to check.
263
+ * @returns `true` if the value is a {@link Command}, `false` otherwise.
264
+ */
265
+ declare function isCommand(x: unknown): x is Command;
266
+ /**
267
+ * Reconstructs Command and Send objects from a deeply nested tree of anonymous objects
268
+ * matching their interfaces.
269
+ *
270
+ * This is only exported for testing purposes. It is NOT intended to be used outside of
271
+ * the Command and Send classes.
272
+ *
273
+ * @internal
274
+ *
275
+ * @param x - The command send tree to convert.
276
+ * @param seen - A map of seen objects to avoid infinite loops.
277
+ * @returns The converted command send tree.
278
+ */
279
+ //#endregion
280
+ export { Command, CommandInstance, CommandParams, END, INTERRUPT, Interrupt, PREVIOUS, START, Send, isCommand, isInterrupted };
281
+ //# sourceMappingURL=constants.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.cts","names":["PendingWrite","START","END","INPUT","COPY","ERROR","CACHE_NS_WRITES","CONFIG_KEY_SEND","CONFIG_KEY_CALL","CONFIG_KEY_READ","CONFIG_KEY_CHECKPOINTER","CONFIG_KEY_RESUMING","CONFIG_KEY_TASK_ID","CONFIG_KEY_STREAM","CONFIG_KEY_RESUME_VALUE","CONFIG_KEY_RESUME_MAP","CONFIG_KEY_SCRATCHPAD","CONFIG_KEY_PREVIOUS_STATE","CONFIG_KEY_DURABILITY","CONFIG_KEY_CHECKPOINT_ID","CONFIG_KEY_CHECKPOINT_NS","CONFIG_KEY_NODE_FINISHED","CONFIG_KEY_CHECKPOINT_MAP","CONFIG_KEY_ABORT_SIGNALS","INTERRUPT","RESUME","NO_WRITES","RETURN","PREVIOUS","RUNTIME_PLACEHOLDER","RECURSION_LIMIT_DEFAULT","TAG_HIDDEN","TAG_NOSTREAM","SELF","TASKS","PUSH","PULL","TASK_NAMESPACE","NULL_TASK_ID","RESERVED","CHECKPOINT_NAMESPACE_SEPARATOR","CHECKPOINT_NAMESPACE_END","COMMAND_SYMBOL","CommandInstance","Record","Resume","Update","Nodes","CommandParams","SendInterface","Node","Args","_isSendInterface","Send","_isSend","Interrupt","Value","isInterrupted","Command","Omit","isCommand","_deserializeCommandSendObjectGraph","Map"],"sources":["../src/constants.d.ts"],"sourcesContent":["import { PendingWrite } from \"@langchain/langgraph-checkpoint\";\n/** Special reserved node name denoting the start of a graph. */\nexport declare const START = \"__start__\";\n/** Special reserved node name denoting the end of a graph. */\nexport declare const END = \"__end__\";\nexport declare const INPUT = \"__input__\";\nexport declare const COPY = \"__copy__\";\nexport declare const ERROR = \"__error__\";\n/** Special reserved cache namespaces */\nexport declare const CACHE_NS_WRITES = \"__pregel_ns_writes\";\nexport declare const CONFIG_KEY_SEND = \"__pregel_send\";\n/** config key containing function used to call a node (push task) */\nexport declare const CONFIG_KEY_CALL = \"__pregel_call\";\nexport declare const CONFIG_KEY_READ = \"__pregel_read\";\nexport declare const CONFIG_KEY_CHECKPOINTER = \"__pregel_checkpointer\";\nexport declare const CONFIG_KEY_RESUMING = \"__pregel_resuming\";\nexport declare const CONFIG_KEY_TASK_ID = \"__pregel_task_id\";\nexport declare const CONFIG_KEY_STREAM = \"__pregel_stream\";\nexport declare const CONFIG_KEY_RESUME_VALUE = \"__pregel_resume_value\";\nexport declare const CONFIG_KEY_RESUME_MAP = \"__pregel_resume_map\";\nexport declare const CONFIG_KEY_SCRATCHPAD = \"__pregel_scratchpad\";\n/** config key containing state from previous invocation of graph for the given thread */\nexport declare const CONFIG_KEY_PREVIOUS_STATE = \"__pregel_previous\";\nexport declare const CONFIG_KEY_DURABILITY = \"__pregel_durability\";\nexport declare const CONFIG_KEY_CHECKPOINT_ID = \"checkpoint_id\";\nexport declare const CONFIG_KEY_CHECKPOINT_NS = \"checkpoint_ns\";\nexport declare const CONFIG_KEY_NODE_FINISHED = \"__pregel_node_finished\";\nexport declare const CONFIG_KEY_CHECKPOINT_MAP = \"checkpoint_map\";\nexport declare const CONFIG_KEY_ABORT_SIGNALS = \"__pregel_abort_signals\";\n/** Special channel reserved for graph interrupts */\nexport declare const INTERRUPT = \"__interrupt__\";\n/** Special channel reserved for graph resume */\nexport declare const RESUME = \"__resume__\";\n/** Special channel reserved for cases when a task exits without any writes */\nexport declare const NO_WRITES = \"__no_writes__\";\n/** Special channel reserved for graph return */\nexport declare const RETURN = \"__return__\";\n/** Special channel reserved for graph previous state */\nexport declare const PREVIOUS = \"__previous__\";\nexport declare const RUNTIME_PLACEHOLDER = \"__pregel_runtime_placeholder__\";\nexport declare const RECURSION_LIMIT_DEFAULT = 25;\nexport declare const TAG_HIDDEN = \"langsmith:hidden\";\nexport declare const TAG_NOSTREAM = \"langsmith:nostream\";\nexport declare const SELF = \"__self__\";\nexport declare const TASKS = \"__pregel_tasks\";\nexport declare const PUSH = \"__pregel_push\";\nexport declare const PULL = \"__pregel_pull\";\nexport declare const TASK_NAMESPACE = \"6ba7b831-9dad-11d1-80b4-00c04fd430c8\";\nexport declare const NULL_TASK_ID = \"00000000-0000-0000-0000-000000000000\";\nexport declare const RESERVED: string[];\nexport declare const CHECKPOINT_NAMESPACE_SEPARATOR = \"|\";\nexport declare const CHECKPOINT_NAMESPACE_END = \":\";\n/** @internal */\ndeclare const COMMAND_SYMBOL: unique symbol;\n/**\n * Instance of a {@link Command} class.\n *\n * This is used to avoid IntelliSense suggesting public fields\n * of {@link Command} class when a plain object is expected.\n *\n * @see {@link Command}\n * @internal\n */\nexport declare class CommandInstance<Resume = unknown, Update extends Record<string, unknown> = Record<string, unknown>, Nodes extends string = string> {\n [COMMAND_SYMBOL]: CommandParams<Resume, Update, Nodes>;\n constructor(args: CommandParams<Resume, Update, Nodes>);\n}\nexport interface SendInterface<Node extends string = string, Args = any> {\n node: Node;\n args: Args;\n}\nexport declare function _isSendInterface(x: unknown): x is SendInterface;\n/**\n *\n * A message or packet to send to a specific node in the graph.\n *\n * The `Send` class is used within a `StateGraph`'s conditional edges to\n * dynamically invoke a node with a custom state at the next step.\n *\n * Importantly, the sent state can differ from the core graph's state,\n * allowing for flexible and dynamic workflow management.\n *\n * One such example is a \"map-reduce\" workflow where your graph invokes\n * the same node multiple times in parallel with different states,\n * before aggregating the results back into the main graph's state.\n *\n * @example\n * ```typescript\n * import { Annotation, Send, StateGraph } from \"@langchain/langgraph\";\n *\n * const ChainState = Annotation.Root({\n * subjects: Annotation<string[]>,\n * jokes: Annotation<string[]>({\n * reducer: (a, b) => a.concat(b),\n * }),\n * });\n *\n * const continueToJokes = async (state: typeof ChainState.State) => {\n * return state.subjects.map((subject) => {\n * return new Send(\"generate_joke\", { subjects: [subject] });\n * });\n * };\n *\n * const graph = new StateGraph(ChainState)\n * .addNode(\"generate_joke\", (state) => ({\n * jokes: [`Joke about ${state.subjects}`],\n * }))\n * .addConditionalEdges(\"__start__\", continueToJokes)\n * .addEdge(\"generate_joke\", \"__end__\")\n * .compile();\n *\n * const res = await graph.invoke({ subjects: [\"cats\", \"dogs\"] });\n * console.log(res);\n *\n * // Invoking with two subjects results in a generated joke for each\n * // { subjects: [\"cats\", \"dogs\"], jokes: [`Joke about cats`, `Joke about dogs`] }\n * ```\n */\nexport declare class Send<Node extends string = string, Args = any> implements SendInterface<Node, Args> {\n lg_name: string;\n node: Node;\n args: Args;\n constructor(node: Node, args: Args);\n toJSON(): {\n lg_name: string;\n node: Node;\n args: Args;\n };\n}\nexport declare function _isSend(x: unknown): x is Send;\nexport type Interrupt<Value = any> = {\n id?: string;\n value?: Value;\n};\n/**\n * Checks if the given graph invoke / stream chunk contains interrupt.\n *\n * @example\n * ```ts\n * import { INTERRUPT, isInterrupted } from \"@langchain/langgraph\";\n *\n * const values = await graph.invoke({ foo: \"bar\" });\n * if (isInterrupted<string>(values)) {\n * const interrupt = values[INTERRUPT][0].value;\n * }\n * ```\n *\n * @param values - The values to check.\n * @returns `true` if the values contain an interrupt, `false` otherwise.\n */\nexport declare function isInterrupted<Value = unknown>(values: unknown): values is {\n [INTERRUPT]: Interrupt<Value>[];\n};\nexport type CommandParams<Resume = unknown, Update extends Record<string, unknown> = Record<string, unknown>, Nodes extends string = string> = {\n /**\n * A discriminator field used to identify the type of object. Must be populated when serializing.\n *\n * Optional because it's not required to specify this when directly constructing a {@link Command}\n * object.\n */\n lg_name?: \"Command\";\n /**\n * Value to resume execution with. To be used together with {@link interrupt}.\n */\n resume?: Resume;\n /**\n * Graph to send the command to. Supported values are:\n * - None: the current graph (default)\n * - The specific name of the graph to send the command to\n * - {@link Command.PARENT}: closest parent graph (only supported when returned from a node in a subgraph)\n */\n graph?: string;\n /**\n * Update to apply to the graph's state.\n */\n update?: Update | [string, unknown][];\n /**\n * Can be one of the following:\n * - name of the node to navigate to next (any node that belongs to the specified `graph`)\n * - sequence of node names to navigate to next\n * - `Send` object (to execute a node with the input provided)\n * - sequence of `Send` objects\n */\n goto?: Nodes | SendInterface<Nodes> | (Nodes | SendInterface<Nodes>)[];\n};\n/**\n * One or more commands to update the graph's state and send messages to nodes.\n * Can be used to combine routing logic with state updates in lieu of conditional edges\n *\n * @example\n * ```ts\n * import { Annotation, Command } from \"@langchain/langgraph\";\n *\n * // Define graph state\n * const StateAnnotation = Annotation.Root({\n * foo: Annotation<string>,\n * });\n *\n * // Define the nodes\n * const nodeA = async (_state: typeof StateAnnotation.State) => {\n * console.log(\"Called A\");\n * // this is a replacement for a real conditional edge function\n * const goto = Math.random() > .5 ? \"nodeB\" : \"nodeC\";\n * // note how Command allows you to BOTH update the graph state AND route to the next node\n * return new Command({\n * // this is the state update\n * update: {\n * foo: \"a\",\n * },\n * // this is a replacement for an edge\n * goto,\n * });\n * };\n *\n * // Nodes B and C are unchanged\n * const nodeB = async (state: typeof StateAnnotation.State) => {\n * console.log(\"Called B\");\n * return {\n * foo: state.foo + \"|b\",\n * };\n * }\n *\n * const nodeC = async (state: typeof StateAnnotation.State) => {\n * console.log(\"Called C\");\n * return {\n * foo: state.foo + \"|c\",\n * };\n * }\n *\n * import { StateGraph } from \"@langchain/langgraph\";\n\n * // NOTE: there are no edges between nodes A, B and C!\n * const graph = new StateGraph(StateAnnotation)\n * .addNode(\"nodeA\", nodeA, {\n * ends: [\"nodeB\", \"nodeC\"],\n * })\n * .addNode(\"nodeB\", nodeB)\n * .addNode(\"nodeC\", nodeC)\n * .addEdge(\"__start__\", \"nodeA\")\n * .compile();\n *\n * await graph.invoke({ foo: \"\" });\n *\n * // Randomly oscillates between\n * // { foo: 'a|c' } and { foo: 'a|b' }\n * ```\n */\nexport declare class Command<Resume = unknown, Update extends Record<string, unknown> = Record<string, unknown>, Nodes extends string = string> extends CommandInstance<Resume, Update, Nodes> {\n readonly lg_name = \"Command\";\n lc_direct_tool_output: boolean;\n /**\n * Graph to send the command to. Supported values are:\n * - None: the current graph (default)\n * - The specific name of the graph to send the command to\n * - {@link Command.PARENT}: closest parent graph (only supported when returned from a node in a subgraph)\n */\n graph?: string;\n /**\n * Update to apply to the graph's state as a result of executing the node that is returning the command.\n * Written to the state as if the node had simply returned this value instead of the Command object.\n */\n update?: Update | [string, unknown][];\n /**\n * Value to resume execution with. To be used together with {@link interrupt}.\n */\n resume?: Resume;\n /**\n * Can be one of the following:\n * - name of the node to navigate to next (any node that belongs to the specified `graph`)\n * - sequence of node names to navigate to next\n * - {@link Send} object (to execute a node with the exact input provided in the {@link Send} object)\n * - sequence of {@link Send} objects\n */\n goto?: Nodes | Send<Nodes> | (Nodes | Send<Nodes>)[];\n static PARENT: string;\n constructor(args: Omit<CommandParams<Resume, Update, Nodes>, \"lg_name\">);\n /**\n * Convert the update field to a list of {@link PendingWrite} tuples\n * @returns List of {@link PendingWrite} tuples of the form `[channelKey, value]`.\n * @internal\n */\n _updateAsTuples(): PendingWrite[];\n toJSON(): {\n lg_name: string;\n update: Update | [string, unknown][] | undefined;\n resume: Resume | undefined;\n goto: Nodes | (Nodes | {\n lg_name: string;\n node: Nodes;\n args: any;\n })[] | {\n lg_name: string;\n node: Nodes;\n args: any;\n } | undefined;\n };\n}\n/**\n * A type guard to check if the given value is a {@link Command}.\n *\n * Useful for type narrowing when working with the {@link Command} object.\n *\n * @param x - The value to check.\n * @returns `true` if the value is a {@link Command}, `false` otherwise.\n */\nexport declare function isCommand(x: unknown): x is Command;\n/**\n * Reconstructs Command and Send objects from a deeply nested tree of anonymous objects\n * matching their interfaces.\n *\n * This is only exported for testing purposes. It is NOT intended to be used outside of\n * the Command and Send classes.\n *\n * @internal\n *\n * @param x - The command send tree to convert.\n * @param seen - A map of seen objects to avoid infinite loops.\n * @returns The converted command send tree.\n */\nexport declare function _deserializeCommandSendObjectGraph(x: unknown, seen?: Map<object, unknown>): unknown;\nexport {};\n"],"mappings":";;;;cAEqBC,KAAAA;AAArB;AAEqBC,cAAAA,GAAAA,GAAG,SAAA;;AAkH2EiD,cAxF9E3B,SAAAA,GAwF8E2B,eAAAA;;;;AAAP,cAhFvEvB,QAAAA,GAgFuE,cAAA;;cAjE9Ec,cAkImBK,EAAAA,OAAAA,MAAAA;;;;;;AAgEjC;;;;AAAwKF,cAxLnJF,eAwLmJE,CAAAA,SAAAA,OAAAA,EAAAA,eAxLlGD,MAwLkGC,CAAAA,MAAAA,EAAAA,OAAAA,CAAAA,GAxLxED,MAwLwEC,CAAAA,MAAAA,EAAAA,OAAAA,CAAAA,EAAAA,cAAAA,MAAAA,GAAAA,MAAAA,CAAAA,CAAAA;GAvLnKH,cAAAA,CAuL2KI,EAvL1JE,aAuL0JF,CAvL5ID,MAuL4IC,EAvLpIA,MAuLoIA,EAvL5HC,KAuL4HD,CAAAA;aAAQC,CAAAA,IAAAA,EAtLlKC,aAsLkKD,CAtLpJF,MAsLoJE,EAtL5ID,MAsL4IC,EAtLpIA,KAsLoIA,CAAAA;;AAkB3KF,UAtMII,aAsMJJ,CAAAA,aAAAA,MAAAA,GAAAA,MAAAA,EAAAA,OAAAA,GAAAA,CAAAA,CAAAA;MAQFE,EA7MDG,IA6MCH;MAAaA,EA5MdI,IA4McJ;;;;;;;;;;;;;;;;;;AAgCxB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA3LqBM,0DAA0DJ,cAAcC,MAAMC;;QAEzFD;QACAC;oBACYD,YAAYC;;;UAGpBD;UACAC;;;KAIFI;;UAEAC;;;;;;;;;;;;;;;;;;iBAkBYC;GACnBjC,SAAAA,GAAY+B,UAAUC;;KAEfR,+CAA+CJ,0BAA0BA;;;;;;;;;;;WAWxEC;;;;;;;;;;;WAWAC;;;;;;;;SAQFC,QAAQE,cAAcF,UAAUA,QAAQE,cAAcF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAgE5CW,yCAAyCd,0BAA0BA,gEAAgED,gBAAgBE,QAAQC,QAAQC;;;;;;;;;;;;;;WAc3KD;;;;WAIAD;;;;;;;;SAQFE,QAAQM,KAAKN,UAAUA,QAAQM,KAAKN;;oBAEzBY,KAAKX,cAAcH,QAAQC,QAAQC;;;;;;qBAMlC/C;;;YAGP8C;YACAD;UACFE,SAASA;;YAELA;;;;YAIAA;;;;;;;;;;;;;iBAaMa,SAAAA,mBAA4BF"}
@@ -0,0 +1,281 @@
1
+ import { PendingWrite } from "@langchain/langgraph-checkpoint";
2
+
3
+ //#region src/constants.d.ts
4
+ /** Special reserved node name denoting the start of a graph. */
5
+ declare const START = "__start__";
6
+ /** Special reserved node name denoting the end of a graph. */
7
+ declare const END = "__end__";
8
+ /** Special channel reserved for graph interrupts */
9
+ declare const INTERRUPT = "__interrupt__";
10
+ /** Special channel reserved for graph resume */
11
+
12
+ /** Special channel reserved for graph previous state */
13
+ declare const PREVIOUS = "__previous__";
14
+ /** @internal */
15
+ declare const COMMAND_SYMBOL: unique symbol;
16
+ /**
17
+ * Instance of a {@link Command} class.
18
+ *
19
+ * This is used to avoid IntelliSense suggesting public fields
20
+ * of {@link Command} class when a plain object is expected.
21
+ *
22
+ * @see {@link Command}
23
+ * @internal
24
+ */
25
+ declare class CommandInstance<Resume = unknown, Update extends Record<string, unknown> = Record<string, unknown>, Nodes extends string = string> {
26
+ [COMMAND_SYMBOL]: CommandParams<Resume, Update, Nodes>;
27
+ constructor(args: CommandParams<Resume, Update, Nodes>);
28
+ }
29
+ interface SendInterface<Node extends string = string, Args = any> {
30
+ node: Node;
31
+ args: Args;
32
+ }
33
+ /**
34
+ *
35
+ * A message or packet to send to a specific node in the graph.
36
+ *
37
+ * The `Send` class is used within a `StateGraph`'s conditional edges to
38
+ * dynamically invoke a node with a custom state at the next step.
39
+ *
40
+ * Importantly, the sent state can differ from the core graph's state,
41
+ * allowing for flexible and dynamic workflow management.
42
+ *
43
+ * One such example is a "map-reduce" workflow where your graph invokes
44
+ * the same node multiple times in parallel with different states,
45
+ * before aggregating the results back into the main graph's state.
46
+ *
47
+ * @example
48
+ * ```typescript
49
+ * import { Annotation, Send, StateGraph } from "@langchain/langgraph";
50
+ *
51
+ * const ChainState = Annotation.Root({
52
+ * subjects: Annotation<string[]>,
53
+ * jokes: Annotation<string[]>({
54
+ * reducer: (a, b) => a.concat(b),
55
+ * }),
56
+ * });
57
+ *
58
+ * const continueToJokes = async (state: typeof ChainState.State) => {
59
+ * return state.subjects.map((subject) => {
60
+ * return new Send("generate_joke", { subjects: [subject] });
61
+ * });
62
+ * };
63
+ *
64
+ * const graph = new StateGraph(ChainState)
65
+ * .addNode("generate_joke", (state) => ({
66
+ * jokes: [`Joke about ${state.subjects}`],
67
+ * }))
68
+ * .addConditionalEdges("__start__", continueToJokes)
69
+ * .addEdge("generate_joke", "__end__")
70
+ * .compile();
71
+ *
72
+ * const res = await graph.invoke({ subjects: ["cats", "dogs"] });
73
+ * console.log(res);
74
+ *
75
+ * // Invoking with two subjects results in a generated joke for each
76
+ * // { subjects: ["cats", "dogs"], jokes: [`Joke about cats`, `Joke about dogs`] }
77
+ * ```
78
+ */
79
+ declare class Send<Node extends string = string, Args = any> implements SendInterface<Node, Args> {
80
+ lg_name: string;
81
+ node: Node;
82
+ args: Args;
83
+ constructor(node: Node, args: Args);
84
+ toJSON(): {
85
+ lg_name: string;
86
+ node: Node;
87
+ args: Args;
88
+ };
89
+ }
90
+ type Interrupt<Value = any> = {
91
+ id?: string;
92
+ value?: Value;
93
+ };
94
+ /**
95
+ * Checks if the given graph invoke / stream chunk contains interrupt.
96
+ *
97
+ * @example
98
+ * ```ts
99
+ * import { INTERRUPT, isInterrupted } from "@langchain/langgraph";
100
+ *
101
+ * const values = await graph.invoke({ foo: "bar" });
102
+ * if (isInterrupted<string>(values)) {
103
+ * const interrupt = values[INTERRUPT][0].value;
104
+ * }
105
+ * ```
106
+ *
107
+ * @param values - The values to check.
108
+ * @returns `true` if the values contain an interrupt, `false` otherwise.
109
+ */
110
+ declare function isInterrupted<Value = unknown>(values: unknown): values is {
111
+ [INTERRUPT]: Interrupt<Value>[];
112
+ };
113
+ type CommandParams<Resume = unknown, Update extends Record<string, unknown> = Record<string, unknown>, Nodes extends string = string> = {
114
+ /**
115
+ * A discriminator field used to identify the type of object. Must be populated when serializing.
116
+ *
117
+ * Optional because it's not required to specify this when directly constructing a {@link Command}
118
+ * object.
119
+ */
120
+ lg_name?: "Command";
121
+ /**
122
+ * Value to resume execution with. To be used together with {@link interrupt}.
123
+ */
124
+ resume?: Resume;
125
+ /**
126
+ * Graph to send the command to. Supported values are:
127
+ * - None: the current graph (default)
128
+ * - The specific name of the graph to send the command to
129
+ * - {@link Command.PARENT}: closest parent graph (only supported when returned from a node in a subgraph)
130
+ */
131
+ graph?: string;
132
+ /**
133
+ * Update to apply to the graph's state.
134
+ */
135
+ update?: Update | [string, unknown][];
136
+ /**
137
+ * Can be one of the following:
138
+ * - name of the node to navigate to next (any node that belongs to the specified `graph`)
139
+ * - sequence of node names to navigate to next
140
+ * - `Send` object (to execute a node with the input provided)
141
+ * - sequence of `Send` objects
142
+ */
143
+ goto?: Nodes | SendInterface<Nodes> | (Nodes | SendInterface<Nodes>)[];
144
+ };
145
+ /**
146
+ * One or more commands to update the graph's state and send messages to nodes.
147
+ * Can be used to combine routing logic with state updates in lieu of conditional edges
148
+ *
149
+ * @example
150
+ * ```ts
151
+ * import { Annotation, Command } from "@langchain/langgraph";
152
+ *
153
+ * // Define graph state
154
+ * const StateAnnotation = Annotation.Root({
155
+ * foo: Annotation<string>,
156
+ * });
157
+ *
158
+ * // Define the nodes
159
+ * const nodeA = async (_state: typeof StateAnnotation.State) => {
160
+ * console.log("Called A");
161
+ * // this is a replacement for a real conditional edge function
162
+ * const goto = Math.random() > .5 ? "nodeB" : "nodeC";
163
+ * // note how Command allows you to BOTH update the graph state AND route to the next node
164
+ * return new Command({
165
+ * // this is the state update
166
+ * update: {
167
+ * foo: "a",
168
+ * },
169
+ * // this is a replacement for an edge
170
+ * goto,
171
+ * });
172
+ * };
173
+ *
174
+ * // Nodes B and C are unchanged
175
+ * const nodeB = async (state: typeof StateAnnotation.State) => {
176
+ * console.log("Called B");
177
+ * return {
178
+ * foo: state.foo + "|b",
179
+ * };
180
+ * }
181
+ *
182
+ * const nodeC = async (state: typeof StateAnnotation.State) => {
183
+ * console.log("Called C");
184
+ * return {
185
+ * foo: state.foo + "|c",
186
+ * };
187
+ * }
188
+ *
189
+ * import { StateGraph } from "@langchain/langgraph";
190
+
191
+ * // NOTE: there are no edges between nodes A, B and C!
192
+ * const graph = new StateGraph(StateAnnotation)
193
+ * .addNode("nodeA", nodeA, {
194
+ * ends: ["nodeB", "nodeC"],
195
+ * })
196
+ * .addNode("nodeB", nodeB)
197
+ * .addNode("nodeC", nodeC)
198
+ * .addEdge("__start__", "nodeA")
199
+ * .compile();
200
+ *
201
+ * await graph.invoke({ foo: "" });
202
+ *
203
+ * // Randomly oscillates between
204
+ * // { foo: 'a|c' } and { foo: 'a|b' }
205
+ * ```
206
+ */
207
+ declare class Command<Resume = unknown, Update extends Record<string, unknown> = Record<string, unknown>, Nodes extends string = string> extends CommandInstance<Resume, Update, Nodes> {
208
+ readonly lg_name = "Command";
209
+ lc_direct_tool_output: boolean;
210
+ /**
211
+ * Graph to send the command to. Supported values are:
212
+ * - None: the current graph (default)
213
+ * - The specific name of the graph to send the command to
214
+ * - {@link Command.PARENT}: closest parent graph (only supported when returned from a node in a subgraph)
215
+ */
216
+ graph?: string;
217
+ /**
218
+ * Update to apply to the graph's state as a result of executing the node that is returning the command.
219
+ * Written to the state as if the node had simply returned this value instead of the Command object.
220
+ */
221
+ update?: Update | [string, unknown][];
222
+ /**
223
+ * Value to resume execution with. To be used together with {@link interrupt}.
224
+ */
225
+ resume?: Resume;
226
+ /**
227
+ * Can be one of the following:
228
+ * - name of the node to navigate to next (any node that belongs to the specified `graph`)
229
+ * - sequence of node names to navigate to next
230
+ * - {@link Send} object (to execute a node with the exact input provided in the {@link Send} object)
231
+ * - sequence of {@link Send} objects
232
+ */
233
+ goto?: Nodes | Send<Nodes> | (Nodes | Send<Nodes>)[];
234
+ static PARENT: string;
235
+ constructor(args: Omit<CommandParams<Resume, Update, Nodes>, "lg_name">);
236
+ /**
237
+ * Convert the update field to a list of {@link PendingWrite} tuples
238
+ * @returns List of {@link PendingWrite} tuples of the form `[channelKey, value]`.
239
+ * @internal
240
+ */
241
+ _updateAsTuples(): PendingWrite[];
242
+ toJSON(): {
243
+ lg_name: string;
244
+ update: Update | [string, unknown][] | undefined;
245
+ resume: Resume | undefined;
246
+ goto: Nodes | (Nodes | {
247
+ lg_name: string;
248
+ node: Nodes;
249
+ args: any;
250
+ })[] | {
251
+ lg_name: string;
252
+ node: Nodes;
253
+ args: any;
254
+ } | undefined;
255
+ };
256
+ }
257
+ /**
258
+ * A type guard to check if the given value is a {@link Command}.
259
+ *
260
+ * Useful for type narrowing when working with the {@link Command} object.
261
+ *
262
+ * @param x - The value to check.
263
+ * @returns `true` if the value is a {@link Command}, `false` otherwise.
264
+ */
265
+ declare function isCommand(x: unknown): x is Command;
266
+ /**
267
+ * Reconstructs Command and Send objects from a deeply nested tree of anonymous objects
268
+ * matching their interfaces.
269
+ *
270
+ * This is only exported for testing purposes. It is NOT intended to be used outside of
271
+ * the Command and Send classes.
272
+ *
273
+ * @internal
274
+ *
275
+ * @param x - The command send tree to convert.
276
+ * @param seen - A map of seen objects to avoid infinite loops.
277
+ * @returns The converted command send tree.
278
+ */
279
+ //#endregion
280
+ export { Command, CommandInstance, CommandParams, END, INTERRUPT, Interrupt, PREVIOUS, START, Send, isCommand, isInterrupted };
281
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","names":["PendingWrite","START","END","INPUT","COPY","ERROR","CACHE_NS_WRITES","CONFIG_KEY_SEND","CONFIG_KEY_CALL","CONFIG_KEY_READ","CONFIG_KEY_CHECKPOINTER","CONFIG_KEY_RESUMING","CONFIG_KEY_TASK_ID","CONFIG_KEY_STREAM","CONFIG_KEY_RESUME_VALUE","CONFIG_KEY_RESUME_MAP","CONFIG_KEY_SCRATCHPAD","CONFIG_KEY_PREVIOUS_STATE","CONFIG_KEY_DURABILITY","CONFIG_KEY_CHECKPOINT_ID","CONFIG_KEY_CHECKPOINT_NS","CONFIG_KEY_NODE_FINISHED","CONFIG_KEY_CHECKPOINT_MAP","CONFIG_KEY_ABORT_SIGNALS","INTERRUPT","RESUME","NO_WRITES","RETURN","PREVIOUS","RUNTIME_PLACEHOLDER","RECURSION_LIMIT_DEFAULT","TAG_HIDDEN","TAG_NOSTREAM","SELF","TASKS","PUSH","PULL","TASK_NAMESPACE","NULL_TASK_ID","RESERVED","CHECKPOINT_NAMESPACE_SEPARATOR","CHECKPOINT_NAMESPACE_END","COMMAND_SYMBOL","CommandInstance","Record","Resume","Update","Nodes","CommandParams","SendInterface","Node","Args","_isSendInterface","Send","_isSend","Interrupt","Value","isInterrupted","Command","Omit","isCommand","_deserializeCommandSendObjectGraph","Map"],"sources":["../src/constants.d.ts"],"sourcesContent":["import { PendingWrite } from \"@langchain/langgraph-checkpoint\";\n/** Special reserved node name denoting the start of a graph. */\nexport declare const START = \"__start__\";\n/** Special reserved node name denoting the end of a graph. */\nexport declare const END = \"__end__\";\nexport declare const INPUT = \"__input__\";\nexport declare const COPY = \"__copy__\";\nexport declare const ERROR = \"__error__\";\n/** Special reserved cache namespaces */\nexport declare const CACHE_NS_WRITES = \"__pregel_ns_writes\";\nexport declare const CONFIG_KEY_SEND = \"__pregel_send\";\n/** config key containing function used to call a node (push task) */\nexport declare const CONFIG_KEY_CALL = \"__pregel_call\";\nexport declare const CONFIG_KEY_READ = \"__pregel_read\";\nexport declare const CONFIG_KEY_CHECKPOINTER = \"__pregel_checkpointer\";\nexport declare const CONFIG_KEY_RESUMING = \"__pregel_resuming\";\nexport declare const CONFIG_KEY_TASK_ID = \"__pregel_task_id\";\nexport declare const CONFIG_KEY_STREAM = \"__pregel_stream\";\nexport declare const CONFIG_KEY_RESUME_VALUE = \"__pregel_resume_value\";\nexport declare const CONFIG_KEY_RESUME_MAP = \"__pregel_resume_map\";\nexport declare const CONFIG_KEY_SCRATCHPAD = \"__pregel_scratchpad\";\n/** config key containing state from previous invocation of graph for the given thread */\nexport declare const CONFIG_KEY_PREVIOUS_STATE = \"__pregel_previous\";\nexport declare const CONFIG_KEY_DURABILITY = \"__pregel_durability\";\nexport declare const CONFIG_KEY_CHECKPOINT_ID = \"checkpoint_id\";\nexport declare const CONFIG_KEY_CHECKPOINT_NS = \"checkpoint_ns\";\nexport declare const CONFIG_KEY_NODE_FINISHED = \"__pregel_node_finished\";\nexport declare const CONFIG_KEY_CHECKPOINT_MAP = \"checkpoint_map\";\nexport declare const CONFIG_KEY_ABORT_SIGNALS = \"__pregel_abort_signals\";\n/** Special channel reserved for graph interrupts */\nexport declare const INTERRUPT = \"__interrupt__\";\n/** Special channel reserved for graph resume */\nexport declare const RESUME = \"__resume__\";\n/** Special channel reserved for cases when a task exits without any writes */\nexport declare const NO_WRITES = \"__no_writes__\";\n/** Special channel reserved for graph return */\nexport declare const RETURN = \"__return__\";\n/** Special channel reserved for graph previous state */\nexport declare const PREVIOUS = \"__previous__\";\nexport declare const RUNTIME_PLACEHOLDER = \"__pregel_runtime_placeholder__\";\nexport declare const RECURSION_LIMIT_DEFAULT = 25;\nexport declare const TAG_HIDDEN = \"langsmith:hidden\";\nexport declare const TAG_NOSTREAM = \"langsmith:nostream\";\nexport declare const SELF = \"__self__\";\nexport declare const TASKS = \"__pregel_tasks\";\nexport declare const PUSH = \"__pregel_push\";\nexport declare const PULL = \"__pregel_pull\";\nexport declare const TASK_NAMESPACE = \"6ba7b831-9dad-11d1-80b4-00c04fd430c8\";\nexport declare const NULL_TASK_ID = \"00000000-0000-0000-0000-000000000000\";\nexport declare const RESERVED: string[];\nexport declare const CHECKPOINT_NAMESPACE_SEPARATOR = \"|\";\nexport declare const CHECKPOINT_NAMESPACE_END = \":\";\n/** @internal */\ndeclare const COMMAND_SYMBOL: unique symbol;\n/**\n * Instance of a {@link Command} class.\n *\n * This is used to avoid IntelliSense suggesting public fields\n * of {@link Command} class when a plain object is expected.\n *\n * @see {@link Command}\n * @internal\n */\nexport declare class CommandInstance<Resume = unknown, Update extends Record<string, unknown> = Record<string, unknown>, Nodes extends string = string> {\n [COMMAND_SYMBOL]: CommandParams<Resume, Update, Nodes>;\n constructor(args: CommandParams<Resume, Update, Nodes>);\n}\nexport interface SendInterface<Node extends string = string, Args = any> {\n node: Node;\n args: Args;\n}\nexport declare function _isSendInterface(x: unknown): x is SendInterface;\n/**\n *\n * A message or packet to send to a specific node in the graph.\n *\n * The `Send` class is used within a `StateGraph`'s conditional edges to\n * dynamically invoke a node with a custom state at the next step.\n *\n * Importantly, the sent state can differ from the core graph's state,\n * allowing for flexible and dynamic workflow management.\n *\n * One such example is a \"map-reduce\" workflow where your graph invokes\n * the same node multiple times in parallel with different states,\n * before aggregating the results back into the main graph's state.\n *\n * @example\n * ```typescript\n * import { Annotation, Send, StateGraph } from \"@langchain/langgraph\";\n *\n * const ChainState = Annotation.Root({\n * subjects: Annotation<string[]>,\n * jokes: Annotation<string[]>({\n * reducer: (a, b) => a.concat(b),\n * }),\n * });\n *\n * const continueToJokes = async (state: typeof ChainState.State) => {\n * return state.subjects.map((subject) => {\n * return new Send(\"generate_joke\", { subjects: [subject] });\n * });\n * };\n *\n * const graph = new StateGraph(ChainState)\n * .addNode(\"generate_joke\", (state) => ({\n * jokes: [`Joke about ${state.subjects}`],\n * }))\n * .addConditionalEdges(\"__start__\", continueToJokes)\n * .addEdge(\"generate_joke\", \"__end__\")\n * .compile();\n *\n * const res = await graph.invoke({ subjects: [\"cats\", \"dogs\"] });\n * console.log(res);\n *\n * // Invoking with two subjects results in a generated joke for each\n * // { subjects: [\"cats\", \"dogs\"], jokes: [`Joke about cats`, `Joke about dogs`] }\n * ```\n */\nexport declare class Send<Node extends string = string, Args = any> implements SendInterface<Node, Args> {\n lg_name: string;\n node: Node;\n args: Args;\n constructor(node: Node, args: Args);\n toJSON(): {\n lg_name: string;\n node: Node;\n args: Args;\n };\n}\nexport declare function _isSend(x: unknown): x is Send;\nexport type Interrupt<Value = any> = {\n id?: string;\n value?: Value;\n};\n/**\n * Checks if the given graph invoke / stream chunk contains interrupt.\n *\n * @example\n * ```ts\n * import { INTERRUPT, isInterrupted } from \"@langchain/langgraph\";\n *\n * const values = await graph.invoke({ foo: \"bar\" });\n * if (isInterrupted<string>(values)) {\n * const interrupt = values[INTERRUPT][0].value;\n * }\n * ```\n *\n * @param values - The values to check.\n * @returns `true` if the values contain an interrupt, `false` otherwise.\n */\nexport declare function isInterrupted<Value = unknown>(values: unknown): values is {\n [INTERRUPT]: Interrupt<Value>[];\n};\nexport type CommandParams<Resume = unknown, Update extends Record<string, unknown> = Record<string, unknown>, Nodes extends string = string> = {\n /**\n * A discriminator field used to identify the type of object. Must be populated when serializing.\n *\n * Optional because it's not required to specify this when directly constructing a {@link Command}\n * object.\n */\n lg_name?: \"Command\";\n /**\n * Value to resume execution with. To be used together with {@link interrupt}.\n */\n resume?: Resume;\n /**\n * Graph to send the command to. Supported values are:\n * - None: the current graph (default)\n * - The specific name of the graph to send the command to\n * - {@link Command.PARENT}: closest parent graph (only supported when returned from a node in a subgraph)\n */\n graph?: string;\n /**\n * Update to apply to the graph's state.\n */\n update?: Update | [string, unknown][];\n /**\n * Can be one of the following:\n * - name of the node to navigate to next (any node that belongs to the specified `graph`)\n * - sequence of node names to navigate to next\n * - `Send` object (to execute a node with the input provided)\n * - sequence of `Send` objects\n */\n goto?: Nodes | SendInterface<Nodes> | (Nodes | SendInterface<Nodes>)[];\n};\n/**\n * One or more commands to update the graph's state and send messages to nodes.\n * Can be used to combine routing logic with state updates in lieu of conditional edges\n *\n * @example\n * ```ts\n * import { Annotation, Command } from \"@langchain/langgraph\";\n *\n * // Define graph state\n * const StateAnnotation = Annotation.Root({\n * foo: Annotation<string>,\n * });\n *\n * // Define the nodes\n * const nodeA = async (_state: typeof StateAnnotation.State) => {\n * console.log(\"Called A\");\n * // this is a replacement for a real conditional edge function\n * const goto = Math.random() > .5 ? \"nodeB\" : \"nodeC\";\n * // note how Command allows you to BOTH update the graph state AND route to the next node\n * return new Command({\n * // this is the state update\n * update: {\n * foo: \"a\",\n * },\n * // this is a replacement for an edge\n * goto,\n * });\n * };\n *\n * // Nodes B and C are unchanged\n * const nodeB = async (state: typeof StateAnnotation.State) => {\n * console.log(\"Called B\");\n * return {\n * foo: state.foo + \"|b\",\n * };\n * }\n *\n * const nodeC = async (state: typeof StateAnnotation.State) => {\n * console.log(\"Called C\");\n * return {\n * foo: state.foo + \"|c\",\n * };\n * }\n *\n * import { StateGraph } from \"@langchain/langgraph\";\n\n * // NOTE: there are no edges between nodes A, B and C!\n * const graph = new StateGraph(StateAnnotation)\n * .addNode(\"nodeA\", nodeA, {\n * ends: [\"nodeB\", \"nodeC\"],\n * })\n * .addNode(\"nodeB\", nodeB)\n * .addNode(\"nodeC\", nodeC)\n * .addEdge(\"__start__\", \"nodeA\")\n * .compile();\n *\n * await graph.invoke({ foo: \"\" });\n *\n * // Randomly oscillates between\n * // { foo: 'a|c' } and { foo: 'a|b' }\n * ```\n */\nexport declare class Command<Resume = unknown, Update extends Record<string, unknown> = Record<string, unknown>, Nodes extends string = string> extends CommandInstance<Resume, Update, Nodes> {\n readonly lg_name = \"Command\";\n lc_direct_tool_output: boolean;\n /**\n * Graph to send the command to. Supported values are:\n * - None: the current graph (default)\n * - The specific name of the graph to send the command to\n * - {@link Command.PARENT}: closest parent graph (only supported when returned from a node in a subgraph)\n */\n graph?: string;\n /**\n * Update to apply to the graph's state as a result of executing the node that is returning the command.\n * Written to the state as if the node had simply returned this value instead of the Command object.\n */\n update?: Update | [string, unknown][];\n /**\n * Value to resume execution with. To be used together with {@link interrupt}.\n */\n resume?: Resume;\n /**\n * Can be one of the following:\n * - name of the node to navigate to next (any node that belongs to the specified `graph`)\n * - sequence of node names to navigate to next\n * - {@link Send} object (to execute a node with the exact input provided in the {@link Send} object)\n * - sequence of {@link Send} objects\n */\n goto?: Nodes | Send<Nodes> | (Nodes | Send<Nodes>)[];\n static PARENT: string;\n constructor(args: Omit<CommandParams<Resume, Update, Nodes>, \"lg_name\">);\n /**\n * Convert the update field to a list of {@link PendingWrite} tuples\n * @returns List of {@link PendingWrite} tuples of the form `[channelKey, value]`.\n * @internal\n */\n _updateAsTuples(): PendingWrite[];\n toJSON(): {\n lg_name: string;\n update: Update | [string, unknown][] | undefined;\n resume: Resume | undefined;\n goto: Nodes | (Nodes | {\n lg_name: string;\n node: Nodes;\n args: any;\n })[] | {\n lg_name: string;\n node: Nodes;\n args: any;\n } | undefined;\n };\n}\n/**\n * A type guard to check if the given value is a {@link Command}.\n *\n * Useful for type narrowing when working with the {@link Command} object.\n *\n * @param x - The value to check.\n * @returns `true` if the value is a {@link Command}, `false` otherwise.\n */\nexport declare function isCommand(x: unknown): x is Command;\n/**\n * Reconstructs Command and Send objects from a deeply nested tree of anonymous objects\n * matching their interfaces.\n *\n * This is only exported for testing purposes. It is NOT intended to be used outside of\n * the Command and Send classes.\n *\n * @internal\n *\n * @param x - The command send tree to convert.\n * @param seen - A map of seen objects to avoid infinite loops.\n * @returns The converted command send tree.\n */\nexport declare function _deserializeCommandSendObjectGraph(x: unknown, seen?: Map<object, unknown>): unknown;\nexport {};\n"],"mappings":";;;;cAEqBC,KAAAA;AAArB;AAEqBC,cAAAA,GAAAA,GAAG,SAAA;;AAkH2EiD,cAxF9E3B,SAAAA,GAwF8E2B,eAAAA;;;;AAAP,cAhFvEvB,QAAAA,GAgFuE,cAAA;;cAjE9Ec,cAkImBK,EAAAA,OAAAA,MAAAA;;;;;;AAgEjC;;;;AAAwKF,cAxLnJF,eAwLmJE,CAAAA,SAAAA,OAAAA,EAAAA,eAxLlGD,MAwLkGC,CAAAA,MAAAA,EAAAA,OAAAA,CAAAA,GAxLxED,MAwLwEC,CAAAA,MAAAA,EAAAA,OAAAA,CAAAA,EAAAA,cAAAA,MAAAA,GAAAA,MAAAA,CAAAA,CAAAA;GAvLnKH,cAAAA,CAuL2KI,EAvL1JE,aAuL0JF,CAvL5ID,MAuL4IC,EAvLpIA,MAuLoIA,EAvL5HC,KAuL4HD,CAAAA;aAAQC,CAAAA,IAAAA,EAtLlKC,aAsLkKD,CAtLpJF,MAsLoJE,EAtL5ID,MAsL4IC,EAtLpIA,KAsLoIA,CAAAA;;AAkB3KF,UAtMII,aAsMJJ,CAAAA,aAAAA,MAAAA,GAAAA,MAAAA,EAAAA,OAAAA,GAAAA,CAAAA,CAAAA;MAQFE,EA7MDG,IA6MCH;MAAaA,EA5MdI,IA4McJ;;;;;;;;;;;;;;;;;;AAgCxB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA3LqBM,0DAA0DJ,cAAcC,MAAMC;;QAEzFD;QACAC;oBACYD,YAAYC;;;UAGpBD;UACAC;;;KAIFI;;UAEAC;;;;;;;;;;;;;;;;;;iBAkBYC;GACnBjC,SAAAA,GAAY+B,UAAUC;;KAEfR,+CAA+CJ,0BAA0BA;;;;;;;;;;;WAWxEC;;;;;;;;;;;WAWAC;;;;;;;;SAQFC,QAAQE,cAAcF,UAAUA,QAAQE,cAAcF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAgE5CW,yCAAyCd,0BAA0BA,gEAAgED,gBAAgBE,QAAQC,QAAQC;;;;;;;;;;;;;;WAc3KD;;;;WAIAD;;;;;;;;SAQFE,QAAQM,KAAKN,UAAUA,QAAQM,KAAKN;;oBAEzBY,KAAKX,cAAcH,QAAQC,QAAQC;;;;;;qBAMlC/C;;;YAGP8C;YACAD;UACFE,SAASA;;YAELA;;;;YAIAA;;;;;;;;;;;;;iBAaMa,SAAAA,mBAA4BF"}