langchain 1.0.0-alpha.8 → 1.0.0-alpha.9

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 (442) hide show
  1. package/LICENSE +6 -6
  2. package/dist/agents/ReactAgent.cjs +497 -104
  3. package/dist/agents/ReactAgent.cjs.map +1 -1
  4. package/dist/agents/ReactAgent.d.cts +140 -17
  5. package/dist/agents/ReactAgent.d.cts.map +1 -1
  6. package/dist/agents/ReactAgent.d.ts +140 -17
  7. package/dist/agents/ReactAgent.d.ts.map +1 -1
  8. package/dist/agents/ReactAgent.js +500 -107
  9. package/dist/agents/ReactAgent.js.map +1 -1
  10. package/dist/agents/annotation.cjs +32 -149
  11. package/dist/agents/annotation.cjs.map +1 -1
  12. package/dist/agents/annotation.js +34 -147
  13. package/dist/agents/annotation.js.map +1 -1
  14. package/dist/agents/constants.cjs.map +1 -1
  15. package/dist/agents/constants.d.cts +9 -0
  16. package/dist/agents/constants.d.cts.map +1 -0
  17. package/dist/agents/constants.d.ts +9 -0
  18. package/dist/agents/constants.d.ts.map +1 -0
  19. package/dist/agents/constants.js.map +1 -1
  20. package/dist/agents/errors.cjs +2 -1
  21. package/dist/agents/errors.cjs.map +1 -1
  22. package/dist/agents/errors.js +2 -1
  23. package/dist/agents/errors.js.map +1 -1
  24. package/dist/agents/index.cjs +5 -29
  25. package/dist/agents/index.cjs.map +1 -1
  26. package/dist/agents/index.d.cts +157 -128
  27. package/dist/agents/index.d.cts.map +1 -1
  28. package/dist/agents/index.d.ts +157 -128
  29. package/dist/agents/index.d.ts.map +1 -1
  30. package/dist/agents/index.js +5 -27
  31. package/dist/agents/index.js.map +1 -1
  32. package/dist/agents/{middlewareAgent/middleware → middleware}/callLimit.cjs +2 -2
  33. package/dist/agents/middleware/callLimit.cjs.map +1 -0
  34. package/dist/agents/{middlewareAgent/middleware → middleware}/callLimit.d.cts +3 -3
  35. package/dist/agents/middleware/callLimit.d.cts.map +1 -0
  36. package/dist/agents/{middlewareAgent/middleware → middleware}/callLimit.d.ts +3 -3
  37. package/dist/agents/middleware/callLimit.d.ts.map +1 -0
  38. package/dist/agents/{middlewareAgent/middleware → middleware}/callLimit.js +1 -1
  39. package/dist/agents/middleware/callLimit.js.map +1 -0
  40. package/dist/agents/{middlewareAgent/middleware → middleware}/contextEditing.cjs +5 -5
  41. package/dist/agents/middleware/contextEditing.cjs.map +1 -0
  42. package/dist/agents/{middlewareAgent/middleware → middleware}/contextEditing.d.cts +2 -2
  43. package/dist/agents/middleware/contextEditing.d.cts.map +1 -0
  44. package/dist/agents/{middlewareAgent/middleware → middleware}/contextEditing.d.ts +2 -2
  45. package/dist/agents/middleware/contextEditing.d.ts.map +1 -0
  46. package/dist/agents/{middlewareAgent/middleware → middleware}/contextEditing.js +4 -4
  47. package/dist/agents/middleware/contextEditing.js.map +1 -0
  48. package/dist/agents/{middlewareAgent/middleware → middleware}/dynamicSystemPrompt.cjs +6 -6
  49. package/dist/agents/middleware/dynamicSystemPrompt.cjs.map +1 -0
  50. package/dist/agents/{middlewareAgent/middleware → middleware}/dynamicSystemPrompt.d.cts +3 -2
  51. package/dist/agents/middleware/dynamicSystemPrompt.d.cts.map +1 -0
  52. package/dist/agents/{middlewareAgent/middleware → middleware}/dynamicSystemPrompt.d.ts +3 -2
  53. package/dist/agents/middleware/dynamicSystemPrompt.d.ts.map +1 -0
  54. package/dist/agents/{middlewareAgent/middleware → middleware}/dynamicSystemPrompt.js +6 -6
  55. package/dist/agents/middleware/dynamicSystemPrompt.js.map +1 -0
  56. package/dist/agents/middleware/hitl.cjs +404 -0
  57. package/dist/agents/middleware/hitl.cjs.map +1 -0
  58. package/dist/agents/middleware/hitl.d.cts +611 -0
  59. package/dist/agents/middleware/hitl.d.cts.map +1 -0
  60. package/dist/agents/middleware/hitl.d.ts +611 -0
  61. package/dist/agents/middleware/hitl.d.ts.map +1 -0
  62. package/dist/agents/middleware/hitl.js +403 -0
  63. package/dist/agents/middleware/hitl.js.map +1 -0
  64. package/dist/agents/middleware/index.cjs +12 -0
  65. package/dist/agents/middleware/index.js +12 -0
  66. package/dist/agents/{middlewareAgent/middleware → middleware}/llmToolSelector.cjs +7 -7
  67. package/dist/agents/middleware/llmToolSelector.cjs.map +1 -0
  68. package/dist/agents/{middlewareAgent/middleware → middleware}/llmToolSelector.d.cts +2 -2
  69. package/dist/agents/middleware/llmToolSelector.d.cts.map +1 -0
  70. package/dist/agents/{middlewareAgent/middleware → middleware}/llmToolSelector.d.ts +2 -2
  71. package/dist/agents/middleware/llmToolSelector.d.ts.map +1 -0
  72. package/dist/agents/{middlewareAgent/middleware → middleware}/llmToolSelector.js +6 -6
  73. package/dist/agents/middleware/llmToolSelector.js.map +1 -0
  74. package/dist/agents/{middlewareAgent/middleware → middleware}/modelFallback.cjs +28 -21
  75. package/dist/agents/middleware/modelFallback.cjs.map +1 -0
  76. package/dist/agents/{middlewareAgent/middleware → middleware}/modelFallback.d.cts +2 -2
  77. package/dist/agents/middleware/modelFallback.d.cts.map +1 -0
  78. package/dist/agents/{middlewareAgent/middleware → middleware}/modelFallback.d.ts +2 -2
  79. package/dist/agents/middleware/modelFallback.d.ts.map +1 -0
  80. package/dist/agents/{middlewareAgent/middleware → middleware}/modelFallback.js +28 -21
  81. package/dist/agents/middleware/modelFallback.js.map +1 -0
  82. package/dist/agents/{middlewareAgent/middleware → middleware}/piiRedaction.cjs +12 -12
  83. package/dist/agents/middleware/piiRedaction.cjs.map +1 -0
  84. package/dist/agents/{middlewareAgent/middleware → middleware}/piiRedaction.d.cts +4 -4
  85. package/dist/agents/middleware/piiRedaction.d.cts.map +1 -0
  86. package/dist/agents/{middlewareAgent/middleware → middleware}/piiRedaction.d.ts +4 -4
  87. package/dist/agents/middleware/piiRedaction.d.ts.map +1 -0
  88. package/dist/agents/{middlewareAgent/middleware → middleware}/piiRedaction.js +10 -10
  89. package/dist/agents/middleware/piiRedaction.js.map +1 -0
  90. package/dist/agents/{middlewareAgent/middleware → middleware}/promptCaching.cjs +27 -24
  91. package/dist/agents/middleware/promptCaching.cjs.map +1 -0
  92. package/dist/agents/{middlewareAgent/middleware → middleware}/promptCaching.d.cts +3 -3
  93. package/dist/agents/middleware/promptCaching.d.cts.map +1 -0
  94. package/dist/agents/{middlewareAgent/middleware → middleware}/promptCaching.d.ts +3 -3
  95. package/dist/agents/middleware/promptCaching.d.ts.map +1 -0
  96. package/dist/agents/{middlewareAgent/middleware → middleware}/promptCaching.js +26 -23
  97. package/dist/agents/middleware/promptCaching.js.map +1 -0
  98. package/dist/agents/{middlewareAgent/middleware → middleware}/summarization.cjs +7 -12
  99. package/dist/agents/middleware/summarization.cjs.map +1 -0
  100. package/dist/agents/{middlewareAgent/middleware → middleware}/summarization.d.cts +3 -3
  101. package/dist/agents/middleware/summarization.d.cts.map +1 -0
  102. package/dist/agents/{middlewareAgent/middleware → middleware}/summarization.d.ts +3 -3
  103. package/dist/agents/middleware/summarization.d.ts.map +1 -0
  104. package/dist/agents/{middlewareAgent/middleware → middleware}/summarization.js +4 -9
  105. package/dist/agents/middleware/summarization.js.map +1 -0
  106. package/dist/agents/middleware/todoListMiddleware.cjs +314 -0
  107. package/dist/agents/middleware/todoListMiddleware.cjs.map +1 -0
  108. package/dist/agents/middleware/todoListMiddleware.d.cts +75 -0
  109. package/dist/agents/middleware/todoListMiddleware.d.cts.map +1 -0
  110. package/dist/agents/middleware/todoListMiddleware.d.ts +75 -0
  111. package/dist/agents/middleware/todoListMiddleware.d.ts.map +1 -0
  112. package/dist/agents/middleware/todoListMiddleware.js +312 -0
  113. package/dist/agents/middleware/todoListMiddleware.js.map +1 -0
  114. package/dist/agents/{middlewareAgent/middleware → middleware}/toolCallLimit.cjs +2 -2
  115. package/dist/agents/middleware/toolCallLimit.cjs.map +1 -0
  116. package/dist/agents/{middlewareAgent/middleware → middleware}/toolCallLimit.d.cts +3 -3
  117. package/dist/agents/middleware/toolCallLimit.d.cts.map +1 -0
  118. package/dist/agents/{middlewareAgent/middleware → middleware}/toolCallLimit.d.ts +3 -3
  119. package/dist/agents/middleware/toolCallLimit.d.ts.map +1 -0
  120. package/dist/agents/{middlewareAgent/middleware → middleware}/toolCallLimit.js +1 -1
  121. package/dist/agents/middleware/toolCallLimit.js.map +1 -0
  122. package/dist/agents/middleware/types.d.cts +208 -0
  123. package/dist/agents/middleware/types.d.cts.map +1 -0
  124. package/dist/agents/middleware/types.d.ts +208 -0
  125. package/dist/agents/middleware/types.d.ts.map +1 -0
  126. package/dist/agents/{middlewareAgent/middleware → middleware}/utils.cjs +1 -1
  127. package/dist/agents/middleware/utils.cjs.map +1 -0
  128. package/dist/agents/{middlewareAgent/middleware → middleware}/utils.d.cts +1 -1
  129. package/dist/agents/middleware/utils.d.cts.map +1 -0
  130. package/dist/agents/{middlewareAgent/middleware → middleware}/utils.d.ts +1 -1
  131. package/dist/agents/middleware/utils.d.ts.map +1 -0
  132. package/dist/agents/{middlewareAgent/middleware → middleware}/utils.js +1 -1
  133. package/dist/agents/middleware/utils.js.map +1 -0
  134. package/dist/agents/{middlewareAgent/middleware.cjs → middleware.cjs} +11 -4
  135. package/dist/agents/middleware.cjs.map +1 -0
  136. package/dist/agents/middleware.d.cts +205 -0
  137. package/dist/agents/middleware.d.cts.map +1 -0
  138. package/dist/agents/middleware.d.ts +205 -0
  139. package/dist/agents/middleware.d.ts.map +1 -0
  140. package/dist/agents/{middlewareAgent/middleware.js → middleware.js} +11 -4
  141. package/dist/agents/middleware.js.map +1 -0
  142. package/dist/agents/nodes/AfterAgentNode.cjs +27 -0
  143. package/dist/agents/nodes/AfterAgentNode.cjs.map +1 -0
  144. package/dist/agents/nodes/AfterAgentNode.js +27 -0
  145. package/dist/agents/nodes/AfterAgentNode.js.map +1 -0
  146. package/dist/agents/{middlewareAgent/nodes/AfterModalNode.cjs → nodes/AfterModelNode.cjs} +3 -5
  147. package/dist/agents/nodes/AfterModelNode.cjs.map +1 -0
  148. package/dist/agents/{middlewareAgent/nodes/AfterModalNode.js → nodes/AfterModelNode.js} +3 -5
  149. package/dist/agents/nodes/AfterModelNode.js.map +1 -0
  150. package/dist/agents/nodes/AgentNode.cjs +202 -71
  151. package/dist/agents/nodes/AgentNode.cjs.map +1 -1
  152. package/dist/agents/nodes/AgentNode.js +204 -73
  153. package/dist/agents/nodes/AgentNode.js.map +1 -1
  154. package/dist/agents/nodes/BeforeAgentNode.cjs +27 -0
  155. package/dist/agents/nodes/BeforeAgentNode.cjs.map +1 -0
  156. package/dist/agents/nodes/BeforeAgentNode.js +27 -0
  157. package/dist/agents/nodes/BeforeAgentNode.js.map +1 -0
  158. package/dist/agents/{middlewareAgent/nodes/BeforeModalNode.cjs → nodes/BeforeModelNode.cjs} +3 -3
  159. package/dist/agents/nodes/BeforeModelNode.cjs.map +1 -0
  160. package/dist/agents/{middlewareAgent/nodes/BeforeModalNode.js → nodes/BeforeModelNode.js} +3 -3
  161. package/dist/agents/nodes/BeforeModelNode.js.map +1 -0
  162. package/dist/agents/nodes/ToolNode.cjs +157 -47
  163. package/dist/agents/nodes/ToolNode.cjs.map +1 -1
  164. package/dist/agents/nodes/ToolNode.js +158 -48
  165. package/dist/agents/nodes/ToolNode.js.map +1 -1
  166. package/dist/agents/{middlewareAgent/nodes → nodes}/middleware.cjs +35 -10
  167. package/dist/agents/nodes/middleware.cjs.map +1 -0
  168. package/dist/agents/{middlewareAgent/nodes → nodes}/middleware.js +34 -9
  169. package/dist/agents/nodes/middleware.js.map +1 -0
  170. package/dist/agents/nodes/types.d.cts +57 -0
  171. package/dist/agents/nodes/types.d.cts.map +1 -0
  172. package/dist/agents/nodes/types.d.ts +57 -0
  173. package/dist/agents/nodes/types.d.ts.map +1 -0
  174. package/dist/agents/nodes/utils.cjs +64 -0
  175. package/dist/agents/nodes/utils.cjs.map +1 -1
  176. package/dist/agents/nodes/utils.js +62 -1
  177. package/dist/agents/nodes/utils.js.map +1 -1
  178. package/dist/agents/responses.cjs +1 -1
  179. package/dist/agents/responses.cjs.map +1 -1
  180. package/dist/agents/responses.d.cts +9 -2
  181. package/dist/agents/responses.d.cts.map +1 -1
  182. package/dist/agents/responses.d.ts +8 -1
  183. package/dist/agents/responses.d.ts.map +1 -1
  184. package/dist/agents/responses.js +1 -1
  185. package/dist/agents/responses.js.map +1 -1
  186. package/dist/agents/runtime.d.cts +123 -0
  187. package/dist/agents/runtime.d.cts.map +1 -0
  188. package/dist/agents/runtime.d.ts +123 -0
  189. package/dist/agents/runtime.d.ts.map +1 -0
  190. package/dist/agents/tests/utils.cjs +13 -5
  191. package/dist/agents/tests/utils.cjs.map +1 -1
  192. package/dist/agents/tests/utils.d.cts +17 -8
  193. package/dist/agents/tests/utils.d.cts.map +1 -1
  194. package/dist/agents/tests/utils.d.ts +14 -5
  195. package/dist/agents/tests/utils.d.ts.map +1 -1
  196. package/dist/agents/tests/utils.js +13 -5
  197. package/dist/agents/tests/utils.js.map +1 -1
  198. package/dist/agents/tools.d.cts +9 -0
  199. package/dist/agents/tools.d.cts.map +1 -0
  200. package/dist/agents/tools.d.ts +9 -0
  201. package/dist/agents/tools.d.ts.map +1 -0
  202. package/dist/agents/types.d.cts +125 -126
  203. package/dist/agents/types.d.cts.map +1 -1
  204. package/dist/agents/types.d.ts +125 -126
  205. package/dist/agents/types.d.ts.map +1 -1
  206. package/dist/agents/utils.cjs +141 -38
  207. package/dist/agents/utils.cjs.map +1 -1
  208. package/dist/agents/utils.js +142 -40
  209. package/dist/agents/utils.js.map +1 -1
  210. package/dist/chat_models/universal.cjs +4 -0
  211. package/dist/chat_models/universal.cjs.map +1 -1
  212. package/dist/chat_models/universal.d.cts +6 -2
  213. package/dist/chat_models/universal.d.cts.map +1 -1
  214. package/dist/chat_models/universal.d.ts +4 -0
  215. package/dist/chat_models/universal.d.ts.map +1 -1
  216. package/dist/chat_models/universal.js +4 -0
  217. package/dist/chat_models/universal.js.map +1 -1
  218. package/dist/hub/base.cjs +4 -3
  219. package/dist/hub/base.cjs.map +1 -1
  220. package/dist/hub/base.d.cts +0 -4
  221. package/dist/hub/base.d.cts.map +1 -1
  222. package/dist/hub/base.d.ts +0 -4
  223. package/dist/hub/base.d.ts.map +1 -1
  224. package/dist/hub/base.js +4 -3
  225. package/dist/hub/base.js.map +1 -1
  226. package/dist/index.cjs +18 -38
  227. package/dist/index.cjs.map +1 -1
  228. package/dist/index.d.cts +21 -21
  229. package/dist/index.d.ts +21 -21
  230. package/dist/index.js +17 -26
  231. package/dist/index.js.map +1 -1
  232. package/dist/load/import_map.cjs +0 -2
  233. package/dist/load/import_map.cjs.map +1 -1
  234. package/dist/load/import_map.js +0 -2
  235. package/dist/load/import_map.js.map +1 -1
  236. 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
  237. 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
  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.js +75 -19
  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.js.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/env.cjs +1 -1
  241. 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
  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.js +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.js.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/experimental/otel/constants.cjs +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/experimental/otel/constants.cjs.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.js +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.js.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/translator.cjs +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/translator.cjs.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.js +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.js.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/index.cjs +2 -2
  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/index.cjs.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.js +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.js.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/run_trees.cjs +7 -5
  257. 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
  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.js +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.js.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/singletons/constants.cjs +1 -1
  261. 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
  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.js +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.js.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/fetch.cjs +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/fetch.cjs.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.js +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.js.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/otel.cjs +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/otel.cjs.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.js +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.js.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/utils/_uuid.cjs +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/utils/_uuid.cjs.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.js +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.js.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/async_caller.cjs +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/async_caller.cjs.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.js +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.js.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/env.cjs +19 -23
  281. 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
  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.js +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.js.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/error.cjs +16 -3
  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/error.cjs.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.js +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.js.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/fast-safe-stringify/index.cjs +1 -1
  289. 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
  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.js +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.js.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/messages.cjs +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/messages.cjs.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.js +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.js.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/project.cjs +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/project.cjs.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.js +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.js.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/prompts.cjs +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/prompts.cjs.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.js +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.js.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/warn.cjs +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/warn.cjs.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.js +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.js.map +1 -1
  308. package/package.json +4 -18
  309. package/dist/agents/RunnableCallable.d.cts +0 -41
  310. package/dist/agents/RunnableCallable.d.cts.map +0 -1
  311. package/dist/agents/RunnableCallable.d.ts +0 -41
  312. package/dist/agents/RunnableCallable.d.ts.map +0 -1
  313. package/dist/agents/annotation.d.cts +0 -52
  314. package/dist/agents/annotation.d.cts.map +0 -1
  315. package/dist/agents/annotation.d.ts +0 -52
  316. package/dist/agents/annotation.d.ts.map +0 -1
  317. package/dist/agents/createAgent.cjs +0 -10
  318. package/dist/agents/createAgent.cjs.map +0 -1
  319. package/dist/agents/createAgent.js +0 -10
  320. package/dist/agents/createAgent.js.map +0 -1
  321. package/dist/agents/interrupt.cjs +0 -2
  322. package/dist/agents/interrupt.d.cts +0 -81
  323. package/dist/agents/interrupt.d.cts.map +0 -1
  324. package/dist/agents/interrupt.d.ts +0 -81
  325. package/dist/agents/interrupt.d.ts.map +0 -1
  326. package/dist/agents/interrupt.js +0 -3
  327. package/dist/agents/middlewareAgent/ReactAgent.cjs +0 -579
  328. package/dist/agents/middlewareAgent/ReactAgent.cjs.map +0 -1
  329. package/dist/agents/middlewareAgent/ReactAgent.d.cts +0 -234
  330. package/dist/agents/middlewareAgent/ReactAgent.d.cts.map +0 -1
  331. package/dist/agents/middlewareAgent/ReactAgent.d.ts +0 -234
  332. package/dist/agents/middlewareAgent/ReactAgent.d.ts.map +0 -1
  333. package/dist/agents/middlewareAgent/ReactAgent.js +0 -578
  334. package/dist/agents/middlewareAgent/ReactAgent.js.map +0 -1
  335. package/dist/agents/middlewareAgent/annotation.cjs +0 -45
  336. package/dist/agents/middlewareAgent/annotation.cjs.map +0 -1
  337. package/dist/agents/middlewareAgent/annotation.js +0 -44
  338. package/dist/agents/middlewareAgent/annotation.js.map +0 -1
  339. package/dist/agents/middlewareAgent/constants.d.cts +0 -5
  340. package/dist/agents/middlewareAgent/constants.d.cts.map +0 -1
  341. package/dist/agents/middlewareAgent/constants.d.ts +0 -5
  342. package/dist/agents/middlewareAgent/constants.d.ts.map +0 -1
  343. package/dist/agents/middlewareAgent/index.cjs +0 -11
  344. package/dist/agents/middlewareAgent/index.cjs.map +0 -1
  345. package/dist/agents/middlewareAgent/index.js +0 -11
  346. package/dist/agents/middlewareAgent/index.js.map +0 -1
  347. package/dist/agents/middlewareAgent/middleware/callLimit.cjs.map +0 -1
  348. package/dist/agents/middlewareAgent/middleware/callLimit.d.cts.map +0 -1
  349. package/dist/agents/middlewareAgent/middleware/callLimit.d.ts.map +0 -1
  350. package/dist/agents/middlewareAgent/middleware/callLimit.js.map +0 -1
  351. package/dist/agents/middlewareAgent/middleware/contextEditing.cjs.map +0 -1
  352. package/dist/agents/middlewareAgent/middleware/contextEditing.d.cts.map +0 -1
  353. package/dist/agents/middlewareAgent/middleware/contextEditing.d.ts.map +0 -1
  354. package/dist/agents/middlewareAgent/middleware/contextEditing.js.map +0 -1
  355. package/dist/agents/middlewareAgent/middleware/dynamicSystemPrompt.cjs.map +0 -1
  356. package/dist/agents/middlewareAgent/middleware/dynamicSystemPrompt.d.cts.map +0 -1
  357. package/dist/agents/middlewareAgent/middleware/dynamicSystemPrompt.d.ts.map +0 -1
  358. package/dist/agents/middlewareAgent/middleware/dynamicSystemPrompt.js.map +0 -1
  359. package/dist/agents/middlewareAgent/middleware/hitl.cjs +0 -341
  360. package/dist/agents/middlewareAgent/middleware/hitl.cjs.map +0 -1
  361. package/dist/agents/middlewareAgent/middleware/hitl.d.cts +0 -524
  362. package/dist/agents/middlewareAgent/middleware/hitl.d.cts.map +0 -1
  363. package/dist/agents/middlewareAgent/middleware/hitl.d.ts +0 -524
  364. package/dist/agents/middlewareAgent/middleware/hitl.d.ts.map +0 -1
  365. package/dist/agents/middlewareAgent/middleware/hitl.js +0 -340
  366. package/dist/agents/middlewareAgent/middleware/hitl.js.map +0 -1
  367. package/dist/agents/middlewareAgent/middleware/index.cjs +0 -52
  368. package/dist/agents/middlewareAgent/middleware/index.cjs.map +0 -1
  369. package/dist/agents/middlewareAgent/middleware/index.d.cts +0 -13
  370. package/dist/agents/middlewareAgent/middleware/index.d.ts +0 -13
  371. package/dist/agents/middlewareAgent/middleware/index.js +0 -34
  372. package/dist/agents/middlewareAgent/middleware/index.js.map +0 -1
  373. package/dist/agents/middlewareAgent/middleware/llmToolSelector.cjs.map +0 -1
  374. package/dist/agents/middlewareAgent/middleware/llmToolSelector.d.cts.map +0 -1
  375. package/dist/agents/middlewareAgent/middleware/llmToolSelector.d.ts.map +0 -1
  376. package/dist/agents/middlewareAgent/middleware/llmToolSelector.js.map +0 -1
  377. package/dist/agents/middlewareAgent/middleware/modelFallback.cjs.map +0 -1
  378. package/dist/agents/middlewareAgent/middleware/modelFallback.d.cts.map +0 -1
  379. package/dist/agents/middlewareAgent/middleware/modelFallback.d.ts.map +0 -1
  380. package/dist/agents/middlewareAgent/middleware/modelFallback.js.map +0 -1
  381. package/dist/agents/middlewareAgent/middleware/piiRedaction.cjs.map +0 -1
  382. package/dist/agents/middlewareAgent/middleware/piiRedaction.d.cts.map +0 -1
  383. package/dist/agents/middlewareAgent/middleware/piiRedaction.d.ts.map +0 -1
  384. package/dist/agents/middlewareAgent/middleware/piiRedaction.js.map +0 -1
  385. package/dist/agents/middlewareAgent/middleware/promptCaching.cjs.map +0 -1
  386. package/dist/agents/middlewareAgent/middleware/promptCaching.d.cts.map +0 -1
  387. package/dist/agents/middlewareAgent/middleware/promptCaching.d.ts.map +0 -1
  388. package/dist/agents/middlewareAgent/middleware/promptCaching.js.map +0 -1
  389. package/dist/agents/middlewareAgent/middleware/summarization.cjs.map +0 -1
  390. package/dist/agents/middlewareAgent/middleware/summarization.d.cts.map +0 -1
  391. package/dist/agents/middlewareAgent/middleware/summarization.d.ts.map +0 -1
  392. package/dist/agents/middlewareAgent/middleware/summarization.js.map +0 -1
  393. package/dist/agents/middlewareAgent/middleware/toolCallLimit.cjs.map +0 -1
  394. package/dist/agents/middlewareAgent/middleware/toolCallLimit.d.cts.map +0 -1
  395. package/dist/agents/middlewareAgent/middleware/toolCallLimit.d.ts.map +0 -1
  396. package/dist/agents/middlewareAgent/middleware/toolCallLimit.js.map +0 -1
  397. package/dist/agents/middlewareAgent/middleware/utils.cjs.map +0 -1
  398. package/dist/agents/middlewareAgent/middleware/utils.d.cts.map +0 -1
  399. package/dist/agents/middlewareAgent/middleware/utils.d.ts.map +0 -1
  400. package/dist/agents/middlewareAgent/middleware/utils.js.map +0 -1
  401. package/dist/agents/middlewareAgent/middleware.cjs.map +0 -1
  402. package/dist/agents/middlewareAgent/middleware.d.cts +0 -117
  403. package/dist/agents/middlewareAgent/middleware.d.cts.map +0 -1
  404. package/dist/agents/middlewareAgent/middleware.d.ts +0 -117
  405. package/dist/agents/middlewareAgent/middleware.d.ts.map +0 -1
  406. package/dist/agents/middlewareAgent/middleware.js.map +0 -1
  407. package/dist/agents/middlewareAgent/nodes/AfterModalNode.cjs.map +0 -1
  408. package/dist/agents/middlewareAgent/nodes/AfterModalNode.js.map +0 -1
  409. package/dist/agents/middlewareAgent/nodes/AgentNode.cjs +0 -468
  410. package/dist/agents/middlewareAgent/nodes/AgentNode.cjs.map +0 -1
  411. package/dist/agents/middlewareAgent/nodes/AgentNode.js +0 -467
  412. package/dist/agents/middlewareAgent/nodes/AgentNode.js.map +0 -1
  413. package/dist/agents/middlewareAgent/nodes/BeforeModalNode.cjs.map +0 -1
  414. package/dist/agents/middlewareAgent/nodes/BeforeModalNode.js.map +0 -1
  415. package/dist/agents/middlewareAgent/nodes/middleware.cjs.map +0 -1
  416. package/dist/agents/middlewareAgent/nodes/middleware.js.map +0 -1
  417. package/dist/agents/middlewareAgent/nodes/utils.cjs +0 -66
  418. package/dist/agents/middlewareAgent/nodes/utils.cjs.map +0 -1
  419. package/dist/agents/middlewareAgent/nodes/utils.js +0 -63
  420. package/dist/agents/middlewareAgent/nodes/utils.js.map +0 -1
  421. package/dist/agents/middlewareAgent/types.d.cts +0 -472
  422. package/dist/agents/middlewareAgent/types.d.cts.map +0 -1
  423. package/dist/agents/middlewareAgent/types.d.ts +0 -472
  424. package/dist/agents/middlewareAgent/types.d.ts.map +0 -1
  425. package/dist/agents/nodes/ToolNode.d.cts +0 -97
  426. package/dist/agents/nodes/ToolNode.d.cts.map +0 -1
  427. package/dist/agents/nodes/ToolNode.d.ts +0 -97
  428. package/dist/agents/nodes/ToolNode.d.ts.map +0 -1
  429. package/dist/agents/types.cjs +0 -7
  430. package/dist/agents/types.cjs.map +0 -1
  431. package/dist/agents/types.js +0 -6
  432. package/dist/agents/types.js.map +0 -1
  433. 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
  434. 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
  435. 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
  436. 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
  437. 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
  438. 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
  439. 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
  440. 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
  441. /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
  442. /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,12 +1,13 @@
