@hashgraphonline/standards-agent-kit 0.2.142 → 0.2.144
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/builders/hcs6/hcs6-builder.d.ts +2 -2
- package/dist/cjs/standards-agent-kit.cjs +1 -1
- package/dist/cjs/standards-agent-kit.cjs.map +1 -1
- package/dist/es/builders/hcs6/hcs6-builder.d.ts +2 -2
- package/dist/es/standards-agent-kit.es39.js.map +1 -1
- package/dist/es/standards-agent-kit.es48.js +3 -7
- package/dist/es/standards-agent-kit.es48.js.map +1 -1
- package/dist/es/standards-agent-kit.es49.js +7 -3
- package/dist/es/standards-agent-kit.es49.js.map +1 -1
- package/dist/es/standards-agent-kit.es6.js +2 -2
- package/dist/es/standards-agent-kit.es6.js.map +1 -1
- package/dist/es/standards-agent-kit.es7.js +52 -14
- package/dist/es/standards-agent-kit.es7.js.map +1 -1
- package/dist/es/standards-agent-kit.es9.js +1 -1
- package/dist/umd/builders/hcs6/hcs6-builder.d.ts +2 -2
- package/dist/umd/standards-agent-kit.umd.js +1 -1
- package/dist/umd/standards-agent-kit.umd.js.map +1 -1
- package/package.json +35 -27
- package/src/builders/hcs2/hcs2-builder.ts +1 -1
- package/src/builders/hcs6/hcs6-builder.ts +90 -21
- package/src/tools/inscriber/InscribeHashinalTool.ts +15 -10
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.144",
|
|
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.72.0",
|
|
66
|
-
"@hashgraphonline/standards-sdk": "^0.
|
|
93
|
+
"@hashgraphonline/standards-sdk": "^0.1.108",
|
|
67
94
|
"@kiloscribe/inscription-sdk": "^1.0.60",
|
|
68
95
|
"@langchain/community": "^0.3.5",
|
|
69
96
|
"@langchain/core": "^0.3.71",
|
|
@@ -102,29 +129,10 @@
|
|
|
102
129
|
"vite-plugin-node-polyfills": "^0.23.0",
|
|
103
130
|
"vite-plugin-string-replace": "^1.1.3"
|
|
104
131
|
},
|
|
105
|
-
"
|
|
106
|
-
|
|
107
|
-
"
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
"build": "pnpm run clean && pnpm run build:es && pnpm run build:cjs && pnpm run build:umd",
|
|
111
|
-
"test": "jest",
|
|
112
|
-
"lint": "eslint . --ext .ts",
|
|
113
|
-
"lint:fix": "eslint . --ext .ts --fix",
|
|
114
|
-
"release": "pnpm publish --access public",
|
|
115
|
-
"release:canary": "pnpm run prepublishOnly && pnpm publish --tag canary --access public",
|
|
116
|
-
"version:canary": "pnpm version prerelease --preid canary --no-git-tag-version",
|
|
117
|
-
"publish:canary": "pnpm run version:canary && pnpm run release:canary",
|
|
118
|
-
"demo:cli": "tsx examples/cli-demo.ts",
|
|
119
|
-
"demo:interactive": "tsx examples/interactive-demo.ts",
|
|
120
|
-
"demo:langchain": "tsx examples/langchain-demo.ts",
|
|
121
|
-
"demo:plugin": "tsx examples/plugin-system-example.ts",
|
|
122
|
-
"demo:plugin:weather": "tsx examples/plugins/weather/index.ts",
|
|
123
|
-
"demo:plugin:defi": "tsx examples/plugins/defi/index.ts",
|
|
124
|
-
"demo:plugin:openconvai": "tsx examples/openconvai-plugin-example.ts",
|
|
125
|
-
"demo:inscription-quotes": "tsx examples/inscription-quote-demo.ts",
|
|
126
|
-
"standards-agent:start": "tsx examples/standards-expert/cli.ts -- start",
|
|
127
|
-
"standards-agent:process-docs": "tsx examples/standards-expert/cli.ts -- process-docs --all-repos",
|
|
128
|
-
"typecheck": "tsc --noEmit"
|
|
132
|
+
"packageManager": "pnpm@10.11.1+sha512.e519b9f7639869dc8d5c3c5dfef73b3f091094b0a006d7317353c72b124e80e1afd429732e28705ad6bfa1ee879c1fce46c128ccebd3192101f43dd67c667912",
|
|
133
|
+
"pnpm": {
|
|
134
|
+
"overrides": {
|
|
135
|
+
"@hashgraph/sdk": "2.72.0"
|
|
136
|
+
}
|
|
129
137
|
}
|
|
130
|
-
}
|
|
138
|
+
}
|
|
@@ -36,7 +36,7 @@ export class HCS2Builder extends BaseServiceBuilder {
|
|
|
36
36
|
if (!this.hcs2Client) {
|
|
37
37
|
const operatorId = this.hederaKit.signer.getAccountId().toString();
|
|
38
38
|
const operatorPrivateKey = this.hederaKit.signer?.getOperatorPrivateKey()
|
|
39
|
-
? this.hederaKit.signer.getOperatorPrivateKey().
|
|
39
|
+
? this.hederaKit.signer.getOperatorPrivateKey().toString()
|
|
40
40
|
: '';
|
|
41
41
|
|
|
42
42
|
const network = this.hederaKit.client.network;
|
|
@@ -13,9 +13,18 @@ import {
|
|
|
13
13
|
HCS6TopicRegistry,
|
|
14
14
|
HCS6CreateHashinalResponse,
|
|
15
15
|
NetworkType,
|
|
16
|
+
HederaMirrorNode,
|
|
17
|
+
TopicResponse,
|
|
16
18
|
} from '@hashgraphonline/standards-sdk';
|
|
17
|
-
import {
|
|
18
|
-
|
|
19
|
+
import {
|
|
20
|
+
SignerProviderRegistry,
|
|
21
|
+
type NetworkString,
|
|
22
|
+
} from '../../signing/signer-provider';
|
|
23
|
+
import type {
|
|
24
|
+
HCS6TopicRegistrationResult,
|
|
25
|
+
HCS6RegistryOperationResult,
|
|
26
|
+
HCS6CreateHashinalResult,
|
|
27
|
+
} from '../../types/tx-results';
|
|
19
28
|
import { CodedError } from '../../utils/CodedError';
|
|
20
29
|
|
|
21
30
|
/**
|
|
@@ -63,25 +72,41 @@ export class HCS6Builder extends BaseServiceBuilder {
|
|
|
63
72
|
): Promise<HCS6TopicRegistrationResult> {
|
|
64
73
|
const exec = SignerProviderRegistry.walletExecutor;
|
|
65
74
|
const preferWallet = SignerProviderRegistry.preferWalletOnly;
|
|
66
|
-
const network = (
|
|
75
|
+
const network = (
|
|
76
|
+
this.hederaKit.client.network.toString().includes('mainnet')
|
|
77
|
+
? 'mainnet'
|
|
78
|
+
: 'testnet'
|
|
79
|
+
) as NetworkString;
|
|
67
80
|
|
|
68
81
|
if (exec) {
|
|
69
82
|
const start = SignerProviderRegistry.startHCSDelegate;
|
|
70
83
|
if (start) {
|
|
71
84
|
try {
|
|
72
85
|
const request: Record<string, unknown> = { options };
|
|
73
|
-
const { transactionBytes } = await start(
|
|
86
|
+
const { transactionBytes } = await start(
|
|
87
|
+
'hcs6.createRegistry',
|
|
88
|
+
request,
|
|
89
|
+
network
|
|
90
|
+
);
|
|
74
91
|
if (transactionBytes) {
|
|
75
92
|
return { success: true, transactionBytes };
|
|
76
93
|
}
|
|
77
94
|
} catch (err) {
|
|
78
95
|
if (preferWallet) {
|
|
79
|
-
throw new CodedError(
|
|
96
|
+
throw new CodedError(
|
|
97
|
+
'wallet_submit_failed',
|
|
98
|
+
`wallet_submit_failed: ${
|
|
99
|
+
err instanceof Error ? err.message : String(err)
|
|
100
|
+
}`
|
|
101
|
+
);
|
|
80
102
|
}
|
|
81
103
|
}
|
|
82
104
|
}
|
|
83
105
|
if (preferWallet) {
|
|
84
|
-
throw new CodedError(
|
|
106
|
+
throw new CodedError(
|
|
107
|
+
'wallet_unavailable',
|
|
108
|
+
'WalletExecutor not configured for hcs6.createRegistry'
|
|
109
|
+
);
|
|
85
110
|
}
|
|
86
111
|
}
|
|
87
112
|
|
|
@@ -102,25 +127,41 @@ export class HCS6Builder extends BaseServiceBuilder {
|
|
|
102
127
|
): Promise<HCS6RegistryOperationResult> {
|
|
103
128
|
const exec = SignerProviderRegistry.walletExecutor;
|
|
104
129
|
const preferWallet = SignerProviderRegistry.preferWalletOnly;
|
|
105
|
-
const network = (
|
|
130
|
+
const network = (
|
|
131
|
+
this.hederaKit.client.network.toString().includes('mainnet')
|
|
132
|
+
? 'mainnet'
|
|
133
|
+
: 'testnet'
|
|
134
|
+
) as NetworkString;
|
|
106
135
|
|
|
107
136
|
if (exec) {
|
|
108
137
|
const start = SignerProviderRegistry.startHCSDelegate;
|
|
109
138
|
if (start) {
|
|
110
139
|
try {
|
|
111
140
|
const request: Record<string, unknown> = { registryTopicId, options };
|
|
112
|
-
const { transactionBytes } = await start(
|
|
141
|
+
const { transactionBytes } = await start(
|
|
142
|
+
'hcs6.registerEntry',
|
|
143
|
+
request,
|
|
144
|
+
network
|
|
145
|
+
);
|
|
113
146
|
if (transactionBytes) {
|
|
114
147
|
return { success: true, transactionBytes };
|
|
115
148
|
}
|
|
116
149
|
} catch (err) {
|
|
117
150
|
if (preferWallet) {
|
|
118
|
-
throw new CodedError(
|
|
151
|
+
throw new CodedError(
|
|
152
|
+
'wallet_submit_failed',
|
|
153
|
+
`wallet_submit_failed: ${
|
|
154
|
+
err instanceof Error ? err.message : String(err)
|
|
155
|
+
}`
|
|
156
|
+
);
|
|
119
157
|
}
|
|
120
158
|
}
|
|
121
159
|
}
|
|
122
160
|
if (preferWallet) {
|
|
123
|
-
throw new CodedError(
|
|
161
|
+
throw new CodedError(
|
|
162
|
+
'wallet_unavailable',
|
|
163
|
+
'WalletExecutor not configured for hcs6.registerEntry'
|
|
164
|
+
);
|
|
124
165
|
}
|
|
125
166
|
}
|
|
126
167
|
|
|
@@ -149,7 +190,8 @@ export class HCS6Builder extends BaseServiceBuilder {
|
|
|
149
190
|
const metadata = {
|
|
150
191
|
name: options.metadata?.name || 'Dynamic Hashinal',
|
|
151
192
|
creator:
|
|
152
|
-
options.metadata?.creator ||
|
|
193
|
+
options.metadata?.creator ||
|
|
194
|
+
this.hederaKit.signer.getAccountId().toString(),
|
|
153
195
|
description: options.metadata?.description || 'Dynamic hashinal metadata',
|
|
154
196
|
type: options.metadata?.type || 'json',
|
|
155
197
|
...options.metadata,
|
|
@@ -172,7 +214,8 @@ export class HCS6Builder extends BaseServiceBuilder {
|
|
|
172
214
|
const metadata = {
|
|
173
215
|
name: options.metadata?.name || 'Dynamic Hashinal',
|
|
174
216
|
creator:
|
|
175
|
-
options.metadata?.creator ||
|
|
217
|
+
options.metadata?.creator ||
|
|
218
|
+
this.hederaKit.signer.getAccountId().toString(),
|
|
176
219
|
description:
|
|
177
220
|
options.metadata?.description || 'Dynamic hashinal registration',
|
|
178
221
|
type: options.metadata?.type || 'json',
|
|
@@ -194,37 +237,63 @@ export class HCS6Builder extends BaseServiceBuilder {
|
|
|
194
237
|
): Promise<HCS6RegistryOperationResult> {
|
|
195
238
|
const exec = SignerProviderRegistry.walletExecutor;
|
|
196
239
|
const preferWallet = SignerProviderRegistry.preferWalletOnly;
|
|
197
|
-
const network = (
|
|
240
|
+
const network = (
|
|
241
|
+
this.hederaKit.client.network.toString().includes('mainnet')
|
|
242
|
+
? 'mainnet'
|
|
243
|
+
: 'testnet'
|
|
244
|
+
) as NetworkString;
|
|
198
245
|
|
|
199
246
|
if (exec) {
|
|
200
247
|
const start = SignerProviderRegistry.startHCSDelegate;
|
|
201
248
|
if (start) {
|
|
202
249
|
try {
|
|
203
250
|
const request: Record<string, unknown> = { topicId, payload };
|
|
204
|
-
const { transactionBytes } = await start(
|
|
251
|
+
const { transactionBytes } = await start(
|
|
252
|
+
'hcs6.submitMessage',
|
|
253
|
+
request,
|
|
254
|
+
network
|
|
255
|
+
);
|
|
205
256
|
if (transactionBytes) {
|
|
206
|
-
return {
|
|
257
|
+
return {
|
|
258
|
+
success: true,
|
|
259
|
+
transactionBytes,
|
|
260
|
+
} as unknown as HCS6RegistryOperationResult;
|
|
207
261
|
}
|
|
208
262
|
} catch (err) {
|
|
209
263
|
if (preferWallet) {
|
|
210
|
-
throw new CodedError(
|
|
264
|
+
throw new CodedError(
|
|
265
|
+
'wallet_submit_failed',
|
|
266
|
+
`wallet_submit_failed: ${
|
|
267
|
+
err instanceof Error ? err.message : String(err)
|
|
268
|
+
}`
|
|
269
|
+
);
|
|
211
270
|
}
|
|
212
271
|
}
|
|
213
272
|
}
|
|
214
273
|
if (preferWallet) {
|
|
215
|
-
throw new CodedError(
|
|
274
|
+
throw new CodedError(
|
|
275
|
+
'wallet_unavailable',
|
|
276
|
+
'WalletExecutor not configured for hcs6.submitMessage'
|
|
277
|
+
);
|
|
216
278
|
}
|
|
217
279
|
}
|
|
218
280
|
|
|
219
281
|
const client = await this.getHCS6Client();
|
|
220
|
-
return await client.submitMessage(
|
|
282
|
+
return (await client.submitMessage(
|
|
283
|
+
topicId,
|
|
284
|
+
payload
|
|
285
|
+
)) as unknown as HCS6RegistryOperationResult;
|
|
221
286
|
}
|
|
222
287
|
|
|
223
288
|
/**
|
|
224
289
|
* Get topic info from mirror node
|
|
225
290
|
*/
|
|
226
|
-
async getTopicInfo(topicId: string): Promise<
|
|
227
|
-
const
|
|
291
|
+
async getTopicInfo(topicId: string): Promise<TopicResponse> {
|
|
292
|
+
const network = this.hederaKit.client.network;
|
|
293
|
+
const networkType: NetworkType = network.toString().includes('mainnet')
|
|
294
|
+
? 'mainnet'
|
|
295
|
+
: 'testnet';
|
|
296
|
+
const client = new HederaMirrorNode(networkType);
|
|
228
297
|
return await client.getTopicInfo(topicId);
|
|
229
298
|
}
|
|
230
299
|
|
|
@@ -237,4 +306,4 @@ export class HCS6Builder extends BaseServiceBuilder {
|
|
|
237
306
|
this.hcs6Client = undefined;
|
|
238
307
|
}
|
|
239
308
|
}
|
|
240
|
-
}
|
|
309
|
+
}
|
|
@@ -51,9 +51,11 @@ const HASHLINK_BLOCK_CONFIG = {
|
|
|
51
51
|
* @param network The network type to get configuration for
|
|
52
52
|
* @returns Network-specific block configuration with blockId, hashLink, and template
|
|
53
53
|
*/
|
|
54
|
-
function getHashLinkBlockId(
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
function getHashLinkBlockId(network: 'mainnet' | 'testnet'): {
|
|
55
|
+
blockId: string;
|
|
56
|
+
hashLink: string;
|
|
57
|
+
template: string;
|
|
58
|
+
} {
|
|
57
59
|
const config =
|
|
58
60
|
network === 'mainnet'
|
|
59
61
|
? HASHLINK_BLOCK_CONFIG.mainnet
|
|
@@ -544,7 +546,8 @@ export class InscribeHashinalTool
|
|
|
544
546
|
fileStandard
|
|
545
547
|
);
|
|
546
548
|
|
|
547
|
-
const txId =
|
|
549
|
+
const txId =
|
|
550
|
+
(result.result as InscriptionResult)?.transactionId ?? 'unknown';
|
|
548
551
|
const successResponse = createInscriptionSuccess({
|
|
549
552
|
hrl: hrl || 'hcs://1/unknown',
|
|
550
553
|
topicId: topicId || 'unknown',
|
|
@@ -556,15 +559,16 @@ export class InscribeHashinalTool
|
|
|
556
559
|
creator: params.creator,
|
|
557
560
|
description: params.description,
|
|
558
561
|
type: params.type,
|
|
559
|
-
attributes: Array.isArray(params.attributes)
|
|
562
|
+
attributes: Array.isArray(params.attributes)
|
|
563
|
+
? params.attributes
|
|
564
|
+
: [],
|
|
560
565
|
},
|
|
561
566
|
});
|
|
562
567
|
|
|
563
|
-
// Attach HashLink block for interactive rendering when requested
|
|
564
568
|
if (params.withHashLinkBlocks !== false) {
|
|
565
569
|
try {
|
|
566
570
|
const block = await this.createHashLinkBlock(successResponse);
|
|
567
|
-
|
|
571
|
+
successResponse.hashLinkBlock = block;
|
|
568
572
|
} catch (e) {
|
|
569
573
|
const logger = new Logger({ module: 'InscribeHashinalTool' });
|
|
570
574
|
logger.warn('Failed to create HashLink block', e);
|
|
@@ -573,17 +577,18 @@ export class InscribeHashinalTool
|
|
|
573
577
|
|
|
574
578
|
return successResponse;
|
|
575
579
|
} else if (!result.quote && !result.confirmed) {
|
|
576
|
-
const txId =
|
|
580
|
+
const txId =
|
|
581
|
+
(result.result as InscriptionResult)?.transactionId ?? 'unknown';
|
|
577
582
|
return createInscriptionPending({
|
|
578
583
|
transactionId: txId,
|
|
579
584
|
details:
|
|
580
|
-
'Successfully submitted Hashinal inscription. Waiting for network confirmation...'
|
|
585
|
+
'Successfully submitted Hashinal inscription. Waiting for network confirmation...',
|
|
581
586
|
});
|
|
582
587
|
} else {
|
|
583
588
|
return createInscriptionError({
|
|
584
589
|
code: 'UNEXPECTED_RESULT',
|
|
585
590
|
details: 'Received an unexpected inscription result state',
|
|
586
|
-
suggestions: ['Try again or verify network status']
|
|
591
|
+
suggestions: ['Try again or verify network status'],
|
|
587
592
|
});
|
|
588
593
|
}
|
|
589
594
|
} catch (error) {
|