@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
@@ -1,129 +1,47 @@
1
- import { StructuredTool } from "@langchain/core/tools";
2
1
  import { z } from "zod";
3
- import { Logger } from "@hashgraphonline/standards-sdk";
4
- class CheckMessagesTool extends StructuredTool {
5
- constructor({ hcsClient, stateManager, ...rest }) {
6
- super(rest);
2
+ import { BaseHCS10QueryTool } from "./standards-agent-kit.es4.js";
3
+ const CheckMessagesZodSchema = z.object({
4
+ targetIdentifier: z.string().describe(
5
+ "The account ID (e.g., 0.0.12345) of the target agent OR the connection number (e.g., '1', '2') from the 'list_connections' tool to check messages for."
6
+ ),
7
+ fetchLatest: z.boolean().optional().default(false).describe(
8
+ "Set to true to fetch the latest messages even if they have been seen before, ignoring the last checked timestamp. Defaults to false (fetching only new messages)."
9
+ ),
10
+ lastMessagesCount: z.number().int().positive().optional().describe(
11
+ "When fetchLatest is true, specifies how many of the most recent messages to retrieve. Defaults to 1."
12
+ )
13
+ });
14
+ class CheckMessagesTool extends BaseHCS10QueryTool {
15
+ constructor(params) {
16
+ super(params);
7
17
  this.name = "check_messages";
8
- this.description = `Checks for and retrieves messages from an active connection.
9
- Identify the target agent using their account ID (e.g., 0.0.12345) or the connection number shown in 'list_connections'.
10
- By default, it only retrieves messages newer than the last check.
11
- Use 'fetchLatest: true' to get the most recent messages regardless of when they arrived.
18
+ this.description = `Checks for and retrieves messages from an active connection.
19
+ Identify the target agent using their account ID (e.g., 0.0.12345) or the connection number shown in 'list_connections'.
20
+ By default, it only retrieves messages newer than the last check.
21
+ Use 'fetchLatest: true' to get the most recent messages regardless of when they arrived.
12
22
  Use 'lastMessagesCount' to specify how many latest messages to retrieve (default 1 when fetchLatest is true).`;
13
- this.schema = z.object({
14
- targetIdentifier: z.string().describe(
15
- "The account ID (e.g., 0.0.12345) of the target agent OR the connection number (e.g., '1', '2') from the 'list_connections' tool to check messages for."
16
- ),
17
- fetchLatest: z.boolean().optional().default(false).describe(
18
- "Set to true to fetch the latest messages even if they have been seen before, ignoring the last checked timestamp. Defaults to false (fetching only new messages)."
19
- ),
20
- lastMessagesCount: z.number().int().positive().optional().describe(
21
- "When fetchLatest is true, specifies how many of the most recent messages to retrieve. Defaults to 1."
22
- )
23
- });
24
- this.hcsClient = hcsClient;
25
- this.stateManager = stateManager;
26
- this.logger = Logger.getInstance({ module: "CheckMessagesTool" });
23
+ this.specificInputSchema = CheckMessagesZodSchema;
27
24
  }
28
- async _call({
25
+ async executeQuery({
29
26
  targetIdentifier,
30
27
  fetchLatest,
31
28
  lastMessagesCount
32
29
  }) {
33
- const connection = this.stateManager.getConnectionByIdentifier(targetIdentifier);
34
- if (!connection) {
35
- return `Error: Could not find an active connection matching identifier "${targetIdentifier}". Use 'list_connections' to see active connections.`;
36
- }
37
- const connectionTopicId = connection.connectionTopicId;
38
- const targetAgentName = connection.targetAgentName;
39
- const lastProcessedTimestamp = this.stateManager.getLastTimestamp(connectionTopicId);
40
- this.logger.info(
41
- `Checking messages for connection with ${targetAgentName} (${connection.targetAccountId}) on topic ${connectionTopicId} (fetchLatest: ${fetchLatest}, lastCount: ${lastMessagesCount}, since: ${lastProcessedTimestamp})`
42
- );
43
- try {
44
- const result = await this.hcsClient.getMessages(connectionTopicId);
45
- const allMessages = result.messages;
46
- if (!allMessages || allMessages.length === 0) {
47
- return `No messages found on connection topic ${connectionTopicId}.`;
48
- }
49
- let messagesToProcess = [];
50
- let latestTimestampNanos = lastProcessedTimestamp;
51
- const isFetchingLatest = fetchLatest === true;
52
- if (isFetchingLatest) {
53
- this.logger.info("Fetching latest messages regardless of timestamp.");
54
- const count = lastMessagesCount ?? 1;
55
- messagesToProcess = allMessages.slice(-count);
56
- } else {
57
- this.logger.info(
58
- `Filtering for messages newer than ${lastProcessedTimestamp}`
59
- );
60
- messagesToProcess = allMessages.filter((msg) => {
61
- const msgTimestampNanos = msg.timestamp * 1e6;
62
- return msgTimestampNanos > lastProcessedTimestamp;
63
- });
64
- if (messagesToProcess.length > 0) {
65
- latestTimestampNanos = messagesToProcess.reduce(
66
- (maxTs, msg) => Math.max(maxTs, msg.timestamp * 1e6),
67
- lastProcessedTimestamp
68
- );
69
- }
70
- }
71
- if (messagesToProcess.length === 0) {
72
- return isFetchingLatest ? `Could not retrieve the latest message(s). No messages found on topic ${connectionTopicId}.` : `No new messages found for connection with ${targetAgentName} since last check.`;
73
- }
74
- this.logger.info(`Processing ${messagesToProcess.length} message(s).`);
75
- let outputString = isFetchingLatest ? `Latest message(s) from ${targetAgentName}:
76
- ` : `New messages from ${targetAgentName}:
77
- `;
78
- for (const msg of messagesToProcess) {
79
- let content = msg.data;
80
- try {
81
- if (typeof content === "string" && content.startsWith("hcs://")) {
82
- this.logger.debug(`Resolving inscribed message: ${content}`);
83
- content = await this.hcsClient.getMessageContent(content);
84
- this.logger.debug(`Resolved content length: ${content?.length}`);
85
- }
86
- let displayContent = content;
87
- try {
88
- const parsed = JSON.parse(content || "{}");
89
- if (parsed.p === "hcs-10" && parsed.op === "message" && parsed.data) {
90
- const senderOpId = parsed.operator_id || "unknown_sender";
91
- displayContent = `[${senderOpId}]: ${parsed.data}`;
92
- } else {
93
- displayContent = content;
94
- }
95
- } catch (parseError) {
96
- displayContent = content;
97
- }
98
- const messageDate = new Date(msg.timestamp);
99
- outputString += `
100
- [${messageDate.toLocaleString()}] (Seq: ${msg.sequence_number})
101
- ${displayContent}
102
- `;
103
- } catch (error) {
104
- const errorMsg = `Error processing message (Seq: ${msg.sequence_number}): ${error instanceof Error ? error.message : String(error)}`;
105
- this.logger.error(errorMsg);
106
- outputString += `
107
- [Error processing message Seq: ${msg.sequence_number}]
108
- `;
109
- }
110
- }
111
- if (!isFetchingLatest && latestTimestampNanos > lastProcessedTimestamp) {
112
- this.logger.debug(
113
- `Updating timestamp for topic ${connectionTopicId} to ${latestTimestampNanos}`
114
- );
115
- this.stateManager.updateTimestamp(
116
- connectionTopicId,
117
- latestTimestampNanos
118
- );
119
- }
120
- return outputString.trim();
121
- } catch (error) {
122
- this.logger.error(
123
- `Failed to check messages for topic ${connectionTopicId}: ${error}`
124
- );
125
- return `Error checking messages for ${targetAgentName}: ${error instanceof Error ? error.message : String(error)}`;
30
+ const hcs10Builder = this.hcs10Builder;
31
+ await hcs10Builder.checkMessages({
32
+ targetIdentifier,
33
+ fetchLatest,
34
+ lastMessagesCount: lastMessagesCount || 1
35
+ });
36
+ const result = await hcs10Builder.execute();
37
+ if (result.success && "rawResult" in result && result.rawResult) {
38
+ const raw = result.rawResult;
39
+ return {
40
+ success: true,
41
+ data: raw.formattedOutput || raw.message || "Messages checked"
42
+ };
126
43
  }
44
+ return result;
127
45
  }
128
46
  }
129
47
  export {
@@ -1 +1 @@
1
- {"version":3,"file":"standards-agent-kit.es9.js","sources":["../../src/tools/CheckMessagesTool.ts"],"sourcesContent":["import { StructuredTool, ToolParams } from '@langchain/core/tools';\nimport { z } from 'zod';\nimport { HCS10Client, HCSMessageWithTimestamp } from '../hcs10/HCS10Client';\nimport { IStateManager } from '../state/state-types';\nimport { Logger } from '@hashgraphonline/standards-sdk'; // Assuming logger utility\n\nexport interface CheckMessagesToolParams extends ToolParams {\n hcsClient: HCS10Client;\n stateManager: IStateManager;\n}\n\n/**\n * A tool to check for new messages on an active HCS-10 connection topic,\n * or optionally fetch the latest messages regardless of timestamp.\n */\nexport class CheckMessagesTool extends StructuredTool {\n name = 'check_messages';\n description = `Checks for and retrieves messages from an active connection. \nIdentify the target agent using their account ID (e.g., 0.0.12345) or the connection number shown in 'list_connections'. \nBy default, it only retrieves messages newer than the last check. \nUse 'fetchLatest: true' to get the most recent messages regardless of when they arrived. \nUse 'lastMessagesCount' to specify how many latest messages to retrieve (default 1 when fetchLatest is true).`;\n schema = z.object({\n targetIdentifier: z\n .string()\n .describe(\n \"The account ID (e.g., 0.0.12345) of the target agent OR the connection number (e.g., '1', '2') from the 'list_connections' tool to check messages for.\"\n ),\n fetchLatest: z\n .boolean()\n .optional()\n .default(false)\n .describe(\n 'Set to true to fetch the latest messages even if they have been seen before, ignoring the last checked timestamp. Defaults to false (fetching only new messages).'\n ),\n lastMessagesCount: z\n .number()\n .int()\n .positive()\n .optional()\n .describe(\n 'When fetchLatest is true, specifies how many of the most recent messages to retrieve. Defaults to 1.'\n ),\n });\n\n public hcsClient: HCS10Client;\n private stateManager: IStateManager;\n private logger: Logger;\n\n constructor({ hcsClient, stateManager, ...rest }: CheckMessagesToolParams) {\n super(rest);\n this.hcsClient = hcsClient;\n this.stateManager = stateManager;\n this.logger = Logger.getInstance({ module: 'CheckMessagesTool' });\n }\n\n protected async _call({\n targetIdentifier,\n fetchLatest,\n lastMessagesCount,\n }: z.infer<this['schema']>): Promise<string> {\n const connection =\n this.stateManager.getConnectionByIdentifier(targetIdentifier);\n\n if (!connection) {\n return `Error: Could not find an active connection matching identifier \"${targetIdentifier}\". Use 'list_connections' to see active connections.`;\n }\n\n const connectionTopicId = connection.connectionTopicId;\n const targetAgentName = connection.targetAgentName;\n const lastProcessedTimestamp =\n this.stateManager.getLastTimestamp(connectionTopicId);\n\n this.logger.info(\n `Checking messages for connection with ${targetAgentName} (${connection.targetAccountId}) on topic ${connectionTopicId} (fetchLatest: ${fetchLatest}, lastCount: ${lastMessagesCount}, since: ${lastProcessedTimestamp})`\n );\n\n try {\n // 1. Get messages from the topic\n const result = await this.hcsClient.getMessages(connectionTopicId);\n const allMessages = result.messages;\n\n if (!allMessages || allMessages.length === 0) {\n return `No messages found on connection topic ${connectionTopicId}.`;\n }\n\n let messagesToProcess: HCSMessageWithTimestamp[] = [];\n let latestTimestampNanos = lastProcessedTimestamp;\n const isFetchingLatest = fetchLatest === true;\n\n if (isFetchingLatest) {\n this.logger.info('Fetching latest messages regardless of timestamp.');\n const count = lastMessagesCount ?? 1;\n messagesToProcess = allMessages.slice(-count);\n } else {\n this.logger.info(\n `Filtering for messages newer than ${lastProcessedTimestamp}`\n );\n messagesToProcess = allMessages.filter((msg) => {\n const msgTimestampNanos = msg.timestamp * 1_000_000;\n return msgTimestampNanos > lastProcessedTimestamp;\n });\n \n if (messagesToProcess.length > 0) {\n latestTimestampNanos = messagesToProcess.reduce(\n (maxTs, msg) => Math.max(maxTs, msg.timestamp * 1_000_000),\n lastProcessedTimestamp\n );\n }\n }\n\n if (messagesToProcess.length === 0) {\n return isFetchingLatest\n ? `Could not retrieve the latest message(s). No messages found on topic ${connectionTopicId}.`\n : `No new messages found for connection with ${targetAgentName} since last check.`;\n }\n\n this.logger.info(`Processing ${messagesToProcess.length} message(s).`);\n\n // 3. Process messages (resolve inscriptions, format)\n let outputString = isFetchingLatest\n ? `Latest message(s) from ${targetAgentName}:\n`\n : `New messages from ${targetAgentName}:\n`;\n\n for (const msg of messagesToProcess) {\n let content = msg.data;\n try {\n // Check for inscription HRL\n if (typeof content === 'string' && content.startsWith('hcs://')) {\n this.logger.debug(`Resolving inscribed message: ${content}`);\n content = await this.hcsClient.getMessageContent(content);\n this.logger.debug(`Resolved content length: ${content?.length}`);\n }\n\n // Attempt to parse the content as the HCS-10 structure\n let displayContent = content; // Default to raw content\n try {\n const parsed = JSON.parse(content || '{}');\n if (\n parsed.p === 'hcs-10' &&\n parsed.op === 'message' &&\n parsed.data\n ) {\n // Extract sender and actual data from standard message format\n const senderOpId = parsed.operator_id || 'unknown_sender';\n displayContent = `[${senderOpId}]: ${parsed.data}`;\n } else {\n // If not standard format, maybe just show raw stringified version\n displayContent = content; // Keep raw if parsing worked but not expected format\n }\n } catch (parseError) {\n // Content wasn't JSON, keep raw content\n displayContent = content;\n }\n\n const messageDate = new Date(msg.timestamp);\n outputString += `\\n[${messageDate.toLocaleString()}] (Seq: ${\n msg.sequence_number\n })\n${displayContent}\n`;\n } catch (error) {\n const errorMsg = `Error processing message (Seq: ${\n msg.sequence_number\n }): ${error instanceof Error ? error.message : String(error)}`;\n this.logger.error(errorMsg);\n outputString += `\\n[Error processing message Seq: ${msg.sequence_number}]\\n`;\n }\n }\n\n // 4. Update the timestamp in demo state ONLY if fetching NEW messages\n if (!isFetchingLatest && latestTimestampNanos > lastProcessedTimestamp) {\n this.logger.debug(\n `Updating timestamp for topic ${connectionTopicId} to ${latestTimestampNanos}`\n );\n this.stateManager.updateTimestamp(\n connectionTopicId,\n latestTimestampNanos\n );\n }\n\n return outputString.trim();\n } catch (error) {\n this.logger.error(\n `Failed to check messages for topic ${connectionTopicId}: ${error}`\n );\n return `Error checking messages for ${targetAgentName}: ${\n error instanceof Error ? error.message : String(error)\n }`;\n }\n }\n}\n"],"names":[],"mappings":"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"}
1
+ {"version":3,"file":"standards-agent-kit.es9.js","sources":["../../src/tools/hcs10/CheckMessagesTool.ts"],"sourcesContent":["import { z } from 'zod';\nimport { BaseHCS10QueryTool } from './base-hcs10-tools';\nimport { HCS10QueryToolParams } from './hcs10-tool-params';\n\n/**\n * A tool to check for new messages on an active HCS-10 connection topic,\n * or optionally fetch the latest messages regardless of timestamp.\n */\nconst CheckMessagesZodSchema = z.object({\n targetIdentifier: z\n .string()\n .describe(\n \"The account ID (e.g., 0.0.12345) of the target agent OR the connection number (e.g., '1', '2') from the 'list_connections' tool to check messages for.\"\n ),\n fetchLatest: z\n .boolean()\n .optional()\n .default(false)\n .describe(\n 'Set to true to fetch the latest messages even if they have been seen before, ignoring the last checked timestamp. Defaults to false (fetching only new messages).'\n ),\n lastMessagesCount: z\n .number()\n .int()\n .positive()\n .optional()\n .describe(\n 'When fetchLatest is true, specifies how many of the most recent messages to retrieve. Defaults to 1.'\n ),\n});\n\nexport class CheckMessagesTool extends BaseHCS10QueryTool<\n typeof CheckMessagesZodSchema\n> {\n name = 'check_messages';\n description = `Checks for and retrieves messages from an active connection.\nIdentify the target agent using their account ID (e.g., 0.0.12345) or the connection number shown in 'list_connections'.\nBy default, it only retrieves messages newer than the last check.\nUse 'fetchLatest: true' to get the most recent messages regardless of when they arrived.\nUse 'lastMessagesCount' to specify how many latest messages to retrieve (default 1 when fetchLatest is true).`;\n specificInputSchema = CheckMessagesZodSchema;\n constructor(params: HCS10QueryToolParams) {\n super(params);\n }\n\n protected async executeQuery({\n targetIdentifier,\n fetchLatest,\n lastMessagesCount,\n }: z.infer<typeof CheckMessagesZodSchema>): Promise<unknown> {\n const hcs10Builder = this.hcs10Builder;\n await hcs10Builder.checkMessages({\n targetIdentifier,\n fetchLatest,\n lastMessagesCount: lastMessagesCount || 1,\n });\n\n const result = await hcs10Builder.execute();\n\n if (result.success && 'rawResult' in result && result.rawResult) {\n const raw = result.rawResult as {\n formattedOutput?: string;\n message?: string;\n };\n return {\n success: true,\n data: raw.formattedOutput || raw.message || 'Messages checked',\n };\n }\n\n return result;\n }\n}"],"names":[],"mappings":";;AAQA,MAAM,yBAAyB,EAAE,OAAO;AAAA,EACtC,kBAAkB,EACf,OAAA,EACA;AAAA,IACC;AAAA,EAAA;AAAA,EAEJ,aAAa,EACV,QAAA,EACA,WACA,QAAQ,KAAK,EACb;AAAA,IACC;AAAA,EAAA;AAAA,EAEJ,mBAAmB,EAChB,SACA,MACA,SAAA,EACA,SAAA,EACA;AAAA,IACC;AAAA,EAAA;AAEN,CAAC;AAEM,MAAM,0BAA0B,mBAErC;AAAA,EAQA,YAAY,QAA8B;AACxC,UAAM,MAAM;AARd,SAAA,OAAO;AACP,SAAA,cAAc;AAAA;AAAA;AAAA;AAAA;AAKd,SAAA,sBAAsB;AAAA,EAGtB;AAAA,EAEA,MAAgB,aAAa;AAAA,IAC3B;AAAA,IACA;AAAA,IACA;AAAA,EAAA,GAC2D;AAC3D,UAAM,eAAe,KAAK;AAC1B,UAAM,aAAa,cAAc;AAAA,MAC/B;AAAA,MACA;AAAA,MACA,mBAAmB,qBAAqB;AAAA,IAAA,CACzC;AAED,UAAM,SAAS,MAAM,aAAa,QAAA;AAElC,QAAI,OAAO,WAAW,eAAe,UAAU,OAAO,WAAW;AAC/D,YAAM,MAAM,OAAO;AAInB,aAAO;AAAA,QACL,SAAS;AAAA,QACT,MAAM,IAAI,mBAAmB,IAAI,WAAW;AAAA,MAAA;AAAA,IAEhD;AAEA,WAAO;AAAA,EACT;AACF;"}
@@ -86,7 +86,7 @@ export interface IStateManager {
86
86
  /**
87
87
  * Sets the current active agent, clearing any previous connections.
88
88
  */
89
- setCurrentAgent(agent: RegisteredAgent | null): void;
89
+ setCurrentAgent(_agent: RegisteredAgent | null): void;
90
90
  /**
91
91
  * Gets the current active agent.
92
92
  */
@@ -95,12 +95,12 @@ export interface IStateManager {
95
95
  * Adds a new active connection to the state.
96
96
  * Will not add duplicates based on connectionTopicId.
97
97
  */
98
- addActiveConnection(connection: ActiveConnection): void;
98
+ addActiveConnection(_connection: ActiveConnection): void;
99
99
  /**
100
100
  * Updates an existing connection or adds it if not found.
101
101
  * Preserves existing properties when updating.
102
102
  */
103
- updateOrAddConnection(connection: ActiveConnection): void;
103
+ updateOrAddConnection(_connection: ActiveConnection): void;
104
104
  /**
105
105
  * Lists all active connections for the current agent.
106
106
  */
@@ -111,26 +111,26 @@ export interface IStateManager {
111
111
  * - A target account ID
112
112
  * - A connection topic ID
113
113
  */
114
- getConnectionByIdentifier(identifier: string): ActiveConnection | undefined;
114
+ getConnectionByIdentifier(_identifier: string): ActiveConnection | undefined;
115
115
  /**
116
116
  * Gets the last processed message timestamp for a connection.
117
117
  */
118
- getLastTimestamp(connectionTopicId: string): number;
118
+ getLastTimestamp(_connectionTopicId: string): number;
119
119
  /**
120
120
  * Updates the last processed message timestamp for a connection.
121
121
  */
122
- updateTimestamp(connectionTopicId: string, timestampNanos: number): void;
122
+ updateTimestamp(_connectionTopicId: string, _timestampNanos: number): void;
123
123
  /**
124
124
  * Persists agent data to storage
125
125
  * Implementation may vary depending on the state manager
126
126
  */
127
- persistAgentData?(agent: RegisteredAgent, options?: AgentPersistenceOptions): Promise<void>;
127
+ persistAgentData?(_agent: RegisteredAgent, _options?: AgentPersistenceOptions): Promise<void>;
128
128
  /**
129
129
  * Initializes the ConnectionsManager with the provided client
130
130
  * @param baseClient - The HCS10BaseClient instance to use
131
131
  * @returns The initialized ConnectionsManager
132
132
  */
133
- initializeConnectionsManager(baseClient: HCS10BaseClient): IConnectionsManager;
133
+ initializeConnectionsManager(_baseClient: HCS10BaseClient): IConnectionsManager;
134
134
  /**
135
135
  * Gets the ConnectionsManager instance
136
136
  * @returns The ConnectionsManager instance or null if not initialized
@@ -0,0 +1,40 @@
1
+ import { z } from 'zod';
2
+ import { BaseHCS10TransactionTool } from './base-hcs10-tools';
3
+ import { HCS10TransactionToolParams } from './hcs10-tool-params';
4
+ import { BaseServiceBuilder } from 'hedera-agent-kit';
5
+ declare const AcceptConnectionRequestZodSchema: z.ZodObject<{
6
+ requestKey: z.ZodString;
7
+ hbarFee: z.ZodOptional<z.ZodNumber>;
8
+ exemptAccountIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
9
+ }, "strip", z.ZodTypeAny, {
10
+ requestKey: string;
11
+ exemptAccountIds?: string[] | undefined;
12
+ hbarFee?: number | undefined;
13
+ }, {
14
+ requestKey: string;
15
+ exemptAccountIds?: string[] | undefined;
16
+ hbarFee?: number | undefined;
17
+ }>;
18
+ /**
19
+ * Tool for accepting incoming HCS-10 connection requests
20
+ */
21
+ export declare class AcceptConnectionRequestTool extends BaseHCS10TransactionTool<typeof AcceptConnectionRequestZodSchema> {
22
+ name: string;
23
+ description: string;
24
+ specificInputSchema: z.ZodObject<{
25
+ requestKey: z.ZodString;
26
+ hbarFee: z.ZodOptional<z.ZodNumber>;
27
+ exemptAccountIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
28
+ }, "strip", z.ZodTypeAny, {
29
+ requestKey: string;
30
+ exemptAccountIds?: string[] | undefined;
31
+ hbarFee?: number | undefined;
32
+ }, {
33
+ requestKey: string;
34
+ exemptAccountIds?: string[] | undefined;
35
+ hbarFee?: number | undefined;
36
+ }>;
37
+ constructor(params: HCS10TransactionToolParams);
38
+ protected callBuilderMethod(builder: BaseServiceBuilder, specificArgs: z.infer<typeof AcceptConnectionRequestZodSchema>): Promise<void>;
39
+ }
40
+ export {};
@@ -0,0 +1,40 @@
1
+ import { z } from 'zod';
2
+ import { BaseHCS10QueryTool } from './base-hcs10-tools';
3
+ import { HCS10QueryToolParams } from './hcs10-tool-params';
4
+ /**
5
+ * A tool to check for new messages on an active HCS-10 connection topic,
6
+ * or optionally fetch the latest messages regardless of timestamp.
7
+ */
8
+ declare const CheckMessagesZodSchema: z.ZodObject<{
9
+ targetIdentifier: z.ZodString;
10
+ fetchLatest: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
11
+ lastMessagesCount: z.ZodOptional<z.ZodNumber>;
12
+ }, "strip", z.ZodTypeAny, {
13
+ targetIdentifier: string;
14
+ fetchLatest: boolean;
15
+ lastMessagesCount?: number | undefined;
16
+ }, {
17
+ targetIdentifier: string;
18
+ fetchLatest?: boolean | undefined;
19
+ lastMessagesCount?: number | undefined;
20
+ }>;
21
+ export declare class CheckMessagesTool extends BaseHCS10QueryTool<typeof CheckMessagesZodSchema> {
22
+ name: string;
23
+ description: string;
24
+ specificInputSchema: z.ZodObject<{
25
+ targetIdentifier: z.ZodString;
26
+ fetchLatest: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
27
+ lastMessagesCount: z.ZodOptional<z.ZodNumber>;
28
+ }, "strip", z.ZodTypeAny, {
29
+ targetIdentifier: string;
30
+ fetchLatest: boolean;
31
+ lastMessagesCount?: number | undefined;
32
+ }, {
33
+ targetIdentifier: string;
34
+ fetchLatest?: boolean | undefined;
35
+ lastMessagesCount?: number | undefined;
36
+ }>;
37
+ constructor(params: HCS10QueryToolParams);
38
+ protected executeQuery({ targetIdentifier, fetchLatest, lastMessagesCount, }: z.infer<typeof CheckMessagesZodSchema>): Promise<unknown>;
39
+ }
40
+ export {};
@@ -0,0 +1,134 @@
1
+ import { z } from 'zod';
2
+ import { BaseHCS10TransactionTool } from './base-hcs10-tools';
3
+ import { HCS10TransactionToolParams } from './hcs10-tool-params';
4
+ import { BaseServiceBuilder } from 'hedera-agent-kit';
5
+ declare const ConnectionMonitorZodSchema: z.ZodObject<{
6
+ acceptAll: z.ZodOptional<z.ZodBoolean>;
7
+ targetAccountId: z.ZodOptional<z.ZodString>;
8
+ hbarFees: z.ZodOptional<z.ZodArray<z.ZodObject<{
9
+ amount: z.ZodNumber;
10
+ collectorAccount: z.ZodOptional<z.ZodString>;
11
+ }, "strip", z.ZodTypeAny, {
12
+ amount: number;
13
+ collectorAccount?: string | undefined;
14
+ }, {
15
+ amount: number;
16
+ collectorAccount?: string | undefined;
17
+ }>, "many">>;
18
+ tokenFees: z.ZodOptional<z.ZodArray<z.ZodObject<{
19
+ amount: z.ZodNumber;
20
+ tokenId: z.ZodString;
21
+ collectorAccount: z.ZodOptional<z.ZodString>;
22
+ }, "strip", z.ZodTypeAny, {
23
+ amount: number;
24
+ tokenId: string;
25
+ collectorAccount?: string | undefined;
26
+ }, {
27
+ amount: number;
28
+ tokenId: string;
29
+ collectorAccount?: string | undefined;
30
+ }>, "many">>;
31
+ exemptAccountIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
32
+ monitorDurationSeconds: z.ZodOptional<z.ZodNumber>;
33
+ defaultCollectorAccount: z.ZodOptional<z.ZodString>;
34
+ }, "strip", z.ZodTypeAny, {
35
+ acceptAll?: boolean | undefined;
36
+ targetAccountId?: string | undefined;
37
+ monitorDurationSeconds?: number | undefined;
38
+ hbarFees?: {
39
+ amount: number;
40
+ collectorAccount?: string | undefined;
41
+ }[] | undefined;
42
+ tokenFees?: {
43
+ amount: number;
44
+ tokenId: string;
45
+ collectorAccount?: string | undefined;
46
+ }[] | undefined;
47
+ exemptAccountIds?: string[] | undefined;
48
+ defaultCollectorAccount?: string | undefined;
49
+ }, {
50
+ acceptAll?: boolean | undefined;
51
+ targetAccountId?: string | undefined;
52
+ monitorDurationSeconds?: number | undefined;
53
+ hbarFees?: {
54
+ amount: number;
55
+ collectorAccount?: string | undefined;
56
+ }[] | undefined;
57
+ tokenFees?: {
58
+ amount: number;
59
+ tokenId: string;
60
+ collectorAccount?: string | undefined;
61
+ }[] | undefined;
62
+ exemptAccountIds?: string[] | undefined;
63
+ defaultCollectorAccount?: string | undefined;
64
+ }>;
65
+ /**
66
+ * A tool for monitoring incoming connection requests and accepting them with optional fee settings.
67
+ */
68
+ export declare class ConnectionMonitorTool extends BaseHCS10TransactionTool<typeof ConnectionMonitorZodSchema> {
69
+ name: string;
70
+ description: string;
71
+ specificInputSchema: z.ZodObject<{
72
+ acceptAll: z.ZodOptional<z.ZodBoolean>;
73
+ targetAccountId: z.ZodOptional<z.ZodString>;
74
+ hbarFees: z.ZodOptional<z.ZodArray<z.ZodObject<{
75
+ amount: z.ZodNumber;
76
+ collectorAccount: z.ZodOptional<z.ZodString>;
77
+ }, "strip", z.ZodTypeAny, {
78
+ amount: number;
79
+ collectorAccount?: string | undefined;
80
+ }, {
81
+ amount: number;
82
+ collectorAccount?: string | undefined;
83
+ }>, "many">>;
84
+ tokenFees: z.ZodOptional<z.ZodArray<z.ZodObject<{
85
+ amount: z.ZodNumber;
86
+ tokenId: z.ZodString;
87
+ collectorAccount: z.ZodOptional<z.ZodString>;
88
+ }, "strip", z.ZodTypeAny, {
89
+ amount: number;
90
+ tokenId: string;
91
+ collectorAccount?: string | undefined;
92
+ }, {
93
+ amount: number;
94
+ tokenId: string;
95
+ collectorAccount?: string | undefined;
96
+ }>, "many">>;
97
+ exemptAccountIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
98
+ monitorDurationSeconds: z.ZodOptional<z.ZodNumber>;
99
+ defaultCollectorAccount: z.ZodOptional<z.ZodString>;
100
+ }, "strip", z.ZodTypeAny, {
101
+ acceptAll?: boolean | undefined;
102
+ targetAccountId?: string | undefined;
103
+ monitorDurationSeconds?: number | undefined;
104
+ hbarFees?: {
105
+ amount: number;
106
+ collectorAccount?: string | undefined;
107
+ }[] | undefined;
108
+ tokenFees?: {
109
+ amount: number;
110
+ tokenId: string;
111
+ collectorAccount?: string | undefined;
112
+ }[] | undefined;
113
+ exemptAccountIds?: string[] | undefined;
114
+ defaultCollectorAccount?: string | undefined;
115
+ }, {
116
+ acceptAll?: boolean | undefined;
117
+ targetAccountId?: string | undefined;
118
+ monitorDurationSeconds?: number | undefined;
119
+ hbarFees?: {
120
+ amount: number;
121
+ collectorAccount?: string | undefined;
122
+ }[] | undefined;
123
+ tokenFees?: {
124
+ amount: number;
125
+ tokenId: string;
126
+ collectorAccount?: string | undefined;
127
+ }[] | undefined;
128
+ exemptAccountIds?: string[] | undefined;
129
+ defaultCollectorAccount?: string | undefined;
130
+ }>;
131
+ constructor(params: HCS10TransactionToolParams);
132
+ protected callBuilderMethod(builder: BaseServiceBuilder, specificArgs: z.infer<typeof ConnectionMonitorZodSchema>): Promise<void>;
133
+ }
134
+ export {};
@@ -0,0 +1,34 @@
1
+ import { z } from 'zod';
2
+ import { AIAgentCapability } from '@hashgraphonline/standards-sdk';
3
+ import { BaseHCS10QueryTool } from './base-hcs10-tools';
4
+ import { HCS10QueryToolParams } from './hcs10-tool-params';
5
+ /**
6
+ * A tool to search for registered HCS-10 agents using the configured registry.
7
+ */
8
+ declare const FindRegistrationsZodSchema: z.ZodObject<{
9
+ accountId: z.ZodOptional<z.ZodString>;
10
+ tags: z.ZodOptional<z.ZodArray<z.ZodNativeEnum<typeof AIAgentCapability>, "many">>;
11
+ }, "strip", z.ZodTypeAny, {
12
+ accountId?: string | undefined;
13
+ tags?: AIAgentCapability[] | undefined;
14
+ }, {
15
+ accountId?: string | undefined;
16
+ tags?: AIAgentCapability[] | undefined;
17
+ }>;
18
+ export declare class FindRegistrationsTool extends BaseHCS10QueryTool<typeof FindRegistrationsZodSchema> {
19
+ name: string;
20
+ description: string;
21
+ specificInputSchema: z.ZodObject<{
22
+ accountId: z.ZodOptional<z.ZodString>;
23
+ tags: z.ZodOptional<z.ZodArray<z.ZodNativeEnum<typeof AIAgentCapability>, "many">>;
24
+ }, "strip", z.ZodTypeAny, {
25
+ accountId?: string | undefined;
26
+ tags?: AIAgentCapability[] | undefined;
27
+ }, {
28
+ accountId?: string | undefined;
29
+ tags?: AIAgentCapability[] | undefined;
30
+ }>;
31
+ constructor(params: HCS10QueryToolParams);
32
+ protected executeQuery({ accountId, tags, }: z.infer<typeof FindRegistrationsZodSchema>): Promise<unknown>;
33
+ }
34
+ export {};
@@ -0,0 +1,43 @@
1
+ import { z } from 'zod';
2
+ import { BaseHCS10TransactionTool } from './base-hcs10-tools';
3
+ import { HCS10TransactionToolParams } from './hcs10-tool-params';
4
+ import { BaseServiceBuilder } from 'hedera-agent-kit';
5
+ declare const InitiateConnectionZodSchema: z.ZodObject<{
6
+ targetAccountId: z.ZodString;
7
+ disableMonitor: z.ZodOptional<z.ZodBoolean>;
8
+ memo: z.ZodOptional<z.ZodString>;
9
+ }, "strip", z.ZodTypeAny, {
10
+ targetAccountId: string;
11
+ disableMonitor?: boolean | undefined;
12
+ memo?: string | undefined;
13
+ }, {
14
+ targetAccountId: string;
15
+ disableMonitor?: boolean | undefined;
16
+ memo?: string | undefined;
17
+ }>;
18
+ /**
19
+ * A tool to actively START a NEW HCS-10 connection TO a target agent.
20
+ * Requires the target agent's account ID.
21
+ * It retrieves their profile, sends a connection request, and optionally waits for confirmation.
22
+ * Use this tool ONLY to actively INITIATE an OUTGOING connection.
23
+ */
24
+ export declare class InitiateConnectionTool extends BaseHCS10TransactionTool<typeof InitiateConnectionZodSchema> {
25
+ name: string;
26
+ description: string;
27
+ specificInputSchema: z.ZodObject<{
28
+ targetAccountId: z.ZodString;
29
+ disableMonitor: z.ZodOptional<z.ZodBoolean>;
30
+ memo: z.ZodOptional<z.ZodString>;
31
+ }, "strip", z.ZodTypeAny, {
32
+ targetAccountId: string;
33
+ disableMonitor?: boolean | undefined;
34
+ memo?: string | undefined;
35
+ }, {
36
+ targetAccountId: string;
37
+ disableMonitor?: boolean | undefined;
38
+ memo?: string | undefined;
39
+ }>;
40
+ constructor(params: HCS10TransactionToolParams);
41
+ protected callBuilderMethod(builder: BaseServiceBuilder, specificArgs: z.infer<typeof InitiateConnectionZodSchema>): Promise<void>;
42
+ }
43
+ export {};
@@ -0,0 +1,34 @@
1
+ import { z } from 'zod';
2
+ import { BaseHCS10QueryTool } from './base-hcs10-tools';
3
+ import { HCS10QueryToolParams } from './hcs10-tool-params';
4
+ /**
5
+ * A tool to list currently active HCS-10 connections stored in the state manager.
6
+ * Enhanced to show more details similar to moonscape's implementation.
7
+ */
8
+ declare const ListConnectionsZodSchema: z.ZodObject<{
9
+ includeDetails: z.ZodOptional<z.ZodBoolean>;
10
+ showPending: z.ZodOptional<z.ZodBoolean>;
11
+ }, "strip", z.ZodTypeAny, {
12
+ includeDetails?: boolean | undefined;
13
+ showPending?: boolean | undefined;
14
+ }, {
15
+ includeDetails?: boolean | undefined;
16
+ showPending?: boolean | undefined;
17
+ }>;
18
+ export declare class ListConnectionsTool extends BaseHCS10QueryTool<typeof ListConnectionsZodSchema> {
19
+ name: string;
20
+ description: string;
21
+ specificInputSchema: z.ZodObject<{
22
+ includeDetails: z.ZodOptional<z.ZodBoolean>;
23
+ showPending: z.ZodOptional<z.ZodBoolean>;
24
+ }, "strip", z.ZodTypeAny, {
25
+ includeDetails?: boolean | undefined;
26
+ showPending?: boolean | undefined;
27
+ }, {
28
+ includeDetails?: boolean | undefined;
29
+ showPending?: boolean | undefined;
30
+ }>;
31
+ constructor(params: HCS10QueryToolParams);
32
+ protected executeQuery(args: z.infer<typeof ListConnectionsZodSchema>): Promise<unknown>;
33
+ }
34
+ export {};
@@ -0,0 +1,15 @@
1
+ import { z } from 'zod';
2
+ import { BaseHCS10QueryTool } from './base-hcs10-tools';
3
+ import { HCS10QueryToolParams } from './hcs10-tool-params';
4
+ declare const ListUnapprovedConnectionRequestsZodSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
5
+ /**
6
+ * Lists all connection requests that are not fully established
7
+ */
8
+ export declare class ListUnapprovedConnectionRequestsTool extends BaseHCS10QueryTool<typeof ListUnapprovedConnectionRequestsZodSchema> {
9
+ name: string;
10
+ description: string;
11
+ specificInputSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
12
+ constructor(params: HCS10QueryToolParams);
13
+ protected executeQuery(): Promise<unknown>;
14
+ }
15
+ export {};
@@ -0,0 +1,34 @@
1
+ import { z } from 'zod';
2
+ import { BaseHCS10QueryTool } from './base-hcs10-tools';
3
+ import { HCS10QueryToolParams } from './hcs10-tool-params';
4
+ declare const ManageConnectionRequestsZodSchema: z.ZodObject<{
5
+ action: z.ZodEnum<["list", "view", "reject"]>;
6
+ requestKey: z.ZodOptional<z.ZodString>;
7
+ }, "strip", z.ZodTypeAny, {
8
+ action: "list" | "view" | "reject";
9
+ requestKey?: string | undefined;
10
+ }, {
11
+ action: "list" | "view" | "reject";
12
+ requestKey?: string | undefined;
13
+ }>;
14
+ /**
15
+ * A tool for managing incoming connection requests in a LangChain-compatible way.
16
+ * This tool allows an agent to list, view details of, and reject incoming connection requests.
17
+ */
18
+ export declare class ManageConnectionRequestsTool extends BaseHCS10QueryTool<typeof ManageConnectionRequestsZodSchema> {
19
+ name: string;
20
+ description: string;
21
+ specificInputSchema: z.ZodObject<{
22
+ action: z.ZodEnum<["list", "view", "reject"]>;
23
+ requestKey: z.ZodOptional<z.ZodString>;
24
+ }, "strip", z.ZodTypeAny, {
25
+ action: "list" | "view" | "reject";
26
+ requestKey?: string | undefined;
27
+ }, {
28
+ action: "list" | "view" | "reject";
29
+ requestKey?: string | undefined;
30
+ }>;
31
+ constructor(params: HCS10QueryToolParams);
32
+ protected executeQuery({ action, requestKey, }: z.infer<typeof ManageConnectionRequestsZodSchema>): Promise<unknown>;
33
+ }
34
+ export {};