@hashgraphonline/standards-agent-kit 0.2.0 → 0.2.101

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,12 +1,13 @@
1
1
  import { AIAgentCapability } from '@hashgraphonline/standards-sdk';
2
2
  import { z } from 'zod';
3
3
  import { BaseServiceBuilder } from 'hedera-agent-kit';
4
+ import { CallbackManagerForToolRun } from '@langchain/core/callbacks/manager';
4
5
  import { BaseHCS10TransactionTool } from './base-hcs10-tools';
5
6
  import { HCS10TransactionToolParams } from './hcs10-tool-params';
6
7
  declare const RegisterAgentZodSchema: z.ZodObject<{
7
8
  name: z.ZodString;
8
9
  description: z.ZodOptional<z.ZodString>;
9
- alias: z.ZodOptional<z.ZodString>;
10
+ alias: z.ZodEffects<z.ZodOptional<z.ZodString>, string, string | undefined>;
10
11
  type: z.ZodOptional<z.ZodEnum<["autonomous", "manual"]>>;
11
12
  model: z.ZodOptional<z.ZodString>;
12
13
  capabilities: z.ZodOptional<z.ZodArray<z.ZodNativeEnum<typeof AIAgentCapability>, "many">>;
@@ -51,6 +52,7 @@ declare const RegisterAgentZodSchema: z.ZodObject<{
51
52
  }>>;
52
53
  }, "strip", z.ZodTypeAny, {
53
54
  name: string;
55
+ alias: string;
54
56
  tokenFees?: {
55
57
  amount: number;
56
58
  tokenId: string;
@@ -58,7 +60,6 @@ declare const RegisterAgentZodSchema: z.ZodObject<{
58
60
  exemptAccountIds?: string[] | undefined;
59
61
  type?: "autonomous" | "manual" | undefined;
60
62
  description?: string | undefined;
61
- alias?: string | undefined;
62
63
  model?: string | undefined;
63
64
  capabilities?: AIAgentCapability[] | undefined;
64
65
  creator?: string | undefined;
@@ -112,7 +113,7 @@ export declare class RegisterAgentTool extends BaseHCS10TransactionTool<typeof R
112
113
  specificInputSchema: z.ZodObject<{
113
114
  name: z.ZodString;
114
115
  description: z.ZodOptional<z.ZodString>;
115
- alias: z.ZodOptional<z.ZodString>;
116
+ alias: z.ZodEffects<z.ZodOptional<z.ZodString>, string, string | undefined>;
116
117
  type: z.ZodOptional<z.ZodEnum<["autonomous", "manual"]>>;
117
118
  model: z.ZodOptional<z.ZodString>;
118
119
  capabilities: z.ZodOptional<z.ZodArray<z.ZodNativeEnum<typeof AIAgentCapability>, "many">>;
@@ -157,6 +158,7 @@ export declare class RegisterAgentTool extends BaseHCS10TransactionTool<typeof R
157
158
  }>>;
158
159
  }, "strip", z.ZodTypeAny, {
159
160
  name: string;
161
+ alias: string;
160
162
  tokenFees?: {
161
163
  amount: number;
162
164
  tokenId: string;
@@ -164,7 +166,6 @@ export declare class RegisterAgentTool extends BaseHCS10TransactionTool<typeof R
164
166
  exemptAccountIds?: string[] | undefined;
165
167
  type?: "autonomous" | "manual" | undefined;
166
168
  description?: string | undefined;
167
- alias?: string | undefined;
168
169
  model?: string | undefined;
169
170
  capabilities?: AIAgentCapability[] | undefined;
170
171
  creator?: string | undefined;
@@ -212,7 +213,16 @@ export declare class RegisterAgentTool extends BaseHCS10TransactionTool<typeof R
212
213
  prefix?: string | undefined;
213
214
  } | undefined;
214
215
  }>;
216
+ private specificArgs;
215
217
  constructor(params: HCS10TransactionToolParams);
216
218
  protected callBuilderMethod(builder: BaseServiceBuilder, specificArgs: z.infer<typeof RegisterAgentZodSchema>): Promise<void>;
219
+ /**
220
+ * Override _call to intercept the result and save agent to state if needed
221
+ */
222
+ protected _call(args: z.infer<ReturnType<this['schema']>>, runManager?: CallbackManagerForToolRun): Promise<string>;
223
+ /**
224
+ * Extract agent data from registration result and save to state
225
+ */
226
+ private _handleRegistrationResult;
217
227
  }
218
228
  export {};
@@ -104,6 +104,10 @@ export declare class HCS10Builder extends BaseServiceBuilder {
104
104
  * Get the network type
105
105
  */
106
106
  getNetwork(): StandardNetworkType;
107
+ /**
108
+ * Get state manager instance
109
+ */
110
+ getStateManager(): IStateManager | undefined;
107
111
  /**
108
112
  * Get account and signer information
109
113
  */
@@ -45,6 +45,12 @@ class HCS10Builder extends BaseServiceBuilder {
45
45
  getNetwork() {
46
46
  return this.network;
47
47
  }
48
+ /**
49
+ * Get state manager instance
50
+ */
51
+ getStateManager() {
52
+ return this.stateManager;
53
+ }
48
54
  /**
49
55
  * Get account and signer information
50
56
  */
@@ -185,16 +191,18 @@ class HCS10Builder extends BaseServiceBuilder {
185
191
  }
186
192
  try {
187
193
  const result = await this.standardClient.getMessages(topicId);
188
- const mappedMessages = result.messages.map((sdkMessage) => {
189
- const timestamp = sdkMessage?.created?.getTime() || 0;
190
- return {
191
- ...sdkMessage,
192
- timestamp,
193
- data: sdkMessage.data || "",
194
- sequence_number: sdkMessage.sequence_number,
195
- p: "hcs-10"
196
- };
197
- });
194
+ const mappedMessages = result.messages.map(
195
+ (sdkMessage) => {
196
+ const timestamp = sdkMessage?.created?.getTime() || 0;
197
+ return {
198
+ ...sdkMessage,
199
+ timestamp,
200
+ data: sdkMessage.data || "",
201
+ sequence_number: sdkMessage.sequence_number,
202
+ p: "hcs-10"
203
+ };
204
+ }
205
+ );
198
206
  mappedMessages.sort(
199
207
  (a, b) => a.timestamp - b.timestamp
200
208
  );
@@ -1056,13 +1064,17 @@ class HCS10Builder extends BaseServiceBuilder {
1056
1064
  try {
1057
1065
  const inboundTopicId = await this.getInboundTopicId();
1058
1066
  const messages = await this.getMessages(inboundTopicId);
1059
- const unapprovedRequests = messages.messages.filter((msg) => msg.op === "connection_request").map((msg) => ({
1067
+ const unapprovedRequests = messages.messages.filter(
1068
+ (msg) => msg.op === "connection_request"
1069
+ ).map((msg) => ({
1060
1070
  requestId: msg.sequence_number,
1061
1071
  fromAccountId: msg.operator_id?.split("@")[1] || "unknown",
1062
1072
  timestamp: msg.timestamp || new Date(msg?.created || "").getTime(),
1063
1073
  memo: msg.m || "",
1064
1074
  data: msg.data
1065
- })).filter((req) => req.fromAccountId !== "unknown");
1075
+ })).filter(
1076
+ (req) => req.fromAccountId !== "unknown"
1077
+ );
1066
1078
  this.executeResult = {
1067
1079
  success: true,
1068
1080
  transactionId: void 0,
@@ -1471,7 +1483,9 @@ ${displayContent}
1471
1483
  `;
1472
1484
  }
1473
1485
  if (profile.social && Object.keys(profile.social).length > 0) {
1474
- profileDetails += `Social: ${Object.entries(profile.social).map(([platform, handle]) => `${platform}: ${handle}`).join(", ")}
1486
+ profileDetails += `Social: ${Object.entries(profile.social).map(
1487
+ ([platform, handle]) => `${platform}: ${handle}`
1488
+ ).join(", ")}
1475
1489
  `;
1476
1490
  }
1477
1491
  if (profile.properties && Object.keys(profile.properties).length > 0) {