@langchain/langgraph 0.4.9 → 1.0.0-alpha.1

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 (505) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +1 -2
  3. package/dist/_virtual/rolldown_runtime.cjs +25 -0
  4. package/dist/channels/any_value.cjs +44 -63
  5. package/dist/channels/any_value.cjs.map +1 -0
  6. package/dist/channels/any_value.d.cts +24 -0
  7. package/dist/channels/any_value.d.cts.map +1 -0
  8. package/dist/channels/any_value.d.ts +16 -11
  9. package/dist/channels/any_value.d.ts.map +1 -0
  10. package/dist/channels/any_value.js +42 -57
  11. package/dist/channels/any_value.js.map +1 -1
  12. package/dist/channels/base.cjs +93 -133
  13. package/dist/channels/base.cjs.map +1 -0
  14. package/dist/channels/base.d.cts +79 -0
  15. package/dist/channels/base.d.cts.map +1 -0
  16. package/dist/channels/base.d.ts +77 -73
  17. package/dist/channels/base.d.ts.map +1 -0
  18. package/dist/channels/base.js +90 -127
  19. package/dist/channels/base.js.map +1 -1
  20. package/dist/channels/binop.cjs +47 -77
  21. package/dist/channels/binop.cjs.map +1 -0
  22. package/dist/channels/binop.d.cts +22 -0
  23. package/dist/channels/binop.d.cts.map +1 -0
  24. package/dist/channels/binop.d.ts +17 -12
  25. package/dist/channels/binop.d.ts.map +1 -0
  26. package/dist/channels/binop.js +45 -71
  27. package/dist/channels/binop.js.map +1 -1
  28. package/dist/channels/dynamic_barrier_value.cjs +72 -208
  29. package/dist/channels/dynamic_barrier_value.cjs.map +1 -0
  30. package/dist/channels/dynamic_barrier_value.d.cts +42 -0
  31. package/dist/channels/dynamic_barrier_value.d.cts.map +1 -0
  32. package/dist/channels/dynamic_barrier_value.d.ts +20 -35
  33. package/dist/channels/dynamic_barrier_value.d.ts.map +1 -0
  34. package/dist/channels/dynamic_barrier_value.js +69 -200
  35. package/dist/channels/dynamic_barrier_value.js.map +1 -1
  36. package/dist/channels/ephemeral_value.cjs +44 -70
  37. package/dist/channels/ephemeral_value.cjs.map +1 -0
  38. package/dist/channels/ephemeral_value.d.cts +22 -0
  39. package/dist/channels/ephemeral_value.d.cts.map +1 -0
  40. package/dist/channels/ephemeral_value.d.ts +18 -12
  41. package/dist/channels/ephemeral_value.d.ts.map +1 -0
  42. package/dist/channels/ephemeral_value.js +43 -65
  43. package/dist/channels/ephemeral_value.js.map +1 -1
  44. package/dist/channels/index.cjs +21 -10
  45. package/dist/channels/index.d.cts +9 -0
  46. package/dist/channels/index.d.ts +9 -7
  47. package/dist/channels/index.js +10 -3
  48. package/dist/channels/last_value.cjs +90 -140
  49. package/dist/channels/last_value.cjs.map +1 -0
  50. package/dist/channels/last_value.d.cts +42 -0
  51. package/dist/channels/last_value.d.cts.map +1 -0
  52. package/dist/channels/last_value.d.ts +27 -23
  53. package/dist/channels/last_value.d.ts.map +1 -0
  54. package/dist/channels/last_value.js +87 -133
  55. package/dist/channels/last_value.js.map +1 -1
  56. package/dist/channels/named_barrier_value.cjs +114 -170
  57. package/dist/channels/named_barrier_value.cjs.map +1 -0
  58. package/dist/channels/named_barrier_value.d.cts +46 -0
  59. package/dist/channels/named_barrier_value.d.cts.map +1 -0
  60. package/dist/channels/named_barrier_value.d.ts +32 -29
  61. package/dist/channels/named_barrier_value.d.ts.map +1 -0
  62. package/dist/channels/named_barrier_value.js +111 -163
  63. package/dist/channels/named_barrier_value.js.map +1 -1
  64. package/dist/channels/topic.cjs +63 -96
  65. package/dist/channels/topic.cjs.map +1 -0
  66. package/dist/channels/topic.d.cts +32 -0
  67. package/dist/channels/topic.d.cts.map +1 -0
  68. package/dist/channels/topic.d.ts +28 -19
  69. package/dist/channels/topic.d.ts.map +1 -0
  70. package/dist/channels/topic.js +61 -90
  71. package/dist/channels/topic.js.map +1 -1
  72. package/dist/constants.cjs +376 -452
  73. package/dist/constants.cjs.map +1 -0
  74. package/dist/constants.d.cts +285 -0
  75. package/dist/constants.d.cts.map +1 -0
  76. package/dist/constants.d.ts +113 -148
  77. package/dist/constants.d.ts.map +1 -0
  78. package/dist/constants.js +336 -444
  79. package/dist/constants.js.map +1 -1
  80. package/dist/errors.cjs +151 -179
  81. package/dist/errors.cjs.map +1 -0
  82. package/dist/errors.d.cts +81 -0
  83. package/dist/errors.d.cts.map +1 -0
  84. package/dist/errors.d.ts +56 -46
  85. package/dist/errors.d.ts.map +1 -0
  86. package/dist/errors.js +140 -165
  87. package/dist/errors.js.map +1 -1
  88. package/dist/func/index.cjs +292 -290
  89. package/dist/func/index.cjs.map +1 -0
  90. package/dist/func/index.d.cts +293 -0
  91. package/dist/func/index.d.cts.map +1 -0
  92. package/dist/func/index.d.ts +86 -72
  93. package/dist/func/index.d.ts.map +1 -0
  94. package/dist/func/index.js +288 -284
  95. package/dist/func/index.js.map +1 -1
  96. package/dist/func/types.d.cts +64 -0
  97. package/dist/func/types.d.cts.map +1 -0
  98. package/dist/func/types.d.ts +24 -19
  99. package/dist/func/types.d.ts.map +1 -0
  100. package/dist/graph/annotation.cjs +96 -120
  101. package/dist/graph/annotation.cjs.map +1 -0
  102. package/dist/graph/annotation.d.cts +116 -0
  103. package/dist/graph/annotation.d.cts.map +1 -0
  104. package/dist/graph/annotation.d.ts +33 -34
  105. package/dist/graph/annotation.d.ts.map +1 -0
  106. package/dist/graph/annotation.js +91 -112
  107. package/dist/graph/annotation.js.map +1 -1
  108. package/dist/graph/graph.cjs +419 -723
  109. package/dist/graph/graph.cjs.map +1 -0
  110. package/dist/graph/graph.d.cts +133 -0
  111. package/dist/graph/graph.d.cts.map +1 -0
  112. package/dist/graph/graph.d.ts +124 -91
  113. package/dist/graph/graph.d.ts.map +1 -0
  114. package/dist/graph/graph.js +412 -713
  115. package/dist/graph/graph.js.map +1 -1
  116. package/dist/graph/index.cjs +4 -17
  117. package/dist/graph/index.js +6 -5
  118. package/dist/graph/message.cjs +59 -104
  119. package/dist/graph/message.cjs.map +1 -0
  120. package/dist/graph/message.d.cts +19 -0
  121. package/dist/graph/message.d.cts.map +1 -0
  122. package/dist/graph/message.d.ts +11 -10
  123. package/dist/graph/message.d.ts.map +1 -0
  124. package/dist/graph/message.js +56 -98
  125. package/dist/graph/message.js.map +1 -1
  126. package/dist/graph/messages_annotation.cjs +106 -106
  127. package/dist/graph/messages_annotation.cjs.map +1 -0
  128. package/dist/graph/messages_annotation.d.cts +111 -0
  129. package/dist/graph/messages_annotation.d.cts.map +1 -0
  130. package/dist/graph/messages_annotation.d.ts +18 -9
  131. package/dist/graph/messages_annotation.d.ts.map +1 -0
  132. package/dist/graph/messages_annotation.js +100 -100
  133. package/dist/graph/messages_annotation.js.map +1 -1
  134. package/dist/graph/state.cjs +475 -779
  135. package/dist/graph/state.cjs.map +1 -0
  136. package/dist/graph/state.d.cts +231 -0
  137. package/dist/graph/state.d.cts.map +1 -0
  138. package/dist/graph/state.d.ts +148 -138
  139. package/dist/graph/state.d.ts.map +1 -0
  140. package/dist/graph/state.js +469 -769
  141. package/dist/graph/state.js.map +1 -1
  142. package/dist/graph/zod/index.cjs +10 -21
  143. package/dist/graph/zod/index.d.cts +3 -0
  144. package/dist/graph/zod/index.d.ts +3 -3
  145. package/dist/graph/zod/index.js +4 -4
  146. package/dist/graph/zod/meta.cjs +142 -177
  147. package/dist/graph/zod/meta.cjs.map +1 -0
  148. package/dist/graph/zod/meta.d.cts +116 -0
  149. package/dist/graph/zod/meta.d.cts.map +1 -0
  150. package/dist/graph/zod/meta.d.ts +99 -97
  151. package/dist/graph/zod/meta.d.ts.map +1 -0
  152. package/dist/graph/zod/meta.js +136 -170
  153. package/dist/graph/zod/meta.js.map +1 -1
  154. package/dist/graph/zod/plugin.cjs +36 -39
  155. package/dist/graph/zod/plugin.cjs.map +1 -0
  156. package/dist/graph/zod/plugin.js +34 -35
  157. package/dist/graph/zod/plugin.js.map +1 -1
  158. package/dist/graph/zod/schema.cjs +82 -110
  159. package/dist/graph/zod/schema.cjs.map +1 -0
  160. package/dist/graph/zod/schema.d.cts +38 -0
  161. package/dist/graph/zod/schema.d.cts.map +1 -0
  162. package/dist/graph/zod/schema.d.ts +12 -6
  163. package/dist/graph/zod/schema.d.ts.map +1 -0
  164. package/dist/graph/zod/schema.js +77 -103
  165. package/dist/graph/zod/schema.js.map +1 -1
  166. package/dist/graph/zod/zod-registry.cjs +41 -47
  167. package/dist/graph/zod/zod-registry.cjs.map +1 -0
  168. package/dist/graph/zod/zod-registry.d.cts +51 -0
  169. package/dist/graph/zod/zod-registry.d.cts.map +1 -0
  170. package/dist/graph/zod/zod-registry.d.ts +34 -26
  171. package/dist/graph/zod/zod-registry.d.ts.map +1 -0
  172. package/dist/graph/zod/zod-registry.js +37 -41
  173. package/dist/graph/zod/zod-registry.js.map +1 -1
  174. package/dist/hash.cjs +205 -267
  175. package/dist/hash.cjs.map +1 -0
  176. package/dist/hash.js +205 -265
  177. package/dist/hash.js.map +1 -1
  178. package/dist/index.cjs +111 -33
  179. package/dist/index.cjs.map +1 -0
  180. package/dist/index.d.cts +26 -0
  181. package/dist/index.d.ts +26 -5
  182. package/dist/index.js +19 -7
  183. package/dist/index.js.map +1 -1
  184. package/dist/interrupt.cjs +79 -85
  185. package/dist/interrupt.cjs.map +1 -0
  186. package/dist/interrupt.d.cts +49 -0
  187. package/dist/interrupt.d.cts.map +1 -0
  188. package/dist/interrupt.d.ts +6 -1
  189. package/dist/interrupt.d.ts.map +1 -0
  190. package/dist/interrupt.js +76 -80
  191. package/dist/interrupt.js.map +1 -1
  192. package/dist/prebuilt/agentName.cjs +139 -172
  193. package/dist/prebuilt/agentName.cjs.map +1 -0
  194. package/dist/prebuilt/agentName.d.cts +42 -0
  195. package/dist/prebuilt/agentName.d.cts.map +1 -0
  196. package/dist/prebuilt/agentName.d.ts +13 -21
  197. package/dist/prebuilt/agentName.d.ts.map +1 -0
  198. package/dist/prebuilt/agentName.js +139 -168
  199. package/dist/prebuilt/agentName.js.map +1 -1
  200. package/dist/prebuilt/agent_executor.cjs +42 -80
  201. package/dist/prebuilt/agent_executor.cjs.map +1 -0
  202. package/dist/prebuilt/agent_executor.d.cts +57 -0
  203. package/dist/prebuilt/agent_executor.d.cts.map +1 -0
  204. package/dist/prebuilt/agent_executor.d.ts +47 -38
  205. package/dist/prebuilt/agent_executor.d.ts.map +1 -0
  206. package/dist/prebuilt/agent_executor.js +40 -75
  207. package/dist/prebuilt/agent_executor.js.map +1 -1
  208. package/dist/prebuilt/chat_agent_executor.cjs +66 -128
  209. package/dist/prebuilt/chat_agent_executor.cjs.map +1 -0
  210. package/dist/prebuilt/chat_agent_executor.d.cts +23 -0
  211. package/dist/prebuilt/chat_agent_executor.d.cts.map +1 -0
  212. package/dist/prebuilt/chat_agent_executor.d.ts +18 -10
  213. package/dist/prebuilt/chat_agent_executor.d.ts.map +1 -0
  214. package/dist/prebuilt/chat_agent_executor.js +63 -123
  215. package/dist/prebuilt/chat_agent_executor.js.map +1 -1
  216. package/dist/prebuilt/index.cjs +15 -18
  217. package/dist/prebuilt/index.d.cts +8 -0
  218. package/dist/prebuilt/index.d.ts +8 -8
  219. package/dist/prebuilt/index.js +8 -7
  220. package/dist/prebuilt/interrupt.d.cts +73 -0
  221. package/dist/prebuilt/interrupt.d.cts.map +1 -0
  222. package/dist/prebuilt/interrupt.d.ts +32 -15
  223. package/dist/prebuilt/interrupt.d.ts.map +1 -0
  224. package/dist/prebuilt/react_agent_executor.cjs +317 -473
  225. package/dist/prebuilt/react_agent_executor.cjs.map +1 -0
  226. package/dist/prebuilt/react_agent_executor.d.cts +229 -0
  227. package/dist/prebuilt/react_agent_executor.d.cts.map +1 -0
  228. package/dist/prebuilt/react_agent_executor.d.ts +171 -143
  229. package/dist/prebuilt/react_agent_executor.d.ts.map +1 -0
  230. package/dist/prebuilt/react_agent_executor.js +315 -465
  231. package/dist/prebuilt/react_agent_executor.js.map +1 -1
  232. package/dist/prebuilt/tool_executor.cjs +45 -67
  233. package/dist/prebuilt/tool_executor.cjs.map +1 -0
  234. package/dist/prebuilt/tool_executor.d.cts +42 -0
  235. package/dist/prebuilt/tool_executor.d.cts.map +1 -0
  236. package/dist/prebuilt/tool_executor.d.ts +30 -24
  237. package/dist/prebuilt/tool_executor.d.ts.map +1 -0
  238. package/dist/prebuilt/tool_executor.js +44 -63
  239. package/dist/prebuilt/tool_executor.js.map +1 -1
  240. package/dist/prebuilt/tool_node.cjs +213 -275
  241. package/dist/prebuilt/tool_node.cjs.map +1 -0
  242. package/dist/prebuilt/tool_node.d.cts +151 -0
  243. package/dist/prebuilt/tool_node.d.cts.map +1 -0
  244. package/dist/prebuilt/tool_node.d.ts +30 -17
  245. package/dist/prebuilt/tool_node.d.ts.map +1 -0
  246. package/dist/prebuilt/tool_node.js +209 -268
  247. package/dist/prebuilt/tool_node.js.map +1 -1
  248. package/dist/pregel/algo.cjs +551 -692
  249. package/dist/pregel/algo.cjs.map +1 -0
  250. package/dist/pregel/algo.d.cts +13 -0
  251. package/dist/pregel/algo.d.cts.map +1 -0
  252. package/dist/pregel/algo.d.ts +8 -38
  253. package/dist/pregel/algo.d.ts.map +1 -0
  254. package/dist/pregel/algo.js +546 -683
  255. package/dist/pregel/algo.js.map +1 -1
  256. package/dist/pregel/call.cjs +46 -42
  257. package/dist/pregel/call.cjs.map +1 -0
  258. package/dist/pregel/call.js +43 -37
  259. package/dist/pregel/call.js.map +1 -1
  260. package/dist/pregel/debug.cjs +153 -223
  261. package/dist/pregel/debug.cjs.map +1 -0
  262. package/dist/pregel/debug.js +152 -215
  263. package/dist/pregel/debug.js.map +1 -1
  264. package/dist/pregel/index.cjs +1138 -1604
  265. package/dist/pregel/index.cjs.map +1 -0
  266. package/dist/pregel/index.d.cts +536 -0
  267. package/dist/pregel/index.d.cts.map +1 -0
  268. package/dist/pregel/index.d.ts +460 -422
  269. package/dist/pregel/index.d.ts.map +1 -0
  270. package/dist/pregel/index.js +1129 -1592
  271. package/dist/pregel/index.js.map +1 -1
  272. package/dist/pregel/io.cjs +127 -234
  273. package/dist/pregel/io.cjs.map +1 -0
  274. package/dist/pregel/io.js +122 -225
  275. package/dist/pregel/io.js.map +1 -1
  276. package/dist/pregel/loop.cjs +542 -954
  277. package/dist/pregel/loop.cjs.map +1 -0
  278. package/dist/pregel/loop.js +539 -948
  279. package/dist/pregel/loop.js.map +1 -1
  280. package/dist/pregel/messages.cjs +104 -196
  281. package/dist/pregel/messages.cjs.map +1 -0
  282. package/dist/pregel/messages.js +102 -191
  283. package/dist/pregel/messages.js.map +1 -1
  284. package/dist/pregel/read.cjs +150 -280
  285. package/dist/pregel/read.cjs.map +1 -0
  286. package/dist/pregel/read.d.cts +51 -0
  287. package/dist/pregel/read.d.cts.map +1 -0
  288. package/dist/pregel/read.d.ts +48 -46
  289. package/dist/pregel/read.d.ts.map +1 -0
  290. package/dist/pregel/read.js +147 -274
  291. package/dist/pregel/read.js.map +1 -1
  292. package/dist/pregel/remote.cjs +339 -458
  293. package/dist/pregel/remote.cjs.map +1 -0
  294. package/dist/pregel/remote.d.cts +121 -0
  295. package/dist/pregel/remote.d.cts.map +1 -0
  296. package/dist/pregel/remote.d.ts +79 -69
  297. package/dist/pregel/remote.d.ts.map +1 -0
  298. package/dist/pregel/remote.js +337 -453
  299. package/dist/pregel/remote.js.map +1 -1
  300. package/dist/pregel/retry.cjs +87 -138
  301. package/dist/pregel/retry.cjs.map +1 -0
  302. package/dist/pregel/retry.js +83 -130
  303. package/dist/pregel/retry.js.map +1 -1
  304. package/dist/pregel/runnable_types.d.cts +49 -0
  305. package/dist/pregel/runnable_types.d.cts.map +1 -0
  306. package/dist/pregel/runnable_types.d.ts +47 -17
  307. package/dist/pregel/runnable_types.d.ts.map +1 -0
  308. package/dist/pregel/runner.cjs +222 -315
  309. package/dist/pregel/runner.cjs.map +1 -0
  310. package/dist/pregel/runner.js +219 -308
  311. package/dist/pregel/runner.js.map +1 -1
  312. package/dist/pregel/stream.cjs +89 -130
  313. package/dist/pregel/stream.cjs.map +1 -0
  314. package/dist/pregel/stream.js +87 -125
  315. package/dist/pregel/stream.js.map +1 -1
  316. package/dist/pregel/types.cjs +25 -62
  317. package/dist/pregel/types.cjs.map +1 -0
  318. package/dist/pregel/types.d.cts +440 -0
  319. package/dist/pregel/types.d.cts.map +1 -0
  320. package/dist/pregel/types.d.ts +381 -432
  321. package/dist/pregel/types.d.ts.map +1 -0
  322. package/dist/pregel/types.js +23 -57
  323. package/dist/pregel/types.js.map +1 -1
  324. package/dist/pregel/utils/config.cjs +101 -147
  325. package/dist/pregel/utils/config.cjs.map +1 -0
  326. package/dist/pregel/utils/config.d.cts +36 -0
  327. package/dist/pregel/utils/config.d.cts.map +1 -0
  328. package/dist/pregel/utils/config.d.ts +12 -9
  329. package/dist/pregel/utils/config.d.ts.map +1 -0
  330. package/dist/pregel/utils/config.js +99 -143
  331. package/dist/pregel/utils/config.js.map +1 -1
  332. package/dist/pregel/utils/index.cjs +87 -125
  333. package/dist/pregel/utils/index.cjs.map +1 -0
  334. package/dist/pregel/utils/index.d.cts +51 -0
  335. package/dist/pregel/utils/index.d.cts.map +1 -0
  336. package/dist/pregel/utils/index.d.ts +45 -61
  337. package/dist/pregel/utils/index.d.ts.map +1 -0
  338. package/dist/pregel/utils/index.js +86 -120
  339. package/dist/pregel/utils/index.js.map +1 -1
  340. package/dist/pregel/utils/subgraph.cjs +15 -26
  341. package/dist/pregel/utils/subgraph.cjs.map +1 -0
  342. package/dist/pregel/utils/subgraph.js +12 -21
  343. package/dist/pregel/utils/subgraph.js.map +1 -1
  344. package/dist/pregel/validate.cjs +42 -92
  345. package/dist/pregel/validate.cjs.map +1 -0
  346. package/dist/pregel/validate.js +39 -84
  347. package/dist/pregel/validate.js.map +1 -1
  348. package/dist/pregel/write.cjs +87 -137
  349. package/dist/pregel/write.cjs.map +1 -0
  350. package/dist/pregel/write.d.cts +35 -0
  351. package/dist/pregel/write.d.cts.map +1 -0
  352. package/dist/pregel/write.d.ts +27 -23
  353. package/dist/pregel/write.d.ts.map +1 -0
  354. package/dist/pregel/write.js +83 -131
  355. package/dist/pregel/write.js.map +1 -1
  356. package/dist/remote.cjs +3 -6
  357. package/dist/remote.d.cts +2 -0
  358. package/dist/remote.d.ts +2 -1
  359. package/dist/remote.js +3 -2
  360. package/dist/setup/async_local_storage.cjs +10 -7
  361. package/dist/setup/async_local_storage.cjs.map +1 -0
  362. package/dist/setup/async_local_storage.js +7 -2
  363. package/dist/setup/async_local_storage.js.map +1 -1
  364. package/dist/ui/index.cjs +4 -0
  365. package/dist/ui/index.d.cts +5 -0
  366. package/dist/ui/index.d.ts +5 -0
  367. package/dist/ui/index.js +3 -0
  368. package/dist/ui/stream.cjs +145 -0
  369. package/dist/ui/stream.cjs.map +1 -0
  370. package/dist/ui/stream.d.cts +25 -0
  371. package/dist/ui/stream.d.cts.map +1 -0
  372. package/dist/ui/stream.d.ts +25 -0
  373. package/dist/ui/stream.d.ts.map +1 -0
  374. package/dist/ui/stream.js +143 -0
  375. package/dist/ui/stream.js.map +1 -0
  376. package/dist/ui/types.infer.d.cts +53 -0
  377. package/dist/ui/types.infer.d.cts.map +1 -0
  378. package/dist/ui/types.infer.d.ts +53 -0
  379. package/dist/ui/types.infer.d.ts.map +1 -0
  380. package/dist/ui/types.message.d.cts +95 -0
  381. package/dist/ui/types.message.d.cts.map +1 -0
  382. package/dist/ui/types.message.d.ts +95 -0
  383. package/dist/ui/types.message.d.ts.map +1 -0
  384. package/dist/ui/types.schema.d.cts +228 -0
  385. package/dist/ui/types.schema.d.cts.map +1 -0
  386. package/dist/ui/types.schema.d.ts +228 -0
  387. package/dist/ui/types.schema.d.ts.map +1 -0
  388. package/dist/utils.cjs +77 -147
  389. package/dist/utils.cjs.map +1 -0
  390. package/dist/utils.d.cts +32 -0
  391. package/dist/utils.d.cts.map +1 -0
  392. package/dist/utils.d.ts +29 -25
  393. package/dist/utils.d.ts.map +1 -0
  394. package/dist/utils.js +73 -140
  395. package/dist/utils.js.map +1 -1
  396. package/dist/web.cjs +96 -55
  397. package/dist/web.d.cts +23 -0
  398. package/dist/web.d.ts +23 -14
  399. package/dist/web.js +15 -8
  400. package/dist/writer.cjs +15 -0
  401. package/dist/writer.cjs.map +1 -0
  402. package/dist/writer.d.cts +5 -0
  403. package/dist/writer.d.cts.map +1 -0
  404. package/dist/writer.d.ts +5 -0
  405. package/dist/writer.d.ts.map +1 -0
  406. package/dist/writer.js +14 -0
  407. package/dist/writer.js.map +1 -0
  408. package/package.json +90 -83
  409. package/dist/channels/index.js.map +0 -1
  410. package/dist/func/types.cjs +0 -15
  411. package/dist/func/types.js +0 -12
  412. package/dist/func/types.js.map +0 -1
  413. package/dist/graph/index.d.ts +0 -4
  414. package/dist/graph/index.js.map +0 -1
  415. package/dist/graph/message.test.cjs +0 -196
  416. package/dist/graph/message.test.d.ts +0 -1
  417. package/dist/graph/message.test.js +0 -194
  418. package/dist/graph/message.test.js.map +0 -1
  419. package/dist/graph/zod/index.js.map +0 -1
  420. package/dist/graph/zod/plugin.d.ts +0 -28
  421. package/dist/hash.d.ts +0 -2
  422. package/dist/prebuilt/index.js.map +0 -1
  423. package/dist/prebuilt/interrupt.cjs +0 -3
  424. package/dist/prebuilt/interrupt.js +0 -2
  425. package/dist/prebuilt/interrupt.js.map +0 -1
  426. package/dist/pregel/call.d.ts +0 -16
  427. package/dist/pregel/debug.d.ts +0 -41
  428. package/dist/pregel/debug.test.cjs +0 -258
  429. package/dist/pregel/debug.test.d.ts +0 -1
  430. package/dist/pregel/debug.test.js +0 -256
  431. package/dist/pregel/debug.test.js.map +0 -1
  432. package/dist/pregel/io.d.ts +0 -30
  433. package/dist/pregel/io.mapCommand.test.cjs +0 -150
  434. package/dist/pregel/io.mapCommand.test.d.ts +0 -1
  435. package/dist/pregel/io.mapCommand.test.js +0 -148
  436. package/dist/pregel/io.mapCommand.test.js.map +0 -1
  437. package/dist/pregel/loop.d.ts +0 -147
  438. package/dist/pregel/messages.d.ts +0 -30
  439. package/dist/pregel/messages.test.cjs +0 -369
  440. package/dist/pregel/messages.test.d.ts +0 -1
  441. package/dist/pregel/messages.test.js +0 -367
  442. package/dist/pregel/messages.test.js.map +0 -1
  443. package/dist/pregel/read.test.cjs +0 -194
  444. package/dist/pregel/read.test.d.ts +0 -1
  445. package/dist/pregel/read.test.js +0 -192
  446. package/dist/pregel/read.test.js.map +0 -1
  447. package/dist/pregel/retry.d.ts +0 -17
  448. package/dist/pregel/runnable_types.cjs +0 -3
  449. package/dist/pregel/runnable_types.js +0 -2
  450. package/dist/pregel/runnable_types.js.map +0 -1
  451. package/dist/pregel/runner.d.ts +0 -79
  452. package/dist/pregel/runner.test.cjs +0 -66
  453. package/dist/pregel/runner.test.d.ts +0 -1
  454. package/dist/pregel/runner.test.js +0 -64
  455. package/dist/pregel/runner.test.js.map +0 -1
  456. package/dist/pregel/stream.d.ts +0 -40
  457. package/dist/pregel/utils/config.test.cjs +0 -214
  458. package/dist/pregel/utils/config.test.d.ts +0 -1
  459. package/dist/pregel/utils/config.test.js +0 -212
  460. package/dist/pregel/utils/config.test.js.map +0 -1
  461. package/dist/pregel/utils/subgraph.d.ts +0 -4
  462. package/dist/pregel/utils/subgraph.test.cjs +0 -83
  463. package/dist/pregel/utils/subgraph.test.d.ts +0 -1
  464. package/dist/pregel/utils/subgraph.test.js +0 -81
  465. package/dist/pregel/utils/subgraph.test.js.map +0 -1
  466. package/dist/pregel/validate.d.ts +0 -16
  467. package/dist/pregel/validate.test.cjs +0 -220
  468. package/dist/pregel/validate.test.d.ts +0 -1
  469. package/dist/pregel/validate.test.js +0 -218
  470. package/dist/pregel/validate.test.js.map +0 -1
  471. package/dist/pregel/write.test.cjs +0 -181
  472. package/dist/pregel/write.test.d.ts +0 -1
  473. package/dist/pregel/write.test.js +0 -179
  474. package/dist/pregel/write.test.js.map +0 -1
  475. package/dist/remote.js.map +0 -1
  476. package/dist/setup/async_local_storage.d.ts +0 -1
  477. package/dist/web.js.map +0 -1
  478. package/index.cjs +0 -1
  479. package/index.d.cts +0 -1
  480. package/index.d.ts +0 -1
  481. package/index.js +0 -1
  482. package/prebuilt.cjs +0 -1
  483. package/prebuilt.d.cts +0 -1
  484. package/prebuilt.d.ts +0 -1
  485. package/prebuilt.js +0 -1
  486. package/pregel.cjs +0 -1
  487. package/pregel.d.cts +0 -1
  488. package/pregel.d.ts +0 -1
  489. package/pregel.js +0 -1
  490. package/remote.cjs +0 -1
  491. package/remote.d.cts +0 -1
  492. package/remote.d.ts +0 -1
  493. package/remote.js +0 -1
  494. package/web.cjs +0 -1
  495. package/web.d.cts +0 -1
  496. package/web.d.ts +0 -1
  497. package/web.js +0 -1
  498. package/zod/schema.cjs +0 -1
  499. package/zod/schema.d.cts +0 -1
  500. package/zod/schema.d.ts +0 -1
  501. package/zod/schema.js +0 -1
  502. package/zod.cjs +0 -1
  503. package/zod.d.cts +0 -1
  504. package/zod.d.ts +0 -1
  505. package/zod.js +0 -1
