@hashgraphonline/standards-agent-kit 0.2.112 → 0.2.114
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/index.d.ts +1 -1
- package/dist/cjs/standards-agent-kit.cjs +1 -1
- package/dist/cjs/standards-agent-kit.cjs.map +1 -1
- package/dist/cjs/tools/hcs6/CreateDynamicRegistryTool.d.ts +44 -0
- package/dist/cjs/tools/hcs6/QueryDynamicRegistryTool.d.ts +50 -0
- package/dist/cjs/tools/hcs6/RegisterDynamicHashinalTool.d.ts +102 -0
- package/dist/cjs/tools/hcs6/UpdateDynamicHashinalTool.d.ts +96 -0
- package/dist/cjs/tools/hcs6/base-hcs6-tools.d.ts +28 -0
- package/dist/cjs/tools/hcs6/hcs6-tool-params.d.ts +18 -0
- package/dist/cjs/tools/hcs6/index.d.ts +6 -0
- package/dist/cjs/tools/index.d.ts +1 -0
- package/dist/cjs/tools/inscriber/InscribeFromBufferTool.d.ts +4 -4
- package/dist/es/index.d.ts +1 -1
- package/dist/es/standards-agent-kit.es.js +44 -31
- package/dist/es/standards-agent-kit.es.js.map +1 -1
- package/dist/es/standards-agent-kit.es10.js +27 -27
- package/dist/es/standards-agent-kit.es10.js.map +1 -1
- package/dist/es/standards-agent-kit.es11.js +20 -30
- package/dist/es/standards-agent-kit.es11.js.map +1 -1
- package/dist/es/standards-agent-kit.es12.js +27 -37
- package/dist/es/standards-agent-kit.es12.js.map +1 -1
- package/dist/es/standards-agent-kit.es13.js +48 -60
- package/dist/es/standards-agent-kit.es13.js.map +1 -1
- package/dist/es/standards-agent-kit.es14.js +60 -23
- package/dist/es/standards-agent-kit.es14.js.map +1 -1
- package/dist/es/standards-agent-kit.es15.js +23 -23
- package/dist/es/standards-agent-kit.es15.js.map +1 -1
- package/dist/es/standards-agent-kit.es16.js +23 -33
- package/dist/es/standards-agent-kit.es16.js.map +1 -1
- package/dist/es/standards-agent-kit.es17.js +34 -10
- package/dist/es/standards-agent-kit.es17.js.map +1 -1
- package/dist/es/standards-agent-kit.es18.js +16 -155
- package/dist/es/standards-agent-kit.es18.js.map +1 -1
- package/dist/es/standards-agent-kit.es19.js +150 -22
- package/dist/es/standards-agent-kit.es19.js.map +1 -1
- package/dist/es/standards-agent-kit.es20.js +25 -39
- package/dist/es/standards-agent-kit.es20.js.map +1 -1
- package/dist/es/standards-agent-kit.es21.js +26 -28
- package/dist/es/standards-agent-kit.es21.js.map +1 -1
- package/dist/es/standards-agent-kit.es22.js +16 -19
- package/dist/es/standards-agent-kit.es22.js.map +1 -1
- package/dist/es/standards-agent-kit.es23.js +21 -15
- package/dist/es/standards-agent-kit.es23.js.map +1 -1
- package/dist/es/standards-agent-kit.es24.js +18 -21
- package/dist/es/standards-agent-kit.es24.js.map +1 -1
- package/dist/es/standards-agent-kit.es25.js +35 -32
- package/dist/es/standards-agent-kit.es25.js.map +1 -1
- package/dist/es/standards-agent-kit.es26.js +38 -25
- package/dist/es/standards-agent-kit.es26.js.map +1 -1
- package/dist/es/standards-agent-kit.es27.js +25 -116
- package/dist/es/standards-agent-kit.es27.js.map +1 -1
- package/dist/es/standards-agent-kit.es28.js +33 -166
- package/dist/es/standards-agent-kit.es28.js.map +1 -1
- package/dist/es/standards-agent-kit.es29.js +42 -121
- package/dist/es/standards-agent-kit.es29.js.map +1 -1
- package/dist/es/standards-agent-kit.es30.js +40 -77
- package/dist/es/standards-agent-kit.es30.js.map +1 -1
- package/dist/es/standards-agent-kit.es31.js +42 -37
- package/dist/es/standards-agent-kit.es31.js.map +1 -1
- package/dist/es/standards-agent-kit.es32.js +20 -237
- package/dist/es/standards-agent-kit.es32.js.map +1 -1
- package/dist/es/standards-agent-kit.es33.js +154 -135
- package/dist/es/standards-agent-kit.es33.js.map +1 -1
- package/dist/es/standards-agent-kit.es34.js +168 -23
- package/dist/es/standards-agent-kit.es34.js.map +1 -1
- package/dist/es/standards-agent-kit.es35.js +126 -21
- package/dist/es/standards-agent-kit.es35.js.map +1 -1
- package/dist/es/standards-agent-kit.es36.js +86 -3
- package/dist/es/standards-agent-kit.es36.js.map +1 -1
- package/dist/es/standards-agent-kit.es37.js +45 -0
- package/dist/es/standards-agent-kit.es37.js.map +1 -0
- package/dist/es/standards-agent-kit.es38.js +249 -0
- package/dist/es/standards-agent-kit.es38.js.map +1 -0
- package/dist/es/standards-agent-kit.es39.js +141 -0
- package/dist/es/standards-agent-kit.es39.js.map +1 -0
- package/dist/es/standards-agent-kit.es4.js +65 -32
- package/dist/es/standards-agent-kit.es4.js.map +1 -1
- package/dist/es/standards-agent-kit.es40.js +33 -0
- package/dist/es/standards-agent-kit.es40.js.map +1 -0
- package/dist/es/standards-agent-kit.es41.js +28 -0
- package/dist/es/standards-agent-kit.es41.js.map +1 -0
- package/dist/es/standards-agent-kit.es42.js +7 -0
- package/dist/es/standards-agent-kit.es42.js.map +1 -0
- package/dist/es/standards-agent-kit.es5.js +35 -311
- package/dist/es/standards-agent-kit.es5.js.map +1 -1
- package/dist/es/standards-agent-kit.es6.js +320 -20
- package/dist/es/standards-agent-kit.es6.js.map +1 -1
- package/dist/es/standards-agent-kit.es7.js +19 -227
- package/dist/es/standards-agent-kit.es7.js.map +1 -1
- package/dist/es/standards-agent-kit.es8.js +216 -65
- package/dist/es/standards-agent-kit.es8.js.map +1 -1
- package/dist/es/standards-agent-kit.es9.js +72 -23
- package/dist/es/standards-agent-kit.es9.js.map +1 -1
- package/dist/es/tools/hcs6/CreateDynamicRegistryTool.d.ts +44 -0
- package/dist/es/tools/hcs6/QueryDynamicRegistryTool.d.ts +50 -0
- package/dist/es/tools/hcs6/RegisterDynamicHashinalTool.d.ts +102 -0
- package/dist/es/tools/hcs6/UpdateDynamicHashinalTool.d.ts +96 -0
- package/dist/es/tools/hcs6/base-hcs6-tools.d.ts +28 -0
- package/dist/es/tools/hcs6/hcs6-tool-params.d.ts +18 -0
- package/dist/es/tools/hcs6/index.d.ts +6 -0
- package/dist/es/tools/index.d.ts +1 -0
- package/dist/es/tools/inscriber/InscribeFromBufferTool.d.ts +4 -4
- package/dist/umd/index.d.ts +1 -1
- 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/hcs6/CreateDynamicRegistryTool.d.ts +44 -0
- package/dist/umd/tools/hcs6/QueryDynamicRegistryTool.d.ts +50 -0
- package/dist/umd/tools/hcs6/RegisterDynamicHashinalTool.d.ts +102 -0
- package/dist/umd/tools/hcs6/UpdateDynamicHashinalTool.d.ts +96 -0
- package/dist/umd/tools/hcs6/base-hcs6-tools.d.ts +28 -0
- package/dist/umd/tools/hcs6/hcs6-tool-params.d.ts +18 -0
- package/dist/umd/tools/hcs6/index.d.ts +6 -0
- package/dist/umd/tools/index.d.ts +1 -0
- package/dist/umd/tools/inscriber/InscribeFromBufferTool.d.ts +4 -4
- package/package.json +1 -1
- package/src/index.ts +1 -1
- package/src/tools/hcs6/CreateDynamicRegistryTool.ts +66 -0
- package/src/tools/hcs6/QueryDynamicRegistryTool.ts +72 -0
- package/src/tools/hcs6/RegisterDynamicHashinalTool.ts +79 -0
- package/src/tools/hcs6/UpdateDynamicHashinalTool.ts +74 -0
- package/src/tools/hcs6/base-hcs6-tools.ts +63 -0
- package/src/tools/hcs6/hcs6-tool-params.ts +21 -0
- package/src/tools/hcs6/index.ts +6 -0
- package/src/tools/index.ts +1 -0
- package/src/tools/inscriber/InscribeFromBufferTool.ts +1 -1
- package/src/tools/inscriber/InscribeFromUrlTool.ts +61 -8
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { BaseHCS6TransactionTool } from './base-hcs6-tools';
|
|
3
|
+
import { HCS6TransactionToolParams } from './hcs6-tool-params';
|
|
4
|
+
import type { TransactionResponse } from 'hedera-agent-kit';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Schema for updating a dynamic hashinal
|
|
8
|
+
*/
|
|
9
|
+
const UpdateDynamicHashinalSchema = z.object({
|
|
10
|
+
registryTopicId: z.string()
|
|
11
|
+
.describe('The registry topic ID that tracks this dynamic hashinal'),
|
|
12
|
+
metadata: z.record(z.unknown())
|
|
13
|
+
.describe('Updated metadata object for the hashinal'),
|
|
14
|
+
data: z.object({
|
|
15
|
+
base64: z.string().optional().describe('Base64 encoded data for the updated hashinal'),
|
|
16
|
+
url: z.string().optional().describe('URL to fetch updated data from'),
|
|
17
|
+
mimeType: z.string().optional().describe('MIME type of the data'),
|
|
18
|
+
}).optional()
|
|
19
|
+
.describe('Updated data to inscribe'),
|
|
20
|
+
memo: z.string()
|
|
21
|
+
.optional()
|
|
22
|
+
.describe('Optional memo for the update (e.g., "Level up", "Version 2.0")'),
|
|
23
|
+
submitKey: z.string()
|
|
24
|
+
.describe('Submit key for the registry (required to update)'),
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export type UpdateDynamicHashinalInput = z.infer<typeof UpdateDynamicHashinalSchema>;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Tool for updating dynamic hashinals
|
|
31
|
+
*/
|
|
32
|
+
export class UpdateDynamicHashinalTool extends BaseHCS6TransactionTool<typeof UpdateDynamicHashinalSchema> {
|
|
33
|
+
name = 'updateDynamicHashinal';
|
|
34
|
+
description = 'Update an existing dynamic hashinal with new content while maintaining the same registry';
|
|
35
|
+
schema = UpdateDynamicHashinalSchema;
|
|
36
|
+
|
|
37
|
+
constructor(params: HCS6TransactionToolParams) {
|
|
38
|
+
super(params);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
protected async _call(
|
|
42
|
+
params: UpdateDynamicHashinalInput
|
|
43
|
+
): Promise<TransactionResponse> {
|
|
44
|
+
try {
|
|
45
|
+
// Use the register method with the existing registry ID
|
|
46
|
+
const result = await this.hcs6Builder.register({
|
|
47
|
+
metadata: params.metadata,
|
|
48
|
+
data: params.data,
|
|
49
|
+
memo: params.memo,
|
|
50
|
+
registryTopicId: params.registryTopicId,
|
|
51
|
+
submitKey: params.submitKey,
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
if (!result.success) {
|
|
55
|
+
throw new Error(result.error || 'Failed to update dynamic hashinal');
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return {
|
|
59
|
+
status: 'success',
|
|
60
|
+
data: {
|
|
61
|
+
registryTopicId: result.registryTopicId,
|
|
62
|
+
newInscriptionTopicId: result.inscriptionTopicId,
|
|
63
|
+
transactionId: result.transactionId,
|
|
64
|
+
updateMemo: params.memo,
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
} catch (error) {
|
|
68
|
+
return {
|
|
69
|
+
status: 'error',
|
|
70
|
+
message: error instanceof Error ? error.message : 'Unknown error',
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BaseHederaTransactionTool,
|
|
3
|
+
BaseHederaQueryTool,
|
|
4
|
+
BaseServiceBuilder,
|
|
5
|
+
} from 'hedera-agent-kit';
|
|
6
|
+
import { HCS6Builder } from '../../builders/hcs6/hcs6-builder';
|
|
7
|
+
import {
|
|
8
|
+
HCS6TransactionToolParams,
|
|
9
|
+
HCS6QueryToolParams,
|
|
10
|
+
} from './hcs6-tool-params';
|
|
11
|
+
import { z } from 'zod';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Base class for HCS6 transaction tools
|
|
15
|
+
*/
|
|
16
|
+
export abstract class BaseHCS6TransactionTool<
|
|
17
|
+
T extends z.ZodObject<
|
|
18
|
+
z.ZodRawShape,
|
|
19
|
+
z.UnknownKeysParam,
|
|
20
|
+
z.ZodTypeAny
|
|
21
|
+
> = z.ZodObject<z.ZodRawShape>
|
|
22
|
+
> extends BaseHederaTransactionTool<T> {
|
|
23
|
+
protected hcs6Builder: HCS6Builder;
|
|
24
|
+
namespace = 'hcs6' as const;
|
|
25
|
+
|
|
26
|
+
constructor(params: HCS6TransactionToolParams) {
|
|
27
|
+
super(params);
|
|
28
|
+
this.hcs6Builder = params.hcs6Builder;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Override to return the HCS6Builder
|
|
33
|
+
*/
|
|
34
|
+
protected getServiceBuilder(): BaseServiceBuilder {
|
|
35
|
+
return this.hcs6Builder;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Base class for HCS6 query tools
|
|
41
|
+
*/
|
|
42
|
+
export abstract class BaseHCS6QueryTool<
|
|
43
|
+
T extends z.ZodObject<
|
|
44
|
+
z.ZodRawShape,
|
|
45
|
+
z.UnknownKeysParam,
|
|
46
|
+
z.ZodTypeAny
|
|
47
|
+
> = z.ZodObject<z.ZodRawShape>
|
|
48
|
+
> extends BaseHederaQueryTool<T> {
|
|
49
|
+
protected hcs6Builder: HCS6Builder;
|
|
50
|
+
namespace = 'hcs6' as const;
|
|
51
|
+
|
|
52
|
+
constructor(params: HCS6QueryToolParams) {
|
|
53
|
+
super(params);
|
|
54
|
+
this.hcs6Builder = params.hcs6Builder;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Override to return the HCS6Builder
|
|
59
|
+
*/
|
|
60
|
+
protected getServiceBuilder(): BaseServiceBuilder {
|
|
61
|
+
return this.hcs6Builder;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { HederaAgentKit } from 'hedera-agent-kit';
|
|
2
|
+
import type { BasePluginContext } from 'hedera-agent-kit';
|
|
3
|
+
import { HCS6Builder } from '../../builders/hcs6/hcs6-builder';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Parameters for HCS6 transaction tools
|
|
7
|
+
*/
|
|
8
|
+
export interface HCS6TransactionToolParams {
|
|
9
|
+
hederaKit: HederaAgentKit;
|
|
10
|
+
hcs6Builder: HCS6Builder;
|
|
11
|
+
logger?: BasePluginContext['logger'];
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Parameters for HCS6 query tools
|
|
16
|
+
*/
|
|
17
|
+
export interface HCS6QueryToolParams {
|
|
18
|
+
hederaKit: HederaAgentKit;
|
|
19
|
+
hcs6Builder: HCS6Builder;
|
|
20
|
+
logger?: BasePluginContext['logger'];
|
|
21
|
+
}
|
package/src/tools/index.ts
CHANGED
|
@@ -53,7 +53,7 @@ const inscribeFromBufferSchema = z.object({
|
|
|
53
53
|
*/
|
|
54
54
|
export class InscribeFromBufferTool extends BaseInscriberQueryTool<typeof inscribeFromBufferSchema> {
|
|
55
55
|
name = 'inscribeFromBuffer';
|
|
56
|
-
description = '
|
|
56
|
+
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.';
|
|
57
57
|
|
|
58
58
|
get specificInputSchema() {
|
|
59
59
|
return inscribeFromBufferSchema;
|
|
@@ -7,7 +7,7 @@ import { CallbackManagerForToolRun } from '@langchain/core/callbacks/manager';
|
|
|
7
7
|
* Schema for inscribing from URL
|
|
8
8
|
*/
|
|
9
9
|
const inscribeFromUrlSchema = z.object({
|
|
10
|
-
url: z.string().url().describe('
|
|
10
|
+
url: z.string().url().describe('ONLY direct file download URLs ending in .pdf, .jpg, .png, .json, .zip etc. NOT for web pages or articles'),
|
|
11
11
|
mode: z
|
|
12
12
|
.enum(['file', 'hashinal'])
|
|
13
13
|
.optional()
|
|
@@ -42,7 +42,7 @@ const inscribeFromUrlSchema = z.object({
|
|
|
42
42
|
*/
|
|
43
43
|
export class InscribeFromUrlTool extends BaseInscriberQueryTool<typeof inscribeFromUrlSchema> {
|
|
44
44
|
name = 'inscribeFromUrl';
|
|
45
|
-
description = '
|
|
45
|
+
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.';
|
|
46
46
|
|
|
47
47
|
get specificInputSchema() {
|
|
48
48
|
return inscribeFromUrlSchema;
|
|
@@ -76,18 +76,32 @@ export class InscribeFromUrlTool extends BaseInscriberQueryTool<typeof inscribeF
|
|
|
76
76
|
const timeoutId = setTimeout(() => controller.abort(), 10000);
|
|
77
77
|
|
|
78
78
|
try {
|
|
79
|
-
|
|
79
|
+
// First try HEAD request
|
|
80
|
+
const headResponse = await fetch(params.url, {
|
|
80
81
|
method: 'HEAD',
|
|
81
82
|
signal: controller.signal,
|
|
82
83
|
});
|
|
83
84
|
|
|
84
85
|
clearTimeout(timeoutId);
|
|
85
86
|
|
|
86
|
-
if (!
|
|
87
|
-
throw new Error(`URL returned error status ${
|
|
87
|
+
if (!headResponse.ok) {
|
|
88
|
+
throw new Error(`URL returned error status ${headResponse.status}: ${headResponse.statusText}. Cannot inscribe content from inaccessible URLs.`);
|
|
88
89
|
}
|
|
89
90
|
|
|
90
|
-
const
|
|
91
|
+
const contentType = headResponse.headers.get('content-type') || '';
|
|
92
|
+
const contentLength = headResponse.headers.get('content-length');
|
|
93
|
+
|
|
94
|
+
// Check if content type indicates HTML/web page
|
|
95
|
+
const webPageContentTypes = [
|
|
96
|
+
'text/html',
|
|
97
|
+
'application/xhtml+xml',
|
|
98
|
+
'text/xml'
|
|
99
|
+
];
|
|
100
|
+
|
|
101
|
+
if (webPageContentTypes.some(type => contentType.toLowerCase().includes(type))) {
|
|
102
|
+
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.`);
|
|
103
|
+
}
|
|
104
|
+
|
|
91
105
|
if (contentLength && parseInt(contentLength) === 0) {
|
|
92
106
|
throw new Error('URL returns empty content (Content-Length: 0). Cannot inscribe empty content.');
|
|
93
107
|
}
|
|
@@ -95,8 +109,47 @@ export class InscribeFromUrlTool extends BaseInscriberQueryTool<typeof inscribeF
|
|
|
95
109
|
if (contentLength && parseInt(contentLength) < 10) {
|
|
96
110
|
throw new Error(`URL content is too small (${contentLength} bytes). Content must be at least 10 bytes.`);
|
|
97
111
|
}
|
|
112
|
+
|
|
113
|
+
// If HEAD doesn't provide content-type, do a partial GET to check
|
|
114
|
+
if (!contentType || contentType === 'application/octet-stream') {
|
|
115
|
+
console.log(`[InscribeFromUrlTool] Content-Type unclear, fetching first 1KB to verify...`);
|
|
116
|
+
|
|
117
|
+
const getController = new AbortController();
|
|
118
|
+
const getTimeoutId = setTimeout(() => getController.abort(), 5000);
|
|
119
|
+
|
|
120
|
+
try {
|
|
121
|
+
const getResponse = await fetch(params.url, {
|
|
122
|
+
signal: getController.signal,
|
|
123
|
+
headers: {
|
|
124
|
+
'Range': 'bytes=0-1023' // Get first 1KB
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
clearTimeout(getTimeoutId);
|
|
129
|
+
|
|
130
|
+
if (getResponse.ok || getResponse.status === 206) { // 206 is partial content
|
|
131
|
+
const buffer = await getResponse.arrayBuffer();
|
|
132
|
+
const bytes = new Uint8Array(buffer);
|
|
133
|
+
const text = new TextDecoder('utf-8', { fatal: false }).decode(bytes.slice(0, 512));
|
|
134
|
+
|
|
135
|
+
// Check if it looks like HTML
|
|
136
|
+
if (text.toLowerCase().includes('<!doctype html') ||
|
|
137
|
+
text.toLowerCase().includes('<html') ||
|
|
138
|
+
text.match(/<meta\s+[^>]*>/i) ||
|
|
139
|
+
text.match(/<title>/i)) {
|
|
140
|
+
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.`);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
} catch (getError) {
|
|
144
|
+
clearTimeout(getTimeoutId);
|
|
145
|
+
if (getError instanceof Error && getError.message.includes('HTML content')) {
|
|
146
|
+
throw getError;
|
|
147
|
+
}
|
|
148
|
+
// If partial GET fails, continue anyway
|
|
149
|
+
console.log(`[InscribeFromUrlTool] Could not perform partial GET validation: ${getError instanceof Error ? getError.message : 'Unknown error'}`);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
98
152
|
|
|
99
|
-
const contentType = response.headers.get('content-type');
|
|
100
153
|
console.log(`[InscribeFromUrlTool] URL validation passed. Content-Type: ${contentType}, Content-Length: ${contentLength || 'unknown'}`);
|
|
101
154
|
} catch (fetchError) {
|
|
102
155
|
clearTimeout(timeoutId);
|
|
@@ -106,7 +159,7 @@ export class InscribeFromUrlTool extends BaseInscriberQueryTool<typeof inscribeF
|
|
|
106
159
|
if (error instanceof Error) {
|
|
107
160
|
if (error.name === 'AbortError') {
|
|
108
161
|
console.log(`[InscribeFromUrlTool] Warning: URL validation timed out after 10 seconds. Proceeding with inscription attempt.`);
|
|
109
|
-
} else if (error.message.includes('URL returned error') || error.message.includes('empty content') || error.message.includes('too small')) {
|
|
162
|
+
} else if (error.message.includes('URL returned error') || error.message.includes('empty content') || error.message.includes('too small') || error.message.includes('HTML')) {
|
|
110
163
|
throw error;
|
|
111
164
|
} else {
|
|
112
165
|
console.log(`[InscribeFromUrlTool] Warning: Could not validate URL with HEAD request: ${error.message}. Proceeding with inscription attempt.`);
|