@hashgraphonline/standards-agent-kit 0.0.12 → 0.0.15

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.
@@ -1,6 +1,7 @@
1
1
  import { HCS10Client } from '../hcs10/HCS10Client';
2
2
  import { StructuredTool } from '@langchain/core/tools';
3
3
  import { z } from 'zod';
4
+ import { IStateManager } from '../state/state-types';
4
5
  /**
5
6
  * RegisterAgentTool wraps the createAndRegisterAgent() function of HCS10Client.
6
7
  * It creates and registers an agent on Hedera using the HCS-10 standard SDK flow.
@@ -10,12 +11,32 @@ export declare class RegisterAgentTool extends StructuredTool {
10
11
  name: string;
11
12
  description: string;
12
13
  private client;
14
+ private stateManager?;
13
15
  schema: z.ZodObject<{
14
16
  name: z.ZodString;
15
17
  description: z.ZodOptional<z.ZodString>;
16
18
  type: z.ZodOptional<z.ZodEnum<["autonomous", "manual"]>>;
17
19
  model: z.ZodOptional<z.ZodString>;
18
20
  capabilities: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
21
+ profilePicture: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
22
+ url: z.ZodString;
23
+ filename: z.ZodString;
24
+ }, "strip", z.ZodTypeAny, {
25
+ url: string;
26
+ filename: string;
27
+ }, {
28
+ url: string;
29
+ filename: string;
30
+ }>, z.ZodObject<{
31
+ path: z.ZodString;
32
+ filename: z.ZodOptional<z.ZodString>;
33
+ }, "strip", z.ZodTypeAny, {
34
+ path: string;
35
+ filename?: string | undefined;
36
+ }, {
37
+ path: string;
38
+ filename?: string | undefined;
39
+ }>]>>;
19
40
  feeCollectorAccountId: z.ZodOptional<z.ZodString>;
20
41
  hbarFee: z.ZodOptional<z.ZodNumber>;
21
42
  tokenFee: z.ZodOptional<z.ZodObject<{
@@ -28,41 +49,140 @@ export declare class RegisterAgentTool extends StructuredTool {
28
49
  amount: number;
29
50
  tokenId: string;
30
51
  }>>;
52
+ hbarFees: z.ZodOptional<z.ZodArray<z.ZodObject<{
53
+ amount: z.ZodNumber;
54
+ collectorAccount: z.ZodOptional<z.ZodString>;
55
+ }, "strip", z.ZodTypeAny, {
56
+ amount: number;
57
+ collectorAccount?: string | undefined;
58
+ }, {
59
+ amount: number;
60
+ collectorAccount?: string | undefined;
61
+ }>, "many">>;
62
+ tokenFees: z.ZodOptional<z.ZodArray<z.ZodObject<{
63
+ amount: z.ZodNumber;
64
+ tokenId: z.ZodString;
65
+ collectorAccount: z.ZodOptional<z.ZodString>;
66
+ }, "strip", z.ZodTypeAny, {
67
+ amount: number;
68
+ tokenId: string;
69
+ collectorAccount?: string | undefined;
70
+ }, {
71
+ amount: number;
72
+ tokenId: string;
73
+ collectorAccount?: string | undefined;
74
+ }>, "many">>;
31
75
  exemptAccountIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
76
+ setAsCurrent: z.ZodOptional<z.ZodBoolean>;
77
+ persistence: z.ZodOptional<z.ZodObject<{
78
+ prefix: z.ZodOptional<z.ZodString>;
79
+ }, "strip", z.ZodTypeAny, {
80
+ prefix?: string | undefined;
81
+ }, {
82
+ prefix?: string | undefined;
83
+ }>>;
32
84
  }, "strip", z.ZodTypeAny, {
33
85
  name: string;
86
+ capabilities?: number[] | undefined;
34
87
  description?: string | undefined;
35
88
  type?: "autonomous" | "manual" | undefined;
36
89
  model?: string | undefined;
37
- capabilities?: number[] | undefined;
90
+ profilePicture?: string | {
91
+ url: string;
92
+ filename: string;
93
+ } | {
94
+ path: string;
95
+ filename?: string | undefined;
96
+ } | undefined;
38
97
  feeCollectorAccountId?: string | undefined;
39
98
  hbarFee?: number | undefined;
40
99
  tokenFee?: {
41
100
  amount: number;
42
101
  tokenId: string;
43
102
  } | undefined;
103
+ hbarFees?: {
104
+ amount: number;
105
+ collectorAccount?: string | undefined;
106
+ }[] | undefined;
107
+ tokenFees?: {
108
+ amount: number;
109
+ tokenId: string;
110
+ collectorAccount?: string | undefined;
111
+ }[] | undefined;
44
112
  exemptAccountIds?: string[] | undefined;
113
+ setAsCurrent?: boolean | undefined;
114
+ persistence?: {
115
+ prefix?: string | undefined;
116
+ } | undefined;
45
117
  }, {
46
118
  name: string;
119
+ capabilities?: number[] | undefined;
47
120
  description?: string | undefined;
48
121
  type?: "autonomous" | "manual" | undefined;
49
122
  model?: string | undefined;
50
- capabilities?: number[] | undefined;
123
+ profilePicture?: string | {
124
+ url: string;
125
+ filename: string;
126
+ } | {
127
+ path: string;
128
+ filename?: string | undefined;
129
+ } | undefined;
51
130
  feeCollectorAccountId?: string | undefined;
52
131
  hbarFee?: number | undefined;
53
132
  tokenFee?: {
54
133
  amount: number;
55
134
  tokenId: string;
56
135
  } | undefined;
136
+ hbarFees?: {
137
+ amount: number;
138
+ collectorAccount?: string | undefined;
139
+ }[] | undefined;
140
+ tokenFees?: {
141
+ amount: number;
142
+ tokenId: string;
143
+ collectorAccount?: string | undefined;
144
+ }[] | undefined;
57
145
  exemptAccountIds?: string[] | undefined;
146
+ setAsCurrent?: boolean | undefined;
147
+ persistence?: {
148
+ prefix?: string | undefined;
149
+ } | undefined;
58
150
  }>;
59
151
  /**
60
- * @param client - Instance of HCS10Client (already configured with operator/network).
152
+ * Creates a new RegisterAgentTool instance
153
+ * @param client - Instance of HCS10Client (already configured with operator/network)
154
+ * @param stateManager - Optional state manager to store agent details
61
155
  */