@@ -1,127 +1,67 @@
1
- import { convertToOpenAIFunction } from "@langchain/core/utils/function_calling";
2
- import { FunctionMessage } from "@langchain/core/messages";
3
- import { RunnableLambda, } from "@langchain/core/runnables";
4
- import { ToolExecutor } from "./tool_executor.js";
5
- import { StateGraph, } from "../graph/state.js";
6
1
  import { END, START } from "../constants.js";
2
+ import { StateGraph } from "../graph/state.js";
3
+ import { ToolExecutor } from "./tool_executor.js";
4
+ import { RunnableLambda } from "@langchain/core/runnables";
5
+ import { FunctionMessage } from "@langchain/core/messages";
6
+ import { convertToOpenAIFunction } from "@langchain/core/utils/function_calling";
7
+
8
+ //#region src/prebuilt/chat_agent_executor.ts
7
9
  /** @deprecated Use {@link createReactAgent} instead with tool calling. */
8
- export function createFunctionCallingExecutor({ model, tools, }) {
9
- let toolExecutor;
10
- let toolClasses;
11
- if (!Array.isArray(tools)) {
12
- toolExecutor = tools;
13
- toolClasses = tools.tools;
14
- }
15
- else {
16
- toolExecutor = new ToolExecutor({
17
- tools,
18
- });
19
- toolClasses = tools;
20
- }
21
- if (!("bind" in model) || typeof model.bind !== "function") {
22
- throw new Error("Model must be bindable");
23
- }
24
- const toolsAsOpenAIFunctions = toolClasses.map((tool) => convertToOpenAIFunction(tool));
25
- const newModel = model.bind({
26
- functions: toolsAsOpenAIFunctions,
27
- });
28
- // Define the function that determines whether to continue or not
29
- const shouldContinue = (state) => {
30
- const { messages } = state;
31
- const lastMessage = messages[messages.length - 1];
32
- // If there is no function call, then we finish
33
- if (!("function_call" in lastMessage.additional_kwargs) ||
34
- !lastMessage.additional_kwargs.function_call) {
35
- return "end";
36
- }
37
- // Otherwise if there is, we continue
38
- return "continue";
39
- };
40
- // Define the function that calls the model
41
- const callModel = async (state, config) => {
42
- const { messages } = state;
43
- const response = await newModel.invoke(messages, config);
44
- // We return a list, because this will get added to the existing list
45
- return {
46
- messages: [response],
47
- };
48
- };
49
- // Define the function to execute tools
50
- const _getAction = (state) => {
51
- const { messages } = state;
52
- // Based on the continue condition
53
- // we know the last message involves a function call
54
- const lastMessage = messages[messages.length - 1];
55
- if (!lastMessage) {
56
- throw new Error("No messages found.");
57
- }
58
- if (!lastMessage.additional_kwargs.function_call) {
59
- throw new Error("No function call found in message.");
60
- }
61
- // We construct an AgentAction from the function_call
62
- return {
63
- tool: lastMessage.additional_kwargs.function_call.name,
64
- toolInput: JSON.stringify(lastMessage.additional_kwargs.function_call.arguments),
65
- log: "",
66
- };
67
- };
68
- const callTool = async (state, config) => {
69
- const action = _getAction(state);
70
- // We call the tool_executor and get back a response
71
- const response = await toolExecutor.invoke(action, config);
72
- // We use the response to create a FunctionMessage
73
- const functionMessage = new FunctionMessage({
74
- content: response,
75
- name: action.tool,
76
- });
77
- // We return a list, because this will get added to the existing list
78
- return { messages: [functionMessage] };
79
- };
80
- // We create the AgentState that we will pass around
81
- // This simply involves a list of messages
82
- // We want steps to return messages to append to the list
83
- // So we annotate the messages attribute with operator.add
84
- const schema = {
85
- messages: {
86
- value: (x, y) => x.concat(y),
87
- default: () => [],
88
- },
89
- };
90
- // Define a new graph
91
- const workflow = new StateGraph({
92
- channels: schema,
93
- })
94
- // Define the two nodes we will cycle between
95
- .addNode("agent", new RunnableLambda({ func: callModel }))
96
- .addNode("action", new RunnableLambda({ func: callTool }))
97
- // Set the entrypoint as `agent`
98
- // This means that this node is the first one called
99
- .addEdge(START, "agent")
100
- // We now add a conditional edge
101
- .addConditionalEdges(
102
- // First, we define the start node. We use `agent`.
103
- // This means these are the edges taken after the `agent` node is called.
104
- "agent",
105
- // Next, we pass in the function that will determine which node is called next.
106
- shouldContinue,
107
- // Finally we pass in a mapping.
108
- // The keys are strings, and the values are other nodes.
109
- // END is a special node marking that the graph should finish.
110
- // What will happen is we will call `should_continue`, and then the output of that
111
- // will be matched against the keys in this mapping.
112
- // Based on which one it matches, that node will then be called.
113
- {
114
- // If `tools`, then we call the tool node.
115
- continue: "action",
116
- // Otherwise we finish.
117
- end: END,
118
- })
119
- // We now add a normal edge from `tools` to `agent`.
120
- // This means that after `tools` is called, `agent` node is called next.
121
- .addEdge("action", "agent");
122
- // Finally, we compile it!
123
- // This compiles it into a LangChain Runnable,
124
- // meaning you can use it as you would any other runnable
125
- return workflow.compile();
10
+ function createFunctionCallingExecutor({ model, tools }) {
11
+ let toolExecutor;
12
+ let toolClasses;
13
+ if (!Array.isArray(tools)) {
14
+ toolExecutor = tools;
15
+ toolClasses = tools.tools;
16
+ } else {
17
+ toolExecutor = new ToolExecutor({ tools });
18
+ toolClasses = tools;
19
+ }
20
+ if (!("bind" in model) || typeof model.bind !== "function") throw new Error("Model must be bindable");
21
+ const toolsAsOpenAIFunctions = toolClasses.map((tool) => convertToOpenAIFunction(tool));
22
+ const newModel = model.bind({ functions: toolsAsOpenAIFunctions });
23
+ const shouldContinue = (state) => {
24
+ const { messages } = state;
25
+ const lastMessage = messages[messages.length - 1];
26
+ if (!("function_call" in lastMessage.additional_kwargs) || !lastMessage.additional_kwargs.function_call) return "end";
27
+ return "continue";
28
+ };
29
+ const callModel = async (state, config) => {
30
+ const { messages } = state;
31
+ const response = await newModel.invoke(messages, config);
32
+ return { messages: [response] };
33
+ };
34
+ const _getAction = (state) => {
35
+ const { messages } = state;
36
+ const lastMessage = messages[messages.length - 1];
37
+ if (!lastMessage) throw new Error("No messages found.");
38
+ if (!lastMessage.additional_kwargs.function_call) throw new Error("No function call found in message.");
39
+ return {
40
+ tool: lastMessage.additional_kwargs.function_call.name,
41
+ toolInput: JSON.stringify(lastMessage.additional_kwargs.function_call.arguments),
42
+ log: ""
43
+ };
44
+ };
45
+ const callTool = async (state, config) => {
46
+ const action = _getAction(state);
47
+ const response = await toolExecutor.invoke(action, config);
48
+ const functionMessage = new FunctionMessage({
49
+ content: response,
50
+ name: action.tool
51
+ });
52
+ return { messages: [functionMessage] };
53
+ };
54
+ const schema = { messages: {
55
+ value: (x, y) => x.concat(y),
56
+ default: () => []
57
+ } };
58
+ const workflow = new StateGraph({ channels: schema }).addNode("agent", new RunnableLambda({ func: callModel })).addNode("action", new RunnableLambda({ func: callTool })).addEdge(START, "agent").addConditionalEdges("agent", shouldContinue, {
59
+ continue: "action",
60
+ end: END
61
+ }).addEdge("action", "agent");
62
+ return workflow.compile();
126
63
  }
64
+
65
+ //#endregion
66
+ export { createFunctionCallingExecutor };
127
67
  //# sourceMappingURL=chat_agent_executor.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"chat_agent_executor.js","sourceRoot":"","sources":["../../src/prebuilt/chat_agent_executor.ts"],"names":[],"mappings":"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"}
1
+ {"version":3,"file":"chat_agent_executor.js","names":["toolExecutor: ToolExecutor","toolClasses: Array<StructuredToolInterface | RunnableToolLike>","schema: StateGraphArgs<FunctionCallingExecutorState>[\"channels\"]"],"sources":["../../src/prebuilt/chat_agent_executor.ts"],"sourcesContent":["import { StructuredToolInterface } from \"@langchain/core/tools\";\nimport { convertToOpenAIFunction } from \"@langchain/core/utils/function_calling\";\nimport { AgentAction } from \"@langchain/core/agents\";\nimport { FunctionMessage, BaseMessage } from \"@langchain/core/messages\";\nimport {\n type RunnableConfig,\n RunnableLambda,\n RunnableToolLike,\n} from \"@langchain/core/runnables\";\nimport { ToolExecutor } from \"./tool_executor.js\";\nimport {\n CompiledStateGraph,\n StateGraph,\n StateGraphArgs,\n} from \"../graph/state.js\";\nimport { END, START } from \"../constants.js\";\n\n/** @deprecated Use {@link createReactAgent} instead with tool calling. */\nexport type FunctionCallingExecutorState = { messages: Array<BaseMessage> };\n\n/** @deprecated Use {@link createReactAgent} instead with tool calling. */\nexport function createFunctionCallingExecutor<Model extends object>({\n model,\n tools,\n}: {\n model: Model;\n tools: Array<StructuredToolInterface | RunnableToolLike> | ToolExecutor;\n}): CompiledStateGraph<\n FunctionCallingExecutorState,\n Partial<FunctionCallingExecutorState>,\n typeof START | \"agent\" | \"action\"\n> {\n let toolExecutor: ToolExecutor;\n let toolClasses: Array<StructuredToolInterface | RunnableToolLike>;\n if (!Array.isArray(tools)) {\n toolExecutor = tools;\n toolClasses = tools.tools;\n } else {\n toolExecutor = new ToolExecutor({\n tools,\n });\n toolClasses = tools;\n }\n\n if (!(\"bind\" in model) || typeof model.bind !== \"function\") {\n throw new Error(\"Model must be bindable\");\n }\n const toolsAsOpenAIFunctions = toolClasses.map((tool) =>\n convertToOpenAIFunction(tool)\n );\n const newModel = model.bind({\n functions: toolsAsOpenAIFunctions,\n });\n\n // Define the function that determines whether to continue or not\n const shouldContinue = (state: FunctionCallingExecutorState) => {\n const { messages } = state;\n const lastMessage = messages[messages.length - 1];\n // If there is no function call, then we finish\n if (\n !(\"function_call\" in lastMessage.additional_kwargs) ||\n !lastMessage.additional_kwargs.function_call\n ) {\n return \"end\";\n }\n // Otherwise if there is, we continue\n return \"continue\";\n };\n\n // Define the function that calls the model\n const callModel = async (\n state: FunctionCallingExecutorState,\n config?: RunnableConfig\n ) => {\n const { messages } = state;\n const response = await newModel.invoke(messages, config);\n // We return a list, because this will get added to the existing list\n return {\n messages: [response],\n };\n };\n\n // Define the function to execute tools\n const _getAction = (state: FunctionCallingExecutorState): AgentAction => {\n const { messages } = state;\n // Based on the continue condition\n // we know the last message involves a function call\n const lastMessage = messages[messages.length - 1];\n if (!lastMessage) {\n throw new Error(\"No messages found.\");\n }\n if (!lastMessage.additional_kwargs.function_call) {\n throw new Error(\"No function call found in message.\");\n }\n // We construct an AgentAction from the function_call\n return {\n tool: lastMessage.additional_kwargs.function_call.name,\n toolInput: JSON.stringify(\n lastMessage.additional_kwargs.function_call.arguments\n ),\n log: \"\",\n };\n };\n\n const callTool = async (\n state: FunctionCallingExecutorState,\n config?: RunnableConfig\n ) => {\n const action = _getAction(state);\n // We call the tool_executor and get back a response\n const response = await toolExecutor.invoke(action, config);\n // We use the response to create a FunctionMessage\n const functionMessage = new FunctionMessage({\n content: response,\n name: action.tool,\n });\n // We return a list, because this will get added to the existing list\n return { messages: [functionMessage] };\n };\n\n // We create the AgentState that we will pass around\n // This simply involves a list of messages\n // We want steps to return messages to append to the list\n // So we annotate the messages attribute with operator.add\n const schema: StateGraphArgs<FunctionCallingExecutorState>[\"channels\"] = {\n messages: {\n value: (x: BaseMessage[], y: BaseMessage[]) => x.concat(y),\n default: () => [],\n },\n };\n\n // Define a new graph\n const workflow = new StateGraph<FunctionCallingExecutorState>({\n channels: schema,\n })\n // Define the two nodes we will cycle between\n .addNode(\"agent\", new RunnableLambda({ func: callModel }))\n .addNode(\"action\", new RunnableLambda({ func: callTool }))\n // Set the entrypoint as `agent`\n // This means that this node is the first one called\n .addEdge(START, \"agent\")\n // We now add a conditional edge\n .addConditionalEdges(\n // First, we define the start node. We use `agent`.\n // This means these are the edges taken after the `agent` node is called.\n \"agent\",\n // Next, we pass in the function that will determine which node is called next.\n shouldContinue,\n // Finally we pass in a mapping.\n // The keys are strings, and the values are other nodes.\n // END is a special node marking that the graph should finish.\n // What will happen is we will call `should_continue`, and then the output of that\n // will be matched against the keys in this mapping.\n // Based on which one it matches, that node will then be called.\n {\n // If `tools`, then we call the tool node.\n continue: \"action\",\n // Otherwise we finish.\n end: END,\n }\n )\n // We now add a normal edge from `tools` to `agent`.\n // This means that after `tools` is called, `agent` node is called next.\n .addEdge(\"action\", \"agent\");\n\n // Finally, we compile it!\n // This compiles it into a LangChain Runnable,\n // meaning you can use it as you would any other runnable\n return workflow.compile();\n}\n"],"mappings":";;;;;;;;;AAqBA,SAAgB,8BAAoD,EAClE,OACA,SAQA;CACA,IAAIA;CACJ,IAAIC;AACJ,KAAI,CAAC,MAAM,QAAQ,QAAQ;AACzB,iBAAe;AACf,gBAAc,MAAM;QACf;AACL,iBAAe,IAAI,aAAa,EAC9B;AAEF,gBAAc;;AAGhB,KAAI,EAAE,UAAU,UAAU,OAAO,MAAM,SAAS,WAC9C,OAAM,IAAI,MAAM;CAElB,MAAM,yBAAyB,YAAY,KAAK,SAC9C,wBAAwB;CAE1B,MAAM,WAAW,MAAM,KAAK,EAC1B,WAAW;CAIb,MAAM,kBAAkB,UAAwC;EAC9D,MAAM,EAAE,aAAa;EACrB,MAAM,cAAc,SAAS,SAAS,SAAS;AAE/C,MACE,EAAE,mBAAmB,YAAY,sBACjC,CAAC,YAAY,kBAAkB,cAE/B,QAAO;AAGT,SAAO;;CAIT,MAAM,YAAY,OAChB,OACA,WACG;EACH,MAAM,EAAE,aAAa;EACrB,MAAM,WAAW,MAAM,SAAS,OAAO,UAAU;AAEjD,SAAO,EACL,UAAU,CAAC;;CAKf,MAAM,cAAc,UAAqD;EACvE,MAAM,EAAE,aAAa;EAGrB,MAAM,cAAc,SAAS,SAAS,SAAS;AAC/C,MAAI,CAAC,YACH,OAAM,IAAI,MAAM;AAElB,MAAI,CAAC,YAAY,kBAAkB,cACjC,OAAM,IAAI,MAAM;AAGlB,SAAO;GACL,MAAM,YAAY,kBAAkB,cAAc;GAClD,WAAW,KAAK,UACd,YAAY,kBAAkB,cAAc;GAE9C,KAAK;;;CAIT,MAAM,WAAW,OACf,OACA,WACG;EACH,MAAM,SAAS,WAAW;EAE1B,MAAM,WAAW,MAAM,aAAa,OAAO,QAAQ;EAEnD,MAAM,kBAAkB,IAAI,gBAAgB;GAC1C,SAAS;GACT,MAAM,OAAO;;AAGf,SAAO,EAAE,UAAU,CAAC;;CAOtB,MAAMC,SAAmE,EACvE,UAAU;EACR,QAAQ,GAAkB,MAAqB,EAAE,OAAO;EACxD,eAAe;;CAKnB,MAAM,WAAW,IAAI,WAAyC,EAC5D,UAAU,UAGT,QAAQ,SAAS,IAAI,eAAe,EAAE,MAAM,cAC5C,QAAQ,UAAU,IAAI,eAAe,EAAE,MAAM,aAG7C,QAAQ,OAAO,SAEf,oBAGC,SAEA,gBAOA;EAEE,UAAU;EAEV,KAAK;IAKR,QAAQ,UAAU;AAKrB,QAAO,SAAS"}
@@ -1,18 +1,15 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.withAgentName = exports.toolsCondition = exports.ToolNode = exports.ToolExecutor = exports.createReactAgentAnnotation = exports.createReactAgent = exports.createFunctionCallingExecutor = exports.createAgentExecutor = void 0;
4
- var agent_executor_js_1 = require("./agent_executor.cjs");
5
- Object.defineProperty(exports, "createAgentExecutor", { enumerable: true, get: function () { return agent_executor_js_1.createAgentExecutor; } });
6
- var chat_agent_executor_js_1 = require("./chat_agent_executor.cjs");
7
- Object.defineProperty(exports, "createFunctionCallingExecutor", { enumerable: true, get: function () { return chat_agent_executor_js_1.createFunctionCallingExecutor; } });
8
- var react_agent_executor_js_1 = require("./react_agent_executor.cjs");
9
- Object.defineProperty(exports, "createReactAgent", { enumerable: true, get: function () { return react_agent_executor_js_1.createReactAgent; } });
10
- Object.defineProperty(exports, "createReactAgentAnnotation", { enumerable: true, get: function () { return react_agent_executor_js_1.createReactAgentAnnotation; } });
11
- var tool_executor_js_1 = require("./tool_executor.cjs");
12
- Object.defineProperty(exports, "ToolExecutor", { enumerable: true, get: function () { return tool_executor_js_1.ToolExecutor; } });
13
- var tool_node_js_1 = require("./tool_node.cjs");
14
- Object.defineProperty(exports, "ToolNode", { enumerable: true, get: function () { return tool_node_js_1.ToolNode; } });
15
- Object.defineProperty(exports, "toolsCondition", { enumerable: true, get: function () { return tool_node_js_1.toolsCondition; } });
16
- var agentName_js_1 = require("./agentName.cjs");
17
- Object.defineProperty(exports, "withAgentName", { enumerable: true, get: function () { return agentName_js_1.withAgentName; } });
18
- //# sourceMappingURL=index.js.map
1
+ const require_tool_executor = require('./tool_executor.cjs');
2
+ const require_agent_executor = require('./agent_executor.cjs');
3
+ const require_chat_agent_executor = require('./chat_agent_executor.cjs');
4
+ const require_tool_node = require('./tool_node.cjs');
5
+ const require_agentName = require('./agentName.cjs');
6
+ const require_react_agent_executor = require('./react_agent_executor.cjs');
7
+
8
+ exports.ToolExecutor = require_tool_executor.ToolExecutor;
9
+ exports.ToolNode = require_tool_node.ToolNode;
10
+ exports.createAgentExecutor = require_agent_executor.createAgentExecutor;
11
+ exports.createFunctionCallingExecutor = require_chat_agent_executor.createFunctionCallingExecutor;
12
+ exports.createReactAgent = require_react_agent_executor.createReactAgent;
13
+ exports.createReactAgentAnnotation = require_react_agent_executor.createReactAgentAnnotation;
14
+ exports.toolsCondition = require_tool_node.toolsCondition;
15
+ exports.withAgentName = require_agentName.withAgentName;
@@ -0,0 +1,8 @@
1
+ import { ToolExecutor, ToolExecutorArgs, ToolInvocationInterface } from "./tool_executor.cjs";
2
+ import { AgentExecutorState, createAgentExecutor } from "./agent_executor.cjs";
3
+ import { FunctionCallingExecutorState, createFunctionCallingExecutor } from "./chat_agent_executor.cjs";
4
+ import { ToolNode, ToolNodeOptions, toolsCondition } from "./tool_node.cjs";
5
+ import { AgentState, CreateReactAgentParams, createReactAgent, createReactAgentAnnotation } from "./react_agent_executor.cjs";
6
+ import { ActionRequest, HumanInterrupt, HumanInterruptConfig, HumanResponse } from "./interrupt.cjs";
7
+ import { AgentNameMode, withAgentName } from "./agentName.cjs";
8
+ export { type ActionRequest, type AgentExecutorState, type AgentNameMode, type AgentState, type CreateReactAgentParams, type FunctionCallingExecutorState, type HumanInterrupt, type HumanInterruptConfig, type HumanResponse, ToolExecutor, type ToolExecutorArgs, type ToolInvocationInterface, ToolNode, type ToolNodeOptions, createAgentExecutor, createFunctionCallingExecutor, createReactAgent, createReactAgentAnnotation, toolsCondition, withAgentName };
@@ -1,8 +1,8 @@
1
- export { type AgentExecutorState, createAgentExecutor, } from "./agent_executor.js";
2
- export { type FunctionCallingExecutorState, createFunctionCallingExecutor, } from "./chat_agent_executor.js";
3
- export { type AgentState, type CreateReactAgentParams, createReactAgent, createReactAgentAnnotation, } from "./react_agent_executor.js";
4
- export { type ToolExecutorArgs, type ToolInvocationInterface, ToolExecutor, } from "./tool_executor.js";
5
- export { ToolNode, toolsCondition, type ToolNodeOptions } from "./tool_node.js";
6
- export type { HumanInterruptConfig, ActionRequest, HumanInterrupt, HumanResponse, } from "./interrupt.js";
7
- export { withAgentName } from "./agentName.js";
8
- export type { AgentNameMode } from "./agentName.js";
1
+ import { ToolExecutor, ToolExecutorArgs, ToolInvocationInterface } from "./tool_executor.js";
2
+ import { AgentExecutorState, createAgentExecutor } from "./agent_executor.js";
3
+ import { FunctionCallingExecutorState, createFunctionCallingExecutor } from "./chat_agent_executor.js";
4
+ import { ToolNode, ToolNodeOptions, toolsCondition } from "./tool_node.js";
5
+ import { AgentState, CreateReactAgentParams, createReactAgent, createReactAgentAnnotation } from "./react_agent_executor.js";
6
+ import { ActionRequest, HumanInterrupt, HumanInterruptConfig, HumanResponse } from "./interrupt.js";
7
+ import { AgentNameMode, withAgentName } from "./agentName.js";
8
+ export { type ActionRequest, type AgentExecutorState, type AgentNameMode, type AgentState, type CreateReactAgentParams, type FunctionCallingExecutorState, type HumanInterrupt, type HumanInterruptConfig, type HumanResponse, ToolExecutor, type ToolExecutorArgs, type ToolInvocationInterface, ToolNode, type ToolNodeOptions, createAgentExecutor, createFunctionCallingExecutor, createReactAgent, createReactAgentAnnotation, toolsCondition, withAgentName };
@@ -1,7 +1,8 @@
1
- export { createAgentExecutor, } from "./agent_executor.js";
2
- export { createFunctionCallingExecutor, } from "./chat_agent_executor.js";
3
- export { createReactAgent, createReactAgentAnnotation, } from "./react_agent_executor.js";
4
- export { ToolExecutor, } from "./tool_executor.js";
5
- export { ToolNode, toolsCondition } from "./tool_node.js";
6
- export { withAgentName } from "./agentName.js";
7
- //# sourceMappingURL=index.js.map
1
+ import { ToolExecutor } from "./tool_executor.js";
2
+ import { createAgentExecutor } from "./agent_executor.js";
3
+ import { createFunctionCallingExecutor } from "./chat_agent_executor.js";
4
+ import { ToolNode, toolsCondition } from "./tool_node.js";
5
+ import { withAgentName } from "./agentName.js";
6
+ import { createReactAgent, createReactAgentAnnotation } from "./react_agent_executor.js";
7
+
8
+ export { ToolExecutor, ToolNode, createAgentExecutor, createFunctionCallingExecutor, createReactAgent, createReactAgentAnnotation, toolsCondition, withAgentName };
@@ -0,0 +1,73 @@
1
+ //#region src/prebuilt/interrupt.d.ts
2
+ /**
3
+ * Configuration interface that defines what actions are allowed for a human interrupt.
4
+ * This controls the available interaction options when the graph is paused for human input.
5
+ *
6
+ * @deprecated Use `HumanInterruptConfig` has been moved to {@link https://www.npmjs.com/package/langchain langchain} package.
7
+ * Update your import to `import { HumanInterruptConfig } from "langchain";`
8
+ *
9
+ * @property {boolean} allow_ignore - Whether the human can choose to ignore/skip the current step
10
+ * @property {boolean} allow_respond - Whether the human can provide a text response/feedback
11
+ * @property {boolean} allow_edit - Whether the human can edit the provided content/state
12
+ * @property {boolean} allow_accept - Whether the human can accept/approve the current state
13
+ */
14
+ interface HumanInterruptConfig {
15
+ allow_ignore: boolean;
16
+ allow_respond: boolean;
17
+ allow_edit: boolean;
18
+ allow_accept: boolean;
19
+ }
20
+ /**
21
+ * Represents a request for human action within the graph execution.
22
+ * Contains the action type and any associated arguments needed for the action.
23
+ *
24
+ * @deprecated Use `ActionRequest` has been moved to {@link https://www.npmjs.com/package/langchain langchain} package.
25
+ * Update your import to `import { ActionRequest } from "langchain/prebuilt/interrupt";`
26
+ *
27
+ * @property {string} action - The type or name of action being requested (e.g., "Approve XYZ action")
28
+ * @property {Record<string, any>} args - Key-value pairs of arguments needed for the action
29
+ */
30
+ interface ActionRequest {
31
+ action: string;
32
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
33
+ args: Record<string, any>;
34
+ }
35
+ /**
36
+ * Represents an interrupt triggered by the graph that requires human intervention.
37
+ * This is passed to the `interrupt` function when execution is paused for human input.
38
+ *
39
+ * @deprecated Use `HumanInterrupt` has been moved to {@link https://www.npmjs.com/package/langchain langchain} package.
40
+ * Update your import to `import { HumanInterrupt } from "langchain/prebuilt/interrupt";`
41
+ *
42
+ * @property {ActionRequest} action_request - The specific action being requested from the human
43
+ * @property {HumanInterruptConfig} config - Configuration defining what actions are allowed
44
+ * @property {string} [description] - Optional detailed description of what input is needed
45
+ */
46
+ interface HumanInterrupt {
47
+ action_request: ActionRequest;
48
+ config: HumanInterruptConfig;
49
+ description?: string;
50
+ }
51
+ /**
52
+ * The response provided by a human to an interrupt, which is returned when graph execution resumes.
53
+ *
54
+ * @deprecated Use `HumanResponse` has been moved to {@link https://www.npmjs.com/package/langchain langchain} package.
55
+ * Update your import to `import { HumanResponse } from "langchain/prebuilt/interrupt";`
56
+ *
57
+ * @property {("accept"|"ignore"|"response"|"edit")} type - The type of response:
58
+ * - "accept": Approves the current state without changes
59
+ * - "ignore": Skips/ignores the current step
60
+ * - "response": Provides text feedback or instructions
61
+ * - "edit": Modifies the current state/content
62
+ * @property {null|string|ActionRequest} args - The response payload:
63
+ * - null: For ignore/accept actions
64
+ * - string: For text responses
65
+ * - ActionRequest: For edit actions with updated content
66
+ */
67
+ type HumanResponse = {
68
+ type: "accept" | "ignore" | "response" | "edit";
69
+ args: null | string | ActionRequest;
70
+ };
71
+ //#endregion
72
+ export { ActionRequest, HumanInterrupt, HumanInterruptConfig, HumanResponse };
73
+ //# sourceMappingURL=interrupt.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interrupt.d.cts","names":["HumanInterruptConfig","ActionRequest","Record","HumanInterrupt","HumanResponse"],"sources":["../../src/prebuilt/interrupt.d.ts"],"sourcesContent":["/**\n * Configuration interface that defines what actions are allowed for a human interrupt.\n * This controls the available interaction options when the graph is paused for human input.\n *\n * @deprecated Use `HumanInterruptConfig` has been moved to {@link https://www.npmjs.com/package/langchain langchain} package.\n * Update your import to `import { HumanInterruptConfig } from \"langchain\";`\n *\n * @property {boolean} allow_ignore - Whether the human can choose to ignore/skip the current step\n * @property {boolean} allow_respond - Whether the human can provide a text response/feedback\n * @property {boolean} allow_edit - Whether the human can edit the provided content/state\n * @property {boolean} allow_accept - Whether the human can accept/approve the current state\n */\nexport interface HumanInterruptConfig {\n allow_ignore: boolean;\n allow_respond: boolean;\n allow_edit: boolean;\n allow_accept: boolean;\n}\n/**\n * Represents a request for human action within the graph execution.\n * Contains the action type and any associated arguments needed for the action.\n *\n * @deprecated Use `ActionRequest` has been moved to {@link https://www.npmjs.com/package/langchain langchain} package.\n * Update your import to `import { ActionRequest } from \"langchain/prebuilt/interrupt\";`\n *\n * @property {string} action - The type or name of action being requested (e.g., \"Approve XYZ action\")\n * @property {Record<string, any>} args - Key-value pairs of arguments needed for the action\n */\nexport interface ActionRequest {\n action: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n args: Record<string, any>;\n}\n/**\n * Represents an interrupt triggered by the graph that requires human intervention.\n * This is passed to the `interrupt` function when execution is paused for human input.\n *\n * @deprecated Use `HumanInterrupt` has been moved to {@link https://www.npmjs.com/package/langchain langchain} package.\n * Update your import to `import { HumanInterrupt } from \"langchain/prebuilt/interrupt\";`\n *\n * @property {ActionRequest} action_request - The specific action being requested from the human\n * @property {HumanInterruptConfig} config - Configuration defining what actions are allowed\n * @property {string} [description] - Optional detailed description of what input is needed\n */\nexport interface HumanInterrupt {\n action_request: ActionRequest;\n config: HumanInterruptConfig;\n description?: string;\n}\n/**\n * The response provided by a human to an interrupt, which is returned when graph execution resumes.\n *\n * @deprecated Use `HumanResponse` has been moved to {@link https://www.npmjs.com/package/langchain langchain} package.\n * Update your import to `import { HumanResponse } from \"langchain/prebuilt/interrupt\";`\n *\n * @property {(\"accept\"|\"ignore\"|\"response\"|\"edit\")} type - The type of response:\n * - \"accept\": Approves the current state without changes\n * - \"ignore\": Skips/ignores the current step\n * - \"response\": Provides text feedback or instructions\n * - \"edit\": Modifies the current state/content\n * @property {null|string|ActionRequest} args - The response payload:\n * - null: For ignore/accept actions\n * - string: For text responses\n * - ActionRequest: For edit actions with updated content\n */\nexport type HumanResponse = {\n type: \"accept\" | \"ignore\" | \"response\" | \"edit\";\n args: null | string | ActionRequest;\n};\n"],"mappings":";;AAYA;AAgBA;AAgBA;;;;;AAqBA;;;;UArDiBA,oBAAAA;;;;;;;;;;;;;;;;UAgBAC,aAAAA;;;QAGPC;;;;;;;;;;;;;UAaOC,cAAAA;kBACGF;UACRD;;;;;;;;;;;;;;;;;;;KAmBAI,aAAAA;;wBAEcH"}
@@ -1,45 +1,59 @@
1
+ //#region src/prebuilt/interrupt.d.ts
1
2
  /**
2
3
  * Configuration interface that defines what actions are allowed for a human interrupt.
3
4
  * This controls the available interaction options when the graph is paused for human input.
4
5
  *
6
+ * @deprecated Use `HumanInterruptConfig` has been moved to {@link https://www.npmjs.com/package/langchain langchain} package.
7
+ * Update your import to `import { HumanInterruptConfig } from "langchain";`
8
+ *
5
9
  * @property {boolean} allow_ignore - Whether the human can choose to ignore/skip the current step
6
10
  * @property {boolean} allow_respond - Whether the human can provide a text response/feedback
7
11
  * @property {boolean} allow_edit - Whether the human can edit the provided content/state
8
12
  * @property {boolean} allow_accept - Whether the human can accept/approve the current state
9
13
  */
10
- export interface HumanInterruptConfig {
11
- allow_ignore: boolean;
12
- allow_respond: boolean;
13
- allow_edit: boolean;
14
- allow_accept: boolean;
14
+ interface HumanInterruptConfig {
15
+ allow_ignore: boolean;
16
+ allow_respond: boolean;
17
+ allow_edit: boolean;
18
+ allow_accept: boolean;
15
19
  }
16
20
  /**
17
21
  * Represents a request for human action within the graph execution.
18
22
  * Contains the action type and any associated arguments needed for the action.
19
23
  *
24
+ * @deprecated Use `ActionRequest` has been moved to {@link https://www.npmjs.com/package/langchain langchain} package.
25
+ * Update your import to `import { ActionRequest } from "langchain/prebuilt/interrupt";`
26
+ *
20
27
  * @property {string} action - The type or name of action being requested (e.g., "Approve XYZ action")
21
28
  * @property {Record<string, any>} args - Key-value pairs of arguments needed for the action
22
29
  */
23
- export interface ActionRequest {
24
- action: string;
25
- args: Record<string, any>;
30
+ interface ActionRequest {
31
+ action: string;
32
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
33
+ args: Record<string, any>;
26
34
  }
27
35
  /**
28
36
  * Represents an interrupt triggered by the graph that requires human intervention.
29
37
  * This is passed to the `interrupt` function when execution is paused for human input.
30
38
  *
39
+ * @deprecated Use `HumanInterrupt` has been moved to {@link https://www.npmjs.com/package/langchain langchain} package.
40
+ * Update your import to `import { HumanInterrupt } from "langchain/prebuilt/interrupt";`
41
+ *
31
42
  * @property {ActionRequest} action_request - The specific action being requested from the human
32
43
  * @property {HumanInterruptConfig} config - Configuration defining what actions are allowed
33
44
  * @property {string} [description] - Optional detailed description of what input is needed
34
45
  */
35
- export interface HumanInterrupt {
36
- action_request: ActionRequest;
37
- config: HumanInterruptConfig;
38
- description?: string;
46
+ interface HumanInterrupt {
47
+ action_request: ActionRequest;
48
+ config: HumanInterruptConfig;
49
+ description?: string;
39
50
  }
40
51
  /**
41
52
  * The response provided by a human to an interrupt, which is returned when graph execution resumes.
42
53
  *
54
+ * @deprecated Use `HumanResponse` has been moved to {@link https://www.npmjs.com/package/langchain langchain} package.
55
+ * Update your import to `import { HumanResponse } from "langchain/prebuilt/interrupt";`
56
+ *
43
57
  * @property {("accept"|"ignore"|"response"|"edit")} type - The type of response:
44
58
  * - "accept": Approves the current state without changes
45
59
  * - "ignore": Skips/ignores the current step
@@ -50,7 +64,10 @@ export interface HumanInterrupt {
50
64
  * - string: For text responses
51
65
  * - ActionRequest: For edit actions with updated content
52
66
  */
53
- export type HumanResponse = {
54
- type: "accept" | "ignore" | "response" | "edit";
55
- args: null | string | ActionRequest;
67
+ type HumanResponse = {
68
+ type: "accept" | "ignore" | "response" | "edit";
69
+ args: null | string | ActionRequest;
56
70
  };
71
+ //#endregion
72
+ export { ActionRequest, HumanInterrupt, HumanInterruptConfig, HumanResponse };
73
+ //# sourceMappingURL=interrupt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interrupt.d.ts","names":["HumanInterruptConfig","ActionRequest","Record","HumanInterrupt","HumanResponse"],"sources":["../../src/prebuilt/interrupt.d.ts"],"sourcesContent":["/**\n * Configuration interface that defines what actions are allowed for a human interrupt.\n * This controls the available interaction options when the graph is paused for human input.\n *\n * @deprecated Use `HumanInterruptConfig` has been moved to {@link https://www.npmjs.com/package/langchain langchain} package.\n * Update your import to `import { HumanInterruptConfig } from \"langchain\";`\n *\n * @property {boolean} allow_ignore - Whether the human can choose to ignore/skip the current step\n * @property {boolean} allow_respond - Whether the human can provide a text response/feedback\n * @property {boolean} allow_edit - Whether the human can edit the provided content/state\n * @property {boolean} allow_accept - Whether the human can accept/approve the current state\n */\nexport interface HumanInterruptConfig {\n allow_ignore: boolean;\n allow_respond: boolean;\n allow_edit: boolean;\n allow_accept: boolean;\n}\n/**\n * Represents a request for human action within the graph execution.\n * Contains the action type and any associated arguments needed for the action.\n *\n * @deprecated Use `ActionRequest` has been moved to {@link https://www.npmjs.com/package/langchain langchain} package.\n * Update your import to `import { ActionRequest } from \"langchain/prebuilt/interrupt\";`\n *\n * @property {string} action - The type or name of action being requested (e.g., \"Approve XYZ action\")\n * @property {Record<string, any>} args - Key-value pairs of arguments needed for the action\n */\nexport interface ActionRequest {\n action: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n args: Record<string, any>;\n}\n/**\n * Represents an interrupt triggered by the graph that requires human intervention.\n * This is passed to the `interrupt` function when execution is paused for human input.\n *\n * @deprecated Use `HumanInterrupt` has been moved to {@link https://www.npmjs.com/package/langchain langchain} package.\n * Update your import to `import { HumanInterrupt } from \"langchain/prebuilt/interrupt\";`\n *\n * @property {ActionRequest} action_request - The specific action being requested from the human\n * @property {HumanInterruptConfig} config - Configuration defining what actions are allowed\n * @property {string} [description] - Optional detailed description of what input is needed\n */\nexport interface HumanInterrupt {\n action_request: ActionRequest;\n config: HumanInterruptConfig;\n description?: string;\n}\n/**\n * The response provided by a human to an interrupt, which is returned when graph execution resumes.\n *\n * @deprecated Use `HumanResponse` has been moved to {@link https://www.npmjs.com/package/langchain langchain} package.\n * Update your import to `import { HumanResponse } from \"langchain/prebuilt/interrupt\";`\n *\n * @property {(\"accept\"|\"ignore\"|\"response\"|\"edit\")} type - The type of response:\n * - \"accept\": Approves the current state without changes\n * - \"ignore\": Skips/ignores the current step\n * - \"response\": Provides text feedback or instructions\n * - \"edit\": Modifies the current state/content\n * @property {null|string|ActionRequest} args - The response payload:\n * - null: For ignore/accept actions\n * - string: For text responses\n * - ActionRequest: For edit actions with updated content\n */\nexport type HumanResponse = {\n type: \"accept\" | \"ignore\" | \"response\" | \"edit\";\n args: null | string | ActionRequest;\n};\n"],"mappings":";;AAYA;AAgBA;AAgBA;;;;;AAqBA;;;;UArDiBA,oBAAAA;;;;;;;;;;;;;;;;UAgBAC,aAAAA;;;QAGPC;;;;;;;;;;;;;UAaOC,cAAAA;kBACGF;UACRD;;;;;;;;;;;;;;;;;;;KAmBAI,aAAAA;;wBAEcH"}