@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
@@ -3,12 +3,6 @@ import type * as t from '@/types';
3
3
  import { Constants } from '@/common';
4
4
  export declare const imageExtRegex: RegExp;
5
5
  export declare const getCodeBaseURL: () => string;
6
- /**
7
- * Renders one section of the post-execution file listing. Used by the
8
- * code/bash tool formatters to keep generated outputs and inherited
9
- * inputs visually separated. See BashExecutor for full docs.
10
- */
11
- export declare function renderFileSection(header: string, files: t.FileRefs, defaultMessage: string): string;
12
6
  export declare const CodeExecutionToolSchema: {
13
7
  readonly type: "object";
14
8
  readonly properties: {
@@ -9,7 +9,7 @@ import type { ResolvedArgsByCallId } from '@/tools/toolOutputReferences';
9
9
  /**
10
10
  * Per-call batch context for `runTool`. Bundles every optional batch-scoped
11
11
  * value the method needs so the signature stays at three positional params
12
- * even as new context fields are added. (PR #117).
12
+ * even as new context fields are added. Upstream-aligned (PR #117).
13
13
  */
14
14
  type RunToolBatchContext = {
15
15
  /** Position of this call within the parent ToolNode batch. */
@@ -51,7 +51,7 @@ export declare class ToolNode<T = any> extends RunnableCallable<T, T> {
51
51
  private hookRegistry?;
52
52
  /**
53
53
  * Tool output reference registry threaded down from Run / Graph
54
- * (PR #114). When set, dispatchToolEvents resolves
54
+ * (upstream PR #114). When set, dispatchToolEvents resolves
55
55
  * `{{tool<i>turn<n>}}` placeholders in args before invoking each tool
56
56
  * and stores successful outputs under their stable reference keys for
57
57
  * subsequent calls in the same run to pipe through.
@@ -112,7 +112,7 @@ export declare class ToolNode<T = any> extends RunnableCallable<T, T> {
112
112
  /**
113
113
  * Runs a single tool call with error handling.
114
114
  *
115
- * @param batchContext Optional per-batch context (PR #117).
115
+ * @param batchContext Optional per-batch context (upstream PR #117).
116
116
  * Threaded from `run()` for tool output reference annotation. The
117
117
  * `batchScopeId` field carries an anonymous synthetic scope when the
118
118
  * caller has no `run_id`, so concurrent batches don't collide on the
@@ -67,7 +67,7 @@ export interface MemoryGetToolResult {
67
67
  export declare function buildMemorySearchUnavailableResult(error: string | undefined): MemorySearchToolResult;
68
68
  /**
69
69
  * Clamp a ranked result list to a total character budget.
70
- * Ported from a reference implementation `tools.citations.ts::clampResultsByInjectedChars`.
70
+ * Ported from upstream `tools.citations.ts::clampResultsByInjectedChars`.
71
71
  */
72
72
  export declare function clampResultsByInjectedChars<T extends {
73
73
  content: string;
@@ -0,0 +1 @@
1
+ export {};
@@ -2,8 +2,8 @@ import type { Logger as WinstonLogger } from 'winston';
2
2
  import type { RunnableConfig } from '@langchain/core/runnables';
3
3
  import type { BaseReranker } from './rerankers';
4
4
  import { DATE_RANGE } from './schema';
5
- export type SearchProvider = 'serper' | 'searxng' | 'tavily';
6
- export type ScraperProvider = 'firecrawl' | 'serper' | 'tavily';
5
+ export type SearchProvider = 'serper' | 'searxng';
6
+ export type ScraperProvider = 'firecrawl' | 'serper';
7
7
  export type RerankerType = 'infinity' | 'jina' | 'cohere' | 'none';
8
8
  export interface Highlight {
9
9
  score: number;
@@ -56,50 +56,11 @@ export interface Source {
56
56
  snippet?: string;
57
57
  date?: string;
58
58
  }
59
- export type TavilyTimeRange = 'day' | 'week' | 'month' | 'year';
60
- export type TavilyTimeRangeInput = TavilyTimeRange | 'h' | 'd' | 'w' | 'm' | 'y';
61
- export interface TavilySearchOptions {
62
- searchDepth?: 'basic' | 'advanced' | 'fast' | 'ultra-fast';
63
- maxResults?: number;
64
- includeImages?: boolean;
65
- includeAnswer?: boolean | 'basic' | 'advanced';
66
- includeRawContent?: boolean | 'markdown' | 'text';
67
- includeDomains?: string[];
68
- excludeDomains?: string[];
69
- topic?: 'general' | 'news' | 'finance';
70
- timeRange?: TavilyTimeRangeInput;
71
- includeImageDescriptions?: boolean;
72
- includeFavicon?: boolean;
73
- chunksPerSource?: number;
74
- safeSearch?: boolean;
75
- timeout?: number;
76
- }
77
- export interface TavilySearchPayload {
78
- query: string;
79
- search_depth: NonNullable<TavilySearchOptions['searchDepth']>;
80
- topic: NonNullable<TavilySearchOptions['topic']>;
81
- max_results: number;
82
- safe_search?: boolean;
83
- time_range?: TavilyTimeRange;
84
- country?: string;
85
- include_images?: boolean;
86
- include_answer?: NonNullable<TavilySearchOptions['includeAnswer']>;
87
- include_raw_content?: NonNullable<TavilySearchOptions['includeRawContent']>;
88
- include_domains?: string[];
89
- exclude_domains?: string[];
90
- include_image_descriptions?: boolean;
91
- include_favicon?: boolean;
92
- chunks_per_source?: number;
93
- }
94
59
  export interface SearchConfig {
95
60
  searchProvider?: SearchProvider;
96
61
  serperApiKey?: string;
97
62
  searxngInstanceUrl?: string;
98
63
  searxngApiKey?: string;
99
- tavilyApiKey?: string;
100
- tavilySearchUrl?: string;
101
- tavilyExtractUrl?: string;
102
- tavilySearchOptions?: TavilySearchOptions;
103
64
  /** Domains to exclude from search results (e.g., 'reddit.com', 'twitter.com').
104
65
  * Appended as -site: operators to the search query. */
105
66
  domainBlocklist?: string[];
@@ -140,16 +101,6 @@ export interface SerperScraperConfig {
140
101
  logger?: Logger;
141
102
  includeMarkdown?: boolean;
142
103
  }
143
- export interface TavilyScraperConfig {
144
- apiKey?: string;
145
- apiUrl?: string;
146
- timeout?: number;
147
- logger?: Logger;
148
- extractDepth?: 'basic' | 'advanced';
149
- includeImages?: boolean;
150
- includeFavicon?: boolean;
151
- format?: 'markdown' | 'text';
152
- }
153
104
  export interface ScraperContentResult {
154
105
  content: string;
155
106
  }
@@ -190,7 +141,6 @@ export interface CohereRerankerResponse {
190
141
  export type SafeSearchLevel = 0 | 1 | 2;
191
142
  export type Logger = WinstonLogger;
192
143
  export interface SearchToolConfig extends SearchConfig, ProcessSourcesConfig, FirecrawlConfig {
193
- tavilyScraperOptions?: TavilyScraperConfig;
194
144
  logger?: Logger;
195
145
  safeSearch?: SafeSearchLevel;
196
146
  jinaApiKey?: string;
@@ -213,27 +163,15 @@ export type UsedReferences = {
213
163
  originalIndex: number;
214
164
  reference: MediaReference;
215
165
  }[];
216
- export type AnyScraperResponse = FirecrawlScrapeResponse | SerperScrapeResponse | TavilyScrapeResponse;
217
166
  /** Base Scraper Interface */
218
167
  export interface BaseScraper {
219
- scrapeUrl(url: string, options?: unknown): Promise<[string, AnyScraperResponse]>;
220
- scrapeUrls?(urls: string[], options?: unknown): Promise<Array<[string, AnyScraperResponse]>>;
221
- extractContent(response: AnyScraperResponse): [string, undefined | References];
222
- extractMetadata(response: AnyScraperResponse): ScrapeMetadata | GenericScrapeMetadata;
168
+ scrapeUrl(url: string, options?: unknown): Promise<[string, FirecrawlScrapeResponse | SerperScrapeResponse]>;
169
+ extractContent(response: FirecrawlScrapeResponse | SerperScrapeResponse): [string, undefined | References];
170
+ extractMetadata(response: FirecrawlScrapeResponse | SerperScrapeResponse): ScrapeMetadata | Record<string, string | number | boolean | null | undefined>;
223
171
  }
224
172
  /** Firecrawl */
225
173
  export type FirecrawlScrapeOptions = Omit<FirecrawlScraperConfig, 'apiKey' | 'apiUrl' | 'version' | 'logger'>;
226
174
  export type SerperScrapeOptions = Omit<SerperScraperConfig, 'apiKey' | 'apiUrl' | 'logger'>;
227
- export type TavilyScrapeOptions = Omit<TavilyScraperConfig, 'apiKey' | 'apiUrl' | 'logger'>;
228
- export interface TavilyExtractPayload {
229
- urls: string[];
230
- extract_depth: NonNullable<TavilyScraperConfig['extractDepth']>;
231
- include_images: boolean;
232
- include_favicon?: boolean;
233
- format?: NonNullable<TavilyScraperConfig['format']>;
234
- timeout?: number;
235
- }
236
- export type GenericScrapeMetadata = Record<string, string | number | boolean | null | undefined>;
237
175
  export interface ScrapeMetadata {
238
176
  sourceURL?: string;
239
177
  url?: string;
@@ -309,38 +247,6 @@ export interface SerperScrapeResponse {
309
247
  };
310
248
  error?: string;
311
249
  }
312
- export interface TavilyScrapeResponse {
313
- success: boolean;
314
- data?: {
315
- rawContent?: string;
316
- images?: string[];
317
- favicon?: string;
318
- };
319
- error?: string;
320
- }
321
- export interface TavilySearchResult {
322
- title?: string;
323
- url?: string;
324
- content?: string;
325
- score?: number;
326
- published_date?: string;
327
- }
328
- export type TavilyImageResult = string | {
329
- url?: string;
330
- description?: string;
331
- };
332
- export interface TavilySearchResponse {
333
- answer?: string;
334
- images?: TavilyImageResult[];
335
- results?: TavilySearchResult[];
336
- }
337
- export interface TavilyExtractResult {
338
- url: string;
339
- raw_content?: string;
340
- images?: string[];
341
- favicon?: string;
342
- error?: string;
343
- }
344
250
  export interface FirecrawlScraperConfig {
345
251
  apiKey?: string;
346
252
  apiUrl?: string;
@@ -6,5 +6,5 @@ import type * as t from './types';
6
6
  */
7
7
  export declare const createDefaultLogger: () => t.Logger;
8
8
  export declare const fileExtRegex: RegExp;
9
- export declare const getDomainName: (link: string, metadata?: t.ScrapeMetadata | t.GenericScrapeMetadata, logger?: t.Logger) => string | undefined;
10
- export declare function getAttribution(link: string, metadata?: t.ScrapeMetadata | t.GenericScrapeMetadata, logger?: t.Logger): string | undefined;
9
+ export declare const getDomainName: (link: string, metadata?: t.ScrapeMetadata, logger?: t.Logger) => string | undefined;
10
+ export declare function getAttribution(link: string, metadata?: t.ScrapeMetadata, logger?: t.Logger): string | undefined;
@@ -15,6 +15,35 @@ export type SubagentExecuteParams = {
15
15
  * without relying on event ordering heuristics.
16
16
  */
17
17
  parentToolCallId?: string;
18
+ /**
19
+ * Snapshot of the parent invocation's `config.configurable` at the
20
+ * spawn-tool call site. Inherited verbatim into the child workflow's
21
+ * `configurable` so host-set fields (`requestBody`, `user`,
22
+ * `userMCPAuthMap`, etc.) propagate — fixing MCP body-placeholder
23
+ * substitution and per-user lookups for subagent tool calls.
24
+ *
25
+ * Inheritance details (verified empirically against LangGraph):
26
+ * - host-set keys propagate as-is into the child's tool dispatches;
27
+ * - `thread_id` propagates (with `childRunId` as a fallback when
28
+ * parent did not supply one) — matches the "subagent is part of
29
+ * the same conversation" mental model and aligns with the
30
+ * `sessionId: this.parentRunId` convention this executor already
31
+ * uses for `SubagentStart` / `SubagentStop` hooks;
32
+ * - `parent_run_id` propagates when the host put it on parent's
33
+ * configurable;
34
+ * - `run_id` is *overwritten by the LangGraph runtime* at child
35
+ * invoke time regardless of what we forward — child's tool
36
+ * dispatches see the child graph's runtime runId in
37
+ * `configurable.run_id`, not the parent's. Hosts that need
38
+ * parent-scoped run identity for downstream consumers should
39
+ * plumb it via a host-defined key (e.g. `requestBody.messageId`),
40
+ * not `run_id`.
41
+ *
42
+ * A future revision will likely make this inheritance configurable
43
+ * per spawn type — background / async subagents may want isolation
44
+ * rather than sharing parent's host context.
45
+ */
46
+ parentConfigurable?: Record<string, unknown>;
18
47
  };
19
48
  export type SubagentExecuteResult = {
20
49
  content: string;
@@ -10,7 +10,6 @@ import type { StandardGraph, MultiAgentGraph } from '@/graphs';
10
10
  import type { ClientOptions } from '@/types/llm';
11
11
  import type { RunStep, RunStepDeltaEvent, MessageDeltaEvent, ReasoningDeltaEvent } from '@/types/stream';
12
12
  import type { TokenCounter } from '@/types/run';
13
- import type { SystemCacheBlock, AgentCacheTTL } from '@/types/agent-cache';
14
13
  /** Interface for bound model with stream and invoke methods */
15
14
  export interface ChatModel {
16
15
  stream?: (messages: BaseMessage[], config?: RunnableConfig) => Promise<AsyncIterable<AIMessageChunk>>;
@@ -264,11 +263,10 @@ export type GraphEdge = {
264
263
  /**
265
264
  * EdgeType.HANDOFF — one-way routing: parent emits an `lc_transfer_to_*`
266
265
  * tool call and exits, child takes over and responds directly to the
267
- * user. Aligns with the standard handoff semantics.
266
+ * user. Aligns with upstream's handoff semantics.
268
267
  * EdgeType.DIRECT — fixed graph edges for automatic sequential / parallel
269
- * transitions. Downstream consumers may layer additional wiring on top
270
- * (fan-in with prompt, parallel groups, approval-gate nodes,
271
- * excludeResults / agentMessages).
268
+ * transitions. Ranger preserves its enriched wiring (fan-in with prompt,
269
+ * parallel groups, ApprovalGateNode, excludeResults / agentMessages).
272
270
  */
273
271
  edgeType?: import('@/common').EdgeType;
274
272
  /**
@@ -459,7 +457,7 @@ export interface SummarizationConfig {
459
457
  */
460
458
  initialSummary?: string;
461
459
  /**
462
- * optional fields. When the host wants the summarization
460
+ * Upstream-aligned optional fields. When the host wants the summarization
463
461
  * pass to run on a different LLM than the agent's own (e.g. a cheaper
464
462
  * model for compaction), these provider/model overrides flow through to
465
463
  * the summarize callback.
@@ -569,36 +567,10 @@ export interface AgentInputs {
569
567
  toolMap?: ToolMap;
570
568
  tools?: GraphTools;
571
569
  provider: Providers;
572
- /**
573
- * Ordered list of cacheable system content blocks emitted BEFORE
574
- * `instructions` in the system message. Each block gets its own cache
575
- * marker (cachePoint on Bedrock, cache_control on Anthropic) so the
576
- * cache key for each block includes only the bytes up to and including
577
- * its own marker. Entries are emitted in array order — earlier =
578
- * stabler = wider cache key (best for cross-tenant sharing).
579
- *
580
- * See `src/types/agent-cache.ts` for full semantics. Capped at
581
- * `MAX_SYSTEM_CACHE_BLOCKS` (2) entries to stay within Bedrock's
582
- * 4-cachePoint budget after the tools array consumes 2.
583
- */
584
- system_cache_blocks?: SystemCacheBlock[];
585
- /**
586
- * Stable/cacheable system instructions for this agent. Always emitted
587
- * with its own trailing cache marker (when caching is supported by
588
- * the provider/model). Use `instructions_cache_ttl` to override the
589
- * default '5m' TTL.
590
- */
591
570
  instructions?: string;
592
- /** TTL for the trailing `instructions` cache marker. Defaults to '5m'. */
593
- instructions_cache_ttl?: AgentCacheTTL;
594
571
  streamBuffer?: number;
595
572
  maxContextTokens?: number;
596
573
  clientOptions?: ClientOptions;
597
- /**
598
- * Dynamic system tail appended after the cacheable instructions
599
- * without any cache marker. Per-user / per-message context belongs
600
- * here so it does not invalidate the cacheable prefix.
601
- */
602
574
  additional_instructions?: string;
603
575
  reasoningKey?: 'reasoning_content' | 'reasoning';
604
576
  /**
@@ -623,9 +595,9 @@ export interface AgentInputs {
623
595
  tokenCount: number;
624
596
  };
625
597
  /**
626
- * opt-in for summarization. When false, the agent never
598
+ * Upstream-aligned opt-in for summarization. When false, the agent never
627
599
  * invokes the summarize callback regardless of context utilization.
628
- * Defaults to undefined (treated as enabled by default to preserve prior
600
+ * Defaults to undefined (treated as enabled in Ranger to preserve prior
629
601
  * behaviour); hosts that want strict opt-in semantics should set it
630
602
  * explicitly.
631
603
  */
@@ -689,6 +661,30 @@ export interface AgentInputs {
689
661
  * @see SummarizationConfig
690
662
  */
691
663
  summarizationConfig?: SummarizationConfig;
664
+ /**
665
+ * Workspace-shared system-message tiers. Each entry becomes a separate
666
+ * text block in the SystemMessage with its own cachePoint / cache_control
667
+ * marker, allowing the platform-tier bytes (e.g. shared branding, tool
668
+ * routing rules, code-executor instructions) to be hashed independently
669
+ * from the per-agent `instructions` block. Hosts that don't use tiered
670
+ * caching can leave this undefined; behavior falls back to the legacy
671
+ * single SystemMessage.
672
+ *
673
+ * Anthropic / Bedrock prompt-cache lookups are forward-prefix-hash, so
674
+ * blocks are emitted in array order BEFORE `instructions`. Up to 4 blocks
675
+ * are supported (the LLM cap on cache breakpoints).
676
+ */
677
+ system_cache_blocks?: Array<{
678
+ text: string;
679
+ ttl?: '5m' | '1h';
680
+ }>;
681
+ /**
682
+ * TTL hint for the per-agent `instructions` block's cache marker.
683
+ * Defaults to '5m' (matching addCacheControl message-level behavior).
684
+ * Only consulted when `system_cache_blocks` is set; otherwise the
685
+ * legacy SystemMessage path is unchanged.
686
+ */
687
+ instructions_cache_ttl?: '5m' | '1h';
692
688
  /**
693
689
  * Lightweight file manifest for the conversation.
694
690
  * Contains file IDs, names, and metadata — NOT full content.
@@ -1,4 +1,3 @@
1
- export * from './agent-cache';
2
1
  export * from './graph';
3
2
  export * from './llm';
4
3
  export * from './messages';
@@ -4,7 +4,7 @@ export type AnthropicMessages = Array<AnthropicMessage | BaseMessage>;
4
4
  export type AnthropicMessage = Anthropic.MessageParam;
5
5
  /**
6
6
  * Per-message ref metadata stamped onto a `ToolMessage` at execution time
7
- * (PR #117). Read by `annotateMessagesForLLM` to apply transient
7
+ * (upstream PR #117). Read by `annotateMessagesForLLM` to apply transient
8
8
  * annotation to a copy of the message right before it goes on the wire to
9
9
  * the provider. Never read after the run-scoped registry has been cleared.
10
10
  *
@@ -62,9 +62,7 @@ export interface AgentStateChannels {
62
62
  messages: BaseMessage[];
63
63
  next: string;
64
64
  [key: string]: unknown;
65
- /** Stable/cacheable system instructions for this agent. */
66
65
  instructions?: string;
67
- /** Dynamic system tail appended after stable instructions. */
68
66
  additional_instructions?: string;
69
67
  }
70
68
  export interface Member {
@@ -121,7 +119,7 @@ export type RunConfig = {
121
119
  */
122
120
  hooks?: HookRegistry;
123
121
  /**
124
- * Tool output reference configuration (PRs #114 / #117).
122
+ * Tool output reference configuration (upstream PRs #114 / #117).
125
123
  * When `enabled` is true, the Run constructs a single
126
124
  * ToolOutputReferenceRegistry and threads it to every ToolNode built by
127
125
  * the graph so `{{tool<i>turn<n>}}` placeholders resolve across agents.
@@ -60,13 +60,13 @@ export type ToolNodeOptions = {
60
60
  /**
61
61
  * Maximum characters for a single tool result (head+tail truncation).
62
62
  * When omitted, derived from the agent's `maxContextTokens` (30%
63
- * heuristic), capped at HARD_MAX_TOOL_RESULT_CHARS. —
64
- * downstream consumers may drive truncation through other knobs;
65
- * accepting this option keeps the test surface portable.
63
+ * heuristic), capped at HARD_MAX_TOOL_RESULT_CHARS. Upstream-aligned
64
+ * Ranger's truncation today is driven by other knobs, but accepting
65
+ * this option keeps the test surface portable.
66
66
  */
67
67
  maxToolResultChars?: number;
68
68
  /**
69
- * Run-scoped tool output reference configuration (PR #114).
69
+ * Run-scoped tool output reference configuration (upstream PR #114).
70
70
  * When `enabled` is true, ToolNode registers successful outputs and
71
71
  * substitutes `{{tool<i>turn<n>}}` placeholders found in string args.
72
72
  * Ignored when `toolOutputRegistry` is also provided (the host-supplied
@@ -123,15 +123,6 @@ export type FileRef = {
123
123
  path?: string;
124
124
  /** Session ID this file belongs to (for multi-session file tracking) */
125
125
  session_id?: string;
126
- /**
127
- * `true` when the codeapi sandbox echoed this entry as an unchanged
128
- * passthrough of an input the caller already owns (skill files,
129
- * downloaded inputs whose hash matched the baseline, inherited
130
- * `.dirkeep` markers). The tool-result formatter renders these as
131
- * "Available files" rather than "Generated files" so the LLM doesn't
132
- * conflate infrastructure inputs with newly-produced outputs.
133
- */
134
- inherited?: true;
135
126
  };
136
127
  export type FileRefs = FileRef[];
137
128
  export type ExecuteResult = {
@@ -255,7 +246,7 @@ export type ToolExecuteResult = {
255
246
  /** Map of tool names to tool definitions */
256
247
  export type LCToolRegistry = Map<string, LCTool>;
257
248
  /**
258
- * Configuration for the tool output reference feature (PR #114).
249
+ * Configuration for the tool output reference feature (upstream PR #114).
259
250
  *
260
251
  * When `enabled: true`, ToolNode stores each successful tool output under
261
252
  * a stable key `tool<idx>turn<turn>` and the LLM can pipe a previous output
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@illuma-ai/agents",
3
- "version": "1.5.1",
3
+ "version": "2.1.1",
4
4
  "main": "./dist/cjs/main.cjs",
5
5
  "module": "./dist/esm/main.mjs",
6
6
  "types": "./dist/types/index.d.ts",
@@ -9,66 +9,6 @@
9
9
  "import": "./dist/esm/main.mjs",
10
10
  "require": "./dist/cjs/main.cjs",
11
11
  "types": "./dist/types/index.d.ts"
12
- },
13
- "./langchain": {
14
- "import": "./dist/esm/langchain/index.mjs",
15
- "require": "./dist/cjs/langchain/index.cjs",
16
- "types": "./dist/types/langchain/index.d.ts"
17
- },
18
- "./langchain/language_models/chat_models": {
19
- "import": "./dist/esm/langchain/language_models/chat_models.mjs",
20
- "require": "./dist/cjs/langchain/language_models/chat_models.cjs",
21
- "types": "./dist/types/langchain/language_models/chat_models.d.ts"
22
- },
23
- "./langchain/messages": {
24
- "import": "./dist/esm/langchain/messages.mjs",
25
- "require": "./dist/cjs/langchain/messages.cjs",
26
- "types": "./dist/types/langchain/messages.d.ts"
27
- },
28
- "./langchain/messages/tool": {
29
- "import": "./dist/esm/langchain/messages/tool.mjs",
30
- "require": "./dist/cjs/langchain/messages/tool.cjs",
31
- "types": "./dist/types/langchain/messages/tool.d.ts"
32
- },
33
- "./langchain/google-common": {
34
- "import": "./dist/esm/langchain/google-common.mjs",
35
- "require": "./dist/cjs/langchain/google-common.cjs",
36
- "types": "./dist/types/langchain/google-common.d.ts"
37
- },
38
- "./langchain/openai": {
39
- "import": "./dist/esm/langchain/openai.mjs",
40
- "require": "./dist/cjs/langchain/openai.cjs",
41
- "types": "./dist/types/langchain/openai.d.ts"
42
- },
43
- "./langchain/prompts": {
44
- "import": "./dist/esm/langchain/prompts.mjs",
45
- "require": "./dist/cjs/langchain/prompts.cjs",
46
- "types": "./dist/types/langchain/prompts.d.ts"
47
- },
48
- "./langchain/runnables": {
49
- "import": "./dist/esm/langchain/runnables.mjs",
50
- "require": "./dist/cjs/langchain/runnables.cjs",
51
- "types": "./dist/types/langchain/runnables.d.ts"
52
- },
53
- "./langchain/tools": {
54
- "import": "./dist/esm/langchain/tools.mjs",
55
- "require": "./dist/cjs/langchain/tools.cjs",
56
- "types": "./dist/types/langchain/tools.d.ts"
57
- },
58
- "./langchain/utils/env": {
59
- "import": "./dist/esm/langchain/utils/env.mjs",
60
- "require": "./dist/cjs/langchain/utils/env.cjs",
61
- "types": "./dist/types/langchain/utils/env.d.ts"
62
- }
63
- },
64
- "typesVersions": {
65
- "*": {
66
- "langchain": [
67
- "dist/types/langchain/index.d.ts"
68
- ],
69
- "langchain/*": [
70
- "dist/types/langchain/*"
71
- ]
72
12
  }
73
13
  },
74
14
  "type": "module",