keyring-agent-core 0.1.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 (318) hide show
  1. package/README.md +169 -0
  2. package/dist/agent/AgentCore.d.ts +220 -0
  3. package/dist/agent/AgentCore.d.ts.map +1 -0
  4. package/dist/agent/AgentCore.js +950 -0
  5. package/dist/agent/AgentCore.js.map +1 -0
  6. package/dist/agent/QueryRewriter.d.ts +67 -0
  7. package/dist/agent/QueryRewriter.d.ts.map +1 -0
  8. package/dist/agent/QueryRewriter.js +262 -0
  9. package/dist/agent/QueryRewriter.js.map +1 -0
  10. package/dist/agent/Router.d.ts +33 -0
  11. package/dist/agent/Router.d.ts.map +1 -0
  12. package/dist/agent/Router.js +191 -0
  13. package/dist/agent/Router.js.map +1 -0
  14. package/dist/agent/Subagent.d.ts +63 -0
  15. package/dist/agent/Subagent.d.ts.map +1 -0
  16. package/dist/agent/Subagent.js +240 -0
  17. package/dist/agent/Subagent.js.map +1 -0
  18. package/dist/agent/Synthesizer.d.ts +11 -0
  19. package/dist/agent/Synthesizer.d.ts.map +1 -0
  20. package/dist/agent/Synthesizer.js +86 -0
  21. package/dist/agent/Synthesizer.js.map +1 -0
  22. package/dist/agent/index.d.ts +10 -0
  23. package/dist/agent/index.d.ts.map +1 -0
  24. package/dist/agent/index.js +24 -0
  25. package/dist/agent/index.js.map +1 -0
  26. package/dist/agent/subagents/AiAgent.d.ts +6 -0
  27. package/dist/agent/subagents/AiAgent.d.ts.map +1 -0
  28. package/dist/agent/subagents/AiAgent.js +48 -0
  29. package/dist/agent/subagents/AiAgent.js.map +1 -0
  30. package/dist/agent/subagents/NftAgent.d.ts +6 -0
  31. package/dist/agent/subagents/NftAgent.d.ts.map +1 -0
  32. package/dist/agent/subagents/NftAgent.js +69 -0
  33. package/dist/agent/subagents/NftAgent.js.map +1 -0
  34. package/dist/agent/subagents/PoolAgent.d.ts +6 -0
  35. package/dist/agent/subagents/PoolAgent.d.ts.map +1 -0
  36. package/dist/agent/subagents/PoolAgent.js +184 -0
  37. package/dist/agent/subagents/PoolAgent.js.map +1 -0
  38. package/dist/agent/subagents/TokenAgent.d.ts +6 -0
  39. package/dist/agent/subagents/TokenAgent.d.ts.map +1 -0
  40. package/dist/agent/subagents/TokenAgent.js +75 -0
  41. package/dist/agent/subagents/TokenAgent.js.map +1 -0
  42. package/dist/agent/subagents/WalletAgent.d.ts +6 -0
  43. package/dist/agent/subagents/WalletAgent.d.ts.map +1 -0
  44. package/dist/agent/subagents/WalletAgent.js +92 -0
  45. package/dist/agent/subagents/WalletAgent.js.map +1 -0
  46. package/dist/agent/subagents/index.d.ts +14 -0
  47. package/dist/agent/subagents/index.d.ts.map +1 -0
  48. package/dist/agent/subagents/index.js +38 -0
  49. package/dist/agent/subagents/index.js.map +1 -0
  50. package/dist/constants/abi.d.ts +520 -0
  51. package/dist/constants/abi.d.ts.map +1 -0
  52. package/dist/constants/abi.js +667 -0
  53. package/dist/constants/abi.js.map +1 -0
  54. package/dist/functions/pool.d.ts +25 -0
  55. package/dist/functions/pool.d.ts.map +1 -0
  56. package/dist/functions/pool.js +151 -0
  57. package/dist/functions/pool.js.map +1 -0
  58. package/dist/functions/web3.d.ts +32 -0
  59. package/dist/functions/web3.d.ts.map +1 -0
  60. package/dist/functions/web3.js +277 -0
  61. package/dist/functions/web3.js.map +1 -0
  62. package/dist/index.d.ts +24 -0
  63. package/dist/index.d.ts.map +1 -0
  64. package/dist/index.js +65 -0
  65. package/dist/index.js.map +1 -0
  66. package/dist/llm/GeminiProvider.d.ts +16 -0
  67. package/dist/llm/GeminiProvider.d.ts.map +1 -0
  68. package/dist/llm/GeminiProvider.js +248 -0
  69. package/dist/llm/GeminiProvider.js.map +1 -0
  70. package/dist/llm/index.d.ts +2 -0
  71. package/dist/llm/index.d.ts.map +1 -0
  72. package/dist/llm/index.js +6 -0
  73. package/dist/llm/index.js.map +1 -0
  74. package/dist/memory/ChatHistory.d.ts +83 -0
  75. package/dist/memory/ChatHistory.d.ts.map +1 -0
  76. package/dist/memory/ChatHistory.js +143 -0
  77. package/dist/memory/ChatHistory.js.map +1 -0
  78. package/dist/memory/KnowledgeBase.d.ts +38 -0
  79. package/dist/memory/KnowledgeBase.d.ts.map +1 -0
  80. package/dist/memory/KnowledgeBase.js +139 -0
  81. package/dist/memory/KnowledgeBase.js.map +1 -0
  82. package/dist/memory/Summarizer.d.ts +12 -0
  83. package/dist/memory/Summarizer.d.ts.map +1 -0
  84. package/dist/memory/Summarizer.js +39 -0
  85. package/dist/memory/Summarizer.js.map +1 -0
  86. package/dist/memory/UpstashKnowledgeBase.d.ts +124 -0
  87. package/dist/memory/UpstashKnowledgeBase.d.ts.map +1 -0
  88. package/dist/memory/UpstashKnowledgeBase.js +152 -0
  89. package/dist/memory/UpstashKnowledgeBase.js.map +1 -0
  90. package/dist/memory/historyUtils.d.ts +58 -0
  91. package/dist/memory/historyUtils.d.ts.map +1 -0
  92. package/dist/memory/historyUtils.js +190 -0
  93. package/dist/memory/historyUtils.js.map +1 -0
  94. package/dist/memory/index.d.ts +7 -0
  95. package/dist/memory/index.d.ts.map +1 -0
  96. package/dist/memory/index.js +12 -0
  97. package/dist/memory/index.js.map +1 -0
  98. package/dist/memory/ingestKnowledgeBase.d.ts +17 -0
  99. package/dist/memory/ingestKnowledgeBase.d.ts.map +1 -0
  100. package/dist/memory/ingestKnowledgeBase.js +35 -0
  101. package/dist/memory/ingestKnowledgeBase.js.map +1 -0
  102. package/dist/services/MoralisService.d.ts +1350 -0
  103. package/dist/services/MoralisService.d.ts.map +1 -0
  104. package/dist/services/MoralisService.js +1364 -0
  105. package/dist/services/MoralisService.js.map +1 -0
  106. package/dist/services/PantographService.d.ts +38 -0
  107. package/dist/services/PantographService.d.ts.map +1 -0
  108. package/dist/services/PantographService.js +199 -0
  109. package/dist/services/PantographService.js.map +1 -0
  110. package/dist/services/PoolService.d.ts +241 -0
  111. package/dist/services/PoolService.d.ts.map +1 -0
  112. package/dist/services/PoolService.js +507 -0
  113. package/dist/services/PoolService.js.map +1 -0
  114. package/dist/services/UniswapService.d.ts +289 -0
  115. package/dist/services/UniswapService.d.ts.map +1 -0
  116. package/dist/services/UniswapService.js +585 -0
  117. package/dist/services/UniswapService.js.map +1 -0
  118. package/dist/services/swap/BaseSwapService.d.ts +17 -0
  119. package/dist/services/swap/BaseSwapService.d.ts.map +1 -0
  120. package/dist/services/swap/BaseSwapService.js +19 -0
  121. package/dist/services/swap/BaseSwapService.js.map +1 -0
  122. package/dist/services/swap/DebridgeAdapter.d.ts +20 -0
  123. package/dist/services/swap/DebridgeAdapter.d.ts.map +1 -0
  124. package/dist/services/swap/DebridgeAdapter.js +175 -0
  125. package/dist/services/swap/DebridgeAdapter.js.map +1 -0
  126. package/dist/services/swap/RelayAdapter.d.ts +19 -0
  127. package/dist/services/swap/RelayAdapter.d.ts.map +1 -0
  128. package/dist/services/swap/RelayAdapter.js +189 -0
  129. package/dist/services/swap/RelayAdapter.js.map +1 -0
  130. package/dist/services/swap/SwapServiceFactory.d.ts +24 -0
  131. package/dist/services/swap/SwapServiceFactory.d.ts.map +1 -0
  132. package/dist/services/swap/SwapServiceFactory.js +74 -0
  133. package/dist/services/swap/SwapServiceFactory.js.map +1 -0
  134. package/dist/services/swap/addresses.d.ts +3 -0
  135. package/dist/services/swap/addresses.d.ts.map +1 -0
  136. package/dist/services/swap/addresses.js +68 -0
  137. package/dist/services/swap/addresses.js.map +1 -0
  138. package/dist/services/swap/affiliate.d.ts +17 -0
  139. package/dist/services/swap/affiliate.d.ts.map +1 -0
  140. package/dist/services/swap/affiliate.js +126 -0
  141. package/dist/services/swap/affiliate.js.map +1 -0
  142. package/dist/services/swap/config.d.ts +9 -0
  143. package/dist/services/swap/config.d.ts.map +1 -0
  144. package/dist/services/swap/config.js +19 -0
  145. package/dist/services/swap/config.js.map +1 -0
  146. package/dist/services/swap/index.d.ts +10 -0
  147. package/dist/services/swap/index.d.ts.map +1 -0
  148. package/dist/services/swap/index.js +22 -0
  149. package/dist/services/swap/index.js.map +1 -0
  150. package/dist/services/swap/types.d.ts +89 -0
  151. package/dist/services/swap/types.d.ts.map +1 -0
  152. package/dist/services/swap/types.js +6 -0
  153. package/dist/services/swap/types.js.map +1 -0
  154. package/dist/tools/BaseTool.d.ts +15 -0
  155. package/dist/tools/BaseTool.d.ts.map +1 -0
  156. package/dist/tools/BaseTool.js +35 -0
  157. package/dist/tools/BaseTool.js.map +1 -0
  158. package/dist/tools/ToolRegistry.d.ts +27 -0
  159. package/dist/tools/ToolRegistry.d.ts.map +1 -0
  160. package/dist/tools/ToolRegistry.js +80 -0
  161. package/dist/tools/ToolRegistry.js.map +1 -0
  162. package/dist/tools/builtin/ai/MoralisCortexTool.d.ts +33 -0
  163. package/dist/tools/builtin/ai/MoralisCortexTool.d.ts.map +1 -0
  164. package/dist/tools/builtin/ai/MoralisCortexTool.js +76 -0
  165. package/dist/tools/builtin/ai/MoralisCortexTool.js.map +1 -0
  166. package/dist/tools/builtin/ai/SolanaCortexTool.d.ts +22 -0
  167. package/dist/tools/builtin/ai/SolanaCortexTool.d.ts.map +1 -0
  168. package/dist/tools/builtin/ai/SolanaCortexTool.js +80 -0
  169. package/dist/tools/builtin/ai/SolanaCortexTool.js.map +1 -0
  170. package/dist/tools/builtin/ai/index.d.ts +5 -0
  171. package/dist/tools/builtin/ai/index.d.ts.map +1 -0
  172. package/dist/tools/builtin/ai/index.js +8 -0
  173. package/dist/tools/builtin/ai/index.js.map +1 -0
  174. package/dist/tools/builtin/index.d.ts +6 -0
  175. package/dist/tools/builtin/index.d.ts.map +1 -0
  176. package/dist/tools/builtin/index.js +22 -0
  177. package/dist/tools/builtin/index.js.map +1 -0
  178. package/dist/tools/builtin/nft/NFTContractInfoTool.d.ts +21 -0
  179. package/dist/tools/builtin/nft/NFTContractInfoTool.d.ts.map +1 -0
  180. package/dist/tools/builtin/nft/NFTContractInfoTool.js +54 -0
  181. package/dist/tools/builtin/nft/NFTContractInfoTool.js.map +1 -0
  182. package/dist/tools/builtin/nft/NFTMetadataTool.d.ts +121 -0
  183. package/dist/tools/builtin/nft/NFTMetadataTool.d.ts.map +1 -0
  184. package/dist/tools/builtin/nft/NFTMetadataTool.js +159 -0
  185. package/dist/tools/builtin/nft/NFTMetadataTool.js.map +1 -0
  186. package/dist/tools/builtin/nft/WalletNFTsTool.d.ts +82 -0
  187. package/dist/tools/builtin/nft/WalletNFTsTool.d.ts.map +1 -0
  188. package/dist/tools/builtin/nft/WalletNFTsTool.js +172 -0
  189. package/dist/tools/builtin/nft/WalletNFTsTool.js.map +1 -0
  190. package/dist/tools/builtin/nft/index.d.ts +7 -0
  191. package/dist/tools/builtin/nft/index.d.ts.map +1 -0
  192. package/dist/tools/builtin/nft/index.js +10 -0
  193. package/dist/tools/builtin/nft/index.js.map +1 -0
  194. package/dist/tools/builtin/pool/EstimatePoolYieldTool.d.ts +124 -0
  195. package/dist/tools/builtin/pool/EstimatePoolYieldTool.d.ts.map +1 -0
  196. package/dist/tools/builtin/pool/EstimatePoolYieldTool.js +235 -0
  197. package/dist/tools/builtin/pool/EstimatePoolYieldTool.js.map +1 -0
  198. package/dist/tools/builtin/pool/OpenAddLiquidityFormTool.d.ts +127 -0
  199. package/dist/tools/builtin/pool/OpenAddLiquidityFormTool.d.ts.map +1 -0
  200. package/dist/tools/builtin/pool/OpenAddLiquidityFormTool.js +517 -0
  201. package/dist/tools/builtin/pool/OpenAddLiquidityFormTool.js.map +1 -0
  202. package/dist/tools/builtin/pool/PoolByAddressTool.d.ts +127 -0
  203. package/dist/tools/builtin/pool/PoolByAddressTool.d.ts.map +1 -0
  204. package/dist/tools/builtin/pool/PoolByAddressTool.js +237 -0
  205. package/dist/tools/builtin/pool/PoolByAddressTool.js.map +1 -0
  206. package/dist/tools/builtin/pool/PoolDetailTool.d.ts +127 -0
  207. package/dist/tools/builtin/pool/PoolDetailTool.d.ts.map +1 -0
  208. package/dist/tools/builtin/pool/PoolDetailTool.js +272 -0
  209. package/dist/tools/builtin/pool/PoolDetailTool.js.map +1 -0
  210. package/dist/tools/builtin/pool/PoolSearchTool.d.ts +50 -0
  211. package/dist/tools/builtin/pool/PoolSearchTool.d.ts.map +1 -0
  212. package/dist/tools/builtin/pool/PoolSearchTool.js +159 -0
  213. package/dist/tools/builtin/pool/PoolSearchTool.js.map +1 -0
  214. package/dist/tools/builtin/pool/PreviewAddLiquidityTool.d.ts +123 -0
  215. package/dist/tools/builtin/pool/PreviewAddLiquidityTool.d.ts.map +1 -0
  216. package/dist/tools/builtin/pool/PreviewAddLiquidityTool.js +380 -0
  217. package/dist/tools/builtin/pool/PreviewAddLiquidityTool.js.map +1 -0
  218. package/dist/tools/builtin/pool/TopPoolsTool.d.ts +68 -0
  219. package/dist/tools/builtin/pool/TopPoolsTool.d.ts.map +1 -0
  220. package/dist/tools/builtin/pool/TopPoolsTool.js +158 -0
  221. package/dist/tools/builtin/pool/TopPoolsTool.js.map +1 -0
  222. package/dist/tools/builtin/pool/index.d.ts +15 -0
  223. package/dist/tools/builtin/pool/index.d.ts.map +1 -0
  224. package/dist/tools/builtin/pool/index.js +18 -0
  225. package/dist/tools/builtin/pool/index.js.map +1 -0
  226. package/dist/tools/builtin/token/TokenAnalyticsTool.d.ts +71 -0
  227. package/dist/tools/builtin/token/TokenAnalyticsTool.d.ts.map +1 -0
  228. package/dist/tools/builtin/token/TokenAnalyticsTool.js +146 -0
  229. package/dist/tools/builtin/token/TokenAnalyticsTool.js.map +1 -0
  230. package/dist/tools/builtin/token/TokenHoldersTool.d.ts +81 -0
  231. package/dist/tools/builtin/token/TokenHoldersTool.d.ts.map +1 -0
  232. package/dist/tools/builtin/token/TokenHoldersTool.js +138 -0
  233. package/dist/tools/builtin/token/TokenHoldersTool.js.map +1 -0
  234. package/dist/tools/builtin/token/TokenInfoTool.d.ts +36 -0
  235. package/dist/tools/builtin/token/TokenInfoTool.d.ts.map +1 -0
  236. package/dist/tools/builtin/token/TokenInfoTool.js +163 -0
  237. package/dist/tools/builtin/token/TokenInfoTool.js.map +1 -0
  238. package/dist/tools/builtin/token/TokenScoreTool.d.ts +63 -0
  239. package/dist/tools/builtin/token/TokenScoreTool.d.ts.map +1 -0
  240. package/dist/tools/builtin/token/TokenScoreTool.js +147 -0
  241. package/dist/tools/builtin/token/TokenScoreTool.js.map +1 -0
  242. package/dist/tools/builtin/token/TopGainersTool.d.ts +46 -0
  243. package/dist/tools/builtin/token/TopGainersTool.d.ts.map +1 -0
  244. package/dist/tools/builtin/token/TopGainersTool.js +110 -0
  245. package/dist/tools/builtin/token/TopGainersTool.js.map +1 -0
  246. package/dist/tools/builtin/token/TopLosersTool.d.ts +66 -0
  247. package/dist/tools/builtin/token/TopLosersTool.d.ts.map +1 -0
  248. package/dist/tools/builtin/token/TopLosersTool.js +128 -0
  249. package/dist/tools/builtin/token/TopLosersTool.js.map +1 -0
  250. package/dist/tools/builtin/token/TrendingTokensTool.d.ts +39 -0
  251. package/dist/tools/builtin/token/TrendingTokensTool.d.ts.map +1 -0
  252. package/dist/tools/builtin/token/TrendingTokensTool.js +75 -0
  253. package/dist/tools/builtin/token/TrendingTokensTool.js.map +1 -0
  254. package/dist/tools/builtin/token/index.d.ts +15 -0
  255. package/dist/tools/builtin/token/index.d.ts.map +1 -0
  256. package/dist/tools/builtin/token/index.js +18 -0
  257. package/dist/tools/builtin/token/index.js.map +1 -0
  258. package/dist/tools/builtin/wallet/TransactionByHashTool.d.ts +70 -0
  259. package/dist/tools/builtin/wallet/TransactionByHashTool.d.ts.map +1 -0
  260. package/dist/tools/builtin/wallet/TransactionByHashTool.js +110 -0
  261. package/dist/tools/builtin/wallet/TransactionByHashTool.js.map +1 -0
  262. package/dist/tools/builtin/wallet/WalletApprovalsTool.d.ts +107 -0
  263. package/dist/tools/builtin/wallet/WalletApprovalsTool.d.ts.map +1 -0
  264. package/dist/tools/builtin/wallet/WalletApprovalsTool.js +163 -0
  265. package/dist/tools/builtin/wallet/WalletApprovalsTool.js.map +1 -0
  266. package/dist/tools/builtin/wallet/WalletDefiPositionsTool.d.ts +61 -0
  267. package/dist/tools/builtin/wallet/WalletDefiPositionsTool.d.ts.map +1 -0
  268. package/dist/tools/builtin/wallet/WalletDefiPositionsTool.js +99 -0
  269. package/dist/tools/builtin/wallet/WalletDefiPositionsTool.js.map +1 -0
  270. package/dist/tools/builtin/wallet/WalletDefiProtocolPositionsTool.d.ts +68 -0
  271. package/dist/tools/builtin/wallet/WalletDefiProtocolPositionsTool.d.ts.map +1 -0
  272. package/dist/tools/builtin/wallet/WalletDefiProtocolPositionsTool.js +114 -0
  273. package/dist/tools/builtin/wallet/WalletDefiProtocolPositionsTool.js.map +1 -0
  274. package/dist/tools/builtin/wallet/WalletDefiSummaryTool.d.ts +50 -0
  275. package/dist/tools/builtin/wallet/WalletDefiSummaryTool.d.ts.map +1 -0
  276. package/dist/tools/builtin/wallet/WalletDefiSummaryTool.js +79 -0
  277. package/dist/tools/builtin/wallet/WalletDefiSummaryTool.js.map +1 -0
  278. package/dist/tools/builtin/wallet/WalletHistoryTool.d.ts +31 -0
  279. package/dist/tools/builtin/wallet/WalletHistoryTool.d.ts.map +1 -0
  280. package/dist/tools/builtin/wallet/WalletHistoryTool.js +153 -0
  281. package/dist/tools/builtin/wallet/WalletHistoryTool.js.map +1 -0
  282. package/dist/tools/builtin/wallet/WalletNetWorthTool.d.ts +44 -0
  283. package/dist/tools/builtin/wallet/WalletNetWorthTool.d.ts.map +1 -0
  284. package/dist/tools/builtin/wallet/WalletNetWorthTool.js +122 -0
  285. package/dist/tools/builtin/wallet/WalletNetWorthTool.js.map +1 -0
  286. package/dist/tools/builtin/wallet/WalletNftTransfersTool.d.ts +86 -0
  287. package/dist/tools/builtin/wallet/WalletNftTransfersTool.d.ts.map +1 -0
  288. package/dist/tools/builtin/wallet/WalletNftTransfersTool.js +264 -0
  289. package/dist/tools/builtin/wallet/WalletNftTransfersTool.js.map +1 -0
  290. package/dist/tools/builtin/wallet/WalletPnlSummaryTool.d.ts +43 -0
  291. package/dist/tools/builtin/wallet/WalletPnlSummaryTool.d.ts.map +1 -0
  292. package/dist/tools/builtin/wallet/WalletPnlSummaryTool.js +88 -0
  293. package/dist/tools/builtin/wallet/WalletPnlSummaryTool.js.map +1 -0
  294. package/dist/tools/builtin/wallet/WalletPnlTool.d.ts +43 -0
  295. package/dist/tools/builtin/wallet/WalletPnlTool.d.ts.map +1 -0
  296. package/dist/tools/builtin/wallet/WalletPnlTool.js +174 -0
  297. package/dist/tools/builtin/wallet/WalletPnlTool.js.map +1 -0
  298. package/dist/tools/builtin/wallet/WalletTokenBalancesTool.d.ts +35 -0
  299. package/dist/tools/builtin/wallet/WalletTokenBalancesTool.d.ts.map +1 -0
  300. package/dist/tools/builtin/wallet/WalletTokenBalancesTool.js +67 -0
  301. package/dist/tools/builtin/wallet/WalletTokenBalancesTool.js.map +1 -0
  302. package/dist/tools/builtin/wallet/WalletTokenTransfersTool.d.ts +109 -0
  303. package/dist/tools/builtin/wallet/WalletTokenTransfersTool.d.ts.map +1 -0
  304. package/dist/tools/builtin/wallet/WalletTokenTransfersTool.js +353 -0
  305. package/dist/tools/builtin/wallet/WalletTokenTransfersTool.js.map +1 -0
  306. package/dist/tools/builtin/wallet/index.d.ts +25 -0
  307. package/dist/tools/builtin/wallet/index.d.ts.map +1 -0
  308. package/dist/tools/builtin/wallet/index.js +28 -0
  309. package/dist/tools/builtin/wallet/index.js.map +1 -0
  310. package/dist/tools/index.d.ts +4 -0
  311. package/dist/tools/index.d.ts.map +1 -0
  312. package/dist/tools/index.js +23 -0
  313. package/dist/tools/index.js.map +1 -0
  314. package/dist/types/index.d.ts +566 -0
  315. package/dist/types/index.d.ts.map +1 -0
  316. package/dist/types/index.js +6 -0
  317. package/dist/types/index.js.map +1 -0
  318. package/package.json +52 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Router.js","sourceRoot":"","sources":["../../src/agent/Router.ts"],"names":[],"mappings":";;;AAUA,yDAAwF;AAExF,MAAM,oBAAoB,GAAG;;;;;;;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C,GAAG,CAAC,IAAI,CAAC,CAAC;QACxC,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,GAAG,CAAC,kCAAkC,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,UAAU,CAAC,CAAC;QAC3E,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;IAEO,SAAS,CAAC,IAAY;QAC5B,IAAI,KAAK,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;QACxB,IAAI,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;YAC5B,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,kBAAkB,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;QACvE,CAAC;QACD,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC3B,CAAC;CACF;AAjKD,wBAiKC"}
