@librechat/agents 4.2.12 → 4.2.14

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 (357) hide show
  1. package/dist/cjs/graphs/Graph.cjs +56 -6
  2. package/dist/cjs/graphs/Graph.cjs.map +1 -1
  3. package/dist/cjs/harness/providerText.cjs +1 -0
  4. package/dist/cjs/harness/providerText.cjs.map +1 -1
  5. package/dist/cjs/llm/anthropic/index.cjs +4 -3
  6. package/dist/cjs/llm/anthropic/index.cjs.map +1 -1
  7. package/dist/cjs/llm/anthropic/utils/container.cjs +37 -0
  8. package/dist/cjs/llm/anthropic/utils/container.cjs.map +1 -0
  9. package/dist/cjs/llm/anthropic/utils/message_inputs.cjs +25 -23
  10. package/dist/cjs/llm/anthropic/utils/message_inputs.cjs.map +1 -1
  11. package/dist/cjs/llm/anthropic/utils/message_outputs.cjs +15 -21
  12. package/dist/cjs/llm/anthropic/utils/message_outputs.cjs.map +1 -1
  13. package/dist/cjs/llm/anthropic/utils/stream_events.cjs +16 -14
  14. package/dist/cjs/llm/anthropic/utils/stream_events.cjs.map +1 -1
  15. package/dist/cjs/llm/bedrock/index.cjs +1 -1
  16. package/dist/cjs/llm/bedrock/index.cjs.map +1 -1
  17. package/dist/cjs/llm/bedrock/toolCache.cjs +1 -1
  18. package/dist/cjs/llm/bedrock/utils/message_inputs.cjs +19 -13
  19. package/dist/cjs/llm/bedrock/utils/message_inputs.cjs.map +1 -1
  20. package/dist/cjs/llm/google/utils/common.cjs +59 -13
  21. package/dist/cjs/llm/google/utils/common.cjs.map +1 -1
  22. package/dist/cjs/llm/google/utils/signatures.cjs +22 -14
  23. package/dist/cjs/llm/google/utils/signatures.cjs.map +1 -1
  24. package/dist/cjs/llm/init.cjs +12 -2
  25. package/dist/cjs/llm/init.cjs.map +1 -1
  26. package/dist/cjs/llm/invoke.cjs +122 -13
  27. package/dist/cjs/llm/invoke.cjs.map +1 -1
  28. package/dist/cjs/llm/openai/index.cjs +9 -3
  29. package/dist/cjs/llm/openai/index.cjs.map +1 -1
  30. package/dist/cjs/llm/openai/typedContent.cjs +94 -0
  31. package/dist/cjs/llm/openai/typedContent.cjs.map +1 -0
  32. package/dist/cjs/llm/openrouter/toolCache.cjs +1 -1
  33. package/dist/cjs/llm/prepareProviderRequest.cjs +81 -4
  34. package/dist/cjs/llm/prepareProviderRequest.cjs.map +1 -1
  35. package/dist/cjs/llm/providerTextBatch.cjs +128 -0
  36. package/dist/cjs/llm/providerTextBatch.cjs.map +1 -0
  37. package/dist/cjs/llm/providerTextBoundary.cjs +81 -12
  38. package/dist/cjs/llm/providerTextBoundary.cjs.map +1 -1
  39. package/dist/cjs/main.cjs +8 -3
  40. package/dist/cjs/messages/alternation.cjs +1 -1
  41. package/dist/cjs/messages/anthropicServerTools.cjs +20 -0
  42. package/dist/cjs/messages/anthropicServerTools.cjs.map +1 -0
  43. package/dist/cjs/messages/budget.cjs +1 -1
  44. package/dist/cjs/messages/core.cjs +3 -2
  45. package/dist/cjs/messages/core.cjs.map +1 -1
  46. package/dist/cjs/messages/format.cjs +2 -2
  47. package/dist/cjs/messages/index.cjs +1 -1
  48. package/dist/cjs/messages/prune.cjs +1 -1
  49. package/dist/cjs/messages/recency.cjs +1 -1
  50. package/dist/cjs/messages/toolResultTypes.cjs +21 -45
  51. package/dist/cjs/messages/toolResultTypes.cjs.map +1 -1
  52. package/dist/cjs/protection/providerText.cjs +60 -6
  53. package/dist/cjs/protection/providerText.cjs.map +1 -1
  54. package/dist/cjs/protection/providerTextAdmission.cjs +5 -0
  55. package/dist/cjs/protection/providerTextAdmission.cjs.map +1 -1
  56. package/dist/cjs/protection/toolResult.cjs +119 -0
  57. package/dist/cjs/protection/toolResult.cjs.map +1 -0
  58. package/dist/cjs/run.cjs +14 -3
  59. package/dist/cjs/run.cjs.map +1 -1
  60. package/dist/cjs/runtime/client.cjs +4 -0
  61. package/dist/cjs/runtime/client.cjs.map +1 -1
  62. package/dist/cjs/stream.cjs +10 -2
  63. package/dist/cjs/stream.cjs.map +1 -1
  64. package/dist/cjs/summarization/node.cjs +1 -1
  65. package/dist/cjs/tools/ToolNode.cjs +46 -13
  66. package/dist/cjs/tools/ToolNode.cjs.map +1 -1
  67. package/dist/cjs/tools/handlers.cjs +47 -1
  68. package/dist/cjs/tools/handlers.cjs.map +1 -1
  69. package/dist/cjs/tools/search/citations.cjs +194 -0
  70. package/dist/cjs/tools/search/citations.cjs.map +1 -0
  71. package/dist/cjs/tools/search/content.cjs +163 -42
  72. package/dist/cjs/tools/search/content.cjs.map +1 -1
  73. package/dist/cjs/tools/search/firecrawl.cjs +4 -9
  74. package/dist/cjs/tools/search/firecrawl.cjs.map +1 -1
  75. package/dist/cjs/tools/search/google.cjs +68 -0
  76. package/dist/cjs/tools/search/google.cjs.map +1 -0
  77. package/dist/cjs/tools/search/openai.cjs +80 -0
  78. package/dist/cjs/tools/search/openai.cjs.map +1 -0
  79. package/dist/cjs/tools/subagent/SubagentExecutor.cjs +4 -0
  80. package/dist/cjs/tools/subagent/SubagentExecutor.cjs.map +1 -1
  81. package/dist/cjs/utils/tokens.cjs +12 -2
  82. package/dist/cjs/utils/tokens.cjs.map +1 -1
  83. package/dist/esm/graphs/Graph.mjs +57 -7
  84. package/dist/esm/graphs/Graph.mjs.map +1 -1
  85. package/dist/esm/harness/providerText.mjs +1 -0
  86. package/dist/esm/harness/providerText.mjs.map +1 -1
  87. package/dist/esm/llm/anthropic/index.mjs +4 -3
  88. package/dist/esm/llm/anthropic/index.mjs.map +1 -1
  89. package/dist/esm/llm/anthropic/utils/container.mjs +37 -0
  90. package/dist/esm/llm/anthropic/utils/container.mjs.map +1 -0
  91. package/dist/esm/llm/anthropic/utils/message_inputs.mjs +25 -23
  92. package/dist/esm/llm/anthropic/utils/message_inputs.mjs.map +1 -1
  93. package/dist/esm/llm/anthropic/utils/message_outputs.mjs +15 -21
  94. package/dist/esm/llm/anthropic/utils/message_outputs.mjs.map +1 -1
  95. package/dist/esm/llm/anthropic/utils/stream_events.mjs +16 -14
  96. package/dist/esm/llm/anthropic/utils/stream_events.mjs.map +1 -1
  97. package/dist/esm/llm/bedrock/index.mjs +2 -2
  98. package/dist/esm/llm/bedrock/index.mjs.map +1 -1
  99. package/dist/esm/llm/bedrock/toolCache.mjs +1 -1
  100. package/dist/esm/llm/bedrock/utils/message_inputs.mjs +19 -14
  101. package/dist/esm/llm/bedrock/utils/message_inputs.mjs.map +1 -1
  102. package/dist/esm/llm/google/utils/common.mjs +59 -13
  103. package/dist/esm/llm/google/utils/common.mjs.map +1 -1
  104. package/dist/esm/llm/google/utils/signatures.mjs +22 -14
  105. package/dist/esm/llm/google/utils/signatures.mjs.map +1 -1
  106. package/dist/esm/llm/init.mjs +12 -2
  107. package/dist/esm/llm/init.mjs.map +1 -1
  108. package/dist/esm/llm/invoke.mjs +124 -15
  109. package/dist/esm/llm/invoke.mjs.map +1 -1
  110. package/dist/esm/llm/openai/index.mjs +9 -3
  111. package/dist/esm/llm/openai/index.mjs.map +1 -1
  112. package/dist/esm/llm/openai/typedContent.mjs +93 -0
  113. package/dist/esm/llm/openai/typedContent.mjs.map +1 -0
  114. package/dist/esm/llm/openrouter/toolCache.mjs +1 -1
  115. package/dist/esm/llm/prepareProviderRequest.mjs +81 -4
  116. package/dist/esm/llm/prepareProviderRequest.mjs.map +1 -1
  117. package/dist/esm/llm/providerTextBatch.mjs +128 -0
  118. package/dist/esm/llm/providerTextBatch.mjs.map +1 -0
  119. package/dist/esm/llm/providerTextBoundary.mjs +81 -12
  120. package/dist/esm/llm/providerTextBoundary.mjs.map +1 -1
  121. package/dist/esm/main.mjs +7 -6
  122. package/dist/esm/messages/alternation.mjs +1 -1
  123. package/dist/esm/messages/anthropicServerTools.mjs +18 -0
  124. package/dist/esm/messages/anthropicServerTools.mjs.map +1 -0
  125. package/dist/esm/messages/budget.mjs +1 -1
  126. package/dist/esm/messages/core.mjs +3 -2
  127. package/dist/esm/messages/core.mjs.map +1 -1
  128. package/dist/esm/messages/format.mjs +2 -2
  129. package/dist/esm/messages/index.mjs +1 -1
  130. package/dist/esm/messages/prune.mjs +1 -1
  131. package/dist/esm/messages/recency.mjs +1 -1
  132. package/dist/esm/messages/toolResultTypes.mjs +21 -45
  133. package/dist/esm/messages/toolResultTypes.mjs.map +1 -1
  134. package/dist/esm/protection/providerText.mjs +58 -7
  135. package/dist/esm/protection/providerText.mjs.map +1 -1
  136. package/dist/esm/protection/providerTextAdmission.mjs +5 -0
  137. package/dist/esm/protection/providerTextAdmission.mjs.map +1 -1
  138. package/dist/esm/protection/toolResult.mjs +114 -0
  139. package/dist/esm/protection/toolResult.mjs.map +1 -0
  140. package/dist/esm/run.mjs +14 -3
  141. package/dist/esm/run.mjs.map +1 -1
  142. package/dist/esm/runtime/client.mjs +4 -0
  143. package/dist/esm/runtime/client.mjs.map +1 -1
  144. package/dist/esm/stream.mjs +10 -2
  145. package/dist/esm/stream.mjs.map +1 -1
  146. package/dist/esm/summarization/node.mjs +1 -1
  147. package/dist/esm/tools/ToolNode.mjs +46 -13
  148. package/dist/esm/tools/ToolNode.mjs.map +1 -1
  149. package/dist/esm/tools/handlers.mjs +47 -2
  150. package/dist/esm/tools/handlers.mjs.map +1 -1
  151. package/dist/esm/tools/search/citations.mjs +190 -0
  152. package/dist/esm/tools/search/citations.mjs.map +1 -0
  153. package/dist/esm/tools/search/content.mjs +163 -42
  154. package/dist/esm/tools/search/content.mjs.map +1 -1
  155. package/dist/esm/tools/search/firecrawl.mjs +4 -9
  156. package/dist/esm/tools/search/firecrawl.mjs.map +1 -1
  157. package/dist/esm/tools/search/google.mjs +67 -0
  158. package/dist/esm/tools/search/google.mjs.map +1 -0
  159. package/dist/esm/tools/search/openai.mjs +80 -0
  160. package/dist/esm/tools/search/openai.mjs.map +1 -0
  161. package/dist/esm/tools/subagent/SubagentExecutor.mjs +4 -0
  162. package/dist/esm/tools/subagent/SubagentExecutor.mjs.map +1 -1
  163. package/dist/esm/utils/tokens.mjs +12 -2
  164. package/dist/esm/utils/tokens.mjs.map +1 -1
  165. package/dist/types/common/index.d.ts +2 -2
  166. package/dist/types/decisions/breaker.d.ts +2 -2
  167. package/dist/types/decisions/core.d.ts +13 -13
  168. package/dist/types/decisions/dialect.d.ts +1 -1
  169. package/dist/types/decisions/http.d.ts +2 -2
  170. package/dist/types/decisions/index.d.ts +5 -5
  171. package/dist/types/decisions/node.d.ts +2 -2
  172. package/dist/types/decisions/presets.d.ts +2 -2
  173. package/dist/types/decisions/probe.d.ts +1 -1
  174. package/dist/types/decisions/questions.d.ts +1 -1
  175. package/dist/types/decisions/structuredChat.d.ts +2 -2
  176. package/dist/types/decisions/transport.d.ts +1 -1
  177. package/dist/types/eventActor/EventActorExecutor.d.ts +1 -1
  178. package/dist/types/eventActor/index.d.ts +2 -2
  179. package/dist/types/graphs/Graph.d.ts +18 -2
  180. package/dist/types/graphs/MultiAgentGraph.d.ts +1 -1
  181. package/dist/types/graphs/applyGraphRuntimeConfig.d.ts +1 -1
  182. package/dist/types/graphs/graphFactory.d.ts +1 -1
  183. package/dist/types/graphs/index.d.ts +5 -5
  184. package/dist/types/harness/fileBindings.d.ts +2 -2
  185. package/dist/types/harness/fileService.d.ts +2 -2
  186. package/dist/types/harness/fileStream.d.ts +1 -1
  187. package/dist/types/harness/index.d.ts +15 -15
  188. package/dist/types/harness/model.d.ts +1 -1
  189. package/dist/types/harness/modelService.d.ts +2 -2
  190. package/dist/types/harness/modelStreamCallbacks.d.ts +1 -1
  191. package/dist/types/harness/providerText.d.ts +1 -1
  192. package/dist/types/hitl/index.d.ts +3 -3
  193. package/dist/types/hooks/HookRegistry.d.ts +1 -1
  194. package/dist/types/hooks/createToolPolicyHook.d.ts +1 -1
  195. package/dist/types/hooks/createWorkspacePolicyHook.d.ts +1 -1
  196. package/dist/types/hooks/executeHooks.d.ts +2 -2
  197. package/dist/types/hooks/index.d.ts +11 -11
  198. package/dist/types/index.d.ts +62 -60
  199. package/dist/types/langchain/index.d.ts +8 -8
  200. package/dist/types/llm/anthropic/utils/container.d.ts +4 -0
  201. package/dist/types/llm/anthropic/utils/message_inputs.d.ts +1 -1
  202. package/dist/types/llm/anthropic/utils/message_outputs.d.ts +1 -1
  203. package/dist/types/llm/anthropic/utils/stream_events.d.ts +1 -1
  204. package/dist/types/llm/bedrock/index.d.ts +2 -3
  205. package/dist/types/llm/bedrock/utils/harmony.d.ts +1 -1
  206. package/dist/types/llm/bedrock/utils/index.d.ts +2 -2
  207. package/dist/types/llm/bedrock/utils/message_inputs.d.ts +3 -12
  208. package/dist/types/llm/bedrock/utils/message_outputs.d.ts +1 -1
  209. package/dist/types/llm/google/index.d.ts +2 -2
  210. package/dist/types/llm/google/utils/common.d.ts +1 -1
  211. package/dist/types/llm/google/utils/tools.d.ts +1 -1
  212. package/dist/types/llm/openai/index.d.ts +1 -1
  213. package/dist/types/llm/openai/typedContent.d.ts +14 -0
  214. package/dist/types/llm/providerRegistry.d.ts +1 -1
  215. package/dist/types/llm/providerTextBatch.d.ts +26 -0
  216. package/dist/types/llm/providerTextBoundary.d.ts +7 -1
  217. package/dist/types/llm/providers.d.ts +1 -1
  218. package/dist/types/messages/anthropicServerTools.d.ts +13 -0
  219. package/dist/types/messages/contextPruning.d.ts +1 -1
  220. package/dist/types/messages/core.d.ts +4 -4
  221. package/dist/types/messages/format.d.ts +1 -1
  222. package/dist/types/messages/index.d.ts +21 -21
  223. package/dist/types/messages/prune.d.ts +1 -1
  224. package/dist/types/openai/index.d.ts +2 -2
  225. package/dist/types/openai/toolProjection.d.ts +1 -1
  226. package/dist/types/prompts/index.d.ts +2 -2
  227. package/dist/types/protection/providerText.d.ts +32 -2
  228. package/dist/types/protection/providerTextAdmission.d.ts +1 -0
  229. package/dist/types/protection/toolResult.d.ts +69 -0
  230. package/dist/types/provider-registration.d.ts +1 -1
  231. package/dist/types/rerank/bm25.d.ts +1 -1
  232. package/dist/types/rerank/core.d.ts +17 -17
  233. package/dist/types/rerank/crossEncoder.d.ts +3 -3
  234. package/dist/types/rerank/fallback.d.ts +1 -1
  235. package/dist/types/rerank/index.d.ts +2 -2
  236. package/dist/types/rerank/outcome.d.ts +2 -2
  237. package/dist/types/rerank/pin.d.ts +2 -2
  238. package/dist/types/rerank/search.d.ts +1 -1
  239. package/dist/types/rerank/systemone.d.ts +4 -4
  240. package/dist/types/rerank/types.d.ts +1 -1
  241. package/dist/types/run.d.ts +1 -0
  242. package/dist/types/runtime/admission.d.ts +1 -1
  243. package/dist/types/runtime/checkpoint.d.ts +1 -1
  244. package/dist/types/runtime/client.d.ts +2 -2
  245. package/dist/types/runtime/files.d.ts +3 -3
  246. package/dist/types/runtime/hostTools.d.ts +2 -2
  247. package/dist/types/runtime/index.d.ts +12 -12
  248. package/dist/types/runtime/model.d.ts +5 -5
  249. package/dist/types/runtime/policy.d.ts +3 -3
  250. package/dist/types/runtime/recovery/client.d.ts +3 -3
  251. package/dist/types/runtime/recovery/log.d.ts +2 -2
  252. package/dist/types/runtime/recovery/redis.d.ts +1 -1
  253. package/dist/types/runtime/recovery/server.d.ts +3 -3
  254. package/dist/types/runtime/resume.d.ts +1 -1
  255. package/dist/types/runtime/server.d.ts +3 -3
  256. package/dist/types/runtime/snapshot.d.ts +1 -1
  257. package/dist/types/runtime/types.d.ts +2 -2
  258. package/dist/types/session/AgentSession.d.ts +2 -2
  259. package/dist/types/session/JsonlSessionStore.d.ts +1 -1
  260. package/dist/types/session/deriveMessages.d.ts +1 -1
  261. package/dist/types/session/handlers.d.ts +1 -1
  262. package/dist/types/session/index.d.ts +7 -7
  263. package/dist/types/session/messageSerialization.d.ts +1 -1
  264. package/dist/types/session/sessionProjection.d.ts +3 -3
  265. package/dist/types/summarization/index.d.ts +2 -2
  266. package/dist/types/tools/BashProgrammaticToolCalling.d.ts +1 -1
  267. package/dist/types/tools/GitHubCompare.d.ts +6 -6
  268. package/dist/types/tools/ProgrammaticToolCalling.d.ts +1 -1
  269. package/dist/types/tools/ReadFile.d.ts +6 -6
  270. package/dist/types/tools/SkillTool.d.ts +6 -6
  271. package/dist/types/tools/ToolNode.d.ts +5 -1
  272. package/dist/types/tools/cloudflare/index.d.ts +4 -4
  273. package/dist/types/tools/handlers.d.ts +13 -0
  274. package/dist/types/tools/local/FileCheckpointer.d.ts +1 -1
  275. package/dist/types/tools/local/LocalExecutionEngine.d.ts +1 -1
  276. package/dist/types/tools/local/attachments.d.ts +1 -1
  277. package/dist/types/tools/local/index.d.ts +12 -12
  278. package/dist/types/tools/search/anthropic.d.ts +1 -1
  279. package/dist/types/tools/search/citations.d.ts +88 -0
  280. package/dist/types/tools/search/content.d.ts +38 -1
  281. package/dist/types/tools/search/crw-scraper.d.ts +1 -1
  282. package/dist/types/tools/search/crw-search.d.ts +1 -1
  283. package/dist/types/tools/search/firecrawl.d.ts +4 -2
  284. package/dist/types/tools/search/format.d.ts +1 -1
  285. package/dist/types/tools/search/google.d.ts +11 -0
  286. package/dist/types/tools/search/highlights.d.ts +1 -1
  287. package/dist/types/tools/search/index.d.ts +3 -3
  288. package/dist/types/tools/search/keenable-scraper.d.ts +1 -1
  289. package/dist/types/tools/search/keenable-search.d.ts +1 -1
  290. package/dist/types/tools/search/metrics.d.ts +1 -1
  291. package/dist/types/tools/search/openai.d.ts +3 -0
  292. package/dist/types/tools/search/rerankers.d.ts +1 -1
  293. package/dist/types/tools/search/schema.d.ts +6 -6
  294. package/dist/types/tools/search/search.d.ts +1 -1
  295. package/dist/types/tools/search/serper-scraper.d.ts +1 -1
  296. package/dist/types/tools/search/tavily-scraper.d.ts +1 -1
  297. package/dist/types/tools/search/tavily-search.d.ts +1 -1
  298. package/dist/types/tools/search/tool.d.ts +3 -3
  299. package/dist/types/tools/search/types.d.ts +26 -2
  300. package/dist/types/tools/search/utils.d.ts +3 -3
  301. package/dist/types/tools/subagent/SubagentExecutionRegistry.d.ts +1 -1
  302. package/dist/types/tools/subagent/SubagentExecutor.d.ts +6 -3
  303. package/dist/types/tools/subagent/diagnostics.d.ts +1 -1
  304. package/dist/types/tools/subagent/index.d.ts +7 -7
  305. package/dist/types/types/attachments.d.ts +1 -1
  306. package/dist/types/types/graph.d.ts +4 -1
  307. package/dist/types/types/index.d.ts +14 -14
  308. package/dist/types/types/llm.d.ts +2 -2
  309. package/dist/types/types/run.d.ts +3 -1
  310. package/dist/types/types/stream.d.ts +12 -0
  311. package/dist/types/types/subagentTasks.d.ts +2 -2
  312. package/dist/types/types/tools.d.ts +6 -3
  313. package/dist/types/utils/index.d.ts +10 -10
  314. package/dist/types/utils/tokens.d.ts +2 -0
  315. package/package.json +3 -2
  316. package/src/graphs/Graph.ts +125 -3
  317. package/src/harness/providerText.ts +1 -0
  318. package/src/index.ts +10 -0
  319. package/src/llm/anthropic/index.ts +11 -3
  320. package/src/llm/anthropic/utils/container.ts +63 -0
  321. package/src/llm/anthropic/utils/message_inputs.ts +57 -51
  322. package/src/llm/anthropic/utils/message_outputs.ts +12 -39
  323. package/src/llm/anthropic/utils/stream_events.ts +17 -12
  324. package/src/llm/bedrock/index.ts +7 -5
  325. package/src/llm/bedrock/utils/message_inputs.ts +28 -35
  326. package/src/llm/google/utils/common.ts +88 -36
  327. package/src/llm/google/utils/signatures.ts +52 -36
  328. package/src/llm/init.ts +35 -3
  329. package/src/llm/invoke.ts +160 -16
  330. package/src/llm/openai/index.ts +18 -5
  331. package/src/llm/openai/typedContent.ts +110 -0
  332. package/src/llm/prepareProviderRequest.ts +154 -4
  333. package/src/llm/providerTextBatch.ts +158 -0
  334. package/src/llm/providerTextBoundary.ts +119 -13
  335. package/src/messages/anthropicServerTools.ts +24 -0
  336. package/src/messages/core.ts +12 -11
  337. package/src/messages/toolResultTypes.ts +80 -88
  338. package/src/protection/providerText.ts +222 -46
  339. package/src/protection/providerTextAdmission.ts +6 -0
  340. package/src/protection/toolResult.ts +272 -0
  341. package/src/run.ts +37 -5
  342. package/src/runtime/client.ts +6 -0
  343. package/src/stream.ts +23 -2
  344. package/src/tools/ToolNode.ts +112 -17
  345. package/src/tools/handlers.ts +110 -5
  346. package/src/tools/search/citations.ts +375 -0
  347. package/src/tools/search/content.ts +282 -62
  348. package/src/tools/search/firecrawl.ts +13 -16
  349. package/src/tools/search/google.ts +122 -0
  350. package/src/tools/search/openai.ts +118 -0
  351. package/src/tools/search/types.ts +21 -0
  352. package/src/tools/subagent/SubagentExecutor.ts +6 -0
  353. package/src/types/graph.ts +3 -0
  354. package/src/types/run.ts +3 -0
  355. package/src/types/stream.ts +9 -0
  356. package/src/types/tools.ts +3 -0
  357. package/src/utils/tokens.ts +37 -2
