@falai/agent 2.6.1 → 3.0.0

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 (611) hide show
  1. package/README.md +2 -2
  2. package/dist/adapters/MemoryAdapter.d.ts +1 -1
  3. package/dist/adapters/MemoryAdapter.d.ts.map +1 -1
  4. package/dist/adapters/MemoryAdapter.js +32 -36
  5. package/dist/adapters/MemoryAdapter.js.map +1 -1
  6. package/dist/adapters/MongoAdapter.d.ts +1 -1
  7. package/dist/adapters/MongoAdapter.d.ts.map +1 -1
  8. package/dist/adapters/MongoAdapter.js +2 -2
  9. package/dist/adapters/MongoAdapter.js.map +1 -1
  10. package/dist/adapters/OpenSearchAdapter.d.ts +1 -1
  11. package/dist/adapters/OpenSearchAdapter.d.ts.map +1 -1
  12. package/dist/adapters/OpenSearchAdapter.js +3 -3
  13. package/dist/adapters/OpenSearchAdapter.js.map +1 -1
  14. package/dist/adapters/PostgreSQLAdapter.d.ts +1 -1
  15. package/dist/adapters/PostgreSQLAdapter.d.ts.map +1 -1
  16. package/dist/adapters/PostgreSQLAdapter.js +18 -13
  17. package/dist/adapters/PostgreSQLAdapter.js.map +1 -1
  18. package/dist/adapters/PrismaAdapter.d.ts +1 -1
  19. package/dist/adapters/PrismaAdapter.d.ts.map +1 -1
  20. package/dist/adapters/PrismaAdapter.js +3 -3
  21. package/dist/adapters/PrismaAdapter.js.map +1 -1
  22. package/dist/adapters/RedisAdapter.d.ts +2 -1
  23. package/dist/adapters/RedisAdapter.d.ts.map +1 -1
  24. package/dist/adapters/RedisAdapter.js +77 -27
  25. package/dist/adapters/RedisAdapter.js.map +1 -1
  26. package/dist/adapters/SQLiteAdapter.d.ts +1 -1
  27. package/dist/adapters/SQLiteAdapter.d.ts.map +1 -1
  28. package/dist/adapters/SQLiteAdapter.js +9 -31
  29. package/dist/adapters/SQLiteAdapter.js.map +1 -1
  30. package/dist/adapters/index.d.ts +13 -13
  31. package/dist/adapters/index.d.ts.map +1 -1
  32. package/dist/adapters/index.js +7 -7
  33. package/dist/adapters/index.js.map +1 -1
  34. package/dist/adapters/sessionRow.d.ts +22 -0
  35. package/dist/adapters/sessionRow.d.ts.map +1 -0
  36. package/dist/adapters/sessionRow.js +48 -0
  37. package/dist/adapters/sessionRow.js.map +1 -0
  38. package/dist/cjs/adapters/MemoryAdapter.d.ts +1 -1
  39. package/dist/cjs/adapters/MemoryAdapter.d.ts.map +1 -1
  40. package/dist/cjs/adapters/MemoryAdapter.js +39 -43
  41. package/dist/cjs/adapters/MemoryAdapter.js.map +1 -1
  42. package/dist/cjs/adapters/MongoAdapter.d.ts +1 -1
  43. package/dist/cjs/adapters/MongoAdapter.d.ts.map +1 -1
  44. package/dist/cjs/adapters/MongoAdapter.js +4 -4
  45. package/dist/cjs/adapters/MongoAdapter.js.map +1 -1
  46. package/dist/cjs/adapters/OpenSearchAdapter.d.ts +1 -1
  47. package/dist/cjs/adapters/OpenSearchAdapter.d.ts.map +1 -1
  48. package/dist/cjs/adapters/OpenSearchAdapter.js +6 -6
  49. package/dist/cjs/adapters/OpenSearchAdapter.js.map +1 -1
  50. package/dist/cjs/adapters/PostgreSQLAdapter.d.ts +1 -1
  51. package/dist/cjs/adapters/PostgreSQLAdapter.d.ts.map +1 -1
  52. package/dist/cjs/adapters/PostgreSQLAdapter.js +20 -15
  53. package/dist/cjs/adapters/PostgreSQLAdapter.js.map +1 -1
  54. package/dist/cjs/adapters/PrismaAdapter.d.ts +1 -1
  55. package/dist/cjs/adapters/PrismaAdapter.d.ts.map +1 -1
  56. package/dist/cjs/adapters/PrismaAdapter.js +7 -7
  57. package/dist/cjs/adapters/PrismaAdapter.js.map +1 -1
  58. package/dist/cjs/adapters/RedisAdapter.d.ts +2 -1
  59. package/dist/cjs/adapters/RedisAdapter.d.ts.map +1 -1
  60. package/dist/cjs/adapters/RedisAdapter.js +81 -31
  61. package/dist/cjs/adapters/RedisAdapter.js.map +1 -1
  62. package/dist/cjs/adapters/SQLiteAdapter.d.ts +1 -1
  63. package/dist/cjs/adapters/SQLiteAdapter.d.ts.map +1 -1
  64. package/dist/cjs/adapters/SQLiteAdapter.js +11 -33
  65. package/dist/cjs/adapters/SQLiteAdapter.js.map +1 -1
  66. package/dist/cjs/adapters/index.d.ts +13 -13
  67. package/dist/cjs/adapters/index.d.ts.map +1 -1
  68. package/dist/cjs/adapters/index.js +14 -14
  69. package/dist/cjs/adapters/index.js.map +1 -1
  70. package/dist/cjs/adapters/sessionRow.d.ts +22 -0
  71. package/dist/cjs/adapters/sessionRow.d.ts.map +1 -0
  72. package/dist/cjs/adapters/sessionRow.js +52 -0
  73. package/dist/cjs/adapters/sessionRow.js.map +1 -0
  74. package/dist/cjs/core/Agent.d.ts +19 -11
  75. package/dist/cjs/core/Agent.d.ts.map +1 -1
  76. package/dist/cjs/core/Agent.js +102 -64
  77. package/dist/cjs/core/Agent.js.map +1 -1
  78. package/dist/cjs/core/AutoChainExecutor.d.ts +12 -22
  79. package/dist/cjs/core/AutoChainExecutor.d.ts.map +1 -1
  80. package/dist/cjs/core/AutoChainExecutor.js +46 -49
  81. package/dist/cjs/core/AutoChainExecutor.js.map +1 -1
  82. package/dist/cjs/core/BranchEvaluator.d.ts +4 -4
  83. package/dist/cjs/core/BranchEvaluator.d.ts.map +1 -1
  84. package/dist/cjs/core/BranchEvaluator.js +6 -6
  85. package/dist/cjs/core/BranchEvaluator.js.map +1 -1
  86. package/dist/cjs/core/CompactionEngine.d.ts +16 -3
  87. package/dist/cjs/core/CompactionEngine.d.ts.map +1 -1
  88. package/dist/cjs/core/CompactionEngine.js +30 -6
  89. package/dist/cjs/core/CompactionEngine.js.map +1 -1
  90. package/dist/cjs/core/DirectiveChainTracker.d.ts +1 -1
  91. package/dist/cjs/core/DirectiveChainTracker.d.ts.map +1 -1
  92. package/dist/cjs/core/DirectiveChainTracker.js +5 -5
  93. package/dist/cjs/core/DirectiveChainTracker.js.map +1 -1
  94. package/dist/cjs/core/Events.d.ts +1 -1
  95. package/dist/cjs/core/Events.d.ts.map +1 -1
  96. package/dist/cjs/core/Events.js +15 -15
  97. package/dist/cjs/core/Events.js.map +1 -1
  98. package/dist/cjs/core/Flow.d.ts +4 -4
  99. package/dist/cjs/core/Flow.d.ts.map +1 -1
  100. package/dist/cjs/core/Flow.js +15 -15
  101. package/dist/cjs/core/Flow.js.map +1 -1
  102. package/dist/cjs/core/FlowRouter.d.ts +4 -4
  103. package/dist/cjs/core/FlowRouter.d.ts.map +1 -1
  104. package/dist/cjs/core/FlowRouter.js +92 -70
  105. package/dist/cjs/core/FlowRouter.js.map +1 -1
  106. package/dist/cjs/core/PersistenceManager.d.ts +1 -1
  107. package/dist/cjs/core/PersistenceManager.d.ts.map +1 -1
  108. package/dist/cjs/core/PersistenceManager.js +10 -10
  109. package/dist/cjs/core/PersistenceManager.js.map +1 -1
  110. package/dist/cjs/core/PromptComposer.d.ts +4 -4
  111. package/dist/cjs/core/PromptComposer.d.ts.map +1 -1
  112. package/dist/cjs/core/PromptComposer.js +13 -13
  113. package/dist/cjs/core/PromptComposer.js.map +1 -1
  114. package/dist/cjs/core/PromptSectionCache.d.ts +2 -2
  115. package/dist/cjs/core/PromptSectionCache.d.ts.map +1 -1
  116. package/dist/cjs/core/ResponseEngine.d.ts +4 -4
  117. package/dist/cjs/core/ResponseEngine.d.ts.map +1 -1
  118. package/dist/cjs/core/ResponseEngine.js +7 -7
  119. package/dist/cjs/core/ResponseEngine.js.map +1 -1
  120. package/dist/cjs/core/ResponseGenerationError.d.ts.map +1 -1
  121. package/dist/cjs/core/ResponseGenerationError.js +3 -5
  122. package/dist/cjs/core/ResponseGenerationError.js.map +1 -1
  123. package/dist/cjs/core/ResponseModal.d.ts +39 -10
  124. package/dist/cjs/core/ResponseModal.d.ts.map +1 -1
  125. package/dist/cjs/core/ResponseModal.js +195 -72
  126. package/dist/cjs/core/ResponseModal.js.map +1 -1
  127. package/dist/cjs/core/ResponsePipeline.d.ts +50 -12
  128. package/dist/cjs/core/ResponsePipeline.d.ts.map +1 -1
  129. package/dist/cjs/core/ResponsePipeline.js +301 -158
  130. package/dist/cjs/core/ResponsePipeline.js.map +1 -1
  131. package/dist/cjs/core/SessionFinalizer.d.ts +4 -4
  132. package/dist/cjs/core/SessionFinalizer.d.ts.map +1 -1
  133. package/dist/cjs/core/SessionFinalizer.js +36 -9
  134. package/dist/cjs/core/SessionFinalizer.js.map +1 -1
  135. package/dist/cjs/core/SessionManager.d.ts +15 -6
  136. package/dist/cjs/core/SessionManager.d.ts.map +1 -1
  137. package/dist/cjs/core/SessionManager.js +49 -22
  138. package/dist/cjs/core/SessionManager.js.map +1 -1
  139. package/dist/cjs/core/SignalCoordinator.d.ts +5 -5
  140. package/dist/cjs/core/SignalCoordinator.d.ts.map +1 -1
  141. package/dist/cjs/core/SignalCoordinator.js +12 -12
  142. package/dist/cjs/core/SignalCoordinator.js.map +1 -1
  143. package/dist/cjs/core/SignalEvaluator.d.ts +4 -4
  144. package/dist/cjs/core/SignalEvaluator.d.ts.map +1 -1
  145. package/dist/cjs/core/SignalEvaluator.js +6 -6
  146. package/dist/cjs/core/SignalEvaluator.js.map +1 -1
  147. package/dist/cjs/core/SignalProcessor.d.ts +6 -6
  148. package/dist/cjs/core/SignalProcessor.d.ts.map +1 -1
  149. package/dist/cjs/core/SignalProcessor.js +17 -89
  150. package/dist/cjs/core/SignalProcessor.js.map +1 -1
  151. package/dist/cjs/core/Step.d.ts +5 -5
  152. package/dist/cjs/core/Step.d.ts.map +1 -1
  153. package/dist/cjs/core/Step.js +65 -17
  154. package/dist/cjs/core/Step.js.map +1 -1
  155. package/dist/cjs/core/StepLifecycle.d.ts +18 -8
  156. package/dist/cjs/core/StepLifecycle.d.ts.map +1 -1
  157. package/dist/cjs/core/StepLifecycle.js +103 -20
  158. package/dist/cjs/core/StepLifecycle.js.map +1 -1
  159. package/dist/cjs/core/StreamingToolExecutor.d.ts +1 -1
  160. package/dist/cjs/core/StreamingToolExecutor.d.ts.map +1 -1
  161. package/dist/cjs/core/StreamingToolExecutor.js +30 -6
  162. package/dist/cjs/core/StreamingToolExecutor.js.map +1 -1
  163. package/dist/cjs/core/ToolLoopExecutor.d.ts +8 -4
  164. package/dist/cjs/core/ToolLoopExecutor.d.ts.map +1 -1
  165. package/dist/cjs/core/ToolLoopExecutor.js +189 -97
  166. package/dist/cjs/core/ToolLoopExecutor.js.map +1 -1
  167. package/dist/cjs/core/ToolManager.d.ts +6 -6
  168. package/dist/cjs/core/ToolManager.d.ts.map +1 -1
  169. package/dist/cjs/core/ToolManager.js +102 -79
  170. package/dist/cjs/core/ToolManager.js.map +1 -1
  171. package/dist/cjs/core/createAgent.d.ts +2 -2
  172. package/dist/cjs/core/createAgent.d.ts.map +1 -1
  173. package/dist/cjs/core/createAgent.js +2 -2
  174. package/dist/cjs/core/createAgent.js.map +1 -1
  175. package/dist/cjs/core/flow-namespace.d.ts +16 -1
  176. package/dist/cjs/core/flow-namespace.d.ts.map +1 -1
  177. package/dist/cjs/core/flow-namespace.js +26 -4
  178. package/dist/cjs/core/flow-namespace.js.map +1 -1
  179. package/dist/cjs/core/toolGates.d.ts +1 -1
  180. package/dist/cjs/core/toolGates.d.ts.map +1 -1
  181. package/dist/cjs/core/toolGates.js +3 -3
  182. package/dist/cjs/core/toolGates.js.map +1 -1
  183. package/dist/cjs/index.d.ts +50 -45
  184. package/dist/cjs/index.d.ts.map +1 -1
  185. package/dist/cjs/index.js +96 -88
  186. package/dist/cjs/index.js.map +1 -1
  187. package/dist/cjs/providers/AnthropicProvider.d.ts +25 -35
  188. package/dist/cjs/providers/AnthropicProvider.d.ts.map +1 -1
  189. package/dist/cjs/providers/AnthropicProvider.js +30 -426
  190. package/dist/cjs/providers/AnthropicProvider.js.map +1 -1
  191. package/dist/cjs/providers/DeepSeekProvider.d.ts +13 -34
  192. package/dist/cjs/providers/DeepSeekProvider.d.ts.map +1 -1
  193. package/dist/cjs/providers/DeepSeekProvider.js +17 -51
  194. package/dist/cjs/providers/DeepSeekProvider.js.map +1 -1
  195. package/dist/cjs/providers/GeminiProvider.d.ts +22 -75
  196. package/dist/cjs/providers/GeminiProvider.d.ts.map +1 -1
  197. package/dist/cjs/providers/GeminiProvider.js +32 -558
  198. package/dist/cjs/providers/GeminiProvider.js.map +1 -1
  199. package/dist/cjs/providers/GenericOpenAICompatibleProvider.d.ts +9 -10
  200. package/dist/cjs/providers/GenericOpenAICompatibleProvider.d.ts.map +1 -1
  201. package/dist/cjs/providers/GenericOpenAICompatibleProvider.js +14 -20
  202. package/dist/cjs/providers/GenericOpenAICompatibleProvider.js.map +1 -1
  203. package/dist/cjs/providers/OpenAICompatibleProvider.d.ts +26 -135
  204. package/dist/cjs/providers/OpenAICompatibleProvider.d.ts.map +1 -1
  205. package/dist/cjs/providers/OpenAICompatibleProvider.js +40 -496
  206. package/dist/cjs/providers/OpenAICompatibleProvider.js.map +1 -1
  207. package/dist/cjs/providers/OpenAIProvider.d.ts +14 -20
  208. package/dist/cjs/providers/OpenAIProvider.d.ts.map +1 -1
  209. package/dist/cjs/providers/OpenAIProvider.js +21 -28
  210. package/dist/cjs/providers/OpenAIProvider.js.map +1 -1
  211. package/dist/cjs/providers/OpenRouterProvider.d.ts +20 -24
  212. package/dist/cjs/providers/OpenRouterProvider.d.ts.map +1 -1
  213. package/dist/cjs/providers/OpenRouterProvider.js +22 -38
  214. package/dist/cjs/providers/OpenRouterProvider.js.map +1 -1
  215. package/dist/cjs/providers/ProviderAdapter.d.ts +94 -0
  216. package/dist/cjs/providers/ProviderAdapter.d.ts.map +1 -0
  217. package/dist/cjs/providers/ProviderAdapter.js +257 -0
  218. package/dist/cjs/providers/ProviderAdapter.js.map +1 -0
  219. package/dist/cjs/providers/index.d.ts +21 -18
  220. package/dist/cjs/providers/index.d.ts.map +1 -1
  221. package/dist/cjs/providers/index.js +23 -21
  222. package/dist/cjs/providers/index.js.map +1 -1
  223. package/dist/cjs/types/agent.d.ts +37 -11
  224. package/dist/cjs/types/agent.d.ts.map +1 -1
  225. package/dist/cjs/types/ai.d.ts +11 -21
  226. package/dist/cjs/types/ai.d.ts.map +1 -1
  227. package/dist/cjs/types/compaction.d.ts +2 -2
  228. package/dist/cjs/types/compaction.d.ts.map +1 -1
  229. package/dist/cjs/types/errors.d.ts +16 -20
  230. package/dist/cjs/types/errors.d.ts.map +1 -1
  231. package/dist/cjs/types/errors.js +17 -18
  232. package/dist/cjs/types/errors.js.map +1 -1
  233. package/dist/cjs/types/flow.d.ts +56 -39
  234. package/dist/cjs/types/flow.d.ts.map +1 -1
  235. package/dist/cjs/types/history.d.ts +1 -1
  236. package/dist/cjs/types/history.d.ts.map +1 -1
  237. package/dist/cjs/types/index.d.ts +17 -17
  238. package/dist/cjs/types/index.d.ts.map +1 -1
  239. package/dist/cjs/types/index.js +14 -14
  240. package/dist/cjs/types/index.js.map +1 -1
  241. package/dist/cjs/types/persistence.d.ts +2 -2
  242. package/dist/cjs/types/persistence.d.ts.map +1 -1
  243. package/dist/cjs/types/session.d.ts +4 -4
  244. package/dist/cjs/types/session.d.ts.map +1 -1
  245. package/dist/cjs/types/signals.d.ts +3 -3
  246. package/dist/cjs/types/signals.d.ts.map +1 -1
  247. package/dist/cjs/types/template.d.ts +2 -2
  248. package/dist/cjs/types/template.d.ts.map +1 -1
  249. package/dist/cjs/types/tool.d.ts +4 -2
  250. package/dist/cjs/types/tool.d.ts.map +1 -1
  251. package/dist/cjs/types/tool.js.map +1 -1
  252. package/dist/cjs/utils/condition.d.ts +1 -1
  253. package/dist/cjs/utils/condition.d.ts.map +1 -1
  254. package/dist/cjs/utils/condition.js +6 -6
  255. package/dist/cjs/utils/condition.js.map +1 -1
  256. package/dist/cjs/utils/event.d.ts +1 -1
  257. package/dist/cjs/utils/event.d.ts.map +1 -1
  258. package/dist/cjs/utils/event.js +2 -2
  259. package/dist/cjs/utils/event.js.map +1 -1
  260. package/dist/cjs/utils/history.d.ts +2 -2
  261. package/dist/cjs/utils/history.d.ts.map +1 -1
  262. package/dist/cjs/utils/history.js +15 -15
  263. package/dist/cjs/utils/history.js.map +1 -1
  264. package/dist/cjs/utils/index.d.ts +11 -13
  265. package/dist/cjs/utils/index.d.ts.map +1 -1
  266. package/dist/cjs/utils/index.js +57 -58
  267. package/dist/cjs/utils/index.js.map +1 -1
  268. package/dist/cjs/utils/serialize.d.ts +17 -0
  269. package/dist/cjs/utils/serialize.d.ts.map +1 -1
  270. package/dist/cjs/utils/serialize.js +33 -0
  271. package/dist/cjs/utils/serialize.js.map +1 -1
  272. package/dist/cjs/utils/session.d.ts +23 -3
  273. package/dist/cjs/utils/session.d.ts.map +1 -1
  274. package/dist/cjs/utils/session.js +40 -8
  275. package/dist/cjs/utils/session.js.map +1 -1
  276. package/dist/cjs/utils/template.d.ts +3 -3
  277. package/dist/cjs/utils/template.d.ts.map +1 -1
  278. package/dist/cjs/utils/template.js +5 -5
  279. package/dist/cjs/utils/template.js.map +1 -1
  280. package/dist/constants/index.d.ts +1 -0
  281. package/dist/constants/index.js +1 -1
  282. package/dist/core/Agent.d.ts +19 -11
  283. package/dist/core/Agent.d.ts.map +1 -1
  284. package/dist/core/Agent.js +53 -15
  285. package/dist/core/Agent.js.map +1 -1
  286. package/dist/core/AutoChainExecutor.d.ts +12 -22
  287. package/dist/core/AutoChainExecutor.d.ts.map +1 -1
  288. package/dist/core/AutoChainExecutor.js +27 -30
  289. package/dist/core/AutoChainExecutor.js.map +1 -1
  290. package/dist/core/BranchEvaluator.d.ts +4 -4
  291. package/dist/core/BranchEvaluator.d.ts.map +1 -1
  292. package/dist/core/BranchEvaluator.js +2 -2
  293. package/dist/core/BranchEvaluator.js.map +1 -1
  294. package/dist/core/CompactionEngine.d.ts +16 -3
  295. package/dist/core/CompactionEngine.d.ts.map +1 -1
  296. package/dist/core/CompactionEngine.js +30 -6
  297. package/dist/core/CompactionEngine.js.map +1 -1
  298. package/dist/core/DirectiveChainTracker.d.ts +1 -1
  299. package/dist/core/DirectiveChainTracker.d.ts.map +1 -1
  300. package/dist/core/DirectiveChainTracker.js +2 -2
  301. package/dist/core/DirectiveChainTracker.js.map +1 -1
  302. package/dist/core/Events.d.ts +1 -1
  303. package/dist/core/Events.d.ts.map +1 -1
  304. package/dist/core/Events.js +1 -1
  305. package/dist/core/Events.js.map +1 -1
  306. package/dist/core/Flow.d.ts +4 -4
  307. package/dist/core/Flow.d.ts.map +1 -1
  308. package/dist/core/Flow.js +3 -3
  309. package/dist/core/Flow.js.map +1 -1
  310. package/dist/core/FlowRouter.d.ts +4 -4
  311. package/dist/core/FlowRouter.d.ts.map +1 -1
  312. package/dist/core/FlowRouter.js +36 -14
  313. package/dist/core/FlowRouter.js.map +1 -1
  314. package/dist/core/PersistenceManager.d.ts +1 -1
  315. package/dist/core/PersistenceManager.d.ts.map +1 -1
  316. package/dist/core/PersistenceManager.js +3 -3
  317. package/dist/core/PersistenceManager.js.map +1 -1
  318. package/dist/core/PromptComposer.d.ts +4 -4
  319. package/dist/core/PromptComposer.d.ts.map +1 -1
  320. package/dist/core/PromptComposer.js +3 -3
  321. package/dist/core/PromptComposer.js.map +1 -1
  322. package/dist/core/PromptSectionCache.d.ts +2 -2
  323. package/dist/core/PromptSectionCache.d.ts.map +1 -1
  324. package/dist/core/ResponseEngine.d.ts +4 -4
  325. package/dist/core/ResponseEngine.d.ts.map +1 -1
  326. package/dist/core/ResponseEngine.js +2 -2
  327. package/dist/core/ResponseEngine.js.map +1 -1
  328. package/dist/core/ResponseGenerationError.d.ts.map +1 -1
  329. package/dist/core/ResponseGenerationError.js +3 -5
  330. package/dist/core/ResponseGenerationError.js.map +1 -1
  331. package/dist/core/ResponseModal.d.ts +39 -10
  332. package/dist/core/ResponseModal.d.ts.map +1 -1
  333. package/dist/core/ResponseModal.js +152 -29
  334. package/dist/core/ResponseModal.js.map +1 -1
  335. package/dist/core/ResponsePipeline.d.ts +50 -12
  336. package/dist/core/ResponsePipeline.d.ts.map +1 -1
  337. package/dist/core/ResponsePipeline.js +232 -89
  338. package/dist/core/ResponsePipeline.js.map +1 -1
  339. package/dist/core/SessionFinalizer.d.ts +4 -4
  340. package/dist/core/SessionFinalizer.d.ts.map +1 -1
  341. package/dist/core/SessionFinalizer.js +32 -5
  342. package/dist/core/SessionFinalizer.js.map +1 -1
  343. package/dist/core/SessionManager.d.ts +15 -6
  344. package/dist/core/SessionManager.d.ts.map +1 -1
  345. package/dist/core/SessionManager.js +46 -19
  346. package/dist/core/SessionManager.js.map +1 -1
  347. package/dist/core/SignalCoordinator.d.ts +5 -5
  348. package/dist/core/SignalCoordinator.d.ts.map +1 -1
  349. package/dist/core/SignalCoordinator.js +2 -2
  350. package/dist/core/SignalCoordinator.js.map +1 -1
  351. package/dist/core/SignalEvaluator.d.ts +4 -4
  352. package/dist/core/SignalEvaluator.d.ts.map +1 -1
  353. package/dist/core/SignalEvaluator.js +2 -2
  354. package/dist/core/SignalEvaluator.js.map +1 -1
  355. package/dist/core/SignalProcessor.d.ts +6 -6
  356. package/dist/core/SignalProcessor.d.ts.map +1 -1
  357. package/dist/core/SignalProcessor.js +7 -79
  358. package/dist/core/SignalProcessor.js.map +1 -1
  359. package/dist/core/Step.d.ts +5 -5
  360. package/dist/core/Step.d.ts.map +1 -1
  361. package/dist/core/Step.js +53 -5
  362. package/dist/core/Step.js.map +1 -1
  363. package/dist/core/StepLifecycle.d.ts +18 -8
  364. package/dist/core/StepLifecycle.d.ts.map +1 -1
  365. package/dist/core/StepLifecycle.js +98 -15
  366. package/dist/core/StepLifecycle.js.map +1 -1
  367. package/dist/core/StreamingToolExecutor.d.ts +1 -1
  368. package/dist/core/StreamingToolExecutor.d.ts.map +1 -1
  369. package/dist/core/StreamingToolExecutor.js +29 -5
  370. package/dist/core/StreamingToolExecutor.js.map +1 -1
  371. package/dist/core/ToolLoopExecutor.d.ts +8 -4
  372. package/dist/core/ToolLoopExecutor.d.ts.map +1 -1
  373. package/dist/core/ToolLoopExecutor.js +157 -65
  374. package/dist/core/ToolLoopExecutor.js.map +1 -1
  375. package/dist/core/ToolManager.d.ts +6 -6
  376. package/dist/core/ToolManager.d.ts.map +1 -1
  377. package/dist/core/ToolManager.js +44 -21
  378. package/dist/core/ToolManager.js.map +1 -1
  379. package/dist/core/createAgent.d.ts +2 -2
  380. package/dist/core/createAgent.d.ts.map +1 -1
  381. package/dist/core/createAgent.js +1 -1
  382. package/dist/core/createAgent.js.map +1 -1
  383. package/dist/core/flow-namespace.d.ts +16 -1
  384. package/dist/core/flow-namespace.d.ts.map +1 -1
  385. package/dist/core/flow-namespace.js +23 -1
  386. package/dist/core/flow-namespace.js.map +1 -1
  387. package/dist/core/toolGates.d.ts +1 -1
  388. package/dist/core/toolGates.d.ts.map +1 -1
  389. package/dist/core/toolGates.js +1 -1
  390. package/dist/core/toolGates.js.map +1 -1
  391. package/dist/index.d.ts +50 -45
  392. package/dist/index.d.ts.map +1 -1
  393. package/dist/index.js +34 -30
  394. package/dist/index.js.map +1 -1
  395. package/dist/providers/AnthropicProvider.d.ts +25 -35
  396. package/dist/providers/AnthropicProvider.d.ts.map +1 -1
  397. package/dist/providers/AnthropicProvider.js +30 -423
  398. package/dist/providers/AnthropicProvider.js.map +1 -1
  399. package/dist/providers/DeepSeekProvider.d.ts +13 -34
  400. package/dist/providers/DeepSeekProvider.d.ts.map +1 -1
  401. package/dist/providers/DeepSeekProvider.js +16 -47
  402. package/dist/providers/DeepSeekProvider.js.map +1 -1
  403. package/dist/providers/GeminiProvider.d.ts +22 -75
  404. package/dist/providers/GeminiProvider.d.ts.map +1 -1
  405. package/dist/providers/GeminiProvider.js +32 -558
  406. package/dist/providers/GeminiProvider.js.map +1 -1
  407. package/dist/providers/GenericOpenAICompatibleProvider.d.ts +9 -10
  408. package/dist/providers/GenericOpenAICompatibleProvider.d.ts.map +1 -1
  409. package/dist/providers/GenericOpenAICompatibleProvider.js +13 -16
  410. package/dist/providers/GenericOpenAICompatibleProvider.js.map +1 -1
  411. package/dist/providers/OpenAICompatibleProvider.d.ts +26 -135
  412. package/dist/providers/OpenAICompatibleProvider.d.ts.map +1 -1
  413. package/dist/providers/OpenAICompatibleProvider.js +39 -495
  414. package/dist/providers/OpenAICompatibleProvider.js.map +1 -1
  415. package/dist/providers/OpenAIProvider.d.ts +14 -20
  416. package/dist/providers/OpenAIProvider.d.ts.map +1 -1
  417. package/dist/providers/OpenAIProvider.js +20 -24
  418. package/dist/providers/OpenAIProvider.js.map +1 -1
  419. package/dist/providers/OpenRouterProvider.d.ts +20 -24
  420. package/dist/providers/OpenRouterProvider.d.ts.map +1 -1
  421. package/dist/providers/OpenRouterProvider.js +21 -34
  422. package/dist/providers/OpenRouterProvider.js.map +1 -1
  423. package/dist/providers/ProviderAdapter.d.ts +94 -0
  424. package/dist/providers/ProviderAdapter.d.ts.map +1 -0
  425. package/dist/providers/ProviderAdapter.js +251 -0
  426. package/dist/providers/ProviderAdapter.js.map +1 -0
  427. package/dist/providers/index.d.ts +21 -18
  428. package/dist/providers/index.d.ts.map +1 -1
  429. package/dist/providers/index.js +13 -10
  430. package/dist/providers/index.js.map +1 -1
  431. package/dist/types/agent.d.ts +37 -11
  432. package/dist/types/agent.d.ts.map +1 -1
  433. package/dist/types/ai.d.ts +11 -21
  434. package/dist/types/ai.d.ts.map +1 -1
  435. package/dist/types/compaction.d.ts +2 -2
  436. package/dist/types/compaction.d.ts.map +1 -1
  437. package/dist/types/errors.d.ts +16 -20
  438. package/dist/types/errors.d.ts.map +1 -1
  439. package/dist/types/errors.js +15 -16
  440. package/dist/types/errors.js.map +1 -1
  441. package/dist/types/flow.d.ts +56 -39
  442. package/dist/types/flow.d.ts.map +1 -1
  443. package/dist/types/history.d.ts +1 -1
  444. package/dist/types/history.d.ts.map +1 -1
  445. package/dist/types/index.d.ts +17 -17
  446. package/dist/types/index.d.ts.map +1 -1
  447. package/dist/types/index.js +4 -4
  448. package/dist/types/index.js.map +1 -1
  449. package/dist/types/persistence.d.ts +2 -2
  450. package/dist/types/persistence.d.ts.map +1 -1
  451. package/dist/types/session.d.ts +4 -4
  452. package/dist/types/session.d.ts.map +1 -1
  453. package/dist/types/signals.d.ts +3 -3
  454. package/dist/types/signals.d.ts.map +1 -1
  455. package/dist/types/template.d.ts +2 -2
  456. package/dist/types/template.d.ts.map +1 -1
  457. package/dist/types/tool.d.ts +4 -2
  458. package/dist/types/tool.d.ts.map +1 -1
  459. package/dist/types/tool.js.map +1 -1
  460. package/dist/utils/condition.d.ts +1 -1
  461. package/dist/utils/condition.d.ts.map +1 -1
  462. package/dist/utils/condition.js +2 -2
  463. package/dist/utils/condition.js.map +1 -1
  464. package/dist/utils/event.d.ts +1 -1
  465. package/dist/utils/event.d.ts.map +1 -1
  466. package/dist/utils/event.js +1 -1
  467. package/dist/utils/event.js.map +1 -1
  468. package/dist/utils/history.d.ts +2 -2
  469. package/dist/utils/history.d.ts.map +1 -1
  470. package/dist/utils/history.js +1 -1
  471. package/dist/utils/history.js.map +1 -1
  472. package/dist/utils/index.d.ts +11 -13
  473. package/dist/utils/index.d.ts.map +1 -1
  474. package/dist/utils/index.js +11 -12
  475. package/dist/utils/index.js.map +1 -1
  476. package/dist/utils/serialize.d.ts +17 -0
  477. package/dist/utils/serialize.d.ts.map +1 -1
  478. package/dist/utils/serialize.js +31 -0
  479. package/dist/utils/serialize.js.map +1 -1
  480. package/dist/utils/session.d.ts +23 -3
  481. package/dist/utils/session.d.ts.map +1 -1
  482. package/dist/utils/session.js +35 -6
  483. package/dist/utils/session.js.map +1 -1
  484. package/dist/utils/template.d.ts +3 -3
  485. package/dist/utils/template.d.ts.map +1 -1
  486. package/dist/utils/template.js +1 -1
  487. package/dist/utils/template.js.map +1 -1
  488. package/docs/concepts/architecture.md +3 -3
  489. package/docs/concepts/directives.md +1 -1
  490. package/docs/guides/error-handling.md +46 -45
  491. package/docs/guides/flow-control.md +8 -1
  492. package/docs/guides/instructions.md +15 -6
  493. package/docs/guides/persistence.md +12 -5
  494. package/docs/guides/streaming.md +10 -0
  495. package/docs/migration/README.md +4 -0
  496. package/docs/migration/v2-3-to-v2-4.md +4 -0
  497. package/docs/migration/v2-6-to-v2-7.md +246 -0
  498. package/docs/reference/adapters.md +15 -1
  499. package/docs/reference/branches.md +2 -0
  500. package/docs/reference/create-agent.md +28 -0
  501. package/docs/reference/directive.md +1 -1
  502. package/docs/reference/errors.md +30 -32
  503. package/docs/reference/providers.md +63 -60
  504. package/docs/reference/step.md +28 -21
  505. package/docs/reference/tool.md +14 -5
  506. package/docs/start/02-first-agent.md +8 -4
  507. package/docs/start/03-collect-data.md +19 -10
  508. package/examples/01-quickstart.ts +2 -2
  509. package/examples/02-data-extraction.ts +1 -1
  510. package/examples/03-tools.ts +1 -1
  511. package/examples/04-instructions.ts +2 -2
  512. package/examples/05-branching.ts +3 -3
  513. package/examples/06-flow-control.ts +3 -3
  514. package/examples/07-streaming.ts +1 -1
  515. package/examples/08-persistence.ts +2 -2
  516. package/examples/09-signals.ts +1 -1
  517. package/examples/tsconfig.json +6 -3
  518. package/package.json +9 -7
  519. package/src/adapters/MemoryAdapter.ts +33 -37
  520. package/src/adapters/MongoAdapter.ts +3 -3
  521. package/src/adapters/OpenSearchAdapter.ts +4 -4
  522. package/src/adapters/PostgreSQLAdapter.ts +26 -21
  523. package/src/adapters/PrismaAdapter.ts +4 -4
  524. package/src/adapters/RedisAdapter.ts +84 -37
  525. package/src/adapters/SQLiteAdapter.ts +13 -34
  526. package/src/adapters/index.ts +13 -13
  527. package/src/adapters/sessionRow.ts +57 -0
  528. package/src/core/Agent.ts +64 -18
  529. package/src/core/AutoChainExecutor.ts +44 -57
  530. package/src/core/BranchEvaluator.ts +5 -5
  531. package/src/core/CompactionEngine.ts +42 -8
  532. package/src/core/DirectiveChainTracker.ts +3 -3
  533. package/src/core/Events.ts +2 -2
  534. package/src/core/Flow.ts +9 -9
  535. package/src/core/FlowRouter.ts +46 -20
  536. package/src/core/PersistenceManager.ts +4 -4
  537. package/src/core/PromptComposer.ts +8 -8
  538. package/src/core/PromptSectionCache.ts +2 -2
  539. package/src/core/ResponseEngine.ts +6 -6
  540. package/src/core/ResponseGenerationError.ts +3 -6
  541. package/src/core/ResponseModal.ts +205 -39
  542. package/src/core/ResponsePipeline.ts +301 -107
  543. package/src/core/SessionFinalizer.ts +40 -10
  544. package/src/core/SessionManager.ts +61 -27
  545. package/src/core/SignalCoordinator.ts +7 -7
  546. package/src/core/SignalEvaluator.ts +6 -6
  547. package/src/core/SignalProcessor.ts +13 -93
  548. package/src/core/Step.ts +87 -10
  549. package/src/core/StepLifecycle.ts +129 -26
  550. package/src/core/StreamingToolExecutor.ts +33 -8
  551. package/src/core/ToolLoopExecutor.ts +206 -80
  552. package/src/core/ToolManager.ts +53 -26
  553. package/src/core/createAgent.ts +2 -2
  554. package/src/core/flow-namespace.ts +31 -2
  555. package/src/core/toolGates.ts +2 -2
  556. package/src/index.ts +59 -45
  557. package/src/providers/AnthropicProvider.ts +44 -595
  558. package/src/providers/DeepSeekProvider.ts +27 -92
  559. package/src/providers/GeminiProvider.ts +41 -752
  560. package/src/providers/GenericOpenAICompatibleProvider.ts +19 -27
  561. package/src/providers/OpenAICompatibleProvider.ts +58 -764
  562. package/src/providers/OpenAIProvider.ts +31 -55
  563. package/src/providers/OpenRouterProvider.ts +40 -70
  564. package/src/providers/ProviderAdapter.ts +368 -0
  565. package/src/providers/index.ts +21 -23
  566. package/src/types/agent.ts +36 -11
  567. package/src/types/ai.ts +11 -21
  568. package/src/types/compaction.ts +2 -2
  569. package/src/types/errors.ts +17 -35
  570. package/src/types/flow.ts +44 -46
  571. package/src/types/history.ts +1 -1
  572. package/src/types/index.ts +18 -17
  573. package/src/types/persistence.ts +2 -2
  574. package/src/types/session.ts +4 -4
  575. package/src/types/signals.ts +3 -3
  576. package/src/types/template.ts +2 -2
  577. package/src/types/tool.ts +4 -2
  578. package/src/utils/condition.ts +3 -3
  579. package/src/utils/event.ts +1 -1
  580. package/src/utils/history.ts +3 -3
  581. package/src/utils/index.ts +14 -15
  582. package/src/utils/serialize.ts +38 -0
  583. package/src/utils/session.ts +46 -9
  584. package/src/utils/template.ts +3 -3
  585. package/dist/cjs/core/DirectiveBus.d.ts +0 -88
  586. package/dist/cjs/core/DirectiveBus.d.ts.map +0 -1
  587. package/dist/cjs/core/DirectiveBus.js +0 -196
  588. package/dist/cjs/core/DirectiveBus.js.map +0 -1
  589. package/dist/cjs/providers/errorClassification.d.ts +0 -61
  590. package/dist/cjs/providers/errorClassification.d.ts.map +0 -1
  591. package/dist/cjs/providers/errorClassification.js +0 -123
  592. package/dist/cjs/providers/errorClassification.js.map +0 -1
  593. package/dist/cjs/utils/retry.d.ts +0 -67
  594. package/dist/cjs/utils/retry.d.ts.map +0 -1
  595. package/dist/cjs/utils/retry.js +0 -201
  596. package/dist/cjs/utils/retry.js.map +0 -1
  597. package/dist/core/DirectiveBus.d.ts +0 -88
  598. package/dist/core/DirectiveBus.d.ts.map +0 -1
  599. package/dist/core/DirectiveBus.js +0 -192
  600. package/dist/core/DirectiveBus.js.map +0 -1
  601. package/dist/providers/errorClassification.d.ts +0 -61
  602. package/dist/providers/errorClassification.d.ts.map +0 -1
  603. package/dist/providers/errorClassification.js +0 -116
  604. package/dist/providers/errorClassification.js.map +0 -1
  605. package/dist/utils/retry.d.ts +0 -67
  606. package/dist/utils/retry.d.ts.map +0 -1
  607. package/dist/utils/retry.js +0 -193
  608. package/dist/utils/retry.js.map +0 -1
  609. package/src/core/DirectiveBus.ts +0 -248
  610. package/src/providers/errorClassification.ts +0 -172
  611. package/src/utils/retry.ts +0 -274
