@hashgraphonline/standards-agent-kit 0.2.125 → 0.2.129

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/cjs/standards-agent-kit.cjs +1 -1
  2. package/dist/cjs/standards-agent-kit.cjs.map +1 -1
  3. package/dist/cjs/tools/inscriber/InscribeFromBufferTool.d.ts +2 -10
  4. package/dist/cjs/tools/inscriber/InscribeHashinalTool.d.ts +62 -30
  5. package/dist/cjs/utils/content-resolver.d.ts +10 -0
  6. package/dist/cjs/utils/metadata-defaults.d.ts +18 -0
  7. package/dist/cjs/validation/content-ref-schemas.d.ts +9 -0
  8. package/dist/cjs/validation/hip412-schemas.d.ts +125 -0
  9. package/dist/es/standards-agent-kit.es34.js +64 -22
  10. package/dist/es/standards-agent-kit.es34.js.map +1 -1
  11. package/dist/es/standards-agent-kit.es36.js +12 -65
  12. package/dist/es/standards-agent-kit.es36.js.map +1 -1
  13. package/dist/es/standards-agent-kit.es37.js +159 -33
  14. package/dist/es/standards-agent-kit.es37.js.map +1 -1
  15. package/dist/es/standards-agent-kit.es44.js +57 -0
  16. package/dist/es/standards-agent-kit.es44.js.map +1 -0
  17. package/dist/es/standards-agent-kit.es45.js +6 -0
  18. package/dist/es/standards-agent-kit.es45.js.map +1 -0
  19. package/dist/es/standards-agent-kit.es46.js +43 -0
  20. package/dist/es/standards-agent-kit.es46.js.map +1 -0
  21. package/dist/es/standards-agent-kit.es47.js +15 -0
  22. package/dist/es/standards-agent-kit.es47.js.map +1 -0
  23. package/dist/es/tools/inscriber/InscribeFromBufferTool.d.ts +2 -10
  24. package/dist/es/tools/inscriber/InscribeHashinalTool.d.ts +62 -30
  25. package/dist/es/utils/content-resolver.d.ts +10 -0
  26. package/dist/es/utils/metadata-defaults.d.ts +18 -0
  27. package/dist/es/validation/content-ref-schemas.d.ts +9 -0
  28. package/dist/es/validation/hip412-schemas.d.ts +125 -0
  29. package/dist/umd/standards-agent-kit.umd.js +1 -1
  30. package/dist/umd/standards-agent-kit.umd.js.map +1 -1
  31. package/dist/umd/tools/inscriber/InscribeFromBufferTool.d.ts +2 -10
  32. package/dist/umd/tools/inscriber/InscribeHashinalTool.d.ts +62 -30
  33. package/dist/umd/utils/content-resolver.d.ts +10 -0
  34. package/dist/umd/utils/metadata-defaults.d.ts +18 -0
  35. package/dist/umd/validation/content-ref-schemas.d.ts +9 -0
  36. package/dist/umd/validation/hip412-schemas.d.ts +125 -0
  37. package/package.json +5 -5
  38. package/src/tools/inscriber/InscribeFromBufferTool.ts +31 -137
  39. package/src/tools/inscriber/InscribeFromUrlTool.ts +147 -65
  40. package/src/tools/inscriber/InscribeHashinalTool.ts +271 -46
  41. package/src/utils/content-resolver.ts +87 -0
  42. package/src/utils/metadata-defaults.ts +25 -0
  43. package/src/validation/content-ref-schemas.ts +20 -0
  44. package/src/validation/hip412-schemas.ts +52 -0
@@ -2,10 +2,9 @@ import { z } from 'zod';
2
2
  import { BaseInscriberQueryTool } from './base-inscriber-tools';
3
3
  import { CallbackManagerForToolRun } from '@langchain/core/callbacks/manager';
