@hashgraphonline/standards-agent-kit 0.2.110 → 0.2.112

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.
@@ -0,0 +1,47 @@
1
+ import { BaseServiceBuilder, HederaAgentKit } from 'hedera-agent-kit';
2
+ import { HCS6Client, HCS6CreateRegistryOptions, HCS6RegisterEntryOptions, HCS6QueryRegistryOptions, HCS6RegisterOptions, HCS6CreateHashinalOptions, HCS6TopicRegistrationResponse, HCS6RegistryOperationResponse, HCS6TopicRegistry, HCS6CreateHashinalResponse } from '@hashgraphonline/standards-sdk';
3
+ /**
4
+ * Builder for HCS-6 operations that delegates to HCS6Client
5
+ */
6
+ export declare class HCS6Builder extends BaseServiceBuilder {
7
+ protected hcs6Client?: HCS6Client;
8
+ constructor(hederaKit: HederaAgentKit);
9
+ /**
10
+ * Get or create HCS-6 client
11
+ */
12
+ protected getHCS6Client(): Promise<HCS6Client>;
13
+ /**
14
+ * Create a new HCS-6 dynamic registry
15
+ * Note: This executes the transaction directly via HCS6Client
16
+ */
17
+ createRegistry(options?: HCS6CreateRegistryOptions): Promise<HCS6TopicRegistrationResponse>;
18
+ /**
19
+ * Register a new dynamic hashinal entry in an HCS-6 registry
20
+ */
21
+ registerEntry(registryTopicId: string, options: HCS6RegisterEntryOptions): Promise<HCS6RegistryOperationResponse>;
22
+ /**
23
+ * Query entries from an HCS-6 registry
24
+ */
25
+ getRegistry(topicId: string, options?: HCS6QueryRegistryOptions): Promise<HCS6TopicRegistry>;
26
+ /**
27
+ * Create a complete dynamic hashinal with inscription and registry
28
+ */
29
+ createHashinal(options: HCS6CreateHashinalOptions): Promise<HCS6CreateHashinalResponse>;
30
+ /**
31
+ * Register a dynamic hashinal with combined inscription and registry creation
32
+ * This is the main method for creating and updating dynamic hashinals
33
+ */
34
+ register(options: HCS6RegisterOptions): Promise<HCS6CreateHashinalResponse>;
35
+ /**
36
+ * Submit a raw message to an HCS-6 topic
37
+ */
38
+ submitMessage(topicId: string, payload: any): Promise<any>;
39
+ /**
40
+ * Get topic info from mirror node
41
+ */
42
+ getTopicInfo(topicId: string): Promise<any>;
43
+ /**
44
+ * Close the HCS-6 client
45
+ */
46
+ close(): Promise<void>;
47
+ }
@@ -0,0 +1 @@
1
+ export * from './hcs6-builder';
@@ -1,4 +1,5 @@
1
1
  export * from './types';
2
2
  export * from './hcs10/hcs10-builder';
3
3
  export * from './hcs2/hcs2-builder';
4
+ export * from './hcs6/hcs6-builder';
4
5
  export * from './inscriber/inscriber-builder';