1
+ import { hasToolCalls } from "../utils.js";
1
2
  import { createMiddleware } from "../middleware.js";
2
3
  import { countTokensApproximately } from "./utils.js";
3
- import { AIMessage, RemoveMessage, SystemMessage, ToolMessage, trimMessages } from "@langchain/core/messages";
4
+ import { RemoveMessage, SystemMessage, ToolMessage, trimMessages } from "@langchain/core/messages";
4
5
  import { REMOVE_ALL_MESSAGES } from "@langchain/langgraph";
5
- import { interopParse } from "@langchain/core/utils/types";
6
6
  import { z } from "zod/v3";
7
+ import { interopParse } from "@langchain/core/utils/types";
7
8
  import { v4 } from "uuid";
8
9
 
9
- //#region src/agents/middlewareAgent/middleware/summarization.ts
10
+ //#region src/agents/middleware/summarization.ts
10
11
  const DEFAULT_SUMMARY_PROMPT = `<role>
11
12
  Context Extraction Assistant
12
13
  </role>
@@ -185,12 +186,6 @@ function isSafeCutoffPoint(messages, cutoffIndex) {
185
186
  return true;
186
187
  }
187
188
  /**
188
- * Check if message is an AI message with tool calls
189
- */
190
- function hasToolCalls(message) {
191
- return AIMessage.isInstance(message) && "tool_calls" in message && Array.isArray(message.tool_calls) && message.tool_calls.length > 0;
192
- }
193
- /**
194
189
  * Extract tool call IDs from an AI message
195
190
  */
196
191
  function extractToolCallIds(aiMessage) {
@@ -0,0 +1 @@
1
+ {"version":3,"file":"summarization.js","names":["options: SummarizationMiddlewareConfig","messages: BaseMessage[]","uuid","systemPrompt: SystemMessage | null","conversationMessages: BaseMessage[]","cutoffIndex: number","originalSystemMessage: SystemMessage | null","summary: string","summaryPrefix: string","content","messagesToKeep: number","aiMessage: AIMessage","aiMessageIndex: number","toolCallIds: Set<string>","messagesToSummarize: BaseMessage[]","model: BaseLanguageModel","summaryPrompt: string","tokenCounter: TokenCounter"],"sources":["../../../src/agents/middleware/summarization.ts"],"sourcesContent":["import { z } from \"zod/v3\";\nimport { v4 as uuid } from \"uuid\";\nimport {\n BaseMessage,\n AIMessage,\n SystemMessage,\n ToolMessage,\n RemoveMessage,\n trimMessages,\n} from \"@langchain/core/messages\";\nimport { BaseLanguageModel } from \"@langchain/core/language_models/base\";\nimport {\n interopParse,\n InferInteropZodOutput,\n InferInteropZodInput,\n} from \"@langchain/core/utils/types\";\nimport { REMOVE_ALL_MESSAGES } from \"@langchain/langgraph\";\nimport { createMiddleware } from \"../middleware.js\";\nimport { countTokensApproximately } from \"./utils.js\";\nimport { hasToolCalls } from \"../utils.js\";\n\nconst DEFAULT_SUMMARY_PROMPT = `<role>\nContext Extraction Assistant\n</role>\n\n<primary_objective>\nYour sole objective in this task is to extract the highest quality/most relevant context from the conversation history below.\n</primary_objective>\n\n<objective_information>\nYou're nearing the total number of input tokens you can accept, so you must extract the highest quality/most relevant pieces of information from your conversation history.\nThis context will then overwrite the conversation history presented below. Because of this, ensure the context you extract is only the most important information to your overall goal.\n</objective_information>\n\n<instructions>\nThe conversation history below will be replaced with the context you extract in this step. Because of this, you must do your very best to extract and record all of the most important context from the conversation history.\nYou want to ensure that you don't repeat any actions you've already completed, so the context you extract from the conversation history should be focused on the most important information to your overall goal.\n</instructions>\n\nThe user will message you with the full message history you'll be extracting context from, to then replace. Carefully read over it all, and think deeply about what information is most important to your overall goal that should be saved:\n\nWith all of this in mind, please carefully read over the entire conversation history, and extract the most important and relevant context to replace it so that you can free up space in the conversation history.\nRespond ONLY with the extracted context. Do not include any additional information, or text before or after the extracted context.\n\n<messages>\nMessages to summarize:\n{messages}\n</messages>`;\n\nconst SUMMARY_PREFIX = \"## Previous conversation summary:\";\n\nconst DEFAULT_MESSAGES_TO_KEEP = 20;\nconst DEFAULT_TRIM_TOKEN_LIMIT = 4000;\nconst DEFAULT_FALLBACK_MESSAGE_COUNT = 15;\nconst SEARCH_RANGE_FOR_TOOL_PAIRS = 5;\n\ntype TokenCounter = (messages: BaseMessage[]) => number | Promise<number>;\n\nconst contextSchema = z.object({\n model: z.custom<BaseLanguageModel>(),\n maxTokensBeforeSummary: z.number().optional(),\n messagesToKeep: z.number().default(DEFAULT_MESSAGES_TO_KEEP),\n tokenCounter: z\n .function()\n .args(z.array(z.any()))\n .returns(z.union([z.number(), z.promise(z.number())]))\n .optional(),\n summaryPrompt: z.string().default(DEFAULT_SUMMARY_PROMPT),\n summaryPrefix: z.string().default(SUMMARY_PREFIX),\n});\n\nexport type SummarizationMiddlewareConfig = InferInteropZodInput<\n typeof contextSchema\n>;\n\n/**\n * Summarization middleware that automatically summarizes conversation history when token limits are approached.\n *\n * This middleware monitors message token counts and automatically summarizes older\n * messages when a threshold is reached, preserving recent messages and maintaining\n * context continuity by ensuring AI/Tool message pairs remain together.\n *\n * @param options Configuration options for the summarization middleware\n * @returns A middleware instance\n *\n * @example\n * ```ts\n * import { summarizationMiddleware } from \"langchain\";\n * import { createAgent } from \"langchain\";\n *\n * const agent = createAgent({\n * llm: model,\n * tools: [getWeather],\n * middleware: [\n * summarizationMiddleware({\n * model: new ChatOpenAI({ model: \"gpt-4o\" }),\n * maxTokensBeforeSummary: 4000,\n * messagesToKeep: 20,\n * })\n * ],\n * });\n *\n * ```\n */\nexport function summarizationMiddleware(\n options: SummarizationMiddlewareConfig\n) {\n return createMiddleware({\n name: \"SummarizationMiddleware\",\n contextSchema,\n beforeModel: async (state, runtime) => {\n /**\n * Parse user options to get their explicit values\n */\n const userOptions = interopParse(contextSchema, options);\n\n /**\n * Merge context with user options, preferring user options when context has default values\n */\n const config = {\n model: userOptions.model,\n maxTokensBeforeSummary:\n runtime.context.maxTokensBeforeSummary !== undefined\n ? runtime.context.maxTokensBeforeSummary\n : userOptions.maxTokensBeforeSummary,\n messagesToKeep:\n runtime.context.messagesToKeep === DEFAULT_MESSAGES_TO_KEEP\n ? userOptions.messagesToKeep\n : runtime.context.messagesToKeep ?? userOptions.messagesToKeep,\n tokenCounter:\n runtime.context.tokenCounter !== undefined\n ? runtime.context.tokenCounter\n : userOptions.tokenCounter,\n summaryPrompt:\n runtime.context.summaryPrompt === DEFAULT_SUMMARY_PROMPT\n ? userOptions.summaryPrompt\n : runtime.context.summaryPrompt ?? userOptions.summaryPrompt,\n summaryPrefix:\n runtime.context.summaryPrefix === SUMMARY_PREFIX\n ? userOptions.summaryPrefix\n : runtime.context.summaryPrefix ?? userOptions.summaryPrefix,\n } as InferInteropZodOutput<typeof contextSchema>;\n const { messages } = state;\n\n // Ensure all messages have IDs\n ensureMessageIds(messages);\n\n const tokenCounter = config.tokenCounter || countTokensApproximately;\n const totalTokens = await tokenCounter(messages);\n\n if (\n config.maxTokensBeforeSummary == null ||\n totalTokens < config.maxTokensBeforeSummary\n ) {\n return;\n }\n\n const { systemPrompt, conversationMessages } =\n splitSystemMessage(messages);\n const cutoffIndex = findSafeCutoff(\n conversationMessages,\n config.messagesToKeep\n );\n\n if (cutoffIndex <= 0) {\n return;\n }\n\n const { messagesToSummarize, preservedMessages } = partitionMessages(\n systemPrompt,\n conversationMessages,\n cutoffIndex\n );\n\n const summary = await createSummary(\n messagesToSummarize,\n config.model,\n config.summaryPrompt,\n tokenCounter\n );\n\n const updatedSystemMessage = buildUpdatedSystemMessage(\n systemPrompt,\n summary,\n config.summaryPrefix\n );\n\n return {\n messages: [\n new RemoveMessage({ id: REMOVE_ALL_MESSAGES }),\n updatedSystemMessage,\n ...preservedMessages,\n ],\n };\n },\n });\n}\n\n/**\n * Ensure all messages have unique IDs\n */\nfunction ensureMessageIds(messages: BaseMessage[]): void {\n for (const msg of messages) {\n if (!msg.id) {\n msg.id = uuid();\n }\n }\n}\n\n/**\n * Separate system message from conversation messages\n */\nfunction splitSystemMessage(messages: BaseMessage[]): {\n systemPrompt: SystemMessage | null;\n conversationMessages: BaseMessage[];\n} {\n if (messages.length > 0 && SystemMessage.isInstance(messages[0])) {\n return {\n systemPrompt: messages[0] as SystemMessage,\n conversationMessages: messages.slice(1),\n };\n }\n return {\n systemPrompt: null,\n conversationMessages: messages,\n };\n}\n\n/**\n * Partition messages into those to summarize and those to preserve\n */\nfunction partitionMessages(\n systemPrompt: SystemMessage | null,\n conversationMessages: BaseMessage[],\n cutoffIndex: number\n): { messagesToSummarize: BaseMessage[]; preservedMessages: BaseMessage[] } {\n const messagesToSummarize = conversationMessages.slice(0, cutoffIndex);\n const preservedMessages = conversationMessages.slice(cutoffIndex);\n\n // Include system message in messages to summarize to capture previous summaries\n if (systemPrompt) {\n messagesToSummarize.unshift(systemPrompt);\n }\n\n return { messagesToSummarize, preservedMessages };\n}\n\n/**\n * Build updated system message incorporating the summary\n */\nfunction buildUpdatedSystemMessage(\n originalSystemMessage: SystemMessage | null,\n summary: string,\n summaryPrefix: string\n): SystemMessage {\n let originalContent = \"\";\n if (originalSystemMessage) {\n const { content } = originalSystemMessage;\n if (typeof content === \"string\") {\n originalContent = content.split(summaryPrefix)[0].trim();\n }\n }\n\n const content = originalContent\n ? `${originalContent}\\n${summaryPrefix}\\n${summary}`\n : `${summaryPrefix}\\n${summary}`;\n\n return new SystemMessage({\n content,\n id: originalSystemMessage?.id || uuid(),\n });\n}\n\n/**\n * Find safe cutoff point that preserves AI/Tool message pairs\n */\nfunction findSafeCutoff(\n messages: BaseMessage[],\n messagesToKeep: number\n): number {\n if (messages.length <= messagesToKeep) {\n return 0;\n }\n\n const targetCutoff = messages.length - messagesToKeep;\n\n for (let i = targetCutoff; i >= 0; i--) {\n if (isSafeCutoffPoint(messages, i)) {\n return i;\n }\n }\n\n return 0;\n}\n\n/**\n * Check if cutting at index would separate AI/Tool message pairs\n */\nfunction isSafeCutoffPoint(\n messages: BaseMessage[],\n cutoffIndex: number\n): boolean {\n if (cutoffIndex >= messages.length) {\n return true;\n }\n\n const searchStart = Math.max(0, cutoffIndex - SEARCH_RANGE_FOR_TOOL_PAIRS);\n const searchEnd = Math.min(\n messages.length,\n cutoffIndex + SEARCH_RANGE_FOR_TOOL_PAIRS\n );\n\n for (let i = searchStart; i < searchEnd; i++) {\n if (!hasToolCalls(messages[i])) {\n continue;\n }\n\n const toolCallIds = extractToolCallIds(messages[i] as AIMessage);\n if (cutoffSeparatesToolPair(messages, i, cutoffIndex, toolCallIds)) {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Extract tool call IDs from an AI message\n */\nfunction extractToolCallIds(aiMessage: AIMessage): Set<string> {\n const toolCallIds = new Set<string>();\n if (aiMessage.tool_calls) {\n for (const toolCall of aiMessage.tool_calls) {\n const id =\n typeof toolCall === \"object\" && \"id\" in toolCall ? toolCall.id : null;\n if (id) {\n toolCallIds.add(id);\n }\n }\n }\n return toolCallIds;\n}\n\n/**\n * Check if cutoff separates an AI message from its corresponding tool messages\n */\nfunction cutoffSeparatesToolPair(\n messages: BaseMessage[],\n aiMessageIndex: number,\n cutoffIndex: number,\n toolCallIds: Set<string>\n): boolean {\n for (let j = aiMessageIndex + 1; j < messages.length; j++) {\n const message = messages[j];\n if (\n ToolMessage.isInstance(message) &&\n toolCallIds.has(message.tool_call_id)\n ) {\n const aiBeforeCutoff = aiMessageIndex < cutoffIndex;\n const toolBeforeCutoff = j < cutoffIndex;\n if (aiBeforeCutoff !== toolBeforeCutoff) {\n return true;\n }\n }\n }\n return false;\n}\n\n/**\n * Generate summary for the given messages\n */\nasync function createSummary(\n messagesToSummarize: BaseMessage[],\n model: BaseLanguageModel,\n summaryPrompt: string,\n tokenCounter: TokenCounter\n): Promise<string> {\n if (!messagesToSummarize.length) {\n return \"No previous conversation history.\";\n }\n\n const trimmedMessages = await trimMessagesForSummary(\n messagesToSummarize,\n tokenCounter\n );\n\n if (!trimmedMessages.length) {\n return \"Previous conversation was too long to summarize.\";\n }\n\n try {\n const formattedPrompt = summaryPrompt.replace(\n \"{messages}\",\n JSON.stringify(trimmedMessages, null, 2)\n );\n const response = await model.invoke(formattedPrompt);\n const { content } = response;\n return typeof content === \"string\"\n ? content.trim()\n : \"Error generating summary: Invalid response format\";\n } catch (e) {\n return `Error generating summary: ${e}`;\n }\n}\n\n/**\n * Trim messages to fit within summary generation limits\n */\nasync function trimMessagesForSummary(\n messages: BaseMessage[],\n tokenCounter: TokenCounter\n): Promise<BaseMessage[]> {\n try {\n return await trimMessages(messages, {\n maxTokens: DEFAULT_TRIM_TOKEN_LIMIT,\n tokenCounter: async (msgs) => Promise.resolve(tokenCounter(msgs)),\n strategy: \"last\",\n allowPartial: true,\n includeSystem: true,\n });\n } catch {\n // Fallback to last N messages if trimming fails\n return messages.slice(-DEFAULT_FALLBACK_MESSAGE_COUNT);\n }\n}\n"],"mappings":";;;;;;;;;;AAqBA,MAAM,yBAAyB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;WA0BrB,CAAC;AAEZ,MAAM,iBAAiB;AAEvB,MAAM,2BAA2B;AACjC,MAAM,2BAA2B;AACjC,MAAM,iCAAiC;AACvC,MAAM,8BAA8B;AAIpC,MAAM,gBAAgB,EAAE,OAAO;CAC7B,OAAO,EAAE,QAA2B;CACpC,wBAAwB,EAAE,QAAQ,CAAC,UAAU;CAC7C,gBAAgB,EAAE,QAAQ,CAAC,QAAQ,yBAAyB;CAC5D,cAAc,EACX,UAAU,CACV,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC,CACtB,QAAQ,EAAE,MAAM,CAAC,EAAE,QAAQ,EAAE,EAAE,QAAQ,EAAE,QAAQ,CAAC,AAAC,EAAC,CAAC,CACrD,UAAU;CACb,eAAe,EAAE,QAAQ,CAAC,QAAQ,uBAAuB;CACzD,eAAe,EAAE,QAAQ,CAAC,QAAQ,eAAe;AAClD,EAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCF,SAAgB,wBACdA,SACA;AACA,QAAO,iBAAiB;EACtB,MAAM;EACN;EACA,aAAa,OAAO,OAAO,YAAY;;;;GAIrC,MAAM,cAAc,aAAa,eAAe,QAAQ;;;;GAKxD,MAAM,SAAS;IACb,OAAO,YAAY;IACnB,wBACE,QAAQ,QAAQ,2BAA2B,SACvC,QAAQ,QAAQ,yBAChB,YAAY;IAClB,gBACE,QAAQ,QAAQ,mBAAmB,2BAC/B,YAAY,iBACZ,QAAQ,QAAQ,kBAAkB,YAAY;IACpD,cACE,QAAQ,QAAQ,iBAAiB,SAC7B,QAAQ,QAAQ,eAChB,YAAY;IAClB,eACE,QAAQ,QAAQ,kBAAkB,yBAC9B,YAAY,gBACZ,QAAQ,QAAQ,iBAAiB,YAAY;IACnD,eACE,QAAQ,QAAQ,kBAAkB,iBAC9B,YAAY,gBACZ,QAAQ,QAAQ,iBAAiB,YAAY;GACpD;GACD,MAAM,EAAE,UAAU,GAAG;GAGrB,iBAAiB,SAAS;GAE1B,MAAM,eAAe,OAAO,gBAAgB;GAC5C,MAAM,cAAc,MAAM,aAAa,SAAS;AAEhD,OACE,OAAO,0BAA0B,QACjC,cAAc,OAAO,uBAErB;GAGF,MAAM,EAAE,cAAc,sBAAsB,GAC1C,mBAAmB,SAAS;GAC9B,MAAM,cAAc,eAClB,sBACA,OAAO,eACR;AAED,OAAI,eAAe,EACjB;GAGF,MAAM,EAAE,qBAAqB,mBAAmB,GAAG,kBACjD,cACA,sBACA,YACD;GAED,MAAM,UAAU,MAAM,cACpB,qBACA,OAAO,OACP,OAAO,eACP,aACD;GAED,MAAM,uBAAuB,0BAC3B,cACA,SACA,OAAO,cACR;AAED,UAAO,EACL,UAAU;IACR,IAAI,cAAc,EAAE,IAAI,oBAAqB;IAC7C;IACA,GAAG;GACJ,EACF;EACF;CACF,EAAC;AACH;;;;AAKD,SAAS,iBAAiBC,UAA+B;AACvD,MAAK,MAAM,OAAO,SAChB,KAAI,CAAC,IAAI,IACP,IAAI,KAAKC,IAAM;AAGpB;;;;AAKD,SAAS,mBAAmBD,UAG1B;AACA,KAAI,SAAS,SAAS,KAAK,cAAc,WAAW,SAAS,GAAG,CAC9D,QAAO;EACL,cAAc,SAAS;EACvB,sBAAsB,SAAS,MAAM,EAAE;CACxC;AAEH,QAAO;EACL,cAAc;EACd,sBAAsB;CACvB;AACF;;;;AAKD,SAAS,kBACPE,cACAC,sBACAC,aAC0E;CAC1E,MAAM,sBAAsB,qBAAqB,MAAM,GAAG,YAAY;CACtE,MAAM,oBAAoB,qBAAqB,MAAM,YAAY;AAGjE,KAAI,cACF,oBAAoB,QAAQ,aAAa;AAG3C,QAAO;EAAE;EAAqB;CAAmB;AAClD;;;;AAKD,SAAS,0BACPC,uBACAC,SACAC,eACe;CACf,IAAI,kBAAkB;AACtB,KAAI,uBAAuB;EACzB,MAAM,EAAE,oBAAS,GAAG;AACpB,MAAI,OAAOC,cAAY,UACrB,kBAAkBA,UAAQ,MAAM,cAAc,CAAC,GAAG,MAAM;CAE3D;CAED,MAAM,UAAU,kBACZ,GAAG,gBAAgB,EAAE,EAAE,cAAc,EAAE,EAAE,SAAS,GAClD,GAAG,cAAc,EAAE,EAAE,SAAS;AAElC,QAAO,IAAI,cAAc;EACvB;EACA,IAAI,uBAAuB,MAAMP,IAAM;CACxC;AACF;;;;AAKD,SAAS,eACPD,UACAS,gBACQ;AACR,KAAI,SAAS,UAAU,eACrB,QAAO;CAGT,MAAM,eAAe,SAAS,SAAS;AAEvC,MAAK,IAAI,IAAI,cAAc,KAAK,GAAG,IACjC,KAAI,kBAAkB,UAAU,EAAE,CAChC,QAAO;AAIX,QAAO;AACR;;;;AAKD,SAAS,kBACPT,UACAI,aACS;AACT,KAAI,eAAe,SAAS,OAC1B,QAAO;CAGT,MAAM,cAAc,KAAK,IAAI,GAAG,cAAc,4BAA4B;CAC1E,MAAM,YAAY,KAAK,IACrB,SAAS,QACT,cAAc,4BACf;AAED,MAAK,IAAI,IAAI,aAAa,IAAI,WAAW,KAAK;AAC5C,MAAI,CAAC,aAAa,SAAS,GAAG,CAC5B;EAGF,MAAM,cAAc,mBAAmB,SAAS,GAAgB;AAChE,MAAI,wBAAwB,UAAU,GAAG,aAAa,YAAY,CAChE,QAAO;CAEV;AAED,QAAO;AACR;;;;AAKD,SAAS,mBAAmBM,WAAmC;CAC7D,MAAM,8BAAc,IAAI;AACxB,KAAI,UAAU,WACZ,MAAK,MAAM,YAAY,UAAU,YAAY;EAC3C,MAAM,KACJ,OAAO,aAAa,YAAY,QAAQ,WAAW,SAAS,KAAK;AACnE,MAAI,IACF,YAAY,IAAI,GAAG;CAEtB;AAEH,QAAO;AACR;;;;AAKD,SAAS,wBACPV,UACAW,gBACAP,aACAQ,aACS;AACT,MAAK,IAAI,IAAI,iBAAiB,GAAG,IAAI,SAAS,QAAQ,KAAK;EACzD,MAAM,UAAU,SAAS;AACzB,MACE,YAAY,WAAW,QAAQ,IAC/B,YAAY,IAAI,QAAQ,aAAa,EACrC;GACA,MAAM,iBAAiB,iBAAiB;GACxC,MAAM,mBAAmB,IAAI;AAC7B,OAAI,mBAAmB,iBACrB,QAAO;EAEV;CACF;AACD,QAAO;AACR;;;;AAKD,eAAe,cACbC,qBACAC,OACAC,eACAC,cACiB;AACjB,KAAI,CAAC,oBAAoB,OACvB,QAAO;CAGT,MAAM,kBAAkB,MAAM,uBAC5B,qBACA,aACD;AAED,KAAI,CAAC,gBAAgB,OACnB,QAAO;AAGT,KAAI;EACF,MAAM,kBAAkB,cAAc,QACpC,cACA,KAAK,UAAU,iBAAiB,MAAM,EAAE,CACzC;EACD,MAAM,WAAW,MAAM,MAAM,OAAO,gBAAgB;EACpD,MAAM,EAAE,SAAS,GAAG;AACpB,SAAO,OAAO,YAAY,WACtB,QAAQ,MAAM,GACd;CACL,SAAQ,GAAG;AACV,SAAO,CAAC,0BAA0B,EAAE,GAAG;CACxC;AACF;;;;AAKD,eAAe,uBACbhB,UACAgB,cACwB;AACxB,KAAI;AACF,SAAO,MAAM,aAAa,UAAU;GAClC,WAAW;GACX,cAAc,OAAO,SAAS,QAAQ,QAAQ,aAAa,KAAK,CAAC;GACjE,UAAU;GACV,cAAc;GACd,eAAe;EAChB,EAAC;CACH,QAAO;AAEN,SAAO,SAAS,MAAM,CAAC,+BAA+B;CACvD;AACF"}
@@ -0,0 +1,314 @@
1
+ const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
+ const require_middleware = require('../middleware.cjs');
3
+ require('../index.cjs');
4
+ const __langchain_core_messages = require_rolldown_runtime.__toESM(require("@langchain/core/messages"));
5
+ const __langchain_core_tools = require_rolldown_runtime.__toESM(require("@langchain/core/tools"));
6
+ const __langchain_langgraph = require_rolldown_runtime.__toESM(require("@langchain/langgraph"));
7
+ const zod_v3 = require_rolldown_runtime.__toESM(require("zod/v3"));
8
+
9
+ //#region src/agents/middleware/todoListMiddleware.ts
10
+ /**
11
+ * Description for the write_todos tool
12
+ * Ported exactly from Python WRITE_TODOS_DESCRIPTION
13
+ */
14
+ const WRITE_TODOS_DESCRIPTION = `Use this tool to create and manage a structured task list for your current work session. This helps you track progress, organize complex tasks, and demonstrate thoroughness to the user.
15
+ It also helps the user understand the progress of the task and overall progress of their requests.
16
+ Only use this tool if you think it will be helpful in staying organized. If the user's request is trivial and takes less than 3 steps, it is better to NOT use this tool and just do the taks directly.
17
+
18
+ ## When to Use This Tool
19
+ Use this tool in these scenarios:
20
+
21
+ 1. Complex multi-step tasks - When a task requires 3 or more distinct steps or actions
22
+ 2. Non-trivial and complex tasks - Tasks that require careful planning or multiple operations
23
+ 3. User explicitly requests todo list - When the user directly asks you to use the todo list
24
+ 4. User provides multiple tasks - When users provide a list of things to be done (numbered or comma-separated)
25
+ 5. The plan may need future revisions or updates based on results from the first few steps. Keeping track of this in a list is helpful.
26
+
27
+ ## How to Use This Tool
28
+ 1. When you start working on a task - Mark it as in_progress BEFORE beginning work.
29
+ 2. After completing a task - Mark it as completed and add any new follow-up tasks discovered during implementation.
30
+ 3. You can also update future tasks, such as deleting them if they are no longer necessary, or adding new tasks that are necessary. Don't change previously completed tasks.
31
+ 4. You can make several updates to the todo list at once. For example, when you complete a task, you can mark the next task you need to start as in_progress.
32
+
33
+ ## When NOT to Use This Tool
34
+ It is important to skip using this tool when:
35
+ 1. There is only a single, straightforward task
36
+ 2. The task is trivial and tracking it provides no benefit
37
+ 3. The task can be completed in less than 3 trivial steps
38
+ 4. The task is purely conversational or informational
39
+
40
+ ## Examples of When to Use the Todo List
41
+
42
+ <example>
43
+ User: I want to add a dark mode toggle to the application settings. Make sure you run the tests and build when you're done!
44
+ Assistant: I'll help add a dark mode toggle to your application settings. Let me create a todo list to track this implementation.
45
+ *Creates todo list with the following items:*
46
+ 1. Create dark mode toggle component in Settings page
47
+ 2. Add dark mode state management (context/store)
48
+ 3. Implement CSS-in-JS styles for dark theme
49
+ 4. Update existing components to support theme switching
50
+ 5. Run tests and build process, addressing any failures or errors that occur
51
+ *Begins working on the first task*
52
+
53
+ <reasoning>
54
+ The assistant used the todo list because:
55
+ 1. Adding dark mode in it of itself is a multi-step feature requiring UI, state management, and styling changes
56
+ 2. The assistant inferred that tests and build need to pass by adding "Ensure tests and build succeed" as the final task
57
+ 3. Both of the user's requests are complex and require multiple steps to complete.
58
+ </reasoning>
59
+ </example>
60
+
61
+ <example>
62
+ User: Help me plan a comprehensive marketing campaign for our new product launch, including social media, email marketing, and press releases.
63
+ Assistant: I'll help you plan a comprehensive marketing campaign for your product launch. Let me create a todo list to organize all the components.
64
+ *Creates todo list with the following items:*
65
+ 1. Define target audience and key messaging
66
+ 2. Create social media content calendar and posting schedule
67
+ 3. Design email marketing sequence and automation flows
68
+ 4. Draft press release and identify media contacts
69
+ 5. Set up tracking and analytics for campaign performance
70
+ 6. Create visual assets and brand materials
71
+ 7. Coordinate launch timeline and deliverables
72
+ *Begins working on the first task*
73
+
74
+ <reasoning>
75
+ The assistant used the todo list because:
76
+ 1. Marketing campaign planning involves multiple distinct channels and activities
77
+ 2. Each component requires careful coordination and planning
78
+ 3. The systematic approach ensures all aspects of the launch are covered
79
+ </reasoning>
80
+ </example>
81
+
82
+ <example>
83
+ User: Help me rename the function getCwd to getCurrentWorkingDirectory across my project
84
+ Assistant: Let me first search through your codebase to find all occurrences of 'getCwd'.
85
+ *Uses search tools to locate all instances of getCwd in the codebase*
86
+ Assistant: I've found 15 instances of 'getCwd' across 8 different files. Let me create a todo list to track these changes.
87
+ *Creates todo list with specific items for each file that needs updating*
88
+
89
+ <reasoning>
90
+ The assistant used the todo list because:
91
+ 1. The assistant searched to understand the scope of the task
92
+ 2. Upon finding multiple occurrences across different files, it determined this was a complex task with multiple steps (>3)
93
+ 3. The todo list helps ensure every instance is tracked and updated systematically
94
+ 4. This approach prevents missing any occurrences and maintains consistency.
95
+ </reasoning>
96
+ </example>
97
+
98
+ <example>
99
+ User: I need help organizing my home office: decluttering the desk, setting up a filing system, organizing digital files, and creating a daily workflow.
100
+ Assistant: I'll help you organize your home office systematically. Let me create a todo list to track each area of organization.
101
+ *Creates todo list with items like: 1) Sort and declutter desk items, 2) Set up physical filing system for documents, 3) Organize digital files and folders, 4) Create daily workflow and productivity systems, 5) Establish maintenance routines*
102
+ Let's start with decluttering your desk space to create a clean foundation for the other organizational systems.
103
+
104
+ <reasoning>
105
+ The assistant used the todo list because:
106
+ 1. The user provided multiple distinct organizational tasks
107
+ 2. Each area requires different approaches and careful planning
108
+ 3. Home organization benefits from systematic, step-by-step completion
109
+ 4. Progress tracking ensures all areas are addressed thoroughly
110
+ </reasoning>
111
+ </example>
112
+
113
+ ## Examples of When NOT to Use the Todo List
114
+
115
+ <example>
116
+ User: How do I print 'Hello World' in Python?
117
+ Assistant: In Python, you can print "Hello World" with this simple code:
118
+
119
+ \`\`\`python
120
+ print("Hello World")
121
+ \`\`\`
122
+
123
+ This will output the text "Hello World" to the console when executed.</assistant>
124
+
125
+ <reasoning>
126
+ The assistant did not use the todo list because this is a single, trivial task that can be completed in one step. There's no need to track multiple tasks or steps for such a straightforward request.
127
+ </reasoning>
128
+ </example>
129
+
130
+ <example>
131
+ User: What's the best way to water houseplants?
132
+ Assistant: The best way to water houseplants depends on the specific plant type, but here are some general guidelines:
133
+
134
+ - Check soil moisture by inserting your finger about 1-2 inches into the soil
135
+ - Water thoroughly when the top inch feels dry, allowing water to drain from the bottom
136
+ - Use room temperature water and water in the morning when possible
137
+ - Avoid overwatering, which is more harmful than underwatering for most plants
138
+
139
+ Different plants have different needs, so it's important to research your specific varieties for optimal care.
140
+
141
+ <reasoning>
142
+ The assistant did not use the todo list because this is an informational request with no actual tasks to complete. The user is simply asking for advice and explanation, not for the assistant to perform multiple steps or activities.
143
+ </reasoning>
144
+ </example>
145
+
146
+ <example>
147
+ User: Can you add a comment to the calculateTotal function to explain what it does?
148
+ Assistant: Sure, let me add a comment to the calculateTotal function to explain what it does.
149
+ * Uses the Edit tool to add a comment to the calculateTotal function *
150
+
151
+ <reasoning>
152
+ The assistant did not use the todo list because this is a single, straightforward task confined to one location. Adding a comment doesn't require tracking multiple steps or systematic organization.
153
+ </reasoning>
154
+ </example>
155
+
156
+ <example>
157
+ User: What time is it in Tokyo right now?
158
+ Assistant: I'll check the current time in Tokyo for you.
159
+
160
+ *Searches for current time in Tokyo*
161
+
162
+ The current time in Tokyo, Japan is [current time]. Tokyo is in the Japan Standard Time (JST) zone, which is UTC+9.
163
+
164
+ <reasoning>
165
+ The assistant did not use the todo list because this is a single information lookup with immediate results. There are no multiple steps to track or organize, making the todo list unnecessary for this straightforward request.
166
+ </reasoning>
167
+ </example>
168
+
169
+ <example>
170
+ User: I need to write a function that checks if a number is prime and then test it out.
171
+ Assistant: I'll help you write a function that checks if a number is prime and then test it out.
172
+ *Writes function that checks if a number is prime*
173
+ *Tests the function*
174
+
175
+ <reasoning>
176
+ Even though this is a multi-step task, it is very straightforward and can be completed in two trivial steps (which is less than 3 steps!). Using the todo list here is overkill and wastes time and tokens.
177
+ </reasoning>
178
+ </example>
179
+
180
+ <example>
181
+ User: I want you to order a pizza from Dominos, order a burger from McDonald's, and order a salad from Subway.
182
+ Assistant: I'll help you order a pizza from Dominos, order a burger from McDonald's, and order a salad from Subway.
183
+ *Orders a pizza from Dominos*
184
+ *Orders a burger from McDonald's*
185
+ *Orders a salad from Subway*
186
+
187
+ <reasoning>
188
+ Even though this is a multi-step task, assuming the assistant has the ability to order from these restaurants, it is very straightforward and can be completed in three trivial tool calls.
189
+ Using the todo list here is overkill and wastes time and tokens. These three tool calls should be made in parallel, in fact.
190
+ </reasoning>
191
+ </example>
192
+
193
+
194
+ ## Task States and Management
195
+
196
+ 1. **Task States**: Use these states to track progress:
197
+ - pending: Task not yet started
198
+ - in_progress: Currently working on (you can have multiple tasks in_progress at a time if they are not related to each other and can be run in parallel)
199
+ - completed: Task finished successfully
200
+
201
+ 2. **Task Management**:
202
+ - Update task status in real-time as you work
203
+ - Mark tasks complete IMMEDIATELY after finishing (don't batch completions)
204
+ - Complete current tasks before starting new ones
205
+ - Remove tasks that are no longer relevant from the list entirely
206
+ - IMPORTANT: When you write this todo list, you should mark your first task (or tasks) as in_progress immediately!.
207
+ - IMPORTANT: Unless all tasks are completed, you should always have at least one task in_progress to show the user that you are working on something.
208
+
209
+ 3. **Task Completion Requirements**:
210
+ - ONLY mark a task as completed when you have FULLY accomplished it
211
+ - If you encounter errors, blockers, or cannot finish, keep the task as in_progress
212
+ - When blocked, create a new task describing what needs to be resolved
213
+ - Never mark a task as completed if:
214
+ - There are unresolved issues or errors
215
+ - Work is partial or incomplete
216
+ - You encountered blockers that prevent completion
217
+ - You couldn't find necessary resources or dependencies
218
+ - Quality standards haven't been met
219
+
220
+ 4. **Task Breakdown**:
221
+ - Create specific, actionable items
222
+ - Break complex tasks into smaller, manageable steps
223
+ - Use clear, descriptive task names
224
+
225
+ Being proactive with task management demonstrates attentiveness and ensures you complete all requirements successfully
226
+ Remember: If you only need to make a few tool calls to complete a task, and it is clear what you need to do, it is better to just do the task directly and NOT call this tool at all.`;
227
+ const TODO_LIST_MIDDLEWARE_SYSTEM_PROMPT = `## \`write_todos\`
228
+
229
+ You have access to the \`write_todos\` tool to help you manage and plan complex objectives.
230
+ Use this tool for complex objectives to ensure that you are tracking each necessary step and giving the user visibility into your progress.
231
+ This tool is very helpful for planning complex objectives, and for breaking down these larger complex objectives into smaller steps.
232
+
233
+ It is critical that you mark todos as completed as soon as you are done with a step. Do not batch up multiple steps before marking them as completed.
234
+ For simple objectives that only require a few steps, it is better to just complete the objective directly and NOT use this tool.
235
+ Writing todos takes time and tokens, use it when it is helpful for managing complex many-step problems! But not for simple few-step requests.
236
+
237
+ ## Important To-Do List Usage Notes to Remember
238
+ - The \`write_todos\` tool should never be called multiple times in parallel.
239
+ - Don't be afraid to revise the To-Do list as you go. New information may reveal new tasks that need to be done, or old tasks that are irrelevant.`;
240
+ const TodoStatus = zod_v3.z.enum([
241
+ "pending",
242
+ "in_progress",
243
+ "completed"
244
+ ]).describe("Status of the todo");
245
+ const TodoSchema = zod_v3.z.object({
246
+ content: zod_v3.z.string().describe("Content of the todo item"),
247
+ status: TodoStatus
248
+ });
249
+ const stateSchema = zod_v3.z.object({ todos: zod_v3.z.array(TodoSchema).default([]) });
250
+ /**
251
+ * Creates a middleware that provides todo list management capabilities to agents.
252
+ *
253
+ * This middleware adds a `write_todos` tool that allows agents to create and manage
254
+ * structured task lists for complex multi-step operations. It's designed to help
255
+ * agents track progress, organize complex tasks, and provide users with visibility
256
+ * into task completion status.
257
+ *
258
+ * The middleware automatically injects system prompts that guide the agent on when
259
+ * and how to use the todo functionality effectively.
260
+ *
261
+ * @example
262
+ * ```typescript
263
+ * import { todoListMiddleware, createAgent } from 'langchain';
264
+ *
265
+ * const agent = createAgent({
266
+ * model: "openai:gpt-4o",
267
+ * middleware: [todoListMiddleware()],
268
+ * });
269
+ *
270
+ * // Agent now has access to write_todos tool and todo state tracking
271
+ * const result = await agent.invoke({
272
+ * messages: [new HumanMessage("Help me refactor my codebase")]
273
+ * });
274
+ *
275
+ * console.log(result.todos); // Array of todo items with status tracking
276
+ * ```
277
+ *
278
+ * @returns A configured middleware instance that provides todo management capabilities
279
+ *
280
+ * @see {@link TodoMiddlewareState} for the state schema
281
+ * @see {@link writeTodos} for the tool implementation
282
+ */
283
+ function todoListMiddleware(options) {
284
+ /**
285
+ * Write todos tool - manages todo list with Command return
286
+ */
287
+ const writeTodos = (0, __langchain_core_tools.tool)(({ todos }, config) => {
288
+ return new __langchain_langgraph.Command({ update: {
289
+ todos,
290
+ messages: [new __langchain_core_messages.ToolMessage({
291
+ content: `Updated todo list to ${JSON.stringify(todos)}`,
292
+ tool_call_id: config.toolCall?.id
293
+ })]
294
+ } });
295
+ }, {
296
+ name: "write_todos",
297
+ description: options?.toolDescription ?? WRITE_TODOS_DESCRIPTION,
298
+ schema: zod_v3.z.object({ todos: zod_v3.z.array(TodoSchema).describe("List of todo items to update") })
299
+ });
300
+ return require_middleware.createMiddleware({
301
+ name: "todoListMiddleware",
302
+ stateSchema,
303
+ tools: [writeTodos],
304
+ wrapModelCall: (request, handler) => handler({
305
+ ...request,
306
+ systemPrompt: (request.systemPrompt ? `${request.systemPrompt}\n\n` : "") + (options?.systemPrompt ?? TODO_LIST_MIDDLEWARE_SYSTEM_PROMPT)
307
+ })
308
+ });
309
+ }
310
+
311
+ //#endregion
312
+ exports.TODO_LIST_MIDDLEWARE_SYSTEM_PROMPT = TODO_LIST_MIDDLEWARE_SYSTEM_PROMPT;
313
+ exports.todoListMiddleware = todoListMiddleware;
314
+ //# sourceMappingURL=todoListMiddleware.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"todoListMiddleware.cjs","names":["z","options?: TodoListMiddlewareOptions","Command","ToolMessage","createMiddleware"],"sources":["../../../src/agents/middleware/todoListMiddleware.ts"],"sourcesContent":["import { z } from \"zod/v3\";\nimport { Command } from \"@langchain/langgraph\";\nimport { tool } from \"@langchain/core/tools\";\nimport { ToolMessage } from \"@langchain/core/messages\";\n\nimport { createMiddleware } from \"../index.js\";\n\n/**\n * Description for the write_todos tool\n * Ported exactly from Python WRITE_TODOS_DESCRIPTION\n */\nconst WRITE_TODOS_DESCRIPTION = `Use this tool to create and manage a structured task list for your current work session. This helps you track progress, organize complex tasks, and demonstrate thoroughness to the user.\nIt also helps the user understand the progress of the task and overall progress of their requests.\nOnly use this tool if you think it will be helpful in staying organized. If the user's request is trivial and takes less than 3 steps, it is better to NOT use this tool and just do the taks directly.\n\n## When to Use This Tool\nUse this tool in these scenarios:\n\n1. Complex multi-step tasks - When a task requires 3 or more distinct steps or actions\n2. Non-trivial and complex tasks - Tasks that require careful planning or multiple operations\n3. User explicitly requests todo list - When the user directly asks you to use the todo list\n4. User provides multiple tasks - When users provide a list of things to be done (numbered or comma-separated)\n5. The plan may need future revisions or updates based on results from the first few steps. Keeping track of this in a list is helpful.\n\n## How to Use This Tool\n1. When you start working on a task - Mark it as in_progress BEFORE beginning work.\n2. After completing a task - Mark it as completed and add any new follow-up tasks discovered during implementation.\n3. You can also update future tasks, such as deleting them if they are no longer necessary, or adding new tasks that are necessary. Don't change previously completed tasks.\n4. You can make several updates to the todo list at once. For example, when you complete a task, you can mark the next task you need to start as in_progress.\n\n## When NOT to Use This Tool\nIt is important to skip using this tool when:\n1. There is only a single, straightforward task\n2. The task is trivial and tracking it provides no benefit\n3. The task can be completed in less than 3 trivial steps\n4. The task is purely conversational or informational\n\n## Examples of When to Use the Todo List\n\n<example>\nUser: I want to add a dark mode toggle to the application settings. Make sure you run the tests and build when you're done!\nAssistant: I'll help add a dark mode toggle to your application settings. Let me create a todo list to track this implementation.\n*Creates todo list with the following items:*\n1. Create dark mode toggle component in Settings page\n2. Add dark mode state management (context/store)\n3. Implement CSS-in-JS styles for dark theme\n4. Update existing components to support theme switching\n5. Run tests and build process, addressing any failures or errors that occur\n*Begins working on the first task*\n\n<reasoning>\nThe assistant used the todo list because:\n1. Adding dark mode in it of itself is a multi-step feature requiring UI, state management, and styling changes\n2. The assistant inferred that tests and build need to pass by adding \"Ensure tests and build succeed\" as the final task\n3. Both of the user's requests are complex and require multiple steps to complete.\n</reasoning>\n</example>\n\n<example>\nUser: Help me plan a comprehensive marketing campaign for our new product launch, including social media, email marketing, and press releases.\nAssistant: I'll help you plan a comprehensive marketing campaign for your product launch. Let me create a todo list to organize all the components.\n*Creates todo list with the following items:*\n1. Define target audience and key messaging\n2. Create social media content calendar and posting schedule\n3. Design email marketing sequence and automation flows\n4. Draft press release and identify media contacts\n5. Set up tracking and analytics for campaign performance\n6. Create visual assets and brand materials\n7. Coordinate launch timeline and deliverables\n*Begins working on the first task*\n\n<reasoning>\nThe assistant used the todo list because:\n1. Marketing campaign planning involves multiple distinct channels and activities\n2. Each component requires careful coordination and planning\n3. The systematic approach ensures all aspects of the launch are covered\n</reasoning>\n</example>\n\n<example>\nUser: Help me rename the function getCwd to getCurrentWorkingDirectory across my project\nAssistant: Let me first search through your codebase to find all occurrences of 'getCwd'.\n*Uses search tools to locate all instances of getCwd in the codebase*\nAssistant: I've found 15 instances of 'getCwd' across 8 different files. Let me create a todo list to track these changes.\n*Creates todo list with specific items for each file that needs updating*\n\n<reasoning>\nThe assistant used the todo list because:\n1. The assistant searched to understand the scope of the task\n2. Upon finding multiple occurrences across different files, it determined this was a complex task with multiple steps (>3)\n3. The todo list helps ensure every instance is tracked and updated systematically\n4. This approach prevents missing any occurrences and maintains consistency.\n</reasoning>\n</example>\n\n<example>\nUser: I need help organizing my home office: decluttering the desk, setting up a filing system, organizing digital files, and creating a daily workflow.\nAssistant: I'll help you organize your home office systematically. Let me create a todo list to track each area of organization.\n*Creates todo list with items like: 1) Sort and declutter desk items, 2) Set up physical filing system for documents, 3) Organize digital files and folders, 4) Create daily workflow and productivity systems, 5) Establish maintenance routines*\nLet's start with decluttering your desk space to create a clean foundation for the other organizational systems.\n\n<reasoning>\nThe assistant used the todo list because:\n1. The user provided multiple distinct organizational tasks\n2. Each area requires different approaches and careful planning\n3. Home organization benefits from systematic, step-by-step completion\n4. Progress tracking ensures all areas are addressed thoroughly\n</reasoning>\n</example>\n\n## Examples of When NOT to Use the Todo List\n\n<example>\nUser: How do I print 'Hello World' in Python?\nAssistant: In Python, you can print \"Hello World\" with this simple code:\n\n\\`\\`\\`python\nprint(\"Hello World\")\n\\`\\`\\`\n\nThis will output the text \"Hello World\" to the console when executed.</assistant>\n\n<reasoning>\nThe assistant did not use the todo list because this is a single, trivial task that can be completed in one step. There's no need to track multiple tasks or steps for such a straightforward request.\n</reasoning>\n</example>\n\n<example>\nUser: What's the best way to water houseplants?\nAssistant: The best way to water houseplants depends on the specific plant type, but here are some general guidelines:\n\n- Check soil moisture by inserting your finger about 1-2 inches into the soil\n- Water thoroughly when the top inch feels dry, allowing water to drain from the bottom\n- Use room temperature water and water in the morning when possible\n- Avoid overwatering, which is more harmful than underwatering for most plants\n\nDifferent plants have different needs, so it's important to research your specific varieties for optimal care.\n\n<reasoning>\nThe assistant did not use the todo list because this is an informational request with no actual tasks to complete. The user is simply asking for advice and explanation, not for the assistant to perform multiple steps or activities.\n</reasoning>\n</example>\n\n<example>\nUser: Can you add a comment to the calculateTotal function to explain what it does?\nAssistant: Sure, let me add a comment to the calculateTotal function to explain what it does.\n* Uses the Edit tool to add a comment to the calculateTotal function *\n\n<reasoning>\nThe assistant did not use the todo list because this is a single, straightforward task confined to one location. Adding a comment doesn't require tracking multiple steps or systematic organization.\n</reasoning>\n</example>\n\n<example>\nUser: What time is it in Tokyo right now?\nAssistant: I'll check the current time in Tokyo for you.\n\n*Searches for current time in Tokyo*\n\nThe current time in Tokyo, Japan is [current time]. Tokyo is in the Japan Standard Time (JST) zone, which is UTC+9.\n\n<reasoning>\nThe assistant did not use the todo list because this is a single information lookup with immediate results. There are no multiple steps to track or organize, making the todo list unnecessary for this straightforward request.\n</reasoning>\n</example>\n\n<example>\nUser: I need to write a function that checks if a number is prime and then test it out.\nAssistant: I'll help you write a function that checks if a number is prime and then test it out.\n*Writes function that checks if a number is prime*\n*Tests the function*\n\n<reasoning>\nEven though this is a multi-step task, it is very straightforward and can be completed in two trivial steps (which is less than 3 steps!). Using the todo list here is overkill and wastes time and tokens.\n</reasoning>\n</example>\n\n<example>\nUser: I want you to order a pizza from Dominos, order a burger from McDonald's, and order a salad from Subway.\nAssistant: I'll help you order a pizza from Dominos, order a burger from McDonald's, and order a salad from Subway.\n*Orders a pizza from Dominos*\n*Orders a burger from McDonald's*\n*Orders a salad from Subway*\n\n<reasoning>\nEven though this is a multi-step task, assuming the assistant has the ability to order from these restaurants, it is very straightforward and can be completed in three trivial tool calls. \nUsing the todo list here is overkill and wastes time and tokens. These three tool calls should be made in parallel, in fact.\n</reasoning>\n</example>\n\n\n## Task States and Management\n\n1. **Task States**: Use these states to track progress:\n - pending: Task not yet started\n - in_progress: Currently working on (you can have multiple tasks in_progress at a time if they are not related to each other and can be run in parallel)\n - completed: Task finished successfully\n\n2. **Task Management**:\n - Update task status in real-time as you work\n - Mark tasks complete IMMEDIATELY after finishing (don't batch completions)\n - Complete current tasks before starting new ones\n - Remove tasks that are no longer relevant from the list entirely\n - IMPORTANT: When you write this todo list, you should mark your first task (or tasks) as in_progress immediately!.\n - IMPORTANT: Unless all tasks are completed, you should always have at least one task in_progress to show the user that you are working on something.\n\n3. **Task Completion Requirements**:\n - ONLY mark a task as completed when you have FULLY accomplished it\n - If you encounter errors, blockers, or cannot finish, keep the task as in_progress\n - When blocked, create a new task describing what needs to be resolved\n - Never mark a task as completed if:\n - There are unresolved issues or errors\n - Work is partial or incomplete\n - You encountered blockers that prevent completion\n - You couldn't find necessary resources or dependencies\n - Quality standards haven't been met\n\n4. **Task Breakdown**:\n - Create specific, actionable items\n - Break complex tasks into smaller, manageable steps\n - Use clear, descriptive task names\n\nBeing proactive with task management demonstrates attentiveness and ensures you complete all requirements successfully\nRemember: If you only need to make a few tool calls to complete a task, and it is clear what you need to do, it is better to just do the task directly and NOT call this tool at all.`;\n\nexport const TODO_LIST_MIDDLEWARE_SYSTEM_PROMPT = `## \\`write_todos\\`\n\nYou have access to the \\`write_todos\\` tool to help you manage and plan complex objectives. \nUse this tool for complex objectives to ensure that you are tracking each necessary step and giving the user visibility into your progress.\nThis tool is very helpful for planning complex objectives, and for breaking down these larger complex objectives into smaller steps.\n\nIt is critical that you mark todos as completed as soon as you are done with a step. Do not batch up multiple steps before marking them as completed.\nFor simple objectives that only require a few steps, it is better to just complete the objective directly and NOT use this tool.\nWriting todos takes time and tokens, use it when it is helpful for managing complex many-step problems! But not for simple few-step requests.\n\n## Important To-Do List Usage Notes to Remember\n- The \\`write_todos\\` tool should never be called multiple times in parallel.\n- Don't be afraid to revise the To-Do list as you go. New information may reveal new tasks that need to be done, or old tasks that are irrelevant.`;\n\nconst TodoStatus = z\n .enum([\"pending\", \"in_progress\", \"completed\"])\n .describe(\"Status of the todo\");\nconst TodoSchema = z.object({\n content: z.string().describe(\"Content of the todo item\"),\n status: TodoStatus,\n});\nconst stateSchema = z.object({\n todos: z.array(TodoSchema).default([]),\n});\nexport type TodoMiddlewareState = z.infer<typeof stateSchema>;\n\nexport interface TodoListMiddlewareOptions {\n /**\n * Custom system prompt to guide the agent on using the todo tool.\n * If not provided, uses the default {@link PLANNING_MIDDLEWARE_SYSTEM_PROMPT}.\n */\n systemPrompt?: string;\n /**\n * Custom description for the {@link writeTodos} tool.\n * If not provided, uses the default {@link WRITE_TODOS_DESCRIPTION}.\n */\n toolDescription?: string;\n}\n\n/**\n * Creates a middleware that provides todo list management capabilities to agents.\n *\n * This middleware adds a `write_todos` tool that allows agents to create and manage\n * structured task lists for complex multi-step operations. It's designed to help\n * agents track progress, organize complex tasks, and provide users with visibility\n * into task completion status.\n *\n * The middleware automatically injects system prompts that guide the agent on when\n * and how to use the todo functionality effectively.\n *\n * @example\n * ```typescript\n * import { todoListMiddleware, createAgent } from 'langchain';\n *\n * const agent = createAgent({\n * model: \"openai:gpt-4o\",\n * middleware: [todoListMiddleware()],\n * });\n *\n * // Agent now has access to write_todos tool and todo state tracking\n * const result = await agent.invoke({\n * messages: [new HumanMessage(\"Help me refactor my codebase\")]\n * });\n *\n * console.log(result.todos); // Array of todo items with status tracking\n * ```\n *\n * @returns A configured middleware instance that provides todo management capabilities\n *\n * @see {@link TodoMiddlewareState} for the state schema\n * @see {@link writeTodos} for the tool implementation\n */\nexport function todoListMiddleware(options?: TodoListMiddlewareOptions) {\n /**\n * Write todos tool - manages todo list with Command return\n */\n const writeTodos = tool(\n ({ todos }, config) => {\n return new Command({\n update: {\n todos,\n messages: [\n new ToolMessage({\n content: `Updated todo list to ${JSON.stringify(todos)}`,\n tool_call_id: config.toolCall?.id as string,\n }),\n ],\n },\n });\n },\n {\n name: \"write_todos\",\n description: options?.toolDescription ?? WRITE_TODOS_DESCRIPTION,\n schema: z.object({\n todos: z.array(TodoSchema).describe(\"List of todo items to update\"),\n }),\n }\n );\n\n return createMiddleware({\n name: \"todoListMiddleware\",\n stateSchema,\n tools: [writeTodos],\n wrapModelCall: (request, handler) =>\n handler({\n ...request,\n systemPrompt:\n (request.systemPrompt ? `${request.systemPrompt}\\n\\n` : \"\") +\n (options?.systemPrompt ?? TODO_LIST_MIDDLEWARE_SYSTEM_PROMPT),\n }),\n });\n}\n"],"mappings":";;;;;;;;;;;;;AAWA,MAAM,0BAA0B,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qLAoNoJ,CAAC;AAEtL,MAAa,qCAAqC,CAAC;;;;;;;;;;;;kJAY+F,CAAC;AAEnJ,MAAM,aAAaA,SAChB,KAAK;CAAC;CAAW;CAAe;AAAY,EAAC,CAC7C,SAAS,qBAAqB;AACjC,MAAM,aAAaA,SAAE,OAAO;CAC1B,SAASA,SAAE,QAAQ,CAAC,SAAS,2BAA2B;CACxD,QAAQ;AACT,EAAC;AACF,MAAM,cAAcA,SAAE,OAAO,EAC3B,OAAOA,SAAE,MAAM,WAAW,CAAC,QAAQ,CAAE,EAAC,CACvC,EAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiDF,SAAgB,mBAAmBC,SAAqC;;;;CAItE,MAAM,8CACJ,CAAC,EAAE,OAAO,EAAE,WAAW;AACrB,SAAO,IAAIC,8BAAQ,EACjB,QAAQ;GACN;GACA,UAAU,CACR,IAAIC,sCAAY;IACd,SAAS,CAAC,qBAAqB,EAAE,KAAK,UAAU,MAAM,EAAE;IACxD,cAAc,OAAO,UAAU;GAChC,EACF;EACF,EACF;CACF,GACD;EACE,MAAM;EACN,aAAa,SAAS,mBAAmB;EACzC,QAAQH,SAAE,OAAO,EACf,OAAOA,SAAE,MAAM,WAAW,CAAC,SAAS,+BAA+B,CACpE,EAAC;CACH,EACF;AAED,QAAOI,oCAAiB;EACtB,MAAM;EACN;EACA,OAAO,CAAC,UAAW;EACnB,eAAe,CAAC,SAAS,YACvB,QAAQ;GACN,GAAG;GACH,eACG,QAAQ,eAAe,GAAG,QAAQ,aAAa,IAAI,CAAC,GAAG,OACvD,SAAS,gBAAgB;EAC7B,EAAC;CACL,EAAC;AACH"}
@@ -0,0 +1,75 @@
1
+ import { AgentMiddleware } from "./types.cjs";
2
+ import { z } from "zod/v3";
3
+
4
+ //#region src/agents/middleware/todoListMiddleware.d.ts
5
+ declare const TODO_LIST_MIDDLEWARE_SYSTEM_PROMPT = "## `write_todos`\n\nYou have access to the `write_todos` tool to help you manage and plan complex objectives. \nUse this tool for complex objectives to ensure that you are tracking each necessary step and giving the user visibility into your progress.\nThis tool is very helpful for planning complex objectives, and for breaking down these larger complex objectives into smaller steps.\n\nIt is critical that you mark todos as completed as soon as you are done with a step. Do not batch up multiple steps before marking them as completed.\nFor simple objectives that only require a few steps, it is better to just complete the objective directly and NOT use this tool.\nWriting todos takes time and tokens, use it when it is helpful for managing complex many-step problems! But not for simple few-step requests.\n\n## Important To-Do List Usage Notes to Remember\n- The `write_todos` tool should never be called multiple times in parallel.\n- Don't be afraid to revise the To-Do list as you go. New information may reveal new tasks that need to be done, or old tasks that are irrelevant.";
6
+ interface TodoListMiddlewareOptions {
7
+ /**
8
+ * Custom system prompt to guide the agent on using the todo tool.
9
+ * If not provided, uses the default {@link PLANNING_MIDDLEWARE_SYSTEM_PROMPT}.
10
+ */
11
+ systemPrompt?: string;
12
+ /**
13
+ * Custom description for the {@link writeTodos} tool.
14
+ * If not provided, uses the default {@link WRITE_TODOS_DESCRIPTION}.
15
+ */
16
+ toolDescription?: string;
17
+ }
18
+ /**
19
+ * Creates a middleware that provides todo list management capabilities to agents.
20
+ *
21
+ * This middleware adds a `write_todos` tool that allows agents to create and manage
22
+ * structured task lists for complex multi-step operations. It's designed to help
23
+ * agents track progress, organize complex tasks, and provide users with visibility
24
+ * into task completion status.
25
+ *
26
+ * The middleware automatically injects system prompts that guide the agent on when
27
+ * and how to use the todo functionality effectively.
28
+ *
29
+ * @example
30
+ * ```typescript
31
+ * import { todoListMiddleware, createAgent } from 'langchain';
32
+ *
33
+ * const agent = createAgent({
34
+ * model: "openai:gpt-4o",
35
+ * middleware: [todoListMiddleware()],
36
+ * });
37
+ *
38
+ * // Agent now has access to write_todos tool and todo state tracking
39
+ * const result = await agent.invoke({
40
+ * messages: [new HumanMessage("Help me refactor my codebase")]
41
+ * });
42
+ *
43
+ * console.log(result.todos); // Array of todo items with status tracking
44
+ * ```
45
+ *
46
+ * @returns A configured middleware instance that provides todo management capabilities
47
+ *
48
+ * @see {@link TodoMiddlewareState} for the state schema
49
+ * @see {@link writeTodos} for the tool implementation
50
+ */
51
+ declare function todoListMiddleware(options?: TodoListMiddlewareOptions): AgentMiddleware<z.ZodObject<{
52
+ todos: z.ZodDefault<z.ZodArray<z.ZodObject<{
53
+ content: z.ZodString;
54
+ status: z.ZodEnum<["pending", "in_progress", "completed"]>;
55
+ }, "strip", z.ZodTypeAny, {
56
+ content: string;
57
+ status: "completed" | "in_progress" | "pending";
58
+ }, {
59
+ content: string;
60
+ status: "completed" | "in_progress" | "pending";
61
+ }>, "many">>;
62
+ }, "strip", z.ZodTypeAny, {
63
+ todos: {
64
+ content: string;
65
+ status: "completed" | "in_progress" | "pending";
66
+ }[];
67
+ }, {
68
+ todos?: {
69
+ content: string;
70
+ status: "completed" | "in_progress" | "pending";
71
+ }[] | undefined;
72
+ }>, undefined, any>;
73
+ //#endregion
74
+ export { TODO_LIST_MIDDLEWARE_SYSTEM_PROMPT, TodoListMiddlewareOptions, todoListMiddleware };
75
+ //# sourceMappingURL=todoListMiddleware.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"todoListMiddleware.d.cts","names":["z","TODO_LIST_MIDDLEWARE_SYSTEM_PROMPT","stateSchema","ZodString","ZodEnum","ZodTypeAny","ZodObject","ZodArray","ZodDefault","TodoMiddlewareState","infer","TodoListMiddlewareOptions","todoListMiddleware","__types_js5","AgentMiddleware"],"sources":["../../../src/agents/middleware/todoListMiddleware.d.ts"],"sourcesContent":["import { z } from \"zod/v3\";\nexport declare const TODO_LIST_MIDDLEWARE_SYSTEM_PROMPT = \"## `write_todos`\\n\\nYou have access to the `write_todos` tool to help you manage and plan complex objectives. \\nUse this tool for complex objectives to ensure that you are tracking each necessary step and giving the user visibility into your progress.\\nThis tool is very helpful for planning complex objectives, and for breaking down these larger complex objectives into smaller steps.\\n\\nIt is critical that you mark todos as completed as soon as you are done with a step. Do not batch up multiple steps before marking them as completed.\\nFor simple objectives that only require a few steps, it is better to just complete the objective directly and NOT use this tool.\\nWriting todos takes time and tokens, use it when it is helpful for managing complex many-step problems! But not for simple few-step requests.\\n\\n## Important To-Do List Usage Notes to Remember\\n- The `write_todos` tool should never be called multiple times in parallel.\\n- Don't be afraid to revise the To-Do list as you go. New information may reveal new tasks that need to be done, or old tasks that are irrelevant.\";\ndeclare const stateSchema: z.ZodObject<{\n todos: z.ZodDefault<z.ZodArray<z.ZodObject<{\n content: z.ZodString;\n status: z.ZodEnum<[\"pending\", \"in_progress\", \"completed\"]>;\n }, \"strip\", z.ZodTypeAny, {\n content: string;\n status: \"completed\" | \"in_progress\" | \"pending\";\n }, {\n content: string;\n status: \"completed\" | \"in_progress\" | \"pending\";\n }>, \"many\">>;\n}, \"strip\", z.ZodTypeAny, {\n todos: {\n content: string;\n status: \"completed\" | \"in_progress\" | \"pending\";\n }[];\n}, {\n todos?: {\n content: string;\n status: \"completed\" | \"in_progress\" | \"pending\";\n }[] | undefined;\n}>;\nexport type TodoMiddlewareState = z.infer<typeof stateSchema>;\nexport interface TodoListMiddlewareOptions {\n /**\n * Custom system prompt to guide the agent on using the todo tool.\n * If not provided, uses the default {@link PLANNING_MIDDLEWARE_SYSTEM_PROMPT}.\n */\n systemPrompt?: string;\n /**\n * Custom description for the {@link writeTodos} tool.\n * If not provided, uses the default {@link WRITE_TODOS_DESCRIPTION}.\n */\n toolDescription?: string;\n}\n/**\n * Creates a middleware that provides todo list management capabilities to agents.\n *\n * This middleware adds a `write_todos` tool that allows agents to create and manage\n * structured task lists for complex multi-step operations. It's designed to help\n * agents track progress, organize complex tasks, and provide users with visibility\n * into task completion status.\n *\n * The middleware automatically injects system prompts that guide the agent on when\n * and how to use the todo functionality effectively.\n *\n * @example\n * ```typescript\n * import { todoListMiddleware, createAgent } from 'langchain';\n *\n * const agent = createAgent({\n * model: \"openai:gpt-4o\",\n * middleware: [todoListMiddleware()],\n * });\n *\n * // Agent now has access to write_todos tool and todo state tracking\n * const result = await agent.invoke({\n * messages: [new HumanMessage(\"Help me refactor my codebase\")]\n * });\n *\n * console.log(result.todos); // Array of todo items with status tracking\n * ```\n *\n * @returns A configured middleware instance that provides todo management capabilities\n *\n * @see {@link TodoMiddlewareState} for the state schema\n * @see {@link writeTodos} for the tool implementation\n */\nexport declare function todoListMiddleware(options?: TodoListMiddlewareOptions): import(\"./types.js\").AgentMiddleware<z.ZodObject<{\n todos: z.ZodDefault<z.ZodArray<z.ZodObject<{\n content: z.ZodString;\n status: z.ZodEnum<[\"pending\", \"in_progress\", \"completed\"]>;\n }, \"strip\", z.ZodTypeAny, {\n content: string;\n status: \"completed\" | \"in_progress\" | \"pending\";\n }, {\n content: string;\n status: \"completed\" | \"in_progress\" | \"pending\";\n }>, \"many\">>;\n}, \"strip\", z.ZodTypeAny, {\n todos: {\n content: string;\n status: \"completed\" | \"in_progress\" | \"pending\";\n }[];\n}, {\n todos?: {\n content: string;\n status: \"completed\" | \"in_progress\" | \"pending\";\n }[] | undefined;\n}>, undefined, any>;\nexport {};\n"],"mappings":";;;;cACqBC,kCAAAA;UAwBJU,yBAAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA6COC,kBAAAA,WAA6BD,4BAA4E,gBAAXX,CAAAA,CAAEM;SAC7GN,CAAAA,CAAEQ,WAAWR,CAAAA,CAAEO,SAASP,CAAAA,CAAEM;aACpBN,CAAAA,CAAEG;YACHH,CAAAA,CAAEI;cACFJ,CAAAA,CAAEK;;;;;;;YAONL,CAAAA,CAAEK"}
@@ -0,0 +1,75 @@
1
+ import { AgentMiddleware } from "./types.js";
2
+ import { z } from "zod/v3";
3
+
4
+ //#region src/agents/middleware/todoListMiddleware.d.ts
5
+ declare const TODO_LIST_MIDDLEWARE_SYSTEM_PROMPT = "## `write_todos`\n\nYou have access to the `write_todos` tool to help you manage and plan complex objectives. \nUse this tool for complex objectives to ensure that you are tracking each necessary step and giving the user visibility into your progress.\nThis tool is very helpful for planning complex objectives, and for breaking down these larger complex objectives into smaller steps.\n\nIt is critical that you mark todos as completed as soon as you are done with a step. Do not batch up multiple steps before marking them as completed.\nFor simple objectives that only require a few steps, it is better to just complete the objective directly and NOT use this tool.\nWriting todos takes time and tokens, use it when it is helpful for managing complex many-step problems! But not for simple few-step requests.\n\n## Important To-Do List Usage Notes to Remember\n- The `write_todos` tool should never be called multiple times in parallel.\n- Don't be afraid to revise the To-Do list as you go. New information may reveal new tasks that need to be done, or old tasks that are irrelevant.";
6
+ interface TodoListMiddlewareOptions {
7
+ /**
8
+ * Custom system prompt to guide the agent on using the todo tool.
9
+ * If not provided, uses the default {@link PLANNING_MIDDLEWARE_SYSTEM_PROMPT}.
10
+ */
11
+ systemPrompt?: string;
12
+ /**
13
+ * Custom description for the {@link writeTodos} tool.
14
+ * If not provided, uses the default {@link WRITE_TODOS_DESCRIPTION}.
15
+ */
16
+ toolDescription?: string;
17
+ }
18
+ /**
19
+ * Creates a middleware that provides todo list management capabilities to agents.
20
+ *
21
+ * This middleware adds a `write_todos` tool that allows agents to create and manage
22
+ * structured task lists for complex multi-step operations. It's designed to help
23
+ * agents track progress, organize complex tasks, and provide users with visibility
24
+ * into task completion status.
25
+ *
26
+ * The middleware automatically injects system prompts that guide the agent on when
27
+ * and how to use the todo functionality effectively.
28
+ *
29
+ * @example
30
+ * ```typescript
31
+ * import { todoListMiddleware, createAgent } from 'langchain';
32
+ *
33
+ * const agent = createAgent({
34
+ * model: "openai:gpt-4o",
35
+ * middleware: [todoListMiddleware()],
36
+ * });
37
+ *
38
+ * // Agent now has access to write_todos tool and todo state tracking
39
+ * const result = await agent.invoke({
40
+ * messages: [new HumanMessage("Help me refactor my codebase")]
41
+ * });
42
+ *
43
+ * console.log(result.todos); // Array of todo items with status tracking
44
+ * ```
45
+ *
46
+ * @returns A configured middleware instance that provides todo management capabilities
47
+ *
48
+ * @see {@link TodoMiddlewareState} for the state schema
49
+ * @see {@link writeTodos} for the tool implementation
50
+ */
51
+ declare function todoListMiddleware(options?: TodoListMiddlewareOptions): AgentMiddleware<z.ZodObject<{
52
+ todos: z.ZodDefault<z.ZodArray<z.ZodObject<{
53
+ content: z.ZodString;
54
+ status: z.ZodEnum<["pending", "in_progress", "completed"]>;
55
+ }, "strip", z.ZodTypeAny, {
56
+ content: string;
57
+ status: "completed" | "in_progress" | "pending";
58
+ }, {
59
+ content: string;
60
+ status: "completed" | "in_progress" | "pending";
61
+ }>, "many">>;
62
+ }, "strip", z.ZodTypeAny, {
63
+ todos: {
64
+ content: string;
65
+ status: "completed" | "in_progress" | "pending";
66
+ }[];
67
+ }, {
68
+ todos?: {
69
+ content: string;
70
+ status: "completed" | "in_progress" | "pending";
71
+ }[] | undefined;
72
+ }>, undefined, any>;
73
+ //#endregion
74
+ export { TODO_LIST_MIDDLEWARE_SYSTEM_PROMPT, TodoListMiddlewareOptions, todoListMiddleware };
75
+ //# sourceMappingURL=todoListMiddleware.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"todoListMiddleware.d.ts","names":["z","TODO_LIST_MIDDLEWARE_SYSTEM_PROMPT","stateSchema","ZodString","ZodEnum","ZodTypeAny","ZodObject","ZodArray","ZodDefault","TodoMiddlewareState","infer","TodoListMiddlewareOptions","todoListMiddleware","__types_js5","AgentMiddleware"],"sources":["../../../src/agents/middleware/todoListMiddleware.d.ts"],"sourcesContent":["import { z } from \"zod/v3\";\nexport declare const TODO_LIST_MIDDLEWARE_SYSTEM_PROMPT = \"## `write_todos`\\n\\nYou have access to the `write_todos` tool to help you manage and plan complex objectives. \\nUse this tool for complex objectives to ensure that you are tracking each necessary step and giving the user visibility into your progress.\\nThis tool is very helpful for planning complex objectives, and for breaking down these larger complex objectives into smaller steps.\\n\\nIt is critical that you mark todos as completed as soon as you are done with a step. Do not batch up multiple steps before marking them as completed.\\nFor simple objectives that only require a few steps, it is better to just complete the objective directly and NOT use this tool.\\nWriting todos takes time and tokens, use it when it is helpful for managing complex many-step problems! But not for simple few-step requests.\\n\\n## Important To-Do List Usage Notes to Remember\\n- The `write_todos` tool should never be called multiple times in parallel.\\n- Don't be afraid to revise the To-Do list as you go. New information may reveal new tasks that need to be done, or old tasks that are irrelevant.\";\ndeclare const stateSchema: z.ZodObject<{\n todos: z.ZodDefault<z.ZodArray<z.ZodObject<{\n content: z.ZodString;\n status: z.ZodEnum<[\"pending\", \"in_progress\", \"completed\"]>;\n }, \"strip\", z.ZodTypeAny, {\n content: string;\n status: \"completed\" | \"in_progress\" | \"pending\";\n }, {\n content: string;\n status: \"completed\" | \"in_progress\" | \"pending\";\n }>, \"many\">>;\n}, \"strip\", z.ZodTypeAny, {\n todos: {\n content: string;\n status: \"completed\" | \"in_progress\" | \"pending\";\n }[];\n}, {\n todos?: {\n content: string;\n status: \"completed\" | \"in_progress\" | \"pending\";\n }[] | undefined;\n}>;\nexport type TodoMiddlewareState = z.infer<typeof stateSchema>;\nexport interface TodoListMiddlewareOptions {\n /**\n * Custom system prompt to guide the agent on using the todo tool.\n * If not provided, uses the default {@link PLANNING_MIDDLEWARE_SYSTEM_PROMPT}.\n */\n systemPrompt?: string;\n /**\n * Custom description for the {@link writeTodos} tool.\n * If not provided, uses the default {@link WRITE_TODOS_DESCRIPTION}.\n */\n toolDescription?: string;\n}\n/**\n * Creates a middleware that provides todo list management capabilities to agents.\n *\n * This middleware adds a `write_todos` tool that allows agents to create and manage\n * structured task lists for complex multi-step operations. It's designed to help\n * agents track progress, organize complex tasks, and provide users with visibility\n * into task completion status.\n *\n * The middleware automatically injects system prompts that guide the agent on when\n * and how to use the todo functionality effectively.\n *\n * @example\n * ```typescript\n * import { todoListMiddleware, createAgent } from 'langchain';\n *\n * const agent = createAgent({\n * model: \"openai:gpt-4o\",\n * middleware: [todoListMiddleware()],\n * });\n *\n * // Agent now has access to write_todos tool and todo state tracking\n * const result = await agent.invoke({\n * messages: [new HumanMessage(\"Help me refactor my codebase\")]\n * });\n *\n * console.log(result.todos); // Array of todo items with status tracking\n * ```\n *\n * @returns A configured middleware instance that provides todo management capabilities\n *\n * @see {@link TodoMiddlewareState} for the state schema\n * @see {@link writeTodos} for the tool implementation\n */\nexport declare function todoListMiddleware(options?: TodoListMiddlewareOptions): import(\"./types.js\").AgentMiddleware<z.ZodObject<{\n todos: z.ZodDefault<z.ZodArray<z.ZodObject<{\n content: z.ZodString;\n status: z.ZodEnum<[\"pending\", \"in_progress\", \"completed\"]>;\n }, \"strip\", z.ZodTypeAny, {\n content: string;\n status: \"completed\" | \"in_progress\" | \"pending\";\n }, {\n content: string;\n status: \"completed\" | \"in_progress\" | \"pending\";\n }>, \"many\">>;\n}, \"strip\", z.ZodTypeAny, {\n todos: {\n content: string;\n status: \"completed\" | \"in_progress\" | \"pending\";\n }[];\n}, {\n todos?: {\n content: string;\n status: \"completed\" | \"in_progress\" | \"pending\";\n }[] | undefined;\n}>, undefined, any>;\nexport {};\n"],"mappings":";;;;cACqBC,kCAAAA;UAwBJU,yBAAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA6COC,kBAAAA,WAA6BD,4BAA4E,gBAAXX,CAAAA,CAAEM;SAC7GN,CAAAA,CAAEQ,WAAWR,CAAAA,CAAEO,SAASP,CAAAA,CAAEM;aACpBN,CAAAA,CAAEG;YACHH,CAAAA,CAAEI;cACFJ,CAAAA,CAAEK;;;;;;;YAONL,CAAAA,CAAEK"}