langchain 1.0.0-alpha.5 → 1.0.0-alpha.7

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 (405) hide show
  1. package/dist/agents/ReactAgent.cjs +5 -5
  2. package/dist/agents/ReactAgent.cjs.map +1 -1
  3. package/dist/agents/ReactAgent.d.cts +2 -5
  4. package/dist/agents/ReactAgent.d.cts.map +1 -1
  5. package/dist/agents/ReactAgent.d.ts +2 -5
  6. package/dist/agents/ReactAgent.d.ts.map +1 -1
  7. package/dist/agents/ReactAgent.js +6 -6
  8. package/dist/agents/ReactAgent.js.map +1 -1
  9. package/dist/agents/annotation.cjs.map +1 -1
  10. package/dist/agents/annotation.d.cts +13 -8
  11. package/dist/agents/annotation.d.cts.map +1 -1
  12. package/dist/agents/annotation.d.ts +13 -8
  13. package/dist/agents/annotation.d.ts.map +1 -1
  14. package/dist/agents/annotation.js.map +1 -1
  15. package/dist/agents/createAgent.cjs.map +1 -1
  16. package/dist/agents/createAgent.js.map +1 -1
  17. package/dist/agents/index.cjs +2 -2
  18. package/dist/agents/index.cjs.map +1 -1
  19. package/dist/agents/index.d.cts +50 -50
  20. package/dist/agents/index.d.cts.map +1 -1
  21. package/dist/agents/index.d.ts +50 -50
  22. package/dist/agents/index.d.ts.map +1 -1
  23. package/dist/agents/index.js +2 -2
  24. package/dist/agents/index.js.map +1 -1
  25. package/dist/agents/interrupt.d.cts +14 -1
  26. package/dist/agents/interrupt.d.cts.map +1 -1
  27. package/dist/agents/interrupt.d.ts +14 -1
  28. package/dist/agents/interrupt.d.ts.map +1 -1
  29. package/dist/agents/middlewareAgent/ReactAgent.cjs +273 -66
  30. package/dist/agents/middlewareAgent/ReactAgent.cjs.map +1 -1
  31. package/dist/agents/middlewareAgent/ReactAgent.d.cts +102 -16
  32. package/dist/agents/middlewareAgent/ReactAgent.d.cts.map +1 -1
  33. package/dist/agents/middlewareAgent/ReactAgent.d.ts +102 -16
  34. package/dist/agents/middlewareAgent/ReactAgent.d.ts.map +1 -1
  35. package/dist/agents/middlewareAgent/ReactAgent.js +275 -68
  36. package/dist/agents/middlewareAgent/ReactAgent.js.map +1 -1
  37. package/dist/agents/middlewareAgent/annotation.cjs +12 -6
  38. package/dist/agents/middlewareAgent/annotation.cjs.map +1 -1
  39. package/dist/agents/middlewareAgent/annotation.js +12 -6
  40. package/dist/agents/middlewareAgent/annotation.js.map +1 -1
  41. package/dist/agents/middlewareAgent/constants.d.cts +5 -0
  42. package/dist/agents/middlewareAgent/constants.d.cts.map +1 -0
  43. package/dist/agents/middlewareAgent/constants.d.ts +5 -0
  44. package/dist/agents/middlewareAgent/constants.d.ts.map +1 -0
  45. package/dist/agents/middlewareAgent/index.cjs.map +1 -1
  46. package/dist/agents/middlewareAgent/index.js.map +1 -1
  47. package/dist/agents/middlewareAgent/middleware/bigTool.cjs +162 -0
  48. package/dist/agents/middlewareAgent/middleware/bigTool.cjs.map +1 -0
  49. package/dist/agents/middlewareAgent/middleware/bigTool.d.cts +113 -0
  50. package/dist/agents/middlewareAgent/middleware/bigTool.d.cts.map +1 -0
  51. package/dist/agents/middlewareAgent/middleware/bigTool.d.ts +113 -0
  52. package/dist/agents/middlewareAgent/middleware/bigTool.d.ts.map +1 -0
  53. package/dist/agents/middlewareAgent/middleware/bigTool.js +161 -0
  54. package/dist/agents/middlewareAgent/middleware/bigTool.js.map +1 -0
  55. package/dist/agents/middlewareAgent/middleware/dynamicSystemPrompt.cjs +58 -0
  56. package/dist/agents/middlewareAgent/middleware/dynamicSystemPrompt.cjs.map +1 -0
  57. package/dist/agents/middlewareAgent/middleware/dynamicSystemPrompt.d.cts +46 -0
  58. package/dist/agents/middlewareAgent/middleware/dynamicSystemPrompt.d.cts.map +1 -0
  59. package/dist/agents/middlewareAgent/middleware/dynamicSystemPrompt.d.ts +46 -0
  60. package/dist/agents/middlewareAgent/middleware/dynamicSystemPrompt.d.ts.map +1 -0
  61. package/dist/agents/middlewareAgent/middleware/dynamicSystemPrompt.js +58 -0
  62. package/dist/agents/middlewareAgent/middleware/dynamicSystemPrompt.js.map +1 -0
  63. package/dist/agents/middlewareAgent/middleware/hitl.cjs +311 -0
  64. package/dist/agents/middlewareAgent/middleware/hitl.cjs.map +1 -0
  65. package/dist/agents/middlewareAgent/middleware/hitl.d.cts +419 -0
  66. package/dist/agents/middlewareAgent/middleware/hitl.d.cts.map +1 -0
  67. package/dist/agents/middlewareAgent/middleware/hitl.d.ts +419 -0
  68. package/dist/agents/middlewareAgent/middleware/hitl.d.ts.map +1 -0
  69. package/dist/agents/middlewareAgent/middleware/hitl.js +310 -0
  70. package/dist/agents/middlewareAgent/middleware/hitl.js.map +1 -0
  71. package/dist/agents/middlewareAgent/middleware/index.cjs +32 -0
  72. package/dist/agents/middlewareAgent/middleware/index.cjs.map +1 -0
  73. package/dist/agents/middlewareAgent/middleware/index.d.cts +6 -0
  74. package/dist/agents/middlewareAgent/middleware/index.d.ts +6 -0
  75. package/dist/agents/middlewareAgent/middleware/index.js +21 -0
  76. package/dist/agents/middlewareAgent/middleware/index.js.map +1 -0
  77. package/dist/agents/middlewareAgent/{middlewares → middleware}/promptCaching.cjs +72 -27
  78. package/dist/agents/middlewareAgent/middleware/promptCaching.cjs.map +1 -0
  79. package/dist/agents/middlewareAgent/{middlewares → middleware}/promptCaching.d.cts +60 -15
  80. package/dist/agents/middlewareAgent/middleware/promptCaching.d.cts.map +1 -0
  81. package/dist/agents/middlewareAgent/{middlewares → middleware}/promptCaching.d.ts +60 -15
  82. package/dist/agents/middlewareAgent/middleware/promptCaching.d.ts.map +1 -0
  83. package/dist/agents/middlewareAgent/{middlewares → middleware}/promptCaching.js +71 -26
  84. package/dist/agents/middlewareAgent/middleware/promptCaching.js.map +1 -0
  85. package/dist/agents/middlewareAgent/{middlewares → middleware}/summarization.cjs +35 -23
  86. package/dist/agents/middlewareAgent/middleware/summarization.cjs.map +1 -0
  87. package/dist/agents/middlewareAgent/{middlewares → middleware}/summarization.d.cts +7 -5
  88. package/dist/agents/middlewareAgent/middleware/summarization.d.cts.map +1 -0
  89. package/dist/agents/middlewareAgent/{middlewares → middleware}/summarization.d.ts +7 -5
  90. package/dist/agents/middlewareAgent/middleware/summarization.d.ts.map +1 -0
  91. package/dist/agents/middlewareAgent/{middlewares → middleware}/summarization.js +29 -17
  92. package/dist/agents/middlewareAgent/middleware/summarization.js.map +1 -0
  93. package/dist/agents/middlewareAgent/middleware.cjs +8 -5
  94. package/dist/agents/middlewareAgent/middleware.cjs.map +1 -1
  95. package/dist/agents/middlewareAgent/middleware.d.cts +67 -7
  96. package/dist/agents/middlewareAgent/middleware.d.cts.map +1 -1
  97. package/dist/agents/middlewareAgent/middleware.d.ts +67 -7
  98. package/dist/agents/middlewareAgent/middleware.d.ts.map +1 -1
  99. package/dist/agents/middlewareAgent/middleware.js +8 -5
  100. package/dist/agents/middlewareAgent/middleware.js.map +1 -1
  101. package/dist/agents/middlewareAgent/nodes/AfterModalNode.cjs +2 -2
  102. package/dist/agents/middlewareAgent/nodes/AfterModalNode.cjs.map +1 -1
  103. package/dist/agents/middlewareAgent/nodes/AfterModalNode.js +2 -2
  104. package/dist/agents/middlewareAgent/nodes/AfterModalNode.js.map +1 -1
  105. package/dist/agents/middlewareAgent/nodes/AgentNode.cjs +125 -83
  106. package/dist/agents/middlewareAgent/nodes/AgentNode.cjs.map +1 -1
  107. package/dist/agents/middlewareAgent/nodes/AgentNode.js +128 -86
  108. package/dist/agents/middlewareAgent/nodes/AgentNode.js.map +1 -1
  109. package/dist/agents/middlewareAgent/nodes/BeforeModalNode.cjs +2 -2
  110. package/dist/agents/middlewareAgent/nodes/BeforeModalNode.cjs.map +1 -1
  111. package/dist/agents/middlewareAgent/nodes/BeforeModalNode.js +2 -2
  112. package/dist/agents/middlewareAgent/nodes/BeforeModalNode.js.map +1 -1
  113. package/dist/agents/middlewareAgent/nodes/middleware.cjs +42 -17
  114. package/dist/agents/middlewareAgent/nodes/middleware.cjs.map +1 -1
  115. package/dist/agents/middlewareAgent/nodes/middleware.js +42 -18
  116. package/dist/agents/middlewareAgent/nodes/middleware.js.map +1 -1
  117. package/dist/agents/middlewareAgent/nodes/utils.cjs +30 -16
  118. package/dist/agents/middlewareAgent/nodes/utils.cjs.map +1 -1
  119. package/dist/agents/middlewareAgent/nodes/utils.js +28 -14
  120. package/dist/agents/middlewareAgent/nodes/utils.js.map +1 -1
  121. package/dist/agents/middlewareAgent/types.d.cts +162 -88
  122. package/dist/agents/middlewareAgent/types.d.cts.map +1 -1
  123. package/dist/agents/middlewareAgent/types.d.ts +162 -88
  124. package/dist/agents/middlewareAgent/types.d.ts.map +1 -1
  125. package/dist/agents/model.cjs +13 -0
  126. package/dist/agents/model.cjs.map +1 -0
  127. package/dist/agents/model.js +11 -0
  128. package/dist/agents/model.js.map +1 -0
  129. package/dist/agents/nodes/AgentNode.cjs +60 -32
  130. package/dist/agents/nodes/AgentNode.cjs.map +1 -1
  131. package/dist/agents/nodes/AgentNode.js +61 -33
  132. package/dist/agents/nodes/AgentNode.js.map +1 -1
  133. package/dist/agents/nodes/ToolNode.cjs +4 -4
  134. package/dist/agents/nodes/ToolNode.cjs.map +1 -1
  135. package/dist/agents/nodes/ToolNode.d.cts +2 -3
  136. package/dist/agents/nodes/ToolNode.d.cts.map +1 -1
  137. package/dist/agents/nodes/ToolNode.d.ts +1 -2
  138. package/dist/agents/nodes/ToolNode.d.ts.map +1 -1
  139. package/dist/agents/nodes/ToolNode.js +5 -5
  140. package/dist/agents/nodes/ToolNode.js.map +1 -1
  141. package/dist/agents/responses.cjs +53 -11
  142. package/dist/agents/responses.cjs.map +1 -1
  143. package/dist/agents/responses.d.cts +12 -20
  144. package/dist/agents/responses.d.cts.map +1 -1
  145. package/dist/agents/responses.d.ts +12 -20
  146. package/dist/agents/responses.d.ts.map +1 -1
  147. package/dist/agents/responses.js +53 -12
  148. package/dist/agents/responses.js.map +1 -1
  149. package/dist/agents/types.d.cts +3 -6
  150. package/dist/agents/types.d.cts.map +1 -1
  151. package/dist/agents/types.d.ts +3 -6
  152. package/dist/agents/types.d.ts.map +1 -1
  153. package/dist/agents/utils.cjs +11 -29
  154. package/dist/agents/utils.cjs.map +1 -1
  155. package/dist/agents/utils.js +9 -26
  156. package/dist/agents/utils.js.map +1 -1
  157. package/dist/agents/withAgentName.cjs.map +1 -1
  158. package/dist/agents/withAgentName.js.map +1 -1
  159. package/dist/chains/api/prompts.cjs.map +1 -1
  160. package/dist/chains/api/prompts.js.map +1 -1
  161. package/dist/chains/constitutional_ai/constitutional_chain.cjs.map +1 -1
  162. package/dist/chains/constitutional_ai/constitutional_chain.js.map +1 -1
  163. package/dist/chains/index.cjs +0 -3
  164. package/dist/chains/index.cjs.map +1 -1
  165. package/dist/chains/index.d.cts +1 -2
  166. package/dist/chains/index.d.ts +1 -2
  167. package/dist/chains/index.js +1 -3
  168. package/dist/chains/index.js.map +1 -1
  169. package/dist/chains/openai_functions/extraction.cjs.map +1 -1
  170. package/dist/chains/openai_functions/extraction.d.cts +1 -3
  171. package/dist/chains/openai_functions/extraction.d.cts.map +1 -1
  172. package/dist/chains/openai_functions/extraction.d.ts +1 -3
  173. package/dist/chains/openai_functions/extraction.d.ts.map +1 -1
  174. package/dist/chains/openai_functions/extraction.js.map +1 -1
  175. package/dist/chains/openai_functions/index.cjs +0 -5
  176. package/dist/chains/openai_functions/index.cjs.map +1 -1
  177. package/dist/chains/openai_functions/index.d.cts +1 -2
  178. package/dist/chains/openai_functions/index.d.ts +1 -2
  179. package/dist/chains/openai_functions/index.js +1 -4
  180. package/dist/chains/openai_functions/index.js.map +1 -1
  181. package/dist/chains/openai_functions/openapi.cjs +4 -4
  182. package/dist/chains/openai_functions/openapi.cjs.map +1 -1
  183. package/dist/chains/openai_functions/openapi.d.cts +1 -1
  184. package/dist/chains/openai_functions/openapi.js +4 -4
  185. package/dist/chains/openai_functions/openapi.js.map +1 -1
  186. package/dist/chains/openai_functions/tagging.cjs.map +1 -1
  187. package/dist/chains/openai_functions/tagging.d.cts +1 -3
  188. package/dist/chains/openai_functions/tagging.d.cts.map +1 -1
  189. package/dist/chains/openai_functions/tagging.d.ts +1 -3
  190. package/dist/chains/openai_functions/tagging.d.ts.map +1 -1
  191. package/dist/chains/openai_functions/tagging.js.map +1 -1
  192. package/dist/chains/query_constructor/index.cjs +4 -4
  193. package/dist/chains/query_constructor/index.cjs.map +1 -1
  194. package/dist/chains/query_constructor/index.d.cts +4 -2
  195. package/dist/chains/query_constructor/index.d.cts.map +1 -1
  196. package/dist/chains/query_constructor/index.d.ts +4 -2
  197. package/dist/chains/query_constructor/index.d.ts.map +1 -1
  198. package/dist/chains/query_constructor/index.js +1 -1
  199. package/dist/chains/query_constructor/index.js.map +1 -1
  200. package/dist/chains/question_answering/load.d.ts +2 -2
  201. package/dist/chains/question_answering/load.d.ts.map +1 -1
  202. package/dist/chains/question_answering/map_reduce_prompts.cjs.map +1 -1
  203. package/dist/chains/question_answering/map_reduce_prompts.js.map +1 -1
  204. package/dist/chains/question_answering/refine_prompts.cjs.map +1 -1
  205. package/dist/chains/question_answering/refine_prompts.js.map +1 -1
  206. package/dist/chains/question_answering/stuff_prompts.cjs.map +1 -1
  207. package/dist/chains/question_answering/stuff_prompts.js.map +1 -1
  208. package/dist/chains/router/multi_prompt.cjs +4 -4
  209. package/dist/chains/router/multi_prompt.cjs.map +1 -1
  210. package/dist/chains/router/multi_prompt.js +1 -1
  211. package/dist/chains/router/multi_prompt.js.map +1 -1
  212. package/dist/chains/router/multi_retrieval_qa.cjs +4 -4
  213. package/dist/chains/router/multi_retrieval_qa.cjs.map +1 -1
  214. package/dist/chains/router/multi_retrieval_qa.js +1 -1
  215. package/dist/chains/router/multi_retrieval_qa.js.map +1 -1
  216. package/dist/chains/sql_db/sql_db_prompt.cjs.map +1 -1
  217. package/dist/chains/sql_db/sql_db_prompt.d.cts.map +1 -1
  218. package/dist/chains/sql_db/sql_db_prompt.d.ts.map +1 -1
  219. package/dist/chains/sql_db/sql_db_prompt.js.map +1 -1
  220. package/dist/chains/summarization/stuff_prompts.cjs.map +1 -1
  221. package/dist/chains/summarization/stuff_prompts.js.map +1 -1
  222. package/dist/chat_models/universal.cjs +8 -5
  223. package/dist/chat_models/universal.cjs.map +1 -1
  224. package/dist/chat_models/universal.d.cts +2 -2
  225. package/dist/chat_models/universal.d.cts.map +1 -1
  226. package/dist/chat_models/universal.d.ts +2 -2
  227. package/dist/chat_models/universal.d.ts.map +1 -1
  228. package/dist/chat_models/universal.js +8 -5
  229. package/dist/chat_models/universal.js.map +1 -1
  230. package/dist/document_loaders/fs/directory.cjs.map +1 -1
  231. package/dist/document_loaders/fs/directory.d.cts +0 -1
  232. package/dist/document_loaders/fs/directory.d.cts.map +1 -1
  233. package/dist/document_loaders/fs/directory.d.ts +0 -1
  234. package/dist/document_loaders/fs/directory.d.ts.map +1 -1
  235. package/dist/document_loaders/fs/directory.js.map +1 -1
  236. package/dist/document_loaders/fs/json.cjs +7 -1
  237. package/dist/document_loaders/fs/json.cjs.map +1 -1
  238. package/dist/document_loaders/fs/json.js +7 -1
  239. package/dist/document_loaders/fs/json.js.map +1 -1
  240. package/dist/embeddings/cache_backed.cjs +1 -1
  241. package/dist/embeddings/cache_backed.cjs.map +1 -1
  242. package/dist/embeddings/cache_backed.d.cts +1 -1
  243. package/dist/embeddings/cache_backed.d.ts +2 -2
  244. package/dist/embeddings/cache_backed.js +2 -2
  245. package/dist/embeddings/cache_backed.js.map +1 -1
  246. package/dist/evaluation/agents/trajectory.d.cts.map +1 -1
  247. package/dist/evaluation/comparison/pairwise.d.cts.map +1 -1
  248. package/dist/evaluation/criteria/criteria.d.cts.map +1 -1
  249. package/dist/evaluation/embedding_distance/base.cjs +2 -4
  250. package/dist/evaluation/embedding_distance/base.cjs.map +1 -1
  251. package/dist/evaluation/embedding_distance/base.js +2 -3
  252. package/dist/evaluation/embedding_distance/base.js.map +1 -1
  253. package/dist/evaluation/loader.cjs +7 -12
  254. package/dist/evaluation/loader.cjs.map +1 -1
  255. package/dist/evaluation/loader.d.cts +8 -2
  256. package/dist/evaluation/loader.d.cts.map +1 -1
  257. package/dist/evaluation/loader.d.ts +8 -2
  258. package/dist/evaluation/loader.d.ts.map +1 -1
  259. package/dist/evaluation/loader.js +7 -12
  260. package/dist/evaluation/loader.js.map +1 -1
  261. package/dist/hub/base.cjs.map +1 -1
  262. package/dist/hub/base.js.map +1 -1
  263. package/dist/index.cjs +38 -6
  264. package/dist/index.cjs.map +1 -1
  265. package/dist/index.d.cts +11 -4
  266. package/dist/index.d.ts +11 -4
  267. package/dist/index.js +18 -4
  268. package/dist/index.js.map +1 -1
  269. package/dist/langchain-core/dist/load/serializable.d.cts.map +1 -1
  270. package/dist/langchain-core/dist/messages/base.d.cts +24 -33
  271. package/dist/langchain-core/dist/messages/base.d.cts.map +1 -1
  272. package/dist/langchain-core/dist/messages/content/index.d.cts +21 -2
  273. package/dist/langchain-core/dist/messages/content/index.d.cts.map +1 -1
  274. package/dist/langchain-core/dist/messages/content/tools.d.cts +67 -6
  275. package/dist/langchain-core/dist/messages/content/tools.d.cts.map +1 -1
  276. package/dist/langchain-core/dist/messages/message.d.cts +598 -0
  277. package/dist/langchain-core/dist/messages/message.d.cts.map +1 -0
  278. package/dist/langchain-core/dist/messages/metadata.d.cts +97 -0
  279. package/dist/langchain-core/dist/messages/metadata.d.cts.map +1 -0
  280. package/dist/langchain-core/dist/messages/utils.d.cts +75 -0
  281. package/dist/langchain-core/dist/messages/utils.d.cts.map +1 -0
  282. package/dist/langchain-core/dist/prompt_values.d.cts.map +1 -1
  283. package/dist/langchain-core/dist/utils/types/index.d.cts.map +1 -1
  284. package/dist/libs/langchain-core/dist/load/serializable.d.ts.map +1 -1
  285. package/dist/libs/langchain-core/dist/messages/base.d.ts +24 -33
  286. package/dist/libs/langchain-core/dist/messages/base.d.ts.map +1 -1
  287. package/dist/libs/langchain-core/dist/messages/content/index.d.ts +21 -2
  288. package/dist/libs/langchain-core/dist/messages/content/index.d.ts.map +1 -1
  289. package/dist/libs/langchain-core/dist/messages/content/tools.d.ts +67 -6
  290. package/dist/libs/langchain-core/dist/messages/content/tools.d.ts.map +1 -1
  291. package/dist/libs/langchain-core/dist/messages/message.d.ts +598 -0
  292. package/dist/libs/langchain-core/dist/messages/message.d.ts.map +1 -0
  293. package/dist/libs/langchain-core/dist/messages/metadata.d.ts +97 -0
  294. package/dist/libs/langchain-core/dist/messages/metadata.d.ts.map +1 -0
  295. package/dist/libs/langchain-core/dist/messages/utils.d.ts +75 -0
  296. package/dist/libs/langchain-core/dist/messages/utils.d.ts.map +1 -0
  297. package/dist/libs/langchain-core/dist/prompt_values.d.ts.map +1 -1
  298. package/dist/libs/langchain-core/dist/utils/types/index.d.ts +2 -0
  299. package/dist/libs/langchain-core/dist/utils/types/index.d.ts.map +1 -1
  300. package/dist/libs/langchain-core/dist/utils/types/zod.d.ts +1 -0
  301. package/dist/load/import_map.cjs +3 -14
  302. package/dist/load/import_map.cjs.map +1 -1
  303. package/dist/load/import_map.js +3 -14
  304. package/dist/load/import_map.js.map +1 -1
  305. package/dist/memory/prompt.cjs.map +1 -1
  306. package/dist/memory/prompt.d.cts.map +1 -1
  307. package/dist/memory/prompt.d.ts.map +1 -1
  308. package/dist/memory/prompt.js.map +1 -1
  309. package/dist/output_parsers/combining.cjs +1 -1
  310. package/dist/output_parsers/combining.cjs.map +1 -1
  311. package/dist/output_parsers/combining.js +1 -1
  312. package/dist/output_parsers/combining.js.map +1 -1
  313. package/dist/output_parsers/expression_type_handlers/array_literal_expression_handler.cjs.map +1 -1
  314. package/dist/output_parsers/expression_type_handlers/array_literal_expression_handler.js.map +1 -1
  315. package/dist/output_parsers/expression_type_handlers/base.cjs +1 -1
  316. package/dist/output_parsers/expression_type_handlers/base.cjs.map +1 -1
  317. package/dist/output_parsers/expression_type_handlers/base.js +1 -1
  318. package/dist/output_parsers/expression_type_handlers/base.js.map +1 -1
  319. package/dist/output_parsers/regex.cjs.map +1 -1
  320. package/dist/output_parsers/regex.js.map +1 -1
  321. package/dist/output_parsers/structured.cjs +4 -4
  322. package/dist/output_parsers/structured.cjs.map +1 -1
  323. package/dist/output_parsers/structured.d.cts +1 -1
  324. package/dist/output_parsers/structured.d.cts.map +1 -1
  325. package/dist/output_parsers/structured.d.ts +1 -1
  326. package/dist/output_parsers/structured.d.ts.map +1 -1
  327. package/dist/output_parsers/structured.js +2 -2
  328. package/dist/output_parsers/structured.js.map +1 -1
  329. package/dist/retrievers/ensemble.cjs.map +1 -1
  330. package/dist/retrievers/ensemble.js.map +1 -1
  331. package/dist/storage/file_system.cjs +1 -1
  332. package/dist/storage/file_system.cjs.map +1 -1
  333. package/dist/storage/file_system.js +1 -1
  334. package/dist/storage/file_system.js.map +1 -1
  335. package/dist/tools/fs.cjs +5 -5
  336. package/dist/tools/fs.cjs.map +1 -1
  337. package/dist/tools/fs.d.cts +1 -1
  338. package/dist/tools/fs.d.cts.map +1 -1
  339. package/dist/tools/fs.d.ts +1 -1
  340. package/dist/tools/fs.d.ts.map +1 -1
  341. package/dist/tools/fs.js +1 -1
  342. package/dist/tools/fs.js.map +1 -1
  343. package/dist/tools/retriever.cjs +2 -2
  344. package/dist/tools/retriever.cjs.map +1 -1
  345. package/dist/tools/retriever.d.cts +1 -1
  346. package/dist/tools/retriever.d.cts.map +1 -1
  347. package/dist/tools/retriever.d.ts +1 -1
  348. package/dist/tools/retriever.d.ts.map +1 -1
  349. package/dist/tools/retriever.js +1 -1
  350. package/dist/tools/retriever.js.map +1 -1
  351. package/dist/tools/sql.cjs +1 -2
  352. package/dist/tools/sql.cjs.map +1 -1
  353. package/dist/tools/sql.d.cts +1 -1
  354. package/dist/tools/sql.d.cts.map +1 -1
  355. package/dist/tools/sql.d.ts +1 -1
  356. package/dist/tools/sql.d.ts.map +1 -1
  357. package/dist/tools/sql.js +1 -2
  358. package/dist/tools/sql.js.map +1 -1
  359. package/dist/types/expression-parser.d.cts +2 -0
  360. package/dist/types/expression-parser.d.cts.map +1 -1
  361. package/dist/types/expression-parser.d.ts +2 -0
  362. package/dist/types/expression-parser.d.ts.map +1 -1
  363. package/dist/util/hub.cjs +1 -1
  364. package/dist/util/hub.js +1 -1
  365. package/dist/util/openapi.cjs +1 -1
  366. package/dist/util/openapi.cjs.map +1 -1
  367. package/dist/util/openapi.js +1 -1
  368. package/dist/util/openapi.js.map +1 -1
  369. package/package.json +15 -21
  370. package/dist/agents/middlewareAgent/middlewares/hitl.cjs +0 -235
  371. package/dist/agents/middlewareAgent/middlewares/hitl.cjs.map +0 -1
  372. package/dist/agents/middlewareAgent/middlewares/hitl.d.cts +0 -199
  373. package/dist/agents/middlewareAgent/middlewares/hitl.d.cts.map +0 -1
  374. package/dist/agents/middlewareAgent/middlewares/hitl.d.ts +0 -199
  375. package/dist/agents/middlewareAgent/middlewares/hitl.d.ts.map +0 -1
  376. package/dist/agents/middlewareAgent/middlewares/hitl.js +0 -234
  377. package/dist/agents/middlewareAgent/middlewares/hitl.js.map +0 -1
  378. package/dist/agents/middlewareAgent/middlewares/index.cjs +0 -8
  379. package/dist/agents/middlewareAgent/middlewares/index.d.cts +0 -4
  380. package/dist/agents/middlewareAgent/middlewares/index.d.ts +0 -4
  381. package/dist/agents/middlewareAgent/middlewares/index.js +0 -5
  382. package/dist/agents/middlewareAgent/middlewares/promptCaching.cjs.map +0 -1
  383. package/dist/agents/middlewareAgent/middlewares/promptCaching.d.cts.map +0 -1
  384. package/dist/agents/middlewareAgent/middlewares/promptCaching.d.ts.map +0 -1
  385. package/dist/agents/middlewareAgent/middlewares/promptCaching.js.map +0 -1
  386. package/dist/agents/middlewareAgent/middlewares/summarization.cjs.map +0 -1
  387. package/dist/agents/middlewareAgent/middlewares/summarization.d.cts.map +0 -1
  388. package/dist/agents/middlewareAgent/middlewares/summarization.d.ts.map +0 -1
  389. package/dist/agents/middlewareAgent/middlewares/summarization.js.map +0 -1
  390. package/dist/chains/openai_functions/structured_output.cjs +0 -107
  391. package/dist/chains/openai_functions/structured_output.cjs.map +0 -1
  392. package/dist/chains/openai_functions/structured_output.d.cts +0 -38
  393. package/dist/chains/openai_functions/structured_output.d.cts.map +0 -1
  394. package/dist/chains/openai_functions/structured_output.d.ts +0 -38
  395. package/dist/chains/openai_functions/structured_output.d.ts.map +0 -1
  396. package/dist/chains/openai_functions/structured_output.js +0 -105
  397. package/dist/chains/openai_functions/structured_output.js.map +0 -1
  398. package/dist/chains/openai_moderation.cjs +0 -107
  399. package/dist/chains/openai_moderation.cjs.map +0 -1
  400. package/dist/chains/openai_moderation.d.cts +0 -74
  401. package/dist/chains/openai_moderation.d.cts.map +0 -1
  402. package/dist/chains/openai_moderation.d.ts +0 -74
  403. package/dist/chains/openai_moderation.d.ts.map +0 -1
  404. package/dist/chains/openai_moderation.js +0 -106
  405. package/dist/chains/openai_moderation.js.map +0 -1
