@hashgraphonline/conversational-agent 0.2.215 → 0.2.217

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 (310) hide show
  1. package/cli/readme.md +181 -0
  2. package/dist/cjs/index.cjs +1 -1
  3. package/dist/cjs/index.cjs.map +1 -1
  4. package/dist/cjs/index.d.ts +1 -0
  5. package/dist/cjs/plugins/community/swarm/SwarmPlugin.d.ts +17 -0
  6. package/dist/cjs/plugins/community/swarm/__tests__/SwarmPlugin.mocks.d.ts +1 -0
  7. package/dist/cjs/plugins/community/swarm/__tests__/SwarmPlugin.test.d.ts +1 -0
  8. package/dist/cjs/plugins/community/swarm/__tests__/tools/CreatePostageStampTool.test.d.ts +1 -0
  9. package/dist/cjs/plugins/community/swarm/__tests__/tools/DownloadDataTool.test.d.ts +1 -0
  10. package/dist/cjs/plugins/community/swarm/__tests__/tools/DownloadFilesTool.test.d.ts +1 -0
  11. package/dist/cjs/plugins/community/swarm/__tests__/tools/ExtendPostageStampTool.test.d.ts +1 -0
  12. package/dist/cjs/plugins/community/swarm/__tests__/tools/GetPostageStampTool.test.d.ts +1 -0
  13. package/dist/cjs/plugins/community/swarm/__tests__/tools/ListPostageStampsTool.test.d.ts +1 -0
  14. package/dist/cjs/plugins/community/swarm/__tests__/tools/QueryUploadProgressTool.test.d.ts +1 -0
  15. package/dist/cjs/plugins/community/swarm/__tests__/tools/ReadFeedTool.test.d.ts +1 -0
  16. package/dist/cjs/plugins/community/swarm/__tests__/tools/SwarmTool.mocks.d.ts +14 -0
  17. package/dist/cjs/plugins/community/swarm/__tests__/tools/UpdateFeedTool.test.d.ts +1 -0
  18. package/dist/cjs/plugins/community/swarm/__tests__/tools/UploadDataTool.test.d.ts +1 -0
  19. package/dist/cjs/plugins/community/swarm/__tests__/tools/UploadFileTool.test.d.ts +1 -0
  20. package/dist/cjs/plugins/community/swarm/__tests__/tools/UploadFolderTool.test.d.ts +1 -0
  21. package/dist/cjs/plugins/community/swarm/config.d.ts +6 -0
  22. package/dist/cjs/plugins/community/swarm/constants.d.ts +8 -0
  23. package/dist/cjs/plugins/community/swarm/index.d.ts +2 -0
  24. package/dist/cjs/plugins/community/swarm/model.d.ts +23 -0
  25. package/dist/cjs/plugins/community/swarm/tools/CreatePostageStampTool.d.ts +47 -0
  26. package/dist/cjs/plugins/community/swarm/tools/DownloadDataTool.d.ts +35 -0
  27. package/dist/cjs/plugins/community/swarm/tools/DownloadFilesTool.d.ts +41 -0
  28. package/dist/cjs/plugins/community/swarm/tools/ExtendPostageStampTool.d.ts +47 -0
  29. package/dist/cjs/plugins/community/swarm/tools/GetPostageStampTool.d.ts +35 -0
  30. package/dist/cjs/plugins/community/swarm/tools/ListPostageStampsTool.d.ts +53 -0
  31. package/dist/cjs/plugins/community/swarm/tools/QueryUploadProgressTool.d.ts +35 -0
  32. package/dist/cjs/plugins/community/swarm/tools/ReadFeedTool.d.ts +41 -0
  33. package/dist/cjs/plugins/community/swarm/tools/UpdateFeedTool.d.ts +47 -0
  34. package/dist/cjs/plugins/community/swarm/tools/UploadDataTool.d.ts +47 -0
  35. package/dist/cjs/plugins/community/swarm/tools/UploadFileTool.d.ts +53 -0
  36. package/dist/cjs/plugins/community/swarm/tools/UploadFolderTool.d.ts +47 -0
  37. package/dist/cjs/plugins/community/swarm/utils.d.ts +22 -0
  38. package/dist/cjs/plugins/index.d.ts +1 -0
  39. package/dist/esm/index.js +33 -31
  40. package/dist/esm/index.js.map +1 -1
  41. package/dist/esm/index10.js +13 -677
  42. package/dist/esm/index10.js.map +1 -1
  43. package/dist/esm/index11.js +601 -234
  44. package/dist/esm/index11.js.map +1 -1
  45. package/dist/esm/index12.js +296 -136
  46. package/dist/esm/index12.js.map +1 -1
  47. package/dist/esm/index13.js +127 -235
  48. package/dist/esm/index13.js.map +1 -1
  49. package/dist/esm/index14.js +247 -84
  50. package/dist/esm/index14.js.map +1 -1
  51. package/dist/esm/index15.js +81 -159
  52. package/dist/esm/index15.js.map +1 -1
  53. package/dist/esm/index16.js +155 -229
  54. package/dist/esm/index16.js.map +1 -1
  55. package/dist/esm/index17.js +238 -140
  56. package/dist/esm/index17.js.map +1 -1
  57. package/dist/esm/index18.js +139 -493
  58. package/dist/esm/index18.js.map +1 -1
  59. package/dist/esm/index19.js +479 -91
  60. package/dist/esm/index19.js.map +1 -1
  61. package/dist/esm/index20.js +88 -147
  62. package/dist/esm/index20.js.map +1 -1
  63. package/dist/esm/index21.js +127 -666
  64. package/dist/esm/index21.js.map +1 -1
  65. package/dist/esm/index22.js +698 -44
  66. package/dist/esm/index22.js.map +1 -1
  67. package/dist/esm/index23.js +45 -304
  68. package/dist/esm/index23.js.map +1 -1
  69. package/dist/esm/index24.js +303 -153
  70. package/dist/esm/index24.js.map +1 -1
  71. package/dist/esm/index25.js +150 -117
  72. package/dist/esm/index25.js.map +1 -1
  73. package/dist/esm/index26.js +154 -18
  74. package/dist/esm/index26.js.map +1 -1
  75. package/dist/esm/index27.js +18 -22
  76. package/dist/esm/index27.js.map +1 -1
  77. package/dist/esm/index28.js +15 -74
  78. package/dist/esm/index28.js.map +1 -1
  79. package/dist/esm/index29.js +70 -295
  80. package/dist/esm/index29.js.map +1 -1
  81. package/dist/esm/index30.js +279 -100
  82. package/dist/esm/index30.js.map +1 -1
  83. package/dist/esm/index31.js +86 -922
  84. package/dist/esm/index31.js.map +1 -1
  85. package/dist/esm/index32.js +904 -189
  86. package/dist/esm/index32.js.map +1 -1
  87. package/dist/esm/index33.js +185 -1169
  88. package/dist/esm/index33.js.map +1 -1
  89. package/dist/esm/index34.js +1218 -112
  90. package/dist/esm/index34.js.map +1 -1
  91. package/dist/esm/index35.js +111 -99
  92. package/dist/esm/index35.js.map +1 -1
  93. package/dist/esm/index36.js +113 -8
  94. package/dist/esm/index36.js.map +1 -1
  95. package/dist/esm/index37.js +8 -45
  96. package/dist/esm/index37.js.map +1 -1
  97. package/dist/esm/index38.js +41 -102
  98. package/dist/esm/index38.js.map +1 -1
  99. package/dist/esm/index39.js +96 -55
  100. package/dist/esm/index39.js.map +1 -1
  101. package/dist/esm/index4.js +1 -1
  102. package/dist/esm/index40.js +58 -71
  103. package/dist/esm/index40.js.map +1 -1
  104. package/dist/esm/index41.js +79 -21
  105. package/dist/esm/index41.js.map +1 -1
  106. package/dist/esm/index42.js +21 -5
  107. package/dist/esm/index42.js.map +1 -1
  108. package/dist/esm/index43.js +4 -11
  109. package/dist/esm/index43.js.map +1 -1
  110. package/dist/esm/index44.js +12 -322
  111. package/dist/esm/index44.js.map +1 -1
  112. package/dist/esm/index45.js +280 -142
  113. package/dist/esm/index45.js.map +1 -1
  114. package/dist/esm/index46.js +181 -24
  115. package/dist/esm/index46.js.map +1 -1
  116. package/dist/esm/index48.js +67 -85
  117. package/dist/esm/index48.js.map +1 -1
  118. package/dist/esm/index49.js +75 -0
  119. package/dist/esm/index49.js.map +1 -0
  120. package/dist/esm/index5.js +2 -2
  121. package/dist/esm/index50.js +57 -0
  122. package/dist/esm/index50.js.map +1 -0
  123. package/dist/esm/index51.js +103 -0
  124. package/dist/esm/index51.js.map +1 -0
  125. package/dist/esm/index52.js +79 -0
  126. package/dist/esm/index52.js.map +1 -0
  127. package/dist/esm/index53.js +75 -0
  128. package/dist/esm/index53.js.map +1 -0
  129. package/dist/esm/index54.js +124 -0
  130. package/dist/esm/index54.js.map +1 -0
  131. package/dist/esm/index55.js +58 -0
  132. package/dist/esm/index55.js.map +1 -0
  133. package/dist/esm/index56.js +83 -0
  134. package/dist/esm/index56.js.map +1 -0
  135. package/dist/esm/index57.js +100 -0
  136. package/dist/esm/index57.js.map +1 -0
  137. package/dist/esm/index58.js +118 -0
  138. package/dist/esm/index58.js.map +1 -0
  139. package/dist/esm/index59.js +108 -0
  140. package/dist/esm/index59.js.map +1 -0
  141. package/dist/esm/index6.js +132 -833
  142. package/dist/esm/index6.js.map +1 -1
  143. package/dist/esm/index60.js +30 -0
  144. package/dist/esm/index60.js.map +1 -0
  145. package/dist/esm/index61.js +98 -0
  146. package/dist/esm/index61.js.map +1 -0
  147. package/dist/esm/index62.js +131 -0
  148. package/dist/esm/index62.js.map +1 -0
  149. package/dist/esm/index63.js +19 -0
  150. package/dist/esm/index63.js.map +1 -0
  151. package/dist/esm/index7.js +826 -75
  152. package/dist/esm/index7.js.map +1 -1
  153. package/dist/esm/index8.js +91 -13
  154. package/dist/esm/index8.js.map +1 -1
  155. package/dist/esm/index9.js +13 -17
  156. package/dist/esm/index9.js.map +1 -1
  157. package/dist/types/index.d.ts +1 -0
  158. package/dist/types/plugins/community/swarm/SwarmPlugin.d.ts +17 -0
  159. package/dist/types/plugins/community/swarm/__tests__/SwarmPlugin.mocks.d.ts +1 -0
  160. package/dist/types/plugins/community/swarm/__tests__/SwarmPlugin.test.d.ts +1 -0
  161. package/dist/types/plugins/community/swarm/__tests__/tools/CreatePostageStampTool.test.d.ts +1 -0
  162. package/dist/types/plugins/community/swarm/__tests__/tools/DownloadDataTool.test.d.ts +1 -0
  163. package/dist/types/plugins/community/swarm/__tests__/tools/DownloadFilesTool.test.d.ts +1 -0
  164. package/dist/types/plugins/community/swarm/__tests__/tools/ExtendPostageStampTool.test.d.ts +1 -0
  165. package/dist/types/plugins/community/swarm/__tests__/tools/GetPostageStampTool.test.d.ts +1 -0
  166. package/dist/types/plugins/community/swarm/__tests__/tools/ListPostageStampsTool.test.d.ts +1 -0
  167. package/dist/types/plugins/community/swarm/__tests__/tools/QueryUploadProgressTool.test.d.ts +1 -0
  168. package/dist/types/plugins/community/swarm/__tests__/tools/ReadFeedTool.test.d.ts +1 -0
  169. package/dist/types/plugins/community/swarm/__tests__/tools/SwarmTool.mocks.d.ts +14 -0
  170. package/dist/types/plugins/community/swarm/__tests__/tools/UpdateFeedTool.test.d.ts +1 -0
  171. package/dist/types/plugins/community/swarm/__tests__/tools/UploadDataTool.test.d.ts +1 -0
  172. package/dist/types/plugins/community/swarm/__tests__/tools/UploadFileTool.test.d.ts +1 -0
  173. package/dist/types/plugins/community/swarm/__tests__/tools/UploadFolderTool.test.d.ts +1 -0
  174. package/dist/types/plugins/community/swarm/config.d.ts +6 -0
  175. package/dist/types/plugins/community/swarm/constants.d.ts +8 -0
  176. package/dist/types/plugins/community/swarm/index.d.ts +2 -0
  177. package/dist/types/plugins/community/swarm/model.d.ts +23 -0
  178. package/dist/types/plugins/community/swarm/tools/CreatePostageStampTool.d.ts +47 -0
  179. package/dist/types/plugins/community/swarm/tools/DownloadDataTool.d.ts +35 -0
  180. package/dist/types/plugins/community/swarm/tools/DownloadFilesTool.d.ts +41 -0
  181. package/dist/types/plugins/community/swarm/tools/ExtendPostageStampTool.d.ts +47 -0
  182. package/dist/types/plugins/community/swarm/tools/GetPostageStampTool.d.ts +35 -0
  183. package/dist/types/plugins/community/swarm/tools/ListPostageStampsTool.d.ts +53 -0
  184. package/dist/types/plugins/community/swarm/tools/QueryUploadProgressTool.d.ts +35 -0
  185. package/dist/types/plugins/community/swarm/tools/ReadFeedTool.d.ts +41 -0
  186. package/dist/types/plugins/community/swarm/tools/UpdateFeedTool.d.ts +47 -0
  187. package/dist/types/plugins/community/swarm/tools/UploadDataTool.d.ts +47 -0
  188. package/dist/types/plugins/community/swarm/tools/UploadFileTool.d.ts +53 -0
  189. package/dist/types/plugins/community/swarm/tools/UploadFolderTool.d.ts +47 -0
  190. package/dist/types/plugins/community/swarm/utils.d.ts +22 -0
  191. package/dist/types/plugins/index.d.ts +1 -0
  192. package/package.json +37 -27
  193. package/src/index.ts +1 -0
  194. package/src/plugins/community/swarm/README.md +279 -0
  195. package/src/plugins/community/swarm/SwarmPlugin.ts +178 -0
  196. package/src/plugins/community/swarm/__tests__/SwarmPlugin.mocks.ts +105 -0
  197. package/src/plugins/community/swarm/__tests__/SwarmPlugin.test.ts +93 -0
  198. package/src/plugins/community/swarm/__tests__/tools/CreatePostageStampTool.test.ts +152 -0
  199. package/src/plugins/community/swarm/__tests__/tools/DownloadDataTool.test.ts +93 -0
  200. package/src/plugins/community/swarm/__tests__/tools/DownloadFilesTool.test.ts +163 -0
  201. package/src/plugins/community/swarm/__tests__/tools/ExtendPostageStampTool.test.ts +132 -0
  202. package/src/plugins/community/swarm/__tests__/tools/GetPostageStampTool.test.ts +83 -0
  203. package/src/plugins/community/swarm/__tests__/tools/ListPostageStampsTool.test.ts +219 -0
  204. package/src/plugins/community/swarm/__tests__/tools/QueryUploadProgressTool.test.ts +169 -0
  205. package/src/plugins/community/swarm/__tests__/tools/ReadFeedTool.test.ts +133 -0
  206. package/src/plugins/community/swarm/__tests__/tools/SwarmTool.mocks.ts +67 -0
  207. package/src/plugins/community/swarm/__tests__/tools/UpdateFeedTool.test.ts +148 -0
  208. package/src/plugins/community/swarm/__tests__/tools/UploadDataTool.test.ts +125 -0
  209. package/src/plugins/community/swarm/__tests__/tools/UploadFileTool.test.ts +194 -0
  210. package/src/plugins/community/swarm/__tests__/tools/UploadFolderTool.test.ts +118 -0
  211. package/src/plugins/community/swarm/config.ts +6 -0
  212. package/src/plugins/community/swarm/constants.ts +12 -0
  213. package/src/plugins/community/swarm/index.ts +2 -0
  214. package/src/plugins/community/swarm/model.ts +23 -0
  215. package/src/plugins/community/swarm/tools/CreatePostageStampTool.ts +137 -0
  216. package/src/plugins/community/swarm/tools/DownloadDataTool.ts +79 -0
  217. package/src/plugins/community/swarm/tools/DownloadFilesTool.ts +155 -0
  218. package/src/plugins/community/swarm/tools/ExtendPostageStampTool.ts +112 -0
  219. package/src/plugins/community/swarm/tools/GetPostageStampTool.ts +92 -0
  220. package/src/plugins/community/swarm/tools/ListPostageStampsTool.ts +124 -0
  221. package/src/plugins/community/swarm/tools/QueryUploadProgressTool.ts +109 -0
  222. package/src/plugins/community/swarm/tools/ReadFeedTool.ts +110 -0
  223. package/src/plugins/community/swarm/tools/UpdateFeedTool.ts +149 -0
  224. package/src/plugins/community/swarm/tools/UploadDataTool.ts +109 -0
  225. package/src/plugins/community/swarm/tools/UploadFileTool.ts +163 -0
  226. package/src/plugins/community/swarm/tools/UploadFolderTool.ts +150 -0
  227. package/src/plugins/community/swarm/utils.ts +172 -0
  228. package/src/plugins/index.ts +1 -0
  229. package/cli/dist/CLIApp.d.ts +0 -11
  230. package/cli/dist/CLIApp.d.ts.map +0 -1
  231. package/cli/dist/CLIApp.js +0 -128
  232. package/cli/dist/CLIApp.js.map +0 -1
  233. package/cli/dist/LocalConversationalAgent.d.ts +0 -37
  234. package/cli/dist/LocalConversationalAgent.js +0 -58
  235. package/cli/dist/app.d.ts +0 -18
  236. package/cli/dist/app.d.ts.map +0 -1
  237. package/cli/dist/app.js +0 -14
  238. package/cli/dist/app.js.map +0 -1
  239. package/cli/dist/cli.d.ts +0 -3
  240. package/cli/dist/cli.d.ts.map +0 -1
  241. package/cli/dist/cli.js +0 -87
  242. package/cli/dist/cli.js.map +0 -1
  243. package/cli/dist/components/AppContainer.d.ts +0 -16
  244. package/cli/dist/components/AppContainer.js +0 -24
  245. package/cli/dist/components/AppScreens.d.ts +0 -2
  246. package/cli/dist/components/AppScreens.js +0 -259
  247. package/cli/dist/components/ChatScreen.d.ts +0 -21
  248. package/cli/dist/components/ChatScreen.d.ts.map +0 -1
  249. package/cli/dist/components/ChatScreen.js +0 -40
  250. package/cli/dist/components/ChatScreen.js.map +0 -1
  251. package/cli/dist/components/DebugLoadingScreen.d.ts +0 -5
  252. package/cli/dist/components/DebugLoadingScreen.js +0 -31
  253. package/cli/dist/components/LoadingScreen.d.ts +0 -3
  254. package/cli/dist/components/LoadingScreen.d.ts.map +0 -1
  255. package/cli/dist/components/LoadingScreen.js +0 -17
  256. package/cli/dist/components/LoadingScreen.js.map +0 -1
  257. package/cli/dist/components/LoadingScreenDebug.d.ts +0 -5
  258. package/cli/dist/components/LoadingScreenDebug.js +0 -27
  259. package/cli/dist/components/MCPConfigScreen.d.ts +0 -28
  260. package/cli/dist/components/MCPConfigScreen.d.ts.map +0 -1
  261. package/cli/dist/components/MCPConfigScreen.js +0 -186
  262. package/cli/dist/components/MCPConfigScreen.js.map +0 -1
  263. package/cli/dist/components/ScreenRouter.d.ts +0 -13
  264. package/cli/dist/components/ScreenRouter.d.ts.map +0 -1
  265. package/cli/dist/components/ScreenRouter.js +0 -23
  266. package/cli/dist/components/ScreenRouter.js.map +0 -1
  267. package/cli/dist/components/SetupScreen.d.ts +0 -16
  268. package/cli/dist/components/SetupScreen.d.ts.map +0 -1
  269. package/cli/dist/components/SetupScreen.js +0 -67
  270. package/cli/dist/components/SetupScreen.js.map +0 -1
  271. package/cli/dist/components/SingleLoadingScreen.d.ts +0 -5
  272. package/cli/dist/components/SingleLoadingScreen.js +0 -27
  273. package/cli/dist/components/StatusBadge.d.ts +0 -10
  274. package/cli/dist/components/StatusBadge.d.ts.map +0 -1
  275. package/cli/dist/components/StatusBadge.js +0 -24
  276. package/cli/dist/components/StatusBadge.js.map +0 -1
  277. package/cli/dist/components/TerminalWindow.d.ts +0 -9
  278. package/cli/dist/components/TerminalWindow.d.ts.map +0 -1
  279. package/cli/dist/components/TerminalWindow.js +0 -19
  280. package/cli/dist/components/TerminalWindow.js.map +0 -1
  281. package/cli/dist/components/WelcomeScreen.d.ts +0 -12
  282. package/cli/dist/components/WelcomeScreen.d.ts.map +0 -1
  283. package/cli/dist/components/WelcomeScreen.js +0 -47
  284. package/cli/dist/components/WelcomeScreen.js.map +0 -1
  285. package/cli/dist/context/AppContext.d.ts +0 -68
  286. package/cli/dist/context/AppContext.js +0 -363
  287. package/cli/dist/headless-runner.d.ts +0 -17
  288. package/cli/dist/headless-runner.d.ts.map +0 -1
  289. package/cli/dist/headless-runner.js +0 -128
  290. package/cli/dist/headless-runner.js.map +0 -1
  291. package/cli/dist/hooks/useInitializeAgent.d.ts +0 -19
  292. package/cli/dist/hooks/useInitializeAgent.d.ts.map +0 -1
  293. package/cli/dist/hooks/useInitializeAgent.js +0 -29
  294. package/cli/dist/hooks/useInitializeAgent.js.map +0 -1
  295. package/cli/dist/hooks/useStableState.d.ts +0 -38
  296. package/cli/dist/hooks/useStableState.d.ts.map +0 -1
  297. package/cli/dist/hooks/useStableState.js +0 -69
  298. package/cli/dist/hooks/useStableState.js.map +0 -1
  299. package/cli/dist/managers/AgentManager.d.ts +0 -58
  300. package/cli/dist/managers/AgentManager.d.ts.map +0 -1
  301. package/cli/dist/managers/AgentManager.js +0 -121
  302. package/cli/dist/managers/AgentManager.js.map +0 -1
  303. package/cli/dist/managers/ConfigManager.d.ts +0 -54
  304. package/cli/dist/managers/ConfigManager.d.ts.map +0 -1
  305. package/cli/dist/managers/ConfigManager.js +0 -188
  306. package/cli/dist/managers/ConfigManager.js.map +0 -1
  307. package/cli/dist/types.d.ts +0 -52
  308. package/cli/dist/types.d.ts.map +0 -1
  309. package/cli/dist/types.js +0 -34
  310. package/cli/dist/types.js.map +0 -1
