@hashgraphonline/standards-agent-kit 0.2.119 → 0.2.121
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.
- package/dist/cjs/config/ContentReferenceConfig.d.ts +8 -0
- package/dist/cjs/index.d.ts +2 -0
- package/dist/cjs/standards-agent-kit.cjs +1 -1
- package/dist/cjs/standards-agent-kit.cjs.map +1 -1
- package/dist/cjs/tools/hcs6/CreateDynamicRegistryTool.d.ts +7 -7
- package/dist/cjs/tools/hcs6/QueryDynamicRegistryTool.d.ts +3 -3
- package/dist/cjs/tools/hcs6/RegisterDynamicHashinalTool.d.ts +7 -7
- package/dist/cjs/tools/hcs6/UpdateDynamicHashinalTool.d.ts +7 -7
- package/dist/cjs/tools/inscriber/InscribeFromBufferTool.d.ts +7 -6
- package/dist/cjs/tools/inscriber/base-inscriber-tools.d.ts +11 -0
- package/dist/cjs/tools/inscriber/inscriber-tool-params.d.ts +3 -0
- package/dist/cjs/types/content-resolver.d.ts +6 -0
- package/dist/es/config/ContentReferenceConfig.d.ts +8 -0
- package/dist/es/index.d.ts +2 -0
- package/dist/es/standards-agent-kit.es.js +42 -40
- package/dist/es/standards-agent-kit.es.js.map +1 -1
- package/dist/es/standards-agent-kit.es10.js +72 -23
- package/dist/es/standards-agent-kit.es10.js.map +1 -1
- package/dist/es/standards-agent-kit.es11.js +27 -27
- package/dist/es/standards-agent-kit.es11.js.map +1 -1
- package/dist/es/standards-agent-kit.es12.js +20 -30
- package/dist/es/standards-agent-kit.es12.js.map +1 -1
- package/dist/es/standards-agent-kit.es13.js +27 -37
- package/dist/es/standards-agent-kit.es13.js.map +1 -1
- package/dist/es/standards-agent-kit.es14.js +48 -60
- package/dist/es/standards-agent-kit.es14.js.map +1 -1
- package/dist/es/standards-agent-kit.es15.js +60 -23
- package/dist/es/standards-agent-kit.es15.js.map +1 -1
- package/dist/es/standards-agent-kit.es16.js +23 -23
- package/dist/es/standards-agent-kit.es16.js.map +1 -1
- package/dist/es/standards-agent-kit.es17.js +23 -33
- package/dist/es/standards-agent-kit.es17.js.map +1 -1
- package/dist/es/standards-agent-kit.es18.js +34 -10
- package/dist/es/standards-agent-kit.es18.js.map +1 -1
- package/dist/es/standards-agent-kit.es19.js +16 -155
- package/dist/es/standards-agent-kit.es19.js.map +1 -1
- package/dist/es/standards-agent-kit.es2.js +21 -1567
- package/dist/es/standards-agent-kit.es2.js.map +1 -1
- package/dist/es/standards-agent-kit.es20.js +150 -22
- package/dist/es/standards-agent-kit.es20.js.map +1 -1
- package/dist/es/standards-agent-kit.es21.js +25 -39
- package/dist/es/standards-agent-kit.es21.js.map +1 -1
- package/dist/es/standards-agent-kit.es22.js +26 -28
- package/dist/es/standards-agent-kit.es22.js.map +1 -1
- package/dist/es/standards-agent-kit.es23.js +16 -19
- package/dist/es/standards-agent-kit.es23.js.map +1 -1
- package/dist/es/standards-agent-kit.es24.js +21 -15
- package/dist/es/standards-agent-kit.es24.js.map +1 -1
- package/dist/es/standards-agent-kit.es25.js +18 -21
- package/dist/es/standards-agent-kit.es25.js.map +1 -1
- package/dist/es/standards-agent-kit.es26.js +35 -32
- package/dist/es/standards-agent-kit.es26.js.map +1 -1
- package/dist/es/standards-agent-kit.es27.js +38 -25
- package/dist/es/standards-agent-kit.es27.js.map +1 -1
- package/dist/es/standards-agent-kit.es28.js +24 -37
- package/dist/es/standards-agent-kit.es28.js.map +1 -1
- package/dist/es/standards-agent-kit.es29.js +26 -43
- package/dist/es/standards-agent-kit.es29.js.map +1 -1
- package/dist/es/standards-agent-kit.es3.js +1532 -55
- package/dist/es/standards-agent-kit.es3.js.map +1 -1
- package/dist/es/standards-agent-kit.es30.js +35 -40
- package/dist/es/standards-agent-kit.es30.js.map +1 -1
- package/dist/es/standards-agent-kit.es31.js +35 -39
- package/dist/es/standards-agent-kit.es31.js.map +1 -1
- package/dist/es/standards-agent-kit.es32.js +39 -23
- package/dist/es/standards-agent-kit.es32.js.map +1 -1
- package/dist/es/standards-agent-kit.es33.js +39 -168
- package/dist/es/standards-agent-kit.es33.js.map +1 -1
- package/dist/es/standards-agent-kit.es34.js +93 -96
- package/dist/es/standards-agent-kit.es34.js.map +1 -1
- package/dist/es/standards-agent-kit.es35.js +99 -64
- package/dist/es/standards-agent-kit.es35.js.map +1 -1
- package/dist/es/standards-agent-kit.es36.js +166 -64
- package/dist/es/standards-agent-kit.es36.js.map +1 -1
- package/dist/es/standards-agent-kit.es37.js +87 -30
- package/dist/es/standards-agent-kit.es37.js.map +1 -1
- package/dist/es/standards-agent-kit.es38.js +38 -242
- package/dist/es/standards-agent-kit.es38.js.map +1 -1
- package/dist/es/standards-agent-kit.es39.js +246 -138
- package/dist/es/standards-agent-kit.es39.js.map +1 -1
- package/dist/es/standards-agent-kit.es4.js +39 -33
- package/dist/es/standards-agent-kit.es4.js.map +1 -1
- package/dist/es/standards-agent-kit.es40.js +134 -26
- package/dist/es/standards-agent-kit.es40.js.map +1 -1
- package/dist/es/standards-agent-kit.es41.js +27 -22
- package/dist/es/standards-agent-kit.es41.js.map +1 -1
- package/dist/es/standards-agent-kit.es42.js +24 -3
- package/dist/es/standards-agent-kit.es42.js.map +1 -1
- package/dist/es/standards-agent-kit.es43.js +7 -0
- package/dist/es/standards-agent-kit.es43.js.map +1 -0
- package/dist/es/standards-agent-kit.es5.js +65 -32
- package/dist/es/standards-agent-kit.es5.js.map +1 -1
- package/dist/es/standards-agent-kit.es6.js +35 -311
- package/dist/es/standards-agent-kit.es6.js.map +1 -1
- package/dist/es/standards-agent-kit.es7.js +320 -20
- package/dist/es/standards-agent-kit.es7.js.map +1 -1
- package/dist/es/standards-agent-kit.es8.js +19 -227
- package/dist/es/standards-agent-kit.es8.js.map +1 -1
- package/dist/es/standards-agent-kit.es9.js +216 -65
- package/dist/es/standards-agent-kit.es9.js.map +1 -1
- package/dist/es/tools/hcs6/CreateDynamicRegistryTool.d.ts +7 -7
- package/dist/es/tools/hcs6/QueryDynamicRegistryTool.d.ts +3 -3
- package/dist/es/tools/hcs6/RegisterDynamicHashinalTool.d.ts +7 -7
- package/dist/es/tools/hcs6/UpdateDynamicHashinalTool.d.ts +7 -7
- package/dist/es/tools/inscriber/InscribeFromBufferTool.d.ts +7 -6
- package/dist/es/tools/inscriber/base-inscriber-tools.d.ts +11 -0
- package/dist/es/tools/inscriber/inscriber-tool-params.d.ts +3 -0
- package/dist/es/types/content-resolver.d.ts +6 -0
- package/dist/umd/config/ContentReferenceConfig.d.ts +8 -0
- package/dist/umd/index.d.ts +2 -0
- package/dist/umd/standards-agent-kit.umd.js +1 -1
- package/dist/umd/standards-agent-kit.umd.js.map +1 -1
- package/dist/umd/tools/hcs6/CreateDynamicRegistryTool.d.ts +7 -7
- package/dist/umd/tools/hcs6/QueryDynamicRegistryTool.d.ts +3 -3
- package/dist/umd/tools/hcs6/RegisterDynamicHashinalTool.d.ts +7 -7
- package/dist/umd/tools/hcs6/UpdateDynamicHashinalTool.d.ts +7 -7
- package/dist/umd/tools/inscriber/InscribeFromBufferTool.d.ts +7 -6
- package/dist/umd/tools/inscriber/base-inscriber-tools.d.ts +11 -0
- package/dist/umd/tools/inscriber/inscriber-tool-params.d.ts +3 -0
- package/dist/umd/types/content-resolver.d.ts +6 -0
- package/package.json +2 -2
- package/src/builders/hcs10/hcs10-builder.ts +2 -3
- package/src/config/ContentReferenceConfig.ts +30 -0
- package/src/index.ts +3 -1
- package/src/tools/hcs6/CreateDynamicRegistryTool.ts +22 -33
- package/src/tools/hcs6/QueryDynamicRegistryTool.ts +23 -33
- package/src/tools/hcs6/RegisterDynamicHashinalTool.ts +25 -35
- package/src/tools/hcs6/UpdateDynamicHashinalTool.ts +25 -36
- package/src/tools/inscriber/InscribeFromBufferTool.ts +239 -120
- package/src/tools/inscriber/base-inscriber-tools.ts +19 -0
- package/src/tools/inscriber/inscriber-tool-params.ts +3 -0
- package/src/types/content-resolver.ts +11 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standards-agent-kit.es3.js","sources":["../../src/builders/hcs2/hcs2-builder.ts"],"sourcesContent":["import { BaseServiceBuilder } from 'hedera-agent-kit';\nimport type { HederaAgentKit } from 'hedera-agent-kit';\nimport {\n HCS2Client,\n SDKHCS2ClientConfig,\n CreateRegistryOptions,\n RegisterEntryOptions,\n UpdateEntryOptions,\n DeleteEntryOptions,\n MigrateTopicOptions,\n QueryRegistryOptions,\n TopicRegistrationResponse,\n RegistryOperationResponse,\n TopicRegistry,\n NetworkType,\n} from '@hashgraphonline/standards-sdk';\n\n/**\n * Builder for HCS-2 operations that delegates to HCS2Client\n */\nexport class HCS2Builder extends BaseServiceBuilder {\n protected hcs2Client?: HCS2Client;\n\n constructor(hederaKit: HederaAgentKit) {\n super(hederaKit);\n }\n\n /**\n * Get or create HCS-2 client\n */\n protected async getHCS2Client(): Promise<HCS2Client> {\n if (!this.hcs2Client) {\n const operatorId = this.hederaKit.signer.getAccountId().toString();\n const operatorPrivateKey = this.hederaKit.signer?.getOperatorPrivateKey()\n ? this.hederaKit.signer.getOperatorPrivateKey().toStringRaw()\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: SDKHCS2ClientConfig = {\n network: networkType,\n operatorId: operatorId,\n operatorKey: operatorPrivateKey,\n };\n\n this.hcs2Client = new HCS2Client(config);\n }\n return this.hcs2Client;\n }\n\n /**\n * Create a new HCS-2 registry\n * Note: This executes the transaction directly via HCS2Client\n */\n async createRegistry(\n options: CreateRegistryOptions = {}\n ): Promise<TopicRegistrationResponse> {\n const client = await this.getHCS2Client();\n return await client.createRegistry(options);\n }\n\n /**\n * Register a new entry in an HCS-2 registry\n */\n async registerEntry(\n registryTopicId: string,\n options: RegisterEntryOptions\n ): Promise<RegistryOperationResponse> {\n const client = await this.getHCS2Client();\n return await client.registerEntry(registryTopicId, options);\n }\n\n /**\n * Update an existing entry in an HCS-2 registry\n */\n async updateEntry(\n registryTopicId: string,\n options: UpdateEntryOptions\n ): Promise<RegistryOperationResponse> {\n const client = await this.getHCS2Client();\n return await client.updateEntry(registryTopicId, options);\n }\n\n /**\n * Delete an entry from an HCS-2 registry\n */\n async deleteEntry(\n registryTopicId: string,\n options: DeleteEntryOptions\n ): Promise<RegistryOperationResponse> {\n const client = await this.getHCS2Client();\n return await client.deleteEntry(registryTopicId, options);\n }\n\n /**\n * Migrate an HCS-2 registry to a new topic\n */\n async migrateRegistry(\n registryTopicId: string,\n options: MigrateTopicOptions\n ): Promise<RegistryOperationResponse> {\n const client = await this.getHCS2Client();\n return await client.migrateRegistry(registryTopicId, options);\n }\n\n /**\n * Query entries from an HCS-2 registry\n */\n async getRegistry(\n topicId: string,\n options: QueryRegistryOptions = {}\n ): Promise<TopicRegistry> {\n const client = await this.getHCS2Client();\n return await client.getRegistry(topicId, options);\n }\n\n /**\n * Submit a raw message to an HCS-2 topic\n */\n async submitMessage(\n topicId: string,\n payload: any\n ): Promise<any> {\n const client = await this.getHCS2Client();\n return await client.submitMessage(topicId, payload);\n }\n\n /**\n * Get topic info from mirror node\n */\n async getTopicInfo(topicId: string): Promise<any> {\n const client = await this.getHCS2Client();\n return await client.getTopicInfo(topicId);\n }\n\n /**\n * Close the HCS-2 client\n */\n async close(): Promise<void> {\n if (this.hcs2Client) {\n this.hcs2Client.close();\n this.hcs2Client = undefined;\n }\n }\n}"],"names":[],"mappings":";;AAoBO,MAAM,oBAAoB,mBAAmB;AAAA,EAGlD,YAAY,WAA2B;AACrC,UAAM,SAAS;AAAA,EACjB;AAAA;AAAA;AAAA;AAAA,EAKA,MAAgB,gBAAqC;AACnD,QAAI,CAAC,KAAK,YAAY;AACpB,YAAM,aAAa,KAAK,UAAU,OAAO,aAAA,EAAe,SAAA;AACxD,YAAM,qBAAqB,KAAK,UAAU,QAAQ,sBAAA,IAC9C,KAAK,UAAU,OAAO,wBAAwB,YAAA,IAC9C;AAEJ,YAAM,UAAU,KAAK,UAAU,OAAO;AACtC,YAAM,cAA2B,QAAQ,SA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AAAA;AAAA;AAAA,EAKA,MAAM,aAAa,SAA+B;AAChD,UAAM,SAAS,MAAM,KAAK,cAAA;AAC1B,WAAO,MAAM,OAAO,aAAa,OAAO;AAAA,EAC1C;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,QAAuB;AAC3B,QAAI,KAAK,YAAY;AACnB,WAAK,WAAW,MAAA;AAChB,WAAK,aAAa;AAAA,IACpB;AAAA,EACF;AACF;"}
|
|
1
|
+
{"version":3,"file":"standards-agent-kit.es3.js","sources":["../../src/builders/hcs10/hcs10-builder.ts"],"sourcesContent":["import { BaseServiceBuilder } from 'hedera-agent-kit';\nimport type { HederaAgentKit } from 'hedera-agent-kit';\nimport { PrivateKey, TransactionReceipt } from '@hashgraph/sdk';\nimport { ActiveConnection, IStateManager } from '../../state/state-types';\nimport { ExecuteResult } from '../types';\nimport {\n FeeConfigBuilderInterface,\n FeeConfigBuilder,\n HCS10Client,\n AgentBuilder,\n InboundTopicType as StandardInboundTopicType,\n AIAgentCapability as StandardAIAgentCapability,\n AgentRegistrationResult,\n ProfileResponse as SDKProfileResponse,\n HCSMessage,\n LogLevel,\n Logger as SDKLogger,\n SocialPlatform,\n HandleConnectionRequestResponse,\n Connection,\n} from '@hashgraphonline/standards-sdk';\nimport fs from 'fs';\nimport path from 'path';\nimport axios from 'axios';\n\nconst NOT_INITIALIZED_ERROR = 'ConnectionsManager not initialized';\n\n/**\n * Internal agent data for registration\n */\ninterface AgentRegistrationData {\n name: string;\n bio?: string;\n alias?: string;\n type?: 'autonomous' | 'manual';\n model?: string;\n capabilities?: number[];\n creator?: string;\n socials?: Record<string, string>;\n properties?: Record<string, unknown>;\n pfpBuffer?: Buffer;\n pfpFileName?: string;\n existingProfilePictureTopicId?: string;\n feeConfig?: FeeConfigBuilderInterface;\n}\n\n/**\n * Message response with timestamp\n */\nexport interface HCSMessageWithTimestamp extends Omit<HCSMessage, 'op'> {\n timestamp: number;\n data?: string;\n sequence_number: number;\n op?: HCSMessage['op'] | string;\n operator_id?: string;\n created?: Date;\n m?: string;\n}\n\n/**\n * Network type for HCS-10\n */\nexport type StandardNetworkType = 'mainnet' | 'testnet';\n\n/**\n * Parameters for agent registration\n */\nexport interface RegisterAgentParams {\n name: string;\n bio?: string;\n alias?: string;\n type?: 'autonomous' | 'manual';\n model?: string;\n capabilities?: number[];\n creator?: string;\n socials?: Record<string, string>;\n properties?: Record<string, unknown>;\n profilePicture?:\n | string\n | {\n url?: string;\n path?: string;\n filename?: string;\n };\n existingProfilePictureTopicId?: string;\n initialBalance?: number;\n userAccountId?: string;\n hbarFee?: number;\n tokenFees?: Array<{\n amount: number;\n tokenId: string;\n }>;\n exemptAccountIds?: string[];\n}\n\n/**\n * Parameters for initiating a connection\n */\nexport interface InitiateConnectionParams {\n targetAccountId: string;\n disableMonitor?: boolean;\n memo?: string;\n}\n\n/**\n * Parameters for accepting a connection request\n */\nexport interface AcceptConnectionParams {\n requestKey: string;\n hbarFee?: number | undefined;\n exemptAccountIds?: string[] | undefined;\n}\n\n/**\n * Parameters for sending a message\n */\nexport interface SendMessageParams {\n topicId: string;\n message: string;\n disableMonitoring?: boolean;\n}\n\n/**\n * Parameters for sending a message to a connected account\n */\nexport interface SendMessageToConnectionParams {\n targetIdentifier: string;\n message: string;\n disableMonitoring?: boolean;\n}\n\n/**\n * HCS10Builder facilitates HCS-10 protocol operations for agent communication\n * This builder incorporates all HCS10Client functionality directly\n */\nexport class HCS10Builder extends BaseServiceBuilder {\n private standardClient: HCS10Client;\n private stateManager: IStateManager | undefined;\n private executeResult?: ExecuteResult & { rawResult?: unknown };\n private useEncryption: boolean = false;\n private guardedRegistryBaseUrl: string = '';\n private network: StandardNetworkType;\n private sdkLogger: SDKLogger;\n\n constructor(\n hederaKit: HederaAgentKit,\n stateManager?: IStateManager,\n options?: {\n useEncryption?: boolean;\n registryUrl?: string;\n logLevel?: LogLevel;\n }\n ) {\n super(hederaKit);\n this.stateManager = stateManager;\n this.useEncryption = options?.useEncryption || false;\n this.guardedRegistryBaseUrl = options?.registryUrl || '';\n\n const network = this.hederaKit.client.network;\n this.network = network.toString().includes('mainnet')\n ? 'mainnet'\n : 'testnet';\n\n const operatorId = this.hederaKit.signer.getAccountId().toString();\n const operatorPrivateKey = this.hederaKit.signer?.getOperatorPrivateKey()\n ? this.hederaKit.signer.getOperatorPrivateKey().toStringRaw()\n : '';\n\n this.sdkLogger = new SDKLogger({\n module: 'HCS10Builder',\n level: options?.logLevel || 'info',\n });\n\n this.standardClient = new HCS10Client({\n network: this.network,\n operatorId: operatorId,\n operatorPrivateKey: operatorPrivateKey,\n logLevel: options?.logLevel || 'info',\n });\n\n if (this.stateManager) {\n this.stateManager.initializeConnectionsManager(this.standardClient);\n }\n }\n\n /**\n * Get the operator account ID\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 /**\n * Get the network type\n */\n public getNetwork(): StandardNetworkType {\n return this.network;\n }\n\n /**\n * Get state manager instance\n */\n public getStateManager(): IStateManager | undefined {\n return this.stateManager;\n }\n\n /**\n * Get account and signer information\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 * Get the inbound topic ID for the current operator\n */\n public async getInboundTopicId(): Promise<string> {\n try {\n const operatorId = this.getOperatorId();\n this.logger.info(\n `[HCS10Builder] 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 `[HCS10Builder] 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 `[HCS10Builder] 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 * Get agent profile\n */\n public async getAgentProfile(accountId: string): Promise<SDKProfileResponse> {\n try {\n return await this.standardClient.retrieveProfile(accountId);\n } catch (error) {\n this.logger.error(\n `[HCS10Builder] Error retrieving agent profile for account ${accountId}:`,\n error\n );\n throw error;\n }\n }\n\n /**\n * Submit connection request\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 * Handle connection request\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\n if (\n result &&\n result.connectionTopicId &&\n typeof result.connectionTopicId === 'object' &&\n 'toString' in result.connectionTopicId\n ) {\n result.connectionTopicId = (\n result.connectionTopicId as { toString(): string }\n ).toString();\n }\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 * Send message to a topic\n */\n public async sendMessage(\n topicId: string,\n data: string,\n memo?: string\n ): Promise<{\n sequenceNumber: number | undefined;\n receipt: TransactionReceipt;\n transactionId: string | undefined;\n }> {\n if (topicId && typeof topicId === 'object' && 'toString' in topicId) {\n topicId = (topicId as unknown as { toString: () => string })?.toString();\n }\n\n if (!topicId || typeof topicId !== 'string') {\n throw new Error(\n `Invalid topic ID provided to sendMessage: ${JSON.stringify(topicId)}`\n );\n }\n\n try {\n const messageResponse = await this.standardClient.sendMessage(\n topicId,\n data,\n memo,\n undefined\n );\n return {\n sequenceNumber: messageResponse.topicSequenceNumber?.toNumber(),\n receipt: messageResponse as unknown as TransactionReceipt,\n transactionId:\n 'transactionId' in messageResponse\n ? (\n messageResponse as { transactionId?: { toString(): string } }\n ).transactionId?.toString()\n : undefined,\n };\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 * Get messages from a topic\n */\n public async getMessages(topicId: string): Promise<{\n messages: HCSMessageWithTimestamp[];\n }> {\n if (topicId && typeof topicId === 'object' && 'toString' in topicId) {\n topicId = (topicId as unknown as { toString: () => string })?.toString();\n }\n\n if (!topicId || typeof topicId !== 'string') {\n throw new Error(\n `Invalid topic ID provided to getMessages: ${JSON.stringify(topicId)}`\n );\n }\n\n try {\n const result = await this.standardClient.getMessages(topicId);\n\n const mappedMessages: HCSMessageWithTimestamp[] = result.messages.map(\n (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 p: 'hcs-10' as const,\n } as HCSMessageWithTimestamp;\n }\n );\n mappedMessages.sort(\n (a: { timestamp: number }, b: { timestamp: number }) =>\n a.timestamp - b.timestamp\n );\n return { messages: mappedMessages };\n } catch (error) {\n this.logger.error(`Error getting messages from topic ${topicId}:`, error);\n return { messages: [] };\n }\n }\n\n /**\n * Get message stream from a topic\n */\n public async getMessageStream(topicId: string): Promise<{\n messages: HCSMessage[];\n }> {\n if (topicId && typeof topicId === 'object' && 'toString' in topicId) {\n topicId = (topicId as unknown as { toString: () => string })?.toString();\n }\n\n if (!topicId || typeof topicId !== 'string') {\n throw new Error(\n `Invalid topic ID provided to getMessageStream: ${JSON.stringify(\n topicId\n )}`\n );\n }\n\n return this.standardClient.getMessageStream(topicId) as Promise<{\n messages: HCSMessage[];\n }>;\n }\n\n /**\n * Get 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 * Get the standard client instance (for compatibility)\n */\n public getStandardClient(): HCS10Client {\n return this.standardClient;\n }\n\n /**\n * Load profile picture from URL or file path\n */\n private async loadProfilePicture(\n profilePicture: string | { url?: string; path?: string; filename?: string }\n ): Promise<{ buffer: Buffer; filename: string } | null> {\n try {\n if (!profilePicture) {\n return null;\n }\n\n if (typeof profilePicture === 'string') {\n const isUrl =\n profilePicture.startsWith('http://') ||\n profilePicture.startsWith('https://');\n\n if (isUrl) {\n this.logger.info(\n `Loading profile picture from URL: ${profilePicture}`\n );\n const response = await axios.get(profilePicture, {\n responseType: 'arraybuffer',\n });\n const buffer = Buffer.from(response.data);\n const urlPathname = new URL(profilePicture).pathname;\n const filename = path.basename(urlPathname) || 'profile.png';\n return { buffer, filename };\n } else {\n if (!fs.existsSync(profilePicture)) {\n this.logger.warn(\n `Profile picture file not found: ${profilePicture}`\n );\n return null;\n }\n this.logger.info(\n `Loading profile picture from file: ${profilePicture}`\n );\n const buffer = fs.readFileSync(profilePicture);\n const filename = path.basename(profilePicture);\n return { buffer, filename };\n }\n } else if (profilePicture.url) {\n this.logger.info(\n `Loading profile picture from URL: ${profilePicture.url}`\n );\n const response = await axios.get(profilePicture.url, {\n responseType: 'arraybuffer',\n });\n const buffer = Buffer.from(response.data);\n const filename = profilePicture.filename || 'profile.png';\n return { buffer, filename };\n } else if (profilePicture.path) {\n if (!fs.existsSync(profilePicture.path)) {\n this.logger.warn(\n `Profile picture file not found: ${profilePicture.path}`\n );\n return null;\n }\n this.logger.info(\n `Loading profile picture from file: ${profilePicture.path}`\n );\n const buffer = fs.readFileSync(profilePicture.path);\n const filename =\n profilePicture.filename || path.basename(profilePicture.path);\n return { buffer, filename };\n }\n\n return null;\n } catch (error) {\n this.logger.error('Failed to load profile picture:', error);\n return null;\n }\n }\n\n /**\n * Create and register an agent\n */\n private async createAndRegisterAgent(\n data: AgentRegistrationData\n ): Promise<AgentRegistrationResult> {\n const builder = new AgentBuilder()\n .setName(data.name)\n .setBio(data.bio || '')\n .setCapabilities(\n data.capabilities || [StandardAIAgentCapability.TEXT_GENERATION]\n )\n .setType(data.type || 'autonomous')\n .setModel(data.model || 'agent-model-2024')\n .setNetwork(this.getNetwork())\n .setInboundTopicType(StandardInboundTopicType.PUBLIC);\n\n if (data.alias) {\n builder.setAlias(data.alias);\n }\n\n if (data.creator) {\n builder.setCreator(data.creator);\n }\n\n if (data?.feeConfig) {\n builder.setInboundTopicType(StandardInboundTopicType.FEE_BASED);\n builder.setFeeConfig(data.feeConfig);\n }\n\n if (data.existingProfilePictureTopicId) {\n builder.setExistingProfilePicture(data.existingProfilePictureTopicId);\n } else if (data.pfpBuffer && data.pfpFileName) {\n if (data.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: ${data.pfpFileName} (${data.pfpBuffer.byteLength} bytes)`\n );\n builder.setProfilePicture(data.pfpBuffer, data.pfpFileName);\n }\n } else {\n this.logger.warn(\n 'Profile picture not provided. Agent creation might fail if required by the underlying SDK builder.'\n );\n }\n\n if (data.socials) {\n Object.entries(data.socials).forEach(([platform, handle]) => {\n builder.addSocial(platform as SocialPlatform, handle);\n });\n }\n\n if (data.properties) {\n Object.entries(data.properties).forEach(([key, value]) => {\n builder.addProperty(key, value);\n });\n }\n\n try {\n const hasFees = Boolean(data?.feeConfig);\n const result = await this.standardClient.createAndRegisterAgent(builder, {\n initialBalance: hasFees ? 50 : 10,\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 * Register a new HCS-10 agent\n * Note: This performs multiple transactions and requires directExecution mode\n */\n public async registerAgent(params: RegisterAgentParams): Promise<this> {\n this.clearNotes();\n\n if (this.hederaKit.operationalMode === 'returnBytes') {\n throw new Error(\n 'Agent registration requires multiple transactions and cannot be performed in returnBytes mode. ' +\n 'Please use autonomous mode.'\n );\n }\n\n try {\n let profilePictureData: { buffer: Buffer; filename: string } | null =\n null;\n if (params.profilePicture) {\n profilePictureData = await this.loadProfilePicture(\n params.profilePicture\n );\n }\n\n const registrationData: AgentRegistrationData = {\n name: params.name,\n ...(params.bio !== undefined && { bio: params.bio }),\n ...(params.alias !== undefined && { alias: params.alias }),\n ...(params.type !== undefined && { type: params.type }),\n ...(params.model !== undefined && { model: params.model }),\n ...(params.capabilities !== undefined && {\n capabilities: params.capabilities,\n }),\n ...(params.creator !== undefined && { creator: params.creator }),\n ...(params.socials !== undefined && { socials: params.socials }),\n ...(params.properties !== undefined && {\n properties: params.properties,\n }),\n ...(params.existingProfilePictureTopicId !== undefined && {\n existingProfilePictureTopicId: params.existingProfilePictureTopicId,\n }),\n ...(profilePictureData?.buffer !== undefined && {\n pfpBuffer: profilePictureData.buffer,\n }),\n ...(profilePictureData?.filename !== undefined && {\n pfpFileName: profilePictureData.filename,\n }),\n };\n\n if (params.hbarFee && params.hbarFee > 0) {\n const feeConfigBuilder = new FeeConfigBuilder({\n network: this.network,\n logger: this.sdkLogger,\n });\n\n const { accountId: collectorAccountId } = this.getAccountAndSigner();\n if (!collectorAccountId) {\n throw new Error('Could not determine account ID for fee collection.');\n }\n this.addNote(\n `Setting the operator account (${collectorAccountId}) as the fee collector since no specific collector was provided.`\n );\n\n const effectiveExemptIds =\n params.exemptAccountIds?.filter(\n (id: string) => id !== collectorAccountId && id.startsWith('0.0')\n ) || [];\n\n registrationData.feeConfig = feeConfigBuilder.addHbarFee(\n params.hbarFee,\n collectorAccountId,\n effectiveExemptIds\n );\n }\n\n const result = await this.createAndRegisterAgent(registrationData);\n\n this.executeResult = {\n success: true,\n transactionId: result.transactionId,\n receipt: undefined,\n scheduleId: undefined,\n rawResult: {\n ...result,\n name: params.name,\n accountId:\n result?.metadata?.accountId ||\n result.state?.agentMetadata?.accountId,\n },\n } as unknown as ExecuteResult & { rawResult?: unknown };\n } catch (error) {\n this.logger.error('Failed to register agent:', error);\n throw error;\n }\n\n return this;\n }\n\n /**\n * Initiate a connection to another agent\n */\n public async initiateConnection(\n params: InitiateConnectionParams\n ): Promise<this> {\n this.clearNotes();\n\n try {\n const targetProfile = await this.getAgentProfile(params.targetAccountId);\n\n if (!targetProfile.success || !targetProfile.topicInfo?.inboundTopic) {\n throw new Error(\n `Could not retrieve inbound topic for target account ${params.targetAccountId}`\n );\n }\n\n const targetInboundTopicId = targetProfile.topicInfo.inboundTopic;\n let memo: string;\n if (params.memo !== undefined) {\n memo = params.memo;\n } else {\n memo = params.disableMonitor ? 'false' : 'true';\n this.addNote(\n `No custom memo was provided. Using default memo '${memo}' based on monitoring preference.`\n );\n }\n if (!params.disableMonitor) {\n this.addNote(\n `Monitoring will be enabled for this connection request as disableMonitor was not specified.`\n );\n }\n\n const result = await this.submitConnectionRequest(\n targetInboundTopicId,\n memo\n );\n\n this.executeResult = {\n success: true,\n transactionId:\n 'transactionId' in result\n ? (\n result as { transactionId?: { toString(): string } }\n ).transactionId?.toString()\n : undefined,\n receipt: result,\n scheduleId: undefined,\n rawResult: {\n targetAccountId: params.targetAccountId,\n targetInboundTopicId,\n connectionRequestSent: true,\n monitoringEnabled: !params.disableMonitor,\n ...result,\n },\n } as unknown as ExecuteResult & { rawResult?: unknown };\n } catch (error) {\n this.logger.error('Failed to initiate connection:', error);\n throw error;\n }\n\n return this;\n }\n\n /**\n * Accept a connection request\n * Note: This performs multiple transactions and requires directExecution mode\n */\n public async acceptConnection(params: AcceptConnectionParams): Promise<this> {\n this.clearNotes();\n\n if (this.hederaKit.operationalMode === 'returnBytes') {\n throw new Error(\n 'Accepting connections requires multiple transactions and cannot be performed in returnBytes mode. ' +\n 'Please use autonomous mode.'\n );\n }\n\n try {\n const currentAgent = this.stateManager?.getCurrentAgent();\n if (!currentAgent) {\n throw new Error(\n 'Cannot accept connection request. No agent is currently active. Please register or select an agent first.'\n );\n }\n\n const connectionsManager = this.stateManager?.getConnectionsManager();\n if (!connectionsManager) {\n throw new Error(NOT_INITIALIZED_ERROR);\n }\n\n await connectionsManager.fetchConnectionData(currentAgent.accountId);\n\n const allRequests = [\n ...connectionsManager.getPendingRequests(),\n ...connectionsManager.getConnectionsNeedingConfirmation(),\n ];\n\n const request = allRequests.find(\n (r) =>\n r.uniqueRequestKey === params.requestKey ||\n r.connectionRequestId?.toString() === params.requestKey ||\n r.inboundRequestId?.toString() === params.requestKey\n );\n\n if (!request) {\n throw new Error(\n `Request with key ${params.requestKey} not found or no longer pending.`\n );\n }\n\n if (!request.needsConfirmation || !request.inboundRequestId) {\n throw new Error(\n `Request with key ${params.requestKey} is not an inbound request that can be accepted.`\n );\n }\n\n const targetAccountId = request.targetAccountId;\n const inboundRequestId = request.inboundRequestId;\n\n let feeConfig: FeeConfigBuilderInterface | undefined;\n\n if (params.hbarFee && params.hbarFee > 0) {\n const feeConfigBuilder = new FeeConfigBuilder({\n network: this.network,\n logger: this.sdkLogger,\n });\n\n const { accountId: collectorAccountId } = this.getAccountAndSigner();\n if (!collectorAccountId) {\n throw new Error('Could not determine account ID for fee collection.');\n }\n this.addNote(\n `Setting the operator account (${collectorAccountId}) as the fee collector since no specific collector was provided.`\n );\n\n const effectiveExemptIds =\n params.exemptAccountIds?.filter(\n (id: string) => id !== collectorAccountId && id.startsWith('0.0')\n ) || [];\n\n feeConfig = feeConfigBuilder.addHbarFee(\n params.hbarFee,\n collectorAccountId,\n effectiveExemptIds\n );\n }\n\n const inboundTopicId = await this.getInboundTopicId();\n const confirmationResult = await this.handleConnectionRequest(\n inboundTopicId,\n targetAccountId,\n inboundRequestId,\n feeConfig\n );\n\n let connectionTopicId = confirmationResult?.connectionTopicId;\n\n if (\n connectionTopicId &&\n typeof connectionTopicId === 'object' &&\n 'toString' in connectionTopicId\n ) {\n connectionTopicId = (\n connectionTopicId as unknown as { toString: () => string }\n )?.toString();\n }\n\n if (!connectionTopicId || typeof connectionTopicId !== 'string') {\n throw new Error(\n `Failed to create connection topic. Got: ${JSON.stringify(\n connectionTopicId\n )}`\n );\n }\n\n if (this.stateManager) {\n const targetAgentName =\n request.targetAgentName || `Agent ${targetAccountId}`;\n if (!request.targetAgentName) {\n this.addNote(\n `No agent name was provided in the connection request, using default name 'Agent ${targetAccountId}'.`\n );\n }\n\n let targetInboundTopicId = request.targetInboundTopicId || '';\n if (!targetInboundTopicId) {\n try {\n const targetProfile = await this.getAgentProfile(targetAccountId);\n if (\n targetProfile.success &&\n targetProfile.topicInfo?.inboundTopic\n ) {\n targetInboundTopicId = targetProfile.topicInfo.inboundTopic;\n }\n } catch (profileError) {\n this.logger.warn(\n `Could not fetch profile for ${targetAccountId}:`,\n profileError\n );\n }\n }\n\n const newConnection = {\n connectionId: `conn-${Date.now()}`,\n targetAccountId: targetAccountId,\n targetAgentName: targetAgentName,\n targetInboundTopicId: targetInboundTopicId,\n connectionTopicId: connectionTopicId,\n status: 'established' as const,\n created: new Date(),\n };\n this.stateManager.addActiveConnection(newConnection);\n\n connectionsManager.markConnectionRequestProcessed(\n request.targetInboundTopicId || '',\n inboundRequestId\n );\n }\n\n this.executeResult = {\n success: true,\n transactionId: undefined,\n receipt: undefined,\n scheduleId: undefined,\n rawResult: {\n targetAccountId,\n connectionTopicId,\n feeConfigured: !!params.hbarFee,\n hbarFee: params.hbarFee || 0,\n confirmationResult,\n },\n } as unknown as ExecuteResult & { rawResult?: unknown };\n } catch (error) {\n this.logger.error('Failed to accept connection:', error);\n throw error;\n }\n\n return this;\n }\n\n /**\n * Send a message using HCS (for operations that need direct topic access)\n */\n public async sendHCS10Message(params: SendMessageParams): Promise<this> {\n this.clearNotes();\n\n try {\n const result = await this.sendMessage(params.topicId, params.message);\n\n this.executeResult = {\n success: true,\n transactionId: result.transactionId,\n receipt: result.receipt,\n scheduleId: undefined,\n rawResult: result,\n } as unknown as ExecuteResult & { rawResult?: unknown };\n\n this.addNote(`Message sent to topic ${params.topicId}.`);\n } catch (error) {\n this.logger.error('Failed to send message:', error);\n throw error;\n }\n\n return this;\n }\n\n /**\n * Send a message to a connected account with optional response monitoring\n */\n public async sendMessageToConnection(\n params: SendMessageToConnectionParams\n ): Promise<this> {\n this.clearNotes();\n\n if (!this.stateManager) {\n throw new Error(\n 'StateManager is required to send messages to connections'\n );\n }\n\n try {\n const currentAgent = this.stateManager.getCurrentAgent();\n if (!currentAgent) {\n throw new Error(\n 'Cannot send message. No agent is currently active. Please register or select an agent first.'\n );\n }\n\n let connection: ActiveConnection | undefined;\n\n const identifier = params.targetIdentifier;\n\n if (identifier.includes('@')) {\n const parts = identifier.split('@');\n if (parts.length === 2) {\n const accountId = parts[1];\n connection = this.stateManager.getConnectionByIdentifier(accountId);\n\n if (!connection) {\n this.addNote(\n `Could not find connection using request key '${identifier}', extracted account ID '${accountId}'.`\n );\n }\n }\n }\n\n if (!connection) {\n connection = this.stateManager.getConnectionByIdentifier(identifier);\n }\n\n if (\n !connection &&\n !identifier.startsWith('0.0.') &&\n /^\\d+$/.test(identifier)\n ) {\n const accountIdWithPrefix = `0.0.${identifier}`;\n connection =\n this.stateManager.getConnectionByIdentifier(accountIdWithPrefix);\n if (connection) {\n this.addNote(\n `Found connection using account ID with prefix: ${accountIdWithPrefix}`\n );\n }\n }\n\n if (!connection && /^[1-9]\\d*$/.test(identifier)) {\n const connections = this.stateManager.listConnections();\n const index = parseInt(identifier) - 1;\n if (index >= 0 && index < connections.length) {\n connection = connections[index];\n if (connection) {\n this.addNote(\n `Found connection by index ${identifier}: ${connection.targetAccountId}`\n );\n }\n }\n }\n\n if (!connection) {\n const connections = this.stateManager.listConnections();\n const availableIds = connections.map(\n (c, i) =>\n `${i + 1}. ${c.targetAccountId} (Topic: ${c.connectionTopicId})`\n );\n\n let errorMsg = `Connection not found for identifier: \"${identifier}\"\\n`;\n errorMsg += `Available connections:\\n${\n availableIds.join('\\n') || 'No active connections'\n }`;\n errorMsg += `\\n\\nYou can use:\\n`;\n errorMsg += `- Connection number (e.g., \"1\", \"2\")\\n`;\n errorMsg += `- Account ID (e.g., \"0.0.6412936\")\\n`;\n errorMsg += `- Connection topic ID\\n`;\n errorMsg += `Use 'list_connections' to see all active connections.`;\n\n throw new Error(errorMsg);\n }\n\n let connectionTopicId = connection.connectionTopicId;\n if (\n connectionTopicId &&\n typeof connectionTopicId === 'object' &&\n 'toString' in connectionTopicId\n ) {\n connectionTopicId = (\n connectionTopicId as unknown as { toString: () => string }\n )?.toString();\n }\n\n if (!connectionTopicId || typeof connectionTopicId !== 'string') {\n throw new Error(\n `Invalid connection topic ID for ${\n connection.targetAccountId\n }: ${JSON.stringify(\n connectionTopicId\n )} (type: ${typeof connectionTopicId})`\n );\n }\n\n const targetAgentName = connection.targetAgentName;\n\n const operatorId = `${currentAgent.inboundTopicId}@${currentAgent.accountId}`;\n\n const messageResult = await this.sendMessage(\n connectionTopicId,\n params.message,\n `Agent message from ${currentAgent.name}`\n );\n\n if (!messageResult.sequenceNumber) {\n throw new Error('Failed to send message');\n }\n\n let reply: string | null = null;\n if (!params.disableMonitoring) {\n reply = await this.monitorResponses(\n connectionTopicId,\n operatorId,\n messageResult.sequenceNumber\n );\n } else {\n this.addNote(\n `Message sent successfully. Response monitoring was disabled.`\n );\n }\n\n this.executeResult = {\n success: true,\n transactionId: messageResult.transactionId,\n receipt: messageResult.receipt,\n scheduleId: undefined,\n rawResult: {\n targetAgentName,\n targetAccountId: connection.targetAccountId,\n connectionTopicId,\n sequenceNumber: messageResult.sequenceNumber,\n reply,\n monitoringEnabled: !params.disableMonitoring,\n message: params.message,\n messageResult,\n },\n };\n } catch (error) {\n this.logger.error('Failed to send message to connection:', error);\n throw error;\n }\n\n return this;\n }\n\n /**\n * Monitor responses on a topic after sending a message\n */\n private async monitorResponses(\n topicId: string,\n operatorId: string,\n sequenceNumber: number\n ): Promise<string | null> {\n const maxAttempts = 30;\n let attempts = 0;\n\n while (attempts < maxAttempts) {\n try {\n const messages = await this.getMessageStream(topicId);\n\n for (const message of messages.messages) {\n if (\n message.sequence_number < sequenceNumber ||\n message.operator_id === operatorId\n ) {\n continue;\n }\n const content = await this.getMessageContent(message.data || '');\n return content;\n }\n } catch (error) {\n this.logger.error(`Error monitoring responses: ${error}`);\n }\n await new Promise((resolve) => setTimeout(resolve, 4000));\n attempts++;\n }\n return null;\n }\n\n /**\n * Start passive monitoring for incoming connection requests\n * This method monitors continuously in the background\n */\n public async startPassiveConnectionMonitoring(): Promise<this> {\n this.clearNotes();\n\n if (!this.stateManager) {\n throw new Error('StateManager is required for passive monitoring');\n }\n\n const inboundTopicId = await this.getInboundTopicId();\n this.logger.info(\n `Starting passive connection monitoring on topic ${inboundTopicId}...`\n );\n\n this.executeResult = {\n success: true,\n transactionId: undefined,\n receipt: undefined,\n scheduleId: undefined,\n rawResult: {\n inboundTopicId,\n message: `Started monitoring inbound topic ${inboundTopicId} for connection requests in the background.`,\n },\n } as unknown as ExecuteResult & { rawResult?: unknown };\n\n return this;\n }\n\n /**\n * Monitor for incoming connection requests\n */\n public async monitorConnections(params: {\n acceptAll?: boolean;\n targetAccountId?: string;\n monitorDurationSeconds?: number;\n hbarFees?: Array<{ amount: number; collectorAccount?: string }>;\n tokenFees?: Array<{\n amount: number;\n tokenId: string;\n collectorAccount?: string;\n }>;\n exemptAccountIds?: string[];\n defaultCollectorAccount?: string;\n }): Promise<this> {\n this.clearNotes();\n\n const {\n acceptAll = false,\n targetAccountId,\n monitorDurationSeconds = 120,\n hbarFees = [],\n tokenFees = [],\n exemptAccountIds = [],\n defaultCollectorAccount,\n } = params;\n\n if (!this.stateManager) {\n throw new Error('StateManager is required for connection monitoring');\n }\n\n const currentAgent = this.stateManager.getCurrentAgent();\n if (!currentAgent) {\n throw new Error(\n 'Cannot monitor for connections. No agent is currently active.'\n );\n }\n\n const inboundTopicId = await this.getInboundTopicId();\n const endTime = Date.now() + monitorDurationSeconds * 1000;\n const pollIntervalMs = 3000;\n let connectionRequestsFound = 0;\n let acceptedConnections = 0;\n const processedRequestIds = new Set<number>();\n\n while (Date.now() < endTime) {\n try {\n const messagesResult = await this.getMessages(inboundTopicId);\n const connectionRequests = messagesResult.messages.filter(\n (msg) =>\n msg.op === 'connection_request' &&\n typeof msg.sequence_number === 'number'\n );\n\n for (const request of connectionRequests) {\n const connectionRequestId = request.sequence_number;\n if (\n !connectionRequestId ||\n processedRequestIds.has(connectionRequestId)\n ) {\n continue;\n }\n\n const requestingAccountId = request.operator_id?.split('@')[1];\n if (!requestingAccountId) {\n continue;\n }\n\n connectionRequestsFound++;\n\n if (targetAccountId && requestingAccountId !== targetAccountId) {\n this.logger.info(\n `Skipping request from ${requestingAccountId} (not target account)`\n );\n continue;\n }\n\n if (acceptAll || targetAccountId === requestingAccountId) {\n this.logger.info(\n `Accepting connection request from ${requestingAccountId}`\n );\n\n let feeConfig;\n if (hbarFees.length > 0 || tokenFees.length > 0) {\n const builder = new FeeConfigBuilder({\n network: this.network,\n logger: this.sdkLogger,\n });\n\n for (const fee of hbarFees) {\n const collectorAccount =\n fee.collectorAccount ||\n defaultCollectorAccount ||\n this.getOperatorId();\n builder.addHbarFee(\n fee.amount,\n collectorAccount,\n exemptAccountIds\n );\n }\n\n for (const fee of tokenFees) {\n const collectorAccount =\n fee.collectorAccount ||\n defaultCollectorAccount ||\n this.getOperatorId();\n builder.addTokenFee(\n fee.amount,\n fee.tokenId,\n collectorAccount,\n undefined,\n exemptAccountIds\n );\n }\n\n feeConfig = builder;\n }\n\n await this.handleConnectionRequest(\n inboundTopicId,\n requestingAccountId,\n connectionRequestId,\n feeConfig\n );\n\n processedRequestIds.add(connectionRequestId);\n acceptedConnections++;\n }\n }\n } catch (error) {\n this.logger.error('Error during connection monitoring:', error);\n }\n\n await new Promise((resolve) => setTimeout(resolve, pollIntervalMs));\n }\n\n this.executeResult = {\n success: true,\n transactionId: undefined,\n receipt: undefined,\n scheduleId: undefined,\n rawResult: {\n connectionRequestsFound,\n acceptedConnections,\n monitorDurationSeconds,\n processedRequestIds: Array.from(processedRequestIds),\n },\n } as unknown as ExecuteResult & { rawResult?: unknown };\n\n this.addNote(\n `Monitoring completed. Found ${connectionRequestsFound} requests, accepted ${acceptedConnections}.`\n );\n\n return this;\n }\n\n /**\n * Manage connection requests (list, view, or reject)\n */\n public async manageConnectionRequests(params: {\n action: 'list' | 'view' | 'reject';\n requestKey?: string;\n }): Promise<this> {\n this.clearNotes();\n\n if (!this.stateManager) {\n throw new Error(\n 'StateManager is required for managing connection requests'\n );\n }\n\n const currentAgent = this.stateManager.getCurrentAgent();\n if (!currentAgent) {\n throw new Error(\n 'Cannot manage connection requests. No agent is currently active.'\n );\n }\n\n const connectionsManager = this.stateManager.getConnectionsManager();\n if (!connectionsManager) {\n throw new Error(NOT_INITIALIZED_ERROR);\n }\n\n try {\n const { accountId } = this.getAccountAndSigner();\n await connectionsManager.fetchConnectionData(accountId);\n\n const pendingRequests = connectionsManager.getPendingRequests();\n const needsConfirmation =\n connectionsManager.getConnectionsNeedingConfirmation();\n const allRequests = [...pendingRequests, ...needsConfirmation];\n\n switch (params.action) {\n case 'list':\n this.executeResult = {\n success: true,\n transactionId: undefined,\n receipt: undefined,\n scheduleId: undefined,\n rawResult: {\n requests: allRequests.map((request, index) => ({\n index: index + 1,\n type: request.needsConfirmation ? 'incoming' : 'outgoing',\n requestKey:\n request.uniqueRequestKey ||\n `${\n request.connectionRequestId ||\n request.inboundRequestId ||\n 'unknown'\n }`,\n targetAccountId: request.targetAccountId,\n targetAgentName:\n request.targetAgentName || `Agent ${request.targetAccountId}`,\n created: request.created.toISOString(),\n memo: request.memo,\n bio: request.profileInfo?.bio,\n })),\n },\n } as unknown as ExecuteResult & { rawResult?: unknown };\n break;\n\n case 'view': {\n if (!params.requestKey) {\n throw new Error('Request key is required for viewing a request');\n }\n const viewRequest = allRequests.find(\n (r) =>\n r.uniqueRequestKey === params.requestKey ||\n r.connectionRequestId?.toString() === params.requestKey ||\n r.inboundRequestId?.toString() === params.requestKey\n );\n if (!viewRequest) {\n throw new Error(`Request with key ${params.requestKey} not found`);\n }\n this.executeResult = {\n success: true,\n transactionId: undefined,\n receipt: undefined,\n scheduleId: undefined,\n rawResult: {\n request: {\n type: viewRequest.needsConfirmation ? 'incoming' : 'outgoing',\n requestKey:\n viewRequest.uniqueRequestKey ||\n `${\n viewRequest.connectionRequestId ||\n viewRequest.inboundRequestId ||\n 'unknown'\n }`,\n targetAccountId: viewRequest.targetAccountId,\n targetAgentName:\n viewRequest.targetAgentName ||\n `Agent ${viewRequest.targetAccountId}`,\n created: viewRequest.created.toISOString(),\n memo: viewRequest.memo,\n profileInfo: viewRequest.profileInfo,\n },\n },\n } as unknown as ExecuteResult & { rawResult?: unknown };\n break;\n }\n\n case 'reject': {\n if (!params.requestKey) {\n throw new Error('Request key is required for rejecting a request');\n }\n const rejectRequest = allRequests.find(\n (r) =>\n r.uniqueRequestKey === params.requestKey ||\n r.connectionRequestId?.toString() === params.requestKey ||\n r.inboundRequestId?.toString() === params.requestKey\n );\n if (!rejectRequest) {\n throw new Error(`Request with key ${params.requestKey} not found`);\n }\n if (rejectRequest.inboundRequestId) {\n connectionsManager.markConnectionRequestProcessed(\n rejectRequest.targetInboundTopicId || '',\n rejectRequest.inboundRequestId\n );\n } else if (rejectRequest.connectionRequestId) {\n connectionsManager.markConnectionRequestProcessed(\n rejectRequest.originTopicId || '',\n rejectRequest.connectionRequestId\n );\n }\n this.executeResult = {\n success: true,\n transactionId: undefined,\n receipt: undefined,\n scheduleId: undefined,\n rawResult: {\n rejectedRequest: {\n requestKey: params.requestKey,\n targetAccountId: rejectRequest.targetAccountId,\n targetAgentName:\n rejectRequest.targetAgentName ||\n `Agent ${rejectRequest.targetAccountId}`,\n },\n },\n } as unknown as ExecuteResult & { rawResult?: unknown };\n break;\n }\n }\n } catch (error) {\n this.logger.error('Failed to manage connection requests:', error);\n throw error;\n }\n\n return this;\n }\n\n /**\n * List unapproved connection requests\n */\n public async listUnapprovedConnectionRequests(): Promise<this> {\n this.clearNotes();\n\n if (!this.stateManager) {\n throw new Error(\n 'StateManager is required for listing connection requests'\n );\n }\n\n const currentAgent = this.stateManager.getCurrentAgent();\n if (!currentAgent) {\n throw new Error(\n 'Cannot list connection requests. No agent is currently active.'\n );\n }\n\n try {\n const inboundTopicId = await this.getInboundTopicId();\n const messages = await this.getMessages(inboundTopicId);\n\n const unapprovedRequests = messages.messages\n .filter(\n (msg): msg is HCSMessageWithTimestamp & { op: string } =>\n msg.op === 'connection_request'\n )\n .map((msg) => ({\n requestId: msg.sequence_number,\n fromAccountId: msg.operator_id?.split('@')[1] || 'unknown',\n timestamp: msg.timestamp || new Date(msg?.created || '').getTime(),\n memo: msg.m || '',\n data: msg.data,\n }))\n .filter(\n (req): req is typeof req & { fromAccountId: string } =>\n req.fromAccountId !== 'unknown'\n );\n\n this.executeResult = {\n success: true,\n transactionId: undefined,\n receipt: undefined,\n scheduleId: undefined,\n rawResult: {\n requests: unapprovedRequests,\n count: unapprovedRequests.length,\n },\n } as unknown as ExecuteResult & { rawResult?: unknown };\n\n if (unapprovedRequests.length === 0) {\n this.addNote('No unapproved connection requests found.');\n } else {\n this.addNote(\n `Found ${unapprovedRequests.length} unapproved connection request(s).`\n );\n }\n } catch (error) {\n this.logger.error(\n 'Failed to list unapproved connection requests:',\n error\n );\n throw error;\n }\n\n return this;\n }\n\n /**\n * List connections with enhanced details\n */\n public async listConnections(\n params: {\n includeDetails?: boolean;\n showPending?: boolean;\n } = {}\n ): Promise<this> {\n this.clearNotes();\n\n if (!this.stateManager) {\n throw new Error('StateManager is required to list connections');\n }\n\n const includeDetails = params.includeDetails ?? true;\n const showPending = params.showPending ?? true;\n\n try {\n const connections = await this.getEnhancedConnections();\n\n if (connections.length === 0) {\n this.executeResult = {\n success: true,\n rawResult: {\n connections: [],\n message: 'There are currently no active connections.',\n },\n } as ExecuteResult & { rawResult?: unknown };\n return this;\n }\n\n const activeConnections = connections.filter(\n (c): c is Connection => (c as Connection).status === 'established'\n );\n const pendingConnections = connections.filter(\n (c): c is Connection => (c as Connection).isPending\n );\n const needsConfirmation = connections.filter(\n (c): c is Connection => (c as Connection).needsConfirmation\n );\n\n let output = '';\n\n if (activeConnections.length > 0) {\n output += `🟢 Active Connections (${activeConnections.length}):\\n`;\n activeConnections.forEach((conn, index) => {\n output += this.formatConnection(conn, index, includeDetails);\n });\n output += '\\n';\n }\n\n if (showPending && needsConfirmation.length > 0) {\n output += `🟠 Connections Needing Confirmation (${needsConfirmation.length}):\\n`;\n needsConfirmation.forEach((conn, index) => {\n output += this.formatConnection(conn, index, includeDetails);\n });\n output += '\\n';\n }\n\n if (showPending && pendingConnections.length > 0) {\n output += `⚪ Pending Connection Requests (${pendingConnections.length}):\\n`;\n pendingConnections.forEach((conn, index) => {\n output += this.formatConnection(conn, index, includeDetails);\n });\n }\n\n this.executeResult = {\n success: true,\n rawResult: {\n connections,\n formattedOutput: output.trim(),\n activeCount: activeConnections.length,\n pendingCount: pendingConnections.length,\n needsConfirmationCount: needsConfirmation.length,\n },\n } as ExecuteResult & { rawResult?: unknown };\n } catch (error) {\n this.logger.error('Failed to list connections:', error);\n this.executeResult = {\n success: false,\n error: `Failed to list connections: ${\n error instanceof Error ? error.message : String(error)\n }`,\n } as ExecuteResult & { rawResult?: unknown };\n }\n\n return this;\n }\n\n private formatConnection(\n conn: unknown,\n index: number,\n includeDetails: boolean\n ): string {\n const connection = conn as {\n profileInfo?: { display_name?: string; bio?: string };\n targetAgentName?: string;\n targetAccountId?: string;\n isPending?: boolean;\n connectionTopicId?: string;\n status?: string;\n created?: Date;\n lastActivity?: Date;\n };\n\n let output = `${index + 1}. ${\n connection.profileInfo?.display_name ||\n connection.targetAgentName ||\n 'Unknown Agent'\n } (${connection.targetAccountId})\\n`;\n const displayTopicId = connection.isPending\n ? '(Pending Request)'\n : connection.connectionTopicId;\n output += ` Topic: ${displayTopicId}\\n`;\n const statusText = connection.status || 'unknown';\n output += ` Status: ${statusText}\\n`;\n\n if (includeDetails) {\n if (connection.profileInfo?.bio) {\n output += ` Bio: ${connection.profileInfo.bio.substring(0, 100)}${\n connection.profileInfo.bio.length > 100 ? '...' : ''\n }\\n`;\n }\n\n if (connection.created) {\n const createdLabel = connection.isPending\n ? 'Request sent'\n : 'Connection established';\n output += ` ${createdLabel}: ${connection.created.toLocaleString()}\\n`;\n }\n\n if (connection.lastActivity) {\n output += ` Last activity: ${connection.lastActivity.toLocaleString()}\\n`;\n }\n }\n\n return output;\n }\n\n private async getEnhancedConnections(): Promise<unknown[]> {\n try {\n const { accountId } = this.getAccountAndSigner();\n if (!accountId) {\n return this.stateManager!.listConnections();\n }\n\n const connectionManager = this.stateManager!.getConnectionsManager();\n if (!connectionManager) {\n this.logger.error(NOT_INITIALIZED_ERROR);\n return this.stateManager!.listConnections();\n }\n\n const connections = await connectionManager.fetchConnectionData(\n accountId\n );\n\n for (const connection of connections) {\n this.stateManager!.addActiveConnection(\n connection as unknown as ActiveConnection\n );\n }\n\n return connections;\n } catch (error) {\n this.logger.error('Failed to get enhanced connections:', error);\n return this.stateManager!.listConnections();\n }\n }\n\n /**\n * Check messages on a connection\n */\n public async checkMessages(params: {\n targetIdentifier: string;\n fetchLatest?: boolean;\n lastMessagesCount?: number;\n }): Promise<this> {\n this.clearNotes();\n\n if (!this.stateManager) {\n throw new Error('StateManager is required to check messages');\n }\n\n const connection = this.stateManager.getConnectionByIdentifier(\n params.targetIdentifier\n );\n\n if (!connection) {\n this.executeResult = {\n success: false,\n error: `Could not find an active connection matching identifier \"${params.targetIdentifier}\". Use 'list_connections' to see active connections.`,\n } as ExecuteResult & { rawResult?: unknown };\n return this;\n }\n\n const connectionTopicId = connection.connectionTopicId || '';\n\n if (!connectionTopicId || !connectionTopicId.match(/^\\d+\\.\\d+\\.\\d+$/)) {\n this.logger.error(\n `Invalid connection topic ID format: ${connectionTopicId}`\n );\n this.executeResult = {\n success: false,\n error: `Invalid connection topic ID format: ${connectionTopicId}. Expected format: 0.0.XXXXX`,\n } as ExecuteResult & { rawResult?: unknown };\n return this;\n }\n\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: ${params.fetchLatest}, lastCount: ${params.lastMessagesCount}, since: ${lastProcessedTimestamp})`\n );\n\n try {\n const result = await this.getMessages(connectionTopicId);\n const allMessages = result.messages;\n\n if (!allMessages || allMessages.length === 0) {\n this.executeResult = {\n success: true,\n rawResult: {\n messages: [],\n message: `No messages found on connection topic ${connectionTopicId}.`,\n },\n } as ExecuteResult & { rawResult?: unknown };\n return this;\n }\n\n let messagesToProcess: HCSMessageWithTimestamp[] = [];\n let latestTimestampNanos = lastProcessedTimestamp;\n const isFetchingLatest = params.fetchLatest === true;\n\n if (isFetchingLatest) {\n this.logger.info('Fetching latest messages regardless of timestamp.');\n const count = params.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(\n (msg: HCSMessageWithTimestamp) => {\n const msgTimestampNanos = msg.timestamp * 1_000_000;\n return msgTimestampNanos > lastProcessedTimestamp;\n }\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 const message = 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 this.executeResult = {\n success: true,\n rawResult: {\n messages: [],\n message,\n },\n } as ExecuteResult & { rawResult?: unknown };\n return this;\n }\n\n this.logger.info(`Processing ${messagesToProcess.length} message(s).`);\n\n let outputString = isFetchingLatest\n ? `Latest message(s) from ${targetAgentName}:\\n`\n : `New messages from ${targetAgentName}:\\n`;\n\n const processedMessages: Array<{\n timestamp: number;\n sequenceNumber: number;\n content: string | undefined;\n raw: HCSMessageWithTimestamp;\n }> = [];\n\n for (const msg of messagesToProcess) {\n let content = msg.data;\n try {\n if (typeof content === 'string' && content.startsWith('hcs://')) {\n this.logger.debug(`Resolving inscribed message: ${content}`);\n content = await this.getMessageContent(content);\n this.logger.debug(`Resolved content length: ${content?.length}`);\n }\n\n let displayContent = 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 const senderOpId = parsed.operator_id || 'unknown_sender';\n displayContent = `[${senderOpId}]: ${parsed.data}`;\n } else {\n displayContent = content;\n }\n } catch {\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\n processedMessages.push({\n timestamp: msg.timestamp,\n sequenceNumber: msg.sequence_number,\n content: displayContent,\n raw: msg,\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 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 this.executeResult = {\n success: true,\n rawResult: {\n messages: processedMessages,\n formattedOutput: outputString.trim(),\n targetAgentName,\n connectionTopicId,\n },\n } as ExecuteResult & { rawResult?: unknown };\n } catch (error) {\n this.logger.error(\n `Failed to check messages for topic ${connectionTopicId}: ${error}`\n );\n this.executeResult = {\n success: false,\n error: `Error checking messages for ${targetAgentName}: ${\n error instanceof Error ? error.message : String(error)\n }`,\n } as ExecuteResult & { rawResult?: unknown };\n }\n\n return this;\n }\n\n /**\n * Find registrations using the configured registry\n */\n public async findRegistrations(params: {\n accountId?: string;\n tags?: number[];\n }): Promise<this> {\n this.clearNotes();\n\n try {\n const options: {\n network: StandardNetworkType;\n accountId?: string;\n tags?: number[];\n } = {\n network: this.network,\n };\n\n if (params.accountId) {\n options.accountId = params.accountId;\n }\n\n if (params.tags && params.tags.length > 0) {\n options.tags = params.tags;\n }\n\n const result = await this.standardClient.findRegistrations(options);\n\n if (!result.success || result.error) {\n this.executeResult = {\n success: false,\n error: `Error finding registrations: ${\n result.error || 'Unknown error'\n }`,\n } as ExecuteResult & { rawResult?: unknown };\n return this;\n }\n\n if (!result.registrations || result.registrations.length === 0) {\n this.executeResult = {\n success: true,\n rawResult: {\n registrations: [],\n message: 'No registrations found matching the criteria.',\n },\n } as ExecuteResult & { rawResult?: unknown };\n return this;\n }\n\n const formattedRegistrations = result.registrations\n .map((reg: unknown): string => {\n const registration = reg as {\n agent?: { name?: string; capabilities?: string[] };\n accountId?: string;\n };\n const agentName = registration.agent?.name || 'Unknown Agent';\n const accountId = registration.accountId || 'Unknown Account';\n const capabilities =\n registration.agent?.capabilities?.join(', ') || 'None';\n\n return `Agent: ${agentName} (${accountId}), Capabilities: ${capabilities}`;\n })\n .join('\\\\n');\n\n this.executeResult = {\n success: true,\n rawResult: {\n registrations: result.registrations,\n formattedOutput: `Found ${result.registrations.length} registration(s):\\\\n${formattedRegistrations}`,\n },\n } as ExecuteResult & { rawResult?: unknown };\n } catch (error) {\n this.logger.error('Error during FindRegistrations execution:', error);\n this.executeResult = {\n success: false,\n error: `Failed to search registrations: ${\n error instanceof Error ? error.message : String(error)\n }`,\n } as ExecuteResult & { rawResult?: unknown };\n }\n\n return this;\n }\n\n /**\n * Retrieve detailed profile information for an agent\n */\n public async retrieveProfile(params: {\n accountId: string;\n disableCache?: boolean;\n }): Promise<this> {\n this.clearNotes();\n\n try {\n const profileResponse = await this.standardClient.retrieveProfile(\n params.accountId,\n params.disableCache || false\n );\n\n if (!profileResponse.success) {\n this.executeResult = {\n success: false,\n error: `Failed to retrieve profile: ${\n profileResponse.error || 'Unknown error'\n }`,\n } as ExecuteResult & { rawResult?: unknown };\n return this;\n }\n\n const profile = profileResponse.profile;\n const topicInfo = profileResponse.topicInfo;\n\n let profileDetails = `Profile for ${params.accountId}:\\n`;\n profileDetails += `Name: ${profile.name || 'Unknown'}\\n`;\n profileDetails += `Bio: ${profile.bio || 'No bio provided'}\\n`;\n profileDetails += `Type: ${profile.type || 'Unknown'}\\n`;\n profileDetails += `Model: ${profile.model || 'Unknown'}\\n`;\n\n if (profile.capabilities && profile.capabilities.length > 0) {\n profileDetails += `Capabilities: ${profile.capabilities.join(', ')}\\n`;\n } else {\n profileDetails += `Capabilities: None listed\\n`;\n }\n\n if (topicInfo) {\n profileDetails += `Inbound Topic: ${\n topicInfo.inboundTopic || 'Unknown'\n }\\n`;\n profileDetails += `Outbound Topic: ${\n topicInfo.outboundTopic || 'Unknown'\n }\\n`;\n profileDetails += `Profile Topic: ${\n topicInfo.profileTopicId || 'Unknown'\n }\\n`;\n }\n\n if (profile.social && Object.keys(profile.social).length > 0) {\n profileDetails += `Social: ${Object.entries(profile.social)\n .map(\n ([platform, handle]: [string, unknown]): string =>\n `${platform}: ${handle}`\n )\n .join(', ')}\\n`;\n }\n\n if (profile.properties && Object.keys(profile.properties).length > 0) {\n profileDetails += `Properties: ${JSON.stringify(profile.properties)}\\n`;\n }\n\n this.executeResult = {\n success: true,\n rawResult: {\n profileDetails,\n rawProfile: profileResponse,\n },\n } as ExecuteResult & { rawResult?: unknown };\n } catch (error) {\n this.logger.error(\n `Unexpected error retrieving profile for ${params.accountId}:`,\n error\n );\n this.executeResult = {\n success: false,\n error: `Unexpected error retrieving profile for ${params.accountId}: ${\n error instanceof Error ? error.message : String(error)\n }`,\n } as ExecuteResult & { rawResult?: unknown };\n }\n\n return this;\n }\n\n /**\n * Override execute to return stored HCS10 operation results\n */\n public override async execute(): Promise<ExecuteResult> {\n if (this.executeResult) {\n return {\n success: this.executeResult.success,\n transactionId: this.executeResult.transactionId,\n receipt: this.executeResult.receipt,\n scheduleId: this.executeResult.scheduleId,\n error: this.executeResult.error,\n rawResult: this.executeResult.rawResult,\n notes: this.notes,\n } as ExecuteResult & { rawResult?: unknown; notes?: string[] };\n }\n\n return {\n success: false,\n error: 'No operation result available. Call a builder method first.',\n };\n }\n}\n"],"names":["SDKLogger","HCS10Client","path","StandardAIAgentCapability","StandardInboundTopicType"],"mappings":";;;;;AAyBA,MAAM,wBAAwB;AA8GvB,MAAM,qBAAqB,mBAAmB;AAAA,EASnD,YACE,WACA,cACA,SAKA;AACA,UAAM,SAAS;AAdjB,SAAQ,gBAAyB;AACjC,SAAQ,yBAAiC;AAcvC,SAAK,eAAe;AACpB,SAAK,gBAAgB,SAAS,iBAAiB;AAC/C,SAAK,yBAAyB,SAAS,eAAe;AAEtD,UAAM,UAAU,KAAK,UAAU,OAAO;AACtC,SAAK,UAAU,QAAQ,SAAA,EAAW,SAAS,SAAS,IAChD,YACA;AAEJ,UAAM,aAAa,KAAK,UAAU,OAAO,aAAA,EAAe,SAAA;AACxD,UA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AgB;AAAA,QACnB,SAAS;AAAA,QACT,OAAO,2CAA2C,OAAO,SAAS,KAChE,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CACvD;AAAA,MAAA;AAAA,IAEJ;AAEA,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA,EAKA,MAAsB,UAAkC;AACtD,QAAI,KAAK,eAAe;AACtB,aAAO;AAAA,QACL,SAAS,KAAK,cAAc;AAAA,QAC5B,eAAe,KAAK,cAAc;AAAA,QAClC,SAAS,KAAK,cAAc;AAAA,QAC5B,YAAY,KAAK,cAAc;AAAA,QAC/B,OAAO,KAAK,cAAc;AAAA,QAC1B,WAAW,KAAK,cAAc;AAAA,QAC9B,OAAO,KAAK;AAAA,MAAA;AAAA,IAEhB;AAEA,WAAO;AAAA,MACL,SAAS;AAAA,MACT,OAAO;AAAA,IAAA;AAAA,EAEX;AACF;"}
|
|
@@ -1,53 +1,48 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import {
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
metadata: z.record(z.unknown()).describe("Updated metadata object for the hashinal"),
|
|
2
|
+
import { BaseHCS6QueryTool } from "./standards-agent-kit.es28.js";
|
|
3
|
+
const RegisterDynamicHashinalSchema = z.object({
|
|
4
|
+
metadata: z.record(z.unknown()).describe("Metadata object for the hashinal (e.g., name, description, attributes)"),
|
|
6
5
|
data: z.object({
|
|
7
|
-
base64: z.string().optional().describe("Base64 encoded data for the
|
|
8
|
-
url: z.string().optional().describe("URL to fetch
|
|
6
|
+
base64: z.string().optional().describe("Base64 encoded data for the hashinal"),
|
|
7
|
+
url: z.string().optional().describe("URL to fetch data from"),
|
|
9
8
|
mimeType: z.string().optional().describe("MIME type of the data")
|
|
10
|
-
}).optional().describe("
|
|
11
|
-
memo: z.string().optional().describe(
|
|
12
|
-
|
|
9
|
+
}).optional().describe("Data to inscribe with the hashinal"),
|
|
10
|
+
memo: z.string().optional().describe("Optional memo for the registration"),
|
|
11
|
+
ttl: z.number().min(3600).default(86400).describe("Time-to-live in seconds for the inscription"),
|
|
12
|
+
registryTopicId: z.string().optional().describe("Registry topic ID to use. If not provided, a new registry will be created"),
|
|
13
|
+
submitKey: z.string().optional().describe("Submit key for the registry (required if registry has a submit key)")
|
|
13
14
|
});
|
|
14
|
-
class
|
|
15
|
+
class RegisterDynamicHashinalTool extends BaseHCS6QueryTool {
|
|
15
16
|
constructor(params) {
|
|
16
17
|
super(params);
|
|
17
|
-
this.name = "
|
|
18
|
-
this.description = "
|
|
19
|
-
this.schema = UpdateDynamicHashinalSchema;
|
|
18
|
+
this.name = "registerDynamicHashinal";
|
|
19
|
+
this.description = "Create and register a new dynamic hashinal that can be updated over time";
|
|
20
20
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
data: {
|
|
36
|
-
registryTopicId: result.registryTopicId,
|
|
37
|
-
newInscriptionTopicId: result.inscriptionTopicId,
|
|
38
|
-
transactionId: result.transactionId,
|
|
39
|
-
updateMemo: params.memo
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
} catch (error) {
|
|
43
|
-
return {
|
|
44
|
-
status: "error",
|
|
45
|
-
message: error instanceof Error ? error.message : "Unknown error"
|
|
46
|
-
};
|
|
21
|
+
get specificInputSchema() {
|
|
22
|
+
return RegisterDynamicHashinalSchema;
|
|
23
|
+
}
|
|
24
|
+
async executeQuery(params, _runManager) {
|
|
25
|
+
const result = await this.hcs6Builder.register({
|
|
26
|
+
metadata: params.metadata,
|
|
27
|
+
data: params.data,
|
|
28
|
+
memo: params.memo,
|
|
29
|
+
ttl: params.ttl,
|
|
30
|
+
registryTopicId: params.registryTopicId,
|
|
31
|
+
submitKey: params.submitKey
|
|
32
|
+
});
|
|
33
|
+
if (!result.success) {
|
|
34
|
+
throw new Error(result.error || "Failed to register dynamic hashinal");
|
|
47
35
|
}
|
|
36
|
+
return `Successfully registered dynamic hashinal!
|
|
37
|
+
|
|
38
|
+
Registry Topic ID: ${result.registryTopicId}
|
|
39
|
+
Inscription Topic ID: ${result.inscriptionTopicId}${params.memo ? `
|
|
40
|
+
Memo: ${params.memo}` : ""}
|
|
41
|
+
|
|
42
|
+
The dynamic hashinal has been created and can be updated using the registry topic ID.`;
|
|
48
43
|
}
|
|
49
44
|
}
|
|
50
45
|
export {
|
|
51
|
-
|
|
46
|
+
RegisterDynamicHashinalTool
|
|
52
47
|
};
|
|
53
48
|
//# sourceMappingURL=standards-agent-kit.es30.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standards-agent-kit.es30.js","sources":["../../src/tools/hcs6/
|
|
1
|
+
{"version":3,"file":"standards-agent-kit.es30.js","sources":["../../src/tools/hcs6/RegisterDynamicHashinalTool.ts"],"sourcesContent":["import { z } from 'zod';\nimport { BaseHCS6QueryTool } from './base-hcs6-tools';\nimport { HCS6QueryToolParams } from './hcs6-tool-params';\nimport { CallbackManagerForToolRun } from '@langchain/core/callbacks/manager';\n\n/**\n * Schema for registering a dynamic hashinal\n */\nconst RegisterDynamicHashinalSchema = z.object({\n metadata: z.record(z.unknown())\n .describe('Metadata object for the hashinal (e.g., name, description, attributes)'),\n data: z.object({\n base64: z.string().optional().describe('Base64 encoded data for the hashinal'),\n url: z.string().optional().describe('URL to fetch data from'),\n mimeType: z.string().optional().describe('MIME type of the data'),\n }).optional()\n .describe('Data to inscribe with the hashinal'),\n memo: z.string()\n .optional()\n .describe('Optional memo for the registration'),\n ttl: z.number()\n .min(3600)\n .default(86400)\n .describe('Time-to-live in seconds for the inscription'),\n registryTopicId: z.string()\n .optional()\n .describe('Registry topic ID to use. If not provided, a new registry will be created'),\n submitKey: z.string()\n .optional()\n .describe('Submit key for the registry (required if registry has a submit key)'),\n});\n\nexport type RegisterDynamicHashinalInput = z.infer<typeof RegisterDynamicHashinalSchema>;\n\n/**\n * Tool for registering (creating) dynamic hashinals\n */\nexport class RegisterDynamicHashinalTool extends BaseHCS6QueryTool<typeof RegisterDynamicHashinalSchema> {\n name = 'registerDynamicHashinal';\n description = 'Create and register a new dynamic hashinal that can be updated over time';\n \n get specificInputSchema() {\n return RegisterDynamicHashinalSchema;\n }\n\n constructor(params: HCS6QueryToolParams) {\n super(params);\n }\n\n protected async executeQuery(\n params: RegisterDynamicHashinalInput,\n _runManager?: CallbackManagerForToolRun\n ): Promise<unknown> {\n const result = await this.hcs6Builder.register({\n metadata: params.metadata,\n data: params.data,\n memo: params.memo,\n ttl: params.ttl,\n registryTopicId: params.registryTopicId,\n submitKey: params.submitKey,\n });\n\n if (!result.success) {\n throw new Error(result.error || 'Failed to register dynamic hashinal');\n }\n\n return `Successfully registered dynamic hashinal!\\n\\nRegistry Topic ID: ${result.registryTopicId}\\nInscription Topic ID: ${result.inscriptionTopicId}${params.memo ? `\\nMemo: ${params.memo}` : ''}\\n\\nThe dynamic hashinal has been created and can be updated using the registry topic ID.`;\n }\n}"],"names":[],"mappings":";;AAQA,MAAM,gCAAgC,EAAE,OAAO;AAAA,EAC7C,UAAU,EAAE,OAAO,EAAE,SAAS,EAC3B,SAAS,wEAAwE;AAAA,EACpF,MAAM,EAAE,OAAO;AAAA,IACb,QAAQ,EAAE,OAAA,EAAS,SAAA,EAAW,SAAS,sCAAsC;AAAA,IAC7E,KAAK,EAAE,OAAA,EAAS,SAAA,EAAW,SAAS,wBAAwB;AAAA,IAC5D,UAAU,EAAE,OAAA,EAAS,SAAA,EAAW,SAAS,uBAAuB;AAAA,EAAA,CACjE,EAAE,SAAA,EACA,SAAS,oCAAoC;AAAA,EAChD,MAAM,EAAE,OAAA,EACL,SAAA,EACA,SAAS,oCAAoC;AAAA,EAChD,KAAK,EAAE,OAAA,EACJ,IAAI,IAAI,EACR,QAAQ,KAAK,EACb,SAAS,6CAA6C;AAAA,EACzD,iBAAiB,EAAE,OAAA,EAChB,SAAA,EACA,SAAS,2EAA2E;AAAA,EACvF,WAAW,EAAE,OAAA,EACV,SAAA,EACA,SAAS,qEAAqE;AACnF,CAAC;AAOM,MAAM,oCAAoC,kBAAwD;AAAA,EAQvG,YAAY,QAA6B;AACvC,UAAM,MAAM;AARd,SAAA,OAAO;AACP,SAAA,cAAc;AAAA,EAQd;AAAA,EANA,IAAI,sBAAsB;AACxB,WAAO;AAAA,EACT;AAAA,EAMA,MAAgB,aACd,QACA,aACkB;AAClB,UAAM,SAAS,MAAM,KAAK,YAAY,SAAS;AAAA,MAC7C,UAAU,OAAO;AAAA,MACjB,MAAM,OAAO;AAAA,MACb,MAAM,OAAO;AAAA,MACb,KAAK,OAAO;AAAA,MACZ,iBAAiB,OAAO;AAAA,MACxB,WAAW,OAAO;AAAA,IAAA,CACnB;AAED,QAAI,CAAC,OAAO,SAAS;AACnB,YAAM,IAAI,MAAM,OAAO,SAAS,qCAAqC;AAAA,IACvE;AAEA,WAAO;AAAA;AAAA,qBAAmE,OAAO,eAAe;AAAA,wBAA2B,OAAO,kBAAkB,GAAG,OAAO,OAAO;AAAA,QAAW,OAAO,IAAI,KAAK,EAAE;AAAA;AAAA;AAAA,EACpM;AACF;"}
|
|
@@ -1,50 +1,46 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { BaseHCS6QueryTool } from "./standards-agent-kit.
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
import { BaseHCS6QueryTool } from "./standards-agent-kit.es28.js";
|
|
3
|
+
const UpdateDynamicHashinalSchema = z.object({
|
|
4
|
+
registryTopicId: z.string().describe("The registry topic ID that tracks this dynamic hashinal"),
|
|
5
|
+
metadata: z.record(z.unknown()).describe("Updated metadata object for the hashinal"),
|
|
6
|
+
data: z.object({
|
|
7
|
+
base64: z.string().optional().describe("Base64 encoded data for the updated hashinal"),
|
|
8
|
+
url: z.string().optional().describe("URL to fetch updated data from"),
|
|
9
|
+
mimeType: z.string().optional().describe("MIME type of the data")
|
|
10
|
+
}).optional().describe("Updated data to inscribe"),
|
|
11
|
+
memo: z.string().optional().describe('Optional memo for the update (e.g., "Level up", "Version 2.0")'),
|
|
12
|
+
submitKey: z.string().describe("Submit key for the registry (required to update)")
|
|
8
13
|
});
|
|
9
|
-
class
|
|
14
|
+
class UpdateDynamicHashinalTool extends BaseHCS6QueryTool {
|
|
10
15
|
constructor(params) {
|
|
11
16
|
super(params);
|
|
12
|
-
this.name = "
|
|
13
|
-
this.description = "
|
|
14
|
-
this.schema = QueryDynamicRegistrySchema;
|
|
17
|
+
this.name = "updateDynamicHashinal";
|
|
18
|
+
this.description = "Update an existing dynamic hashinal with new content while maintaining the same registry";
|
|
15
19
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
latestEntry: registry.latestEntry ? {
|
|
30
|
-
topicId: registry.latestEntry.message.t_id,
|
|
31
|
-
timestamp: registry.latestEntry.timestamp,
|
|
32
|
-
memo: registry.latestEntry.message.m,
|
|
33
|
-
sequence: registry.latestEntry.sequence,
|
|
34
|
-
payer: registry.latestEntry.payer
|
|
35
|
-
} : null,
|
|
36
|
-
totalEntries: registry.entries.length
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
} catch (error) {
|
|
40
|
-
return {
|
|
41
|
-
status: "error",
|
|
42
|
-
message: error instanceof Error ? error.message : "Unknown error"
|
|
43
|
-
};
|
|
20
|
+
get specificInputSchema() {
|
|
21
|
+
return UpdateDynamicHashinalSchema;
|
|
22
|
+
}
|
|
23
|
+
async executeQuery(params, _runManager) {
|
|
24
|
+
const result = await this.hcs6Builder.register({
|
|
25
|
+
metadata: params.metadata,
|
|
26
|
+
data: params.data,
|
|
27
|
+
memo: params.memo,
|
|
28
|
+
registryTopicId: params.registryTopicId,
|
|
29
|
+
submitKey: params.submitKey
|
|
30
|
+
});
|
|
31
|
+
if (!result.success) {
|
|
32
|
+
throw new Error(result.error || "Failed to update dynamic hashinal");
|
|
44
33
|
}
|
|
34
|
+
return `Successfully updated dynamic hashinal!
|
|
35
|
+
|
|
36
|
+
Registry Topic ID: ${params.registryTopicId}
|
|
37
|
+
Inscription Topic ID: ${result.inscriptionTopicId}${params.memo ? `
|
|
38
|
+
Update Memo: ${params.memo}` : ""}
|
|
39
|
+
|
|
40
|
+
The dynamic hashinal has been updated with new content.`;
|
|
45
41
|
}
|
|
46
42
|
}
|
|
47
43
|
export {
|
|
48
|
-
|
|
44
|
+
UpdateDynamicHashinalTool
|
|
49
45
|
};
|
|
50
46
|
//# sourceMappingURL=standards-agent-kit.es31.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standards-agent-kit.es31.js","sources":["../../src/tools/hcs6/
|
|
1
|
+
{"version":3,"file":"standards-agent-kit.es31.js","sources":["../../src/tools/hcs6/UpdateDynamicHashinalTool.ts"],"sourcesContent":["import { z } from 'zod';\nimport { BaseHCS6QueryTool } from './base-hcs6-tools';\nimport { HCS6QueryToolParams } from './hcs6-tool-params';\nimport { CallbackManagerForToolRun } from '@langchain/core/callbacks/manager';\n\n/**\n * Schema for updating a dynamic hashinal\n */\nconst UpdateDynamicHashinalSchema = z.object({\n registryTopicId: z.string()\n .describe('The registry topic ID that tracks this dynamic hashinal'),\n metadata: z.record(z.unknown())\n .describe('Updated metadata object for the hashinal'),\n data: z.object({\n base64: z.string().optional().describe('Base64 encoded data for the updated hashinal'),\n url: z.string().optional().describe('URL to fetch updated data from'),\n mimeType: z.string().optional().describe('MIME type of the data'),\n }).optional()\n .describe('Updated data to inscribe'),\n memo: z.string()\n .optional()\n .describe('Optional memo for the update (e.g., \"Level up\", \"Version 2.0\")'),\n submitKey: z.string()\n .describe('Submit key for the registry (required to update)'),\n});\n\nexport type UpdateDynamicHashinalInput = z.infer<typeof UpdateDynamicHashinalSchema>;\n\n/**\n * Tool for updating dynamic hashinals\n */\nexport class UpdateDynamicHashinalTool extends BaseHCS6QueryTool<typeof UpdateDynamicHashinalSchema> {\n name = 'updateDynamicHashinal';\n description = 'Update an existing dynamic hashinal with new content while maintaining the same registry';\n \n get specificInputSchema() {\n return UpdateDynamicHashinalSchema;\n }\n\n constructor(params: HCS6QueryToolParams) {\n super(params);\n }\n\n protected async executeQuery(\n params: UpdateDynamicHashinalInput,\n _runManager?: CallbackManagerForToolRun\n ): Promise<unknown> {\n // Use the register method with the existing registry ID to update\n const result = await this.hcs6Builder.register({\n metadata: params.metadata,\n data: params.data,\n memo: params.memo,\n registryTopicId: params.registryTopicId,\n submitKey: params.submitKey,\n });\n\n if (!result.success) {\n throw new Error(result.error || 'Failed to update dynamic hashinal');\n }\n\n return `Successfully updated dynamic hashinal!\\n\\nRegistry Topic ID: ${params.registryTopicId}\\nInscription Topic ID: ${result.inscriptionTopicId}${params.memo ? `\\nUpdate Memo: ${params.memo}` : ''}\\n\\nThe dynamic hashinal has been updated with new content.`;\n }\n}"],"names":[],"mappings":";;AAQA,MAAM,8BAA8B,EAAE,OAAO;AAAA,EAC3C,iBAAiB,EAAE,SAChB,SAAS,yDAAyD;AAAA,EACrE,UAAU,EAAE,OAAO,EAAE,SAAS,EAC3B,SAAS,0CAA0C;AAAA,EACtD,MAAM,EAAE,OAAO;AAAA,IACb,QAAQ,EAAE,OAAA,EAAS,SAAA,EAAW,SAAS,8CAA8C;AAAA,IACrF,KAAK,EAAE,OAAA,EAAS,SAAA,EAAW,SAAS,gCAAgC;AAAA,IACpE,UAAU,EAAE,OAAA,EAAS,SAAA,EAAW,SAAS,uBAAuB;AAAA,EAAA,CACjE,EAAE,SAAA,EACA,SAAS,0BAA0B;AAAA,EACtC,MAAM,EAAE,OAAA,EACL,SAAA,EACA,SAAS,gEAAgE;AAAA,EAC5E,WAAW,EAAE,OAAA,EACV,SAAS,kDAAkD;AAChE,CAAC;AAOM,MAAM,kCAAkC,kBAAsD;AAAA,EAQnG,YAAY,QAA6B;AACvC,UAAM,MAAM;AARd,SAAA,OAAO;AACP,SAAA,cAAc;AAAA,EAQd;AAAA,EANA,IAAI,sBAAsB;AACxB,WAAO;AAAA,EACT;AAAA,EAMA,MAAgB,aACd,QACA,aACkB;AAElB,UAAM,SAAS,MAAM,KAAK,YAAY,SAAS;AAAA,MAC7C,UAAU,OAAO;AAAA,MACjB,MAAM,OAAO;AAAA,MACb,MAAM,OAAO;AAAA,MACb,iBAAiB,OAAO;AAAA,MACxB,WAAW,OAAO;AAAA,IAAA,CACnB;AAED,QAAI,CAAC,OAAO,SAAS;AACnB,YAAM,IAAI,MAAM,OAAO,SAAS,mCAAmC;AAAA,IACrE;AAEA,WAAO;AAAA;AAAA,qBAAgE,OAAO,eAAe;AAAA,wBAA2B,OAAO,kBAAkB,GAAG,OAAO,OAAO;AAAA,eAAkB,OAAO,IAAI,KAAK,EAAE;AAAA;AAAA;AAAA,EACxM;AACF;"}
|
|
@@ -1,32 +1,48 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { BaseHCS6QueryTool } from "./standards-agent-kit.es28.js";
|
|
3
|
+
const QueryDynamicRegistrySchema = z.object({
|
|
4
|
+
topicId: z.string().describe("The registry topic ID to query"),
|
|
5
|
+
limit: z.number().optional().default(100).describe("Maximum number of entries to retrieve"),
|
|
6
|
+
order: z.enum(["asc", "desc"]).optional().default("desc").describe("Order of entries (desc shows latest first)"),
|
|
7
|
+
skip: z.number().optional().describe("Number of entries to skip")
|
|
8
|
+
});
|
|
9
|
+
class QueryDynamicRegistryTool extends BaseHCS6QueryTool {
|
|
3
10
|
constructor(params) {
|
|
4
11
|
super(params);
|
|
5
|
-
this.
|
|
6
|
-
this.
|
|
12
|
+
this.name = "queryDynamicRegistry";
|
|
13
|
+
this.description = "Query a dynamic registry to get the current state of a dynamic hashinal";
|
|
7
14
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
*/
|
|
11
|
-
getServiceBuilder() {
|
|
12
|
-
return this.inscriberBuilder;
|
|
15
|
+
get specificInputSchema() {
|
|
16
|
+
return QueryDynamicRegistrySchema;
|
|
13
17
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
18
|
+
async executeQuery(params, _runManager) {
|
|
19
|
+
const registry = await this.hcs6Builder.getRegistry(params.topicId, {
|
|
20
|
+
limit: params.limit,
|
|
21
|
+
order: params.order,
|
|
22
|
+
skip: params.skip
|
|
23
|
+
});
|
|
24
|
+
const latestEntry = registry.latestEntry ? {
|
|
25
|
+
topicId: registry.latestEntry.message.t_id,
|
|
26
|
+
timestamp: registry.latestEntry.timestamp,
|
|
27
|
+
memo: registry.latestEntry.message.m,
|
|
28
|
+
sequence: registry.latestEntry.sequence,
|
|
29
|
+
payer: registry.latestEntry.payer
|
|
30
|
+
} : null;
|
|
31
|
+
return `Successfully queried dynamic registry!
|
|
32
|
+
|
|
33
|
+
Registry Topic: ${registry.topicId}
|
|
34
|
+
Registry Type: NON_INDEXED
|
|
35
|
+
TTL: ${registry.ttl} seconds
|
|
36
|
+
Total Entries: ${registry.entries.length}${latestEntry ? `
|
|
37
|
+
|
|
38
|
+
Latest Entry:
|
|
39
|
+
- Topic ID: ${latestEntry.topicId}
|
|
40
|
+
- Timestamp: ${latestEntry.timestamp}
|
|
41
|
+
- Memo: ${latestEntry.memo || "N/A"}
|
|
42
|
+
- Sequence: ${latestEntry.sequence}` : "\n\nNo entries found in registry."}`;
|
|
26
43
|
}
|
|
27
44
|
}
|
|
28
45
|
export {
|
|
29
|
-
|
|
30
|
-
BaseInscriberTransactionTool
|
|
46
|
+
QueryDynamicRegistryTool
|
|
31
47
|
};
|
|
32
48
|
//# sourceMappingURL=standards-agent-kit.es32.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standards-agent-kit.es32.js","sources":["../../src/tools/
|
|
1
|
+
{"version":3,"file":"standards-agent-kit.es32.js","sources":["../../src/tools/hcs6/QueryDynamicRegistryTool.ts"],"sourcesContent":["import { z } from 'zod';\nimport { BaseHCS6QueryTool } from './base-hcs6-tools';\nimport { HCS6QueryToolParams } from './hcs6-tool-params';\nimport { CallbackManagerForToolRun } from '@langchain/core/callbacks/manager';\n\n/**\n * Schema for querying a dynamic registry\n */\nconst QueryDynamicRegistrySchema = z.object({\n topicId: z.string()\n .describe('The registry topic ID to query'),\n limit: z.number()\n .optional()\n .default(100)\n .describe('Maximum number of entries to retrieve'),\n order: z.enum(['asc', 'desc'])\n .optional()\n .default('desc')\n .describe('Order of entries (desc shows latest first)'),\n skip: z.number()\n .optional()\n .describe('Number of entries to skip'),\n});\n\nexport type QueryDynamicRegistryInput = z.infer<typeof QueryDynamicRegistrySchema>;\n\n/**\n * Tool for querying HCS-6 dynamic registries\n */\nexport class QueryDynamicRegistryTool extends BaseHCS6QueryTool<typeof QueryDynamicRegistrySchema> {\n name = 'queryDynamicRegistry';\n description = 'Query a dynamic registry to get the current state of a dynamic hashinal';\n \n get specificInputSchema() {\n return QueryDynamicRegistrySchema;\n }\n\n constructor(params: HCS6QueryToolParams) {\n super(params);\n }\n\n protected async executeQuery(\n params: QueryDynamicRegistryInput,\n _runManager?: CallbackManagerForToolRun\n ): Promise<unknown> {\n const registry = await this.hcs6Builder.getRegistry(params.topicId, {\n limit: params.limit,\n order: params.order,\n skip: params.skip,\n });\n\n const latestEntry = registry.latestEntry ? {\n topicId: registry.latestEntry.message.t_id,\n timestamp: registry.latestEntry.timestamp,\n memo: registry.latestEntry.message.m,\n sequence: registry.latestEntry.sequence,\n payer: registry.latestEntry.payer,\n } : null;\n\n return `Successfully queried dynamic registry!\\n\\nRegistry Topic: ${registry.topicId}\\nRegistry Type: NON_INDEXED\\nTTL: ${registry.ttl} seconds\\nTotal Entries: ${registry.entries.length}${latestEntry ? `\\n\\nLatest Entry:\\n- Topic ID: ${latestEntry.topicId}\\n- Timestamp: ${latestEntry.timestamp}\\n- Memo: ${latestEntry.memo || 'N/A'}\\n- Sequence: ${latestEntry.sequence}` : '\\n\\nNo entries found in registry.'}`;\n }\n}"],"names":[],"mappings":";;AAQA,MAAM,6BAA6B,EAAE,OAAO;AAAA,EAC1C,SAAS,EAAE,SACR,SAAS,gCAAgC;AAAA,EAC5C,OAAO,EAAE,OAAA,EACN,SAAA,EACA,QAAQ,GAAG,EACX,SAAS,uCAAuC;AAAA,EACnD,OAAO,EAAE,KAAK,CAAC,OAAO,MAAM,CAAC,EAC1B,SAAA,EACA,QAAQ,MAAM,EACd,SAAS,4CAA4C;AAAA,EACxD,MAAM,EAAE,OAAA,EACL,SAAA,EACA,SAAS,2BAA2B;AACzC,CAAC;AAOM,MAAM,iCAAiC,kBAAqD;AAAA,EAQjG,YAAY,QAA6B;AACvC,UAAM,MAAM;AARd,SAAA,OAAO;AACP,SAAA,cAAc;AAAA,EAQd;AAAA,EANA,IAAI,sBAAsB;AACxB,WAAO;AAAA,EACT;AAAA,EAMA,MAAgB,aACd,QACA,aACkB;AAClB,UAAM,WAAW,MAAM,KAAK,YAAY,YAAY,OAAO,SAAS;AAAA,MAClE,OAAO,OAAO;AAAA,MACd,OAAO,OAAO;AAAA,MACd,MAAM,OAAO;AAAA,IAAA,CACd;AAED,UAAM,cAAc,SAAS,cAAc;AAAA,MACzC,SAAS,SAAS,YAAY,QAAQ;AAAA,MACtC,WAAW,SAAS,YAAY;AAAA,MAChC,MAAM,SAAS,YAAY,QAAQ;AAAA,MACnC,UAAU,SAAS,YAAY;AAAA,MAC/B,OAAO,SAAS,YAAY;AAAA,IAAA,IAC1B;AAEJ,WAAO;AAAA;AAAA,kBAA6D,SAAS,OAAO;AAAA;AAAA,OAAsC,SAAS,GAAG;AAAA,iBAA4B,SAAS,Q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