@illuma-ai/agents 1.5.1 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (319) hide show
  1. package/README.md +0 -62
  2. package/dist/cjs/agents/AgentContext.cjs +160 -259
  3. package/dist/cjs/agents/AgentContext.cjs.map +1 -1
  4. package/dist/cjs/common/enum.cjs +12 -12
  5. package/dist/cjs/common/enum.cjs.map +1 -1
  6. package/dist/cjs/graphs/Graph.cjs +30 -13
  7. package/dist/cjs/graphs/Graph.cjs.map +1 -1
  8. package/dist/cjs/graphs/MultiAgentGraph.cjs +1 -1
  9. package/dist/cjs/graphs/MultiAgentGraph.cjs.map +1 -1
  10. package/dist/cjs/graphs/phases/memoryFlushPhase.cjs +1 -1
  11. package/dist/cjs/graphs/phases/memoryFlushPhase.cjs.map +1 -1
  12. package/dist/cjs/hooks/HookRegistry.cjs +1 -1
  13. package/dist/cjs/hooks/HookRegistry.cjs.map +1 -1
  14. package/dist/cjs/hooks/matchers.cjs +2 -2
  15. package/dist/cjs/hooks/matchers.cjs.map +1 -1
  16. package/dist/cjs/hooks/types.cjs +1 -1
  17. package/dist/cjs/hooks/types.cjs.map +1 -1
  18. package/dist/cjs/llm/anthropic/utils/message_inputs.cjs +1 -5
  19. package/dist/cjs/llm/anthropic/utils/message_inputs.cjs.map +1 -1
  20. package/dist/cjs/llm/bedrock/index.cjs +33 -61
  21. package/dist/cjs/llm/bedrock/index.cjs.map +1 -1
  22. package/dist/cjs/llm/openai/index.cjs +1 -1
  23. package/dist/cjs/llm/openai/index.cjs.map +1 -1
  24. package/dist/cjs/llm/openai/utils/index.cjs +10 -27
  25. package/dist/cjs/llm/openai/utils/index.cjs.map +1 -1
  26. package/dist/cjs/main.cjs +3 -84
  27. package/dist/cjs/main.cjs.map +1 -1
  28. package/dist/cjs/memory/citations.cjs +4 -4
  29. package/dist/cjs/memory/citations.cjs.map +1 -1
  30. package/dist/cjs/memory/constants.cjs +17 -17
  31. package/dist/cjs/memory/constants.cjs.map +1 -1
  32. package/dist/cjs/memory/mmr.cjs +1 -1
  33. package/dist/cjs/memory/mmr.cjs.map +1 -1
  34. package/dist/cjs/memory/paths.cjs +1 -1
  35. package/dist/cjs/memory/paths.cjs.map +1 -1
  36. package/dist/cjs/memory/recallTracking.cjs +3 -3
  37. package/dist/cjs/memory/recallTracking.cjs.map +1 -1
  38. package/dist/cjs/memory/temporalDecay.cjs +2 -2
  39. package/dist/cjs/memory/temporalDecay.cjs.map +1 -1
  40. package/dist/cjs/messages/cache.cjs +0 -89
  41. package/dist/cjs/messages/cache.cjs.map +1 -1
  42. package/dist/cjs/messages/format.cjs +13 -71
  43. package/dist/cjs/messages/format.cjs.map +1 -1
  44. package/dist/cjs/tools/BashExecutor.cjs +11 -21
  45. package/dist/cjs/tools/BashExecutor.cjs.map +1 -1
  46. package/dist/cjs/tools/CodeExecutor.cjs +13 -41
  47. package/dist/cjs/tools/CodeExecutor.cjs.map +1 -1
  48. package/dist/cjs/tools/ProgrammaticToolCalling.cjs +11 -16
  49. package/dist/cjs/tools/ProgrammaticToolCalling.cjs.map +1 -1
  50. package/dist/cjs/tools/ToolNode.cjs +78 -13
  51. package/dist/cjs/tools/ToolNode.cjs.map +1 -1
  52. package/dist/cjs/tools/memory/memoryAppendTool.cjs +1 -1
  53. package/dist/cjs/tools/memory/memoryAppendTool.cjs.map +1 -1
  54. package/dist/cjs/tools/memory/memoryGetTool.cjs +2 -2
  55. package/dist/cjs/tools/memory/memoryGetTool.cjs.map +1 -1
  56. package/dist/cjs/tools/memory/memorySearchTool.cjs +3 -3
  57. package/dist/cjs/tools/memory/memorySearchTool.cjs.map +1 -1
  58. package/dist/cjs/tools/memory/shared.cjs +1 -1
  59. package/dist/cjs/tools/memory/shared.cjs.map +1 -1
  60. package/dist/cjs/tools/search/search.cjs +3 -11
  61. package/dist/cjs/tools/search/search.cjs.map +1 -1
  62. package/dist/cjs/tools/search/tool.cjs +4 -28
  63. package/dist/cjs/tools/search/tool.cjs.map +1 -1
  64. package/dist/cjs/tools/search/utils.cjs +3 -10
  65. package/dist/cjs/tools/search/utils.cjs.map +1 -1
  66. package/dist/cjs/tools/subagent/SubagentExecutor.cjs +48 -0
  67. package/dist/cjs/tools/subagent/SubagentExecutor.cjs.map +1 -1
  68. package/dist/cjs/types/graph.cjs.map +1 -1
  69. package/dist/esm/agents/AgentContext.mjs +160 -259
  70. package/dist/esm/agents/AgentContext.mjs.map +1 -1
  71. package/dist/esm/common/enum.mjs +12 -12
  72. package/dist/esm/common/enum.mjs.map +1 -1
  73. package/dist/esm/graphs/Graph.mjs +30 -13
  74. package/dist/esm/graphs/Graph.mjs.map +1 -1
  75. package/dist/esm/graphs/MultiAgentGraph.mjs +1 -1
  76. package/dist/esm/graphs/MultiAgentGraph.mjs.map +1 -1
  77. package/dist/esm/graphs/phases/memoryFlushPhase.mjs +1 -1
  78. package/dist/esm/graphs/phases/memoryFlushPhase.mjs.map +1 -1
  79. package/dist/esm/hooks/HookRegistry.mjs +1 -1
  80. package/dist/esm/hooks/HookRegistry.mjs.map +1 -1
  81. package/dist/esm/hooks/matchers.mjs +2 -2
  82. package/dist/esm/hooks/matchers.mjs.map +1 -1
  83. package/dist/esm/hooks/types.mjs +1 -1
  84. package/dist/esm/hooks/types.mjs.map +1 -1
  85. package/dist/esm/llm/anthropic/utils/message_inputs.mjs +1 -5
  86. package/dist/esm/llm/anthropic/utils/message_inputs.mjs.map +1 -1
  87. package/dist/esm/llm/bedrock/index.mjs +34 -61
  88. package/dist/esm/llm/bedrock/index.mjs.map +1 -1
  89. package/dist/esm/llm/openai/index.mjs +1 -1
  90. package/dist/esm/llm/openai/index.mjs.map +1 -1
  91. package/dist/esm/llm/openai/utils/index.mjs +10 -27
  92. package/dist/esm/llm/openai/utils/index.mjs.map +1 -1
  93. package/dist/esm/main.mjs +1 -5
  94. package/dist/esm/main.mjs.map +1 -1
  95. package/dist/esm/memory/citations.mjs +4 -4
  96. package/dist/esm/memory/citations.mjs.map +1 -1
  97. package/dist/esm/memory/constants.mjs +17 -17
  98. package/dist/esm/memory/constants.mjs.map +1 -1
  99. package/dist/esm/memory/mmr.mjs +1 -1
  100. package/dist/esm/memory/mmr.mjs.map +1 -1
  101. package/dist/esm/memory/paths.mjs +1 -1
  102. package/dist/esm/memory/paths.mjs.map +1 -1
  103. package/dist/esm/memory/recallTracking.mjs +3 -3
  104. package/dist/esm/memory/recallTracking.mjs.map +1 -1
  105. package/dist/esm/memory/temporalDecay.mjs +2 -2
  106. package/dist/esm/memory/temporalDecay.mjs.map +1 -1
  107. package/dist/esm/messages/cache.mjs +0 -89
  108. package/dist/esm/messages/cache.mjs.map +1 -1
  109. package/dist/esm/messages/format.mjs +13 -71
  110. package/dist/esm/messages/format.mjs.map +1 -1
  111. package/dist/esm/tools/BashExecutor.mjs +12 -22
  112. package/dist/esm/tools/BashExecutor.mjs.map +1 -1
  113. package/dist/esm/tools/CodeExecutor.mjs +14 -41
  114. package/dist/esm/tools/CodeExecutor.mjs.map +1 -1
  115. package/dist/esm/tools/ProgrammaticToolCalling.mjs +12 -17
  116. package/dist/esm/tools/ProgrammaticToolCalling.mjs.map +1 -1
  117. package/dist/esm/tools/ToolNode.mjs +78 -13
  118. package/dist/esm/tools/ToolNode.mjs.map +1 -1
  119. package/dist/esm/tools/memory/memoryAppendTool.mjs +1 -1
  120. package/dist/esm/tools/memory/memoryAppendTool.mjs.map +1 -1
  121. package/dist/esm/tools/memory/memoryGetTool.mjs +2 -2
  122. package/dist/esm/tools/memory/memoryGetTool.mjs.map +1 -1
  123. package/dist/esm/tools/memory/memorySearchTool.mjs +3 -3
  124. package/dist/esm/tools/memory/memorySearchTool.mjs.map +1 -1
  125. package/dist/esm/tools/memory/shared.mjs +1 -1
  126. package/dist/esm/tools/memory/shared.mjs.map +1 -1
  127. package/dist/esm/tools/search/search.mjs +3 -11
  128. package/dist/esm/tools/search/search.mjs.map +1 -1
  129. package/dist/esm/tools/search/tool.mjs +4 -28
  130. package/dist/esm/tools/search/tool.mjs.map +1 -1
  131. package/dist/esm/tools/search/utils.mjs +3 -10
  132. package/dist/esm/tools/search/utils.mjs.map +1 -1
  133. package/dist/esm/tools/subagent/SubagentExecutor.mjs +48 -0
  134. package/dist/esm/tools/subagent/SubagentExecutor.mjs.map +1 -1
  135. package/dist/esm/types/graph.mjs.map +1 -1
  136. package/dist/types/agents/AgentContext.d.ts +25 -95
  137. package/dist/types/common/enum.d.ts +12 -12
  138. package/dist/types/graphs/Graph.d.ts +2 -2
  139. package/dist/types/graphs/phases/memoryFlushPhase.d.ts +2 -2
  140. package/dist/types/hooks/HookRegistry.d.ts +1 -1
  141. package/dist/types/hooks/matchers.d.ts +2 -2
  142. package/dist/types/hooks/types.d.ts +1 -1
  143. package/dist/types/index.d.ts +0 -1
  144. package/dist/types/llm/bedrock/index.d.ts +1 -54
  145. package/dist/types/llm/openai/index.d.ts +1 -1
  146. package/dist/types/memory/citations.d.ts +4 -4
  147. package/dist/types/memory/constants.d.ts +17 -17
  148. package/dist/types/memory/mmr.d.ts +3 -3
  149. package/dist/types/memory/paths.d.ts +1 -1
  150. package/dist/types/memory/temporalDecay.d.ts +2 -2
  151. package/dist/types/memory/types.d.ts +3 -3
  152. package/dist/types/messages/format.d.ts +2 -5
  153. package/dist/types/tools/CodeExecutor.d.ts +0 -6
  154. package/dist/types/tools/ToolNode.d.ts +3 -3
  155. package/dist/types/tools/memory/shared.d.ts +1 -1
  156. package/dist/types/tools/search/test.d.ts +1 -0
  157. package/dist/types/tools/search/types.d.ts +5 -99
  158. package/dist/types/tools/search/utils.d.ts +2 -2
  159. package/dist/types/tools/subagent/SubagentExecutor.d.ts +29 -0
  160. package/dist/types/types/graph.d.ts +30 -34
  161. package/dist/types/types/index.d.ts +0 -1
  162. package/dist/types/types/messages.d.ts +1 -1
  163. package/dist/types/types/run.d.ts +1 -3
  164. package/dist/types/types/tools.d.ts +5 -14
  165. package/package.json +1 -61
  166. package/src/agents/AgentContext.test.ts +176 -0
  167. package/src/agents/AgentContext.ts +179 -305
  168. package/src/agents/__tests__/AgentContext.test.ts +0 -632
  169. package/src/common/__tests__/enum.test.ts +1 -1
  170. package/src/common/enum.ts +12 -12
  171. package/src/graphs/Graph.ts +32 -13
  172. package/src/graphs/MultiAgentGraph.ts +1 -1
  173. package/src/graphs/gapFeatures.test.ts +1 -1
  174. package/src/graphs/phases/__tests__/memoryFlushPhase.test.ts +1 -1
  175. package/src/graphs/phases/memoryFlushPhase.ts +2 -2
  176. package/src/hooks/HookRegistry.ts +1 -1
  177. package/src/hooks/index.ts +1 -1
  178. package/src/hooks/matchers.ts +2 -2
  179. package/src/hooks/types.ts +1 -1
  180. package/src/index.ts +0 -6
  181. package/src/llm/anthropic/utils/message_inputs.ts +1 -10
  182. package/src/llm/bedrock/__tests__/bedrock-caching.test.ts +18 -166
  183. package/src/llm/bedrock/index.ts +41 -116
  184. package/src/llm/openai/index.ts +2 -2
  185. package/src/llm/openai/utils/index.ts +14 -31
  186. package/src/memory/citations.ts +4 -4
  187. package/src/memory/constants.ts +17 -17
  188. package/src/memory/mmr.ts +3 -3
  189. package/src/memory/paths.ts +1 -1
  190. package/src/memory/recallTracking.ts +3 -3
  191. package/src/memory/temporalDecay.ts +2 -2
  192. package/src/memory/types.ts +3 -3
  193. package/src/messages/cache.test.ts +24 -62
  194. package/src/messages/cache.ts +0 -112
  195. package/src/messages/ensureThinkingBlock.test.ts +1 -1
  196. package/src/messages/format.ts +13 -92
  197. package/src/messages/formatAgentMessages.test.ts +1 -1
  198. package/src/scripts/subagent-configurable-inheritance.ts +263 -0
  199. package/src/scripts/subagent-event-driven-debug.ts +2 -2
  200. package/src/specs/anthropic.simple.test.ts +0 -61
  201. package/src/specs/prune.orphans.test.ts +1 -1
  202. package/src/tools/BashExecutor.ts +13 -37
  203. package/src/tools/CodeExecutor.ts +14 -59
  204. package/src/tools/ProgrammaticToolCalling.ts +14 -29
  205. package/src/tools/ToolNode.ts +75 -14
  206. package/src/tools/__tests__/CodeExecutor.test.ts +3 -3
  207. package/src/tools/__tests__/ProgrammaticToolCalling.test.ts +0 -60
  208. package/src/tools/__tests__/SubagentExecutor.test.ts +157 -0
  209. package/src/tools/memory/memoryAppendTool.ts +1 -1
  210. package/src/tools/memory/memoryGetTool.ts +2 -2
  211. package/src/tools/memory/memorySearchTool.ts +3 -3
  212. package/src/tools/memory/shared.ts +1 -1
  213. package/src/tools/search/output.md +2775 -0
  214. package/src/tools/search/search.ts +2 -12
  215. package/src/tools/search/test.html +884 -0
  216. package/src/tools/search/test.md +643 -0
  217. package/src/tools/search/test.ts +159 -0
  218. package/src/tools/search/tool.ts +2 -36
  219. package/src/tools/search/types.ts +8 -133
  220. package/src/tools/search/utils.ts +5 -13
  221. package/src/tools/subagent/SubagentExecutor.ts +78 -0
  222. package/src/types/graph.ts +27 -34
  223. package/src/types/index.ts +0 -1
  224. package/src/types/messages.ts +1 -1
  225. package/src/types/run.ts +1 -3
  226. package/src/types/tools.ts +5 -14
  227. package/dist/cjs/langchain/google-common.cjs +0 -3
  228. package/dist/cjs/langchain/google-common.cjs.map +0 -1
  229. package/dist/cjs/langchain/index.cjs +0 -86
  230. package/dist/cjs/langchain/index.cjs.map +0 -1
  231. package/dist/cjs/langchain/language_models/chat_models.cjs +0 -3
  232. package/dist/cjs/langchain/language_models/chat_models.cjs.map +0 -1
  233. package/dist/cjs/langchain/messages/tool.cjs +0 -3
  234. package/dist/cjs/langchain/messages/tool.cjs.map +0 -1
  235. package/dist/cjs/langchain/messages.cjs +0 -51
  236. package/dist/cjs/langchain/messages.cjs.map +0 -1
  237. package/dist/cjs/langchain/openai.cjs +0 -3
  238. package/dist/cjs/langchain/openai.cjs.map +0 -1
  239. package/dist/cjs/langchain/prompts.cjs +0 -11
  240. package/dist/cjs/langchain/prompts.cjs.map +0 -1
  241. package/dist/cjs/langchain/runnables.cjs +0 -19
  242. package/dist/cjs/langchain/runnables.cjs.map +0 -1
  243. package/dist/cjs/langchain/tools.cjs +0 -23
  244. package/dist/cjs/langchain/tools.cjs.map +0 -1
  245. package/dist/cjs/langchain/utils/env.cjs +0 -11
  246. package/dist/cjs/langchain/utils/env.cjs.map +0 -1
  247. package/dist/cjs/llm/bedrock/cacheSupport.cjs +0 -55
  248. package/dist/cjs/llm/bedrock/cacheSupport.cjs.map +0 -1
  249. package/dist/cjs/tools/search/tavily-scraper.cjs +0 -189
  250. package/dist/cjs/tools/search/tavily-scraper.cjs.map +0 -1
  251. package/dist/cjs/tools/search/tavily-search.cjs +0 -372
  252. package/dist/cjs/tools/search/tavily-search.cjs.map +0 -1
  253. package/dist/cjs/types/agent-cache.cjs +0 -54
  254. package/dist/cjs/types/agent-cache.cjs.map +0 -1
  255. package/dist/esm/langchain/google-common.mjs +0 -2
  256. package/dist/esm/langchain/google-common.mjs.map +0 -1
  257. package/dist/esm/langchain/index.mjs +0 -5
  258. package/dist/esm/langchain/index.mjs.map +0 -1
  259. package/dist/esm/langchain/language_models/chat_models.mjs +0 -2
  260. package/dist/esm/langchain/language_models/chat_models.mjs.map +0 -1
  261. package/dist/esm/langchain/messages/tool.mjs +0 -2
  262. package/dist/esm/langchain/messages/tool.mjs.map +0 -1
  263. package/dist/esm/langchain/messages.mjs +0 -2
  264. package/dist/esm/langchain/messages.mjs.map +0 -1
  265. package/dist/esm/langchain/openai.mjs +0 -2
  266. package/dist/esm/langchain/openai.mjs.map +0 -1
  267. package/dist/esm/langchain/prompts.mjs +0 -2
  268. package/dist/esm/langchain/prompts.mjs.map +0 -1
  269. package/dist/esm/langchain/runnables.mjs +0 -2
  270. package/dist/esm/langchain/runnables.mjs.map +0 -1
  271. package/dist/esm/langchain/tools.mjs +0 -2
  272. package/dist/esm/langchain/tools.mjs.map +0 -1
  273. package/dist/esm/langchain/utils/env.mjs +0 -2
  274. package/dist/esm/langchain/utils/env.mjs.map +0 -1
  275. package/dist/esm/llm/bedrock/cacheSupport.mjs +0 -52
  276. package/dist/esm/llm/bedrock/cacheSupport.mjs.map +0 -1
  277. package/dist/esm/tools/search/tavily-scraper.mjs +0 -186
  278. package/dist/esm/tools/search/tavily-scraper.mjs.map +0 -1
  279. package/dist/esm/tools/search/tavily-search.mjs +0 -370
  280. package/dist/esm/tools/search/tavily-search.mjs.map +0 -1
  281. package/dist/esm/types/agent-cache.mjs +0 -52
  282. package/dist/esm/types/agent-cache.mjs.map +0 -1
  283. package/dist/types/langchain/google-common.d.ts +0 -1
  284. package/dist/types/langchain/index.d.ts +0 -8
  285. package/dist/types/langchain/language_models/chat_models.d.ts +0 -1
  286. package/dist/types/langchain/messages/tool.d.ts +0 -1
  287. package/dist/types/langchain/messages.d.ts +0 -2
  288. package/dist/types/langchain/openai.d.ts +0 -1
  289. package/dist/types/langchain/prompts.d.ts +0 -1
  290. package/dist/types/langchain/runnables.d.ts +0 -2
  291. package/dist/types/langchain/tools.d.ts +0 -2
  292. package/dist/types/langchain/utils/env.d.ts +0 -1
  293. package/dist/types/llm/bedrock/cacheSupport.d.ts +0 -35
  294. package/dist/types/tools/search/tavily-scraper.d.ts +0 -19
  295. package/dist/types/tools/search/tavily-search.d.ts +0 -4
  296. package/dist/types/tools/subagent/types.d.ts +0 -84
  297. package/dist/types/types/agent-cache.d.ts +0 -71
  298. package/src/agents/__tests__/AgentContext.cacheTtl.live.test.ts +0 -259
  299. package/src/agents/__tests__/AgentContext.crossAgentTier1.live.test.ts +0 -266
  300. package/src/agents/__tests__/AgentContext.crossUserCache.live.test.ts +0 -342
  301. package/src/langchain/google-common.ts +0 -1
  302. package/src/langchain/index.ts +0 -8
  303. package/src/langchain/language_models/chat_models.ts +0 -1
  304. package/src/langchain/messages/tool.ts +0 -5
  305. package/src/langchain/messages.ts +0 -21
  306. package/src/langchain/openai.ts +0 -1
  307. package/src/langchain/prompts.ts +0 -1
  308. package/src/langchain/runnables.ts +0 -7
  309. package/src/langchain/tools.ts +0 -8
  310. package/src/langchain/utils/env.ts +0 -1
  311. package/src/llm/anthropic/utils/server-tool-inputs.test.ts +0 -436
  312. package/src/llm/bedrock/cacheSupport.test.ts +0 -99
  313. package/src/llm/bedrock/cacheSupport.ts +0 -53
  314. package/src/tools/search/tavily-scraper.ts +0 -235
  315. package/src/tools/search/tavily-search.ts +0 -424
  316. package/src/tools/search/tavily.test.ts +0 -965
  317. package/src/tools/subagent/types.test.ts +0 -70
  318. package/src/tools/subagent/types.ts +0 -115
  319. package/src/types/agent-cache.ts +0 -74