@@ -6,7 +6,8 @@ import type { ToolCall } from '@langchain/core/messages/tool';
6
6
  import type { SubagentGraphResumeState, SubagentToolNodeResumeState } from '../tools/subagent/SubagentReplay.js';
7
7
  import type { ResolvedStreamLimits, RunBreakerScope, StreamedToolCallArgTally, StreamDeltaEventTally } from '../llm/streamLimits.js';
8
8
  import type { GraphFactoryDependencies } from './graphFactory.js';
9
- import type { HandoffRouting } from './handoff';
9
+ import type { GoogleGroundingMetadata } from '../tools/search/types.js';
10
+ import type { HandoffRouting } from './handoff.js';
10
11
  import type { HookRegistry } from '../hooks/index.js';
11
12
  import type * as t from '../types/index.js';
12
13
  import { StreamLimitExceededError } from '../llm/streamLimits.js';
@@ -15,6 +16,7 @@ import { ProviderTextProtectionError } from '../protection/providerText.js';
15
16
  import { ToolOutputReferenceRegistry } from '../tools/toolOutputReferences.js';
16
17
  import { PreparedSubagents, PreparedSubagentError } from '../tools/preparedSubagents.js';
17
18
  import { ToolNode as CustomToolNode } from '../tools/ToolNode.js';
