@hashgraphonline/standards-agent-kit 0.2.123 → 0.2.124

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hashgraphonline/standards-agent-kit",
3
- "version": "0.2.123",
3
+ "version": "0.2.124",
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/cjs/standards-agent-kit.cjs",
@@ -126,7 +126,7 @@ export class InscribeFromBufferTool extends BaseInscriberQueryTool<
126
126
  mimeType: resolvedMimeType,
127
127
  sizeBytes: buffer.length,
128
128
  },
129
- message: `Quote generated for buffer content: ${resolvedFileName} (${(buffer.length / 1024).toFixed(2)} KB)\nTotal cost: ${quote.totalCostHbar} HBAR\nQuote valid until: ${new Date(quote.validUntil).toLocaleString()}`,
129
+ message: `Quote generated for buffer content: ${resolvedFileName} (${(buffer.length / 1024).toFixed(2)} KB)\nTotal cost: ${quote.totalCostHbar} HBAR`,
130
130
  };
131
131
  } catch (error) {
132
132
  const errorMessage =
@@ -9,7 +9,12 @@ import * as path from 'path';
9
9
  * Schema for inscribing from file
10
10
  */
11
11
  const inscribeFromFileSchema = z.object({
12
- filePath: z.string().min(1, 'File path cannot be empty').describe('The file path of the content to inscribe. Must point to a valid, non-empty file.'),
12
+ filePath: z
13
+ .string()
14
+ .min(1, 'File path cannot be empty')
15
+ .describe(
16
+ 'The file path of the content to inscribe. Must point to a valid, non-empty file.'
17
+ ),
13
18
  mode: z
14
19
  .enum(['file', 'hashinal'])
15
20
  .optional()
@@ -43,7 +48,9 @@ const inscribeFromFileSchema = z.object({
43
48
  .boolean()
44
49
  .optional()
45
50
  .default(false)
46
- .describe('If true, returns a cost quote instead of executing the inscription'),
51
+ .describe(
52
+ 'If true, returns a cost quote instead of executing the inscription'
53
+ ),
47
54
  });
48
55
 
49
56
  /**
@@ -64,8 +71,10 @@ export class InscribeFromFileTool extends BaseInscriberQueryTool<
64
71
  params: z.infer<typeof inscribeFromFileSchema>,
65
72
  _runManager?: CallbackManagerForToolRun
66
73
  ): Promise<unknown> {
67
- console.log(`[DEBUG] InscribeFromFileTool.executeQuery called with: ${params.filePath}`);
68
-
74
+ console.log(
75
+ `[DEBUG] InscribeFromFileTool.executeQuery called with: ${params.filePath}`
76
+ );
77
+
69
78
  let fileContent: Buffer;
70
79
  try {
71
80
  console.log(`[DEBUG] Checking file: ${params.filePath}`);
@@ -91,7 +100,12 @@ export class InscribeFromFileTool extends BaseInscriberQueryTool<
91
100
  }
92
101
 
93
102
  if (stats.size > 100 * 1024 * 1024) {
94
- console.log(`[InscribeFromFileTool] WARNING: Large file detected (${(stats.size / (1024 * 1024)).toFixed(2)} MB)`);
103
+ console.log(
104
+ `[InscribeFromFileTool] WARNING: Large file detected (${(
105
+ stats.size /
106
+ (1024 * 1024)
107
+ ).toFixed(2)} MB)`
108
+ );
95
109
  }
96
110
 
97
111
  this.logger?.info('Reading file content...');
@@ -113,7 +127,11 @@ export class InscribeFromFileTool extends BaseInscriberQueryTool<
113
127
  const fileName = path.basename(params.filePath);
114
128
  const mimeType = this.getMimeType(fileName);
115
129
  if (mimeType.startsWith('text/') || mimeType === 'application/json') {
116
- const textContent = fileContent.toString('utf8', 0, Math.min(fileContent.length, 1000));
130
+ const textContent = fileContent.toString(
131
+ 'utf8',
132
+ 0,
133
+ Math.min(fileContent.length, 1000)
134
+ );
117
135
  if (textContent.trim() === '') {
118
136
  throw new Error(
119
137
  `File "${params.filePath}" contains only whitespace or empty content. Cannot inscribe meaningless data.`
@@ -142,7 +160,9 @@ export class InscribeFromFileTool extends BaseInscriberQueryTool<
142
160
  metadata: params.metadata,
143
161
  tags: params.tags,
144
162
  chunkSize: params.chunkSize,
145
- waitForConfirmation: params.quoteOnly ? false : (params.waitForConfirmation ?? true),
163
+ waitForConfirmation: params.quoteOnly
164
+ ? false
165
+ : params.waitForConfirmation ?? true,
146
166
  waitMaxAttempts: 10,
147
167
  waitIntervalMs: 3000,
148
168
  apiKey: params.apiKey,
@@ -165,7 +185,7 @@ export class InscribeFromFileTool extends BaseInscriberQueryTool<
165
185
  },
166
186
  options
167
187
  );
168
-
188
+
169
189
  return {
170
190
  success: true,
171
191
  quote: {
@@ -179,22 +199,31 @@ export class InscribeFromFileTool extends BaseInscriberQueryTool<
179
199
  sizeBytes: fileContent.length,
180
200
  filePath: params.filePath,
181
201
  },
182
- message: `Quote generated for file: ${fileName} (${(fileContent.length / 1024).toFixed(2)} KB)\nTotal cost: ${quote.totalCostHbar} HBAR\nQuote valid until: ${new Date(quote.validUntil).toLocaleString()}`,
202
+ message: `Quote generated for file: ${fileName} (${(
203
+ fileContent.length / 1024
204
+ ).toFixed(2)} KB)\nTotal cost: ${
205
+ quote.totalCostHbar
206
+ } HBAR`,
183
207
  };
184
208
  } catch (error) {
185
209
  const errorMessage =
186
- error instanceof Error ? error.message : 'Failed to generate inscription quote';
210
+ error instanceof Error
211
+ ? error.message
212
+ : 'Failed to generate inscription quote';
187
213
  throw new Error(`Quote generation failed: ${errorMessage}`);
188
214
  }
189
215
  }
190
216
 
191
217
  try {
192
218
  let result: unknown;
193
-
219
+
194
220
  if (params.timeoutMs) {
195
221
  const timeoutPromise = new Promise((_, reject) => {
196
222
  setTimeout(
197
- () => reject(new Error(`Inscription timed out after ${params.timeoutMs}ms`)),
223
+ () =>
224
+ reject(
225
+ new Error(`Inscription timed out after ${params.timeoutMs}ms`)
226
+ ),
198
227
  params.timeoutMs
199
228
  );
200
229
  });
@@ -225,7 +254,9 @@ export class InscribeFromFileTool extends BaseInscriberQueryTool<
225
254
 
226
255
  const inscriptionResult = result as any;
227
256
  if (inscriptionResult.confirmed && !inscriptionResult.quote) {
228
- const topicId = inscriptionResult.inscription?.topic_id || inscriptionResult.result.topicId;
257
+ const topicId =
258
+ inscriptionResult.inscription?.topic_id ||
259
+ inscriptionResult.result.topicId;
229
260
  const network = options.network || 'testnet';
230
261
  const cdnUrl = topicId
231
262
  ? `https://kiloscribe.com/api/inscription-cdn/${topicId}?network=${network}`
@@ -207,7 +207,7 @@ export class InscribeFromUrlTool extends BaseInscriberQueryTool<typeof inscribeF
207
207
  contentInfo: {
208
208
  url: params.url,
209
209
  },
210
- message: `Quote generated for URL: ${params.url}\nTotal cost: ${quote.totalCostHbar} HBAR\nQuote valid until: ${new Date(quote.validUntil).toLocaleString()}`,
210
+ message: `Quote generated for URL: ${params.url}\nTotal cost: ${quote.totalCostHbar} HBAR`,
211
211
  };
212
212
  } catch (error) {
213
213
  const errorMessage =
@@ -120,7 +120,7 @@ export class InscribeHashinalTool extends BaseInscriberQueryTool<typeof inscribe
120
120
  creator: params.creator,
121
121
  type: params.type,
122
122
  },
123
- message: `Quote generated for Hashinal NFT: ${params.name}\nCreator: ${params.creator}\nTotal cost: ${quote.totalCostHbar} HBAR\nQuote valid until: ${new Date(quote.validUntil).toLocaleString()}`,
123
+ message: `Quote generated for Hashinal NFT: ${params.name}\nCreator: ${params.creator}\nTotal cost: ${quote.totalCostHbar} HBAR`,
124
124
  };
125
125
  } catch (error) {
126
126
  const errorMessage =