4
4
  declare const inscribeFromBufferSchema: z.ZodObject<{
5
- base64Data: z.ZodString;
5
+ base64Data: z.ZodUnion<[z.ZodString, z.ZodString]>;
6
6
  fileName: z.ZodString;
7
7
  mimeType: z.ZodOptional<z.ZodString>;
8
- mode: z.ZodOptional<z.ZodEnum<["file", "hashinal"]>>;
9
8
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
10
9
  tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
11
10
  chunkSize: z.ZodOptional<z.ZodNumber>;
@@ -20,7 +19,6 @@ declare const inscribeFromBufferSchema: z.ZodObject<{
20
19
  tags?: string[] | undefined;
21
20
  metadata?: Record<string, unknown> | undefined;
22
21
  mimeType?: string | undefined;
23
- mode?: "file" | "hashinal" | undefined;
24
22
  chunkSize?: number | undefined;
25
23
  waitForConfirmation?: boolean | undefined;
26
24
  timeoutMs?: number | undefined;
@@ -31,7 +29,6 @@ declare const inscribeFromBufferSchema: z.ZodObject<{
31
29
  tags?: string[] | undefined;
32
30
  metadata?: Record<string, unknown> | undefined;
33
31
  mimeType?: string | undefined;
34
- mode?: "file" | "hashinal" | undefined;
35
32
  chunkSize?: number | undefined;
36
33
  waitForConfirmation?: boolean | undefined;
37
34
  timeoutMs?: number | undefined;
@@ -43,10 +40,9 @@ export declare class InscribeFromBufferTool extends BaseInscriberQueryTool<typeo
43
40
  description: string;
44
41
  private config;
45
42
  get specificInputSchema(): z.ZodObject<{
46
- base64Data: z.ZodString;
43
+ base64Data: z.ZodUnion<[z.ZodString, z.ZodString]>;
47
44
  fileName: z.ZodString;
48
45
  mimeType: z.ZodOptional<z.ZodString>;
49
- mode: z.ZodOptional<z.ZodEnum<["file", "hashinal"]>>;
50
46
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
51
47
  tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
52
48
  chunkSize: z.ZodOptional<z.ZodNumber>;
@@ -61,7 +57,6 @@ export declare class InscribeFromBufferTool extends BaseInscriberQueryTool<typeo
61
57
  tags?: string[] | undefined;
62
58
  metadata?: Record<string, unknown> | undefined;
63
59
  mimeType?: string | undefined;
64
- mode?: "file" | "hashinal" | undefined;
65
60
  chunkSize?: number | undefined;
66
61
  waitForConfirmation?: boolean | undefined;
67
62
  timeoutMs?: number | undefined;
@@ -72,7 +67,6 @@ export declare class InscribeFromBufferTool extends BaseInscriberQueryTool<typeo
72
67
  tags?: string[] | undefined;
73
68
  metadata?: Record<string, unknown> | undefined;
74
69
  mimeType?: string | undefined;
75
- mode?: "file" | "hashinal" | undefined;
76
70
  chunkSize?: number | undefined;
77
71
  waitForConfirmation?: boolean | undefined;
78
72
  timeoutMs?: number | undefined;
@@ -84,7 +78,5 @@ export declare class InscribeFromBufferTool extends BaseInscriberQueryTool<typeo
84
78
  private validateContent;
85
79
  private executeInscription;
86
80
  private formatInscriptionResult;
87
- private resolveContent;
88
- private handleDirectContent;
89
81
  }
90
82
  export {};
@@ -5,11 +5,15 @@ import { CallbackManagerForToolRun } from '@langchain/core/callbacks/manager';
5
5
  * Schema for inscribing Hashinal NFT
6
6
  */
7
7
  declare const inscribeHashinalSchema: z.ZodObject<{
8
- url: z.ZodString;
9
- name: z.ZodString;
10
- creator: z.ZodString;
11
- description: z.ZodString;
12
- type: z.ZodString;
8
+ url: z.ZodOptional<z.ZodString>;
9
+ contentRef: z.ZodOptional<z.ZodString>;
10
+ base64Data: z.ZodOptional<z.ZodString>;
11
+ fileName: z.ZodOptional<z.ZodString>;
12
+ mimeType: z.ZodOptional<z.ZodString>;
13
+ name: z.ZodOptional<z.ZodString>;
14
+ creator: z.ZodOptional<z.ZodString>;
15
+ description: z.ZodOptional<z.ZodString>;
16
+ type: z.ZodOptional<z.ZodString>;
13
17
  attributes: z.ZodOptional<z.ZodArray<z.ZodObject<{
14
18
  trait_type: z.ZodString;
15
19
  value: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
@@ -22,6 +26,7 @@ declare const inscribeHashinalSchema: z.ZodObject<{
22
26
  }>, "many">>;
23
27
  properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
24
28
  jsonFileURL: z.ZodOptional<z.ZodString>;
29
+ fileStandard: z.ZodDefault<z.ZodOptional<z.ZodEnum<["1", "6"]>>>;
25
30
  tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
26
31
  chunkSize: z.ZodOptional<z.ZodNumber>;
27
32
  waitForConfirmation: z.ZodOptional<z.ZodBoolean>;
@@ -29,41 +34,51 @@ declare const inscribeHashinalSchema: z.ZodObject<{
29
34
  apiKey: z.ZodOptional<z.ZodString>;
30
35
  quoteOnly: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
31
36
  }, "strip", z.ZodTypeAny, {
32
- url: string;
33
- type: string;
34
- name: string;
35
- description: string;
36
- creator: string;
37
37
  quoteOnly: boolean;
38
+ fileStandard: "1" | "6";
39
+ url?: string | undefined;
40
+ type?: string | undefined;
41
+ name?: string | undefined;
42
+ description?: string | undefined;
38
43
  tags?: string[] | undefined;
44
+ creator?: string | undefined;
39
45
  properties?: Record<string, unknown> | undefined;
46
+ mimeType?: string | undefined;
40
47
  chunkSize?: number | undefined;
41
48
  waitForConfirmation?: boolean | undefined;
42
49
  timeoutMs?: number | undefined;
43
50
  apiKey?: string | undefined;
51
+ fileName?: string | undefined;
52
+ base64Data?: string | undefined;
44
53
  attributes?: {
45
54
  value: string | number;
46
55
  trait_type: string;
47
56
  }[] | undefined;
57
+ contentRef?: string | undefined;
48
58
  jsonFileURL?: string | undefined;
49
59
  }, {
50
- url: string;
51
- type: string;
52
- name: string;
53
- description: string;
54
- creator: string;
60
+ url?: string | undefined;
61
+ type?: string | undefined;
62
+ name?: string | undefined;
63
+ description?: string | undefined;
55
64
  tags?: string[] | undefined;
65
+ creator?: string | undefined;
56
66
  properties?: Record<string, unknown> | undefined;
67
+ mimeType?: string | undefined;
57
68
  chunkSize?: number | undefined;
58
69
  waitForConfirmation?: boolean | undefined;
59
70
  timeoutMs?: number | undefined;
60
71
  apiKey?: string | undefined;
61
72
  quoteOnly?: boolean | undefined;
73
+ fileName?: string | undefined;
74
+ base64Data?: string | undefined;
62
75
  attributes?: {
63
76
  value: string | number;
64
77
  trait_type: string;
65
78
  }[] | undefined;
79
+ contentRef?: string | undefined;
66
80
  jsonFileURL?: string | undefined;
81
+ fileStandard?: "1" | "6" | undefined;
67
82
  }>;
68
83
  /**
69
84
  * Tool for inscribing Hashinal NFTs
@@ -72,11 +87,15 @@ export declare class InscribeHashinalTool extends BaseInscriberQueryTool<typeof
72
87
  name: string;
73
88
  description: string;
74
89
  get specificInputSchema(): z.ZodObject<{
75
- url: z.ZodString;
76
- name: z.ZodString;
77
- creator: z.ZodString;
78
- description: z.ZodString;
79
- type: z.ZodString;
90
+ url: z.ZodOptional<z.ZodString>;
91
+ contentRef: z.ZodOptional<z.ZodString>;
92
+ base64Data: z.ZodOptional<z.ZodString>;
93
+ fileName: z.ZodOptional<z.ZodString>;
94
+ mimeType: z.ZodOptional<z.ZodString>;
95
+ name: z.ZodOptional<z.ZodString>;
96
+ creator: z.ZodOptional<z.ZodString>;
97
+ description: z.ZodOptional<z.ZodString>;
98
+ type: z.ZodOptional<z.ZodString>;
80
99
  attributes: z.ZodOptional<z.ZodArray<z.ZodObject<{
81
100
  trait_type: z.ZodString;
82
101
  value: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
@@ -89,6 +108,7 @@ export declare class InscribeHashinalTool extends BaseInscriberQueryTool<typeof
89
108
  }>, "many">>;
90
109
  properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
91
110
  jsonFileURL: z.ZodOptional<z.ZodString>;
111
+ fileStandard: z.ZodDefault<z.ZodOptional<z.ZodEnum<["1", "6"]>>>;
92
112
  tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
93
113
  chunkSize: z.ZodOptional<z.ZodNumber>;
94
114
  waitForConfirmation: z.ZodOptional<z.ZodBoolean>;
@@ -96,42 +116,54 @@ export declare class InscribeHashinalTool extends BaseInscriberQueryTool<typeof
96
116
  apiKey: z.ZodOptional<z.ZodString>;
97
117
  quoteOnly: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
98
118
  }, "strip", z.ZodTypeAny, {
99
- url: string;
100
- type: string;
101
- name: string;
102
- description: string;
103
- creator: string;
104
119
  quoteOnly: boolean;
120
+ fileStandard: "1" | "6";
121
+ url?: string | undefined;
122
+ type?: string | undefined;
123
+ name?: string | undefined;
124
+ description?: string | undefined;
105
125
  tags?: string[] | undefined;
126
+ creator?: string | undefined;
106
127
  properties?: Record<string, unknown> | undefined;
128
+ mimeType?: string | undefined;
107
129
  chunkSize?: number | undefined;
108
130
  waitForConfirmation?: boolean | undefined;
109
131
  timeoutMs?: number | undefined;
110
132
  apiKey?: string | undefined;
133
+ fileName?: string | undefined;
134
+ base64Data?: string | undefined;
111
135
  attributes?: {
112
136
  value: string | number;
113
137
  trait_type: string;
114
138
  }[] | undefined;
139
+ contentRef?: string | undefined;
115
140
  jsonFileURL?: string | undefined;
116
141
  }, {
117
- url: string;
118
- type: string;
119
- name: string;
120
- description: string;
121
- creator: string;
142
+ url?: string | undefined;
143
+ type?: string | undefined;
144
+ name?: string | undefined;
145
+ description?: string | undefined;
122
146
  tags?: string[] | undefined;
147
+ creator?: string | undefined;
123
148
  properties?: Record<string, unknown> | undefined;
149
+ mimeType?: string | undefined;
124
150
  chunkSize?: number | undefined;
125
151
  waitForConfirmation?: boolean | undefined;
126
152
  timeoutMs?: number | undefined;
127
153
  apiKey?: string | undefined;
128
154
  quoteOnly?: boolean | undefined;
155
+ fileName?: string | undefined;
156
+ base64Data?: string | undefined;
129
157
  attributes?: {
130
158
  value: string | number;
131
159
  trait_type: string;
132
160
  }[] | undefined;
161
+ contentRef?: string | undefined;
133
162
  jsonFileURL?: string | undefined;
163
+ fileStandard?: "1" | "6" | undefined;
134
164
  }>;
135
165
  protected executeQuery(params: z.infer<typeof inscribeHashinalSchema>, _runManager?: CallbackManagerForToolRun): Promise<unknown>;
166
+ private resolveContent;
167
+ private handleDirectContent;
136
168
  }
137
169
  export {};
@@ -0,0 +1,10 @@
1
+ export interface ContentResolutionResult {
2
+ buffer: Buffer;
3
+ mimeType?: string;
4
+ fileName?: string;
5
+ wasReference?: boolean;
6
+ }
7
+ /**
8
+ * Resolves content from various input formats (content-ref, base64, plain text)
9
+ */
10
+ export declare function resolveContent(input: string, providedMimeType?: string, providedFileName?: string): Promise<ContentResolutionResult>;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Generates default metadata for NFT inscription
3
+ */
4
+ export declare function generateDefaultMetadata(params: {
5
+ name?: string;
6
+ creator?: string;
7
+ description?: string;
8
+ type?: string;
9
+ fileName?: string;
10
+ mimeType?: string;
11
+ operatorAccount: string;
12
+ }): {
13
+ name: string;
14
+ creator: string;
15
+ description: string;
16
+ type: string;
17
+ image: string;
18
+ };
@@ -0,0 +1,9 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Validates content reference format
4
+ */
5
+ export declare const contentRefSchema: z.ZodString;
6
+ /**
7
+ * Validates content reference or returns error for dumber models
8
+ */
9
+ export declare function validateContentRef(input: string): string;
@@ -0,0 +1,125 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * HIP-412 file schema for multi-file NFTs
4
+ */
5
+ export declare const hip412FileSchema: z.ZodObject<{
6
+ uri: z.ZodString;
7
+ checksum: z.ZodOptional<z.ZodString>;
8
+ is_default_file: z.ZodOptional<z.ZodBoolean>;
9
+ type: z.ZodString;
10
+ }, "strip", z.ZodTypeAny, {
11
+ type: string;
12
+ uri: string;
13
+ checksum?: string | undefined;
14
+ is_default_file?: boolean | undefined;
15
+ }, {
16
+ type: string;
17
+ uri: string;
18
+ checksum?: string | undefined;
19
+ is_default_file?: boolean | undefined;
20
+ }>;
21
+ /**
22
+ * HIP-412 attribute schema for NFT traits
23
+ */
24
+ export declare const hip412AttributeSchema: z.ZodObject<{
25
+ trait_type: z.ZodString;
26
+ value: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
27
+ display_type: z.ZodOptional<z.ZodString>;
28
+ }, "strip", z.ZodTypeAny, {
29
+ value: string | number;
30
+ trait_type: string;
31
+ display_type?: string | undefined;
32
+ }, {
33
+ value: string | number;
34
+ trait_type: string;
35
+ display_type?: string | undefined;
36
+ }>;
37
+ /**
38
+ * HIP-412 compliant metadata schema for Hedera NFTs
39
+ */
40
+ export declare const hip412MetadataSchema: z.ZodObject<{
41
+ name: z.ZodString;
42
+ description: z.ZodString;
43
+ image: z.ZodString;
44
+ type: z.ZodString;
45
+ creator: z.ZodOptional<z.ZodString>;
46
+ creatorDID: z.ZodOptional<z.ZodString>;
47
+ checksum: z.ZodOptional<z.ZodString>;
48
+ format: z.ZodDefault<z.ZodOptional<z.ZodString>>;
49
+ files: z.ZodOptional<z.ZodArray<z.ZodObject<{
50
+ uri: z.ZodString;
51
+ checksum: z.ZodOptional<z.ZodString>;
52
+ is_default_file: z.ZodOptional<z.ZodBoolean>;
53
+ type: z.ZodString;
54
+ }, "strip", z.ZodTypeAny, {
55
+ type: string;
56
+ uri: string;
57
+ checksum?: string | undefined;
58
+ is_default_file?: boolean | undefined;
59
+ }, {
60
+ type: string;
61
+ uri: string;
62
+ checksum?: string | undefined;
63
+ is_default_file?: boolean | undefined;
64
+ }>, "many">>;
65
+ attributes: z.ZodOptional<z.ZodArray<z.ZodObject<{
66
+ trait_type: z.ZodString;
67
+ value: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
68
+ display_type: z.ZodOptional<z.ZodString>;
69
+ }, "strip", z.ZodTypeAny, {
70
+ value: string | number;
71
+ trait_type: string;
72
+ display_type?: string | undefined;
73
+ }, {
74
+ value: string | number;
75
+ trait_type: string;
76
+ display_type?: string | undefined;
77
+ }>, "many">>;
78
+ properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
79
+ }, "strip", z.ZodTypeAny, {
80
+ type: string;
81
+ image: string;
82
+ name: string;
83
+ description: string;
84
+ format: string;
85
+ creator?: string | undefined;
86
+ properties?: Record<string, unknown> | undefined;
87
+ checksum?: string | undefined;
88
+ creatorDID?: string | undefined;
89
+ files?: {
90
+ type: string;
91
+ uri: string;
92
+ checksum?: string | undefined;
93
+ is_default_file?: boolean | undefined;
94
+ }[] | undefined;
95
+ attributes?: {
96
+ value: string | number;
97
+ trait_type: string;
98
+ display_type?: string | undefined;
99
+ }[] | undefined;
100
+ }, {
101
+ type: string;
102
+ image: string;
103
+ name: string;
104
+ description: string;
105
+ creator?: string | undefined;
106
+ properties?: Record<string, unknown> | undefined;
107
+ checksum?: string | undefined;
108
+ creatorDID?: string | undefined;
109
+ format?: string | undefined;
110
+ files?: {
111
+ type: string;
112
+ uri: string;
113
+ checksum?: string | undefined;
114
+ is_default_file?: boolean | undefined;
115
+ }[] | undefined;
116
+ attributes?: {
117
+ value: string | number;
118
+ trait_type: string;
119
+ display_type?: string | undefined;
120
+ }[] | undefined;
121
+ }>;
122
+ /**
123
+ * Validates metadata against HIP-412 standard
124
+ */
125
+ export declare function validateHIP412Metadata(metadata: any): z.infer<typeof hip412MetadataSchema>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hashgraphonline/standards-agent-kit",
3
- "version": "0.2.125",
3
+ "version": "0.2.129",
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",
@@ -90,10 +90,10 @@
90
90
  },
91
91
  "dependencies": {
92
92
  "@hashgraph/sdk": "^2.69.0",
93
- "@hashgraphonline/standards-sdk": "^0.0.180",
94
- "@langchain/community": "^0.3.49",
95
- "@langchain/core": "^0.3.66",
96
- "@langchain/openai": "^0.6.3",
93
+ "@hashgraphonline/standards-sdk": "0.0.181",
94
+ "@langchain/community": "^0.3.5",
95
+ "@langchain/core": "^0.3.7",
96
+ "@langchain/openai": "^0.6.7",
97
97
  "@octokit/rest": "^21.1.1",
98
98
  "axios": "^1.11.0",
99
99
  "chromadb": "^2.4.6",
@@ -1,57 +1,23 @@
1
1
  import { z } from 'zod';
2
2
  import { BaseInscriberQueryTool } from './base-inscriber-tools';
3
- import { InscriptionOptions, ContentResolverRegistry } from '@hashgraphonline/standards-sdk';
3
+ import { InscriptionOptions } from '@hashgraphonline/standards-sdk';
4
4
  import { CallbackManagerForToolRun } from '@langchain/core/callbacks/manager';
5
+ import { resolveContent } from '../../utils/content-resolver';
6
+ import { contentRefSchema } from '../../validation/content-ref-schemas';
5
7
  import { loadConfig } from '../../config/ContentReferenceConfig';
6
8
 
7
9
  const inscribeFromBufferSchema = z.object({
8
- base64Data: z
9
- .string()
10
- .min(1, 'Data cannot be empty')
11
- .describe(
12
- 'The content to inscribe. Accept BOTH plain text AND base64. Also accepts content reference IDs in format "content-ref:[id]". When user says "inscribe it" or "inscribe the content", use the EXACT content from your previous message or from MCP tool results. DO NOT generate new content. DO NOT create repetitive text. Pass the actual search results or other retrieved content EXACTLY as you received it.'
13
- ),
14
- fileName: z
15
- .string()
16
- .min(1, 'File name cannot be empty')
17
- .describe('Name for the inscribed content. Required for all inscriptions.'),
10
+ base64Data: z.union([z.string(), contentRefSchema])
11
+ .describe('Content to inscribe as base64 data, plain text, or content reference'),
12
+ fileName: z.string().min(1).describe('Name for the inscribed content'),
18
13
  mimeType: z.string().optional().describe('MIME type of the content'),
19
- mode: z
20
- .enum(['file', 'hashinal'])
21
- .optional()
22
- .describe('Inscription mode: file or hashinal NFT'),
23
- metadata: z
24
- .record(z.unknown())
25
- .optional()
26
- .describe('Metadata to attach to the inscription'),
27
- tags: z
28
- .array(z.string())
29
- .optional()
30
- .describe('Tags to categorize the inscription'),
31
- chunkSize: z
32
- .number()
33
- .int()
34
- .positive()
35
- .optional()
36
- .describe('Chunk size for large files'),
37
- waitForConfirmation: z
38
- .boolean()
39
- .optional()
40
- .describe('Whether to wait for inscription confirmation'),
41
- timeoutMs: z
42
- .number()
43
- .int()
44
- .positive()
45
- .optional()
46
- .describe(
47
- 'Timeout in milliseconds for inscription (default: no timeout - waits until completion)'
48
- ),
14
+ metadata: z.record(z.unknown()).optional().describe('Metadata to attach'),
15
+ tags: z.array(z.string()).optional().describe('Tags to categorize the inscription'),
16
+ chunkSize: z.number().int().positive().optional().describe('Chunk size for large files'),
17
+ waitForConfirmation: z.boolean().optional().describe('Wait for inscription confirmation'),
18
+ timeoutMs: z.number().int().positive().optional().describe('Timeout in milliseconds'),
49
19
  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'),
20
+ quoteOnly: z.boolean().optional().default(false).describe('Return cost quote only'),
55
21
  });
56
22
 
57
23
  export class InscribeFromBufferTool extends BaseInscriberQueryTool<
@@ -59,7 +25,7 @@ export class InscribeFromBufferTool extends BaseInscriberQueryTool<
59
25
  > {
60
26
  name = 'inscribeFromBuffer';
61
27
  description =
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.';
28
+ 'Inscribe content that you have already retrieved or displayed as standard file inscription (NOT for hashinal NFTs - use InscribeHashinalTool for NFTs). 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.';
63
29
 
64
30
  private config = loadConfig();
65
31
 
@@ -73,7 +39,7 @@ export class InscribeFromBufferTool extends BaseInscriberQueryTool<
73
39
  ): Promise<unknown> {
74
40
  this.validateInput(params);
75
41
 
76
- const resolvedContent = await this.resolveContent(
42
+ const resolvedContent = await resolveContent(
77
43
  params.base64Data,
78
44
  params.mimeType,
79
45
  params.fileName
@@ -86,11 +52,13 @@ export class InscribeFromBufferTool extends BaseInscriberQueryTool<
86
52
  const resolvedFileName = resolvedContent.fileName || params.fileName;
87
53
 
88
54
  const options: InscriptionOptions = {
89
- mode: params.mode,
55
+ mode: 'file',
90
56
  metadata: params.metadata,
91
57
  tags: params.tags,
92
58
  chunkSize: params.chunkSize,
93
- waitForConfirmation: params.quoteOnly ? false : (params.waitForConfirmation ?? true),
59
+ waitForConfirmation: params.quoteOnly
60
+ ? false
61
+ : params.waitForConfirmation ?? true,
94
62
  waitMaxAttempts: 10,
95
63
  waitIntervalMs: 3000,
96
64
  apiKey: params.apiKey,
@@ -113,7 +81,7 @@ export class InscribeFromBufferTool extends BaseInscriberQueryTool<
113
81
  },
114
82
  options
115
83
  );
116
-
84
+
117
85
  return {
118
86
  success: true,
119
87
  quote: {
@@ -126,25 +94,26 @@ export class InscribeFromBufferTool extends BaseInscriberQueryTool<
126
94
  mimeType: resolvedMimeType,
127
95
  sizeBytes: buffer.length,
128
96
  },
129
- message: `Estimated Quote for buffer content: ${resolvedFileName} (${(buffer.length / 1024).toFixed(2)} KB)\nTotal cost: ${quote.totalCostHbar} HBAR`,
97
+ message: `Estimated Quote for buffer content: ${resolvedFileName} (${(
98
+ buffer.length / 1024
99
+ ).toFixed(2)} KB)\nTotal cost: ${quote.totalCostHbar} HBAR`,
130
100
  };
131
101
  } catch (error) {
132
102
  const errorMessage =
133
- error instanceof Error ? error.message : 'Failed to generate inscription quote';
103
+ error instanceof Error
104
+ ? error.message
105
+ : 'Failed to generate inscription quote';
134
106
  throw new Error(`Quote generation failed: ${errorMessage}`);
135
107
  }
136
108
  }
137
109
 
138
- const timeoutMs =
139
- params.timeoutMs || (options.waitForConfirmation ? 60000 : undefined);
140
-
141
110
  try {
142
111
  const result = await this.executeInscription(
143
112
  buffer,
144
113
  resolvedFileName,
145
114
  resolvedMimeType,
146
115
  options,
147
- timeoutMs
116
+ params.timeoutMs
148
117
  );
149
118
  return this.formatInscriptionResult(result, options);
150
119
  } catch (error) {
@@ -250,7 +219,8 @@ export class InscribeFromBufferTool extends BaseInscriberQueryTool<
250
219
  options: InscriptionOptions
251
220
  ): string {
252
221
  if (result.confirmed && !result.quote) {
253
- const topicId = result.inscription?.topic_id || (result.result as any).topicId;
222
+ const topicId =
223
+ result.inscription?.topic_id || (result.result as any).topicId;
254
224
  const network = options.network || 'testnet';
255
225
  const cdnUrl = topicId
256
226
  ? `https://kiloscribe.com/api/inscription-cdn/${topicId}?network=${network}`
@@ -263,88 +233,12 @@ export class InscribeFromBufferTool extends BaseInscriberQueryTool<
263
233
  }
264
234
 
265
235
  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.`;
236
+ return `Successfully submitted inscription to the Hedera network!\n\nTransaction ID: ${
237
+ (result.result as any).transactionId
238
+ }\n\nThe inscription is processing and will be confirmed shortly.`;
267
239
  }
268
240
 
269
241
  return 'Inscription operation completed.';
270
242
  }
271
243
 
272
- private async resolveContent(
273
- input: string,
274
- providedMimeType?: string,
275
- providedFileName?: string
276
- ): Promise<{
277
- buffer: Buffer;
278
- mimeType?: string;
279
- fileName?: string;
280
- wasReference?: boolean;
281
- }> {
282
- const trimmedInput = input.trim();
283
-
284
- const resolver = this.getContentResolver() || ContentResolverRegistry.getResolver();
285
-
286
- if (!resolver) {
287
- return this.handleDirectContent(trimmedInput, providedMimeType, providedFileName);
288
- }
289
-
290
- const referenceId = resolver.extractReferenceId(trimmedInput);
291
-
292
- if (referenceId) {
293
- try {
294
- const resolution = await resolver.resolveReference(referenceId);
295
-
296
- return {
297
- buffer: resolution.content,
298
- mimeType: resolution.metadata?.mimeType || providedMimeType,
299
- fileName: resolution.metadata?.fileName || providedFileName,
300
- wasReference: true,
301
- };
302
- } catch (error) {
303
- const errorMsg =
304
- error instanceof Error
305
- ? error.message
306
- : 'Unknown error resolving reference';
307
- throw new Error(`Reference resolution failed: ${errorMsg}`);
308
- }
309
- }
310
-
311
- return this.handleDirectContent(trimmedInput, providedMimeType, providedFileName);
312
- }
313
-
314
- private handleDirectContent(
315
- input: string,
316
- providedMimeType?: string,
317
- providedFileName?: string
318
- ): {
319
- buffer: Buffer;
320
- mimeType?: string;
321
- fileName?: string;
322
- wasReference?: boolean;
323
- } {
324
- const isValidBase64 = /^[A-Za-z0-9+/]*={0,2}$/.test(input);
325
-
326
- if (isValidBase64) {
327
- try {
328
- const buffer = Buffer.from(input, 'base64');
329
- return {
330
- buffer,
331
- mimeType: providedMimeType,
332
- fileName: providedFileName,
333
- wasReference: false,
334
- };
335
- } catch (error) {
336
- throw new Error(
337
- 'Failed to decode base64 data. Please ensure the data is properly encoded.'
338
- );
339
- }
340
- }
341
-
342
- const buffer = Buffer.from(input, 'utf8');
343
- return {
344
- buffer,
345
- mimeType: providedMimeType || 'text/plain',
346
- fileName: providedFileName,
347
- wasReference: false,
348
- };
349
- }
350
244
  }