@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
@@ -58,18 +58,9 @@ export declare class AgentContext {
58
58
  toolDefinitions?: t.LCTool[];
59
59
  /** Set of tool names discovered via tool search (to be loaded) */
60
60
  discoveredToolNames: Set<string>;
61
- /**
62
- * Cacheable system content blocks emitted before `instructions`. Each
63
- * gets its own cache marker (cachePoint on Bedrock, cache_control on
64
- * Anthropic). Earlier entries = wider cache key (best for cross-tenant
65
- * sharing). See `src/types/agent-cache.ts`.
66
- */
67
- systemCacheBlocks?: t.SystemCacheBlock[];
68
- /** Stable/cacheable instructions for this agent (gets trailing marker). */
61
+ /** Instructions for this agent */
69
62
  instructions?: string;
70
- /** TTL for the trailing instructions cache marker. Defaults to '5m'. */
71
- instructionsCacheTtl?: t.AgentCacheTTL;
72
- /** Dynamic system tail (per-user / per-message — never cached). */
63
+ /** Additional instructions for this agent */
73
64
  additionalInstructions?: string;
74
65
  /**
75
66
  * Dynamic context that changes per-request (e.g., current time, user info).
@@ -129,13 +120,25 @@ export declare class AgentContext {
129
120
  summarizationConfig?: t.SummarizationConfig;
130
121
  /** Lightweight file manifest for file-aware compaction (IDs and names only, no content) */
131
122
  fileManifest?: t.FileManifestEntry[];
123
+ /**
124
+ * Workspace-shared system-message tiers. When set, each entry becomes a
125
+ * separate text block in the SystemMessage with its own cachePoint /
126
+ * cache_control marker, BEFORE the per-agent `instructions` block.
127
+ * See {@link t.AgentInputs.system_cache_blocks} for full semantics.
128
+ */
129
+ systemCacheBlocks?: Array<{
130
+ text: string;
131
+ ttl?: '5m' | '1h';
132
+ }>;
133
+ /** TTL hint for the per-agent instructions cache marker. Defaults to '5m'. */
134
+ instructionsCacheTtl?: '5m' | '1h';
132
135
  /** Original AgentInputs used to create this context — used for self-spawn subagent resolution. */
133
136
  _sourceInputs?: t.AgentInputs;
134
137
  /** Subagent configurations for hierarchical delegation. */
135
138
  subagentConfigs?: t.SubagentConfig[];
136
139
  /** Maximum subagent nesting depth. */
137
140
  maxSubagentDepth?: number;
138
- constructor({ agentId, name, description, provider, clientOptions, maxContextTokens, streamBuffer, tokenCounter, tools, toolMap, toolRegistry, toolDefinitions, systemCacheBlocks, instructions, instructionsCacheTtl, additionalInstructions, dynamicContext, reasoningKey, toolEnd, instructionTokens, useLegacyContent, structuredOutput, discoveredTools, summarizeCallback, persistedSummary, summarizationConfig, fileManifest, }: {
141
+ constructor({ agentId, name, description, provider, clientOptions, maxContextTokens, streamBuffer, tokenCounter, tools, toolMap, toolRegistry, toolDefinitions, instructions, additionalInstructions, dynamicContext, reasoningKey, toolEnd, instructionTokens, useLegacyContent, structuredOutput, discoveredTools, summarizeCallback, persistedSummary, summarizationConfig, fileManifest, systemCacheBlocks, instructionsCacheTtl, }: {
139
142
  agentId: string;
140
143
  name?: string;
141
144
  description?: string;
@@ -148,9 +151,7 @@ export declare class AgentContext {
148
151
  toolMap?: t.ToolMap;
149
152
  toolRegistry?: t.LCToolRegistry;
150
153
  toolDefinitions?: t.LCTool[];
151
- systemCacheBlocks?: t.SystemCacheBlock[];
152
154
  instructions?: string;
153
- instructionsCacheTtl?: t.AgentCacheTTL;
154
155
  additionalInstructions?: string;
155
156
  dynamicContext?: string;
156
157
  reasoningKey?: 'reasoning_content' | 'reasoning';
@@ -163,6 +164,11 @@ export declare class AgentContext {
163
164
  persistedSummary?: string;
164
165
  summarizationConfig?: t.SummarizationConfig;
165
166
  fileManifest?: t.FileManifestEntry[];
167
+ systemCacheBlocks?: Array<{
168
+ text: string;
169
+ ttl?: '5m' | '1h';
170
+ }>;
171
+ instructionsCacheTtl?: '5m' | '1h';
166
172
  });
167
173
  /**
168
174
  * Checks if structured output mode is enabled for this agent.
@@ -213,75 +219,18 @@ export declare class AgentContext {
213
219
  */
214
220
  initializeSystemRunnable(): void;
215
221
  /**
216
- * Builds the cacheable instructions string (without creating SystemMessage).
217
- * Includes agent identity preamble, the agent's static instructions, and
218
- * programmatic-only tool documentation. This is the part of the system
219
- * message that stays byte-stable across turns and across users for the
220
- * same agent — the prompt cache prefix.
221
- *
222
- * Per-user/per-message dynamic context belongs in
223
- * `buildDynamicInstructionsString()` so it does not invalidate the cache
224
- * marker. (See `feedback_cache_stability_invariant` for the rule.)
222
+ * Builds the raw instructions string (without creating SystemMessage).
223
+ * Includes agent identity preamble and handoff context when available.
225
224
  */
226
- private buildStableInstructionsString;
227
- /**
228
- * Builds the dynamic system-tail string (without creating SystemMessage).
229
- * Keep this out of prompt-cache-marked content so volatile per-call
230
- * context does not invalidate the stable prefix.
231
- *
232
- * `additional_instructions` is treated as dynamic (per-user/per-message
233
- * memory, runtime context, etc.) and intentionally excluded from the
234
- * cacheable prefix.
235
- */
236
- private buildDynamicInstructionsString;
225
+ private buildInstructionsString;
237
226
  /**
238
227
  * Builds the agent identity preamble including handoff context if present.
239
228
  * This helps the agent understand its role in the multi-agent workflow.
240
229
  */
241
230
  private buildIdentityPreamble;
242
231
  /**
243
- * True when Anthropic prompt caching is enabled for this agent.
244
- * Used by `buildSystemRunnable` to decide whether to emit a cache_control
245
- * marker on the stable instructions prefix.
246
- */
247
- private hasAnthropicPromptCache;
248
- /**
249
- * True when Bedrock prompt caching is enabled for this agent AND the
250
- * configured model supports `cachePoint` blocks. Only Claude (and Nova)
251
- * models on Bedrock honour cachePoint — Llama / Titan reject it.
252
- *
253
- * Used by `buildSystemRunnable` to inline a `cachePoint` block right
254
- * after the stable system text so the system prefix is cached at the
255
- * AWS account level (cross-user, cross-conversation).
256
- */
257
- private hasBedrockPromptCache;
258
- /**
259
- * Build system runnable from cacheable blocks + the trailing
260
- * `instructions` block + optional dynamic tail.
261
- *
262
- * ┌──────────────────────────────────────────┐
263
- * │ system_cache_blocks[0].text │ ← consumer-defined block 0
264
- * ├──── cache marker (TTL = blocks[0].ttl) ──┤
265
- * │ system_cache_blocks[1].text │ ← consumer-defined block 1
266
- * ├──── cache marker (TTL = blocks[1].ttl) ──┤
267
- * │ instructions │ ← per-agent stable
268
- * ├──── cache marker (TTL = instructionsCacheTtl) ┤
269
- * │ additional_instructions │ ← dynamic (uncached)
270
- * └──────────────────────────────────────────┘
271
- *
272
- * If `system_cache_blocks` is empty, behavior reduces to the 2-tier
273
- * (instructions + dynamic) path used by simpler consumers.
274
- *
275
- * Provider-specific cache marker:
276
- * - Anthropic: `cache_control: { type: 'ephemeral', ttl?: '1h'|'5m' }` on
277
- * each cacheable text block. Up to 4 cache breakpoints per workspace.
278
- * - Bedrock (Claude/Nova): a `{ cachePoint: { type: 'default', ttl?: '1h'|'5m' } }`
279
- * block inserted after each cacheable section. Up to 4 cachePoints per
280
- * request, of which the tools array can consume up to 2.
281
- *
282
- * Cache key composition: every byte from message start to a given cache
283
- * marker forms that marker's cache key. Earlier blocks = wider cache key
284
- * = more cross-tenant share. Place the most stable content first.
232
+ * Build system runnable from pre-built instructions string.
233
+ * Only called when content has actually changed.
285
234
  */
286
235
  private buildSystemRunnable;
287
236
  /**
@@ -292,25 +241,6 @@ export declare class AgentContext {
292
241
  * Update the token count map with instruction tokens
293
242
  */
294
243
  updateTokenMapWithInstructions(baseTokenMap: Record<string, number>): void;
295
- /** Active tool definitions for token accounting (excludes deferred-and-undiscovered entries
296
- * and definitions whose `allowed_callers` exclude `'direct'`). Mirrors the gate
297
- * `getEventDrivenToolsForBinding` applies so accounting and binding stay aligned. */
298
- private getActiveToolDefinitions;
299
- /**
300
- * Single source of truth for "which entries of `this.tools` should be
301
- * treated as actually bound". Callers:
302
- * - `getToolsForBinding` (non-event-driven branch)
303
- * - `getEventDrivenToolsForBinding` (appends instance tools alongside
304
- * schema-only definitions)
305
- * - `calculateInstructionTokens` (counts schema bytes for accounting)
306
- *
307
- * In event-driven mode (`toolDefinitions` present) instance tools are
308
- * appended unfiltered; outside event-driven mode they pass through
309
- * `filterToolsForBinding`. Centralizing the decision here prevents the
310
- * accounting/binding paths from drifting apart, which was the root
311
- * cause of the original miscount (Fixes #121).
312
- */
313
- private getEffectiveInstanceTools;
314
244
  /**
315
245
  * Calculate tool tokens and add to instruction tokens
316
246
  * Note: System message tokens are calculated during systemRunnable creation
@@ -82,19 +82,19 @@ export declare enum Providers {
82
82
  }
83
83
  export declare enum EdgeType {
84
84
  /**
85
- * handoff: one-way routing where the parent agent exits
85
+ * Upstream-aligned handoff: one-way routing where the parent agent exits
86
86
  * via a `lc_transfer_to_<destination>` tool call, the child takes over,
87
87
  * and the child responds directly to the user. Replaces what used to be
88
- * called "TRANSFER" in older versions; the parent-calls-child
88
+ * called "TRANSFER" in earlier Ranger versions; the parent-calls-child
89
89
  * supervisor pattern (formerly `EdgeType.HANDOFF`) is gone — use the
90
90
  * Subagent primitive (Tier 5) for deep delegation instead.
91
91
  */
92
92
  HANDOFF = "handoff",
93
93
  /**
94
- * Fixed graph edges for automatic transitions. Standard naming.
95
- * Downstream consumers may layer additional wiring on top of this edge
96
- * type: fan-in with prompt + {results}, parallel groups, approval-gate
97
- * node insertion, and the `excludeResults` agentMessages channel.
94
+ * Fixed graph edges for automatic transitions. Naming matches upstream.
95
+ * Ranger keeps its enriched wiring on top of this edge type:
96
+ * fan-in with prompt + {results}, parallel groups, ApprovalGateNode
97
+ * insertion, and the `excludeResults` agentMessages channel.
98
98
  */
99
99
  DIRECT = "direct"
100
100
  }
@@ -149,15 +149,15 @@ export declare enum Callback {
149
149
  export declare enum Constants {
150
150
  OFFICIAL_CODE_BASEURL = "https://api.illuma.ai/v1",
151
151
  EXECUTE_CODE = "execute_code",
152
- /** Tool name for the bash execution primitive (Tier 3). */
152
+ /** Tool name for the bash execution primitive (upstream Tier 3). */
153
153
  BASH_TOOL = "execute_bash",
154
- /** Tool name for the bash programmatic-tool-calling variant (Tier 3). */
154
+ /** Tool name for the bash programmatic-tool-calling variant (upstream Tier 3). */
155
155
  BASH_PROGRAMMATIC_TOOL_CALLING = "run_tools_with_bash",
156
- /** Tool name for the read-file primitive (Tier 3). */
156
+ /** Tool name for the read-file primitive (upstream Tier 3). */
157
157
  READ_FILE = "read_file",
158
- /** Tool name for the SkillTool primitive (Tier 2). */
158
+ /** Tool name for the SkillTool primitive (upstream Tier 2). */
159
159
  SKILL_TOOL = "skill",
160
- /** Tool name for the Subagent primitive (Tier 5). */
160
+ /** Tool name for the Subagent primitive (upstream Tier 5). */
161
161
  SUBAGENT = "subagent",
162
162
  TOOL_SEARCH = "tool_search",
163
163
  PROGRAMMATIC_TOOL_CALLING = "run_tools_with_code",
@@ -219,6 +219,6 @@ export declare enum MessageTypes {
219
219
  /**
220
220
  * Tool names that use the code execution environment (shared session, file
221
221
  * tracking). Used by ToolNode to inject session context + file refs into
222
- * `invokeParams` before tool execution. constant.
222
+ * `invokeParams` before tool execution. Upstream-aligned constant.
223
223
  */
224
224
  export declare const CODE_EXECUTION_TOOLS: ReadonlySet<string>;
@@ -50,7 +50,7 @@ export declare abstract class Graph<T extends t.BaseGraphState = t.BaseGraphStat
50
50
  hookRegistry?: import('@/hooks').HookRegistry;
51
51
  /**
52
52
  * Optional tool-output reference registry threaded down from Run
53
- * (PR #114). When set, every ToolNode built by this graph
53
+ * (upstream PR #114). When set, every ToolNode built by this graph
54
54
  * stores successful outputs here and resolves `{{tool<i>turn<n>}}`
55
55
  * placeholders in args before invoking the tool.
56
56
  *
@@ -61,7 +61,7 @@ export declare abstract class Graph<T extends t.BaseGraphState = t.BaseGraphStat
61
61
  */
62
62
  toolOutputRegistry?: import('@/tools/toolOutputReferences').ToolOutputReferenceRegistry;
63
63
  /**
64
- * Run-scoped tool output reference configuration (PR #117).
64
+ * Run-scoped tool output reference configuration (upstream PR #117).
65
65
  * When `enabled` is true, the graph lazily allocates a single
66
66
  * `ToolOutputReferenceRegistry` on first `getOrCreateToolOutputRegistry()`
67
67
  * call and shares it with every ToolNode the graph compiles, so
@@ -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
  *
@@ -29,7 +29,7 @@ export interface ShouldFlushInput {
29
29
  /**
30
30
  * Pure trigger function: fires when the current context is within
31
31
  * `softThreshold + reserveFloor` tokens of the model window. Matches
32
- * the standard formula.
32
+ * upstream's formula.
33
33
  */
34
34
  export declare function shouldFlushMemory(input: ShouldFlushInput): boolean;
35
35
  export interface RunFlushParams {
@@ -10,7 +10,7 @@ import type { HookEvent, HookMatcher } from './types';
10
10
  *
11
11
  * ## Why `Map<sessionId, MatcherBucket>` and not `Record`
12
12
  *
13
- * Real consumers run thousands of parallel sessions in one Node process, and
13
+ * LibreChat runs thousands of parallel sessions in one Node process, and
14
14
  * hook registration happens inside hot paths (tool loading, agent spawning).
15
15
  * A `Record<sessionId, ...>` has to be spread on every insertion, which is
16
16
  * O(n) per call and O(n²) total for a batch of parallel registrations. A
@@ -50,7 +50,7 @@ export declare const MAX_CACHE_SIZE = 256;
50
50
  * This catches the common forms but not all. Ambiguous-alternation ReDoS
51
51
  * like `(a|a)+` is not detected. Pathologically long patterns are also
52
52
  * caught by {@link MAX_PATTERN_LENGTH}. Hosts that accept user-supplied
53
- * patterns must still validate standard.
53
+ * patterns must still validate upstream.
54
54
  */
55
55
  export declare function hasNestedQuantifier(pattern: string): boolean;
56
56
  /**
@@ -84,7 +84,7 @@ export declare function hasNestedQuantifier(pattern: string): boolean;
84
84
  * never re-enter the regex compiler.
85
85
  *
86
86
  * These are a floor, not a ceiling. Hosts that accept user-supplied
87
- * patterns should still validate standard. The design report §3.8 routes
87
+ * patterns should still validate upstream. The design report §3.8 routes
88
88
  * persistable hooks through a host-side compiler before they reach this
89
89
  * module.
90
90
  */
@@ -5,7 +5,7 @@ import type { BaseMessage } from '@langchain/core/messages';
5
5
  * These mirror the subset of Claude Code's event surface that makes sense
6
6
  * for a library context (no filesystem/CLI-specific events). See
7
7
  * `docs/hooks-design-report.md` §3.2 for the mapping to existing
8
- * `@illuma-ai/agents` emission points.
8
+ * `@librechat/agents` emission points.
9
9
  */
10
10
  export declare const HOOK_EVENTS: readonly ["RunStart", "UserPromptSubmit", "PreToolUse", "PostToolUse", "PostToolUseFailure", "PermissionDenied", "SubagentStart", "SubagentStop", "Stop", "StopFailure", "PreCompact", "PostCompact"];
11
11
  export type HookEvent = (typeof HOOK_EVENTS)[number];
@@ -35,7 +35,6 @@ export * from './nodes';
35
35
  export * from './common';
36
36
  export * from './utils';
37
37
  export type * from './types';
38
- export * from './langchain';
39
38
  export { CustomOpenAIClient } from './llm/openai';
40
39
  export { ChatOpenRouter } from './llm/openrouter';
41
40
  export type { OpenRouterReasoning, OpenRouterReasoningEffort, ChatOpenRouterCallOptions, } from './llm/openrouter';
@@ -41,65 +41,18 @@ import type { ChatBedrockConverseInput } from '@langchain/aws';
41
41
  * @see https://docs.aws.amazon.com/bedrock/latest/userguide/service-tiers-inference.html
42
42
  */
43
43
  export type ServiceTierType = 'priority' | 'default' | 'flex' | 'reserved';
44
- /**
45
- * Tool cachePoint allocation strategy.
46
- *
47
- * - 'single': one cachePoint at the END of the tools array (whole array
48
- * cached as one unit). Lightest budget use (1 cachePoint).
49
- * - 'split': split tools into groups via `toolGroupSelector`. Each
50
- * non-empty group gets its own cachePoint. Use when groups
51
- * have different volatility (e.g. stable core tools vs
52
- * volatile MCP tools). Costs more cachePoint budget.
53
- * - 'none': no cachePoint on tools array. Use when tool definitions
54
- * change every request anyway.
55
- */
56
- export type ToolCacheStrategy = 'single' | 'split' | 'none';
57
- /**
58
- * Group selector for `toolCacheStrategy: 'split'`. Receives the tool name
59
- * and returns a stable group key — tools with the same key are grouped
60
- * together. Group order in the output array follows first-encounter order.
61
- */
62
- export type ToolGroupSelector = (toolName: string) => string;
63
- /**
64
- * Default group selector — puts all tools in a single group named 'core'.
65
- * Equivalent to 'single' strategy but explicit. Consumers override this
66
- * to enable per-source grouping (e.g. by inspecting tool-name substrings
67
- * to separate stable framework tools from volatile MCP-sourced tools).
68
- */
69
- export declare const DEFAULT_TOOL_GROUP_SELECTOR: ToolGroupSelector;
70
44
  /**
71
45
  * Extended input interface with additional features:
72
46
  * - promptCache: Enable Bedrock prompt caching for tool definitions
73
47
  * - applicationInferenceProfile: Use an inference profile ARN instead of model ID
74
48
  * - serviceTier: Specify service tier (Priority, Standard, Flex, Reserved)
75
- * - toolCacheStrategy: How to allocate cachePoints across tools array
76
- * - toolGroupSelector: Group key resolver for the 'split' strategy
77
49
  */
78
50
  export interface IllumaBedrockConverseInput extends ChatBedrockConverseInput {
79
51
  /**
80
52
  * Enable Bedrock prompt caching for tool definitions.
81
- * When true, adds cachePoint marker(s) to tools array per
82
- * `toolCacheStrategy`. Defaults to 'single'.
53
+ * When true, adds cachePoint markers to tools array.
83
54
  */
84
55
  promptCache?: boolean;
85
- /**
86
- * Tool cachePoint allocation. Defaults to 'single' — one cachePoint at
87
- * the end of the tools array. Set to 'split' (with `toolGroupSelector`)
88
- * when different tool groups have different volatility.
89
- */
90
- toolCacheStrategy?: ToolCacheStrategy;
91
- /**
92
- * Group selector for 'split' strategy. Receives a tool name, returns
93
- * a stable group key. Defaults to a one-group selector (equivalent
94
- * to 'single').
95
- */
96
- toolGroupSelector?: ToolGroupSelector;
97
- /**
98
- * Additional model ID patterns to consider Bedrock-cache-supported.
99
- * Defaults are in `src/llm/bedrock/cacheSupport.ts`. Use this when
100
- * AWS adds a new model family before the next library release.
101
- */
102
- bedrockCacheModelPatterns?: readonly RegExp[];
103
56
  /**
104
57
  * Application Inference Profile ARN to use for the model.
105
58
  * For example, "arn:aws:bedrock:eu-west-1:123456789102:application-inference-profile/fm16bt65tzgx"
@@ -137,12 +90,6 @@ export declare class IllumaBedrockConverse extends ChatBedrockConverse {
137
90
  applicationInferenceProfile?: string;
138
91
  /** Service tier for model invocation */
139
92
  serviceTier?: ServiceTierType;
140
- /** Tool cachePoint allocation strategy. */
141
- toolCacheStrategy: ToolCacheStrategy;
142
- /** Group selector for 'split' strategy. */
143
- toolGroupSelector: ToolGroupSelector;
144
- /** Optional consumer extensions to the cache-supported model allowlist. */
145
- bedrockCacheModelPatterns?: readonly RegExp[];
146
93
  constructor(fields?: IllumaBedrockConverseInput);
147
94
  static lc_name(): string;
148
95
  /**
@@ -102,7 +102,7 @@ export interface XAIUsageMetadata extends OpenAIClient.Completions.CompletionUsa
102
102
  num_sources_used?: number;
103
103
  }
104
104
  export declare class ChatMoonshot extends ChatOpenAI {
105
- static lc_name(): 'IllumaMoonshot';
105
+ static lc_name(): 'LibreChatMoonshot';
106
106
  protected _convertMessages(messages: BaseMessage[]): OpenAICompletionParam[];
107
107
  _generate(messages: BaseMessage[], options: this['ParsedCallOptions'], runManager?: CallbackManagerForLLMRun): Promise<ChatResult>;
108
108
  protected _convertResponseToMessage(choice: OpenAIClient.Chat.Completions.ChatCompletion.Choice, data: OpenAIClient.Chat.Completions.ChatCompletion): AIMessage;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Citation decoration — Phase 2.
3
3
  *
4
- * Ported from a reference implementation `extensions/memory-core/src/tools.citations.ts`.
4
+ * Ported from upstream `extensions/memory-core/src/tools.citations.ts`.
5
5
  * Decorates memory_search hits with `[path#L{start}-L{end}]` markers so
6
6
  * the model can attribute claims back to specific memory files when it
7
7
  * uses them in its answer.
@@ -10,7 +10,7 @@
10
10
  * compute line ranges from the returned content block on the fly:
11
11
  * - `startLine` = 1 (line 1 of the file)
12
12
  * - `endLine` = total number of lines in the block
13
- * This matches the standard output format exactly while keeping the pg
13
+ * This matches upstream's output format exactly while keeping the pg
14
14
  * schema chunk-free.
15
15
  */
16
16
  export type MemoryCitationsMode = 'on' | 'off' | 'auto';
@@ -24,7 +24,7 @@ export interface CitationCandidate {
24
24
  citation?: string;
25
25
  }
26
26
  /**
27
- * Decorate each hit with a citation marker. Mirrors the standard behavior:
27
+ * Decorate each hit with a citation marker. Mirrors upstream's behavior:
28
28
  * appends `\n\nSource: <citation>` to the content and sets `citation`.
29
29
  * When `include=false`, clears any existing citation field.
30
30
  */
@@ -32,7 +32,7 @@ export declare function decorateCitations<T extends CitationCandidate>(hits: T[]
32
32
  /**
33
33
  * Whether citations should be emitted for this call.
34
34
  *
35
- * The reference implementation keys `auto` off the session type (direct/group/channel). In
35
+ * Upstream keys `auto` off the session type (direct/group/channel). In
36
36
  * Phase 1 we only have direct chat, so `auto` => `on`. Callers that
37
37
  * later distinguish session types can pass `mode` explicitly.
38
38
  */
@@ -19,14 +19,14 @@ export declare const DEFAULT_MEMORY_SCHEMA = "public";
19
19
  export declare const MEMORY_PHASE_NORMAL = "normal";
20
20
  export declare const MEMORY_PHASE_FLUSHING = "memory_flushing";
21
21
  /**
22
- * Search defaults — aligned with the standard defaults.
22
+ * Search defaults — aligned with upstream's upstream defaults.
23
23
  *
24
24
  * Sources:
25
- * - `reference` → maxResults=6
26
- * - `reference` → maxInjectedChars=4000
25
+ * - `upstream reference` → maxResults=6
26
+ * - `upstream reference` → maxInjectedChars=4000
27
27
  *
28
- * Keeping these in lockstep with means the mandatory-recall tool
29
- * description, budget clamps, and eval corpora line up with the standard
28
+ * Keeping these in lockstep with upstream means the mandatory-recall tool
29
+ * description, budget clamps, and eval corpora line up with upstream's
30
30
  * tuning — we inherit their calibration instead of re-tuning from scratch.
31
31
  */
32
32
  export declare const DEFAULT_MAX_SEARCH_RESULTS = 6;
@@ -36,11 +36,11 @@ export declare const DEFAULT_MAX_INJECTED_CHARS = 4000;
36
36
  export declare const HYBRID_VECTOR_WEIGHT = 0.7;
37
37
  export declare const HYBRID_TEXT_WEIGHT = 0.3;
38
38
  /**
39
- * Phase 2 rerank defaults — ported from a reference implementation.
39
+ * Phase 2 rerank defaults — ported from upstream.
40
40
  *
41
41
  * Sources:
42
- * - `reference` → lambda=0.7
43
- * - `reference` → halfLifeDays=30
42
+ * - `upstream reference` → lambda=0.7
43
+ * - `upstream reference` → halfLifeDays=30
44
44
  *
45
45
  * Both features are opt-in (enabled=false by default) — the Phase 2
46
46
  * features are layered on top of hybrid search and don't change default
@@ -53,11 +53,11 @@ export declare const DEFAULT_TEMPORAL_DECAY_HALF_LIFE_DAYS = 30;
53
53
  export declare const DEFAULT_RECALL_TRACKING_ENABLED = false;
54
54
  export declare const DEFAULT_CITATIONS_MODE: "auto";
55
55
  /**
56
- * Flush trigger margins (token counts) — aligned with standard.
56
+ * Flush trigger margins (token counts) — aligned with upstream upstream.
57
57
  *
58
58
  * Sources:
59
- * - `reference` → softThreshold=4000
60
- * - `reference` → reserveFloor=20000
59
+ * - `upstream reference` → softThreshold=4000
60
+ * - `upstream reference` → reserveFloor=20000
61
61
  */
62
62
  export declare const DEFAULT_FLUSH_SOFT_THRESHOLD_TOKENS = 4000;
63
63
  export declare const DEFAULT_FLUSH_RESERVE_FLOOR_TOKENS = 20000;
@@ -67,7 +67,7 @@ export declare const DEFAULT_MAX_APPENDS_PER_FLUSH = 20;
67
67
  * Hard cap on agentic loop iterations inside {@link runMemoryFlush}.
68
68
  *
69
69
  * Each iteration = one model.invoke() followed by execution of any
70
- * `memory_append` tool_calls it emits. Mirrors the standard flush-plan
70
+ * `memory_append` tool_calls it emits. Mirrors upstream's flush-plan
71
71
  * loop cap; 8 is enough for ~2–3 reflections of batched notes while
72
72
  * protecting against runaway cycles if the model refuses to stop.
73
73
  */
@@ -82,21 +82,21 @@ export declare const MEMORY_APPEND_TOOL_NAME = "memory_append";
82
82
  * Mandatory-recall description — the single most load-bearing line in the
83
83
  * whole memory system. Do not soften, shorten, or reword without an eval run.
84
84
  *
85
- * Ported VERBATIM from a reference implementation `extensions/memory-core/src/tools.ts:186`.
85
+ * Ported VERBATIM from upstream `extensions/memory-core/src/tools.ts:186`.
86
86
  * The wiki/corpus clause is retained even though Phase 1 doesn't ship
87
- * compiled-wiki supplements — keeping the string identical means the standard
87
+ * compiled-wiki supplements — keeping the string identical means upstream's
88
88
  * eval corpora remain drop-in valid.
89
89
  */
90
90
  export declare const MEMORY_SEARCH_DESCRIPTION: string;
91
91
  /**
92
- * Ported VERBATIM from a reference implementation `extensions/memory-core/src/tools.ts:322`.
92
+ * Ported VERBATIM from upstream `extensions/memory-core/src/tools.ts:322`.
93
93
  */
94
94
  export declare const MEMORY_GET_DESCRIPTION: string;
95
95
  /**
96
96
  * `memory_append` tool description.
97
97
  *
98
98
  * Phase 1 historically wrote to a single date-keyed file
99
- * (`memory/YYYY-MM-DD.md`), ported verbatim from a reference implementation. That scheme
99
+ * (`memory/YYYY-MM-DD.md`), ported verbatim from upstream. That scheme
100
100
  * is now replaced by an 8-path canonical whitelist — see
101
101
  * {@link ./paths.MEMORY_ALL_PATHS}. The tool description no longer
102
102
  * names a specific file; the flush-turn prompt renders the full rubric
@@ -105,7 +105,7 @@ export declare const MEMORY_GET_DESCRIPTION: string;
105
105
  export declare const MEMORY_APPEND_DESCRIPTION: string;
106
106
  /**
107
107
  * Reply token that signals the flush turn produced no user-visible output.
108
- * Ported VERBATIM from a reference implementation `src/auto-reply/tokens.ts:4`.
108
+ * Ported VERBATIM from upstream `src/auto-reply/tokens.ts:4`.
109
109
  */
110
110
  export declare const SILENT_REPLY_TOKEN = "NO_REPLY";
111
111
  /**
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Maximal Marginal Relevance (MMR) re-ranking — Phase 2.
3
3
  *
4
- * Ported from a reference implementation `extensions/memory-core/src/memory/mmr.ts` with
4
+ * Ported from upstream `extensions/memory-core/src/memory/mmr.ts` with
5
5
  * minor adaptation for our `MemoryEntry` shape (content vs snippet, id vs
6
6
  * path+startLine). Behavior is identical: normalize scores, iteratively
7
7
  * pick the item that maximizes `λ * relevance - (1-λ) * max_similarity`
@@ -10,9 +10,9 @@
10
10
  * @see Carbonell & Goldstein, "The Use of MMR, Diversity-Based Reranking" (1998)
11
11
  */
12
12
  export interface MMRConfig {
13
- /** Opt-in. Default is false. */
13
+ /** Opt-in. Upstream default is false. */
14
14
  enabled: boolean;
15
- /** 0 = max diversity, 1 = max relevance. Default 0.7. */
15
+ /** 0 = max diversity, 1 = max relevance. Upstream default 0.7. */
16
16
  lambda: number;
17
17
  }
18
18
  export declare const DEFAULT_MMR_CONFIG: MMRConfig;
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * ## Why a whitelist?
10
10
  *
11
- * Earlier historical designs used date-keyed files
11
+ * Earlier upstream-faithful designs used date-keyed files
12
12
  * (`memory/YYYY-MM-DD.md`), which have three problems for a persistent
13
13
  * multi-user agent:
14
14
  *
@@ -1,14 +1,14 @@
1
1
  /**
2
2
  * Temporal decay — Phase 2.
3
3
  *
4
- * Ported from a reference implementation `extensions/memory-core/src/memory/temporal-decay.ts`.
4
+ * Ported from upstream `extensions/memory-core/src/memory/temporal-decay.ts`.
5
5
  * Ages dated memory files (`memory/YYYY-MM-DD.md`) using exponential decay
6
6
  * `multiplier = exp(-ln(2) / halfLifeDays * ageInDays)`. At half-life, the
7
7
  * score is exactly halved.
8
8
  *
9
9
  * Evergreen files (MEMORY.md, memory/topics.md, any non-dated file inside
10
10
  * memory/) do NOT decay — they represent durable knowledge and should stay
11
- * hot regardless of age. This mirrors the standard `isEvergreenMemoryPath`.
11
+ * hot regardless of age. This mirrors upstream's `isEvergreenMemoryPath`.
12
12
  *
13
13
  * Since our pgvector rows carry `createdAt`, we don't need filesystem stat
14
14
  * fallback — the row timestamp is authoritative for any file without a
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Autonomous memory — core types.
3
3
  *
4
- * Ported from the reference implementation's memory-core pattern, adapted for Postgres + pgvector
4
+ * Ported from upstream's memory-core pattern, adapted for Postgres + pgvector
5
5
  * and shaped so a future graph-backend layer (Graphiti, Neo4j agent-memory, etc.)
6
6
  * can be added alongside the vector store without changing the tool contracts.
7
7
  *
@@ -75,7 +75,7 @@ export interface MemorySearchOptions {
75
75
  minScore?: number;
76
76
  /**
77
77
  * Phase 2 toggles — when the backend supports them. Each is independently
78
- * opt-in; all false = Phase 1 behavior.
78
+ * opt-in; all false = upstream Phase 1 behavior.
79
79
  */
80
80
  mmr?: {
81
81
  enabled?: boolean;
@@ -144,7 +144,7 @@ export interface MemoryConfig {
144
144
  search?: {
145
145
  maxResults?: number;
146
146
  maxInjectedChars?: number;
147
- /** Phase 2 — enable MMR reranking (defaults when true). */
147
+ /** Phase 2 — enable MMR reranking (upstream-aligned defaults when true). */
148
148
  mmr?: {
149
149
  enabled?: boolean;
150
150
  lambda?: number;
@@ -83,9 +83,6 @@ interface LangChainMessage {
83
83
  * @returns - The formatted LangChain message.
84
84
  */
85
85
  export declare const formatFromLangChain: (message: LangChainMessage) => Record<string, any>;
86
- interface FormatAgentMessagesOptions {
87
- provider?: Providers;
88
- }
89
86
  /**
90
87
  * Groups content parts by agent and formats them with agent labels
91
88
  * This preprocesses multi-agent content to prevent identity confusion
@@ -110,10 +107,10 @@ export declare const labelContentByAgent: (contentParts: MessageContentComplex[]
110
107
  * When SkillTool is invoked, the body is injected as a HumanMessage into LangGraph state
111
108
  * but NOT persisted to conversation history. On follow-up runs the skill body is lost.
112
109
  * Pass `skills` to reconstruct the HumanMessage at the right position after each skill
113
- * ToolMessage. PRs #96 / #97.
110
+ * ToolMessage. Upstream PRs #96 / #97.
114
111
  * @returns - Object containing formatted messages and updated indexTokenCountMap if provided.
115
112
  */
116
- export declare const formatAgentMessages: (payload: TPayload, indexTokenCountMap?: Record<number, number | undefined>, tools?: Set<string>, skills?: Map<string, string>, options?: FormatAgentMessagesOptions) => {
113
+ export declare const formatAgentMessages: (payload: TPayload, indexTokenCountMap?: Record<number, number | undefined>, tools?: Set<string>, skills?: Map<string, string>) => {
117
114
  messages: Array<HumanMessage | AIMessage | SystemMessage | ToolMessage>;
118
115
  indexTokenCountMap?: Record<number, number>;
119
116
  };