@@ -0,0 +1,63 @@
1
+ import type { ChatMessage, LLMProvider, SubagentCard, SubagentResult, SubagentTask, UserContext } from '../types';
2
+ import type { ToolRegistry } from '../tools/ToolRegistry';
3
+ export interface SubagentOptions {
4
+ /** Max number of tool calls inside one run (budget). Default: 5 */
5
+ maxToolCalls?: number;
6
+ /** Max tokens of recent conversation history to include. Default: 6 messages */
7
+ historyMessages?: number;
8
+ /** Enable debug logging */
9
+ debug?: boolean;
10
+ }
11
+ export interface SubagentParams {
12
+ /** Unique id, e.g. "wallet-agent" */
13
+ name: string;
14
+ /** Capability description shown to the router LLM (dense, one-liner) */
15
+ description: string;
16
+ /** Domain tag, e.g. "wallet" */
17
+ domain: string;
18
+ /** Tool names this subagent is allowed to invoke. */
19
+ toolNames: string[];
20
+ /** Domain-expert system prompt */
21
+ systemPrompt: string;
22
+ /**
23
+ * Optional Cortex AI fallback tool name. When set, if the first LLM turn
24
+ * returns no tool calls, the subagent re-prompts the LLM and forces it to
25
+ * call this tool — guaranteeing the user's query goes to Cortex instead of
26
+ * being answered by the LLM's own knowledge with no on-chain data.
27
+ */
28
+ cortexFallbackTool?: string;
29
+ llm: LLMProvider;
30
+ registry: ToolRegistry;
31
+ options?: SubagentOptions;
32
+ }
33
+ /**
34
+ * Domain-specialised worker in the Router → Subagent → Tool architecture.
35
+ *
36
+ * Each subagent:
37
+ * - owns a narrow subset of tools (by name)
38
+ * - runs its own ReAct loop via native function calling
39
+ * - produces a domain-scoped summary + the raw tool results
40
+ *
41
+ * Keeping each subagent's tool surface small is the main token-cost win:
42
+ * the LLM receives only ~5 tool schemas instead of ~23.
43
+ */
44
+ export declare class Subagent {
45
+ readonly name: string;
46
+ readonly description: string;
47
+ readonly domain: string;
48
+ private readonly toolNames;
49
+ private readonly systemPrompt;
50
+ private readonly cortexFallbackTool?;
51
+ private readonly llm;
52
+ private readonly registry;
53
+ private readonly maxToolCalls;
54
+ private readonly historyMessages;
55
+ private readonly debug;
56
+ constructor(params: SubagentParams);
57
+ /** Card shown to the router for selection. */
58
+ getCard(): SubagentCard;
59
+ /** Only the tools this subagent owns, resolved from the shared registry. */
60
+ private getTools;
61
+ run(task: SubagentTask, conversationHistory: ChatMessage[], userContext?: UserContext): Promise<SubagentResult>;
62
+ }
63
+ //# sourceMappingURL=Subagent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Subagent.d.ts","sourceRoot":"","sources":["../../src/agent/Subagent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,WAAW,EAEX,YAAY,EACZ,cAAc,EACd,YAAY,EAGZ,WAAW,EACZ,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAG1D,MAAM,WAAW,eAAe;IAC9B,mEAAmE;IACnE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gFAAgF;IAChF,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,2BAA2B;IAC3B,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,cAA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
3
+ exports.Subagent = void 0;
4
+ const historyUtils_1 = require("../memory/historyUtils");
5
+ /**
6
+ * Domain-specialised worker in the Router → Subagent → Tool architecture.
7
+ *
8
+ * Each subagent:
9
+ * - owns a narrow subset of tools (by name)
10
+ * - runs its own ReAct loop via native function calling
11
+ * - produces a domain-scoped summary + the raw tool results
12
+ *
13
+ * Keeping each subagent's tool surface small is the main token-cost win:
14
+ * the LLM receives only ~5 tool schemas instead of ~23.
15
+ */
16
+ class Subagent {
17
+ name;
18
+ description;
19
+ domain;
20
+ toolNames;
21
+ systemPrompt;
22
+ cortexFallbackTool;
23
+ llm;
24
+ registry;
25
+ maxToolCalls;
26
+ historyMessages;
27
+ debug;
28
+ constructor(params) {
29
+ this.name = params.name;
30
+ this.description = params.description;
31
+ this.domain = params.domain;
32
+ this.toolNames = new Set(params.toolNames);
33
+ this.systemPrompt = params.systemPrompt;
34
+ this.cortexFallbackTool = params.cortexFallbackTool;
35
+ if (this.cortexFallbackTool && !this.toolNames.has(this.cortexFallbackTool)) {
36
+ throw new Error(`Subagent "${params.name}": cortexFallbackTool "${this.cortexFallbackTool}" must be in toolNames.`);
37
+ }
38
+ this.llm = params.llm;
39
+ this.registry = params.registry;
40
+ this.maxToolCalls = params.options?.maxToolCalls ?? 5;
41
+ // Wider default window so follow-up turns ("detail the first one", "more")
42
+ // can still see the previous assistant reply + tool results they reference.
43
+ this.historyMessages = params.options?.historyMessages ?? 10;
44
+ this.debug = params.options?.debug ?? false;
45
+ }
46
+ /** Card shown to the router for selection. */
47
+ getCard() {
48
+ return { name: this.name, description: this.description, domain: this.domain };
49
+ }
50
+ /** Only the tools this subagent owns, resolved from the shared registry. */
51
+ getTools() {
52
+ return this.registry.getDefinitions().filter((t) => this.toolNames.has(t.name));
53
+ }
54
+ async run(task, conversationHistory, userContext) {
55
+ const tools = this.getTools();
56
+ if (this.debug) {
57
+ console.log(`\n [${this.name}] query: "${task.query}"`);
58
+ console.log(` [${this.name}] tools available: ${tools.map((t) => t.name).join(', ')}`);
59
+ }
60
+ if (tools.length === 0) {
61
+ return {
62
+ subagentName: this.name,
63
+ steps: [],
64
+ finalAnswer: `Subagent "${this.name}" has no registered tools available.`,
65
+ toolResults: [],
66
+ toolMessages: [],
67
+ };
68
+ }
69
+ const trace = [];
70
+ const toolResults = [];
71
+ // Interleaved assistant+toolCalls / role:'tool' messages for ChatHistory
72
+ const toolMessages = [];
73
+ const calledKeys = new Set();
74
+ let toolCallCount = 0;
75
+ const contextParts = [];
76
+ if (userContext?.walletAddress)
77
+ contextParts.push(`Connected wallet: ${userContext.walletAddress}`);
78
+ if (userContext?.chain)
79
+ contextParts.push(`Current chain: ${userContext.chain}`);
80
+ const contextSection = contextParts.length > 0 ? `User context:\n${contextParts.join('\n')}` : '';
81
+ const userContent = [
82
+ contextSection,
83
+ `Routed query: ${task.query}`,
84
+ task.reasoning ? `Router reasoning: ${task.reasoning}` : '',
85
+ "Use only the tools you own. If you already have enough information, respond directly in the user's language.",
86
+ ]
87
+ .filter(Boolean)
88
+ .join('\n\n');
89
+ // Filter history so only tool messages this subagent owns survive (orphan
90
+ // functionResponse parts would confuse Gemini since its tool schema only
91
+ // contains this subagent's tools). Then keep a recent window without
92
+ // splitting any remaining tool-call group.
93
+ const filteredHistory = (0, historyUtils_1.filterToolMessagesForSubagent)(conversationHistory, this.toolNames);
94
+ const windowed = (0, historyUtils_1.sliceRecentKeepingToolPairs)(filteredHistory, this.historyMessages);
95
+ const messages = [
96
+ { role: 'system', content: this.systemPrompt, timestamp: 0 },
97
+ ...windowed,
98
+ { role: 'user', content: userContent, timestamp: Date.now() },
99
+ ];
100
+ // Max chars stored per tool result in history.
101
+ // Must be large enough to preserve: transaction hashes (66 chars each),
102
+ // pagination cursors (100–300 chars), and enough transactions for
103
+ // follow-up lookups ("details of this tx"). 6000 chars ≈ 5–6 transactions
104
+ // with full ERC-20 transfer data while keeping context cost acceptable.
105
+ const TOOL_RESULT_MAX_CHARS = 6000;
106
+ const maxIterations = this.maxToolCalls + 2;
107
+ for (let i = 0; i < maxIterations; i++) {
108
+ const budgetLeft = toolCallCount < this.maxToolCalls;
109
+ const toolsThisTurn = budgetLeft ? tools : undefined;
110
+ const response = await this.llm.chat(messages, toolsThisTurn);
111
+ if (response.toolCalls.length === 0) {
112
+ // First-turn safety net: the subagent owns tools but the LLM tried to
113
+ // answer from its own knowledge. If a Cortex fallback is declared,
114
+ // re-prompt the LLM and force it to call Cortex with the user's query.
115
+ // This guarantees on-chain-shaped questions never get a hallucinated
116
+ // answer with zero tool calls.
117
+ if (toolCallCount === 0 && this.cortexFallbackTool && budgetLeft) {
118
+ if (this.debug) {
119
+ console.log(` [${this.name}] no tool called — forcing fallback to ${this.cortexFallbackTool}`);
120
+ }
121
+ messages.push({
122
+ role: 'user',
123
+ content: `You answered without calling any tool. This is not allowed for on-chain queries. ` +
124
+ `Call "${this.cortexFallbackTool}" now with a clear, well-formed English prompt that captures the user's intent. ` +
125
+ `Resolve ambiguity with sensible defaults (chain: Ethereum unless specified; result count: top 10; ` +
126
+ `time window: last 24h; sort key: 24h volume for "top/best/trending" queries). ` +
127
+ `Do NOT answer in text — call the tool.`,
128
+ timestamp: Date.now(),
129
+ });
130
+ continue;
131
+ }
132
+ if (this.debug) {
133
+ console.log(` [${this.name}] done — ${toolCallCount} tool call(s), answer: "${response.text.slice(0, 80)}…"`);
134
+ }
135
+ return { subagentName: this.name, steps: trace, finalAnswer: response.text, toolResults, toolMessages };
136
+ }
137
+ // The assistant message sent to Gemini for this iteration.
138
+ // We push it to `messages` now and will push to `toolMessages` only if
139
+ // at least one valid tool call succeeds in this iteration.
140
+ const assistantMsg = {
141
+ role: 'assistant',
142
+ content: response.text || '',
143
+ toolCalls: response.toolCalls,
144
+ timestamp: Date.now(),
145
+ };
146
+ messages.push(assistantMsg);
147
+ // Collect per-iteration valid tool results before deciding what to store.
148
+ const iterationToolMsgs = [];
149
+ for (const tc of response.toolCalls) {
150
+ if (!this.toolNames.has(tc.toolName)) {
151
+ const err = `Tool "${tc.toolName}" is not owned by ${this.name}`;
152
+ if (this.debug)
153
+ console.log(` [${this.name}] WARN: ${err}`);
154
+ trace.push({ phase: 'observe', content: err, timestamp: Date.now() });
155
+ messages.push({
156
+ role: 'tool',
157
+ content: err,
158
+ toolName: tc.toolName,
159
+ toolCallId: tc.callId,
160
+ timestamp: Date.now(),
161
+ });
162
+ continue;
163
+ }
164
+ const key = `${tc.toolName}::${JSON.stringify(tc.args)}`;
165
+ if (calledKeys.has(key)) {
166
+ const skip = `Skipped duplicate call: ${tc.toolName}`;
167
+ if (this.debug)
168
+ console.log(` [${this.name}] SKIP duplicate: ${tc.toolName}`);
169
+ trace.push({ phase: 'observe', content: skip, timestamp: Date.now() });
170
+ messages.push({
171
+ role: 'tool',
172
+ content: skip,
173
+ toolName: tc.toolName,
174
+ toolCallId: tc.callId,
175
+ timestamp: Date.now(),
176
+ });
177
+ continue;
178
+ }
179
+ calledKeys.add(key);
180
+ toolCallCount++;
181
+ if (this.debug) {
182
+ console.log(` [${this.name}] call #${toolCallCount}: ${tc.toolName} ${JSON.stringify(tc.args)}`);
183
+ }
184
+ trace.push({ phase: 'think', content: response.text || `Calling ${tc.toolName}`, timestamp: Date.now() });
185
+ trace.push({
186
+ phase: 'act',
187
+ content: `Calling tool: ${tc.toolName}`,
188
+ toolCall: { toolName: tc.toolName, args: tc.args },
189
+ timestamp: Date.now(),
190
+ });
191
+ const t0 = Date.now();
192
+ const result = await this.registry.execute(tc.toolName, tc.args, userContext);
193
+ toolResults.push(result);
194
+ const observation = result.success ? JSON.stringify(result.data) : `Error: ${result.error}`;
195
+ if (this.debug) {
196
+ const status = result.success ? 'OK' : 'ERR';
197
+ const preview = result.success
198
+ ? `${observation.slice(0, 120)}${observation.length > 120 ? '…' : ''}`
199
+ : result.error;
200
+ console.log(` [${this.name}] ${status} (${Date.now() - t0}ms): ${preview}`);
201
+ }
202
+ trace.push({ phase: 'observe', content: observation, toolResult: result, timestamp: Date.now() });
203
+ const toolMsg = {
204
+ role: 'tool',
205
+ content: observation,
206
+ toolName: tc.toolName,
207
+ toolCallId: tc.callId,
208
+ timestamp: Date.now(),
209
+ };
210
+ messages.push(toolMsg);
211
+ // Store a size-capped version in history so cursors + key data survive
212
+ // across turns without ballooning the context window.
213
+ iterationToolMsgs.push({
214
+ ...toolMsg,
215
+ content: observation.length > TOOL_RESULT_MAX_CHARS
216
+ ? observation.slice(0, TOOL_RESULT_MAX_CHARS) + '…[truncated]'
217
+ : observation,
218
+ });
219
+ }
220
+ // If any valid tool was called this iteration, persist the assistant
221
+ // function-call message + truncated results into toolMessages.
222
+ if (iterationToolMsgs.length > 0) {
223
+ toolMessages.push(assistantMsg);
224
+ toolMessages.push(...iterationToolMsgs);
225
+ }
226
+ }
227
+ if (this.debug) {
228
+ console.log(` [${this.name}] budget exhausted after ${toolCallCount} calls, forcing final answer`);
229
+ }
230
+ messages.push({
231
+ role: 'user',
232
+ content: 'Tool budget reached. Give your best answer now based on the data gathered.',
233
+ timestamp: Date.now(),
234
+ });
235
+ const final = await this.llm.chat(messages);
236
+ return { subagentName: this.name, steps: trace, finalAnswer: final.text, toolResults, toolMessages };
237
+ }
238
+ }
239
+ exports.Subagent = Subagent;
240
+ //# sourceMappingURL=Subagent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Subagent.js","sourceRoot":"","sources":["../../src/agent/Subagent.ts"],"names":[],"mappings":";;;AAYA,yDAAoG;AAkCpG;;;;;;;;;;GAUG;AACH,MAAa,QAAQ;IACV,IAAI,CAAS;IACb,WAAW,CAAS;IACpB,MAAM,CAAS;IACP,SAAS,CAAc;IACvB,YAAY,CAAS;IACrB,kBAAkB,CAAU;IAC5B,GAAG,CAAc;IACjB,QAAQ,CAAe;IACvB,YAAY,CAAS;IACrB,eAAe,CAAS;IACxB,KAAK,CAAU;IAEhC,YAAY,MAAsB;QAChC,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;QACxB,IAAI,CAAC,WAAW,GAAG,MA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AAE,CAAC;IACvG,CAAC;CACF;AAhQD,4BAgQC"}
@@ -0,0 +1,11 @@
1
+ import type { ChatMessage, LLMProvider, ReActTrace } from '../types';
2
+ /**
3
+ * Takes the ReAct execution trace and produces a polished
4
+ * final response suitable for the end user.
5
+ */
6
+ export declare class Synthesizer {
7
+ private llm;
8
+ constructor(llm: LLMProvider);
9
+ synthesise(userQuery: string, trace: ReActTrace, conversationHistory: ChatMessage[], language?: string): Promise<string>;
10
+ }
11
+ //# sourceMappingURL=Synthesizer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Synthesizer.d.ts","sourceRoot":"","sources":["../../src/agent/Synthesizer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAcrE;;;GAGG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,GAAG,CAAc;gBAEb,GAAG,EAAE,WAAW;IAItB,UAAU,CACd,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,UAAU,EACjB,mBAAmB,EAAE,WAAW,EAAE,EAClC,QAAQ,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC,MAAM,CAAC;CAoDnB"}
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Synthesizer = void 0;
4
+ const historyUtils_1 = require("../memory/historyUtils");
5
+ const SYNTHESIZER_SYSTEM_PROMPT = `You are a response synthesizer. Given the user's question and tool execution results, produce a clear, helpful final answer.
6
+
7
+ Rules:
8
+ - Be concise but complete.
9
+ - Present data in a readable format (use lists, tables, or bullet points when appropriate).
10
+ - If tool data contains the answer, cite the relevant facts and numbers.
11
+ - If tools returned errors, explain honestly what happened.
12
+ - Respond in the same language as the user's message.
13
+ - Do NOT mention internal tool names, JSON structures, or technical implementation details.
14
+ `;
15
+ /**
16
+ * Takes the ReAct execution trace and produces a polished
17
+ * final response suitable for the end user.
18
+ */
19
+ class Synthesizer {
20
+ llm;
21
+ constructor(llm) {
22
+ this.llm = llm;
23
+ }
24
+ async synthesise(userQuery, trace, conversationHistory, language) {
25
+ // If no tools ran and we already have a single subagent answer, return it
26
+ // directly — but strip the "[subagent-name] " debug prefix added by
27
+ // AgentCore.mergeTrace so the user never sees internal agent ids.
28
+ const hasToolCalls = trace.steps.some((s) => s.phase === 'act');
29
+ if (!hasToolCalls && trace.finalAnswer) {
30
+ return stripSubagentPrefix(trace.finalAnswer);
31
+ }
32
+ // Build a concise summary of tool observations
33
+ const observations = trace.steps
34
+ .filter((s) => s.phase === 'observe')
35
+ .map((s, i) => `[Result ${i + 1}]: ${s.content}`)
36
+ .join('\n');
37
+ // Synthesizer has NO tools declared — defensively strip any tool messages
38
+ // from the history slice, then keep a window without splitting tool-call
39
+ // groups (relevant only if the caller passed a raw history).
40
+ const cleanHistory = (0, historyUtils_1.stripToolMessages)(conversationHistory);
41
+ const windowed = (0, historyUtils_1.sliceRecentKeepingToolPairs)(cleanHistory, 8);
42
+ // Prefer the rewriter-detected BCP-47 tag — tool results often contain
43
+ // mixed-language strings (e.g. token symbols, on-chain metadata) which
44
+ // would otherwise confuse the model about which language to reply in.
45
+ const lang = (language || '').trim().toLowerCase();
46
+ const languageDirective = lang
47
+ ? `IMPORTANT: Reply in BCP-47 language "${lang}" (the language the user actually typed). Tool results may contain text in other languages — ignore that and reply ONLY in "${lang}".`
48
+ : `IMPORTANT: The user wrote in the language of this message: "${userQuery}". Reply in that exact language, ignoring any other languages that appear inside tool results.`;
49
+ const messages = [
50
+ { role: 'system', content: SYNTHESIZER_SYSTEM_PROMPT, timestamp: 0 },
51
+ ...windowed,
52
+ {
53
+ role: 'user',
54
+ content: [
55
+ `User question: ${userQuery}`,
56
+ '',
57
+ `Agent reasoning: ${trace.finalAnswer}`,
58
+ '',
59
+ observations ? `Tool results:\n${observations}` : '',
60
+ '',
61
+ languageDirective,
62
+ ]
63
+ .filter(Boolean)
64
+ .join('\n'),
65
+ timestamp: Date.now(),
66
+ },
67
+ ];
68
+ const response = await this.llm.chat(messages);
69
+ return stripSubagentPrefix(response.text);
70
+ }
71
+ }
72
+ exports.Synthesizer = Synthesizer;
73
+ /**
74
+ * AgentCore.mergeTrace tags each subagent answer with a "[subagent-name] "
75
+ * debug prefix so multi-agent traces are readable. The synthesiser must
76
+ * strip that tag before returning to the user — otherwise replies start
77
+ * with internal ids like "[ai-agent] …".
78
+ *
79
+ * Handles both leading single-agent prefix and inline multi-agent joins.
80
+ */
81
+ function stripSubagentPrefix(text) {
82
+ if (!text)
83
+ return text;
84
+ return text.replace(/^\[[a-z0-9-]+-agent\]\s*/i, '').replace(/\n\n\[[a-z0-9-]+-agent\]\s*/gi, '\n\n');
85
+ }
86
+ //# sourceMappingURL=Synthesizer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Synthesizer.js","sourceRoot":"","sources":["../../src/agent/Synthesizer.ts"],"names":[],"mappings":";;;AACA,yDAAwF;AAExF,MAAM,yBAAyB,GAAG;;;;;;;;;CASjC,CAAC;AAEF;;;GAGG;AACH,MAAa,WAAW;IACd,GAAG,CAAc;IAEzB,YAAY,GAAgB;QAC1B,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACjB,CAAC;IAED,KAAK,CAAC,UAAU,CACd,SAAiB,EACjB,KAAiB,EACjB,mBAAkC,EAClC,QAAiB;QAEjB,0EAA0E;QAC1E,oEAAoE;QACpE,kEAAkE;QAClE,MAAM,YAAY,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,KAAK,CAAC,CAAC;QAChE,IAAI,CAAC,YAAY,IAAI,KAAK,CAAC,WAAW,EAAE,CAAC;YACvC,OAAO,mBAAmB,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QAChD,CAAC;QAED,+CAA+C;QAC/C,MAAM,YAAY,GAAG,KAAK,CAAC,KAAK;aAC7B,MAAM,CAAC,C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,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC/C,OAAO,mBAAmB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC5C,CAAC;CACF;AAhED,kCAgEC;AAED;;;;;;;GAOG;AACH,SAAS,mBAAmB,CAAC,IAAY;IACvC,IAAI,CAAC,IAAI;QAAE,OAAO,IAAI,CAAC;IACvB,OAAO,IAAI,CAAC,OAAO,CAAC,2BAA2B,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,+BAA+B,EAAE,MAAM,CAAC,CAAC;AACxG,CAAC"}
@@ -0,0 +1,10 @@
1
+ export { AgentCore } from './AgentCore';
2
+ export type { AgentResponse } from './AgentCore';
3
+ export { Router } from './Router';
4
+ export { Subagent } from './Subagent';
5
+ export type { SubagentOptions, SubagentParams } from './Subagent';
6
+ export { Synthesizer } from './Synthesizer';
7
+ export { QueryRewriter } from './QueryRewriter';
8
+ export type { RewriteResult, QueryRewriterOptions } from './QueryRewriter';
9
+ export { createDefaultSubagents, createWalletAgent, createTokenAgent, createNftAgent, createAiAgent, WALLET_AGENT_TOOL_NAMES, TOKEN_AGENT_TOOL_NAMES, NFT_AGENT_TOOL_NAMES, AI_AGENT_TOOL_NAMES, } from './subagents';
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/agent/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,YAAY,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAC3E,OAAO,EACL,sBAAsB,EACtB,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,EACd,aAAa,EACb,uBAAuB,EACvB,sBAAsB,EACtB,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,aAAa,CAAC"}
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AI_AGENT_TOOL_NAMES = exports.NFT_AGENT_TOOL_NAMES = exports.TOKEN_AGENT_TOOL_NAMES = exports.WALLET_AGENT_TOOL_NAMES = exports.createAiAgent = exports.createNftAgent = exports.createTokenAgent = exports.createWalletAgent = exports.createDefaultSubagents = exports.QueryRewriter = exports.Synthesizer = exports.Subagent = exports.Router = exports.AgentCore = void 0;
4
+ var AgentCore_1 = require("./AgentCore");
5
+ Object.defineProperty(exports, "AgentCore", { enumerable: true, get: function () { return AgentCore_1.AgentCore; } });
6
+ var Router_1 = require("./Router");
7
+ Object.defineProperty(exports, "Router", { enumerable: true, get: function () { return Router_1.Router; } });
8
+ var Subagent_1 = require("./Subagent");
9
+ Object.defineProperty(exports, "Subagent", { enumerable: true, get: function () { return Subagent_1.Subagent; } });
10
+ var Synthesizer_1 = require("./Synthesizer");
11
+ Object.defineProperty(exports, "Synthesizer", { enumerable: true, get: function () { return Synthesizer_1.Synthesizer; } });
12
+ var QueryRewriter_1 = require("./QueryRewriter");
13
+ Object.defineProperty(exports, "QueryRewriter", { enumerable: true, get: function () { return QueryRewriter_1.QueryRewriter; } });
14
+ var subagents_1 = require("./subagents");
15
+ Object.defineProperty(exports, "createDefaultSubagents", { enumerable: true, get: function () { return subagents_1.createDefaultSubagents; } });
16
+ Object.defineProperty(exports, "createWalletAgent", { enumerable: true, get: function () { return subagents_1.createWalletAgent; } });
17
+ Object.defineProperty(exports, "createTokenAgent", { enumerable: true, get: function () { return subagents_1.createTokenAgent; } });
18
+ Object.defineProperty(exports, "createNftAgent", { enumerable: true, get: function () { return subagents_1.createNftAgent; } });
19
+ Object.defineProperty(exports, "createAiAgent", { enumerable: true, get: function () { return subagents_1.createAiAgent; } });
20
+ Object.defineProperty(exports, "WALLET_AGENT_TOOL_NAMES", { enumerable: true, get: function () { return subagents_1.WALLET_AGENT_TOOL_NAMES; } });
21
+ Object.defineProperty(exports, "TOKEN_AGENT_TOOL_NAMES", { enumerable: true, get: function () { return subagents_1.TOKEN_AGENT_TOOL_NAMES; } });
22
+ Object.defineProperty(exports, "NFT_AGENT_TOOL_NAMES", { enumerable: true, get: function () { return subagents_1.NFT_AGENT_TOOL_NAMES; } });
23
+ Object.defineProperty(exports, "AI_AGENT_TOOL_NAMES", { enumerable: true, get: function () { return subagents_1.AI_AGENT_TOOL_NAMES; } });
24
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/agent/index.ts"],"names":[],"mappings":";;;AAAA,yCAAwC;AAA/B,sGAAA,SAAS,OAAA;AAElB,mCAAkC;AAAzB,gGAAA,MAAM,OAAA;AACf,uCAAsC;AAA7B,oGAAA,QAAQ,OAAA;AAEjB,6CAA4C;AAAnC,0GAAA,WAAW,OAAA;AACpB,iDAAgD;AAAvC,8GAAA,aAAa,OAAA;AAEtB,yCAUqB;AATnB,mHAAA,sBAAsB,OAAA;AACtB,8GAAA,iBAAiB,OAAA;AACjB,6GAAA,gBAAgB,OAAA;AAChB,2GAAA,cAAc,OAAA;AACd,0GAAA,aAAa,OAAA;AACb,oHAAA,uBAAuB,OAAA;AACvB,mHAAA,sBAAsB,OAAA;AACtB,iHAAA,oBAAoB,OAAA;AACpB,gHAAA,mBAAmB,OAAA"}
@@ -0,0 +1,6 @@
1
+ import type { LLMProvider } from '../../types';
2
+ import type { ToolRegistry } from '../../tools/ToolRegistry';
3
+ import { Subagent, type SubagentOptions } from '../Subagent';
4
+ export declare const AI_AGENT_TOOL_NAMES: readonly ["moralis-cortex-ai", "solana-cortex-ai"];
5
+ export declare function createAiAgent(llm: LLMProvider, registry: ToolRegistry, options?: SubagentOptions): Subagent;
6
+ //# sourceMappingURL=AiAgent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AiAgent.d.ts","sourceRoot":"","sources":["../../../src/agent/subagents/AiAgent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,KAAK,eAAe,EAAE,MAAM,aAAa,CAAC;AAmB7D,eAAO,MAAM,mBAAmB,oDAAqD,CAAC;AAEtF,wBAAgB,aAAa,CAAC,GAAG,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,QAAQ,CAwB3G"}
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AI_AGENT_TOOL_NAMES = void 0;
4
+ exports.createAiAgent = createAiAgent;
5
+ const Subagent_1 = require("../Subagent");
6
+ const AI_AGENT_PROMPT = `You are the Crypto AI-Cortex expert.
7
+
8
+ You answer ANY blockchain / crypto / token / NFT / DeFi / on-chain question that does not
9
+ have a direct structured tool in the other agents. Cortex is a natural-language AI over
10
+ on-chain data — trust it to handle the query.
11
+
12
+ ROUTING (which Cortex tool to call):
13
+ - Solana-related question (Solana wallet, SPL token, Solana NFT, Solana DeFi) → solana-cortex-ai
14
+ - Everything else (EVM chains, general crypto, token categories like meme/AI/gaming,
15
+ protocol questions, exploratory analysis) → moralis-cortex-ai
16
+
17
+ RULES:
18
+ - Always call exactly ONE Cortex tool per turn. NEVER refuse, NEVER answer without calling a tool.
19
+ - Pass the user's question to the Cortex tool VERBATIM — do not rephrase or shorten it.
20
+ - NEVER retry with the same query if the Cortex call fails — return what you have.
21
+ - Answer in the user's language. Do NOT mention tool names.`;
22
+ exports.AI_AGENT_TOOL_NAMES = ['moralis-cortex-ai', 'solana-cortex-ai'];
23
+ function createAiAgent(llm, registry, options) {
24
+ return new Subagent_1.Subagent({
25
+ name: 'ai-agent',
26
+ domain: 'ai',
27
+ description: [
28
+ 'Catch-all crypto / blockchain expert powered by AI Cortex (natural-language on-chain data).',
29
+ 'USE THIS AGENT whenever the query is about blockchain, crypto, tokens, NFTs, DeFi, wallets,',
30
+ 'on-chain data, smart contracts, or any chain (EVM or Solana) BUT no other agent',
31
+ '(wallet-agent, token-agent, nft-agent, pool-agent) has a direct structured tool for it.',
32
+ 'Scope examples: (1) any Solana question — wallets, SPL tokens, NFTs, DeFi on Solana;',
33
+ '(2) token categories or themes — meme tokens, AI tokens, gaming tokens, L2 tokens, RWA;',
34
+ '(3) protocol-specific questions — "how does X protocol work", "what happened to Y";',
35
+ '(4) cross-contract or exploratory EVM analysis spanning many contracts;',
36
+ '(5) any open-ended on-chain question without a direct structured tool.',
37
+ 'Prefer the specific agents when they clearly match (wallet balances → wallet-agent,',
38
+ 'single-token info/analytics → token-agent, NFT holdings/metadata → nft-agent, DEX pools → pool-agent).',
39
+ 'But for anything crypto-related that falls outside those, route HERE — do not return empty.',
40
+ ].join(' '),
41
+ toolNames: [...exports.AI_AGENT_TOOL_NAMES],
42
+ systemPrompt: AI_AGENT_PROMPT,
43
+ llm,
44
+ registry,
45
+ options,
46
+ });
47
+ }
48
+ //# sourceMappingURL=AiAgent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AiAgent.js","sourceRoot":"","sources":["../../../src/agent/subagents/AiAgent.ts"],"names":[],"mappings":";;;AAuBA,sCAwBC;AA7CD,0CAA6D;AAE7D,MAAM,eAAe,GAAG;;;;;;;;;;;;;;;4DAeoC,CAAC;AAEhD,QAAA,mBAAmB,GAAG,CAAC,mBAAmB,EAAE,kBAAkB,CAAU,CAAC;AAEtF,SAAgB,aAAa,CAAC,GAAgB,EAAE,QAAsB,EAAE,OAAyB;IAC/F,OAAO,IAAI,mBAAQ,CAAC;QAClB,IAAI,EAAE,UAAU;QAChB,MAAM,EAAE,IAAI;QACZ,WAAW,EAAE;YACX,6FAA6F;YAC7F,6FAA6F;YAC7F,iFAAiF;YACjF,yFAAyF;YACzF,sFAAsF;YACtF,yFAAyF;YACzF,qFAAqF;YACrF,yEAAyE;YACzE,wEAAwE;YACxE,qFAAqF;YACrF,wGAAwG;YACxG,6FAA6F;SAC9F,CAAC,IAAI,CAAC,GAAG,CAAC;QACX,SAAS,EAAE,CAAC,GAAG,2BAAmB,CAAC;QACnC,YAAY,EAAE,eAAe;QAC7B,GAAG;QACH,QAAQ;QACR,OAAO;KACR,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { LLMProvider } from '../../types';
2
+ import type { ToolRegistry } from '../../tools/ToolRegistry';
3
+ import { Subagent, type SubagentOptions } from '../Subagent';
4
+ export declare const NFT_AGENT_TOOL_NAMES: readonly ["get-wallet-nfts", "get-nft-metadata", "get-nft-contract-info", "moralis-cortex-ai", "solana-cortex-ai"];
5
+ export declare function createNftAgent(llm: LLMProvider, registry: ToolRegistry, options?: SubagentOptions): Subagent;
6
+ //# sourceMappingURL=NftAgent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NftAgent.d.ts","sourceRoot":"","sources":["../../../src/agent/subagents/NftAgent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,KAAK,eAAe,EAAE,MAAM,aAAa,CAAC;AAwC7D,eAAO,MAAM,oBAAoB,oHAMvB,CAAC;AAEX,wBAAgB,cAAc,CAAC,GAAG,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,QAAQ,CAkB5G"}