@langchain/langgraph 0.4.7 → 1.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (494) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +1 -2
  3. package/dist/_virtual/rolldown_runtime.cjs +25 -0
  4. package/dist/channels/any_value.d.cts +26 -0
  5. package/dist/channels/any_value.d.cts.map +1 -0
  6. package/dist/channels/any_value.d.ts +16 -9
  7. package/dist/channels/any_value.d.ts.map +1 -0
  8. package/dist/channels/base.cjs +97 -133
  9. package/dist/channels/base.cjs.map +1 -0
  10. package/dist/channels/base.d.cts +73 -0
  11. package/dist/channels/base.d.cts.map +1 -0
  12. package/dist/channels/base.d.ts +73 -74
  13. package/dist/channels/base.d.ts.map +1 -0
  14. package/dist/channels/base.js +94 -127
  15. package/dist/channels/base.js.map +1 -1
  16. package/dist/channels/binop.cjs +47 -77
  17. package/dist/channels/binop.cjs.map +1 -0
  18. package/dist/channels/binop.d.cts +22 -0
  19. package/dist/channels/binop.d.cts.map +1 -0
  20. package/dist/channels/binop.d.ts +17 -12
  21. package/dist/channels/binop.d.ts.map +1 -0
  22. package/dist/channels/binop.js +45 -71
  23. package/dist/channels/binop.js.map +1 -1
  24. package/dist/channels/dynamic_barrier_value.d.cts +43 -0
  25. package/dist/channels/dynamic_barrier_value.d.cts.map +1 -0
  26. package/dist/channels/dynamic_barrier_value.d.ts +20 -34
  27. package/dist/channels/dynamic_barrier_value.d.ts.map +1 -0
  28. package/dist/channels/ephemeral_value.cjs +46 -70
  29. package/dist/channels/ephemeral_value.cjs.map +1 -0
  30. package/dist/channels/ephemeral_value.d.cts +23 -0
  31. package/dist/channels/ephemeral_value.d.cts.map +1 -0
  32. package/dist/channels/ephemeral_value.d.ts +18 -11
  33. package/dist/channels/ephemeral_value.d.ts.map +1 -0
  34. package/dist/channels/ephemeral_value.js +45 -65
  35. package/dist/channels/ephemeral_value.js.map +1 -1
  36. package/dist/channels/index.cjs +2 -10
  37. package/dist/channels/index.js +4 -3
  38. package/dist/channels/last_value.cjs +91 -140
  39. package/dist/channels/last_value.cjs.map +1 -0
  40. package/dist/channels/last_value.d.cts +30 -0
  41. package/dist/channels/last_value.d.cts.map +1 -0
  42. package/dist/channels/last_value.d.ts +15 -23
  43. package/dist/channels/last_value.d.ts.map +1 -0
  44. package/dist/channels/last_value.js +88 -133
  45. package/dist/channels/last_value.js.map +1 -1
  46. package/dist/channels/named_barrier_value.cjs +114 -170
  47. package/dist/channels/named_barrier_value.cjs.map +1 -0
  48. package/dist/channels/named_barrier_value.d.cts +33 -0
  49. package/dist/channels/named_barrier_value.d.cts.map +1 -0
  50. package/dist/channels/named_barrier_value.d.ts +19 -29
  51. package/dist/channels/named_barrier_value.d.ts.map +1 -0
  52. package/dist/channels/named_barrier_value.js +112 -163
  53. package/dist/channels/named_barrier_value.js.map +1 -1
  54. package/dist/channels/topic.cjs +63 -96
  55. package/dist/channels/topic.cjs.map +1 -0
  56. package/dist/channels/topic.d.cts +26 -0
  57. package/dist/channels/topic.d.cts.map +1 -0
  58. package/dist/channels/topic.d.ts +21 -18
  59. package/dist/channels/topic.d.ts.map +1 -0
  60. package/dist/channels/topic.js +61 -90
  61. package/dist/channels/topic.js.map +1 -1
  62. package/dist/constants.cjs +373 -452
  63. package/dist/constants.cjs.map +1 -0
  64. package/dist/constants.d.cts +284 -0
  65. package/dist/constants.d.cts.map +1 -0
  66. package/dist/constants.d.ts +112 -148
  67. package/dist/constants.d.ts.map +1 -0
  68. package/dist/constants.js +333 -444
  69. package/dist/constants.js.map +1 -1
  70. package/dist/errors.cjs +150 -179
  71. package/dist/errors.cjs.map +1 -0
  72. package/dist/errors.d.cts +80 -0
  73. package/dist/errors.d.cts.map +1 -0
  74. package/dist/errors.d.ts +55 -46
  75. package/dist/errors.d.ts.map +1 -0
  76. package/dist/errors.js +139 -165
  77. package/dist/errors.js.map +1 -1
  78. package/dist/func/index.cjs +289 -290
  79. package/dist/func/index.cjs.map +1 -0
  80. package/dist/func/index.d.cts +289 -0
  81. package/dist/func/index.d.cts.map +1 -0
  82. package/dist/func/index.d.ts +81 -71
  83. package/dist/func/index.d.ts.map +1 -0
  84. package/dist/func/index.js +285 -284
  85. package/dist/func/index.js.map +1 -1
  86. package/dist/func/types.d.cts +64 -0
  87. package/dist/func/types.d.cts.map +1 -0
  88. package/dist/func/types.d.ts +24 -19
  89. package/dist/func/types.d.ts.map +1 -0
  90. package/dist/graph/annotation.cjs +96 -120
  91. package/dist/graph/annotation.cjs.map +1 -0
  92. package/dist/graph/annotation.d.cts +116 -0
  93. package/dist/graph/annotation.d.cts.map +1 -0
  94. package/dist/graph/annotation.d.ts +33 -34
  95. package/dist/graph/annotation.d.ts.map +1 -0
  96. package/dist/graph/annotation.js +91 -112
  97. package/dist/graph/annotation.js.map +1 -1
  98. package/dist/graph/graph.cjs +419 -723
  99. package/dist/graph/graph.cjs.map +1 -0
  100. package/dist/graph/graph.d.cts +131 -0
  101. package/dist/graph/graph.d.cts.map +1 -0
  102. package/dist/graph/graph.d.ts +122 -91
  103. package/dist/graph/graph.d.ts.map +1 -0
  104. package/dist/graph/graph.js +412 -713
  105. package/dist/graph/graph.js.map +1 -1
  106. package/dist/graph/index.cjs +4 -17
  107. package/dist/graph/index.js +6 -5
  108. package/dist/graph/message.cjs +59 -104
  109. package/dist/graph/message.cjs.map +1 -0
  110. package/dist/graph/message.d.cts +19 -0
  111. package/dist/graph/message.d.cts.map +1 -0
  112. package/dist/graph/message.d.ts +11 -10
  113. package/dist/graph/message.d.ts.map +1 -0
  114. package/dist/graph/message.js +56 -98
  115. package/dist/graph/message.js.map +1 -1
  116. package/dist/graph/messages_annotation.cjs +106 -106
  117. package/dist/graph/messages_annotation.cjs.map +1 -0
  118. package/dist/graph/messages_annotation.d.cts +111 -0
  119. package/dist/graph/messages_annotation.d.cts.map +1 -0
  120. package/dist/graph/messages_annotation.d.ts +18 -9
  121. package/dist/graph/messages_annotation.d.ts.map +1 -0
  122. package/dist/graph/messages_annotation.js +100 -100
  123. package/dist/graph/messages_annotation.js.map +1 -1
  124. package/dist/graph/state.cjs +476 -777
  125. package/dist/graph/state.cjs.map +1 -0
  126. package/dist/graph/state.d.cts +216 -0
  127. package/dist/graph/state.d.cts.map +1 -0
  128. package/dist/graph/state.d.ts +129 -134
  129. package/dist/graph/state.d.ts.map +1 -0
  130. package/dist/graph/state.js +470 -768
  131. package/dist/graph/state.js.map +1 -1
  132. package/dist/graph/zod/index.cjs +10 -21
  133. package/dist/graph/zod/index.d.cts +3 -0
  134. package/dist/graph/zod/index.d.ts +3 -3
  135. package/dist/graph/zod/index.js +4 -4
  136. package/dist/graph/zod/meta.cjs +142 -177
  137. package/dist/graph/zod/meta.cjs.map +1 -0
  138. package/dist/graph/zod/meta.d.cts +116 -0
  139. package/dist/graph/zod/meta.d.cts.map +1 -0
  140. package/dist/graph/zod/meta.d.ts +99 -97
  141. package/dist/graph/zod/meta.d.ts.map +1 -0
  142. package/dist/graph/zod/meta.js +136 -170
  143. package/dist/graph/zod/meta.js.map +1 -1
  144. package/dist/graph/zod/plugin.cjs +36 -39
  145. package/dist/graph/zod/plugin.cjs.map +1 -0
  146. package/dist/graph/zod/plugin.js +34 -35
  147. package/dist/graph/zod/plugin.js.map +1 -1
  148. package/dist/graph/zod/schema.cjs +82 -110
  149. package/dist/graph/zod/schema.cjs.map +1 -0
  150. package/dist/graph/zod/schema.d.cts +38 -0
  151. package/dist/graph/zod/schema.d.cts.map +1 -0
  152. package/dist/graph/zod/schema.d.ts +12 -6
  153. package/dist/graph/zod/schema.d.ts.map +1 -0
  154. package/dist/graph/zod/schema.js +77 -103
  155. package/dist/graph/zod/schema.js.map +1 -1
  156. package/dist/graph/zod/zod-registry.cjs +41 -47
  157. package/dist/graph/zod/zod-registry.cjs.map +1 -0
  158. package/dist/graph/zod/zod-registry.d.cts +51 -0
  159. package/dist/graph/zod/zod-registry.d.cts.map +1 -0
  160. package/dist/graph/zod/zod-registry.d.ts +34 -26
  161. package/dist/graph/zod/zod-registry.d.ts.map +1 -0
  162. package/dist/graph/zod/zod-registry.js +37 -41
  163. package/dist/graph/zod/zod-registry.js.map +1 -1
  164. package/dist/hash.cjs +205 -267
  165. package/dist/hash.cjs.map +1 -0
  166. package/dist/hash.js +205 -265
  167. package/dist/hash.js.map +1 -1
  168. package/dist/index.cjs +110 -33
  169. package/dist/index.cjs.map +1 -0
  170. package/dist/index.d.cts +25 -0
  171. package/dist/index.d.ts +25 -5
  172. package/dist/index.js +18 -7
  173. package/dist/index.js.map +1 -1
  174. package/dist/interrupt.cjs +79 -85
  175. package/dist/interrupt.cjs.map +1 -0
  176. package/dist/interrupt.d.cts +49 -0
  177. package/dist/interrupt.d.cts.map +1 -0
  178. package/dist/interrupt.d.ts +6 -1
  179. package/dist/interrupt.d.ts.map +1 -0
  180. package/dist/interrupt.js +76 -80
  181. package/dist/interrupt.js.map +1 -1
  182. package/dist/prebuilt/agentName.cjs +139 -172
  183. package/dist/prebuilt/agentName.cjs.map +1 -0
  184. package/dist/prebuilt/agentName.d.cts +42 -0
  185. package/dist/prebuilt/agentName.d.cts.map +1 -0
  186. package/dist/prebuilt/agentName.d.ts +13 -21
  187. package/dist/prebuilt/agentName.d.ts.map +1 -0
  188. package/dist/prebuilt/agentName.js +139 -168
  189. package/dist/prebuilt/agentName.js.map +1 -1
  190. package/dist/prebuilt/agent_executor.cjs +42 -80
  191. package/dist/prebuilt/agent_executor.cjs.map +1 -0
  192. package/dist/prebuilt/agent_executor.d.cts +57 -0
  193. package/dist/prebuilt/agent_executor.d.cts.map +1 -0
  194. package/dist/prebuilt/agent_executor.d.ts +46 -37
  195. package/dist/prebuilt/agent_executor.d.ts.map +1 -0
  196. package/dist/prebuilt/agent_executor.js +40 -75
  197. package/dist/prebuilt/agent_executor.js.map +1 -1
  198. package/dist/prebuilt/chat_agent_executor.cjs +66 -128
  199. package/dist/prebuilt/chat_agent_executor.cjs.map +1 -0
  200. package/dist/prebuilt/chat_agent_executor.d.cts +23 -0
  201. package/dist/prebuilt/chat_agent_executor.d.cts.map +1 -0
  202. package/dist/prebuilt/chat_agent_executor.d.ts +18 -10
  203. package/dist/prebuilt/chat_agent_executor.d.ts.map +1 -0
  204. package/dist/prebuilt/chat_agent_executor.js +63 -123
  205. package/dist/prebuilt/chat_agent_executor.js.map +1 -1
  206. package/dist/prebuilt/index.cjs +15 -18
  207. package/dist/prebuilt/index.d.cts +8 -0
  208. package/dist/prebuilt/index.d.ts +8 -8
  209. package/dist/prebuilt/index.js +8 -7
  210. package/dist/prebuilt/interrupt.d.cts +73 -0
  211. package/dist/prebuilt/interrupt.d.cts.map +1 -0
  212. package/dist/prebuilt/interrupt.d.ts +32 -15
  213. package/dist/prebuilt/interrupt.d.ts.map +1 -0
  214. package/dist/prebuilt/react_agent_executor.cjs +317 -473
  215. package/dist/prebuilt/react_agent_executor.cjs.map +1 -0
  216. package/dist/prebuilt/react_agent_executor.d.cts +229 -0
  217. package/dist/prebuilt/react_agent_executor.d.cts.map +1 -0
  218. package/dist/prebuilt/react_agent_executor.d.ts +171 -143
  219. package/dist/prebuilt/react_agent_executor.d.ts.map +1 -0
  220. package/dist/prebuilt/react_agent_executor.js +315 -465
  221. package/dist/prebuilt/react_agent_executor.js.map +1 -1
  222. package/dist/prebuilt/tool_executor.cjs +45 -67
  223. package/dist/prebuilt/tool_executor.cjs.map +1 -0
  224. package/dist/prebuilt/tool_executor.d.cts +42 -0
  225. package/dist/prebuilt/tool_executor.d.cts.map +1 -0
  226. package/dist/prebuilt/tool_executor.d.ts +30 -24
  227. package/dist/prebuilt/tool_executor.d.ts.map +1 -0
  228. package/dist/prebuilt/tool_executor.js +44 -63
  229. package/dist/prebuilt/tool_executor.js.map +1 -1
  230. package/dist/prebuilt/tool_node.cjs +213 -275
  231. package/dist/prebuilt/tool_node.cjs.map +1 -0
  232. package/dist/prebuilt/tool_node.d.cts +151 -0
  233. package/dist/prebuilt/tool_node.d.cts.map +1 -0
  234. package/dist/prebuilt/tool_node.d.ts +30 -17
  235. package/dist/prebuilt/tool_node.d.ts.map +1 -0
  236. package/dist/prebuilt/tool_node.js +209 -268
  237. package/dist/prebuilt/tool_node.js.map +1 -1
  238. package/dist/pregel/algo.cjs +521 -692
  239. package/dist/pregel/algo.cjs.map +1 -0
  240. package/dist/pregel/algo.d.cts +13 -0
  241. package/dist/pregel/algo.d.cts.map +1 -0
  242. package/dist/pregel/algo.d.ts +8 -38
  243. package/dist/pregel/algo.d.ts.map +1 -0
  244. package/dist/pregel/algo.js +516 -683
  245. package/dist/pregel/algo.js.map +1 -1
  246. package/dist/pregel/call.cjs +46 -42
  247. package/dist/pregel/call.cjs.map +1 -0
  248. package/dist/pregel/call.js +43 -37
  249. package/dist/pregel/call.js.map +1 -1
  250. package/dist/pregel/debug.cjs +153 -223
  251. package/dist/pregel/debug.cjs.map +1 -0
  252. package/dist/pregel/debug.js +152 -215
  253. package/dist/pregel/debug.js.map +1 -1
  254. package/dist/pregel/index.cjs +1134 -1604
  255. package/dist/pregel/index.cjs.map +1 -0
  256. package/dist/pregel/index.d.cts +534 -0
  257. package/dist/pregel/index.d.cts.map +1 -0
  258. package/dist/pregel/index.d.ts +458 -422
  259. package/dist/pregel/index.d.ts.map +1 -0
  260. package/dist/pregel/index.js +1125 -1592
  261. package/dist/pregel/index.js.map +1 -1
  262. package/dist/pregel/io.cjs +127 -234
  263. package/dist/pregel/io.cjs.map +1 -0
  264. package/dist/pregel/io.js +122 -225
  265. package/dist/pregel/io.js.map +1 -1
  266. package/dist/pregel/loop.cjs +539 -954
  267. package/dist/pregel/loop.cjs.map +1 -0
  268. package/dist/pregel/loop.js +536 -948
  269. package/dist/pregel/loop.js.map +1 -1
  270. package/dist/pregel/messages.cjs +104 -196
  271. package/dist/pregel/messages.cjs.map +1 -0
  272. package/dist/pregel/messages.js +102 -191
  273. package/dist/pregel/messages.js.map +1 -1
  274. package/dist/pregel/read.cjs +150 -280
  275. package/dist/pregel/read.cjs.map +1 -0
  276. package/dist/pregel/read.d.cts +51 -0
  277. package/dist/pregel/read.d.cts.map +1 -0
  278. package/dist/pregel/read.d.ts +48 -46
  279. package/dist/pregel/read.d.ts.map +1 -0
  280. package/dist/pregel/read.js +147 -274
  281. package/dist/pregel/read.js.map +1 -1
  282. package/dist/pregel/remote.cjs +339 -458
  283. package/dist/pregel/remote.cjs.map +1 -0
  284. package/dist/pregel/remote.d.cts +121 -0
  285. package/dist/pregel/remote.d.cts.map +1 -0
  286. package/dist/pregel/remote.d.ts +79 -69
  287. package/dist/pregel/remote.d.ts.map +1 -0
  288. package/dist/pregel/remote.js +337 -453
  289. package/dist/pregel/remote.js.map +1 -1
  290. package/dist/pregel/retry.cjs +87 -138
  291. package/dist/pregel/retry.cjs.map +1 -0
  292. package/dist/pregel/retry.js +83 -130
  293. package/dist/pregel/retry.js.map +1 -1
  294. package/dist/pregel/runnable_types.d.cts +25 -0
  295. package/dist/pregel/runnable_types.d.cts.map +1 -0
  296. package/dist/pregel/runnable_types.d.ts +22 -16
  297. package/dist/pregel/runnable_types.d.ts.map +1 -0
  298. package/dist/pregel/runner.cjs +222 -315
  299. package/dist/pregel/runner.cjs.map +1 -0
  300. package/dist/pregel/runner.js +219 -308
  301. package/dist/pregel/runner.js.map +1 -1
  302. package/dist/pregel/stream.cjs +89 -130
  303. package/dist/pregel/stream.cjs.map +1 -0
  304. package/dist/pregel/stream.js +87 -125
  305. package/dist/pregel/stream.js.map +1 -1
  306. package/dist/pregel/types.cjs +25 -62
  307. package/dist/pregel/types.cjs.map +1 -0
  308. package/dist/pregel/types.d.cts +437 -0
  309. package/dist/pregel/types.d.cts.map +1 -0
  310. package/dist/pregel/types.d.ts +377 -431
  311. package/dist/pregel/types.d.ts.map +1 -0
  312. package/dist/pregel/types.js +23 -57
  313. package/dist/pregel/types.js.map +1 -1
  314. package/dist/pregel/utils/config.cjs +100 -147
  315. package/dist/pregel/utils/config.cjs.map +1 -0
  316. package/dist/pregel/utils/config.d.cts +36 -0
  317. package/dist/pregel/utils/config.d.cts.map +1 -0
  318. package/dist/pregel/utils/config.d.ts +12 -9
  319. package/dist/pregel/utils/config.d.ts.map +1 -0
  320. package/dist/pregel/utils/config.js +98 -143
  321. package/dist/pregel/utils/config.js.map +1 -1
  322. package/dist/pregel/utils/index.cjs +87 -125
  323. package/dist/pregel/utils/index.cjs.map +1 -0
  324. package/dist/pregel/utils/index.d.cts +51 -0
  325. package/dist/pregel/utils/index.d.cts.map +1 -0
  326. package/dist/pregel/utils/index.d.ts +45 -61
  327. package/dist/pregel/utils/index.d.ts.map +1 -0
  328. package/dist/pregel/utils/index.js +86 -120
  329. package/dist/pregel/utils/index.js.map +1 -1
  330. package/dist/pregel/utils/subgraph.cjs +15 -26
  331. package/dist/pregel/utils/subgraph.cjs.map +1 -0
  332. package/dist/pregel/utils/subgraph.js +12 -21
  333. package/dist/pregel/utils/subgraph.js.map +1 -1
  334. package/dist/pregel/validate.cjs +42 -92
  335. package/dist/pregel/validate.cjs.map +1 -0
  336. package/dist/pregel/validate.js +39 -84
  337. package/dist/pregel/validate.js.map +1 -1
  338. package/dist/pregel/write.cjs +87 -137
  339. package/dist/pregel/write.cjs.map +1 -0
  340. package/dist/pregel/write.d.cts +35 -0
  341. package/dist/pregel/write.d.cts.map +1 -0
  342. package/dist/pregel/write.d.ts +27 -23
  343. package/dist/pregel/write.d.ts.map +1 -0
  344. package/dist/pregel/write.js +83 -131
  345. package/dist/pregel/write.js.map +1 -1
  346. package/dist/remote.cjs +3 -6
  347. package/dist/remote.d.cts +2 -0
  348. package/dist/remote.d.ts +2 -1
  349. package/dist/remote.js +3 -2
  350. package/dist/setup/async_local_storage.cjs +10 -7
  351. package/dist/setup/async_local_storage.cjs.map +1 -0
  352. package/dist/setup/async_local_storage.js +7 -2
  353. package/dist/setup/async_local_storage.js.map +1 -1
  354. package/dist/ui/index.cjs +4 -0
  355. package/dist/ui/index.d.cts +5 -0
  356. package/dist/ui/index.d.ts +5 -0
  357. package/dist/ui/index.js +3 -0
  358. package/dist/ui/stream.cjs +145 -0
  359. package/dist/ui/stream.cjs.map +1 -0
  360. package/dist/ui/stream.d.cts +25 -0
  361. package/dist/ui/stream.d.cts.map +1 -0
  362. package/dist/ui/stream.d.ts +25 -0
  363. package/dist/ui/stream.d.ts.map +1 -0
  364. package/dist/ui/stream.js +143 -0
  365. package/dist/ui/stream.js.map +1 -0
  366. package/dist/ui/types.infer.d.cts +53 -0
  367. package/dist/ui/types.infer.d.cts.map +1 -0
  368. package/dist/ui/types.infer.d.ts +53 -0
  369. package/dist/ui/types.infer.d.ts.map +1 -0
  370. package/dist/ui/types.message.d.cts +95 -0
  371. package/dist/ui/types.message.d.cts.map +1 -0
  372. package/dist/ui/types.message.d.ts +95 -0
  373. package/dist/ui/types.message.d.ts.map +1 -0
  374. package/dist/ui/types.schema.d.cts +228 -0
  375. package/dist/ui/types.schema.d.cts.map +1 -0
  376. package/dist/ui/types.schema.d.ts +228 -0
  377. package/dist/ui/types.schema.d.ts.map +1 -0
  378. package/dist/utils.cjs +77 -147
  379. package/dist/utils.cjs.map +1 -0
  380. package/dist/utils.d.cts +32 -0
  381. package/dist/utils.d.cts.map +1 -0
  382. package/dist/utils.d.ts +29 -25
  383. package/dist/utils.d.ts.map +1 -0
  384. package/dist/utils.js +73 -140
  385. package/dist/utils.js.map +1 -1
  386. package/dist/web.cjs +97 -55
  387. package/dist/web.d.cts +23 -0
  388. package/dist/web.d.ts +23 -14
  389. package/dist/web.js +15 -8
  390. package/package.json +77 -80
  391. package/dist/channels/any_value.cjs +0 -65
  392. package/dist/channels/any_value.js +0 -61
  393. package/dist/channels/any_value.js.map +0 -1
  394. package/dist/channels/dynamic_barrier_value.cjs +0 -212
  395. package/dist/channels/dynamic_barrier_value.js +0 -207
  396. package/dist/channels/dynamic_barrier_value.js.map +0 -1
  397. package/dist/channels/index.d.ts +0 -7
  398. package/dist/channels/index.js.map +0 -1
  399. package/dist/func/types.cjs +0 -15
  400. package/dist/func/types.js +0 -12
  401. package/dist/func/types.js.map +0 -1
  402. package/dist/graph/index.d.ts +0 -4
  403. package/dist/graph/index.js.map +0 -1
  404. package/dist/graph/message.test.cjs +0 -196
  405. package/dist/graph/message.test.d.ts +0 -1
  406. package/dist/graph/message.test.js +0 -194
  407. package/dist/graph/message.test.js.map +0 -1
  408. package/dist/graph/zod/index.js.map +0 -1
  409. package/dist/graph/zod/plugin.d.ts +0 -28
  410. package/dist/hash.d.ts +0 -2
  411. package/dist/prebuilt/index.js.map +0 -1
  412. package/dist/prebuilt/interrupt.cjs +0 -3
  413. package/dist/prebuilt/interrupt.js +0 -2
  414. package/dist/prebuilt/interrupt.js.map +0 -1
  415. package/dist/pregel/call.d.ts +0 -16
  416. package/dist/pregel/debug.d.ts +0 -41
  417. package/dist/pregel/debug.test.cjs +0 -258
  418. package/dist/pregel/debug.test.d.ts +0 -1
  419. package/dist/pregel/debug.test.js +0 -256
  420. package/dist/pregel/debug.test.js.map +0 -1
  421. package/dist/pregel/io.d.ts +0 -30
  422. package/dist/pregel/io.mapCommand.test.cjs +0 -150
  423. package/dist/pregel/io.mapCommand.test.d.ts +0 -1
  424. package/dist/pregel/io.mapCommand.test.js +0 -148
  425. package/dist/pregel/io.mapCommand.test.js.map +0 -1
  426. package/dist/pregel/loop.d.ts +0 -147
  427. package/dist/pregel/messages.d.ts +0 -30
  428. package/dist/pregel/messages.test.cjs +0 -369
  429. package/dist/pregel/messages.test.d.ts +0 -1
  430. package/dist/pregel/messages.test.js +0 -367
  431. package/dist/pregel/messages.test.js.map +0 -1
  432. package/dist/pregel/read.test.cjs +0 -194
  433. package/dist/pregel/read.test.d.ts +0 -1
  434. package/dist/pregel/read.test.js +0 -192
  435. package/dist/pregel/read.test.js.map +0 -1
  436. package/dist/pregel/retry.d.ts +0 -17
  437. package/dist/pregel/runnable_types.cjs +0 -3
  438. package/dist/pregel/runnable_types.js +0 -2
  439. package/dist/pregel/runnable_types.js.map +0 -1
  440. package/dist/pregel/runner.d.ts +0 -79
  441. package/dist/pregel/runner.test.cjs +0 -66
  442. package/dist/pregel/runner.test.d.ts +0 -1
  443. package/dist/pregel/runner.test.js +0 -64
  444. package/dist/pregel/runner.test.js.map +0 -1
  445. package/dist/pregel/stream.d.ts +0 -40
  446. package/dist/pregel/utils/config.test.cjs +0 -214
  447. package/dist/pregel/utils/config.test.d.ts +0 -1
  448. package/dist/pregel/utils/config.test.js +0 -212
  449. package/dist/pregel/utils/config.test.js.map +0 -1
  450. package/dist/pregel/utils/subgraph.d.ts +0 -4
  451. package/dist/pregel/utils/subgraph.test.cjs +0 -83
  452. package/dist/pregel/utils/subgraph.test.d.ts +0 -1
  453. package/dist/pregel/utils/subgraph.test.js +0 -81
  454. package/dist/pregel/utils/subgraph.test.js.map +0 -1
  455. package/dist/pregel/validate.d.ts +0 -16
  456. package/dist/pregel/validate.test.cjs +0 -220
  457. package/dist/pregel/validate.test.d.ts +0 -1
  458. package/dist/pregel/validate.test.js +0 -218
  459. package/dist/pregel/validate.test.js.map +0 -1
  460. package/dist/pregel/write.test.cjs +0 -181
  461. package/dist/pregel/write.test.d.ts +0 -1
  462. package/dist/pregel/write.test.js +0 -179
  463. package/dist/pregel/write.test.js.map +0 -1
  464. package/dist/remote.js.map +0 -1
  465. package/dist/setup/async_local_storage.d.ts +0 -1
  466. package/dist/web.js.map +0 -1
  467. package/index.cjs +0 -1
  468. package/index.d.cts +0 -1
  469. package/index.d.ts +0 -1
  470. package/index.js +0 -1
  471. package/prebuilt.cjs +0 -1
  472. package/prebuilt.d.cts +0 -1
  473. package/prebuilt.d.ts +0 -1
  474. package/prebuilt.js +0 -1
  475. package/pregel.cjs +0 -1
  476. package/pregel.d.cts +0 -1
  477. package/pregel.d.ts +0 -1
  478. package/pregel.js +0 -1
  479. package/remote.cjs +0 -1
  480. package/remote.d.cts +0 -1
  481. package/remote.d.ts +0 -1
  482. package/remote.js +0 -1
  483. package/web.cjs +0 -1
  484. package/web.d.cts +0 -1
  485. package/web.d.ts +0 -1
  486. package/web.js +0 -1
  487. package/zod/schema.cjs +0 -1
  488. package/zod/schema.d.cts +0 -1
  489. package/zod/schema.d.ts +0 -1
  490. package/zod/schema.js +0 -1
  491. package/zod.cjs +0 -1
  492. package/zod.d.cts +0 -1
  493. package/zod.d.ts +0 -1
  494. package/zod.js +0 -1