19
+ import { SearchCitations } from '../tools/search/citations.js';
18
20
  import { AgentContext } from '../agents/AgentContext.js';
19
21
  import { HandlerRegistry } from '../events.js';
20
22
  type RunStepStateChannel = BaseChannel<t.RunStepResumeState, t.RunStepResumeState | OverwriteValue<t.RunStepResumeState>>;
@@ -93,6 +95,8 @@ export declare abstract class Graph<T extends t.BaseGraphState = t.BaseGraphStat
93
95
  callerSignal?: AbortSignal;
94
96
  /** Set of invoked tool call IDs from non-message run steps completed mid-run, if any */
95
97
  invokedToolIds?: Set<string>;
98
+ /** Provider-native web search sources and the anchors still owed to their citations. */
99
+ searchCitations: SearchCitations;
96
100
  /** Explicit host policy. Never inferred from missing ToolNode claims. */
97
101
  clientDelegatedToolNames?: ReadonlySet<string>;
98
102
  handlerRegistry: HandlerRegistry | undefined;
@@ -317,6 +321,8 @@ export declare class StandardGraph extends Graph<t.BaseGraphState, t.GraphNode>
317
321
  streamLimits: ResolvedStreamLimits;
318
322
  /** Default-off mandatory provider prose release. */
319
323
  providerTextProtection?: t.StandardGraphInput['providerTextProtection'];
