@hashgraphonline/standards-agent-kit 0.2.136 → 0.2.138

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.
Files changed (211) hide show
  1. package/README.md +3 -4
  2. package/dist/cjs/builders/hcs10/hcs10-builder.d.ts +1 -0
  3. package/dist/cjs/builders/hcs2/hcs2-builder.d.ts +8 -7
  4. package/dist/cjs/builders/hcs6/hcs6-builder.d.ts +5 -4
  5. package/dist/cjs/builders/inscriber/inscriber-builder.d.ts +32 -1
  6. package/dist/cjs/index.d.ts +4 -0
  7. package/dist/cjs/signing/bytes-registry.d.ts +17 -0
  8. package/dist/cjs/signing/signer-provider.d.ts +45 -0
  9. package/dist/cjs/standards-agent-kit.cjs +1 -1
  10. package/dist/cjs/standards-agent-kit.cjs.map +1 -1
  11. package/dist/cjs/tools/hcs10/InitiateConnectionTool.d.ts +4 -4
  12. package/dist/cjs/tools/hcs2/CreateRegistryTool.d.ts +2 -2
  13. package/dist/cjs/tools/hcs2/DeleteEntryTool.d.ts +2 -2
  14. package/dist/cjs/tools/hcs2/UpdateEntryTool.d.ts +2 -2
  15. package/dist/cjs/tools/hcs6/RegisterDynamicHashinalTool.d.ts +10 -10
  16. package/dist/cjs/tools/hcs6/UpdateDynamicHashinalTool.d.ts +8 -8
  17. package/dist/cjs/tools/inscriber/InscribeFromBufferTool.d.ts +5 -4
  18. package/dist/cjs/tools/inscriber/InscribeFromFileTool.d.ts +2 -2
  19. package/dist/cjs/tools/inscriber/InscribeFromUrlTool.d.ts +4 -4
  20. package/dist/cjs/tools/inscriber/InscribeHashinalTool.d.ts +3 -3
  21. package/dist/cjs/types/inscription-response.d.ts +8 -0
  22. package/dist/cjs/types/tx-results.d.ts +15 -0
  23. package/dist/cjs/utils/CodedError.d.ts +4 -0
  24. package/dist/cjs/utils/inscription-utils.d.ts +21 -0
  25. package/dist/cjs/validation/hip412-schemas.d.ts +2 -2
  26. package/dist/es/builders/hcs10/hcs10-builder.d.ts +1 -0
  27. package/dist/es/builders/hcs2/hcs2-builder.d.ts +8 -7
  28. package/dist/es/builders/hcs6/hcs6-builder.d.ts +5 -4
  29. package/dist/es/builders/inscriber/inscriber-builder.d.ts +32 -1
  30. package/dist/es/index.d.ts +4 -0
  31. package/dist/es/signing/bytes-registry.d.ts +17 -0
  32. package/dist/es/signing/signer-provider.d.ts +45 -0
  33. package/dist/es/standards-agent-kit.es.js +46 -42
  34. package/dist/es/standards-agent-kit.es.js.map +1 -1
  35. package/dist/es/standards-agent-kit.es10.js +24 -83
  36. package/dist/es/standards-agent-kit.es10.js.map +1 -1
  37. package/dist/es/standards-agent-kit.es11.js +224 -20
  38. package/dist/es/standards-agent-kit.es11.js.map +1 -1
  39. package/dist/es/standards-agent-kit.es12.js +78 -27
  40. package/dist/es/standards-agent-kit.es12.js.map +1 -1
  41. package/dist/es/standards-agent-kit.es13.js +26 -36
  42. package/dist/es/standards-agent-kit.es13.js.map +1 -1
  43. package/dist/es/standards-agent-kit.es14.js +17 -39
  44. package/dist/es/standards-agent-kit.es14.js.map +1 -1
  45. package/dist/es/standards-agent-kit.es15.js +36 -58
  46. package/dist/es/standards-agent-kit.es15.js.map +1 -1
  47. package/dist/es/standards-agent-kit.es16.js +45 -18
  48. package/dist/es/standards-agent-kit.es16.js.map +1 -1
  49. package/dist/es/standards-agent-kit.es17.js +53 -16
  50. package/dist/es/standards-agent-kit.es17.js.map +1 -1
  51. package/dist/es/standards-agent-kit.es18.js +18 -28
  52. package/dist/es/standards-agent-kit.es18.js.map +1 -1
  53. package/dist/es/standards-agent-kit.es19.js +26 -12
  54. package/dist/es/standards-agent-kit.es19.js.map +1 -1
  55. package/dist/es/standards-agent-kit.es20.js +38 -136
  56. package/dist/es/standards-agent-kit.es20.js.map +1 -1
  57. package/dist/es/standards-agent-kit.es21.js +13 -24
  58. package/dist/es/standards-agent-kit.es21.js.map +1 -1
  59. package/dist/es/standards-agent-kit.es22.js +136 -39
  60. package/dist/es/standards-agent-kit.es22.js.map +1 -1
  61. package/dist/es/standards-agent-kit.es23.js +25 -41
  62. package/dist/es/standards-agent-kit.es23.js.map +1 -1
  63. package/dist/es/standards-agent-kit.es24.js +49 -31
  64. package/dist/es/standards-agent-kit.es24.js.map +1 -1
  65. package/dist/es/standards-agent-kit.es25.js +34 -18
  66. package/dist/es/standards-agent-kit.es25.js.map +1 -1
  67. package/dist/es/standards-agent-kit.es26.js +35 -19
  68. package/dist/es/standards-agent-kit.es26.js.map +1 -1
  69. package/dist/es/standards-agent-kit.es27.js +45 -32
  70. package/dist/es/standards-agent-kit.es27.js.map +1 -1
  71. package/dist/es/standards-agent-kit.es28.js +54 -25
  72. package/dist/es/standards-agent-kit.es28.js.map +1 -1
  73. package/dist/es/standards-agent-kit.es29.js +35 -23
  74. package/dist/es/standards-agent-kit.es29.js.map +1 -1
  75. package/dist/es/standards-agent-kit.es3.js +41 -1545
  76. package/dist/es/standards-agent-kit.es3.js.map +1 -1
  77. package/dist/es/standards-agent-kit.es30.js +23 -39
  78. package/dist/es/standards-agent-kit.es30.js.map +1 -1
  79. package/dist/es/standards-agent-kit.es31.js +30 -28
  80. package/dist/es/standards-agent-kit.es31.js.map +1 -1
  81. package/dist/es/standards-agent-kit.es32.js +45 -32
  82. package/dist/es/standards-agent-kit.es32.js.map +1 -1
  83. package/dist/es/standards-agent-kit.es33.js +50 -89
  84. package/dist/es/standards-agent-kit.es33.js.map +1 -1
  85. package/dist/es/standards-agent-kit.es34.js +35 -228
  86. package/dist/es/standards-agent-kit.es34.js.map +1 -1
  87. package/dist/es/standards-agent-kit.es35.js +87 -212
  88. package/dist/es/standards-agent-kit.es35.js.map +1 -1
  89. package/dist/es/standards-agent-kit.es36.js +188 -128
  90. package/dist/es/standards-agent-kit.es36.js.map +1 -1
  91. package/dist/es/standards-agent-kit.es37.js +167 -561
  92. package/dist/es/standards-agent-kit.es37.js.map +1 -1
  93. package/dist/es/standards-agent-kit.es38.js +236 -31
  94. package/dist/es/standards-agent-kit.es38.js.map +1 -1
  95. package/dist/es/standards-agent-kit.es39.js +483 -206
  96. package/dist/es/standards-agent-kit.es39.js.map +1 -1
  97. package/dist/es/standards-agent-kit.es4.js +359 -81
  98. package/dist/es/standards-agent-kit.es4.js.map +1 -1
  99. package/dist/es/standards-agent-kit.es40.js +39 -135
  100. package/dist/es/standards-agent-kit.es40.js.map +1 -1
  101. package/dist/es/standards-agent-kit.es41.js +244 -28
  102. package/dist/es/standards-agent-kit.es41.js.map +1 -1
  103. package/dist/es/standards-agent-kit.es42.js +132 -418
  104. package/dist/es/standards-agent-kit.es42.js.map +1 -1
  105. package/dist/es/standards-agent-kit.es43.js +28 -184
  106. package/dist/es/standards-agent-kit.es43.js.map +1 -1
  107. package/dist/es/standards-agent-kit.es44.js +423 -3
  108. package/dist/es/standards-agent-kit.es44.js.map +1 -1
  109. package/dist/es/standards-agent-kit.es45.js +185 -24
  110. package/dist/es/standards-agent-kit.es45.js.map +1 -1
  111. package/dist/es/standards-agent-kit.es46.js +3 -3
  112. package/dist/es/standards-agent-kit.es46.js.map +1 -1
  113. package/dist/es/standards-agent-kit.es47.js +21 -50
  114. package/dist/es/standards-agent-kit.es47.js.map +1 -1
  115. package/dist/es/standards-agent-kit.es48.js +8 -3
  116. package/dist/es/standards-agent-kit.es48.js.map +1 -1
  117. package/dist/es/standards-agent-kit.es49.js +3 -39
  118. package/dist/es/standards-agent-kit.es49.js.map +1 -1
  119. package/dist/es/standards-agent-kit.es5.js +1747 -73
  120. package/dist/es/standards-agent-kit.es5.js.map +1 -1
  121. package/dist/es/standards-agent-kit.es50.js +18 -16
  122. package/dist/es/standards-agent-kit.es50.js.map +1 -1
  123. package/dist/es/standards-agent-kit.es51.js +49 -49
  124. package/dist/es/standards-agent-kit.es51.js.map +1 -1
  125. package/dist/es/standards-agent-kit.es52.js +6 -0
  126. package/dist/es/standards-agent-kit.es52.js.map +1 -0
  127. package/dist/es/standards-agent-kit.es53.js +43 -0
  128. package/dist/es/standards-agent-kit.es53.js.map +1 -0
  129. package/dist/es/standards-agent-kit.es54.js +22 -0
  130. package/dist/es/standards-agent-kit.es54.js.map +1 -0
  131. package/dist/es/standards-agent-kit.es55.js +77 -0
  132. package/dist/es/standards-agent-kit.es55.js.map +1 -0
  133. package/dist/es/standards-agent-kit.es56.js +7 -0
  134. package/dist/es/standards-agent-kit.es56.js.map +1 -0
  135. package/dist/es/standards-agent-kit.es6.js +347 -32
  136. package/dist/es/standards-agent-kit.es6.js.map +1 -1
  137. package/dist/es/standards-agent-kit.es7.js +142 -293
  138. package/dist/es/standards-agent-kit.es7.js.map +1 -1
  139. package/dist/es/standards-agent-kit.es8.js +201 -21
  140. package/dist/es/standards-agent-kit.es8.js.map +1 -1
  141. package/dist/es/standards-agent-kit.es9.js +301 -213
  142. package/dist/es/standards-agent-kit.es9.js.map +1 -1
  143. package/dist/es/tools/hcs10/InitiateConnectionTool.d.ts +4 -4
  144. package/dist/es/tools/hcs2/CreateRegistryTool.d.ts +2 -2
  145. package/dist/es/tools/hcs2/DeleteEntryTool.d.ts +2 -2
  146. package/dist/es/tools/hcs2/UpdateEntryTool.d.ts +2 -2
  147. package/dist/es/tools/hcs6/RegisterDynamicHashinalTool.d.ts +10 -10
  148. package/dist/es/tools/hcs6/UpdateDynamicHashinalTool.d.ts +8 -8
  149. package/dist/es/tools/inscriber/InscribeFromBufferTool.d.ts +5 -4
  150. package/dist/es/tools/inscriber/InscribeFromFileTool.d.ts +2 -2
  151. package/dist/es/tools/inscriber/InscribeFromUrlTool.d.ts +4 -4
  152. package/dist/es/tools/inscriber/InscribeHashinalTool.d.ts +3 -3
  153. package/dist/es/types/inscription-response.d.ts +8 -0
  154. package/dist/es/types/tx-results.d.ts +15 -0
  155. package/dist/es/utils/CodedError.d.ts +4 -0
  156. package/dist/es/utils/inscription-utils.d.ts +21 -0
  157. package/dist/es/validation/hip412-schemas.d.ts +2 -2
  158. package/dist/umd/builders/hcs10/hcs10-builder.d.ts +1 -0
  159. package/dist/umd/builders/hcs2/hcs2-builder.d.ts +8 -7
  160. package/dist/umd/builders/hcs6/hcs6-builder.d.ts +5 -4
  161. package/dist/umd/builders/inscriber/inscriber-builder.d.ts +32 -1
  162. package/dist/umd/index.d.ts +4 -0
  163. package/dist/umd/signing/bytes-registry.d.ts +17 -0
  164. package/dist/umd/signing/signer-provider.d.ts +45 -0
  165. package/dist/umd/standards-agent-kit.umd.js +1 -1
  166. package/dist/umd/standards-agent-kit.umd.js.map +1 -1
  167. package/dist/umd/tools/hcs10/InitiateConnectionTool.d.ts +4 -4
  168. package/dist/umd/tools/hcs2/CreateRegistryTool.d.ts +2 -2
  169. package/dist/umd/tools/hcs2/DeleteEntryTool.d.ts +2 -2
  170. package/dist/umd/tools/hcs2/UpdateEntryTool.d.ts +2 -2
  171. package/dist/umd/tools/hcs6/RegisterDynamicHashinalTool.d.ts +10 -10
  172. package/dist/umd/tools/hcs6/UpdateDynamicHashinalTool.d.ts +8 -8
  173. package/dist/umd/tools/inscriber/InscribeFromBufferTool.d.ts +5 -4
  174. package/dist/umd/tools/inscriber/InscribeFromFileTool.d.ts +2 -2
  175. package/dist/umd/tools/inscriber/InscribeFromUrlTool.d.ts +4 -4
  176. package/dist/umd/tools/inscriber/InscribeHashinalTool.d.ts +3 -3
  177. package/dist/umd/types/inscription-response.d.ts +8 -0
  178. package/dist/umd/types/tx-results.d.ts +15 -0
  179. package/dist/umd/utils/CodedError.d.ts +4 -0
  180. package/dist/umd/utils/inscription-utils.d.ts +21 -0
  181. package/dist/umd/validation/hip412-schemas.d.ts +2 -2
  182. package/package.json +10 -5
  183. package/src/builders/hcs10/hcs10-builder.ts +239 -6
  184. package/src/builders/hcs2/hcs2-builder.ts +302 -9
  185. package/src/builders/hcs6/hcs6-builder.ts +79 -4
  186. package/src/builders/inscriber/inscriber-builder.ts +235 -2
  187. package/src/hcs10/HCS10Client.ts +1 -1
  188. package/src/index.ts +5 -1
  189. package/src/lib/zod-render/schema-extension.ts +0 -1
  190. package/src/signing/bytes-registry.ts +501 -0
  191. package/src/signing/signer-provider.ts +120 -0
  192. package/src/tools/hcs2/CreateRegistryTool.ts +30 -5
  193. package/src/tools/hcs2/DeleteEntryTool.ts +16 -2
  194. package/src/tools/hcs2/MigrateRegistryTool.ts +16 -2
  195. package/src/tools/hcs2/QueryRegistryTool.ts +11 -2
  196. package/src/tools/hcs2/RegisterEntryTool.ts +17 -3
  197. package/src/tools/hcs2/UpdateEntryTool.ts +16 -2
  198. package/src/tools/hcs6/CreateDynamicRegistryTool.ts +17 -3
  199. package/src/tools/hcs6/RegisterDynamicHashinalTool.ts +17 -3
  200. package/src/tools/hcs6/UpdateDynamicHashinalTool.ts +17 -3
  201. package/src/tools/inscriber/InscribeFromBufferTool.ts +126 -21
  202. package/src/tools/inscriber/InscribeFromFileTool.ts +10 -13
  203. package/src/tools/inscriber/InscribeFromUrlTool.ts +15 -11
  204. package/src/tools/inscriber/InscribeHashinalTool.ts +40 -168
  205. package/src/tools/inscriber/RetrieveInscriptionTool.ts +15 -16
  206. package/src/types/inscription-response.ts +27 -0
  207. package/src/types/tx-results.ts +18 -0
  208. package/src/utils/CodedError.ts +8 -0
  209. package/src/utils/Encryption.ts +0 -2
  210. package/src/utils/ensure-agent-has-hbar.ts +4 -5
  211. package/src/utils/inscription-utils.ts +53 -0
