@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,66 @@
1
+ import { z } from 'zod';
2
+ import { BaseHCS10TransactionTool } from './base-hcs10-tools';
3
+ import { HCS10Builder } from '../../builders/hcs10/hcs10-builder';
4
+ import { HCS10TransactionToolParams } from './hcs10-tool-params';
5
+ import { BaseServiceBuilder } from 'hedera-agent-kit';
6
+
7
+ const InitiateConnectionZodSchema = z.object({
8
+ targetAccountId: z
9
+ .string()
10
+ .describe(
11
+ 'The Hedera account ID (e.g., 0.0.12345) of the agent you want to connect with.'
12
+ ),
13
+ disableMonitor: z
14
+ .boolean()
15
+ .optional()
16
+ .describe(
17
+ 'If true, does not wait for connection confirmation. Returns immediately after sending the request.'
18
+ ),
19
+ memo: z
20
+ .string()
21
+ .optional()
22
+ .describe(
23
+ 'Optional memo to include with the connection request (e.g., "Hello from Alice"). If not provided, defaults to "true" or "false" based on monitoring preference.'
24
+ ),
25
+ });
26
+
27
+ /**
28
+ * A tool to actively START a NEW HCS-10 connection TO a target agent.
29
+ * Requires the target agent's account ID.
30
+ * It retrieves their profile, sends a connection request, and optionally waits for confirmation.
31
+ * Use this tool ONLY to actively INITIATE an OUTGOING connection.
32
+ */
33
+ export class InitiateConnectionTool extends BaseHCS10TransactionTool<
34
+ typeof InitiateConnectionZodSchema
35
+ > {
36
+ name = 'initiate_connection';
37
+ description =
38
+ 'Actively STARTS a NEW HCS-10 connection TO a specific target agent identified by their account ID. Requires the targetAccountId parameter. Use this ONLY to INITIATE an OUTGOING connection request.';
39
+ specificInputSchema = InitiateConnectionZodSchema;
40
+ constructor(params: HCS10TransactionToolParams) {
41
+ super(params);
42
+ this.neverScheduleThisTool = true;
43
+ this.requiresMultipleTransactions = true;
44
+ }
45
+
46
+ protected async callBuilderMethod(
47
+ builder: BaseServiceBuilder,
48
+ specificArgs: z.infer<typeof InitiateConnectionZodSchema>
49
+ ): Promise<void> {
50
+ const hcs10Builder = builder as HCS10Builder;
51
+ const params: {
52
+ targetAccountId: string;
53
+ disableMonitor?: boolean;
54
+ memo?: string;
55
+ } = {
56
+ targetAccountId: specificArgs.targetAccountId,
57
+ };
58
+ if (specificArgs.disableMonitor !== undefined) {
59
+ params.disableMonitor = specificArgs.disableMonitor;
60
+ }
61
+ if (specificArgs.memo !== undefined) {
62
+ params.memo = specificArgs.memo;
63
+ }
64
+ await hcs10Builder.initiateConnection(params);
65
+ }
66
+ }
@@ -0,0 +1,58 @@
1
+ import { z } from 'zod';
2
+ import { BaseHCS10QueryTool } from './base-hcs10-tools';
3
+ import { HCS10QueryToolParams } from './hcs10-tool-params';
4
+
5
+ /**
6
+ * A tool to list currently active HCS-10 connections stored in the state manager.
7
+ * Enhanced to show more details similar to moonscape's implementation.
8
+ */
9
+ const ListConnectionsZodSchema = z.object({
10
+ includeDetails: z
11
+ .boolean()
12
+ .optional()
13
+ .describe(
14
+ 'Whether to include detailed information about each connection'
15
+ ),
16
+ showPending: z
17
+ .boolean()
18
+ .optional()
19
+ .describe('Whether to include pending connection requests'),
20
+ });
21
+
22
+ export class ListConnectionsTool extends BaseHCS10QueryTool<
23
+ typeof ListConnectionsZodSchema
24
+ > {
25
+ name = 'list_connections';
26
+ description =
27
+ 'Lists the currently active HCS-10 connections with detailed information. Shows connection status, agent details, and recent activity. Use this to get a comprehensive view of all active connections.';
28
+ specificInputSchema = ListConnectionsZodSchema;
29
+ constructor(params: HCS10QueryToolParams) {
30
+ super(params);
31
+ }
32
+
33
+ protected async executeQuery(
34
+ args: z.infer<typeof ListConnectionsZodSchema>
35
+ ): Promise<unknown> {
36
+ const hcs10Builder = this.hcs10Builder;
37
+ const params: { includeDetails?: boolean; showPending?: boolean } = {};
38
+ if (args.includeDetails !== undefined) {
39
+ params.includeDetails = args.includeDetails;
40
+ }
41
+ if (args.showPending !== undefined) {
42
+ params.showPending = args.showPending;
43
+ }
44
+ await hcs10Builder.listConnections(params);
45
+
46
+ const result = await hcs10Builder.execute();
47
+
48
+ if (result.success && 'rawResult' in result && result.rawResult) {
49
+ const raw = result.rawResult as { formattedOutput?: string; message?: string };
50
+ return {
51
+ success: true,
52
+ data: raw.formattedOutput || raw.message || 'Connections listed'
53
+ };
54
+ }
55
+
56
+ return result;
57
+ }
58
+ }
@@ -0,0 +1,26 @@
1
+ import { z } from 'zod';
2
+ import { BaseHCS10QueryTool } from './base-hcs10-tools';
3
+ import { HCS10QueryToolParams } from './hcs10-tool-params';
4
+ const ListUnapprovedConnectionRequestsZodSchema = z.object({});
5
+
6
+ /**
7
+ * Lists all connection requests that are not fully established
8
+ */
9
+ export class ListUnapprovedConnectionRequestsTool extends BaseHCS10QueryTool<
10
+ typeof ListUnapprovedConnectionRequestsZodSchema
11
+ > {
12
+ name = 'list_unapproved_connection_requests';
13
+ description =
14
+ 'Lists all connection requests that are not fully established, including incoming requests needing approval and outgoing requests waiting for confirmation.';
15
+ specificInputSchema = ListUnapprovedConnectionRequestsZodSchema;
16
+ constructor(params: HCS10QueryToolParams) {
17
+ super(params);
18
+ }
19
+
20
+ protected async executeQuery(): Promise<unknown> {
21
+ const hcs10Builder = this.hcs10Builder;
22
+ await hcs10Builder.listUnapprovedConnectionRequests();
23
+ const result = await hcs10Builder.execute();
24
+ return 'rawResult' in result ? result.rawResult : result;
25
+ }
26
+ }
@@ -0,0 +1,48 @@
1
+ import { z } from 'zod';
2
+ import { BaseHCS10QueryTool } from './base-hcs10-tools';
3
+ import { HCS10QueryToolParams } from './hcs10-tool-params';
4
+
5
+ const ManageConnectionRequestsZodSchema = z.object({
6
+ action: z
7
+ .enum(['list', 'view', 'reject'])
8
+ .describe(
9
+ 'The action to perform: list all requests, view details of a specific request, or reject a request'
10
+ ),
11
+ requestKey: z
12
+ .string()
13
+ .optional()
14
+ .describe(
15
+ 'The unique request key to view or reject (required for view and reject actions)'
16
+ ),
17
+ });
18
+
19
+ /**
20
+ * A tool for managing incoming connection requests in a LangChain-compatible way.
21
+ * This tool allows an agent to list, view details of, and reject incoming connection requests.
22
+ */
23
+ export class ManageConnectionRequestsTool extends BaseHCS10QueryTool<
24
+ typeof ManageConnectionRequestsZodSchema
25
+ > {
26
+ name = 'manage_connection_requests';
27
+ description =
28
+ 'Manage incoming connection requests. List pending requests, view details about requesting agents, and reject connection requests. Use the separate "accept_connection_request" tool to accept.';
29
+ specificInputSchema = ManageConnectionRequestsZodSchema;
30
+ constructor(params: HCS10QueryToolParams) {
31
+ super(params);
32
+ }
33
+
34
+ protected async executeQuery({
35
+ action,
36
+ requestKey,
37
+ }: z.infer<typeof ManageConnectionRequestsZodSchema>): Promise<unknown> {
38
+ const hcs10Builder = this.hcs10Builder;
39
+ const params: { action: 'list' | 'view' | 'reject'; requestKey?: string } =
40
+ { action };
41
+ if (requestKey !== undefined) {
42
+ params.requestKey = requestKey;
43
+ }
44
+ await hcs10Builder.manageConnectionRequests(params);
45
+ const result = await hcs10Builder.execute();
46
+ return 'rawResult' in result ? result.rawResult : result;
47
+ }
48
+ }
@@ -0,0 +1,213 @@
1
+ import { AIAgentCapability } from '@hashgraphonline/standards-sdk';
2
+ import { z } from 'zod';
3
+ import { BaseServiceBuilder } from 'hedera-agent-kit';
4
+ import { HCS10Builder, RegisterAgentParams } from '../../builders/hcs10/hcs10-builder';
5
+ import { BaseHCS10TransactionTool } from './base-hcs10-tools';
6
+ import { HCS10TransactionToolParams } from './hcs10-tool-params';
7
+
8
+ const RegisterAgentZodSchema = z.object({
9
+ name: z
10
+ .string()
11
+ .min(1)
12
+ .max(50)
13
+ .describe('A unique name for the agent (1-50 characters)'),
14
+ description: z
15
+ .string()
16
+ .max(500)
17
+ .optional()
18
+ .describe('Optional bio description for the agent (max 500 characters)'),
19
+ alias: z
20
+ .string()
21
+ .optional()
22
+ .describe('Optional custom username/alias for the agent'),
23
+ type: z
24
+ .enum(['autonomous', 'manual'])
25
+ .optional()
26
+ .describe('Agent type (default: autonomous)'),
27
+ model: z
28
+ .string()
29
+ .optional()
30
+ .describe('AI model identifier (default: agent-model-2024)'),
31
+ capabilities: z
32
+ .array(z.nativeEnum(AIAgentCapability))
33
+ .optional()
34
+ .describe('Array of agent capabilities (default: [TEXT_GENERATION])'),
35
+ creator: z.string().optional().describe('Creator attribution for the agent'),
36
+ socials: z
37
+ .record(
38
+ z.enum([
39
+ 'twitter',
40
+ 'github',
41
+ 'discord',
42
+ 'telegram',
43
+ 'linkedin',
44
+ 'youtube',
45
+ 'website',
46
+ 'x',
47
+ ] as const),
48
+ z.string()
49
+ )
50
+ .optional()
51
+ .describe(
52
+ 'Social media links (e.g., {"twitter": "@handle", "discord": "username"})'
53
+ ),
54
+ properties: z
55
+ .record(z.unknown())
56
+ .optional()
57
+ .describe('Custom metadata properties for the agent'),
58
+ profilePicture: z
59
+ .union([
60
+ z.string().describe('URL or local file path to profile picture'),
61
+ z.object({
62
+ url: z.string().optional(),
63
+ path: z.string().optional(),
64
+ filename: z.string().optional(),
65
+ }),
66
+ ])
67
+ .optional()
68
+ .describe(
69
+ 'Optional profile picture as URL, file path, or object with url/path/filename'
70
+ ),
71
+ existingProfilePictureTopicId: z
72
+ .string()
73
+ .optional()
74
+ .describe(
75
+ 'Topic ID of an existing profile picture to reuse (e.g., 0.0.12345)'
76
+ ),
77
+ initialBalance: z
78
+ .number()
79
+ .positive()
80
+ .optional()
81
+ .describe(
82
+ 'Optional initial HBAR balance for the new agent account (will create new account if provided)'
83
+ ),
84
+ userAccountId: z
85
+ .string()
86
+ .optional()
87
+ .describe(
88
+ 'Optional account ID (e.g., 0.0.12345) to use as the agent account instead of creating a new one'
89
+ ),
90
+ hbarFee: z
91
+ .number()
92
+ .positive()
93
+ .optional()
94
+ .describe(
95
+ 'Optional HBAR fee amount to charge per message on the inbound topic'
96
+ ),
97
+ tokenFees: z
98
+ .array(
99
+ z.object({
100
+ amount: z.number().positive(),
101
+ tokenId: z.string(),
102
+ })
103
+ )
104
+ .optional()
105
+ .describe('Optional token fees to charge per message'),
106
+ exemptAccountIds: z
107
+ .array(z.string())
108
+ .optional()
109
+ .describe('Optional account IDs to exempt from fees'),
110
+ setAsCurrent: z
111
+ .boolean()
112
+ .optional()
113
+ .describe('Whether to set as current agent (default: true)'),
114
+ persistence: z
115
+ .object({
116
+ prefix: z.string().optional(),
117
+ })
118
+ .optional()
119
+ .describe('Optional persistence configuration'),
120
+ });
121
+
122
+ export class RegisterAgentTool extends BaseHCS10TransactionTool<
123
+ typeof RegisterAgentZodSchema
124
+ > {
125
+ name = 'register_agent';
126
+ description =
127
+ 'Creates and registers the AI agent on the Hedera network. Returns JSON string with agent details (accountId, privateKey, topics) on success. Note: This tool requires multiple transactions and cannot be used in returnBytes mode.';
128
+ specificInputSchema = RegisterAgentZodSchema;
129
+
130
+ constructor(params: HCS10TransactionToolParams) {
131
+ super(params);
132
+ this.neverScheduleThisTool = true;
133
+ this.requiresMultipleTransactions = true;
134
+ }
135
+
136
+ protected async callBuilderMethod(
137
+ builder: BaseServiceBuilder,
138
+ specificArgs: z.infer<typeof RegisterAgentZodSchema>
139
+ ): Promise<void> {
140
+ const hcs10Builder = builder as HCS10Builder;
141
+
142
+ const params: RegisterAgentParams = {
143
+ name: specificArgs.name,
144
+ };
145
+
146
+ if (specificArgs.description !== undefined) {
147
+ params.bio = specificArgs.description;
148
+ }
149
+ if (specificArgs.alias !== undefined) {
150
+ params.alias = specificArgs.alias;
151
+ }
152
+ if (specificArgs.type !== undefined) {
153
+ params.type = specificArgs.type;
154
+ }
155
+ if (specificArgs.model !== undefined) {
156
+ params.model = specificArgs.model;
157
+ }
158
+ if (specificArgs.capabilities !== undefined) {
159
+ params.capabilities = specificArgs.capabilities;
160
+ }
161
+ if (specificArgs.creator !== undefined) {
162
+ params.creator = specificArgs.creator;
163
+ }
164
+ if (specificArgs.socials !== undefined) {
165
+ params.socials = specificArgs.socials;
166
+ }
167
+ if (specificArgs.properties !== undefined) {
168
+ params.properties = specificArgs.properties;
169
+ }
170
+ if (specificArgs.profilePicture !== undefined) {
171
+ if (typeof specificArgs.profilePicture === 'string') {
172
+ params.profilePicture = specificArgs.profilePicture;
173
+ } else {
174
+ const profilePicObj: {
175
+ url?: string;
176
+ path?: string;
177
+ filename?: string;
178
+ } = {};
179
+ if (specificArgs.profilePicture.url !== undefined) {
180
+ profilePicObj.url = specificArgs.profilePicture.url;
181
+ }
182
+ if (specificArgs.profilePicture.path !== undefined) {
183
+ profilePicObj.path = specificArgs.profilePicture.path;
184
+ }
185
+ if (specificArgs.profilePicture.filename !== undefined) {
186
+ profilePicObj.filename = specificArgs.profilePicture.filename;
187
+ }
188
+ params.profilePicture = profilePicObj;
189
+ }
190
+ }
191
+ if (specificArgs.existingProfilePictureTopicId !== undefined) {
192
+ params.existingProfilePictureTopicId =
193
+ specificArgs.existingProfilePictureTopicId;
194
+ }
195
+ if (specificArgs.userAccountId !== undefined) {
196
+ params.userAccountId = specificArgs.userAccountId;
197
+ }
198
+ if (specificArgs.hbarFee !== undefined) {
199
+ params.hbarFee = specificArgs.hbarFee;
200
+ }
201
+ if (specificArgs.tokenFees !== undefined) {
202
+ params.tokenFees = specificArgs.tokenFees;
203
+ }
204
+ if (specificArgs.exemptAccountIds !== undefined) {
205
+ params.exemptAccountIds = specificArgs.exemptAccountIds;
206
+ }
207
+ if (specificArgs.initialBalance !== undefined) {
208
+ params.initialBalance = specificArgs.initialBalance;
209
+ }
210
+
211
+ await hcs10Builder.registerAgent(params);
212
+ }
213
+ }
@@ -0,0 +1,61 @@
1
+ import { z } from 'zod';
2
+ import { BaseHCS10QueryTool } from './base-hcs10-tools';
3
+ import { HCS10QueryToolParams } from './hcs10-tool-params';
4
+ const RetrieveProfileZodSchema = z.object({
5
+ accountId: z
6
+ .string()
7
+ .describe(
8
+ 'The Hedera account ID of the agent whose profile you want to retrieve (e.g., 0.0.12345).'
9
+ ),
10
+ disableCache: z
11
+ .boolean()
12
+ .optional()
13
+ .describe(
14
+ 'Optional: Force refresh from the network instead of using cache.'
15
+ ),
16
+ });
17
+
18
+ /**
19
+ * Tool to retrieve detailed profile information for a specific HCS-10 agent
20
+ */
21
+ export class RetrieveProfileTool extends BaseHCS10QueryTool<
22
+ typeof RetrieveProfileZodSchema
23
+ > {
24
+ name = 'retrieve_profile';
25
+ description =
26
+ 'Gets the detailed profile information for a specific HCS-10 agent by their account ID. Returns name, bio, capabilities, topics, and other metadata.';
27
+ specificInputSchema = RetrieveProfileZodSchema;
28
+ constructor(params: HCS10QueryToolParams) {
29
+ super(params);
30
+ }
31
+
32
+ protected async executeQuery({
33
+ accountId,
34
+ disableCache,
35
+ }: z.infer<typeof RetrieveProfileZodSchema>): Promise<unknown> {
36
+ const hcs10Builder = this.hcs10Builder;
37
+ const params: { accountId: string; disableCache?: boolean } = {
38
+ accountId,
39
+ };
40
+ if (disableCache !== undefined) {
41
+ params.disableCache = disableCache;
42
+ }
43
+ await hcs10Builder.retrieveProfile(params);
44
+
45
+ const result = await hcs10Builder.execute();
46
+
47
+ if (result.success && 'rawResult' in result && result.rawResult) {
48
+ const raw = result.rawResult as {
49
+ profileDetails?: string;
50
+ rawProfile?: unknown;
51
+ };
52
+ return {
53
+ success: true,
54
+ data: raw.profileDetails || 'Profile retrieved',
55
+ rawProfile: raw.rawProfile,
56
+ };
57
+ }
58
+
59
+ return result;
60
+ }
61
+ }
@@ -0,0 +1,45 @@
1
+ import { z } from 'zod';
2
+ import { BaseHCS10TransactionTool } from './base-hcs10-tools';
3
+ import { HCS10Builder } from '../../builders/hcs10/hcs10-builder';
4
+ import { HCS10TransactionToolParams } from './hcs10-tool-params';
5
+ import { BaseServiceBuilder } from 'hedera-agent-kit';
6
+
7
+ const SendMessageToConnectionZodSchema = z.object({
8
+ targetIdentifier: z
9
+ .string()
10
+ .describe(
11
+ "The request key (e.g., 'req-1:0.0.6155171@0.0.6154875'), account ID (e.g., 0.0.12345) of the target agent, OR the connection number (e.g., '1', '2') from the 'list_connections' tool. Request key is most deterministic."
12
+ ),
13
+ message: z.string().describe('The text message content to send.'),
14
+ disableMonitoring: z.boolean().optional().default(false),
15
+ });
16
+
17
+ /**
18
+ * A tool to send a message to an agent over an established HCS-10 connection.
19
+ */
20
+ export class SendMessageToConnectionTool extends BaseHCS10TransactionTool<
21
+ typeof SendMessageToConnectionZodSchema
22
+ > {
23
+ name = 'send_message_to_connection';
24
+ description =
25
+ "Sends a text message to another agent using an existing active connection. Identify the target agent using their account ID (e.g., 0.0.12345) or the connection number shown in 'list_connections'. Return back the reply from the target agent if possible";
26
+ specificInputSchema = SendMessageToConnectionZodSchema;
27
+ constructor(params: HCS10TransactionToolParams) {
28
+ super(params);
29
+ this.requiresMultipleTransactions = true;
30
+ this.neverScheduleThisTool = true;
31
+ }
32
+
33
+ protected async callBuilderMethod(
34
+ builder: BaseServiceBuilder,
35
+ specificArgs: z.infer<typeof SendMessageToConnectionZodSchema>
36
+ ): Promise<void> {
37
+ const hcs10Builder = builder as HCS10Builder;
38
+
39
+ await hcs10Builder.sendMessageToConnection({
40
+ targetIdentifier: specificArgs.targetIdentifier,
41
+ message: specificArgs.message,
42
+ disableMonitoring: specificArgs.disableMonitoring,
43
+ });
44
+ }
45
+ }
@@ -0,0 +1,65 @@
1
+ import {
2
+ BaseHederaTransactionTool,
3
+ BaseHederaQueryTool,
4
+ BaseServiceBuilder,
5
+ } from 'hedera-agent-kit';
6
+ import { HCS10Builder } from '../../builders/hcs10/hcs10-builder';
7
+ import {
8
+ HCS10TransactionToolParams,
9
+ HCS10QueryToolParams,
10
+ } from './hcs10-tool-params';
11
+ import { z } from 'zod';
12
+
13
+ /**
14
+ * Base class for HCS10 transaction tools
15
+ */
16
+ export abstract class BaseHCS10TransactionTool<
17
+ T extends z.ZodObject<
18
+ z.ZodRawShape,
19
+ z.UnknownKeysParam,
20
+ z.ZodTypeAny
21
+ > = z.ZodObject<z.ZodRawShape>
22
+ > extends BaseHederaTransactionTool<T> {
23
+ protected hcs10Builder: HCS10Builder;
24
+ namespace = 'hcs10' as const;
25
+
26
+ constructor(params: HCS10TransactionToolParams) {
27
+ super(params);
28
+ this.hcs10Builder = params.hcs10Builder;
29
+ }
30
+
31
+ /**
32
+ * Override to return the HCS10Builder
33
+ */
34
+ protected getServiceBuilder(): BaseServiceBuilder {
35
+ return this.hcs10Builder;
36
+ }
37
+ }
38
+
39
+ /**
40
+ * Base class for HCS10 query tools
41
+ */
42
+ export abstract class BaseHCS10QueryTool<
43
+ T extends z.ZodObject<
44
+ z.ZodRawShape,
45
+ z.UnknownKeysParam,
46
+ z.ZodTypeAny,
47
+ Record<string, unknown>,
48
+ Record<string, unknown>
49
+ > = z.ZodObject<z.ZodRawShape>
50
+ > extends BaseHederaQueryTool<T> {
51
+ protected hcs10Builder: HCS10Builder;
52
+ namespace = 'hcs10' as const;
53
+
54
+ constructor(params: HCS10QueryToolParams) {
55
+ super(params);
56
+ this.hcs10Builder = params.hcs10Builder;
57
+ }
58
+
59
+ /**
60
+ * Override to return the HCS10Builder
61
+ */
62
+ protected getServiceBuilder(): BaseServiceBuilder {
63
+ return this.hcs10Builder;
64
+ }
65
+ }
@@ -0,0 +1,21 @@
1
+ import { HederaAgentKit } from 'hedera-agent-kit';
2
+ import type { BasePluginContext } from 'hedera-agent-kit';
3
+ import { HCS10Builder } from '../../builders/hcs10/hcs10-builder';
4
+
5
+ /**
6
+ * Parameters for HCS10 transaction tools
7
+ */
8
+ export interface HCS10TransactionToolParams {
9
+ hederaKit: HederaAgentKit;
10
+ hcs10Builder: HCS10Builder;
11
+ logger?: BasePluginContext['logger'];
12
+ }
13
+
14
+ /**
15
+ * Parameters for HCS10 query tools
16
+ */
17
+ export interface HCS10QueryToolParams {
18
+ hederaKit: HederaAgentKit;
19
+ hcs10Builder: HCS10Builder;
20
+ logger?: BasePluginContext['logger'];
21
+ }
@@ -0,0 +1,13 @@
1
+ export * from './base-hcs10-tools';
2
+ export * from './hcs10-tool-params';
3
+ export * from './RegisterAgentTool';
4
+ export * from './SendMessageToConnectionTool';
5
+ export * from './InitiateConnectionTool';
6
+ export * from './ListConnectionsTool';
7
+ export * from './CheckMessagesTool';
8
+ export * from './FindRegistrationsTool';
9
+ export * from './ConnectionMonitorTool';
10
+ export * from './ManageConnectionRequestsTool';
11
+ export * from './AcceptConnectionRequestTool';
12
+ export * from './RetrieveProfileTool';
13
+ export * from './ListUnapprovedConnectionRequestsTool';
@@ -1,13 +1,2 @@
1
- export * from './RegisterAgentTool';
2
- export * from './SendMessageTool';
3
- export * from './ConnectionTool';
4
- export * from './SendMessageToConnectionTool';
5
- export * from './InitiateConnectionTool';
6
- export * from './ListConnectionsTool';
7
- export * from './CheckMessagesTool';
8
- export * from './FindRegistrationsTool';
9
- export * from './ConnectionMonitorTool';
10
- export * from './ManageConnectionRequestsTool';
11
- export * from './AcceptConnectionRequestTool';
12
- export * from './RetrieveProfileTool';
13
- export * from './ListUnapprovedConnectionRequestsTool';
1
+ // Export all HCS10 tools from the subdirectory
2
+ export * from './hcs10';
@@ -44,9 +44,9 @@ export class HederaClient {
44
44
  .setStartTime(0);
45
45
 
46
46
  try {
47
- const subscription = query.subscribe(
47
+ query.subscribe(
48
48
  this.client,
49
- (message: TopicMessage | null, error: Error) => {
49
+ (_message: TopicMessage | null, error: Error) => {
50
50
  if (error) {
51
51
  onError(error);
52
52
  }
@@ -1,5 +1,4 @@
1
- import { Hbar } from "@hashgraph/sdk";
2
- import { TransferTransaction } from "@hashgraph/sdk";
1
+ import { Hbar, TransferTransaction, Client } from "@hashgraph/sdk";
3
2
  import { Logger, HCS10Client, HederaMirrorNode } from "@hashgraphonline/standards-sdk";
4
3
 
5
4
  export const MIN_REQUIRED_USD = 2.0;
@@ -60,9 +59,9 @@ export async function ensureAgentHasEnoughHbar(
60
59
  );
61
60
 
62
61
  const fundTxResponse = await transferTx.execute(
63
- baseClient.getClient() as any
62
+ baseClient.getClient() as Client
64
63
  );
65
- await fundTxResponse.getReceipt(baseClient.getClient() as any);
64
+ await fundTxResponse.getReceipt(baseClient.getClient() as Client);
66
65
  logger.info(
67
66
  `Successfully funded ${agentName} account ${accountId}.`
68
67
  );
File without changes