@@ -1,847 +1,146 @@
1
- import { ServerSigner, getAllHederaCorePlugins } from "hedera-agent-kit";
2
- import { Logger } from "@hashgraphonline/standards-sdk";
3
- import { createAgent } from "./index8.js";
4
- import { BrowserSigner } from "./index39.js";
5
- import { LangChainProvider } from "./index9.js";
6
- import { ChatOpenAI } from "@langchain/openai";
7
- import { ChatAnthropic } from "@langchain/anthropic";
8
- import { SystemMessage, HumanMessage, AIMessage } from "@langchain/core/messages";
9
- import { HCS10Plugin } from "./index2.js";
10
- import { HCS2Plugin } from "./index3.js";
11
- import { InscribePlugin } from "./index4.js";
12
- import { getWalletBridgeProvider } from "./index36.js";
13
- import { OpenConvaiState, InscriberBuilder, SignerProviderRegistry } from "@hashgraphonline/standards-agent-kit";
14
- import { HbarPlugin } from "./index5.js";
15
- import { WebBrowserPlugin } from "./index40.js";
16
- import { getSystemMessage } from "./index41.js";
17
- import { ContentStoreManager } from "./index24.js";
18
- import { SmartMemoryManager } from "./index18.js";
19
- import "./index19.js";
20
- import "./index20.js";
21
- import "./index21.js";
22
- import "crypto";
23
- import { createEntityTools } from "./index34.js";
24
- import { ParameterService } from "./index29.js";
25
- import { FormatConverterRegistry } from "./index25.js";
26
- import { TopicIdToHrlConverter } from "./index27.js";
27
- import { StringNormalizationConverter } from "./index28.js";
28
- const DEFAULT_MODEL_NAME = "gpt-4o";
29
- const DEFAULT_OPENAI_MODEL = "gpt-4o-mini";
30
- const DEFAULT_OPENROUTER_MODEL = "openai/gpt-4o-mini";
31
- const DEFAULT_CLAUDE_MODEL = "claude-3-7-sonnet-latest";
32
- const DEFAULT_TEMPERATURE = 0.1;
33
- const DEFAULT_NETWORK = "testnet";
34
- const DEFAULT_OPERATIONAL_MODE = "autonomous";
35
- const _ConversationalAgent = class _ConversationalAgent {
36
- constructor(options) {
37
- this.options = options;
38
- this.stateManager = options.stateManager || new OpenConvaiState();
39
- this.hcs10Plugin = new HCS10Plugin();
40
- this.hcs2Plugin = new HCS2Plugin();
41
- this.inscribePlugin = new InscribePlugin();
42
- this.hbarPlugin = new HbarPlugin();
43
- this.webBrowserPlugin = new WebBrowserPlugin();
44
- this.logger = new Logger({
45
- module: "ConversationalAgent",
46
- silent: options.disableLogging || false
47
- });
48
- if (this.options.entityMemoryEnabled !== false) {
49
- if (!options.openAIApiKey) {
50
- throw new Error(
51
- "OpenAI/Anthropic API key is required when entity memory is enabled"
52
- );
53
- }
54
- this.memoryManager = new SmartMemoryManager(
55
- this.options.entityMemoryConfig
56
- );
57
- this.logger.info("Entity memory initialized");
58
- const provider = options.entityMemoryProvider || options.llmProvider || "openai";
59
- let modelName = options.entityMemoryModelName;
60
- if (!modelName) {
61
- if (provider === "anthropic") {
62
- modelName = DEFAULT_CLAUDE_MODEL;
63
- } else if (provider === "openrouter") {
64
- modelName = DEFAULT_OPENROUTER_MODEL;
65
- } else {
66
- modelName = DEFAULT_OPENAI_MODEL;
67
- }
68
- }
69
- let resolverLLM;
70
- if (provider === "anthropic") {
71
- resolverLLM = new ChatAnthropic({
72
- apiKey: options.openAIApiKey,
73
- model: modelName,
74
- temperature: 0
75
- });
76
- } else if (provider === "openrouter") {
77
- const baseURL = options.openRouterBaseURL || "https://openrouter.ai/api/v1";
78
- const apiKey = options.openRouterApiKey || options.openAIApiKey;
79
- resolverLLM = new ChatOpenAI({
80
- apiKey,
81
- model: modelName,
82
- temperature: 0,
83
- configuration: {
84
- baseURL,
85
- defaultHeaders: {
86
- "HTTP-Referer": process.env.OPENROUTER_REFERRER || "https://hashgraphonline.com",
87
- "X-Title": process.env.OPENROUTER_TITLE || "Hashgraph Online Conversational Agent"
88
- }
89
- }
90
- });
91
- } else {
92
- resolverLLM = new ChatOpenAI({
93
- apiKey: options.openAIApiKey,
94
- model: modelName,
95
- temperature: 0
96
- });
97
- }
98
- this.entityTools = createEntityTools(resolverLLM);
99
- this.logger.info("LLM-based entity resolver tools initialized");
100
- }
101
- }
102
- /**
103
- * Initialize the conversational agent with Hedera Hashgraph connection and AI configuration
104
- * @throws {Error} If account ID or private key is missing
105
- * @throws {Error} If initialization fails
106
- */
107
- async initialize() {
108
- const {
109
- accountId,
110
- privateKey,
111
- network = DEFAULT_NETWORK,
112
- openAIApiKey,
113
- openAIModelName = DEFAULT_MODEL_NAME,
114
- llmProvider = "openai"
115
- } = this.options;
116
- this.validateOptions(accountId, privateKey);
117
- try {
118
- const opMode = this.options.operationalMode || DEFAULT_OPERATIONAL_MODE;
119
- const bytesMode = opMode !== "autonomous";
120
- let signer;
121
- try {
122
- const IB = InscriberBuilder;
123
- if (typeof IB.setPreferWalletOnly === "function") {
124
- IB.setPreferWalletOnly(false);
125
- }
126
- } catch (e) {
127
- this.logger.warn("Failed to set wallet-only preference", e);
128
- }
129
- if (!bytesMode) {
130
- signer = new ServerSigner(
131
- accountId,
132
- privateKey,
133
- network
134
- );
135
- } else {
136
- const chain = String(network || "testnet") === "mainnet" ? "mainnet" : "testnet";
137
- const effectiveAccount = this.options.userAccountId || accountId;
138
- signer = new BrowserSigner(
139
- effectiveAccount,
140
- chain,
141
- this.options.walletExecutor
142
- );
143
- }
144
- this.logger.info("Signer configured", {
145
- operationalMode: opMode,
146
- bytesMode,
147
- signerClass: Object.getPrototypeOf(signer)?.constructor?.name || "unknown"
148
- });
149
- try {
150
- const bridge = getWalletBridgeProvider();
151
- if (bridge) {
152
- const IB = InscriberBuilder;
153
- if (typeof IB.setWalletInfoResolver === "function") {
154
- IB.setWalletInfoResolver(async () => {
155
- const status = await bridge.status();
156
- if (status.connected && status.accountId && status.network) {
157
- return { accountId: status.accountId, network: status.network };
158
- }
159
- return null;
160
- });
161
- }
162
- if (typeof IB.setWalletExecutor === "function") {
163
- IB.setWalletExecutor(
164
- async (base64, network2) => {
165
- return await bridge.executeBytes(base64, network2);
166
- }
167
- );
168
- }
169
- if (typeof IB.setStartInscriptionDelegate === "function" && bridge.startInscription) {
170
- IB.setStartInscriptionDelegate(
171
- async (request, network2) => {
172
- return await bridge.startInscription(request, network2);
173
- }
174
- );
175
- }
176
- try {
177
- const status = await bridge.status();
178
- const enforceWallet = !!(bytesMode && status.connected);
179
- SignerProviderRegistry.setWalletInfoResolver(async () => {
180
- const s = await bridge.status();
181
- if (s.connected && s.accountId && s.network) {
182
- return {
183
- accountId: s.accountId,
184
- network: s.network
185
- };
186
- }
187
- return null;
188
- });
189
- SignerProviderRegistry.setWalletExecutor(
190
- async (base64, network2) => {
191
- return await bridge.executeBytes(base64, network2);
192
- }
193
- );
194
- const extended = bridge;
195
- if (typeof extended?.startHCS === "function") {
196
- SignerProviderRegistry.setStartHCSDelegate(
197
- async (op, request, network2) => {
198
- return await extended.startHCS(
199
- op,
200
- request,
201
- network2
202
- );
203
- }
204
- );
205
- } else {
206
- SignerProviderRegistry.setStartHCSDelegate(null);
207
- }
208
- SignerProviderRegistry.setPreferWalletOnly(enforceWallet);
209
- const IB2 = InscriberBuilder;
210
- if (typeof IB2.setPreferWalletOnly === "function") {
211
- IB2.setPreferWalletOnly(enforceWallet);
212
- }
213
- } catch (sakWireErr) {
214
- this.logger.warn(
215
- "Failed to wire SAK SignerProviderRegistry wallet delegates",
216
- sakWireErr
217
- );
218
- }
219
- }
220
- } catch (e) {
221
- this.logger.warn(
222
- "Failed to register wallet bridge providers",
223
- e
224
- );
225
- }
226
- let llm;
227
- let providerInfo = { provider: llmProvider };
228
- if (llmProvider === "anthropic") {
229
- llm = new ChatAnthropic({
230
- apiKey: openAIApiKey,
231
- model: openAIModelName || DEFAULT_CLAUDE_MODEL,
232
- temperature: DEFAULT_TEMPERATURE
233
- });
234
- providerInfo = {
235
- ...providerInfo,
236
- model: openAIModelName || DEFAULT_CLAUDE_MODEL,
237
- keyPresent: !!openAIApiKey
238
- };
239
- } else if (llmProvider === "openrouter") {
240
- const baseURL = this.options.openRouterBaseURL || "https://openrouter.ai/api/v1";
241
- const apiKey = this.options.openRouterApiKey || openAIApiKey;
242
- const modelName = openAIModelName || "anthropic/claude-3-haiku-20240307";
243
- llm = new ChatOpenAI({
244
- apiKey,
245
- model: modelName,
246
- temperature: DEFAULT_TEMPERATURE,
247
- configuration: {
248
- baseURL,
249
- defaultHeaders: {
250
- "HTTP-Referer": process.env.OPENROUTER_REFERRER || "https://hashgraphonline.com",
251
- "X-Title": process.env.OPENROUTER_TITLE || "Hashgraph Online Conversational Agent"
252
- }
253
- }
254
- });
255
- providerInfo = {
256
- ...providerInfo,
257
- model: modelName,
258
- baseURL,
259
- keyPresent: !!apiKey
260
- };
261
- } else {
262
- const modelName2 = openAIModelName || DEFAULT_OPENAI_MODEL;
263
- const isGPT5Model = modelName2.toLowerCase().includes("gpt-5") || modelName2.toLowerCase().includes("gpt5");
264
- llm = new ChatOpenAI({
265
- apiKey: openAIApiKey,
266
- model: modelName2,
267
- ...isGPT5Model ? { temperature: 1 } : { temperature: DEFAULT_TEMPERATURE }
268
- });
269
- providerInfo = {
270
- ...providerInfo,
271
- model: modelName2,
272
- keyPresent: !!openAIApiKey
273
- };
274
- }
275
- this.logger.info("AI provider configured", providerInfo);
276
- this.logger.info("Preparing plugins...");
277
- const allPlugins = this.preparePlugins();
278
- this.logger.info("Creating agent config...");
279
- const agentConfig = this.createAgentConfig(
280
- signer,
281
- llm,
282
- allPlugins
283
- );
284
- this.logger.info("Creating agent...");
285
- this.agent = createAgent(agentConfig);
286
- this.logger.info("Agent created");
287
- this.logger.info("Configuring HCS10 plugin...");
288
- this.configureHCS10Plugin(allPlugins);
289
- this.logger.info("HCS10 plugin configured");
290
- this.contentStoreManager = new ContentStoreManager();
291
- await this.contentStoreManager.initialize();
292
- this.logger.info(
293
- "ContentStoreManager initialized for content reference support"
294
- );
295
- this.logger.info("About to call agent.boot()");
296
- this.logger.info("🔥 About to call agent.boot()");
297
- await this.agent.boot();
298
- this.logger.info("agent.boot() completed");
299
- this.logger.info("🔥 agent.boot() completed");
300
- if (this.agent) {
301
- try {
302
- const registry = new FormatConverterRegistry();
303
- registry.register(new TopicIdToHrlConverter());
304
- registry.register(new StringNormalizationConverter());
305
- const paramService = new ParameterService(
306
- registry,
307
- this.options.network || "testnet"
308
- );
309
- paramService.attachToAgent(this.agent, {
310
- getEntities: async () => this.memoryManager?.getEntityAssociations() || []
311
- });
312
- this.logger.info(
313
- "Parameter preprocessing callback attached (internal)"
314
- );
315
- } catch (e) {
316
- this.logger.warn(
317
- "Failed to attach internal parameter preprocessing callback",
318
- e
319
- );
320
- }
321
- const cfg = agentConfig;
322
- cfg.filtering = cfg.filtering || {};
323
- const originalPredicate = cfg.filtering.toolPredicate;
324
- const userPredicate = this.options.toolFilter;
325
- cfg.filtering.toolPredicate = (tool) => {
326
- if (tool && tool.name === "hedera-account-transfer-hbar") {
327
- return false;
328
- }
329
- if (tool && tool.name === "hedera-hts-airdrop-token") {
330
- return false;
331
- }
332
- if (originalPredicate && !originalPredicate(tool)) {
333
- return false;
334
- }
335
- if (userPredicate && !userPredicate(tool)) {
336
- return false;
337
- }
338
- return true;
339
- };
340
- }
341
- if (this.options.mcpServers && this.options.mcpServers.length > 0) {
342
- this.connectMCP();
343
- }
344
- } catch (error) {
345
- this.logger.error("Failed to initialize ConversationalAgent:", error);
346
- throw error;
347
- }
348
- }
349
- /**
350
- * Get the HCS-10 plugin instance
351
- * @returns {HCS10Plugin} The HCS-10 plugin instance
352
- */
353
- getPlugin() {
354
- return this.hcs10Plugin;
355
- }
356
- /**
357
- * Get the state manager instance
358
- * @returns {IStateManager} The state manager instance
359
- */
360
- getStateManager() {
361
- return this.stateManager;
362
- }
363
- /**
364
- * Get the underlying agent instance
365
- * @returns {ReturnType<typeof createAgent>} The agent instance
366
- * @throws {Error} If agent is not initialized
367
- */
368
- getAgent() {
369
- if (!this.agent) {
370
- throw new Error(_ConversationalAgent.NOT_INITIALIZED_ERROR);
371
- }
372
- return this.agent;
373
- }
374
- /**
375
- * Get the conversational agent instance (alias for getAgent)
376
- * @returns {ReturnType<typeof createAgent>} The agent instance
377
- * @throws {Error} If agent is not initialized
378
- */
379
- getConversationalAgent() {
380
- return this.getAgent();
381
- }
382
- /**
383
- * Process a message through the conversational agent
384
- * @param {string} message - The message to process
385
- * @param {Array<{type: 'human' | 'ai'; content: string}>} chatHistory - Previous chat history
386
- * @returns {Promise<ChatResponse>} The agent's response
387
- * @throws {Error} If agent is not initialized
388
- */
389
- async processMessage(message, chatHistory = []) {
390
- if (!this.agent) {
391
- throw new Error("Agent not initialized. Call initialize() first.");
392
- }
393
- try {
394
- const resolvedMessage = message;
395
- const messages = chatHistory.map((msg) => {
396
- const content = msg.content;
397
- if (msg.type === "system") {
398
- return new SystemMessage(content);
399
- }
400
- return msg.type === "human" ? new HumanMessage(content) : new AIMessage(content);
401
- });
402
- const context = { messages };
403
- const response = await this.agent.chat(resolvedMessage, context);
404
- if (this.memoryManager && this.options.operationalMode !== "returnBytes") {
405
- await this.extractAndStoreEntities(response, message);
406
- }
407
- this.logger.info("Message processed successfully");
408
- return response;
409
- } catch (error) {
410
- this.logger.error("Error processing message:", error);
411
- throw error;
412
- }
413
- }
414
- /**
415
- * Process form submission through the conversational agent
416
- * @param {FormSubmission} submission - The form submission data
417
- * @returns {Promise<ChatResponse>} The agent's response after processing the form
418
- * @throws {Error} If agent is not initialized or doesn't support form processing
419
- */
420
- async processFormSubmission(submission) {
421
- if (!this.agent) {
422
- throw new Error(_ConversationalAgent.NOT_INITIALIZED_ERROR);
423
- }
424
- try {
425
- this.logger.info("Processing form submission:", {
426
- formId: submission.formId,
427
- toolName: submission.toolName,
428
- parameterKeys: Object.keys(submission.parameters || {}),
429
- hasContext: !!submission.context
430
- });
431
- const response = await this.agent.processFormSubmission(submission);
432
- this.logger.info("Form submission processed successfully");
433
- return response;
434
- } catch (error) {
435
- this.logger.error("Error processing form submission:", error);
436
- throw error;
437
- }
438
- }
439
- /**
440
- * Validates initialization options and throws if required fields are missing.
441
- *
442
- * @param accountId - The Hedera account ID
443
- * @param privateKey - The private key for the account
444
- * @throws {Error} If required fields are missing
445
- */
446
- validateOptions(accountId, privateKey) {
447
- const opMode = this.options.operationalMode || DEFAULT_OPERATIONAL_MODE;
448
- const bytesMode = opMode !== "autonomous";
449
- if (!accountId) {
450
- throw new Error("Account ID is required");
451
- }
452
- if (!privateKey && !bytesMode) {
453
- throw new Error("Private key is required in autonomous mode");
454
- }
455
- if (typeof accountId !== "string") {
456
- throw new Error(
457
- `Account ID must be a string, received ${typeof accountId}`
1
+ import { BasePlugin } from "hedera-agent-kit";
2
+ import { Bee } from "@ethersphere/bee-js";
3
+ import { ListPostageStampsTool } from "./index48.js";
4
+ import { UploadDataTool } from "./index49.js";
5
+ import { DownloadDataTool } from "./index50.js";
6
+ import { CreatePostageStampTool } from "./index51.js";
7
+ import { ExtendPostageStampTool } from "./index52.js";
8
+ import { QueryUploadProgressTool } from "./index53.js";
9
+ import { DownloadFilesTool } from "./index54.js";
10
+ import { GetPostageStampTool } from "./index55.js";
11
+ import { ReadFeedTool } from "./index56.js";
12
+ import { UpdateFeedTool } from "./index57.js";
13
+ import { UploadFileTool } from "./index58.js";
14
+ import { UploadFolderTool } from "./index59.js";
15
+ class SwarmPlugin extends BasePlugin {
16
+ constructor(config) {
17
+ super();
18
+ this.id = "swarm";
19
+ this.name = "Swarm Plugin";
20
+ this.description = "Swarm operations: tools for interacting with the Swarm decentralized storage.";
21
+ this.version = "1.0.0";
22
+ this.author = "Solar Punk";
23
+ this.namespace = "swarm";
24
+ this.tools = [];
25
+ this.config = config || null;
26
+ }
27
+ async initialize(context) {
28
+ await super.initialize(context);
29
+ const hederaKit = context.config.hederaKit;
30
+ if (!hederaKit) {
31
+ this.context.logger.warn(
32
+ "SwarmPlugin skipped because HederaAgentKit was not present in plugin context."
458
33
  );
34
+ this.tools = [];
35
+ return;
459
36
  }
460
- if (!bytesMode && typeof privateKey !== "string") {
461
- throw new Error(
462
- `Private key must be a string, received ${typeof privateKey}: ${JSON.stringify(
463
- privateKey
464
- )}`
37
+ if (!this.config) {
38
+ this.context.logger.warn(
39
+ "SwarmPlugin skipped because Swarm config was not present."
465
40
  );
41
+ this.tools = [];
42
+ return;
466
43
  }
467
- if (!bytesMode && typeof privateKey === "string" && privateKey.length < 10) {
468
- throw new Error("Private key appears to be invalid (too short)");
469
- }
470
- }
471
- /**
472
- * Prepares the list of plugins to use based on configuration.
473
- *
474
- * @returns Array of plugins to initialize with the agent
475
- */
476
- preparePlugins() {
477
- const { additionalPlugins = [], enabledPlugins, disabledPlugins } = this.options;
478
- const standardPlugins = [
479
- this.hcs10Plugin,
480
- this.hcs2Plugin,
481
- this.inscribePlugin,
482
- this.hbarPlugin
483
- ];
484
- standardPlugins.push(this.webBrowserPlugin);
485
- const corePlugins = getAllHederaCorePlugins();
486
- let pluginPool = [...standardPlugins, ...corePlugins];
487
- if (enabledPlugins) {
488
- const enabledSet = new Set(enabledPlugins);
489
- pluginPool = pluginPool.filter((plugin) => enabledSet.has(plugin.id));
490
- }
491
- if (disabledPlugins && disabledPlugins.length > 0) {
492
- const disabledSet = new Set(disabledPlugins);
493
- pluginPool = pluginPool.filter((plugin) => !disabledSet.has(plugin.id));
494
- }
495
- const additional = disabledPlugins && disabledPlugins.length > 0 ? additionalPlugins.filter((plugin) => !disabledPlugins.includes(plugin.id)) : additionalPlugins;
496
- return [...pluginPool, ...additional];
497
- }
498
- /**
499
- * Creates the agent configuration object.
500
- *
501
- * @param signer - The signer instance
502
- * @param llm - The language model instance
503
- * @param allPlugins - Array of plugins to use
504
- * @returns Configuration object for creating the agent
505
- */
506
- createAgentConfig(signer, llm, allPlugins) {
507
- const {
508
- operationalMode = DEFAULT_OPERATIONAL_MODE,
509
- userAccountId,
510
- scheduleUserTransactionsInBytesMode,
511
- customSystemMessagePreamble,
512
- customSystemMessagePostamble,
513
- verbose = false,
514
- mirrorNodeConfig,
515
- disableLogging,
516
- accountId = ""
517
- } = this.options;
518
- return {
519
- framework: "langchain",
520
- signer,
521
- execution: {
522
- mode: operationalMode === "autonomous" ? "direct" : "bytes",
523
- operationalMode,
524
- ...userAccountId && { userAccountId },
525
- ...scheduleUserTransactionsInBytesMode !== void 0 && {
526
- scheduleUserTransactionsInBytesMode,
527
- scheduleUserTransactions: scheduleUserTransactionsInBytesMode
528
- }
529
- },
530
- ai: {
531
- provider: new LangChainProvider(llm),
532
- temperature: DEFAULT_TEMPERATURE
533
- },
534
- filtering: {
535
- toolPredicate: (tool) => {
536
- if (tool.name === "hedera-account-transfer-hbar") return false;
537
- if (this.options.toolFilter && !this.options.toolFilter(tool)) {
538
- return false;
539
- }
540
- return true;
541
- }
542
- },
543
- messaging: {
544
- systemPreamble: customSystemMessagePreamble || getSystemMessage(accountId),
545
- ...customSystemMessagePostamble && {
546
- systemPostamble: customSystemMessagePostamble
547
- },
548
- conciseMode: true
549
- },
550
- extensions: {
551
- plugins: allPlugins,
552
- ...mirrorNodeConfig && {
553
- mirrorConfig: mirrorNodeConfig
554
- }
555
- },
556
- ...this.options.mcpServers && {
557
- mcp: {
558
- servers: this.options.mcpServers,
559
- autoConnect: false
560
- }
561
- },
562
- debug: {
563
- verbose,
564
- silent: disableLogging ?? false
565
- }
566
- };
567
- }
568
- /**
569
- * Configures the HCS-10 plugin with the state manager.
570
- *
571
- * @param allPlugins - Array of all plugins
572
- */
573
- configureHCS10Plugin(allPlugins) {
574
- const hcs10 = allPlugins.find((p) => p.id === "hcs-10");
575
- if (hcs10) {
576
- hcs10.appConfig = {
577
- stateManager: this.stateManager
578
- };
579
- }
580
- }
581
- /**
582
- * Create a ConversationalAgent with specific plugins enabled
583
- */
584
- static withPlugins(options, plugins) {
585
- return new _ConversationalAgent({
586
- ...options,
587
- enabledPlugins: plugins
44
+ const beeURL = this.config.beeApiUrl;
45
+ const bee = new Bee(beeURL);
46
+ const createPostageStampTool = new CreatePostageStampTool({
47
+ hederaKit,
48
+ bee,
49
+ config: this.config,
50
+ logger: this.context.logger
588
51
  });
589
- }
590
- /**
591
- * Create a ConversationalAgent with only HTS (Hedera Token Service) tools enabled
592
- */
593
- static withHTS(options) {
594
- return this.withPlugins(options, ["hts-token"]);
595
- }
596
- /**
597
- * Create a ConversationalAgent with only HCS-2 tools enabled
598
- */
599
- static withHCS2(options) {
600
- return this.withPlugins(options, ["hcs-2"]);
601
- }
602
- /**
603
- * Create a ConversationalAgent with only HCS-10 tools enabled
604
- */
605
- static withHCS10(options) {
606
- return this.withPlugins(options, ["hcs-10"]);
607
- }
608
- /**
609
- * Create a ConversationalAgent with only inscription tools enabled
610
- */
611
- static withInscribe(options) {
612
- return this.withPlugins(options, ["inscribe"]);
613
- }
614
- /**
615
- * Create a ConversationalAgent with only account management tools enabled
616
- */
617
- static withAccount(options) {
618
- return this.withPlugins(options, ["account"]);
619
- }
620
- /**
621
- * Create a ConversationalAgent with only file service tools enabled
622
- */
623
- static withFileService(options) {
624
- return this.withPlugins(options, ["file-service"]);
625
- }
626
- /**
627
- * Create a ConversationalAgent with only consensus service tools enabled
628
- */
629
- static withConsensusService(options) {
630
- return this.withPlugins(options, ["consensus-service"]);
631
- }
632
- /**
633
- * Create a ConversationalAgent with only smart contract tools enabled
634
- */
635
- static withSmartContract(options) {
636
- return this.withPlugins(options, ["smart-contract"]);
637
- }
638
- /**
639
- * Create a ConversationalAgent with all HCS standards plugins
640
- */
641
- static withAllStandards(options) {
642
- return this.withPlugins(options, ["hcs-10", "hcs-2", "inscribe"]);
643
- }
644
- /**
645
- * Create a ConversationalAgent with minimal Hedera tools (no HCS standards)
646
- */
647
- static minimal(options) {
648
- return this.withPlugins(options, []);
649
- }
650
- /**
651
- * Create a ConversationalAgent with MCP servers configured
652
- */
653
- static withMCP(options, mcpServers) {
654
- return new _ConversationalAgent({
655
- ...options,
656
- mcpServers
52
+ const downloadDataTool = new DownloadDataTool({
53
+ hederaKit,
54
+ bee,
55
+ config: this.config,
56
+ logger: this.context.logger
657
57
  });
658
- }
659
- /**
660
- * Extract and store entities from agent responses
661
- * @param response - Agent response containing potential entity information
662
- * @param originalMessage - Original user message for context
663
- */
664
- async extractAndStoreEntities(response, originalMessage) {
665
- if (!this.memoryManager || !this.entityTools) {
666
- return;
667
- }
668
- try {
669
- this.logger.info("Starting LLM-based entity extraction");
670
- const responseText = this.extractResponseText(response);
671
- const entitiesJson = await this.entityTools.extractEntities.call({
672
- response: responseText,
673
- userMessage: originalMessage
674
- });
675
- try {
676
- const entities = JSON.parse(entitiesJson);
677
- for (const entity of entities) {
678
- if (entity && typeof entity === "object" && "name" in entity && "type" in entity && "id" in entity) {
679
- this.logger.info(
680
- `Storing entity: ${entity.name} (${entity.type}) -> ${entity.id}`
681
- );
682
- const transactionId = this.extractTransactionId(response);
683
- const idStr = String(entity.id);
684
- const isHederaId = /^0\.0\.[0-9]+$/.test(idStr);
685
- if (!isHederaId) {
686
- this.logger.warn("Skipping non-ID entity from extraction", {
687
- id: idStr,
688
- name: String(entity.name),
689
- type: String(entity.type)
690
- });
691
- } else {
692
- this.memoryManager.storeEntityAssociation(
693
- idStr,
694
- String(entity.name),
695
- String(entity.type),
696
- transactionId
697
- );
698
- }
699
- }
700
- }
701
- if (entities.length > 0) {
702
- this.logger.info(
703
- `Stored ${entities.length} entities via LLM extraction`
704
- );
705
- } else {
706
- this.logger.info("No entities found in response via LLM extraction");
707
- }
708
- } catch (parseError) {
709
- this.logger.error(
710
- "Failed to parse extracted entities JSON:",
711
- parseError
712
- );
713
- throw parseError;
714
- }
715
- } catch (error) {
716
- this.logger.error("Entity extraction failed:", error);
717
- throw error;
718
- }
719
- }
720
- /**
721
- * Extract transaction ID from response if available
722
- * @param response - Transaction response
723
- * @returns Transaction ID or undefined
724
- */
725
- extractTransactionId(response) {
726
- try {
727
- if (typeof response === "object" && response && "transactionId" in response) {
728
- const responseWithTxId = response;
729
- return typeof responseWithTxId.transactionId === "string" ? responseWithTxId.transactionId : void 0;
730
- }
731
- if (typeof response === "string") {
732
- const match = response.match(
733
- /transaction[\s\w]*ID[\s:"]*([0-9a-fA-F@._-]+)/i
734
- );
735
- return match ? match[1] : void 0;
736
- }
737
- return void 0;
738
- } catch {
739
- return void 0;
740
- }
741
- }
742
- /**
743
- * Connect to MCP servers asynchronously
744
- * @private
745
- */
746
- connectMCP() {
747
- if (!this.agent || !this.options.mcpServers) {
748
- return;
749
- }
750
- this.agent.connectMCPServers().catch((e) => {
751
- this.logger.error("Failed to connect MCP servers:", e);
752
- }).then(() => {
753
- this.logger.info("MCP servers connected successfully");
58
+ const downloadFilesTool = new DownloadFilesTool({
59
+ hederaKit,
60
+ bee,
61
+ config: this.config,
62
+ logger: this.context.logger
754
63
  });
64
+ const extendPostageStampTool = new ExtendPostageStampTool({
65
+ hederaKit,
66
+ bee,
67
+ config: this.config,
68
+ logger: this.context.logger
69
+ });
70
+ const getPostageStampsTool = new GetPostageStampTool({
71
+ hederaKit,
72
+ bee,
73
+ config: this.config,
74
+ logger: this.context.logger
75
+ });
76
+ const listPostageStampsTool = new ListPostageStampsTool({
77
+ hederaKit,
78
+ bee,
79
+ config: this.config,
80
+ logger: this.context.logger
81
+ });
82
+ const queryUploadProgressTool = new QueryUploadProgressTool({
83
+ hederaKit,
84
+ bee,
85
+ config: this.config,
86
+ logger: this.context.logger
87
+ });
88
+ const readFeedTool = new ReadFeedTool({
89
+ hederaKit,
90
+ bee,
91
+ config: this.config,
92
+ logger: this.context.logger
93
+ });
94
+ const updateFeedTool = new UpdateFeedTool({
95
+ hederaKit,
96
+ bee,
97
+ config: this.config,
98
+ logger: this.context.logger
99
+ });
100
+ const uploadDataTool = new UploadDataTool({
101
+ hederaKit,
102
+ bee,
103
+ config: this.config,
104
+ logger: this.context.logger
105
+ });
106
+ const uploadFileTool = new UploadFileTool({
107
+ hederaKit,
108
+ bee,
109
+ config: this.config,
110
+ logger: this.context.logger
111
+ });
112
+ const uploadFolderTool = new UploadFolderTool({
113
+ hederaKit,
114
+ bee,
115
+ config: this.config,
116
+ logger: this.context.logger
117
+ });
118
+ this.tools = [
119
+ createPostageStampTool,
120
+ downloadDataTool,
121
+ downloadFilesTool,
122
+ extendPostageStampTool,
123
+ getPostageStampsTool,
124
+ listPostageStampsTool,
125
+ queryUploadProgressTool,
126
+ readFeedTool,
127
+ updateFeedTool,
128
+ uploadDataTool,
129
+ uploadFileTool,
130
+ uploadFolderTool
131
+ ];
132
+ this.context.logger.info(
133
+ "Swarm Plugin initialized."
134
+ );
755
135
  }
756
- /**
757
- * Get MCP connection status for all servers
758
- * @returns {Map<string, MCPConnectionStatus>} Connection status map
759
- */
760
- getMCPConnectionStatus() {
761
- if (this.agent) {
762
- return this.agent.getMCPConnectionStatus();
763
- }
764
- return /* @__PURE__ */ new Map();
765
- }
766
- /**
767
- * Check if a specific MCP server is connected
768
- * @param {string} serverName - Name of the server to check
769
- * @returns {boolean} True if connected, false otherwise
770
- */
771
- isMCPServerConnected(serverName) {
772
- if (this.agent) {
773
- const statusMap = this.agent.getMCPConnectionStatus();
774
- const status = statusMap.get(serverName);
775
- return status?.connected ?? false;
776
- }
777
- return false;
136
+ getTools() {
137
+ return this.tools;
778
138
  }
779
- /**
780
- * Clean up resources
781
- */
782
139
  async cleanup() {
783
- try {
784
- this.logger.info("Cleaning up ConversationalAgent...");
785
- if (this.memoryManager) {
786
- try {
787
- this.memoryManager.dispose();
788
- this.logger.info("Memory manager cleaned up successfully");
789
- } catch (error) {
790
- this.logger.warn("Error cleaning up memory manager:", error);
791
- }
792
- this.memoryManager = void 0;
793
- }
794
- if (this.contentStoreManager) {
795
- await this.contentStoreManager.dispose();
796
- this.logger.info("ContentStoreManager cleaned up");
797
- }
798
- this.logger.info("ConversationalAgent cleanup completed");
799
- } catch (error) {
800
- this.logger.error("Error during cleanup:", error);
801
- }
140
+ this.tools = [];
802
141
  }
803
- /**
804
- * Switch operational mode
805
- */
806
- switchMode(mode) {
807
- if (this.agent?.switchMode) {
808
- this.agent.switchMode(mode || "autonomous");
809
- }
810
- }
811
- /**
812
- * Get usage statistics
813
- */
814
- getUsageStats() {
815
- return this.agent?.getUsageStats?.() ?? {};
816
- }
817
- /**
818
- * Clear usage statistics
819
- */
820
- clearUsageStats() {
821
- if (this.agent?.clearUsageStats) {
822
- this.agent.clearUsageStats();
823
- }
824
- }
825
- /**
826
- * Shutdown the agent
827
- */
828
- shutdown() {
829
- return this.agent?.shutdown?.() ?? Promise.resolve();
830
- }
831
- extractResponseText(response) {
832
- if (typeof response === "string") {
833
- return response;
834
- }
835
- if (response && typeof response === "object" && "output" in response) {
836
- const responseWithOutput = response;
837
- return String(responseWithOutput.output);
838
- }
839
- return JSON.stringify(response);
840
- }
841
- };
842
- _ConversationalAgent.NOT_INITIALIZED_ERROR = "Agent not initialized. Call initialize() first.";
843
- let ConversationalAgent = _ConversationalAgent;
142
+ }
844
143
  export {
845
- ConversationalAgent
144
+ SwarmPlugin
846
145
  };
847
146
  //# sourceMappingURL=index6.js.map