@illuma-ai/agents 1.5.0 → 1.5.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 (404) hide show
  1. package/dist/cjs/agents/AgentContext.cjs +2 -2
  2. package/dist/cjs/agents/AgentContext.cjs.map +1 -1
  3. package/dist/cjs/common/enum.cjs +12 -12
  4. package/dist/cjs/common/enum.cjs.map +1 -1
  5. package/dist/cjs/graphs/Graph.cjs +5 -5
  6. package/dist/cjs/graphs/Graph.cjs.map +1 -1
  7. package/dist/cjs/graphs/MultiAgentGraph.cjs +1 -1
  8. package/dist/cjs/graphs/MultiAgentGraph.cjs.map +1 -1
  9. package/dist/cjs/graphs/phases/memoryFlushPhase.cjs +1 -1
  10. package/dist/cjs/graphs/phases/memoryFlushPhase.cjs.map +1 -1
  11. package/dist/cjs/hooks/HookRegistry.cjs +1 -1
  12. package/dist/cjs/hooks/HookRegistry.cjs.map +1 -1
  13. package/dist/cjs/hooks/matchers.cjs +2 -2
  14. package/dist/cjs/hooks/matchers.cjs.map +1 -1
  15. package/dist/cjs/hooks/types.cjs +1 -1
  16. package/dist/cjs/hooks/types.cjs.map +1 -1
  17. package/dist/cjs/llm/bedrock/cacheSupport.cjs +1 -1
  18. package/dist/cjs/llm/bedrock/cacheSupport.cjs.map +1 -1
  19. package/dist/cjs/llm/bedrock/index.cjs +2 -2
  20. package/dist/cjs/llm/bedrock/index.cjs.map +1 -1
  21. package/dist/cjs/llm/openai/index.cjs +1 -1
  22. package/dist/cjs/llm/openai/index.cjs.map +1 -1
  23. package/dist/cjs/llm/openai/utils/index.cjs +2 -2
  24. package/dist/cjs/llm/openai/utils/index.cjs.map +1 -1
  25. package/dist/cjs/memory/citations.cjs +4 -4
  26. package/dist/cjs/memory/citations.cjs.map +1 -1
  27. package/dist/cjs/memory/constants.cjs +17 -17
  28. package/dist/cjs/memory/constants.cjs.map +1 -1
  29. package/dist/cjs/memory/mmr.cjs +1 -1
  30. package/dist/cjs/memory/mmr.cjs.map +1 -1
  31. package/dist/cjs/memory/paths.cjs +1 -1
  32. package/dist/cjs/memory/paths.cjs.map +1 -1
  33. package/dist/cjs/memory/recallTracking.cjs +3 -3
  34. package/dist/cjs/memory/recallTracking.cjs.map +1 -1
  35. package/dist/cjs/memory/temporalDecay.cjs +2 -2
  36. package/dist/cjs/memory/temporalDecay.cjs.map +1 -1
  37. package/dist/cjs/messages/format.cjs +3 -3
  38. package/dist/cjs/messages/format.cjs.map +1 -1
  39. package/dist/cjs/tools/CodeExecutor.cjs +4 -3
  40. package/dist/cjs/tools/CodeExecutor.cjs.map +1 -1
  41. package/dist/cjs/tools/ToolNode.cjs +5 -5
  42. package/dist/cjs/tools/ToolNode.cjs.map +1 -1
  43. package/dist/cjs/tools/memory/memoryAppendTool.cjs +1 -1
  44. package/dist/cjs/tools/memory/memoryAppendTool.cjs.map +1 -1
  45. package/dist/cjs/tools/memory/memoryGetTool.cjs +2 -2
  46. package/dist/cjs/tools/memory/memoryGetTool.cjs.map +1 -1
  47. package/dist/cjs/tools/memory/memorySearchTool.cjs +3 -3
  48. package/dist/cjs/tools/memory/memorySearchTool.cjs.map +1 -1
  49. package/dist/cjs/tools/memory/shared.cjs +1 -1
  50. package/dist/cjs/tools/memory/shared.cjs.map +1 -1
  51. package/dist/cjs/types/agent-cache.cjs +6 -5
  52. package/dist/cjs/types/agent-cache.cjs.map +1 -1
  53. package/dist/cjs/types/graph.cjs.map +1 -1
  54. package/dist/esm/agents/AgentContext.mjs +2 -2
  55. package/dist/esm/agents/AgentContext.mjs.map +1 -1
  56. package/dist/esm/common/enum.mjs +12 -12
  57. package/dist/esm/common/enum.mjs.map +1 -1
  58. package/dist/esm/graphs/Graph.mjs +5 -5
  59. package/dist/esm/graphs/Graph.mjs.map +1 -1
  60. package/dist/esm/graphs/MultiAgentGraph.mjs +1 -1
  61. package/dist/esm/graphs/MultiAgentGraph.mjs.map +1 -1
  62. package/dist/esm/graphs/phases/memoryFlushPhase.mjs +1 -1
  63. package/dist/esm/graphs/phases/memoryFlushPhase.mjs.map +1 -1
  64. package/dist/esm/hooks/HookRegistry.mjs +1 -1
  65. package/dist/esm/hooks/HookRegistry.mjs.map +1 -1
  66. package/dist/esm/hooks/matchers.mjs +2 -2
  67. package/dist/esm/hooks/matchers.mjs.map +1 -1
  68. package/dist/esm/hooks/types.mjs +1 -1
  69. package/dist/esm/hooks/types.mjs.map +1 -1
  70. package/dist/esm/llm/bedrock/cacheSupport.mjs +1 -1
  71. package/dist/esm/llm/bedrock/cacheSupport.mjs.map +1 -1
  72. package/dist/esm/llm/bedrock/index.mjs +2 -2
  73. package/dist/esm/llm/bedrock/index.mjs.map +1 -1
  74. package/dist/esm/llm/openai/index.mjs +1 -1
  75. package/dist/esm/llm/openai/index.mjs.map +1 -1
  76. package/dist/esm/llm/openai/utils/index.mjs +2 -2
  77. package/dist/esm/llm/openai/utils/index.mjs.map +1 -1
  78. package/dist/esm/memory/citations.mjs +4 -4
  79. package/dist/esm/memory/citations.mjs.map +1 -1
  80. package/dist/esm/memory/constants.mjs +17 -17
  81. package/dist/esm/memory/constants.mjs.map +1 -1
  82. package/dist/esm/memory/mmr.mjs +1 -1
  83. package/dist/esm/memory/mmr.mjs.map +1 -1
  84. package/dist/esm/memory/paths.mjs +1 -1
  85. package/dist/esm/memory/paths.mjs.map +1 -1
  86. package/dist/esm/memory/recallTracking.mjs +3 -3
  87. package/dist/esm/memory/recallTracking.mjs.map +1 -1
  88. package/dist/esm/memory/temporalDecay.mjs +2 -2
  89. package/dist/esm/memory/temporalDecay.mjs.map +1 -1
  90. package/dist/esm/messages/format.mjs +3 -3
  91. package/dist/esm/messages/format.mjs.map +1 -1
  92. package/dist/esm/tools/CodeExecutor.mjs +4 -3
  93. package/dist/esm/tools/CodeExecutor.mjs.map +1 -1
  94. package/dist/esm/tools/ToolNode.mjs +5 -5
  95. package/dist/esm/tools/ToolNode.mjs.map +1 -1
  96. package/dist/esm/tools/memory/memoryAppendTool.mjs +1 -1
  97. package/dist/esm/tools/memory/memoryAppendTool.mjs.map +1 -1
  98. package/dist/esm/tools/memory/memoryGetTool.mjs +2 -2
  99. package/dist/esm/tools/memory/memoryGetTool.mjs.map +1 -1
  100. package/dist/esm/tools/memory/memorySearchTool.mjs +3 -3
  101. package/dist/esm/tools/memory/memorySearchTool.mjs.map +1 -1
  102. package/dist/esm/tools/memory/shared.mjs +1 -1
  103. package/dist/esm/tools/memory/shared.mjs.map +1 -1
  104. package/dist/esm/types/agent-cache.mjs +6 -5
  105. package/dist/esm/types/agent-cache.mjs.map +1 -1
  106. package/dist/esm/types/graph.mjs.map +1 -1
  107. package/dist/types/agents/AgentContext.d.ts +1 -1
  108. package/dist/types/common/enum.d.ts +12 -12
  109. package/dist/types/graphs/Graph.d.ts +2 -2
  110. package/dist/types/graphs/phases/memoryFlushPhase.d.ts +2 -2
  111. package/dist/types/hooks/HookRegistry.d.ts +1 -1
  112. package/dist/types/hooks/matchers.d.ts +2 -2
  113. package/dist/types/hooks/types.d.ts +1 -1
  114. package/dist/types/llm/bedrock/cacheSupport.d.ts +1 -1
  115. package/dist/types/llm/bedrock/index.d.ts +2 -2
  116. package/dist/types/llm/openai/index.d.ts +1 -1
  117. package/dist/types/memory/citations.d.ts +4 -4
  118. package/dist/types/memory/constants.d.ts +17 -17
  119. package/dist/types/memory/mmr.d.ts +3 -3
  120. package/dist/types/memory/paths.d.ts +1 -1
  121. package/dist/types/memory/temporalDecay.d.ts +2 -2
  122. package/dist/types/memory/types.d.ts +3 -3
  123. package/dist/types/messages/format.d.ts +1 -1
  124. package/dist/types/tools/ToolNode.d.ts +3 -3
  125. package/dist/types/tools/memory/shared.d.ts +1 -1
  126. package/dist/types/types/agent-cache.d.ts +6 -5
  127. package/dist/types/types/graph.d.ts +7 -6
  128. package/dist/types/types/messages.d.ts +1 -1
  129. package/dist/types/types/run.d.ts +1 -1
  130. package/dist/types/types/tools.d.ts +5 -5
  131. package/package.json +1 -1
  132. package/src/agents/AgentContext.ts +2 -2
  133. package/src/agents/__tests__/AgentContext.crossAgentTier1.live.test.ts +5 -3
  134. package/src/agents/__tests__/AgentContext.test.ts +1 -1
  135. package/src/common/__tests__/enum.test.ts +1 -1
  136. package/src/common/enum.ts +12 -12
  137. package/src/graphs/Graph.ts +5 -5
  138. package/src/graphs/MultiAgentGraph.ts +1 -1
  139. package/src/graphs/gapFeatures.test.ts +1 -1
  140. package/src/graphs/phases/__tests__/memoryFlushPhase.test.ts +1 -1
  141. package/src/graphs/phases/memoryFlushPhase.ts +2 -2
  142. package/src/hooks/HookRegistry.ts +1 -1
  143. package/src/hooks/index.ts +1 -1
  144. package/src/hooks/matchers.ts +2 -2
  145. package/src/hooks/types.ts +1 -1
  146. package/src/llm/anthropic/utils/server-tool-inputs.test.ts +7 -7
  147. package/src/llm/bedrock/__tests__/bedrock-caching.test.ts +2 -2
  148. package/src/llm/bedrock/cacheSupport.ts +1 -1
  149. package/src/llm/bedrock/index.ts +2 -2
  150. package/src/llm/openai/index.ts +2 -2
  151. package/src/llm/openai/utils/index.ts +2 -2
  152. package/src/memory/citations.ts +4 -4
  153. package/src/memory/constants.ts +17 -17
  154. package/src/memory/mmr.ts +3 -3
  155. package/src/memory/paths.ts +1 -1
  156. package/src/memory/recallTracking.ts +3 -3
  157. package/src/memory/temporalDecay.ts +2 -2
  158. package/src/memory/types.ts +3 -3
  159. package/src/messages/cache.test.ts +1 -1
  160. package/src/messages/ensureThinkingBlock.test.ts +1 -1
  161. package/src/messages/format.ts +4 -4
  162. package/src/messages/formatAgentMessages.test.ts +1 -1
  163. package/src/scripts/subagent-event-driven-debug.ts +2 -2
  164. package/src/specs/anthropic.simple.test.ts +1 -1
  165. package/src/specs/prune.orphans.test.ts +1 -1
  166. package/src/tools/CodeExecutor.ts +4 -3
  167. package/src/tools/ToolNode.ts +6 -6
  168. package/src/tools/__tests__/CodeExecutor.test.ts +3 -3
  169. package/src/tools/memory/memoryAppendTool.ts +1 -1
  170. package/src/tools/memory/memoryGetTool.ts +2 -2
  171. package/src/tools/memory/memorySearchTool.ts +3 -3
  172. package/src/tools/memory/shared.ts +1 -1
  173. package/src/types/agent-cache.ts +6 -5
  174. package/src/types/graph.ts +7 -6
  175. package/src/types/messages.ts +1 -1
  176. package/src/types/run.ts +1 -1
  177. package/src/types/tools.ts +5 -5
  178. package/dist/types/tools/search/test.d.ts +0 -1
  179. package/src/agents/AgentContext.js.map +0 -1
  180. package/src/agents/AgentContext.test.js.map +0 -1
  181. package/src/agents/__tests__/AgentContext.test.js.map +0 -1
  182. package/src/agents/__tests__/resolveStructuredOutputMode.test.js.map +0 -1
  183. package/src/common/enum.js.map +0 -1
  184. package/src/common/index.js.map +0 -1
  185. package/src/events.js.map +0 -1
  186. package/src/graphs/Graph.js.map +0 -1
  187. package/src/graphs/MultiAgentGraph.js.map +0 -1
  188. package/src/graphs/__tests__/structured-output.integration.test.js.map +0 -1
  189. package/src/graphs/__tests__/structured-output.test.js.map +0 -1
  190. package/src/graphs/contextManagement.e2e.test.js.map +0 -1
  191. package/src/graphs/contextManagement.test.js.map +0 -1
  192. package/src/graphs/handoffValidation.test.js.map +0 -1
  193. package/src/graphs/index.js.map +0 -1
  194. package/src/index.js.map +0 -1
  195. package/src/instrumentation.js.map +0 -1
  196. package/src/llm/anthropic/index.js.map +0 -1
  197. package/src/llm/anthropic/types.js.map +0 -1
  198. package/src/llm/anthropic/utils/message_inputs.js.map +0 -1
  199. package/src/llm/anthropic/utils/message_outputs.js.map +0 -1
  200. package/src/llm/anthropic/utils/output_parsers.js.map +0 -1
  201. package/src/llm/anthropic/utils/tools.js.map +0 -1
  202. package/src/llm/bedrock/__tests__/bedrock-caching.test.js.map +0 -1
  203. package/src/llm/bedrock/index.js.map +0 -1
  204. package/src/llm/bedrock/types.js.map +0 -1
  205. package/src/llm/bedrock/utils/index.js.map +0 -1
  206. package/src/llm/bedrock/utils/message_inputs.js.map +0 -1
  207. package/src/llm/bedrock/utils/message_outputs.js.map +0 -1
  208. package/src/llm/fake.js.map +0 -1
  209. package/src/llm/google/index.js.map +0 -1
  210. package/src/llm/google/types.js.map +0 -1
  211. package/src/llm/google/utils/common.js.map +0 -1
  212. package/src/llm/google/utils/tools.js.map +0 -1
  213. package/src/llm/google/utils/zod_to_genai_parameters.js.map +0 -1
  214. package/src/llm/openai/index.js.map +0 -1
  215. package/src/llm/openai/types.js.map +0 -1
  216. package/src/llm/openai/utils/index.js.map +0 -1
  217. package/src/llm/openai/utils/isReasoningModel.test.js.map +0 -1
  218. package/src/llm/openrouter/index.js.map +0 -1
  219. package/src/llm/openrouter/reasoning.test.js.map +0 -1
  220. package/src/llm/providers.js.map +0 -1
  221. package/src/llm/text.js.map +0 -1
  222. package/src/llm/vertexai/index.js.map +0 -1
  223. package/src/messages/__tests__/tools.test.js.map +0 -1
  224. package/src/messages/cache.js.map +0 -1
  225. package/src/messages/cache.test.js.map +0 -1
  226. package/src/messages/content.js.map +0 -1
  227. package/src/messages/content.test.js.map +0 -1
  228. package/src/messages/core.js.map +0 -1
  229. package/src/messages/ensureThinkingBlock.test.js.map +0 -1
  230. package/src/messages/format.js.map +0 -1
  231. package/src/messages/formatAgentMessages.test.js.map +0 -1
  232. package/src/messages/formatAgentMessages.tools.test.js.map +0 -1
  233. package/src/messages/formatMessage.test.js.map +0 -1
  234. package/src/messages/ids.js.map +0 -1
  235. package/src/messages/index.js.map +0 -1
  236. package/src/messages/labelContentByAgent.test.js.map +0 -1
  237. package/src/messages/prune.js.map +0 -1
  238. package/src/messages/reducer.js.map +0 -1
  239. package/src/messages/shiftIndexTokenCountMap.test.js.map +0 -1
  240. package/src/messages/summarize.js.map +0 -1
  241. package/src/messages/summarize.test.js.map +0 -1
  242. package/src/messages/tools.js.map +0 -1
  243. package/src/mockStream.js.map +0 -1
  244. package/src/prompts/collab.js.map +0 -1
  245. package/src/prompts/index.js.map +0 -1
  246. package/src/prompts/taskmanager.js.map +0 -1
  247. package/src/run.js.map +0 -1
  248. package/src/schemas/index.js.map +0 -1
  249. package/src/schemas/schema-preparation.test.js.map +0 -1
  250. package/src/schemas/validate.js.map +0 -1
  251. package/src/schemas/validate.test.js.map +0 -1
  252. package/src/scripts/abort.js.map +0 -1
  253. package/src/scripts/ant_web_search.js.map +0 -1
  254. package/src/scripts/ant_web_search_edge_case.js.map +0 -1
  255. package/src/scripts/ant_web_search_error_edge_case.js.map +0 -1
  256. package/src/scripts/args.js.map +0 -1
  257. package/src/scripts/bedrock-cache-debug.js.map +0 -1
  258. package/src/scripts/bedrock-content-aggregation-test.js.map +0 -1
  259. package/src/scripts/bedrock-merge-test.js.map +0 -1
  260. package/src/scripts/bedrock-parallel-tools-test.js.map +0 -1
  261. package/src/scripts/caching.js.map +0 -1
  262. package/src/scripts/cli.js.map +0 -1
  263. package/src/scripts/cli2.js.map +0 -1
  264. package/src/scripts/cli3.js.map +0 -1
  265. package/src/scripts/cli4.js.map +0 -1
  266. package/src/scripts/cli5.js.map +0 -1
  267. package/src/scripts/code_exec.js.map +0 -1
  268. package/src/scripts/code_exec_files.js.map +0 -1
  269. package/src/scripts/code_exec_multi_session.js.map +0 -1
  270. package/src/scripts/code_exec_ptc.js.map +0 -1
  271. package/src/scripts/code_exec_session.js.map +0 -1
  272. package/src/scripts/code_exec_simple.js.map +0 -1
  273. package/src/scripts/content.js.map +0 -1
  274. package/src/scripts/empty_input.js.map +0 -1
  275. package/src/scripts/handoff-test.js.map +0 -1
  276. package/src/scripts/image.js.map +0 -1
  277. package/src/scripts/memory.js.map +0 -1
  278. package/src/scripts/multi-agent-chain.js.map +0 -1
  279. package/src/scripts/multi-agent-conditional.js.map +0 -1
  280. package/src/scripts/multi-agent-document-review-chain.js.map +0 -1
  281. package/src/scripts/multi-agent-hybrid-flow.js.map +0 -1
  282. package/src/scripts/multi-agent-parallel-start.js.map +0 -1
  283. package/src/scripts/multi-agent-parallel.js.map +0 -1
  284. package/src/scripts/multi-agent-sequence.js.map +0 -1
  285. package/src/scripts/multi-agent-supervisor.js.map +0 -1
  286. package/src/scripts/multi-agent-test.js.map +0 -1
  287. package/src/scripts/parallel-asymmetric-tools-test.js.map +0 -1
  288. package/src/scripts/parallel-full-metadata-test.js.map +0 -1
  289. package/src/scripts/parallel-tools-test.js.map +0 -1
  290. package/src/scripts/programmatic_exec.js.map +0 -1
  291. package/src/scripts/programmatic_exec_agent.js.map +0 -1
  292. package/src/scripts/search.js.map +0 -1
  293. package/src/scripts/sequential-full-metadata-test.js.map +0 -1
  294. package/src/scripts/simple.js.map +0 -1
  295. package/src/scripts/single-agent-metadata-test.js.map +0 -1
  296. package/src/scripts/stream.js.map +0 -1
  297. package/src/scripts/test-custom-prompt-key.js.map +0 -1
  298. package/src/scripts/test-handoff-input.js.map +0 -1
  299. package/src/scripts/test-handoff-preamble.js.map +0 -1
  300. package/src/scripts/test-handoff-steering.js.map +0 -1
  301. package/src/scripts/test-multi-agent-list-handoff.js.map +0 -1
  302. package/src/scripts/test-parallel-agent-labeling.js.map +0 -1
  303. package/src/scripts/test-parallel-handoffs.js.map +0 -1
  304. package/src/scripts/test-thinking-handoff-bedrock.js.map +0 -1
  305. package/src/scripts/test-thinking-handoff.js.map +0 -1
  306. package/src/scripts/test-thinking-to-thinking-handoff-bedrock.js.map +0 -1
  307. package/src/scripts/test-tool-before-handoff-role-order.js.map +0 -1
  308. package/src/scripts/test-tools-before-handoff.js.map +0 -1
  309. package/src/scripts/test_code_api.js.map +0 -1
  310. package/src/scripts/thinking-bedrock.js.map +0 -1
  311. package/src/scripts/thinking-vertexai.js.map +0 -1
  312. package/src/scripts/thinking.js.map +0 -1
  313. package/src/scripts/tool_search.js.map +0 -1
  314. package/src/scripts/tools.js.map +0 -1
  315. package/src/specs/agent-handoffs-bedrock.integration.test.js.map +0 -1
  316. package/src/specs/agent-handoffs.test.js.map +0 -1
  317. package/src/specs/anthropic.simple.test.js.map +0 -1
  318. package/src/specs/azure.simple.test.js.map +0 -1
  319. package/src/specs/cache.simple.test.js.map +0 -1
  320. package/src/specs/custom-event-await.test.js.map +0 -1
  321. package/src/specs/deepseek.simple.test.js.map +0 -1
  322. package/src/specs/emergency-prune.test.js.map +0 -1
  323. package/src/specs/moonshot.simple.test.js.map +0 -1
  324. package/src/specs/observability.integration.test.js.map +0 -1
  325. package/src/specs/openai.simple.test.js.map +0 -1
  326. package/src/specs/openrouter.simple.test.js.map +0 -1
  327. package/src/specs/prune.test.js.map +0 -1
  328. package/src/specs/reasoning.test.js.map +0 -1
  329. package/src/specs/spec.utils.js.map +0 -1
  330. package/src/specs/thinking-handoff.test.js.map +0 -1
  331. package/src/specs/thinking-prune.test.js.map +0 -1
  332. package/src/specs/token-distribution-edge-case.test.js.map +0 -1
  333. package/src/specs/token-memoization.test.js.map +0 -1
  334. package/src/specs/tokens.test.js.map +0 -1
  335. package/src/specs/tool-error.test.js.map +0 -1
  336. package/src/splitStream.js.map +0 -1
  337. package/src/splitStream.test.js.map +0 -1
  338. package/src/stream.js.map +0 -1
  339. package/src/stream.test.js.map +0 -1
  340. package/src/test/mockTools.js.map +0 -1
  341. package/src/tools/BrowserTools.js.map +0 -1
  342. package/src/tools/Calculator.js.map +0 -1
  343. package/src/tools/Calculator.test.js.map +0 -1
  344. package/src/tools/CodeExecutor.js.map +0 -1
  345. package/src/tools/ProgrammaticToolCalling.js.map +0 -1
  346. package/src/tools/StreamingToolCallBuffer.js.map +0 -1
  347. package/src/tools/ToolNode.js.map +0 -1
  348. package/src/tools/ToolSearch.js.map +0 -1
  349. package/src/tools/__tests__/BrowserTools.test.js.map +0 -1
  350. package/src/tools/__tests__/ProgrammaticToolCalling.integration.test.js.map +0 -1
  351. package/src/tools/__tests__/ProgrammaticToolCalling.test.js.map +0 -1
  352. package/src/tools/__tests__/StreamingToolCallBuffer.test.js.map +0 -1
  353. package/src/tools/__tests__/ToolApproval.test.js.map +0 -1
  354. package/src/tools/__tests__/ToolNode.recovery.test.js.map +0 -1
  355. package/src/tools/__tests__/ToolNode.session.test.js.map +0 -1
  356. package/src/tools/__tests__/ToolSearch.integration.test.js.map +0 -1
  357. package/src/tools/__tests__/ToolSearch.test.js.map +0 -1
  358. package/src/tools/__tests__/handlers.test.js.map +0 -1
  359. package/src/tools/__tests__/truncation-recovery.integration.test.js.map +0 -1
  360. package/src/tools/handlers.js.map +0 -1
  361. package/src/tools/schema.js.map +0 -1
  362. package/src/tools/search/anthropic.js.map +0 -1
  363. package/src/tools/search/content.js.map +0 -1
  364. package/src/tools/search/content.test.js.map +0 -1
  365. package/src/tools/search/firecrawl.js.map +0 -1
  366. package/src/tools/search/format.js.map +0 -1
  367. package/src/tools/search/highlights.js.map +0 -1
  368. package/src/tools/search/index.js.map +0 -1
  369. package/src/tools/search/jina-reranker.test.js.map +0 -1
  370. package/src/tools/search/output.md +0 -2775
  371. package/src/tools/search/rerankers.js.map +0 -1
  372. package/src/tools/search/schema.js.map +0 -1
  373. package/src/tools/search/search.js.map +0 -1
  374. package/src/tools/search/serper-scraper.js.map +0 -1
  375. package/src/tools/search/test.html +0 -884
  376. package/src/tools/search/test.js.map +0 -1
  377. package/src/tools/search/test.md +0 -643
  378. package/src/tools/search/test.ts +0 -159
  379. package/src/tools/search/tool.js.map +0 -1
  380. package/src/tools/search/types.js.map +0 -1
  381. package/src/tools/search/utils.js.map +0 -1
  382. package/src/types/graph.js.map +0 -1
  383. package/src/types/graph.test.js.map +0 -1
  384. package/src/types/index.js.map +0 -1
  385. package/src/types/llm.js.map +0 -1
  386. package/src/types/messages.js.map +0 -1
  387. package/src/types/run.js.map +0 -1
  388. package/src/types/stream.js.map +0 -1
  389. package/src/types/tools.js.map +0 -1
  390. package/src/utils/contextAnalytics.js.map +0 -1
  391. package/src/utils/contextAnalytics.test.js.map +0 -1
  392. package/src/utils/events.js.map +0 -1
  393. package/src/utils/graph.js.map +0 -1
  394. package/src/utils/handlers.js.map +0 -1
  395. package/src/utils/index.js.map +0 -1
  396. package/src/utils/llm.js.map +0 -1
  397. package/src/utils/llmConfig.js.map +0 -1
  398. package/src/utils/logging.js.map +0 -1
  399. package/src/utils/misc.js.map +0 -1
  400. package/src/utils/run.js.map +0 -1
  401. package/src/utils/schema.js.map +0 -1
  402. package/src/utils/title.js.map +0 -1
  403. package/src/utils/tokens.js.map +0 -1
  404. package/src/utils/toonFormat.js.map +0 -1
