@hashgraphonline/standards-agent-kit 0.2.113 → 0.2.115
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/dist/cjs/standards-agent-kit.cjs +1 -1
- package/dist/cjs/standards-agent-kit.cjs.map +1 -1
- package/dist/cjs/tools/inscriber/InscribeFromBufferTool.d.ts +4 -4
- package/dist/cjs/tools/inscriber/InscribeFromFileTool.d.ts +2 -2
- package/dist/cjs/tools/inscriber/InscribeFromUrlTool.d.ts +6 -0
- package/dist/cjs/tools/inscriber/InscribeHashinalTool.d.ts +6 -0
- package/dist/es/standards-agent-kit.es33.js +22 -10
- package/dist/es/standards-agent-kit.es33.js.map +1 -1
- package/dist/es/standards-agent-kit.es35.js +2 -2
- package/dist/es/standards-agent-kit.es35.js.map +1 -1
- package/dist/es/standards-agent-kit.es36.js +20 -8
- package/dist/es/standards-agent-kit.es36.js.map +1 -1
- package/dist/es/tools/inscriber/InscribeFromBufferTool.d.ts +4 -4
- package/dist/es/tools/inscriber/InscribeFromFileTool.d.ts +2 -2
- package/dist/es/tools/inscriber/InscribeFromUrlTool.d.ts +6 -0
- package/dist/es/tools/inscriber/InscribeHashinalTool.d.ts +6 -0
- package/dist/umd/standards-agent-kit.umd.js +1 -1
- package/dist/umd/standards-agent-kit.umd.js.map +1 -1
- package/dist/umd/tools/inscriber/InscribeFromBufferTool.d.ts +4 -4
- package/dist/umd/tools/inscriber/InscribeFromFileTool.d.ts +2 -2
- package/dist/umd/tools/inscriber/InscribeFromUrlTool.d.ts +6 -0
- package/dist/umd/tools/inscriber/InscribeHashinalTool.d.ts +6 -0
- package/package.json +1 -1
- package/src/tools/inscriber/InscribeFromBufferTool.ts +4 -4
- package/src/tools/inscriber/InscribeFromUrlTool.ts +28 -10
- package/src/tools/inscriber/InscribeHashinalTool.ts +26 -8
|
@@ -24,8 +24,8 @@ declare const inscribeFromBufferSchema: z.ZodObject<{
|
|
|
24
24
|
mode?: "file" | "hashinal" | undefined;
|
|
25
25
|
chunkSize?: number | undefined;
|
|
26
26
|
waitForConfirmation?: boolean | undefined;
|
|
27
|
-
apiKey?: string | undefined;
|
|
28
27
|
timeoutMs?: number | undefined;
|
|
28
|
+
apiKey?: string | undefined;
|
|
29
29
|
}, {
|
|
30
30
|
fileName: string;
|
|
31
31
|
base64Data: string;
|
|
@@ -35,8 +35,8 @@ declare const inscribeFromBufferSchema: z.ZodObject<{
|
|
|
35
35
|
mode?: "file" | "hashinal" | undefined;
|
|
36
36
|
chunkSize?: number | undefined;
|
|
37
37
|
waitForConfirmation?: boolean | undefined;
|
|
38
|
-
apiKey?: string | undefined;
|
|
39
38
|
timeoutMs?: number | undefined;
|
|
39
|
+
apiKey?: string | undefined;
|
|
40
40
|
}>;
|
|
41
41
|
/**
|
|
42
42
|
* Tool for inscribing content from buffer
|
|
@@ -64,8 +64,8 @@ export declare class InscribeFromBufferTool extends BaseInscriberQueryTool<typeo
|
|
|
64
64
|
mode?: "file" | "hashinal" | undefined;
|
|
65
65
|
chunkSize?: number | undefined;
|
|
66
66
|
waitForConfirmation?: boolean | undefined;
|
|
67
|
-
apiKey?: string | undefined;
|
|
68
67
|
timeoutMs?: number | undefined;
|
|
68
|
+
apiKey?: string | undefined;
|
|
69
69
|
}, {
|
|
70
70
|
fileName: string;
|
|
71
71
|
base64Data: string;
|
|
@@ -75,8 +75,8 @@ export declare class InscribeFromBufferTool extends BaseInscriberQueryTool<typeo
|
|
|
75
75
|
mode?: "file" | "hashinal" | undefined;
|
|
76
76
|
chunkSize?: number | undefined;
|
|
77
77
|
waitForConfirmation?: boolean | undefined;
|
|
78
|
-
apiKey?: string | undefined;
|
|
79
78
|
timeoutMs?: number | undefined;
|
|
79
|
+
apiKey?: string | undefined;
|
|
80
80
|
}>;
|
|
81
81
|
protected executeQuery(params: z.infer<typeof inscribeFromBufferSchema>, _runManager?: CallbackManagerForToolRun): Promise<unknown>;
|
|
82
82
|
}
|
|
@@ -20,8 +20,8 @@ declare const inscribeFromFileSchema: z.ZodObject<{
|
|
|
20
20
|
mode?: "file" | "hashinal" | undefined;
|
|
21
21
|
chunkSize?: number | undefined;
|
|
22
22
|
waitForConfirmation?: boolean | undefined;
|
|
23
|
-
apiKey?: string | undefined;
|
|
24
23
|
timeoutMs?: number | undefined;
|
|
24
|
+
apiKey?: string | undefined;
|
|
25
25
|
}, {
|
|
26
26
|
filePath: string;
|
|
27
27
|
tags?: string[] | undefined;
|
|
@@ -29,8 +29,8 @@ declare const inscribeFromFileSchema: z.ZodObject<{
|
|
|
29
29
|
mode?: "file" | "hashinal" | undefined;
|
|
30
30
|
chunkSize?: number | undefined;
|
|
31
31
|
waitForConfirmation?: boolean | undefined;
|
|
32
|
-
apiKey?: string | undefined;
|
|
33
32
|
timeoutMs?: number | undefined;
|
|
33
|
+
apiKey?: string | undefined;
|
|
34
34
|
}>;
|
|
35
35
|
/**
|
|
36
36
|
* Tool for inscribing content from file
|
|
@@ -11,6 +11,7 @@ declare const inscribeFromUrlSchema: z.ZodObject<{
|
|
|
11
11
|
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
12
12
|
chunkSize: z.ZodOptional<z.ZodNumber>;
|
|
13
13
|
waitForConfirmation: z.ZodOptional<z.ZodBoolean>;
|
|
14
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
14
15
|
apiKey: z.ZodOptional<z.ZodString>;
|
|
15
16
|
}, "strip", z.ZodTypeAny, {
|
|
16
17
|
url: string;
|
|
@@ -19,6 +20,7 @@ declare const inscribeFromUrlSchema: z.ZodObject<{
|
|
|
19
20
|
mode?: "file" | "hashinal" | undefined;
|
|
20
21
|
chunkSize?: number | undefined;
|
|
21
22
|
waitForConfirmation?: boolean | undefined;
|
|
23
|
+
timeoutMs?: number | undefined;
|
|
22
24
|
apiKey?: string | undefined;
|
|
23
25
|
}, {
|
|
24
26
|
url: string;
|
|
@@ -27,6 +29,7 @@ declare const inscribeFromUrlSchema: z.ZodObject<{
|
|
|
27
29
|
mode?: "file" | "hashinal" | undefined;
|
|
28
30
|
chunkSize?: number | undefined;
|
|
29
31
|
waitForConfirmation?: boolean | undefined;
|
|
32
|
+
timeoutMs?: number | undefined;
|
|
30
33
|
apiKey?: string | undefined;
|
|
31
34
|
}>;
|
|
32
35
|
/**
|
|
@@ -42,6 +45,7 @@ export declare class InscribeFromUrlTool extends BaseInscriberQueryTool<typeof i
|
|
|
42
45
|
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
43
46
|
chunkSize: z.ZodOptional<z.ZodNumber>;
|
|
44
47
|
waitForConfirmation: z.ZodOptional<z.ZodBoolean>;
|
|
48
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
45
49
|
apiKey: z.ZodOptional<z.ZodString>;
|
|
46
50
|
}, "strip", z.ZodTypeAny, {
|
|
47
51
|
url: string;
|
|
@@ -50,6 +54,7 @@ export declare class InscribeFromUrlTool extends BaseInscriberQueryTool<typeof i
|
|
|
50
54
|
mode?: "file" | "hashinal" | undefined;
|
|
51
55
|
chunkSize?: number | undefined;
|
|
52
56
|
waitForConfirmation?: boolean | undefined;
|
|
57
|
+
timeoutMs?: number | undefined;
|
|
53
58
|
apiKey?: string | undefined;
|
|
54
59
|
}, {
|
|
55
60
|
url: string;
|
|
@@ -58,6 +63,7 @@ export declare class InscribeFromUrlTool extends BaseInscriberQueryTool<typeof i
|
|
|
58
63
|
mode?: "file" | "hashinal" | undefined;
|
|
59
64
|
chunkSize?: number | undefined;
|
|
60
65
|
waitForConfirmation?: boolean | undefined;
|
|
66
|
+
timeoutMs?: number | undefined;
|
|
61
67
|
apiKey?: string | undefined;
|
|
62
68
|
}>;
|
|
63
69
|
protected executeQuery(params: z.infer<typeof inscribeFromUrlSchema>, _runManager?: CallbackManagerForToolRun): Promise<unknown>;
|
|
@@ -25,6 +25,7 @@ declare const inscribeHashinalSchema: z.ZodObject<{
|
|
|
25
25
|
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
26
26
|
chunkSize: z.ZodOptional<z.ZodNumber>;
|
|
27
27
|
waitForConfirmation: z.ZodOptional<z.ZodBoolean>;
|
|
28
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
28
29
|
apiKey: z.ZodOptional<z.ZodString>;
|
|
29
30
|
}, "strip", z.ZodTypeAny, {
|
|
30
31
|
url: string;
|
|
@@ -36,6 +37,7 @@ declare const inscribeHashinalSchema: z.ZodObject<{
|
|
|
36
37
|
properties?: Record<string, unknown> | undefined;
|
|
37
38
|
chunkSize?: number | undefined;
|
|
38
39
|
waitForConfirmation?: boolean | undefined;
|
|
40
|
+
timeoutMs?: number | undefined;
|
|
39
41
|
apiKey?: string | undefined;
|
|
40
42
|
attributes?: {
|
|
41
43
|
value: string | number;
|
|
@@ -52,6 +54,7 @@ declare const inscribeHashinalSchema: z.ZodObject<{
|
|
|
52
54
|
properties?: Record<string, unknown> | undefined;
|
|
53
55
|
chunkSize?: number | undefined;
|
|
54
56
|
waitForConfirmation?: boolean | undefined;
|
|
57
|
+
timeoutMs?: number | undefined;
|
|
55
58
|
apiKey?: string | undefined;
|
|
56
59
|
attributes?: {
|
|
57
60
|
value: string | number;
|
|
@@ -86,6 +89,7 @@ export declare class InscribeHashinalTool extends BaseInscriberQueryTool<typeof
|
|
|
86
89
|
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
87
90
|
chunkSize: z.ZodOptional<z.ZodNumber>;
|
|
88
91
|
waitForConfirmation: z.ZodOptional<z.ZodBoolean>;
|
|
92
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
89
93
|
apiKey: z.ZodOptional<z.ZodString>;
|
|
90
94
|
}, "strip", z.ZodTypeAny, {
|
|
91
95
|
url: string;
|
|
@@ -97,6 +101,7 @@ export declare class InscribeHashinalTool extends BaseInscriberQueryTool<typeof
|
|
|
97
101
|
properties?: Record<string, unknown> | undefined;
|
|
98
102
|
chunkSize?: number | undefined;
|
|
99
103
|
waitForConfirmation?: boolean | undefined;
|
|
104
|
+
timeoutMs?: number | undefined;
|
|
100
105
|
apiKey?: string | undefined;
|
|
101
106
|
attributes?: {
|
|
102
107
|
value: string | number;
|
|
@@ -113,6 +118,7 @@ export declare class InscribeHashinalTool extends BaseInscriberQueryTool<typeof
|
|
|
113
118
|
properties?: Record<string, unknown> | undefined;
|
|
114
119
|
chunkSize?: number | undefined;
|
|
115
120
|
waitForConfirmation?: boolean | undefined;
|
|
121
|
+
timeoutMs?: number | undefined;
|
|
116
122
|
apiKey?: string | undefined;
|
|
117
123
|
attributes?: {
|
|
118
124
|
value: string | number;
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { BaseInscriberQueryTool } from "./standards-agent-kit.es32.js";
|
|
3
3
|
const inscribeFromUrlSchema = z.object({
|
|
4
|
-
url: z.string().url().describe("
|
|
4
|
+
url: z.string().url().describe("ONLY direct file download URLs ending in .pdf, .jpg, .png, .json, .zip etc. NOT for web pages or articles"),
|
|
5
5
|
mode: z.enum(["file", "hashinal"]).optional().describe("Inscription mode: file or hashinal NFT"),
|
|
6
6
|
metadata: z.record(z.unknown()).optional().describe("Metadata to attach to the inscription"),
|
|
7
7
|
tags: z.array(z.string()).optional().describe("Tags to categorize the inscription"),
|
|
8
8
|
chunkSize: z.number().int().positive().optional().describe("Chunk size for large files"),
|
|
9
9
|
waitForConfirmation: z.boolean().optional().describe("Whether to wait for inscription confirmation"),
|
|
10
|
+
timeoutMs: z.number().int().positive().optional().describe("Timeout in milliseconds for inscription (default: no timeout - waits until completion)"),
|
|
10
11
|
apiKey: z.string().optional().describe("API key for inscription service")
|
|
11
12
|
});
|
|
12
13
|
class InscribeFromUrlTool extends BaseInscriberQueryTool {
|
|
13
14
|
constructor() {
|
|
14
15
|
super(...arguments);
|
|
15
16
|
this.name = "inscribeFromUrl";
|
|
16
|
-
this.description = "
|
|
17
|
+
this.description = "DO NOT use this for web pages, articles, or HTML content - it will FAIL. ONLY use for direct file downloads like PDFs, images, JSON, ZIP files. If user asks to inscribe a web page article, DO NOT use this tool. Valid examples: .pdf, .jpg, .png, .json, .zip files. Invalid examples: any web page, news article, blog post, social media content. For those, retrieve the content first then use inscribeFromBuffer.";
|
|
17
18
|
}
|
|
18
19
|
get specificInputSchema() {
|
|
19
20
|
return inscribeFromUrlSchema;
|
|
@@ -120,16 +121,27 @@ class InscribeFromUrlTool extends BaseInscriberQueryTool {
|
|
|
120
121
|
network: this.inscriberBuilder["hederaKit"].client.network.toString().includes("mainnet") ? "mainnet" : "testnet"
|
|
121
122
|
};
|
|
122
123
|
try {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
124
|
+
let result;
|
|
125
|
+
if (params.timeoutMs) {
|
|
126
|
+
const timeoutPromise = new Promise((_, reject) => {
|
|
127
|
+
setTimeout(
|
|
128
|
+
() => reject(new Error(`Inscription timed out after ${params.timeoutMs}ms`)),
|
|
129
|
+
params.timeoutMs
|
|
130
|
+
);
|
|
131
|
+
});
|
|
132
|
+
result = await Promise.race([
|
|
133
|
+
this.inscriberBuilder.inscribe(
|
|
134
|
+
{ type: "url", url: params.url },
|
|
135
|
+
options
|
|
136
|
+
),
|
|
137
|
+
timeoutPromise
|
|
138
|
+
]);
|
|
139
|
+
} else {
|
|
140
|
+
result = await this.inscriberBuilder.inscribe(
|
|
128
141
|
{ type: "url", url: params.url },
|
|
129
142
|
options
|
|
130
|
-
)
|
|
131
|
-
|
|
132
|
-
]);
|
|
143
|
+
);
|
|
144
|
+
}
|
|
133
145
|
if (result.confirmed) {
|
|
134
146
|
const topicId = result.inscription?.topic_id || result.result.topicId;
|
|
135
147
|
const network = options.network || "testnet";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standards-agent-kit.es33.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 ONLY from URLs that point directly to downloadable files (PDF, image, JSON, ZIP, etc). This tool will FAIL for web pages, news sites, or social media. Examples of VALID URLs: https://example.com/document.pdf, https://cdn.example.com/image.jpg, https://api.example.com/data.json. For web page articles or any content you retrieve via MCP tools, you MUST use inscribeFromBuffer instead after retrieving the content.';\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 // First try HEAD request\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(`URL returned error status ${headResponse.status}: ${headResponse.statusText}. Cannot inscribe content from inaccessible URLs.`);\n }\n\n const contentType = headResponse.headers.get('content-type') || '';\n const contentLength = headResponse.headers.get('content-length');\n \n // Check if content type indicates HTML/web page\n const webPageContentTypes = [\n 'text/html',\n 'application/xhtml+xml',\n 'text/xml'\n ];\n \n if (webPageContentTypes.some(type => contentType.toLowerCase().includes(type))) {\n throw new Error(`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 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 // If HEAD doesn't provide content-type, do a partial GET to check\n if (!contentType || contentType === 'application/octet-stream') {\n console.log(`[InscribeFromUrlTool] 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) { // 206 is partial content\n const buffer = await getResponse.arrayBuffer();\n const bytes = new Uint8Array(buffer);\n const text = new TextDecoder('utf-8', { fatal: false }).decode(bytes.slice(0, 512));\n \n // Check if it looks like HTML\n if (text.toLowerCase().includes('<!doctype html') || \n text.toLowerCase().includes('<html') ||\n text.match(/<meta\\s+[^>]*>/i) ||\n text.match(/<title>/i)) {\n throw new Error(`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 } catch (getError) {\n clearTimeout(getTimeoutId);\n if (getError instanceof Error && getError.message.includes('HTML content')) {\n throw getError;\n }\n // If partial GET fails, continue anyway\n console.log(`[InscribeFromUrlTool] Could not perform partial GET validation: ${getError instanceof Error ? getError.message : 'Unknown error'}`);\n }\n }\n\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') || error.message.includes('HTML')) {\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,CA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7M,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.es33.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('ONLY direct file download URLs ending in .pdf, .jpg, .png, .json, .zip etc. NOT for web pages or articles'),\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 - waits until completion)'),\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 = 'DO NOT use this for web pages, articles, or HTML content - it will FAIL. ONLY use for direct file downloads like PDFs, images, JSON, ZIP files. If user asks to inscribe a web page article, DO NOT use this tool. Valid examples: .pdf, .jpg, .png, .json, .zip files. Invalid examples: any web page, news article, blog post, social media content. For those, retrieve the content first then use inscribeFromBuffer.';\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 // First try HEAD request\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(`URL returned error status ${headResponse.status}: ${headResponse.statusText}. Cannot inscribe content from inaccessible URLs.`);\n }\n\n const contentType = headResponse.headers.get('content-type') || '';\n const contentLength = headResponse.headers.get('content-length');\n \n // Check if content type indicates HTML/web page\n const webPageContentTypes = [\n 'text/html',\n 'application/xhtml+xml',\n 'text/xml'\n ];\n \n if (webPageContentTypes.some(type => contentType.toLowerCase().includes(type))) {\n throw new Error(`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 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 // If HEAD doesn't provide content-type, do a partial GET to check\n if (!contentType || contentType === 'application/octet-stream') {\n console.log(`[InscribeFromUrlTool] 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) { // 206 is partial content\n const buffer = await getResponse.arrayBuffer();\n const bytes = new Uint8Array(buffer);\n const text = new TextDecoder('utf-8', { fatal: false }).decode(bytes.slice(0, 512));\n \n // Check if it looks like HTML\n if (text.toLowerCase().includes('<!doctype html') || \n text.toLowerCase().includes('<html') ||\n text.match(/<meta\\s+[^>]*>/i) ||\n text.match(/<title>/i)) {\n throw new Error(`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 } catch (getError) {\n clearTimeout(getTimeoutId);\n if (getError instanceof Error && getError.message.includes('HTML content')) {\n throw getError;\n }\n // If partial GET fails, continue anyway\n console.log(`[InscribeFromUrlTool] Could not perform partial GET validation: ${getError instanceof Error ? getError.message : 'Unknown error'}`);\n }\n }\n\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') || error.message.includes('HTML')) {\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 let result: Awaited<ReturnType<typeof this.inscriberBuilder.inscribe>>;\n \n if (params.timeoutMs) {\n const timeoutPromise = new Promise<never>((_, 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 { 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 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,2GAA2G;AAAA,EAC1I,MAAM,EACH,KAAK,CAAC,QAAQ,UAAU,CAAC,EACzB,SAAA,EACA,SAAS,wCAAwC;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optional().describe("Tags to categorize the inscription"),
|
|
10
10
|
chunkSize: z.number().int().positive().optional().describe("Chunk size for large files"),
|
|
11
11
|
waitForConfirmation: z.boolean().optional().describe("Whether to wait for inscription confirmation"),
|
|
12
|
-
timeoutMs: z.number().int().positive().optional().describe("Timeout in milliseconds for inscription (default: no timeout)"),
|
|
12
|
+
timeoutMs: z.number().int().positive().optional().describe("Timeout in milliseconds for inscription (default: no timeout - waits until completion)"),
|
|
13
13
|
apiKey: z.string().optional().describe("API key for inscription service")
|
|
14
14
|
});
|
|
15
15
|
class InscribeFromBufferTool extends BaseInscriberQueryTool {
|
|
16
16
|
constructor() {
|
|
17
17
|
super(...arguments);
|
|
18
18
|
this.name = "inscribeFromBuffer";
|
|
19
|
-
this.description = "
|
|
19
|
+
this.description = "Use this for ANY web page, article, or content you retrieve. If user asks to inscribe a web page or article, FIRST retrieve it, THEN use this tool. This is the CORRECT tool for: web pages, news articles, blog posts, social media content, API responses, or any text content. Steps: 1) Retrieve content, 2) Convert to base64, 3) Use this tool. DO NOT use inscribeFromUrl for web content.";
|
|
20
20
|
}
|
|
21
21
|
get specificInputSchema() {
|
|
22
22
|
return inscribeFromBufferSchema;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standards-agent-kit.es35.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 retrieved or generated. ALWAYS use this tool for: web page articles (after using MCP tools), API responses, text data, or any content from MCP tools. Steps: 1) Retrieve content using appropriate tool, 2) Convert to base64, 3) Use this tool. NEVER use inscribeFromUrl for web pages - that tool is ONLY for direct file downloads like PDFs or images.';\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;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,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,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.es35.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 - waits until completion)'),\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 = 'Use this for ANY web page, article, or content you retrieve. If user asks to inscribe a web page or article, FIRST retrieve it, THEN use this tool. This is the CORRECT tool for: web pages, news articles, blog posts, social media content, API responses, or any text content. Steps: 1) Retrieve content, 2) Convert to base64, 3) Use this tool. DO NOT use inscribeFromUrl for web 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: Awaited<ReturnType<typeof this.inscriberBuilder.inscribe>>;\n \n if (params.timeoutMs) {\n const timeoutPromise = new Promise<never>((_, 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;AAAA,EACnD,MAAM,EACH,MAAM,EAAE,OAAA,CAAQ,EAChB,SAAA,EACA,SAAS,oCAAoC;AAAA,EAChD,WAAW,EACR,OAAA,EACA,IAAA,EACA,SAAA,EAC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;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;"}
|
|
@@ -17,6 +17,7 @@ const inscribeHashinalSchema = z.object({
|
|
|
17
17
|
tags: z.array(z.string()).optional().describe("Tags to categorize the NFT"),
|
|
18
18
|
chunkSize: z.number().int().positive().optional().describe("Chunk size for large files"),
|
|
19
19
|
waitForConfirmation: z.boolean().optional().describe("Whether to wait for inscription confirmation"),
|
|
20
|
+
timeoutMs: z.number().int().positive().optional().describe("Timeout in milliseconds for inscription (default: no timeout - waits until completion)"),
|
|
20
21
|
apiKey: z.string().optional().describe("API key for inscription service")
|
|
21
22
|
});
|
|
22
23
|
class InscribeHashinalTool extends BaseInscriberQueryTool {
|
|
@@ -50,16 +51,27 @@ class InscribeHashinalTool extends BaseInscriberQueryTool {
|
|
|
50
51
|
network: this.inscriberBuilder["hederaKit"].client.network.toString().includes("mainnet") ? "mainnet" : "testnet"
|
|
51
52
|
};
|
|
52
53
|
try {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
let result;
|
|
55
|
+
if (params.timeoutMs) {
|
|
56
|
+
const timeoutPromise = new Promise((_, reject) => {
|
|
57
|
+
setTimeout(
|
|
58
|
+
() => reject(new Error(`Inscription timed out after ${params.timeoutMs}ms`)),
|
|
59
|
+
params.timeoutMs
|
|
60
|
+
);
|
|
61
|
+
});
|
|
62
|
+
result = await Promise.race([
|
|
63
|
+
this.inscriberBuilder.inscribe(
|
|
64
|
+
{ type: "url", url: params.url },
|
|
65
|
+
options
|
|
66
|
+
),
|
|
67
|
+
timeoutPromise
|
|
68
|
+
]);
|
|
69
|
+
} else {
|
|
70
|
+
result = await this.inscriberBuilder.inscribe(
|
|
58
71
|
{ type: "url", url: params.url },
|
|
59
72
|
options
|
|
60
|
-
)
|
|
61
|
-
|
|
62
|
-
]);
|
|
73
|
+
);
|
|
74
|
+
}
|
|
63
75
|
if (result.confirmed) {
|
|
64
76
|
const topicId = result.inscription?.topic_id || result.result.topicId;
|
|
65
77
|
const network = options.network || "testnet";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standards-agent-kit.es36.js","sources":["../../src/tools/inscriber/InscribeHashinalTool.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 Hashinal NFT\n */\nconst inscribeHashinalSchema = z.object({\n url: z.string().url().describe('The URL of the content to inscribe as Hashinal NFT'),\n name: z.string().describe('Name of the Hashinal NFT'),\n creator: z.string().describe('Creator account ID or name'),\n description: z.string().describe('Description of the Hashinal NFT'),\n type: z.string().describe('Type of NFT (e.g., \"image\", \"video\", \"audio\")'),\n attributes: z\n .array(\n z.object({\n trait_type: z.string(),\n value: z.union([z.string(), z.number()]),\n })\n )\n .optional()\n .describe('NFT attributes'),\n properties: z\n .record(z.unknown())\n .optional()\n .describe('Additional properties'),\n jsonFileURL: z\n .string()\n .url()\n .optional()\n .describe('URL to JSON metadata file'),\n tags: z\n .array(z.string())\n .optional()\n .describe('Tags to categorize the NFT'),\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 Hashinal NFTs\n */\nexport class InscribeHashinalTool extends BaseInscriberQueryTool<typeof inscribeHashinalSchema> {\n name = 'inscribeHashinal';\n description = 'Inscribe content as a Hashinal NFT on the Hedera network';\n\n get specificInputSchema() {\n return inscribeHashinalSchema;\n }\n\n protected async executeQuery(\n params: z.infer<typeof inscribeHashinalSchema>,\n _runManager?: CallbackManagerForToolRun\n ): Promise<unknown> {\n const metadata = {\n name: params.name,\n creator: params.creator,\n description: params.description,\n type: params.type,\n attributes: params.attributes,\n properties: params.properties,\n };\n\n const options: InscriptionOptions = {\n mode: 'hashinal',\n metadata,\n jsonFileURL: params.jsonFileURL,\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
|
|
1
|
+
{"version":3,"file":"standards-agent-kit.es36.js","sources":["../../src/tools/inscriber/InscribeHashinalTool.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 Hashinal NFT\n */\nconst inscribeHashinalSchema = z.object({\n url: z.string().url().describe('The URL of the content to inscribe as Hashinal NFT'),\n name: z.string().describe('Name of the Hashinal NFT'),\n creator: z.string().describe('Creator account ID or name'),\n description: z.string().describe('Description of the Hashinal NFT'),\n type: z.string().describe('Type of NFT (e.g., \"image\", \"video\", \"audio\")'),\n attributes: z\n .array(\n z.object({\n trait_type: z.string(),\n value: z.union([z.string(), z.number()]),\n })\n )\n .optional()\n .describe('NFT attributes'),\n properties: z\n .record(z.unknown())\n .optional()\n .describe('Additional properties'),\n jsonFileURL: z\n .string()\n .url()\n .optional()\n .describe('URL to JSON metadata file'),\n tags: z\n .array(z.string())\n .optional()\n .describe('Tags to categorize the NFT'),\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 - waits until completion)'),\n apiKey: z\n .string()\n .optional()\n .describe('API key for inscription service'),\n});\n\n\n/**\n * Tool for inscribing Hashinal NFTs\n */\nexport class InscribeHashinalTool extends BaseInscriberQueryTool<typeof inscribeHashinalSchema> {\n name = 'inscribeHashinal';\n description = 'Inscribe content as a Hashinal NFT on the Hedera network';\n\n get specificInputSchema() {\n return inscribeHashinalSchema;\n }\n\n protected async executeQuery(\n params: z.infer<typeof inscribeHashinalSchema>,\n _runManager?: CallbackManagerForToolRun\n ): Promise<unknown> {\n const metadata = {\n name: params.name,\n creator: params.creator,\n description: params.description,\n type: params.type,\n attributes: params.attributes,\n properties: params.properties,\n };\n\n const options: InscriptionOptions = {\n mode: 'hashinal',\n metadata,\n jsonFileURL: params.jsonFileURL,\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: Awaited<ReturnType<typeof this.inscriberBuilder.inscribe>>;\n \n if (params.timeoutMs) {\n const timeoutPromise = new Promise<never>((_, 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 { 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 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 Hashinal NFT on the Hedera network!\\n\\nTransaction ID: ${result.result.transactionId}\\nTopic ID: ${topicId || 'N/A'}${cdnUrl ? `\\nView inscription: ${cdnUrl}` : ''}\\n\\nThe Hashinal NFT is now available.`;\n } else {\n return `Successfully submitted Hashinal NFT 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 Hashinal NFT';\n throw new Error(`Inscription failed: ${errorMessage}`);\n }\n }\n}"],"names":[],"mappings":";;AAQA,MAAM,yBAAyB,EAAE,OAAO;AAAA,EACtC,KAAK,EAAE,OAAA,EAAS,IAAA,EAAM,SAAS,oDAAoD;AAAA,EACnF,MAAM,EAAE,SAAS,SAAS,0BAA0B;AAAA,EACpD,SAAS,EAAE,SAAS,SAAS,4BAA4B;AAAA,EACzD,aAAa,EAAE,SAAS,SAAS,iCAAiC;AAAA,EAClE,MAAM,EAAE,SAAS,SAAS,+CAA+C;AAAA,EACzE,YAAY,EACT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scribeFromBufferSchema: z.ZodObject<{
|
|
|
24
24
|
mode?: "file" | "hashinal" | undefined;
|
|
25
25
|
chunkSize?: number | undefined;
|
|
26
26
|
waitForConfirmation?: boolean | undefined;
|
|
27
|
-
apiKey?: string | undefined;
|
|
28
27
|
timeoutMs?: number | undefined;
|
|
28
|
+
apiKey?: string | undefined;
|
|
29
29
|
}, {
|
|
30
30
|
fileName: string;
|
|
31
31
|
base64Data: string;
|
|
@@ -35,8 +35,8 @@ declare const inscribeFromBufferSchema: z.ZodObject<{
|
|
|
35
35
|
mode?: "file" | "hashinal" | undefined;
|
|
36
36
|
chunkSize?: number | undefined;
|
|
37
37
|
waitForConfirmation?: boolean | undefined;
|
|
38
|
-
apiKey?: string | undefined;
|
|
39
38
|
timeoutMs?: number | undefined;
|
|
39
|
+
apiKey?: string | undefined;
|
|
40
40
|
}>;
|
|
41
41
|
/**
|
|
42
42
|
* Tool for inscribing content from buffer
|
|
@@ -64,8 +64,8 @@ export declare class InscribeFromBufferTool extends BaseInscriberQueryTool<typeo
|
|
|
64
64
|
mode?: "file" | "hashinal" | undefined;
|
|
65
65
|
chunkSize?: number | undefined;
|
|
66
66
|
waitForConfirmation?: boolean | undefined;
|
|
67
|
-
apiKey?: string | undefined;
|
|
68
67
|
timeoutMs?: number | undefined;
|
|
68
|
+
apiKey?: string | undefined;
|
|
69
69
|
}, {
|
|
70
70
|
fileName: string;
|
|
71
71
|
base64Data: string;
|
|
@@ -75,8 +75,8 @@ export declare class InscribeFromBufferTool extends BaseInscriberQueryTool<typeo
|
|
|
75
75
|
mode?: "file" | "hashinal" | undefined;
|
|
76
76
|
chunkSize?: number | undefined;
|
|
77
77
|
waitForConfirmation?: boolean | undefined;
|
|
78
|
-
apiKey?: string | undefined;
|
|
79
78
|
timeoutMs?: number | undefined;
|
|
79
|
+
apiKey?: string | undefined;
|
|
80
80
|
}>;
|
|
81
81
|
protected executeQuery(params: z.infer<typeof inscribeFromBufferSchema>, _runManager?: CallbackManagerForToolRun): Promise<unknown>;
|
|
82
82
|
}
|
|
@@ -20,8 +20,8 @@ declare const inscribeFromFileSchema: z.ZodObject<{
|
|
|
20
20
|
mode?: "file" | "hashinal" | undefined;
|
|
21
21
|
chunkSize?: number | undefined;
|
|
22
22
|
waitForConfirmation?: boolean | undefined;
|
|
23
|
-
apiKey?: string | undefined;
|
|
24
23
|
timeoutMs?: number | undefined;
|
|
24
|
+
apiKey?: string | undefined;
|
|
25
25
|
}, {
|
|
26
26
|
filePath: string;
|
|
27
27
|
tags?: string[] | undefined;
|
|
@@ -29,8 +29,8 @@ declare const inscribeFromFileSchema: z.ZodObject<{
|
|
|
29
29
|
mode?: "file" | "hashinal" | undefined;
|
|
30
30
|
chunkSize?: number | undefined;
|
|
31
31
|
waitForConfirmation?: boolean | undefined;
|
|
32
|
-
apiKey?: string | undefined;
|
|
33
32
|
timeoutMs?: number | undefined;
|
|
33
|
+
apiKey?: string | undefined;
|
|
34
34
|
}>;
|
|
35
35
|
/**
|
|
36
36
|
* Tool for inscribing content from file
|
|
@@ -11,6 +11,7 @@ declare const inscribeFromUrlSchema: z.ZodObject<{
|
|
|
11
11
|
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
12
12
|
chunkSize: z.ZodOptional<z.ZodNumber>;
|
|
13
13
|
waitForConfirmation: z.ZodOptional<z.ZodBoolean>;
|
|
14
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
14
15
|
apiKey: z.ZodOptional<z.ZodString>;
|
|
15
16
|
}, "strip", z.ZodTypeAny, {
|
|
16
17
|
url: string;
|
|
@@ -19,6 +20,7 @@ declare const inscribeFromUrlSchema: z.ZodObject<{
|
|
|
19
20
|
mode?: "file" | "hashinal" | undefined;
|
|
20
21
|
chunkSize?: number | undefined;
|
|
21
22
|
waitForConfirmation?: boolean | undefined;
|
|
23
|
+
timeoutMs?: number | undefined;
|
|
22
24
|
apiKey?: string | undefined;
|
|
23
25
|
}, {
|
|
24
26
|
url: string;
|
|
@@ -27,6 +29,7 @@ declare const inscribeFromUrlSchema: z.ZodObject<{
|
|
|
27
29
|
mode?: "file" | "hashinal" | undefined;
|
|
28
30
|
chunkSize?: number | undefined;
|
|
29
31
|
waitForConfirmation?: boolean | undefined;
|
|
32
|
+
timeoutMs?: number | undefined;
|
|
30
33
|
apiKey?: string | undefined;
|
|
31
34
|
}>;
|
|
32
35
|
/**
|
|
@@ -42,6 +45,7 @@ export declare class InscribeFromUrlTool extends BaseInscriberQueryTool<typeof i
|
|
|
42
45
|
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
43
46
|
chunkSize: z.ZodOptional<z.ZodNumber>;
|
|
44
47
|
waitForConfirmation: z.ZodOptional<z.ZodBoolean>;
|
|
48
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
45
49
|
apiKey: z.ZodOptional<z.ZodString>;
|
|
46
50
|
}, "strip", z.ZodTypeAny, {
|
|
47
51
|
url: string;
|
|
@@ -50,6 +54,7 @@ export declare class InscribeFromUrlTool extends BaseInscriberQueryTool<typeof i
|
|
|
50
54
|
mode?: "file" | "hashinal" | undefined;
|
|
51
55
|
chunkSize?: number | undefined;
|
|
52
56
|
waitForConfirmation?: boolean | undefined;
|
|
57
|
+
timeoutMs?: number | undefined;
|
|
53
58
|
apiKey?: string | undefined;
|
|
54
59
|
}, {
|
|
55
60
|
url: string;
|
|
@@ -58,6 +63,7 @@ export declare class InscribeFromUrlTool extends BaseInscriberQueryTool<typeof i
|
|
|
58
63
|
mode?: "file" | "hashinal" | undefined;
|
|
59
64
|
chunkSize?: number | undefined;
|
|
60
65
|
waitForConfirmation?: boolean | undefined;
|
|
66
|
+
timeoutMs?: number | undefined;
|
|
61
67
|
apiKey?: string | undefined;
|
|
62
68
|
}>;
|
|
63
69
|
protected executeQuery(params: z.infer<typeof inscribeFromUrlSchema>, _runManager?: CallbackManagerForToolRun): Promise<unknown>;
|
|
@@ -25,6 +25,7 @@ declare const inscribeHashinalSchema: z.ZodObject<{
|
|
|
25
25
|
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
26
26
|
chunkSize: z.ZodOptional<z.ZodNumber>;
|
|
27
27
|
waitForConfirmation: z.ZodOptional<z.ZodBoolean>;
|
|
28
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
28
29
|
apiKey: z.ZodOptional<z.ZodString>;
|
|
29
30
|
}, "strip", z.ZodTypeAny, {
|
|
30
31
|
url: string;
|
|
@@ -36,6 +37,7 @@ declare const inscribeHashinalSchema: z.ZodObject<{
|
|
|
36
37
|
properties?: Record<string, unknown> | undefined;
|
|
37
38
|
chunkSize?: number | undefined;
|
|
38
39
|
waitForConfirmation?: boolean | undefined;
|
|
40
|
+
timeoutMs?: number | undefined;
|
|
39
41
|
apiKey?: string | undefined;
|
|
40
42
|
attributes?: {
|
|
41
43
|
value: string | number;
|
|
@@ -52,6 +54,7 @@ declare const inscribeHashinalSchema: z.ZodObject<{
|
|
|
52
54
|
properties?: Record<string, unknown> | undefined;
|
|
53
55
|
chunkSize?: number | undefined;
|
|
54
56
|
waitForConfirmation?: boolean | undefined;
|
|
57
|
+
timeoutMs?: number | undefined;
|
|
55
58
|
apiKey?: string | undefined;
|
|
56
59
|
attributes?: {
|
|
57
60
|
value: string | number;
|
|
@@ -86,6 +89,7 @@ export declare class InscribeHashinalTool extends BaseInscriberQueryTool<typeof
|
|
|
86
89
|
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
87
90
|
chunkSize: z.ZodOptional<z.ZodNumber>;
|
|
88
91
|
waitForConfirmation: z.ZodOptional<z.ZodBoolean>;
|
|
92
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
89
93
|
apiKey: z.ZodOptional<z.ZodString>;
|
|
90
94
|
}, "strip", z.ZodTypeAny, {
|
|
91
95
|
url: string;
|
|
@@ -97,6 +101,7 @@ export declare class InscribeHashinalTool extends BaseInscriberQueryTool<typeof
|
|
|
97
101
|
properties?: Record<string, unknown> | undefined;
|
|
98
102
|
chunkSize?: number | undefined;
|
|
99
103
|
waitForConfirmation?: boolean | undefined;
|
|
104
|
+
timeoutMs?: number | undefined;
|
|
100
105
|
apiKey?: string | undefined;
|
|
101
106
|
attributes?: {
|
|
102
107
|
value: string | number;
|
|
@@ -113,6 +118,7 @@ export declare class InscribeHashinalTool extends BaseInscriberQueryTool<typeof
|
|
|
113
118
|
properties?: Record<string, unknown> | undefined;
|
|
114
119
|
chunkSize?: number | undefined;
|
|
115
120
|
waitForConfirmation?: boolean | undefined;
|
|
121
|
+
timeoutMs?: number | undefined;
|
|
116
122
|
apiKey?: string | undefined;
|
|
117
123
|
attributes?: {
|
|
118
124
|
value: string | number;
|