@@ -1,33 +1,119 @@
1
- import { ResponseFormatUndefined } from "../responses.cjs";
2
- import { AnyAnnotationRoot, ToAnnotationRoot } from "../annotation.cjs";
3
- import { AgentMiddleware, BuiltInState, CreateAgentParams, InferContextInput, InferMiddlewareContextInputs, InferMiddlewareInputStates, InferMiddlewareStates, IsAllOptional } from "./types.cjs";
1
+ import { AnyAnnotationRoot, ResponseFormatUndefined, ToAnnotationRoot } from "../annotation.cjs";
2
+ import { AgentMiddleware, BuiltInState, CreateAgentParams, InferContextInput, InferMiddlewareContextInputs, InferMiddlewareInputStates, InferMiddlewareStates, InvokeConfiguration, StreamConfiguration } from "./types.cjs";
4
3
  import { InteropZodObject } from "@langchain/core/utils/types";
5
- import { Command, CompiledStateGraph, LangGraphRunnableConfig } from "@langchain/langgraph";
4
+ import { Command, CompiledStateGraph } from "@langchain/langgraph";
5
+ import { IterableReadableStream } from "@langchain/core/utils/stream";
6
6
 
7
7
  //#region src/agents/middlewareAgent/ReactAgent.d.ts
8
+
8
9
  // Helper type to get the state definition with middleware states