324
+ /** Default-off host inspection of selected tools' result text. */
325
+ toolResultProtection?: t.StandardGraphInput['toolResultProtection'];
320
326
  /** Host lookup for attachments carried by reference; read while a provider request is prepared. */
321
327
  resolveAttachment?: t.StandardGraphInput['resolveAttachment'];
322
328
  /**
@@ -447,7 +453,7 @@ export declare class StandardGraph extends Graph<t.BaseGraphState, t.GraphNode>
447
453
  * from a discard.
448
454
  */
449
455
  private preemptRestartPending;
450
- constructor({ runId, signal, agents, langfuse, tokenCounter, indexTokenCountMap, calibrationRatio, fadingTier, fadingTiers, subagentUsageSink, subagentTasks, subagentScope, subagentExecutionContext, subagentContext, onSubagentResolutionFailure, preemption, streamLimits, providerTextProtection, resolveAttachment, toolExecution, clientDelegatedToolNames, }: t.StandardGraphInput, dependencies?: GraphFactoryDependencies);
456
+ constructor({ runId, signal, agents, langfuse, tokenCounter, indexTokenCountMap, calibrationRatio, fadingTier, fadingTiers, subagentUsageSink, subagentTasks, subagentScope, subagentExecutionContext, subagentContext, onSubagentResolutionFailure, preemption, streamLimits, providerTextProtection, toolResultProtection, resolveAttachment, toolExecution, clientDelegatedToolNames, }: t.StandardGraphInput, dependencies?: GraphFactoryDependencies);
451
457
  /**
452
458
  * A compaction applies its remove-all inside the agent subgraph, so the
453
459
  * subgraph's result carries only the retained tail, and an outer reducer
@@ -606,6 +612,16 @@ export declare class StandardGraph extends Graph<t.BaseGraphState, t.GraphNode>
606
612
  * terminal-status guard in `closeRunStep` absorbs duplicate echoes.
607
613
  */
608
614
  recordStepCompletion(stepId: string, options?: t.RecordStepCompletionOptions): Promise<void>;
615
+ /** Gemini grounding and OpenAI url_citation arrive after the text they cite. */
616
+ private tracksSearchText;
617
+ /** Keeps a Gemini chunk's grounding for the lane's model call. */
618
+ groundSearchCitations(metadata: Record<string, unknown> | undefined, grounding: GoogleGroundingMetadata): void;
619
+ /**
620
+ * Turns the web search citations a finished agent model call carried into
621
+ * a `web_search` result and anchors in its text. Model calls outside an
622
+ * agent node (summaries, tool internals) never own the lane's text.
623
+ */
624
+ settleSearchCitations(metadata?: Record<string, unknown>): Promise<void>;
609
625
  /**
610
626
  * Closes the tracked open MESSAGE_CREATION step for the event's agent lane.
611
627
  * Fires on every model end, so the empty-map check short-circuits ahead of
@@ -1,6 +1,6 @@
1
1
  import type { GraphFactoryDependencies } from './graphFactory.js';
2
2
  import type * as t from '../types/index.js';
3
- import { StandardGraph } from './Graph';
3
+ import { StandardGraph } from './Graph.js';
4
4
  /**
5
5
  * MultiAgentGraph extends StandardGraph to support dynamic multi-agent workflows
6
6
  * with handoffs, fan-in/fan-out, and other composable patterns.
@@ -1,3 +1,3 @@
1
- import type { StandardGraph } from './Graph';
1
+ import type { StandardGraph } from './Graph.js';
2
2
  export type GraphRuntimeConfig = Pick<StandardGraph, 'hookRegistry' | 'humanInTheLoop' | 'toolOutputReferences' | 'eagerEventToolExecution' | 'codeSessionToolNames' | 'interruptingToolNames' | 'toolExecution'>;
3
3
  export declare function applyGraphRuntimeConfig(graph: StandardGraph, config: GraphRuntimeConfig): void;
@@ -1,4 +1,4 @@
1
- import type { StandardGraph } from './Graph';
1
+ import type { StandardGraph } from './Graph.js';
2
2
  import type * as t from '../types/index.js';
3
3
  export type GraphFactoryRequest = {
4
4
  kind: 'standard';
@@ -1,5 +1,5 @@
1
- export * from './Graph';
2
- export * from './MultiAgentGraph';
3
- export * from './createGraph';
4
- export type * from './graphFactory';
5
- export { HandoffLimitError } from './handoff';
1
+ export * from './Graph.js';
2
+ export * from './MultiAgentGraph.js';
3
+ export * from './createGraph.js';
4
+ export type * from './graphFactory.js';
5
+ export { HandoffLimitError } from './handoff.js';
@@ -1,5 +1,5 @@
1
- import type { HostFileDescriptor, HostFileStageRequest, HostFilePublication, HostFileServiceDescriptor, HostFileService } from './files';
2
- import type { ExecutionIdentity } from './identity';
1
+ import type { HostFileDescriptor, HostFileStageRequest, HostFilePublication, HostFileServiceDescriptor, HostFileService } from './files.js';
2
+ import type { ExecutionIdentity } from './identity.js';
3
3
  export interface HostFileBindings {
4
4
  read(file: HostFileDescriptor, signal?: AbortSignal): AsyncIterable<Uint8Array>;
5
5
  stage(artifact: Omit<HostFileStageRequest, 'version' | 'identity'>, content: AsyncIterable<Uint8Array>, signal?: AbortSignal): Promise<HostFileDescriptor>;
@@ -1,5 +1,5 @@
1
- import type { HostFileService, HostFileServiceDescriptor } from './files';
2
- import type { ExecutionIdentity } from './identity';
1
+ import type { HostFileService, HostFileServiceDescriptor } from './files.js';
2
+ import type { ExecutionIdentity } from './identity.js';
3
3
  /** Share across bindings in the host's quota scope. Hung storage retains its slot and byte reservation. */
