@hashgraphonline/standards-agent-kit 0.2.136 → 0.2.138

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 (211) hide show
  1. package/README.md +3 -4
  2. package/dist/cjs/builders/hcs10/hcs10-builder.d.ts +1 -0
  3. package/dist/cjs/builders/hcs2/hcs2-builder.d.ts +8 -7
  4. package/dist/cjs/builders/hcs6/hcs6-builder.d.ts +5 -4
  5. package/dist/cjs/builders/inscriber/inscriber-builder.d.ts +32 -1
  6. package/dist/cjs/index.d.ts +4 -0
  7. package/dist/cjs/signing/bytes-registry.d.ts +17 -0
  8. package/dist/cjs/signing/signer-provider.d.ts +45 -0
  9. package/dist/cjs/standards-agent-kit.cjs +1 -1
  10. package/dist/cjs/standards-agent-kit.cjs.map +1 -1
  11. package/dist/cjs/tools/hcs10/InitiateConnectionTool.d.ts +4 -4
  12. package/dist/cjs/tools/hcs2/CreateRegistryTool.d.ts +2 -2
  13. package/dist/cjs/tools/hcs2/DeleteEntryTool.d.ts +2 -2
  14. package/dist/cjs/tools/hcs2/UpdateEntryTool.d.ts +2 -2
  15. package/dist/cjs/tools/hcs6/RegisterDynamicHashinalTool.d.ts +10 -10
  16. package/dist/cjs/tools/hcs6/UpdateDynamicHashinalTool.d.ts +8 -8
  17. package/dist/cjs/tools/inscriber/InscribeFromBufferTool.d.ts +5 -4
  18. package/dist/cjs/tools/inscriber/InscribeFromFileTool.d.ts +2 -2
  19. package/dist/cjs/tools/inscriber/InscribeFromUrlTool.d.ts +4 -4
  20. package/dist/cjs/tools/inscriber/InscribeHashinalTool.d.ts +3 -3
  21. package/dist/cjs/types/inscription-response.d.ts +8 -0
  22. package/dist/cjs/types/tx-results.d.ts +15 -0
  23. package/dist/cjs/utils/CodedError.d.ts +4 -0
  24. package/dist/cjs/utils/inscription-utils.d.ts +21 -0
  25. package/dist/cjs/validation/hip412-schemas.d.ts +2 -2
  26. package/dist/es/builders/hcs10/hcs10-builder.d.ts +1 -0
  27. package/dist/es/builders/hcs2/hcs2-builder.d.ts +8 -7
  28. package/dist/es/builders/hcs6/hcs6-builder.d.ts +5 -4
  29. package/dist/es/builders/inscriber/inscriber-builder.d.ts +32 -1
  30. package/dist/es/index.d.ts +4 -0
  31. package/dist/es/signing/bytes-registry.d.ts +17 -0
  32. package/dist/es/signing/signer-provider.d.ts +45 -0
  33. package/dist/es/standards-agent-kit.es.js +46 -42
  34. package/dist/es/standards-agent-kit.es.js.map +1 -1
  35. package/dist/es/standards-agent-kit.es10.js +24 -83
  36. package/dist/es/standards-agent-kit.es10.js.map +1 -1
  37. package/dist/es/standards-agent-kit.es11.js +224 -20
  38. package/dist/es/standards-agent-kit.es11.js.map +1 -1
  39. package/dist/es/standards-agent-kit.es12.js +78 -27
  40. package/dist/es/standards-agent-kit.es12.js.map +1 -1
  41. package/dist/es/standards-agent-kit.es13.js +26 -36
  42. package/dist/es/standards-agent-kit.es13.js.map +1 -1
  43. package/dist/es/standards-agent-kit.es14.js +17 -39
  44. package/dist/es/standards-agent-kit.es14.js.map +1 -1
  45. package/dist/es/standards-agent-kit.es15.js +36 -58
  46. package/dist/es/standards-agent-kit.es15.js.map +1 -1
  47. package/dist/es/standards-agent-kit.es16.js +45 -18
  48. package/dist/es/standards-agent-kit.es16.js.map +1 -1
  49. package/dist/es/standards-agent-kit.es17.js +53 -16
  50. package/dist/es/standards-agent-kit.es17.js.map +1 -1
  51. package/dist/es/standards-agent-kit.es18.js +18 -28
  52. package/dist/es/standards-agent-kit.es18.js.map +1 -1
  53. package/dist/es/standards-agent-kit.es19.js +26 -12
  54. package/dist/es/standards-agent-kit.es19.js.map +1 -1
  55. package/dist/es/standards-agent-kit.es20.js +38 -136
  56. package/dist/es/standards-agent-kit.es20.js.map +1 -1
  57. package/dist/es/standards-agent-kit.es21.js +13 -24
  58. package/dist/es/standards-agent-kit.es21.js.map +1 -1
  59. package/dist/es/standards-agent-kit.es22.js +136 -39
  60. package/dist/es/standards-agent-kit.es22.js.map +1 -1
  61. package/dist/es/standards-agent-kit.es23.js +25 -41
  62. package/dist/es/standards-agent-kit.es23.js.map +1 -1
  63. package/dist/es/standards-agent-kit.es24.js +49 -31
  64. package/dist/es/standards-agent-kit.es24.js.map +1 -1
  65. package/dist/es/standards-agent-kit.es25.js +34 -18
  66. package/dist/es/standards-agent-kit.es25.js.map +1 -1
  67. package/dist/es/standards-agent-kit.es26.js +35 -19
  68. package/dist/es/standards-agent-kit.es26.js.map +1 -1
  69. package/dist/es/standards-agent-kit.es27.js +45 -32
  70. package/dist/es/standards-agent-kit.es27.js.map +1 -1
  71. package/dist/es/standards-agent-kit.es28.js +54 -25
  72. package/dist/es/standards-agent-kit.es28.js.map +1 -1
  73. package/dist/es/standards-agent-kit.es29.js +35 -23
  74. package/dist/es/standards-agent-kit.es29.js.map +1 -1
  75. package/dist/es/standards-agent-kit.es3.js +41 -1545
  76. package/dist/es/standards-agent-kit.es3.js.map +1 -1
  77. package/dist/es/standards-agent-kit.es30.js +23 -39
  78. package/dist/es/standards-agent-kit.es30.js.map +1 -1
  79. package/dist/es/standards-agent-kit.es31.js +30 -28
  80. package/dist/es/standards-agent-kit.es31.js.map +1 -1
  81. package/dist/es/standards-agent-kit.es32.js +45 -32
  82. package/dist/es/standards-agent-kit.es32.js.map +1 -1
  83. package/dist/es/standards-agent-kit.es33.js +50 -89
  84. package/dist/es/standards-agent-kit.es33.js.map +1 -1
  85. package/dist/es/standards-agent-kit.es34.js +35 -228
  86. package/dist/es/standards-agent-kit.es34.js.map +1 -1
  87. package/dist/es/standards-agent-kit.es35.js +87 -212
  88. package/dist/es/standards-agent-kit.es35.js.map +1 -1
  89. package/dist/es/standards-agent-kit.es36.js +188 -128
  90. package/dist/es/standards-agent-kit.es36.js.map +1 -1
  91. package/dist/es/standards-agent-kit.es37.js +167 -561
  92. package/dist/es/standards-agent-kit.es37.js.map +1 -1
  93. package/dist/es/standards-agent-kit.es38.js +236 -31
  94. package/dist/es/standards-agent-kit.es38.js.map +1 -1
  95. package/dist/es/standards-agent-kit.es39.js +483 -206
  96. package/dist/es/standards-agent-kit.es39.js.map +1 -1
  97. package/dist/es/standards-agent-kit.es4.js +359 -81
  98. package/dist/es/standards-agent-kit.es4.js.map +1 -1
  99. package/dist/es/standards-agent-kit.es40.js +39 -135
  100. package/dist/es/standards-agent-kit.es40.js.map +1 -1
  101. package/dist/es/standards-agent-kit.es41.js +244 -28
  102. package/dist/es/standards-agent-kit.es41.js.map +1 -1
  103. package/dist/es/standards-agent-kit.es42.js +132 -418
  104. package/dist/es/standards-agent-kit.es42.js.map +1 -1
  105. package/dist/es/standards-agent-kit.es43.js +28 -184
  106. package/dist/es/standards-agent-kit.es43.js.map +1 -1
  107. package/dist/es/standards-agent-kit.es44.js +423 -3
  108. package/dist/es/standards-agent-kit.es44.js.map +1 -1
  109. package/dist/es/standards-agent-kit.es45.js +185 -24
  110. package/dist/es/standards-agent-kit.es45.js.map +1 -1
  111. package/dist/es/standards-agent-kit.es46.js +3 -3
  112. package/dist/es/standards-agent-kit.es46.js.map +1 -1
  113. package/dist/es/standards-agent-kit.es47.js +21 -50
  114. package/dist/es/standards-agent-kit.es47.js.map +1 -1
  115. package/dist/es/standards-agent-kit.es48.js +8 -3
  116. package/dist/es/standards-agent-kit.es48.js.map +1 -1
  117. package/dist/es/standards-agent-kit.es49.js +3 -39
  118. package/dist/es/standards-agent-kit.es49.js.map +1 -1
  119. package/dist/es/standards-agent-kit.es5.js +1747 -73
  120. package/dist/es/standards-agent-kit.es5.js.map +1 -1
  121. package/dist/es/standards-agent-kit.es50.js +18 -16
  122. package/dist/es/standards-agent-kit.es50.js.map +1 -1
  123. package/dist/es/standards-agent-kit.es51.js +49 -49
  124. package/dist/es/standards-agent-kit.es51.js.map +1 -1
  125. package/dist/es/standards-agent-kit.es52.js +6 -0
  126. package/dist/es/standards-agent-kit.es52.js.map +1 -0
  127. package/dist/es/standards-agent-kit.es53.js +43 -0
  128. package/dist/es/standards-agent-kit.es53.js.map +1 -0
  129. package/dist/es/standards-agent-kit.es54.js +22 -0
  130. package/dist/es/standards-agent-kit.es54.js.map +1 -0
  131. package/dist/es/standards-agent-kit.es55.js +77 -0
  132. package/dist/es/standards-agent-kit.es55.js.map +1 -0
  133. package/dist/es/standards-agent-kit.es56.js +7 -0
  134. package/dist/es/standards-agent-kit.es56.js.map +1 -0
  135. package/dist/es/standards-agent-kit.es6.js +347 -32
  136. package/dist/es/standards-agent-kit.es6.js.map +1 -1
  137. package/dist/es/standards-agent-kit.es7.js +142 -293
  138. package/dist/es/standards-agent-kit.es7.js.map +1 -1
  139. package/dist/es/standards-agent-kit.es8.js +201 -21
  140. package/dist/es/standards-agent-kit.es8.js.map +1 -1
  141. package/dist/es/standards-agent-kit.es9.js +301 -213
  142. package/dist/es/standards-agent-kit.es9.js.map +1 -1
  143. package/dist/es/tools/hcs10/InitiateConnectionTool.d.ts +4 -4
  144. package/dist/es/tools/hcs2/CreateRegistryTool.d.ts +2 -2
  145. package/dist/es/tools/hcs2/DeleteEntryTool.d.ts +2 -2
  146. package/dist/es/tools/hcs2/UpdateEntryTool.d.ts +2 -2
  147. package/dist/es/tools/hcs6/RegisterDynamicHashinalTool.d.ts +10 -10
  148. package/dist/es/tools/hcs6/UpdateDynamicHashinalTool.d.ts +8 -8
  149. package/dist/es/tools/inscriber/InscribeFromBufferTool.d.ts +5 -4
  150. package/dist/es/tools/inscriber/InscribeFromFileTool.d.ts +2 -2
  151. package/dist/es/tools/inscriber/InscribeFromUrlTool.d.ts +4 -4
  152. package/dist/es/tools/inscriber/InscribeHashinalTool.d.ts +3 -3
  153. package/dist/es/types/inscription-response.d.ts +8 -0
  154. package/dist/es/types/tx-results.d.ts +15 -0
  155. package/dist/es/utils/CodedError.d.ts +4 -0
  156. package/dist/es/utils/inscription-utils.d.ts +21 -0
  157. package/dist/es/validation/hip412-schemas.d.ts +2 -2
  158. package/dist/umd/builders/hcs10/hcs10-builder.d.ts +1 -0
  159. package/dist/umd/builders/hcs2/hcs2-builder.d.ts +8 -7
  160. package/dist/umd/builders/hcs6/hcs6-builder.d.ts +5 -4
  161. package/dist/umd/builders/inscriber/inscriber-builder.d.ts +32 -1
  162. package/dist/umd/index.d.ts +4 -0
  163. package/dist/umd/signing/bytes-registry.d.ts +17 -0
  164. package/dist/umd/signing/signer-provider.d.ts +45 -0
  165. package/dist/umd/standards-agent-kit.umd.js +1 -1
  166. package/dist/umd/standards-agent-kit.umd.js.map +1 -1
  167. package/dist/umd/tools/hcs10/InitiateConnectionTool.d.ts +4 -4
  168. package/dist/umd/tools/hcs2/CreateRegistryTool.d.ts +2 -2
  169. package/dist/umd/tools/hcs2/DeleteEntryTool.d.ts +2 -2
  170. package/dist/umd/tools/hcs2/UpdateEntryTool.d.ts +2 -2
  171. package/dist/umd/tools/hcs6/RegisterDynamicHashinalTool.d.ts +10 -10
  172. package/dist/umd/tools/hcs6/UpdateDynamicHashinalTool.d.ts +8 -8
  173. package/dist/umd/tools/inscriber/InscribeFromBufferTool.d.ts +5 -4
  174. package/dist/umd/tools/inscriber/InscribeFromFileTool.d.ts +2 -2
  175. package/dist/umd/tools/inscriber/InscribeFromUrlTool.d.ts +4 -4
  176. package/dist/umd/tools/inscriber/InscribeHashinalTool.d.ts +3 -3
  177. package/dist/umd/types/inscription-response.d.ts +8 -0
  178. package/dist/umd/types/tx-results.d.ts +15 -0
  179. package/dist/umd/utils/CodedError.d.ts +4 -0
  180. package/dist/umd/utils/inscription-utils.d.ts +21 -0
  181. package/dist/umd/validation/hip412-schemas.d.ts +2 -2
  182. package/package.json +10 -5
  183. package/src/builders/hcs10/hcs10-builder.ts +239 -6
  184. package/src/builders/hcs2/hcs2-builder.ts +302 -9
  185. package/src/builders/hcs6/hcs6-builder.ts +79 -4
  186. package/src/builders/inscriber/inscriber-builder.ts +235 -2
  187. package/src/hcs10/HCS10Client.ts +1 -1
  188. package/src/index.ts +5 -1
  189. package/src/lib/zod-render/schema-extension.ts +0 -1
  190. package/src/signing/bytes-registry.ts +501 -0
  191. package/src/signing/signer-provider.ts +120 -0
  192. package/src/tools/hcs2/CreateRegistryTool.ts +30 -5
  193. package/src/tools/hcs2/DeleteEntryTool.ts +16 -2
  194. package/src/tools/hcs2/MigrateRegistryTool.ts +16 -2
  195. package/src/tools/hcs2/QueryRegistryTool.ts +11 -2
  196. package/src/tools/hcs2/RegisterEntryTool.ts +17 -3
  197. package/src/tools/hcs2/UpdateEntryTool.ts +16 -2
  198. package/src/tools/hcs6/CreateDynamicRegistryTool.ts +17 -3
  199. package/src/tools/hcs6/RegisterDynamicHashinalTool.ts +17 -3
  200. package/src/tools/hcs6/UpdateDynamicHashinalTool.ts +17 -3
  201. package/src/tools/inscriber/InscribeFromBufferTool.ts +126 -21
  202. package/src/tools/inscriber/InscribeFromFileTool.ts +10 -13
  203. package/src/tools/inscriber/InscribeFromUrlTool.ts +15 -11
  204. package/src/tools/inscriber/InscribeHashinalTool.ts +40 -168
  205. package/src/tools/inscriber/RetrieveInscriptionTool.ts +15 -16
  206. package/src/types/inscription-response.ts +27 -0
  207. package/src/types/tx-results.ts +18 -0
  208. package/src/utils/CodedError.ts +8 -0
  209. package/src/utils/Encryption.ts +0 -2
  210. package/src/utils/ensure-agent-has-hbar.ts +4 -5
  211. package/src/utils/inscription-utils.ts +53 -0