package/dist/constants.js CHANGED
@@ -1,470 +1,359 @@
1
- var _a;
1
+ //#region src/constants.ts
2
2
  /** Special reserved node name denoting the start of a graph. */
3
- export const START = "__start__";
3
+ const START = "__start__";
4
4
  /** Special reserved node name denoting the end of a graph. */
5
- export const END = "__end__";
6
- export const INPUT = "__input__";
7
- export const COPY = "__copy__";
8
- export const ERROR = "__error__";
5
+ const END = "__end__";
6
+ const INPUT = "__input__";
7
+ const COPY = "__copy__";
8
+ const ERROR = "__error__";
9
9
  /** Special reserved cache namespaces */
10
- export const CACHE_NS_WRITES = "__pregel_ns_writes";
11
- export const CONFIG_KEY_SEND = "__pregel_send";
10
+ const CACHE_NS_WRITES = "__pregel_ns_writes";
11
+ const CONFIG_KEY_SEND = "__pregel_send";
12
12
  /** config key containing function used to call a node (push task) */
13
- export const CONFIG_KEY_CALL = "__pregel_call";
14
- export const CONFIG_KEY_READ = "__pregel_read";
15
- export const CONFIG_KEY_CHECKPOINTER = "__pregel_checkpointer";
16
- export const CONFIG_KEY_RESUMING = "__pregel_resuming";
17
- export const CONFIG_KEY_TASK_ID = "__pregel_task_id";
18
- export const CONFIG_KEY_STREAM = "__pregel_stream";
19
- export const CONFIG_KEY_RESUME_VALUE = "__pregel_resume_value";
20
- export const CONFIG_KEY_RESUME_MAP = "__pregel_resume_map";
21
- export const CONFIG_KEY_SCRATCHPAD = "__pregel_scratchpad";
13
+ const CONFIG_KEY_CALL = "__pregel_call";
14
+ const CONFIG_KEY_READ = "__pregel_read";
15
+ const CONFIG_KEY_CHECKPOINTER = "__pregel_checkpointer";
16
+ const CONFIG_KEY_RESUMING = "__pregel_resuming";
17
+ const CONFIG_KEY_TASK_ID = "__pregel_task_id";
18
+ const CONFIG_KEY_STREAM = "__pregel_stream";
19
+ const CONFIG_KEY_RESUME_VALUE = "__pregel_resume_value";
20
+ const CONFIG_KEY_RESUME_MAP = "__pregel_resume_map";
21
+ const CONFIG_KEY_SCRATCHPAD = "__pregel_scratchpad";
22
22
  /** config key containing state from previous invocation of graph for the given thread */