@@ -16,8 +16,14 @@
16
16
  */
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.ToolLoopExecutor = void 0;
19
- const ResponseGenerationError_1 = require("./ResponseGenerationError");
20
- const utils_1 = require("../utils");
19
+ const ResponseGenerationError_js_1 = require("./ResponseGenerationError.js");
20
+ const flow_namespace_js_1 = require("./flow-namespace.js");
21
+ const index_js_1 = require("../utils/index.js");
22
+ const executionFailure = (toolName, error) => JSON.stringify({
23
+ success: false,
24
+ error: `${toolName}: ${error instanceof Error ? error.message : String(error)}`,
25
+ });
26
+ const toolNotFoundFailure = (toolName) => JSON.stringify({ success: false, error: `Tool "${toolName}" is not registered in any scope.` });
21
27
  class ToolLoopExecutor {
22
28
  constructor(deps) {
23
29
  this.deps = deps;
@@ -34,19 +40,27 @@ class ToolLoopExecutor {
34
40
  // runFollowUpLoop; here toolCalls is only read.
35
41
  const { toolCalls } = params;
36
42
  let { session } = params;
43
+ // Directives emitted by tools this turn — consumed by the caller
44
+ const collectedDirectives = [];
37
45
  // Convert HistoryItem[] to Event[] for internal processing
38
- const historyEvents = (0, utils_1.historyToEvents)(history);
39
- // Map to store tool execution results for history
40
- const toolResultsMap = new Map();
41
- // Map to store tool call arguments for history reconstruction
42
- const toolArgsMap = new Map();
46
+ const historyEvents = (0, index_js_1.historyToEvents)(history);
47
+ // Execution records keyed by call shared with the follow-up loop
48
+ const records = [];
43
49
  // Execute initial dynamic tool calls
44
50
  if (toolCalls && toolCalls.length > 0) {
45
- utils_1.logger.debug(`[ToolLoopExecutor] Executing ${toolCalls.length} dynamic tool calls:`, toolCalls.map(tc => tc.toolName));
46
- for (const toolCall of toolCalls) {
51
+ index_js_1.logger.debug(`[ToolLoopExecutor] Executing ${toolCalls.length} dynamic tool calls:`, toolCalls.map(tc => tc.toolName));
52
+ for (const [callIndex, toolCall] of toolCalls.entries()) {
53
+ const record = {
54
+ requestId: `init-${callIndex}-${toolCall.toolName}`,
55
+ toolName: toolCall.toolName,
56
+ arguments: toolCall.arguments,
57
+ round: 0,
58
+ };
59
+ records.push(record);
47
60
  const tool = this.findAvailableTool(toolCall.toolName, selectedFlow);
48
61
  if (!tool) {
49
- utils_1.logger.warn(`[ToolExecutionError] Tool not found: "${toolCall.toolName}" is not registered in any scope. Skipping this tool call. Register the tool or check the tool name.`);
62
+ index_js_1.logger.warn(`[ToolExecutionError] Tool not found: "${toolCall.toolName}" is not registered in any scope. Register the tool or check the tool name.`);
63
+ record.result = toolNotFoundFailure(toolCall.toolName);
50
64
  continue;
51
65
  }
52
66
  try {
@@ -61,11 +75,14 @@ class ToolLoopExecutor {
61
75
  toolArguments: toolCall.arguments,
62
76
  });
63
77
  // Store the actual tool result data for history
64
- toolResultsMap.set(toolCall.toolName, (0, utils_1.serializeToolResult)(toolResult));
65
- toolArgsMap.set(toolCall.toolName, toolCall.arguments);
78
+ record.result = (0, index_js_1.serializeToolResult)(toolResult);
79
+ // Collect tool-emitted directives (ctx.dispatch / {directive})
80
+ if (toolResult.directives?.length) {
81
+ collectedDirectives.push(...toolResult.directives);
82
+ }
66
83
  // Check if tool execution was successful
67
84
  if (!toolResult.success) {
68
- utils_1.logger.error(`[ToolLoopExecutor] Tool execution failed: ${toolCall.toolName} - ${toolResult.error}`);
85
+ index_js_1.logger.error(`[ToolLoopExecutor] Tool execution failed: ${toolCall.toolName} - ${toolResult.error}`);
69
86
  // Continue with other tools rather than failing completely
70
87
  continue;
71
88
  }
@@ -75,7 +92,7 @@ class ToolLoopExecutor {
75
92
  await this.deps.updateContext(toolResult.contextUpdate);
76
93
  }
77
94
  catch (error) {
78
- utils_1.logger.error(`[ToolLoopExecutor] Failed to update context from tool ${toolCall.toolName}:`, error);
95
+ index_js_1.logger.error(`[ToolLoopExecutor] Failed to update context from tool ${toolCall.toolName}:`, error);
79
96
  // Continue execution but log the error
80
97
  }
81
98
  }
@@ -83,30 +100,46 @@ class ToolLoopExecutor {
83
100
  if (toolResult.dataUpdate) {
84
101
  try {
85
102
  session = await this.deps.updateSessionData(session, toolResult.dataUpdate);
86
- utils_1.logger.debug(`[ToolLoopExecutor] Tool updated collected data:`, toolResult.dataUpdate);
103
+ index_js_1.logger.debug(`[ToolLoopExecutor] Tool updated collected data:`, toolResult.dataUpdate);
87
104
  }
88
105
  catch (error) {
89
- utils_1.logger.error(`[ToolLoopExecutor] Failed to update data from tool ${toolCall.toolName}:`, error);
106
+ index_js_1.logger.error(`[ToolLoopExecutor] Failed to update data from tool ${toolCall.toolName}:`, error);
90
107
  // Continue execution but log the error
91
108
  }
92
109
  }
93
- utils_1.logger.debug(`[ToolLoopExecutor] Executed dynamic tool: ${toolCall.toolName} (success: ${toolResult.success})`);
110
+ index_js_1.logger.debug(`[ToolLoopExecutor] Executed dynamic tool: ${toolCall.toolName} (success: ${toolResult.success})`);
94
111
  }
95
112
  catch (error) {
96
- utils_1.logger.error(`[ToolLoopExecutor] Tool execution error for ${toolCall.toolName}:`, error);
97
- // Continue with other tools rather than failing the entire response
113
+ index_js_1.logger.error(`[ToolLoopExecutor] Tool execution error for ${toolCall.toolName}:`, error);
114
+ // A thrown handler must be visible to the model as a FAILED
115
+ // tool call — reporting success makes it confirm actions
116
+ // that never happened.
117
+ record.result = executionFailure(toolCall.toolName, error);
98
118
  continue;
99
119
  }
100
120
  }
101
121
  }
122
+ // A tool spoke verbatim this turn: its reply IS the final message —
123
+ // skip the follow-up LLM call (documented dispatch semantics).
124
+ const preLoopDirectives = flow_namespace_js_1.flow.mergeAll(collectedDirectives);
125
+ if (preLoopDirectives?.reply) {
126
+ index_js_1.logger.debug("[ToolLoopExecutor] Tool directive reply short-circuits follow-up LLM call");
127
+ return {
128
+ session,
129
+ finalToolCalls: toolCalls,
130
+ finalMessage: preLoopDirectives.reply,
131
+ structured: { message: preLoopDirectives.reply },
132
+ directives: preLoopDirectives,
133
+ };
134
+ }
102
135
  // Hand off to the multi-round follow-up loop shared with the
103
136
  // streaming path. The initial batch above already executed
104
137
  // sequentially and populated the result maps.
105
138
  return await this.runFollowUpLoop({
106
139
  toolCalls,
107
140
  session,
108
- toolResultsMap,
109
- toolArgsMap,
141
+ records,
142
+ collectedDirectives,
110
143
  context,
111
144
  history,
112
145
  selectedFlow,
@@ -117,7 +150,7 @@ class ToolLoopExecutor {
117
150
  });
118
151
  }
119
152
  catch (error) {
120
- throw ResponseGenerationError_1.ResponseGenerationError.fromError(error, 'tool_execution', params, {
153
+ throw ResponseGenerationError_js_1.ResponseGenerationError.fromError(error, 'tool_execution', params, {
121
154
  toolCallsCount: params.toolCalls?.length || 0,
122
155
  availableToolsCount: params.availableTools.length
123
156
  });
@@ -134,7 +167,7 @@ class ToolLoopExecutor {
134
167
  * maps; from here both paths behave identically.
135
168
  */
136
169
  async runFollowUpLoop(params) {
137
- const { context, history, selectedFlow, responsePrompt, availableTools, responseSchema, signal, toolResultsMap, toolArgsMap } = params;
170
+ const { context, history, selectedFlow, responsePrompt, availableTools, responseSchema, signal, records, collectedDirectives = [] } = params;
138
171
  let { toolCalls, session } = params;
139
172
  try {
140
173
  // TOOL LOOP: Allow AI to make follow-up tool calls after initial tool execution
@@ -147,35 +180,33 @@ class ToolLoopExecutor {
147
180
  let followUpStructured;
148
181
  while (hasToolCalls && toolLoopCount < MAX_TOOL_LOOPS) {
149
182
  toolLoopCount++;
150
- utils_1.logger.debug(`[ToolLoopExecutor] Starting tool loop ${toolLoopCount}/${MAX_TOOL_LOOPS} with ${toolCalls?.length || 0} tool calls`);
151
- // Create tool result history items
183
+ index_js_1.logger.debug(`[ToolLoopExecutor] Starting tool loop ${toolLoopCount}/${MAX_TOOL_LOOPS} with ${toolCalls?.length || 0} tool calls`);
184
+ // Create tool result history items for the PREVIOUS round's
185
+ // calls. Failures are reported as failures — never as success.
186
+ const previousRound = toolLoopCount - 1;
187
+ const roundRecords = records.filter((r) => r.round === previousRound);
152
188
  const toolResultHistoryItems = [];
153
- for (const toolCall of toolCalls || []) {
154
- const tool = this.findAvailableTool(toolCall.toolName, selectedFlow);
155
- if (tool) {
156
- // assistant tool_call + tool result pair, via the shared
157
- // history factories (same as forceFinalTextFromTools).
158
- toolResultHistoryItems.push((0, utils_1.assistantMessage)(null, [
159
- { id: toolCall.toolName, name: toolCall.toolName, arguments: toolCall.arguments },
160
- ]), (0, utils_1.toolMessage)(toolCall.toolName, toolCall.toolName, toolResultsMap.get(toolCall.toolName) || "Tool executed successfully"));
161
- }
189
+ for (const record of roundRecords) {
190
+ toolResultHistoryItems.push((0, index_js_1.assistantMessage)(null, [
191
+ { id: record.requestId, name: record.toolName, arguments: record.arguments },
192
+ ]), (0, index_js_1.toolMessage)(record.toolName, record.requestId, record.result ?? toolNotFoundFailure(record.toolName)));
162
193
  }
163
194
  // Create updated history with tool results
164
195
  const updatedHistory = [...history, ...toolResultHistoryItems];
165
- // Make follow-up AI call to see if more tools are needed
166
- // After first iteration, don't provide tools to force a text response
196
+ // Make follow-up AI call to see if more tools are needed.
197
+ // Tools are offered EVERY iteration the loop is already bounded
198
+ // by MAX_TOOL_LOOPS, so withholding them after round only made
199
+ // maxToolLoops values above 2 unreachable.
167
200
  const agentOptions = this.deps.getAgentOptions();
168
- const shouldProvideTools = toolLoopCount === 1;
169
- utils_1.logger.debug(`[ToolLoopExecutor] Making follow-up AI call (loop ${toolLoopCount}):`, {
170
- providingTools: shouldProvideTools,
171
- toolsCount: shouldProvideTools ? availableTools.length : 0,
172
- addingTextInstruction: toolLoopCount > 1,
201
+ index_js_1.logger.debug(`[ToolLoopExecutor] Making follow-up AI call (loop ${toolLoopCount}):`, {
202
+ providingTools: true,
203
+ toolsCount: availableTools.length,
173
204
  });
174
205
  const followUpResult = await agentOptions.provider.generateMessage({
175
- prompt: responsePrompt + (toolLoopCount > 1 ? "\n\nProvide a text response to the user based on the tool results." : ""),
206
+ prompt: responsePrompt,
176
207
  history: updatedHistory, // Use HistoryItem[] for AI provider
177
208
  context,
178
- tools: shouldProvideTools ? availableTools : [], // Only provide tools on first iteration
209
+ tools: availableTools,
179
210
  parameters: responseSchema ? {
180
211
  jsonSchema: responseSchema,
181
212
  schemaName: "tool_followup",
@@ -185,7 +216,7 @@ class ToolLoopExecutor {
185
216
  // Check if follow-up call has more tool calls
186
217
  const followUpToolCalls = followUpResult.structured?.toolCalls;
187
218
  hasToolCalls = followUpToolCalls && followUpToolCalls.length > 0;
188
- utils_1.logger.debug(`[ToolLoopExecutor] Follow-up AI response (loop ${toolLoopCount}):`, {
219
+ index_js_1.logger.debug(`[ToolLoopExecutor] Follow-up AI response (loop ${toolLoopCount}):`, {
189
220
  hasMessage: !!followUpResult.message,
190
221
  messageLength: followUpResult.message?.length || 0,
191
222
  hasToolCalls,
@@ -193,12 +224,20 @@ class ToolLoopExecutor {
193
224
  toolNames: followUpToolCalls?.map(tc => tc.toolName) || [],
194
225
  });
195
226
  if (hasToolCalls) {
196
- utils_1.logger.debug(`[ToolLoopExecutor] Follow-up call produced ${followUpToolCalls.length} additional tool calls`);
227
+ index_js_1.logger.debug(`[ToolLoopExecutor] Follow-up call produced ${followUpToolCalls.length} additional tool calls`);
197
228
  // Execute the follow-up tool calls
198
- for (const toolCall of followUpToolCalls) {
229
+ for (const [callIndex, toolCall] of followUpToolCalls.entries()) {
230
+ const record = {
231
+ requestId: `fup-${toolLoopCount}-${callIndex}-${toolCall.toolName}`,
232
+ toolName: toolCall.toolName,
233
+ arguments: toolCall.arguments,
234
+ round: toolLoopCount,
235
+ };
236
+ records.push(record);
199
237
  const tool = this.findAvailableTool(toolCall.toolName, selectedFlow);
200
238
  if (!tool) {
201
- utils_1.logger.warn(`[ToolExecutionError] Tool not found in follow-up: "${toolCall.toolName}" is not registered in any scope. Skipping this tool call. Register the tool or check the tool name.`);
239
+ index_js_1.logger.warn(`[ToolExecutionError] Tool not found in follow-up: "${toolCall.toolName}" is not registered in any scope. Register the tool or check the tool name.`);
240
+ record.result = toolNotFoundFailure(toolCall.toolName);
202
241
  continue;
203
242
  }
204
243
  try {
@@ -208,13 +247,13 @@ class ToolLoopExecutor {
208
247
  context,
209
248
  updateContext: this.deps.updateContext,
210
249
  updateData: this.deps.updateCollectedData,
211
- history: (0, utils_1.historyToEvents)(updatedHistory), // Convert to Event[] for tool execution
250
+ history: (0, index_js_1.historyToEvents)(updatedHistory), // Convert to Event[] for tool execution
212
251
  data: session.data,
213
252
  toolArguments: toolCall.arguments,
214
253
  });
215
254
  // Check if tool execution was successful
216
255
  if (!toolResult.success) {
217
- utils_1.logger.error(`[ToolLoopExecutor] Follow-up tool execution failed: ${toolCall.toolName} - ${toolResult.error}`);
256
+ index_js_1.logger.error(`[ToolLoopExecutor] Follow-up tool execution failed: ${toolCall.toolName} - ${toolResult.error}`);
218
257
  continue;
219
258
  }
220
259
  // Update context with follow-up tool results
@@ -223,33 +262,49 @@ class ToolLoopExecutor {
223
262
  await this.deps.updateContext(toolResult.contextUpdate);
224
263
  }
225
264
  catch (error) {
226
- utils_1.logger.error(`[ToolLoopExecutor] Failed to update context from follow-up tool ${toolCall.toolName}:`, error);
265
+ index_js_1.logger.error(`[ToolLoopExecutor] Failed to update context from follow-up tool ${toolCall.toolName}:`, error);
227
266
  }
228
267
  }
229
268
  if (toolResult.dataUpdate) {
230
269
  try {
231
270
  session = await this.deps.updateSessionData(session, toolResult.dataUpdate);
232
- utils_1.logger.debug(`[ToolLoopExecutor] Follow-up tool updated collected data:`, toolResult.dataUpdate);
271
+ index_js_1.logger.debug(`[ToolLoopExecutor] Follow-up tool updated collected data:`, toolResult.dataUpdate);
233
272
  }
234
273
  catch (error) {
235
- utils_1.logger.error(`[ToolLoopExecutor] Failed to update data from follow-up tool ${toolCall.toolName}:`, error);
274
+ index_js_1.logger.error(`[ToolLoopExecutor] Failed to update data from follow-up tool ${toolCall.toolName}:`, error);
236
275
  }
237
276
  }
238
277
  // Store the follow-up tool result for potential next loop iteration
239
- toolResultsMap.set(toolCall.toolName, (0, utils_1.serializeToolResult)(toolResult));
240
- toolArgsMap.set(toolCall.toolName, toolCall.arguments);
241
- utils_1.logger.debug(`[ToolLoopExecutor] Executed follow-up tool: ${toolCall.toolName} (success: ${toolResult.success})`);
278
+ record.result = (0, index_js_1.serializeToolResult)(toolResult);
279
+ // Collect tool-emitted directives (ctx.dispatch / {directive})
280
+ if (toolResult.directives?.length) {
281
+ collectedDirectives.push(...toolResult.directives);
282
+ }
283
+ index_js_1.logger.debug(`[ToolLoopExecutor] Executed follow-up tool: ${toolCall.toolName} (success: ${toolResult.success})`);
242
284
  }
243
285
  catch (error) {
244
- utils_1.logger.error(`[ToolLoopExecutor] Follow-up tool execution error for ${toolCall.toolName}:`, error);
286
+ index_js_1.logger.error(`[ToolLoopExecutor] Follow-up tool execution error for ${toolCall.toolName}:`, error);
287
+ // Visible failure beats a fabricated success.
288
+ record.result = executionFailure(toolCall.toolName, error);
245
289
  continue;
246
290
  }
247
291
  }
292
+ // A tool emitted a verbatim reply this round: it IS the final
293
+ // message — stop looping and skip any further LLM call.
294
+ const roundDirectives = flow_namespace_js_1.flow.mergeAll(collectedDirectives);
295
+ if (roundDirectives?.reply) {
296
+ index_js_1.logger.debug("[ToolLoopExecutor] Tool directive reply short-circuits remaining tool loop");
297
+ finalMessage = roundDirectives.reply;
298
+ followUpStructured = { message: roundDirectives.reply };
299
+ hasToolCalls = false;
300
+ toolCalls = undefined;
301
+ break;
302
+ }
248
303
  // Update toolCalls for next iteration or final response
249
304
  toolCalls = followUpToolCalls;
250
305
  }
251
306
  else {
252
- utils_1.logger.debug(`[ToolLoopExecutor] Tool loop completed after ${toolLoopCount} iterations`);
307
+ index_js_1.logger.debug(`[ToolLoopExecutor] Tool loop completed after ${toolLoopCount} iterations`);
253
308
  // Update final message and toolCalls from follow-up result if no more tools
254
309
  finalMessage = followUpResult.structured?.message || followUpResult.message;
255
310
  followUpStructured = followUpResult.structured;
@@ -258,7 +313,7 @@ class ToolLoopExecutor {
258
313
  }
259
314
  }
260
315
  if (toolLoopCount >= MAX_TOOL_LOOPS) {
261
- utils_1.logger.warn(`[ResponseGenerationError] Tool loop limit reached: ${toolLoopCount} iterations hit the cap (${MAX_TOOL_LOOPS}). Stopping tool execution. Increase the agent's maxToolLoops option or reduce recursive tool calls.`);
316
+ index_js_1.logger.warn(`[ResponseGenerationError] Tool loop limit reached: ${toolLoopCount} iterations hit the cap (${MAX_TOOL_LOOPS}). Stopping tool execution. Increase the agent's maxToolLoops option or reduce recursive tool calls.`);
262
317
  }
263
318
  // If tools were executed but no final text message was produced,
264
319
  // make one more LLM call to generate a proper text response from tool
@@ -266,11 +321,10 @@ class ToolLoopExecutor {
266
321
  // "Let me check...") from being returned as the final user-facing
267
322
  // response. Shared with the streaming path via forceFinalTextFromTools.
268
323
  if (!finalMessage && toolLoopCount > 0) {
269
- utils_1.logger.debug(`[ToolLoopExecutor] No final message after tool loop, making additional LLM call for text response`);
324
+ index_js_1.logger.debug(`[ToolLoopExecutor] No final message after tool loop, making additional LLM call for text response`);
270
325
  const forced = await this.forceFinalTextFromTools({
271
326
  history,
272
- toolResultsMap,
273
- toolArgsMap,
327
+ records,
274
328
  responsePrompt,
275
329
  responseSchema,
276
330
  context,
@@ -283,7 +337,7 @@ class ToolLoopExecutor {
283
337
  followUpStructured = forced.structured;
284
338
  }
285
339
  }
286
- utils_1.logger.debug(`[ToolLoopExecutor] Tool loop completed:`, {
340
+ index_js_1.logger.debug(`[ToolLoopExecutor] Tool loop completed:`, {
287
341
  totalIterations: toolLoopCount,
288
342
  hasFinalMessage: !!finalMessage,
289
343
  finalMessageLength: finalMessage?.length || 0,
@@ -294,10 +348,11 @@ class ToolLoopExecutor {
294
348
  finalToolCalls: toolCalls,
295
349
  finalMessage,
296
350
  structured: followUpStructured,
351
+ directives: flow_namespace_js_1.flow.mergeAll(collectedDirectives),
297
352
  };
298
353
  }
299
354
  catch (error) {
300
- throw ResponseGenerationError_1.ResponseGenerationError.fromError(error, 'tool_execution', params, {
355
+ throw ResponseGenerationError_js_1.ResponseGenerationError.fromError(error, 'tool_execution', params, {
301
356
  toolCallsCount: params.toolCalls?.length || 0,
302
357
  availableToolsCount: params.availableTools.length
303
358
  });
@@ -311,14 +366,17 @@ class ToolLoopExecutor {
311
366
  * or yields nothing, leaving the caller to fall back to its prior message.
312
367
  */
313
368
  async forceFinalTextFromTools(params) {
314
- const { history, toolResultsMap, toolArgsMap, responsePrompt, responseSchema, context, signal } = params;
369
+ const { history, records, responsePrompt, responseSchema, context, signal } = params;
315
370
  // Reconstruct assistant tool_call + tool result pairs so the follow-up
316
- // call can see what the tools returned.
371
+ // call can see what the tools returned — every executed call, keyed by
372
+ // its own request id.
317
373
  const finalToolResultHistoryItems = [];
318
- for (const [toolName, toolResult] of toolResultsMap) {
319
- finalToolResultHistoryItems.push((0, utils_1.assistantMessage)(null, [
320
- { id: toolName, name: toolName, arguments: toolArgsMap.get(toolName) || {} },
321
- ]), (0, utils_1.toolMessage)(toolName, toolName, toolResult));
374
+ for (const record of records) {
375
+ if (!record.result)
376
+ continue;
377
+ finalToolResultHistoryItems.push((0, index_js_1.assistantMessage)(null, [
378
+ { id: record.requestId, name: record.toolName, arguments: record.arguments },
379
+ ]), (0, index_js_1.toolMessage)(record.toolName, record.requestId, record.result));
322
380
  }
323
381
  const finalHistory = [...history, ...finalToolResultHistoryItems];
324
382
  const agentOptions = this.deps.getAgentOptions();
@@ -335,14 +393,14 @@ class ToolLoopExecutor {
335
393
  signal,
336
394
  });
337
395
  const finalMessage = textResult.structured?.message || textResult.message;
338
- utils_1.logger.debug(`[ToolLoopExecutor] Generated final text response from tool results:`, {
396
+ index_js_1.logger.debug(`[ToolLoopExecutor] Generated final text response from tool results:`, {
339
397
  hasMessage: !!finalMessage,
340
398
  messageLength: finalMessage?.length || 0,
341
399
  });
342
400
  return { finalMessage, structured: textResult.structured };
343
401
  }
344
402
  catch (error) {
345
- utils_1.logger.error(`[ToolLoopExecutor] Failed to generate final text response from tool results:`, error);
403
+ index_js_1.logger.error(`[ToolLoopExecutor] Failed to generate final text response from tool results:`, error);
346
404
  // Leave the caller to fall back to its prior message.
347
405
  return {};
348
406
  }
@@ -361,6 +419,8 @@ class ToolLoopExecutor {
361
419
  const { context, history, selectedFlow, step, accumulated, responsePrompt, availableTools, responseSchema, signal } = params;
362
420
  let { session } = params;
363
421
  let toolCalls = params.toolCalls;
422
+ // Directives emitted by tools this turn — surfaced to the caller
423
+ const collectedDirectives = [];
364
424
  // Use concurrent execution for the initial batch of tool calls
365
425
  const toolCallRequests = params.toolCalls.map((tc, i) => ({
366
426
  id: `${tc.toolName}-${i}-${Date.now()}`,
@@ -369,10 +429,16 @@ class ToolLoopExecutor {
369
429
  }));
370
430
  // Map request id -> request so completed results can be attributed back
371
431
  // to their tool name/arguments for the forced final-text call.
372
- const requestById = new Map(toolCallRequests.map((r) => [r.id, r]));
373
- const toolResultsMap = new Map();
374
- const toolArgsMap = new Map();
375
- const historyEvents = (0, utils_1.historyToEvents)(history);
432
+ // Execution records keyed by call id — seeded at queue time so results
433
+ // (and failures) attach to the right call even for same-name calls.
434
+ const records = toolCallRequests.map((req) => ({
435
+ requestId: req.id,
436
+ toolName: req.toolName,
437
+ arguments: req.arguments,
438
+ round: 0,
439
+ }));
440
+ const recordById = new Map(records.map((r) => [r.requestId, r]));
441
+ const historyEvents = (0, index_js_1.historyToEvents)(history);
376
442
  let finalMessage;
377
443
  let structured;
378
444
  try {
@@ -391,7 +457,7 @@ class ToolLoopExecutor {
391
457
  await this.deps.updateContext(update.contextUpdate);
392
458
  }
393
459
  catch (error) {
394
- utils_1.logger.error(`[ToolLoopExecutor] Failed to update context from concurrent tool:`, error);
460
+ index_js_1.logger.error(`[ToolLoopExecutor] Failed to update context from concurrent tool:`, error);
395
461
  }
396
462
  }
397
463
  // Apply data updates
@@ -400,15 +466,18 @@ class ToolLoopExecutor {
400
466
  session = await this.deps.updateSessionData(session, update.dataUpdate);
401
467
  }
402
468
  catch (error) {
403
- utils_1.logger.error(`[ToolLoopExecutor] Failed to update data from concurrent tool:`, error);
469
+ index_js_1.logger.error(`[ToolLoopExecutor] Failed to update data from concurrent tool:`, error);
404
470
  }
405
471
  }
406
472
  // Capture tool results for the forced final-text call
407
473
  if (update.result) {
408
- const req = requestById.get(update.toolCallId);
409
- if (req) {
410
- toolResultsMap.set(req.toolName, (0, utils_1.serializeToolResult)(update.result));
411
- toolArgsMap.set(req.toolName, req.arguments);
474
+ const record = recordById.get(update.toolCallId);
475
+ if (record) {
476
+ record.result = (0, index_js_1.serializeToolResult)(update.result);
477
+ }
478
+ // Collect tool-emitted directives (ctx.dispatch / {directive})
479
+ if (update.result.directives?.length) {
480
+ collectedDirectives.push(...update.result.directives);
412
481
  }
413
482
  }
414
483
  // Yield progress updates immediately
@@ -424,7 +493,7 @@ class ToolLoopExecutor {
424
493
  };
425
494
  }
426
495
  }
427
- utils_1.logger.debug(`[ToolLoopExecutor] Concurrent tool execution completed for ${toolCallRequests.length} tools`);
496
+ index_js_1.logger.debug(`[ToolLoopExecutor] Concurrent tool execution completed for ${toolCallRequests.length} tools`);
428
497
  // Multi-round follow-up shared with the non-streaming path: re-prompt
429
498
  // with the tool results so the model can chain further tool calls,
430
499
  // then produce result-aware closing text (forced if it never does).
@@ -433,8 +502,8 @@ class ToolLoopExecutor {
433
502
  const followUp = await this.runFollowUpLoop({
434
503
  toolCalls,
435
504
  session,
436
- toolResultsMap,
437
- toolArgsMap,
505
+ records,
506
+ collectedDirectives,
438
507
  context,
439
508
  history,
440
509
  selectedFlow,
@@ -449,20 +518,43 @@ class ToolLoopExecutor {
449
518
  structured = followUp.structured;
450
519
  }
451
520
  catch (error) {
452
- utils_1.logger.error(`[ToolLoopExecutor] Concurrent tool execution failed, falling back to sequential:`, error);
453
- // Fall back to the unified tool loop on failure. runLoop re-executes
454
- // the tools from scratch, so any partial results collected above are
455
- // intentionally discarded (it builds and forces its own).
456
- const toolResult = await this.runLoop({
457
- toolCalls, context, session, history, selectedFlow,
458
- responsePrompt, availableTools, responseSchema, signal,
459
- });
460
- session = toolResult.session;
461
- toolCalls = toolResult.finalToolCalls;
462
- finalMessage = toolResult.finalMessage;
463
- structured = toolResult.structured;
521
+ index_js_1.logger.error(`[ToolLoopExecutor] Concurrent batch failed:`, error);
522
+ const executedRecords = records.filter((r) => r.result !== undefined);
523
+ if (executedRecords.length > 0) {
524
+ // Some tools already executed re-running them would duplicate
525
+ // real-world side effects (sends, writes, charges). Close the
526
+ // turn from the results we have instead.
527
+ index_js_1.logger.warn(`[ToolLoopExecutor] ${executedRecords.length} tool(s) already executed; closing the turn from their results rather than re-executing.`);
528
+ const forced = await this.forceFinalTextFromTools({
529
+ history,
530
+ records,
531
+ responsePrompt,
532
+ responseSchema,
533
+ context,
534
+ signal,
535
+ });
536
+ if (forced.finalMessage) {
537
+ finalMessage = forced.finalMessage;
538
+ }
539
+ structured = structured ?? forced.structured;
540
+ }
541
+ else {
542
+ // Nothing executed — safe to fall back to the unified loop.
543
+ const toolResult = await this.runLoop({
544
+ toolCalls, context, session, history, selectedFlow,
545
+ responsePrompt, availableTools, responseSchema, signal,
546
+ });
547
+ session = toolResult.session;
548
+ toolCalls = toolResult.finalToolCalls;
549
+ finalMessage = toolResult.finalMessage;
550
+ structured = toolResult.structured;
551
+ if (toolResult.directives) {
552
+ collectedDirectives.length = 0;
553
+ collectedDirectives.push(toolResult.directives);
554
+ }
555
+ }
464
556
  }
465
- return { session, toolCalls, finalMessage, structured };
557
+ return { session, toolCalls, finalMessage, structured, directives: flow_namespace_js_1.flow.mergeAll(collectedDirectives) };
466
558
  }
467
559
  /**
468
560
  * Find an available tool by name for the given flow.
@@ -1 +1 @@
1
- {"version":3,"file":"ToolLoopExecutor.js","sourceRoot":"","sources":["../../../src/core/ToolLoopExecutor.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAaH,uEAAoE;AACpE,oCAAuG;AAEvG,MAAa,gBAAgB;IACzB,YACqB,IAWhB;QAXgB,SAAI,GAAJ,IAAI,CAWpB;IACD,CAAC;IAEL;;;;OAIG;IACH,KAAK,CAAC,OAAO,CAAC,MAeb;QAMG,IAAI,CAAC;YACD,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;YAC1G,+DAA+D;YAC/D,gDAAgD;YAChD,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC;YAC7B,IAAI,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;YAEzB,2DAA2D;YAC3D,MAAM,aAAa,GAAG,IAAA,uBAAe,EAAC,OAAO,CAAC,CAAC;YAE/C,kDAAkD;YAClD,MAAM,cAAc,GAAG,IAAI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AAgB,EAChB,IAA4B;QAE5B,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;IAC5E,CAAC;CACJ;AAprBD,4CAorBC"}
@@ -1,11 +1,11 @@
1
1
  /**
2
2
  * ToolManager - Centralized tool management with simplified creation APIs
3
3
  */
4
- import type { Tool, ToolExecutionResult, DataEnrichmentConfig, ValidationConfig, ValidationResult, ApiCallConfig, ComputationConfig, ToolCallRequest, ToolExecutionUpdate, Event } from "../types";
5
- import { ToolScope } from "../types";
6
- import type { Agent } from "./Agent";
7
- import { Flow } from "./Flow";
8
- import { Step } from "./Step";
4
+ import type { Tool, ToolExecutionResult, DataEnrichmentConfig, ValidationConfig, ValidationResult, ApiCallConfig, ComputationConfig, ToolCallRequest, ToolExecutionUpdate, Event } from "../types/index.js";
5
+ import { ToolScope } from "../types/index.js";
6
+ import type { Agent } from "./Agent.js";
7
+ import { Flow } from "./Flow.js";
8
+ import { Step } from "./Step.js";
9
9
  /**
10
10
  * Error thrown when tool creation fails
11
11
  */
@@ -43,7 +43,7 @@ export declare class ToolManager<TContext = unknown, TData = unknown> {
43
43
  * Set the transient tool layer for the current turn.
44
44
  *
45
45
  * Accepts the merged `injectTools` array from pre-LLM emitters
46
- * (already concatenated in outer-to-inner order by the DirectiveBus).
46
+ * (concatenated in outer-to-inner order).
47
47
  * Deduplicates by tool `id` with last-definition-wins.
48
48
  *
49
49
  * Must be paired with `clearTransientTools()` in a try/finally guard