@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;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hashgraphonline/standards-agent-kit",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.115",
|
|
4
4
|
"description": "A modular SDK for building on-chain autonomous agents using Hashgraph Online Standards, including HCS-10 for agent discovery and communication.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/cjs/standards-agent-kit.cjs",
|
|
@@ -40,7 +40,7 @@ const inscribeFromBufferSchema = z.object({
|
|
|
40
40
|
.int()
|
|
41
41
|
.positive()
|
|
42
42
|
.optional()
|
|
43
|
-
.describe('Timeout in milliseconds for inscription (default: no timeout)'),
|
|
43
|
+
.describe('Timeout in milliseconds for inscription (default: no timeout - waits until completion)'),
|
|
44
44
|
apiKey: z
|
|
45
45
|
.string()
|
|
46
46
|
.optional()
|
|
@@ -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;
|
|
@@ -123,10 +123,10 @@ export class InscribeFromBufferTool extends BaseInscriberQueryTool<typeof inscri
|
|
|
123
123
|
};
|
|
124
124
|
|
|
125
125
|
try {
|
|
126
|
-
let result:
|
|
126
|
+
let result: Awaited<ReturnType<typeof this.inscriberBuilder.inscribe>>;
|
|
127
127
|
|
|
128
128
|
if (params.timeoutMs) {
|
|
129
|
-
const timeoutPromise = new Promise((_, reject) => {
|
|
129
|
+
const timeoutPromise = new Promise<never>((_, reject) => {
|
|
130
130
|
setTimeout(
|
|
131
131
|
() => reject(new Error(`Inscription timed out after ${params.timeoutMs}ms`)),
|
|
132
132
|
params.timeoutMs
|
|
@@ -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()
|
|
@@ -30,6 +30,12 @@ const inscribeFromUrlSchema = z.object({
|
|
|
30
30
|
.boolean()
|
|
31
31
|
.optional()
|
|
32
32
|
.describe('Whether to wait for inscription confirmation'),
|
|
33
|
+
timeoutMs: z
|
|
34
|
+
.number()
|
|
35
|
+
.int()
|
|
36
|
+
.positive()
|
|
37
|
+
.optional()
|
|
38
|
+
.describe('Timeout in milliseconds for inscription (default: no timeout - waits until completion)'),
|
|
33
39
|
apiKey: z
|
|
34
40
|
.string()
|
|
35
41
|
.optional()
|
|
@@ -42,7 +48,7 @@ const inscribeFromUrlSchema = z.object({
|
|
|
42
48
|
*/
|
|
43
49
|
export class InscribeFromUrlTool extends BaseInscriberQueryTool<typeof inscribeFromUrlSchema> {
|
|
44
50
|
name = 'inscribeFromUrl';
|
|
45
|
-
description = '
|
|
51
|
+
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
52
|
|
|
47
53
|
get specificInputSchema() {
|
|
48
54
|
return inscribeFromUrlSchema;
|
|
@@ -180,17 +186,29 @@ export class InscribeFromUrlTool extends BaseInscriberQueryTool<typeof inscribeF
|
|
|
180
186
|
};
|
|
181
187
|
|
|
182
188
|
try {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
189
|
+
let result: Awaited<ReturnType<typeof this.inscriberBuilder.inscribe>>;
|
|
190
|
+
|
|
191
|
+
if (params.timeoutMs) {
|
|
192
|
+
const timeoutPromise = new Promise<never>((_, reject) => {
|
|
193
|
+
setTimeout(
|
|
194
|
+
() => reject(new Error(`Inscription timed out after ${params.timeoutMs}ms`)),
|
|
195
|
+
params.timeoutMs
|
|
196
|
+
);
|
|
197
|
+
});
|
|
186
198
|
|
|
187
|
-
|
|
188
|
-
|
|
199
|
+
result = await Promise.race([
|
|
200
|
+
this.inscriberBuilder.inscribe(
|
|
201
|
+
{ type: 'url', url: params.url },
|
|
202
|
+
options
|
|
203
|
+
),
|
|
204
|
+
timeoutPromise
|
|
205
|
+
]);
|
|
206
|
+
} else {
|
|
207
|
+
result = await this.inscriberBuilder.inscribe(
|
|
189
208
|
{ type: 'url', url: params.url },
|
|
190
209
|
options
|
|
191
|
-
)
|
|
192
|
-
|
|
193
|
-
]) as any;
|
|
210
|
+
);
|
|
211
|
+
}
|
|
194
212
|
|
|
195
213
|
if (result.confirmed) {
|
|
196
214
|
const topicId = result.inscription?.topic_id || result.result.topicId;
|
|
@@ -44,6 +44,12 @@ const inscribeHashinalSchema = z.object({
|
|
|
44
44
|
.boolean()
|
|
45
45
|
.optional()
|
|
46
46
|
.describe('Whether to wait for inscription confirmation'),
|
|
47
|
+
timeoutMs: z
|
|
48
|
+
.number()
|
|
49
|
+
.int()
|
|
50
|
+
.positive()
|
|
51
|
+
.optional()
|
|
52
|
+
.describe('Timeout in milliseconds for inscription (default: no timeout - waits until completion)'),
|
|
47
53
|
apiKey: z
|
|
48
54
|
.string()
|
|
49
55
|
.optional()
|
|
@@ -89,17 +95,29 @@ export class InscribeHashinalTool extends BaseInscriberQueryTool<typeof inscribe
|
|
|
89
95
|
};
|
|
90
96
|
|
|
91
97
|
try {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
98
|
+
let result: Awaited<ReturnType<typeof this.inscriberBuilder.inscribe>>;
|
|
99
|
+
|
|
100
|
+
if (params.timeoutMs) {
|
|
101
|
+
const timeoutPromise = new Promise<never>((_, reject) => {
|
|
102
|
+
setTimeout(
|
|
103
|
+
() => reject(new Error(`Inscription timed out after ${params.timeoutMs}ms`)),
|
|
104
|
+
params.timeoutMs
|
|
105
|
+
);
|
|
106
|
+
});
|
|
95
107
|
|
|
96
|
-
|
|
97
|
-
|
|
108
|
+
result = await Promise.race([
|
|
109
|
+
this.inscriberBuilder.inscribe(
|
|
110
|
+
{ type: 'url', url: params.url },
|
|
111
|
+
options
|
|
112
|
+
),
|
|
113
|
+
timeoutPromise
|
|
114
|
+
]);
|
|
115
|
+
} else {
|
|
116
|
+
result = await this.inscriberBuilder.inscribe(
|
|
98
117
|
{ type: 'url', url: params.url },
|
|
99
118
|
options
|
|
100
|
-
)
|
|
101
|
-
|
|
102
|
-
]) as any;
|
|
119
|
+
);
|
|
120
|
+
}
|
|
103
121
|
|
|
104
122
|
if (result.confirmed) {
|
|
105
123
|
const topicId = result.inscription?.topic_id || result.result.topicId;
|