@hashgraphonline/standards-agent-kit 0.0.37 → 0.2.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 (251) hide show
  1. package/dist/cjs/builders/hcs10/hcs10-builder.d.ts +262 -0
  2. package/dist/cjs/builders/index.d.ts +2 -0
  3. package/dist/cjs/builders/types.d.ts +10 -0
  4. package/dist/cjs/index.d.ts +3 -1
  5. package/dist/cjs/init/init.d.ts +21 -22
  6. package/dist/cjs/plugins/PluginInterface.d.ts +4 -80
  7. package/dist/cjs/plugins/PluginRegistry.d.ts +1 -47
  8. package/dist/cjs/plugins/defi/index.d.ts +7 -4
  9. package/dist/cjs/plugins/hedera/HbarPricePlugin.d.ts +7 -35
  10. package/dist/cjs/plugins/index.d.ts +0 -5
  11. package/dist/cjs/plugins/weather/index.d.ts +6 -5
  12. package/dist/cjs/standards-agent-kit.cjs +1 -1
  13. package/dist/cjs/standards-agent-kit.cjs.map +1 -1
  14. package/dist/cjs/state/state-types.d.ts +8 -8
  15. package/dist/cjs/tools/hcs10/AcceptConnectionRequestTool.d.ts +40 -0
  16. package/dist/cjs/tools/hcs10/CheckMessagesTool.d.ts +40 -0
  17. package/dist/cjs/tools/hcs10/ConnectionMonitorTool.d.ts +134 -0
  18. package/dist/cjs/tools/hcs10/FindRegistrationsTool.d.ts +34 -0
  19. package/dist/cjs/tools/hcs10/InitiateConnectionTool.d.ts +43 -0
  20. package/dist/cjs/tools/hcs10/ListConnectionsTool.d.ts +34 -0
  21. package/dist/cjs/tools/hcs10/ListUnapprovedConnectionRequestsTool.d.ts +15 -0
  22. package/dist/cjs/tools/hcs10/ManageConnectionRequestsTool.d.ts +34 -0
  23. package/dist/cjs/tools/hcs10/RegisterAgentTool.d.ts +218 -0
  24. package/dist/cjs/tools/hcs10/RetrieveProfileTool.d.ts +33 -0
  25. package/dist/cjs/tools/hcs10/SendMessageToConnectionTool.d.ts +40 -0
  26. package/dist/cjs/tools/hcs10/base-hcs10-tools.d.ts +28 -0
  27. package/dist/cjs/tools/hcs10/hcs10-tool-params.d.ts +18 -0
  28. package/dist/cjs/tools/hcs10/index.d.ts +13 -0
  29. package/dist/cjs/tools/index.d.ts +1 -13
  30. package/dist/es/builders/hcs10/hcs10-builder.d.ts +262 -0
  31. package/dist/es/builders/index.d.ts +2 -0
  32. package/dist/es/builders/types.d.ts +10 -0
  33. package/dist/es/index.d.ts +3 -1
  34. package/dist/es/init/init.d.ts +21 -22
  35. package/dist/es/plugins/PluginInterface.d.ts +4 -80
  36. package/dist/es/plugins/PluginRegistry.d.ts +1 -47
  37. package/dist/es/plugins/defi/index.d.ts +7 -4
  38. package/dist/es/plugins/hedera/HbarPricePlugin.d.ts +7 -35
  39. package/dist/es/plugins/index.d.ts +0 -5
  40. package/dist/es/plugins/weather/index.d.ts +6 -5
  41. package/dist/es/standards-agent-kit.es.js +10 -18
  42. package/dist/es/standards-agent-kit.es.js.map +1 -1
  43. package/dist/es/standards-agent-kit.es10.js +29 -76
  44. package/dist/es/standards-agent-kit.es10.js.map +1 -1
  45. package/dist/es/standards-agent-kit.es11.js +61 -384
  46. package/dist/es/standards-agent-kit.es11.js.map +1 -1
  47. package/dist/es/standards-agent-kit.es12.js +22 -190
  48. package/dist/es/standards-agent-kit.es12.js.map +1 -1
  49. package/dist/es/standards-agent-kit.es13.js +26 -138
  50. package/dist/es/standards-agent-kit.es13.js.map +1 -1
  51. package/dist/es/standards-agent-kit.es14.js +35 -59
  52. package/dist/es/standards-agent-kit.es14.js.map +1 -1
  53. package/dist/es/standards-agent-kit.es15.js +11 -117
  54. package/dist/es/standards-agent-kit.es15.js.map +1 -1
  55. package/dist/es/standards-agent-kit.es16.js +1 -1
  56. package/dist/es/standards-agent-kit.es16.js.map +1 -1
  57. package/dist/es/standards-agent-kit.es17.js +63 -46
  58. package/dist/es/standards-agent-kit.es17.js.map +1 -1
  59. package/dist/es/standards-agent-kit.es18.js +25 -74
  60. package/dist/es/standards-agent-kit.es18.js.map +1 -1
  61. package/dist/es/standards-agent-kit.es19.js +22 -13
  62. package/dist/es/standards-agent-kit.es19.js.map +1 -1
  63. package/dist/es/standards-agent-kit.es2.js +1381 -188
  64. package/dist/es/standards-agent-kit.es2.js.map +1 -1
  65. package/dist/es/standards-agent-kit.es20.js +3 -67
  66. package/dist/es/standards-agent-kit.es20.js.map +1 -1
  67. package/dist/es/standards-agent-kit.es3.js +285 -347
  68. package/dist/es/standards-agent-kit.es3.js.map +1 -1
  69. package/dist/es/standards-agent-kit.es4.js +22 -74
  70. package/dist/es/standards-agent-kit.es4.js.map +1 -1
  71. package/dist/es/standards-agent-kit.es5.js +127 -154
  72. package/dist/es/standards-agent-kit.es5.js.map +1 -1
  73. package/dist/es/standards-agent-kit.es6.js +21 -88
  74. package/dist/es/standards-agent-kit.es6.js.map +1 -1
  75. package/dist/es/standards-agent-kit.es7.js +28 -86
  76. package/dist/es/standards-agent-kit.es7.js.map +1 -1
  77. package/dist/es/standards-agent-kit.es8.js +27 -100
  78. package/dist/es/standards-agent-kit.es8.js.map +1 -1
  79. package/dist/es/standards-agent-kit.es9.js +35 -117
  80. package/dist/es/standards-agent-kit.es9.js.map +1 -1
  81. package/dist/es/state/state-types.d.ts +8 -8
  82. package/dist/es/tools/hcs10/AcceptConnectionRequestTool.d.ts +40 -0
  83. package/dist/es/tools/hcs10/CheckMessagesTool.d.ts +40 -0
  84. package/dist/es/tools/hcs10/ConnectionMonitorTool.d.ts +134 -0
  85. package/dist/es/tools/hcs10/FindRegistrationsTool.d.ts +34 -0
  86. package/dist/es/tools/hcs10/InitiateConnectionTool.d.ts +43 -0
  87. package/dist/es/tools/hcs10/ListConnectionsTool.d.ts +34 -0
  88. package/dist/es/tools/hcs10/ListUnapprovedConnectionRequestsTool.d.ts +15 -0
  89. package/dist/es/tools/hcs10/ManageConnectionRequestsTool.d.ts +34 -0
  90. package/dist/es/tools/hcs10/RegisterAgentTool.d.ts +218 -0
  91. package/dist/es/tools/hcs10/RetrieveProfileTool.d.ts +33 -0
  92. package/dist/es/tools/hcs10/SendMessageToConnectionTool.d.ts +40 -0
  93. package/dist/es/tools/hcs10/base-hcs10-tools.d.ts +28 -0
  94. package/dist/es/tools/hcs10/hcs10-tool-params.d.ts +18 -0
  95. package/dist/es/tools/hcs10/index.d.ts +13 -0
  96. package/dist/es/tools/index.d.ts +1 -13
  97. package/dist/umd/builders/hcs10/hcs10-builder.d.ts +262 -0
  98. package/dist/umd/builders/index.d.ts +2 -0
  99. package/dist/umd/builders/types.d.ts +10 -0
  100. package/dist/umd/index.d.ts +3 -1
  101. package/dist/umd/init/init.d.ts +21 -22
  102. package/dist/umd/plugins/PluginInterface.d.ts +4 -80
  103. package/dist/umd/plugins/PluginRegistry.d.ts +1 -47
  104. package/dist/umd/plugins/defi/index.d.ts +7 -4
  105. package/dist/umd/plugins/hedera/HbarPricePlugin.d.ts +7 -35
  106. package/dist/umd/plugins/index.d.ts +0 -5
  107. package/dist/umd/plugins/weather/index.d.ts +6 -5
  108. package/dist/umd/standards-agent-kit.umd.js +1 -164
  109. package/dist/umd/standards-agent-kit.umd.js.map +1 -1
  110. package/dist/umd/state/state-types.d.ts +8 -8
  111. package/dist/umd/tools/hcs10/AcceptConnectionRequestTool.d.ts +40 -0
  112. package/dist/umd/tools/hcs10/CheckMessagesTool.d.ts +40 -0
  113. package/dist/umd/tools/hcs10/ConnectionMonitorTool.d.ts +134 -0
  114. package/dist/umd/tools/hcs10/FindRegistrationsTool.d.ts +34 -0
  115. package/dist/umd/tools/hcs10/InitiateConnectionTool.d.ts +43 -0
  116. package/dist/umd/tools/hcs10/ListConnectionsTool.d.ts +34 -0
  117. package/dist/umd/tools/hcs10/ListUnapprovedConnectionRequestsTool.d.ts +15 -0
  118. package/dist/umd/tools/hcs10/ManageConnectionRequestsTool.d.ts +34 -0
  119. package/dist/umd/tools/hcs10/RegisterAgentTool.d.ts +218 -0
  120. package/dist/umd/tools/hcs10/RetrieveProfileTool.d.ts +33 -0
  121. package/dist/umd/tools/hcs10/SendMessageToConnectionTool.d.ts +40 -0
  122. package/dist/umd/tools/hcs10/base-hcs10-tools.d.ts +28 -0
  123. package/dist/umd/tools/hcs10/hcs10-tool-params.d.ts +18 -0
  124. package/dist/umd/tools/hcs10/index.d.ts +13 -0
  125. package/dist/umd/tools/index.d.ts +1 -13
  126. package/package.json +41 -41
  127. package/src/builders/hcs10/hcs10-builder.ts +2108 -0
  128. package/src/builders/index.ts +2 -0
  129. package/src/builders/types.ts +11 -0
  130. package/src/hcs10/HCS10Client.ts +3 -2
  131. package/src/index.ts +4 -2
  132. package/src/init/init.ts +85 -63
  133. package/src/plugins/PluginInterface.ts +15 -94
  134. package/src/plugins/PluginRegistry.ts +2 -98
  135. package/src/plugins/defi/index.ts +31 -118
  136. package/src/plugins/hedera/HbarPricePlugin.ts +19 -100
  137. package/src/plugins/index.ts +0 -5
  138. package/src/plugins/weather/index.ts +56 -40
  139. package/src/state/state-types.ts +9 -11
  140. package/src/tools/hcs10/AcceptConnectionRequestTool.ts +56 -0
  141. package/src/tools/hcs10/CheckMessagesTool.ts +73 -0
  142. package/src/tools/hcs10/ConnectionMonitorTool.ts +111 -0
  143. package/src/tools/hcs10/FindRegistrationsTool.ts +64 -0
  144. package/src/tools/hcs10/InitiateConnectionTool.ts +66 -0
  145. package/src/tools/hcs10/ListConnectionsTool.ts +58 -0
  146. package/src/tools/hcs10/ListUnapprovedConnectionRequestsTool.ts +26 -0
  147. package/src/tools/hcs10/ManageConnectionRequestsTool.ts +48 -0
  148. package/src/tools/hcs10/RegisterAgentTool.ts +213 -0
  149. package/src/tools/hcs10/RetrieveProfileTool.ts +61 -0
  150. package/src/tools/hcs10/SendMessageToConnectionTool.ts +45 -0
  151. package/src/tools/hcs10/base-hcs10-tools.ts +65 -0
  152. package/src/tools/hcs10/hcs10-tool-params.ts +21 -0
  153. package/src/tools/hcs10/index.ts +13 -0
  154. package/src/tools/index.ts +2 -13
  155. package/src/utils/HederaClient.ts +2 -2
  156. package/src/utils/ensure-agent-has-hbar.ts +3 -4
  157. package/dist/cjs/agents/index.d.ts +0 -0
  158. package/dist/cjs/plugins/BasePlugin.d.ts +0 -28
  159. package/dist/cjs/plugins/GenericPlugin.d.ts +0 -17
  160. package/dist/cjs/plugins/HCS10Plugin.d.ts +0 -13
  161. package/dist/cjs/plugins/PluginLoader.d.ts +0 -38
  162. package/dist/cjs/plugins/openconvai/OpenConvAIPlugin.d.ts +0 -23
  163. package/dist/cjs/plugins/openconvai/index.d.ts +0 -1
  164. package/dist/cjs/tools/AcceptConnectionRequestTool.d.ts +0 -33
  165. package/dist/cjs/tools/CheckMessagesTool.d.ts +0 -34
  166. package/dist/cjs/tools/ConnectionMonitorTool.d.ts +0 -100
  167. package/dist/cjs/tools/ConnectionTool.d.ts +0 -40
  168. package/dist/cjs/tools/FindRegistrationsTool.d.ts +0 -28
  169. package/dist/cjs/tools/InitiateConnectionTool.d.ts +0 -30
  170. package/dist/cjs/tools/ListConnectionsTool.d.ts +0 -33
  171. package/dist/cjs/tools/ListUnapprovedConnectionRequestsTool.d.ts +0 -41
  172. package/dist/cjs/tools/ManageConnectionRequestsTool.d.ts +0 -38
  173. package/dist/cjs/tools/RegisterAgentTool.d.ts +0 -188
  174. package/dist/cjs/tools/RetrieveProfileTool.d.ts +0 -34
  175. package/dist/cjs/tools/SendMessageToConnectionTool.d.ts +0 -34
  176. package/dist/cjs/tools/SendMessageTool.d.ts +0 -40
  177. package/dist/es/agents/index.d.ts +0 -0
  178. package/dist/es/plugins/BasePlugin.d.ts +0 -28
  179. package/dist/es/plugins/GenericPlugin.d.ts +0 -17
  180. package/dist/es/plugins/HCS10Plugin.d.ts +0 -13
  181. package/dist/es/plugins/PluginLoader.d.ts +0 -38
  182. package/dist/es/plugins/openconvai/OpenConvAIPlugin.d.ts +0 -23
  183. package/dist/es/plugins/openconvai/index.d.ts +0 -1
  184. package/dist/es/standards-agent-kit.es21.js +0 -92
  185. package/dist/es/standards-agent-kit.es21.js.map +0 -1
  186. package/dist/es/standards-agent-kit.es22.js +0 -7
  187. package/dist/es/standards-agent-kit.es22.js.map +0 -1
  188. package/dist/es/standards-agent-kit.es23.js +0 -106
  189. package/dist/es/standards-agent-kit.es23.js.map +0 -1
  190. package/dist/es/standards-agent-kit.es24.js +0 -7
  191. package/dist/es/standards-agent-kit.es24.js.map +0 -1
  192. package/dist/es/standards-agent-kit.es25.js +0 -7
  193. package/dist/es/standards-agent-kit.es25.js.map +0 -1
  194. package/dist/es/standards-agent-kit.es26.js +0 -85
  195. package/dist/es/standards-agent-kit.es26.js.map +0 -1
  196. package/dist/es/standards-agent-kit.es27.js +0 -28
  197. package/dist/es/standards-agent-kit.es27.js.map +0 -1
  198. package/dist/es/tools/AcceptConnectionRequestTool.d.ts +0 -33
  199. package/dist/es/tools/CheckMessagesTool.d.ts +0 -34
  200. package/dist/es/tools/ConnectionMonitorTool.d.ts +0 -100
  201. package/dist/es/tools/ConnectionTool.d.ts +0 -40
  202. package/dist/es/tools/FindRegistrationsTool.d.ts +0 -28
  203. package/dist/es/tools/InitiateConnectionTool.d.ts +0 -30
  204. package/dist/es/tools/ListConnectionsTool.d.ts +0 -33
  205. package/dist/es/tools/ListUnapprovedConnectionRequestsTool.d.ts +0 -41
  206. package/dist/es/tools/ManageConnectionRequestsTool.d.ts +0 -38
  207. package/dist/es/tools/RegisterAgentTool.d.ts +0 -188
  208. package/dist/es/tools/RetrieveProfileTool.d.ts +0 -34
  209. package/dist/es/tools/SendMessageToConnectionTool.d.ts +0 -34
  210. package/dist/es/tools/SendMessageTool.d.ts +0 -40
  211. package/dist/umd/agents/index.d.ts +0 -0
  212. package/dist/umd/plugins/BasePlugin.d.ts +0 -28
  213. package/dist/umd/plugins/GenericPlugin.d.ts +0 -17
  214. package/dist/umd/plugins/HCS10Plugin.d.ts +0 -13
  215. package/dist/umd/plugins/PluginLoader.d.ts +0 -38
  216. package/dist/umd/plugins/openconvai/OpenConvAIPlugin.d.ts +0 -23
  217. package/dist/umd/plugins/openconvai/index.d.ts +0 -1
  218. package/dist/umd/tools/AcceptConnectionRequestTool.d.ts +0 -33
  219. package/dist/umd/tools/CheckMessagesTool.d.ts +0 -34
  220. package/dist/umd/tools/ConnectionMonitorTool.d.ts +0 -100
  221. package/dist/umd/tools/ConnectionTool.d.ts +0 -40
  222. package/dist/umd/tools/FindRegistrationsTool.d.ts +0 -28
  223. package/dist/umd/tools/InitiateConnectionTool.d.ts +0 -30
  224. package/dist/umd/tools/ListConnectionsTool.d.ts +0 -33
  225. package/dist/umd/tools/ListUnapprovedConnectionRequestsTool.d.ts +0 -41
  226. package/dist/umd/tools/ManageConnectionRequestsTool.d.ts +0 -38
  227. package/dist/umd/tools/RegisterAgentTool.d.ts +0 -188
  228. package/dist/umd/tools/RetrieveProfileTool.d.ts +0 -34
  229. package/dist/umd/tools/SendMessageToConnectionTool.d.ts +0 -34
  230. package/dist/umd/tools/SendMessageTool.d.ts +0 -40
  231. package/src/agents/index.ts +0 -1
  232. package/src/plugins/BasePlugin.ts +0 -37
  233. package/src/plugins/GenericPlugin.ts +0 -19
  234. package/src/plugins/HCS10Plugin.ts +0 -14
  235. package/src/plugins/PluginLoader.ts +0 -121
  236. package/src/plugins/README.md +0 -113
  237. package/src/plugins/openconvai/OpenConvAIPlugin.ts +0 -124
  238. package/src/plugins/openconvai/index.ts +0 -1
  239. package/src/tools/AcceptConnectionRequestTool.ts +0 -196
  240. package/src/tools/CheckMessagesTool.ts +0 -194
  241. package/src/tools/ConnectionMonitorTool.ts +0 -550
  242. package/src/tools/ConnectionTool.ts +0 -231
  243. package/src/tools/FindRegistrationsTool.ts +0 -114
  244. package/src/tools/InitiateConnectionTool.ts +0 -137
  245. package/src/tools/ListConnectionsTool.ts +0 -158
  246. package/src/tools/ListUnapprovedConnectionRequestsTool.ts +0 -173
  247. package/src/tools/ManageConnectionRequestsTool.ts +0 -275
  248. package/src/tools/RegisterAgentTool.ts +0 -590
  249. package/src/tools/RetrieveProfileTool.ts +0 -94
  250. package/src/tools/SendMessageToConnectionTool.ts +0 -142
  251. package/src/tools/SendMessageTool.ts +0 -116