62
- constructor(client: HCS10Client);
156
+ constructor(client: HCS10Client, stateManager?: IStateManager);
157
+ /**
158
+ * Loads a profile picture from a local file or URL and returns a buffer
159
+ * @param profilePicture - Local file path or URL
160
+ * @returns Object containing buffer and filename
161
+ */
162
+ private loadProfilePicture;
63
163
  /**
64
164
  * Calls createAndRegisterAgent() with the provided metadata.
65
165
  * Returns a JSON string with agent details on success, or an error string.
66
166
  */
67
167
  _call(input: z.infer<typeof this.schema>): Promise<string>;
168
+ /**
169
+ * Checks if the token fee configuration is valid
170
+ */
171
+ private hasValidTokenFee;
172
+ /**
173
+ * Processes the registration result and returns formatted output
174
+ */
175
+ private processRegistrationResult;
176
+ /**
177
+ * Ensures the agent has enough HBAR for operations
178
+ */
179
+ private ensureAgentHasFunds;
180
+ /**
181
+ * Validates that all required fields are present in the registration result
182
+ */
183
+ private validateRegistrationResult;
184
+ /**
185
+ * Creates a description of the fees configured for the agent
186
+ */
187
+ private createFeeDescription;
68
188
  }
@@ -0,0 +1,34 @@
1
+ import { StructuredTool } from '@langchain/core/tools';
2
+ import { z } from 'zod';
3
+ import { HCS10Client } from '../hcs10/HCS10Client';
4
+ /**
5
+ * Tool for retrieving the HCS-11 profile associated with a Hedera account ID.
6
+ * Utilizes the HCS10Client's retrieveProfile method, which handles fetching.
7
+ */
8
+ export declare class RetrieveProfileTool extends StructuredTool {
9
+ name: string;
10
+ description: string;
11
+ private client;
12
+ private logger;
13
+ schema: z.ZodObject<{
14
+ accountId: z.ZodOptional<z.ZodString>;
15
+ disableCache: z.ZodOptional<z.ZodBoolean>;
16
+ }, "strip", z.ZodTypeAny, {
17
+ accountId?: string | undefined;
18
+ disableCache?: boolean | undefined;
19
+ }, {
20
+ accountId?: string | undefined;
21
+ disableCache?: boolean | undefined;
22
+ }>;
23
+ /**
24
+ * Creates a new RetrieveProfileTool instance.
25
+ * @param client - An instance of HCS10Client.
26
+ */
27
+ constructor(client: HCS10Client);
28
+ /**
29
+ * Executes the profile retrieval.
30
+ * @param input - The input object containing accountId and optional disableCache flag.
31
+ * @returns A JSON string of the profile on success, or an error message string.
32
+ */
33
+ _call(input: z.infer<typeof this.schema>): Promise<string>;
34
+ }
@@ -1,7 +1,7 @@
1
1
  import { StructuredTool, ToolParams } from '@langchain/core/tools';
2
2
  import { z } from 'zod';
3
3
  import { HCS10Client } from '../hcs10/HCS10Client';
4
- import { IStateManager } from '../state/open-convai-state';
4
+ import { IStateManager } from '../state/state-types';
5
5
  export interface SendMessageToConnectionToolParams extends ToolParams {
6
6
  hcsClient: HCS10Client;
7
7
  stateManager: IStateManager;
@@ -0,0 +1,15 @@
1
+ import { HCS10Client } from '../hcs10/HCS10Client';
2
+ import { HCSMessage, HCS11Profile } from '@hashgraphonline/standards-sdk';
3
+ export interface ConnectionMap {
4
+ inboundRequests: Map<number, HCSMessage>;
5
+ outboundConfirmations: Map<number, HCSMessage>;
6
+ outboundRequests: Map<number, HCSMessage>;
7
+ inboundConfirmations: Map<number, HCSMessage>;
8
+ profileMap: Map<string, HCS11Profile>;
9
+ confirmedRequestIds: Set<number>;
10
+ }
11
+ /**
12
+ * Fetches and processes inbound/outbound messages and profiles
13
+ * to provide a map of connection states.
14
+ */
15
+ export declare function fetchConnectionMap(hcsClient: HCS10Client): Promise<ConnectionMap>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hashgraphonline/standards-agent-kit",
3
- "version": "0.0.12",
3
+ "version": "0.0.15",
4
4
  "description": "A modular SDK for building on-chain autonomous agents using Hashgraph Online Standards, including HCS-10 for agent discovery and communication.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.es.js",
@@ -68,7 +68,7 @@
68
68
  },
69
69
  "dependencies": {
70
70
  "@hashgraph/sdk": "^2.62.0",
71
- "@hashgraphonline/standards-sdk": "0.0.70",
71
+ "@hashgraphonline/standards-sdk": "0.0.73",
72
72
  "@langchain/community": "^0.3.37",
73
73
  "@langchain/openai": "^0.5.1",
74
74
  "dotenv": "^16.4.1",