@hashgraphonline/standards-agent-kit 0.2.121 → 0.2.123
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/hcs6/CreateDynamicRegistryTool.d.ts +0 -6
- package/dist/cjs/tools/inscriber/InscribeFromBufferTool.d.ts +6 -0
- package/dist/cjs/tools/inscriber/InscribeFromFileTool.d.ts +3 -0
- package/dist/cjs/tools/inscriber/InscribeFromUrlTool.d.ts +6 -0
- package/dist/cjs/tools/inscriber/InscribeHashinalTool.d.ts +6 -0
- package/dist/cjs/tools/inscriber/base-inscriber-tools.d.ts +15 -0
- package/dist/es/standards-agent-kit.es29.js +0 -2
- package/dist/es/standards-agent-kit.es29.js.map +1 -1
- package/dist/es/standards-agent-kit.es33.js +44 -0
- package/dist/es/standards-agent-kit.es33.js.map +1 -1
- package/dist/es/standards-agent-kit.es34.js +35 -6
- package/dist/es/standards-agent-kit.es34.js.map +1 -1
- package/dist/es/standards-agent-kit.es35.js +47 -9
- package/dist/es/standards-agent-kit.es35.js.map +1 -1
- package/dist/es/standards-agent-kit.es36.js +43 -6
- package/dist/es/standards-agent-kit.es36.js.map +1 -1
- package/dist/es/standards-agent-kit.es37.js +39 -6
- package/dist/es/standards-agent-kit.es37.js.map +1 -1
- package/dist/es/standards-agent-kit.es5.js +28 -4
- package/dist/es/standards-agent-kit.es5.js.map +1 -1
- package/dist/es/tools/hcs6/CreateDynamicRegistryTool.d.ts +0 -6
- package/dist/es/tools/inscriber/InscribeFromBufferTool.d.ts +6 -0
- package/dist/es/tools/inscriber/InscribeFromFileTool.d.ts +3 -0
- package/dist/es/tools/inscriber/InscribeFromUrlTool.d.ts +6 -0
- package/dist/es/tools/inscriber/InscribeHashinalTool.d.ts +6 -0
- package/dist/es/tools/inscriber/base-inscriber-tools.d.ts +15 -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/hcs6/CreateDynamicRegistryTool.d.ts +0 -6
- package/dist/umd/tools/inscriber/InscribeFromBufferTool.d.ts +6 -0
- package/dist/umd/tools/inscriber/InscribeFromFileTool.d.ts +3 -0
- package/dist/umd/tools/inscriber/InscribeFromUrlTool.d.ts +6 -0
- package/dist/umd/tools/inscriber/InscribeHashinalTool.d.ts +6 -0
- package/dist/umd/tools/inscriber/base-inscriber-tools.d.ts +15 -0
- package/package.json +31 -27
- package/src/builders/hcs6/hcs6-builder.ts +33 -4
- package/src/tools/hcs6/CreateDynamicRegistryTool.ts +4 -6
- package/src/tools/inscriber/InscribeFromBufferTool.ts +49 -9
- package/src/tools/inscriber/InscribeFromFileTool.ts +50 -8
- package/src/tools/inscriber/InscribeFromUrlTool.ts +40 -11
- package/src/tools/inscriber/InscribeHashinalTool.ts +43 -6
- package/src/tools/inscriber/base-inscriber-tools.ts +87 -0
|
@@ -7,15 +7,12 @@ import { CallbackManagerForToolRun } from '@langchain/core/callbacks/manager';
|
|
|
7
7
|
*/
|
|
8
8
|
declare const CreateDynamicRegistrySchema: z.ZodObject<{
|
|
9
9
|
ttl: z.ZodDefault<z.ZodNumber>;
|
|
10
|
-
adminKey: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodString]>>;
|
|
11
10
|
submitKey: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodString]>>;
|
|
12
11
|
}, "strip", z.ZodTypeAny, {
|
|
13
12
|
ttl: number;
|
|
14
|
-
adminKey?: string | boolean | undefined;
|
|
15
13
|
submitKey?: string | boolean | undefined;
|
|
16
14
|
}, {
|
|
17
15
|
ttl?: number | undefined;
|
|
18
|
-
adminKey?: string | boolean | undefined;
|
|
19
16
|
submitKey?: string | boolean | undefined;
|
|
20
17
|
}>;
|
|
21
18
|
export type CreateDynamicRegistryInput = z.infer<typeof CreateDynamicRegistrySchema>;
|
|
@@ -27,15 +24,12 @@ export declare class CreateDynamicRegistryTool extends BaseHCS6QueryTool<typeof
|
|
|
27
24
|
description: string;
|
|
28
25
|
get specificInputSchema(): z.ZodObject<{
|
|
29
26
|
ttl: z.ZodDefault<z.ZodNumber>;
|
|
30
|
-
adminKey: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodString]>>;
|
|
31
27
|
submitKey: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodString]>>;
|
|
32
28
|
}, "strip", z.ZodTypeAny, {
|
|
33
29
|
ttl: number;
|
|
34
|
-
adminKey?: string | boolean | undefined;
|
|
35
30
|
submitKey?: string | boolean | undefined;
|
|
36
31
|
}, {
|
|
37
32
|
ttl?: number | undefined;
|
|
38
|
-
adminKey?: string | boolean | undefined;
|
|
39
33
|
submitKey?: string | boolean | undefined;
|
|
40
34
|
}>;
|
|
41
35
|
constructor(params: HCS6QueryToolParams);
|
|
@@ -12,7 +12,9 @@ declare const inscribeFromBufferSchema: z.ZodObject<{
|
|
|
12
12
|
waitForConfirmation: z.ZodOptional<z.ZodBoolean>;
|
|
13
13
|
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
14
14
|
apiKey: z.ZodOptional<z.ZodString>;
|
|
15
|
+
quoteOnly: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
15
16
|
}, "strip", z.ZodTypeAny, {
|
|
17
|
+
quoteOnly: boolean;
|
|
16
18
|
fileName: string;
|
|
17
19
|
base64Data: string;
|
|
18
20
|
tags?: string[] | undefined;
|
|
@@ -34,6 +36,7 @@ declare const inscribeFromBufferSchema: z.ZodObject<{
|
|
|
34
36
|
waitForConfirmation?: boolean | undefined;
|
|
35
37
|
timeoutMs?: number | undefined;
|
|
36
38
|
apiKey?: string | undefined;
|
|
39
|
+
quoteOnly?: boolean | undefined;
|
|
37
40
|
}>;
|
|
38
41
|
export declare class InscribeFromBufferTool extends BaseInscriberQueryTool<typeof inscribeFromBufferSchema> {
|
|
39
42
|
name: string;
|
|
@@ -50,7 +53,9 @@ export declare class InscribeFromBufferTool extends BaseInscriberQueryTool<typeo
|
|
|
50
53
|
waitForConfirmation: z.ZodOptional<z.ZodBoolean>;
|
|
51
54
|
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
52
55
|
apiKey: z.ZodOptional<z.ZodString>;
|
|
56
|
+
quoteOnly: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
53
57
|
}, "strip", z.ZodTypeAny, {
|
|
58
|
+
quoteOnly: boolean;
|
|
54
59
|
fileName: string;
|
|
55
60
|
base64Data: string;
|
|
56
61
|
tags?: string[] | undefined;
|
|
@@ -72,6 +77,7 @@ export declare class InscribeFromBufferTool extends BaseInscriberQueryTool<typeo
|
|
|
72
77
|
waitForConfirmation?: boolean | undefined;
|
|
73
78
|
timeoutMs?: number | undefined;
|
|
74
79
|
apiKey?: string | undefined;
|
|
80
|
+
quoteOnly?: boolean | undefined;
|
|
75
81
|
}>;
|
|
76
82
|
protected executeQuery(params: z.infer<typeof inscribeFromBufferSchema>, _runManager?: CallbackManagerForToolRun): Promise<unknown>;
|
|
77
83
|
private validateInput;
|
|
@@ -13,7 +13,9 @@ declare const inscribeFromFileSchema: z.ZodObject<{
|
|
|
13
13
|
waitForConfirmation: z.ZodOptional<z.ZodBoolean>;
|
|
14
14
|
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
15
15
|
apiKey: z.ZodOptional<z.ZodString>;
|
|
16
|
+
quoteOnly: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
16
17
|
}, "strip", z.ZodTypeAny, {
|
|
18
|
+
quoteOnly: boolean;
|
|
17
19
|
filePath: string;
|
|
18
20
|
tags?: string[] | undefined;
|
|
19
21
|
metadata?: Record<string, unknown> | undefined;
|
|
@@ -31,6 +33,7 @@ declare const inscribeFromFileSchema: z.ZodObject<{
|
|
|
31
33
|
waitForConfirmation?: boolean | undefined;
|
|
32
34
|
timeoutMs?: number | undefined;
|
|
33
35
|
apiKey?: string | undefined;
|
|
36
|
+
quoteOnly?: boolean | undefined;
|
|
34
37
|
}>;
|
|
35
38
|
/**
|
|
36
39
|
* Tool for inscribing content from file
|
|
@@ -13,8 +13,10 @@ declare const inscribeFromUrlSchema: z.ZodObject<{
|
|
|
13
13
|
waitForConfirmation: z.ZodOptional<z.ZodBoolean>;
|
|
14
14
|
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
15
15
|
apiKey: z.ZodOptional<z.ZodString>;
|
|
16
|
+
quoteOnly: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
16
17
|
}, "strip", z.ZodTypeAny, {
|
|
17
18
|
url: string;
|
|
19
|
+
quoteOnly: boolean;
|
|
18
20
|
tags?: string[] | undefined;
|
|
19
21
|
metadata?: Record<string, unknown> | undefined;
|
|
20
22
|
mode?: "file" | "hashinal" | undefined;
|
|
@@ -31,6 +33,7 @@ declare const inscribeFromUrlSchema: z.ZodObject<{
|
|
|
31
33
|
waitForConfirmation?: boolean | undefined;
|
|
32
34
|
timeoutMs?: number | undefined;
|
|
33
35
|
apiKey?: string | undefined;
|
|
36
|
+
quoteOnly?: boolean | undefined;
|
|
34
37
|
}>;
|
|
35
38
|
/**
|
|
36
39
|
* Tool for inscribing content from URL
|
|
@@ -47,8 +50,10 @@ export declare class InscribeFromUrlTool extends BaseInscriberQueryTool<typeof i
|
|
|
47
50
|
waitForConfirmation: z.ZodOptional<z.ZodBoolean>;
|
|
48
51
|
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
49
52
|
apiKey: z.ZodOptional<z.ZodString>;
|
|
53
|
+
quoteOnly: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
50
54
|
}, "strip", z.ZodTypeAny, {
|
|
51
55
|
url: string;
|
|
56
|
+
quoteOnly: boolean;
|
|
52
57
|
tags?: string[] | undefined;
|
|
53
58
|
metadata?: Record<string, unknown> | undefined;
|
|
54
59
|
mode?: "file" | "hashinal" | undefined;
|
|
@@ -65,6 +70,7 @@ export declare class InscribeFromUrlTool extends BaseInscriberQueryTool<typeof i
|
|
|
65
70
|
waitForConfirmation?: boolean | undefined;
|
|
66
71
|
timeoutMs?: number | undefined;
|
|
67
72
|
apiKey?: string | undefined;
|
|
73
|
+
quoteOnly?: boolean | undefined;
|
|
68
74
|
}>;
|
|
69
75
|
protected executeQuery(params: z.infer<typeof inscribeFromUrlSchema>, _runManager?: CallbackManagerForToolRun): Promise<unknown>;
|
|
70
76
|
}
|
|
@@ -27,12 +27,14 @@ declare const inscribeHashinalSchema: z.ZodObject<{
|
|
|
27
27
|
waitForConfirmation: z.ZodOptional<z.ZodBoolean>;
|
|
28
28
|
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
29
29
|
apiKey: z.ZodOptional<z.ZodString>;
|
|
30
|
+
quoteOnly: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
30
31
|
}, "strip", z.ZodTypeAny, {
|
|
31
32
|
url: string;
|
|
32
33
|
type: string;
|
|
33
34
|
name: string;
|
|
34
35
|
description: string;
|
|
35
36
|
creator: string;
|
|
37
|
+
quoteOnly: boolean;
|
|
36
38
|
tags?: string[] | undefined;
|
|
37
39
|
properties?: Record<string, unknown> | undefined;
|
|
38
40
|
chunkSize?: number | undefined;
|
|
@@ -56,6 +58,7 @@ declare const inscribeHashinalSchema: z.ZodObject<{
|
|
|
56
58
|
waitForConfirmation?: boolean | undefined;
|
|
57
59
|
timeoutMs?: number | undefined;
|
|
58
60
|
apiKey?: string | undefined;
|
|
61
|
+
quoteOnly?: boolean | undefined;
|
|
59
62
|
attributes?: {
|
|
60
63
|
value: string | number;
|
|
61
64
|
trait_type: string;
|
|
@@ -91,12 +94,14 @@ export declare class InscribeHashinalTool extends BaseInscriberQueryTool<typeof
|
|
|
91
94
|
waitForConfirmation: z.ZodOptional<z.ZodBoolean>;
|
|
92
95
|
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
93
96
|
apiKey: z.ZodOptional<z.ZodString>;
|
|
97
|
+
quoteOnly: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
94
98
|
}, "strip", z.ZodTypeAny, {
|
|
95
99
|
url: string;
|
|
96
100
|
type: string;
|
|
97
101
|
name: string;
|
|
98
102
|
description: string;
|
|
99
103
|
creator: string;
|
|
104
|
+
quoteOnly: boolean;
|
|
100
105
|
tags?: string[] | undefined;
|
|
101
106
|
properties?: Record<string, unknown> | undefined;
|
|
102
107
|
chunkSize?: number | undefined;
|
|
@@ -120,6 +125,7 @@ export declare class InscribeHashinalTool extends BaseInscriberQueryTool<typeof
|
|
|
120
125
|
waitForConfirmation?: boolean | undefined;
|
|
121
126
|
timeoutMs?: number | undefined;
|
|
122
127
|
apiKey?: string | undefined;
|
|
128
|
+
quoteOnly?: boolean | undefined;
|
|
123
129
|
attributes?: {
|
|
124
130
|
value: string | number;
|
|
125
131
|
trait_type: string;
|
|
@@ -2,6 +2,7 @@ import { BaseHederaTransactionTool, BaseHederaQueryTool, BaseServiceBuilder } fr
|
|
|
2
2
|
import { InscriberBuilder } from '../../builders/inscriber/inscriber-builder';
|
|
3
3
|
import { InscriberTransactionToolParams, InscriberQueryToolParams } from './inscriber-tool-params';
|
|
4
4
|
import { ContentResolverInterface } from '../../types/content-resolver';
|
|
5
|
+
import { InscriptionInput, InscriptionOptions, QuoteResult } from '@hashgraphonline/standards-sdk';
|
|
5
6
|
import { z } from 'zod';
|
|
6
7
|
/**
|
|
7
8
|
* Base class for Inscriber transaction tools
|
|
@@ -19,6 +20,13 @@ export declare abstract class BaseInscriberTransactionTool<T extends z.ZodObject
|
|
|
19
20
|
* Get content resolver with fallback to registry
|
|
20
21
|
*/
|
|
21
22
|
protected getContentResolver(): ContentResolverInterface | null;
|
|
23
|
+
/**
|
|
24
|
+
* Generate a quote for an inscription without executing it
|
|
25
|
+
* @param input - The inscription input data
|
|
26
|
+
* @param options - Inscription options
|
|
27
|
+
* @returns Promise containing the quote result
|
|
28
|
+
*/
|
|
29
|
+
protected generateInscriptionQuote(input: InscriptionInput, options: InscriptionOptions): Promise<QuoteResult>;
|
|
22
30
|
}
|
|
23
31
|
/**
|
|
24
32
|
* Base class for Inscriber query tools
|
|
@@ -36,4 +44,11 @@ export declare abstract class BaseInscriberQueryTool<T extends z.ZodObject<z.Zod
|
|
|
36
44
|
* Get content resolver with fallback to registry
|
|
37
45
|
*/
|
|
38
46
|
protected getContentResolver(): ContentResolverInterface | null;
|
|
47
|
+
/**
|
|
48
|
+
* Generate a quote for an inscription without executing it
|
|
49
|
+
* @param input - The inscription input data
|
|
50
|
+
* @param options - Inscription options
|
|
51
|
+
* @returns Promise containing the quote result
|
|
52
|
+
*/
|
|
53
|
+
protected generateInscriptionQuote(input: InscriptionInput, options: InscriptionOptions): Promise<QuoteResult>;
|
|
39
54
|
}
|
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.123",
|
|
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",
|
|
@@ -21,6 +21,33 @@
|
|
|
21
21
|
"LICENSE",
|
|
22
22
|
"README.md"
|
|
23
23
|
],
|
|
24
|
+
"scripts": {
|
|
25
|
+
"clean": "rimraf dist",
|
|
26
|
+
"build:es": "BUILD_FORMAT=es vite build",
|
|
27
|
+
"build:cjs": "BUILD_FORMAT=cjs vite build",
|
|
28
|
+
"build:umd": "BUILD_FORMAT=umd vite build",
|
|
29
|
+
"build": "pnpm run clean && pnpm run build:es && pnpm run build:cjs && pnpm run build:umd",
|
|
30
|
+
"test": "jest",
|
|
31
|
+
"lint": "eslint . --ext .ts",
|
|
32
|
+
"lint:fix": "eslint . --ext .ts --fix",
|
|
33
|
+
"prepare": "pnpm run build",
|
|
34
|
+
"prepublishOnly": "pnpm run build",
|
|
35
|
+
"release": "pnpm publish --access public",
|
|
36
|
+
"release:canary": "pnpm run prepublishOnly && pnpm publish --tag canary --access public",
|
|
37
|
+
"version:canary": "pnpm version prerelease --preid canary --no-git-tag-version",
|
|
38
|
+
"publish:canary": "pnpm run version:canary && pnpm run release:canary",
|
|
39
|
+
"demo:cli": "tsx examples/cli-demo.ts",
|
|
40
|
+
"demo:interactive": "tsx examples/interactive-demo.ts",
|
|
41
|
+
"demo:langchain": "tsx examples/langchain-demo.ts",
|
|
42
|
+
"demo:plugin": "tsx examples/plugin-system-example.ts",
|
|
43
|
+
"demo:plugin:weather": "tsx examples/plugins/weather/index.ts",
|
|
44
|
+
"demo:plugin:defi": "tsx examples/plugins/defi/index.ts",
|
|
45
|
+
"demo:plugin:openconvai": "tsx examples/openconvai-plugin-example.ts",
|
|
46
|
+
"demo:inscription-quotes": "tsx examples/inscription-quote-demo.ts",
|
|
47
|
+
"standards-agent:start": "tsx examples/standards-expert/cli.ts -- start",
|
|
48
|
+
"standards-agent:process-docs": "tsx examples/standards-expert/cli.ts -- process-docs --all-repos",
|
|
49
|
+
"typecheck": "tsc --noEmit"
|
|
50
|
+
},
|
|
24
51
|
"keywords": [
|
|
25
52
|
"hedera",
|
|
26
53
|
"hcs10",
|
|
@@ -63,7 +90,7 @@
|
|
|
63
90
|
},
|
|
64
91
|
"dependencies": {
|
|
65
92
|
"@hashgraph/sdk": "^2.69.0",
|
|
66
|
-
"@hashgraphonline/standards-sdk": "
|
|
93
|
+
"@hashgraphonline/standards-sdk": "^0.0.180",
|
|
67
94
|
"@langchain/community": "^0.3.49",
|
|
68
95
|
"@langchain/core": "^0.3.66",
|
|
69
96
|
"@langchain/openai": "^0.6.3",
|
|
@@ -101,28 +128,5 @@
|
|
|
101
128
|
"vite-plugin-node-polyfills": "^0.23.0",
|
|
102
129
|
"vite-plugin-string-replace": "^1.1.3"
|
|
103
130
|
},
|
|
104
|
-
"
|
|
105
|
-
|
|
106
|
-
"build:es": "BUILD_FORMAT=es vite build",
|
|
107
|
-
"build:cjs": "BUILD_FORMAT=cjs vite build",
|
|
108
|
-
"build:umd": "BUILD_FORMAT=umd vite build",
|
|
109
|
-
"build": "pnpm run clean && pnpm run build:es && pnpm run build:cjs && pnpm run build:umd",
|
|
110
|
-
"test": "jest",
|
|
111
|
-
"lint": "eslint . --ext .ts",
|
|
112
|
-
"lint:fix": "eslint . --ext .ts --fix",
|
|
113
|
-
"release": "pnpm publish --access public",
|
|
114
|
-
"release:canary": "pnpm run prepublishOnly && pnpm publish --tag canary --access public",
|
|
115
|
-
"version:canary": "pnpm version prerelease --preid canary --no-git-tag-version",
|
|
116
|
-
"publish:canary": "pnpm run version:canary && pnpm run release:canary",
|
|
117
|
-
"demo:cli": "tsx examples/cli-demo.ts",
|
|
118
|
-
"demo:interactive": "tsx examples/interactive-demo.ts",
|
|
119
|
-
"demo:langchain": "tsx examples/langchain-demo.ts",
|
|
120
|
-
"demo:plugin": "tsx examples/plugin-system-example.ts",
|
|
121
|
-
"demo:plugin:weather": "tsx examples/plugins/weather/index.ts",
|
|
122
|
-
"demo:plugin:defi": "tsx examples/plugins/defi/index.ts",
|
|
123
|
-
"demo:plugin:openconvai": "tsx examples/openconvai-plugin-example.ts",
|
|
124
|
-
"standards-agent:start": "tsx examples/standards-expert/cli.ts -- start",
|
|
125
|
-
"standards-agent:process-docs": "tsx examples/standards-expert/cli.ts -- process-docs --all-repos",
|
|
126
|
-
"typecheck": "tsc --noEmit"
|
|
127
|
-
}
|
|
128
|
-
}
|
|
131
|
+
"packageManager": "pnpm@10.11.1+sha512.e519b9f7639869dc8d5c3c5dfef73b3f091094b0a006d7317353c72b124e80e1afd429732e28705ad6bfa1ee879c1fce46c128ccebd3192101f43dd67c667912"
|
|
132
|
+
}
|
|
@@ -32,7 +32,7 @@ export class HCS6Builder extends BaseServiceBuilder {
|
|
|
32
32
|
if (!this.hcs6Client) {
|
|
33
33
|
const operatorId = this.hederaKit.signer.getAccountId().toString();
|
|
34
34
|
const operatorPrivateKey = this.hederaKit.signer?.getOperatorPrivateKey()
|
|
35
|
-
? this.hederaKit.signer.getOperatorPrivateKey().
|
|
35
|
+
? this.hederaKit.signer.getOperatorPrivateKey().toString()
|
|
36
36
|
: '';
|
|
37
37
|
|
|
38
38
|
const network = this.hederaKit.client.network;
|
|
@@ -59,7 +59,11 @@ export class HCS6Builder extends BaseServiceBuilder {
|
|
|
59
59
|
options: HCS6CreateRegistryOptions = {}
|
|
60
60
|
): Promise<HCS6TopicRegistrationResponse> {
|
|
61
61
|
const client = await this.getHCS6Client();
|
|
62
|
-
|
|
62
|
+
const sanitized = { ...options };
|
|
63
|
+
if ('adminKey' in sanitized) {
|
|
64
|
+
delete (sanitized as any).adminKey;
|
|
65
|
+
}
|
|
66
|
+
return await client.createRegistry(sanitized);
|
|
63
67
|
}
|
|
64
68
|
|
|
65
69
|
/**
|
|
@@ -91,7 +95,19 @@ export class HCS6Builder extends BaseServiceBuilder {
|
|
|
91
95
|
options: HCS6CreateHashinalOptions
|
|
92
96
|
): Promise<HCS6CreateHashinalResponse> {
|
|
93
97
|
const client = await this.getHCS6Client();
|
|
94
|
-
|
|
98
|
+
const metadata = {
|
|
99
|
+
name: options.metadata?.name || 'Dynamic Hashinal',
|
|
100
|
+
creator:
|
|
101
|
+
options.metadata?.creator || this.hederaKit.signer.getAccountId().toString(),
|
|
102
|
+
description: options.metadata?.description || 'Dynamic hashinal metadata',
|
|
103
|
+
type: options.metadata?.type || 'json',
|
|
104
|
+
...options.metadata,
|
|
105
|
+
} as Record<string, unknown>;
|
|
106
|
+
|
|
107
|
+
return await client.createHashinal({
|
|
108
|
+
...options,
|
|
109
|
+
metadata,
|
|
110
|
+
});
|
|
95
111
|
}
|
|
96
112
|
|
|
97
113
|
/**
|
|
@@ -102,7 +118,20 @@ export class HCS6Builder extends BaseServiceBuilder {
|
|
|
102
118
|
options: HCS6RegisterOptions
|
|
103
119
|
): Promise<HCS6CreateHashinalResponse> {
|
|
104
120
|
const client = await this.getHCS6Client();
|
|
105
|
-
|
|
121
|
+
const metadata = {
|
|
122
|
+
name: options.metadata?.name || 'Dynamic Hashinal',
|
|
123
|
+
creator:
|
|
124
|
+
options.metadata?.creator || this.hederaKit.signer.getAccountId().toString(),
|
|
125
|
+
description:
|
|
126
|
+
options.metadata?.description || 'Dynamic hashinal registration',
|
|
127
|
+
type: options.metadata?.type || 'json',
|
|
128
|
+
...options.metadata,
|
|
129
|
+
} as Record<string, unknown>;
|
|
130
|
+
|
|
131
|
+
return await client.register({
|
|
132
|
+
...options,
|
|
133
|
+
metadata,
|
|
134
|
+
});
|
|
106
135
|
}
|
|
107
136
|
|
|
108
137
|
/**
|
|
@@ -7,14 +7,13 @@ import { CallbackManagerForToolRun } from '@langchain/core/callbacks/manager';
|
|
|
7
7
|
* Schema for creating a dynamic hashinal registry
|
|
8
8
|
*/
|
|
9
9
|
const CreateDynamicRegistrySchema = z.object({
|
|
10
|
-
ttl: z
|
|
10
|
+
ttl: z
|
|
11
|
+
.number()
|
|
11
12
|
.min(3600)
|
|
12
13
|
.default(86400)
|
|
13
14
|
.describe('Time-to-live in seconds (minimum 3600 seconds/1 hour)'),
|
|
14
|
-
|
|
15
|
-
.
|
|
16
|
-
.describe('Admin key for the registry topic. Can be boolean (use operator key) or a public key string'),
|
|
17
|
-
submitKey: z.union([z.boolean(), z.string()])
|
|
15
|
+
submitKey: z
|
|
16
|
+
.union([z.boolean(), z.string()])
|
|
18
17
|
.optional()
|
|
19
18
|
.describe('Submit key for the registry topic. Can be boolean (use operator key) or a public key string'),
|
|
20
19
|
});
|
|
@@ -42,7 +41,6 @@ export class CreateDynamicRegistryTool extends BaseHCS6QueryTool<typeof CreateDy
|
|
|
42
41
|
): Promise<unknown> {
|
|
43
42
|
const result = await this.hcs6Builder.createRegistry({
|
|
44
43
|
ttl: params.ttl,
|
|
45
|
-
adminKey: params.adminKey,
|
|
46
44
|
submitKey: params.submitKey,
|
|
47
45
|
});
|
|
48
46
|
|
|
@@ -47,6 +47,11 @@ const inscribeFromBufferSchema = z.object({
|
|
|
47
47
|
'Timeout in milliseconds for inscription (default: no timeout - waits until completion)'
|
|
48
48
|
),
|
|
49
49
|
apiKey: z.string().optional().describe('API key for inscription service'),
|
|
50
|
+
quoteOnly: z
|
|
51
|
+
.boolean()
|
|
52
|
+
.optional()
|
|
53
|
+
.default(false)
|
|
54
|
+
.describe('If true, returns a cost quote instead of executing the inscription'),
|
|
50
55
|
});
|
|
51
56
|
|
|
52
57
|
export class InscribeFromBufferTool extends BaseInscriberQueryTool<
|
|
@@ -54,7 +59,7 @@ export class InscribeFromBufferTool extends BaseInscriberQueryTool<
|
|
|
54
59
|
> {
|
|
55
60
|
name = 'inscribeFromBuffer';
|
|
56
61
|
description =
|
|
57
|
-
'Inscribe content that you have already retrieved or displayed. When user says "inscribe it" after you showed search results or other content, use THIS tool. The base64Data field accepts PLAIN TEXT (not just base64) and content reference IDs in format "content-ref:[id]". Pass the EXACT content from your previous response or MCP tool output. DO NOT generate new content or create repetitive text. Content references are automatically resolved to the original content for inscription.';
|
|
62
|
+
'Inscribe content that you have already retrieved or displayed. When user says "inscribe it" after you showed search results or other content, use THIS tool. The base64Data field accepts PLAIN TEXT (not just base64) and content reference IDs in format "content-ref:[id]". Pass the EXACT content from your previous response or MCP tool output. DO NOT generate new content or create repetitive text. Content references are automatically resolved to the original content for inscription. Set quoteOnly=true to get cost estimates without executing the inscription.';
|
|
58
63
|
|
|
59
64
|
private config = loadConfig();
|
|
60
65
|
|
|
@@ -85,7 +90,7 @@ export class InscribeFromBufferTool extends BaseInscriberQueryTool<
|
|
|
85
90
|
metadata: params.metadata,
|
|
86
91
|
tags: params.tags,
|
|
87
92
|
chunkSize: params.chunkSize,
|
|
88
|
-
waitForConfirmation: params.waitForConfirmation ?? true,
|
|
93
|
+
waitForConfirmation: params.quoteOnly ? false : (params.waitForConfirmation ?? true),
|
|
89
94
|
waitMaxAttempts: 10,
|
|
90
95
|
waitIntervalMs: 3000,
|
|
91
96
|
apiKey: params.apiKey,
|
|
@@ -94,8 +99,42 @@ export class InscribeFromBufferTool extends BaseInscriberQueryTool<
|
|
|
94
99
|
.includes('mainnet')
|
|
95
100
|
? 'mainnet'
|
|
96
101
|
: 'testnet',
|
|
102
|
+
quoteOnly: params.quoteOnly,
|
|
97
103
|
};
|
|
98
104
|
|
|
105
|
+
if (params.quoteOnly) {
|
|
106
|
+
try {
|
|
107
|
+
const quote = await this.generateInscriptionQuote(
|
|
108
|
+
{
|
|
109
|
+
type: 'buffer',
|
|
110
|
+
buffer,
|
|
111
|
+
fileName: resolvedFileName,
|
|
112
|
+
mimeType: resolvedMimeType,
|
|
113
|
+
},
|
|
114
|
+
options
|
|
115
|
+
);
|
|
116
|
+
|
|
117
|
+
return {
|
|
118
|
+
success: true,
|
|
119
|
+
quote: {
|
|
120
|
+
totalCostHbar: quote.totalCostHbar,
|
|
121
|
+
validUntil: quote.validUntil,
|
|
122
|
+
breakdown: quote.breakdown,
|
|
123
|
+
},
|
|
124
|
+
contentInfo: {
|
|
125
|
+
fileName: resolvedFileName,
|
|
126
|
+
mimeType: resolvedMimeType,
|
|
127
|
+
sizeBytes: buffer.length,
|
|
128
|
+
},
|
|
129
|
+
message: `Quote generated for buffer content: ${resolvedFileName} (${(buffer.length / 1024).toFixed(2)} KB)\nTotal cost: ${quote.totalCostHbar} HBAR\nQuote valid until: ${new Date(quote.validUntil).toLocaleString()}`,
|
|
130
|
+
};
|
|
131
|
+
} catch (error) {
|
|
132
|
+
const errorMessage =
|
|
133
|
+
error instanceof Error ? error.message : 'Failed to generate inscription quote';
|
|
134
|
+
throw new Error(`Quote generation failed: ${errorMessage}`);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
99
138
|
const timeoutMs =
|
|
100
139
|
params.timeoutMs || (options.waitForConfirmation ? 60000 : undefined);
|
|
101
140
|
|
|
@@ -210,20 +249,24 @@ export class InscribeFromBufferTool extends BaseInscriberQueryTool<
|
|
|
210
249
|
result: Awaited<ReturnType<typeof this.inscriberBuilder.inscribe>>,
|
|
211
250
|
options: InscriptionOptions
|
|
212
251
|
): string {
|
|
213
|
-
if (result.confirmed) {
|
|
214
|
-
const topicId = result.inscription?.topic_id || result.result.topicId;
|
|
252
|
+
if (result.confirmed && !result.quote) {
|
|
253
|
+
const topicId = result.inscription?.topic_id || (result.result as any).topicId;
|
|
215
254
|
const network = options.network || 'testnet';
|
|
216
255
|
const cdnUrl = topicId
|
|
217
256
|
? `https://kiloscribe.com/api/inscription-cdn/${topicId}?network=${network}`
|
|
218
257
|
: null;
|
|
219
258
|
return `Successfully inscribed and confirmed content on the Hedera network!\n\nTransaction ID: ${
|
|
220
|
-
result.result.transactionId
|
|
259
|
+
(result.result as any).transactionId
|
|
221
260
|
}\nTopic ID: ${topicId || 'N/A'}${
|
|
222
261
|
cdnUrl ? `\nView inscription: ${cdnUrl}` : ''
|
|
223
262
|
}\n\nThe inscription is now available.`;
|
|
224
263
|
}
|
|
225
264
|
|
|
226
|
-
|
|
265
|
+
if (!result.quote && !result.confirmed) {
|
|
266
|
+
return `Successfully submitted inscription to the Hedera network!\n\nTransaction ID: ${(result.result as any).transactionId}\n\nThe inscription is processing and will be confirmed shortly.`;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
return 'Inscription operation completed.';
|
|
227
270
|
}
|
|
228
271
|
|
|
229
272
|
private async resolveContent(
|
|
@@ -238,11 +281,9 @@ export class InscribeFromBufferTool extends BaseInscriberQueryTool<
|
|
|
238
281
|
}> {
|
|
239
282
|
const trimmedInput = input.trim();
|
|
240
283
|
|
|
241
|
-
// Try to get resolver from either injected dependency or registry
|
|
242
284
|
const resolver = this.getContentResolver() || ContentResolverRegistry.getResolver();
|
|
243
285
|
|
|
244
286
|
if (!resolver) {
|
|
245
|
-
// No resolver available, handle content directly
|
|
246
287
|
return this.handleDirectContent(trimmedInput, providedMimeType, providedFileName);
|
|
247
288
|
}
|
|
248
289
|
|
|
@@ -267,7 +308,6 @@ export class InscribeFromBufferTool extends BaseInscriberQueryTool<
|
|
|
267
308
|
}
|
|
268
309
|
}
|
|
269
310
|
|
|
270
|
-
// No reference found, handle as direct content
|
|
271
311
|
return this.handleDirectContent(trimmedInput, providedMimeType, providedFileName);
|
|
272
312
|
}
|
|
273
313
|
|
|
@@ -39,6 +39,11 @@ const inscribeFromFileSchema = z.object({
|
|
|
39
39
|
.optional()
|
|
40
40
|
.describe('Timeout in milliseconds for inscription (default: no timeout)'),
|
|
41
41
|
apiKey: z.string().optional().describe('API key for inscription service'),
|
|
42
|
+
quoteOnly: z
|
|
43
|
+
.boolean()
|
|
44
|
+
.optional()
|
|
45
|
+
.default(false)
|
|
46
|
+
.describe('If true, returns a cost quote instead of executing the inscription'),
|
|
42
47
|
});
|
|
43
48
|
|
|
44
49
|
/**
|
|
@@ -49,7 +54,7 @@ export class InscribeFromFileTool extends BaseInscriberQueryTool<
|
|
|
49
54
|
> {
|
|
50
55
|
name = 'inscribeFromFile';
|
|
51
56
|
description =
|
|
52
|
-
'Inscribe content from a local file to the Hedera network using a file path. IMPORTANT: Only use this tool when you have a valid file path to actual content. The file must exist and contain meaningful data (minimum 10 bytes). For files accessed through MCP filesystem tools, consider reading the file content first and using inscribeFromBuffer instead.';
|
|
57
|
+
'Inscribe content from a local file to the Hedera network using a file path. IMPORTANT: Only use this tool when you have a valid file path to actual content. The file must exist and contain meaningful data (minimum 10 bytes). For files accessed through MCP filesystem tools, consider reading the file content first and using inscribeFromBuffer instead. Set quoteOnly=true to get cost estimates without executing the inscription.';
|
|
53
58
|
|
|
54
59
|
get specificInputSchema(): typeof inscribeFromFileSchema {
|
|
55
60
|
return inscribeFromFileSchema;
|
|
@@ -61,7 +66,6 @@ export class InscribeFromFileTool extends BaseInscriberQueryTool<
|
|
|
61
66
|
): Promise<unknown> {
|
|
62
67
|
console.log(`[DEBUG] InscribeFromFileTool.executeQuery called with: ${params.filePath}`);
|
|
63
68
|
|
|
64
|
-
// File validation
|
|
65
69
|
let fileContent: Buffer;
|
|
66
70
|
try {
|
|
67
71
|
console.log(`[DEBUG] Checking file: ${params.filePath}`);
|
|
@@ -138,7 +142,7 @@ export class InscribeFromFileTool extends BaseInscriberQueryTool<
|
|
|
138
142
|
metadata: params.metadata,
|
|
139
143
|
tags: params.tags,
|
|
140
144
|
chunkSize: params.chunkSize,
|
|
141
|
-
waitForConfirmation: params.waitForConfirmation ?? true,
|
|
145
|
+
waitForConfirmation: params.quoteOnly ? false : (params.waitForConfirmation ?? true),
|
|
142
146
|
waitMaxAttempts: 10,
|
|
143
147
|
waitIntervalMs: 3000,
|
|
144
148
|
apiKey: params.apiKey,
|
|
@@ -147,10 +151,45 @@ export class InscribeFromFileTool extends BaseInscriberQueryTool<
|
|
|
147
151
|
.includes('mainnet')
|
|
148
152
|
? 'mainnet'
|
|
149
153
|
: 'testnet',
|
|
154
|
+
quoteOnly: params.quoteOnly,
|
|
150
155
|
};
|
|
151
156
|
|
|
157
|
+
if (params.quoteOnly) {
|
|
158
|
+
try {
|
|
159
|
+
const quote = await this.generateInscriptionQuote(
|
|
160
|
+
{
|
|
161
|
+
type: 'buffer',
|
|
162
|
+
buffer: Buffer.from(base64Data, 'base64'),
|
|
163
|
+
fileName,
|
|
164
|
+
mimeType,
|
|
165
|
+
},
|
|
166
|
+
options
|
|
167
|
+
);
|
|
168
|
+
|
|
169
|
+
return {
|
|
170
|
+
success: true,
|
|
171
|
+
quote: {
|
|
172
|
+
totalCostHbar: quote.totalCostHbar,
|
|
173
|
+
validUntil: quote.validUntil,
|
|
174
|
+
breakdown: quote.breakdown,
|
|
175
|
+
},
|
|
176
|
+
contentInfo: {
|
|
177
|
+
fileName,
|
|
178
|
+
mimeType,
|
|
179
|
+
sizeBytes: fileContent.length,
|
|
180
|
+
filePath: params.filePath,
|
|
181
|
+
},
|
|
182
|
+
message: `Quote generated for file: ${fileName} (${(fileContent.length / 1024).toFixed(2)} KB)\nTotal cost: ${quote.totalCostHbar} HBAR\nQuote valid until: ${new Date(quote.validUntil).toLocaleString()}`,
|
|
183
|
+
};
|
|
184
|
+
} catch (error) {
|
|
185
|
+
const errorMessage =
|
|
186
|
+
error instanceof Error ? error.message : 'Failed to generate inscription quote';
|
|
187
|
+
throw new Error(`Quote generation failed: ${errorMessage}`);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
152
191
|
try {
|
|
153
|
-
let result:
|
|
192
|
+
let result: unknown;
|
|
154
193
|
|
|
155
194
|
if (params.timeoutMs) {
|
|
156
195
|
const timeoutPromise = new Promise((_, reject) => {
|
|
@@ -184,19 +223,22 @@ export class InscribeFromFileTool extends BaseInscriberQueryTool<
|
|
|
184
223
|
);
|
|
185
224
|
}
|
|
186
225
|
|
|
187
|
-
|
|
188
|
-
|
|
226
|
+
const inscriptionResult = result as any;
|
|
227
|
+
if (inscriptionResult.confirmed && !inscriptionResult.quote) {
|
|
228
|
+
const topicId = inscriptionResult.inscription?.topic_id || inscriptionResult.result.topicId;
|
|
189
229
|
const network = options.network || 'testnet';
|
|
190
230
|
const cdnUrl = topicId
|
|
191
231
|
? `https://kiloscribe.com/api/inscription-cdn/${topicId}?network=${network}`
|
|
192
232
|
: null;
|
|
193
233
|
return `Successfully inscribed and confirmed content on the Hedera network!\n\nTransaction ID: ${
|
|
194
|
-
|
|
234
|
+
inscriptionResult.result.transactionId
|
|
195
235
|
}\nTopic ID: ${topicId || 'N/A'}${
|
|
196
236
|
cdnUrl ? `\nView inscription: ${cdnUrl}` : ''
|
|
197
237
|
}\n\nThe inscription is now available.`;
|
|
238
|
+
} else if (!inscriptionResult.quote && !inscriptionResult.confirmed) {
|
|
239
|
+
return `Successfully submitted inscription to the Hedera network!\n\nTransaction ID: ${inscriptionResult.result.transactionId}\n\nThe inscription is processing and will be confirmed shortly.`;
|
|
198
240
|
} else {
|
|
199
|
-
return
|
|
241
|
+
return 'Inscription operation completed.';
|
|
200
242
|
}
|
|
201
243
|
} catch (error) {
|
|
202
244
|
const errorMessage =
|