@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
@@ -57,9 +57,10 @@ const SUPPORTED_LANGUAGES = [
57
57
  ];
58
58
  // Minimal schema for raw code execution. Only what the /exec endpoint needs.
59
59
  // Higher-level workflows (versioning, edit, store, replay) are consumer
60
- // concerns — e.g. ranger layers its own write/edit/execute schema on top via
61
- // codeEditWrapper and a separate ContentStore-backed Zod schema. Keeping this
62
- // tool narrow means every consumer gets a clean, schema-stable primitive.
60
+ // concerns — downstream consumers may layer their own write/edit/execute
61
+ // schemas on top via wrapper utilities and content-store backed Zod
62
+ // schemas. Keeping this tool narrow means every consumer gets a clean,
63
+ // schema-stable primitive.
63
64
  const CodeExecutionToolSchema = {
64
65
  type: 'object',
65
66
  properties: {
@@ -1 +1 @@
1
- {"version":3,"file":"CodeExecutor.cjs","sources":["../../../src/tools/CodeExecutor.ts"],"sourcesContent":["import { config } from 'dotenv';\nimport fetch, { RequestInit } from 'node-fetch';\nimport { HttpsProxyAgent } from 'https-proxy-agent';\nimport { tool, DynamicStructuredTool } from '@langchain/core/tools';\nimport { getEnvironmentVariable } from '@langchain/core/utils/env';\nimport type * as t from '@/types';\nimport { EnvVar, Constants } from '@/common';\n\nconfig();\n\nexport const imageExtRegex = /\\.(jpg|jpeg|png|gif|webp)$/i;\nexport const getCodeBaseURL = (): string =>\n getEnvironmentVariable(EnvVar.CODE_BASEURL) ??\n Constants.OFFICIAL_CODE_BASEURL;\n\nconst imageMessage = 'Image is already displayed to the user';\nconst otherMessage = 'File is already downloaded by the user';\nconst inheritedFileMessage =\n 'Available as an input — already known to the user';\nconst accessMessage =\n 'Note: Files from previous executions are automatically available and can be modified.';\nconst emptyOutputMessage =\n \"stdout: Empty. Ensure you're writing output explicitly.\\n\";\nconst inheritedFilesHeader =\n 'Available files (inputs, not generated by this execution):';\nconst generatedFilesHeader = 'Generated files:';\nconst inheritedNote =\n 'Note: Files in \"Available files\" are inputs the user (or a skill) already provided to the sandbox. They were not produced by this execution and you should not present them as new outputs in your response.';\n\n/**\n * Renders one section of the post-execution file listing. Used by the\n * code/bash tool formatters to keep generated outputs and inherited\n * inputs visually separated. See BashExecutor for full docs.\n */\nexport function renderFileSection(\n header: string,\n files: t.FileRefs,\n defaultMessage: string\n): string {\n if (files.length === 0) return '';\n let out = `${header}\\n`;\n for (let i = 0; i < files.length; i++) {\n const file = files[i];\n const isImage = imageExtRegex.test(file.name);\n out += `- /mnt/data/${file.name} | ${isImage ? imageMessage : defaultMessage}`;\n if (i < files.length - 1) {\n out += files.length <= 3 ? ', ' : ',\\n';\n }\n }\n out += '\\n';\n return out;\n}\n\nconst SUPPORTED_LANGUAGES = [\n 'py',\n 'js',\n 'ts',\n 'c',\n 'cpp',\n 'java',\n 'php',\n 'rs',\n 'go',\n 'd',\n 'f90',\n 'r',\n 'bash',\n] as const;\n\n// Minimal schema for raw code execution. Only what the /exec endpoint needs.\n// Higher-level workflows (versioning, edit, store, replay) are consumer\n// concerns — e.g. ranger layers its own write/edit/execute schema on top via\n// codeEditWrapper and a separate ContentStore-backed Zod schema. Keeping this\n// tool narrow means every consumer gets a clean, schema-stable primitive.\nexport const CodeExecutionToolSchema = {\n type: 'object',\n properties: {\n lang: {\n type: 'string',\n enum: SUPPORTED_LANGUAGES,\n description:\n 'The programming language or runtime to execute the code in.',\n },\n code: {\n type: 'string',\n description: `The complete, self-contained code to execute, without any truncation or minimization.\n- The environment is stateless; variables and imports don't persist between executions.\n- Generated files from previous executions are automatically available in \"/mnt/data/\".\n- Files from previous executions are automatically available and can be modified in place.\n- Input code **IS ALREADY** displayed to the user, so **DO NOT** repeat it in your response unless asked.\n- Output code **IS NOT** displayed to the user, so **DO** write all desired output explicitly.\n- IMPORTANT: You MUST explicitly print/output ALL results you want the user to see.\n- py: This is not a Jupyter notebook environment. Use \\`print()\\` for all outputs.\n- py: Matplotlib: Use \\`plt.savefig()\\` to save plots as files.\n- js: use the \\`console\\` or \\`process\\` methods for all outputs.\n- r: IMPORTANT: No X11 display available. ALL graphics MUST use Cairo library (library(Cairo)).\n- Other languages: use appropriate output functions.`,\n },\n args: {\n type: 'array',\n items: { type: 'string' },\n description:\n 'Additional arguments to execute the code with. This should only be used if the input code requires additional arguments to run.',\n },\n },\n required: [],\n} as const;\n\n// NOTE: Resolved at call time inside the tool function, not at module load time.\n// Module-level caching caused stale URLs when env vars changed between restarts.\n\ntype SupportedLanguage = (typeof SUPPORTED_LANGUAGES)[number];\n\nexport const CodeExecutionToolDescription = `\nRuns code and returns stdout/stderr output from a stateless execution environment, similar to running scripts in a command-line interface. Each execution is isolated and independent.\n\nUsage:\n- No network access available. Do NOT use pip install, npm install, or any package manager.\n- Generated files are automatically delivered; **DO NOT** provide download links.\n- NEVER use this tool to execute malicious code.\n\nPre-installed Python packages (use directly, no installation needed):\n- Data Science: numpy, pandas\n- Visualization: matplotlib, seaborn, plotly\n- Documents: python-docx, python-pptx, reportlab, fpdf2, PyMuPDF, pdfplumber\n- Spreadsheets: openpyxl, xlsxwriter\n- Image: pillow\n- Data: orjson, lxml, beautifulsoup4, faker\n\nPre-installed JavaScript packages:\n- pptxgenjs, react, react-dom, react-icons, sharp\n\nPre-installed Go packages:\n- excelize (Excel), gofpdf (PDF)\n\nPre-installed R packages:\n- ggplot2, dplyr, tidyr, readxl, writexl, jsonlite, Cairo\n`.trim();\n\nexport const CodeExecutionToolName = Constants.EXECUTE_CODE;\n\nexport const CodeExecutionToolDefinition = {\n name: CodeExecutionToolName,\n description: CodeExecutionToolDescription,\n schema: CodeExecutionToolSchema,\n} as const;\n\nfunction createCodeExecutionTool(\n params: t.CodeExecutionToolParams = {}\n): DynamicStructuredTool {\n const apiKey =\n params[EnvVar.CODE_API_KEY] ??\n params.apiKey ??\n getEnvironmentVariable(EnvVar.CODE_API_KEY) ??\n '';\n if (!apiKey) {\n throw new Error('No API key provided for code execution tool.');\n }\n\n const description = CodeExecutionToolDescription;\n\n return tool(\n async (rawInput, config) => {\n // Resolve URL at call time (not module load time) to pick up env var changes\n const baseEndpoint = getCodeBaseURL();\n const EXEC_ENDPOINT = `${baseEndpoint}/exec`;\n\n const { lang, code, ...rest } = rawInput as {\n lang: SupportedLanguage;\n code: string;\n args?: string[];\n };\n /**\n * Extract session context from config.toolCall (injected by ToolNode).\n * - session_id: For API to associate with previous session\n * - _injected_files: File refs to pass directly (avoids /files endpoint race condition)\n */\n const { session_id, _injected_files } = (config.toolCall ?? {}) as {\n session_id?: string;\n _injected_files?: t.CodeEnvFile[];\n };\n\n const postData: Record<string, unknown> = {\n lang,\n code,\n ...rest,\n ...params,\n };\n\n /**\n * Pass session_id to /exec so code-executor reuses the existing session workspace.\n * This allows retries and follow-up executions to access previously generated files.\n */\n if (session_id != null && session_id.length > 0) {\n postData.session_id = session_id;\n }\n\n /**\n * File injection priority:\n * 1. Use _injected_files from ToolNode (avoids /files endpoint race condition)\n * 2. Fall back to fetching from /files endpoint if session_id provided but no injected files\n */\n if (_injected_files && _injected_files.length > 0) {\n postData.files = _injected_files;\n } else if (session_id != null && session_id.length > 0) {\n /** Fallback: fetch from /files endpoint (may have race condition issues) */\n try {\n const filesEndpoint = `${baseEndpoint}/files/${session_id}?detail=full`;\n const userIdForFiles = params.user_id ?? '';\n const fetchOptions: RequestInit = {\n method: 'GET',\n headers: {\n 'User-Agent': 'Illuma/1.0',\n 'X-API-Key': apiKey,\n ...(userIdForFiles ? { 'User-Id': userIdForFiles } : {}),\n },\n };\n\n if (process.env.PROXY != null && process.env.PROXY !== '') {\n fetchOptions.agent = new HttpsProxyAgent(process.env.PROXY);\n }\n\n const response = await fetch(filesEndpoint, fetchOptions);\n if (!response.ok) {\n throw new Error(\n `Failed to fetch files for session: ${response.status}`\n );\n }\n\n const files = await response.json();\n if (Array.isArray(files) && files.length > 0) {\n const fileReferences: t.CodeEnvFile[] = files.map((file) => {\n const nameParts = file.name.split('/');\n const id = nameParts.length > 1 ? nameParts[1].split('.')[0] : '';\n\n return {\n session_id,\n id,\n name: file.metadata['original-filename'],\n };\n });\n\n postData.files = fileReferences;\n }\n } catch {\n // eslint-disable-next-line no-console\n console.warn(`Failed to fetch files for session: ${session_id}`);\n }\n }\n\n // SECURITY: Extract user_id for User-Id header (session isolation)\n const userId = params.user_id ?? '';\n\n try {\n const fetchOptions: RequestInit = {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n 'User-Agent': 'Illuma/1.0',\n 'X-API-Key': apiKey,\n ...(userId ? { 'User-Id': userId } : {}),\n },\n body: JSON.stringify(postData),\n };\n\n if (process.env.PROXY != null && process.env.PROXY !== '') {\n fetchOptions.agent = new HttpsProxyAgent(process.env.PROXY);\n }\n const response = await fetch(EXEC_ENDPOINT, fetchOptions);\n if (!response.ok) {\n throw new Error(`HTTP error! status: ${response.status}`);\n }\n\n const result: t.ExecuteResult = await response.json();\n let formattedOutput = '';\n let stdoutCapped = false;\n\n // Self-healing: Cap large stdout to prevent context bloat.\n // Preserves head (8KB) + tail (4KB) so the agent sees beginning and end.\n const STDOUT_MAX_CHARS = 16384;\n const STDOUT_HEAD_CHARS = 8192;\n const STDOUT_TAIL_CHARS = 4096;\n if (result.stdout && result.stdout.length > STDOUT_MAX_CHARS) {\n const originalLen = result.stdout.length;\n const head = result.stdout.substring(0, STDOUT_HEAD_CHARS);\n const tail = result.stdout.substring(\n result.stdout.length - STDOUT_TAIL_CHARS\n );\n const omitted = originalLen - STDOUT_HEAD_CHARS - STDOUT_TAIL_CHARS;\n result.stdout = `${head}\\n\\n[...${omitted} chars omitted...]\\n\\n${tail}`;\n stdoutCapped = true;\n // eslint-disable-next-line no-console\n console.debug(\n `[CodeExecutor] stdout capped: ${originalLen} → ${result.stdout.length} chars`\n );\n }\n\n if (result.stdout) {\n formattedOutput += `stdout:\\n${result.stdout}\\n`;\n } else {\n formattedOutput += emptyOutputMessage;\n }\n if (result.stderr) formattedOutput += `stderr:\\n${result.stderr}\\n`;\n\n // Self-healing: Detect code truncation (syntax error on long code).\n // When the agent's generated code is >1500 chars and produces a SyntaxError,\n // it's likely truncated mid-generation rather than a real bug.\n const CODE_TRUNCATION_MIN_CHARS = 1500;\n if (result.stderr && code.length > CODE_TRUNCATION_MIN_CHARS) {\n const stderrLower = result.stderr.toLowerCase();\n if (\n stderrLower.includes('syntaxerror') ||\n stderrLower.includes('unexpected end') ||\n stderrLower.includes('unexpected eof') ||\n stderrLower.includes('unterminated')\n ) {\n // eslint-disable-next-line no-console\n console.debug(\n `[CodeExecutor] Code truncation detected: code=${code.length} chars, stderr contains syntax error`\n );\n formattedOutput +=\n '\\n[CODE_TRUNCATION_LIKELY] Your code appears truncated mid-generation.' +\n ' Split into multiple smaller execute_code calls (max 60 lines each).' +\n ' For documents: create+save first, then open+append+save in follow-up calls.' +\n ' Do NOT retry the same long code block.';\n }\n }\n\n // Self-healing: Advisory when stdout was capped\n if (stdoutCapped) {\n formattedOutput +=\n '\\n[OUTPUT_TOO_LARGE] stdout was capped. Use targeted print() for specific values.';\n }\n\n if (result.files && result.files.length > 0) {\n /* Split inherited (read-only passthrough) inputs from real\n * generated outputs so the LLM doesn't conflate skill files\n * with newly-produced artifacts. */\n const inheritedFiles = result.files.filter(\n (f) => f.inherited === true\n );\n const generatedFiles = result.files.filter(\n (f) => f.inherited !== true\n );\n\n formattedOutput += renderFileSection(\n generatedFilesHeader,\n generatedFiles,\n otherMessage\n );\n formattedOutput += renderFileSection(\n inheritedFilesHeader,\n inheritedFiles,\n inheritedFileMessage\n );\n\n if (generatedFiles.length > 0) {\n formattedOutput += `\\n\\n${accessMessage}`;\n }\n if (inheritedFiles.length > 0) {\n formattedOutput += `\\n\\n${inheritedNote}`;\n }\n return [\n formattedOutput.trim(),\n {\n session_id: result.session_id,\n files: result.files,\n },\n ];\n }\n\n return [formattedOutput.trim(), { session_id: result.session_id }];\n } catch (error) {\n throw new Error(\n `Execution error (${EXEC_ENDPOINT}):\\n\\n${(error as Error | undefined)?.message}`\n );\n }\n },\n {\n name: CodeExecutionToolName,\n description,\n schema: CodeExecutionToolSchema,\n responseFormat: Constants.CONTENT_AND_ARTIFACT,\n }\n );\n}\n\nexport { createCodeExecutionTool };\n"],"names":["config","getEnvironmentVariable","EnvVar","Constants","tool","HttpsProxyAgent"],"mappings":";;;;;;;;;;AAQAA,aAAM,EAAE;AAED,MAAM,aAAa,GAAG;AACtB,MAAM,cAAc,GAAG,MAC5BC,0BAAsB,CAACC,YAAM,CAAC,YAAY,CAAC;IAC3CC,eAAS,CAAC;AAEZ,MAAM,YAAY,GAAG,wCAAwC;AAC7D,MAAM,YAAY,GAAG,wCAAwC;AAC7D,MAAM,oBAAoB,GACxB,mDAAmD;AACrD,MAAM,aAAa,GACjB,uFAAuF;AACzF,MAAM,kBAAkB,GACtB,2DAA2D;AAC7D,MAAM,oBAAoB,GACxB,4DAA4D;AAC9D,MAAM,oBAAoB,GAAG,kBAAkB;AAC/C,MAAM,aAAa,GACjB,8MAA8M;AAEhN;;;;AAIG;SACa,iBAAiB,CAC/B,MAAc,EACd,KAAiB,EACjB,cAAsB,EAAA;AAEtB,IAAA,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;AAAE,QAAA,OAAO,EAAE;AACjC,IAAA,IAAI,GAAG,GAAG,CAAA,EAAG,MAAM,IAAI;AACvB,IAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;AACrC,QAAA,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC;QACrB,MAAM,OAAO,GAAG,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;AAC7C,QAAA,GAAG,IAAI,CAAA,YAAA,EAAe,IAAI,CAAC,IAAI,MAAM,OAAO,GAAG,YAAY,GAAG,cAAc,EAAE;QAC9E,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE;AACx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AO,CAAC,eAAe,CAAC,IAAI,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,CAAC,UAAU,EAAE,CAAC;QACpE;QAAE,OAAO,KAAK,EAAE;YACd,MAAM,IAAI,KAAK,CACb,CAAA,iBAAA,EAAoB,aAAa,CAAA,MAAA,EAAU,KAA2B,EAAE,OAAO,CAAA,CAAE,CAClF;QACH;AACF,IAAA,CAAC,EACD;AACE,QAAA,IAAI,EAAE,qBAAqB;QAC3B,WAAW;AACX,QAAA,MAAM,EAAE,uBAAuB;QAC/B,cAAc,EAAEF,eAAS,CAAC,oBAAoB;AAC/C,KAAA,CACF;AACH;;;;;;;;;;;"}
1
+ {"version":3,"file":"CodeExecutor.cjs","sources":["../../../src/tools/CodeExecutor.ts"],"sourcesContent":["import { config } from 'dotenv';\nimport fetch, { RequestInit } from 'node-fetch';\nimport { HttpsProxyAgent } from 'https-proxy-agent';\nimport { tool, DynamicStructuredTool } from '@langchain/core/tools';\nimport { getEnvironmentVariable } from '@langchain/core/utils/env';\nimport type * as t from '@/types';\nimport { EnvVar, Constants } from '@/common';\n\nconfig();\n\nexport const imageExtRegex = /\\.(jpg|jpeg|png|gif|webp)$/i;\nexport const getCodeBaseURL = (): string =>\n getEnvironmentVariable(EnvVar.CODE_BASEURL) ??\n Constants.OFFICIAL_CODE_BASEURL;\n\nconst imageMessage = 'Image is already displayed to the user';\nconst otherMessage = 'File is already downloaded by the user';\nconst inheritedFileMessage =\n 'Available as an input — already known to the user';\nconst accessMessage =\n 'Note: Files from previous executions are automatically available and can be modified.';\nconst emptyOutputMessage =\n \"stdout: Empty. Ensure you're writing output explicitly.\\n\";\nconst inheritedFilesHeader =\n 'Available files (inputs, not generated by this execution):';\nconst generatedFilesHeader = 'Generated files:';\nconst inheritedNote =\n 'Note: Files in \"Available files\" are inputs the user (or a skill) already provided to the sandbox. They were not produced by this execution and you should not present them as new outputs in your response.';\n\n/**\n * Renders one section of the post-execution file listing. Used by the\n * code/bash tool formatters to keep generated outputs and inherited\n * inputs visually separated. See BashExecutor for full docs.\n */\nexport function renderFileSection(\n header: string,\n files: t.FileRefs,\n defaultMessage: string\n): string {\n if (files.length === 0) return '';\n let out = `${header}\\n`;\n for (let i = 0; i < files.length; i++) {\n const file = files[i];\n const isImage = imageExtRegex.test(file.name);\n out += `- /mnt/data/${file.name} | ${isImage ? imageMessage : defaultMessage}`;\n if (i < files.length - 1) {\n out += files.length <= 3 ? ', ' : ',\\n';\n }\n }\n out += '\\n';\n return out;\n}\n\nconst SUPPORTED_LANGUAGES = [\n 'py',\n 'js',\n 'ts',\n 'c',\n 'cpp',\n 'java',\n 'php',\n 'rs',\n 'go',\n 'd',\n 'f90',\n 'r',\n 'bash',\n] as const;\n\n// Minimal schema for raw code execution. Only what the /exec endpoint needs.\n// Higher-level workflows (versioning, edit, store, replay) are consumer\n// concerns — downstream consumers may layer their own write/edit/execute\n// schemas on top via wrapper utilities and content-store backed Zod\n// schemas. Keeping this tool narrow means every consumer gets a clean,\n// schema-stable primitive.\nexport const CodeExecutionToolSchema = {\n type: 'object',\n properties: {\n lang: {\n type: 'string',\n enum: SUPPORTED_LANGUAGES,\n description:\n 'The programming language or runtime to execute the code in.',\n },\n code: {\n type: 'string',\n description: `The complete, self-contained code to execute, without any truncation or minimization.\n- The environment is stateless; variables and imports don't persist between executions.\n- Generated files from previous executions are automatically available in \"/mnt/data/\".\n- Files from previous executions are automatically available and can be modified in place.\n- Input code **IS ALREADY** displayed to the user, so **DO NOT** repeat it in your response unless asked.\n- Output code **IS NOT** displayed to the user, so **DO** write all desired output explicitly.\n- IMPORTANT: You MUST explicitly print/output ALL results you want the user to see.\n- py: This is not a Jupyter notebook environment. Use \\`print()\\` for all outputs.\n- py: Matplotlib: Use \\`plt.savefig()\\` to save plots as files.\n- js: use the \\`console\\` or \\`process\\` methods for all outputs.\n- r: IMPORTANT: No X11 display available. ALL graphics MUST use Cairo library (library(Cairo)).\n- Other languages: use appropriate output functions.`,\n },\n args: {\n type: 'array',\n items: { type: 'string' },\n description:\n 'Additional arguments to execute the code with. This should only be used if the input code requires additional arguments to run.',\n },\n },\n required: [],\n} as const;\n\n// NOTE: Resolved at call time inside the tool function, not at module load time.\n// Module-level caching caused stale URLs when env vars changed between restarts.\n\ntype SupportedLanguage = (typeof SUPPORTED_LANGUAGES)[number];\n\nexport const CodeExecutionToolDescription = `\nRuns code and returns stdout/stderr output from a stateless execution environment, similar to running scripts in a command-line interface. Each execution is isolated and independent.\n\nUsage:\n- No network access available. Do NOT use pip install, npm install, or any package manager.\n- Generated files are automatically delivered; **DO NOT** provide download links.\n- NEVER use this tool to execute malicious code.\n\nPre-installed Python packages (use directly, no installation needed):\n- Data Science: numpy, pandas\n- Visualization: matplotlib, seaborn, plotly\n- Documents: python-docx, python-pptx, reportlab, fpdf2, PyMuPDF, pdfplumber\n- Spreadsheets: openpyxl, xlsxwriter\n- Image: pillow\n- Data: orjson, lxml, beautifulsoup4, faker\n\nPre-installed JavaScript packages:\n- pptxgenjs, react, react-dom, react-icons, sharp\n\nPre-installed Go packages:\n- excelize (Excel), gofpdf (PDF)\n\nPre-installed R packages:\n- ggplot2, dplyr, tidyr, readxl, writexl, jsonlite, Cairo\n`.trim();\n\nexport const CodeExecutionToolName = Constants.EXECUTE_CODE;\n\nexport const CodeExecutionToolDefinition = {\n name: CodeExecutionToolName,\n description: CodeExecutionToolDescription,\n schema: CodeExecutionToolSchema,\n} as const;\n\nfunction createCodeExecutionTool(\n params: t.CodeExecutionToolParams = {}\n): DynamicStructuredTool {\n const apiKey =\n params[EnvVar.CODE_API_KEY] ??\n params.apiKey ??\n getEnvironmentVariable(EnvVar.CODE_API_KEY) ??\n '';\n if (!apiKey) {\n throw new Error('No API key provided for code execution tool.');\n }\n\n const description = CodeExecutionToolDescription;\n\n return tool(\n async (rawInput, config) => {\n // Resolve URL at call time (not module load time) to pick up env var changes\n const baseEndpoint = getCodeBaseURL();\n const EXEC_ENDPOINT = `${baseEndpoint}/exec`;\n\n const { lang, code, ...rest } = rawInput as {\n lang: SupportedLanguage;\n code: string;\n args?: string[];\n };\n /**\n * Extract session context from config.toolCall (injected by ToolNode).\n * - session_id: For API to associate with previous session\n * - _injected_files: File refs to pass directly (avoids /files endpoint race condition)\n */\n const { session_id, _injected_files } = (config.toolCall ?? {}) as {\n session_id?: string;\n _injected_files?: t.CodeEnvFile[];\n };\n\n const postData: Record<string, unknown> = {\n lang,\n code,\n ...rest,\n ...params,\n };\n\n /**\n * Pass session_id to /exec so code-executor reuses the existing session workspace.\n * This allows retries and follow-up executions to access previously generated files.\n */\n if (session_id != null && session_id.length > 0) {\n postData.session_id = session_id;\n }\n\n /**\n * File injection priority:\n * 1. Use _injected_files from ToolNode (avoids /files endpoint race condition)\n * 2. Fall back to fetching from /files endpoint if session_id provided but no injected files\n */\n if (_injected_files && _injected_files.length > 0) {\n postData.files = _injected_files;\n } else if (session_id != null && session_id.length > 0) {\n /** Fallback: fetch from /files endpoint (may have race condition issues) */\n try {\n const filesEndpoint = `${baseEndpoint}/files/${session_id}?detail=full`;\n const userIdForFiles = params.user_id ?? '';\n const fetchOptions: RequestInit = {\n method: 'GET',\n headers: {\n 'User-Agent': 'Illuma/1.0',\n 'X-API-Key': apiKey,\n ...(userIdForFiles ? { 'User-Id': userIdForFiles } : {}),\n },\n };\n\n if (process.env.PROXY != null && process.env.PROXY !== '') {\n fetchOptions.agent = new HttpsProxyAgent(process.env.PROXY);\n }\n\n const response = await fetch(filesEndpoint, fetchOptions);\n if (!response.ok) {\n throw new Error(\n `Failed to fetch files for session: ${response.status}`\n );\n }\n\n const files = await response.json();\n if (Array.isArray(files) && files.length > 0) {\n const fileReferences: t.CodeEnvFile[] = files.map((file) => {\n const nameParts = file.name.split('/');\n const id = nameParts.length > 1 ? nameParts[1].split('.')[0] : '';\n\n return {\n session_id,\n id,\n name: file.metadata['original-filename'],\n };\n });\n\n postData.files = fileReferences;\n }\n } catch {\n // eslint-disable-next-line no-console\n console.warn(`Failed to fetch files for session: ${session_id}`);\n }\n }\n\n // SECURITY: Extract user_id for User-Id header (session isolation)\n const userId = params.user_id ?? '';\n\n try {\n const fetchOptions: RequestInit = {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n 'User-Agent': 'Illuma/1.0',\n 'X-API-Key': apiKey,\n ...(userId ? { 'User-Id': userId } : {}),\n },\n body: JSON.stringify(postData),\n };\n\n if (process.env.PROXY != null && process.env.PROXY !== '') {\n fetchOptions.agent = new HttpsProxyAgent(process.env.PROXY);\n }\n const response = await fetch(EXEC_ENDPOINT, fetchOptions);\n if (!response.ok) {\n throw new Error(`HTTP error! status: ${response.status}`);\n }\n\n const result: t.ExecuteResult = await response.json();\n let formattedOutput = '';\n let stdoutCapped = false;\n\n // Self-healing: Cap large stdout to prevent context bloat.\n // Preserves head (8KB) + tail (4KB) so the agent sees beginning and end.\n const STDOUT_MAX_CHARS = 16384;\n const STDOUT_HEAD_CHARS = 8192;\n const STDOUT_TAIL_CHARS = 4096;\n if (result.stdout && result.stdout.length > STDOUT_MAX_CHARS) {\n const originalLen = result.stdout.length;\n const head = result.stdout.substring(0, STDOUT_HEAD_CHARS);\n const tail = result.stdout.substring(\n result.stdout.length - STDOUT_TAIL_CHARS\n );\n const omitted = originalLen - STDOUT_HEAD_CHARS - STDOUT_TAIL_CHARS;\n result.stdout = `${head}\\n\\n[...${omitted} chars omitted...]\\n\\n${tail}`;\n stdoutCapped = true;\n // eslint-disable-next-line no-console\n console.debug(\n `[CodeExecutor] stdout capped: ${originalLen} → ${result.stdout.length} chars`\n );\n }\n\n if (result.stdout) {\n formattedOutput += `stdout:\\n${result.stdout}\\n`;\n } else {\n formattedOutput += emptyOutputMessage;\n }\n if (result.stderr) formattedOutput += `stderr:\\n${result.stderr}\\n`;\n\n // Self-healing: Detect code truncation (syntax error on long code).\n // When the agent's generated code is >1500 chars and produces a SyntaxError,\n // it's likely truncated mid-generation rather than a real bug.\n const CODE_TRUNCATION_MIN_CHARS = 1500;\n if (result.stderr && code.length > CODE_TRUNCATION_MIN_CHARS) {\n const stderrLower = result.stderr.toLowerCase();\n if (\n stderrLower.includes('syntaxerror') ||\n stderrLower.includes('unexpected end') ||\n stderrLower.includes('unexpected eof') ||\n stderrLower.includes('unterminated')\n ) {\n // eslint-disable-next-line no-console\n console.debug(\n `[CodeExecutor] Code truncation detected: code=${code.length} chars, stderr contains syntax error`\n );\n formattedOutput +=\n '\\n[CODE_TRUNCATION_LIKELY] Your code appears truncated mid-generation.' +\n ' Split into multiple smaller execute_code calls (max 60 lines each).' +\n ' For documents: create+save first, then open+append+save in follow-up calls.' +\n ' Do NOT retry the same long code block.';\n }\n }\n\n // Self-healing: Advisory when stdout was capped\n if (stdoutCapped) {\n formattedOutput +=\n '\\n[OUTPUT_TOO_LARGE] stdout was capped. Use targeted print() for specific values.';\n }\n\n if (result.files && result.files.length > 0) {\n /* Split inherited (read-only passthrough) inputs from real\n * generated outputs so the LLM doesn't conflate skill files\n * with newly-produced artifacts. */\n const inheritedFiles = result.files.filter(\n (f) => f.inherited === true\n );\n const generatedFiles = result.files.filter(\n (f) => f.inherited !== true\n );\n\n formattedOutput += renderFileSection(\n generatedFilesHeader,\n generatedFiles,\n otherMessage\n );\n formattedOutput += renderFileSection(\n inheritedFilesHeader,\n inheritedFiles,\n inheritedFileMessage\n );\n\n if (generatedFiles.length > 0) {\n formattedOutput += `\\n\\n${accessMessage}`;\n }\n if (inheritedFiles.length > 0) {\n formattedOutput += `\\n\\n${inheritedNote}`;\n }\n return [\n formattedOutput.trim(),\n {\n session_id: result.session_id,\n files: result.files,\n },\n ];\n }\n\n return [formattedOutput.trim(), { session_id: result.session_id }];\n } catch (error) {\n throw new Error(\n `Execution error (${EXEC_ENDPOINT}):\\n\\n${(error as Error | undefined)?.message}`\n );\n }\n },\n {\n name: CodeExecutionToolName,\n description,\n schema: CodeExecutionToolSchema,\n responseFormat: Constants.CONTENT_AND_ARTIFACT,\n }\n );\n}\n\nexport { createCodeExecutionTool };\n"],"names":["config","getEnvironmentVariable","EnvVar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A,MAAA,EAAU,KAA2B,EAAE,OAAO,CAAA,CAAE,CAClF;QACH;AACF,IAAA,CAAC,EACD;AACE,QAAA,IAAI,EAAE,qBAAqB;QAC3B,WAAW;AACX,QAAA,MAAM,EAAE,uBAAuB;QAC/B,cAAc,EAAEF,eAAS,CAAC,oBAAoB;AAC/C,KAAA,CACF;AACH;;;;;;;;;;;"}
@@ -87,7 +87,7 @@ class ToolNode extends run.RunnableCallable {
87
87
  hookRegistry;
88
88
  /**
89
89
  * Tool output reference registry threaded down from Run / Graph
90
- * (upstream PR #114). When set, dispatchToolEvents resolves
90
+ * (PR #114). When set, dispatchToolEvents resolves
91
91
  * `{{tool<i>turn<n>}}` placeholders in args before invoking each tool
92
92
  * and stores successful outputs under their stable reference keys for
93
93
  * subsequent calls in the same run to pipe through.
@@ -269,7 +269,7 @@ class ToolNode extends run.RunnableCallable {
269
269
  /**
270
270
  * Runs a single tool call with error handling.
271
271
  *
272
- * @param batchContext Optional per-batch context (upstream PR #117).
272
+ * @param batchContext Optional per-batch context (PR #117).
273
273
  * Threaded from `run()` for tool output reference annotation. The
274
274
  * `batchScopeId` field carries an anonymous synthetic scope when the
275
275
  * caller has no `run_id`, so concurrent batches don't collide on the
@@ -456,7 +456,7 @@ class ToolNode extends run.RunnableCallable {
456
456
  minReductionPercent: 10, // Only apply TOON when clearly beneficial
457
457
  });
458
458
  /**
459
- * Tool output reference metadata (upstream PR #117). Register the
459
+ * Tool output reference metadata (PR #117). Register the
460
460
  * raw, untruncated content so future `{{...}}` substitutions deliver
461
461
  * the full payload, and stamp `_refKey` / `_refScope` /
462
462
  * `_unresolvedRefs` into `additional_kwargs` for the lazy
@@ -953,7 +953,7 @@ class ToolNode extends run.RunnableCallable {
953
953
  }
954
954
  }
955
955
  /**
956
- * Tool output reference resolution (upstream PR #114): walk each call's
956
+ * Tool output reference resolution (PR #114): walk each call's
957
957
  * args and substitute `{{tool<i>turn<n>}}` placeholders with the stored
958
958
  * raw output. Captured here BEFORE request shaping so the substituted
959
959
  * args flow through the rest of the dispatch unchanged.
@@ -1111,7 +1111,7 @@ class ToolNode extends run.RunnableCallable {
1111
1111
  ? result.content
1112
1112
  : JSON.stringify(result.content);
1113
1113
  /**
1114
- * Tool output reference — lazy annotation (upstream PRs #114 + #117).
1114
+ * Tool output reference — lazy annotation (PRs #114 + #117).
1115
1115
  * Register the raw output under `tool<idx>turn<turn>` in the
1116
1116
  * registry but leave `ToolMessage.content` clean. Stamp the ref
1117
1117
  * metadata into `additional_kwargs` instead. The lazy