langchain 1.0.0-alpha.8 → 1.0.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 (458) hide show
  1. package/CHANGELOG.md +260 -0
  2. package/LICENSE +6 -6
  3. package/README.md +29 -77
  4. package/dist/agents/ReactAgent.cjs +498 -104
  5. package/dist/agents/ReactAgent.cjs.map +1 -1
  6. package/dist/agents/ReactAgent.d.cts +140 -17
  7. package/dist/agents/ReactAgent.d.cts.map +1 -1
  8. package/dist/agents/ReactAgent.d.ts +140 -17
  9. package/dist/agents/ReactAgent.d.ts.map +1 -1
  10. package/dist/agents/ReactAgent.js +501 -107
  11. package/dist/agents/ReactAgent.js.map +1 -1
  12. package/dist/agents/annotation.cjs +34 -152
  13. package/dist/agents/annotation.cjs.map +1 -1
  14. package/dist/agents/annotation.js +36 -150
  15. package/dist/agents/annotation.js.map +1 -1
  16. package/dist/agents/constants.cjs.map +1 -1
  17. package/dist/agents/constants.d.cts +9 -0
  18. package/dist/agents/constants.d.cts.map +1 -0
  19. package/dist/agents/constants.d.ts +9 -0
  20. package/dist/agents/constants.d.ts.map +1 -0
  21. package/dist/agents/constants.js.map +1 -1
  22. package/dist/agents/errors.cjs +2 -1
  23. package/dist/agents/errors.cjs.map +1 -1
  24. package/dist/agents/errors.js +2 -1
  25. package/dist/agents/errors.js.map +1 -1
  26. package/dist/agents/index.cjs +5 -29
  27. package/dist/agents/index.cjs.map +1 -1
  28. package/dist/agents/index.d.cts +157 -128
  29. package/dist/agents/index.d.cts.map +1 -1
  30. package/dist/agents/index.d.ts +157 -128
  31. package/dist/agents/index.d.ts.map +1 -1
  32. package/dist/agents/index.js +5 -27
  33. package/dist/agents/index.js.map +1 -1
  34. package/dist/agents/{middlewareAgent/middleware → middleware}/callLimit.cjs +31 -29
  35. package/dist/agents/middleware/callLimit.cjs.map +1 -0
  36. package/dist/agents/{middlewareAgent/middleware → middleware}/callLimit.d.cts +3 -3
  37. package/dist/agents/middleware/callLimit.d.cts.map +1 -0
  38. package/dist/agents/{middlewareAgent/middleware → middleware}/callLimit.d.ts +3 -3
  39. package/dist/agents/middleware/callLimit.d.ts.map +1 -0
  40. package/dist/agents/{middlewareAgent/middleware → middleware}/callLimit.js +30 -28
  41. package/dist/agents/middleware/callLimit.js.map +1 -0
  42. package/dist/agents/{middlewareAgent/middleware → middleware}/contextEditing.cjs +6 -6
  43. package/dist/agents/middleware/contextEditing.cjs.map +1 -0
  44. package/dist/agents/{middlewareAgent/middleware → middleware}/contextEditing.d.cts +2 -2
  45. package/dist/agents/middleware/contextEditing.d.cts.map +1 -0
  46. package/dist/agents/{middlewareAgent/middleware → middleware}/contextEditing.d.ts +2 -2
  47. package/dist/agents/middleware/contextEditing.d.ts.map +1 -0
  48. package/dist/agents/{middlewareAgent/middleware → middleware}/contextEditing.js +5 -5
  49. package/dist/agents/middleware/contextEditing.js.map +1 -0
  50. package/dist/agents/{middlewareAgent/middleware → middleware}/dynamicSystemPrompt.cjs +6 -6
  51. package/dist/agents/middleware/dynamicSystemPrompt.cjs.map +1 -0
  52. package/dist/agents/{middlewareAgent/middleware → middleware}/dynamicSystemPrompt.d.cts +3 -2
  53. package/dist/agents/middleware/dynamicSystemPrompt.d.cts.map +1 -0
  54. package/dist/agents/{middlewareAgent/middleware → middleware}/dynamicSystemPrompt.d.ts +3 -2
  55. package/dist/agents/middleware/dynamicSystemPrompt.d.ts.map +1 -0
  56. package/dist/agents/{middlewareAgent/middleware → middleware}/dynamicSystemPrompt.js +6 -6
  57. package/dist/agents/middleware/dynamicSystemPrompt.js.map +1 -0
  58. package/dist/agents/middleware/hitl.cjs +406 -0
  59. package/dist/agents/middleware/hitl.cjs.map +1 -0
  60. package/dist/agents/middleware/hitl.d.cts +611 -0
  61. package/dist/agents/middleware/hitl.d.cts.map +1 -0
  62. package/dist/agents/middleware/hitl.d.ts +611 -0
  63. package/dist/agents/middleware/hitl.d.ts.map +1 -0
  64. package/dist/agents/middleware/hitl.js +405 -0
  65. package/dist/agents/middleware/hitl.js.map +1 -0
  66. package/dist/agents/middleware/index.cjs +12 -0
  67. package/dist/agents/middleware/index.js +12 -0
  68. package/dist/agents/{middlewareAgent/middleware → middleware}/llmToolSelector.cjs +7 -7
  69. package/dist/agents/middleware/llmToolSelector.cjs.map +1 -0
  70. package/dist/agents/{middlewareAgent/middleware → middleware}/llmToolSelector.d.cts +2 -2
  71. package/dist/agents/middleware/llmToolSelector.d.cts.map +1 -0
  72. package/dist/agents/{middlewareAgent/middleware → middleware}/llmToolSelector.d.ts +2 -2
  73. package/dist/agents/middleware/llmToolSelector.d.ts.map +1 -0
  74. package/dist/agents/{middlewareAgent/middleware → middleware}/llmToolSelector.js +6 -6
  75. package/dist/agents/middleware/llmToolSelector.js.map +1 -0
  76. package/dist/agents/{middlewareAgent/middleware → middleware}/modelFallback.cjs +29 -22
  77. package/dist/agents/middleware/modelFallback.cjs.map +1 -0
  78. package/dist/agents/{middlewareAgent/middleware → middleware}/modelFallback.d.cts +3 -3
  79. package/dist/agents/middleware/modelFallback.d.cts.map +1 -0
  80. package/dist/agents/{middlewareAgent/middleware → middleware}/modelFallback.d.ts +3 -3
  81. package/dist/agents/middleware/modelFallback.d.ts.map +1 -0
  82. package/dist/agents/{middlewareAgent/middleware → middleware}/modelFallback.js +29 -22
  83. package/dist/agents/middleware/modelFallback.js.map +1 -0
  84. package/dist/agents/{middlewareAgent/middleware → middleware}/piiRedaction.cjs +12 -12
  85. package/dist/agents/middleware/piiRedaction.cjs.map +1 -0
  86. package/dist/agents/{middlewareAgent/middleware → middleware}/piiRedaction.d.cts +4 -4
  87. package/dist/agents/middleware/piiRedaction.d.cts.map +1 -0
  88. package/dist/agents/{middlewareAgent/middleware → middleware}/piiRedaction.d.ts +4 -4
  89. package/dist/agents/middleware/piiRedaction.d.ts.map +1 -0
  90. package/dist/agents/{middlewareAgent/middleware → middleware}/piiRedaction.js +10 -10
  91. package/dist/agents/middleware/piiRedaction.js.map +1 -0
  92. package/dist/agents/{middlewareAgent/middleware → middleware}/promptCaching.cjs +27 -24
  93. package/dist/agents/middleware/promptCaching.cjs.map +1 -0
  94. package/dist/agents/{middlewareAgent/middleware → middleware}/promptCaching.d.cts +3 -3
  95. package/dist/agents/middleware/promptCaching.d.cts.map +1 -0
  96. package/dist/agents/{middlewareAgent/middleware → middleware}/promptCaching.d.ts +3 -3
  97. package/dist/agents/middleware/promptCaching.d.ts.map +1 -0
  98. package/dist/agents/{middlewareAgent/middleware → middleware}/promptCaching.js +26 -23
  99. package/dist/agents/middleware/promptCaching.js.map +1 -0
  100. package/dist/agents/{middlewareAgent/middleware → middleware}/summarization.cjs +7 -12
  101. package/dist/agents/middleware/summarization.cjs.map +1 -0
  102. package/dist/agents/{middlewareAgent/middleware → middleware}/summarization.d.cts +3 -3
  103. package/dist/agents/middleware/summarization.d.cts.map +1 -0
  104. package/dist/agents/{middlewareAgent/middleware → middleware}/summarization.d.ts +3 -3
  105. package/dist/agents/middleware/summarization.d.ts.map +1 -0
  106. package/dist/agents/{middlewareAgent/middleware → middleware}/summarization.js +5 -10
  107. package/dist/agents/middleware/summarization.js.map +1 -0
  108. package/dist/agents/middleware/todoListMiddleware.cjs +314 -0
  109. package/dist/agents/middleware/todoListMiddleware.cjs.map +1 -0
  110. package/dist/agents/middleware/todoListMiddleware.d.cts +75 -0
  111. package/dist/agents/middleware/todoListMiddleware.d.cts.map +1 -0
  112. package/dist/agents/middleware/todoListMiddleware.d.ts +75 -0
  113. package/dist/agents/middleware/todoListMiddleware.d.ts.map +1 -0
  114. package/dist/agents/middleware/todoListMiddleware.js +312 -0
  115. package/dist/agents/middleware/todoListMiddleware.js.map +1 -0
  116. package/dist/agents/{middlewareAgent/middleware → middleware}/toolCallLimit.cjs +32 -30
  117. package/dist/agents/middleware/toolCallLimit.cjs.map +1 -0
  118. package/dist/agents/{middlewareAgent/middleware → middleware}/toolCallLimit.d.cts +3 -3
  119. package/dist/agents/middleware/toolCallLimit.d.cts.map +1 -0
  120. package/dist/agents/{middlewareAgent/middleware → middleware}/toolCallLimit.d.ts +3 -3
  121. package/dist/agents/middleware/toolCallLimit.d.ts.map +1 -0
  122. package/dist/agents/{middlewareAgent/middleware → middleware}/toolCallLimit.js +31 -29
  123. package/dist/agents/middleware/toolCallLimit.js.map +1 -0
  124. package/dist/agents/middleware/types.d.cts +354 -0
  125. package/dist/agents/middleware/types.d.cts.map +1 -0
  126. package/dist/agents/middleware/types.d.ts +354 -0
  127. package/dist/agents/middleware/types.d.ts.map +1 -0
  128. package/dist/agents/{middlewareAgent/middleware → middleware}/utils.cjs +11 -1
  129. package/dist/agents/middleware/utils.cjs.map +1 -0
  130. package/dist/agents/{middlewareAgent/middleware → middleware}/utils.d.cts +1 -1
  131. package/dist/agents/middleware/utils.d.cts.map +1 -0
  132. package/dist/agents/{middlewareAgent/middleware → middleware}/utils.d.ts +1 -1
  133. package/dist/agents/middleware/utils.d.ts.map +1 -0
  134. package/dist/agents/{middlewareAgent/middleware → middleware}/utils.js +10 -2
  135. package/dist/agents/middleware/utils.js.map +1 -0
  136. package/dist/agents/{middlewareAgent/middleware.cjs → middleware.cjs} +11 -8
  137. package/dist/agents/middleware.cjs.map +1 -0
  138. package/dist/agents/middleware.d.cts +185 -0
  139. package/dist/agents/middleware.d.cts.map +1 -0
  140. package/dist/agents/middleware.d.ts +185 -0
  141. package/dist/agents/middleware.d.ts.map +1 -0
  142. package/dist/agents/{middlewareAgent/middleware.js → middleware.js} +11 -8
  143. package/dist/agents/middleware.js.map +1 -0
  144. package/dist/agents/nodes/AfterAgentNode.cjs +29 -0
  145. package/dist/agents/nodes/AfterAgentNode.cjs.map +1 -0
  146. package/dist/agents/nodes/AfterAgentNode.js +29 -0
  147. package/dist/agents/nodes/AfterAgentNode.js.map +1 -0
  148. package/dist/agents/{middlewareAgent/nodes/AfterModalNode.cjs → nodes/AfterModelNode.cjs} +6 -6
  149. package/dist/agents/nodes/AfterModelNode.cjs.map +1 -0
  150. package/dist/agents/{middlewareAgent/nodes/AfterModalNode.js → nodes/AfterModelNode.js} +6 -6
  151. package/dist/agents/nodes/AfterModelNode.js.map +1 -0
  152. package/dist/agents/nodes/AgentNode.cjs +203 -71
  153. package/dist/agents/nodes/AgentNode.cjs.map +1 -1
  154. package/dist/agents/nodes/AgentNode.js +205 -73
  155. package/dist/agents/nodes/AgentNode.js.map +1 -1
  156. package/dist/agents/nodes/BeforeAgentNode.cjs +29 -0
  157. package/dist/agents/nodes/BeforeAgentNode.cjs.map +1 -0
  158. package/dist/agents/nodes/BeforeAgentNode.js +29 -0
  159. package/dist/agents/nodes/BeforeAgentNode.js.map +1 -0
  160. package/dist/agents/{middlewareAgent/nodes/BeforeModalNode.cjs → nodes/BeforeModelNode.cjs} +6 -4
  161. package/dist/agents/nodes/BeforeModelNode.cjs.map +1 -0
  162. package/dist/agents/{middlewareAgent/nodes/BeforeModalNode.js → nodes/BeforeModelNode.js} +6 -4
  163. package/dist/agents/nodes/BeforeModelNode.js.map +1 -0
  164. package/dist/agents/nodes/ToolNode.cjs +163 -52
  165. package/dist/agents/nodes/ToolNode.cjs.map +1 -1
  166. package/dist/agents/nodes/ToolNode.js +164 -53
  167. package/dist/agents/nodes/ToolNode.js.map +1 -1
  168. package/dist/agents/{middlewareAgent/nodes → nodes}/middleware.cjs +36 -10
  169. package/dist/agents/nodes/middleware.cjs.map +1 -0
  170. package/dist/agents/{middlewareAgent/nodes → nodes}/middleware.js +35 -9
  171. package/dist/agents/nodes/middleware.js.map +1 -0
  172. package/dist/agents/nodes/types.d.cts +72 -0
  173. package/dist/agents/nodes/types.d.cts.map +1 -0
  174. package/dist/agents/nodes/types.d.ts +72 -0
  175. package/dist/agents/nodes/types.d.ts.map +1 -0
  176. package/dist/agents/nodes/utils.cjs +64 -0
  177. package/dist/agents/nodes/utils.cjs.map +1 -1
  178. package/dist/agents/nodes/utils.js +62 -1
  179. package/dist/agents/nodes/utils.js.map +1 -1
  180. package/dist/agents/responses.cjs +1 -1
  181. package/dist/agents/responses.cjs.map +1 -1
  182. package/dist/agents/responses.d.cts +9 -2
  183. package/dist/agents/responses.d.cts.map +1 -1
  184. package/dist/agents/responses.d.ts +8 -1
  185. package/dist/agents/responses.d.ts.map +1 -1
  186. package/dist/agents/responses.js +1 -1
  187. package/dist/agents/responses.js.map +1 -1
  188. package/dist/agents/runtime.d.cts +123 -0
  189. package/dist/agents/runtime.d.cts.map +1 -0
  190. package/dist/agents/runtime.d.ts +123 -0
  191. package/dist/agents/runtime.d.ts.map +1 -0
  192. package/dist/agents/tests/utils.cjs +13 -5
  193. package/dist/agents/tests/utils.cjs.map +1 -1
  194. package/dist/agents/tests/utils.d.cts +17 -8
  195. package/dist/agents/tests/utils.d.cts.map +1 -1
  196. package/dist/agents/tests/utils.d.ts +14 -5
  197. package/dist/agents/tests/utils.d.ts.map +1 -1
  198. package/dist/agents/tests/utils.js +13 -5
  199. package/dist/agents/tests/utils.js.map +1 -1
  200. package/dist/agents/tools.d.cts +9 -0
  201. package/dist/agents/tools.d.cts.map +1 -0
  202. package/dist/agents/tools.d.ts +9 -0
  203. package/dist/agents/tools.d.ts.map +1 -0
  204. package/dist/agents/types.d.cts +163 -119
  205. package/dist/agents/types.d.cts.map +1 -1
  206. package/dist/agents/types.d.ts +163 -119
  207. package/dist/agents/types.d.ts.map +1 -1
  208. package/dist/agents/utils.cjs +141 -38
  209. package/dist/agents/utils.cjs.map +1 -1
  210. package/dist/agents/utils.js +142 -40
  211. package/dist/agents/utils.js.map +1 -1
  212. package/dist/chat_models/universal.cjs +4 -0
  213. package/dist/chat_models/universal.cjs.map +1 -1
  214. package/dist/chat_models/universal.d.cts +6 -2
  215. package/dist/chat_models/universal.d.cts.map +1 -1
  216. package/dist/chat_models/universal.d.ts +4 -0
  217. package/dist/chat_models/universal.d.ts.map +1 -1
  218. package/dist/chat_models/universal.js +4 -0
  219. package/dist/chat_models/universal.js.map +1 -1
  220. package/dist/hub/base.cjs +4 -3
  221. package/dist/hub/base.cjs.map +1 -1
  222. package/dist/hub/base.d.cts +0 -4
  223. package/dist/hub/base.d.cts.map +1 -1
  224. package/dist/hub/base.d.ts +0 -4
  225. package/dist/hub/base.d.ts.map +1 -1
  226. package/dist/hub/base.js +4 -3
  227. package/dist/hub/base.js.map +1 -1
  228. package/dist/index.cjs +23 -43
  229. package/dist/index.cjs.map +1 -1
  230. package/dist/index.d.cts +21 -21
  231. package/dist/index.d.ts +21 -21
  232. package/dist/index.js +17 -26
  233. package/dist/index.js.map +1 -1
  234. package/dist/load/import_map.cjs +1 -7
  235. package/dist/load/import_map.cjs.map +1 -1
  236. package/dist/load/import_map.js +1 -7
  237. package/dist/load/import_map.js.map +1 -1
  238. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/client.cjs +74 -18
  239. package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/client.cjs.map +1 -0
  240. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/client.js +75 -19
  241. package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/client.js.map +1 -0
  242. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/env.cjs +1 -1
  243. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/env.cjs.map +1 -1
  244. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/env.js +1 -1
  245. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/env.js.map +1 -1
  246. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/experimental/otel/constants.cjs +1 -1
  247. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/experimental/otel/constants.cjs.map +1 -1
  248. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/experimental/otel/constants.js +1 -1
  249. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/experimental/otel/constants.js.map +1 -1
  250. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/experimental/otel/translator.cjs +1 -1
  251. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/experimental/otel/translator.cjs.map +1 -1
  252. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/experimental/otel/translator.js +1 -1
  253. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/experimental/otel/translator.js.map +1 -1
  254. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/index.cjs +2 -2
  255. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/index.cjs.map +1 -1
  256. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/index.js +2 -2
  257. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/index.js.map +1 -1
  258. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/run_trees.cjs +7 -5
  259. package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/run_trees.cjs.map +1 -0
  260. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/run_trees.js +7 -5
  261. package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/run_trees.js.map +1 -0
  262. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/singletons/constants.cjs +1 -1
  263. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/singletons/constants.cjs.map +1 -1
  264. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/singletons/constants.js +1 -1
  265. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/singletons/constants.js.map +1 -1
  266. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/singletons/fetch.cjs +1 -1
  267. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/singletons/fetch.cjs.map +1 -1
  268. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/singletons/fetch.js +1 -1
  269. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/singletons/fetch.js.map +1 -1
  270. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/singletons/otel.cjs +1 -1
  271. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/singletons/otel.cjs.map +1 -1
  272. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/singletons/otel.js +1 -1
  273. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/singletons/otel.js.map +1 -1
  274. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/_uuid.cjs +1 -1
  275. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/_uuid.cjs.map +1 -1
  276. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/_uuid.js +1 -1
  277. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/_uuid.js.map +1 -1
  278. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/async_caller.cjs +1 -1
  279. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/async_caller.cjs.map +1 -1
  280. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/async_caller.js +1 -1
  281. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/async_caller.js.map +1 -1
  282. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/env.cjs +19 -23
  283. package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/env.cjs.map +1 -0
  284. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/env.js +19 -23
  285. package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/env.js.map +1 -0
  286. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/error.cjs +16 -3
  287. package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/error.cjs.map +1 -0
  288. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/error.js +16 -3
  289. package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/error.js.map +1 -0
  290. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/fast-safe-stringify/index.cjs +1 -1
  291. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/fast-safe-stringify/index.cjs.map +1 -1
  292. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/fast-safe-stringify/index.js +1 -1
  293. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/fast-safe-stringify/index.js.map +1 -1
  294. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/messages.cjs +1 -1
  295. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/messages.cjs.map +1 -1
  296. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/messages.js +1 -1
  297. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/messages.js.map +1 -1
  298. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/project.cjs +1 -1
  299. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/project.cjs.map +1 -1
  300. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/project.js +1 -1
  301. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/project.js.map +1 -1
  302. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/prompts.cjs +1 -1
  303. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/prompts.cjs.map +1 -1
  304. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/prompts.js +1 -1
  305. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/prompts.js.map +1 -1
  306. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/warn.cjs +1 -1
  307. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/warn.cjs.map +1 -1
  308. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/warn.js +1 -1
  309. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/warn.js.map +1 -1
  310. package/package.json +30 -63
  311. package/dist/agents/RunnableCallable.d.cts +0 -41
  312. package/dist/agents/RunnableCallable.d.cts.map +0 -1
  313. package/dist/agents/RunnableCallable.d.ts +0 -41
  314. package/dist/agents/RunnableCallable.d.ts.map +0 -1
  315. package/dist/agents/annotation.d.cts +0 -52
  316. package/dist/agents/annotation.d.cts.map +0 -1
  317. package/dist/agents/annotation.d.ts +0 -52
  318. package/dist/agents/annotation.d.ts.map +0 -1
  319. package/dist/agents/createAgent.cjs +0 -10
  320. package/dist/agents/createAgent.cjs.map +0 -1
  321. package/dist/agents/createAgent.js +0 -10
  322. package/dist/agents/createAgent.js.map +0 -1
  323. package/dist/agents/interrupt.cjs +0 -2
  324. package/dist/agents/interrupt.d.cts +0 -81
  325. package/dist/agents/interrupt.d.cts.map +0 -1
  326. package/dist/agents/interrupt.d.ts +0 -81
  327. package/dist/agents/interrupt.d.ts.map +0 -1
  328. package/dist/agents/interrupt.js +0 -3
  329. package/dist/agents/middlewareAgent/ReactAgent.cjs +0 -579
  330. package/dist/agents/middlewareAgent/ReactAgent.cjs.map +0 -1
  331. package/dist/agents/middlewareAgent/ReactAgent.d.cts +0 -234
  332. package/dist/agents/middlewareAgent/ReactAgent.d.cts.map +0 -1
  333. package/dist/agents/middlewareAgent/ReactAgent.d.ts +0 -234
  334. package/dist/agents/middlewareAgent/ReactAgent.d.ts.map +0 -1
  335. package/dist/agents/middlewareAgent/ReactAgent.js +0 -578
  336. package/dist/agents/middlewareAgent/ReactAgent.js.map +0 -1
  337. package/dist/agents/middlewareAgent/annotation.cjs +0 -45
  338. package/dist/agents/middlewareAgent/annotation.cjs.map +0 -1
  339. package/dist/agents/middlewareAgent/annotation.js +0 -44
  340. package/dist/agents/middlewareAgent/annotation.js.map +0 -1
  341. package/dist/agents/middlewareAgent/constants.d.cts +0 -5
  342. package/dist/agents/middlewareAgent/constants.d.cts.map +0 -1
  343. package/dist/agents/middlewareAgent/constants.d.ts +0 -5
  344. package/dist/agents/middlewareAgent/constants.d.ts.map +0 -1
  345. package/dist/agents/middlewareAgent/index.cjs +0 -11
  346. package/dist/agents/middlewareAgent/index.cjs.map +0 -1
  347. package/dist/agents/middlewareAgent/index.js +0 -11
  348. package/dist/agents/middlewareAgent/index.js.map +0 -1
  349. package/dist/agents/middlewareAgent/middleware/callLimit.cjs.map +0 -1
  350. package/dist/agents/middlewareAgent/middleware/callLimit.d.cts.map +0 -1
  351. package/dist/agents/middlewareAgent/middleware/callLimit.d.ts.map +0 -1
  352. package/dist/agents/middlewareAgent/middleware/callLimit.js.map +0 -1
  353. package/dist/agents/middlewareAgent/middleware/contextEditing.cjs.map +0 -1
  354. package/dist/agents/middlewareAgent/middleware/contextEditing.d.cts.map +0 -1
  355. package/dist/agents/middlewareAgent/middleware/contextEditing.d.ts.map +0 -1
  356. package/dist/agents/middlewareAgent/middleware/contextEditing.js.map +0 -1
  357. package/dist/agents/middlewareAgent/middleware/dynamicSystemPrompt.cjs.map +0 -1
  358. package/dist/agents/middlewareAgent/middleware/dynamicSystemPrompt.d.cts.map +0 -1
  359. package/dist/agents/middlewareAgent/middleware/dynamicSystemPrompt.d.ts.map +0 -1
  360. package/dist/agents/middlewareAgent/middleware/dynamicSystemPrompt.js.map +0 -1
  361. package/dist/agents/middlewareAgent/middleware/hitl.cjs +0 -341
  362. package/dist/agents/middlewareAgent/middleware/hitl.cjs.map +0 -1
  363. package/dist/agents/middlewareAgent/middleware/hitl.d.cts +0 -524
  364. package/dist/agents/middlewareAgent/middleware/hitl.d.cts.map +0 -1
  365. package/dist/agents/middlewareAgent/middleware/hitl.d.ts +0 -524
  366. package/dist/agents/middlewareAgent/middleware/hitl.d.ts.map +0 -1
  367. package/dist/agents/middlewareAgent/middleware/hitl.js +0 -340
  368. package/dist/agents/middlewareAgent/middleware/hitl.js.map +0 -1
  369. package/dist/agents/middlewareAgent/middleware/index.cjs +0 -52
  370. package/dist/agents/middlewareAgent/middleware/index.cjs.map +0 -1
  371. package/dist/agents/middlewareAgent/middleware/index.d.cts +0 -13
  372. package/dist/agents/middlewareAgent/middleware/index.d.ts +0 -13
  373. package/dist/agents/middlewareAgent/middleware/index.js +0 -34
  374. package/dist/agents/middlewareAgent/middleware/index.js.map +0 -1
  375. package/dist/agents/middlewareAgent/middleware/llmToolSelector.cjs.map +0 -1
  376. package/dist/agents/middlewareAgent/middleware/llmToolSelector.d.cts.map +0 -1
  377. package/dist/agents/middlewareAgent/middleware/llmToolSelector.d.ts.map +0 -1
  378. package/dist/agents/middlewareAgent/middleware/llmToolSelector.js.map +0 -1
  379. package/dist/agents/middlewareAgent/middleware/modelFallback.cjs.map +0 -1
  380. package/dist/agents/middlewareAgent/middleware/modelFallback.d.cts.map +0 -1
  381. package/dist/agents/middlewareAgent/middleware/modelFallback.d.ts.map +0 -1
  382. package/dist/agents/middlewareAgent/middleware/modelFallback.js.map +0 -1
  383. package/dist/agents/middlewareAgent/middleware/piiRedaction.cjs.map +0 -1
  384. package/dist/agents/middlewareAgent/middleware/piiRedaction.d.cts.map +0 -1
  385. package/dist/agents/middlewareAgent/middleware/piiRedaction.d.ts.map +0 -1
  386. package/dist/agents/middlewareAgent/middleware/piiRedaction.js.map +0 -1
  387. package/dist/agents/middlewareAgent/middleware/promptCaching.cjs.map +0 -1
  388. package/dist/agents/middlewareAgent/middleware/promptCaching.d.cts.map +0 -1
  389. package/dist/agents/middlewareAgent/middleware/promptCaching.d.ts.map +0 -1
  390. package/dist/agents/middlewareAgent/middleware/promptCaching.js.map +0 -1
  391. package/dist/agents/middlewareAgent/middleware/summarization.cjs.map +0 -1
  392. package/dist/agents/middlewareAgent/middleware/summarization.d.cts.map +0 -1
  393. package/dist/agents/middlewareAgent/middleware/summarization.d.ts.map +0 -1
  394. package/dist/agents/middlewareAgent/middleware/summarization.js.map +0 -1
  395. package/dist/agents/middlewareAgent/middleware/toolCallLimit.cjs.map +0 -1
  396. package/dist/agents/middlewareAgent/middleware/toolCallLimit.d.cts.map +0 -1
  397. package/dist/agents/middlewareAgent/middleware/toolCallLimit.d.ts.map +0 -1
  398. package/dist/agents/middlewareAgent/middleware/toolCallLimit.js.map +0 -1
  399. package/dist/agents/middlewareAgent/middleware/utils.cjs.map +0 -1
  400. package/dist/agents/middlewareAgent/middleware/utils.d.cts.map +0 -1
  401. package/dist/agents/middlewareAgent/middleware/utils.d.ts.map +0 -1
  402. package/dist/agents/middlewareAgent/middleware/utils.js.map +0 -1
  403. package/dist/agents/middlewareAgent/middleware.cjs.map +0 -1
  404. package/dist/agents/middlewareAgent/middleware.d.cts +0 -117
  405. package/dist/agents/middlewareAgent/middleware.d.cts.map +0 -1
  406. package/dist/agents/middlewareAgent/middleware.d.ts +0 -117
  407. package/dist/agents/middlewareAgent/middleware.d.ts.map +0 -1
  408. package/dist/agents/middlewareAgent/middleware.js.map +0 -1
  409. package/dist/agents/middlewareAgent/nodes/AfterModalNode.cjs.map +0 -1
  410. package/dist/agents/middlewareAgent/nodes/AfterModalNode.js.map +0 -1
  411. package/dist/agents/middlewareAgent/nodes/AgentNode.cjs +0 -468
  412. package/dist/agents/middlewareAgent/nodes/AgentNode.cjs.map +0 -1
  413. package/dist/agents/middlewareAgent/nodes/AgentNode.js +0 -467
  414. package/dist/agents/middlewareAgent/nodes/AgentNode.js.map +0 -1
  415. package/dist/agents/middlewareAgent/nodes/BeforeModalNode.cjs.map +0 -1
  416. package/dist/agents/middlewareAgent/nodes/BeforeModalNode.js.map +0 -1
  417. package/dist/agents/middlewareAgent/nodes/middleware.cjs.map +0 -1
  418. package/dist/agents/middlewareAgent/nodes/middleware.js.map +0 -1
  419. package/dist/agents/middlewareAgent/nodes/utils.cjs +0 -66
  420. package/dist/agents/middlewareAgent/nodes/utils.cjs.map +0 -1
  421. package/dist/agents/middlewareAgent/nodes/utils.js +0 -63
  422. package/dist/agents/middlewareAgent/nodes/utils.js.map +0 -1
  423. package/dist/agents/middlewareAgent/types.d.cts +0 -472
  424. package/dist/agents/middlewareAgent/types.d.cts.map +0 -1
  425. package/dist/agents/middlewareAgent/types.d.ts +0 -472
  426. package/dist/agents/middlewareAgent/types.d.ts.map +0 -1
  427. package/dist/agents/nodes/ToolNode.d.cts +0 -97
  428. package/dist/agents/nodes/ToolNode.d.cts.map +0 -1
  429. package/dist/agents/nodes/ToolNode.d.ts +0 -97
  430. package/dist/agents/nodes/ToolNode.d.ts.map +0 -1
  431. package/dist/agents/types.cjs +0 -7
  432. package/dist/agents/types.cjs.map +0 -1
  433. package/dist/agents/types.js +0 -6
  434. package/dist/agents/types.js.map +0 -1
  435. package/dist/embeddings/cache_backed.cjs +0 -140
  436. package/dist/embeddings/cache_backed.cjs.map +0 -1
  437. package/dist/embeddings/cache_backed.d.cts +0 -107
  438. package/dist/embeddings/cache_backed.d.cts.map +0 -1
  439. package/dist/embeddings/cache_backed.d.ts +0 -107
  440. package/dist/embeddings/cache_backed.d.ts.map +0 -1
  441. package/dist/embeddings/cache_backed.js +0 -134
  442. package/dist/embeddings/cache_backed.js.map +0 -1
  443. package/dist/embeddings/fake.cjs +0 -22
  444. package/dist/embeddings/fake.cjs.map +0 -1
  445. package/dist/embeddings/fake.d.cts +0 -1
  446. package/dist/embeddings/fake.d.ts +0 -1
  447. package/dist/embeddings/fake.js +0 -12
  448. package/dist/embeddings/fake.js.map +0 -1
  449. package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/client.cjs.map +0 -1
  450. package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/client.js.map +0 -1
  451. package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/run_trees.cjs.map +0 -1
  452. package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/run_trees.js.map +0 -1
  453. package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/env.cjs.map +0 -1
  454. package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/env.js.map +0 -1
  455. package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/error.cjs.map +0 -1
  456. package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/error.js.map +0 -1
  457. /package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/index.cjs +0 -0
  458. /package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/index.js +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"file":"ReactAgent.d.ts","names":["InteropZodObject","Command","CompiledStateGraph","GetStateOptions","CheckpointListOptions","IterableReadableStream","RunnableConfig","CreateAgentParams","AgentMiddleware","InferMiddlewareStates","InferMiddlewareInputStates","BuiltInState","InferMiddlewareContextInputs","InferContextInput","InvokeConfiguration","StreamConfiguration","UserInput","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, type GetStateOptions } from \"@langchain/langgraph\";\nimport type { CheckpointListOptions } from \"@langchain/langgraph-checkpoint\";\nimport { IterableReadableStream } from \"@langchain/core/utils/stream\";\nimport type { RunnableConfig } from \"@langchain/core/runnables\";\nimport type { CreateAgentParams, AgentMiddleware, InferMiddlewareStates, InferMiddlewareInputStates, BuiltInState, InferMiddlewareContextInputs, InferContextInput, InvokeConfiguration, StreamConfiguration, UserInput } 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>[]> = (UserInput & 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 state updates as they occur.\n *\n * This method runs the agent's workflow similar to `invoke`, but instead of waiting for\n * completion, it streams high-level state updates 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 * - React to state changes as nodes complete\n *\n * For more granular event-level streaming (like individual LLM tokens), use `streamEvents` instead.\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 state updates.\n * Each update contains the current state after a node completes.\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 chunk of stream) {\n * console.log(chunk); // State update from each node\n * }\n * ```\n */\n stream(state: InvokeStateParameter<TMiddleware>, config?: StreamConfiguration<InferContextInput<ContextSchema> & InferMiddlewareContextInputs<TMiddleware>>): Promise<IterableReadableStream<any>>;\n /**\n * Executes the agent with low-level event streaming, returning detailed events as they occur.\n *\n * This method provides fine-grained control over streaming, emitting events for every\n * operation during execution. This is useful when you need to:\n * - Stream individual LLM tokens as they're generated\n * - Monitor detailed execution flow with timing information\n * - Handle specific event types (model start/end, tool calls, etc.)\n * - Debug or trace agent behavior at a granular level\n *\n * For simpler state-based streaming, use `stream` instead.\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 * @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 *\n * @param streamOptions - Additional streaming options (passed to LangGraph's streamEvents).\n *\n * @returns An IterableReadableStream of detailed events including:\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.streamEvents({\n * messages: [{ role: \"human\", content: \"What's 2+2 and the weather in NYC?\" }]\n * }, {\n * version: \"v2\"\n * });\n *\n * for await (const event of stream) {\n * if (event.event === \"on_chat_model_stream\") {\n * process.stdout.write(event.data.chunk.content); // Stream tokens\n * }\n * }\n * ```\n */\n streamEvents(state: InvokeStateParameter<TMiddleware>, config?: StreamConfiguration<InferContextInput<ContextSchema> & InferMiddlewareContextInputs<TMiddleware>> & {\n version?: \"v1\" | \"v2\";\n }, streamOptions?: any): 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 /**\n * The following are internal methods to enable support for LangGraph Platform.\n * They are not part of the createAgent public API.\n *\n * Note: we intentionally return as `never` to avoid type errors due to type inference.\n */\n /**\n * @internal\n */\n getGraphAsync(config?: RunnableConfig): never;\n /**\n * @internal\n */\n getState(config: RunnableConfig, options?: GetStateOptions): never;\n /**\n * @internal\n */\n getStateHistory(config: RunnableConfig, options?: CheckpointListOptions): never;\n /**\n * @internal\n */\n getSubgraphs(namespace?: string, recurse?: boolean): never;\n /**\n * @internal\n */\n getSubgraphAsync(namespace?: string, recurse?: boolean): never;\n}\nexport {};\n"],"mappings":";;;;;;;;;;AAQ+G;KAE1GoB,gBAAgB,CAAA,iCAAkCC,MAAlC,CAAA,MAAA,EAAA,GAAA,CAAA,GAAwDF,uBAAxD,EAAA,oBAAA,SAA8GX,eAA9G,CAAA,GAAA,EAAA,GAAA,EAAA,GAAA,CAAA,EAAA,CAAA,GAAA,CAAmJc,wBAAnJ,SAAoLH,uBAApL,GAA8MI,IAA9M,CAAmNZ,YAAnN,EAAA,QAAA,CAAA,GAA6OY,IAA7O,CAAkPZ,YAAlP,EAAA,QAAA,CAAA,GAAA;EAAA,kBAAkCU,EAC/BC,wBAD+BD;CAAM,CAAA,GAExDZ,qBAFwEU,CAElDK,WAFkDL,CAAAA;KAGxEM,oBAH8HjB,CAAAA,oBAAAA,SAG5EA,eAH4EA,CAAAA,GAAAA,EAAAA,GAAAA,EAAAA,GAAAA,CAAAA,EAAAA,CAAAA,GAAAA,CAGvCQ,SAHuCR,GAG3BE,0BAH2BF,CAGAgB,WAHAhB,CAAAA,CAAAA,GAGgBP,OAHhBO,CAAAA,GAAAA,EAAAA,GAAAA,EAAAA,GAAAA,CAAAA,GAAAA,IAAAA;KAI9HkB,UAJmKJ,CAAAA,iCAIvHD,MAJuHC,CAAAA,MAAAA,EAAAA,GAAAA,CAAAA,GAIjGH,uBAJiGG,GAIvED,MAJuEC,CAAAA,MAAAA,EAAAA,GAAAA,CAAAA,EAAAA,sBAI5BL,iBAJ4BK,GAIRtB,gBAJQsB,GAIWL,iBAJXK,EAAAA,oBAAAA,SAI2Dd,eAJ3Dc,CAAAA,GAAAA,EAAAA,GAAAA,EAAAA,GAAAA,CAAAA,EAAAA,GAAAA,EAAAA,CAAAA,GAIoGpB,kBAJpGoB,CAAAA,GAAAA,EAAAA,GAAAA,EAAAA,GAAAA,EAAAA,GAAAA,EAI2IF,gBAJ3IE,CAI4JA,wBAJ5JA,EAIsLE,WAJtLF,CAAAA,EAIoMJ,gBAJpMI,CAIqNK,aAJrNL,CAAAA,CAAAA,MAAAA,CAAAA,EAAAA,OAAAA,CAAAA;AAAiCH,cAKpLS,UALoLT,CAAAA,iCAKxIE,MALwIF,CAAAA,MAAAA,EAAAA,GAAAA,CAAAA,GAKlHA,uBALkHA,GAKxFE,MALwFF,CAAAA,MAAAA,EAAAA,GAAAA,CAAAA,EAAAA,sBAK7CF,iBAL6CE,GAKzBnB,gBALyBmB,GAKNF,iBALME,EAAAA,oBAAAA,SAK0CX,eAL1CW,CAAAA,GAAAA,EAAAA,GAAAA,EAAAA,GAAAA,CAAAA,EAAAA,GAAAA,SAKsFX,eALtFW,CAAAA,GAAAA,EAAAA,GAAAA,EAAAA,GAAAA,CAAAA,EAAAA,CAAAA,CAAAA;EAAuB,CAAA,OAAQR;EAAY,OAAjBY,EAOtNhB,iBAPsNgB,CAOpMD,wBAPoMC,EAO1KI,aAP0KJ,CAAAA;EAAI,WAAgCZ,CAAAA,OAAAA,EAQ9OJ,iBAR8OI,CAQ5NW,wBAR4NX,EAQlMgB,aARkMhB,CAAAA;EAAY;;;EAE7O,IAAjCF,KAAAA,CAAAA,CAAAA,EAUYiB,UAVZjB,CAUuBa,wBAVvBb,EAUiDkB,aAVjDlB,EAUgEe,WAVhEf,CAAAA;EAAqB;AAAA;;;;;;;AACgI;AAAA;;;;;;;;;;;;;;;AACoI;AAC9R;;;;;;;;;;;;;;;;;;EAOmE,MAAEe,CAAAA,KAAAA,EA4CnDC,oBA5CmDD,CA4C9BA,WA5C8BA,CAAAA,EAAAA,MAAAA,CAAAA,EA4CPV,mBA5COU,CA4CaX,iBA5CbW,CA4C+BG,aA5C/BH,CAAAA,GA4CgDZ,4BA5ChDY,CA4C6EA,WA5C7EA,CAAAA,CAAAA,CAAAA,EA4C6FK,OA5C7FL,CA4CqGJ,gBA5CrGI,CA4CsHF,wBA5CtHE,EA4CgJA,WA5ChJA,CAAAA,CAAAA;EAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsML;gBA/GzDC,qBAAqBD,uBAAuBT,oBAAoBF,kBAAkBc,iBAAiBf,6BAA6BY,gBAAgBK,QAAQxB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAyDlJoB,qBAAqBD,uBAAuBT,oBAAoBF,kBAAkBc,iBAAiBf,6BAA6BY;;2BAE3HK,QAAQxB;;;;;;;;;;;;;;iBAchBgB;;;MAGbQ,QAAQE,WAAWD;;;;;;;;;;;;;;iBAcNT;;;MAGbQ;;;;;;;;;;yBAUmBvB;;;;mBAINA,0BAA0BH;;;;0BAInBG,0BAA0BF"}