23
- export const CONFIG_KEY_PREVIOUS_STATE = "__pregel_previous";
24
- export const CONFIG_KEY_DURABILITY = "__pregel_durability";
25
- export const CONFIG_KEY_CHECKPOINT_ID = "checkpoint_id";
26
- export const CONFIG_KEY_CHECKPOINT_NS = "checkpoint_ns";
27
- export const CONFIG_KEY_NODE_FINISHED = "__pregel_node_finished";
28
- // this one is part of public API
29
- export const CONFIG_KEY_CHECKPOINT_MAP = "checkpoint_map";
30
- export const CONFIG_KEY_ABORT_SIGNALS = "__pregel_abort_signals";
23
+ const CONFIG_KEY_PREVIOUS_STATE = "__pregel_previous";
24
+ const CONFIG_KEY_DURABILITY = "__pregel_durability";
25
+ const CONFIG_KEY_CHECKPOINT_ID = "checkpoint_id";
26
+ const CONFIG_KEY_CHECKPOINT_NS = "checkpoint_ns";
27
+ const CONFIG_KEY_NODE_FINISHED = "__pregel_node_finished";
28
+ const CONFIG_KEY_CHECKPOINT_MAP = "checkpoint_map";
29
+ const CONFIG_KEY_ABORT_SIGNALS = "__pregel_abort_signals";
31
30
  /** Special channel reserved for graph interrupts */