@@ -5,9 +5,9 @@ import { clampResultsByInjectedChars, buildMemorySearchUnavailableResult, Memory
5
5
  /**
6
6
  * `memory_search` — the mandatory-recall tool.
7
7
  *
8
- * Port of upstream `createMemorySearchTool` at
9
- * `upstream reference`. The tool description
10
- * is verbatim "Mandatory recall step..." from upstream — this is the load-
8
+ * Port of `createMemorySearchTool` at
9
+ * `reference`. The tool description
10
+ * is verbatim "Mandatory recall step..." from a reference implementation — this is the load-
11
11
  * bearing line that turns "the agent may recall" into "the agent will recall".
12
12
  */
13
13
  // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
@@ -1 +1 @@
1
- {"version":3,"file":"memorySearchTool.mjs","sources":["../../../../src/tools/memory/memorySearchTool.ts"],"sourcesContent":["/**\n * `memory_search` — the mandatory-recall tool.\n *\n * Port of upstream `createMemorySearchTool` at\n * `upstream reference`. The tool description\n * is verbatim \"Mandatory recall step...\" from upstream — this is the load-\n * bearing line that turns \"the agent may recall\" into \"the agent will recall\".\n */\nimport { tool } from '@langchain/core/tools';\nimport {\n MEMORY_SEARCH_DESCRIPTION,\n MEMORY_SEARCH_TOOL_NAME,\n} from '@/memory/constants';\nimport {\n buildMemorySearchUnavailableResult,\n clampResultsByInjectedChars,\n MemorySearchSchema,\n type MemorySearchToolResult,\n type MemoryToolBinding,\n} from './shared';\n\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nexport function createMemorySearchTool(binding: MemoryToolBinding) {\n return tool(\n async (args): Promise<string> => {\n try {\n const entries = await binding.backend.search(\n binding.scope,\n args.query,\n {\n maxResults: args.maxResults,\n minScore: args.minScore,\n mmr: binding.searchOptions?.mmr,\n temporalDecay: binding.searchOptions?.temporalDecay,\n citations: binding.searchOptions?.citations,\n }\n );\n const clamped = clampResultsByInjectedChars(\n entries,\n binding.maxInjectedChars\n );\n\n // [phase2-recall-tracking] debug: fire-and-forget best-effort record\n if (binding.recallTracker && clamped.length > 0) {\n void binding.recallTracker\n .record({\n agentId: binding.scope.agentId,\n query: args.query,\n hits: clamped.map((e) => ({\n id: e.id,\n path: e.path,\n score: e.score,\n })),\n })\n .catch(() => undefined);\n }\n\n const payload: MemorySearchToolResult = {\n results: clamped.map((entry) => ({\n id: entry.id,\n path: entry.path,\n content: entry.content,\n score: entry.score,\n createdAt: entry.createdAt,\n citation: entry.citation,\n })),\n };\n return JSON.stringify(payload);\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err);\n return JSON.stringify(buildMemorySearchUnavailableResult(message));\n }\n },\n {\n name: MEMORY_SEARCH_TOOL_NAME,\n description: MEMORY_SEARCH_DESCRIPTION,\n schema: MemorySearchSchema,\n }\n );\n}\n"],"names":[],"mappings":";;;;AAAA;;;;;;;AAOG;AAcH;AACM,SAAU,sBAAsB,CAAC,OAA0B,EAAA;AAC/D,IAAA,OAAO,IAAI,CACT,OAAO,IAAI,KAAqB;AAC9B,QAAA,IAAI;AACF,YAAA,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,MAAM,CAC1C,OAAO,CAAC,KAAK,EACb,IAAI,CAAC,KAAK,EACV;gBACE,UAAU,EAAE,IAAI,CAAC,UAAU;gBAC3B,QAAQ,EAAE,IAAI,CAAC,QAAQ;AACvB,gBAAA,GAAG,EAAE,OAAO,CAAC,aAAa,EAAE,GAAG;AAC/B,gBAAA,aAAa,EAAE,OAAO,CAAC,aAAa,EAAE,aAAa;AACnD,gBAAA,SAAS,EAAE,OAAO,CAAC,aAAa,EAAE,SAAS;AAC5C,aAAA,CACF;YACD,MAAM,OAAO,GAAG,2BAA2B,CACzC,OAAO,EACP,OAAO,CAAC,gBAAgB,CACzB;;YAGD,IAAI,OAAO,CAAC,aAAa,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE;gBAC/C,KAAK,OAAO,CAAC;AACV,qBAAA,MAAM,CAAC;AACN,oBAAA,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,OAAO;oBAC9B,KAAK,EAAE,IAAI,CAAC,KAAK;oBACjB,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM;wBACxB,EAAE,EAAE,CAAC,CAAC,EAAE;wBACR,IAAI,EAAE,CAAC,CAAC,IAAI;wBACZ,KAAK,EAAE,CAAC,CAAC,KAAK;AACf,qBAAA,CAAC,CAAC;iBACJ;AACA,qBAAA,KAAK,CAAC,MAAM,SAAS,CAAC;YAC3B;AAEA,YAAA,MAAM,OAAO,GAA2B;gBACtC,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,KAAK,MAAM;oBAC/B,EAAE,EAAE,KAAK,CAAC,EAAE;oBACZ,IAAI,EAAE,KAAK,CAAC,IAAI;oBAChB,OAAO,EAAE,KAAK,CAAC,OAAO;oBACtB,KAAK,EAAE,KAAK,CAAC,KAAK;oBAClB,SAAS,EAAE,KAAK,CAAC,SAAS;oBAC1B,QAAQ,EAAE,KAAK,CAAC,QAAQ;AACzB,iBAAA,CAAC,CAAC;aACJ;AACD,YAAA,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;QAChC;QAAE,OAAO,GAAG,EAAE;AACZ,YAAA,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,GAAG,GAAG,CAAC,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC;YAChE,OAAO,IAAI,CAAC,SAAS,CAAC,kCAAkC,CAAC,OAAO,CAAC,CAAC;QACpE;AACF,IAAA,CAAC,EACD;AACE,QAAA,IAAI,EAAE,uBAAuB;AAC7B,QAAA,WAAW,EAAE,yBAAyB;AACtC,QAAA,MAAM,EAAE,kBAAkB;AAC3B,KAAA,CACF;AACH;;;;"}
1
+ {"version":3,"file":"memorySearchTool.mjs","sources":["../../../../src/tools/memory/memorySearchTool.ts"],"sourcesContent":["/**\n * `memory_search` — the mandatory-recall tool.\n *\n * Port of `createMemorySearchTool` at\n * `reference`. The tool description\n * is verbatim \"Mandatory recall step...\" from a reference implementation — this is the load-\n * bearing line that turns \"the agent may recall\" into \"the agent will recall\".\n */\nimport { tool } from '@langchain/core/tools';\nimport {\n MEMORY_SEARCH_DESCRIPTION,\n MEMORY_SEARCH_TOOL_NAME,\n} from '@/memory/constants';\nimport {\n buildMemorySearchUnavailableResult,\n clampResultsByInjectedChars,\n MemorySearchSchema,\n type MemorySearchToolResult,\n type MemoryToolBinding,\n} from './shared';\n\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nexport function createMemorySearchTool(binding: MemoryToolBinding) {\n return tool(\n async (args): Promise<string> => {\n try {\n const entries = await binding.backend.search(\n binding.scope,\n args.query,\n {\n maxResults: args.maxResults,\n minScore: args.minScore,\n mmr: binding.searchOptions?.mmr,\n temporalDecay: binding.searchOptions?.temporalDecay,\n citations: binding.searchOptions?.citations,\n }\n );\n const clamped = clampResultsByInjectedChars(\n entries,\n binding.maxInjectedChars\n );\n\n // [phase2-recall-tracking] debug: fire-and-forget best-effort record\n if (binding.recallTracker && clamped.length > 0) {\n void binding.recallTracker\n .record({\n agentId: binding.scope.agentId,\n query: args.query,\n hits: clamped.map((e) => ({\n id: e.id,\n path: e.path,\n score: e.score,\n })),\n })\n .catch(() => undefined);\n }\n\n const payload: MemorySearchToolResult = {\n results: clamped.map((entry) => ({\n id: entry.id,\n path: entry.path,\n content: entry.content,\n score: entry.score,\n createdAt: entry.createdAt,\n citation: entry.citation,\n })),\n };\n return JSON.stringify(payload);\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err);\n return JSON.stringify(buildMemorySearchUnavailableResult(message));\n }\n },\n {\n name: MEMORY_SEARCH_TOOL_NAME,\n description: MEMORY_SEARCH_DESCRIPTION,\n schema: MemorySearchSchema,\n }\n );\n}\n"],"names":[],"mappings":";;;;AAAA;;;;;;;AAOG;AAcH;AACM,SAAU,sBAAsB,CAAC,OAA0B,EAAA;AAC/D,IAAA,OAAO,IAAI,CACT,OAAO,IAAI,KAAqB;AAC9B,QAAA,IAAI;AACF,YAAA,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,MAAM,CAC1C,OAAO,CAAC,KAAK,EACb,IAAI,CAAC,KAAK,EACV;gBACE,UAAU,EAAE,IAAI,CAAC,UAAU;gBAC3B,QAAQ,EAAE,IAAI,CAAC,QAAQ;AACvB,gBAAA,GAAG,EAAE,OAAO,CAAC,aAAa,EAAE,GAAG;AAC/B,gBAAA,aAAa,EAAE,OAAO,CAAC,aAAa,EAAE,aAAa;AACnD,gBAAA,SAAS,EAAE,OAAO,CAAC,aAAa,EAAE,SAAS;AAC5C,aAAA,CACF;YACD,MAAM,OAAO,GAAG,2BAA2B,CACzC,OAAO,EACP,OAAO,CAAC,gBAAgB,CACzB;;YAGD,IAAI,OAAO,CAAC,aAAa,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE;gBAC/C,KAAK,OAAO,CAAC;AACV,qBAAA,MAAM,CAAC;AACN,oBAAA,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,OAAO;oBAC9B,KAAK,EAAE,IAAI,CAAC,KAAK;oBACjB,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM;wBACxB,EAAE,EAAE,CAAC,CAAC,EAAE;wBACR,IAAI,EAAE,CAAC,CAAC,IAAI;wBACZ,KAAK,EAAE,CAAC,CAAC,KAAK;AACf,qBAAA,CAAC,CAAC;iBACJ;AACA,qBAAA,KAAK,CAAC,MAAM,SAAS,CAAC;YAC3B;AAEA,YAAA,MAAM,OAAO,GAA2B;gBACtC,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,KAAK,MAAM;oBAC/B,EAAE,EAAE,KAAK,CAAC,EAAE;oBACZ,IAAI,EAAE,KAAK,CAAC,IAAI;oBAChB,OAAO,EAAE,KAAK,CAAC,OAAO;oBACtB,KAAK,EAAE,KAAK,CAAC,KAAK;oBAClB,SAAS,EAAE,KAAK,CAAC,SAAS;oBAC1B,QAAQ,EAAE,KAAK,CAAC,QAAQ;AACzB,iBAAA,CAAC,CAAC;aACJ;AACD,YAAA,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;QAChC;QAAE,OAAO,GAAG,EAAE;AACZ,YAAA,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,GAAG,GAAG,CAAC,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC;YAChE,OAAO,IAAI,CAAC,SAAS,CAAC,kCAAkC,CAAC,OAAO,CAAC,CAAC;QACpE;AACF,IAAA,CAAC,EACD;AACE,QAAA,IAAI,EAAE,uBAAuB;AAC7B,QAAA,WAAW,EAAE,yBAAyB;AACtC,QAAA,MAAM,EAAE,kBAAkB;AAC3B,KAAA,CACF;AACH;;;;"}
@@ -69,7 +69,7 @@ function buildMemorySearchUnavailableResult(error) {
69
69
  }
70
70
  /**
71
71
  * Clamp a ranked result list to a total character budget.
72
- * Ported from upstream `tools.citations.ts::clampResultsByInjectedChars`.
72
+ * Ported from a reference implementation `tools.citations.ts::clampResultsByInjectedChars`.
73
73
  */
74
74
  function clampResultsByInjectedChars(results, maxInjectedChars = DEFAULT_MAX_INJECTED_CHARS) {
75
75
  const out = [];
@@ -1 +1 @@
1
- {"version":3,"file":"shared.mjs","sources":["../../../../src/tools/memory/shared.ts"],"sourcesContent":["/**\n * Shared Zod schemas + helpers for the memory tool family.\n *\n * The tool schemas deliberately do NOT expose `agent_id` or `user_id`. Scope\n * is captured in a closure at tool construction time by {@link buildMemoryTools},\n * so even a hallucinated tool call with extra fields cannot influence it.\n */\nimport { z } from 'zod';\nimport {\n DEFAULT_MAX_INJECTED_CHARS,\n MEMORY_PATH_PREFIX,\n} from '@/memory/constants';\nimport type {\n MemoryAppendInput,\n MemoryBackend,\n MemoryEntry,\n MemoryScope,\n} from '@/memory/types';\n\nexport const MemorySearchSchema = z.object({\n query: z.string().describe('Natural-language query to search memory for'),\n maxResults: z\n .number()\n .int()\n .min(1)\n .max(50)\n .optional()\n .describe('Maximum number of results to return (default 10)'),\n minScore: z\n .number()\n .min(0)\n .max(1)\n .optional()\n .describe('Minimum hybrid score (0..1) below which results are dropped'),\n});\n\nexport const MemoryGetSchema = z.object({\n path: z\n .string()\n .describe(\n 'Memory path, e.g. \"memory/decisions.md\". Must start with \"memory/\"'\n ),\n from: z\n .number()\n .int()\n .min(1)\n .optional()\n .describe('Starting line number (1-indexed)'),\n lines: z\n .number()\n .int()\n .min(1)\n .optional()\n .describe('Number of lines to read starting at `from`'),\n});\n\nexport const MemoryAppendSchema = z.object({\n path: z\n .string()\n .describe(\n 'Memory path to append to (e.g. \"memory/decisions.md\"). Must start with \"memory/\"'\n ),\n content: z\n .string()\n .min(1)\n .describe(\n \"Note content in the agent's own voice. Markdown allowed. Each call appends an immutable entry.\"\n ),\n});\n\nexport type MemorySearchArgs = z.infer<typeof MemorySearchSchema>;\nexport type MemoryGetArgs = z.infer<typeof MemoryGetSchema>;\nexport type MemoryAppendArgs = z.infer<typeof MemoryAppendSchema>;\n\n/** Shape returned by `memory_search` — serialised as the tool result string. */\nexport interface MemorySearchToolResult {\n results: Array<\n Pick<MemoryEntry, 'id' | 'path' | 'content' | 'score' | 'createdAt'> & {\n citation?: string;\n }\n >;\n disabled?: boolean;\n unavailable?: boolean;\n error?: string;\n warning?: string;\n action?: string;\n}\n\n/** Shape returned by `memory_get`. */\nexport interface MemoryGetToolResult {\n path: string;\n text: string;\n disabled?: boolean;\n error?: string;\n}\n\nexport function buildMemorySearchUnavailableResult(\n error: string | undefined\n): MemorySearchToolResult {\n const reason =\n (error ?? 'memory search unavailable').trim() ||\n 'memory search unavailable';\n const isQuota = /insufficient_quota|quota|429/i.test(reason);\n return {\n results: [],\n disabled: true,\n unavailable: true,\n error: reason,\n warning: isQuota\n ? 'Memory search is unavailable because the embedding provider quota is exhausted.'\n : 'Memory search is unavailable due to an embedding/provider error.',\n action: isQuota\n ? 'Top up or switch embedding provider, then retry memory_search.'\n : 'Check embedding provider configuration and retry memory_search.',\n };\n}\n\n/**\n * Clamp a ranked result list to a total character budget.\n * Ported from upstream `tools.citations.ts::clampResultsByInjectedChars`.\n */\nexport function clampResultsByInjectedChars<T extends { content: string }>(\n results: T[],\n maxInjectedChars: number = DEFAULT_MAX_INJECTED_CHARS\n): T[] {\n const out: T[] = [];\n let total = 0;\n for (const result of results) {\n const size = result.content.length ?? 0;\n if (total + size > maxInjectedChars && out.length > 0) break;\n out.push(result);\n total += size;\n }\n return out;\n}\n\nexport interface MemoryToolBinding {\n backend: MemoryBackend;\n scope: MemoryScope;\n maxInjectedChars?: number;\n /** Phase 2 — per-call search options propagated into backend.search. */\n searchOptions?: {\n mmr?: { enabled?: boolean; lambda?: number };\n temporalDecay?: { enabled?: boolean; halfLifeDays?: number };\n citations?: 'on' | 'off' | 'auto';\n };\n /** Phase 2 — optional best-effort recall recorder. */\n recallTracker?: {\n record(params: {\n agentId: string;\n query: string;\n hits: Array<{ id: string; path: string; score: number }>;\n }): Promise<void>;\n };\n}\n\nexport function assertAppendAllowed(path: string): void {\n if (!path || !path.startsWith(MEMORY_PATH_PREFIX)) {\n throw new Error(\n `memory_append path must start with \"${MEMORY_PATH_PREFIX}\"`\n );\n }\n}\n\n/** Normalise an append call into the backend input shape. */\nexport function toAppendInput(args: MemoryAppendArgs): MemoryAppendInput {\n assertAppendAllowed(args.path);\n return { path: args.path, content: args.content };\n}\n"],"names":[],"mappings":";;;AAAA;;;;;;AAMG;AAaI,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,6CAA6C,CAAC;AACzE,IAAA,UAAU,EAAE;AACT,SAAA,MAAM;AACN,SAAA,GAAG;SACH,GAAG,CAAC,CAAC;SACL,GAAG,CAAC,EAAE;AACN,SAAA,QAAQ;SACR,QAAQ,CAAC,kDAAkD,CAAC;AAC/D,IAAA,QAAQ,EAAE;AACP,SAAA,MAAM;SACN,GAAG,CAAC,CAAC;SACL,GAAG,CAAC,CAAC;AACL,SAAA,QAAQ;SACR,QAAQ,CAAC,6DAA6D,CAAC;AAC3E,CAAA;AAEM,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;AACtC,IAAA,IAAI,EAAE;AACH,SAAA,MAAM;SACN,QAAQ,CACP,oEAAoE,CACrE;AACH,IAAA,IAAI,EAAE;AACH,SAAA,MAAM;AACN,SAAA,GAAG;SACH,GAAG,CAAC,CAAC;AACL,SAAA,QAAQ;SACR,QAAQ,CAAC,kCAAkC,CAAC;AAC/C,IAAA,KAAK,EAAE;AACJ,SAAA,MAAM;AACN,SAAA,GAAG;SACH,GAAG,CAAC,CAAC;AACL,SAAA,QAAQ;SACR,QAAQ,CAAC,4CAA4C,CAAC;AAC1D,CAAA;AAEM,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;AACzC,IAAA,IAAI,EAAE;AACH,SAAA,MAAM;SACN,QAAQ,CACP,kFAAkF,CACnF;AACH,IAAA,OAAO,EAAE;AACN,SAAA,MAAM;SACN,GAAG,CAAC,CAAC;SACL,QAAQ,CACP,gGAAgG,CACjG;AACJ,CAAA;AA4BK,SAAU,kCAAkC,CAChD,KAAyB,EAAA;IAEzB,MAAM,MAAM,GACV,CAAC,KAAK,IAAI,2BAA2B,EAAE,IAAI,EAAE;AAC7C,QAAA,2BAA2B;IAC7B,MAAM,OAAO,GAAG,+BAA+B,CAAC,IAAI,CAAC,MAAM,CAAC;IAC5D,OAAO;AACL,QAAA,OAAO,EAAE,EAAE;AACX,QAAA,QAAQ,EAAE,IAAI;AACd,QAAA,WAAW,EAAE,IAAI;AACjB,QAAA,KAAK,EAAE,MAAM;AACb,QAAA,OAAO,EAAE;AACP,cAAE;AACF,cAAE,kEAAkE;AACtE,QAAA,MAAM,EAAE;AACN,cAAE;AACF,cAAE,iEAAiE;KACtE;AACH;AAEA;;;AAGG;SACa,2BAA2B,CACzC,OAAY,EACZ,mBAA2B,0BAA0B,EAAA;IAErD,MAAM,GAAG,GAAQ,EAAE;IACnB,IAAI,KAAK,GAAG,CAAC;AACb,IAAA,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE;QAC5B,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC;QACvC,IAAI,KAAK,GAAG,IAAI,GAAG,gBAAgB,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC;YAAE;AACvD,QAAA,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC;QAChB,KAAK,IAAI,IAAI;IACf;AACA,IAAA,OAAO,GAAG;AACZ;AAsBM,SAAU,mBAAmB,CAAC,IAAY,EAAA;IAC9C,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,kBAAkB,CAAC,EAAE;AACjD,QAAA,MAAM,IAAI,KAAK,CACb,uCAAuC,kBAAkB,CAAA,CAAA,CAAG,CAC7D;IACH;AACF;AAEA;AACM,SAAU,aAAa,CAAC,IAAsB,EAAA;AAClD,IAAA,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC;AAC9B,IAAA,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE;AACnD;;;;"}
1
+ {"version":3,"file":"shared.mjs","sources":["../../../../src/tools/memory/shared.ts"],"sourcesContent":["/**\n * Shared Zod schemas + helpers for the memory tool family.\n *\n * The tool schemas deliberately do NOT expose `agent_id` or `user_id`. Scope\n * is captured in a closure at tool construction time by {@link buildMemoryTools},\n * so even a hallucinated tool call with extra fields cannot influence it.\n */\nimport { z } from 'zod';\nimport {\n DEFAULT_MAX_INJECTED_CHARS,\n MEMORY_PATH_PREFIX,\n} from '@/memory/constants';\nimport type {\n MemoryAppendInput,\n MemoryBackend,\n MemoryEntry,\n MemoryScope,\n} from '@/memory/types';\n\nexport const MemorySearchSchema = z.object({\n query: z.string().describe('Natural-language query to search memory for'),\n maxResults: z\n .number()\n .int()\n .min(1)\n .max(50)\n .optional()\n .describe('Maximum number of results to return (default 10)'),\n minScore: z\n .number()\n .min(0)\n .max(1)\n .optional()\n .describe('Minimum hybrid score (0..1) below which results are dropped'),\n});\n\nexport const MemoryGetSchema = z.object({\n path: z\n .string()\n .describe(\n 'Memory path, e.g. \"memory/decisions.md\". Must start with \"memory/\"'\n ),\n from: z\n .number()\n .int()\n .min(1)\n .optional()\n .describe('Starting line number (1-indexed)'),\n lines: z\n .number()\n .int()\n .min(1)\n .optional()\n .describe('Number of lines to read starting at `from`'),\n});\n\nexport const MemoryAppendSchema = z.object({\n path: z\n .string()\n .describe(\n 'Memory path to append to (e.g. \"memory/decisions.md\"). Must start with \"memory/\"'\n ),\n content: z\n .string()\n .min(1)\n .describe(\n \"Note content in the agent's own voice. Markdown allowed. Each call appends an immutable entry.\"\n ),\n});\n\nexport type MemorySearchArgs = z.infer<typeof MemorySearchSchema>;\nexport type MemoryGetArgs = z.infer<typeof MemoryGetSchema>;\nexport type MemoryAppendArgs = z.infer<typeof MemoryAppendSchema>;\n\n/** Shape returned by `memory_search` — serialised as the tool result string. */\nexport interface MemorySearchToolResult {\n results: Array<\n Pick<MemoryEntry, 'id' | 'path' | 'content' | 'score' | 'createdAt'> & {\n citation?: string;\n }\n >;\n disabled?: boolean;\n unavailable?: boolean;\n error?: string;\n warning?: string;\n action?: string;\n}\n\n/** Shape returned by `memory_get`. */\nexport interface MemoryGetToolResult {\n path: string;\n text: string;\n disabled?: boolean;\n error?: string;\n}\n\nexport function buildMemorySearchUnavailableResult(\n error: string | undefined\n): MemorySearchToolResult {\n const reason =\n (error ?? 'memory search unavailable').trim() ||\n 'memory search unavailable';\n const isQuota = /insufficient_quota|quota|429/i.test(reason);\n return {\n results: [],\n disabled: true,\n unavailable: true,\n error: reason,\n warning: isQuota\n ? 'Memory search is unavailable because the embedding provider quota is exhausted.'\n : 'Memory search is unavailable due to an embedding/provider error.',\n action: isQuota\n ? 'Top up or switch embedding provider, then retry memory_search.'\n : 'Check embedding provider configuration and retry memory_search.',\n };\n}\n\n/**\n * Clamp a ranked result list to a total character budget.\n * Ported from a reference implementation `tools.citations.ts::clampResultsByInjectedChars`.\n */\nexport function clampResultsByInjectedChars<T extends { content: string }>(\n results: T[],\n maxInjectedChars: number = DEFAULT_MAX_INJECTED_CHARS\n): T[] {\n const out: T[] = [];\n let total = 0;\n for (const result of results) {\n const size = result.content.length ?? 0;\n if (total + size > maxInjectedChars && out.length > 0) break;\n out.push(result);\n total += size;\n }\n return out;\n}\n\nexport interface MemoryToolBinding {\n backend: MemoryBackend;\n scope: MemoryScope;\n maxInjectedChars?: number;\n /** Phase 2 — per-call search options propagated into backend.search. */\n searchOptions?: {\n mmr?: { enabled?: boolean; lambda?: number };\n temporalDecay?: { enabled?: boolean; halfLifeDays?: number };\n citations?: 'on' | 'off' | 'auto';\n };\n /** Phase 2 — optional best-effort recall recorder. */\n recallTracker?: {\n record(params: {\n agentId: string;\n query: string;\n hits: Array<{ id: string; path: string; score: number }>;\n }): Promise<void>;\n };\n}\n\nexport function assertAppendAllowed(path: string): void {\n if (!path || !path.startsWith(MEMORY_PATH_PREFIX)) {\n throw new Error(\n `memory_append path must start with \"${MEMORY_PATH_PREFIX}\"`\n );\n }\n}\n\n/** Normalise an append call into the backend input shape. */\nexport function toAppendInput(args: MemoryAppendArgs): MemoryAppendInput {\n assertAppendAllowed(args.path);\n return { path: args.path, content: args.content };\n}\n"],"names":[],"mappings":";;;AAAA;;;;;;AAMG;AAaI,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,6CAA6C,CAAC;AACzE,IAAA,UAAU,EAAE;AACT,SAAA,MAAM;AACN,SAAA,GAAG;SACH,GAAG,CAAC,CAAC;SACL,GAAG,CAAC,EAAE;AACN,SAAA,QAAQ;SACR,QAAQ,CAAC,kDAAkD,CAAC;AAC/D,IAAA,QAAQ,EAAE;AACP,SAAA,MAAM;SACN,GAAG,CAAC,CAAC;SACL,GAAG,CAAC,CAAC;AACL,SAAA,QAAQ;SACR,QAAQ,CAAC,6DAA6D,CAAC;AAC3E,CAAA;AAEM,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;AACtC,IAAA,IAAI,EAAE;AACH,SAAA,MAAM;SACN,QAAQ,CACP,oEAAoE,CACrE;AACH,IAAA,IAAI,EAAE;AACH,SAAA,MAAM;AACN,SAAA,GAAG;SACH,GAAG,CAAC,CAAC;AACL,SAAA,QAAQ;SACR,QAAQ,CAAC,kCAAkC,CAAC;AAC/C,IAAA,KAAK,EAAE;AACJ,SAAA,MAAM;AACN,SAAA,GAAG;SACH,GAAG,CAAC,CAAC;AACL,SAAA,QAAQ;SACR,QAAQ,CAAC,4CAA4C,CAAC;AAC1D,CAAA;AAEM,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;AACzC,IAAA,IAAI,EAAE;AACH,SAAA,MAAM;SACN,QAAQ,CACP,kFAAkF,CACnF;AACH,IAAA,OAAO,EAAE;AACN,SAAA,MAAM;SACN,GAAG,CAAC,CAAC;SACL,QAAQ,CACP,gGAAgG,CACjG;AACJ,CAAA;AA4BK,SAAU,kCAAkC,CAChD,KAAyB,EAAA;IAEzB,MAAM,MAAM,GACV,CAAC,KAAK,IAAI,2BAA2B,EAAE,IAAI,EAAE;AAC7C,QAAA,2BAA2B;IAC7B,MAAM,OAAO,GAAG,+BAA+B,CAAC,IAAI,CAAC,MAAM,CAAC;IAC5D,OAAO;AACL,QAAA,OAAO,EAAE,EAAE;AACX,QAAA,QAAQ,EAAE,IAAI;AACd,QAAA,WAAW,EAAE,IAAI;AACjB,QAAA,KAAK,EAAE,MAAM;AACb,QAAA,OAAO,EAAE;AACP,cAAE;AACF,cAAE,kEAAkE;AACtE,QAAA,MAAM,EAAE;AACN,cAAE;AACF,cAAE,iEAAiE;KACtE;AACH;AAEA;;;AAGG;SACa,2BAA2B,CACzC,OAAY,EACZ,mBAA2B,0BAA0B,EAAA;IAErD,MAAM,GAAG,GAAQ,EAAE;IACnB,IAAI,KAAK,GAAG,CAAC;AACb,IAAA,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE;QAC5B,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC;QACvC,IAAI,KAAK,GAAG,IAAI,GAAG,gBAAgB,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC;YAAE;AACvD,QAAA,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC;QAChB,KAAK,IAAI,IAAI;IACf;AACA,IAAA,OAAO,GAAG;AACZ;AAsBM,SAAU,mBAAmB,CAAC,IAAY,EAAA;IAC9C,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,kBAAkB,CAAC,EAAE;AACjD,QAAA,MAAM,IAAI,KAAK,CACb,uCAAuC,kBAAkB,CAAA,CAAA,CAAG,CAC7D;IACH;AACF;AAEA;AACM,SAAU,aAAa,CAAC,IAAsB,EAAA;AAClD,IAAA,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC;AAC9B,IAAA,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE;AACnD;;;;"}
@@ -9,13 +9,14 @@
9
9
  * for the active provider; consumers decide what content to put in each
10
10
  * block.
11
11
  *
12
- * Why this is generic rather than ranger-specific
12
+ * Why this is generic rather than tier-named
13
13
  * ------------------------------------------------
14
14
  * Earlier iterations exposed `platform_instructions` and `cache_ttl:
15
- * { platform, agent }` — vocabulary borrowed from a multi-tenant chat
16
- * platform's mental model. That leaked a specific consumer's domain into
17
- * the library and made it confusing for other consumers (CLI tools,
18
- * desktop apps, gateways) which have no notion of "platforms" or "agents".
15
+ * { platform, agent }` — vocabulary borrowed from a specific consumer's
16
+ * multi-tenant chat-platform mental model. That leaked one consumer's
17
+ * domain into the library and made it confusing for other consumers
18
+ * (CLI tools, desktop apps, gateways) which have no notion of
19
+ * "platforms" or "agents".
19
20
  *
20
21
  * The current shape lets every consumer define their own cache-tier
21
22
  * organization without the library knowing or caring.
@@ -1 +1 @@
1
- {"version":3,"file":"agent-cache.mjs","sources":["../../../src/types/agent-cache.ts"],"sourcesContent":["/**\n * Agent system-message prompt-cache types.\n * ==========================================\n *\n * `@illuma-ai/agents` exposes a generic primitive — `system_cache_blocks` —\n * for composing a system message that gets explicit cache markers\n * (cachePoint on Bedrock, cache_control on Anthropic) at consumer-defined\n * boundaries. The library encodes each entry into the right wire format\n * for the active provider; consumers decide what content to put in each\n * block.\n *\n * Why this is generic rather than ranger-specific\n * ------------------------------------------------\n * Earlier iterations exposed `platform_instructions` and `cache_ttl:\n * { platform, agent }` — vocabulary borrowed from a multi-tenant chat\n * platform's mental model. That leaked a specific consumer's domain into\n * the library and made it confusing for other consumers (CLI tools,\n * desktop apps, gateways) which have no notion of \"platforms\" or \"agents\".\n *\n * The current shape lets every consumer define their own cache-tier\n * organization without the library knowing or caring.\n *\n * Cache key composition\n * ---------------------\n * Both Anthropic and Bedrock hash the message bytes leading up to each\n * cache marker. So entry N's cache key is the concatenation of bytes\n * 0..N. Stable content (universal rules, framework docs) goes earlier;\n * volatile content (per-agent identity, per-tool docs) goes later. The\n * earlier entries get cross-tenant cache hits; the later entries get\n * narrower hits.\n *\n * Provider budget\n * ---------------\n * Bedrock's Converse API supports up to 4 cachePoint blocks per request.\n * The default tools-array cache strategy (see `IllumaBedrockConverse`)\n * uses up to 2 of those. So at most 2 entries should appear in\n * `system_cache_blocks` to leave budget for the trailing\n * `instructions` block. The library throws on more than 2.\n *\n * Anthropic supports up to 4 cache breakpoints per request workspace-wide;\n * the same constraint applies to keep tools + system within budget.\n */\n\n/** Provider TTL hint applied to a cachePoint / cache_control marker. */\nexport type AgentCacheTTL = '5m' | '1h';\n\n/**\n * One cacheable system content block. Each entry produces a text block\n * followed by a provider-specific cache marker in the assembled system\n * message. Entries are emitted in array order — earlier = more stable\n * = wider cache key.\n */\nexport interface SystemCacheBlock {\n /**\n * Text payload. Caller is responsible for keeping this byte-stable\n * across requests that should share a cache entry. ANY change to\n * these bytes invalidates every cache key that includes this entry.\n */\n text: string;\n /**\n * Optional TTL hint for the cache marker. Defaults to '5m' when\n * omitted. '1h' costs more to write (2× base vs 1.25×) but survives\n * longer idle, which is the right tradeoff for low-traffic blocks.\n */\n ttl?: AgentCacheTTL;\n}\n\n/**\n * Maximum number of `system_cache_blocks` entries the library accepts.\n * Higher than this would exceed Bedrock's 4-cachePoint budget once the\n * tools array and trailing `instructions` block are counted.\n */\nexport const MAX_SYSTEM_CACHE_BLOCKS = 2;\n"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCG;AA0BH;;;;AAIG;AACI,MAAM,uBAAuB,GAAG;;;;"}
1
+ {"version":3,"file":"agent-cache.mjs","sources":["../../../src/types/agent-cache.ts"],"sourcesContent":["/**\n * Agent system-message prompt-cache types.\n * ==========================================\n *\n * `@illuma-ai/agents` exposes a generic primitive — `system_cache_blocks` —\n * for composing a system message that gets explicit cache markers\n * (cachePoint on Bedrock, cache_control on Anthropic) at consumer-defined\n * boundaries. The library encodes each entry into the right wire format\n * for the active provider; consumers decide what content to put in each\n * block.\n *\n * Why this is generic rather than tier-named\n * ------------------------------------------------\n * Earlier iterations exposed `platform_instructions` and `cache_ttl:\n * { platform, agent }` — vocabulary borrowed from a specific consumer's\n * multi-tenant chat-platform mental model. That leaked one consumer's\n * domain into the library and made it confusing for other consumers\n * (CLI tools, desktop apps, gateways) which have no notion of\n * \"platforms\" or \"agents\".\n *\n * The current shape lets every consumer define their own cache-tier\n * organization without the library knowing or caring.\n *\n * Cache key composition\n * ---------------------\n * Both Anthropic and Bedrock hash the message bytes leading up to each\n * cache marker. So entry N's cache key is the concatenation of bytes\n * 0..N. Stable content (universal rules, framework docs) goes earlier;\n * volatile content (per-agent identity, per-tool docs) goes later. The\n * earlier entries get cross-tenant cache hits; the later entries get\n * narrower hits.\n *\n * Provider budget\n * ---------------\n * Bedrock's Converse API supports up to 4 cachePoint blocks per request.\n * The default tools-array cache strategy (see `IllumaBedrockConverse`)\n * uses up to 2 of those. So at most 2 entries should appear in\n * `system_cache_blocks` to leave budget for the trailing\n * `instructions` block. The library throws on more than 2.\n *\n * Anthropic supports up to 4 cache breakpoints per request workspace-wide;\n * the same constraint applies to keep tools + system within budget.\n */\n\n/** Provider TTL hint applied to a cachePoint / cache_control marker. */\nexport type AgentCacheTTL = '5m' | '1h';\n\n/**\n * One cacheable system content block. Each entry produces a text block\n * followed by a provider-specific cache marker in the assembled system\n * message. Entries are emitted in array order — earlier = more stable\n * = wider cache key.\n */\nexport interface SystemCacheBlock {\n /**\n * Text payload. Caller is responsible for keeping this byte-stable\n * across requests that should share a cache entry. ANY change to\n * these bytes invalidates every cache key that includes this entry.\n */\n text: string;\n /**\n * Optional TTL hint for the cache marker. Defaults to '5m' when\n * omitted. '1h' costs more to write (2× base vs 1.25×) but survives\n * longer idle, which is the right tradeoff for low-traffic blocks.\n */\n ttl?: AgentCacheTTL;\n}\n\n/**\n * Maximum number of `system_cache_blocks` entries the library accepts.\n * Higher than this would exceed Bedrock's 4-cachePoint budget once the\n * tools array and trailing `instructions` block are counted.\n */\nexport const MAX_SYSTEM_CACHE_BLOCKS = 2;\n"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CG;AA0BH;;;;AAIG;AACI,MAAM,uBAAuB,GAAG;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"graph.mjs","sources":["../../../src/types/graph.ts"],"sourcesContent":["// src/types/graph.ts\nimport type {\n START,\n StateType,\n UpdateType,\n StateGraph,\n StateGraphArgs,\n StateDefinition,\n CompiledStateGraph,\n BinaryOperatorAggregate,\n} from '@langchain/langgraph';\nimport type { BindToolsInput } from '@langchain/core/language_models/chat_models';\nimport type {\n BaseMessage,\n AIMessageChunk,\n SystemMessage,\n} from '@langchain/core/messages';\nimport type { RunnableConfig, Runnable } from '@langchain/core/runnables';\nimport type { ChatGenerationChunk } from '@langchain/core/outputs';\nimport type { GoogleAIToolType } from '@langchain/google-common';\nimport type {\n ToolMap,\n ToolEndEvent,\n GenericTool,\n LCTool,\n ToolApprovalConfig,\n ToolExecuteBatchRequest,\n} from '@/types/tools';\nimport type { Providers, Callback, GraphNodeKeys } from '@/common';\nimport type { StandardGraph, MultiAgentGraph } from '@/graphs';\nimport type { ClientOptions } from '@/types/llm';\nimport type {\n RunStep,\n RunStepDeltaEvent,\n MessageDeltaEvent,\n ReasoningDeltaEvent,\n} from '@/types/stream';\nimport type { TokenCounter } from '@/types/run';\nimport type { SystemCacheBlock, AgentCacheTTL } from '@/types/agent-cache';\n\n/** Interface for bound model with stream and invoke methods */\nexport interface ChatModel {\n stream?: (\n messages: BaseMessage[],\n config?: RunnableConfig\n ) => Promise<AsyncIterable<AIMessageChunk>>;\n invoke: (\n messages: BaseMessage[],\n config?: RunnableConfig\n ) => Promise<AIMessageChunk>;\n}\n\n/** Payload for ON_AGENT_TRANSITION events */\nexport type AgentTransitionEvent = {\n sourceAgentId?: string;\n sourceAgentName?: string;\n destinationAgentId: string;\n destinationAgentName: string;\n edgeType: string; // 'handoff' | 'transfer' | 'sequence'\n timestamp: number;\n /** When true, this event signals handoff completion (child → parent return) */\n isCompletion?: boolean;\n /** Duration of child agent execution in milliseconds (only on completion events) */\n durationMs?: number;\n /** Length of child agent result text in characters (only on completion events) */\n resultLength?: number;\n};\n\nexport type GraphNode = GraphNodeKeys | typeof START;\nexport type ClientCallback<T extends unknown[]> = (\n graph: StandardGraph,\n ...args: T\n) => void;\n\nexport type ClientCallbacks = {\n [Callback.TOOL_ERROR]?: ClientCallback<[Error, string]>;\n [Callback.TOOL_START]?: ClientCallback<unknown[]>;\n [Callback.TOOL_END]?: ClientCallback<unknown[]>;\n};\n\nexport type SystemCallbacks = {\n [K in keyof ClientCallbacks]: ClientCallbacks[K] extends ClientCallback<\n infer Args\n >\n ? (...args: Args) => void\n : never;\n};\n\nexport type BaseGraphState = {\n messages: BaseMessage[];\n /**\n * Structured response when using structured output mode.\n * Contains the validated JSON response conforming to the configured schema.\n */\n structuredResponse?: Record<string, unknown>;\n};\n\nexport type MultiAgentGraphState = BaseGraphState & {\n agentMessages?: BaseMessage[];\n};\n\nexport type IState = BaseGraphState;\n\nexport interface EventHandler {\n handle(\n event: string,\n data:\n | StreamEventData\n | ModelEndData\n | RunStep\n | RunStepDeltaEvent\n | MessageDeltaEvent\n | ReasoningDeltaEvent\n | SubagentUpdateEvent\n | ToolExecuteBatchRequest\n | { result: ToolEndEvent },\n metadata?: Record<string, unknown>,\n graph?: StandardGraph | MultiAgentGraph\n ): void | Promise<void>;\n}\n\nexport type GraphStateChannels<T extends BaseGraphState> =\n StateGraphArgs<T>['channels'];\n\nexport type Workflow<\n T extends BaseGraphState = BaseGraphState,\n U extends Partial<T> = Partial<T>,\n N extends string = string,\n> = StateGraph<T, U, N>;\n\nexport type CompiledWorkflow<\n T extends BaseGraphState = BaseGraphState,\n U extends Partial<T> = Partial<T>,\n N extends string = string,\n> = CompiledStateGraph<T, U, N>;\n\nexport type CompiledStateWorkflow = CompiledStateGraph<\n StateType<{\n messages: BinaryOperatorAggregate<BaseMessage[], BaseMessage[]>;\n }>,\n UpdateType<{\n messages: BinaryOperatorAggregate<BaseMessage[], BaseMessage[]>;\n }>,\n string,\n {\n messages: BinaryOperatorAggregate<BaseMessage[], BaseMessage[]>;\n },\n {\n messages: BinaryOperatorAggregate<BaseMessage[], BaseMessage[]>;\n },\n StateDefinition\n>;\n\nexport type CompiledMultiAgentWorkflow = CompiledStateGraph<\n StateType<{\n messages: BinaryOperatorAggregate<BaseMessage[], BaseMessage[]>;\n agentMessages: BinaryOperatorAggregate<BaseMessage[], BaseMessage[]>;\n }>,\n UpdateType<{\n messages: BinaryOperatorAggregate<BaseMessage[], BaseMessage[]>;\n agentMessages: BinaryOperatorAggregate<BaseMessage[], BaseMessage[]>;\n }>,\n string,\n {\n messages: BinaryOperatorAggregate<BaseMessage[], BaseMessage[]>;\n agentMessages: BinaryOperatorAggregate<BaseMessage[], BaseMessage[]>;\n },\n {\n messages: BinaryOperatorAggregate<BaseMessage[], BaseMessage[]>;\n agentMessages: BinaryOperatorAggregate<BaseMessage[], BaseMessage[]>;\n },\n StateDefinition\n>;\n\nexport type CompiledAgentWorfklow = CompiledStateGraph<\n {\n messages: BaseMessage[];\n },\n {\n messages?: BaseMessage[] | undefined;\n },\n '__start__' | `agent=${string}` | `tools=${string}`,\n {\n messages: BinaryOperatorAggregate<BaseMessage[], BaseMessage[]>;\n },\n {\n messages: BinaryOperatorAggregate<BaseMessage[], BaseMessage[]>;\n },\n StateDefinition,\n {\n [x: `agent=${string}`]: Partial<BaseGraphState>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [x: `tools=${string}`]: any;\n }\n>;\n\nexport type SystemRunnable =\n | Runnable<\n BaseMessage[],\n (BaseMessage | SystemMessage)[],\n RunnableConfig<Record<string, unknown>>\n >\n | undefined;\n\n/**\n * Optional compile options passed to workflow.compile().\n * These are intentionally untyped to avoid coupling to library internals.\n */\nexport type CompileOptions = {\n // A checkpointer instance (e.g., MemorySaver, SQL saver)\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n checkpointer?: any;\n interruptBefore?: string[];\n interruptAfter?: string[];\n /**\n * Human-in-the-loop tool approval configuration.\n * When set, tools matching the policy will trigger an interrupt()\n * before execution, pausing the graph for human approval.\n * Requires a checkpointer to be set for interrupt/resume to work.\n */\n toolApprovalConfig?: ToolApprovalConfig;\n};\n\nexport type EventStreamCallbackHandlerInput =\n Parameters<CompiledWorkflow['streamEvents']>[2] extends Omit<\n infer T,\n 'autoClose'\n >\n ? T\n : never;\n\nexport type StreamChunk =\n | (ChatGenerationChunk & {\n message: AIMessageChunk;\n })\n | AIMessageChunk;\n\n/**\n * Data associated with a StreamEvent.\n */\nexport type StreamEventData = {\n /**\n * The input passed to the runnable that generated the event.\n * Inputs will sometimes be available at the *START* of the runnable, and\n * sometimes at the *END* of the runnable.\n * If a runnable is able to stream its inputs, then its input by definition\n * won't be known until the *END* of the runnable when it has finished streaming\n * its inputs.\n */\n input?: unknown;\n /**\n * The output of the runnable that generated the event.\n * Outputs will only be available at the *END* of the runnable.\n * For most runnables, this field can be inferred from the `chunk` field,\n * though there might be some exceptions for special cased runnables (e.g., like\n * chat models), which may return more information.\n */\n output?: unknown;\n /**\n * A streaming chunk from the output that generated the event.\n * chunks support addition in general, and adding them up should result\n * in the output of the runnable that generated the event.\n */\n chunk?: StreamChunk;\n /**\n * Runnable config for invoking other runnables within handlers.\n */\n config?: RunnableConfig;\n /**\n * Custom result from the runnable that generated the event.\n */\n result?: unknown;\n /**\n * Custom field to indicate the event was manually emitted, and may have been handled already\n */\n emitted?: boolean;\n};\n\n/**\n * A streaming event.\n *\n * Schema of a streaming event which is produced from the streamEvents method.\n */\nexport type StreamEvent = {\n /**\n * Event names are of the format: on_[runnable_type]_(start|stream|end).\n *\n * Runnable types are one of:\n * - llm - used by non chat models\n * - chat_model - used by chat models\n * - prompt -- e.g., ChatPromptTemplate\n * - tool -- LangChain tools\n * - chain - most Runnables are of this type\n *\n * Further, the events are categorized as one of:\n * - start - when the runnable starts\n * - stream - when the runnable is streaming\n * - end - when the runnable ends\n *\n * start, stream and end are associated with slightly different `data` payload.\n *\n * Please see the documentation for `EventData` for more details.\n */\n event: string;\n /** The name of the runnable that generated the event. */\n name: string;\n /**\n * An randomly generated ID to keep track of the execution of the given runnable.\n *\n * Each child runnable that gets invoked as part of the execution of a parent runnable\n * is assigned its own unique ID.\n */\n run_id: string;\n /**\n * Tags associated with the runnable that generated this event.\n * Tags are always inherited from parent runnables.\n */\n tags?: string[];\n /** Metadata associated with the runnable that generated this event. */\n metadata: Record<string, unknown>;\n /**\n * Event data.\n *\n * The contents of the event data depend on the event type.\n */\n data: StreamEventData;\n};\n\nexport type GraphConfig = {\n provider: string;\n thread_id?: string;\n run_id?: string;\n};\n\nexport type PartMetadata = {\n progress?: number;\n asset_pointer?: string;\n status?: string;\n action?: boolean;\n output?: string;\n};\n\nexport type ModelEndData =\n | (StreamEventData & { output: AIMessageChunk | undefined })\n | undefined;\nexport type GraphTools = GenericTool[] | BindToolsInput[] | GoogleAIToolType[];\nexport type StandardGraphInput = {\n runId?: string;\n signal?: AbortSignal;\n agents: AgentInputs[];\n tokenCounter?: TokenCounter;\n indexTokenCountMap?: Record<string, number>;\n};\n\n/**\n * Configuration for an approval gate placed on a sequence edge.\n * When present, the graph inserts an approval gate node between the source\n * and destination agents. The gate ALWAYS fires (regardless of ExecutionContext)\n * and calls interrupt() to pause the graph for human approval.\n */\nexport type ApprovalGateConfig = {\n /** Unique identifier for this gate (used as node ID suffix) */\n gateId: string;\n /**\n * Approval channel — where the approval UI is rendered.\n * - 'chat': SSE-based chat UI (default)\n * - 'outlook': MS Graph Actionable Messages\n * - 'telegram': Telegram Bot inline keyboard\n */\n channel?: 'chat' | 'outlook' | 'telegram';\n /** Optional human-readable prompt shown to the approver */\n prompt?: string;\n /** Optional approver identifier (e.g., email, user ID) */\n approver?: string;\n /** Timeout in ms before the gate auto-expires (default: 5 minutes) */\n timeoutMs?: number;\n /** What to do on denial: 'stop' ends the graph, 'skip' skips the destination agent */\n onDeny?: 'stop' | 'skip';\n};\n\nexport type GraphEdge = {\n /** Agent ID, use a list for multiple sources */\n from: string | string[];\n /** Agent ID, use a list for multiple destinations */\n to: string | string[];\n description?: string;\n /** Can return boolean or specific destination(s) */\n condition?: (state: BaseGraphState) => boolean | string | string[];\n /**\n * EdgeType.HANDOFF — one-way routing: parent emits an `lc_transfer_to_*`\n * tool call and exits, child takes over and responds directly to the\n * user. Aligns with upstream's handoff semantics.\n * EdgeType.DIRECT — fixed graph edges for automatic sequential / parallel\n * transitions. Ranger preserves its enriched wiring (fan-in with prompt,\n * parallel groups, ApprovalGateNode, excludeResults / agentMessages).\n */\n edgeType?: import('@/common').EdgeType;\n /**\n * For sequence edges: Optional prompt to add when transitioning through this edge.\n * String prompts can include variables like {results} which will be replaced with\n * messages from startIndex onwards. When {results} is used, excludeResults defaults to true.\n *\n * For transfer edges: Description for the input parameter that the transfer tool accepts,\n * allowing the supervisor to pass specific instructions/context to the transferred agent.\n */\n prompt?:\n | string\n | ((\n messages: BaseMessage[],\n runStartIndex: number\n ) => string | Promise<string> | undefined);\n /**\n * When true, excludes messages from startIndex when adding prompt.\n * Automatically set to true when {results} variable is used in prompt.\n */\n excludeResults?: boolean;\n /**\n * For transfer edges: Customizes the parameter name for the transfer input.\n * Defaults to \"instructions\" if not specified.\n * Only applies when prompt is provided for transfer edges.\n *\n * For handoff edges: Customizes the parameter name for the handoff instruction input.\n */\n promptKey?: string;\n /**\n * Approval gate configuration for sequence edges.\n * When set, inserts an approval gate node between source and destination.\n * The gate ALWAYS fires regardless of ExecutionContext (unlike tool approval).\n */\n approvalGate?: ApprovalGateConfig;\n};\n\nexport type MultiAgentGraphInput = StandardGraphInput & {\n edges: GraphEdge[];\n /**\n * When set, the graph routes START to this agent instead of the default\n * starting nodes. Used for multi-turn resumption: the caller reads the\n * last active agent id from the previous turn (e.g. via\n * `Run.getLastActiveAgentId()`, which derives it from the run's content\n * data trail) and passes it here so follow-up messages route to the\n * agent that last handled the conversation.\n *\n * If the agent ID is invalid (not in the graph), falls back to default\n * starting nodes.\n */\n resumeFromAgentId?: string;\n};\n\n/**\n * Structured output mode determines how the agent returns structured data.\n * - 'tool': Uses tool calling to return structured output (works with all tool-calling models)\n * - 'provider': Uses provider-native structured output via LangChain's jsonMode (OpenAI, Anthropic, etc.)\n * - 'native': Uses provider's constrained decoding API directly for guaranteed schema compliance\n * (Anthropic output_config.format, OpenAI response_format.json_schema). Falls back to 'tool' for unsupported providers.\n * - 'auto': Automatically selects the best strategy — 'native' for supported providers, 'tool' for others\n */\nexport type StructuredOutputMode = 'tool' | 'provider' | 'native' | 'auto';\n\n/**\n * Resolved method used internally after mode resolution.\n * Maps to LangChain's withStructuredOutput method parameter plus our native path.\n */\nexport type ResolvedStructuredOutputMethod =\n | 'functionCalling'\n | 'jsonMode'\n | 'jsonSchema'\n | 'native'\n | undefined;\n\n/**\n * Error thrown when the model refuses to produce structured output due to safety policies.\n */\nexport class StructuredOutputRefusalError extends Error {\n constructor(public refusalText: string) {\n super(`Model refused to produce structured output: ${refusalText}`);\n this.name = 'StructuredOutputRefusalError';\n }\n}\n\n/**\n * Error thrown when the structured output response was truncated due to max_tokens.\n */\nexport class StructuredOutputTruncatedError extends Error {\n constructor(public stopReason: string) {\n super(\n `Structured output was truncated (stop_reason: ${stopReason}). ` +\n 'Increase max_tokens to allow the full JSON response to be generated.'\n );\n this.name = 'StructuredOutputTruncatedError';\n }\n}\n\n/**\n * Configuration for structured JSON output from agents.\n * When configured, the agent will return a validated JSON response\n * instead of streaming text.\n */\nexport interface StructuredOutputConfig {\n /**\n * JSON Schema defining the output structure.\n * The model will be forced to return data conforming to this schema.\n */\n schema: Record<string, unknown>;\n /**\n * Name for the structured output format (used in tool mode).\n * @default 'StructuredResponse'\n */\n name?: string;\n /**\n * Description of what the structured output represents.\n * Helps the model understand the expected format.\n */\n description?: string;\n /**\n * Output mode strategy.\n * @default 'auto'\n */\n mode?: StructuredOutputMode;\n /**\n * Enable strict schema validation.\n * When true, the response must exactly match the schema.\n * @default true\n */\n strict?: boolean;\n /**\n * Error handling configuration.\n * - true: Auto-retry on validation errors (default)\n * - false: Throw error on validation failure\n * - string: Custom error message for retry\n */\n handleErrors?: boolean | string;\n /**\n * Maximum number of retry attempts on validation failure.\n * @default 2\n */\n maxRetries?: number;\n /**\n * Include the raw AI message along with structured response.\n * Useful for debugging.\n * @default false\n */\n includeRaw?: boolean;\n}\n\n/**\n * Database/API structured output format (snake_case with enabled flag).\n * This matches the format stored in MongoDB and sent from frontends.\n */\nexport interface StructuredOutputInput {\n /** Whether structured output is enabled */\n enabled?: boolean;\n /** JSON Schema defining the expected response structure */\n schema?: Record<string, unknown>;\n /** Name identifier for the structured output */\n name?: string;\n /** Description of what the structured output represents */\n description?: string;\n /** Mode for structured output: 'tool' | 'provider' | 'native' | 'auto' */\n mode?: StructuredOutputMode;\n /** Whether to enforce strict schema validation */\n strict?: boolean;\n}\n\n/**\n * Trigger strategy for when summarization should activate.\n * - 'contextPercentage': Trigger when context utilization exceeds a threshold percentage\n * - 'messageCount': Trigger when pruned message count exceeds a threshold\n * - 'tokenThreshold': Trigger when total token count exceeds a raw threshold\n */\nexport type SummarizationTriggerType =\n | 'contextPercentage'\n | 'messageCount'\n | 'tokenThreshold';\n\n/**\n * Configuration for summarization behavior within the agent pipeline.\n * All fields are optional — sensible defaults are provided via constants.\n *\n * @see SUMMARIZATION_CONTEXT_THRESHOLD, SUMMARIZATION_RESERVE_RATIO, PRUNING_EMA_ALPHA\n */\nexport interface SummarizationConfig {\n /**\n * Strategy for when summarization triggers.\n * @default 'contextPercentage'\n */\n triggerType?: SummarizationTriggerType;\n\n /**\n * Threshold value interpreted based on triggerType:\n * - contextPercentage: 0-100 (percentage of context window)\n * - messageCount: absolute count of messages pruned\n * - tokenThreshold: absolute token count\n * @default 80 (for contextPercentage)\n */\n triggerThreshold?: number;\n\n /**\n * Fraction of context window (0-1) reserved for recent messages.\n * Prevents over-pruning by ensuring at least this fraction of the\n * context budget is preserved as recent conversation history.\n * @default 0.3\n */\n reserveRatio?: number;\n\n /**\n * Whether context pruning is enabled (can be disabled for debugging).\n * @default true\n */\n contextPruning?: boolean;\n\n /**\n * Initial summary text to seed across runs.\n * Different from persistedSummary: this is provided by the caller as a\n * cross-conversation seed (e.g., agent personality or recurring context),\n * while persistedSummary is loaded from the conversation's own history.\n */\n initialSummary?: string;\n\n /**\n * Upstream-aligned optional fields. When the host wants the summarization\n * pass to run on a different LLM than the agent's own (e.g. a cheaper\n * model for compaction), these provider/model overrides flow through to\n * the summarize callback.\n */\n provider?: Providers;\n model?: string;\n parameters?: Record<string, unknown>;\n prompt?: string;\n updatePrompt?: string;\n trigger?: { type: string; value: number };\n maxSummaryTokens?: number;\n}\n\n/**\n * Runtime state for EMA-based pruning calibration.\n * Maintained across iterations within a single run to smooth pruning decisions.\n */\nexport interface PruneCalibrationState {\n /** Current EMA calibration ratio */\n ratio: number;\n /** Number of calibration updates applied */\n iterations: number;\n}\n\n/**\n * Lightweight file metadata entry for conversation-level file awareness.\n * Contains only IDs and names — NOT full content — so the agent always knows\n * what files exist in the conversation even after compaction pushes old messages\n * behind the summary window. The agent can retrieve full content on-demand\n * via file_search (RAG) or content_tool read (by contentId).\n */\nexport interface FileManifestEntry {\n /** Unique file identifier (e.g., MongoDB ObjectId or UUID) */\n fileId: string;\n /** Original filename (e.g., \"quarterly-report.pdf\") */\n filename: string;\n /** Content identifier for on-demand retrieval via content_tool read */\n contentId?: string;\n /** File source (e.g., \"local\", \"sharepoint\", \"onedrive\") */\n source?: string;\n /** Index of the message that introduced this file (0-based in the original message array) */\n messageIndex?: number;\n}\n\n/** Configuration for a subagent type that can be spawned by a parent agent. */\nexport type SubagentConfig = {\n /** Identifier used in the tool's `subagent_type` enum (e.g. 'researcher', 'coder'). */\n type: string;\n /** Human-readable display name. */\n name: string;\n /** What this subagent specializes in — shown to the LLM. */\n description: string;\n /** Full agent config for the child graph. Omit when `self` is true. */\n agentInputs?: AgentInputs;\n /** When true, reuse the parent's AgentInputs (context isolation without separate config). */\n self?: boolean;\n /** Max AGENT→TOOLS cycles before forced stop (default: 25). */\n maxTurns?: number;\n /** Allow this subagent to spawn its own subagents (default: false). */\n allowNested?: boolean;\n};\n\n/** SubagentConfig with agentInputs guaranteed present (self-spawn resolved). */\nexport type ResolvedSubagentConfig = SubagentConfig & {\n agentInputs: AgentInputs;\n};\n\n/** Lifecycle phase carried on {@link SubagentUpdateEvent}. */\nexport type SubagentUpdatePhase =\n | 'start'\n | 'run_step'\n | 'run_step_delta'\n | 'run_step_completed'\n | 'message_delta'\n | 'reasoning_delta'\n | 'stop'\n | 'error';\n\n/**\n * Wrapper event emitted when a subagent's child graph dispatches activity.\n * Lets hosts show subagent progress in a UI surface separate from the parent\n * conversation without having to untangle events by agent ID.\n */\nexport interface SubagentUpdateEvent {\n /** Parent run ID. */\n runId: string;\n /** Child run ID (unique per subagent execution). */\n subagentRunId: string;\n /**\n * Parent-side `tool_call_id` for the `subagent` tool invocation that\n * triggered this run. Stable for the duration of the child; lets hosts\n * correlate updates deterministically instead of inferring by ordering.\n * Omitted when the executor was invoked outside of a tool-call context.\n */\n parentToolCallId?: string;\n /** Subagent `type` identifier from the SubagentConfig. */\n subagentType: string;\n /** Child agent ID assigned to this subagent execution. */\n subagentAgentId: string;\n /** Parent agent ID that spawned this subagent. */\n parentAgentId?: string;\n /** Lifecycle phase carried by this update. */\n phase: SubagentUpdatePhase;\n /** Underlying event payload (shape depends on phase). */\n data?: unknown;\n /** Short human-readable description. Hosts can render this directly. */\n label?: string;\n /** ISO timestamp for ordering / display. */\n timestamp: string;\n}\n\nexport interface AgentInputs {\n agentId: string;\n /** Human-readable name for the agent (used in handoff context). Defaults to agentId if not provided. */\n name?: string;\n /** Description of what this agent does (used to enrich handoff tool descriptions). */\n description?: string;\n toolEnd?: boolean;\n toolMap?: ToolMap;\n tools?: GraphTools;\n provider: Providers;\n /**\n * Ordered list of cacheable system content blocks emitted BEFORE\n * `instructions` in the system message. Each block gets its own cache\n * marker (cachePoint on Bedrock, cache_control on Anthropic) so the\n * cache key for each block includes only the bytes up to and including\n * its own marker. Entries are emitted in array order — earlier =\n * stabler = wider cache key (best for cross-tenant sharing).\n *\n * See `src/types/agent-cache.ts` for full semantics. Capped at\n * `MAX_SYSTEM_CACHE_BLOCKS` (2) entries to stay within Bedrock's\n * 4-cachePoint budget after the tools array consumes 2.\n */\n system_cache_blocks?: SystemCacheBlock[];\n /**\n * Stable/cacheable system instructions for this agent. Always emitted\n * with its own trailing cache marker (when caching is supported by\n * the provider/model). Use `instructions_cache_ttl` to override the\n * default '5m' TTL.\n */\n instructions?: string;\n /** TTL for the trailing `instructions` cache marker. Defaults to '5m'. */\n instructions_cache_ttl?: AgentCacheTTL;\n streamBuffer?: number;\n maxContextTokens?: number;\n clientOptions?: ClientOptions;\n /**\n * Dynamic system tail appended after the cacheable instructions\n * without any cache marker. Per-user / per-message context belongs\n * here so it does not invalidate the cacheable prefix.\n */\n additional_instructions?: string;\n reasoningKey?: 'reasoning_content' | 'reasoning';\n /**\n * Subagent types this agent may spawn. When non-empty, Graph injects the\n * `subagent` tool into the agent's toolset with the per-config enum and\n * description populated.\n */\n subagentConfigs?: SubagentConfig[];\n /**\n * Maximum subagent depth allowed below this agent. Used by SubagentExecutor\n * to abort runaway nesting. Defaults to a small constant.\n */\n maxSubagentDepth?: number;\n /**\n * Pre-existing summary injected into the system message via\n * AgentContext.buildInstructionsString. Populated by SubagentExecutor when\n * spawning a self-config subagent that should inherit the parent's prior\n * compaction summary; otherwise host-supplied at run time.\n */\n initialSummary?: { text: string; tokenCount: number };\n /**\n * Upstream-aligned opt-in for summarization. When false, the agent never\n * invokes the summarize callback regardless of context utilization.\n * Defaults to undefined (treated as enabled in Ranger to preserve prior\n * behaviour); hosts that want strict opt-in semantics should set it\n * explicitly.\n */\n summarizationEnabled?: boolean;\n /** Format content blocks as strings (for legacy compatibility i.e. Ollama/Azure Serverless) */\n useLegacyContent?: boolean;\n /**\n * Tool definitions for all tools, including deferred and programmatic.\n * Used for tool search and programmatic tool calling.\n * Maps tool name to LCTool definition.\n */\n toolRegistry?: Map<string, LCTool>;\n /**\n * Dynamic context that changes per-request (e.g., current time, user info).\n * This is injected as a user message rather than system prompt to preserve cache.\n * Keeping this separate from instructions ensures the system message stays static\n * and can be cached by Bedrock/Anthropic prompt caching.\n */\n dynamicContext?: string;\n /**\n * Structured output configuration (camelCase).\n * When set, disables streaming and returns a validated JSON response\n * conforming to the specified schema.\n */\n structuredOutput?: StructuredOutputConfig;\n /**\n * Structured output configuration (snake_case - database/API format).\n * Alternative to structuredOutput for compatibility with MongoDB/frontend.\n * Uses an `enabled` flag to control activation.\n * @deprecated Use structuredOutput instead when possible\n */\n structured_output?: StructuredOutputInput;\n /**\n * Serializable tool definitions for event-driven execution.\n * When provided, ToolNode operates in event-driven mode, dispatching\n * ON_TOOL_EXECUTE events instead of invoking tools directly.\n */\n toolDefinitions?: LCTool[];\n /**\n * Tool names discovered from previous conversation history.\n * These tools will be pre-marked as discovered so they're included\n * in tool binding without requiring tool_search.\n */\n discoveredTools?: string[];\n /**\n * Optional callback for summarizing messages that were pruned from context.\n * When provided, discarded messages are summarized by the host caller\n * using a cheap LLM call, and the summary is prepended to the context.\n */\n summarizeCallback?: (\n messagesToRefine: import('@langchain/core/messages').BaseMessage[]\n ) => Promise<string | undefined>;\n /**\n * Pre-existing summary text loaded from persistent storage (MongoDB/Redis).\n * When provided, this summary is injected into the initial message context\n * so the agent has prior conversation history even on new turns.\n * Set by the host's summary store when resuming a conversation.\n */\n persistedSummary?: string;\n /**\n * Summarization configuration controlling trigger strategy, reserve ratio,\n * and EMA calibration for pruning. When omitted, sensible defaults apply.\n * @see SummarizationConfig\n */\n summarizationConfig?: SummarizationConfig;\n /**\n * Lightweight file manifest for the conversation.\n * Contains file IDs, names, and metadata — NOT full content.\n *\n * Used by the compaction engine to inject a [Conversation Files] block\n * into the windowed view, ensuring the LLM always knows what files exist\n * even when old messages (with full file content) are behind the summary.\n *\n * The agent can retrieve full content on-demand via:\n * - file_search (RAG semantic search over embedded files)\n * - content_tool read (by contentId for exact file retrieval)\n *\n * Built by the host orchestrator from message_file_map\n * and metadata.context_files across all conversation messages.\n */\n fileManifest?: FileManifestEntry[];\n}\n\n/**\n * Tunable knobs for position-based content degradation.\n * See `messages/contextPruning.ts` and `messages/contextPruningSettings.ts`.\n */\nexport interface ContextPruningConfig {\n enabled?: boolean;\n keepLastAssistants?: number;\n softTrimRatio?: number;\n hardClearRatio?: number;\n minPrunableToolChars?: number;\n softTrim?: {\n maxChars?: number;\n headChars?: number;\n tailChars?: number;\n };\n hardClear?: {\n enabled?: boolean;\n placeholder?: string;\n };\n}\n"],"names":[],"mappings":"AAqdA;;AAEG;AACG,MAAO,4BAA6B,SAAQ,KAAK,CAAA;AAClC,IAAA,WAAA;AAAnB,IAAA,WAAA,CAAmB,WAAmB,EAAA;AACpC,QAAA,KAAK,CAAC,CAAA,4CAAA,EAA+C,WAAW,CAAA,CAAE,CAAC;QADlD,IAAA,CAAA,WAAW,GAAX,WAAW;AAE5B,QAAA,IAAI,CAAC,IAAI,GAAG,8BAA8B;IAC5C;AACD;AAED;;AAEG;AACG,MAAO,8BAA+B,SAAQ,KAAK,CAAA;AACpC,IAAA,UAAA;AAAnB,IAAA,WAAA,CAAmB,UAAkB,EAAA;QACnC,KAAK,CACH,CAAA,8CAAA,EAAiD,UAAU,CAAA,GAAA,CAAK;AAC9D,YAAA,sEAAsE,CACzE;QAJgB,IAAA,CAAA,UAAU,GAAV,UAAU;AAK3B,QAAA,IAAI,CAAC,IAAI,GAAG,gCAAgC;IAC9C;AACD;;;;"}
1
+ {"version":3,"file":"graph.mjs","sources":["../../../src/types/graph.ts"],"sourcesContent":["// src/types/graph.ts\nimport type {\n START,\n StateType,\n UpdateType,\n StateGraph,\n StateGraphArgs,\n StateDefinition,\n CompiledStateGraph,\n BinaryOperatorAggregate,\n} from '@langchain/langgraph';\nimport type { BindToolsInput } from '@langchain/core/language_models/chat_models';\nimport type {\n BaseMessage,\n AIMessageChunk,\n SystemMessage,\n} from '@langchain/core/messages';\nimport type { RunnableConfig, Runnable } from '@langchain/core/runnables';\nimport type { ChatGenerationChunk } from '@langchain/core/outputs';\nimport type { GoogleAIToolType } from '@langchain/google-common';\nimport type {\n ToolMap,\n ToolEndEvent,\n GenericTool,\n LCTool,\n ToolApprovalConfig,\n ToolExecuteBatchRequest,\n} from '@/types/tools';\nimport type { Providers, Callback, GraphNodeKeys } from '@/common';\nimport type { StandardGraph, MultiAgentGraph } from '@/graphs';\nimport type { ClientOptions } from '@/types/llm';\nimport type {\n RunStep,\n RunStepDeltaEvent,\n MessageDeltaEvent,\n ReasoningDeltaEvent,\n} from '@/types/stream';\nimport type { TokenCounter } from '@/types/run';\nimport type { SystemCacheBlock, AgentCacheTTL } from '@/types/agent-cache';\n\n/** Interface for bound model with stream and invoke methods */\nexport interface ChatModel {\n stream?: (\n messages: BaseMessage[],\n config?: RunnableConfig\n ) => Promise<AsyncIterable<AIMessageChunk>>;\n invoke: (\n messages: BaseMessage[],\n config?: RunnableConfig\n ) => Promise<AIMessageChunk>;\n}\n\n/** Payload for ON_AGENT_TRANSITION events */\nexport type AgentTransitionEvent = {\n sourceAgentId?: string;\n sourceAgentName?: string;\n destinationAgentId: string;\n destinationAgentName: string;\n edgeType: string; // 'handoff' | 'transfer' | 'sequence'\n timestamp: number;\n /** When true, this event signals handoff completion (child → parent return) */\n isCompletion?: boolean;\n /** Duration of child agent execution in milliseconds (only on completion events) */\n durationMs?: number;\n /** Length of child agent result text in characters (only on completion events) */\n resultLength?: number;\n};\n\nexport type GraphNode = GraphNodeKeys | typeof START;\nexport type ClientCallback<T extends unknown[]> = (\n graph: StandardGraph,\n ...args: T\n) => void;\n\nexport type ClientCallbacks = {\n [Callback.TOOL_ERROR]?: ClientCallback<[Error, string]>;\n [Callback.TOOL_START]?: ClientCallback<unknown[]>;\n [Callback.TOOL_END]?: ClientCallback<unknown[]>;\n};\n\nexport type SystemCallbacks = {\n [K in keyof ClientCallbacks]: ClientCallbacks[K] extends ClientCallback<\n infer Args\n >\n ? (...args: Args) => void\n : never;\n};\n\nexport type BaseGraphState = {\n messages: BaseMessage[];\n /**\n * Structured response when using structured output mode.\n * Contains the validated JSON response conforming to the configured schema.\n */\n structuredResponse?: Record<string, unknown>;\n};\n\nexport type MultiAgentGraphState = BaseGraphState & {\n agentMessages?: BaseMessage[];\n};\n\nexport type IState = BaseGraphState;\n\nexport interface EventHandler {\n handle(\n event: string,\n data:\n | StreamEventData\n | ModelEndData\n | RunStep\n | RunStepDeltaEvent\n | MessageDeltaEvent\n | ReasoningDeltaEvent\n | SubagentUpdateEvent\n | ToolExecuteBatchRequest\n | { result: ToolEndEvent },\n metadata?: Record<string, unknown>,\n graph?: StandardGraph | MultiAgentGraph\n ): void | Promise<void>;\n}\n\nexport type GraphStateChannels<T extends BaseGraphState> =\n StateGraphArgs<T>['channels'];\n\nexport type Workflow<\n T extends BaseGraphState = BaseGraphState,\n U extends Partial<T> = Partial<T>,\n N extends string = string,\n> = StateGraph<T, U, N>;\n\nexport type CompiledWorkflow<\n T extends BaseGraphState = BaseGraphState,\n U extends Partial<T> = Partial<T>,\n N extends string = string,\n> = CompiledStateGraph<T, U, N>;\n\nexport type CompiledStateWorkflow = CompiledStateGraph<\n StateType<{\n messages: BinaryOperatorAggregate<BaseMessage[], BaseMessage[]>;\n }>,\n UpdateType<{\n messages: BinaryOperatorAggregate<BaseMessage[], BaseMessage[]>;\n }>,\n string,\n {\n messages: BinaryOperatorAggregate<BaseMessage[], BaseMessage[]>;\n },\n {\n messages: BinaryOperatorAggregate<BaseMessage[], BaseMessage[]>;\n },\n StateDefinition\n>;\n\nexport type CompiledMultiAgentWorkflow = CompiledStateGraph<\n StateType<{\n messages: BinaryOperatorAggregate<BaseMessage[], BaseMessage[]>;\n agentMessages: BinaryOperatorAggregate<BaseMessage[], BaseMessage[]>;\n }>,\n UpdateType<{\n messages: BinaryOperatorAggregate<BaseMessage[], BaseMessage[]>;\n agentMessages: BinaryOperatorAggregate<BaseMessage[], BaseMessage[]>;\n }>,\n string,\n {\n messages: BinaryOperatorAggregate<BaseMessage[], BaseMessage[]>;\n agentMessages: BinaryOperatorAggregate<BaseMessage[], BaseMessage[]>;\n },\n {\n messages: BinaryOperatorAggregate<BaseMessage[], BaseMessage[]>;\n agentMessages: BinaryOperatorAggregate<BaseMessage[], BaseMessage[]>;\n },\n StateDefinition\n>;\n\nexport type CompiledAgentWorfklow = CompiledStateGraph<\n {\n messages: BaseMessage[];\n },\n {\n messages?: BaseMessage[] | undefined;\n },\n '__start__' | `agent=${string}` | `tools=${string}`,\n {\n messages: BinaryOperatorAggregate<BaseMessage[], BaseMessage[]>;\n },\n {\n messages: BinaryOperatorAggregate<BaseMessage[], BaseMessage[]>;\n },\n StateDefinition,\n {\n [x: `agent=${string}`]: Partial<BaseGraphState>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [x: `tools=${string}`]: any;\n }\n>;\n\nexport type SystemRunnable =\n | Runnable<\n BaseMessage[],\n (BaseMessage | SystemMessage)[],\n RunnableConfig<Record<string, unknown>>\n >\n | undefined;\n\n/**\n * Optional compile options passed to workflow.compile().\n * These are intentionally untyped to avoid coupling to library internals.\n */\nexport type CompileOptions = {\n // A checkpointer instance (e.g., MemorySaver, SQL saver)\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n checkpointer?: any;\n interruptBefore?: string[];\n interruptAfter?: string[];\n /**\n * Human-in-the-loop tool approval configuration.\n * When set, tools matching the policy will trigger an interrupt()\n * before execution, pausing the graph for human approval.\n * Requires a checkpointer to be set for interrupt/resume to work.\n */\n toolApprovalConfig?: ToolApprovalConfig;\n};\n\nexport type EventStreamCallbackHandlerInput =\n Parameters<CompiledWorkflow['streamEvents']>[2] extends Omit<\n infer T,\n 'autoClose'\n >\n ? T\n : never;\n\nexport type StreamChunk =\n | (ChatGenerationChunk & {\n message: AIMessageChunk;\n })\n | AIMessageChunk;\n\n/**\n * Data associated with a StreamEvent.\n */\nexport type StreamEventData = {\n /**\n * The input passed to the runnable that generated the event.\n * Inputs will sometimes be available at the *START* of the runnable, and\n * sometimes at the *END* of the runnable.\n * If a runnable is able to stream its inputs, then its input by definition\n * won't be known until the *END* of the runnable when it has finished streaming\n * its inputs.\n */\n input?: unknown;\n /**\n * The output of the runnable that generated the event.\n * Outputs will only be available at the *END* of the runnable.\n * For most runnables, this field can be inferred from the `chunk` field,\n * though there might be some exceptions for special cased runnables (e.g., like\n * chat models), which may return more information.\n */\n output?: unknown;\n /**\n * A streaming chunk from the output that generated the event.\n * chunks support addition in general, and adding them up should result\n * in the output of the runnable that generated the event.\n */\n chunk?: StreamChunk;\n /**\n * Runnable config for invoking other runnables within handlers.\n */\n config?: RunnableConfig;\n /**\n * Custom result from the runnable that generated the event.\n */\n result?: unknown;\n /**\n * Custom field to indicate the event was manually emitted, and may have been handled already\n */\n emitted?: boolean;\n};\n\n/**\n * A streaming event.\n *\n * Schema of a streaming event which is produced from the streamEvents method.\n */\nexport type StreamEvent = {\n /**\n * Event names are of the format: on_[runnable_type]_(start|stream|end).\n *\n * Runnable types are one of:\n * - llm - used by non chat models\n * - chat_model - used by chat models\n * - prompt -- e.g., ChatPromptTemplate\n * - tool -- LangChain tools\n * - chain - most Runnables are of this type\n *\n * Further, the events are categorized as one of:\n * - start - when the runnable starts\n * - stream - when the runnable is streaming\n * - end - when the runnable ends\n *\n * start, stream and end are associated with slightly different `data` payload.\n *\n * Please see the documentation for `EventData` for more details.\n */\n event: string;\n /** The name of the runnable that generated the event. */\n name: string;\n /**\n * An randomly generated ID to keep track of the execution of the given runnable.\n *\n * Each child runnable that gets invoked as part of the execution of a parent runnable\n * is assigned its own unique ID.\n */\n run_id: string;\n /**\n * Tags associated with the runnable that generated this event.\n * Tags are always inherited from parent runnables.\n */\n tags?: string[];\n /** Metadata associated with the runnable that generated this event. */\n metadata: Record<string, unknown>;\n /**\n * Event data.\n *\n * The contents of the event data depend on the event type.\n */\n data: StreamEventData;\n};\n\nexport type GraphConfig = {\n provider: string;\n thread_id?: string;\n run_id?: string;\n};\n\nexport type PartMetadata = {\n progress?: number;\n asset_pointer?: string;\n status?: string;\n action?: boolean;\n output?: string;\n};\n\nexport type ModelEndData =\n | (StreamEventData & { output: AIMessageChunk | undefined })\n | undefined;\nexport type GraphTools = GenericTool[] | BindToolsInput[] | GoogleAIToolType[];\nexport type StandardGraphInput = {\n runId?: string;\n signal?: AbortSignal;\n agents: AgentInputs[];\n tokenCounter?: TokenCounter;\n indexTokenCountMap?: Record<string, number>;\n};\n\n/**\n * Configuration for an approval gate placed on a sequence edge.\n * When present, the graph inserts an approval gate node between the source\n * and destination agents. The gate ALWAYS fires (regardless of ExecutionContext)\n * and calls interrupt() to pause the graph for human approval.\n */\nexport type ApprovalGateConfig = {\n /** Unique identifier for this gate (used as node ID suffix) */\n gateId: string;\n /**\n * Approval channel — where the approval UI is rendered.\n * - 'chat': SSE-based chat UI (default)\n * - 'outlook': MS Graph Actionable Messages\n * - 'telegram': Telegram Bot inline keyboard\n */\n channel?: 'chat' | 'outlook' | 'telegram';\n /** Optional human-readable prompt shown to the approver */\n prompt?: string;\n /** Optional approver identifier (e.g., email, user ID) */\n approver?: string;\n /** Timeout in ms before the gate auto-expires (default: 5 minutes) */\n timeoutMs?: number;\n /** What to do on denial: 'stop' ends the graph, 'skip' skips the destination agent */\n onDeny?: 'stop' | 'skip';\n};\n\nexport type GraphEdge = {\n /** Agent ID, use a list for multiple sources */\n from: string | string[];\n /** Agent ID, use a list for multiple destinations */\n to: string | string[];\n description?: string;\n /** Can return boolean or specific destination(s) */\n condition?: (state: BaseGraphState) => boolean | string | string[];\n /**\n * EdgeType.HANDOFF — one-way routing: parent emits an `lc_transfer_to_*`\n * tool call and exits, child takes over and responds directly to the\n * user. Aligns with the standard handoff semantics.\n * EdgeType.DIRECT — fixed graph edges for automatic sequential / parallel\n * transitions. Downstream consumers may layer additional wiring on top\n * (fan-in with prompt, parallel groups, approval-gate nodes,\n * excludeResults / agentMessages).\n */\n edgeType?: import('@/common').EdgeType;\n /**\n * For sequence edges: Optional prompt to add when transitioning through this edge.\n * String prompts can include variables like {results} which will be replaced with\n * messages from startIndex onwards. When {results} is used, excludeResults defaults to true.\n *\n * For transfer edges: Description for the input parameter that the transfer tool accepts,\n * allowing the supervisor to pass specific instructions/context to the transferred agent.\n */\n prompt?:\n | string\n | ((\n messages: BaseMessage[],\n runStartIndex: number\n ) => string | Promise<string> | undefined);\n /**\n * When true, excludes messages from startIndex when adding prompt.\n * Automatically set to true when {results} variable is used in prompt.\n */\n excludeResults?: boolean;\n /**\n * For transfer edges: Customizes the parameter name for the transfer input.\n * Defaults to \"instructions\" if not specified.\n * Only applies when prompt is provided for transfer edges.\n *\n * For handoff edges: Customizes the parameter name for the handoff instruction input.\n */\n promptKey?: string;\n /**\n * Approval gate configuration for sequence edges.\n * When set, inserts an approval gate node between source and destination.\n * The gate ALWAYS fires regardless of ExecutionContext (unlike tool approval).\n */\n approvalGate?: ApprovalGateConfig;\n};\n\nexport type MultiAgentGraphInput = StandardGraphInput & {\n edges: GraphEdge[];\n /**\n * When set, the graph routes START to this agent instead of the default\n * starting nodes. Used for multi-turn resumption: the caller reads the\n * last active agent id from the previous turn (e.g. via\n * `Run.getLastActiveAgentId()`, which derives it from the run's content\n * data trail) and passes it here so follow-up messages route to the\n * agent that last handled the conversation.\n *\n * If the agent ID is invalid (not in the graph), falls back to default\n * starting nodes.\n */\n resumeFromAgentId?: string;\n};\n\n/**\n * Structured output mode determines how the agent returns structured data.\n * - 'tool': Uses tool calling to return structured output (works with all tool-calling models)\n * - 'provider': Uses provider-native structured output via LangChain's jsonMode (OpenAI, Anthropic, etc.)\n * - 'native': Uses provider's constrained decoding API directly for guaranteed schema compliance\n * (Anthropic output_config.format, OpenAI response_format.json_schema). Falls back to 'tool' for unsupported providers.\n * - 'auto': Automatically selects the best strategy — 'native' for supported providers, 'tool' for others\n */\nexport type StructuredOutputMode = 'tool' | 'provider' | 'native' | 'auto';\n\n/**\n * Resolved method used internally after mode resolution.\n * Maps to LangChain's withStructuredOutput method parameter plus our native path.\n */\nexport type ResolvedStructuredOutputMethod =\n | 'functionCalling'\n | 'jsonMode'\n | 'jsonSchema'\n | 'native'\n | undefined;\n\n/**\n * Error thrown when the model refuses to produce structured output due to safety policies.\n */\nexport class StructuredOutputRefusalError extends Error {\n constructor(public refusalText: string) {\n super(`Model refused to produce structured output: ${refusalText}`);\n this.name = 'StructuredOutputRefusalError';\n }\n}\n\n/**\n * Error thrown when the structured output response was truncated due to max_tokens.\n */\nexport class StructuredOutputTruncatedError extends Error {\n constructor(public stopReason: string) {\n super(\n `Structured output was truncated (stop_reason: ${stopReason}). ` +\n 'Increase max_tokens to allow the full JSON response to be generated.'\n );\n this.name = 'StructuredOutputTruncatedError';\n }\n}\n\n/**\n * Configuration for structured JSON output from agents.\n * When configured, the agent will return a validated JSON response\n * instead of streaming text.\n */\nexport interface StructuredOutputConfig {\n /**\n * JSON Schema defining the output structure.\n * The model will be forced to return data conforming to this schema.\n */\n schema: Record<string, unknown>;\n /**\n * Name for the structured output format (used in tool mode).\n * @default 'StructuredResponse'\n */\n name?: string;\n /**\n * Description of what the structured output represents.\n * Helps the model understand the expected format.\n */\n description?: string;\n /**\n * Output mode strategy.\n * @default 'auto'\n */\n mode?: StructuredOutputMode;\n /**\n * Enable strict schema validation.\n * When true, the response must exactly match the schema.\n * @default true\n */\n strict?: boolean;\n /**\n * Error handling configuration.\n * - true: Auto-retry on validation errors (default)\n * - false: Throw error on validation failure\n * - string: Custom error message for retry\n */\n handleErrors?: boolean | string;\n /**\n * Maximum number of retry attempts on validation failure.\n * @default 2\n */\n maxRetries?: number;\n /**\n * Include the raw AI message along with structured response.\n * Useful for debugging.\n * @default false\n */\n includeRaw?: boolean;\n}\n\n/**\n * Database/API structured output format (snake_case with enabled flag).\n * This matches the format stored in MongoDB and sent from frontends.\n */\nexport interface StructuredOutputInput {\n /** Whether structured output is enabled */\n enabled?: boolean;\n /** JSON Schema defining the expected response structure */\n schema?: Record<string, unknown>;\n /** Name identifier for the structured output */\n name?: string;\n /** Description of what the structured output represents */\n description?: string;\n /** Mode for structured output: 'tool' | 'provider' | 'native' | 'auto' */\n mode?: StructuredOutputMode;\n /** Whether to enforce strict schema validation */\n strict?: boolean;\n}\n\n/**\n * Trigger strategy for when summarization should activate.\n * - 'contextPercentage': Trigger when context utilization exceeds a threshold percentage\n * - 'messageCount': Trigger when pruned message count exceeds a threshold\n * - 'tokenThreshold': Trigger when total token count exceeds a raw threshold\n */\nexport type SummarizationTriggerType =\n | 'contextPercentage'\n | 'messageCount'\n | 'tokenThreshold';\n\n/**\n * Configuration for summarization behavior within the agent pipeline.\n * All fields are optional — sensible defaults are provided via constants.\n *\n * @see SUMMARIZATION_CONTEXT_THRESHOLD, SUMMARIZATION_RESERVE_RATIO, PRUNING_EMA_ALPHA\n */\nexport interface SummarizationConfig {\n /**\n * Strategy for when summarization triggers.\n * @default 'contextPercentage'\n */\n triggerType?: SummarizationTriggerType;\n\n /**\n * Threshold value interpreted based on triggerType:\n * - contextPercentage: 0-100 (percentage of context window)\n * - messageCount: absolute count of messages pruned\n * - tokenThreshold: absolute token count\n * @default 80 (for contextPercentage)\n */\n triggerThreshold?: number;\n\n /**\n * Fraction of context window (0-1) reserved for recent messages.\n * Prevents over-pruning by ensuring at least this fraction of the\n * context budget is preserved as recent conversation history.\n * @default 0.3\n */\n reserveRatio?: number;\n\n /**\n * Whether context pruning is enabled (can be disabled for debugging).\n * @default true\n */\n contextPruning?: boolean;\n\n /**\n * Initial summary text to seed across runs.\n * Different from persistedSummary: this is provided by the caller as a\n * cross-conversation seed (e.g., agent personality or recurring context),\n * while persistedSummary is loaded from the conversation's own history.\n */\n initialSummary?: string;\n\n /**\n * optional fields. When the host wants the summarization\n * pass to run on a different LLM than the agent's own (e.g. a cheaper\n * model for compaction), these provider/model overrides flow through to\n * the summarize callback.\n */\n provider?: Providers;\n model?: string;\n parameters?: Record<string, unknown>;\n prompt?: string;\n updatePrompt?: string;\n trigger?: { type: string; value: number };\n maxSummaryTokens?: number;\n}\n\n/**\n * Runtime state for EMA-based pruning calibration.\n * Maintained across iterations within a single run to smooth pruning decisions.\n */\nexport interface PruneCalibrationState {\n /** Current EMA calibration ratio */\n ratio: number;\n /** Number of calibration updates applied */\n iterations: number;\n}\n\n/**\n * Lightweight file metadata entry for conversation-level file awareness.\n * Contains only IDs and names — NOT full content — so the agent always knows\n * what files exist in the conversation even after compaction pushes old messages\n * behind the summary window. The agent can retrieve full content on-demand\n * via file_search (RAG) or content_tool read (by contentId).\n */\nexport interface FileManifestEntry {\n /** Unique file identifier (e.g., MongoDB ObjectId or UUID) */\n fileId: string;\n /** Original filename (e.g., \"quarterly-report.pdf\") */\n filename: string;\n /** Content identifier for on-demand retrieval via content_tool read */\n contentId?: string;\n /** File source (e.g., \"local\", \"sharepoint\", \"onedrive\") */\n source?: string;\n /** Index of the message that introduced this file (0-based in the original message array) */\n messageIndex?: number;\n}\n\n/** Configuration for a subagent type that can be spawned by a parent agent. */\nexport type SubagentConfig = {\n /** Identifier used in the tool's `subagent_type` enum (e.g. 'researcher', 'coder'). */\n type: string;\n /** Human-readable display name. */\n name: string;\n /** What this subagent specializes in — shown to the LLM. */\n description: string;\n /** Full agent config for the child graph. Omit when `self` is true. */\n agentInputs?: AgentInputs;\n /** When true, reuse the parent's AgentInputs (context isolation without separate config). */\n self?: boolean;\n /** Max AGENT→TOOLS cycles before forced stop (default: 25). */\n maxTurns?: number;\n /** Allow this subagent to spawn its own subagents (default: false). */\n allowNested?: boolean;\n};\n\n/** SubagentConfig with agentInputs guaranteed present (self-spawn resolved). */\nexport type ResolvedSubagentConfig = SubagentConfig & {\n agentInputs: AgentInputs;\n};\n\n/** Lifecycle phase carried on {@link SubagentUpdateEvent}. */\nexport type SubagentUpdatePhase =\n | 'start'\n | 'run_step'\n | 'run_step_delta'\n | 'run_step_completed'\n | 'message_delta'\n | 'reasoning_delta'\n | 'stop'\n | 'error';\n\n/**\n * Wrapper event emitted when a subagent's child graph dispatches activity.\n * Lets hosts show subagent progress in a UI surface separate from the parent\n * conversation without having to untangle events by agent ID.\n */\nexport interface SubagentUpdateEvent {\n /** Parent run ID. */\n runId: string;\n /** Child run ID (unique per subagent execution). */\n subagentRunId: string;\n /**\n * Parent-side `tool_call_id` for the `subagent` tool invocation that\n * triggered this run. Stable for the duration of the child; lets hosts\n * correlate updates deterministically instead of inferring by ordering.\n * Omitted when the executor was invoked outside of a tool-call context.\n */\n parentToolCallId?: string;\n /** Subagent `type` identifier from the SubagentConfig. */\n subagentType: string;\n /** Child agent ID assigned to this subagent execution. */\n subagentAgentId: string;\n /** Parent agent ID that spawned this subagent. */\n parentAgentId?: string;\n /** Lifecycle phase carried by this update. */\n phase: SubagentUpdatePhase;\n /** Underlying event payload (shape depends on phase). */\n data?: unknown;\n /** Short human-readable description. Hosts can render this directly. */\n label?: string;\n /** ISO timestamp for ordering / display. */\n timestamp: string;\n}\n\nexport interface AgentInputs {\n agentId: string;\n /** Human-readable name for the agent (used in handoff context). Defaults to agentId if not provided. */\n name?: string;\n /** Description of what this agent does (used to enrich handoff tool descriptions). */\n description?: string;\n toolEnd?: boolean;\n toolMap?: ToolMap;\n tools?: GraphTools;\n provider: Providers;\n /**\n * Ordered list of cacheable system content blocks emitted BEFORE\n * `instructions` in the system message. Each block gets its own cache\n * marker (cachePoint on Bedrock, cache_control on Anthropic) so the\n * cache key for each block includes only the bytes up to and including\n * its own marker. Entries are emitted in array order — earlier =\n * stabler = wider cache key (best for cross-tenant sharing).\n *\n * See `src/types/agent-cache.ts` for full semantics. Capped at\n * `MAX_SYSTEM_CACHE_BLOCKS` (2) entries to stay within Bedrock's\n * 4-cachePoint budget after the tools array consumes 2.\n */\n system_cache_blocks?: SystemCacheBlock[];\n /**\n * Stable/cacheable system instructions for this agent. Always emitted\n * with its own trailing cache marker (when caching is supported by\n * the provider/model). Use `instructions_cache_ttl` to override the\n * default '5m' TTL.\n */\n instructions?: string;\n /** TTL for the trailing `instructions` cache marker. Defaults to '5m'. */\n instructions_cache_ttl?: AgentCacheTTL;\n streamBuffer?: number;\n maxContextTokens?: number;\n clientOptions?: ClientOptions;\n /**\n * Dynamic system tail appended after the cacheable instructions\n * without any cache marker. Per-user / per-message context belongs\n * here so it does not invalidate the cacheable prefix.\n */\n additional_instructions?: string;\n reasoningKey?: 'reasoning_content' | 'reasoning';\n /**\n * Subagent types this agent may spawn. When non-empty, Graph injects the\n * `subagent` tool into the agent's toolset with the per-config enum and\n * description populated.\n */\n subagentConfigs?: SubagentConfig[];\n /**\n * Maximum subagent depth allowed below this agent. Used by SubagentExecutor\n * to abort runaway nesting. Defaults to a small constant.\n */\n maxSubagentDepth?: number;\n /**\n * Pre-existing summary injected into the system message via\n * AgentContext.buildInstructionsString. Populated by SubagentExecutor when\n * spawning a self-config subagent that should inherit the parent's prior\n * compaction summary; otherwise host-supplied at run time.\n */\n initialSummary?: { text: string; tokenCount: number };\n /**\n * opt-in for summarization. When false, the agent never\n * invokes the summarize callback regardless of context utilization.\n * Defaults to undefined (treated as enabled by default to preserve prior\n * behaviour); hosts that want strict opt-in semantics should set it\n * explicitly.\n */\n summarizationEnabled?: boolean;\n /** Format content blocks as strings (for legacy compatibility i.e. Ollama/Azure Serverless) */\n useLegacyContent?: boolean;\n /**\n * Tool definitions for all tools, including deferred and programmatic.\n * Used for tool search and programmatic tool calling.\n * Maps tool name to LCTool definition.\n */\n toolRegistry?: Map<string, LCTool>;\n /**\n * Dynamic context that changes per-request (e.g., current time, user info).\n * This is injected as a user message rather than system prompt to preserve cache.\n * Keeping this separate from instructions ensures the system message stays static\n * and can be cached by Bedrock/Anthropic prompt caching.\n */\n dynamicContext?: string;\n /**\n * Structured output configuration (camelCase).\n * When set, disables streaming and returns a validated JSON response\n * conforming to the specified schema.\n */\n structuredOutput?: StructuredOutputConfig;\n /**\n * Structured output configuration (snake_case - database/API format).\n * Alternative to structuredOutput for compatibility with MongoDB/frontend.\n * Uses an `enabled` flag to control activation.\n * @deprecated Use structuredOutput instead when possible\n */\n structured_output?: StructuredOutputInput;\n /**\n * Serializable tool definitions for event-driven execution.\n * When provided, ToolNode operates in event-driven mode, dispatching\n * ON_TOOL_EXECUTE events instead of invoking tools directly.\n */\n toolDefinitions?: LCTool[];\n /**\n * Tool names discovered from previous conversation history.\n * These tools will be pre-marked as discovered so they're included\n * in tool binding without requiring tool_search.\n */\n discoveredTools?: string[];\n /**\n * Optional callback for summarizing messages that were pruned from context.\n * When provided, discarded messages are summarized by the host caller\n * using a cheap LLM call, and the summary is prepended to the context.\n */\n summarizeCallback?: (\n messagesToRefine: import('@langchain/core/messages').BaseMessage[]\n ) => Promise<string | undefined>;\n /**\n * Pre-existing summary text loaded from persistent storage (MongoDB/Redis).\n * When provided, this summary is injected into the initial message context\n * so the agent has prior conversation history even on new turns.\n * Set by the host's summary store when resuming a conversation.\n */\n persistedSummary?: string;\n /**\n * Summarization configuration controlling trigger strategy, reserve ratio,\n * and EMA calibration for pruning. When omitted, sensible defaults apply.\n * @see SummarizationConfig\n */\n summarizationConfig?: SummarizationConfig;\n /**\n * Lightweight file manifest for the conversation.\n * Contains file IDs, names, and metadata — NOT full content.\n *\n * Used by the compaction engine to inject a [Conversation Files] block\n * into the windowed view, ensuring the LLM always knows what files exist\n * even when old messages (with full file content) are behind the summary.\n *\n * The agent can retrieve full content on-demand via:\n * - file_search (RAG semantic search over embedded files)\n * - content_tool read (by contentId for exact file retrieval)\n *\n * Built by the host orchestrator from message_file_map\n * and metadata.context_files across all conversation messages.\n */\n fileManifest?: FileManifestEntry[];\n}\n\n/**\n * Tunable knobs for position-based content degradation.\n * See `messages/contextPruning.ts` and `messages/contextPruningSettings.ts`.\n */\nexport interface ContextPruningConfig {\n enabled?: boolean;\n keepLastAssistants?: number;\n softTrimRatio?: number;\n hardClearRatio?: number;\n minPrunableToolChars?: number;\n softTrim?: {\n maxChars?: number;\n headChars?: number;\n tailChars?: number;\n };\n hardClear?: {\n enabled?: boolean;\n placeholder?: string;\n };\n}\n"],"names":[],"mappings":"AAsdA;;AAEG;AACG,MAAO,4BAA6B,SAAQ,KAAK,CAAA;AAClC,IAAA,WAAA;AAAnB,IAAA,WAAA,CAAmB,WAAmB,EAAA;AACpC,QAAA,KAAK,CAAC,CAAA,4CAAA,EAA+C,WAAW,CAAA,CAAE,CAAC;QADlD,IAAA,CAAA,WAAW,GAAX,WAAW;AAE5B,QAAA,IAAI,CAAC,IAAI,GAAG,8BAA8B;IAC5C;AACD;AAED;;AAEG;AACG,MAAO,8BAA+B,SAAQ,KAAK,CAAA;AACpC,IAAA,UAAA;AAAnB,IAAA,WAAA,CAAmB,UAAkB,EAAA;QACnC,KAAK,CACH,CAAA,8CAAA,EAAiD,UAAU,CAAA,GAAA,CAAK;AAC9D,YAAA,sEAAsE,CACzE;QAJgB,IAAA,CAAA,UAAU,GAAV,UAAU;AAK3B,QAAA,IAAI,CAAC,IAAI,GAAG,gCAAgC;IAC9C;AACD;;;;"}
@@ -308,7 +308,7 @@ export declare class AgentContext {
308
308
  * appended unfiltered; outside event-driven mode they pass through
309
309
  * `filterToolsForBinding`. Centralizing the decision here prevents the
310
310
  * accounting/binding paths from drifting apart, which was the root
311
- * cause of the original miscount (Fixes upstream #121).
311
+ * cause of the original miscount (Fixes #121).
312
312
  */
313
313
  private getEffectiveInstanceTools;
314
314
  /**
@@ -82,19 +82,19 @@ export declare enum Providers {
82
82
  }
83
83
  export declare enum EdgeType {
84
84
  /**
85
- * Upstream-aligned handoff: one-way routing where the parent agent exits
85
+ * 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 earlier Ranger versions; the parent-calls-child
88
+ * called "TRANSFER" in older 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. 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.
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.
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 (upstream Tier 3). */
152
+ /** Tool name for the bash execution primitive (Tier 3). */
153
153
  BASH_TOOL = "execute_bash",
154
- /** Tool name for the bash programmatic-tool-calling variant (upstream Tier 3). */
154
+ /** Tool name for the bash programmatic-tool-calling variant (Tier 3). */
155
155
  BASH_PROGRAMMATIC_TOOL_CALLING = "run_tools_with_bash",
156
- /** Tool name for the read-file primitive (upstream Tier 3). */
156
+ /** Tool name for the read-file primitive (Tier 3). */
157
157
  READ_FILE = "read_file",
158
- /** Tool name for the SkillTool primitive (upstream Tier 2). */
158
+ /** Tool name for the SkillTool primitive (Tier 2). */
159
159
  SKILL_TOOL = "skill",
160
- /** Tool name for the Subagent primitive (upstream Tier 5). */
160
+ /** Tool name for the Subagent primitive (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. Upstream-aligned constant.
222
+ * `invokeParams` before tool execution. 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
- * (upstream PR #114). When set, every ToolNode built by this graph
53
+ * (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 (upstream PR #117).
64
+ * Run-scoped tool output reference configuration (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 upstream's post-turn flush handler. The agent is re-invoked
4
+ * Ported from the reference implementation'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
- * upstream's formula.
32
+ * the standard 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
- * LibreChat runs thousands of parallel sessions in one Node process, and
13
+ * Real consumers run 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 upstream.
53
+ * patterns must still validate standard.
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 upstream. The design report §3.8 routes
87
+ * patterns should still validate standard. 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
- * `@librechat/agents` emission points.
8
+ * `@illuma-ai/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];
@@ -10,7 +10,7 @@
10
10
  *
11
11
  * Consumers can extend the allowlist with `bedrockCacheModelPatterns` in
12
12
  * `clientOptions` for proprietary or pre-release model IDs not yet in
13
- * the upstream library.
13
+ * the reference library.
14
14
  */
15
15
  /**
16
16
  * Default allowlist of Bedrock model ID patterns that support cachePoint.
@@ -63,8 +63,8 @@ export type ToolGroupSelector = (toolName: string) => string;
63
63
  /**
64
64
  * Default group selector — puts all tools in a single group named 'core'.
65
65
  * Equivalent to 'single' strategy but explicit. Consumers override this
66
- * to enable per-source grouping (e.g. ranger uses `_mcp_` substring to
67
- * separate core from MCP tools).
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
68
  */
69
69
  export declare const DEFAULT_TOOL_GROUP_SELECTOR: ToolGroupSelector;
70
70
  /**
@@ -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(): 'LibreChatMoonshot';
105
+ static lc_name(): 'IllumaMoonshot';
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 upstream `extensions/memory-core/src/tools.citations.ts`.
4
+ * Ported from a reference implementation `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 upstream's output format exactly while keeping the pg
13
+ * This matches the standard 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 upstream's behavior:
27
+ * Decorate each hit with a citation marker. Mirrors the standard 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
- * Upstream keys `auto` off the session type (direct/group/channel). In
35
+ * The reference implementation 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 upstream's upstream defaults.
22
+ * Search defaults — aligned with the standard defaults.
23
23
  *
24
24
  * Sources:
25
- * - `upstream reference` → maxResults=6
26
- * - `upstream reference` → maxInjectedChars=4000
25
+ * - `reference` → maxResults=6
26
+ * - `reference` → maxInjectedChars=4000
27
27
  *
28
- * Keeping these in lockstep with upstream means the mandatory-recall tool
29
- * description, budget clamps, and eval corpora line up with upstream's
28
+ * Keeping these in lockstep with means the mandatory-recall tool
29
+ * description, budget clamps, and eval corpora line up with the standard
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 upstream.
39
+ * Phase 2 rerank defaults — ported from a reference implementation.
40
40
  *
41
41
  * Sources:
42
- * - `upstream reference` → lambda=0.7
43
- * - `upstream reference` → halfLifeDays=30
42
+ * - `reference` → lambda=0.7
43
+ * - `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 upstream upstream.
56
+ * Flush trigger margins (token counts) — aligned with standard.
57
57
  *
58
58
  * Sources:
59
- * - `upstream reference` → softThreshold=4000
60
- * - `upstream reference` → reserveFloor=20000
59
+ * - `reference` → softThreshold=4000
60
+ * - `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 upstream's flush-plan
70
+ * `memory_append` tool_calls it emits. Mirrors the standard 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 upstream `extensions/memory-core/src/tools.ts:186`.
85
+ * Ported VERBATIM from a reference implementation `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 upstream's
87
+ * compiled-wiki supplements — keeping the string identical means the standard
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 upstream `extensions/memory-core/src/tools.ts:322`.
92
+ * Ported VERBATIM from a reference implementation `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 upstream. That scheme
99
+ * (`memory/YYYY-MM-DD.md`), ported verbatim from a reference implementation. 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 upstream `src/auto-reply/tokens.ts:4`.
108
+ * Ported VERBATIM from a reference implementation `src/auto-reply/tokens.ts:4`.
109
109
  */
110
110
  export declare const SILENT_REPLY_TOKEN = "NO_REPLY";
111
111
  /**