4
4
  export declare class HostFileAdmission {
5
5
  private operations;
@@ -1,4 +1,4 @@
1
- import type { HostFileStageRequest } from './files';
1
+ import type { HostFileStageRequest } from './files.js';
2
2
  /** Single-consumer, bounded upload. Cleanup is owned by the operation, not the transport. */
3
3
  export declare function createFileUpload(source: AsyncIterable<Uint8Array>, request: Pick<HostFileStageRequest, 'bytes' | 'sha256'>, maxChunkBytes: number, signal?: AbortSignal, hash?: boolean): {
4
4
  content: AsyncIterable<Uint8Array>;
@@ -1,7 +1,7 @@
1
1
  import type { EventHandler, LCTool, ToolCallRequest, ToolExecuteBatchRequest, ToolExecuteResult } from '../types/index.js';
2
- import type { ExecutionIdentity } from './identity';
3
- export { snapshotExecutionIdentity } from './identity';
4
- export type { ExecutionIdentity } from './identity';
2
+ import type { ExecutionIdentity } from './identity.js';
3
+ export { snapshotExecutionIdentity } from './identity.js';
4
+ export type { ExecutionIdentity } from './identity.js';
5
5
  /** A host reference selects an authorized implementation, not a URL or executable name. */
6
6
  export interface HostToolDescriptor {
7
7
  definition: LCTool;
@@ -48,16 +48,16 @@ export declare function createHostToolBindings(options: {
48
48
  tools: readonly HostToolDescriptor[];
49
49
  service: HostToolService;
50
50
  }): HostToolBindings;
51
- export { createHostProviderTextService, createHostProviderTextProtection, } from './providerText';
52
- export type { HostProviderTextDescriptor, HostProviderTextRequest, HostProviderTextService, } from './providerText';
53
- export { HostChatModel, HostModelServiceError } from './model';
51
+ export { createHostProviderTextService, createHostProviderTextProtection, } from './providerText.js';
52
+ export type { HostProviderTextDescriptor, HostProviderTextRequest, HostProviderTextService, } from './providerText.js';
53
+ export { HostChatModel, HostModelServiceError } from './model.js';
54
54
  export type { ModelInvocationContext } from '../llm/invocation.js';
55
- export type { HostModelDescriptor, HostModelRequest, HostModelService, HostModelToolChoice, HostModelErrorCode, } from './model';
56
- export { createHostModelService, HostModelAdmission } from './modelService';
57
- export type { HostModelLimits } from './modelService';
58
- export { createHostFileService, HostFileAdmission } from './fileService';
59
- export type { HostFileStore } from './fileService';
60
- export { createHostFileBindings } from './fileBindings';
61
- export type { HostFileBindings } from './fileBindings';
62
- export { HostFileServiceError, hostFileDescriptorSchema, hostFileServiceDescriptorSchema, hostFileReadRequestSchema, hostFileStageRequestSchema, hostFilePublishRequestSchema, } from './files';
63
- export type { HostFileDescriptor, HostFileServiceDescriptor, HostFileService, HostFileReadRequest, HostFileStageRequest, HostFilePublishRequest, HostFileChunk, HostFilePublication, HostFileErrorCode, } from './files';
55
+ export type { HostModelDescriptor, HostModelRequest, HostModelService, HostModelToolChoice, HostModelErrorCode, } from './model.js';
56
+ export { createHostModelService, HostModelAdmission } from './modelService.js';
57
+ export type { HostModelLimits } from './modelService.js';
58
+ export { createHostFileService, HostFileAdmission } from './fileService.js';
59
+ export type { HostFileStore } from './fileService.js';
60
+ export { createHostFileBindings } from './fileBindings.js';
61
+ export type { HostFileBindings } from './fileBindings.js';
62
+ export { HostFileServiceError, hostFileDescriptorSchema, hostFileServiceDescriptorSchema, hostFileReadRequestSchema, hostFileStageRequestSchema, hostFilePublishRequestSchema, } from './files.js';
63
+ export type { HostFileDescriptor, HostFileServiceDescriptor, HostFileService, HostFileReadRequest, HostFileStageRequest, HostFilePublishRequest, HostFileChunk, HostFilePublication, HostFileErrorCode, } from './files.js';
@@ -9,7 +9,7 @@ import type { CallbackManagerForLLMRun } from '@langchain/core/callbacks/manager
9
9
  import type { Runnable } from '@langchain/core/runnables';
10
10
  import type { ChatResult } from '@langchain/core/outputs';
11
11
  import type { ModelInvocationContext } from '../llm/invocation.js';
12
- import type { ExecutionIdentity } from './identity';
12
+ import type { ExecutionIdentity } from './identity.js';
13
13
  import { PreparedSubagentError } from '../tools/preparedSubagents.js';
14
14
  import { StreamLimitExceededError } from '../llm/streamLimits.js';
15
15
  type FunctionTool = ReturnType<typeof convertToOpenAITool>;
@@ -1,7 +1,7 @@
1
1
  import type { BaseChatModel } from '@langchain/core/language_models/chat_models';
2
2
  import type { RunnableConfig } from '@langchain/core/runnables';
3
- import type { HostModelDescriptor, HostModelService } from './model';
4
- import type { ExecutionIdentity } from './identity';
3
+ import type { HostModelDescriptor, HostModelService } from './model.js';
4
+ import type { ExecutionIdentity } from './identity.js';
5
5
  interface ModelLease {
6
6
  charge(bytes: number): void;
7
7
  retain(): void;
@@ -1,7 +1,7 @@
1
1
  import { AIMessageChunk } from '@langchain/core/messages';
2
2
  import type { UsageMetadata } from '@langchain/core/messages';
3
3
  import type { RunnableConfig } from '@langchain/core/runnables';
4
- import type { HostModelErrorCode } from './model';
4
+ import type { HostModelErrorCode } from './model.js';
5
5
  /** Observes native completion; only synthesizes an end when iterator return bypasses it. */
6
6
  export declare function modelStreamCallbacks(model: object, config: RunnableConfig): {
7
7
  config: RunnableConfig;
@@ -1,6 +1,6 @@
1
1
  import type { ProviderTextAdmission } from '../protection/providerTextAdmission.js';
2
2
  import type { ProviderTextProtection } from '../protection/providerText.js';
3
- import type { ExecutionIdentity } from './identity';
3
+ import type { ExecutionIdentity } from './identity.js';
4
4
  /** Host-owned limits, negotiated before executing a graph. Contains no credentials or callbacks. */
5
5
  export type HostProviderTextDescriptor = Pick<ProviderTextProtection, 'version' | 'timeoutMs' | 'maxAttemptBytes' | 'maxBufferedBytes'>;
6
6
  export interface HostProviderTextRequest {
@@ -3,6 +3,6 @@
3
3
  * and re-export from the top-level types barrel; runtime helpers (like
4
4
  * `askUserQuestion()`) live here.
5
5
  */
6
- export { askUserQuestion } from './askUserQuestion';
7
- export { askUserQuestions } from './askUserQuestions';
8
- export { ASK_USER_QUESTION_ID_PATTERN, isAskUserQuestionsInterrupt, MAX_ASK_USER_QUESTIONS, } from './askUserQuestionsInterrupt';
6
+ export { askUserQuestion } from './askUserQuestion.js';
7
+ export { askUserQuestions } from './askUserQuestions.js';
8
+ export { ASK_USER_QUESTION_ID_PATTERN, isAskUserQuestionsInterrupt, MAX_ASK_USER_QUESTIONS, } from './askUserQuestionsInterrupt.js';
@@ -1,4 +1,4 @@
1
- import type { HookEvent, HookMatcher, ToolApprovalReplayKey, ToolApprovalReplaySnapshot, AggregatedHookResult } from './types';
1
+ import type { HookEvent, HookMatcher, ToolApprovalReplayKey, ToolApprovalReplaySnapshot, AggregatedHookResult } from './types.js';
2
2
  /**
3
3
  * Snapshot of a halt request raised by a hook returning
4
4
  * `preventContinuation: true`. The SDK's run loop polls for this between
@@ -9,7 +9,7 @@
9
9
  * the cross-walk and `docs/hooks-design-report.md` for the broader hook
10
10
  * system context.
11
11
  */
12
- import type { HookCallback } from './types';
12
+ import type { HookCallback } from './types.js';
13
13
  /**
14
14
  * Permission mode controlling how tool calls that match no rule are
15
15
  * resolved. Mirrors Claude Code's `permissionMode`.
@@ -46,7 +46,7 @@
46
46
  * },
47
47
  * // …with the hook installed and humanInTheLoop.enabled = true.
48
48
  */
49
- import type { HookCallback } from './types';
49
+ import type { HookCallback } from './types.js';
50
50
  /**
51
51
  * What to do when a tool call references a path outside the workspace.
52
52
  *
@@ -1,6 +1,6 @@
1
1
  import type { Logger } from 'winston';
2
- import type { HookInput, ToolApprovalReplayKey, AggregatedHookResult } from './types';
3
- import type { HookRegistry } from './HookRegistry';
2
+ import type { HookInput, ToolApprovalReplayKey, AggregatedHookResult } from './types.js';
3
+ import type { HookRegistry } from './HookRegistry.js';
4
4
  /** Default per-hook timeout when a matcher doesn't set its own. */
5
5
  export declare const DEFAULT_HOOK_TIMEOUT_MS = 30000;
6
6
  /**
@@ -1,6 +1,6 @@
1
- export { HookRegistry } from './HookRegistry';
2
- export type { HookHaltSignal } from './HookRegistry';
3
- export { executeHooks, mergeAggregatedHookResults, DEFAULT_HOOK_TIMEOUT_MS, } from './executeHooks';
1
+ export { HookRegistry } from './HookRegistry.js';
2
+ export type { HookHaltSignal } from './HookRegistry.js';
3
+ export { executeHooks, mergeAggregatedHookResults, DEFAULT_HOOK_TIMEOUT_MS, } from './executeHooks.js';
4
4
  /**
5
5
  * Feature probe for hosts: hook outputs support `injectedMessages`
6
6
  * (per-message graph-state injection at the `PostToolBatch` boundary).
@@ -39,13 +39,13 @@ export declare const HOOK_STOP_CONTINUATION_CAPABLE = true;
39
39
  * exactly the window users reach for it most.
40
40
  */
41
41
  export declare const HOOK_PREEMPT_RESTART_CAPABLE = true;
42
- export { matchesQuery, hasNestedQuantifier, MAX_PATTERN_LENGTH, MAX_CACHE_SIZE, } from './matchers';
43
- export { createToolPolicyHook } from './createToolPolicyHook';
44
- export type { ToolPolicyMode, ToolPolicyConfig } from './createToolPolicyHook';
45
- export { createWorkspacePolicyHook } from './createWorkspacePolicyHook';
46
- export type { OutsideAccessPolicy, WorkspacePolicyConfig, PathExtractor, } from './createWorkspacePolicyHook';
47
- export { HOOK_EVENTS, TOOL_APPROVAL_EXECUTION_SCOPE_CONFIG_KEY } from './types';
48
- export type { HookEvent, HookInput, HookOutput, HookCallback, HookMatcher, HooksByEvent, HookInputByEvent, HookOutputByEvent, BaseHookInput, BaseHookOutput, ToolDecision, StopDecision, ToolApprovalReplayKey, ToolApprovalReplaySnapshot, AggregatedHookResult, RunStartHookInput, UserPromptSubmitHookInput, PreToolUseHookInput, PostToolUseHookInput, PostToolUseFailureHookInput, PostToolBatchHookInput, PostToolBatchEntry, PreemptBoundaryHookInput, PermissionDeniedHookInput, SubagentStartHookInput, SubagentStopHookInput, StopHookInput, StopFinalizeHookInput, StopFailureHookInput, PreCompactHookInput, PostCompactHookInput, RunStartHookOutput, UserPromptSubmitHookOutput, PreToolUseHookOutput, PostToolUseHookOutput, PostToolUseFailureHookOutput, PostToolBatchHookOutput, PreemptBoundaryHookOutput, PermissionDeniedHookOutput, SubagentStartHookOutput, SubagentStopHookOutput, StopHookOutput, StopFinalizeHookOutput, StopFailureHookOutput, PreCompactHookOutput, PostCompactHookOutput, } from './types';
49
- export type { ExecuteHooksOptions } from './executeHooks';
42
+ export { matchesQuery, hasNestedQuantifier, MAX_PATTERN_LENGTH, MAX_CACHE_SIZE, } from './matchers.js';
43
+ export { createToolPolicyHook } from './createToolPolicyHook.js';
44
+ export type { ToolPolicyMode, ToolPolicyConfig } from './createToolPolicyHook.js';
45
+ export { createWorkspacePolicyHook } from './createWorkspacePolicyHook.js';
46
+ export type { OutsideAccessPolicy, WorkspacePolicyConfig, PathExtractor, } from './createWorkspacePolicyHook.js';
47
+ export { HOOK_EVENTS, TOOL_APPROVAL_EXECUTION_SCOPE_CONFIG_KEY } from './types.js';
48
+ export type { HookEvent, HookInput, HookOutput, HookCallback, HookMatcher, HooksByEvent, HookInputByEvent, HookOutputByEvent, BaseHookInput, BaseHookOutput, ToolDecision, StopDecision, ToolApprovalReplayKey, ToolApprovalReplaySnapshot, AggregatedHookResult, RunStartHookInput, UserPromptSubmitHookInput, PreToolUseHookInput, PostToolUseHookInput, PostToolUseFailureHookInput, PostToolBatchHookInput, PostToolBatchEntry, PreemptBoundaryHookInput, PermissionDeniedHookInput, SubagentStartHookInput, SubagentStopHookInput, StopHookInput, StopFinalizeHookInput, StopFailureHookInput, PreCompactHookInput, PostCompactHookInput, RunStartHookOutput, UserPromptSubmitHookOutput, PreToolUseHookOutput, PostToolUseHookOutput, PostToolUseFailureHookOutput, PostToolBatchHookOutput, PreemptBoundaryHookOutput, PermissionDeniedHookOutput, SubagentStartHookOutput, SubagentStopHookOutput, StopHookOutput, StopFinalizeHookOutput, StopFailureHookOutput, PreCompactHookOutput, PostCompactHookOutput, } from './types.js';
49
+ export type { ExecuteHooksOptions } from './executeHooks.js';
50
50
  /** Hosts may opt into stable generation scopes across every ToolNode interrupt type. */
51
51
  export declare const TOOL_APPROVAL_EXECUTION_SCOPE_CAPABLE = true;
@@ -1,38 +1,38 @@
1
- export * from './run';
2
- export * from './stream';
3
- export * from './events';
4
- export * from './messages';
5
- export { LANGFUSE_OBSERVATION_METADATA_ARTIFACT_KEY } from './langfuseToolOutputTracing';
6
- export * from './graphs';
7
- export * from './agents/projection';
8
- export * from './summarization';
9
- export * from './tools/Calculator';
10
- export * from './tools/GitHubCompare';
11
- export * from './tools/CodeExecutor';
12
- export * from './tools/BashExecutor';
13
- export * from './tools/ProgrammaticToolCalling';
14
- export * from './tools/BashProgrammaticToolCalling';
15
- export * from './tools/SkillTool';
16
- export * from './tools/SubagentTool';
17
- export * from './tools/subagent';
18
- export * from './tools/ReadFile';
19
- export * from './tools/skillCatalog';
20
- export * from './tools/ToolSearch';
21
- export * from './tools/ToolNode';
22
- export * from './tools/intentArg';
23
- export * from './tools/schema';
24
- export * from './tools/handlers';
25
- export * from './tools/local';
26
- export * from './tools/cloudflare';
27
- export * from './tools/search';
28
- export * from './common';
29
- export * from './utils';
30
- export * from './hooks';
31
- export * from './session';
32
- export * from './eventActor';
33
- export * from './hitl';
34
- export type * from './types';
35
- export * from './langchain';
1
+ export * from './run.js';
2
+ export * from './stream.js';
3
+ export * from './events.js';
4
+ export * from './messages/index.js';
5
+ export { LANGFUSE_OBSERVATION_METADATA_ARTIFACT_KEY } from './langfuseToolOutputTracing.js';
6
+ export * from './graphs/index.js';
7
+ export * from './agents/projection.js';
8
+ export * from './summarization/index.js';
9
+ export * from './tools/Calculator.js';
10
+ export * from './tools/GitHubCompare.js';
11
+ export * from './tools/CodeExecutor.js';
12
+ export * from './tools/BashExecutor.js';
13
+ export * from './tools/ProgrammaticToolCalling.js';
14
+ export * from './tools/BashProgrammaticToolCalling.js';
15
+ export * from './tools/SkillTool.js';
16
+ export * from './tools/SubagentTool.js';
17
+ export * from './tools/subagent/index.js';
18
+ export * from './tools/ReadFile.js';
19
+ export * from './tools/skillCatalog.js';
20
+ export * from './tools/ToolSearch.js';
21
+ export * from './tools/ToolNode.js';
22
+ export * from './tools/intentArg.js';
23
+ export * from './tools/schema.js';
24
+ export * from './tools/handlers.js';
25
+ export * from './tools/local/index.js';
26
+ export * from './tools/cloudflare/index.js';
27
+ export * from './tools/search/index.js';
28
+ export * from './common/index.js';
29
+ export * from './utils/index.js';
30
+ export * from './hooks/index.js';
31
+ export * from './session/index.js';
32
+ export * from './eventActor/index.js';
33
+ export * from './hitl/index.js';
34
+ export type * from './types/index.js';
35
+ export * from './langchain/index.js';
36
36
  /**
37
37
  * HITL primitives re-exported from `@langchain/langgraph` so hosts that
38
38
  * build durable checkpoint savers, dispatch `Command({ resume })`, or
@@ -41,31 +41,33 @@ export * from './langchain';
41
41
  */
42
42
  export { Command, INTERRUPT, interrupt, MemorySaver, BaseCheckpointSaver, isInterrupted, } from '@langchain/langgraph';
43
43
  export type { Interrupt } from '@langchain/langgraph';
44
- export { markTokenCounterCacheCompatible } from './llm/tokenCounterCacheCompatibility';
44
+ export { markTokenCounterCacheCompatible } from './llm/tokenCounterCacheCompatibility.js';
45
45
  /** Provider chat-model classes moved off the root barrel: importing any of them here
46
46
  * forced every host to pay that provider SDK's module init at boot. They remain
47
47
  * available from their own entries, e.g. `@librechat/agents/llm/openai`. */
48
- export type { OpenRouterReasoning, OpenRouterReasoningEffort, ChatOpenRouterCallOptions, } from './llm/openrouter';
49
- export { getChatModelClass } from './llm/providers';
50
- export { registerProvider } from './provider-registration';
51
- export type { ProviderFamily, ProviderRegistrationOptions, } from './provider-registration';
52
- export { smoothStream, resolveStreamDelay, DEFAULT_STREAM_DELAY, computeAdaptivePieceSize, } from './llm/stream/smoother';
53
- export type { SmoothItem, SmoothPiece } from './llm/stream/smoother';
54
- export { FakeChatModel, createFakeStreamingLLM } from './llm/fake';
55
- export { initializeModel } from './llm/init';
56
- export { attemptInvoke, tryFallbackProviders } from './llm/invoke';
57
- export { prepareProviderRequest } from './llm/prepareProviderRequest';
58
- export type { PreparedProviderRequest, PrepareProviderRequestParams, ProviderMessageProjectionMode, ProviderPayloadMeasurement, ProviderRequestContext, } from './llm/prepareProviderRequest';
59
- export { canSealPreempt } from './llm/preempt';
60
- export { isThinkingEnabled, getMaxOutputTokensKey } from './llm/request';
61
- export { DEFAULT_MAX_TOOL_CALL_ARG_BYTES, StreamLimitExceededError, resolveStreamLimits, } from './llm/streamLimits';
62
- export type { StreamedToolCallArgTally, ResolvedStreamLimits, StreamLimitState, StreamLimitKind, } from './llm/streamLimits';
63
- export * from './decisions';
64
- export * from './rerank';
65
- export { PROVIDER_TEXT_PROTECTION_VERSION, ProviderTextProtectionError, serializeProviderTextProtectionError, deserializeProviderTextProtectionError, } from './protection/providerText';
66
- export type { ProviderTextProtection, ProviderTextProtectionResult, ProviderTextProtectionErrorCode, ProviderTextProtectionFailure, } from './protection/providerText';
67
- export { GEMINI_PARTS, GEMINI_REPLAY_UNSUPPORTED, captureGeminiReplayParts, restoreGeminiReplayParts, isGeminiReplayParts, } from './llm/google/utils/signatures';
68
- export type { GeminiReplayPart } from './llm/google/utils/signatures';
69
- export * from './harness';
70
- export { ProviderTextAdmission } from './protection/providerTextAdmission';
71
- export type { ProviderTextAdmissionLimits, ProviderTextAdmissionSnapshot, } from './protection/providerTextAdmission';
48
+ export type { OpenRouterReasoning, OpenRouterReasoningEffort, ChatOpenRouterCallOptions, } from './llm/openrouter/index.js';
49
+ export { getChatModelClass } from './llm/providers.js';
50
+ export { registerProvider } from './provider-registration.js';
51
+ export type { ProviderFamily, ProviderRegistrationOptions, } from './provider-registration.js';
52
+ export { smoothStream, resolveStreamDelay, DEFAULT_STREAM_DELAY, computeAdaptivePieceSize, } from './llm/stream/smoother.js';
53
+ export type { SmoothItem, SmoothPiece } from './llm/stream/smoother.js';
54
+ export { FakeChatModel, createFakeStreamingLLM } from './llm/fake.js';
55
+ export { initializeModel } from './llm/init.js';
56
+ export { attemptInvoke, tryFallbackProviders } from './llm/invoke.js';
57
+ export { prepareProviderRequest } from './llm/prepareProviderRequest.js';
58
+ export type { PreparedProviderRequest, PrepareProviderRequestParams, ProviderMessageProjectionMode, ProviderPayloadMeasurement, ProviderRequestContext, } from './llm/prepareProviderRequest.js';
59
+ export { canSealPreempt } from './llm/preempt.js';
60
+ export { isThinkingEnabled, getMaxOutputTokensKey } from './llm/request.js';
61
+ export { DEFAULT_MAX_TOOL_CALL_ARG_BYTES, StreamLimitExceededError, resolveStreamLimits, } from './llm/streamLimits.js';
62
+ export type { StreamedToolCallArgTally, ResolvedStreamLimits, StreamLimitState, StreamLimitKind, } from './llm/streamLimits.js';
63
+ export * from './decisions/index.js';
64
+ export * from './rerank/index.js';
65
+ export { PROVIDER_TEXT_PROTECTION_VERSION, PROVIDER_TEXT_BATCHING_VERSION, ProviderTextProtectionError, serializeProviderTextProtectionError, deserializeProviderTextProtectionError, } from './protection/providerText.js';
66
+ export type { ProviderTextBatching, ProviderTextProtection, ProviderTextProtectionResult, ProviderTextProtectionErrorCode, ProviderTextProtectionFailure, } from './protection/providerText.js';
67
+ export { TOOL_RESULT_PROTECTION_VERSION, ToolResultProtectionError, } from './protection/toolResult.js';
68
+ export type { ToolResultProtection, ToolResultProtectionResult, } from './protection/toolResult.js';
69
+ export { GEMINI_PARTS, GEMINI_REPLAY_UNSUPPORTED, captureGeminiReplayParts, restoreGeminiReplayParts, isGeminiReplayParts, } from './llm/google/utils/signatures.js';
70
+ export type { GeminiReplayPart } from './llm/google/utils/signatures.js';
71
+ export * from './harness/index.js';
72
+ export { ProviderTextAdmission } from './protection/providerTextAdmission.js';
73
+ export type { ProviderTextAdmissionLimits, ProviderTextAdmissionSnapshot, } from './protection/providerTextAdmission.js';
@@ -1,8 +1,8 @@
1
- export * from './messages';
2
- export * from './prompts';
3
- export * from './runnables';
4
- export * from './tools';
5
- export * from './google-common';
6
- export * from './language_models/chat_models';
7
- export * from './messages/tool';
8
- export * from './openai';
1
+ export * from './messages.js';
2
+ export * from './prompts.js';
3
+ export * from './runnables.js';
4
+ export * from './tools.js';
5
+ export * from './google-common.js';
6
+ export * from './language_models/chat_models.js';
7
+ export * from './messages/tool.js';
8
+ export * from './openai.js';
@@ -0,0 +1,4 @@
1
+ import type { BaseMessage } from '@langchain/core/messages';
2
+ export declare function withCurrentTurnContainer<T extends {
3
+ container?: string;
4
+ }>(messages: readonly BaseMessage[], options: T): T;
@@ -1,6 +1,6 @@
1
1
  import { ToolCall } from '@langchain/core/messages/tool';
2
2
  import { type BaseMessage } from '@langchain/core/messages';
3
- import { AnthropicMessageCreateParams, AnthropicToolResponse } from '../types';
3
+ import { AnthropicMessageCreateParams, AnthropicToolResponse } from '../types.js';
4
4
  /**
5
5
  * Normalize a tool-call ID to satisfy Anthropic's `^[a-zA-Z0-9_-]+$` and 64-char
6
6
  * constraints. Pure and deterministic — same input always yields the same output,
@@ -3,7 +3,7 @@ import { AIMessageChunk } from '@langchain/core/messages';
3
3
  import type { UsageMetadata } from '@langchain/core/messages';
4
4
  import type { ChatGeneration } from '@langchain/core/outputs';
5
5
  import type Anthropic from '@anthropic-ai/sdk';
6
- import type { AnthropicMessageResponse } from '../types';
6
+ import type { AnthropicMessageResponse } from '../types.js';
7
7
  export interface AnthropicUsageData {
8
8
  input_tokens?: number | null;
9
9
  output_tokens?: number | null;
@@ -4,7 +4,7 @@
4
4
  * @module
5
5
  */
6
6
  import type { ChatModelStreamEvent } from '@langchain/core/language_models/event';
7
- import type { AnthropicMessageStreamEvent } from '../types';
7
+ import type { AnthropicMessageStreamEvent } from '../types.js';
8
8
  interface AnthropicStreamErrorEvent {
9
9
  type: 'error';
10
10
  error: {
@@ -146,9 +146,8 @@ export declare class CustomChatBedrockConverse extends ChatBedrockConverse {
146
146
  _generateNonStreaming(messages: BaseMessage[], options: this['ParsedCallOptions'] & CustomChatBedrockConverseCallOptions, runManager?: CallbackManagerForLLMRun): Promise<ChatResult>;
147
147
  /**
148
148
  * Non-streaming Converse through this package's converter, as the stream already uses.
149
- * The parent's converter replays reasoning and sends harmony control tokens as written,
150
- * both of which OpenAI models on Bedrock fail on, and it cannot strip a trailing
151
- * assistant prefill that Claude 4.6 and later reject.
149
+ * The parent's converter cannot omit unsupported reasoning replay, neutralize
150
+ * OpenAI Harmony tokens, or strip unsupported Claude assistant prefill.
152
151
  */
153
152
  private generateWithLocalConverter;
154
153
  /**
@@ -15,7 +15,7 @@
15
15
  * tolerated inside the match and kept.
16
16
  */
17
17
  import type { ConverseStreamCommandInput } from '@aws-sdk/client-bedrock-runtime';
18
- import type { BedrockMessage, BedrockSystemContentBlock } from '../types';
18
+ import type { BedrockMessage, BedrockSystemContentBlock } from '../types.js';
19
19
  /** The text with every harmony control token rendered inert; the same string when none. */
20
20
  export declare function neutralizeHarmonyControlTokens(text: string): string;
21
21
  type ToolConfiguration = NonNullable<ConverseStreamCommandInput['toolConfig']>;
@@ -1,5 +1,5 @@
1
1
  /**
2
2
  * Bedrock Converse utility exports.
3
3
  */
4
- export { convertToConverseMessages, extractImageInfo, langchainReasoningBlockToBedrockReasoningBlock, concatenateLangchainReasoningBlocks, } from './message_inputs';
5
- export { convertConverseMessageToLangChainMessage, createConverseToolUseStopChunk, handleConverseStreamContentBlockStart, handleConverseStreamContentBlockDelta, handleConverseStreamMetadata, bedrockReasoningBlockToLangchainReasoningBlock, bedrockReasoningDeltaToLangchainPartialReasoningBlock, } from './message_outputs';
4
+ export { convertToConverseMessages, extractImageInfo, langchainReasoningBlockToBedrockReasoningBlock, concatenateLangchainReasoningBlocks, } from './message_inputs.js';
5
+ export { convertConverseMessageToLangChainMessage, createConverseToolUseStopChunk, handleConverseStreamContentBlockStart, handleConverseStreamContentBlockDelta, handleConverseStreamMetadata, bedrockReasoningBlockToLangchainReasoningBlock, bedrockReasoningDeltaToLangchainPartialReasoningBlock, } from './message_outputs.js';
@@ -3,7 +3,7 @@
3
3
  * Ported from @langchain/aws common.js
4
4
  */
5
5
  import { type BaseMessage, MessageContentComplex } from '@langchain/core/messages';
6
- import type { BedrockMessage, BedrockSystemContentBlock, BedrockContentBlock, MessageContentReasoningBlock } from '../types';
6
+ import type { BedrockMessage, BedrockSystemContentBlock, BedrockContentBlock, MessageContentReasoningBlock } from '../types.js';
7
7
  /**
8
8
  * Convert a LangChain reasoning block to a Bedrock reasoning block.
9
9
  */
@@ -30,18 +30,9 @@ export interface ConvertToConverseMessagesOptions {
30
30
  */
31
31
  model?: string;
32
32
  }
33
- /**
34
- * Whether the model is an identified OpenAI model on Bedrock (`openai.*`, a geo/global
35
- * inference profile such as `global.openai.*`, or an ARN naming one). Missing model IDs and
36
- * opaque resource ARNs are not identified.
37
- */
33
+ /** Identifies OpenAI models on Bedrock, including named inference profiles. */
38
34
  export declare function isBedrockOpenAIModel(model?: string): boolean;
39
- /**
40
- * OpenAI Bedrock models reject prior `reasoningContent`, including on Claude-to-GPT handoffs.
41
- * Only suppress replay for identified OpenAI targets; other model families retain the existing
42
- * behavior because their Bedrock reasoning-replay requirements have not been verified here.
43
- * Missing model IDs and opaque resource ARNs also retain the existing behavior.
44
- */
35
+ /** OpenAI and Grok 4.7 reject prior reasoning; opaque resources keep replay. */
45
36
  export declare function replaysBedrockReasoning(model?: string): boolean;
46
37
  /**
47
38
  * Convert LangChain messages to Bedrock Converse messages.
@@ -4,7 +4,7 @@
4
4
  */
5
5
  import { ChatGenerationChunk } from '@langchain/core/outputs';
6
6
  import { AIMessage } from '@langchain/core/messages';
7
- import type { BedrockMessage, ConverseResponse, ContentBlockDeltaEvent, ConverseStreamMetadataEvent, ContentBlockStartEvent, ReasoningContentBlock, ReasoningContentBlockDelta, MessageContentReasoningBlock, MessageContentReasoningBlockReasoningTextPartial, MessageContentReasoningBlockRedacted } from '../types';
7
+ import type { BedrockMessage, ConverseResponse, ContentBlockDeltaEvent, ConverseStreamMetadataEvent, ContentBlockStartEvent, ReasoningContentBlock, ReasoningContentBlockDelta, MessageContentReasoningBlock, MessageContentReasoningBlockReasoningTextPartial, MessageContentReasoningBlockRedacted } from '../types.js';
8
8
  /**
9
9
  * Convert a Bedrock reasoning block delta to a LangChain partial reasoning block.
10
10
  */
@@ -27,5 +27,5 @@ export declare class CustomChatGoogleGenerativeAI extends ChatGoogleGenerativeAI
27
27
  _streamResponseChunks(messages: BaseMessage[], options: this['ParsedCallOptions'], runManager?: CallbackManagerForLLMRun): AsyncGenerator<ChatGenerationChunk>;
28
28
  private _streamProviderChunks;
29
29
  }
30
- export { GEMINI_PARTS, GEMINI_REPLAY_UNSUPPORTED, captureGeminiReplayParts, restoreGeminiReplayParts, isGeminiReplayParts, } from './utils/signatures';
31
- export type { GeminiReplayPart } from './utils/signatures';
30
+ export { GEMINI_PARTS, GEMINI_REPLAY_UNSUPPORTED, captureGeminiReplayParts, restoreGeminiReplayParts, isGeminiReplayParts, } from './utils/signatures.js';
31
+ export type { GeminiReplayPart } from './utils/signatures.js';
@@ -2,7 +2,7 @@ import { ChatGenerationChunk } from '@langchain/core/outputs';
2
2
  import { BaseMessage, UsageMetadata } from '@langchain/core/messages';
3
3
  import { POSSIBLE_ROLES, type Part, type Content, type GenerateContentResponse, type EnhancedGenerateContentResponse, type FunctionDeclarationsTool as GoogleGenerativeAIFunctionDeclarationsTool } from '@google/generative-ai';
4
4
  import type { ChatResult } from '@langchain/core/outputs';
5
- import { GoogleGenerativeAIToolType } from '../types';
5
+ import { GoogleGenerativeAIToolType } from '../types.js';
6
6
  export declare const _FUNCTION_CALL_THOUGHT_SIGNATURES_MAP_KEY = "__gemini_function_call_thought_signatures__";
7
7
  type GoogleResponse = GenerateContentResponse & Partial<EnhancedGenerateContentResponse>;
8
8
  /**
@@ -1,6 +1,6 @@
1
1
  import { ToolChoice } from '@langchain/core/language_models/chat_models';
2
2
  import { Tool as GenerativeAITool, ToolConfig } from '@google/generative-ai';
3
- import { GoogleGenerativeAIToolType } from '../types';
3
+ import { GoogleGenerativeAIToolType } from '../types.js';
4
4
  export declare function convertToolsToGenAI(tools: GoogleGenerativeAIToolType[], extra?: {
5
5
  toolChoice?: ToolChoice;
6
6
  allowedFunctionNames?: string[];
@@ -11,7 +11,7 @@ import type { ChatResult } from '@langchain/core/outputs';
11
11
  import type { ChatXAIInput } from '@langchain/xai';
12
12
  import type * as t from '@langchain/openai';
13
13
  import type { SmoothItem } from '../stream/smoother.js';
14
- import type { HeaderValue, HeadersLike } from './types';
14
+ import type { HeaderValue, HeadersLike } from './types.js';
15
15
  import type { PromptCacheTtl } from '../../messages/cache.js';
16
16
  export declare function isHeaders(headers: unknown): headers is Headers;
17
17
  export declare function normalizeHeaders(headers: HeadersLike): Record<string, HeaderValue | readonly HeaderValue[]>;