@@ -13,7 +13,7 @@ class InscribeFromUrlTool extends BaseInscriberQueryTool {
13
13
  constructor() {
14
14
  super(...arguments);
15
15
  this.name = "inscribeFromUrl";
16
- this.description = "Inscribe content from a URL to the Hedera network. IMPORTANT: Only use this tool when you have a valid URL pointing to actual content. The URL must be accessible and return meaningful data. The tool will validate that the content exists and is not empty before inscription.";
16
+ this.description = "Inscribe content directly from a URL that points to a downloadable file (PDF, image, JSON, etc). DO NOT use this for web pages like Wikipedia, Twitter, or GitHub pages. This tool is ONLY for direct file URLs like https://example.com/document.pdf or https://api.example.com/data.json. For content you already have (from Wikipedia, MCP tools, or text), use inscribeFromBuffer instead.";
17
17
  }
18
18
  get specificInputSchema() {
19
19
  return inscribeFromUrlSchema;
@@ -1 +1 @@
1
- {"version":3,"file":"standards-agent-kit.es27.js","sources":["../../src/tools/inscriber/InscribeFromUrlTool.ts"],"sourcesContent":["import { z } from 'zod';\nimport { BaseInscriberQueryTool } from './base-inscriber-tools';\nimport { InscriptionOptions } from '@hashgraphonline/standards-sdk';\nimport { CallbackManagerForToolRun } from '@langchain/core/callbacks/manager';\n\n/**\n * Schema for inscribing from URL\n */\nconst inscribeFromUrlSchema = z.object({\n url: z.string().url().describe('The URL of the content to inscribe'),\n mode: z\n .enum(['file', 'hashinal'])\n .optional()\n .describe('Inscription mode: file or hashinal NFT'),\n metadata: z\n .record(z.unknown())\n .optional()\n .describe('Metadata to attach to the inscription'),\n tags: z\n .array(z.string())\n .optional()\n .describe('Tags to categorize the inscription'),\n chunkSize: z\n .number()\n .int()\n .positive()\n .optional()\n .describe('Chunk size for large files'),\n waitForConfirmation: z\n .boolean()\n .optional()\n .describe('Whether to wait for inscription confirmation'),\n apiKey: z\n .string()\n .optional()\n .describe('API key for inscription service'),\n});\n\n\n/**\n * Tool for inscribing content from URL\n */\nexport class InscribeFromUrlTool extends BaseInscriberQueryTool<typeof inscribeFromUrlSchema> {\n name = 'inscribeFromUrl';\n description = 'Inscribe content from a URL to the Hedera network. IMPORTANT: Only use this tool when you have a valid URL pointing to actual content. The URL must be accessible and return meaningful data. The tool will validate that the content exists and is not empty before inscription.';\n\n get specificInputSchema() {\n return inscribeFromUrlSchema;\n }\n\n protected async executeQuery(\n params: z.infer<typeof inscribeFromUrlSchema>,\n _runManager?: CallbackManagerForToolRun\n ): Promise<unknown> {\n console.log(`[DEBUG] InscribeFromUrlTool.executeQuery called with URL: ${params.url}`);\n \n if (!params.url || params.url.trim() === '') {\n throw new Error('URL cannot be empty. Please provide a valid URL.');\n }\n\n try {\n const urlObj = new URL(params.url);\n if (!urlObj.protocol || !urlObj.host) {\n throw new Error('Invalid URL format. Please provide a complete URL with protocol (http/https).');\n }\n if (!['http:', 'https:'].includes(urlObj.protocol)) {\n throw new Error('Only HTTP and HTTPS URLs are supported for inscription.');\n }\n } catch (error) {\n throw new Error(`Invalid URL: ${params.url}. Please provide a valid URL.`);\n }\n\n console.log(`[InscribeFromUrlTool] Validating URL content before inscription...`);\n try {\n const controller = new AbortController();\n const timeoutId = setTimeout(() => controller.abort(), 10000);\n \n try {\n const response = await fetch(params.url, {\n method: 'HEAD',\n signal: controller.signal,\n });\n \n clearTimeout(timeoutId);\n \n if (!response.ok) {\n throw new Error(`URL returned error status ${response.status}: ${response.statusText}. Cannot inscribe content from inaccessible URLs.`);\n }\n\n const contentLength = response.headers.get('content-length');\n if (contentLength && parseInt(contentLength) === 0) {\n throw new Error('URL returns empty content (Content-Length: 0). Cannot inscribe empty content.');\n }\n\n if (contentLength && parseInt(contentLength) < 10) {\n throw new Error(`URL content is too small (${contentLength} bytes). Content must be at least 10 bytes.`);\n }\n\n const contentType = response.headers.get('content-type');\n console.log(`[InscribeFromUrlTool] URL validation passed. Content-Type: ${contentType}, Content-Length: ${contentLength || 'unknown'}`);\n } catch (fetchError) {\n clearTimeout(timeoutId);\n throw fetchError;\n }\n } catch (error) {\n if (error instanceof Error) {\n if (error.name === 'AbortError') {\n console.log(`[InscribeFromUrlTool] Warning: URL validation timed out after 10 seconds. Proceeding with inscription attempt.`);\n } else if (error.message.includes('URL returned error') || error.message.includes('empty content') || error.message.includes('too small')) {\n throw error;\n } else {\n console.log(`[InscribeFromUrlTool] Warning: Could not validate URL with HEAD request: ${error.message}. Proceeding with inscription attempt.`);\n }\n }\n }\n\n const options: InscriptionOptions = {\n mode: params.mode,\n metadata: params.metadata,\n tags: params.tags,\n chunkSize: params.chunkSize,\n waitForConfirmation: params.waitForConfirmation ?? true,\n waitMaxAttempts: 10,\n waitIntervalMs: 3000,\n apiKey: params.apiKey,\n network: this.inscriberBuilder['hederaKit'].client.network.toString().includes('mainnet') ? 'mainnet' : 'testnet',\n };\n\n try {\n const timeoutPromise = new Promise((_, reject) => {\n setTimeout(() => reject(new Error('Inscription timed out after 30 seconds')), 30000);\n });\n\n const result = await Promise.race([\n this.inscriberBuilder.inscribe(\n { type: 'url', url: params.url },\n options\n ),\n timeoutPromise\n ]) as any;\n\n if (result.confirmed) {\n const topicId = result.inscription?.topic_id || result.result.topicId;\n const network = options.network || 'testnet';\n const cdnUrl = topicId ? `https://kiloscribe.com/api/inscription-cdn/${topicId}?network=${network}` : null;\n return `Successfully inscribed and confirmed content on the Hedera network!\\n\\nTransaction ID: ${result.result.transactionId}\\nTopic ID: ${topicId || 'N/A'}${cdnUrl ? `\\nView inscription: ${cdnUrl}` : ''}\\n\\nThe inscription is now available.`;\n } else {\n return `Successfully submitted inscription to the Hedera network!\\n\\nTransaction ID: ${result.result.transactionId}\\n\\nThe inscription is processing and will be confirmed shortly.`;\n }\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : 'Failed to inscribe from URL';\n throw new Error(`Inscription failed: ${errorMessage}`);\n }\n }\n}"],"names":[],"mappings":";;AAQA,MAAM,wBAAwB,EAAE,OAAO;AAAA,EACrC,KAAK,EAAE,OAAA,EAAS,IAAA,EAAM,SAAS,oCAAoC;AAAA,EACnE,MAAM,EACH,KAAK,CAAC,QAAQ,UAAU,CAAC,EACzB,SAAA,EACA,SAAS,wCAAwC;AAAA,EACpD,UAAU,EACP,OAAO,EAAE,QAAA,CAAS,EAClB,SAAA,EACA,SAAS,uCAAuC;AAAA,EACnD,MAAM,EACH,MAAM,EAAE,OAAA,CAAQ,EAChB,SAAA,EACA,SAAS,oCAAoC;AAAA,EAChD,WAAW,EACR,OAAA,EACA,IAAA,EACA,SAAA,EACA,SAAA,EACA,SAAS,4BAA4B;AAAA,EACxC,qBAAqB,EAClB,QAAA,EACA,SAAA,EACA,SAAS,8CAA8C;AAAA,EAC1D,QAAQ,EACL,OAAA,EACA,SAAA,EACA,SAAS,iCAAiC;AAC/C,CAAC;AAMM,MAAM,4BAA4B,uBAAqD;AAAA,EAAvF,cAAA;AAAA,UAAA,GAAA,SAAA;AACL,SAAA,OAAO;AACP,SAAA,cAAc;AAAA,EAAA;AAAA,EAEd,IAAI,sBAAsB;AACxB,WAAO;AAAA,EACT;AAAA,EAEA,MAAgB,aACd,QACA,aACkB;AAClB,YAAQ,IAAI,6DAA6D,OAAO,GAAG,EAAE;AAErF,QAAI,CAAC,OAAO,OAAO,OAAO,IAAI,KAAA,MAAW,IAAI;AAC3C,YAAM,IAAI,MAAM,kDAAkD;AAAA,IACpE;AAEA,QAAI;AACF,YAAM,SAAS,IAAI,IAAI,OAAO,GAAG;AACjC,UAAI,CAAC,OAAO,YAAY,CAAC,OAAO,MAAM;AACpC,cAAM,IAAI,MAAM,+EAA+E;AAAA,MACjG;AACA,UAAI,CAAC,CAA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 {"version":3,"file":"standards-agent-kit.es27.js","sources":["../../src/tools/inscriber/InscribeFromUrlTool.ts"],"sourcesContent":["import { z } from 'zod';\nimport { BaseInscriberQueryTool } from './base-inscriber-tools';\nimport { InscriptionOptions } from '@hashgraphonline/standards-sdk';\nimport { CallbackManagerForToolRun } from '@langchain/core/callbacks/manager';\n\n/**\n * Schema for inscribing from URL\n */\nconst inscribeFromUrlSchema = z.object({\n url: z.string().url().describe('The URL of the content to inscribe'),\n mode: z\n .enum(['file', 'hashinal'])\n .optional()\n .describe('Inscription mode: file or hashinal NFT'),\n metadata: z\n .record(z.unknown())\n .optional()\n .describe('Metadata to attach to the inscription'),\n tags: z\n .array(z.string())\n .optional()\n .describe('Tags to categorize the inscription'),\n chunkSize: z\n .number()\n .int()\n .positive()\n .optional()\n .describe('Chunk size for large files'),\n waitForConfirmation: z\n .boolean()\n .optional()\n .describe('Whether to wait for inscription confirmation'),\n apiKey: z\n .string()\n .optional()\n .describe('API key for inscription service'),\n});\n\n\n/**\n * Tool for inscribing content from URL\n */\nexport class InscribeFromUrlTool extends BaseInscriberQueryTool<typeof inscribeFromUrlSchema> {\n name = 'inscribeFromUrl';\n description = 'Inscribe content directly from a URL that points to a downloadable file (PDF, image, JSON, etc). DO NOT use this for web pages like Wikipedia, Twitter, or GitHub pages. This tool is ONLY for direct file URLs like https://example.com/document.pdf or https://api.example.com/data.json. For content you already have (from Wikipedia, MCP tools, or text), use inscribeFromBuffer instead.';\n\n get specificInputSchema() {\n return inscribeFromUrlSchema;\n }\n\n protected async executeQuery(\n params: z.infer<typeof inscribeFromUrlSchema>,\n _runManager?: CallbackManagerForToolRun\n ): Promise<unknown> {\n console.log(`[DEBUG] InscribeFromUrlTool.executeQuery called with URL: ${params.url}`);\n \n if (!params.url || params.url.trim() === '') {\n throw new Error('URL cannot be empty. Please provide a valid URL.');\n }\n\n try {\n const urlObj = new URL(params.url);\n if (!urlObj.protocol || !urlObj.host) {\n throw new Error('Invalid URL format. Please provide a complete URL with protocol (http/https).');\n }\n if (!['http:', 'https:'].includes(urlObj.protocol)) {\n throw new Error('Only HTTP and HTTPS URLs are supported for inscription.');\n }\n } catch (error) {\n throw new Error(`Invalid URL: ${params.url}. Please provide a valid URL.`);\n }\n\n console.log(`[InscribeFromUrlTool] Validating URL content before inscription...`);\n try {\n const controller = new AbortController();\n const timeoutId = setTimeout(() => controller.abort(), 10000);\n \n try {\n const response = await fetch(params.url, {\n method: 'HEAD',\n signal: controller.signal,\n });\n \n clearTimeout(timeoutId);\n \n if (!response.ok) {\n throw new Error(`URL returned error status ${response.status}: ${response.statusText}. Cannot inscribe content from inaccessible URLs.`);\n }\n\n const contentLength = response.headers.get('content-length');\n if (contentLength && parseInt(contentLength) === 0) {\n throw new Error('URL returns empty content (Content-Length: 0). Cannot inscribe empty content.');\n }\n\n if (contentLength && parseInt(contentLength) < 10) {\n throw new Error(`URL content is too small (${contentLength} bytes). Content must be at least 10 bytes.`);\n }\n\n const contentType = response.headers.get('content-type');\n console.log(`[InscribeFromUrlTool] URL validation passed. Content-Type: ${contentType}, Content-Length: ${contentLength || 'unknown'}`);\n } catch (fetchError) {\n clearTimeout(timeoutId);\n throw fetchError;\n }\n } catch (error) {\n if (error instanceof Error) {\n if (error.name === 'AbortError') {\n console.log(`[InscribeFromUrlTool] Warning: URL validation timed out after 10 seconds. Proceeding with inscription attempt.`);\n } else if (error.message.includes('URL returned error') || error.message.includes('empty content') || error.message.includes('too small')) {\n throw error;\n } else {\n console.log(`[InscribeFromUrlTool] Warning: Could not validate URL with HEAD request: ${error.message}. Proceeding with inscription attempt.`);\n }\n }\n }\n\n const options: InscriptionOptions = {\n mode: params.mode,\n metadata: params.metadata,\n tags: params.tags,\n chunkSize: params.chunkSize,\n waitForConfirmation: params.waitForConfirmation ?? true,\n waitMaxAttempts: 10,\n waitIntervalMs: 3000,\n apiKey: params.apiKey,\n network: this.inscriberBuilder['hederaKit'].client.network.toString().includes('mainnet') ? 'mainnet' : 'testnet',\n };\n\n try {\n const timeoutPromise = new Promise((_, reject) => {\n setTimeout(() => reject(new Error('Inscription timed out after 30 seconds')), 30000);\n });\n\n const result = await Promise.race([\n this.inscriberBuilder.inscribe(\n { type: 'url', url: params.url },\n options\n ),\n timeoutPromise\n ]) as any;\n\n if (result.confirmed) {\n const topicId = result.inscription?.topic_id || result.result.topicId;\n const network = options.network || 'testnet';\n const cdnUrl = topicId ? `https://kiloscribe.com/api/inscription-cdn/${topicId}?network=${network}` : null;\n return `Successfully inscribed and confirmed content on the Hedera network!\\n\\nTransaction ID: ${result.result.transactionId}\\nTopic ID: ${topicId || 'N/A'}${cdnUrl ? `\\nView inscription: ${cdnUrl}` : ''}\\n\\nThe inscription is now available.`;\n } else {\n return `Successfully submitted inscription to the Hedera network!\\n\\nTransaction ID: ${result.result.transactionId}\\n\\nThe inscription is processing and will be confirmed shortly.`;\n }\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : 'Failed to inscribe from URL';\n throw new Error(`Inscription failed: ${errorMessage}`);\n }\n }\n}"],"names":[],"mappings":";;AAQA,MAAM,wBAAwB,EAAE,OAAO;AAAA,EACrC,KAAK,EAAE,OAAA,EAAS,IAAA,EAAM,SAAS,oCAAoC;AAAA,EACnE,MAAM,EACH,KAAK,CAAC,QAAQ,UAAU,CAAC,EACzB,SAAA,EACA,SAAS,wCAAwC;AAAA,EACpD,UAAU,EACP,OAAO,EAAE,QAAA,CAAS,EAClB,SAAA,EACA,SAAS,uCAAuC;AAAA,EACnD,MAAM,EACH,MAAM,EAAE,OAAA,CAAQ,EAChB,SAAA,EACA,SAAS,oCAAoC;AAAA,EAChD,WAAW,EACR,OAAA,EACA,IAAA,EACA,SAAA,EACA,SAAA,EACA,SAAS,4BAA4B;AAAA,EACxC,qBAAqB,EAClB,QAAA,EACA,SAAA,EACA,SAAS,8CAA8C;AAAA,EAC1D,QAAQ,EACL,OAAA,EACA,SAAA,EACA,SAAS,iCAAiC;AAC/C,CAAC;AAMM,MAAM,4BAA4B,uBAAqD;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OAAO,aAAa,YAAY,OAAO,OAAO;AAC9D,cAAM,UAAU,QAAQ,WAAW;AACnC,cAAM,SAAS,UAAU,8CAA8C,OAAO,YAAY,OAAO,KAAK;AACtG,eAAO;AAAA;AAAA,kBAA0F,OAAO,OAAO,aAAa;AAAA,YAAe,WAAW,KAAK,GAAG,SAAS;AAAA,oBAAuB,MAAM,KAAK,EAAE;AAAA;AAAA;AAAA,MAC7M,OAAO;AACL,eAAO;AAAA;AAAA,kBAAgF,OAAO,OAAO,aAAa;AAAA;AAAA;AAAA,MACpH;AAAA,IACF,SAAS,OAAO;AACd,YAAM,eAAe,iBAAiB,QAAQ,MAAM,UAAU;AAC9D,YAAM,IAAI,MAAM,uBAAuB,YAAY,EAAE;AAAA,IACvD;AAAA,EACF;AACF;"}
@@ -16,7 +16,7 @@ class InscribeFromBufferTool extends BaseInscriberQueryTool {
16
16
  constructor() {
17
17
  super(...arguments);
18
18
  this.name = "inscribeFromBuffer";
19
- this.description = "Inscribe content from a buffer/base64 data to the Hedera network. IMPORTANT: Only use this tool when you have actual content to inscribe. The base64Data must contain valid, non-empty content (minimum 10 bytes). Useful for inscribing content that has been read into memory, including files accessed through MCP filesystem tools. Always verify the content exists and is meaningful before attempting inscription.";
19
+ this.description = "Inscribe content that you already have (text, data, or files) to the Hedera network. Use this tool when you have content from: Wikipedia articles, MCP tool responses, text data, API responses, or any content you've retrieved. Convert your content to base64 first. DO NOT use inscribeFromUrl for web page content - use this tool instead after retrieving the actual content.";
20
20
  }
21
21
  get specificInputSchema() {
22
22
  return inscribeFromBufferSchema;
@@ -1 +1 @@
1
- {"version":3,"file":"standards-agent-kit.es29.js","sources":["../../src/tools/inscriber/InscribeFromBufferTool.ts"],"sourcesContent":["import { z } from 'zod';\nimport { BaseInscriberQueryTool } from './base-inscriber-tools';\nimport { InscriptionOptions } from '@hashgraphonline/standards-sdk';\nimport { CallbackManagerForToolRun } from '@langchain/core/callbacks/manager';\n\n/**\n * Schema for inscribing from buffer\n */\nconst inscribeFromBufferSchema = z.object({\n base64Data: z.string().min(1, 'Base64 data cannot be empty').describe('Base64 encoded content to inscribe. Must contain valid, non-empty content (minimum 10 bytes after decoding).'),\n fileName: z.string().min(1, 'File name cannot be empty').describe('Name for the inscribed content. Required for all inscriptions.'),\n mimeType: z\n .string()\n .optional()\n .describe('MIME type of the content'),\n mode: z\n .enum(['file', 'hashinal'])\n .optional()\n .describe('Inscription mode: file or hashinal NFT'),\n metadata: z\n .record(z.unknown())\n .optional()\n .describe('Metadata to attach to the inscription'),\n tags: z\n .array(z.string())\n .optional()\n .describe('Tags to categorize the inscription'),\n chunkSize: z\n .number()\n .int()\n .positive()\n .optional()\n .describe('Chunk size for large files'),\n waitForConfirmation: z\n .boolean()\n .optional()\n .describe('Whether to wait for inscription confirmation'),\n timeoutMs: z\n .number()\n .int()\n .positive()\n .optional()\n .describe('Timeout in milliseconds for inscription (default: no timeout)'),\n apiKey: z\n .string()\n .optional()\n .describe('API key for inscription service'),\n});\n\n\n/**\n * Tool for inscribing content from buffer\n */\nexport class InscribeFromBufferTool extends BaseInscriberQueryTool<typeof inscribeFromBufferSchema> {\n name = 'inscribeFromBuffer';\n description = 'Inscribe content from a buffer/base64 data to the Hedera network. IMPORTANT: Only use this tool when you have actual content to inscribe. The base64Data must contain valid, non-empty content (minimum 10 bytes). Useful for inscribing content that has been read into memory, including files accessed through MCP filesystem tools. Always verify the content exists and is meaningful before attempting inscription.';\n\n get specificInputSchema() {\n return inscribeFromBufferSchema;\n }\n\n protected async executeQuery(\n params: z.infer<typeof inscribeFromBufferSchema>,\n _runManager?: CallbackManagerForToolRun\n ): Promise<unknown> {\n console.log(`[DEBUG] InscribeFromBufferTool.executeQuery called`);\n console.log(`[DEBUG] Buffer tool received base64Data length: ${params.base64Data?.length || 0}`);\n console.log(`[DEBUG] Buffer tool fileName: ${params.fileName}`);\n console.log(`[DEBUG] Buffer tool mimeType: ${params.mimeType}`);\n \n if (!params.base64Data || params.base64Data.trim() === '') {\n console.log(`[InscribeFromBufferTool] ERROR: No data provided`);\n throw new Error('No data provided. Cannot inscribe empty content. Please provide valid base64 encoded data.');\n }\n\n if (!params.fileName || params.fileName.trim() === '') {\n console.log(`[InscribeFromBufferTool] ERROR: No fileName provided`);\n throw new Error('No fileName provided. A valid fileName is required for inscription.');\n }\n\n let buffer: Buffer;\n try {\n buffer = Buffer.from(params.base64Data, 'base64');\n } catch (error) {\n console.log(`[InscribeFromBufferTool] ERROR: Invalid base64 data`);\n throw new Error('Invalid base64 data provided. Please ensure the data is properly base64 encoded.');\n }\n \n console.log(`[InscribeFromBufferTool] Buffer length after conversion: ${buffer.length}`);\n \n if (buffer.length === 0) {\n console.log(`[InscribeFromBufferTool] ERROR: Buffer is empty after conversion`);\n throw new Error('Buffer is empty after base64 conversion. The provided data appears to be invalid or empty.');\n }\n\n if (buffer.length < 10) {\n console.log(`[InscribeFromBufferTool] WARNING: Buffer is very small (${buffer.length} bytes)`);\n console.log(`[InscribeFromBufferTool] Buffer content preview: ${buffer.toString('utf8', 0, Math.min(buffer.length, 50))}`);\n throw new Error(`Buffer content is too small (${buffer.length} bytes). This may indicate empty or invalid content. Please verify the source data contains actual content.`);\n }\n\n const isValidBase64 = /^[A-Za-z0-9+/]*={0,2}$/.test(params.base64Data);\n if (!isValidBase64) {\n console.log(`[InscribeFromBufferTool] ERROR: Invalid base64 format`);\n throw new Error('Invalid base64 format. The data does not appear to be properly base64 encoded.');\n }\n\n if (buffer.toString('utf8', 0, Math.min(buffer.length, 100)).trim() === '') {\n console.log(`[InscribeFromBufferTool] ERROR: Buffer contains only whitespace or empty content`);\n throw new Error('Buffer contains only whitespace or empty content. Cannot inscribe meaningless data.');\n }\n\n const options: InscriptionOptions = {\n mode: params.mode,\n metadata: params.metadata,\n tags: params.tags,\n chunkSize: params.chunkSize,\n waitForConfirmation: params.waitForConfirmation ?? true,\n waitMaxAttempts: 10,\n waitIntervalMs: 3000,\n apiKey: params.apiKey,\n network: this.inscriberBuilder['hederaKit'].client.network.toString().includes('mainnet') ? 'mainnet' : 'testnet',\n };\n\n try {\n let result: any;\n \n if (params.timeoutMs) {\n const timeoutPromise = new Promise((_, reject) => {\n setTimeout(\n () => reject(new Error(`Inscription timed out after ${params.timeoutMs}ms`)),\n params.timeoutMs\n );\n });\n\n result = await Promise.race([\n this.inscriberBuilder.inscribe(\n {\n type: 'buffer',\n buffer,\n fileName: params.fileName,\n mimeType: params.mimeType,\n },\n options\n ),\n timeoutPromise,\n ]);\n } else {\n result = await this.inscriberBuilder.inscribe(\n {\n type: 'buffer',\n buffer,\n fileName: params.fileName,\n mimeType: params.mimeType,\n },\n options\n );\n }\n\n if (result.confirmed) {\n const topicId = result.inscription?.topic_id || result.result.topicId;\n const network = options.network || 'testnet';\n const cdnUrl = topicId ? `https://kiloscribe.com/api/inscription-cdn/${topicId}?network=${network}` : null;\n return `Successfully inscribed and confirmed content on the Hedera network!\\n\\nTransaction ID: ${result.result.transactionId}\\nTopic ID: ${topicId || 'N/A'}${cdnUrl ? `\\nView inscription: ${cdnUrl}` : ''}\\n\\nThe inscription is now available.`;\n } else {\n return `Successfully submitted inscription to the Hedera network!\\n\\nTransaction ID: ${result.result.transactionId}\\n\\nThe inscription is processing and will be confirmed shortly.`;\n }\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : 'Failed to inscribe from buffer';\n throw new Error(`Inscription failed: ${errorMessage}`);\n }\n }\n}"],"names":[],"mappings":";;AAQA,MAAM,2BAA2B,EAAE,OAAO;AAAA,EACxC,YAAY,EAAE,SAAS,IAAI,GAAG,6BAA6B,EAAE,SAAS,8GAA8G;AAAA,EACpL,UAAU,EAAE,SAAS,IAAI,GAAG,2BAA2B,EAAE,SAAS,gEAAgE;AAAA,EAClI,UAAU,EACP,OAAA,EACA,SAAA,EACA,SAAS,0BAA0B;AAAA,EACtC,MAAM,EACH,KAAK,CAAC,QAAQ,UAAU,CAAC,EACzB,SAAA,EACA,SAAS,wCAAwC;AAAA,EACpD,UAAU,EACP,OAAO,EA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,UAAA;AAAA,QAEX,CAAC;AAED,iBAAS,MAAM,QAAQ,KAAK;AAAA,UAC1B,KAAK,iBAAiB;AAAA,YACpB;AAAA,cACE,MAAM;AAAA,cACN;AAAA,cACA,UAAU,OAAO;AAAA,cACjB,UAAU,OAAO;AAAA,YAAA;AAAA,YAEnB;AAAA,UAAA;AAAA,UAEF;AAAA,QAAA,CACD;AAAA,MACH,OAAO;AACL,iBAAS,MAAM,KAAK,iBAAiB;AAAA,UACnC;AAAA,YACE,MAAM;AAAA,YACN;AAAA,YACA,UAAU,OAAO;AAAA,YACjB,UAAU,OAAO;AAAA,UAAA;AAAA,UAEnB;AAAA,QAAA;AAAA,MAEJ;AAEA,UAAI,OAAO,WAAW;AACpB,cAAM,UAAU,OAAO,aAAa,YAAY,OAAO,OAAO;AAC9D,cAAM,UAAU,QAAQ,WAAW;AACnC,cAAM,SAAS,UAAU,8CAA8C,OAAO,YAAY,OAAO,KAAK;AACtG,eAAO;AAAA;AAAA,kBAA0F,OAAO,OAAO,aAAa;AAAA,YAAe,WAAW,KAAK,GAAG,SAAS;AAAA,oBAAuB,MAAM,KAAK,EAAE;AAAA;AAAA;AAAA,MAC7M,OAAO;AACL,eAAO;AAAA;AAAA,kBAAgF,OAAO,OAAO,aAAa;AAAA;AAAA;AAAA,MACpH;AAAA,IACF,SAAS,OAAO;AACd,YAAM,eAAe,iBAAiB,QAAQ,MAAM,UAAU;AAC9D,YAAM,IAAI,MAAM,uBAAuB,YAAY,EAAE;AAAA,IACvD;AAAA,EACF;AACF;"}
1
+ {"version":3,"file":"standards-agent-kit.es29.js","sources":["../../src/tools/inscriber/InscribeFromBufferTool.ts"],"sourcesContent":["import { z } from 'zod';\nimport { BaseInscriberQueryTool } from './base-inscriber-tools';\nimport { InscriptionOptions } from '@hashgraphonline/standards-sdk';\nimport { CallbackManagerForToolRun } from '@langchain/core/callbacks/manager';\n\n/**\n * Schema for inscribing from buffer\n */\nconst inscribeFromBufferSchema = z.object({\n base64Data: z.string().min(1, 'Base64 data cannot be empty').describe('Base64 encoded content to inscribe. Must contain valid, non-empty content (minimum 10 bytes after decoding).'),\n fileName: z.string().min(1, 'File name cannot be empty').describe('Name for the inscribed content. Required for all inscriptions.'),\n mimeType: z\n .string()\n .optional()\n .describe('MIME type of the content'),\n mode: z\n .enum(['file', 'hashinal'])\n .optional()\n .describe('Inscription mode: file or hashinal NFT'),\n metadata: z\n .record(z.unknown())\n .optional()\n .describe('Metadata to attach to the inscription'),\n tags: z\n .array(z.string())\n .optional()\n .describe('Tags to categorize the inscription'),\n chunkSize: z\n .number()\n .int()\n .positive()\n .optional()\n .describe('Chunk size for large files'),\n waitForConfirmation: z\n .boolean()\n .optional()\n .describe('Whether to wait for inscription confirmation'),\n timeoutMs: z\n .number()\n .int()\n .positive()\n .optional()\n .describe('Timeout in milliseconds for inscription (default: no timeout)'),\n apiKey: z\n .string()\n .optional()\n .describe('API key for inscription service'),\n});\n\n\n/**\n * Tool for inscribing content from buffer\n */\nexport class InscribeFromBufferTool extends BaseInscriberQueryTool<typeof inscribeFromBufferSchema> {\n name = 'inscribeFromBuffer';\n description = 'Inscribe content that you already have (text, data, or files) to the Hedera network. Use this tool when you have content from: Wikipedia articles, MCP tool responses, text data, API responses, or any content you\\'ve retrieved. Convert your content to base64 first. DO NOT use inscribeFromUrl for web page content - use this tool instead after retrieving the actual content.';\n\n get specificInputSchema() {\n return inscribeFromBufferSchema;\n }\n\n protected async executeQuery(\n params: z.infer<typeof inscribeFromBufferSchema>,\n _runManager?: CallbackManagerForToolRun\n ): Promise<unknown> {\n console.log(`[DEBUG] InscribeFromBufferTool.executeQuery called`);\n console.log(`[DEBUG] Buffer tool received base64Data length: ${params.base64Data?.length || 0}`);\n console.log(`[DEBUG] Buffer tool fileName: ${params.fileName}`);\n console.log(`[DEBUG] Buffer tool mimeType: ${params.mimeType}`);\n \n if (!params.base64Data || params.base64Data.trim() === '') {\n console.log(`[InscribeFromBufferTool] ERROR: No data provided`);\n throw new Error('No data provided. Cannot inscribe empty content. Please provide valid base64 encoded data.');\n }\n\n if (!params.fileName || params.fileName.trim() === '') {\n console.log(`[InscribeFromBufferTool] ERROR: No fileName provided`);\n throw new Error('No fileName provided. A valid fileName is required for inscription.');\n }\n\n let buffer: Buffer;\n try {\n buffer = Buffer.from(params.base64Data, 'base64');\n } catch (error) {\n console.log(`[InscribeFromBufferTool] ERROR: Invalid base64 data`);\n throw new Error('Invalid base64 data provided. Please ensure the data is properly base64 encoded.');\n }\n \n console.log(`[InscribeFromBufferTool] Buffer length after conversion: ${buffer.length}`);\n \n if (buffer.length === 0) {\n console.log(`[InscribeFromBufferTool] ERROR: Buffer is empty after conversion`);\n throw new Error('Buffer is empty after base64 conversion. The provided data appears to be invalid or empty.');\n }\n\n if (buffer.length < 10) {\n console.log(`[InscribeFromBufferTool] WARNING: Buffer is very small (${buffer.length} bytes)`);\n console.log(`[InscribeFromBufferTool] Buffer content preview: ${buffer.toString('utf8', 0, Math.min(buffer.length, 50))}`);\n throw new Error(`Buffer content is too small (${buffer.length} bytes). This may indicate empty or invalid content. Please verify the source data contains actual content.`);\n }\n\n const isValidBase64 = /^[A-Za-z0-9+/]*={0,2}$/.test(params.base64Data);\n if (!isValidBase64) {\n console.log(`[InscribeFromBufferTool] ERROR: Invalid base64 format`);\n throw new Error('Invalid base64 format. The data does not appear to be properly base64 encoded.');\n }\n\n if (buffer.toString('utf8', 0, Math.min(buffer.length, 100)).trim() === '') {\n console.log(`[InscribeFromBufferTool] ERROR: Buffer contains only whitespace or empty content`);\n throw new Error('Buffer contains only whitespace or empty content. Cannot inscribe meaningless data.');\n }\n\n const options: InscriptionOptions = {\n mode: params.mode,\n metadata: params.metadata,\n tags: params.tags,\n chunkSize: params.chunkSize,\n waitForConfirmation: params.waitForConfirmation ?? true,\n waitMaxAttempts: 10,\n waitIntervalMs: 3000,\n apiKey: params.apiKey,\n network: this.inscriberBuilder['hederaKit'].client.network.toString().includes('mainnet') ? 'mainnet' : 'testnet',\n };\n\n try {\n let result: any;\n \n if (params.timeoutMs) {\n const timeoutPromise = new Promise((_, reject) => {\n setTimeout(\n () => reject(new Error(`Inscription timed out after ${params.timeoutMs}ms`)),\n params.timeoutMs\n );\n });\n\n result = await Promise.race([\n this.inscriberBuilder.inscribe(\n {\n type: 'buffer',\n buffer,\n fileName: params.fileName,\n mimeType: params.mimeType,\n },\n options\n ),\n timeoutPromise,\n ]);\n } else {\n result = await this.inscriberBuilder.inscribe(\n {\n type: 'buffer',\n buffer,\n fileName: params.fileName,\n mimeType: params.mimeType,\n },\n options\n );\n }\n\n if (result.confirmed) {\n const topicId = result.inscription?.topic_id || result.result.topicId;\n const network = options.network || 'testnet';\n const cdnUrl = topicId ? `https://kiloscribe.com/api/inscription-cdn/${topicId}?network=${network}` : null;\n return `Successfully inscribed and confirmed content on the Hedera network!\\n\\nTransaction ID: ${result.result.transactionId}\\nTopic ID: ${topicId || 'N/A'}${cdnUrl ? `\\nView inscription: ${cdnUrl}` : ''}\\n\\nThe inscription is now available.`;\n } else {\n return `Successfully submitted inscription to the Hedera network!\\n\\nTransaction ID: ${result.result.transactionId}\\n\\nThe inscription is processing and will be confirmed shortly.`;\n }\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : 'Failed to inscribe from buffer';\n throw new Error(`Inscription failed: ${errorMessage}`);\n }\n }\n}"],"names":[],"mappings":";;AAQA,MAAM,2BAA2B,EAAE,OAAO;AAAA,EACxC,YAAY,EAAE,SAAS,IAAI,GAAG,6BAA6B,EAAE,SAAS,8GAA8G;AAAA,EACpL,UAAU,EAAE,SAAS,IAAI,GAAG,2BAA2B,EAAE,SAAS,gEAAgE;AAAA,EAClI,UAAU,EACP,OAAA,EACA,SAAA,EACA,SAAS,0BAA0B;AAAA,EACtC,MAAM,EACH,KAAK,CAAC,QAAQ,UAAU,CAAC,EACzB,SAAA,EACA,SAAS,wCAAwC;AAAA,EACpD,UAAU,EACP,OAAO,EAAE,QAAA,CAAS,EAClB,SAAA,EACA,SAAS,uCAAuC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AQ,KAAK;AAAA,UAC1B,KAAK,iBAAiB;AAAA,YACpB;AAAA,cACE,MAAM;AAAA,cACN;AAAA,cACA,UAAU,OAAO;AAAA,cACjB,UAAU,OAAO;AAAA,YAAA;AAAA,YAEnB;AAAA,UAAA;AAAA,UAEF;AAAA,QAAA,CACD;AAAA,MACH,OAAO;AACL,iBAAS,MAAM,KAAK,iBAAiB;AAAA,UACnC;AAAA,YACE,MAAM;AAAA,YACN;AAAA,YACA,UAAU,OAAO;AAAA,YACjB,UAAU,OAAO;AAAA,UAAA;AAAA,UAEnB;AAAA,QAAA;AAAA,MAEJ;AAEA,UAAI,OAAO,WAAW;AACpB,cAAM,UAAU,OAAO,aAAa,YAAY,OAAO,OAAO;AAC9D,cAAM,UAAU,QAAQ,WAAW;AACnC,cAAM,SAAS,UAAU,8CAA8C,OAAO,YAAY,OAAO,KAAK;AACtG,eAAO;AAAA;AAAA,kBAA0F,OAAO,OAAO,aAAa;AAAA,YAAe,WAAW,KAAK,GAAG,SAAS;AAAA,oBAAuB,MAAM,KAAK,EAAE;AAAA;AAAA;AAAA,MAC7M,OAAO;AACL,eAAO;AAAA;AAAA,kBAAgF,OAAO,OAAO,aAAa;AAAA;AAAA;AAAA,MACpH;AAAA,IACF,SAAS,OAAO;AACd,YAAM,eAAe,iBAAiB,QAAQ,MAAM,UAAU;AAC9D,YAAM,IAAI,MAAM,uBAAuB,YAAY,EAAE;AAAA,IACvD;AAAA,EACF;AACF;"}
@@ -0,0 +1,47 @@
1
+ import { BaseServiceBuilder, HederaAgentKit } from 'hedera-agent-kit';
2
+ import { HCS6Client, HCS6CreateRegistryOptions, HCS6RegisterEntryOptions, HCS6QueryRegistryOptions, HCS6RegisterOptions, HCS6CreateHashinalOptions, HCS6TopicRegistrationResponse, HCS6RegistryOperationResponse, HCS6TopicRegistry, HCS6CreateHashinalResponse } from '@hashgraphonline/standards-sdk';
3
+ /**
4
+ * Builder for HCS-6 operations that delegates to HCS6Client
5
+ */
6
+ export declare class HCS6Builder extends BaseServiceBuilder {
7
+ protected hcs6Client?: HCS6Client;
8
+ constructor(hederaKit: HederaAgentKit);
9
+ /**
10
+ * Get or create HCS-6 client
11
+ */
12
+ protected getHCS6Client(): Promise<HCS6Client>;
13
+ /**
14
+ * Create a new HCS-6 dynamic registry
15
+ * Note: This executes the transaction directly via HCS6Client
16
+ */
17
+ createRegistry(options?: HCS6CreateRegistryOptions): Promise<HCS6TopicRegistrationResponse>;
18
+ /**
19
+ * Register a new dynamic hashinal entry in an HCS-6 registry
20
+ */
21
+ registerEntry(registryTopicId: string, options: HCS6RegisterEntryOptions): Promise<HCS6RegistryOperationResponse>;
22
+ /**
23
+ * Query entries from an HCS-6 registry
24
+ */
25
+ getRegistry(topicId: string, options?: HCS6QueryRegistryOptions): Promise<HCS6TopicRegistry>;
26
+ /**
27
+ * Create a complete dynamic hashinal with inscription and registry
28
+ */
29
+ createHashinal(options: HCS6CreateHashinalOptions): Promise<HCS6CreateHashinalResponse>;
30
+ /**
31
+ * Register a dynamic hashinal with combined inscription and registry creation
32
+ * This is the main method for creating and updating dynamic hashinals
33
+ */
34
+ register(options: HCS6RegisterOptions): Promise<HCS6CreateHashinalResponse>;
35
+ /**
36
+ * Submit a raw message to an HCS-6 topic
37
+ */
38
+ submitMessage(topicId: string, payload: any): Promise<any>;
39
+ /**
40
+ * Get topic info from mirror node
41
+ */
42
+ getTopicInfo(topicId: string): Promise<any>;
43
+ /**
44
+ * Close the HCS-6 client
45
+ */
46
+ close(): Promise<void>;
47
+ }
@@ -0,0 +1 @@
1
+ export * from './hcs6-builder';
@@ -1,4 +1,5 @@
1
1
  export * from './types';
2
2
  export * from './hcs10/hcs10-builder';
3
3
  export * from './hcs2/hcs2-builder';
4
+ export * from './hcs6/hcs6-builder';
4
5
  export * from './inscriber/inscriber-builder';