@hashgraphonline/standards-agent-kit 0.2.110 → 0.2.112
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 +47 -0
- package/dist/cjs/builders/hcs6/index.d.ts +1 -0
- package/dist/cjs/builders/index.d.ts +1 -0
- 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 +47 -0
- package/dist/es/builders/hcs6/index.d.ts +1 -0
- package/dist/es/builders/index.d.ts +1 -0
- package/dist/es/standards-agent-kit.es27.js +1 -1
- package/dist/es/standards-agent-kit.es27.js.map +1 -1
- package/dist/es/standards-agent-kit.es29.js +1 -1
- package/dist/es/standards-agent-kit.es29.js.map +1 -1
- package/dist/umd/builders/hcs6/hcs6-builder.d.ts +47 -0
- package/dist/umd/builders/hcs6/index.d.ts +1 -0
- package/dist/umd/builders/index.d.ts +1 -0
- package/dist/umd/standards-agent-kit.umd.js +1 -1
- package/dist/umd/standards-agent-kit.umd.js.map +1 -1
- package/package.json +2 -2
- package/src/builders/hcs6/hcs6-builder.ts +136 -0
- package/src/builders/hcs6/index.ts +1 -0
- package/src/builders/index.ts +1 -0
- package/src/tools/inscriber/InscribeFromBufferTool.ts +1 -1
- package/src/tools/inscriber/InscribeFromUrlTool.ts +1 -1
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.112",
|
|
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",
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
},
|
|
90
90
|
"dependencies": {
|
|
91
91
|
"@hashgraph/sdk": "^2.69.0",
|
|
92
|
-
"@hashgraphonline/standards-sdk": "0.0.
|
|
92
|
+
"@hashgraphonline/standards-sdk": "0.0.167",
|
|
93
93
|
"@langchain/community": "^0.3.49",
|
|
94
94
|
"@langchain/core": "^0.3.66",
|
|
95
95
|
"@langchain/openai": "^0.6.3",
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { BaseServiceBuilder } from 'hedera-agent-kit';
|
|
2
|
+
import type { HederaAgentKit } from 'hedera-agent-kit';
|
|
3
|
+
import {
|
|
4
|
+
HCS6Client,
|
|
5
|
+
SDKHCS6ClientConfig,
|
|
6
|
+
HCS6CreateRegistryOptions,
|
|
7
|
+
HCS6RegisterEntryOptions,
|
|
8
|
+
HCS6QueryRegistryOptions,
|
|
9
|
+
HCS6RegisterOptions,
|
|
10
|
+
HCS6CreateHashinalOptions,
|
|
11
|
+
HCS6TopicRegistrationResponse,
|
|
12
|
+
HCS6RegistryOperationResponse,
|
|
13
|
+
HCS6TopicRegistry,
|
|
14
|
+
HCS6CreateHashinalResponse,
|
|
15
|
+
NetworkType,
|
|
16
|
+
} from '@hashgraphonline/standards-sdk';
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Builder for HCS-6 operations that delegates to HCS6Client
|
|
20
|
+
*/
|
|
21
|
+
export class HCS6Builder extends BaseServiceBuilder {
|
|
22
|
+
protected hcs6Client?: HCS6Client;
|
|
23
|
+
|
|
24
|
+
constructor(hederaKit: HederaAgentKit) {
|
|
25
|
+
super(hederaKit);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Get or create HCS-6 client
|
|
30
|
+
*/
|
|
31
|
+
protected async getHCS6Client(): Promise<HCS6Client> {
|
|
32
|
+
if (!this.hcs6Client) {
|
|
33
|
+
const operatorId = this.hederaKit.signer.getAccountId().toString();
|
|
34
|
+
const operatorPrivateKey = this.hederaKit.signer?.getOperatorPrivateKey()
|
|
35
|
+
? this.hederaKit.signer.getOperatorPrivateKey().toStringRaw()
|
|
36
|
+
: '';
|
|
37
|
+
|
|
38
|
+
const network = this.hederaKit.client.network;
|
|
39
|
+
const networkType: NetworkType = network.toString().includes('mainnet')
|
|
40
|
+
? 'mainnet'
|
|
41
|
+
: 'testnet';
|
|
42
|
+
|
|
43
|
+
const config: SDKHCS6ClientConfig = {
|
|
44
|
+
network: networkType,
|
|
45
|
+
operatorId: operatorId,
|
|
46
|
+
operatorKey: operatorPrivateKey,
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
this.hcs6Client = new HCS6Client(config);
|
|
50
|
+
}
|
|
51
|
+
return this.hcs6Client;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Create a new HCS-6 dynamic registry
|
|
56
|
+
* Note: This executes the transaction directly via HCS6Client
|
|
57
|
+
*/
|
|
58
|
+
async createRegistry(
|
|
59
|
+
options: HCS6CreateRegistryOptions = {}
|
|
60
|
+
): Promise<HCS6TopicRegistrationResponse> {
|
|
61
|
+
const client = await this.getHCS6Client();
|
|
62
|
+
return await client.createRegistry(options);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Register a new dynamic hashinal entry in an HCS-6 registry
|
|
67
|
+
*/
|
|
68
|
+
async registerEntry(
|
|
69
|
+
registryTopicId: string,
|
|
70
|
+
options: HCS6RegisterEntryOptions
|
|
71
|
+
): Promise<HCS6RegistryOperationResponse> {
|
|
72
|
+
const client = await this.getHCS6Client();
|
|
73
|
+
return await client.registerEntry(registryTopicId, options);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Query entries from an HCS-6 registry
|
|
78
|
+
*/
|
|
79
|
+
async getRegistry(
|
|
80
|
+
topicId: string,
|
|
81
|
+
options: HCS6QueryRegistryOptions = {}
|
|
82
|
+
): Promise<HCS6TopicRegistry> {
|
|
83
|
+
const client = await this.getHCS6Client();
|
|
84
|
+
return await client.getRegistry(topicId, options);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Create a complete dynamic hashinal with inscription and registry
|
|
89
|
+
*/
|
|
90
|
+
async createHashinal(
|
|
91
|
+
options: HCS6CreateHashinalOptions
|
|
92
|
+
): Promise<HCS6CreateHashinalResponse> {
|
|
93
|
+
const client = await this.getHCS6Client();
|
|
94
|
+
return await client.createHashinal(options);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Register a dynamic hashinal with combined inscription and registry creation
|
|
99
|
+
* This is the main method for creating and updating dynamic hashinals
|
|
100
|
+
*/
|
|
101
|
+
async register(
|
|
102
|
+
options: HCS6RegisterOptions
|
|
103
|
+
): Promise<HCS6CreateHashinalResponse> {
|
|
104
|
+
const client = await this.getHCS6Client();
|
|
105
|
+
return await client.register(options);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Submit a raw message to an HCS-6 topic
|
|
110
|
+
*/
|
|
111
|
+
async submitMessage(
|
|
112
|
+
topicId: string,
|
|
113
|
+
payload: any
|
|
114
|
+
): Promise<any> {
|
|
115
|
+
const client = await this.getHCS6Client();
|
|
116
|
+
return await client.submitMessage(topicId, payload);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Get topic info from mirror node
|
|
121
|
+
*/
|
|
122
|
+
async getTopicInfo(topicId: string): Promise<any> {
|
|
123
|
+
const client = await this.getHCS6Client();
|
|
124
|
+
return await client.getTopicInfo(topicId);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Close the HCS-6 client
|
|
129
|
+
*/
|
|
130
|
+
async close(): Promise<void> {
|
|
131
|
+
if (this.hcs6Client) {
|
|
132
|
+
this.hcs6Client.close();
|
|
133
|
+
this.hcs6Client = undefined;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './hcs6-builder';
|
package/src/builders/index.ts
CHANGED
|
@@ -53,7 +53,7 @@ const inscribeFromBufferSchema = z.object({
|
|
|
53
53
|
*/
|
|
54
54
|
export class InscribeFromBufferTool extends BaseInscriberQueryTool<typeof inscribeFromBufferSchema> {
|
|
55
55
|
name = 'inscribeFromBuffer';
|
|
56
|
-
description = 'Inscribe content
|
|
56
|
+
description = 'Inscribe content that you already have (text, data, or files) to the Hedera network. Use this tool when you have content from: Wikipedia articles, MCP tool responses, text data, API responses, or any content you\'ve retrieved. Convert your content to base64 first. DO NOT use inscribeFromUrl for web page content - use this tool instead after retrieving the actual content.';
|
|
57
57
|
|
|
58
58
|
get specificInputSchema() {
|
|
59
59
|
return inscribeFromBufferSchema;
|
|
@@ -42,7 +42,7 @@ const inscribeFromUrlSchema = z.object({
|
|
|
42
42
|
*/
|
|
43
43
|
export class InscribeFromUrlTool extends BaseInscriberQueryTool<typeof inscribeFromUrlSchema> {
|
|
44
44
|
name = 'inscribeFromUrl';
|
|
45
|
-
description = 'Inscribe content from a URL to
|
|
45
|
+
description = 'Inscribe content directly from a URL that points to a downloadable file (PDF, image, JSON, etc). DO NOT use this for web pages like Wikipedia, Twitter, or GitHub pages. This tool is ONLY for direct file URLs like https://example.com/document.pdf or https://api.example.com/data.json. For content you already have (from Wikipedia, MCP tools, or text), use inscribeFromBuffer instead.';
|
|
46
46
|
|
|
47
47
|
get specificInputSchema() {
|
|
48
48
|
return inscribeFromUrlSchema;
|