@hashgraphonline/standards-sdk 0.0.82 → 0.0.84
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/es/hcs-10/base-client.d.ts.map +1 -1
- package/dist/es/hcs-10/connections-manager.d.ts +185 -0
- package/dist/es/hcs-10/connections-manager.d.ts.map +1 -0
- package/dist/es/hcs-10/index.d.ts +1 -0
- package/dist/es/hcs-10/index.d.ts.map +1 -1
- package/dist/es/hcs-10/sdk.d.ts.map +1 -1
- package/dist/es/services/mirror-node.d.ts.map +1 -1
- package/dist/es/standards-sdk.es.js +13 -11
- package/dist/es/standards-sdk.es.js.map +1 -1
- package/dist/es/standards-sdk.es10.js +594 -117
- package/dist/es/standards-sdk.es10.js.map +1 -1
- package/dist/es/standards-sdk.es100.js +3 -31
- package/dist/es/standards-sdk.es100.js.map +1 -1
- package/dist/es/standards-sdk.es101.js +3 -14
- package/dist/es/standards-sdk.es101.js.map +1 -1
- package/dist/es/standards-sdk.es102.js +13 -4
- package/dist/es/standards-sdk.es102.js.map +1 -1
- package/dist/es/standards-sdk.es103.js +13 -4
- package/dist/es/standards-sdk.es103.js.map +1 -1
- package/dist/es/standards-sdk.es104.js +1 -1
- package/dist/es/standards-sdk.es106.js +3 -3
- package/dist/es/standards-sdk.es107.js +8 -8
- package/dist/es/standards-sdk.es108.js +3 -3
- package/dist/es/standards-sdk.es11.js +103 -58
- package/dist/es/standards-sdk.es11.js.map +1 -1
- package/dist/es/standards-sdk.es110.js +4 -3
- package/dist/es/standards-sdk.es110.js.map +1 -1
- package/dist/es/standards-sdk.es111.js +34 -2
- package/dist/es/standards-sdk.es111.js.map +1 -1
- package/dist/es/standards-sdk.es112.js +33 -2
- package/dist/es/standards-sdk.es112.js.map +1 -1
- package/dist/es/standards-sdk.es113.js +9 -34
- package/dist/es/standards-sdk.es113.js.map +1 -1
- package/dist/es/standards-sdk.es114.js +32 -31
- package/dist/es/standards-sdk.es114.js.map +1 -1
- package/dist/es/standards-sdk.es115.js +3 -9
- package/dist/es/standards-sdk.es115.js.map +1 -1
- package/dist/es/standards-sdk.es116.js +2 -34
- package/dist/es/standards-sdk.es116.js.map +1 -1
- package/dist/es/standards-sdk.es117.js +5 -0
- package/dist/es/standards-sdk.es117.js.map +1 -0
- package/dist/es/standards-sdk.es12.js +82 -628
- package/dist/es/standards-sdk.es12.js.map +1 -1
- package/dist/es/standards-sdk.es13.js +650 -85
- package/dist/es/standards-sdk.es13.js.map +1 -1
- package/dist/es/standards-sdk.es14.js +84 -58
- package/dist/es/standards-sdk.es14.js.map +1 -1
- package/dist/es/standards-sdk.es15.js +57 -20
- package/dist/es/standards-sdk.es15.js.map +1 -1
- package/dist/es/standards-sdk.es16.js +18 -156
- package/dist/es/standards-sdk.es16.js.map +1 -1
- package/dist/es/standards-sdk.es17.js +138 -385
- package/dist/es/standards-sdk.es17.js.map +1 -1
- package/dist/es/standards-sdk.es18.js +385 -299
- package/dist/es/standards-sdk.es18.js.map +1 -1
- package/dist/es/standards-sdk.es19.js +310 -128
- package/dist/es/standards-sdk.es19.js.map +1 -1
- package/dist/es/standards-sdk.es2.js +1 -1
- package/dist/es/standards-sdk.es20.js +155 -7
- package/dist/es/standards-sdk.es20.js.map +1 -1
- package/dist/es/standards-sdk.es21.js +7 -1767
- package/dist/es/standards-sdk.es21.js.map +1 -1
- package/dist/es/standards-sdk.es22.js +1041 -36
- package/dist/es/standards-sdk.es22.js.map +1 -1
- package/dist/es/standards-sdk.es23.js +1766 -47
- package/dist/es/standards-sdk.es23.js.map +1 -1
- package/dist/es/standards-sdk.es24.js +36 -7190
- package/dist/es/standards-sdk.es24.js.map +1 -1
- package/dist/es/standards-sdk.es25.js +48 -3
- package/dist/es/standards-sdk.es25.js.map +1 -1
- package/dist/es/standards-sdk.es26.js +7190 -2
- package/dist/es/standards-sdk.es26.js.map +1 -1
- package/dist/es/standards-sdk.es27.js +3 -4167
- package/dist/es/standards-sdk.es27.js.map +1 -1
- package/dist/es/standards-sdk.es28.js +2 -1041
- package/dist/es/standards-sdk.es28.js.map +1 -1
- package/dist/es/standards-sdk.es29.js +2 -2
- package/dist/es/standards-sdk.es3.js +1 -1
- package/dist/es/standards-sdk.es30.js +4122 -374
- package/dist/es/standards-sdk.es30.js.map +1 -1
- package/dist/es/standards-sdk.es31.js +2 -2
- package/dist/es/standards-sdk.es31.js.map +1 -1
- package/dist/es/standards-sdk.es32.js +356 -112
- package/dist/es/standards-sdk.es32.js.map +1 -1
- package/dist/es/standards-sdk.es33.js +6 -2
- package/dist/es/standards-sdk.es33.js.map +1 -1
- package/dist/es/standards-sdk.es34.js +178 -3
- package/dist/es/standards-sdk.es34.js.map +1 -1
- package/dist/es/standards-sdk.es35.js +72 -75
- package/dist/es/standards-sdk.es35.js.map +1 -1
- package/dist/es/standards-sdk.es36.js +111 -20
- package/dist/es/standards-sdk.es36.js.map +1 -1
- package/dist/es/standards-sdk.es37.js +42 -138
- package/dist/es/standards-sdk.es37.js.map +1 -1
- package/dist/es/standards-sdk.es38.js +10 -91
- package/dist/es/standards-sdk.es38.js.map +1 -1
- package/dist/es/standards-sdk.es39.js +75 -7114
- package/dist/es/standards-sdk.es39.js.map +1 -1
- package/dist/es/standards-sdk.es4.js +2 -2
- package/dist/es/standards-sdk.es40.js +3 -194
- package/dist/es/standards-sdk.es40.js.map +1 -1
- package/dist/es/standards-sdk.es41.js +2 -438
- package/dist/es/standards-sdk.es41.js.map +1 -1
- package/dist/es/standards-sdk.es42.js +107 -19
- package/dist/es/standards-sdk.es42.js.map +1 -1
- package/dist/es/standards-sdk.es43.js +70 -135
- package/dist/es/standards-sdk.es43.js.map +1 -1
- package/dist/es/standards-sdk.es44.js +5 -17
- package/dist/es/standards-sdk.es44.js.map +1 -1
- package/dist/es/standards-sdk.es45.js +4 -28
- package/dist/es/standards-sdk.es45.js.map +1 -1
- package/dist/es/standards-sdk.es46.js +219 -27
- package/dist/es/standards-sdk.es46.js.map +1 -1
- package/dist/es/standards-sdk.es47.js +56 -19
- package/dist/es/standards-sdk.es47.js.map +1 -1
- package/dist/es/standards-sdk.es48.js +69 -44
- package/dist/es/standards-sdk.es48.js.map +1 -1
- package/dist/es/standards-sdk.es49.js +191 -14
- package/dist/es/standards-sdk.es49.js.map +1 -1
- package/dist/es/standards-sdk.es5.js +32 -26
- package/dist/es/standards-sdk.es5.js.map +1 -1
- package/dist/es/standards-sdk.es50.js +421 -44
- package/dist/es/standards-sdk.es50.js.map +1 -1
- package/dist/es/standards-sdk.es51.js +19 -1283
- package/dist/es/standards-sdk.es51.js.map +1 -1
- package/dist/es/standards-sdk.es52.js +134 -27
- package/dist/es/standards-sdk.es52.js.map +1 -1
- package/dist/es/standards-sdk.es53.js +17 -5
- package/dist/es/standards-sdk.es53.js.map +1 -1
- package/dist/es/standards-sdk.es54.js +21 -151
- package/dist/es/standards-sdk.es54.js.map +1 -1
- package/dist/es/standards-sdk.es55.js +20 -784
- package/dist/es/standards-sdk.es55.js.map +1 -1
- package/dist/es/standards-sdk.es56.js +17 -170
- package/dist/es/standards-sdk.es56.js.map +1 -1
- package/dist/es/standards-sdk.es57.js +35 -134
- package/dist/es/standards-sdk.es57.js.map +1 -1
- package/dist/es/standards-sdk.es58.js +18 -3
- package/dist/es/standards-sdk.es58.js.map +1 -1
- package/dist/es/standards-sdk.es59.js +54 -357
- package/dist/es/standards-sdk.es59.js.map +1 -1
- package/dist/es/standards-sdk.es60.js +1287 -4
- package/dist/es/standards-sdk.es60.js.map +1 -1
- package/dist/es/standards-sdk.es61.js +135 -166
- package/dist/es/standards-sdk.es61.js.map +1 -1
- package/dist/es/standards-sdk.es62.js +82 -72
- package/dist/es/standards-sdk.es62.js.map +1 -1
- package/dist/es/standards-sdk.es63.js +78 -108
- package/dist/es/standards-sdk.es63.js.map +1 -1
- package/dist/es/standards-sdk.es64.js +27 -47
- package/dist/es/standards-sdk.es64.js.map +1 -1
- package/dist/es/standards-sdk.es65.js +5 -9
- package/dist/es/standards-sdk.es65.js.map +1 -1
- package/dist/es/standards-sdk.es66.js +146 -84
- package/dist/es/standards-sdk.es66.js.map +1 -1
- package/dist/es/standards-sdk.es67.js +22 -3
- package/dist/es/standards-sdk.es67.js.map +1 -1
- package/dist/es/standards-sdk.es68.js +793 -2
- package/dist/es/standards-sdk.es68.js.map +1 -1
- package/dist/es/standards-sdk.es69.js +93 -105
- package/dist/es/standards-sdk.es69.js.map +1 -1
- package/dist/es/standards-sdk.es7.js +39 -33
- package/dist/es/standards-sdk.es7.js.map +1 -1
- package/dist/es/standards-sdk.es70.js +2 -74
- package/dist/es/standards-sdk.es70.js.map +1 -1
- package/dist/es/standards-sdk.es71.js +15 -5
- package/dist/es/standards-sdk.es71.js.map +1 -1
- package/dist/es/standards-sdk.es72.js +408 -4
- package/dist/es/standards-sdk.es72.js.map +1 -1
- package/dist/es/standards-sdk.es73.js +162 -209
- package/dist/es/standards-sdk.es73.js.map +1 -1
- package/dist/es/standards-sdk.es74.js +137 -52
- package/dist/es/standards-sdk.es74.js.map +1 -1
- package/dist/es/standards-sdk.es75.js +2281 -68
- package/dist/es/standards-sdk.es75.js.map +1 -1
- package/dist/es/standards-sdk.es76.js +159 -16
- package/dist/es/standards-sdk.es76.js.map +1 -1
- package/dist/es/standards-sdk.es77.js +417 -25
- package/dist/es/standards-sdk.es77.js.map +1 -1
- package/dist/es/standards-sdk.es78.js +2 -26
- package/dist/es/standards-sdk.es78.js.map +1 -1
- package/dist/es/standards-sdk.es79.js +118 -36
- package/dist/es/standards-sdk.es79.js.map +1 -1
- package/dist/es/standards-sdk.es8.js +8 -8
- package/dist/es/standards-sdk.es8.js.map +1 -1
- package/dist/es/standards-sdk.es80.js +20 -100
- package/dist/es/standards-sdk.es80.js.map +1 -1
- package/dist/es/standards-sdk.es81.js +3 -2
- package/dist/es/standards-sdk.es81.js.map +1 -1
- package/dist/es/standards-sdk.es82.js +31 -15
- package/dist/es/standards-sdk.es82.js.map +1 -1
- package/dist/es/standards-sdk.es83.js +57 -403
- package/dist/es/standards-sdk.es83.js.map +1 -1
- package/dist/es/standards-sdk.es84.js +47 -161
- package/dist/es/standards-sdk.es84.js.map +1 -1
- package/dist/es/standards-sdk.es85.js +9 -31
- package/dist/es/standards-sdk.es85.js.map +1 -1
- package/dist/es/standards-sdk.es86.js +58 -56
- package/dist/es/standards-sdk.es86.js.map +1 -1
- package/dist/es/standards-sdk.es87.js +6 -50
- package/dist/es/standards-sdk.es87.js.map +1 -1
- package/dist/es/standards-sdk.es88.js +14 -9
- package/dist/es/standards-sdk.es88.js.map +1 -1
- package/dist/es/standards-sdk.es89.js +6 -64
- package/dist/es/standards-sdk.es89.js.map +1 -1
- package/dist/es/standards-sdk.es9.js +2 -2
- package/dist/es/standards-sdk.es90.js +44 -5
- package/dist/es/standards-sdk.es90.js.map +1 -1
- package/dist/es/standards-sdk.es91.js +2 -15
- package/dist/es/standards-sdk.es91.js.map +1 -1
- package/dist/es/standards-sdk.es92.js +135 -6
- package/dist/es/standards-sdk.es92.js.map +1 -1
- package/dist/es/standards-sdk.es93.js +169 -42
- package/dist/es/standards-sdk.es93.js.map +1 -1
- package/dist/es/standards-sdk.es94.js +7136 -2
- package/dist/es/standards-sdk.es94.js.map +1 -1
- package/dist/es/standards-sdk.es95.js +27 -136
- package/dist/es/standards-sdk.es95.js.map +1 -1
- package/dist/es/standards-sdk.es96.js +26 -172
- package/dist/es/standards-sdk.es96.js.map +1 -1
- package/dist/es/standards-sdk.es97.js +38 -2282
- package/dist/es/standards-sdk.es97.js.map +1 -1
- package/dist/es/standards-sdk.es98.js +31 -12
- package/dist/es/standards-sdk.es98.js.map +1 -1
- package/dist/es/standards-sdk.es99.js +15 -13
- package/dist/es/standards-sdk.es99.js.map +1 -1
- package/dist/umd/hcs-10/base-client.d.ts.map +1 -1
- package/dist/umd/hcs-10/connections-manager.d.ts +185 -0
- package/dist/umd/hcs-10/connections-manager.d.ts.map +1 -0
- package/dist/umd/hcs-10/index.d.ts +1 -0
- package/dist/umd/hcs-10/index.d.ts.map +1 -1
- package/dist/umd/hcs-10/sdk.d.ts.map +1 -1
- package/dist/umd/services/mirror-node.d.ts.map +1 -1
- package/dist/umd/standards-sdk.umd.js +2 -2
- package/dist/umd/standards-sdk.umd.js.map +1 -1
- package/package.json +9 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standards-sdk.es10.js","sources":["../../src/hcs-11/agent-builder.ts"],"sourcesContent":["import {\n InboundTopicType,\n AgentConfiguration,\n AgentMetadata,\n AIAgentCapability,\n SocialPlatform,\n} from './types';\nimport { Logger } from '../utils/logger';\nimport { FeeConfigBuilderInterface } from '../fees';\nimport { NetworkType } from '../utils/types';\n\n/**\n * AgentBuilder is a builder class for creating agent configurations.\n * It provides a fluent interface for setting various properties of the agent.\n *\n * Example usage:\n * ```typescript\n * const agentBuilder = new AgentBuilder();\n * agentBuilder.setName('My Agent');\n * agentBuilder.setDescription('This is my agent');\n * agentBuilder.setCapabilities([AIAgentCapability.CREATE_CONTENT]);\n * agentBuilder.setModel('gpt-4o');\n * agentBuilder.setCreator('John Doe');\n * agentBuilder.addSocial('twitter', 'JohnDoe');\n * agentBuilder.addProperty('key', 'value');\n * const agentConfig = agentBuilder.build();\n * ```\n *\n */\nexport class AgentBuilder {\n private config: Partial<AgentConfiguration> = {};\n private logger: Logger;\n\n constructor() {\n this.logger = Logger.getInstance({\n module: 'AgentBuilder',\n });\n }\n\n setName(name: string): this {\n this.config.name = name;\n return this;\n }\n\n setAlias(alias: string): this {\n this.config.alias = alias;\n return this;\n }\n\n setBio(bio: string): this {\n this.config.bio = bio;\n return this;\n }\n\n /**\n * @deprecated Use setBio instead\n */\n setDescription(description: string): this {\n this.config.bio = description;\n return this;\n }\n\n setCapabilities(capabilities: AIAgentCapability[]): this {\n this.config.capabilities = capabilities;\n return this;\n }\n\n /**\n * @deprecated Use setType instead\n */\n setAgentType(type: 'autonomous' | 'manual'): this {\n if (!this.config.metadata) {\n this.config.metadata = { type };\n } else {\n this.config.metadata.type = type;\n }\n return this;\n }\n\n setType(type: 'autonomous' | 'manual'): this {\n if (!this.config.metadata) {\n this.config.metadata = { type };\n } else {\n this.config.metadata.type = type;\n }\n return this;\n }\n\n setModel(model: string): this {\n if (!this.config.metadata) {\n this.config.metadata = { type: 'manual' };\n }\n this.config.metadata.model = model;\n return this;\n }\n\n setCreator(creator: string): this {\n if (!this.config.metadata) {\n this.config.metadata = { type: 'manual' };\n }\n this.config.metadata.creator = creator;\n return this;\n }\n\n addSocial(platform: SocialPlatform, handle: string): this {\n if (!this.config.metadata) {\n this.config.metadata = { type: 'manual' };\n }\n if (!this.config.metadata.socials) {\n this.config.metadata.socials = {};\n }\n this.config.metadata.socials[platform] = handle;\n return this;\n }\n\n addProperty(key: string, value: any): this {\n if (!this.config.metadata) {\n this.config.metadata = { type: 'manual' };\n }\n if (!this.config.metadata.properties) {\n this.config.metadata.properties = {};\n }\n this.config.metadata.properties[key] = value;\n return this;\n }\n\n setMetadata(metadata: AgentMetadata): this {\n this.config.metadata = metadata;\n return this;\n }\n\n setProfilePicture(pfpBuffer: Buffer, pfpFileName: string): this {\n this.config.pfpBuffer = pfpBuffer;\n this.config.pfpFileName = pfpFileName;\n return this;\n }\n\n setExistingProfilePicture(pfpTopicId: string): this {\n this.config.existingPfpTopicId = pfpTopicId;\n return this;\n }\n\n setNetwork(network: NetworkType): this {\n this.config.network = network;\n return this;\n }\n\n setInboundTopicType(inboundTopicType: InboundTopicType): this {\n this.config.inboundTopicType = inboundTopicType;\n return this;\n }\n\n setFeeConfig(feeConfigBuilder: FeeConfigBuilderInterface): this {\n this.config.feeConfig = feeConfigBuilder;\n return this;\n }\n\n setConnectionFeeConfig(feeConfigBuilder: FeeConfigBuilderInterface): this {\n this.config.connectionFeeConfig = feeConfigBuilder;\n return this;\n }\n\n setExistingAccount(accountId: string, privateKey: string): this {\n this.config.existingAccount = { accountId, privateKey };\n return this;\n }\n\n build(): AgentConfiguration {\n if (!this.config.name) {\n throw new Error('Agent display name is required');\n }\n\n if (!this.config.bio) {\n this.logger?.warn('Agent description is not set');\n }\n\n if (!this.config.pfpBuffer && !this.config.existingPfpTopicId) {\n this.logger.warn('No profile picture provided or referenced.');\n }\n\n if (!this.config.network) {\n throw new Error('Network is required');\n }\n\n if (!this.config.inboundTopicType) {\n this.config.inboundTopicType = InboundTopicType.PUBLIC;\n }\n\n if (!this.config.capabilities) {\n this.config.capabilities = [];\n }\n\n if (!this.config.metadata) {\n this.config.metadata = { type: 'manual' };\n } else if (!this.config.metadata.type) {\n this.config.metadata.type = 'manual';\n }\n\n if (\n this.config.inboundTopicType === InboundTopicType.FEE_BASED &&\n !this.config.feeConfig\n ) {\n throw new Error('Fee configuration is required for fee-based topics');\n }\n\n return this.config as AgentConfiguration;\n }\n}\n"],"names":[],"mappings":";;AA6BO,MAAM,aAAa;AAAA,EAIxB,cAAc;AAHd,SAAQ,SAAsC,CAAC;AAIxC,SAAA,SAAS,OAAO,YAAY;AAAA,MAC/B,QAAQ;AAAA,IAAA,CACT;AAAA,EAAA;AAAA,EAGH,QAAQ,MAAoB;AAC1B,SAAK,OAAO,OAAO;AACZ,WAAA;AAAA,EAAA;AAAA,EAGT,SAAS,OAAqB;AAC5B,SAAK,OAAO,QAAQ;AACb,WAAA;AAAA,EAAA;AAAA,EAGT,OAAO,KAAmB;AACxB,SAAK,OAAO,MAAM;AACX,WAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA,EAMT,eAAe,aAA2B;AACxC,SAAK,OAAO,MAAM;AACX,WAAA;AAAA,EAAA;AAAA,EAGT,gBAAgB,cAAyC;AACvD,SAAK,OAAO,eAAe;AACpB,WAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA,EAMT,aAAa,MAAqC;AAC5C,QAAA,CAAC,KAAK,OAAO,UAAU;AACpB,WAAA,OAAO,WAAW,EAAE,KAAK;AAAA,IAAA,OACzB;AACA,WAAA,OAAO,SAAS,OAAO;AAAA,IAAA;AAEvB,WAAA;AAAA,EAAA;AAAA,EAGT,QA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B,QAAA,KAAK,OAAO,qBAAqB,iBAAiB,aAClD,CAAC,KAAK,OAAO,WACb;AACM,YAAA,IAAI,MAAM,oDAAoD;AAAA,IAAA;AAGtE,WAAO,KAAK;AAAA,EAAA;AAEhB;"}
|
|
1
|
+
{"version":3,"file":"standards-sdk.es10.js","sources":["../../src/hcs-10/connections-manager.ts"],"sourcesContent":["import { Logger, LoggerOptions } from '../utils/logger';\nimport { HCSMessage, HCS10BaseClient } from './base-client';\nimport { AIAgentProfile } from '../hcs-11';\n\n/**\n * Represents a connection request between agents\n */\nexport interface ConnectionRequest {\n id: number;\n requesterId: string;\n requesterTopicId: string;\n targetAccountId: string;\n targetTopicId: string;\n operatorId: string;\n sequenceNumber: number;\n created: Date;\n memo?: string;\n status: 'pending' | 'confirmed' | 'rejected';\n}\n\n/**\n * Represents an active connection between agents\n */\nexport interface Connection {\n connectionTopicId: string;\n targetAccountId: string;\n targetAgentName?: string;\n targetInboundTopicId?: string;\n targetOutboundTopicId?: string;\n status: 'pending' | 'established' | 'needs_confirmation' | 'closed';\n isPending: boolean;\n needsConfirmation: boolean;\n created: Date;\n lastActivity?: Date;\n profileInfo?: AIAgentProfile;\n connectionRequestId?: number;\n confirmedRequestId?: number;\n requesterOutboundTopicId?: string;\n inboundRequestId?: number;\n closedReason?: string;\n closeMethod?: string;\n uniqueRequestKey?: string;\n}\n\n/**\n * Options for the connections manager\n */\nexport interface ConnectionsManagerOptions {\n logLevel?: 'debug' | 'info' | 'warn' | 'error';\n filterPendingAccountIds?: string[];\n baseClient: HCS10BaseClient;\n}\n\n/**\n * ConnectionsManager provides a unified way to track and manage HCS-10 connections\n * across different applications. It works with both frontend and backend implementations.\n */\nexport class ConnectionsManager {\n private logger: Logger;\n private connections: Map<string, Connection> = new Map();\n private pendingRequests: Map<string, ConnectionRequest> = new Map();\n private profileCache: Map<string, AIAgentProfile> = new Map();\n private filterPendingAccountIds: Set<string> = new Set();\n private baseClient: HCS10BaseClient;\n\n /**\n * Creates a new ConnectionsManager instance\n */\n constructor(options: ConnectionsManagerOptions) {\n const loggerOptions: LoggerOptions = {\n module: 'ConnectionsManager',\n level: options?.logLevel || 'info',\n prettyPrint: true,\n };\n this.logger = new Logger(loggerOptions);\n\n if (options?.filterPendingAccountIds) {\n this.filterPendingAccountIds = new Set(options.filterPendingAccountIds);\n }\n\n if (!options.baseClient) {\n throw new Error('ConnectionsManager requires a baseClient to operate');\n }\n\n this.baseClient = options.baseClient;\n }\n\n /**\n * Fetches and processes connection data using the configured client\n * @param accountId - The account ID to fetch connection data for\n * @returns A promise that resolves to an array of Connection objects\n */\n async fetchConnectionData(accountId: string): Promise<Connection[]> {\n try {\n const topicInfo = await this.baseClient.retrieveCommunicationTopics(\n accountId\n );\n\n const [outboundMessagesResult, inboundMessagesResult] = await Promise.all(\n [\n this.baseClient.getMessages(topicInfo.outboundTopic),\n this.baseClient.getMessages(topicInfo.inboundTopic),\n ]\n );\n\n this.processOutboundMessages(\n outboundMessagesResult.messages || [],\n accountId\n );\n this.processInboundMessages(\n inboundMessagesResult.messages || [],\n accountId\n );\n\n await this.checkTargetInboundTopicsForConfirmations();\n await this.fetchProfilesForConnections(accountId);\n await this.fetchConnectionActivity();\n\n return this.getAllConnections();\n } catch (error) {\n this.logger.error('Error fetching connection data:', error);\n return this.getAllConnections();\n }\n }\n\n /**\n * Checks target agent inbound topics to find confirmations for pending requests\n * that might not be visible in our local messages\n */\n private async checkTargetInboundTopicsForConfirmations(): Promise<void> {\n const pendingConnections = Array.from(this.connections.values()).filter(\n (conn) => conn.isPending && conn.targetInboundTopicId\n );\n\n if (pendingConnections.length === 0) {\n return;\n }\n\n const pendingRequestsByTarget = new Map<string, Connection[]>();\n\n pendingConnections.forEach((conn) => {\n if (conn.targetInboundTopicId) {\n const requests =\n pendingRequestsByTarget.get(conn.targetInboundTopicId) || [];\n requests.push(conn);\n pendingRequestsByTarget.set(conn.targetInboundTopicId, requests);\n }\n });\n\n const MAX_FETCH_ATTEMPTS = 2;\n const FETCH_DELAY_MS = 500;\n\n for (const [\n targetInboundTopicId,\n requests,\n ] of pendingRequestsByTarget.entries()) {\n for (let attempt = 1; attempt <= MAX_FETCH_ATTEMPTS; attempt++) {\n try {\n const targetMessagesResult = await this.baseClient.getMessages(\n targetInboundTopicId\n );\n const targetMessages = targetMessagesResult.messages || [];\n\n let confirmedAny = false;\n\n for (const conn of requests) {\n const requestId = conn.connectionRequestId;\n if (!requestId) {\n continue;\n }\n\n const confirmationMsg = targetMessages.find(\n (msg) =>\n msg.op === 'connection_created' &&\n msg.connection_id === requestId &&\n msg.connection_topic_id\n );\n\n if (confirmationMsg?.connection_topic_id) {\n confirmedAny = true;\n\n const connectionTopicId = confirmationMsg.connection_topic_id;\n\n let pendingKey = conn.connectionTopicId;\n if (!pendingKey.startsWith('req-') && conn.uniqueRequestKey) {\n pendingKey = conn.uniqueRequestKey;\n }\n\n const newConnection: Connection = {\n connectionTopicId,\n targetAccountId: conn.targetAccountId,\n targetAgentName: conn.targetAgentName,\n targetInboundTopicId: conn.targetInboundTopicId,\n status: 'established',\n isPending: false,\n needsConfirmation: false,\n created: new Date(confirmationMsg.created || conn.created),\n profileInfo: conn.profileInfo,\n connectionRequestId: requestId,\n uniqueRequestKey: conn.uniqueRequestKey,\n };\n\n this.connections.set(connectionTopicId, newConnection);\n\n if (pendingKey && pendingKey !== connectionTopicId) {\n this.connections.delete(pendingKey);\n }\n\n this.logger.debug(\n `Confirmed connection in target inbound topic: ${connectionTopicId}`\n );\n }\n }\n\n if (confirmedAny || attempt === MAX_FETCH_ATTEMPTS) {\n break;\n }\n\n await new Promise((resolve) => setTimeout(resolve, FETCH_DELAY_MS));\n } catch (error) {\n this.logger.debug(\n `Error fetching target inbound topic ${targetInboundTopicId}:`,\n error\n );\n if (attempt === MAX_FETCH_ATTEMPTS) {\n break;\n }\n await new Promise((resolve) => setTimeout(resolve, FETCH_DELAY_MS));\n }\n }\n }\n }\n\n /**\n * Fetches profiles for all connected accounts\n * @param accountId - The account ID making the request\n */\n private async fetchProfilesForConnections(accountId: string): Promise<void> {\n const targetAccountIds = new Set<string>();\n\n for (const connection of this.connections.values()) {\n if (\n connection.targetAccountId &&\n !this.profileCache.has(connection.targetAccountId)\n ) {\n targetAccountIds.add(connection.targetAccountId);\n }\n }\n\n const accountIdPromises = Array.from(targetAccountIds).map(\n async (targetId) => {\n try {\n const profileResponse = await this.baseClient.retrieveProfile(\n targetId\n );\n if (profileResponse.success && profileResponse.profile) {\n this.addProfileInfo(targetId, profileResponse.profile);\n\n this.updatePendingConnectionsWithProfileInfo(\n targetId,\n profileResponse.profile\n );\n }\n } catch (error) {\n this.logger.debug(`Failed to fetch profile for ${targetId}:`, error);\n }\n }\n );\n\n await Promise.allSettled(accountIdPromises);\n }\n\n /**\n * Updates pending connections with inbound topic IDs from profile info\n * @param accountId - The account ID to update connections for\n * @param profile - The profile containing the inbound topic ID\n */\n private updatePendingConnectionsWithProfileInfo(\n accountId: string,\n profile: AIAgentProfile\n ): void {\n const pendingConnections = Array.from(this.connections.values()).filter(\n (conn) =>\n conn.targetAccountId === accountId &&\n (conn.isPending || conn.needsConfirmation) &&\n !conn.targetInboundTopicId\n );\n\n if (pendingConnections.length > 0 && profile.inboundTopicId) {\n for (const conn of pendingConnections) {\n const updatedConn = {\n ...conn,\n targetInboundTopicId: profile.inboundTopicId,\n };\n this.connections.set(conn.connectionTopicId, updatedConn);\n }\n }\n }\n\n /**\n * Fetches activity from active connection topics\n * Updates the lastActivity timestamp for each connection based on latest messages\n * @returns Promise that resolves when all activity has been fetched\n */\n private async fetchConnectionActivity(): Promise<void> {\n const activeConnections = this.getActiveConnections();\n\n const activityPromises = activeConnections.map(async (connection) => {\n try {\n const messagesResult = await this.baseClient.getMessages(\n connection.connectionTopicId\n );\n if (messagesResult?.messages?.length > 0) {\n this.processConnectionMessages(\n connection.connectionTopicId,\n messagesResult.messages\n );\n }\n } catch (error) {\n this.logger.debug(\n `Failed to fetch activity for ${connection.connectionTopicId}:`,\n error\n );\n }\n });\n\n await Promise.allSettled(activityPromises);\n }\n\n /**\n * Checks if an account should be filtered, taking into account existing established connections\n * @param accountId - The account ID to check\n * @returns True if the account should be filtered, false otherwise\n */\n private shouldFilterAccount(accountId: string): boolean {\n if (!this.filterPendingAccountIds.has(accountId)) {\n return false;\n }\n\n if (this.hasEstablishedConnectionWithAccount(accountId)) {\n return false;\n }\n\n return true;\n }\n\n /**\n * Process outbound messages to track connection requests and confirmations\n * @param messages - The messages to process\n * @param accountId - The account ID that sent the messages\n * @returns Array of connections after processing\n */\n processOutboundMessages(\n messages: HCSMessage[],\n accountId: string\n ): Connection[] {\n if (!messages || messages.length === 0) {\n return Array.from(this.connections.values());\n }\n\n const requestMessages = messages.filter(\n (msg) => msg.op === 'connection_request' && msg.connection_request_id\n );\n\n for (const msg of requestMessages) {\n const requestId = msg.connection_request_id!;\n const operatorId = msg.operator_id || '';\n const targetAccountId =\n this.baseClient.extractAccountFromOperatorId(operatorId);\n const targetInboundTopicId =\n this.baseClient.extractTopicFromOperatorId(operatorId);\n\n if (this.shouldFilterAccount(targetAccountId)) {\n this.logger.debug(\n `Filtering out outbound request to account: ${targetAccountId}`\n );\n continue;\n }\n\n const isAlreadyConfirmed = Array.from(this.connections.values()).some(\n (conn) => conn.connectionRequestId === requestId && !conn.isPending\n );\n\n const pendingKey = `req-${requestId}:${operatorId}`;\n\n if (!isAlreadyConfirmed && !this.pendingRequests.has(pendingKey)) {\n this.pendingRequests.set(pendingKey, {\n id: requestId,\n requesterId: accountId,\n requesterTopicId: msg.outbound_topic_id || '',\n targetAccountId,\n targetTopicId: targetInboundTopicId,\n operatorId,\n sequenceNumber: msg.sequence_number,\n created: msg.created || new Date(),\n memo: msg.m,\n status: 'pending',\n });\n\n if (!this.connections.has(pendingKey)) {\n this.connections.set(pendingKey, {\n connectionTopicId: pendingKey,\n targetAccountId,\n targetInboundTopicId,\n status: 'pending',\n isPending: true,\n needsConfirmation: false,\n created: msg.created || new Date(),\n connectionRequestId: requestId,\n uniqueRequestKey: pendingKey,\n });\n }\n }\n }\n\n const confirmationMessages = messages.filter(\n (msg) =>\n msg.op === 'connection_created' &&\n msg.connection_topic_id &&\n msg.connection_request_id\n );\n\n for (const msg of confirmationMessages) {\n const requestId = msg.connection_request_id!;\n const connectionTopicId = msg.connection_topic_id!;\n const targetAccountId = this.baseClient.extractAccountFromOperatorId(\n msg.operator_id || ''\n );\n\n if (this.shouldFilterAccount(targetAccountId)) {\n this.logger.debug(\n `Filtering out outbound confirmation to account: ${targetAccountId}`\n );\n continue;\n }\n\n const pendingKey = `req-${requestId}:${msg.operator_id}`;\n\n const pendingRequest = this.pendingRequests.get(pendingKey);\n if (pendingRequest) {\n pendingRequest.status = 'confirmed';\n }\n\n if (this.connections.has(pendingKey)) {\n this.connections.delete(pendingKey);\n }\n\n const existingConnections = Array.from(this.connections.entries()).filter(\n ([_, conn]) => conn.connectionRequestId === requestId\n );\n\n for (const [key, _] of existingConnections) {\n if (key !== connectionTopicId) {\n this.connections.delete(key);\n }\n }\n\n if (!this.connections.has(connectionTopicId)) {\n this.connections.set(connectionTopicId, {\n connectionTopicId,\n targetAccountId,\n status: 'established',\n isPending: false,\n needsConfirmation: false,\n created: msg.created || new Date(),\n connectionRequestId: requestId,\n confirmedRequestId: msg.confirmed_request_id,\n requesterOutboundTopicId: msg.outbound_topic_id,\n uniqueRequestKey: pendingKey,\n });\n } else {\n const conn = this.connections.get(connectionTopicId)!;\n this.connections.set(connectionTopicId, {\n ...conn,\n status: 'established',\n isPending: false,\n needsConfirmation: false,\n connectionRequestId: requestId,\n confirmedRequestId: msg.confirmed_request_id,\n requesterOutboundTopicId: msg.outbound_topic_id,\n uniqueRequestKey: pendingKey,\n });\n }\n }\n\n const closedMessages = messages.filter(\n (msg) =>\n (msg.op as string) === 'connection_closed' ||\n (msg.op === 'close_connection' && msg.connection_topic_id)\n );\n\n for (const msg of closedMessages) {\n const connectionTopicId = msg.connection_topic_id!;\n\n if (this.connections.has(connectionTopicId)) {\n const conn = this.connections.get(connectionTopicId)!;\n if (\n this.shouldFilterAccount(conn.targetAccountId) &&\n conn.status !== 'established'\n ) {\n continue;\n }\n\n const uniqueKey =\n msg.connection_request_id && msg.operator_id\n ? `req-${msg.connection_request_id}:${msg.operator_id}`\n : undefined;\n\n this.connections.set(connectionTopicId, {\n ...conn,\n status: 'closed',\n isPending: false,\n needsConfirmation: false,\n lastActivity: msg.created || new Date(),\n closedReason: msg.reason,\n closeMethod: msg.close_method,\n uniqueRequestKey: uniqueKey,\n });\n }\n }\n\n return Array.from(this.connections.values()).filter(\n (conn) =>\n conn.status === 'established' ||\n conn.status === 'closed' ||\n !this.filterPendingAccountIds.has(conn.targetAccountId)\n );\n }\n\n /**\n * Process inbound messages to track connection requests and confirmations\n * @param messages - The messages to process\n * @param accountId - The account ID that received the messages\n * @returns Array of connections after processing\n */\n processInboundMessages(\n messages: HCSMessage[],\n accountId: string\n ): Connection[] {\n if (!messages || messages.length === 0) {\n return Array.from(this.connections.values());\n }\n\n const requestMessages = messages.filter(\n (msg) => msg.op === 'connection_request' && msg.sequence_number\n );\n\n for (const msg of requestMessages) {\n const sequenceNumber = msg.sequence_number;\n const operatorId = msg.operator_id || '';\n const requestorAccountId =\n this.baseClient.extractAccountFromOperatorId(operatorId);\n const requestorTopicId =\n this.baseClient.extractTopicFromOperatorId(operatorId);\n\n if (this.shouldFilterAccount(requestorAccountId)) {\n this.logger.debug(\n `Filtering out request from account: ${requestorAccountId}`\n );\n continue;\n }\n\n const isAlreadyConfirmed = messages.some(\n (confirmMsg) =>\n confirmMsg.op === 'connection_created' &&\n confirmMsg.connection_id === sequenceNumber\n );\n\n if (!isAlreadyConfirmed) {\n const needsConfirmKey = `inb-${sequenceNumber}:${operatorId}`;\n\n if (!this.connections.has(needsConfirmKey)) {\n this.connections.set(needsConfirmKey, {\n connectionTopicId: needsConfirmKey,\n targetAccountId: requestorAccountId,\n targetInboundTopicId: requestorTopicId,\n status: 'needs_confirmation',\n isPending: false,\n needsConfirmation: true,\n created: msg.created || new Date(),\n inboundRequestId: sequenceNumber,\n uniqueRequestKey: needsConfirmKey,\n });\n }\n }\n }\n\n const confirmationMessages = messages.filter(\n (msg) =>\n msg.op === 'connection_created' &&\n msg.connection_topic_id &&\n msg.connection_id\n );\n\n for (const msg of confirmationMessages) {\n const sequenceNumber = msg.connection_id!;\n const connectionTopicId = msg.connection_topic_id!;\n const connectedAccountId = msg.connected_account_id || '';\n\n if (this.shouldFilterAccount(connectedAccountId)) {\n this.logger.debug(\n `Filtering out confirmation for account: ${connectedAccountId}`\n );\n continue;\n }\n\n const needsConfirmKey = `inb-${sequenceNumber}:${msg.operator_id}`;\n\n if (this.connections.has(needsConfirmKey)) {\n this.connections.delete(needsConfirmKey);\n }\n\n const existingConnections = Array.from(this.connections.entries()).filter(\n ([_, conn]) => conn.inboundRequestId === sequenceNumber\n );\n\n for (const [key, _] of existingConnections) {\n if (key !== connectionTopicId) {\n this.connections.delete(key);\n }\n }\n\n if (!this.connections.has(connectionTopicId)) {\n this.connections.set(connectionTopicId, {\n connectionTopicId,\n targetAccountId: connectedAccountId,\n status: 'established',\n isPending: false,\n needsConfirmation: false,\n created: msg.created || new Date(),\n inboundRequestId: sequenceNumber,\n uniqueRequestKey: needsConfirmKey,\n });\n } else {\n const conn = this.connections.get(connectionTopicId)!;\n this.connections.set(connectionTopicId, {\n ...conn,\n status: 'established',\n isPending: false,\n needsConfirmation: false,\n inboundRequestId: sequenceNumber,\n uniqueRequestKey: needsConfirmKey,\n });\n }\n }\n\n return Array.from(this.connections.values()).filter(\n (conn) =>\n conn.status === 'established' ||\n conn.status === 'closed' ||\n !this.filterPendingAccountIds.has(conn.targetAccountId)\n );\n }\n\n /**\n * Process connection topic messages to update last activity time\n * @param connectionTopicId - The topic ID of the connection\n * @param messages - The messages to process\n * @returns The updated connection or undefined if not found\n */\n processConnectionMessages(\n connectionTopicId: string,\n messages: HCSMessage[]\n ): Connection | undefined {\n if (\n !messages ||\n messages.length === 0 ||\n !this.connections.has(connectionTopicId)\n ) {\n return this.connections.get(connectionTopicId);\n }\n\n const latestMessage = messages\n .filter((m) => m.created)\n .sort((a, b) => {\n const dateA = a.created ? new Date(a.created).getTime() : 0;\n const dateB = b.created ? new Date(b.created).getTime() : 0;\n return dateB - dateA;\n })[0];\n\n if (latestMessage?.created) {\n const conn = this.connections.get(connectionTopicId)!;\n this.connections.set(connectionTopicId, {\n ...conn,\n lastActivity: latestMessage.created,\n });\n }\n\n const closeMessage = messages.find((msg) => msg.op === 'close_connection');\n if (closeMessage) {\n const conn = this.connections.get(connectionTopicId)!;\n this.connections.set(connectionTopicId, {\n ...conn,\n status: 'closed',\n lastActivity: closeMessage.created || new Date(),\n closedReason: closeMessage.reason,\n closeMethod: 'explicit',\n });\n }\n\n return this.connections.get(connectionTopicId);\n }\n\n /**\n * Adds or updates profile information for a connection\n * @param accountId - The account ID to add profile info for\n * @param profile - The profile information\n */\n addProfileInfo(accountId: string, profile: any): void {\n this.profileCache.set(accountId, profile);\n\n const matchingConnections = Array.from(this.connections.values()).filter(\n (conn) => conn.targetAccountId === accountId\n );\n\n for (const conn of matchingConnections) {\n this.connections.set(conn.connectionTopicId, {\n ...conn,\n profileInfo: profile,\n targetAgentName: profile.display_name,\n targetInboundTopicId: profile.inboundTopicId,\n targetOutboundTopicId: profile.outboundTopicId,\n });\n }\n }\n\n /**\n * Gets all connections\n * @returns Array of all connections that should be visible\n */\n getAllConnections(): Connection[] {\n return Array.from(this.connections.values()).filter(\n (conn) =>\n conn.status === 'established' ||\n conn.status === 'closed' ||\n !this.filterPendingAccountIds.has(conn.targetAccountId) ||\n this.hasEstablishedConnectionWithAccount(conn.targetAccountId)\n );\n }\n\n /**\n * Gets all pending connection requests\n * @returns Array of pending connection requests\n */\n getPendingRequests(): Connection[] {\n return Array.from(this.connections.values()).filter((conn) => {\n return (\n conn.isPending &&\n (!this.filterPendingAccountIds.has(conn.targetAccountId) ||\n this.hasEstablishedConnectionWithAccount(conn.targetAccountId))\n );\n });\n }\n\n /**\n * Helper method to check if there's an established connection with an account\n * @param accountId - The account ID to check\n * @returns True if there's an established connection, false otherwise\n */\n private hasEstablishedConnectionWithAccount(accountId: string): boolean {\n return Array.from(this.connections.values()).some(\n (conn) =>\n conn.targetAccountId === accountId && conn.status === 'established'\n );\n }\n\n /**\n * Gets all active (established) connections\n * @returns Array of active connections\n */\n getActiveConnections(): Connection[] {\n return Array.from(this.connections.values()).filter(\n (conn) => conn.status === 'established'\n );\n }\n\n /**\n * Gets all connections needing confirmation\n * @returns Array of connections needing confirmation\n */\n getConnectionsNeedingConfirmation(): Connection[] {\n return Array.from(this.connections.values()).filter(\n (conn) =>\n conn.needsConfirmation &&\n (!this.filterPendingAccountIds.has(conn.targetAccountId) ||\n this.hasEstablishedConnectionWithAccount(conn.targetAccountId))\n );\n }\n\n /**\n * Gets a connection by its topic ID\n * @param connectionTopicId - The topic ID to look up\n * @returns The connection with the given topic ID, or undefined if not found\n */\n getConnectionByTopicId(connectionTopicId: string): Connection | undefined {\n return this.connections.get(connectionTopicId);\n }\n\n /**\n * Gets a connection by request ID\n * @param requestId - The request ID to look up\n * @returns The connection with the given request ID, or undefined if not found\n */\n getConnection(requestId: number, inboundTopicId: string): Connection | undefined {\n return Array.from(this.connections.values()).find(\n (conn) =>\n conn.connectionRequestId === requestId ||\n conn.inboundRequestId === requestId\n );\n }\n\n /**\n * Gets a connection by account ID\n * @param accountId - The account ID to look up\n * @returns The connection with the given account ID, or undefined if not found\n */\n getConnectionByAccountId(accountId: string): Connection | undefined {\n return Array.from(this.connections.values()).find(\n (conn) =>\n conn.targetAccountId === accountId && conn.status === 'established'\n );\n }\n\n /**\n * Gets all connections for a specific account ID\n * @param accountId - The account ID to look up\n * @returns Array of connections for the given account ID\n */\n getConnectionsByAccountId(accountId: string): Connection[] {\n return Array.from(this.connections.values()).filter(\n (conn) => conn.targetAccountId === accountId\n );\n }\n\n /**\n * Updates or adds a connection\n * @param connection - The connection to update or add\n */\n updateOrAddConnection(connection: Connection): void {\n this.connections.set(connection.connectionTopicId, connection);\n }\n\n /**\n * Clears all tracked connections and requests\n */\n clearAll(): void {\n this.connections.clear();\n this.pendingRequests.clear();\n }\n}\n"],"names":[],"mappings":";AAyDO,MAAM,mBAAmB;AAAA;AAAA;AAAA;AAAA,EAW9B,YAAY,SAAoC;AATxC,SAAA,kCAA2C,IAAI;AAC/C,SAAA,sCAAsD,IAAI;AAC1D,SAAA,mCAAgD,IAAI;AACpD,SAAA,8CAA2C,IAAI;AAOrD,UAAM,gBAA+B;AAAA,MACnC,QAAQ;AAAA,MACR,OAAO,SAAS,YAAY;AAAA,MAC5B,aAAa;AAAA,IACf;AACK,SAAA,SAAS,IAAI,OAAO,aAAa;AAEtC,QAAI,SAAS,yBAAyB;AACpC,WAAK,0BAA0B,IAAI,IAAI,QAAQ,uBAAuB;AAAA,IAAA;AAGpE,QAAA,CAAC,QAAQ,YAAY;AACjB,YAAA,IAAI,MAAM,qDAAqD;AAAA,IAAA;AAGvE,SAAK,aAAa,QAAQ;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQ5B,MAAM,oBAAoB,WAA0C;AAC9D,QAAA;AACI,YAAA,YAAY,MAAM,KAAK,WAAW;AAAA,QACtC;AAAA,MACF;AAEA,YAAM,CAAC,wBAAwB,qBAAqB,IAAI,MAAM,QAAQ;AAAA,QACpE;AAAA,UACE,KAAK,WAAW,YAAY,UAAU,aAAa;AAAA,UACnD,KAAK,WAAW,YAAY,UAAU,YAAY;AAAA,QAAA;AAAA,MAEtD;AAEK,WAAA;AAAA,QACH,uBAAuB,YAAY,CAAC;AAAA,QACpC;AAAA,MACF;AACK,WAAA;AAAA,QACH,sBAAsB,YAAY,CAAC;AAAA,QACnC;AAAA,MACF;AAEA,YAAM,KAAK,yCAAyC;AAC9C,YAAA,KAAK,4BAA4B,SAAS;AAChD,YAAM,KAAK,wBAAwB;AAEnC,aAAO,KAAK,kBAAkB;AAAA,aACvB,OAAO;AACT,WAAA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gB,MAAM;AAAA,EAAA;AAE/B;"}
|
|
@@ -1,35 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const charMap = {
|
|
4
|
-
"!": "%21",
|
|
5
|
-
"'": "%27",
|
|
6
|
-
"(": "%28",
|
|
7
|
-
")": "%29",
|
|
8
|
-
"~": "%7E",
|
|
9
|
-
"%20": "+",
|
|
10
|
-
"%00": "\0"
|
|
11
|
-
};
|
|
12
|
-
return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
|
|
13
|
-
return charMap[match];
|
|
14
|
-
});
|
|
1
|
+
function isAbsoluteURL(url) {
|
|
2
|
+
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
|
|
15
3
|
}
|
|
16
|
-
function AxiosURLSearchParams(params, options) {
|
|
17
|
-
this._pairs = [];
|
|
18
|
-
params && toFormData(params, this, options);
|
|
19
|
-
}
|
|
20
|
-
const prototype = AxiosURLSearchParams.prototype;
|
|
21
|
-
prototype.append = function append(name, value) {
|
|
22
|
-
this._pairs.push([name, value]);
|
|
23
|
-
};
|
|
24
|
-
prototype.toString = function toString(encoder) {
|
|
25
|
-
const _encode = encoder ? function(value) {
|
|
26
|
-
return encoder.call(this, value, encode);
|
|
27
|
-
} : encode;
|
|
28
|
-
return this._pairs.map(function each(pair) {
|
|
29
|
-
return _encode(pair[0]) + "=" + _encode(pair[1]);
|
|
30
|
-
}, "").join("&");
|
|
31
|
-
};
|
|
32
4
|
export {
|
|
33
|
-
|
|
5
|
+
isAbsoluteURL as default
|
|
34
6
|
};
|
|
35
7
|
//# sourceMappingURL=standards-sdk.es100.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standards-sdk.es100.js","sources":["../../node_modules/axios/lib/helpers/
|
|
1
|
+
{"version":3,"file":"standards-sdk.es100.js","sources":["../../node_modules/axios/lib/helpers/isAbsoluteURL.js"],"sourcesContent":["'use strict';\n\n/**\n * Determines whether the specified URL is absolute\n *\n * @param {string} url The URL to test\n *\n * @returns {boolean} True if the specified URL is absolute, otherwise false\n */\nexport default function isAbsoluteURL(url) {\n // A URL is considered absolute if it begins with \"<scheme>://\" or \"//\" (protocol-relative URL).\n // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed\n // by any combination of letters, digits, plus, period, or hyphen.\n return /^([a-z][a-z\\d+\\-.]*:)?\\/\\//i.test(url);\n}\n"],"names":[],"mappings":"AASe,SAAS,cAAc,KAAK;AAIzC,SAAO,8BAA8B,KAAK,GAAG;AAC/C;","x_google_ignoreList":[0]}
|
|
@@ -1,18 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import AxiosHeaders from "./standards-sdk.es73.js";
|
|
4
|
-
function transformData(fns, response) {
|
|
5
|
-
const config = this || defaults;
|
|
6
|
-
const context = response || config;
|
|
7
|
-
const headers = AxiosHeaders.from(context.headers);
|
|
8
|
-
let data = context.data;
|
|
9
|
-
utils.forEach(fns, function transform(fn) {
|
|
10
|
-
data = fn.call(config, data, headers.normalize(), response ? response.status : void 0);
|
|
11
|
-
});
|
|
12
|
-
headers.normalize();
|
|
13
|
-
return data;
|
|
1
|
+
function combineURLs(baseURL, relativeURL) {
|
|
2
|
+
return relativeURL ? baseURL.replace(/\/?\/$/, "") + "/" + relativeURL.replace(/^\/+/, "") : baseURL;
|
|
14
3
|
}
|
|
15
4
|
export {
|
|
16
|
-
|
|
5
|
+
combineURLs as default
|
|
17
6
|
};
|
|
18
7
|
//# sourceMappingURL=standards-sdk.es101.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standards-sdk.es101.js","sources":["../../node_modules/axios/lib/
|
|
1
|
+
{"version":3,"file":"standards-sdk.es101.js","sources":["../../node_modules/axios/lib/helpers/combineURLs.js"],"sourcesContent":["'use strict';\n\n/**\n * Creates a new URL by combining the specified URLs\n *\n * @param {string} baseURL The base URL\n * @param {string} relativeURL The relative URL\n *\n * @returns {string} The combined URL\n */\nexport default function combineURLs(baseURL, relativeURL) {\n return relativeURL\n ? baseURL.replace(/\\/?\\/$/, '') + '/' + relativeURL.replace(/^\\/+/, '')\n : baseURL;\n}\n"],"names":[],"mappings":"AAUe,SAAS,YAAY,SAAS,aAAa;AACxD,SAAO,cACH,QAAQ,QAAQ,UAAU,EAAE,IAAI,MAAM,YAAY,QAAQ,QAAQ,EAAE,IACpE;AACN;","x_google_ignoreList":[0]}
|
|
@@ -1,7 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import URLSearchParams from "./standards-sdk.es115.js";
|
|
2
|
+
import FormData from "./standards-sdk.es116.js";
|
|
3
|
+
import Blob from "./standards-sdk.es117.js";
|
|
4
|
+
const platform = {
|
|
5
|
+
isBrowser: true,
|
|
6
|
+
classes: {
|
|
7
|
+
URLSearchParams,
|
|
8
|
+
FormData,
|
|
9
|
+
Blob
|
|
10
|
+
},
|
|
11
|
+
protocols: ["http", "https", "file", "blob", "url", "data"]
|
|
12
|
+
};
|
|
4
13
|
export {
|
|
5
|
-
|
|
14
|
+
platform as default
|
|
6
15
|
};
|
|
7
16
|
//# sourceMappingURL=standards-sdk.es102.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standards-sdk.es102.js","sources":["../../node_modules/axios/lib/
|
|
1
|
+
{"version":3,"file":"standards-sdk.es102.js","sources":["../../node_modules/axios/lib/platform/browser/index.js"],"sourcesContent":["import URLSearchParams from './classes/URLSearchParams.js'\nimport FormData from './classes/FormData.js'\nimport Blob from './classes/Blob.js'\n\nexport default {\n isBrowser: true,\n classes: {\n URLSearchParams,\n FormData,\n Blob\n },\n protocols: ['http', 'https', 'file', 'blob', 'url', 'data']\n};\n"],"names":[],"mappings":";;;AAIA,MAAe,WAAA;AAAA,EACb,WAAW;AAAA,EACX,SAAS;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,EACD;AAAA,EACD,WAAW,CAAC,QAAQ,SAAS,QAAQ,QAAQ,OAAO,MAAM;AAC5D;","x_google_ignoreList":[0]}
|
|
@@ -1,7 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
const hasBrowserEnv = typeof window !== "undefined" && typeof document !== "undefined";
|
|
2
|
+
const _navigator = typeof navigator === "object" && navigator || void 0;
|
|
3
|
+
const hasStandardBrowserEnv = hasBrowserEnv && (!_navigator || ["ReactNative", "NativeScript", "NS"].indexOf(_navigator.product) < 0);
|
|
4
|
+
const hasStandardBrowserWebWorkerEnv = (() => {
|
|
5
|
+
return typeof WorkerGlobalScope !== "undefined" && // eslint-disable-next-line no-undef
|
|
6
|
+
self instanceof WorkerGlobalScope && typeof self.importScripts === "function";
|
|
7
|
+
})();
|
|
8
|
+
const origin = hasBrowserEnv && window.location.href || "http://localhost";
|
|
4
9
|
export {
|
|
5
|
-
|
|
10
|
+
hasBrowserEnv,
|
|
11
|
+
hasStandardBrowserEnv,
|
|
12
|
+
hasStandardBrowserWebWorkerEnv,
|
|
13
|
+
_navigator as navigator,
|
|
14
|
+
origin
|
|
6
15
|
};
|
|
7
16
|
//# sourceMappingURL=standards-sdk.es103.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standards-sdk.es103.js","sources":["../../node_modules/axios/lib/
|
|
1
|
+
{"version":3,"file":"standards-sdk.es103.js","sources":["../../node_modules/axios/lib/platform/common/utils.js"],"sourcesContent":["const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';\n\nconst _navigator = typeof navigator === 'object' && navigator || undefined;\n\n/**\n * Determine if we're running in a standard browser environment\n *\n * This allows axios to run in a web worker, and react-native.\n * Both environments support XMLHttpRequest, but not fully standard globals.\n *\n * web workers:\n * typeof window -> undefined\n * typeof document -> undefined\n *\n * react-native:\n * navigator.product -> 'ReactNative'\n * nativescript\n * navigator.product -> 'NativeScript' or 'NS'\n *\n * @returns {boolean}\n */\nconst hasStandardBrowserEnv = hasBrowserEnv &&\n (!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);\n\n/**\n * Determine if we're running in a standard browser webWorker environment\n *\n * Although the `isStandardBrowserEnv` method indicates that\n * `allows axios to run in a web worker`, the WebWorker will still be\n * filtered out due to its judgment standard\n * `typeof window !== 'undefined' && typeof document !== 'undefined'`.\n * This leads to a problem when axios post `FormData` in webWorker\n */\nconst hasStandardBrowserWebWorkerEnv = (() => {\n return (\n typeof WorkerGlobalScope !== 'undefined' &&\n // eslint-disable-next-line no-undef\n self instanceof WorkerGlobalScope &&\n typeof self.importScripts === 'function'\n );\n})();\n\nconst origin = hasBrowserEnv && window.location.href || 'http://localhost';\n\nexport {\n hasBrowserEnv,\n hasStandardBrowserWebWorkerEnv,\n hasStandardBrowserEnv,\n _navigator as navigator,\n origin\n}\n"],"names":[],"mappings":"AAAK,MAAC,gBAAgB,OAAO,WAAW,eAAe,OAAO,aAAa;AAEtE,MAAC,aAAa,OAAO,cAAc,YAAY,aAAa;AAmB5D,MAAC,wBAAwB,kBAC3B,CAAC,cAAc,CAAC,eAAe,gBAAgB,IAAI,EAAE,QAAQ,WAAW,OAAO,IAAI;AAWjF,MAAC,kCAAkC,MAAM;AAC5C,SACE,OAAO,sBAAsB;AAAA,EAE7B,gBAAgB,qBAChB,OAAO,KAAK,kBAAkB;AAElC,GAAC;AAEI,MAAC,SAAS,iBAAiB,OAAO,SAAS,QAAQ;","x_google_ignoreList":[0]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import AxiosError from "./standards-sdk.
|
|
1
|
+
import AxiosError from "./standards-sdk.es43.js";
|
|
2
2
|
function settle(resolve, reject, response) {
|
|
3
3
|
const validateStatus = response.config.validateStatus;
|
|
4
4
|
if (!response.status || !validateStatus || validateStatus(response.status)) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import speedometer from "./standards-sdk.
|
|
2
|
-
import throttle from "./standards-sdk.
|
|
3
|
-
import utils from "./standards-sdk.
|
|
1
|
+
import speedometer from "./standards-sdk.es111.js";
|
|
2
|
+
import throttle from "./standards-sdk.es112.js";
|
|
3
|
+
import utils from "./standards-sdk.es32.js";
|
|
4
4
|
const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
|
|
5
5
|
let bytesNotified = 0;
|
|
6
6
|
const _speedometer = speedometer(50, 250);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import platform from "./standards-sdk.
|
|
2
|
-
import utils from "./standards-sdk.
|
|
3
|
-
import isURLSameOrigin from "./standards-sdk.
|
|
4
|
-
import cookies from "./standards-sdk.
|
|
5
|
-
import buildFullPath from "./standards-sdk.
|
|
6
|
-
import mergeConfig from "./standards-sdk.
|
|
7
|
-
import AxiosHeaders from "./standards-sdk.
|
|
8
|
-
import buildURL from "./standards-sdk.
|
|
1
|
+
import platform from "./standards-sdk.es89.js";
|
|
2
|
+
import utils from "./standards-sdk.es32.js";
|
|
3
|
+
import isURLSameOrigin from "./standards-sdk.es113.js";
|
|
4
|
+
import cookies from "./standards-sdk.es114.js";
|
|
5
|
+
import buildFullPath from "./standards-sdk.es85.js";
|
|
6
|
+
import mergeConfig from "./standards-sdk.es35.js";
|
|
7
|
+
import AxiosHeaders from "./standards-sdk.es46.js";
|
|
8
|
+
import buildURL from "./standards-sdk.es82.js";
|
|
9
9
|
const resolveConfig = (config) => {
|
|
10
10
|
const newConfig = mergeConfig({}, config);
|
|
11
11
|
let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import CanceledError from "./standards-sdk.
|
|
2
|
-
import AxiosError from "./standards-sdk.
|
|
3
|
-
import utils from "./standards-sdk.
|
|
1
|
+
import CanceledError from "./standards-sdk.es38.js";
|
|
2
|
+
import AxiosError from "./standards-sdk.es43.js";
|
|
3
|
+
import utils from "./standards-sdk.es32.js";
|
|
4
4
|
const composeSignals = (signals, timeout) => {
|
|
5
5
|
const { length } = signals = signals ? signals.filter(Boolean) : [];
|
|
6
6
|
if (timeout || length) {
|
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { InboundTopicType } from "./standards-sdk.es14.js";
|
|
2
|
+
import { Logger } from "./standards-sdk.es15.js";
|
|
3
|
+
class AgentBuilder {
|
|
3
4
|
constructor() {
|
|
4
|
-
this.config = {
|
|
5
|
-
version: "1.0",
|
|
6
|
-
type: 0
|
|
7
|
-
};
|
|
5
|
+
this.config = {};
|
|
8
6
|
this.logger = Logger.getInstance({
|
|
9
|
-
module: "
|
|
7
|
+
module: "AgentBuilder"
|
|
10
8
|
});
|
|
11
9
|
}
|
|
12
10
|
setName(name) {
|
|
13
|
-
this.config.
|
|
11
|
+
this.config.name = name;
|
|
14
12
|
return this;
|
|
15
13
|
}
|
|
16
14
|
setAlias(alias) {
|
|
@@ -25,24 +23,68 @@ class PersonBuilder {
|
|
|
25
23
|
* @deprecated Use setBio instead
|
|
26
24
|
*/
|
|
27
25
|
setDescription(description) {
|
|
28
|
-
|
|
26
|
+
this.config.bio = description;
|
|
27
|
+
return this;
|
|
29
28
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
29
|
+
setCapabilities(capabilities) {
|
|
30
|
+
this.config.capabilities = capabilities;
|
|
31
|
+
return this;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* @deprecated Use setType instead
|
|
35
|
+
*/
|
|
36
|
+
setAgentType(type) {
|
|
37
|
+
if (!this.config.metadata) {
|
|
38
|
+
this.config.metadata = { type };
|
|
39
|
+
} else {
|
|
40
|
+
this.config.metadata.type = type;
|
|
41
|
+
}
|
|
42
|
+
return this;
|
|
43
|
+
}
|
|
44
|
+
setType(type) {
|
|
45
|
+
if (!this.config.metadata) {
|
|
46
|
+
this.config.metadata = { type };
|
|
39
47
|
} else {
|
|
40
|
-
|
|
48
|
+
this.config.metadata.type = type;
|
|
49
|
+
}
|
|
50
|
+
return this;
|
|
51
|
+
}
|
|
52
|
+
setModel(model) {
|
|
53
|
+
if (!this.config.metadata) {
|
|
54
|
+
this.config.metadata = { type: "manual" };
|
|
55
|
+
}
|
|
56
|
+
this.config.metadata.model = model;
|
|
57
|
+
return this;
|
|
58
|
+
}
|
|
59
|
+
setCreator(creator) {
|
|
60
|
+
if (!this.config.metadata) {
|
|
61
|
+
this.config.metadata = { type: "manual" };
|
|
62
|
+
}
|
|
63
|
+
this.config.metadata.creator = creator;
|
|
64
|
+
return this;
|
|
65
|
+
}
|
|
66
|
+
addSocial(platform, handle) {
|
|
67
|
+
if (!this.config.metadata) {
|
|
68
|
+
this.config.metadata = { type: "manual" };
|
|
69
|
+
}
|
|
70
|
+
if (!this.config.metadata.socials) {
|
|
71
|
+
this.config.metadata.socials = {};
|
|
72
|
+
}
|
|
73
|
+
this.config.metadata.socials[platform] = handle;
|
|
74
|
+
return this;
|
|
75
|
+
}
|
|
76
|
+
addProperty(key, value) {
|
|
77
|
+
if (!this.config.metadata) {
|
|
78
|
+
this.config.metadata = { type: "manual" };
|
|
79
|
+
}
|
|
80
|
+
if (!this.config.metadata.properties) {
|
|
81
|
+
this.config.metadata.properties = {};
|
|
41
82
|
}
|
|
83
|
+
this.config.metadata.properties[key] = value;
|
|
42
84
|
return this;
|
|
43
85
|
}
|
|
44
|
-
|
|
45
|
-
this.config.
|
|
86
|
+
setMetadata(metadata) {
|
|
87
|
+
this.config.metadata = metadata;
|
|
46
88
|
return this;
|
|
47
89
|
}
|
|
48
90
|
setProfilePicture(pfpBuffer, pfpFileName) {
|
|
@@ -51,57 +93,60 @@ class PersonBuilder {
|
|
|
51
93
|
return this;
|
|
52
94
|
}
|
|
53
95
|
setExistingProfilePicture(pfpTopicId) {
|
|
54
|
-
this.config.
|
|
96
|
+
this.config.existingPfpTopicId = pfpTopicId;
|
|
55
97
|
return this;
|
|
56
98
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
this.config.properties = {};
|
|
60
|
-
}
|
|
61
|
-
this.config.properties[key] = value;
|
|
99
|
+
setNetwork(network) {
|
|
100
|
+
this.config.network = network;
|
|
62
101
|
return this;
|
|
63
102
|
}
|
|
64
|
-
|
|
65
|
-
this.config.
|
|
103
|
+
setInboundTopicType(inboundTopicType) {
|
|
104
|
+
this.config.inboundTopicType = inboundTopicType;
|
|
66
105
|
return this;
|
|
67
106
|
}
|
|
68
|
-
|
|
69
|
-
this.config.
|
|
107
|
+
setFeeConfig(feeConfigBuilder) {
|
|
108
|
+
this.config.feeConfig = feeConfigBuilder;
|
|
70
109
|
return this;
|
|
71
110
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
111
|
+
setConnectionFeeConfig(feeConfigBuilder) {
|
|
112
|
+
this.config.connectionFeeConfig = feeConfigBuilder;
|
|
113
|
+
return this;
|
|
114
|
+
}
|
|
115
|
+
setExistingAccount(accountId, privateKey) {
|
|
116
|
+
this.config.existingAccount = { accountId, privateKey };
|
|
117
|
+
return this;
|
|
77
118
|
}
|
|
78
119
|
build() {
|
|
79
|
-
if (!this.config.
|
|
80
|
-
throw new Error("
|
|
120
|
+
if (!this.config.name) {
|
|
121
|
+
throw new Error("Agent display name is required");
|
|
81
122
|
}
|
|
82
123
|
if (!this.config.bio) {
|
|
83
|
-
this.logger
|
|
84
|
-
}
|
|
85
|
-
if (!this.config.pfpBuffer && !this.config.
|
|
86
|
-
this.logger.warn("No profile picture provided or referenced");
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}
|
|
124
|
+
this.logger?.warn("Agent description is not set");
|
|
125
|
+
}
|
|
126
|
+
if (!this.config.pfpBuffer && !this.config.existingPfpTopicId) {
|
|
127
|
+
this.logger.warn("No profile picture provided or referenced.");
|
|
128
|
+
}
|
|
129
|
+
if (!this.config.network) {
|
|
130
|
+
throw new Error("Network is required");
|
|
131
|
+
}
|
|
132
|
+
if (!this.config.inboundTopicType) {
|
|
133
|
+
this.config.inboundTopicType = InboundTopicType.PUBLIC;
|
|
134
|
+
}
|
|
135
|
+
if (!this.config.capabilities) {
|
|
136
|
+
this.config.capabilities = [];
|
|
137
|
+
}
|
|
138
|
+
if (!this.config.metadata) {
|
|
139
|
+
this.config.metadata = { type: "manual" };
|
|
140
|
+
} else if (!this.config.metadata.type) {
|
|
141
|
+
this.config.metadata.type = "manual";
|
|
142
|
+
}
|
|
143
|
+
if (this.config.inboundTopicType === InboundTopicType.FEE_BASED && !this.config.feeConfig) {
|
|
144
|
+
throw new Error("Fee configuration is required for fee-based topics");
|
|
145
|
+
}
|
|
146
|
+
return this.config;
|
|
102
147
|
}
|
|
103
148
|
}
|
|
104
149
|
export {
|
|
105
|
-
|
|
150
|
+
AgentBuilder
|
|
106
151
|
};
|
|
107
152
|
//# sourceMappingURL=standards-sdk.es11.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standards-sdk.es11.js","sources":["../../src/hcs-11/
|
|
1
|
+
{"version":3,"file":"standards-sdk.es11.js","sources":["../../src/hcs-11/agent-builder.ts"],"sourcesContent":["import {\n InboundTopicType,\n AgentConfiguration,\n AgentMetadata,\n AIAgentCapability,\n SocialPlatform,\n} from './types';\nimport { Logger } from '../utils/logger';\nimport { FeeConfigBuilderInterface } from '../fees';\nimport { NetworkType } from '../utils/types';\n\n/**\n * AgentBuilder is a builder class for creating agent configurations.\n * It provides a fluent interface for setting various properties of the agent.\n *\n * Example usage:\n * ```typescript\n * const agentBuilder = new AgentBuilder();\n * agentBuilder.setName('My Agent');\n * agentBuilder.setDescription('This is my agent');\n * agentBuilder.setCapabilities([AIAgentCapability.CREATE_CONTENT]);\n * agentBuilder.setModel('gpt-4o');\n * agentBuilder.setCreator('John Doe');\n * agentBuilder.addSocial('twitter', 'JohnDoe');\n * agentBuilder.addProperty('key', 'value');\n * const agentConfig = agentBuilder.build();\n * ```\n *\n */\nexport class AgentBuilder {\n private config: Partial<AgentConfiguration> = {};\n private logger: Logger;\n\n constructor() {\n this.logger = Logger.getInstance({\n module: 'AgentBuilder',\n });\n }\n\n setName(name: string): this {\n this.config.name = name;\n return this;\n }\n\n setAlias(alias: string): this {\n this.config.alias = alias;\n return this;\n }\n\n setBio(bio: string): this {\n this.config.bio = bio;\n return this;\n }\n\n /**\n * @deprecated Use setBio instead\n */\n setDescription(description: string): this {\n this.config.bio = description;\n return this;\n }\n\n setCapabilities(capabilities: AIAgentCapability[]): this {\n this.config.capabilities = capabilities;\n return this;\n }\n\n /**\n * @deprecated Use setType instead\n */\n setAgentType(type: 'autonomous' | 'manual'): this {\n if (!this.config.metadata) {\n this.config.metadata = { type };\n } else {\n this.config.metadata.type = type;\n }\n return this;\n }\n\n setType(type: 'autonomous' | 'manual'): this {\n if (!this.config.metadata) {\n this.config.metadata = { type };\n } else {\n this.config.metadata.type = type;\n }\n return this;\n }\n\n setModel(model: string): this {\n if (!this.config.metadata) {\n this.config.metadata = { type: 'manual' };\n }\n this.config.metadata.model = model;\n return this;\n }\n\n setCreator(creator: string): this {\n if (!this.config.metadata) {\n this.config.metadata = { type: 'manual' };\n }\n this.config.metadata.creator = creator;\n return this;\n }\n\n addSocial(platform: SocialPlatform, handle: string): this {\n if (!this.config.metadata) {\n this.config.metadata = { type: 'manual' };\n }\n if (!this.config.metadata.socials) {\n this.config.metadata.socials = {};\n }\n this.config.metadata.socials[platform] = handle;\n return this;\n }\n\n addProperty(key: string, value: any): this {\n if (!this.config.metadata) {\n this.config.metadata = { type: 'manual' };\n }\n if (!this.config.metadata.properties) {\n this.config.metadata.properties = {};\n }\n this.config.metadata.properties[key] = value;\n return this;\n }\n\n setMetadata(metadata: AgentMetadata): this {\n this.config.metadata = metadata;\n return this;\n }\n\n setProfilePicture(pfpBuffer: Buffer, pfpFileName: string): this {\n this.config.pfpBuffer = pfpBuffer;\n this.config.pfpFileName = pfpFileName;\n return this;\n }\n\n setExistingProfilePicture(pfpTopicId: string): this {\n this.config.existingPfpTopicId = pfpTopicId;\n return this;\n }\n\n setNetwork(network: NetworkType): this {\n this.config.network = network;\n return this;\n }\n\n setInboundTopicType(inboundTopicType: InboundTopicType): this {\n this.config.inboundTopicType = inboundTopicType;\n return this;\n }\n\n setFeeConfig(feeConfigBuilder: FeeConfigBuilderInterface): this {\n this.config.feeConfig = feeConfigBuilder;\n return this;\n }\n\n setConnectionFeeConfig(feeConfigBuilder: FeeConfigBuilderInterface): this {\n this.config.connectionFeeConfig = feeConfigBuilder;\n return this;\n }\n\n setExistingAccount(accountId: string, privateKey: string): this {\n this.config.existingAccount = { accountId, privateKey };\n return this;\n }\n\n build(): AgentConfiguration {\n if (!this.config.name) {\n throw new Error('Agent display name is required');\n }\n\n if (!this.config.bio) {\n this.logger?.warn('Agent description is not set');\n }\n\n if (!this.config.pfpBuffer && !this.config.existingPfpTopicId) {\n this.logger.warn('No profile picture provided or referenced.');\n }\n\n if (!this.config.network) {\n throw new Error('Network is required');\n }\n\n if (!this.config.inboundTopicType) {\n this.config.inboundTopicType = InboundTopicType.PUBLIC;\n }\n\n if (!this.config.capabilities) {\n this.config.capabilities = [];\n }\n\n if (!this.config.metadata) {\n this.config.metadata = { type: 'manual' };\n } else if (!this.config.metadata.type) {\n this.config.metadata.type = 'manual';\n }\n\n if (\n this.config.inboundTopicType === InboundTopicType.FEE_BASED &&\n !this.config.feeConfig\n ) {\n throw new Error('Fee configuration is required for fee-based topics');\n }\n\n return this.config as AgentConfiguration;\n }\n}\n"],"names":[],"mappings":";;AA6BO,MAAM,aAAa;AAAA,EAIxB,cAAc;AAHd,SAAQ,SAAsC,CAAC;AAIxC,SAAA,SAAS,OAAO,YAAY;AAAA,MAC/B,QAAQ;AAAA,IAAA,CACT;AAAA,EAAA;AAAA,EAGH,QAAQ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O,KAAK;AACf,WAAA,QAAQ,KAAK,8BAA8B;AAAA,IAAA;AAGlD,QAAI,CAAC,KAAK,OAAO,aAAa,CAAC,KAAK,OAAO,oBAAoB;AACxD,WAAA,OAAO,KAAK,4CAA4C;AAAA,IAAA;AAG3D,QAAA,CAAC,KAAK,OAAO,SAAS;AAClB,YAAA,IAAI,MAAM,qBAAqB;AAAA,IAAA;AAGnC,QAAA,CAAC,KAAK,OAAO,kBAAkB;AAC5B,WAAA,OAAO,mBAAmB,iBAAiB;AAAA,IAAA;AAG9C,QAAA,CAAC,KAAK,OAAO,cAAc;AACxB,WAAA,OAAO,eAAe,CAAC;AAAA,IAAA;AAG1B,QAAA,CAAC,KAAK,OAAO,UAAU;AACzB,WAAK,OAAO,WAAW,EAAE,MAAM,SAAS;AAAA,IAC/B,WAAA,CAAC,KAAK,OAAO,SAAS,MAAM;AAChC,WAAA,OAAO,SAAS,OAAO;AAAA,IAAA;AAI5B,QAAA,KAAK,OAAO,qBAAqB,iBAAiB,aAClD,CAAC,KAAK,OAAO,WACb;AACM,YAAA,IAAI,MAAM,oDAAoD;AAAA,IAAA;AAGtE,WAAO,KAAK;AAAA,EAAA;AAEhB;"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
function getDefaultExportFromCjs(x) {
|
|
2
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
3
|
+
}
|
|
3
4
|
export {
|
|
4
|
-
|
|
5
|
+
getDefaultExportFromCjs
|
|
5
6
|
};
|
|
6
7
|
//# sourceMappingURL=standards-sdk.es110.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standards-sdk.es110.js","sources":[
|
|
1
|
+
{"version":3,"file":"standards-sdk.es110.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
|