9
- type MergedAgentState<StructuredResponseFormat extends Record<string, any> | ResponseFormatUndefined, TMiddlewares extends readonly AgentMiddleware<any, any, any>[]> = (StructuredResponseFormat extends ResponseFormatUndefined ? BuiltInState : BuiltInState & {
10
+ type MergedAgentState<StructuredResponseFormat extends Record<string, any> | ResponseFormatUndefined, TMiddleware extends readonly AgentMiddleware<any, any, any>[]> = (StructuredResponseFormat extends ResponseFormatUndefined ? Omit<BuiltInState, "jumpTo"> : Omit<BuiltInState, "jumpTo"> & {
10
11
  structuredResponse: StructuredResponseFormat;
11
- }) & InferMiddlewareStates<TMiddlewares>;
12
- type InvokeStateParameter<TMiddlewares extends readonly AgentMiddleware<any, any, any>[]> = (BuiltInState & InferMiddlewareInputStates<TMiddlewares>) | Command<any, any, any> | null;
13
- type AgentGraph<StructuredResponseFormat extends Record<string, any> | ResponseFormatUndefined = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddlewares extends readonly AgentMiddleware<any, any, any>[] = []> = CompiledStateGraph<any, any,
14
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
15
- any, any, MergedAgentState<StructuredResponseFormat, TMiddlewares>, ToAnnotationRoot<ContextSchema>["spec"], unknown>;
16
- declare class ReactAgent<StructuredResponseFormat extends Record<string, any> | ResponseFormatUndefined = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddlewares extends readonly AgentMiddleware<any, any, any>[] = []> {
12
+ }) & InferMiddlewareStates<TMiddleware>;
13
+ type InvokeStateParameter<TMiddleware extends readonly AgentMiddleware<any, any, any>[]> = (BuiltInState & InferMiddlewareInputStates<TMiddleware>) | Command<any, any, any> | null;
14
+ type AgentGraph<StructuredResponseFormat extends Record<string, any> | ResponseFormatUndefined = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware<any, any, any>[] = []> = CompiledStateGraph<any, any, any, any, MergedAgentState<StructuredResponseFormat, TMiddleware>, ToAnnotationRoot<ContextSchema>["spec"], unknown>;
15
+ declare class ReactAgent<StructuredResponseFormat extends Record<string, any> | ResponseFormatUndefined = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware<any, any, any>[] = readonly AgentMiddleware<any, any, any>[]> {
17
16
  #private;
18
17
  options: CreateAgentParams<StructuredResponseFormat, ContextSchema>;
19
18
  constructor(options: CreateAgentParams<StructuredResponseFormat, ContextSchema>);
20
19
  /**
21
- * Get the compiled graph.
20
+ * Get the compiled {@link https://docs.langchain.com/oss/javascript/langgraph/use-graph-api | StateGraph}.
22
21
  */
23
- get graph(): AgentGraph<StructuredResponseFormat, ContextSchema, TMiddlewares>;
22
+ get graph(): AgentGraph<StructuredResponseFormat, ContextSchema, TMiddleware>;
24
23
  /**
25
- * @inheritdoc
24
+ * Executes the agent with the given state and returns the final state after all processing.
25
+ *
26
+ * This method runs the agent's entire workflow synchronously, including:
27
+ * - Processing the input messages through any configured middleware
28
+ * - Calling the language model to generate responses
29
+ * - Executing any tool calls made by the model
30
+ * - Running all middleware hooks (beforeModel, afterModel, etc.)
31
+ *
32
+ * @param state - The initial state for the agent execution. Can be:
33
+ * - An object containing `messages` array and any middleware-specific state properties
34
+ * - A Command object for more advanced control flow
35
+ *
36
+ * @param config - Optional runtime configuration including:
37
+ * @param config.context - The context for the agent execution.
38
+ * @param config.configurable - LangGraph configuration options like `thread_id`, `run_id`, etc.
39
+ * @param config.store - The store for the agent execution for persisting state, see more in {@link https://docs.langchain.com/oss/javascript/langgraph/memory#memory-storage | Memory storage}.
40
+ * @param config.signal - An optional {@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | `AbortSignal`} for the agent execution.
41
+ * @param config.recursionLimit - The recursion limit for the agent execution.
42
+ *
43
+ * @returns A Promise that resolves to the final agent state after execution completes.
44
+ * The returned state includes:
45
+ * - a `messages` property containing an array with all messages (input, AI responses, tool calls/results)
46
+ * - a `structuredResponse` property containing the structured response (if configured)
47
+ * - all state values defined in the middleware
48
+ *
49
+ * @example
50
+ * ```typescript
51
+ * const agent = new ReactAgent({
52
+ * llm: myModel,
53
+ * tools: [calculator, webSearch],
54
+ * responseFormat: z.object({
55
+ * weather: z.string(),
56
+ * }),
57
+ * });
58
+ *
59
+ * const result = await agent.invoke({
60
+ * messages: [{ role: "human", content: "What's the weather in Paris?" }]
61
+ * });
62
+ *
63
+ * console.log(result.structuredResponse.weather); // outputs: "It's sunny and 75°F."
64
+ * ```
26
65
  */
27
- get invoke(): IsAllOptional<InferContextInput<ContextSchema> & InferMiddlewareContextInputs<TMiddlewares>> extends true ? (state: InvokeStateParameter<TMiddlewares>, config?: LangGraphRunnableConfig<InferContextInput<ContextSchema> & InferMiddlewareContextInputs<TMiddlewares>> | undefined) => Promise<MergedAgentState<StructuredResponseFormat, TMiddlewares>> : (state: InvokeStateParameter<TMiddlewares>, config?: LangGraphRunnableConfig<InferContextInput<ContextSchema> & InferMiddlewareContextInputs<TMiddlewares>> | undefined) => Promise<MergedAgentState<StructuredResponseFormat, TMiddlewares>>;
66
+ invoke(state: InvokeStateParameter<TMiddleware>, config?: InvokeConfiguration<InferContextInput<ContextSchema> & InferMiddlewareContextInputs<TMiddleware>>): Promise<MergedAgentState<StructuredResponseFormat, TMiddleware>>;
28
67
  /**
29
- * ToDo(@christian-bromann): Add stream and streamEvents methods
68
+ * Executes the agent with streaming, returning an async iterable of events as they occur.
69
+ *
70
+ * This method runs the agent's workflow similar to `invoke`, but instead of waiting for
71
+ * completion, it streams events in real-time. This allows you to:
72
+ * - Display intermediate results to users as they're generated
73
+ * - Monitor the agent's progress through each step
74
+ * - Handle tool calls and results as they happen
75
+ * - Update UI with streaming responses from the LLM
76
+ *
77
+ * @param state - The initial state for the agent execution. Can be:
78
+ * - An object containing `messages` array and any middleware-specific state properties
79
+ * - A Command object for more advanced control flow
80
+ *
81
+ * @param config - Optional runtime configuration including:
82
+ * @param config.context - The context for the agent execution.
83
+ * @param config.configurable - LangGraph configuration options like `thread_id`, `run_id`, etc.
84
+ * @param config.store - The store for the agent execution for persisting state, see more in {@link https://docs.langchain.com/oss/javascript/langgraph/memory#memory-storage | Memory storage}.
85
+ * @param config.signal - An optional {@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | `AbortSignal`} for the agent execution.
86
+ * @param config.streamMode - The streaming mode for the agent execution, see more in {@link https://docs.langchain.com/oss/javascript/langgraph/streaming#supported-stream-modes | Supported stream modes}.
87
+ * @param config.recursionLimit - The recursion limit for the agent execution.
88
+ *
89
+ * @returns A Promise that resolves to an IterableReadableStream of events.
90
+ * Events include:
91
+ * - `on_chat_model_start`: When the LLM begins processing
92
+ * - `on_chat_model_stream`: Streaming tokens from the LLM
93
+ * - `on_chat_model_end`: When the LLM completes
94
+ * - `on_tool_start`: When a tool execution begins
95
+ * - `on_tool_end`: When a tool execution completes
96
+ * - `on_chain_start`: When middleware chains begin
97
+ * - `on_chain_end`: When middleware chains complete
98
+ * - And other LangGraph v2 stream events
99
+ *
100
+ * @example
101
+ * ```typescript
102
+ * const agent = new ReactAgent({
103
+ * llm: myModel,
104
+ * tools: [calculator, webSearch]
105
+ * });
106
+ *
107
+ * const stream = await agent.stream({
108
+ * messages: [{ role: "human", content: "What's 2+2 and the weather in NYC?" }]
109
+ * });
110
+ *
111
+ * for await (const event of stream) {
112
+ * //
113
+ * }
114
+ * ```
30
115
  */
116
+ stream(state: InvokeStateParameter<TMiddleware>, config?: StreamConfiguration<InferContextInput<ContextSchema> & InferMiddlewareContextInputs<TMiddleware>>): Promise<IterableReadableStream<any>>;
31
117
  /**
32
118
  * Visualize the graph as a PNG image.
33
119
  * @param params - Parameters for the drawMermaidPng method.
@@ -1 +1 @@
1
- {"version":3,"file":"ReactAgent.d.cts","names":["InteropZodObject","Command","CompiledStateGraph","LangGraphRunnableConfig","CreateAgentParams","AgentMiddleware","InferMiddlewareStates","InferMiddlewareInputStates","BuiltInState","InferMiddlewareContextInputs","IsAllOptional","InferContextInput","AnyAnnotationRoot","ToAnnotationRoot","ResponseFormatUndefined","MergedAgentState","Record","StructuredResponseFormat","TMiddlewares","InvokeStateParameter","AgentGraph","ContextSchema","ReactAgent","Promise","ArrayBuffer","Uint8Array"],"sources":["../../../src/agents/middlewareAgent/ReactAgent.d.ts"],"sourcesContent":["/* eslint-disable prefer-destructuring, no-instanceof/no-instanceof, @typescript-eslint/ban-types */\nimport { InteropZodObject } from \"@langchain/core/utils/types\";\nimport { Command, CompiledStateGraph, type LangGraphRunnableConfig } from \"@langchain/langgraph\";\nimport { CreateAgentParams, AgentMiddleware, InferMiddlewareStates, InferMiddlewareInputStates, BuiltInState, InferMiddlewareContextInputs, IsAllOptional, InferContextInput } from \"./types.js\";\nimport { type AnyAnnotationRoot, type ToAnnotationRoot } from \"../annotation.js\";\nimport type { ResponseFormatUndefined } from \"../responses.js\";\n// Helper type to get the state definition with middleware states\ntype MergedAgentState<StructuredResponseFormat extends Record<string, any> | ResponseFormatUndefined, TMiddlewares extends readonly AgentMiddleware<any, any, any>[]> = (StructuredResponseFormat extends ResponseFormatUndefined ? BuiltInState : BuiltInState & {\n structuredResponse: StructuredResponseFormat;\n}) & InferMiddlewareStates<TMiddlewares>;\ntype InvokeStateParameter<TMiddlewares extends readonly AgentMiddleware<any, any, any>[]> = (BuiltInState & InferMiddlewareInputStates<TMiddlewares>) | Command<any, any, any> | null;\ntype AgentGraph<StructuredResponseFormat extends Record<string, any> | ResponseFormatUndefined = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddlewares extends readonly AgentMiddleware<any, any, any>[] = []> = CompiledStateGraph<any, any, \n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nany, any, MergedAgentState<StructuredResponseFormat, TMiddlewares>, ToAnnotationRoot<ContextSchema>[\"spec\"], unknown>;\nexport declare class ReactAgent<StructuredResponseFormat extends Record<string, any> | ResponseFormatUndefined = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddlewares extends readonly AgentMiddleware<any, any, any>[] = []> {\n #private;\n options: CreateAgentParams<StructuredResponseFormat, ContextSchema>;\n constructor(options: CreateAgentParams<StructuredResponseFormat, ContextSchema>);\n /**\n * Get the compiled graph.\n */\n get graph(): AgentGraph<StructuredResponseFormat, ContextSchema, TMiddlewares>;\n /**\n * @inheritdoc\n */\n get invoke(): IsAllOptional<InferContextInput<ContextSchema> & InferMiddlewareContextInputs<TMiddlewares>> extends true ? (state: InvokeStateParameter<TMiddlewares>, config?: LangGraphRunnableConfig<InferContextInput<ContextSchema> & InferMiddlewareContextInputs<TMiddlewares>> | undefined) => Promise<MergedAgentState<StructuredResponseFormat, TMiddlewares>> : (state: InvokeStateParameter<TMiddlewares>, config?: LangGraphRunnableConfig<InferContextInput<ContextSchema> & InferMiddlewareContextInputs<TMiddlewares>> | undefined) => Promise<MergedAgentState<StructuredResponseFormat, TMiddlewares>>;\n /**\n * ToDo(@christian-bromann): Add stream and streamEvents methods\n */\n /**\n * Visualize the graph as a PNG image.\n * @param params - Parameters for the drawMermaidPng method.\n * @param params.withStyles - Whether to include styles in the graph.\n * @param params.curveStyle - The style of the graph's curves.\n * @param params.nodeColors - The colors of the graph's nodes.\n * @param params.wrapLabelNWords - The maximum number of words to wrap in a node's label.\n * @param params.backgroundColor - The background color of the graph.\n * @returns PNG image as a buffer\n */\n drawMermaidPng(params?: {\n withStyles?: boolean;\n curveStyle?: string;\n nodeColors?: Record<string, string>;\n wrapLabelNWords?: number;\n backgroundColor?: string;\n }): Promise<Uint8Array<ArrayBuffer>>;\n /**\n * Draw the graph as a Mermaid string.\n * @param params - Parameters for the drawMermaid method.\n * @param params.withStyles - Whether to include styles in the graph.\n * @param params.curveStyle - The style of the graph's curves.\n * @param params.nodeColors - The colors of the graph's nodes.\n * @param params.wrapLabelNWords - The maximum number of words to wrap in a node's label.\n * @param params.backgroundColor - The background color of the graph.\n * @returns Mermaid string\n */\n drawMermaid(params?: {\n withStyles?: boolean;\n curveStyle?: string;\n nodeColors?: Record<string, string>;\n wrapLabelNWords?: number;\n backgroundColor?: string;\n }):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AAAA,CAAAA,GAAAA,SAAAA,EAAAA,GAe8agB,OAf9ahB,CAesbQ,gBAftbR,CAeucU,wBAfvcV,EAeieW,YAfjeX,CAAAA,CAAAA;EAA0B;AAAyB;AAAA;EAChJ;;;;;;;;;;EAEkD,cAAvDQ,CAAAA,MACqB,CADrBA,EAAAA;IAA2EM,UAAAA,CAAAA,EAAAA,OAAAA;IAAjBR,UAAAA,CAAAA,EAAAA,MAAAA;IAFyMX,UAAAA,CAAAA,EA+BxPc,MA/BwPd,CAAAA,MAAAA,EAAAA,MAAAA,CAAAA;IAAkB,eAAA,CAAA,EAAA,MAAA;IAG1QoB,eAAU,CAAA,EAAA,MAAA;EAAA,CAAA,CAAA,EA+BvBC,OA/BuB,CA+BfE,UA/Be,CA+BJD,WA/BI,CAAA,CAAA;EAAA;;;;;;;;;;EAED,WACaP,CAAAA,MAIsC,CAJtCA,EAAAA;IAA0BI,UAAAA,CAAAA,EAAAA,OAAAA;IAA5CjB,UAAAA,CAAAA,EAAAA,MAAAA;IAIGa,UAAAA,CAAAA,EAsCPD,MAtCOC,CAAAA,MAAAA,EAAAA,MAAAA,CAAAA;IAA0BI,eAAAA,CAAAA,EAAAA,MAAAA;IAAeH,eAAAA,CAAAA,EAAAA,MAAAA;EAAY,CAAA,CAAA,EAyCzEK,OAzCSH,CAAAA,MAAAA,CAAAA"}
1
+ {"version":3,"file":"ReactAgent.d.cts","names":["InteropZodObject","Command","CompiledStateGraph","IterableReadableStream","CreateAgentParams","AgentMiddleware","InferMiddlewareStates","InferMiddlewareInputStates","BuiltInState","InferMiddlewareContextInputs","InferContextInput","InvokeConfiguration","StreamConfiguration","AnyAnnotationRoot","ToAnnotationRoot","ResponseFormatUndefined","MergedAgentState","Record","StructuredResponseFormat","Omit","TMiddleware","InvokeStateParameter","AgentGraph","ContextSchema","ReactAgent","Promise","ArrayBuffer","Uint8Array"],"sources":["../../../src/agents/middlewareAgent/ReactAgent.d.ts"],"sourcesContent":["/* eslint-disable no-instanceof/no-instanceof */\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { InteropZodObject } from \"@langchain/core/utils/types\";\nimport { Command, CompiledStateGraph } from \"@langchain/langgraph\";\nimport { IterableReadableStream } from \"@langchain/core/utils/stream\";\nimport type { CreateAgentParams, AgentMiddleware, InferMiddlewareStates, InferMiddlewareInputStates, BuiltInState, InferMiddlewareContextInputs, InferContextInput, InvokeConfiguration, StreamConfiguration } from \"./types.js\";\nimport { type AnyAnnotationRoot, type ToAnnotationRoot, type ResponseFormatUndefined } from \"../annotation.js\";\n// Helper type to get the state definition with middleware states\ntype MergedAgentState<StructuredResponseFormat extends Record<string, any> | ResponseFormatUndefined, TMiddleware extends readonly AgentMiddleware<any, any, any>[]> = (StructuredResponseFormat extends ResponseFormatUndefined ? Omit<BuiltInState, \"jumpTo\"> : Omit<BuiltInState, \"jumpTo\"> & {\n structuredResponse: StructuredResponseFormat;\n}) & InferMiddlewareStates<TMiddleware>;\ntype InvokeStateParameter<TMiddleware extends readonly AgentMiddleware<any, any, any>[]> = (BuiltInState & InferMiddlewareInputStates<TMiddleware>) | Command<any, any, any> | null;\ntype AgentGraph<StructuredResponseFormat extends Record<string, any> | ResponseFormatUndefined = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware<any, any, any>[] = []> = CompiledStateGraph<any, any, any, any, MergedAgentState<StructuredResponseFormat, TMiddleware>, ToAnnotationRoot<ContextSchema>[\"spec\"], unknown>;\nexport declare class ReactAgent<StructuredResponseFormat extends Record<string, any> | ResponseFormatUndefined = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware<any, any, any>[] = readonly AgentMiddleware<any, any, any>[]> {\n #private;\n options: CreateAgentParams<StructuredResponseFormat, ContextSchema>;\n constructor(options: CreateAgentParams<StructuredResponseFormat, ContextSchema>);\n /**\n * Get the compiled {@link https://docs.langchain.com/oss/javascript/langgraph/use-graph-api | StateGraph}.\n */\n get graph(): AgentGraph<StructuredResponseFormat, ContextSchema, TMiddleware>;\n /**\n * Executes the agent with the given state and returns the final state after all processing.\n *\n * This method runs the agent's entire workflow synchronously, including:\n * - Processing the input messages through any configured middleware\n * - Calling the language model to generate responses\n * - Executing any tool calls made by the model\n * - Running all middleware hooks (beforeModel, afterModel, etc.)\n *\n * @param state - The initial state for the agent execution. Can be:\n * - An object containing `messages` array and any middleware-specific state properties\n * - A Command object for more advanced control flow\n *\n * @param config - Optional runtime configuration including:\n * @param config.context - The context for the agent execution.\n * @param config.configurable - LangGraph configuration options like `thread_id`, `run_id`, etc.\n * @param config.store - The store for the agent execution for persisting state, see more in {@link https://docs.langchain.com/oss/javascript/langgraph/memory#memory-storage | Memory storage}.\n * @param config.signal - An optional {@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | `AbortSignal`} for the agent execution.\n * @param config.recursionLimit - The recursion limit for the agent execution.\n *\n * @returns A Promise that resolves to the final agent state after execution completes.\n * The returned state includes:\n * - a `messages` property containing an array with all messages (input, AI responses, tool calls/results)\n * - a `structuredResponse` property containing the structured response (if configured)\n * - all state values defined in the middleware\n *\n * @example\n * ```typescript\n * const agent = new ReactAgent({\n * llm: myModel,\n * tools: [calculator, webSearch],\n * responseFormat: z.object({\n * weather: z.string(),\n * }),\n * });\n *\n * const result = await agent.invoke({\n * messages: [{ role: \"human\", content: \"What's the weather in Paris?\" }]\n * });\n *\n * console.log(result.structuredResponse.weather); // outputs: \"It's sunny and 75°F.\"\n * ```\n */\n invoke(state: InvokeStateParameter<TMiddleware>, config?: InvokeConfiguration<InferContextInput<ContextSchema> & InferMiddlewareContextInputs<TMiddleware>>): Promise<MergedAgentState<StructuredResponseFormat, TMiddleware>>;\n /**\n * Executes the agent with streaming, returning an async iterable of events as they occur.\n *\n * This method runs the agent's workflow similar to `invoke`, but instead of waiting for\n * completion, it streams events in real-time. This allows you to:\n * - Display intermediate results to users as they're generated\n * - Monitor the agent's progress through each step\n * - Handle tool calls and results as they happen\n * - Update UI with streaming responses from the LLM\n *\n * @param state - The initial state for the agent execution. Can be:\n * - An object containing `messages` array and any middleware-specific state properties\n * - A Command object for more advanced control flow\n *\n * @param config - Optional runtime configuration including:\n * @param config.context - The context for the agent execution.\n * @param config.configurable - LangGraph configuration options like `thread_id`, `run_id`, etc.\n * @param config.store - The store for the agent execution for persisting state, see more in {@link https://docs.langchain.com/oss/javascript/langgraph/memory#memory-storage | Memory storage}.\n * @param config.signal - An optional {@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | `AbortSignal`} for the agent execution.\n * @param config.streamMode - The streaming mode for the agent execution, see more in {@link https://docs.langchain.com/oss/javascript/langgraph/streaming#supported-stream-modes | Supported stream modes}.\n * @param config.recursionLimit - The recursion limit for the agent execution.\n *\n * @returns A Promise that resolves to an IterableReadableStream of events.\n * Events include:\n * - `on_chat_model_start`: When the LLM begins processing\n * - `on_chat_model_stream`: Streaming tokens from the LLM\n * - `on_chat_model_end`: When the LLM completes\n * - `on_tool_start`: When a tool execution begins\n * - `on_tool_end`: When a tool execution completes\n * - `on_chain_start`: When middleware chains begin\n * - `on_chain_end`: When middleware chains complete\n * - And other LangGraph v2 stream events\n *\n * @example\n * ```typescript\n * const agent = new ReactAgent({\n * llm: myModel,\n * tools: [calculator, webSearch]\n * });\n *\n * const stream = await agent.stream({\n * messages: [{ role: \"human\", content: \"What's 2+2 and the weather in NYC?\" }]\n * });\n *\n * for await (const event of stream) {\n * //\n * }\n * ```\n */\n stream(state: InvokeStateParameter<TMiddleware>, config?: StreamConfiguration<InferContextInput<ContextSchema> & InferMiddlewareContextInputs<TMiddleware>>): Promise<IterableReadableStream<any>>;\n /**\n * Visualize the graph as a PNG image.\n * @param params - Parameters for the drawMermaidPng method.\n * @param params.withStyles - Whether to include styles in the graph.\n * @param params.curveStyle - The style of the graph's curves.\n * @param params.nodeColors - The colors of the graph's nodes.\n * @param params.wrapLabelNWords - The maximum number of words to wrap in a node's label.\n * @param params.backgroundColor - The background color of the graph.\n * @returns PNG image as a buffer\n */\n drawMermaidPng(params?: {\n withStyles?: boolean;\n curveStyle?: string;\n nodeColors?: Record<string, string>;\n wrapLabelNWords?: number;\n backgroundColor?: string;\n }): Promise<Uint8Array<ArrayBuffer>>;\n /**\n * Draw the graph as a Mermaid string.\n * @param params - Parameters for the drawMermaid method.\n * @param params.withStyles - Whether to include styles in the graph.\n * @param params.curveStyle - The style of the graph's curves.\n * @param params.nodeColors - The colors of the graph's nodes.\n * @param params.wrapLabelNWords - The maximum number of words to wrap in a node's label.\n * @param params.backgroundColor - The background color of the graph.\n * @returns Mermaid string\n */\n drawMermaid(params?: {\n withStyles?: boolean;\n curveStyle?: string;\n nodeColors?: Record<string, string>;\n wrapLabelNWords?: number;\n backgroundColor?: string;\n }): Promise<string>;\n}\nexport {};\n"],"mappings":";;;;;;;;AAM+G;KAE1GgB,gBAAgB,CAAA,iCAAkCC,MAAlC,CAAA,MAAA,EAAA,GAAA,CAAA,GAAwDF,uBAAxD,EAAA,oBAAA,SAA8GV,eAA9G,CAAA,GAAA,EAAA,GAAA,EAAA,GAAA,CAAA,EAAA,CAAA,GAAA,CAAmJa,wBAAnJ,SAAoLH,uBAApL,GAA8MI,IAA9M,CAAmNX,YAAnN,EAAA,QAAA,CAAA,GAA6OW,IAA7O,CAAkPX,YAAlP,EAAA,QAAA,CAAA,GAAA;EAAA,kBAAkCS,EAC/BC,wBAD+BD;CAAM,CAAA,GAExDX,qBAFwES,CAElDK,WAFkDL,CAAAA;KAGxEM,oBAH8HhB,CAAAA,oBAAAA,SAG5EA,eAH4EA,CAAAA,GAAAA,EAAAA,GAAAA,EAAAA,GAAAA,CAAAA,EAAAA,CAAAA,GAAAA,CAGvCG,YAHuCH,GAGxBE,0BAHwBF,CAGGe,WAHHf,CAAAA,CAAAA,GAGmBJ,OAHnBI,CAAAA,GAAAA,EAAAA,GAAAA,EAAAA,GAAAA,CAAAA,GAAAA,IAAAA;KAI9Hi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gEc,WAVhEd,CAAAA;EAAqB;AAAA;;;;;;;AACmI;AAAA;;;;;;;;;;;;;;;AACiI;AAC9R;;;;;;;;;;;;;;;;;;EAOmE,MAAEc,CAAAA,KAAAA,EA4CnDC,oBA5CmDD,CA4C9BA,WA5C8BA,CAAAA,EAAAA,MAAAA,CAAAA,EA4CPT,mBA5COS,CA4CaV,iBA5CbU,CA4C+BG,aA5C/BH,CAAAA,GA4CgDX,4BA5ChDW,CA4C6EA,WA5C7EA,CAAAA,CAAAA,CAAAA,EA4C6FK,OA5C7FL,CA4CqGJ,gBA5CrGI,CA4CsHF,wBA5CtHE,EA4CgJA,WA5ChJA,CAAAA,CAAAA;EAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgIjE;;;;;;;;;;;;;;;;;;;;;;gBAlCGC,qBAAqBD,uBAAuBR,oBAAoBF,kBAAkBa,iBAAiBd,6BAA6BW,gBAAgBK,QAAQtB;;;;;;;;;;;;;;iBAcrJc;;;MAGbQ,QAAQE,WAAWD;;;;;;;;;;;;;;iBAcNT;;;MAGbQ"}
@@ -1,33 +1,119 @@
1
- import { ResponseFormatUndefined } from "../responses.js";
2
- import { AnyAnnotationRoot, ToAnnotationRoot } from "../annotation.js";
3
- import { AgentMiddleware, BuiltInState, CreateAgentParams, InferContextInput, InferMiddlewareContextInputs, InferMiddlewareInputStates, InferMiddlewareStates, IsAllOptional } from "./types.js";
4
- import { Command, CompiledStateGraph, LangGraphRunnableConfig } from "@langchain/langgraph";
1
+ import { AnyAnnotationRoot, ResponseFormatUndefined, ToAnnotationRoot } from "../annotation.js";
2
+ import { AgentMiddleware, BuiltInState, CreateAgentParams, InferContextInput, InferMiddlewareContextInputs, InferMiddlewareInputStates, InferMiddlewareStates, InvokeConfiguration, StreamConfiguration } from "./types.js";
3
+ import { IterableReadableStream } from "@langchain/core/utils/stream";
4
+ import { Command, CompiledStateGraph } from "@langchain/langgraph";
5
5
  import { InteropZodObject } from "@langchain/core/utils/types";
6
6
 
7
7
  //#region src/agents/middlewareAgent/ReactAgent.d.ts
8
+
8
9
  // Helper type to get the state definition with middleware states
9
- type MergedAgentState<StructuredResponseFormat extends Record<string, any> | ResponseFormatUndefined, TMiddlewares extends readonly AgentMiddleware<any, any, any>[]> = (StructuredResponseFormat extends ResponseFormatUndefined ? BuiltInState : BuiltInState & {
10
+ type MergedAgentState<StructuredResponseFormat extends Record<string, any> | ResponseFormatUndefined, TMiddleware extends readonly AgentMiddleware<any, any, any>[]> = (StructuredResponseFormat extends ResponseFormatUndefined ? Omit<BuiltInState, "jumpTo"> : Omit<BuiltInState, "jumpTo"> & {
10
11
  structuredResponse: StructuredResponseFormat;
11
- }) & InferMiddlewareStates<TMiddlewares>;
12
- type InvokeStateParameter<TMiddlewares extends readonly AgentMiddleware<any, any, any>[]> = (BuiltInState & InferMiddlewareInputStates<TMiddlewares>) | Command<any, any, any> | null;
13
- type AgentGraph<StructuredResponseFormat extends Record<string, any> | ResponseFormatUndefined = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddlewares extends readonly AgentMiddleware<any, any, any>[] = []> = CompiledStateGraph<any, any,
14
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
15
- any, any, MergedAgentState<StructuredResponseFormat, TMiddlewares>, ToAnnotationRoot<ContextSchema>["spec"], unknown>;
16
- declare class ReactAgent<StructuredResponseFormat extends Record<string, any> | ResponseFormatUndefined = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddlewares extends readonly AgentMiddleware<any, any, any>[] = []> {
12
+ }) & InferMiddlewareStates<TMiddleware>;
13
+ type InvokeStateParameter<TMiddleware extends readonly AgentMiddleware<any, any, any>[]> = (BuiltInState & InferMiddlewareInputStates<TMiddleware>) | Command<any, any, any> | null;
14
+ type AgentGraph<StructuredResponseFormat extends Record<string, any> | ResponseFormatUndefined = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware<any, any, any>[] = []> = CompiledStateGraph<any, any, any, any, MergedAgentState<StructuredResponseFormat, TMiddleware>, ToAnnotationRoot<ContextSchema>["spec"], unknown>;
15
+ declare class ReactAgent<StructuredResponseFormat extends Record<string, any> | ResponseFormatUndefined = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware<any, any, any>[] = readonly AgentMiddleware<any, any, any>[]> {
17
16
  #private;
18
17
  options: CreateAgentParams<StructuredResponseFormat, ContextSchema>;
19
18
  constructor(options: CreateAgentParams<StructuredResponseFormat, ContextSchema>);
20
19
  /**
21
- * Get the compiled graph.
20
+ * Get the compiled {@link https://docs.langchain.com/oss/javascript/langgraph/use-graph-api | StateGraph}.
22
21
  */
23
- get graph(): AgentGraph<StructuredResponseFormat, ContextSchema, TMiddlewares>;
22
+ get graph(): AgentGraph<StructuredResponseFormat, ContextSchema, TMiddleware>;
24
23
  /**
25
- * @inheritdoc
24
+ * Executes the agent with the given state and returns the final state after all processing.
25
+ *
26
+ * This method runs the agent's entire workflow synchronously, including:
27
+ * - Processing the input messages through any configured middleware
28
+ * - Calling the language model to generate responses
29
+ * - Executing any tool calls made by the model
30
+ * - Running all middleware hooks (beforeModel, afterModel, etc.)
31
+ *
32
+ * @param state - The initial state for the agent execution. Can be:
33
+ * - An object containing `messages` array and any middleware-specific state properties
34
+ * - A Command object for more advanced control flow
35
+ *
36
+ * @param config - Optional runtime configuration including:
37
+ * @param config.context - The context for the agent execution.
38
+ * @param config.configurable - LangGraph configuration options like `thread_id`, `run_id`, etc.
39
+ * @param config.store - The store for the agent execution for persisting state, see more in {@link https://docs.langchain.com/oss/javascript/langgraph/memory#memory-storage | Memory storage}.
40
+ * @param config.signal - An optional {@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | `AbortSignal`} for the agent execution.
41
+ * @param config.recursionLimit - The recursion limit for the agent execution.
42
+ *
43
+ * @returns A Promise that resolves to the final agent state after execution completes.
44
+ * The returned state includes:
45
+ * - a `messages` property containing an array with all messages (input, AI responses, tool calls/results)
46
+ * - a `structuredResponse` property containing the structured response (if configured)
47
+ * - all state values defined in the middleware
48
+ *
49
+ * @example
50
+ * ```typescript
51
+ * const agent = new ReactAgent({
52
+ * llm: myModel,
53
+ * tools: [calculator, webSearch],
54
+ * responseFormat: z.object({
55
+ * weather: z.string(),
56
+ * }),
57
+ * });
58
+ *
59
+ * const result = await agent.invoke({
60
+ * messages: [{ role: "human", content: "What's the weather in Paris?" }]
61
+ * });
62
+ *
63
+ * console.log(result.structuredResponse.weather); // outputs: "It's sunny and 75°F."
64
+ * ```
26
65
  */
27
- get invoke(): IsAllOptional<InferContextInput<ContextSchema> & InferMiddlewareContextInputs<TMiddlewares>> extends true ? (state: InvokeStateParameter<TMiddlewares>, config?: LangGraphRunnableConfig<InferContextInput<ContextSchema> & InferMiddlewareContextInputs<TMiddlewares>> | undefined) => Promise<MergedAgentState<StructuredResponseFormat, TMiddlewares>> : (state: InvokeStateParameter<TMiddlewares>, config?: LangGraphRunnableConfig<InferContextInput<ContextSchema> & InferMiddlewareContextInputs<TMiddlewares>> | undefined) => Promise<MergedAgentState<StructuredResponseFormat, TMiddlewares>>;
66
+ invoke(state: InvokeStateParameter<TMiddleware>, config?: InvokeConfiguration<InferContextInput<ContextSchema> & InferMiddlewareContextInputs<TMiddleware>>): Promise<MergedAgentState<StructuredResponseFormat, TMiddleware>>;
28
67
  /**
29
- * ToDo(@christian-bromann): Add stream and streamEvents methods
68
+ * Executes the agent with streaming, returning an async iterable of events as they occur.
69
+ *
70
+ * This method runs the agent's workflow similar to `invoke`, but instead of waiting for
71
+ * completion, it streams events in real-time. This allows you to:
72
+ * - Display intermediate results to users as they're generated
73
+ * - Monitor the agent's progress through each step
74
+ * - Handle tool calls and results as they happen
75
+ * - Update UI with streaming responses from the LLM
76
+ *
77
+ * @param state - The initial state for the agent execution. Can be:
78
+ * - An object containing `messages` array and any middleware-specific state properties
79
+ * - A Command object for more advanced control flow
80
+ *
81
+ * @param config - Optional runtime configuration including:
82
+ * @param config.context - The context for the agent execution.
83
+ * @param config.configurable - LangGraph configuration options like `thread_id`, `run_id`, etc.
84
+ * @param config.store - The store for the agent execution for persisting state, see more in {@link https://docs.langchain.com/oss/javascript/langgraph/memory#memory-storage | Memory storage}.
85
+ * @param config.signal - An optional {@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | `AbortSignal`} for the agent execution.
86
+ * @param config.streamMode - The streaming mode for the agent execution, see more in {@link https://docs.langchain.com/oss/javascript/langgraph/streaming#supported-stream-modes | Supported stream modes}.
87
+ * @param config.recursionLimit - The recursion limit for the agent execution.
88
+ *
89
+ * @returns A Promise that resolves to an IterableReadableStream of events.
90
+ * Events include:
91
+ * - `on_chat_model_start`: When the LLM begins processing
92
+ * - `on_chat_model_stream`: Streaming tokens from the LLM
93
+ * - `on_chat_model_end`: When the LLM completes
94
+ * - `on_tool_start`: When a tool execution begins
95
+ * - `on_tool_end`: When a tool execution completes
96
+ * - `on_chain_start`: When middleware chains begin
97
+ * - `on_chain_end`: When middleware chains complete
98
+ * - And other LangGraph v2 stream events
99
+ *
100
+ * @example
101
+ * ```typescript
102
+ * const agent = new ReactAgent({
103
+ * llm: myModel,
104
+ * tools: [calculator, webSearch]
105
+ * });
106
+ *
107
+ * const stream = await agent.stream({
108
+ * messages: [{ role: "human", content: "What's 2+2 and the weather in NYC?" }]
109
+ * });
110
+ *
111
+ * for await (const event of stream) {
112
+ * //
113
+ * }
114
+ * ```
30
115
  */
116
+ stream(state: InvokeStateParameter<TMiddleware>, config?: StreamConfiguration<InferContextInput<ContextSchema> & InferMiddlewareContextInputs<TMiddleware>>): Promise<IterableReadableStream<any>>;
31
117
  /**
32
118
  * Visualize the graph as a PNG image.
33
119
  * @param params - Parameters for the drawMermaidPng method.
@@ -1 +1 @@
1
- {"version":3,"file":"ReactAgent.d.ts","names":["InteropZodObject","Command","CompiledStateGraph","LangGraphRunnableConfig","CreateAgentParams","AgentMiddleware","InferMiddlewareStates","InferMiddlewareInputStates","BuiltInState","InferMiddlewareContextInputs","IsAllOptional","InferContextInput","AnyAnnotationRoot","ToAnnotationRoot","ResponseFormatUndefined","MergedAgentState","Record","StructuredResponseFormat","TMiddlewares","InvokeStateParameter","AgentGraph","ContextSchema","ReactAgent","Promise","ArrayBuffer","Uint8Array"],"sources":["../../../src/agents/middlewareAgent/ReactAgent.d.ts"],"sourcesContent":["/* eslint-disable prefer-destructuring, no-instanceof/no-instanceof, @typescript-eslint/ban-types */\nimport { InteropZodObject } from \"@langchain/core/utils/types\";\nimport { Command, CompiledStateGraph, type LangGraphRunnableConfig } from \"@langchain/langgraph\";\nimport { CreateAgentParams, AgentMiddleware, InferMiddlewareStates, InferMiddlewareInputStates, BuiltInState, InferMiddlewareContextInputs, IsAllOptional, InferContextInput } from \"./types.js\";\nimport { type AnyAnnotationRoot, type ToAnnotationRoot } from \"../annotation.js\";\nimport type { ResponseFormatUndefined } from \"../responses.js\";\n// Helper type to get the state definition with middleware states\ntype MergedAgentState<StructuredResponseFormat extends Record<string, any> | ResponseFormatUndefined, TMiddlewares extends readonly AgentMiddleware<any, any, any>[]> = (StructuredResponseFormat extends ResponseFormatUndefined ? BuiltInState : BuiltInState & {\n structuredResponse: StructuredResponseFormat;\n}) & InferMiddlewareStates<TMiddlewares>;\ntype InvokeStateParameter<TMiddlewares extends readonly AgentMiddleware<any, any, any>[]> = (BuiltInState & InferMiddlewareInputStates<TMiddlewares>) | Command<any, any, any> | null;\ntype AgentGraph<StructuredResponseFormat extends Record<string, any> | ResponseFormatUndefined = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddlewares extends readonly AgentMiddleware<any, any, any>[] = []> = CompiledStateGraph<any, any, \n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nany, any, MergedAgentState<StructuredResponseFormat, TMiddlewares>, ToAnnotationRoot<ContextSchema>[\"spec\"], unknown>;\nexport declare class ReactAgent<StructuredResponseFormat extends Record<string, any> | ResponseFormatUndefined = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddlewares extends readonly AgentMiddleware<any, any, any>[] = []> {\n #private;\n options: CreateAgentParams<StructuredResponseFormat, ContextSchema>;\n constructor(options: CreateAgentParams<StructuredResponseFormat, ContextSchema>);\n /**\n * Get the compiled graph.\n */\n get graph(): AgentGraph<StructuredResponseFormat, ContextSchema, TMiddlewares>;\n /**\n * @inheritdoc\n */\n get invoke(): IsAllOptional<InferContextInput<ContextSchema> & InferMiddlewareContextInputs<TMiddlewares>> extends true ? (state: InvokeStateParameter<TMiddlewares>, config?: LangGraphRunnableConfig<InferContextInput<ContextSchema> & InferMiddlewareContextInputs<TMiddlewares>> | undefined) => Promise<MergedAgentState<StructuredResponseFormat, TMiddlewares>> : (state: InvokeStateParameter<TMiddlewares>, config?: LangGraphRunnableConfig<InferContextInput<ContextSchema> & InferMiddlewareContextInputs<TMiddlewares>> | undefined) => Promise<MergedAgentState<StructuredResponseFormat, TMiddlewares>>;\n /**\n * ToDo(@christian-bromann): Add stream and streamEvents methods\n */\n /**\n * Visualize the graph as a PNG image.\n * @param params - Parameters for the drawMermaidPng method.\n * @param params.withStyles - Whether to include styles in the graph.\n * @param params.curveStyle - The style of the graph's curves.\n * @param params.nodeColors - The colors of the graph's nodes.\n * @param params.wrapLabelNWords - The maximum number of words to wrap in a node's label.\n * @param params.backgroundColor - The background color of the graph.\n * @returns PNG image as a buffer\n */\n drawMermaidPng(params?: {\n withStyles?: boolean;\n curveStyle?: string;\n nodeColors?: Record<string, string>;\n wrapLabelNWords?: number;\n backgroundColor?: string;\n }): Promise<Uint8Array<ArrayBuffer>>;\n /**\n * Draw the graph as a Mermaid string.\n * @param params - Parameters for the drawMermaid method.\n * @param params.withStyles - Whether to include styles in the graph.\n * @param params.curveStyle - The style of the graph's curves.\n * @param params.nodeColors - The colors of the graph's nodes.\n * @param params.wrapLabelNWords - The maximum number of words to wrap in a node's label.\n * @param params.backgroundColor - The background color of the graph.\n * @returns Mermaid string\n */\n drawMermaid(params?: {\n withStyles?: boolean;\n curveStyle?: string;\n nodeColors?: Record<string, string>;\n wrapLabelNWords?: number;\n backgroundColor?: string;\n }): Promise<string>;\n}\nexport {};\n"],"mappings":";;;;;;;;AAK+D,KAE1De,gBAAAA,CAAAA,iCAAkDC,MAAlC,CAAA,MAAA,EAAA,GAAA,CAAA,GAAwDF,uBAAxD,EAAA,qBAAA,SAA+GT,eAA/G,CAAA,GAAA,EAAA,GAAA,EAAA,GAAA,CAAA,EAAA,CAAA,GAAA,CAAoJY,wBAApJ,SAAqLH,uBAArL,GAA+MN,YAA/M,GAA8NA,YAA9N,GAAA;EAAA,kBAAA,EACGS,wBADH;CAAA,CAAA,GAEhBX,qBAFkDU,CAE5BE,YAF4BF,CAAAA;KAGlDG,oBAHwEL,CAAAA,qBAAAA,SAGrBT,eAHqBS,CAAAA,GAAAA,EAAAA,GAAAA,EAAAA,GAAAA,CAAAA,EAAAA,CAAAA,GAAAA,CAGgBN,YAHhBM,GAG+BP,0BAH/BO,CAG0DI,YAH1DJ,CAAAA,CAAAA,GAG2Eb,OAH3Ea,CAAAA,GAAAA,EAAAA,GAAAA,EAAAA,GAAAA,CAAAA,GAAAA,IAAAA;KAIxEM,UAJ+Hf,CAAAA,iCAInFW,MAJmFX,CAAAA,MAAAA,EAAAA,GAAAA,CAAAA,GAI7DS,uBAJ6DT,GAInCW,MAJmCX,CAAAA,MAAAA,EAAAA,GAAAA,CAAAA,EAAAA,sBAIQO,iBAJRP,GAI4BL,gBAJ5BK,GAI+CO,iBAJ/CP,EAAAA,qBAAAA,SAIgGA,eAJhGA,CAAAA,GAAAA,EAAAA,GAAAA,EAAAA,GAAAA,CAAAA,EAAAA,GAAAA,EAAAA,CAAAA,GAIyIH,kBAJzIG,CAAAA,GAAAA,EAAAA,GAAAA;;GAA6D,EAAA,GAASS,EAMhMC,gBANgMD,CAM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AAA,KAAAA,EAe0QY,oBAf1QZ,CAe+RW,YAf/RX,CAAAA,EAAAA,MAAAA,CAAAA,EAeuTJ,uBAfvTI,CAe+UI,iBAf/UJ,CAeiWc,aAfjWd,CAAAA,GAekXE,4BAflXF,CAe+YW,YAf/YX,CAAAA,CAAAA,GAAAA,SAAAA,EAAAA,GAe8agB,OAf9ahB,CAesbQ,gBAftbR,CAeucU,wBAfvcV,EAeieW,YAfjeX,CAAAA,CAAAA;EAA0B;AAAyB;AAAA;EAChJ;;;;;;;;;;EAEkD,cAAvDQ,CAAAA,MACqB,CADrBA,EAAAA;IAA2EM,UAAAA,CAAAA,EAAAA,OAAAA;IAAjBR,UAAAA,CAAAA,EAAAA,MAAAA;IAFyMX,UAAAA,CAAAA,EA+BxPc,MA/BwPd,CAAAA,MAAAA,EAAAA,MAAAA,CAAAA;IAAkB,eAAA,CAAA,EAAA,MAAA;IAG1QoB,eAAU,CAAA,EAAA,MAAA;EAAA,CAAA,CAAA,EA+BvBC,OA/BuB,CA+BfE,UA/Be,CA+BJD,WA/BI,CAAA,CAAA;EAAA;;;;;;;;;;EAED,WACaP,CAAAA,MAIsC,CAJtCA,EAAAA;IAA0BI,UAAAA,CAAAA,EAAAA,OAAAA;IAA5CjB,UAAAA,CAAAA,EAAAA,MAAAA;IAIGa,UAAAA,CAAAA,EAsCPD,MAtCOC,CAAAA,MAAAA,EAAAA,MAAAA,CAAAA;IAA0BI,eAAAA,CAAAA,EAAAA,MAAAA;IAAeH,eAAAA,CAAAA,EAAAA,MAAAA;EAAY,CAAA,CAAA,EAyCzEK,OAzCSH,CAAAA,MAAAA,CAAAA"}
1
+ {"version":3,"file":"ReactAgent.d.ts","names":["InteropZodObject","Command","CompiledStateGraph","IterableReadableStream","CreateAgentParams","AgentMiddleware","InferMiddlewareStates","InferMiddlewareInputStates","BuiltInState","InferMiddlewareContextInputs","InferContextInput","InvokeConfiguration","StreamConfiguration","AnyAnnotationRoot","ToAnnotationRoot","ResponseFormatUndefined","MergedAgentState","Record","StructuredResponseFormat","Omit","TMiddleware","InvokeStateParameter","AgentGraph","ContextSchema","ReactAgent","Promise","ArrayBuffer","Uint8Array"],"sources":["../../../src/agents/middlewareAgent/ReactAgent.d.ts"],"sourcesContent":["/* eslint-disable no-instanceof/no-instanceof */\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { InteropZodObject } from \"@langchain/core/utils/types\";\nimport { Command, CompiledStateGraph } from \"@langchain/langgraph\";\nimport { IterableReadableStream } from \"@langchain/core/utils/stream\";\nimport type { CreateAgentParams, AgentMiddleware, InferMiddlewareStates, InferMiddlewareInputStates, BuiltInState, InferMiddlewareContextInputs, InferContextInput, InvokeConfiguration, StreamConfiguration } from \"./types.js\";\nimport { type AnyAnnotationRoot, type ToAnnotationRoot, type ResponseFormatUndefined } from \"../annotation.js\";\n// Helper type to get the state definition with middleware states\ntype MergedAgentState<StructuredResponseFormat extends Record<string, any> | ResponseFormatUndefined, TMiddleware extends readonly AgentMiddleware<any, any, any>[]> = (StructuredResponseFormat extends ResponseFormatUndefined ? Omit<BuiltInState, \"jumpTo\"> : Omit<BuiltInState, \"jumpTo\"> & {\n structuredResponse: StructuredResponseFormat;\n}) & InferMiddlewareStates<TMiddleware>;\ntype InvokeStateParameter<TMiddleware extends readonly AgentMiddleware<any, any, any>[]> = (BuiltInState & InferMiddlewareInputStates<TMiddleware>) | Command<any, any, any> | null;\ntype AgentGraph<StructuredResponseFormat extends Record<string, any> | ResponseFormatUndefined = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware<any, any, any>[] = []> = CompiledStateGraph<any, any, any, any, MergedAgentState<StructuredResponseFormat, TMiddleware>, ToAnnotationRoot<ContextSchema>[\"spec\"], unknown>;\nexport declare class ReactAgent<StructuredResponseFormat extends Record<string, any> | ResponseFormatUndefined = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware<any, any, any>[] = readonly AgentMiddleware<any, any, any>[]> {\n #private;\n options: CreateAgentParams<StructuredResponseFormat, ContextSchema>;\n constructor(options: CreateAgentParams<StructuredResponseFormat, ContextSchema>);\n /**\n * Get the compiled {@link https://docs.langchain.com/oss/javascript/langgraph/use-graph-api | StateGraph}.\n */\n get graph(): AgentGraph<StructuredResponseFormat, ContextSchema, TMiddleware>;\n /**\n * Executes the agent with the given state and returns the final state after all processing.\n *\n * This method runs the agent's entire workflow synchronously, including:\n * - Processing the input messages through any configured middleware\n * - Calling the language model to generate responses\n * - Executing any tool calls made by the model\n * - Running all middleware hooks (beforeModel, afterModel, etc.)\n *\n * @param state - The initial state for the agent execution. Can be:\n * - An object containing `messages` array and any middleware-specific state properties\n * - A Command object for more advanced control flow\n *\n * @param config - Optional runtime configuration including:\n * @param config.context - The context for the agent execution.\n * @param config.configurable - LangGraph configuration options like `thread_id`, `run_id`, etc.\n * @param config.store - The store for the agent execution for persisting state, see more in {@link https://docs.langchain.com/oss/javascript/langgraph/memory#memory-storage | Memory storage}.\n * @param config.signal - An optional {@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | `AbortSignal`} for the agent execution.\n * @param config.recursionLimit - The recursion limit for the agent execution.\n *\n * @returns A Promise that resolves to the final agent state after execution completes.\n * The returned state includes:\n * - a `messages` property containing an array with all messages (input, AI responses, tool calls/results)\n * - a `structuredResponse` property containing the structured response (if configured)\n * - all state values defined in the middleware\n *\n * @example\n * ```typescript\n * const agent = new ReactAgent({\n * llm: myModel,\n * tools: [calculator, webSearch],\n * responseFormat: z.object({\n * weather: z.string(),\n * }),\n * });\n *\n * const result = await agent.invoke({\n * messages: [{ role: \"human\", content: \"What's the weather in Paris?\" }]\n * });\n *\n * console.log(result.structuredResponse.weather); // outputs: \"It's sunny and 75°F.\"\n * ```\n */\n invoke(state: InvokeStateParameter<TMiddleware>, config?: InvokeConfiguration<InferContextInput<ContextSchema> & InferMiddlewareContextInputs<TMiddleware>>): Promise<MergedAgentState<StructuredResponseFormat, TMiddleware>>;\n /**\n * Executes the agent with streaming, returning an async iterable of events as they occur.\n *\n * This method runs the agent's workflow similar to `invoke`, but instead of waiting for\n * completion, it streams events in real-time. This allows you to:\n * - Display intermediate results to users as they're generated\n * - Monitor the agent's progress through each step\n * - Handle tool calls and results as they happen\n * - Update UI with streaming responses from the LLM\n *\n * @param state - The initial state for the agent execution. Can be:\n * - An object containing `messages` array and any middleware-specific state properties\n * - A Command object for more advanced control flow\n *\n * @param config - Optional runtime configuration including:\n * @param config.context - The context for the agent execution.\n * @param config.configurable - LangGraph configuration options like `thread_id`, `run_id`, etc.\n * @param config.store - The store for the agent execution for persisting state, see more in {@link https://docs.langchain.com/oss/javascript/langgraph/memory#memory-storage | Memory storage}.\n * @param config.signal - An optional {@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | `AbortSignal`} for the agent execution.\n * @param config.streamMode - The streaming mode for the agent execution, see more in {@link https://docs.langchain.com/oss/javascript/langgraph/streaming#supported-stream-modes | Supported stream modes}.\n * @param config.recursionLimit - The recursion limit for the agent execution.\n *\n * @returns A Promise that resolves to an IterableReadableStream of events.\n * Events include:\n * - `on_chat_model_start`: When the LLM begins processing\n * - `on_chat_model_stream`: Streaming tokens from the LLM\n * - `on_chat_model_end`: When the LLM completes\n * - `on_tool_start`: When a tool execution begins\n * - `on_tool_end`: When a tool execution completes\n * - `on_chain_start`: When middleware chains begin\n * - `on_chain_end`: When middleware chains complete\n * - And other LangGraph v2 stream events\n *\n * @example\n * ```typescript\n * const agent = new ReactAgent({\n * llm: myModel,\n * tools: [calculator, webSearch]\n * });\n *\n * const stream = await agent.stream({\n * messages: [{ role: \"human\", content: \"What's 2+2 and the weather in NYC?\" }]\n * });\n *\n * for await (const event of stream) {\n * //\n * }\n * ```\n */\n stream(state: InvokeStateParameter<TMiddleware>, config?: StreamConfiguration<InferContextInput<ContextSchema> & InferMiddlewareContextInputs<TMiddleware>>): Promise<IterableReadableStream<any>>;\n /**\n * Visualize the graph as a PNG image.\n * @param params - Parameters for the drawMermaidPng method.\n * @param params.withStyles - Whether to include styles in the graph.\n * @param params.curveStyle - The style of the graph's curves.\n * @param params.nodeColors - The colors of the graph's nodes.\n * @param params.wrapLabelNWords - The maximum number of words to wrap in a node's label.\n * @param params.backgroundColor - The background color of the graph.\n * @returns PNG image as a buffer\n */\n drawMermaidPng(params?: {\n withStyles?: boolean;\n curveStyle?: string;\n nodeColors?: Record<string, string>;\n wrapLabelNWords?: number;\n backgroundColor?: string;\n }): Promise<Uint8Array<ArrayBuffer>>;\n /**\n * Draw the graph as a Mermaid string.\n * @param params - Parameters for the drawMermaid method.\n * @param params.withStyles - Whether to include styles in the graph.\n * @param params.curveStyle - The style of the graph's curves.\n * @param params.nodeColors - The colors of the graph's nodes.\n * @param params.wrapLabelNWords - The maximum number of words to wrap in a node's label.\n * @param params.backgroundColor - The background color of the graph.\n * @returns Mermaid string\n */\n drawMermaid(params?: {\n withStyles?: boolean;\n curveStyle?: string;\n nodeColors?: Record<string, string>;\n wrapLabelNWords?: number;\n backgroundColor?: string;\n }): Promise<string>;\n}\nexport {};\n"],"mappings":";;;;;;;;AAM+G;KAE1GgB,gBAAgB,CAAA,iCAAkCC,MAAlC,CAAA,MAAA,EAAA,GAAA,CAAA,GAAwDF,uBAAxD,EAAA,oBAAA,SAA8GV,eAA9G,CAAA,GAAA,EAAA,GAAA,EAAA,GAAA,CAAA,EAAA,CAAA,GAAA,CAAmJa,wBAAnJ,SAAoLH,uBAApL,GAA8MI,IAA9M,CAAmNX,YAAnN,EAAA,QAAA,CAAA,GAA6OW,IAA7O,CAAkPX,YAAlP,EAAA,QAAA,CAAA,GAAA;EAAA,kBAAkCS,EAC/BC,wBAD+BD;CAAM,CAAA,GAExDX,qBAFwES,CAElDK,WAFkDL,CAAAA;KAGxEM,oBAH8HhB,CAAAA,oBAAAA,SAG5EA,eAH4EA,CAAAA,GAAAA,EAAAA,GAAAA,EAAAA,GAAAA,CAAAA,EA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