@@ -1,332 +1,181 @@
1
- import { HCS10Client as HCS10Client$1, Logger, AgentBuilder, AIAgentCapability, InboundTopicType } from "@hashgraphonline/standards-sdk";
2
- import { encryptMessage } from "./standards-agent-kit.es46.js";
3
- class HCS10Client {
4
- constructor(operatorId, operatorPrivateKey, network, options) {
5
- this.standardClient = new HCS10Client$1({
6
- network,
7
- operatorId,
8
- operatorPrivateKey,
9
- guardedRegistryBaseUrl: options?.registryUrl,
10
- logLevel: options?.logLevel
11
- });
12
- this.guardedRegistryBaseUrl = options?.registryUrl || "";
13
- this.useEncryption = options?.useEncryption || false;
14
- const shouldSilence = process.env.DISABLE_LOGGING === "true";
15
- this.logger = new Logger({
16
- level: options?.logLevel || "info",
17
- silent: shouldSilence
18
- });
19
- }
20
- getOperatorId() {
21
- const operator = this.standardClient.getClient().operatorAccountId;
22
- if (!operator) {
23
- throw new Error("Operator Account ID not configured in standard client.");
24
- }
25
- return operator.toString();
26
- }
27
- getNetwork() {
28
- return this.standardClient.getNetwork();
29
- }
30
- async handleConnectionRequest(inboundTopicId, requestingAccountId, connectionRequestId, feeConfig) {
31
- try {
32
- const result = await this.standardClient.handleConnectionRequest(
33
- inboundTopicId,
34
- requestingAccountId,
35
- connectionRequestId,
36
- feeConfig
37
- );
38
- return result;
39
- } catch (error) {
40
- this.logger.error(
41
- `Error handling connection request #${connectionRequestId} for topic ${inboundTopicId}:`,
42
- error
43
- );
44
- throw new Error(
45
- `Failed to handle connection request: ${error instanceof Error ? error.message : String(error)}`
46
- );
47
- }
1
+ import { BaseServiceBuilder } from "hedera-agent-kit";
2
+ import { HCS6Client } from "@hashgraphonline/standards-sdk";
3
+ import { SignerProviderRegistry } from "./standards-agent-kit.es3.js";
4
+ import { CodedError } from "./standards-agent-kit.es48.js";
5
+ class HCS6Builder extends BaseServiceBuilder {
6
+ constructor(hederaKit) {
7
+ super(hederaKit);
48
8
  }
49
9
  /**
50
- * Retrieves the profile for a given account ID using the standard SDK.
10
+ * Get or create HCS-6 client
51
11
  */
52
- async getAgentProfile(accountId) {
53
- return this.standardClient.retrieveProfile(accountId);
54
- }
55
- /**
56
- * Exposes the standard SDK's submitConnectionRequest method.
57
- */
58
- async submitConnectionRequest(inboundTopicId, memo) {
59
- return this.standardClient.submitConnectionRequest(
60
- inboundTopicId,
61
- memo
62
- );
12
+ async getHCS6Client() {
13
+ if (!this.hcs6Client) {
14
+ const operatorId = this.hederaKit.signer.getAccountId().toString();
15
+ const operatorPrivateKey = this.hederaKit.signer?.getOperatorPrivateKey() ? this.hederaKit.signer.getOperatorPrivateKey().toString() : "";
16
+ const network = this.hederaKit.client.network;
17
+ const networkType = network.toString().includes("mainnet") ? "mainnet" : "testnet";
18
+ const config = {
19
+ network: networkType,
20
+ operatorId,
21
+ operatorKey: operatorPrivateKey
22
+ };
23
+ this.hcs6Client = new HCS6Client(config);
24
+ }
25
+ return this.hcs6Client;
63
26
  }
64
27
  /**
65
- * Exposes the standard SDK's waitForConnectionConfirmation method.
28
+ * Create a new HCS-6 dynamic registry
29
+ * Note: This executes the transaction directly via HCS6Client
66
30
  */
67
- async waitForConnectionConfirmation(outboundTopicId, connectionRequestId, maxAttempts = 60, delayMs = 2e3) {
68
- return this.standardClient.waitForConnectionConfirmation(
69
- outboundTopicId,
70
- connectionRequestId,
71
- maxAttempts,
72
- delayMs
73
- );
31
+ async createRegistry(options = {}) {
32
+ const exec = SignerProviderRegistry.walletExecutor;
33
+ const preferWallet = SignerProviderRegistry.preferWalletOnly;
34
+ const network = this.hederaKit.client.network.toString().includes("mainnet") ? "mainnet" : "testnet";
35
+ if (exec) {
36
+ const start = SignerProviderRegistry.startHCSDelegate;
37
+ if (start) {
38
+ try {
39
+ const request = { options };
40
+ const { transactionBytes } = await start("hcs6.createRegistry", request, network);
41
+ if (transactionBytes) {
42
+ return { success: true, transactionBytes };
43
+ }
44
+ } catch (err) {
45
+ if (preferWallet) {
46
+ throw new CodedError("wallet_submit_failed", `wallet_submit_failed: ${err instanceof Error ? err.message : String(err)}`);
47
+ }
48
+ }
49
+ }
50
+ if (preferWallet) {
51
+ throw new CodedError("wallet_unavailable", "WalletExecutor not configured for hcs6.createRegistry");
52
+ }
53
+ }
54
+ const client = await this.getHCS6Client();
55
+ const sanitized = { ...options };
56
+ if ("adminKey" in sanitized) {
57
+ delete sanitized.adminKey;
58
+ }
59
+ return await client.createRegistry(sanitized);
74
60
  }
75
61
  /**
76
- * Creates and registers an agent using the standard SDK's HCS10Client.
77
- * This handles account creation, key generation, topic setup, and registration.
78
- *
79
- * When metadata includes fee configuration:
80
- * 1. The properties.feeConfig will be passed to the AgentBuilder
81
- * 2. The properties.inboundTopicType will be set to FEE_BASED
82
- * 3. The SDK's createAndRegisterAgent will apply the fees to the agent's inbound topic
83
- *
84
- * @param metadata - The agent's metadata, potentially including pfpBuffer, pfpFileName,
85
- * and fee configuration in properties.feeConfig
86
- * @returns The registration result from the standard SDK, containing accountId, keys, topics etc.
62
+ * Register a new dynamic hashinal entry in an HCS-6 registry
87
63
  */
88
- async createAndRegisterAgent(metadata) {
89
- const builder = new AgentBuilder().setName(metadata.name).setBio(metadata.description || "").setCapabilities(
90
- metadata.capabilities ? metadata.capabilities : [AIAgentCapability.TEXT_GENERATION]
91
- ).setType(metadata.type || "autonomous").setModel(metadata.model || "agent-model-2024").setNetwork(this.getNetwork()).setInboundTopicType(InboundTopicType.PUBLIC);
92
- if (metadata?.feeConfig) {
93
- builder.setInboundTopicType(InboundTopicType.FEE_BASED);
94
- builder.setFeeConfig(metadata.feeConfig);
95
- }
96
- if (metadata.pfpBuffer && metadata.pfpFileName) {
97
- if (metadata.pfpBuffer.byteLength === 0) {
98
- this.logger.warn(
99
- "Provided PFP buffer is empty. Skipping profile picture."
100
- );
101
- } else {
102
- this.logger.info(
103
- `Setting profile picture: ${metadata.pfpFileName} (${metadata.pfpBuffer.byteLength} bytes)`
104
- );
105
- builder.setProfilePicture(metadata.pfpBuffer, metadata.pfpFileName);
64
+ async registerEntry(registryTopicId, options) {
65
+ const exec = SignerProviderRegistry.walletExecutor;
66
+ const preferWallet = SignerProviderRegistry.preferWalletOnly;
67
+ const network = this.hederaKit.client.network.toString().includes("mainnet") ? "mainnet" : "testnet";
68
+ if (exec) {
69
+ const start = SignerProviderRegistry.startHCSDelegate;
70
+ if (start) {
71
+ try {
72
+ const request = { registryTopicId, options };
73
+ const { transactionBytes } = await start("hcs6.registerEntry", request, network);
74
+ if (transactionBytes) {
75
+ return { success: true, transactionBytes };
76
+ }
77
+ } catch (err) {
78
+ if (preferWallet) {
79
+ throw new CodedError("wallet_submit_failed", `wallet_submit_failed: ${err instanceof Error ? err.message : String(err)}`);
80
+ }
81
+ }
106
82
  }
107
- } else {
108
- this.logger.warn(
109
- "Profile picture not provided in metadata. Agent creation might fail if required by the underlying SDK builder."
110
- );
111
- }
112
- if (metadata.social) {
113
- Object.entries(metadata.social).forEach(([platform, handle]) => {
114
- builder.addSocial(platform, handle);
115
- });
116
- }
117
- if (metadata.properties) {
118
- Object.entries(metadata.properties).forEach(([key, value]) => {
119
- builder.addProperty(key, value);
120
- });
121
- }
122
- try {
123
- const hasFees = Boolean(metadata?.feeConfig);
124
- const result = await this.standardClient.createAndRegisterAgent(builder, {
125
- initialBalance: hasFees ? 50 : void 0
126
- });
127
- if (result?.metadata?.inboundTopicId && result?.metadata?.outboundTopicId) {
128
- this.agentChannels = {
129
- inboundTopicId: result.metadata.inboundTopicId,
130
- outboundTopicId: result.metadata.outboundTopicId
131
- };
83
+ if (preferWallet) {
84
+ throw new CodedError("wallet_unavailable", "WalletExecutor not configured for hcs6.registerEntry");
132
85
  }
133
- return result;
134
- } catch (error) {
135
- this.logger.error("Error during agent creation/registration:", error);
136
- throw new Error(
137
- `Failed to create/register agent: ${error instanceof Error ? error.message : String(error)}`
138
- );
139
86
  }
87
+ const client = await this.getHCS6Client();
88
+ return await client.registerEntry(registryTopicId, options);
140
89
  }
141
90
  /**
142
- * Sends a structured HCS-10 message to the specified topic using the standard SDK client.
143
- * Handles potential inscription for large messages.
144
- *
145
- * @param topicId - The target topic ID (likely a connection topic).
146
- * @param operatorId - The operator ID string (e.g., "inboundTopic@accountId").
147
- * @param data - The actual message content/data.
148
- * @param memo - Optional memo for the message.
149
- * @param submitKey - Optional private key for topics requiring specific submit keys.
150
- * @returns A confirmation status string from the transaction receipt.
91
+ * Query entries from an HCS-6 registry
151
92
  */
152
- async sendMessage(topicId, data, memo, submitKey) {
153
- if (this.useEncryption) {
154
- data = encryptMessage(data);
155
- }
156
- try {
157
- const messageResponse = await this.standardClient.sendMessage(
158
- topicId,
159
- data,
160
- memo,
161
- submitKey
162
- );
163
- return messageResponse.topicSequenceNumber?.toNumber();
164
- } catch (error) {
165
- this.logger.error(`Error sending message to topic ${topicId}:`, error);
166
- throw new Error(
167
- `Failed to send message: ${error instanceof Error ? error.message : String(error)}`
168
- );
169
- }
93
+ async getRegistry(topicId, options = {}) {
94
+ const client = await this.getHCS6Client();
95
+ return await client.getRegistry(topicId, options);
170
96
  }
171
97
  /**
172
- * Retrieves messages from a topic using the standard SDK client.
173
- *
174
- * @param topicId - The topic ID to get messages from.
175
- * @returns Messages from the topic, mapped to the expected format.
98
+ * Create a complete dynamic hashinal with inscription and registry
176
99
  */
177
- async getMessages(topicId) {
178
- try {
179
- const result = await this.standardClient.getMessages(topicId);
180
- const mappedMessages = result.messages.map((sdkMessage) => {
181
- const timestamp = sdkMessage?.created?.getTime() || 0;
182
- return {
183
- ...sdkMessage,
184
- timestamp,
185
- data: sdkMessage.data,
186
- sequence_number: sdkMessage.sequence_number
187
- };
188
- });
189
- mappedMessages.sort(
190
- (a, b) => a.timestamp - b.timestamp
191
- );
192
- return { messages: mappedMessages };
193
- } catch (error) {
194
- this.logger.error(`Error getting messages from topic ${topicId}:`, error);
195
- return { messages: [] };
196
- }
197
- }
198
- async getMessageStream(topicId) {
199
- const result = this.standardClient.getMessageStream(topicId);
200
- return result;
100
+ async createHashinal(options) {
101
+ const client = await this.getHCS6Client();
102
+ const metadata = {
103
+ name: options.metadata?.name || "Dynamic Hashinal",
104
+ creator: options.metadata?.creator || this.hederaKit.signer.getAccountId().toString(),
105
+ description: options.metadata?.description || "Dynamic hashinal metadata",
106
+ type: options.metadata?.type || "json",
107
+ ...options.metadata
108
+ };
109
+ return await client.createHashinal({
110
+ ...options,
111
+ metadata
112
+ });
201
113
  }
202
114
  /**
203
- * Retrieves content from an inscribed message using the standard SDK client.
204
- * @param inscriptionIdOrData - The inscription ID (hcs://...) or potentially raw data string.
205
- * @returns The resolved message content.
115
+ * Register a dynamic hashinal with combined inscription and registry creation
116
+ * This is the main method for creating and updating dynamic hashinals
206
117
  */
207
- async getMessageContent(inscriptionIdOrData) {
208
- try {
209
- const content = await this.standardClient.getMessageContent(
210
- inscriptionIdOrData
211
- );
212
- return content;
213
- } catch (error) {
214
- this.logger.error(
215
- `Error retrieving message content for: ${inscriptionIdOrData}`,
216
- error
217
- );
218
- throw new Error(
219
- `Failed to retrieve message content: ${error instanceof Error ? error.message : String(error)}`
220
- );
221
- }
118
+ async register(options) {
119
+ const client = await this.getHCS6Client();
120
+ const metadata = {
121
+ name: options.metadata?.name || "Dynamic Hashinal",
122
+ creator: options.metadata?.creator || this.hederaKit.signer.getAccountId().toString(),
123
+ description: options.metadata?.description || "Dynamic hashinal registration",
124
+ type: options.metadata?.type || "json",
125
+ ...options.metadata
126
+ };
127
+ return await client.register({
128
+ ...options,
129
+ metadata
130
+ });
222
131
  }
223
132
  /**
224
- * Retrieves the inbound topic ID associated with the current operator.
225
- * This typically involves fetching the operator's own HCS-10 profile.
226
- * @returns A promise that resolves to the operator's inbound topic ID.
227
- * @throws {Error} If the operator ID cannot be determined or the profile/topic cannot be retrieved.
133
+ * Submit a raw message to an HCS-6 topic
228
134
  */
229
- async getInboundTopicId() {
230
- try {
231
- const operatorId = this.getOperatorId();
232
- this.logger.info(
233
- `[HCS10Client] Retrieving profile for operator ${operatorId} to find inbound topic...`
234
- );
235
- const profileResponse = await this.getAgentProfile(operatorId);
236
- if (profileResponse.success && profileResponse.topicInfo?.inboundTopic) {
237
- this.logger.info(
238
- `[HCS10Client] Found inbound topic for operator ${operatorId}: ${profileResponse.topicInfo.inboundTopic}`
239
- );
240
- return profileResponse.topicInfo.inboundTopic;
241
- } else {
242
- throw new Error(
243
- `Could not retrieve inbound topic from profile for ${operatorId}. Profile success: ${profileResponse.success}, Error: ${profileResponse.error}`
244
- );
135
+ async submitMessage(topicId, payload) {
136
+ const exec = SignerProviderRegistry.walletExecutor;
137
+ const preferWallet = SignerProviderRegistry.preferWalletOnly;
138
+ const network = this.hederaKit.client.network.toString().includes("mainnet") ? "mainnet" : "testnet";
139
+ if (exec) {
140
+ const start = SignerProviderRegistry.startHCSDelegate;
141
+ if (start) {
142
+ try {
143
+ const request = { topicId, payload };
144
+ const { transactionBytes } = await start("hcs6.submitMessage", request, network);
145
+ if (transactionBytes) {
146
+ return { success: true, transactionBytes };
147
+ }
148
+ } catch (err) {
149
+ if (preferWallet) {
150
+ throw new CodedError("wallet_submit_failed", `wallet_submit_failed: ${err instanceof Error ? err.message : String(err)}`);
151
+ }
152
+ }
245
153
  }
246
- } catch (error) {
247
- this.logger.error(
248
- `[HCS10Client] Error fetching operator's inbound topic ID (${this.getOperatorId()}):`,
249
- error
250
- );
251
- const operatorId = this.getOperatorId();
252
- let detailedMessage = `Failed to get inbound topic ID for operator ${operatorId}.`;
253
- if (error instanceof Error && error.message.includes("does not have a valid HCS-11 memo")) {
254
- detailedMessage += ` The account profile may not exist or is invalid. Please ensure this operator account (${operatorId}) is registered as an HCS-10 agent. You might need to register it first (e.g., using the 'register_agent' tool or SDK function).`;
255
- } else if (error instanceof Error) {
256
- detailedMessage += ` Reason: ${error.message}`;
257
- } else {
258
- detailedMessage += ` Unexpected error: ${String(error)}`;
154
+ if (preferWallet) {
155
+ throw new CodedError("wallet_unavailable", "WalletExecutor not configured for hcs6.submitMessage");
259
156
  }
260
- throw new Error(detailedMessage);
261
157
  }
158
+ const client = await this.getHCS6Client();
159
+ return await client.submitMessage(topicId, payload);
262
160
  }
263
161
  /**
264
- * Retrieves the configured operator account ID and private key.
265
- * Required by tools needing to identify the current agent instance.
266
- */
267
- getAccountAndSigner() {
268
- const result = this.standardClient.getAccountAndSigner();
269
- return {
270
- accountId: result.accountId,
271
- signer: result.signer
272
- };
273
- }
274
- /**
275
- * Retrieves the outbound topic ID for the current operator.
276
- * Fetches the operator's profile if necessary.
277
- * @returns The outbound topic ID string.
278
- * @throws If the outbound topic cannot be determined.
162
+ * Get topic info from mirror node
279
163
  */
280
- async getOutboundTopicId() {
281
- const operatorId = this.getOperatorId();
282
- const profile = await this.getAgentProfile(operatorId);
283
- if (profile.success && profile.topicInfo?.outboundTopic) {
284
- return profile.topicInfo.outboundTopic;
285
- } else {
286
- throw new Error(
287
- `Could not retrieve outbound topic from profile for ${operatorId}. Profile success: ${profile.success}, Error: ${profile.error}`
288
- );
289
- }
290
- }
291
- setClient(accountId, privateKey) {
292
- this.standardClient = new HCS10Client$1({
293
- network: this.getNetwork(),
294
- operatorId: accountId,
295
- operatorPrivateKey: privateKey,
296
- guardedRegistryBaseUrl: this.guardedRegistryBaseUrl
297
- });
298
- return this.standardClient;
164
+ async getTopicInfo(topicId) {
165
+ const client = await this.getHCS6Client();
166
+ return await client.getTopicInfo(topicId);
299
167
  }
300
168
  /**
301
- * Validates that the operator account exists and has proper access for agent operations
169
+ * Close the HCS-6 client
302
170
  */
303
- async validateOperator(options) {
304
- try {
305
- this.setClient(options.accountId, options.privateKey);
306
- const operatorId = this.getOperatorId();
307
- return {
308
- isValid: true,
309
- operator: { accountId: operatorId }
310
- };
311
- } catch (error) {
312
- this.logger.error(`Validation error: ${error}`);
313
- return {
314
- isValid: false,
315
- error: error instanceof Error ? error.message : String(error)
316
- };
317
- }
318
- }
319
- async initializeWithValidation(options) {
320
- const validationResult = await this.validateOperator(options);
321
- if (validationResult.isValid) {
322
- if (options.stateManager) {
323
- options.stateManager.initializeConnectionsManager(this.standardClient);
324
- }
171
+ async close() {
172
+ if (this.hcs6Client) {
173
+ this.hcs6Client.close();
174
+ this.hcs6Client = void 0;
325
175
  }
326
- return validationResult;
327
176
  }
328
177
  }
329
178
  export {
330
- HCS10Client
179
+ HCS6Builder
331
180
  };
332
181
  //# sourceMappingURL=standards-agent-kit.es7.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"standards-agent-kit.es7.js","sources":["../../src/hcs10/HCS10Client.ts"],"sourcesContent":["import { TransactionReceipt, PrivateKey } from '@hashgraph/sdk';\nimport {\n HCS10Client as StandardSDKClient,\n AgentBuilder,\n InboundTopicType as StandardInboundTopicType,\n AIAgentCapability as StandardAIAgentCapability,\n AgentRegistrationResult,\n WaitForConnectionConfirmationResponse,\n ProfileResponse as SDKProfileResponse,\n HCSMessage,\n LogLevel,\n Logger,\n FeeConfigBuilderInterface,\n SocialPlatform,\n} from '@hashgraphonline/standards-sdk';\nimport { AgentMetadata, AgentChannels } from './types';\nimport { encryptMessage } from '../utils/Encryption';\nimport { IStateManager } from '../state/state-types';\n\ntype StandardHandleConnectionRequest = InstanceType<\n typeof StandardSDKClient\n>['handleConnectionRequest'];\ntype HandleConnectionRequestResponse = Awaited<\n ReturnType<StandardHandleConnectionRequest>\n>;\nexport type StandardNetworkType = 'mainnet' | 'testnet';\n\nexport interface ClientValidationOptions {\n accountId: string;\n privateKey: string;\n network?: StandardNetworkType;\n stateManager?: IStateManager;\n}\n\nexport interface HCSMessageWithTimestamp extends HCSMessage {\n timestamp: number;\n data?: string;\n sequence_number: number;\n}\n\nexport interface ExtendedAgentMetadata extends AgentMetadata {\n pfpBuffer?: Buffer;\n pfpFileName?: string;\n feeConfig?: FeeConfigBuilderInterface;\n}\n\n/**\n * HCS10Client wraps the HCS-10 functionalities using the @hashgraphonline/standards-sdk.\n * - Creates and registers agents using the standard SDK flow.\n * - Manages agent communication channels (handled by standard SDK).\n * - Sends messages on Hedera topics (currently manual, potential for standard SDK integration).\n */\nexport class HCS10Client {\n public standardClient: StandardSDKClient;\n private useEncryption: boolean;\n public agentChannels?: AgentChannels;\n public guardedRegistryBaseUrl: string;\n public logger: Logger;\n\n constructor(\n operatorId: string,\n operatorPrivateKey: string,\n network: StandardNetworkType,\n options?: {\n useEncryption?: boolean;\n registryUrl?: string;\n logLevel?: LogLevel;\n }\n ) {\n this.standardClient = new StandardSDKClient({\n network: network,\n operatorId: operatorId,\n operatorPrivateKey: operatorPrivateKey,\n guardedRegistryBaseUrl: options?.registryUrl,\n logLevel: options?.logLevel,\n });\n this.guardedRegistryBaseUrl = options?.registryUrl || '';\n this.useEncryption = options?.useEncryption || false;\n const shouldSilence = process.env.DISABLE_LOGGING === 'true';\n this.logger = new Logger({\n level: options?.logLevel || 'info',\n silent: shouldSilence,\n });\n }\n\n public getOperatorId(): string {\n const operator = this.standardClient.getClient().operatorAccountId;\n if (!operator) {\n throw new Error('Operator Account ID not configured in standard client.');\n }\n return operator.toString();\n }\n\n public getNetwork(): StandardNetworkType {\n return this.standardClient.getNetwork() as StandardNetworkType;\n }\n\n public async handleConnectionRequest(\n inboundTopicId: string,\n requestingAccountId: string,\n connectionRequestId: number,\n feeConfig?: FeeConfigBuilderInterface\n ): Promise<HandleConnectionRequestResponse> {\n try {\n const result = await this.standardClient.handleConnectionRequest(\n inboundTopicId,\n requestingAccountId,\n connectionRequestId,\n feeConfig\n );\n return result;\n } catch (error) {\n this.logger.error(\n `Error handling connection request #${connectionRequestId} for topic ${inboundTopicId}:`,\n error\n );\n throw new Error(\n `Failed to handle connection request: ${\n error instanceof Error ? error.message : String(error)\n }`\n );\n }\n }\n\n /**\n * Retrieves the profile for a given account ID using the standard SDK.\n */\n public async getAgentProfile(accountId: string): Promise<SDKProfileResponse> {\n return this.standardClient.retrieveProfile(accountId);\n }\n\n /**\n * Exposes the standard SDK's submitConnectionRequest method.\n */\n public async submitConnectionRequest(\n inboundTopicId: string,\n memo: string\n ): Promise<TransactionReceipt> {\n return this.standardClient.submitConnectionRequest(\n inboundTopicId,\n memo\n ) as Promise<TransactionReceipt>;\n }\n\n /**\n * Exposes the standard SDK's waitForConnectionConfirmation method.\n */\n public async waitForConnectionConfirmation(\n outboundTopicId: string,\n connectionRequestId: number,\n maxAttempts = 60,\n delayMs = 2000\n ): Promise<WaitForConnectionConfirmationResponse> {\n return this.standardClient.waitForConnectionConfirmation(\n outboundTopicId,\n connectionRequestId,\n maxAttempts,\n delayMs\n );\n }\n\n /**\n * Creates and registers an agent using the standard SDK's HCS10Client.\n * This handles account creation, key generation, topic setup, and registration.\n *\n * When metadata includes fee configuration:\n * 1. The properties.feeConfig will be passed to the AgentBuilder\n * 2. The properties.inboundTopicType will be set to FEE_BASED\n * 3. The SDK's createAndRegisterAgent will apply the fees to the agent's inbound topic\n *\n * @param metadata - The agent's metadata, potentially including pfpBuffer, pfpFileName,\n * and fee configuration in properties.feeConfig\n * @returns The registration result from the standard SDK, containing accountId, keys, topics etc.\n */\n public async createAndRegisterAgent(\n metadata: ExtendedAgentMetadata\n ): Promise<AgentRegistrationResult> {\n const builder = new AgentBuilder()\n .setName(metadata.name)\n .setBio(metadata.description || '')\n .setCapabilities(\n metadata.capabilities\n ? metadata.capabilities\n : [StandardAIAgentCapability.TEXT_GENERATION]\n )\n .setType((metadata.type || 'autonomous') as 'autonomous' | 'manual')\n .setModel(metadata.model || 'agent-model-2024')\n .setNetwork(this.getNetwork())\n .setInboundTopicType(StandardInboundTopicType.PUBLIC);\n\n if (metadata?.feeConfig) {\n builder.setInboundTopicType(StandardInboundTopicType.FEE_BASED);\n builder.setFeeConfig(metadata.feeConfig);\n }\n\n if (metadata.pfpBuffer && metadata.pfpFileName) {\n if (metadata.pfpBuffer.byteLength === 0) {\n this.logger.warn(\n 'Provided PFP buffer is empty. Skipping profile picture.'\n );\n } else {\n this.logger.info(\n `Setting profile picture: ${metadata.pfpFileName} (${metadata.pfpBuffer.byteLength} bytes)`\n );\n builder.setProfilePicture(metadata.pfpBuffer, metadata.pfpFileName);\n }\n } else {\n this.logger.warn(\n 'Profile picture not provided in metadata. Agent creation might fail if required by the underlying SDK builder.'\n );\n }\n\n if (metadata.social) {\n Object.entries(metadata.social).forEach(([platform, handle]) => {\n builder.addSocial(platform as SocialPlatform, handle);\n });\n }\n\n if (metadata.properties) {\n Object.entries(metadata.properties).forEach(([key, value]) => {\n builder.addProperty(key, value);\n });\n }\n\n try {\n const hasFees = Boolean(metadata?.feeConfig);\n const result = await this.standardClient.createAndRegisterAgent(builder, {\n initialBalance: hasFees ? 50 : undefined,\n });\n if (\n result?.metadata?.inboundTopicId &&\n result?.metadata?.outboundTopicId\n ) {\n this.agentChannels = {\n inboundTopicId: result.metadata.inboundTopicId,\n outboundTopicId: result.metadata.outboundTopicId,\n };\n }\n return result;\n } catch (error) {\n this.logger.error('Error during agent creation/registration:', error);\n throw new Error(\n `Failed to create/register agent: ${\n error instanceof Error ? error.message : String(error)\n }`\n );\n }\n }\n\n /**\n * Sends a structured HCS-10 message to the specified topic using the standard SDK client.\n * Handles potential inscription for large messages.\n *\n * @param topicId - The target topic ID (likely a connection topic).\n * @param operatorId - The operator ID string (e.g., \"inboundTopic@accountId\").\n * @param data - The actual message content/data.\n * @param memo - Optional memo for the message.\n * @param submitKey - Optional private key for topics requiring specific submit keys.\n * @returns A confirmation status string from the transaction receipt.\n */\n public async sendMessage(\n topicId: string,\n data: string,\n memo?: string,\n submitKey?: PrivateKey\n ): Promise<number | undefined> {\n if (this.useEncryption) {\n data = encryptMessage(data);\n }\n\n try {\n const messageResponse = await this.standardClient.sendMessage(\n topicId,\n data,\n memo,\n submitKey\n );\n return messageResponse.topicSequenceNumber?.toNumber();\n } catch (error) {\n this.logger.error(`Error sending message to topic ${topicId}:`, error);\n throw new Error(\n `Failed to send message: ${\n error instanceof Error ? error.message : String(error)\n }`\n );\n }\n }\n\n /**\n * Retrieves messages from a topic using the standard SDK client.\n *\n * @param topicId - The topic ID to get messages from.\n * @returns Messages from the topic, mapped to the expected format.\n */\n public async getMessages(topicId: string): Promise<{\n messages: HCSMessageWithTimestamp[];\n }> {\n try {\n const result = await this.standardClient.getMessages(topicId);\n\n const mappedMessages = result.messages.map((sdkMessage) => {\n const timestamp = sdkMessage?.created?.getTime() || 0;\n\n return {\n ...sdkMessage,\n timestamp: timestamp,\n data: sdkMessage.data,\n sequence_number: sdkMessage.sequence_number,\n };\n });\n mappedMessages.sort(\n (a: { timestamp: number }, b: { timestamp: number }) =>\n a.timestamp - b.timestamp\n );\n return { messages: mappedMessages as HCSMessageWithTimestamp[] };\n } catch (error) {\n this.logger.error(`Error getting messages from topic ${topicId}:`, error);\n return { messages: [] };\n }\n }\n\n public async getMessageStream(topicId: string): Promise<{\n messages: HCSMessage[];\n }> {\n const result = this.standardClient.getMessageStream(topicId);\n return result as Promise<{ messages: HCSMessage[] }>;\n }\n\n /**\n * Retrieves content from an inscribed message using the standard SDK client.\n * @param inscriptionIdOrData - The inscription ID (hcs://...) or potentially raw data string.\n * @returns The resolved message content.\n */\n public async getMessageContent(inscriptionIdOrData: string): Promise<string> {\n try {\n const content = await this.standardClient.getMessageContent(\n inscriptionIdOrData\n );\n return content as string;\n } catch (error) {\n this.logger.error(\n `Error retrieving message content for: ${inscriptionIdOrData}`,\n error\n );\n throw new Error(\n `Failed to retrieve message content: ${\n error instanceof Error ? error.message : String(error)\n }`\n );\n }\n }\n\n /**\n * Retrieves the inbound topic ID associated with the current operator.\n * This typically involves fetching the operator's own HCS-10 profile.\n * @returns A promise that resolves to the operator's inbound topic ID.\n * @throws {Error} If the operator ID cannot be determined or the profile/topic cannot be retrieved.\n */\n public async getInboundTopicId(): Promise<string> {\n try {\n const operatorId = this.getOperatorId();\n this.logger.info(\n `[HCS10Client] Retrieving profile for operator ${operatorId} to find inbound topic...`\n );\n const profileResponse = await this.getAgentProfile(operatorId);\n if (profileResponse.success && profileResponse.topicInfo?.inboundTopic) {\n this.logger.info(\n `[HCS10Client] Found inbound topic for operator ${operatorId}: ${profileResponse.topicInfo.inboundTopic}`\n );\n return profileResponse.topicInfo.inboundTopic;\n } else {\n throw new Error(\n `Could not retrieve inbound topic from profile for ${operatorId}. Profile success: ${profileResponse.success}, Error: ${profileResponse.error}`\n );\n }\n } catch (error) {\n this.logger.error(\n `[HCS10Client] Error fetching operator's inbound topic ID (${this.getOperatorId()}):`,\n error\n );\n const operatorId = this.getOperatorId();\n let detailedMessage = `Failed to get inbound topic ID for operator ${operatorId}.`;\n if (\n error instanceof Error &&\n error.message.includes('does not have a valid HCS-11 memo')\n ) {\n detailedMessage += ` The account profile may not exist or is invalid. Please ensure this operator account (${operatorId}) is registered as an HCS-10 agent. You might need to register it first (e.g., using the 'register_agent' tool or SDK function).`;\n } else if (error instanceof Error) {\n detailedMessage += ` Reason: ${error.message}`;\n } else {\n detailedMessage += ` Unexpected error: ${String(error)}`;\n }\n throw new Error(detailedMessage);\n }\n }\n\n /**\n * Retrieves the configured operator account ID and private key.\n * Required by tools needing to identify the current agent instance.\n */\n public getAccountAndSigner(): { accountId: string; signer: PrivateKey } {\n const result = this.standardClient.getAccountAndSigner();\n return {\n accountId: result.accountId,\n signer: result.signer as unknown as PrivateKey,\n };\n }\n\n /**\n * Retrieves the outbound topic ID for the current operator.\n * Fetches the operator's profile if necessary.\n * @returns The outbound topic ID string.\n * @throws If the outbound topic cannot be determined.\n */\n public async getOutboundTopicId(): Promise<string> {\n const operatorId = this.getOperatorId();\n const profile = await this.getAgentProfile(operatorId);\n if (profile.success && profile.topicInfo?.outboundTopic) {\n return profile.topicInfo.outboundTopic;\n } else {\n throw new Error(\n `Could not retrieve outbound topic from profile for ${operatorId}. Profile success: ${profile.success}, Error: ${profile.error}`\n );\n }\n }\n\n public setClient(accountId: string, privateKey: string): StandardSDKClient {\n this.standardClient = new StandardSDKClient({\n network: this.getNetwork(),\n operatorId: accountId,\n operatorPrivateKey: privateKey,\n guardedRegistryBaseUrl: this.guardedRegistryBaseUrl,\n });\n return this.standardClient;\n }\n\n /**\n * Validates that the operator account exists and has proper access for agent operations\n */\n private async validateOperator(options: ClientValidationOptions): Promise<{\n isValid: boolean;\n operator?: { accountId: string };\n error?: string;\n }> {\n try {\n\n this.setClient(options.accountId, options.privateKey);\n\n const operatorId = this.getOperatorId();\n\n return {\n isValid: true,\n operator: { accountId: operatorId },\n };\n } catch (error) {\n this.logger.error(`Validation error: ${error}`);\n return {\n isValid: false,\n error: error instanceof Error ? error.message : String(error),\n };\n }\n }\n\n async initializeWithValidation(options: ClientValidationOptions): Promise<{\n isValid: boolean;\n operator?: { accountId: string };\n error?: string;\n }> {\n const validationResult = await this.validateOperator(options);\n\n if (validationResult.isValid) {\n\n if (options.stateManager) {\n options.stateManager.initializeConnectionsManager(this.standardClient);\n }\n }\n\n return validationResult;\n }\n}\n"],"names":["StandardSDKClient","StandardAIAgentCap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iB,IAAIF,cAAkB;AAAA,MAC1C,SAAS,KAAK,WAAA;AAAA,MACd,YAAY;AAAA,MACZ,oBAAoB;AAAA,MACpB,wBAAwB,KAAK;AAAA,IAAA,CAC9B;AACD,WAAO,KAAK;AAAA,EACd;AAAA;AAAA;AAAA;AAAA,EAKA,MAAc,iBAAiB,SAI5B;AACD,QAAI;AAEF,WAAK,UAAU,QAAQ,WAAW,QAAQ,UAAU;AAEpD,YAAM,aAAa,KAAK,cAAA;AAExB,aAAO;AAAA,QACL,SAAS;AAAA,QACT,UAAU,EAAE,WAAW,WAAA;AAAA,MAAW;AAAA,IAEtC,SAAS,OAAO;AACd,WAAK,OAAO,MAAM,qBAAqB,KAAK,EAAE;AAC9C,aAAO;AAAA,QACL,SAAS;AAAA,QACT,OAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AAAA,MAAA;AAAA,IAEhE;AAAA,EACF;AAAA,EAEA,MAAM,yBAAyB,SAI5B;AACD,UAAM,mBAAmB,MAAM,KAAK,iBAAiB,OAAO;AAE5D,QAAI,iBAAiB,SAAS;AAE5B,UAAI,QAAQ,cAAc;AACxB,gBAAQ,aAAa,6BAA6B,KAAK,cAAc;AAAA,MACvE;AAAA,IACF;AAEA,WAAO;AAAA,EACT;AACF;"}
1
+ {"version":3,"file":"standards-agent-kit.es7.js","sources":["../../src/builders/hcs6/hcs6-builder.ts"],"sourcesContent":["import { BaseServiceBuilder } from 'hedera-agent-kit';\nimport type { HederaAgentKit } from 'hedera-agent-kit';\nimport {\n HCS6Client,\n SDKHCS6ClientConfig,\n HCS6CreateRegistryOptions,\n HCS6RegisterEntryOptions,\n HCS6QueryRegistryOptions,\n HCS6RegisterOptions,\n HCS6CreateHashinalOptions,\n HCS6TopicRegistrationResponse,\n HCS6RegistryOperationResponse,\n HCS6TopicRegistry,\n HCS6CreateHashinalResponse,\n NetworkType,\n} from '@hashgraphonline/standards-sdk';\nimport { SignerProviderRegistry, type NetworkString } from '../../signing/signer-provider';\nimport type { HCS6TopicRegistrationResult, HCS6RegistryOperationResult, HCS6CreateHashinalResult } from '../../types/tx-results';\nimport { CodedError } from '../../utils/CodedError';\n\n/**\n * Builder for HCS-6 operations that delegates to HCS6Client\n */\nexport class HCS6Builder extends BaseServiceBuilder {\n protected hcs6Client?: HCS6Client;\n\n constructor(hederaKit: HederaAgentKit) {\n super(hederaKit);\n }\n\n /**\n * Get or create HCS-6 client\n */\n protected async getHCS6Client(): Promise<HCS6Client> {\n if (!this.hcs6Client) {\n const operatorId = this.hederaKit.signer.getAccountId().toString();\n const operatorPrivateKey = this.hederaKit.signer?.getOperatorPrivateKey()\n ? this.hederaKit.signer.getOperatorPrivateKey().toString()\n : '';\n\n const network = this.hederaKit.client.network;\n const networkType: NetworkType = network.toString().includes('mainnet')\n ? 'mainnet'\n : 'testnet';\n\n const config: SDKHCS6ClientConfig = {\n network: networkType,\n operatorId: operatorId,\n operatorKey: operatorPrivateKey,\n };\n\n this.hcs6Client = new HCS6Client(config);\n }\n return this.hcs6Client;\n }\n\n /**\n * Create a new HCS-6 dynamic registry\n * Note: This executes the transaction directly via HCS6Client\n */\n async createRegistry(\n options: HCS6CreateRegistryOptions = {}\n ): Promise<HCS6TopicRegistrationResult> {\n const exec = SignerProviderRegistry.walletExecutor;\n const preferWallet = SignerProviderRegistry.preferWalletOnly;\n const network = (this.hederaKit.client.network.toString().includes('mainnet') ? 'mainnet' : 'testnet') as NetworkString;\n\n if (exec) {\n const start = SignerProviderRegistry.startHCSDelegate;\n if (start) {\n try {\n const request: Record<string, unknown> = { options };\n const { transactionBytes } = await start('hcs6.createRegistry', request, network);\n if (transactionBytes) {\n return { success: true, transactionBytes };\n }\n } catch (err) {\n if (preferWallet) {\n throw new CodedError('wallet_submit_failed', `wallet_submit_failed: ${err instanceof Error ? err.message : String(err)}`);\n }\n }\n }\n if (preferWallet) {\n throw new CodedError('wallet_unavailable', 'WalletExecutor not configured for hcs6.createRegistry');\n }\n }\n\n const client = await this.getHCS6Client();\n const sanitized = { ...options };\n if ('adminKey' in sanitized) {\n delete (sanitized as any).adminKey;\n }\n return await client.createRegistry(sanitized);\n }\n\n /**\n * Register a new dynamic hashinal entry in an HCS-6 registry\n */\n async registerEntry(\n registryTopicId: string,\n options: HCS6RegisterEntryOptions\n ): Promise<HCS6RegistryOperationResult> {\n const exec = SignerProviderRegistry.walletExecutor;\n const preferWallet = SignerProviderRegistry.preferWalletOnly;\n const network = (this.hederaKit.client.network.toString().includes('mainnet') ? 'mainnet' : 'testnet') as NetworkString;\n\n if (exec) {\n const start = SignerProviderRegistry.startHCSDelegate;\n if (start) {\n try {\n const request: Record<string, unknown> = { registryTopicId, options };\n const { transactionBytes } = await start('hcs6.registerEntry', request, network);\n if (transactionBytes) {\n return { success: true, transactionBytes };\n }\n } catch (err) {\n if (preferWallet) {\n throw new CodedError('wallet_submit_failed', `wallet_submit_failed: ${err instanceof Error ? err.message : String(err)}`);\n }\n }\n }\n if (preferWallet) {\n throw new CodedError('wallet_unavailable', 'WalletExecutor not configured for hcs6.registerEntry');\n }\n }\n\n const client = await this.getHCS6Client();\n return await client.registerEntry(registryTopicId, options);\n }\n\n /**\n * Query entries from an HCS-6 registry\n */\n async getRegistry(\n topicId: string,\n options: HCS6QueryRegistryOptions = {}\n ): Promise<HCS6TopicRegistry> {\n const client = await this.getHCS6Client();\n return await client.getRegistry(topicId, options);\n }\n\n /**\n * Create a complete dynamic hashinal with inscription and registry\n */\n async createHashinal(\n options: HCS6CreateHashinalOptions\n ): Promise<HCS6CreateHashinalResponse> {\n const client = await this.getHCS6Client();\n const metadata = {\n name: options.metadata?.name || 'Dynamic Hashinal',\n creator:\n options.metadata?.creator || this.hederaKit.signer.getAccountId().toString(),\n description: options.metadata?.description || 'Dynamic hashinal metadata',\n type: options.metadata?.type || 'json',\n ...options.metadata,\n } as Record<string, unknown>;\n\n return await client.createHashinal({\n ...options,\n metadata,\n });\n }\n\n /**\n * Register a dynamic hashinal with combined inscription and registry creation\n * This is the main method for creating and updating dynamic hashinals\n */\n async register(\n options: HCS6RegisterOptions\n ): Promise<HCS6CreateHashinalResponse> {\n const client = await this.getHCS6Client();\n const metadata = {\n name: options.metadata?.name || 'Dynamic Hashinal',\n creator:\n options.metadata?.creator || this.hederaKit.signer.getAccountId().toString(),\n description:\n options.metadata?.description || 'Dynamic hashinal registration',\n type: options.metadata?.type || 'json',\n ...options.metadata,\n } as Record<string, unknown>;\n\n return await client.register({\n ...options,\n metadata,\n });\n }\n\n /**\n * Submit a raw message to an HCS-6 topic\n */\n async submitMessage(\n topicId: string,\n payload: any\n ): Promise<HCS6RegistryOperationResult> {\n const exec = SignerProviderRegistry.walletExecutor;\n const preferWallet = SignerProviderRegistry.preferWalletOnly;\n const network = (this.hederaKit.client.network.toString().includes('mainnet') ? 'mainnet' : 'testnet') as NetworkString;\n\n if (exec) {\n const start = SignerProviderRegistry.startHCSDelegate;\n if (start) {\n try {\n const request: Record<string, unknown> = { topicId, payload };\n const { transactionBytes } = await start('hcs6.submitMessage', request, network);\n if (transactionBytes) {\n return { success: true, transactionBytes } as unknown as HCS6RegistryOperationResult;\n }\n } catch (err) {\n if (preferWallet) {\n throw new CodedError('wallet_submit_failed', `wallet_submit_failed: ${err instanceof Error ? err.message : String(err)}`);\n }\n }\n }\n if (preferWallet) {\n throw new CodedError('wallet_unavailable', 'WalletExecutor not configured for hcs6.submitMessage');\n }\n }\n\n const client = await this.getHCS6Client();\n return await client.submitMessage(topicId, payload) as unknown as HCS6RegistryOperationResult;\n }\n\n /**\n * Get topic info from mirror node\n */\n async getTopicInfo(topicId: string): Promise<any> {\n const client = await this.getHCS6Client();\n return await client.getTopicInfo(topicId);\n }\n\n /**\n * Close the HCS-6 client\n */\n async close(): Promise<void> {\n if (this.hcs6Client) {\n this.hcs6Client.close();\n this.hcs6Client = undefined;\n }\n }\n}"],"names":[],"mappings":";;;;AAuBO,MAAM,oBAAoB,mBAAmB;AAAA,EAGlD,YAAY,WAA2B;AACrC,UAAM,SAAS;AAAA,EAC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