@@ -1,43 +1,157 @@
1
1
  import { z } from "zod";
2
- import { BaseInscriberQueryTool } from "./standards-agent-kit.es33.js";
3
- import { resolveContent } from "./standards-agent-kit.es47.js";
4
- import { contentRefSchema } from "./standards-agent-kit.es48.js";
5
- import { loadConfig } from "./standards-agent-kit.es2.js";
6
- const inscribeFromBufferSchema = z.object({
7
- base64Data: z.union([z.string(), contentRefSchema]).describe("Content to inscribe as base64 data, plain text, or content reference"),
8
- fileName: z.string().min(1).describe("Name for the inscribed content"),
9
- mimeType: z.string().optional().describe("MIME type of the content"),
10
- metadata: z.record(z.unknown()).optional().describe("Metadata to attach"),
2
+ import { BaseInscriberQueryTool } from "./standards-agent-kit.es35.js";
3
+ import { Logger } from "@hashgraphonline/standards-sdk";
4
+ import { extractTopicIds, buildInscriptionLinks } from "./standards-agent-kit.es50.js";
5
+ const logger = new Logger({ module: "InscribeFromUrlTool" });
6
+ const inscribeFromUrlSchema = z.object({
7
+ url: z.string().url().describe(
8
+ "ONLY direct file download URLs with file extensions (.pdf, .jpg, .png, .json, .zip). NEVER use for web pages, articles, or when you already have content to inscribe."
9
+ ),
10
+ mode: z.enum(["file", "hashinal"]).optional().describe("Inscription mode: file or hashinal NFT"),
11
+ metadata: z.record(z.unknown()).optional().describe("Metadata to attach to the inscription"),
11
12
  tags: z.array(z.string()).optional().describe("Tags to categorize the inscription"),
12
13
  chunkSize: z.number().int().positive().optional().describe("Chunk size for large files"),
13
- waitForConfirmation: z.boolean().optional().describe("Wait for inscription confirmation"),
14
- timeoutMs: z.number().int().positive().optional().describe("Timeout in milliseconds"),
14
+ waitForConfirmation: z.boolean().optional().describe("Whether to wait for inscription confirmation"),
15
+ timeoutMs: z.number().int().positive().optional().describe(
16
+ "Timeout in milliseconds for inscription (default: no timeout - waits until completion)"
17
+ ),
15
18
  apiKey: z.string().optional().describe("API key for inscription service"),
16
- quoteOnly: z.boolean().optional().default(false).describe("Return cost quote only")
19
+ quoteOnly: z.boolean().optional().default(false).describe(
20
+ "If true, returns a cost quote instead of executing the inscription"
21
+ )
17
22
  });
18
- class InscribeFromBufferTool extends BaseInscriberQueryTool {
23
+ class InscribeFromUrlTool extends BaseInscriberQueryTool {
19
24
  constructor() {
20
25
  super(...arguments);
21
- this.name = "inscribeFromBuffer";
22
- this.description = 'Use ONLY for inscribing regular files or content (NOT for NFT/Hashinal inscriptions). When user says "inscribe it" after you showed search results or other content WITHOUT mentioning NFT/hashinal, use THIS tool. The base64Data field accepts PLAIN TEXT (not just base64) and content reference IDs in format "content-ref:[id]". Pass the EXACT content from your previous response or MCP tool output. DO NOT generate new content or create repetitive text. Content references are automatically resolved to the original content for inscription. Set quoteOnly=true to get cost estimates without executing the inscription. NEVER use this for Hashinal NFTs - always use InscribeHashinalTool instead when user mentions hashinal, NFT, dynamic, or minting.';
23
- this.config = loadConfig();
26
+ this.name = "inscribeFromUrl";
27
+ this.description = 'ONLY for direct FILE DOWNLOAD URLs ending with file extensions (.pdf, .jpg, .png, .json, .zip). NEVER use for web pages, articles, or ANY HTML content - it WILL FAIL. If you have already retrieved content from any source (including MCP tools), you MUST use inscribeFromBuffer instead. This tool downloads files from URLs - it does NOT inscribe content you already have. When asked to "inscribe it" after retrieving content, ALWAYS use inscribeFromBuffer with the actual content. Set quoteOnly=true to get cost estimates without executing the inscription.';
24
28
  }
25
29
  get specificInputSchema() {
26
- return inscribeFromBufferSchema;
30
+ return inscribeFromUrlSchema;
27
31
  }
28
32
  async executeQuery(params, _runManager) {
29
- this.validateInput(params);
30
- const resolvedContent = await resolveContent(
31
- params.base64Data,
32
- params.mimeType,
33
- params.fileName
34
- );
35
- this.validateContent(resolvedContent.buffer);
36
- const buffer = resolvedContent.buffer;
37
- const resolvedMimeType = resolvedContent.mimeType || params.mimeType;
38
- const resolvedFileName = resolvedContent.fileName || params.fileName;
33
+ logger.debug(`InscribeFromUrlTool.executeQuery called with URL: ${params.url}`);
34
+ if (!params.url || params.url.trim() === "") {
35
+ throw new Error("URL cannot be empty. Please provide a valid URL.");
36
+ }
37
+ try {
38
+ const urlObj = new URL(params.url);
39
+ if (!urlObj.protocol || !urlObj.host) {
40
+ throw new Error(
41
+ "Invalid URL format. Please provide a complete URL with protocol (http/https)."
42
+ );
43
+ }
44
+ if (!["http:", "https:"].includes(urlObj.protocol)) {
45
+ throw new Error(
46
+ "Only HTTP and HTTPS URLs are supported for inscription."
47
+ );
48
+ }
49
+ } catch (error) {
50
+ if (error instanceof Error && error.message.includes("Cannot inscribe content from")) {
51
+ throw error;
52
+ }
53
+ throw new Error(
54
+ `Invalid URL: ${params.url}. Please provide a valid URL.`
55
+ );
56
+ }
57
+ logger.info("Validating URL content before inscription...");
58
+ try {
59
+ const controller = new AbortController();
60
+ const timeoutId = setTimeout(() => controller.abort(), 1e4);
61
+ try {
62
+ const headResponse = await fetch(params.url, {
63
+ method: "HEAD",
64
+ signal: controller.signal
65
+ });
66
+ clearTimeout(timeoutId);
67
+ if (!headResponse.ok) {
68
+ throw new Error(
69
+ `URL returned error status ${headResponse.status}: ${headResponse.statusText}. Cannot inscribe content from inaccessible URLs.`
70
+ );
71
+ }
72
+ const contentType = headResponse.headers.get("content-type") || "";
73
+ const contentLength = headResponse.headers.get("content-length");
74
+ const webPageContentTypes = [
75
+ "text/html",
76
+ "application/xhtml+xml",
77
+ "text/xml"
78
+ ];
79
+ if (webPageContentTypes.some(
80
+ (type) => contentType.toLowerCase().includes(type)
81
+ )) {
82
+ throw new Error(
83
+ `URL returns HTML/web page content (Content-Type: ${contentType}). This tool only works with direct file URLs (PDFs, images, JSON, etc.). For web page content, first retrieve the content using the appropriate MCP tool or web scraper, then use inscribeFromBuffer to inscribe it.`
84
+ );
85
+ }
86
+ if (contentLength && parseInt(contentLength) === 0) {
87
+ throw new Error(
88
+ "URL returns empty content (Content-Length: 0). Cannot inscribe empty content."
89
+ );
90
+ }
91
+ if (contentLength && parseInt(contentLength) < 10) {
92
+ throw new Error(
93
+ `URL content is too small (${contentLength} bytes). Content must be at least 10 bytes.`
94
+ );
95
+ }
96
+ if (!contentType || contentType === "application/octet-stream") {
97
+ logger.info("Content-Type unclear, fetching first 1KB to verify...");
98
+ const getController = new AbortController();
99
+ const getTimeoutId = setTimeout(() => getController.abort(), 5e3);
100
+ try {
101
+ const getResponse = await fetch(params.url, {
102
+ signal: getController.signal,
103
+ headers: {
104
+ Range: "bytes=0-1023"
105
+ // Get first 1KB
106
+ }
107
+ });
108
+ clearTimeout(getTimeoutId);
109
+ if (getResponse.ok || getResponse.status === 206) {
110
+ const buffer = await getResponse.arrayBuffer();
111
+ const bytes = new Uint8Array(buffer);
112
+ const text = new TextDecoder("utf-8", { fatal: false }).decode(
113
+ bytes.slice(0, 512)
114
+ );
115
+ if (text.toLowerCase().includes("<!doctype html") || text.toLowerCase().includes("<html") || text.match(/<meta\s+[^>]*>/i) || text.match(/<title>/i)) {
116
+ throw new Error(
117
+ `URL returns HTML content. This tool only works with direct file URLs. For web page content, first retrieve it using the appropriate tool, then use inscribeFromBuffer.`
118
+ );
119
+ }
120
+ }
121
+ } catch (getError) {
122
+ clearTimeout(getTimeoutId);
123
+ if (getError instanceof Error && getError.message.includes("HTML content")) {
124
+ throw getError;
125
+ }
126
+ logger.warn(
127
+ `Could not perform partial GET validation: ${getError instanceof Error ? getError.message : "Unknown error"}`
128
+ );
129
+ }
130
+ }
131
+ logger.info(
132
+ `URL validation passed. Content-Type: ${contentType}, Content-Length: ${contentLength || "unknown"}`
133
+ );
134
+ } catch (fetchError) {
135
+ clearTimeout(timeoutId);
136
+ throw fetchError;
137
+ }
138
+ } catch (error) {
139
+ if (error instanceof Error) {
140
+ if (error.name === "AbortError") {
141
+ logger.warn(
142
+ "URL validation timed out after 10 seconds. Proceeding with inscription attempt."
143
+ );
144
+ } else if (error.message.includes("URL returned error") || error.message.includes("empty content") || error.message.includes("too small") || error.message.includes("HTML")) {
145
+ throw error;
146
+ } else {
147
+ logger.warn(
148
+ `Could not validate URL with HEAD request: ${error.message}. Proceeding with inscription attempt.`
149
+ );
150
+ }
151
+ }
152
+ }
39
153
  const options = {
40
- mode: "file",
154
+ mode: params.mode,
41
155
  metadata: params.metadata,
42
156
  tags: params.tags,
43
157
  chunkSize: params.chunkSize,
@@ -51,12 +165,7 @@ class InscribeFromBufferTool extends BaseInscriberQueryTool {
51
165
  if (params.quoteOnly) {
52
166
  try {
53
167
  const quote = await this.generateInscriptionQuote(
54
- {
55
- type: "buffer",
56
- buffer,
57
- fileName: resolvedFileName,
58
- mimeType: resolvedMimeType
59
- },
168
+ { type: "url", url: params.url },
60
169
  options
61
170
  );
62
171
  return {
@@ -67,11 +176,9 @@ class InscribeFromBufferTool extends BaseInscriberQueryTool {
67
176
  breakdown: quote.breakdown
68
177
  },
69
178
  contentInfo: {
70
- fileName: resolvedFileName,
71
- mimeType: resolvedMimeType,
72
- sizeBytes: buffer.length
179
+ url: params.url
73
180
  },
74
- message: `Estimated Quote for buffer content: ${resolvedFileName} (${(buffer.length / 1024).toFixed(2)} KB)
181
+ message: `Estimated Quote for URL: ${params.url}
75
182
  Total cost: ${quote.totalCostHbar} HBAR`
76
183
  };
77
184
  } catch (error) {
@@ -80,108 +187,61 @@ Total cost: ${quote.totalCostHbar} HBAR`
80
187
  }
81
188
  }
82
189
  try {
83
- const result = await this.executeInscription(
84
- buffer,
85
- resolvedFileName,
86
- resolvedMimeType,
87
- options,
88
- params.timeoutMs
89
- );
90
- return this.formatInscriptionResult(result, options);
91
- } catch (error) {
92
- const errorMessage = error instanceof Error ? error.message : "Failed to inscribe from buffer";
93
- throw new Error(`Inscription failed: ${errorMessage}`);
94
- }
95
- }
96
- validateInput(params) {
97
- if (!params.base64Data || params.base64Data.trim() === "") {
98
- throw new Error(
99
- "No data provided. Cannot inscribe empty content. Please provide valid content, plain text, base64 encoded data, or a content reference ID."
100
- );
101
- }
102
- if (!params.fileName || params.fileName.trim() === "") {
103
- throw new Error(
104
- "No fileName provided. A valid fileName is required for inscription."
105
- );
106
- }
107
- }
108
- validateContent(buffer) {
109
- if (buffer.length === 0) {
110
- throw new Error(
111
- "Buffer is empty after conversion. The provided data appears to be invalid or empty."
112
- );
113
- }
114
- if (buffer.length > this.config.maxInscriptionSize) {
115
- const maxSizeKB = Math.round(this.config.maxInscriptionSize / 1024);
116
- const bufferSizeKB = Math.round(buffer.length / 1024);
117
- throw new Error(
118
- `Content is too large for inscription (${bufferSizeKB}KB, max ${maxSizeKB}KB). Please summarize or extract key information before inscribing.`
119
- );
120
- }
121
- if (buffer.length < this.config.minContentSize) {
122
- throw new Error(
123
- `Buffer content is too small (${buffer.length} bytes). This may indicate empty or invalid content. Please verify the source data contains actual content.`
124
- );
125
- }
126
- if (buffer.toString("utf8", 0, Math.min(buffer.length, 100)).trim() === "") {
127
- throw new Error(
128
- "Buffer contains only whitespace or empty content. Cannot inscribe meaningless data."
129
- );
130
- }
131
- const contentStr = buffer.toString("utf8");
132
- const emptyHtmlPattern = /<a\s+href=["'][^"']+["']\s*>\s*<\/a>/i;
133
- const hasOnlyEmptyLinks = emptyHtmlPattern.test(contentStr) && contentStr.replace(/<[^>]+>/g, "").trim().length < 50;
134
- if (hasOnlyEmptyLinks) {
135
- throw new Error(
136
- "Buffer contains empty HTML with only links and no actual content. When inscribing content from external sources, use the actual article text you retrieved, not empty HTML with links."
137
- );
138
- }
139
- }
140
- async executeInscription(buffer, fileName, mimeType, options, timeoutMs) {
141
- const inscriptionData = {
142
- type: "buffer",
143
- buffer,
144
- fileName,
145
- mimeType
146
- };
147
- if (timeoutMs) {
148
- const timeoutPromise = new Promise((_, reject) => {
149
- setTimeout(
150
- () => reject(new Error(`Inscription timed out after ${timeoutMs}ms`)),
151
- timeoutMs
190
+ let result;
191
+ if (params.timeoutMs) {
192
+ const timeoutPromise = new Promise((_, reject) => {
193
+ setTimeout(
194
+ () => reject(
195
+ new Error(`Inscription timed out after ${params.timeoutMs}ms`)
196
+ ),
197
+ params.timeoutMs
198
+ );
199
+ });
200
+ result = await Promise.race([
201
+ this.inscriberBuilder.inscribe(
202
+ { type: "url", url: params.url },
203
+ options
204
+ ),
205
+ timeoutPromise
206
+ ]);
207
+ } else {
208
+ result = await this.inscriberBuilder.inscribe(
209
+ { type: "url", url: params.url },
210
+ options
152
211
  );
153
- });
154
- return Promise.race([
155
- this.inscriberBuilder.inscribe(inscriptionData, options),
156
- timeoutPromise
157
- ]);
158
- }
159
- return this.inscriberBuilder.inscribe(inscriptionData, options);
160
- }
161
- formatInscriptionResult(result, options) {
162
- if (result.confirmed && !result.quote) {
163
- const topicId = result.inscription?.topic_id || result.result.topicId;
164
- const network = options.network || "testnet";
165
- const cdnUrl = topicId ? `https://kiloscribe.com/api/inscription-cdn/${topicId}?network=${network}` : null;
166
- return `Successfully inscribed and confirmed content on the Hedera network!
212
+ }
213
+ const typed = result;
214
+ if (typed.confirmed && !typed.quote) {
215
+ const ids = extractTopicIds(typed.inscription, typed.result);
216
+ const network = options.network || "testnet";
217
+ const { topicId, cdnUrl } = buildInscriptionLinks(
218
+ ids,
219
+ network,
220
+ "1"
221
+ );
222
+ return `Successfully inscribed and confirmed content on the Hedera network!
167
223
 
168
- Transaction ID: ${result.result.transactionId}
224
+ Transaction ID: ${typed.result?.transactionId ?? "unknown"}
169
225
  Topic ID: ${topicId || "N/A"}${cdnUrl ? `
170
226
  View inscription: ${cdnUrl}` : ""}
171
227
 
172
228
  The inscription is now available.`;
173
- }
174
- if (!result.quote && !result.confirmed) {
175
- return `Successfully submitted inscription to the Hedera network!
229
+ } else if (!typed.quote && !typed.confirmed) {
230
+ return `Successfully submitted inscription to the Hedera network!
176
231
 
177
- Transaction ID: ${result.result.transactionId}
232
+ Transaction ID: ${typed.result?.transactionId ?? "unknown"}
178
233
 
179
234
  The inscription is processing and will be confirmed shortly.`;
235
+ } else {
236
+ return "Inscription operation completed.";
237
+ }
238
+ } catch (error) {
239
+ const errorMessage = error instanceof Error ? error.message : "Failed to inscribe from URL";
240
+ throw new Error(`Inscription failed: ${errorMessage}`);
180
241
  }
181
- return "Inscription operation completed.";
182
242
  }
183
243
  }
184
244
  export {
185
- InscribeFromBufferTool
245
+ InscribeFromUrlTool
186
246
  };
187
247
  //# sourceMappingURL=standards-agent-kit.es36.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"standards-agent-kit.es36.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';\nimport { resolveContent } from '../../utils/content-resolver';\nimport { contentRefSchema } from '../../validation/content-ref-schemas';\nimport { loadConfig } from '../../config/ContentReferenceConfig';\n\nconst inscribeFromBufferSchema = z.object({\n base64Data: z.union([z.string(), contentRefSchema])\n .describe('Content to inscribe as base64 data, plain text, or content reference'),\n fileName: z.string().min(1).describe('Name for the inscribed content'),\n mimeType: z.string().optional().describe('MIME type of the content'),\n metadata: z.record(z.unknown()).optional().describe('Metadata to attach'),\n tags: z.array(z.string()).optional().describe('Tags to categorize the inscription'),\n chunkSize: z.number().int().positive().optional().describe('Chunk size for large files'),\n waitForConfirmation: z.boolean().optional().describe('Wait for inscription confirmation'),\n timeoutMs: z.number().int().positive().optional().describe('Timeout in milliseconds'),\n apiKey: z.string().optional().describe('API key for inscription service'),\n quoteOnly: z.boolean().optional().default(false).describe('Return cost quote only'),\n});\n\nexport class InscribeFromBufferTool extends BaseInscriberQueryTool<\n typeof inscribeFromBufferSchema\n> {\n name = 'inscribeFromBuffer';\n description =\n 'Use ONLY for inscribing regular files or content (NOT for NFT/Hashinal inscriptions). When user says \"inscribe it\" after you showed search results or other content WITHOUT mentioning NFT/hashinal, use THIS tool. The base64Data field accepts PLAIN TEXT (not just base64) and content reference IDs in format \"content-ref:[id]\". Pass the EXACT content from your previous response or MCP tool output. DO NOT generate new content or create repetitive text. Content references are automatically resolved to the original content for inscription. Set quoteOnly=true to get cost estimates without executing the inscription. NEVER use this for Hashinal NFTs - always use InscribeHashinalTool instead when user mentions hashinal, NFT, dynamic, or minting.';\n\n private config = loadConfig();\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 this.validateInput(params);\n\n const resolvedContent = await resolveContent(\n params.base64Data,\n params.mimeType,\n params.fileName\n );\n\n this.validateContent(resolvedContent.buffer);\n\n const buffer = resolvedContent.buffer;\n const resolvedMimeType = resolvedContent.mimeType || params.mimeType;\n const resolvedFileName = resolvedContent.fileName || params.fileName;\n\n const options: InscriptionOptions = {\n mode: 'file',\n metadata: params.metadata,\n tags: params.tags,\n chunkSize: params.chunkSize,\n waitForConfirmation: params.quoteOnly\n ? false\n : params.waitForConfirmation ?? true,\n waitMaxAttempts: 60,\n waitIntervalMs: 5000,\n apiKey: params.apiKey,\n network: this.inscriberBuilder['hederaKit'].client.network\n .toString()\n .includes('mainnet')\n ? 'mainnet'\n : 'testnet',\n quoteOnly: params.quoteOnly,\n };\n\n if (params.quoteOnly) {\n try {\n const quote = await this.generateInscriptionQuote(\n {\n type: 'buffer',\n buffer,\n fileName: resolvedFileName,\n mimeType: resolvedMimeType,\n },\n options\n );\n\n return {\n success: true,\n quote: {\n totalCostHbar: quote.totalCostHbar,\n validUntil: quote.validUntil,\n breakdown: quote.breakdown,\n },\n contentInfo: {\n fileName: resolvedFileName,\n mimeType: resolvedMimeType,\n sizeBytes: buffer.length,\n },\n message: `Estimated Quote for buffer content: ${resolvedFileName} (${(\n buffer.length / 1024\n ).toFixed(2)} KB)\\nTotal cost: ${quote.totalCostHbar} HBAR`,\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error\n ? error.message\n : 'Failed to generate inscription quote';\n throw new Error(`Quote generation failed: ${errorMessage}`);\n }\n }\n\n try {\n const result = await this.executeInscription(\n buffer,\n resolvedFileName,\n resolvedMimeType,\n options,\n params.timeoutMs\n );\n return this.formatInscriptionResult(result, options);\n } catch (error) {\n const errorMessage =\n error instanceof Error\n ? error.message\n : 'Failed to inscribe from buffer';\n throw new Error(`Inscription failed: ${errorMessage}`);\n }\n }\n\n private validateInput(\n params: z.infer<typeof inscribeFromBufferSchema>\n ): void {\n if (!params.base64Data || params.base64Data.trim() === '') {\n throw new Error(\n 'No data provided. Cannot inscribe empty content. Please provide valid content, plain text, base64 encoded data, or a content reference ID.'\n );\n }\n\n if (!params.fileName || params.fileName.trim() === '') {\n throw new Error(\n 'No fileName provided. A valid fileName is required for inscription.'\n );\n }\n }\n\n private validateContent(buffer: Buffer): void {\n if (buffer.length === 0) {\n throw new Error(\n 'Buffer is empty after conversion. The provided data appears to be invalid or empty.'\n );\n }\n\n if (buffer.length > this.config.maxInscriptionSize) {\n const maxSizeKB = Math.round(this.config.maxInscriptionSize / 1024);\n const bufferSizeKB = Math.round(buffer.length / 1024);\n throw new Error(\n `Content is too large for inscription (${bufferSizeKB}KB, max ${maxSizeKB}KB). Please summarize or extract key information before inscribing.`\n );\n }\n\n if (buffer.length < this.config.minContentSize) {\n throw new Error(\n `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\n if (\n buffer.toString('utf8', 0, Math.min(buffer.length, 100)).trim() === ''\n ) {\n throw new Error(\n 'Buffer contains only whitespace or empty content. Cannot inscribe meaningless data.'\n );\n }\n\n const contentStr = buffer.toString('utf8');\n const emptyHtmlPattern = /<a\\s+href=[\"'][^\"']+[\"']\\s*>\\s*<\\/a>/i;\n const hasOnlyEmptyLinks =\n emptyHtmlPattern.test(contentStr) &&\n contentStr.replace(/<[^>]+>/g, '').trim().length < 50;\n\n if (hasOnlyEmptyLinks) {\n throw new Error(\n 'Buffer contains empty HTML with only links and no actual content. When inscribing content from external sources, use the actual article text you retrieved, not empty HTML with links.'\n );\n }\n }\n\n private async executeInscription(\n buffer: Buffer,\n fileName: string,\n mimeType: string | undefined,\n options: InscriptionOptions,\n timeoutMs?: number\n ): Promise<Awaited<ReturnType<typeof this.inscriberBuilder.inscribe>>> {\n const inscriptionData = {\n type: 'buffer' as const,\n buffer,\n fileName,\n mimeType,\n };\n\n if (timeoutMs) {\n const timeoutPromise = new Promise<never>((_, reject) => {\n setTimeout(\n () => reject(new Error(`Inscription timed out after ${timeoutMs}ms`)),\n timeoutMs\n );\n });\n\n return Promise.race([\n this.inscriberBuilder.inscribe(inscriptionData, options),\n timeoutPromise,\n ]);\n }\n\n return this.inscriberBuilder.inscribe(inscriptionData, options);\n }\n\n private formatInscriptionResult(\n result: Awaited<ReturnType<typeof this.inscriberBuilder.inscribe>>,\n options: InscriptionOptions\n ): string {\n if (result.confirmed && !result.quote) {\n const topicId =\n result.inscription?.topic_id || (result.result as any).topicId;\n const network = options.network || 'testnet';\n const cdnUrl = topicId\n ? `https://kiloscribe.com/api/inscription-cdn/${topicId}?network=${network}`\n : null;\n return `Successfully inscribed and confirmed content on the Hedera network!\\n\\nTransaction ID: ${\n (result.result as any).transactionId\n }\\nTopic ID: ${topicId || 'N/A'}${\n cdnUrl ? `\\nView inscription: ${cdnUrl}` : ''\n }\\n\\nThe inscription is now available.`;\n }\n\n if (!result.quote && !result.confirmed) {\n return `Successfully submitted inscription to the Hedera network!\\n\\nTransaction ID: ${\n (result.result as any).transactionId\n }\\n\\nThe inscription is processing and will be confirmed shortly.`;\n }\n\n return 'Inscription operation completed.';\n }\n\n}\n"],"names":[],"mappings":";;;;;AAQA,MAAM,2BAA2B,EAAE,OAAO;AAAA,EACxC,YAAY,EAAE,MAAM,CAAC,EAAE,OAAA,GAAU,gBAAgB,CAAC,EAC/C,SAAS,sEAAsE;AAAA,EAClF,UAAU,EAAE,OAAA,EAAS,IAAI,CAAC,EAAE,SAAS,gCAAgC;AAAA,EACrE,UAAU,EAAE,OAAA,EAAS,SAAA,EAAW,SAAS,0BAA0B;AAAA,EACnE,UAAU,EAAE,OAAO,EAAE,QAAA,CAAS,EAAE,SAAA,EAAW,SAAS,oBAAoB;AAAA,EACxE,MAAM,EAAE,MAAM,EAAE,OAAA,CAAQ,EAAE,SAAA,EAAW,SAAS,oCAAoC;AAAA,EAClF,WAAW,EAAE,OAAA,EAAS,IAAA,EAAM,SAAA,EAAW,SAAA,EAAW,SAAS,4BAA4B;AAAA,EACvF,qBAAqB,EAAE,QAAA,EAAU,SAAA,EAAW,SAAS,mCAAmC;AAAA,EACxF,WAAW,EAAE,OAAA,EAAS,IAAA,EAAM,SAAA,EAAW,SAAA,EAAW,SAAS,yBAAyB;AAAA,EACpF,QAAQ,EAAE,OAAA,EAAS,SAAA,EAAW,SAAS,iCAAiC;AAAA,EACxE,WAAW,EAAE,UAAU,SAAA,EAAW,QAAQ,KAAK,EAAE,SAA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AAM,KAAK,EAC7C;AAAA;AAAA;AAAA,IACF;AAEA,QAAI,CAAC,OAAO,SAAS,CAAC,OAAO,WAAW;AACtC,aAAO;AAAA;AAAA,kBACJ,OAAO,OAAe,aACzB;AAAA;AAAA;AAAA,IACF;AAEA,WAAO;AAAA,EACT;AAEF;"}
1
+ {"version":3,"file":"standards-agent-kit.es36.js","sources":["../../src/tools/inscriber/InscribeFromUrlTool.ts"],"sourcesContent":["import { z } from 'zod';\nimport { BaseInscriberQueryTool } from './base-inscriber-tools';\nimport { InscriptionOptions, Logger, InscriptionResponse } from '@hashgraphonline/standards-sdk';\nimport { CallbackManagerForToolRun } from '@langchain/core/callbacks/manager';\nimport { extractTopicIds, buildInscriptionLinks } from '../../utils/inscription-utils';\n\nconst logger = new Logger({ module: 'InscribeFromUrlTool' });\n\n/**\n * Schema for inscribing from URL\n */\nconst inscribeFromUrlSchema = z.object({\n url: z\n .string()\n .url()\n .describe(\n 'ONLY direct file download URLs with file extensions (.pdf, .jpg, .png, .json, .zip). NEVER use for web pages, articles, or when you already have content to inscribe.'\n ),\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(\n 'Timeout in milliseconds for inscription (default: no timeout - waits until completion)'\n ),\n apiKey: z.string().optional().describe('API key for inscription service'),\n quoteOnly: z\n .boolean()\n .optional()\n .default(false)\n .describe(\n 'If true, returns a cost quote instead of executing the inscription'\n ),\n});\n\n/**\n * Tool for inscribing content from URL\n */\nexport class InscribeFromUrlTool extends BaseInscriberQueryTool<\n typeof inscribeFromUrlSchema\n> {\n name = 'inscribeFromUrl';\n description =\n 'ONLY for direct FILE DOWNLOAD URLs ending with file extensions (.pdf, .jpg, .png, .json, .zip). NEVER use for web pages, articles, or ANY HTML content - it WILL FAIL. If you have already retrieved content from any source (including MCP tools), you MUST use inscribeFromBuffer instead. This tool downloads files from URLs - it does NOT inscribe content you already have. When asked to \"inscribe it\" after retrieving content, ALWAYS use inscribeFromBuffer with the actual content. Set quoteOnly=true to get cost estimates without executing the 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 logger.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(\n 'Invalid URL format. Please provide a complete URL with protocol (http/https).'\n );\n }\n if (!['http:', 'https:'].includes(urlObj.protocol)) {\n throw new Error(\n 'Only HTTP and HTTPS URLs are supported for inscription.'\n );\n }\n } catch (error) {\n if (\n error instanceof Error &&\n error.message.includes('Cannot inscribe content from')\n ) {\n throw error;\n }\n throw new Error(\n `Invalid URL: ${params.url}. Please provide a valid URL.`\n );\n }\n\n logger.info('Validating URL content before inscription...');\n try {\n const controller = new AbortController();\n const timeoutId = setTimeout(() => controller.abort(), 10000);\n\n try {\n const headResponse = await fetch(params.url, {\n method: 'HEAD',\n signal: controller.signal,\n });\n\n clearTimeout(timeoutId);\n\n if (!headResponse.ok) {\n throw new Error(\n `URL returned error status ${headResponse.status}: ${headResponse.statusText}. Cannot inscribe content from inaccessible URLs.`\n );\n }\n\n const contentType = headResponse.headers.get('content-type') || '';\n const contentLength = headResponse.headers.get('content-length');\n\n const webPageContentTypes = [\n 'text/html',\n 'application/xhtml+xml',\n 'text/xml',\n ];\n\n if (\n webPageContentTypes.some((type) =>\n contentType.toLowerCase().includes(type)\n )\n ) {\n throw new Error(\n `URL returns HTML/web page content (Content-Type: ${contentType}). This tool only works with direct file URLs (PDFs, images, JSON, etc.). For web page content, first retrieve the content using the appropriate MCP tool or web scraper, then use inscribeFromBuffer to inscribe it.`\n );\n }\n\n if (contentLength && parseInt(contentLength) === 0) {\n throw new Error(\n 'URL returns empty content (Content-Length: 0). Cannot inscribe empty content.'\n );\n }\n\n if (contentLength && parseInt(contentLength) < 10) {\n throw new Error(\n `URL content is too small (${contentLength} bytes). Content must be at least 10 bytes.`\n );\n }\n\n if (!contentType || contentType === 'application/octet-stream') {\n logger.info('Content-Type unclear, fetching first 1KB to verify...');\n\n const getController = new AbortController();\n const getTimeoutId = setTimeout(() => getController.abort(), 5000);\n\n try {\n const getResponse = await fetch(params.url, {\n signal: getController.signal,\n headers: {\n Range: 'bytes=0-1023', // Get first 1KB\n },\n });\n\n clearTimeout(getTimeoutId);\n\n if (getResponse.ok || getResponse.status === 206) {\n\n const buffer = await getResponse.arrayBuffer();\n const bytes = new Uint8Array(buffer);\n const text = new TextDecoder('utf-8', { fatal: false }).decode(\n bytes.slice(0, 512)\n );\n\n if (\n text.toLowerCase().includes('<!doctype html') ||\n text.toLowerCase().includes('<html') ||\n text.match(/<meta\\s+[^>]*>/i) ||\n text.match(/<title>/i)\n ) {\n throw new Error(\n `URL returns HTML content. This tool only works with direct file URLs. For web page content, first retrieve it using the appropriate tool, then use inscribeFromBuffer.`\n );\n }\n }\n } catch (getError) {\n clearTimeout(getTimeoutId);\n if (\n getError instanceof Error &&\n getError.message.includes('HTML content')\n ) {\n throw getError;\n }\n logger.warn(\n `Could not perform partial GET validation: ${\n getError instanceof Error ? getError.message : 'Unknown error'\n }`\n );\n }\n }\n\n logger.info(\n `URL validation passed. Content-Type: ${contentType}, Content-Length: ${\n contentLength || 'unknown'\n }`\n );\n } catch (fetchError) {\n clearTimeout(timeoutId);\n throw fetchError;\n }\n } catch (error) {\n if (error instanceof Error) {\n if (error.name === 'AbortError') {\n logger.warn(\n 'URL validation timed out after 10 seconds. Proceeding with inscription attempt.'\n );\n } else if (\n error.message.includes('URL returned error') ||\n error.message.includes('empty content') ||\n error.message.includes('too small') ||\n error.message.includes('HTML')\n ) {\n throw error;\n } else {\n logger.warn(\n `Could not validate URL with HEAD request: ${error.message}. Proceeding with inscription attempt.`\n );\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.quoteOnly\n ? false\n : params.waitForConfirmation ?? true,\n waitMaxAttempts: 60,\n waitIntervalMs: 5000,\n apiKey: params.apiKey,\n network: this.inscriberBuilder['hederaKit'].client.network\n .toString()\n .includes('mainnet')\n ? 'mainnet'\n : 'testnet',\n quoteOnly: params.quoteOnly,\n };\n\n if (params.quoteOnly) {\n try {\n const quote = await this.generateInscriptionQuote(\n { type: 'url', url: params.url },\n options\n );\n\n return {\n success: true,\n quote: {\n totalCostHbar: quote.totalCostHbar,\n validUntil: quote.validUntil,\n breakdown: quote.breakdown,\n },\n contentInfo: {\n url: params.url,\n },\n message: `Estimated Quote for URL: ${params.url}\\nTotal cost: ${quote.totalCostHbar} HBAR`,\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error\n ? error.message\n : 'Failed to generate inscription quote';\n throw new Error(`Quote generation failed: ${errorMessage}`);\n }\n }\n\n try {\n let result: Awaited<ReturnType<typeof this.inscriberBuilder.inscribe>>;\n\n if (params.timeoutMs) {\n const timeoutPromise = new Promise<never>((_, reject) => {\n setTimeout(\n () =>\n reject(\n new Error(`Inscription timed out after ${params.timeoutMs}ms`)\n ),\n params.timeoutMs\n );\n });\n\n result = await Promise.race([\n this.inscriberBuilder.inscribe(\n { type: 'url', url: params.url },\n options\n ),\n timeoutPromise,\n ]);\n } else {\n result = await this.inscriberBuilder.inscribe(\n { type: 'url', url: params.url },\n options\n );\n }\n\n const typed = result as InscriptionResponse;\n\n if (typed.confirmed && !typed.quote) {\n const ids = extractTopicIds(typed.inscription, typed.result);\n const network = (options.network || 'testnet') as 'mainnet' | 'testnet';\n const { topicId, cdnUrl } = buildInscriptionLinks(\n ids,\n network,\n '1'\n );\n return `Successfully inscribed and confirmed content on the Hedera network!\\n\\nTransaction ID: ${\n (typed.result as { transactionId?: string })?.transactionId ?? 'unknown'\n }\\nTopic ID: ${topicId || 'N/A'}${\n cdnUrl ? `\\nView inscription: ${cdnUrl}` : ''\n }\\n\\nThe inscription is now available.`;\n } else if (!typed.quote && !typed.confirmed) {\n return `Successfully submitted inscription to the Hedera network!\\n\\nTransaction ID: ${\n (typed.result as { transactionId?: string })?.transactionId ?? 'unknown'\n }\\n\\nThe inscription is processing and will be confirmed shortly.`;\n } else {\n return 'Inscription operation completed.';\n }\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'Failed to inscribe from URL';\n throw new Error(`Inscription failed: ${errorMessage}`);\n }\n }\n}\n"],"names":[],"mappings":";;;;AAMA,MAAM,SAAS,IAAI,OAAO,EAAE,QAAQ,uBAAuB;AAK3D,MAAM,wBAAwB,EAAE,OAAO;AAAA,EACrC,KAAK,EACF,SACA,MACA;AAAA,IACC;AAAA,EAAA;AAAA,EAEJ,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,WAAW,EACR,SACA,MACA,SAAA,EACA,SAAA,EACA;AAAA,IACC;AAAA,EAAA;AAAA,E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