@@ -0,0 +1,2 @@
1
+ export * from './types';
2
+ export * from './hcs10/hcs10-builder';
@@ -0,0 +1,11 @@
1
+ import { TransactionReceipt } from '@hashgraph/sdk';
2
+
3
+ export interface ExecuteResult {
4
+ success: boolean;
5
+ receipt?: TransactionReceipt;
6
+ scheduleId?: string;
7
+ error?: string;
8
+ transactionId?: string | undefined;
9
+ rawResult?: unknown;
10
+ notes?: string[];
11
+ }
@@ -313,7 +313,7 @@ export class HCS10Client {
313
313
  (a: { timestamp: number }, b: { timestamp: number }) =>
314
314
  a.timestamp - b.timestamp
315
315
  );
316
- return { messages: mappedMessages };
316
+ return { messages: mappedMessages as HCSMessageWithTimestamp[] };
317
317
  } catch (error) {
318
318
  this.logger.error(`Error getting messages from topic ${topicId}:`, error);
319
319
  return { messages: [] };
@@ -323,7 +323,8 @@ export class HCS10Client {
323
323
  public async getMessageStream(topicId: string): Promise<{
324
324
  messages: HCSMessage[];
325
325
  }> {
326
- return this.standardClient.getMessageStream(topicId);
326
+ const result = this.standardClient.getMessageStream(topicId);
327
+ return result as Promise<{ messages: HCSMessage[] }>;
327
328
  }
328
329
 
329
330
  /**
package/src/index.ts CHANGED
@@ -1,5 +1,7 @@
1
- export * from './hcs10';
2
1
  export * from './tools';
3
2
  export * from './state';
4
3
  export * from './init';
5
- export * from './plugins';
4
+ export * from './plugins';
5
+ export { HCS10Builder } from './builders';
6
+ export type { ExecuteResult } from './builders';
7
+ export { HCS10Client } from './hcs10';
package/src/init/init.ts CHANGED
@@ -1,26 +1,25 @@
1
- import { HCS10Client, StandardNetworkType } from '../hcs10/HCS10Client';
2
- import { RegisterAgentTool } from '../tools/RegisterAgentTool';
3
- import { SendMessageTool } from '../tools/SendMessageTool';
4
- import { ConnectionTool } from '../tools/ConnectionTool';
1
+ import { HederaAgentKit, ServerSigner } from 'hedera-agent-kit';
2
+ import { HCS10Builder } from '../builders/hcs10/hcs10-builder';
3
+ import { RegisterAgentTool } from '../tools/hcs10/RegisterAgentTool';
4
+ import { FindRegistrationsTool } from '../tools/hcs10/FindRegistrationsTool';
5
+ import { InitiateConnectionTool } from '../tools/hcs10/InitiateConnectionTool';
6
+ import { ListConnectionsTool } from '../tools/hcs10/ListConnectionsTool';
7
+ import { SendMessageToConnectionTool } from '../tools/hcs10/SendMessageToConnectionTool';
8
+ import { CheckMessagesTool } from '../tools/hcs10/CheckMessagesTool';
9
+ import { ConnectionMonitorTool } from '../tools/hcs10/ConnectionMonitorTool';
10
+ import { ManageConnectionRequestsTool } from '../tools/hcs10/ManageConnectionRequestsTool';
11
+ import { AcceptConnectionRequestTool } from '../tools/hcs10/AcceptConnectionRequestTool';
12
+ import { RetrieveProfileTool } from '../tools/hcs10/RetrieveProfileTool';
13
+ import { ListUnapprovedConnectionRequestsTool } from '../tools/hcs10/ListUnapprovedConnectionRequestsTool';
5
14
  import { IStateManager } from '../state/state-types';
6
15
  import { OpenConvaiState } from '../state/open-convai-state';
7
- import { FindRegistrationsTool } from '../tools/FindRegistrationsTool';
8
- import { InitiateConnectionTool } from '../tools/InitiateConnectionTool';
9
- import { ListConnectionsTool } from '../tools/ListConnectionsTool';
10
- import { SendMessageToConnectionTool } from '../tools/SendMessageToConnectionTool';
11
- import { CheckMessagesTool } from '../tools/CheckMessagesTool';
12
- import { ConnectionMonitorTool } from '../tools/ConnectionMonitorTool';
13
- import { ManageConnectionRequestsTool } from '../tools/ManageConnectionRequestsTool';
14
- import { AcceptConnectionRequestTool } from '../tools/AcceptConnectionRequestTool';
15
- import { RetrieveProfileTool } from '../tools/RetrieveProfileTool';
16
- import { ListUnapprovedConnectionRequestsTool } from '../tools/ListUnapprovedConnectionRequestsTool';
17
16
  import { Logger } from '@hashgraphonline/standards-sdk';
18
17
  import { ENV_FILE_PATH } from '../utils/state-tools';
19
18
 
20
19
  export interface HCS10ClientConfig {
21
20
  operatorId?: string;
22
21
  operatorKey?: string;
23
- network?: StandardNetworkType;
22
+ network?: 'mainnet' | 'testnet';
24
23
  useEncryption?: boolean;
25
24
  registryUrl?: string;
26
25
  logLevel?: 'debug' | 'info' | 'warn' | 'error';
@@ -44,8 +43,6 @@ export interface HCS10Tools {
44
43
  listConnectionsTool: ListConnectionsTool;
45
44
  sendMessageToConnectionTool: SendMessageToConnectionTool;
46
45
  checkMessagesTool: CheckMessagesTool;
47
- sendMessageTool: SendMessageTool;
48
- connectionTool: ConnectionTool;
49
46
  connectionMonitorTool: ConnectionMonitorTool;
50
47
  manageConnectionRequestsTool: ManageConnectionRequestsTool;
51
48
  acceptConnectionRequestTool: AcceptConnectionRequestTool;
@@ -56,16 +53,18 @@ export interface HCS10Tools {
56
53
  * Initializes the HCS10 client and returns pre-registered LangChain tools.
57
54
  *
58
55
  * @param options - Initialization options
59
- * @returns Object containing hcs10Client and requested tools
56
+ * @returns Object containing hederaKit, hcs10Builder and requested tools
60
57
  */
61
- export const initializeStandardsAgentKit = (
58
+ export const initializeStandardsAgentKit = async (
62
59
  options?: HCS10InitializationOptions
63
- ): {
64
- hcs10Client: HCS10Client;
65
- monitoringClient?: HCS10Client;
60
+ ): Promise<{
61
+ hederaKit: HederaAgentKit;
62
+ hcs10Builder: HCS10Builder;
63
+ monitoringHederaKit?: HederaAgentKit;
64
+ monitoringHcs10Builder?: HCS10Builder;
66
65
  tools: Partial<HCS10Tools>;
67
66
  stateManager: IStateManager;
68
- } => {
67
+ }> => {
69
68
  const config = options?.clientConfig || {};
70
69
 
71
70
  const operatorId = config.operatorId || process.env.HEDERA_OPERATOR_ID;
@@ -74,7 +73,7 @@ export const initializeStandardsAgentKit = (
74
73
 
75
74
  const networkEnv = config.network || process.env.HEDERA_NETWORK || 'testnet';
76
75
 
77
- let network: StandardNetworkType;
76
+ let network: 'mainnet' | 'testnet';
78
77
  if (networkEnv === 'mainnet') {
79
78
  network = 'mainnet';
80
79
  } else if (networkEnv === 'testnet') {
@@ -106,82 +105,105 @@ export const initializeStandardsAgentKit = (
106
105
  });
107
106
  logger.info('State manager initialized');
108
107
 
109
- const hcs10Client = new HCS10Client(operatorId, operatorPrivateKey, network, {
108
+ // Create HederaAgentKit
109
+ const signer = new ServerSigner(operatorId, operatorPrivateKey, network);
110
+ const hederaKit = new HederaAgentKit(signer);
111
+ await hederaKit.initialize();
112
+ logger.info(`HederaAgentKit initialized for ${operatorId} on ${network}`);
113
+
114
+ // Create HCS10Builder
115
+ const hcs10Builder = new HCS10Builder(hederaKit, stateManager, {
110
116
  useEncryption: config.useEncryption,
111
117
  registryUrl: config.registryUrl,
118
+ logLevel: config.logLevel,
112
119
  });
113
- logger.info(`HCS10Client initialized for ${operatorId} on ${network}`);
114
120
 
115
- let monitoringClient: HCS10Client | undefined;
121
+ let monitoringHederaKit: HederaAgentKit | undefined;
122
+ let monitoringHcs10Builder: HCS10Builder | undefined;
123
+
116
124
  if (options?.monitoringClient) {
117
- monitoringClient = new HCS10Client(
118
- operatorId,
119
- operatorPrivateKey,
120
- network,
121
- {
122
- useEncryption: config.useEncryption,
123
- registryUrl: config.registryUrl,
124
- logLevel: 'error',
125
- }
126
- );
125
+ const monitoringSigner = new ServerSigner(operatorId, operatorPrivateKey, network);
126
+ monitoringHederaKit = new HederaAgentKit(monitoringSigner);
127
+ await monitoringHederaKit.initialize();
128
+ monitoringHcs10Builder = new HCS10Builder(monitoringHederaKit, stateManager, {
129
+ useEncryption: config.useEncryption,
130
+ registryUrl: config.registryUrl,
131
+ logLevel: 'error',
132
+ });
127
133
  logger.info('Monitoring client initialized');
128
134
  }
129
135
 
130
136
  const tools: Partial<HCS10Tools> = {};
131
137
 
132
- tools.registerAgentTool = new RegisterAgentTool(hcs10Client, stateManager);
133
- tools.sendMessageTool = new SendMessageTool(hcs10Client);
134
- tools.connectionTool = new ConnectionTool({
135
- client: monitoringClient || hcs10Client,
136
- stateManager,
138
+ // Always create RegisterAgentTool
139
+ tools.registerAgentTool = new RegisterAgentTool({
140
+ hederaKit,
141
+ hcs10Builder,
142
+ logger: undefined,
137
143
  });
138
144
 
139
145
  if (options?.createAllTools) {
140
146
  tools.findRegistrationsTool = new FindRegistrationsTool({
141
- hcsClient: hcs10Client,
147
+ hederaKit,
148
+ hcs10Builder,
149
+ logger: undefined,
150
+ });
151
+ tools.retrieveProfileTool = new RetrieveProfileTool({
152
+ hederaKit,
153
+ hcs10Builder,
154
+ logger: undefined,
142
155
  });
143
- tools.retrieveProfileTool = new RetrieveProfileTool(hcs10Client);
144
156
  tools.initiateConnectionTool = new InitiateConnectionTool({
145
- hcsClient: hcs10Client,
146
- stateManager,
157
+ hederaKit,
158
+ hcs10Builder,
159
+ logger: undefined,
147
160
  });
148
161
  tools.listConnectionsTool = new ListConnectionsTool({
149
- hcsClient: hcs10Client,
150
- stateManager,
162
+ hederaKit,
163
+ hcs10Builder,
164
+ logger: undefined,
151
165
  });
152
166
  tools.sendMessageToConnectionTool = new SendMessageToConnectionTool({
153
- hcsClient: hcs10Client,
154
- stateManager,
167
+ hederaKit,
168
+ hcs10Builder,
169
+ logger: undefined,
155
170
  });
156
171
  tools.checkMessagesTool = new CheckMessagesTool({
157
- hcsClient: hcs10Client,
158
- stateManager,
172
+ hederaKit,
173
+ hcs10Builder,
174
+ logger: undefined,
159
175
  });
160
176
  tools.connectionMonitorTool = new ConnectionMonitorTool({
161
- hcsClient: monitoringClient || hcs10Client,
162
- stateManager,
177
+ hederaKit: monitoringHederaKit || hederaKit,
178
+ hcs10Builder: monitoringHcs10Builder || hcs10Builder,
179
+ logger: undefined,
163
180
  });
164
181
  tools.manageConnectionRequestsTool = new ManageConnectionRequestsTool({
165
- hcsClient: hcs10Client,
166
- stateManager,
182
+ hederaKit,
183
+ hcs10Builder,
184
+ logger: undefined,
167
185
  });
168
186
  tools.acceptConnectionRequestTool = new AcceptConnectionRequestTool({
169
- hcsClient: hcs10Client,
170
- stateManager,
187
+ hederaKit,
188
+ hcs10Builder,
189
+ logger: undefined,
171
190
  });
172
191
  tools.listUnapprovedConnectionRequestsTool =
173
192
  new ListUnapprovedConnectionRequestsTool({
174
- stateManager,
175
- hcsClient: hcs10Client,
193
+ hederaKit,
194
+ hcs10Builder,
195
+ logger: undefined,
176
196
  });
177
197
 
178
198
  logger.info('All tools initialized');
179
199
  }
180
200
 
181
201
  return {
182
- hcs10Client,
183
- monitoringClient,
202
+ hederaKit,
203
+ hcs10Builder,
204
+ monitoringHederaKit,
205
+ monitoringHcs10Builder,
184
206
  tools,
185
207
  stateManager,
186
208
  };
187
- };
209
+ };
@@ -1,56 +1,24 @@
1
- import { StructuredTool } from '@langchain/core/tools';
1
+ // Re-export plugin interfaces from hedera-agent-kit for consistency
2
+ export { BasePlugin } from 'hedera-agent-kit';
3
+ export type {
4
+ IPlugin,
5
+ BasePluginContext,
6
+ GenericPluginContext,
7
+ PluginContext,
8
+ IPluginClient,
9
+ IPluginStateManager,
10
+ HederaTool,
11
+ } from 'hedera-agent-kit';
12
+
13
+ // Extended context for HCS10-specific functionality
2
14
  import { HCS10Client } from '../hcs10/HCS10Client';
3
15
  import { IStateManager } from '../state/state-types';
4
- import { Logger } from '@hashgraphonline/standards-sdk';
5
-
6
- /**
7
- * Basic client interface required by plugins
8
- */
9
- export interface IPluginClient {
10
- getNetwork(): string;
11
- }
12
-
13
- /**
14
- * Basic state manager interface required by plugins
15
- */
16
- export interface IPluginStateManager {
17
- getCurrentAgent?(): unknown;
18
- }
19
-
20
- /**
21
- * Base context provided to all plugins during initialization
22
- */
23
- export interface BasePluginContext {
24
- /**
25
- * Logger instance
26
- */
27
- logger: Logger;
28
-
29
- /**
30
- * Configuration options
31
- */
32
- config: Record<string, unknown>;
33
- }
34
-
35
- /**
36
- * Context provided to platform-agnostic plugins during initialization
37
- */
38
- export interface GenericPluginContext extends BasePluginContext {
39
- /**
40
- * Generic client interface
41
- */
42
- client: IPluginClient;
43
-
44
- /**
45
- * Optional generic state manager
46
- */
47
- stateManager?: IPluginStateManager;
48
- }
16
+ import { BasePluginContext } from 'hedera-agent-kit';
49
17
 
50
18
  /**
51
19
  * Context provided to HCS10-specific plugins during initialization
52
20
  */
53
- export interface PluginContext extends BasePluginContext {
21
+ export interface HCS10PluginContext extends BasePluginContext {
54
22
  /**
55
23
  * The HCS10Client instance
56
24
  */
@@ -61,50 +29,3 @@ export interface PluginContext extends BasePluginContext {
61
29
  */
62
30
  stateManager?: IStateManager;
63
31
  }
64
-
65
- /**
66
- * Standard interface that all plugins must implement
67
- */
68
- export interface IPlugin<T extends BasePluginContext = BasePluginContext> {
69
- /**
70
- * Unique identifier for the plugin
71
- */
72
- id: string;
73
-
74
- /**
75
- * Human-readable name of the plugin
76
- */
77
- name: string;
78
-
79
- /**
80
- * Description of what the plugin does
81
- */
82
- description: string;
83
-
84
- /**
85
- * Version of the plugin
86
- */
87
- version: string;
88
-
89
- /**
90
- * Author of the plugin
91
- */
92
- author: string;
93
-
94
- /**
95
- * Initialize the plugin with the provided context
96
- * @param context The context containing shared resources
97
- */
98
- initialize(context: T): Promise<void>;
99
-
100
- /**
101
- * Get the tools provided by this plugin
102
- * @returns Array of tools provided by this plugin
103
- */
104
- getTools(): StructuredTool[];
105
-
106
- /**
107
- * Clean up resources when the plugin is unloaded
108
- */
109
- cleanup?(): Promise<void>;
110
- }
@@ -1,98 +1,2 @@
1
- import { IPlugin, PluginContext } from './PluginInterface';
2
- import { StructuredTool } from '@langchain/core/tools';
3
- import { Logger } from '@hashgraphonline/standards-sdk';
4
-
5
- /**
6
- * Registry for managing plugins in the Standards Agent Kit
7
- */
8
- export class PluginRegistry {
9
- private plugins: Map<string, IPlugin> = new Map();
10
- private context: PluginContext;
11
- private logger: Logger;
12
-
13
- /**
14
- * Creates a new PluginRegistry instance
15
- * @param context The context to provide to plugins during initialization
16
- */
17
- constructor(context: PluginContext) {
18
- this.context = context;
19
- this.logger = context.logger;
20
- }
21
-
22
- /**
23
- * Register a plugin with the registry
24
- * @param plugin The plugin to register
25
- * @throws Error if a plugin with the same ID is already registered
26
- */
27
- async registerPlugin(plugin: IPlugin): Promise<void> {
28
- if (this.plugins.has(plugin.id)) {
29
- throw new Error(`Plugin with ID ${plugin.id} is already registered`);
30
- }
31
-
32
- await plugin.initialize(this.context);
33
- this.plugins.set(plugin.id, plugin);
34
- this.logger.info(`Plugin registered: ${plugin.name} (${plugin.id}) v${plugin.version}`);
35
- }
36
-
37
- /**
38
- * Get a plugin by ID
39
- * @param id The ID of the plugin to retrieve
40
- * @returns The plugin, or undefined if not found
41
- */
42
- getPlugin(id: string): IPlugin | undefined {
43
- return this.plugins.get(id);
44
- }
45
-
46
- /**
47
- * Get all registered plugins
48
- * @returns Array of all registered plugins
49
- */
50
- getAllPlugins(): IPlugin[] {
51
- return Array.from(this.plugins.values());
52
- }
53
-
54
- /**
55
- * Get all tools from all registered plugins
56
- * @returns Array of all tools provided by registered plugins
57
- */
58
- getAllTools(): StructuredTool[] {
59
- return this.getAllPlugins().flatMap(plugin => plugin.getTools());
60
- }
61
-
62
- /**
63
- * Unregister a plugin
64
- * @param id The ID of the plugin to unregister
65
- * @returns true if the plugin was unregistered, false if it wasn't found
66
- */
67
- async unregisterPlugin(id: string): Promise<boolean> {
68
- const plugin = this.plugins.get(id);
69
- if (!plugin) {
70
- return false;
71
- }
72
-
73
- if (plugin.cleanup) {
74
- try {
75
- await plugin.cleanup();
76
- } catch (error) {
77
- this.logger.error(`Error during plugin cleanup: ${error}`);
78
- }
79
- }
80
-
81
- const result = this.plugins.delete(id);
82
- if (result) {
83
- this.logger.info(`Plugin unregistered: ${plugin.name} (${plugin.id})`);
84
- }
85
-
86
- return result;
87
- }
88
-
89
- /**
90
- * Unregister all plugins
91
- */
92
- async unregisterAllPlugins(): Promise<void> {
93
- const pluginIds = Array.from(this.plugins.keys());
94
- for (const id of pluginIds) {
95
- await this.unregisterPlugin(id);
96
- }
97
- }
98
- }
1
+ // Re-export PluginRegistry from hedera-agent-kit
2
+ export { PluginRegistry } from 'hedera-agent-kit';
@@ -1,129 +1,42 @@
1
- import { HCS10Plugin } from '../../../src/plugins/HCS10Plugin';
2
- import { StructuredTool } from '@langchain/core/tools';
3
- import { z } from 'zod';
4
- import axios from 'axios';
5
- import { HCS10Client } from '../../../src/hcs10/HCS10Client';
6
-
7
- /**
8
- * Tool for getting token price information using CoinGecko
9
- */
10
- class GetTokenPriceTool extends StructuredTool {
11
- name = 'get_token_price';
12
- description = 'Get the current price of a token on Hedera';
13
-
14
- schema = z.object({
15
- tokenId: z.string().describe('The Hedera token ID (e.g., 0.0.12345)'),
16
- });
17
-
18
- constructor(private client: HCS10Client) {
19
- super();
20
- }
21
-
22
- async _call(input: z.infer<typeof this.schema>): Promise<string> {
23
- try {
24
- // In a real implementation, this would map Hedera token IDs to CoinGecko IDs
25
- // This is a simplified mock implementation
26
- const mockCoinGeckoIds: Record<string, string> = {
27
- '0.0.1234': 'hbar',
28
- '0.0.5678': 'ethereum',
29
- '0.0.9012': 'bitcoin',
30
- };
31
-
32
- const coinGeckoId = mockCoinGeckoIds[input.tokenId] || 'hbar';
33
-
34
- // Use CoinGecko's public API (no API key required)
35
- const response = await axios.get(`https://api.coingecko.com/api/v3/simple/price?ids=${coinGeckoId}&vs_currencies=usd`);
36
-
37
- const price = response.data[coinGeckoId]?.usd || 0;
38
-
39
- return `Current price of token ${input.tokenId}: $${price.toFixed(4)} USD`;
40
- } catch (error) {
41
- return `Error fetching token price: ${error instanceof Error ? error.message : String(error)}`;
42
- }
43
- }
44
- }
45
-
46
- /**
47
- * Tool for swapping tokens
48
- */
49
- class SwapTokensTool extends StructuredTool {
50
- name = 'swap_tokens';
51
- description = 'Swap one token for another on Hedera';
52
-
53
- schema = z.object({
54
- fromTokenId: z.string().describe('The ID of the token to swap from (e.g., 0.0.12345)'),
55
- toTokenId: z.string().describe('The ID of the token to swap to (e.g., 0.0.67890)'),
56
- amount: z.number().positive().describe('The amount of the source token to swap'),
57
- });
58
-
59
- constructor(private client: HCS10Client) {
60
- super();
61
- }
62
-
63
- async _call(input: z.infer<typeof this.schema>): Promise<string> {
64
- try {
65
- // In a real implementation, this would interact with a DEX contract
66
- // This is a simplified mock implementation
67
- const { accountId } = this.client.getAccountAndSigner();
68
-
69
- // Mock exchange rate
70
- const exchangeRate = Math.random() * 2;
71
- const receivedAmount = input.amount * exchangeRate;
72
-
73
- return `Simulated swap of ${input.amount} tokens (${input.fromTokenId}) for ${receivedAmount.toFixed(4)} tokens (${input.toTokenId}).\n\nNote: This is a mock implementation. In a real implementation, this would execute the swap through a DEX on Hedera.`;
74
- } catch (error) {
75
- return `Error performing token swap: ${error instanceof Error ? error.message : String(error)}`;
76
- }
77
- }
78
- }
79
-
80
- /**
81
- * Tool for checking token balance
82
- */
83
- class CheckTokenBalanceTool extends StructuredTool {
84
- name = 'check_token_balance';
85
- description = 'Check the balance of a token for an account on Hedera';
86
-
87
- schema = z.object({
88
- tokenId: z.string().describe('The Hedera token ID (e.g., 0.0.12345)'),
89
- accountId: z.string().optional().describe('The account ID to check (defaults to the operator account)'),
90
- });
91
-
92
- constructor(private client: HCS10Client) {
93
- super();
94
- }
95
-
96
- async _call(input: z.infer<typeof this.schema>): Promise<string> {
97
- try {
98
- const { accountId: operatorId } = this.client.getAccountAndSigner();
99
- const accountToCheck = input.accountId || operatorId;
100
-
101
- // In a real implementation, this would query the account's token balance
102
- // This is a simplified mock implementation
103
- const mockBalance = Math.floor(Math.random() * 10000);
104
-
105
- return `Token balance for account ${accountToCheck}:\n${mockBalance} tokens of ${input.tokenId}\n\nNote: This is a mock implementation. In a real implementation, this would query the actual token balance from the Hedera network.`;
106
- } catch (error) {
107
- return `Error checking token balance: ${error instanceof Error ? error.message : String(error)}`;
108
- }
109
- }
110
- }
1
+ import { BasePlugin, GenericPluginContext, HederaTool, HederaAgentKit } from 'hedera-agent-kit';
2
+ import {
3
+ HederaGetTokenInfoTool,
4
+ HederaTransferTokensTool,
5
+ HederaGetAccountTokensTool,
6
+ HederaAssociateTokensTool
7
+ } from 'hedera-agent-kit';
111
8
 
112
9
  /**
113
10
  * DeFi Integration Plugin for the Standards Agent Kit
11
+ * Uses built-in Hedera token tools from hedera-agent-kit
114
12
  */
115
- export default class DeFiPlugin extends HCS10Plugin {
13
+ export default class DeFiPlugin extends BasePlugin<GenericPluginContext> {
116
14
  id = 'defi-integration';
117
15
  name = 'DeFi Integration Plugin';
118
- description = 'Provides tools to interact with DeFi protocols on Hedera';
16
+ description = 'Provides tools to interact with DeFi protocols on Hedera using built-in Hedera tools';
119
17
  version = '1.0.0';
120
18
  author = 'Hashgraph Online';
121
-
122
- getTools(): StructuredTool[] {
123
- return [
124
- new GetTokenPriceTool(this.context.client),
125
- new SwapTokensTool(this.context.client),
126
- new CheckTokenBalanceTool(this.context.client)
19
+
20
+ private tools: HederaTool[] = [];
21
+
22
+ override async initialize(context: GenericPluginContext): Promise<void> {
23
+ await super.initialize(context);
24
+ this.initializeTools();
25
+ }
26
+
27
+ private initializeTools(): void {
28
+ const hederaKit = this.context.config.hederaKit as HederaAgentKit;
29
+ const logger = this.context.logger;
30
+
31
+ this.tools = [
32
+ new HederaGetTokenInfoTool({ hederaKit, logger }),
33
+ new HederaTransferTokensTool({ hederaKit, logger }),
34
+ new HederaGetAccountTokensTool({ hederaKit, logger }),
35
+ new HederaAssociateTokensTool({ hederaKit, logger })
127
36
  ];
128
37
  }
38
+
39
+ getTools(): HederaTool[] {
40
+ return this.tools;
41
+ }
129
42
  }