@@ -1,578 +0,0 @@
1
- import { isClientTool } from "../utils.js";
2
- import { ToolNode } from "../nodes/ToolNode.js";
3
- import { createAgentAnnotationConditional } from "./annotation.js";
4
- import { AgentNode } from "./nodes/AgentNode.js";
5
- import { initializeMiddlewareStates, parseJumpToTarget } from "./nodes/utils.js";
6
- import { BeforeModelNode } from "./nodes/BeforeModalNode.js";
7
- import { AfterModelNode } from "./nodes/AfterModalNode.js";
8
- import { AIMessage, ToolMessage } from "@langchain/core/messages";
9
- import { Command, END, START, Send, StateGraph } from "@langchain/langgraph";
10
-
11
- //#region src/agents/middlewareAgent/ReactAgent.ts
12
- var ReactAgent = class {
13
- #graph;
14
- #toolBehaviorVersion = "v2";
15
- #agentNode;
16
- constructor(options) {
17
- this.options = options;
18
- this.#toolBehaviorVersion = options.version ?? this.#toolBehaviorVersion;
19
- /**
20
- * define complete list of tools based on options and middleware
21
- */
22
- const middlewareTools = this.options.middleware?.filter((m) => m.tools).flatMap((m) => m.tools) ?? [];
23
- const toolClasses = [...(Array.isArray(options.tools) ? options.tools : options.tools?.tools) ?? [], ...middlewareTools];
24
- /**
25
- * If any of the tools are configured to return_directly after running,
26
- * our graph needs to check if these were called
27
- */
28
- const shouldReturnDirect = new Set(toolClasses.filter(isClientTool).filter((tool) => "returnDirect" in tool && tool.returnDirect).map((tool) => tool.name));
29
- const schema = createAgentAnnotationConditional(this.options.responseFormat !== void 0, this.options.middleware);
30
- const workflow = new StateGraph(schema, this.options.contextSchema);
31
- const allNodeWorkflows = workflow;
32
- const beforeModelNodes = [];
33
- const afterModelNodes = [];
34
- const modifyModelRequestHookMiddleware = [];
35
- const retryModelRequestHookMiddleware = [];
36
- this.#agentNode = new AgentNode({
37
- model: this.options.model,
38
- systemPrompt: this.options.systemPrompt,
39
- includeAgentName: this.options.includeAgentName,
40
- name: this.options.name,
41
- responseFormat: this.options.responseFormat,
42
- middleware: this.options.middleware,
43
- toolClasses,
44
- shouldReturnDirect,
45
- signal: this.options.signal,
46
- modifyModelRequestHookMiddleware,
47
- retryModelRequestHookMiddleware
48
- });
49
- const middlewareNames = /* @__PURE__ */ new Set();
50
- const middleware = this.options.middleware ?? [];
51
- for (let i = 0; i < middleware.length; i++) {
52
- let beforeModelNode;
53
- let afterModelNode;
54
- const m = middleware[i];
55
- if (middlewareNames.has(m.name)) throw new Error(`Middleware ${m.name} is defined multiple times`);
56
- middlewareNames.add(m.name);
57
- if (m.beforeModel) {
58
- beforeModelNode = new BeforeModelNode(m, { getPrivateState: () => this.#agentNode.getState()._privateState });
59
- const name = `${m.name}.before_model`;
60
- beforeModelNodes.push({
61
- index: i,
62
- name,
63
- allowed: m.beforeModelJumpTo
64
- });
65
- allNodeWorkflows.addNode(name, beforeModelNode, beforeModelNode.nodeOptions);
66
- }
67
- if (m.afterModel) {
68
- afterModelNode = new AfterModelNode(m, { getPrivateState: () => this.#agentNode.getState()._privateState });
69
- const name = `${m.name}.after_model`;
70
- afterModelNodes.push({
71
- index: i,
72
- name,
73
- allowed: m.afterModelJumpTo
74
- });
75
- allNodeWorkflows.addNode(name, afterModelNode, afterModelNode.nodeOptions);
76
- }
77
- if (m.modifyModelRequest) modifyModelRequestHookMiddleware.push([m, () => ({
78
- ...beforeModelNode?.getState(),
79
- ...afterModelNode?.getState()
80
- })]);
81
- if (m.retryModelRequest) retryModelRequestHookMiddleware.push([m, () => ({
82
- ...beforeModelNode?.getState(),
83
- ...afterModelNode?.getState()
84
- })]);
85
- }
86
- /**
87
- * Add Nodes
88
- */
89
- allNodeWorkflows.addNode("model_request", this.#agentNode, AgentNode.nodeOptions);
90
- /**
91
- * add single tool node for all tools
92
- */
93
- if (toolClasses.filter(isClientTool).length > 0) {
94
- const toolNode = new ToolNode(toolClasses.filter(isClientTool), { signal: this.options.signal });
95
- allNodeWorkflows.addNode("tools", toolNode);
96
- }
97
- /**
98
- * Add Edges
99
- */
100
- if (beforeModelNodes.length > 0) allNodeWorkflows.addEdge(START, beforeModelNodes[0].name);
101
- else allNodeWorkflows.addEdge(START, "model_request");
102
- for (let i = 0; i < beforeModelNodes.length; i++) {
103
- const node = beforeModelNodes[i];
104
- const current = node.name;
105
- const isLast = i === beforeModelNodes.length - 1;
106
- const nextDefault = isLast ? "model_request" : beforeModelNodes[i + 1].name;
107
- if (node.allowed && node.allowed.length > 0) {
108
- const hasTools = toolClasses.filter(isClientTool).length > 0;
109
- const allowedMapped = node.allowed.map((t) => parseJumpToTarget(t)).filter((dest) => dest !== "tools" || hasTools);
110
- const destinations = Array.from(new Set([nextDefault, ...allowedMapped]));
111
- allNodeWorkflows.addConditionalEdges(current, this.#createBeforeModelRouter(toolClasses.filter(isClientTool), nextDefault), destinations);
112
- } else allNodeWorkflows.addEdge(current, nextDefault);
113
- }
114
- const lastAfterModelNode = afterModelNodes.at(-1);
115
- if (afterModelNodes.length > 0 && lastAfterModelNode) allNodeWorkflows.addEdge("model_request", lastAfterModelNode.name);
116
- else {
117
- const modelPaths = this.#getModelPaths(toolClasses.filter(isClientTool));
118
- if (modelPaths.length === 1) allNodeWorkflows.addEdge("model_request", modelPaths[0]);
119
- else allNodeWorkflows.addConditionalEdges("model_request", this.#createModelRouter(), modelPaths);
120
- }
121
- for (let i = afterModelNodes.length - 1; i > 0; i--) {
122
- const node = afterModelNodes[i];
123
- const current = node.name;
124
- const nextDefault = afterModelNodes[i - 1].name;
125
- if (node.allowed && node.allowed.length > 0) {
126
- const hasTools = toolClasses.filter(isClientTool).length > 0;
127
- const allowedMapped = node.allowed.map((t) => parseJumpToTarget(t)).filter((dest) => dest !== "tools" || hasTools);
128
- const destinations = Array.from(new Set([nextDefault, ...allowedMapped]));
129
- allNodeWorkflows.addConditionalEdges(current, this.#createAfterModelSequenceRouter(toolClasses.filter(isClientTool), node.allowed, nextDefault), destinations);
130
- } else allNodeWorkflows.addEdge(current, nextDefault);
131
- }
132
- if (afterModelNodes.length > 0) {
133
- const firstAfterModel = afterModelNodes[0];
134
- const firstAfterModelNode = firstAfterModel.name;
135
- const modelPaths = this.#getModelPaths(toolClasses.filter(isClientTool), true).filter((p) => p !== "tools" || toolClasses.filter(isClientTool).length > 0);
136
- const allowJump = Boolean(firstAfterModel.allowed && firstAfterModel.allowed.length > 0);
137
- const destinations = modelPaths;
138
- allNodeWorkflows.addConditionalEdges(firstAfterModelNode, this.#createAfterModelRouter(toolClasses.filter(isClientTool), allowJump), destinations);
139
- }
140
- /**
141
- * add edges for tools node
142
- */
143
- if (toolClasses.filter(isClientTool).length > 0) {
144
- let toolReturnTarget;
145
- if (beforeModelNodes.length > 0) toolReturnTarget = beforeModelNodes[0].name;
146
- else toolReturnTarget = "model_request";
147
- if (shouldReturnDirect.size > 0) allNodeWorkflows.addConditionalEdges("tools", this.#createToolsRouter(shouldReturnDirect), [toolReturnTarget, END]);
148
- else allNodeWorkflows.addEdge("tools", toolReturnTarget);
149
- }
150
- /**
151
- * compile the graph
152
- */
153
- this.#graph = allNodeWorkflows.compile({
154
- checkpointer: this.options.checkpointer ?? this.options.checkpointSaver,
155
- store: this.options.store,
156
- name: this.options.name,
157
- description: this.options.description
158
- });
159
- }
160
- /**
161
- * Get the compiled {@link https://docs.langchain.com/oss/javascript/langgraph/use-graph-api | StateGraph}.
162
- */
163
- get graph() {
164
- return this.#graph;
165
- }
166
- /**
167
- * Get possible edge destinations from model node.
168
- * @param toolClasses names of tools to call
169
- * @param includeModelRequest whether to include "model_request" as a valid path (for jumpTo routing)
170
- * @returns list of possible edge destinations
171
- */
172
- #getModelPaths(toolClasses, includeModelRequest = false) {
173
- const paths = [];
174
- if (toolClasses.length > 0) paths.push("tools");
175
- if (includeModelRequest) paths.push("model_request");
176
- paths.push(END);
177
- return paths;
178
- }
179
- /**
180
- * Create routing function for tools node conditional edges.
181
- */
182
- #createToolsRouter(shouldReturnDirect) {
183
- /**
184
- * ToDo: fix type
185
- */
186
- return (state) => {
187
- const messages = state.messages;
188
- const lastMessage = messages[messages.length - 1];
189
- if (ToolMessage.isInstance(lastMessage) && lastMessage.name && shouldReturnDirect.has(lastMessage.name)) return this.options.responseFormat ? "model_request" : END;
190
- return "model_request";
191
- };
192
- }
193
- /**
194
- * Create routing function for model node conditional edges.
195
- */
196
- #createModelRouter() {
197
- /**
198
- * determine if the agent should continue or not
199
- */
200
- return (state) => {
201
- const messages = state.messages;
202
- const lastMessage = messages.at(-1);
203
- if (!AIMessage.isInstance(lastMessage) || !lastMessage.tool_calls || lastMessage.tool_calls.length === 0) return END;
204
- const hasOnlyStructuredResponseCalls = lastMessage.tool_calls.every((toolCall) => toolCall.name.startsWith("extract-"));
205
- if (hasOnlyStructuredResponseCalls) return END;
206
- /**
207
- * The tool node processes a single message.
208
- */
209
- if (this.#toolBehaviorVersion === "v1") return "tools";
210
- /**
211
- * Route to tools node (filter out any structured response tool calls)
212
- */
213
- const regularToolCalls = lastMessage.tool_calls.filter((toolCall) => !toolCall.name.startsWith("extract-"));
214
- if (regularToolCalls.length === 0) return END;
215
- return regularToolCalls.map((toolCall) => new Send("tools", {
216
- ...state,
217
- lg_tool_call: toolCall
218
- }));
219
- };
220
- }
221
- /**
222
- * Create routing function for jumpTo functionality after afterModel hooks.
223
- *
224
- * This router checks if the `jumpTo` property is set in the state after afterModel middleware
225
- * execution. If set, it routes to the specified target ("model_request" or "tools").
226
- * If not set, it falls back to the normal model routing logic for afterModel context.
227
- *
228
- * The jumpTo property is automatically cleared after use to prevent infinite loops.
229
- *
230
- * @param toolClasses - Available tool classes for validation
231
- * @returns Router function that handles jumpTo logic and normal routing
232
- */
233
- #createAfterModelRouter(toolClasses, allowJump) {
234
- const hasStructuredResponse = Boolean(this.options.responseFormat);
235
- return (state) => {
236
- const messages = state.messages;
237
- const lastMessage = messages.at(-1);
238
- if (AIMessage.isInstance(lastMessage) && (!lastMessage.tool_calls || lastMessage.tool_calls.length === 0)) return END;
239
- if (allowJump && state.jumpTo) {
240
- if (state.jumpTo === END) return END;
241
- if (state.jumpTo === "tools") {
242
- if (toolClasses.length === 0) return END;
243
- return new Send("tools", {
244
- ...state,
245
- jumpTo: void 0
246
- });
247
- }
248
- return new Send("model_request", {
249
- ...state,
250
- jumpTo: void 0
251
- });
252
- }
253
- const toolMessages = messages.filter(ToolMessage.isInstance);
254
- const lastAiMessage = messages.filter(AIMessage.isInstance).at(-1);
255
- const pendingToolCalls = lastAiMessage?.tool_calls?.filter((call) => !toolMessages.some((m) => m.tool_call_id === call.id));
256
- if (pendingToolCalls && pendingToolCalls.length > 0) return pendingToolCalls.map((toolCall) => new Send("tools", {
257
- ...state,
258
- lg_tool_call: toolCall
259
- }));
260
- const hasStructuredResponseCalls = lastAiMessage?.tool_calls?.some((toolCall) => toolCall.name.startsWith("extract-"));
261
- if (pendingToolCalls && pendingToolCalls.length === 0 && !hasStructuredResponseCalls && hasStructuredResponse) return "model_request";
262
- if (!AIMessage.isInstance(lastMessage) || !lastMessage.tool_calls || lastMessage.tool_calls.length === 0) return END;
263
- const hasOnlyStructuredResponseCalls = lastMessage.tool_calls.every((toolCall) => toolCall.name.startsWith("extract-"));
264
- const hasRegularToolCalls = lastMessage.tool_calls.some((toolCall) => !toolCall.name.startsWith("extract-"));
265
- if (hasOnlyStructuredResponseCalls || !hasRegularToolCalls) return END;
266
- /**
267
- * For routing from afterModel nodes, always use simple string paths
268
- * The Send API is handled at the model_request node level
269
- */
270
- return "tools";
271
- };
272
- }
273
- /**
274
- * Router for afterModel sequence nodes (connecting later middlewares to earlier ones),
275
- * honoring allowed jump targets and defaulting to the next node.
276
- */
277
- #createAfterModelSequenceRouter(toolClasses, allowed, nextDefault) {
278
- const allowedSet = new Set(allowed.map((t) => parseJumpToTarget(t)));
279
- return (state) => {
280
- if (state.jumpTo) {
281
- const dest = parseJumpToTarget(state.jumpTo);
282
- if (dest === END && allowedSet.has(END)) return END;
283
- if (dest === "tools" && allowedSet.has("tools")) {
284
- if (toolClasses.length === 0) return END;
285
- return new Send("tools", {
286
- ...state,
287
- jumpTo: void 0
288
- });
289
- }
290
- if (dest === "model_request" && allowedSet.has("model_request")) return new Send("model_request", {
291
- ...state,
292
- jumpTo: void 0
293
- });
294
- }
295
- return nextDefault;
296
- };
297
- }
298
- /**
299
- * Create routing function for jumpTo functionality after beforeModel hooks.
300
- * Falls back to the default next node if no jumpTo is present.
301
- */
302
- #createBeforeModelRouter(toolClasses, nextDefault) {
303
- return (state) => {
304
- if (!state.jumpTo) return nextDefault;
305
- const destination = parseJumpToTarget(state.jumpTo);
306
- if (destination === END) return END;
307
- if (destination === "tools") {
308
- if (toolClasses.length === 0) return END;
309
- return new Send("tools", {
310
- ...state,
311
- jumpTo: void 0
312
- });
313
- }
314
- return new Send("model_request", {
315
- ...state,
316
- jumpTo: void 0
317
- });
318
- };
319
- }
320
- /**
321
- * Initialize middleware states if not already present in the input state.
322
- */
323
- async #initializeMiddlewareStates(state) {
324
- if (!this.options.middleware || this.options.middleware.length === 0 || state instanceof Command || !state) return state;
325
- const defaultStates = await initializeMiddlewareStates(this.options.middleware, state);
326
- const updatedState = { ...state };
327
- if (!updatedState) return updatedState;
328
- for (const [key, value] of Object.entries(defaultStates)) if (!(key in updatedState)) updatedState[key] = value;
329
- return updatedState;
330
- }
331
- /**
332
- * Populate the private state of the agent node from the previous state.
333
- */
334
- async #populatePrivateState(config) {
335
- /**
336
- * not needed if thread_id is not provided
337
- */
338
- if (!config?.configurable?.thread_id) return;
339
- const prevState = await this.#graph.getState(config);
340
- /**
341
- * not need if state is empty
342
- */
343
- if (!prevState.values._privateState) return;
344
- this.#agentNode.setState({
345
- structuredResponse: void 0,
346
- _privateState: prevState.values._privateState
347
- });
348
- }
349
- /**
350
- * Executes the agent with the given state and returns the final state after all processing.
351
- *
352
- * This method runs the agent's entire workflow synchronously, including:
353
- * - Processing the input messages through any configured middleware
354
- * - Calling the language model to generate responses
355
- * - Executing any tool calls made by the model
356
- * - Running all middleware hooks (beforeModel, afterModel, etc.)
357
- *
358
- * @param state - The initial state for the agent execution. Can be:
359
- * - An object containing `messages` array and any middleware-specific state properties
360
- * - A Command object for more advanced control flow
361
- *
362
- * @param config - Optional runtime configuration including:
363
- * @param config.context - The context for the agent execution.
364
- * @param config.configurable - LangGraph configuration options like `thread_id`, `run_id`, etc.
365
- * @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}.
366
- * @param config.signal - An optional {@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | `AbortSignal`} for the agent execution.
367
- * @param config.recursionLimit - The recursion limit for the agent execution.
368
- *
369
- * @returns A Promise that resolves to the final agent state after execution completes.
370
- * The returned state includes:
371
- * - a `messages` property containing an array with all messages (input, AI responses, tool calls/results)
372
- * - a `structuredResponse` property containing the structured response (if configured)
373
- * - all state values defined in the middleware
374
- *
375
- * @example
376
- * ```typescript
377
- * const agent = new ReactAgent({
378
- * llm: myModel,
379
- * tools: [calculator, webSearch],
380
- * responseFormat: z.object({
381
- * weather: z.string(),
382
- * }),
383
- * });
384
- *
385
- * const result = await agent.invoke({
386
- * messages: [{ role: "human", content: "What's the weather in Paris?" }]
387
- * });
388
- *
389
- * console.log(result.structuredResponse.weather); // outputs: "It's sunny and 75°F."
390
- * ```
391
- */
392
- async invoke(state, config) {
393
- const initializedState = await this.#initializeMiddlewareStates(state);
394
- await this.#populatePrivateState(config);
395
- return this.#graph.invoke(initializedState, config);
396
- }
397
- /**
398
- * Executes the agent with streaming, returning an async iterable of state updates as they occur.
399
- *
400
- * This method runs the agent's workflow similar to `invoke`, but instead of waiting for
401
- * completion, it streams high-level state updates in real-time. This allows you to:
402
- * - Display intermediate results to users as they're generated
403
- * - Monitor the agent's progress through each step
404
- * - React to state changes as nodes complete
405
- *
406
- * For more granular event-level streaming (like individual LLM tokens), use `streamEvents` instead.
407
- *
408
- * @param state - The initial state for the agent execution. Can be:
409
- * - An object containing `messages` array and any middleware-specific state properties
410
- * - A Command object for more advanced control flow
411
- *
412
- * @param config - Optional runtime configuration including:
413
- * @param config.context - The context for the agent execution.
414
- * @param config.configurable - LangGraph configuration options like `thread_id`, `run_id`, etc.
415
- * @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}.
416
- * @param config.signal - An optional {@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | `AbortSignal`} for the agent execution.
417
- * @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}.
418
- * @param config.recursionLimit - The recursion limit for the agent execution.
419
- *
420
- * @returns A Promise that resolves to an IterableReadableStream of state updates.
421
- * Each update contains the current state after a node completes.
422
- *
423
- * @example
424
- * ```typescript
425
- * const agent = new ReactAgent({
426
- * llm: myModel,
427
- * tools: [calculator, webSearch]
428
- * });
429
- *
430
- * const stream = await agent.stream({
431
- * messages: [{ role: "human", content: "What's 2+2 and the weather in NYC?" }]
432
- * });
433
- *
434
- * for await (const chunk of stream) {
435
- * console.log(chunk); // State update from each node
436
- * }
437
- * ```
438
- */
439
- async stream(state, config) {
440
- const initializedState = await this.#initializeMiddlewareStates(state);
441
- return this.#graph.stream(initializedState, config);
442
- }
443
- /**
444
- * Executes the agent with low-level event streaming, returning detailed events as they occur.
445
- *
446
- * This method provides fine-grained control over streaming, emitting events for every
447
- * operation during execution. This is useful when you need to:
448
- * - Stream individual LLM tokens as they're generated
449
- * - Monitor detailed execution flow with timing information
450
- * - Handle specific event types (model start/end, tool calls, etc.)
451
- * - Debug or trace agent behavior at a granular level
452
- *
453
- * For simpler state-based streaming, use `stream` instead.
454
- *
455
- * @param state - The initial state for the agent execution. Can be:
456
- * - An object containing `messages` array and any middleware-specific state properties
457
- * - A Command object for more advanced control flow
458
- *
459
- * @param config - Optional runtime configuration including:
460
- * @param config.context - The context for the agent execution.
461
- * @param config.configurable - LangGraph configuration options like `thread_id`, `run_id`, etc.
462
- * @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}.
463
- * @param config.signal - An optional {@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | `AbortSignal`} for the agent execution.
464
- * @param config.recursionLimit - The recursion limit for the agent execution.
465
- * @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}.
466
- *
467
- * @param streamOptions - Additional streaming options (passed to LangGraph's streamEvents).
468
- *
469
- * @returns An IterableReadableStream of detailed events including:
470
- * - `on_chat_model_start`: When the LLM begins processing
471
- * - `on_chat_model_stream`: Streaming tokens from the LLM
472
- * - `on_chat_model_end`: When the LLM completes
473
- * - `on_tool_start`: When a tool execution begins
474
- * - `on_tool_end`: When a tool execution completes
475
- * - `on_chain_start`: When middleware chains begin
476
- * - `on_chain_end`: When middleware chains complete
477
- * - And other LangGraph v2 stream events
478
- *
479
- * @example
480
- * ```typescript
481
- * const agent = new ReactAgent({
482
- * llm: myModel,
483
- * tools: [calculator, webSearch]
484
- * });
485
- *
486
- * const stream = await agent.streamEvents({
487
- * messages: [{ role: "human", content: "What's 2+2 and the weather in NYC?" }]
488
- * }, {
489
- * version: "v2"
490
- * });
491
- *
492
- * for await (const event of stream) {
493
- * if (event.event === "on_chat_model_stream") {
494
- * process.stdout.write(event.data.chunk.content); // Stream tokens
495
- * }
496
- * }
497
- * ```
498
- */
499
- async streamEvents(state, config, streamOptions) {
500
- const initializedState = await this.#initializeMiddlewareStates(state);
501
- await this.#populatePrivateState(config);
502
- return this.#graph.streamEvents(initializedState, {
503
- ...config,
504
- version: config?.version ?? "v2"
505
- }, streamOptions);
506
- }
507
- /**
508
- * Visualize the graph as a PNG image.
509
- * @param params - Parameters for the drawMermaidPng method.
510
- * @param params.withStyles - Whether to include styles in the graph.
511
- * @param params.curveStyle - The style of the graph's curves.
512
- * @param params.nodeColors - The colors of the graph's nodes.
513
- * @param params.wrapLabelNWords - The maximum number of words to wrap in a node's label.
514
- * @param params.backgroundColor - The background color of the graph.
515
- * @returns PNG image as a buffer
516
- */
517
- async drawMermaidPng(params) {
518
- const representation = await this.#graph.getGraphAsync();
519
- const image = await representation.drawMermaidPng(params);
520
- const arrayBuffer = await image.arrayBuffer();
521
- const buffer = new Uint8Array(arrayBuffer);
522
- return buffer;
523
- }
524
- /**
525
- * Draw the graph as a Mermaid string.
526
- * @param params - Parameters for the drawMermaid method.
527
- * @param params.withStyles - Whether to include styles in the graph.
528
- * @param params.curveStyle - The style of the graph's curves.
529
- * @param params.nodeColors - The colors of the graph's nodes.
530
- * @param params.wrapLabelNWords - The maximum number of words to wrap in a node's label.
531
- * @param params.backgroundColor - The background color of the graph.
532
- * @returns Mermaid string
533
- */
534
- async drawMermaid(params) {
535
- const representation = await this.#graph.getGraphAsync();
536
- return representation.drawMermaid(params);
537
- }
538
- /**
539
- * The following are internal methods to enable support for LangGraph Platform.
540
- * They are not part of the createAgent public API.
541
- *
542
- * Note: we intentionally return as `never` to avoid type errors due to type inference.
543
- */
544
- /**
545
- * @internal
546
- */
547
- getGraphAsync(config) {
548
- return this.#graph.getGraphAsync(config);
549
- }
550
- /**
551
- * @internal
552
- */
553
- getState(config, options) {
554
- return this.#graph.getState(config, options);
555
- }
556
- /**
557
- * @internal
558
- */
559
- getStateHistory(config, options) {
560
- return this.#graph.getStateHistory(config, options);
561
- }
562
- /**
563
- * @internal
564
- */
565
- getSubgraphs(namespace, recurse) {
566
- return this.#graph.getSubgraphs(namespace, recurse);
567
- }
568
- /**
569
- * @internal
570
- */
571
- getSubgraphAsync(namespace, recurse) {
572
- return this.#graph.getSubgraphsAsync(namespace, recurse);
573
- }
574
- };
575
-
576
- //#endregion
577
- export { ReactAgent };
578
- //# sourceMappingURL=ReactAgent.js.map