32
- export const INTERRUPT = "__interrupt__";
31
+ const INTERRUPT = "__interrupt__";
33
32
  /** Special channel reserved for graph resume */
34
- export const RESUME = "__resume__";
33
+ const RESUME = "__resume__";
35
34
  /** Special channel reserved for cases when a task exits without any writes */
36
- export const NO_WRITES = "__no_writes__";
35
+ const NO_WRITES = "__no_writes__";
37
36
  /** Special channel reserved for graph return */
38
- export const RETURN = "__return__";
37
+ const RETURN = "__return__";
39
38
  /** Special channel reserved for graph previous state */
40
- export const PREVIOUS = "__previous__";
41
- export const RUNTIME_PLACEHOLDER = "__pregel_runtime_placeholder__";
42
- export const RECURSION_LIMIT_DEFAULT = 25;
43
- export const TAG_HIDDEN = "langsmith:hidden";
44
- export const TAG_NOSTREAM = "langsmith:nostream";
45
- export const SELF = "__self__";
46
- export const TASKS = "__pregel_tasks";
47
- export const PUSH = "__pregel_push";
48
- export const PULL = "__pregel_pull";
49
- export const TASK_NAMESPACE = "6ba7b831-9dad-11d1-80b4-00c04fd430c8";
50
- export const NULL_TASK_ID = "00000000-0000-0000-0000-000000000000";
51
- export const RESERVED = [
52
- TAG_HIDDEN,
53
- INPUT,
54
- INTERRUPT,
55
- RESUME,
56
- ERROR,
57
- NO_WRITES,
58
- // reserved config.configurable keys
59
- CONFIG_KEY_SEND,
60
- CONFIG_KEY_READ,
61
- CONFIG_KEY_CHECKPOINTER,
62
- CONFIG_KEY_DURABILITY,
63
- CONFIG_KEY_STREAM,
64
- CONFIG_KEY_RESUMING,
65
- CONFIG_KEY_TASK_ID,
66
- CONFIG_KEY_CALL,
67
- CONFIG_KEY_RESUME_VALUE,
68
- CONFIG_KEY_SCRATCHPAD,
69
- CONFIG_KEY_PREVIOUS_STATE,
70
- CONFIG_KEY_CHECKPOINT_MAP,
71
- CONFIG_KEY_CHECKPOINT_NS,
72
- CONFIG_KEY_CHECKPOINT_ID,
39
+ const PREVIOUS = "__previous__";
40
+ const TAG_HIDDEN = "langsmith:hidden";
41
+ const TAG_NOSTREAM = "langsmith:nostream";
42
+ const SELF = "__self__";
43
+ const TASKS = "__pregel_tasks";
44
+ const PUSH = "__pregel_push";
45
+ const PULL = "__pregel_pull";
46
+ const NULL_TASK_ID = "00000000-0000-0000-0000-000000000000";
47
+ const RESERVED = [
48
+ TAG_HIDDEN,
49
+ INPUT,
50
+ INTERRUPT,
51
+ RESUME,
52
+ ERROR,
53
+ NO_WRITES,
54
+ CONFIG_KEY_SEND,
55
+ CONFIG_KEY_READ,
56
+ CONFIG_KEY_CHECKPOINTER,
57
+ CONFIG_KEY_DURABILITY,
58
+ CONFIG_KEY_STREAM,
59
+ CONFIG_KEY_RESUMING,
60
+ CONFIG_KEY_TASK_ID,
61
+ CONFIG_KEY_CALL,
62
+ CONFIG_KEY_RESUME_VALUE,
63
+ CONFIG_KEY_SCRATCHPAD,
64
+ CONFIG_KEY_PREVIOUS_STATE,
65
+ CONFIG_KEY_CHECKPOINT_MAP,
66
+ CONFIG_KEY_CHECKPOINT_NS,
67
+ CONFIG_KEY_CHECKPOINT_ID
73
68
  ];
74
- export const CHECKPOINT_NAMESPACE_SEPARATOR = "|";
75
- export const CHECKPOINT_NAMESPACE_END = ":";
69
+ const CHECKPOINT_NAMESPACE_SEPARATOR = "|";
70
+ const CHECKPOINT_NAMESPACE_END = ":";
76
71
  /** @internal */
77
72
  const COMMAND_SYMBOL = Symbol.for("langgraph.command");
78
73
  /**
79
- * Instance of a {@link Command} class.
80
- *
81
- * This is used to avoid IntelliSense suggesting public fields
82
- * of {@link Command} class when a plain object is expected.
83
- *
84
- * @see {@link Command}
85
- * @internal
86
- */
87
- export class CommandInstance {
88
- constructor() {
89
- Object.defineProperty(this, _a, {
90
- enumerable: true,
91
- configurable: true,
92
- writable: true,
93
- value: void 0
94
- });
95
- }
96
- }
97
- _a = COMMAND_SYMBOL;
98
- export function _isSendInterface(x) {
99
- const operation = x;
100
- return (operation !== null &&
101
- operation !== undefined &&
102
- typeof operation.node === "string" &&
103
- operation.args !== undefined);
74
+ * Instance of a {@link Command} class.
75
+ *
76
+ * This is used to avoid IntelliSense suggesting public fields
77
+ * of {@link Command} class when a plain object is expected.
78
+ *
79
+ * @see {@link Command}
80
+ * @internal
81
+ */
82
+ var CommandInstance = class {
83
+ [COMMAND_SYMBOL];
84
+ };
85
+ function _isSendInterface(x) {
86
+ const operation = x;
87
+ return operation !== null && operation !== void 0 && typeof operation.node === "string" && operation.args !== void 0;
104
88
  }
105
89
  /**
106
- *
107
- * A message or packet to send to a specific node in the graph.
108
- *
109
- * The `Send` class is used within a `StateGraph`'s conditional edges to
110
- * dynamically invoke a node with a custom state at the next step.
111
- *
112
- * Importantly, the sent state can differ from the core graph's state,
113
- * allowing for flexible and dynamic workflow management.
114
- *
115
- * One such example is a "map-reduce" workflow where your graph invokes
116
- * the same node multiple times in parallel with different states,
117
- * before aggregating the results back into the main graph's state.
118
- *
119
- * @example
120
- * ```typescript
121
- * import { Annotation, Send, StateGraph } from "@langchain/langgraph";
122
- *
123
- * const ChainState = Annotation.Root({
124
- * subjects: Annotation<string[]>,
125
- * jokes: Annotation<string[]>({
126
- * reducer: (a, b) => a.concat(b),
127
- * }),
128
- * });
129
- *
130
- * const continueToJokes = async (state: typeof ChainState.State) => {
131
- * return state.subjects.map((subject) => {
132
- * return new Send("generate_joke", { subjects: [subject] });
133
- * });
134
- * };
135
- *
136
- * const graph = new StateGraph(ChainState)
137
- * .addNode("generate_joke", (state) => ({
138
- * jokes: [`Joke about ${state.subjects}`],
139
- * }))
140
- * .addConditionalEdges("__start__", continueToJokes)
141
- * .addEdge("generate_joke", "__end__")
142
- * .compile();
143
- *
144
- * const res = await graph.invoke({ subjects: ["cats", "dogs"] });
145
- * console.log(res);
146
- *
147
- * // Invoking with two subjects results in a generated joke for each
148
- * // { subjects: ["cats", "dogs"], jokes: [`Joke about cats`, `Joke about dogs`] }
149
- * ```
150
- */
151
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
152
- export class Send {
153
- constructor(node, args) {
154
- Object.defineProperty(this, "lg_name", {
155
- enumerable: true,
156
- configurable: true,
157
- writable: true,
158
- value: "Send"
159
- });
160
- Object.defineProperty(this, "node", {
161
- enumerable: true,
162
- configurable: true,
163
- writable: true,
164
- value: void 0
165
- });
166
- Object.defineProperty(this, "args", {
167
- enumerable: true,
168
- configurable: true,
169
- writable: true,
170
- value: void 0
171
- });
172
- this.node = node;
173
- this.args = _deserializeCommandSendObjectGraph(args);
174
- }
175
- toJSON() {
176
- return { lg_name: this.lg_name, node: this.node, args: this.args };
177
- }
178
- }
179
- export function _isSend(x) {
180
- // eslint-disable-next-line no-instanceof/no-instanceof
181
- return x instanceof Send;
90
+ *
91
+ * A message or packet to send to a specific node in the graph.
92
+ *
93
+ * The `Send` class is used within a `StateGraph`'s conditional edges to
94
+ * dynamically invoke a node with a custom state at the next step.
95
+ *
96
+ * Importantly, the sent state can differ from the core graph's state,
97
+ * allowing for flexible and dynamic workflow management.
98
+ *
99
+ * One such example is a "map-reduce" workflow where your graph invokes
100
+ * the same node multiple times in parallel with different states,
101
+ * before aggregating the results back into the main graph's state.
102
+ *
103
+ * @example
104
+ * ```typescript
105
+ * import { Annotation, Send, StateGraph } from "@langchain/langgraph";
106
+ *
107
+ * const ChainState = Annotation.Root({
108
+ * subjects: Annotation<string[]>,
109
+ * jokes: Annotation<string[]>({
110
+ * reducer: (a, b) => a.concat(b),
111
+ * }),
112
+ * });
113
+ *
114
+ * const continueToJokes = async (state: typeof ChainState.State) => {
115
+ * return state.subjects.map((subject) => {
116
+ * return new Send("generate_joke", { subjects: [subject] });
117
+ * });
118
+ * };
119
+ *
120
+ * const graph = new StateGraph(ChainState)
121
+ * .addNode("generate_joke", (state) => ({
122
+ * jokes: [`Joke about ${state.subjects}`],
123
+ * }))
124
+ * .addConditionalEdges("__start__", continueToJokes)
125
+ * .addEdge("generate_joke", "__end__")
126
+ * .compile();
127
+ *
128
+ * const res = await graph.invoke({ subjects: ["cats", "dogs"] });
129
+ * console.log(res);
130
+ *
131
+ * // Invoking with two subjects results in a generated joke for each
132
+ * // { subjects: ["cats", "dogs"], jokes: [`Joke about cats`, `Joke about dogs`] }
133
+ * ```
134
+ */
135
+ var Send = class {
136
+ lg_name = "Send";
137
+ node;
138
+ args;
139
+ constructor(node, args) {
140
+ this.node = node;
141
+ this.args = _deserializeCommandSendObjectGraph(args);
142
+ }
143
+ toJSON() {
144
+ return {
145
+ lg_name: this.lg_name,
146
+ node: this.node,
147
+ args: this.args
148
+ };
149
+ }
150
+ };
151
+ function _isSend(x) {
152
+ return x instanceof Send;
182
153
  }
183
154
  /**
184
- * Checks if the given graph invoke / stream chunk contains interrupt.
185
- *
186
- * @example
187
- * ```ts
188
- * import { INTERRUPT, isInterrupted } from "@langchain/langgraph";
189
- *
190
- * const values = await graph.invoke({ foo: "bar" });
191
- * if (isInterrupted<string>(values)) {
192
- * const interrupt = values[INTERRUPT][0].value;
193
- * }
194
- * ```
195
- *
196
- * @param values - The values to check.
197
- * @returns `true` if the values contain an interrupt, `false` otherwise.
198
- */
199
- export function isInterrupted(values) {
200
- if (!values || typeof values !== "object")
201
- return false;
202
- if (!(INTERRUPT in values))
203
- return false;
204
- return Array.isArray(values[INTERRUPT]);
155
+ * Checks if the given graph invoke / stream chunk contains interrupt.
156
+ *
157
+ * @example
158
+ * ```ts
159
+ * import { INTERRUPT, isInterrupted } from "@langchain/langgraph";
160
+ *
161
+ * const values = await graph.invoke({ foo: "bar" });
162
+ * if (isInterrupted<string>(values)) {
163
+ * const interrupt = values[INTERRUPT][0].value;
164
+ * }
165
+ * ```
166
+ *
167
+ * @param values - The values to check.
168
+ * @returns `true` if the values contain an interrupt, `false` otherwise.
169
+ */
170
+ function isInterrupted(values) {
171
+ if (!values || typeof values !== "object") return false;
172
+ if (!(INTERRUPT in values)) return false;
173
+ return Array.isArray(values[INTERRUPT]);
205
174
  }
206
175
  /**
207
- * One or more commands to update the graph's state and send messages to nodes.
208
- * Can be used to combine routing logic with state updates in lieu of conditional edges
209
- *
210
- * @example
211
- * ```ts
212
- * import { Annotation, Command } from "@langchain/langgraph";
213
- *
214
- * // Define graph state
215
- * const StateAnnotation = Annotation.Root({
216
- * foo: Annotation<string>,
217
- * });
218
- *
219
- * // Define the nodes
220
- * const nodeA = async (_state: typeof StateAnnotation.State) => {
221
- * console.log("Called A");
222
- * // this is a replacement for a real conditional edge function
223
- * const goto = Math.random() > .5 ? "nodeB" : "nodeC";
224
- * // note how Command allows you to BOTH update the graph state AND route to the next node
225
- * return new Command({
226
- * // this is the state update
227
- * update: {
228
- * foo: "a",
229
- * },
230
- * // this is a replacement for an edge
231
- * goto,
232
- * });
233
- * };
234
- *
235
- * // Nodes B and C are unchanged
236
- * const nodeB = async (state: typeof StateAnnotation.State) => {
237
- * console.log("Called B");
238
- * return {
239
- * foo: state.foo + "|b",
240
- * };
241
- * }
242
- *
243
- * const nodeC = async (state: typeof StateAnnotation.State) => {
244
- * console.log("Called C");
245
- * return {
246
- * foo: state.foo + "|c",
247
- * };
248
- * }
249
- *
250
- * import { StateGraph } from "@langchain/langgraph";
176
+ * One or more commands to update the graph's state and send messages to nodes.
177
+ * Can be used to combine routing logic with state updates in lieu of conditional edges
178
+ *
179
+ * @example
180
+ * ```ts
181
+ * import { Annotation, Command } from "@langchain/langgraph";
182
+ *
183
+ * // Define graph state
184
+ * const StateAnnotation = Annotation.Root({
185
+ * foo: Annotation<string>,
186
+ * });
187
+ *
188
+ * // Define the nodes
189
+ * const nodeA = async (_state: typeof StateAnnotation.State) => {
190
+ * console.log("Called A");
191
+ * // this is a replacement for a real conditional edge function
192
+ * const goto = Math.random() > .5 ? "nodeB" : "nodeC";
193
+ * // note how Command allows you to BOTH update the graph state AND route to the next node
194
+ * return new Command({
195
+ * // this is the state update
196
+ * update: {
197
+ * foo: "a",
198
+ * },
199
+ * // this is a replacement for an edge
200
+ * goto,
201
+ * });
202
+ * };
203
+ *
204
+ * // Nodes B and C are unchanged
205
+ * const nodeB = async (state: typeof StateAnnotation.State) => {
206
+ * console.log("Called B");
207
+ * return {
208
+ * foo: state.foo + "|b",
209
+ * };
210
+ * }
211
+ *
212
+ * const nodeC = async (state: typeof StateAnnotation.State) => {
213
+ * console.log("Called C");
214
+ * return {
215
+ * foo: state.foo + "|c",
216
+ * };
217
+ * }
218
+ *
219
+ * import { StateGraph } from "@langchain/langgraph";
251
220
 
252
- * // NOTE: there are no edges between nodes A, B and C!
253
- * const graph = new StateGraph(StateAnnotation)
254
- * .addNode("nodeA", nodeA, {
255
- * ends: ["nodeB", "nodeC"],
256
- * })
257
- * .addNode("nodeB", nodeB)
258
- * .addNode("nodeC", nodeC)
259
- * .addEdge("__start__", "nodeA")
260
- * .compile();
261
- *
262
- * await graph.invoke({ foo: "" });
263
- *
264
- * // Randomly oscillates between
265
- * // { foo: 'a|c' } and { foo: 'a|b' }
266
- * ```
267
- */
268
- export class Command extends CommandInstance {
269
- constructor(args) {
270
- super();
271
- Object.defineProperty(this, "lg_name", {
272
- enumerable: true,
273
- configurable: true,
274
- writable: true,
275
- value: "Command"
276
- });
277
- Object.defineProperty(this, "lc_direct_tool_output", {
278
- enumerable: true,
279
- configurable: true,
280
- writable: true,
281
- value: true
282
- });
283
- /**
284
- * Graph to send the command to. Supported values are:
285
- * - None: the current graph (default)
286
- * - The specific name of the graph to send the command to
287
- * - {@link Command.PARENT}: closest parent graph (only supported when returned from a node in a subgraph)
288
- */
289
- Object.defineProperty(this, "graph", {
290
- enumerable: true,
291
- configurable: true,
292
- writable: true,
293
- value: void 0
294
- });
295
- /**
296
- * Update to apply to the graph's state as a result of executing the node that is returning the command.
297
- * Written to the state as if the node had simply returned this value instead of the Command object.
298
- */
299
- Object.defineProperty(this, "update", {
300
- enumerable: true,
301
- configurable: true,
302
- writable: true,
303
- value: void 0
304
- });
305
- /**
306
- * Value to resume execution with. To be used together with {@link interrupt}.
307
- */
308
- Object.defineProperty(this, "resume", {
309
- enumerable: true,
310
- configurable: true,
311
- writable: true,
312
- value: void 0
313
- });
314
- /**
315
- * Can be one of the following:
316
- * - name of the node to navigate to next (any node that belongs to the specified `graph`)
317
- * - sequence of node names to navigate to next
318
- * - {@link Send} object (to execute a node with the exact input provided in the {@link Send} object)
319
- * - sequence of {@link Send} objects
320
- */
321
- Object.defineProperty(this, "goto", {
322
- enumerable: true,
323
- configurable: true,
324
- writable: true,
325
- value: []
326
- });
327
- this.resume = args.resume;
328
- this.graph = args.graph;
329
- this.update = args.update;
330
- if (args.goto) {
331
- this.goto = Array.isArray(args.goto)
332
- ? _deserializeCommandSendObjectGraph(args.goto)
333
- : [_deserializeCommandSendObjectGraph(args.goto)];
334
- }
335
- }
336
- /**
337
- * Convert the update field to a list of {@link PendingWrite} tuples
338
- * @returns List of {@link PendingWrite} tuples of the form `[channelKey, value]`.
339
- * @internal
340
- */
341
- _updateAsTuples() {
342
- if (this.update &&
343
- typeof this.update === "object" &&
344
- !Array.isArray(this.update)) {
345
- return Object.entries(this.update);
346
- }
347
- else if (Array.isArray(this.update) &&
348
- this.update.every((t) => Array.isArray(t) && t.length === 2 && typeof t[0] === "string")) {
349
- return this.update;
350
- }
351
- else {
352
- return [["__root__", this.update]];
353
- }
354
- }
355
- toJSON() {
356
- let serializedGoto;
357
- if (typeof this.goto === "string") {
358
- serializedGoto = this.goto;
359
- }
360
- else if (_isSend(this.goto)) {
361
- serializedGoto = this.goto.toJSON();
362
- }
363
- else {
364
- serializedGoto = this.goto?.map((innerGoto) => {
365
- if (typeof innerGoto === "string") {
366
- return innerGoto;
367
- }
368
- else {
369
- return innerGoto.toJSON();
370
- }
371
- });
372
- }
373
- return {
374
- lg_name: this.lg_name,
375
- update: this.update,
376
- resume: this.resume,
377
- goto: serializedGoto,
378
- };
379
- }
380
- }
381
- Object.defineProperty(Command, "PARENT", {
382
- enumerable: true,
383
- configurable: true,
384
- writable: true,
385
- value: "__parent__"
386
- });
221
+ * // NOTE: there are no edges between nodes A, B and C!
222
+ * const graph = new StateGraph(StateAnnotation)
223
+ * .addNode("nodeA", nodeA, {
224
+ * ends: ["nodeB", "nodeC"],
225
+ * })
226
+ * .addNode("nodeB", nodeB)
227
+ * .addNode("nodeC", nodeC)
228
+ * .addEdge("__start__", "nodeA")
229
+ * .compile();
230
+ *
231
+ * await graph.invoke({ foo: "" });
232
+ *
233
+ * // Randomly oscillates between
234
+ * // { foo: 'a|c' } and { foo: 'a|b' }
235
+ * ```
236
+ */
237
+ var Command = class extends CommandInstance {
238
+ lg_name = "Command";
239
+ lc_direct_tool_output = true;
240
+ /**
241
+ * Graph to send the command to. Supported values are:
242
+ * - None: the current graph (default)
243
+ * - The specific name of the graph to send the command to
244
+ * - {@link Command.PARENT}: closest parent graph (only supported when returned from a node in a subgraph)
245
+ */
246
+ graph;
247
+ /**
248
+ * Update to apply to the graph's state as a result of executing the node that is returning the command.
249
+ * Written to the state as if the node had simply returned this value instead of the Command object.
250
+ */
251
+ update;
252
+ /**
253
+ * Value to resume execution with. To be used together with {@link interrupt}.
254
+ */
255
+ resume;
256
+ /**
257
+ * Can be one of the following:
258
+ * - name of the node to navigate to next (any node that belongs to the specified `graph`)
259
+ * - sequence of node names to navigate to next
260
+ * - {@link Send} object (to execute a node with the exact input provided in the {@link Send} object)
261
+ * - sequence of {@link Send} objects
262
+ */
263
+ goto = [];
264
+ static PARENT = "__parent__";
265
+ constructor(args) {
266
+ super();
267
+ this.resume = args.resume;
268
+ this.graph = args.graph;
269
+ this.update = args.update;
270
+ if (args.goto) this.goto = Array.isArray(args.goto) ? _deserializeCommandSendObjectGraph(args.goto) : [_deserializeCommandSendObjectGraph(args.goto)];
271
+ }
272
+ /**
273
+ * Convert the update field to a list of {@link PendingWrite} tuples
274
+ * @returns List of {@link PendingWrite} tuples of the form `[channelKey, value]`.
275
+ * @internal
276
+ */
277
+ _updateAsTuples() {
278
+ if (this.update && typeof this.update === "object" && !Array.isArray(this.update)) return Object.entries(this.update);
279
+ else if (Array.isArray(this.update) && this.update.every((t) => Array.isArray(t) && t.length === 2 && typeof t[0] === "string")) return this.update;
280
+ else return [["__root__", this.update]];
281
+ }
282
+ toJSON() {
283
+ let serializedGoto;
284
+ if (typeof this.goto === "string") serializedGoto = this.goto;
285
+ else if (_isSend(this.goto)) serializedGoto = this.goto.toJSON();
286
+ else serializedGoto = this.goto?.map((innerGoto) => {
287
+ if (typeof innerGoto === "string") return innerGoto;
288
+ else return innerGoto.toJSON();
289
+ });
290
+ return {
291
+ lg_name: this.lg_name,
292
+ update: this.update,
293
+ resume: this.resume,
294
+ goto: serializedGoto
295
+ };
296
+ }
297
+ };
387
298
  /**
388
- * A type guard to check if the given value is a {@link Command}.
389
- *
390
- * Useful for type narrowing when working with the {@link Command} object.
391
- *
392
- * @param x - The value to check.
393
- * @returns `true` if the value is a {@link Command}, `false` otherwise.
394
- */
395
- export function isCommand(x) {
396
- if (typeof x !== "object") {
397
- return false;
398
- }
399
- if (x === null || x === undefined) {
400
- return false;
401
- }
402
- if ("lg_name" in x && x.lg_name === "Command") {
403
- return true;
404
- }
405
- return false;
299
+ * A type guard to check if the given value is a {@link Command}.
300
+ *
301
+ * Useful for type narrowing when working with the {@link Command} object.
302
+ *
303
+ * @param x - The value to check.
304
+ * @returns `true` if the value is a {@link Command}, `false` otherwise.
305
+ */
306
+ function isCommand(x) {
307
+ if (typeof x !== "object") return false;
308
+ if (x === null || x === void 0) return false;
309
+ if ("lg_name" in x && x.lg_name === "Command") return true;
310
+ return false;
406
311
  }
407
312
  /**
408
- * Reconstructs Command and Send objects from a deeply nested tree of anonymous objects
409
- * matching their interfaces.
410
- *
411
- * This is only exported for testing purposes. It is NOT intended to be used outside of
412
- * the Command and Send classes.
413
- *
414
- * @internal
415
- *
416
- * @param x - The command send tree to convert.
417
- * @param seen - A map of seen objects to avoid infinite loops.
418
- * @returns The converted command send tree.
419
- */
420
- export function _deserializeCommandSendObjectGraph(x, seen = new Map()) {
421
- if (x !== undefined && x !== null && typeof x === "object") {
422
- // If we've already processed this object, return the transformed version
423
- if (seen.has(x)) {
424
- return seen.get(x);
425
- }
426
- let result;
427
- if (Array.isArray(x)) {
428
- // Create the array first, then populate it
429
- result = [];
430
- // Add to seen map before processing elements to handle self-references
431
- seen.set(x, result);
432
- // Now populate the array
433
- x.forEach((item, index) => {
434
- result[index] = _deserializeCommandSendObjectGraph(item, seen);
435
- });
436
- // eslint-disable-next-line no-instanceof/no-instanceof
437
- }
438
- else if (isCommand(x) && !(x instanceof Command)) {
439
- result = new Command(x);
440
- seen.set(x, result);
441
- // eslint-disable-next-line no-instanceof/no-instanceof
442
- }
443
- else if (_isSendInterface(x) && !(x instanceof Send)) {
444
- result = new Send(x.node, x.args);
445
- seen.set(x, result);
446
- }
447
- else if (isCommand(x) || _isSend(x)) {
448
- result = x;
449
- seen.set(x, result);
450
- }
451
- else if ("lc_serializable" in x && x.lc_serializable) {
452
- result = x;
453
- seen.set(x, result);
454
- }
455
- else {
456
- // Create empty object first
457
- result = {};
458
- // Add to seen map before processing properties to handle self-references
459
- seen.set(x, result);
460
- // Now populate the object
461
- for (const [key, value] of Object.entries(x)) {
462
- result[key] =
463
- _deserializeCommandSendObjectGraph(value, seen);
464
- }
465
- }
466
- return result;
467
- }
468
- return x;
313
+ * Reconstructs Command and Send objects from a deeply nested tree of anonymous objects
314
+ * matching their interfaces.
315
+ *
316
+ * This is only exported for testing purposes. It is NOT intended to be used outside of
317
+ * the Command and Send classes.
318
+ *
319
+ * @internal
320
+ *
321
+ * @param x - The command send tree to convert.
322
+ * @param seen - A map of seen objects to avoid infinite loops.
323
+ * @returns The converted command send tree.
324
+ */
325
+ function _deserializeCommandSendObjectGraph(x, seen = /* @__PURE__ */ new Map()) {
326
+ if (x !== void 0 && x !== null && typeof x === "object") {
327
+ if (seen.has(x)) return seen.get(x);
328
+ let result;
329
+ if (Array.isArray(x)) {
330
+ result = [];
331
+ seen.set(x, result);
332
+ x.forEach((item, index) => {
333
+ result[index] = _deserializeCommandSendObjectGraph(item, seen);
334
+ });
335
+ } else if (isCommand(x) && !(x instanceof Command)) {
336
+ result = new Command(x);
337
+ seen.set(x, result);
338
+ } else if (_isSendInterface(x) && !(x instanceof Send)) {
339
+ result = new Send(x.node, x.args);
340
+ seen.set(x, result);
341
+ } else if (isCommand(x) || _isSend(x)) {
342
+ result = x;
343
+ seen.set(x, result);
344
+ } else if ("lc_serializable" in x && x.lc_serializable) {
345
+ result = x;
346
+ seen.set(x, result);
347
+ } else {
348
+ result = {};
349
+ seen.set(x, result);
350
+ for (const [key, value] of Object.entries(x)) result[key] = _deserializeCommandSendObjectGraph(value, seen);
351
+ }
352
+ return result;
353
+ }
354
+ return x;
469
355
  }
356
+
357
+ //#endregion
358
+ export { CACHE_NS_WRITES, CHECKPOINT_NAMESPACE_END, CHECKPOINT_NAMESPACE_SEPARATOR, CONFIG_KEY_ABORT_SIGNALS, CONFIG_KEY_CALL, CONFIG_KEY_CHECKPOINTER, CONFIG_KEY_CHECKPOINT_ID, CONFIG_KEY_CHECKPOINT_MAP, CONFIG_KEY_CHECKPOINT_NS, CONFIG_KEY_DURABILITY, CONFIG_KEY_NODE_FINISHED, CONFIG_KEY_PREVIOUS_STATE, CONFIG_KEY_READ, CONFIG_KEY_RESUME_MAP, CONFIG_KEY_RESUMING, CONFIG_KEY_SCRATCHPAD, CONFIG_KEY_SEND, CONFIG_KEY_STREAM, CONFIG_KEY_TASK_ID, COPY, Command, END, ERROR, INPUT, INTERRUPT, NO_WRITES, NULL_TASK_ID, PREVIOUS, PULL, PUSH, RESERVED, RESUME, RETURN, SELF, START, Send, TAG_HIDDEN, TAG_NOSTREAM, TASKS, _isSend, _isSendInterface, isCommand, isInterrupted };
470
359
  //# sourceMappingURL=constants.js.map