@@ -103,19 +103,19 @@ export enum Providers {
103
103
 
104
104
  export enum EdgeType {
105
105
  /**
106
- * handoff: one-way routing where the parent agent exits
106
+ * Upstream-aligned handoff: one-way routing where the parent agent exits
107
107
  * via a `lc_transfer_to_<destination>` tool call, the child takes over,
108
108
  * and the child responds directly to the user. Replaces what used to be
109
- * called "TRANSFER" in older versions; the parent-calls-child
109
+ * called "TRANSFER" in earlier Ranger versions; the parent-calls-child
110
110
  * supervisor pattern (formerly `EdgeType.HANDOFF`) is gone — use the
111
111
  * Subagent primitive (Tier 5) for deep delegation instead.
112
112
  */
113
113
  HANDOFF = 'handoff',
114
114
  /**
115
- * Fixed graph edges for automatic transitions. Standard naming.
116
- * Downstream consumers may layer additional wiring on top of this edge
117
- * type: fan-in with prompt + {results}, parallel groups, approval-gate
118
- * node insertion, and the `excludeResults` agentMessages channel.
115
+ * Fixed graph edges for automatic transitions. Naming matches upstream.
116
+ * Ranger keeps its enriched wiring on top of this edge type:
117
+ * fan-in with prompt + {results}, parallel groups, ApprovalGateNode
118
+ * insertion, and the `excludeResults` agentMessages channel.
119
119
  */
120
120
  DIRECT = 'direct',
121
121
  }
@@ -195,15 +195,15 @@ export enum Callback {
195
195
  export enum Constants {
196
196
  OFFICIAL_CODE_BASEURL = 'https://api.illuma.ai/v1',
197
197
  EXECUTE_CODE = 'execute_code',
198
- /** Tool name for the bash execution primitive (Tier 3). */
198
+ /** Tool name for the bash execution primitive (upstream Tier 3). */
199
199
  BASH_TOOL = 'execute_bash',
200
- /** Tool name for the bash programmatic-tool-calling variant (Tier 3). */
200
+ /** Tool name for the bash programmatic-tool-calling variant (upstream Tier 3). */
201
201
  BASH_PROGRAMMATIC_TOOL_CALLING = 'run_tools_with_bash',
202
- /** Tool name for the read-file primitive (Tier 3). */
202
+ /** Tool name for the read-file primitive (upstream Tier 3). */
203
203
  READ_FILE = 'read_file',
204
- /** Tool name for the SkillTool primitive (Tier 2). */
204
+ /** Tool name for the SkillTool primitive (upstream Tier 2). */
205
205
  SKILL_TOOL = 'skill',
206
- /** Tool name for the Subagent primitive (Tier 5). */
206
+ /** Tool name for the Subagent primitive (upstream Tier 5). */
207
207
  SUBAGENT = 'subagent',
208
208
  TOOL_SEARCH = 'tool_search',
209
209
  PROGRAMMATIC_TOOL_CALLING = 'run_tools_with_code',
@@ -270,7 +270,7 @@ export enum MessageTypes {
270
270
  /**
271
271
  * Tool names that use the code execution environment (shared session, file
272
272
  * tracking). Used by ToolNode to inject session context + file refs into
273
- * `invokeParams` before tool execution. constant.
273
+ * `invokeParams` before tool execution. Upstream-aligned constant.
274
274
  */
275
275
  export const CODE_EXECUTION_TOOLS: ReadonlySet<string> = new Set([
276
276
  Constants.EXECUTE_CODE,
@@ -187,7 +187,7 @@ export abstract class Graph<
187
187
  hookRegistry?: import('@/hooks').HookRegistry;
188
188
  /**
189
189
  * Optional tool-output reference registry threaded down from Run
190
- * (PR #114). When set, every ToolNode built by this graph
190
+ * (upstream PR #114). When set, every ToolNode built by this graph
191
191
  * stores successful outputs here and resolves `{{tool<i>turn<n>}}`
192
192
  * placeholders in args before invoking the tool.
193
193
  *
@@ -198,7 +198,7 @@ export abstract class Graph<
198
198
  */
199
199
  toolOutputRegistry?: import('@/tools/toolOutputReferences').ToolOutputReferenceRegistry;
200
200
  /**
201
- * Run-scoped tool output reference configuration (PR #117).
201
+ * Run-scoped tool output reference configuration (upstream PR #117).
202
202
  * When `enabled` is true, the graph lazily allocates a single
203
203
  * `ToolOutputReferenceRegistry` on first `getOrCreateToolOutputRegistry()`
204
204
  * call and shares it with every ToolNode the graph compiles, so
@@ -366,15 +366,25 @@ export class StandardGraph extends Graph<t.BaseGraphState, t.GraphNode> {
366
366
  if (keepContent !== true) {
367
367
  this.contentData = resetIfNotEmpty(this.contentData, []);
368
368
  this.contentIndexMap = resetIfNotEmpty(this.contentIndexMap, new Map());
369
+ /**
370
+ * Clear in-place instead of replacing with a new Map to preserve the
371
+ * shared reference held by ToolNode (passed at construction time).
372
+ * Using resetIfNotEmpty would create a new Map, leaving ToolNode with
373
+ * a stale reference on 2nd+ processStream calls.
374
+ *
375
+ * Gated by `keepContent` because HITL resume calls processStream a
376
+ * second time (`Command({resume})`) with `keepContent: true` to
377
+ * preserve the in-progress message's contentParts. The toolCallId →
378
+ * stepId map must survive the same boundary so that when LangGraph
379
+ * replays the interrupted ToolNode, `handleRunToolCompletions` can
380
+ * still resolve the resumed tool call's stepId and dispatch
381
+ * ON_RUN_STEP_COMPLETED with the tool's output. Without this guard,
382
+ * HITL tools (e.g. `ask_user`) lose their `output` field on every
383
+ * persisted message — the result is in the LLM context but never
384
+ * makes it into the saved tool_call entry.
385
+ */
386
+ this.toolCallStepIds.clear();
369
387
  }
370
- this.stepKeyIds = resetIfNotEmpty(this.stepKeyIds, new Map());
371
- /**
372
- * Clear in-place instead of replacing with a new Map to preserve the
373
- * shared reference held by ToolNode (passed at construction time).
374
- * Using resetIfNotEmpty would create a new Map, leaving ToolNode with
375
- * a stale reference on 2nd+ processStream calls.
376
- */
377
- this.toolCallStepIds.clear();
378
388
  this.messageIdsByStepKey = resetIfNotEmpty(
379
389
  this.messageIdsByStepKey,
380
390
  new Map()
@@ -1109,7 +1119,7 @@ export class StandardGraph extends Graph<t.BaseGraphState, t.GraphNode> {
1109
1119
  }
1110
1120
 
1111
1121
  /**
1112
- * Lazy tool-output reference annotation (PR #117). Right
1122
+ * Lazy tool-output reference annotation (upstream PR #117). Right
1113
1123
  * before the message array hits the provider, walk it and apply
1114
1124
  * `[ref: tool<i>turn<n>]` prefixes / `_ref` JSON fields to a
1115
1125
  * transient copy. The persisted ToolMessages stay clean — only what
@@ -1720,7 +1730,7 @@ export class StandardGraph extends Graph<t.BaseGraphState, t.GraphNode> {
1720
1730
  * Fire PreCompact (#103) before the LLM call. Observational —
1721
1731
  * hosts may use the input to schedule auxiliary work, but a
1722
1732
  * deny/ask decision does NOT block compaction here because
1723
- * the summarizer runs in the background and a refusal
1733
+ * Ranger's summarizer runs in the background and a refusal
1724
1734
  * has nowhere to go: pruning still needs to happen at 100%
1725
1735
  * regardless. Errors are swallowed so a hook bug cannot
1726
1736
  * masquerade as a context-overflow failure.
@@ -2716,7 +2726,7 @@ If I seem to be missing something we discussed earlier, just give me a quick rem
2716
2726
  }
2717
2727
 
2718
2728
  /**
2719
- * Subagent injection (Tier 5): when the agent has SubagentConfig
2729
+ * Subagent injection (upstream Tier 5): when the agent has SubagentConfig
2720
2730
  * entries and depth budget remaining, inject a `subagent` DynamicStructuredTool
2721
2731
  * into graphTools. The tool's executor receives this graph's hookRegistry and
2722
2732
  * a lazy handler-registry getter (Run wires handlerRegistry AFTER createWorkflow,
@@ -2769,6 +2779,15 @@ If I seem to be missing something we discussed earlier, just give me a quick rem
2769
2779
  subagentType,
2770
2780
  threadId,
2771
2781
  parentToolCallId,
2782
+ /**
2783
+ * Forward the parent's `configurable` so host-set fields
2784
+ * (`requestBody`, `user`, etc.) propagate into the child
2785
+ * workflow. The executor scrubs run-identity fields before
2786
+ * forwarding — see `SubagentExecuteParams.parentConfigurable`.
2787
+ */
2788
+ parentConfigurable: config.configurable as
2789
+ | Record<string, unknown>
2790
+ | undefined,
2772
2791
  });
2773
2792
  return result.content;
2774
2793
  }, buildSubagentToolParams(resolvedConfigs));
@@ -1006,7 +1006,7 @@ export class MultiAgentGraph extends StandardGraph {
1006
1006
 
1007
1007
  /**
1008
1008
  * Add approval-gate nodes for sequence edges that declare an approvalGate
1009
- * config (consumer extension, not part of the standard interface). Gates fire
1009
+ * config (Ranger-only feature, not present upstream). Gates fire
1010
1010
  * regardless of ExecutionContext and sit between source and destination.
1011
1011
  */
1012
1012
  const gatedEdges = new Set<t.GraphEdge>();
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * gapFeatures.test.ts
3
3
  *
4
- * Integration tests for the four gap features:
4
+ * Integration tests for the four LibreChat gap features:
5
5
  * 1. Tool Discovery Caching
6
6
  * 2. SummarizationConfig (trigger types, initialSummary)
7
7
  * 3. EMA Pruning Calibration
@@ -1,7 +1,7 @@
1
1
  import { shouldFlushMemory } from '../memoryFlushPhase';
2
2
 
3
3
  describe('shouldFlushMemory', () => {
4
- // Use defaults: soft=4000, reserve=20000 means a 200k
4
+ // Use upstream-aligned defaults: soft=4000, reserve=20000 means a 200k
5
5
  // window fires at 176k. Explicit numbers here keep the test independent
6
6
  // from the constants file.
7
7
  const base = {
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Memory flush phase — trigger logic + reflection invocation.
3
3
  *
4
- * Ported from the reference implementation's post-turn flush handler. The agent is re-invoked
4
+ * Ported from upstream's post-turn flush handler. The agent is re-invoked
5
5
  * with a reflection system prompt and the `memory_append` tool unlocked;
6
6
  * it writes notes to its future self, then the graph returns to normal.
7
7
  *
@@ -45,7 +45,7 @@ export interface ShouldFlushInput {
45
45
  /**
46
46
  * Pure trigger function: fires when the current context is within
47
47
  * `softThreshold + reserveFloor` tokens of the model window. Matches
48
- * the standard formula.
48
+ * upstream's formula.
49
49
  */
50
50
  export function shouldFlushMemory(input: ShouldFlushInput): boolean {
51
51
  if (
@@ -24,7 +24,7 @@ type MatcherBucket = Partial<Record<HookEvent, HookMatcher<HookEvent>[]>>;
24
24
  *
25
25
  * ## Why `Map<sessionId, MatcherBucket>` and not `Record`
26
26
  *
27
- * Real consumers run thousands of parallel sessions in one Node process, and
27
+ * LibreChat runs thousands of parallel sessions in one Node process, and
28
28
  * hook registration happens inside hot paths (tool loading, agent spawning).
29
29
  * A `Record<sessionId, ...>` has to be spread on every insertion, which is
30
30
  * O(n) per call and O(n²) total for a batch of parallel registrations. A
@@ -1,6 +1,6 @@
1
1
  // src/hooks/index.ts
2
2
  //
3
- // Hook lifecycle system for `@illuma-ai/agents`. Re-exported from
3
+ // Hook lifecycle system for `@librechat/agents`. Re-exported from
4
4
  // `src/index.ts` and consumed by `Run.processStream` (RunStart,
5
5
  // UserPromptSubmit, Stop, StopFailure), `ToolNode.dispatchToolEvents`
6
6
  // (PreToolUse, PostToolUse, PostToolUseFailure, PermissionDenied),
@@ -129,7 +129,7 @@ function skipGroupSyntaxPrefix(pattern: string, start: number): number {
129
129
  * This catches the common forms but not all. Ambiguous-alternation ReDoS
130
130
  * like `(a|a)+` is not detected. Pathologically long patterns are also
131
131
  * caught by {@link MAX_PATTERN_LENGTH}. Hosts that accept user-supplied
132
- * patterns must still validate standard.
132
+ * patterns must still validate upstream.
133
133
  */
134
134
  export function hasNestedQuantifier(pattern: string): boolean {
135
135
  const stack: QuantifierFrame[] = [];
@@ -248,7 +248,7 @@ function compile(pattern: string): RegExp | null {
248
248
  * never re-enter the regex compiler.
249
249
  *
250
250
  * These are a floor, not a ceiling. Hosts that accept user-supplied
251
- * patterns should still validate standard. The design report §3.8 routes
251
+ * patterns should still validate upstream. The design report §3.8 routes
252
252
  * persistable hooks through a host-side compiler before they reach this
253
253
  * module.
254
254
  */
@@ -7,7 +7,7 @@ import type { BaseMessage } from '@langchain/core/messages';
7
7
  * These mirror the subset of Claude Code's event surface that makes sense
8
8
  * for a library context (no filesystem/CLI-specific events). See
9
9
  * `docs/hooks-design-report.md` §3.2 for the mapping to existing
10
- * `@illuma-ai/agents` emission points.
10
+ * `@librechat/agents` emission points.
11
11
  */
12
12
  export const HOOK_EVENTS = [
13
13
  'RunStart',
package/src/index.ts CHANGED
@@ -78,12 +78,6 @@ export * from './utils';
78
78
  /* Types */
79
79
  export type * from './types';
80
80
 
81
- /* LangChain compatibility facade — re-exports common langchain primitives
82
- * so consumers can import from '@illuma-ai/agents/langchain' instead of
83
- * pinning '@langchain/*' versions directly. Helps keep consumer dep
84
- * versions in sync with the library's tested set. */
85
- export * from './langchain';
86
-
87
81
  /* LLM */
88
82
  export { CustomOpenAIClient } from './llm/openai';
89
83
  export { ChatOpenRouter } from './llm/openrouter';
@@ -592,16 +592,7 @@ function _formatContent(message: BaseMessage) {
592
592
  throw new Error('Unsupported message content format');
593
593
  }
594
594
  });
595
- return contentBlocks.filter(
596
- (block) =>
597
- block !== null &&
598
- !(
599
- block.type === 'text' &&
600
- 'text' in block &&
601
- typeof block.text === 'string' &&
602
- block.text.trim() === ''
603
- )
604
- );
595
+ return contentBlocks.filter((block) => block !== null);
605
596
  }
606
597
  }
607
598
 
@@ -194,134 +194,6 @@ describe('Bedrock Prompt Caching', () => {
194
194
  expect(model.promptCache).toBe(false);
195
195
  });
196
196
  });
197
-
198
- describe('Tool cache strategies', () => {
199
- const fakeTools = [
200
- {
201
- toolSpec: {
202
- name: 'web_search',
203
- description: 'core search',
204
- inputSchema: { json: { type: 'object', properties: {} } },
205
- },
206
- },
207
- {
208
- toolSpec: {
209
- name: 'execute_code',
210
- description: 'core code',
211
- inputSchema: { json: { type: 'object', properties: {} } },
212
- },
213
- },
214
- {
215
- toolSpec: {
216
- name: 'search_emails_mcp_Outlook',
217
- description: 'mcp tool',
218
- inputSchema: { json: { type: 'object', properties: {} } },
219
- },
220
- },
221
- {
222
- toolSpec: {
223
- name: 'list_documents_mcp_SharePoint',
224
- description: 'mcp tool',
225
- inputSchema: { json: { type: 'object', properties: {} } },
226
- },
227
- },
228
- ];
229
-
230
- it("default 'single' strategy: one cachePoint at end of tools array", () => {
231
- const model = new CustomChatBedrockConverse({
232
- model: 'anthropic.claude-3-haiku-20240307-v1:0',
233
- region: 'us-east-1',
234
- promptCache: true,
235
- // toolCacheStrategy omitted — default is 'single'
236
- });
237
- const params = model.invocationParams({
238
- tools: fakeTools,
239
- } satisfies InvocationParamsOptions);
240
- // 4 tools + 1 cachePoint
241
- expect(params.toolConfig?.tools).toHaveLength(5);
242
- expect(params.toolConfig?.tools?.[4]).toEqual({
243
- cachePoint: { type: 'default' },
244
- });
245
- });
246
-
247
- it("'split' strategy with toolGroupSelector groups tools by selector key, cachePoint after each group", () => {
248
- const model = new CustomChatBedrockConverse({
249
- model: 'anthropic.claude-3-haiku-20240307-v1:0',
250
- region: 'us-east-1',
251
- promptCache: true,
252
- toolCacheStrategy: 'split',
253
- toolGroupSelector: (toolName) =>
254
- toolName.includes('_mcp_') ? 'mcp' : 'core',
255
- });
256
- const params = model.invocationParams({
257
- tools: fakeTools,
258
- } satisfies InvocationParamsOptions);
259
- // [core, core, cp, mcp, mcp, cp] = 6 entries
260
- expect(params.toolConfig?.tools).toHaveLength(6);
261
- expect(params.toolConfig?.tools?.[0]).toEqual(fakeTools[0]); // core
262
- expect(params.toolConfig?.tools?.[1]).toEqual(fakeTools[1]); // core
263
- expect(params.toolConfig?.tools?.[2]).toEqual({
264
- cachePoint: { type: 'default' },
265
- });
266
- expect(params.toolConfig?.tools?.[3]).toEqual(fakeTools[2]); // mcp
267
- expect(params.toolConfig?.tools?.[4]).toEqual(fakeTools[3]); // mcp
268
- expect(params.toolConfig?.tools?.[5]).toEqual({
269
- cachePoint: { type: 'default' },
270
- });
271
- });
272
-
273
- it("'none' strategy: no cachePoint added at all", () => {
274
- const model = new CustomChatBedrockConverse({
275
- model: 'anthropic.claude-3-haiku-20240307-v1:0',
276
- region: 'us-east-1',
277
- promptCache: true,
278
- toolCacheStrategy: 'none',
279
- });
280
- const params = model.invocationParams({
281
- tools: fakeTools,
282
- } satisfies InvocationParamsOptions);
283
- expect(params.toolConfig?.tools).toHaveLength(4);
284
- for (const tool of params.toolConfig?.tools ?? []) {
285
- expect('cachePoint' in tool).toBe(false);
286
- }
287
- });
288
-
289
- it("'split' with single-group selector behaves like 'single'", () => {
290
- const model = new CustomChatBedrockConverse({
291
- model: 'anthropic.claude-3-haiku-20240307-v1:0',
292
- region: 'us-east-1',
293
- promptCache: true,
294
- toolCacheStrategy: 'split',
295
- toolGroupSelector: () => 'all', // every tool same group
296
- });
297
- const params = model.invocationParams({
298
- tools: fakeTools,
299
- } satisfies InvocationParamsOptions);
300
- // 4 tools + 1 cachePoint
301
- expect(params.toolConfig?.tools).toHaveLength(5);
302
- expect(params.toolConfig?.tools?.[4]).toEqual({
303
- cachePoint: { type: 'default' },
304
- });
305
- });
306
-
307
- it("'split' with empty groups skipped (only emits cachePoint after non-empty groups)", () => {
308
- const model = new CustomChatBedrockConverse({
309
- model: 'anthropic.claude-3-haiku-20240307-v1:0',
310
- region: 'us-east-1',
311
- promptCache: true,
312
- toolCacheStrategy: 'split',
313
- toolGroupSelector: (name) =>
314
- name.includes('_mcp_') ? 'mcp' : 'core',
315
- });
316
- // Only core tools — no MCP
317
- const coreOnly = fakeTools.slice(0, 2);
318
- const params = model.invocationParams({
319
- tools: coreOnly,
320
- } satisfies InvocationParamsOptions);
321
- // 2 core + 1 cachePoint = 3
322
- expect(params.toolConfig?.tools).toHaveLength(3);
323
- });
324
- });
325
197
  });
326
198
 
327
199
  describe('AgentContext - System Message Caching', () => {
@@ -361,13 +233,7 @@ describe('Bedrock Prompt Caching', () => {
361
233
  };
362
234
 
363
235
  describe('Bedrock system message with promptCache: true', () => {
364
- /* Updated contract (2026-05-01, PR #128 alignment): Bedrock
365
- * system message gets a `cachePoint` block inline so the system
366
- * prefix is cached at the AWS account level (cross-user). Previously
367
- * cachePoint was only added at the tool level, leaving the system
368
- * prefix uncached. Tools array still gets its own cachePoints from
369
- * IllumaBedrockConverse.invocationParams independently. */
370
- it('emits content array with cachePoint after stable text (Claude model)', async () => {
236
+ it('should produce plain string system message (cachePoint is handled at tool level)', async () => {
371
237
  const ctx = createBedrockContext({
372
238
  instructions: 'You are a helpful assistant.',
373
239
  promptCache: true,
@@ -376,20 +242,17 @@ describe('Bedrock Prompt Caching', () => {
376
242
  const systemRunnable = ctx.systemRunnable;
377
243
  expect(systemRunnable).toBeDefined();
378
244
 
245
+ // Invoke the runnable to get the messages
379
246
  const result = await systemRunnable!.invoke([]);
380
247
  const systemMessage = result[0];
381
248
 
382
- const content = systemMessage.content as Array<Record<string, unknown>>;
383
- expect(Array.isArray(content)).toBe(true);
384
- expect(content).toHaveLength(2);
385
- expect(content[0]).toEqual({
386
- type: 'text',
387
- text: 'You are a helpful assistant.',
388
- });
389
- expect(content[1]).toEqual({ cachePoint: { type: 'default', ttl: '5m' } });
249
+ // Bedrock system messages are plain strings — cachePoint is added
250
+ // at the tool level by IllumaBedrockConverse.invocationParams()
251
+ expect(typeof systemMessage.content).toBe('string');
252
+ expect(systemMessage.content).toBe('You are a helpful assistant.');
390
253
  });
391
254
 
392
- it('keeps additional_instructions AFTER cachePoint (dynamic tail not cached)', async () => {
255
+ it('should include combined instructions and additional_instructions as plain string', async () => {
393
256
  const ctx = createBedrockContext({
394
257
  instructions: 'Base instructions.',
395
258
  additionalInstructions: 'Additional context.',
@@ -398,20 +261,11 @@ describe('Bedrock Prompt Caching', () => {
398
261
 
399
262
  const result = await ctx.systemRunnable!.invoke([]);
400
263
  const systemMessage = result[0];
401
- const content = systemMessage.content as Array<Record<string, unknown>>;
402
264
 
403
- /* Order is critical: stable text cachePoint dynamic text.
404
- * Anything after the cachePoint is excluded from the cache, so
405
- * the per-user/per-request `additional_instructions` does not
406
- * invalidate the cached prefix. */
407
- expect(content).toHaveLength(3);
408
- expect((content[0] as { text: string }).text).toBe(
409
- 'Base instructions.'
410
- );
411
- expect(content[1]).toEqual({ cachePoint: { type: 'default', ttl: '5m' } });
412
- expect((content[2] as { text: string }).text).toBe(
413
- 'Additional context.'
414
- );
265
+ // Bedrock system messages are plain strings even with promptCache
266
+ expect(typeof systemMessage.content).toBe('string');
267
+ expect(systemMessage.content).toContain('Base instructions.');
268
+ expect(systemMessage.content).toContain('Additional context.');
415
269
  });
416
270
  });
417
271
 
@@ -458,7 +312,7 @@ describe('Bedrock Prompt Caching', () => {
458
312
  expect(content[0]).toEqual({
459
313
  type: 'text',
460
314
  text: 'You are a helpful assistant.',
461
- cache_control: { type: 'ephemeral', ttl: '5m' },
315
+ cache_control: { type: 'ephemeral' },
462
316
  });
463
317
  });
464
318
 
@@ -476,21 +330,19 @@ describe('Bedrock Prompt Caching', () => {
476
330
  });
477
331
 
478
332
  describe('Provider-specific caching behavior', () => {
479
- it('emits cachePoint block inline for Bedrock Claude (account-scoped system caching)', async () => {
333
+ it('should produce plain string for Bedrock (cachePoint handled at tool level)', async () => {
480
334
  const bedrockCtx = createBedrockContext({
481
335
  instructions: 'Test',
482
336
  promptCache: true,
483
337
  });
484
338
 
485
339
  const result = await bedrockCtx.systemRunnable!.invoke([]);
486
- const content = result[0].content as Array<Record<string, unknown>>;
487
340
 
488
- // Bedrock system messages now carry an inline cachePoint so the
489
- // system prefix gets cached at the AWS account level (matching
490
- // PR #128). Tool-level cachePoint from
491
- // IllumaBedrockConverse.invocationParams() runs independently.
492
- expect(Array.isArray(content)).toBe(true);
493
- expect(content.some((c) => 'cachePoint' in c)).toBe(true);
341
+ // Bedrock system messages are plain strings cachePoint is added
342
+ // at the tool level by IllumaBedrockConverse.invocationParams(),
343
+ // not inline in the system message content
344
+ expect(typeof result[0].content).toBe('string');
345
+ expect(result[0].content).toBe('Test');
494
346
  });
495
347
 
496
348
  it('should use cache_control format for Anthropic, not cachePoint', async () => {