@hashgraphonline/standards-agent-kit 0.2.130 → 0.2.132
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/inscriber/inscriber-builder.d.ts +36 -5
- package/dist/cjs/index.d.ts +2 -0
- package/dist/cjs/interfaces/FormValidatable.d.ts +45 -0
- package/dist/cjs/interfaces/index.d.ts +1 -0
- package/dist/cjs/lib/index.d.ts +1 -0
- package/dist/cjs/lib/zod-render/__tests__/withRender.test.d.ts +1 -0
- package/dist/cjs/lib/zod-render/config-extractor.d.ts +71 -0
- package/dist/cjs/lib/zod-render/index.d.ts +6 -0
- package/dist/cjs/lib/zod-render/schema-extension.d.ts +102 -0
- package/dist/cjs/lib/zod-render/types.d.ts +286 -0
- package/dist/cjs/standards-agent-kit.cjs +1 -1
- package/dist/cjs/standards-agent-kit.cjs.map +1 -1
- package/dist/cjs/tools/hcs10/natural-language-mapper.d.ts +6 -1
- package/dist/cjs/tools/hcs2/CreateRegistryTool.d.ts +1 -16
- package/dist/cjs/tools/hcs2/DeleteEntryTool.d.ts +1 -13
- package/dist/cjs/tools/hcs2/RegisterEntryTool.d.ts +1 -16
- package/dist/cjs/tools/hcs2/UpdateEntryTool.d.ts +1 -19
- package/dist/cjs/tools/hcs6/CreateDynamicRegistryTool.d.ts +1 -10
- package/dist/cjs/tools/hedera/HederaCreateNftTool.d.ts +72 -0
- package/dist/cjs/tools/hedera/index.d.ts +1 -0
- package/dist/cjs/tools/index.d.ts +1 -0
- package/dist/cjs/tools/inscriber/InscribeHashinalTool.d.ts +42 -132
- package/dist/cjs/tools/inscriber/RetrieveInscriptionTool.d.ts +20 -1
- package/dist/cjs/types/inscription-response.d.ts +172 -0
- package/dist/cjs/validation/hip412-schemas.d.ts +1 -1
- package/dist/es/builders/inscriber/inscriber-builder.d.ts +36 -5
- package/dist/es/index.d.ts +2 -0
- package/dist/es/interfaces/FormValidatable.d.ts +45 -0
- package/dist/es/interfaces/index.d.ts +1 -0
- package/dist/es/lib/index.d.ts +1 -0
- package/dist/es/lib/zod-render/__tests__/withRender.test.d.ts +1 -0
- package/dist/es/lib/zod-render/config-extractor.d.ts +71 -0
- package/dist/es/lib/zod-render/index.d.ts +6 -0
- package/dist/es/lib/zod-render/schema-extension.d.ts +102 -0
- package/dist/es/lib/zod-render/types.d.ts +286 -0
- package/dist/es/standards-agent-kit.es.js +6248 -44
- package/dist/es/standards-agent-kit.es.js.map +1 -1
- package/dist/es/tools/hcs10/natural-language-mapper.d.ts +6 -1
- package/dist/es/tools/hcs2/CreateRegistryTool.d.ts +1 -16
- package/dist/es/tools/hcs2/DeleteEntryTool.d.ts +1 -13
- package/dist/es/tools/hcs2/RegisterEntryTool.d.ts +1 -16
- package/dist/es/tools/hcs2/UpdateEntryTool.d.ts +1 -19
- package/dist/es/tools/hcs6/CreateDynamicRegistryTool.d.ts +1 -10
- package/dist/es/tools/hedera/HederaCreateNftTool.d.ts +72 -0
- package/dist/es/tools/hedera/index.d.ts +1 -0
- package/dist/es/tools/index.d.ts +1 -0
- package/dist/es/tools/inscriber/InscribeHashinalTool.d.ts +42 -132
- package/dist/es/tools/inscriber/RetrieveInscriptionTool.d.ts +20 -1
- package/dist/es/types/inscription-response.d.ts +172 -0
- package/dist/es/validation/hip412-schemas.d.ts +1 -1
- package/dist/umd/builders/inscriber/inscriber-builder.d.ts +36 -5
- package/dist/umd/index.d.ts +2 -0
- package/dist/umd/interfaces/FormValidatable.d.ts +45 -0
- package/dist/umd/interfaces/index.d.ts +1 -0
- package/dist/umd/lib/index.d.ts +1 -0
- package/dist/umd/lib/zod-render/__tests__/withRender.test.d.ts +1 -0
- package/dist/umd/lib/zod-render/config-extractor.d.ts +71 -0
- package/dist/umd/lib/zod-render/index.d.ts +6 -0
- package/dist/umd/lib/zod-render/schema-extension.d.ts +102 -0
- package/dist/umd/lib/zod-render/types.d.ts +286 -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/hcs10/natural-language-mapper.d.ts +6 -1
- package/dist/umd/tools/hcs2/CreateRegistryTool.d.ts +1 -16
- package/dist/umd/tools/hcs2/DeleteEntryTool.d.ts +1 -13
- package/dist/umd/tools/hcs2/RegisterEntryTool.d.ts +1 -16
- package/dist/umd/tools/hcs2/UpdateEntryTool.d.ts +1 -19
- package/dist/umd/tools/hcs6/CreateDynamicRegistryTool.d.ts +1 -10
- package/dist/umd/tools/hedera/HederaCreateNftTool.d.ts +72 -0
- package/dist/umd/tools/hedera/index.d.ts +1 -0
- package/dist/umd/tools/index.d.ts +1 -0
- package/dist/umd/tools/inscriber/InscribeHashinalTool.d.ts +42 -132
- package/dist/umd/tools/inscriber/RetrieveInscriptionTool.d.ts +20 -1
- package/dist/umd/types/inscription-response.d.ts +172 -0
- package/dist/umd/validation/hip412-schemas.d.ts +1 -1
- package/package.json +29 -32
- package/src/builders/inscriber/inscriber-builder.ts +42 -6
- package/src/hcs10/HCS10Client.ts +2 -5
- package/src/hcs10/types.ts +1 -15
- package/src/index.ts +2 -0
- package/src/init/init.ts +7 -10
- package/src/interfaces/FormValidatable.ts +57 -0
- package/src/interfaces/index.ts +1 -0
- package/src/lib/index.ts +1 -0
- package/src/lib/zod-render/__tests__/withRender.test.ts +205 -0
- package/src/lib/zod-render/config-extractor.ts +443 -0
- package/src/lib/zod-render/index.ts +42 -0
- package/src/lib/zod-render/schema-extension.ts +612 -0
- package/src/lib/zod-render/types.ts +333 -0
- package/src/plugins/PluginInterface.ts +1 -2
- package/src/plugins/PluginRegistry.ts +1 -1
- package/src/plugins/hedera/HbarPricePlugin.ts +1 -1
- package/src/plugins/weather/index.ts +15 -4
- package/src/state/open-convai-state.ts +1 -11
- package/src/tools/hcs10/FindRegistrationsTool.ts +1 -1
- package/src/tools/hcs10/RegisterAgentTool.ts +3 -3
- package/src/tools/hcs10/SendMessageToConnectionTool.ts +4 -1
- package/src/tools/hcs10/natural-language-mapper.ts +35 -53
- package/src/tools/hcs2/CreateRegistryTool.ts +1 -1
- package/src/tools/hcs2/DeleteEntryTool.ts +1 -1
- package/src/tools/hcs2/RegisterEntryTool.ts +1 -1
- package/src/tools/hcs2/UpdateEntryTool.ts +1 -1
- package/src/tools/hcs6/CreateDynamicRegistryTool.ts +2 -2
- package/src/tools/hcs6/QueryDynamicRegistryTool.ts +1 -1
- package/src/tools/hcs6/RegisterDynamicHashinalTool.ts +1 -1
- package/src/tools/hcs6/UpdateDynamicHashinalTool.ts +2 -2
- package/src/tools/hedera/HederaCreateNftTool.ts +294 -0
- package/src/tools/hedera/index.ts +1 -0
- package/src/tools/index.ts +2 -1
- package/src/tools/inscriber/InscribeFromFileTool.ts +2 -11
- package/src/tools/inscriber/InscribeFromUrlTool.ts +15 -19
- package/src/tools/inscriber/InscribeHashinalTool.ts +596 -155
- package/src/tools/inscriber/RetrieveInscriptionTool.ts +34 -12
- package/src/tools/inscriber/base-inscriber-tools.ts +2 -24
- package/src/types/content-resolver.ts +3 -3
- package/src/types/inscription-response.ts +234 -0
- package/src/utils/Encryption.ts +1 -1
- package/src/utils/HederaClient.ts +1 -2
- package/src/utils/metadata-defaults.ts +15 -4
- package/src/utils/state-tools.ts +1 -2
- package/src/validation/content-ref-schemas.ts +2 -2
- package/src/validation/hip412-schemas.ts +1 -1
- package/dist/es/standards-agent-kit.es10.js +0 -89
- package/dist/es/standards-agent-kit.es10.js.map +0 -1
- package/dist/es/standards-agent-kit.es11.js +0 -40
- package/dist/es/standards-agent-kit.es11.js.map +0 -1
- package/dist/es/standards-agent-kit.es12.js +0 -40
- package/dist/es/standards-agent-kit.es12.js.map +0 -1
- package/dist/es/standards-agent-kit.es13.js +0 -50
- package/dist/es/standards-agent-kit.es13.js.map +0 -1
- package/dist/es/standards-agent-kit.es14.js +0 -60
- package/dist/es/standards-agent-kit.es14.js.map +0 -1
- package/dist/es/standards-agent-kit.es15.js +0 -72
- package/dist/es/standards-agent-kit.es15.js.map +0 -1
- package/dist/es/standards-agent-kit.es16.js +0 -35
- package/dist/es/standards-agent-kit.es16.js.map +0 -1
- package/dist/es/standards-agent-kit.es17.js +0 -35
- package/dist/es/standards-agent-kit.es17.js.map +0 -1
- package/dist/es/standards-agent-kit.es18.js +0 -45
- package/dist/es/standards-agent-kit.es18.js.map +0 -1
- package/dist/es/standards-agent-kit.es19.js +0 -21
- package/dist/es/standards-agent-kit.es19.js.map +0 -1
- package/dist/es/standards-agent-kit.es2.js +0 -25
- package/dist/es/standards-agent-kit.es2.js.map +0 -1
- package/dist/es/standards-agent-kit.es20.js +0 -160
- package/dist/es/standards-agent-kit.es20.js.map +0 -1
- package/dist/es/standards-agent-kit.es21.js +0 -32
- package/dist/es/standards-agent-kit.es21.js.map +0 -1
- package/dist/es/standards-agent-kit.es22.js +0 -46
- package/dist/es/standards-agent-kit.es22.js.map +0 -1
- package/dist/es/standards-agent-kit.es23.js +0 -48
- package/dist/es/standards-agent-kit.es23.js.map +0 -1
- package/dist/es/standards-agent-kit.es24.js +0 -51
- package/dist/es/standards-agent-kit.es24.js.map +0 -1
- package/dist/es/standards-agent-kit.es25.js +0 -45
- package/dist/es/standards-agent-kit.es25.js.map +0 -1
- package/dist/es/standards-agent-kit.es26.js +0 -48
- package/dist/es/standards-agent-kit.es26.js.map +0 -1
- package/dist/es/standards-agent-kit.es27.js +0 -45
- package/dist/es/standards-agent-kit.es27.js.map +0 -1
- package/dist/es/standards-agent-kit.es28.js +0 -32
- package/dist/es/standards-agent-kit.es28.js.map +0 -1
- package/dist/es/standards-agent-kit.es29.js +0 -35
- package/dist/es/standards-agent-kit.es29.js.map +0 -1
- package/dist/es/standards-agent-kit.es3.js +0 -1572
- package/dist/es/standards-agent-kit.es3.js.map +0 -1
- package/dist/es/standards-agent-kit.es30.js +0 -48
- package/dist/es/standards-agent-kit.es30.js.map +0 -1
- package/dist/es/standards-agent-kit.es31.js +0 -46
- package/dist/es/standards-agent-kit.es31.js.map +0 -1
- package/dist/es/standards-agent-kit.es32.js +0 -48
- package/dist/es/standards-agent-kit.es32.js.map +0 -1
- package/dist/es/standards-agent-kit.es33.js +0 -90
- package/dist/es/standards-agent-kit.es33.js.map +0 -1
- package/dist/es/standards-agent-kit.es34.js +0 -245
- package/dist/es/standards-agent-kit.es34.js.map +0 -1
- package/dist/es/standards-agent-kit.es35.js +0 -229
- package/dist/es/standards-agent-kit.es35.js.map +0 -1
- package/dist/es/standards-agent-kit.es36.js +0 -187
- package/dist/es/standards-agent-kit.es36.js.map +0 -1
- package/dist/es/standards-agent-kit.es37.js +0 -260
- package/dist/es/standards-agent-kit.es37.js.map +0 -1
- package/dist/es/standards-agent-kit.es38.js +0 -45
- package/dist/es/standards-agent-kit.es38.js.map +0 -1
- package/dist/es/standards-agent-kit.es39.js +0 -249
- package/dist/es/standards-agent-kit.es39.js.map +0 -1
- package/dist/es/standards-agent-kit.es4.js +0 -95
- package/dist/es/standards-agent-kit.es4.js.map +0 -1
- package/dist/es/standards-agent-kit.es40.js +0 -141
- package/dist/es/standards-agent-kit.es40.js.map +0 -1
- package/dist/es/standards-agent-kit.es41.js +0 -33
- package/dist/es/standards-agent-kit.es41.js.map +0 -1
- package/dist/es/standards-agent-kit.es42.js +0 -28
- package/dist/es/standards-agent-kit.es42.js.map +0 -1
- package/dist/es/standards-agent-kit.es43.js +0 -7
- package/dist/es/standards-agent-kit.es43.js.map +0 -1
- package/dist/es/standards-agent-kit.es44.js +0 -57
- package/dist/es/standards-agent-kit.es44.js.map +0 -1
- package/dist/es/standards-agent-kit.es45.js +0 -6
- package/dist/es/standards-agent-kit.es45.js.map +0 -1
- package/dist/es/standards-agent-kit.es46.js +0 -43
- package/dist/es/standards-agent-kit.es46.js.map +0 -1
- package/dist/es/standards-agent-kit.es47.js +0 -15
- package/dist/es/standards-agent-kit.es47.js.map +0 -1
- package/dist/es/standards-agent-kit.es5.js +0 -113
- package/dist/es/standards-agent-kit.es5.js.map +0 -1
- package/dist/es/standards-agent-kit.es6.js +0 -56
- package/dist/es/standards-agent-kit.es6.js.map +0 -1
- package/dist/es/standards-agent-kit.es7.js +0 -332
- package/dist/es/standards-agent-kit.es7.js.map +0 -1
- package/dist/es/standards-agent-kit.es8.js +0 -32
- package/dist/es/standards-agent-kit.es8.js.map +0 -1
- package/dist/es/standards-agent-kit.es9.js +0 -240
- package/dist/es/standards-agent-kit.es9.js.map +0 -1
|
@@ -15,6 +15,26 @@ const retrieveInscriptionSchema = z.object({
|
|
|
15
15
|
.describe('API key for inscription service'),
|
|
16
16
|
});
|
|
17
17
|
|
|
18
|
+
/**
|
|
19
|
+
* Type definition for inscription retrieval result
|
|
20
|
+
*/
|
|
21
|
+
interface InscriptionRetrievalResult {
|
|
22
|
+
inscriptionId?: string;
|
|
23
|
+
transactionId: string;
|
|
24
|
+
topicId?: string;
|
|
25
|
+
status?: string;
|
|
26
|
+
holderId?: string;
|
|
27
|
+
metadata?: unknown;
|
|
28
|
+
tags?: unknown;
|
|
29
|
+
mode?: string;
|
|
30
|
+
chunks?: unknown;
|
|
31
|
+
createdAt?: string;
|
|
32
|
+
completedAt?: string;
|
|
33
|
+
fileUrl?: string;
|
|
34
|
+
mimeType?: string;
|
|
35
|
+
fileSize?: number;
|
|
36
|
+
}
|
|
37
|
+
|
|
18
38
|
|
|
19
39
|
/**
|
|
20
40
|
* Tool for retrieving inscriptions
|
|
@@ -30,7 +50,7 @@ export class RetrieveInscriptionTool extends BaseInscriberQueryTool<typeof retri
|
|
|
30
50
|
protected async executeQuery(
|
|
31
51
|
params: z.infer<typeof retrieveInscriptionSchema>,
|
|
32
52
|
_runManager?: CallbackManagerForToolRun
|
|
33
|
-
): Promise<
|
|
53
|
+
): Promise<InscriptionRetrievalResult> {
|
|
34
54
|
const result = await this.inscriberBuilder.retrieveInscription(
|
|
35
55
|
params.transactionId,
|
|
36
56
|
{
|
|
@@ -39,21 +59,23 @@ export class RetrieveInscriptionTool extends BaseInscriberQueryTool<typeof retri
|
|
|
39
59
|
}
|
|
40
60
|
);
|
|
41
61
|
|
|
62
|
+
const typedResult = result as unknown as Record<string, unknown>;
|
|
63
|
+
|
|
42
64
|
return {
|
|
43
|
-
inscriptionId:
|
|
44
|
-
transactionId: result.transactionId,
|
|
45
|
-
topicId:
|
|
46
|
-
status: result.status,
|
|
47
|
-
holderId:
|
|
65
|
+
inscriptionId: typedResult.inscriptionId as string | undefined,
|
|
66
|
+
transactionId: result.transactionId || 'unknown',
|
|
67
|
+
topicId: typedResult.topic_id as string | undefined,
|
|
68
|
+
status: result.status || 'unknown',
|
|
69
|
+
holderId: typedResult.holderId as string | undefined,
|
|
48
70
|
metadata: result.metadata,
|
|
49
|
-
tags:
|
|
71
|
+
tags: typedResult.tags,
|
|
50
72
|
mode: result.mode,
|
|
51
|
-
chunks:
|
|
52
|
-
createdAt:
|
|
53
|
-
completedAt: (
|
|
73
|
+
chunks: typedResult.chunks,
|
|
74
|
+
createdAt: typedResult.createdAt as string | undefined,
|
|
75
|
+
completedAt: (typedResult.completed || typedResult.completedAt) as string | undefined,
|
|
54
76
|
fileUrl: result.fileUrl,
|
|
55
|
-
mimeType:
|
|
56
|
-
fileSize:
|
|
77
|
+
mimeType: typedResult.mimeType as string | undefined,
|
|
78
|
+
fileSize: typedResult.fileSize as number | undefined,
|
|
57
79
|
};
|
|
58
80
|
}
|
|
59
81
|
}
|
|
@@ -60,22 +60,11 @@ export abstract class BaseInscriberTransactionTool<
|
|
|
60
60
|
input: InscriptionInput,
|
|
61
61
|
options: InscriptionOptions
|
|
62
62
|
): Promise<QuoteResult> {
|
|
63
|
-
const operatorId = this.inscriberBuilder['hederaKit'].signer.getAccountId().toString();
|
|
64
|
-
const operatorPrivateKey = this.inscriberBuilder['hederaKit'].signer?.getOperatorPrivateKey()
|
|
65
|
-
? this.inscriberBuilder['hederaKit'].signer.getOperatorPrivateKey().toStringRaw()
|
|
66
|
-
: '';
|
|
67
|
-
|
|
68
63
|
const network = this.inscriberBuilder['hederaKit'].client.network;
|
|
69
64
|
const networkType = network.toString().includes('mainnet')
|
|
70
65
|
? 'mainnet'
|
|
71
66
|
: 'testnet';
|
|
72
67
|
|
|
73
|
-
const clientConfig = {
|
|
74
|
-
accountId: operatorId,
|
|
75
|
-
privateKey: operatorPrivateKey,
|
|
76
|
-
network: networkType as 'mainnet' | 'testnet',
|
|
77
|
-
};
|
|
78
|
-
|
|
79
68
|
const quoteOptions = {
|
|
80
69
|
...options,
|
|
81
70
|
quoteOnly: true,
|
|
@@ -83,7 +72,7 @@ export abstract class BaseInscriberTransactionTool<
|
|
|
83
72
|
};
|
|
84
73
|
|
|
85
74
|
const result = await this.inscriberBuilder.inscribe(input, quoteOptions);
|
|
86
|
-
|
|
75
|
+
|
|
87
76
|
if (!result.quote || result.confirmed) {
|
|
88
77
|
throw new Error('Failed to generate quote - unexpected response type');
|
|
89
78
|
}
|
|
@@ -136,22 +125,11 @@ export abstract class BaseInscriberQueryTool<
|
|
|
136
125
|
input: InscriptionInput,
|
|
137
126
|
options: InscriptionOptions
|
|
138
127
|
): Promise<QuoteResult> {
|
|
139
|
-
const operatorId = this.inscriberBuilder['hederaKit'].signer.getAccountId().toString();
|
|
140
|
-
const operatorPrivateKey = this.inscriberBuilder['hederaKit'].signer?.getOperatorPrivateKey()
|
|
141
|
-
? this.inscriberBuilder['hederaKit'].signer.getOperatorPrivateKey().toStringRaw()
|
|
142
|
-
: '';
|
|
143
|
-
|
|
144
128
|
const network = this.inscriberBuilder['hederaKit'].client.network;
|
|
145
129
|
const networkType = network.toString().includes('mainnet')
|
|
146
130
|
? 'mainnet'
|
|
147
131
|
: 'testnet';
|
|
148
132
|
|
|
149
|
-
const clientConfig = {
|
|
150
|
-
accountId: operatorId,
|
|
151
|
-
privateKey: operatorPrivateKey,
|
|
152
|
-
network: networkType as 'mainnet' | 'testnet',
|
|
153
|
-
};
|
|
154
|
-
|
|
155
133
|
const quoteOptions = {
|
|
156
134
|
...options,
|
|
157
135
|
quoteOnly: true,
|
|
@@ -159,7 +137,7 @@ export abstract class BaseInscriberQueryTool<
|
|
|
159
137
|
};
|
|
160
138
|
|
|
161
139
|
const result = await this.inscriberBuilder.inscribe(input, quoteOptions);
|
|
162
|
-
|
|
140
|
+
|
|
163
141
|
if (!result.quote || result.confirmed) {
|
|
164
142
|
throw new Error('Failed to generate quote - unexpected response type');
|
|
165
143
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Content Resolver Types
|
|
3
|
-
*
|
|
3
|
+
*
|
|
4
4
|
* Re-export types from standards-sdk for content resolution.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
export type {
|
|
7
|
+
export type {
|
|
8
8
|
ContentResolverInterface,
|
|
9
9
|
ReferenceResolutionResult,
|
|
10
|
-
ContentStoreInterface
|
|
10
|
+
ContentStoreInterface
|
|
11
11
|
} from '@hashgraphonline/standards-sdk';
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Structured response interface for inscription tools
|
|
3
|
+
* Provides a consistent, user-friendly format for inscription results
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export interface InscriptionSuccessResponse {
|
|
7
|
+
success: true;
|
|
8
|
+
type: 'inscription';
|
|
9
|
+
title: string;
|
|
10
|
+
message: string;
|
|
11
|
+
inscription: {
|
|
12
|
+
/** The HRL (Hashinal Reference Link) for minting - e.g., "hcs://1/0.0.123456" */
|
|
13
|
+
hrl: string;
|
|
14
|
+
/** Topic ID where the inscription was stored */
|
|
15
|
+
topicId: string;
|
|
16
|
+
/** Type of Hashinal - Static (HCS-5) or Dynamic (HCS-6) */
|
|
17
|
+
standard: 'Static' | 'Dynamic';
|
|
18
|
+
/** CDN URL for direct access to the inscribed content */
|
|
19
|
+
cdnUrl?: string;
|
|
20
|
+
/** Transaction ID of the inscription */
|
|
21
|
+
transactionId?: string;
|
|
22
|
+
};
|
|
23
|
+
metadata: {
|
|
24
|
+
/** Name/title of the inscribed content */
|
|
25
|
+
name?: string;
|
|
26
|
+
/** Creator of the content */
|
|
27
|
+
creator?: string;
|
|
28
|
+
/** Description of the content */
|
|
29
|
+
description?: string;
|
|
30
|
+
/** Content type (image, text, etc.) */
|
|
31
|
+
type?: string;
|
|
32
|
+
/** Additional attributes */
|
|
33
|
+
attributes?: Array<{ trait_type: string; value: string | number }>;
|
|
34
|
+
};
|
|
35
|
+
nextSteps: {
|
|
36
|
+
/** Primary action the user should take next */
|
|
37
|
+
primary: string;
|
|
38
|
+
/** Additional context or options */
|
|
39
|
+
context?: string;
|
|
40
|
+
/** Specific metadata value to use for minting */
|
|
41
|
+
mintingMetadata: string;
|
|
42
|
+
};
|
|
43
|
+
/** HashLink block data (only present when withHashLinkBlocks=true) */
|
|
44
|
+
hashLinkBlock?: {
|
|
45
|
+
/** Block topic ID on HCS */
|
|
46
|
+
blockId: string;
|
|
47
|
+
/** HashLink reference to the block */
|
|
48
|
+
hashLink: string;
|
|
49
|
+
/** Template topic ID */
|
|
50
|
+
template: string;
|
|
51
|
+
/** Block attributes for rendering */
|
|
52
|
+
attributes: BlockAttributes;
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface InscriptionQuoteResponse {
|
|
57
|
+
success: true;
|
|
58
|
+
type: 'quote';
|
|
59
|
+
title: string;
|
|
60
|
+
message: string;
|
|
61
|
+
quote: {
|
|
62
|
+
/** Total cost in HBAR */
|
|
63
|
+
totalCostHbar: string;
|
|
64
|
+
/** When the quote expires */
|
|
65
|
+
validUntil: string;
|
|
66
|
+
/** Cost breakdown details */
|
|
67
|
+
breakdown?: CostBreakdown;
|
|
68
|
+
};
|
|
69
|
+
content: {
|
|
70
|
+
/** Name of the content to be inscribed */
|
|
71
|
+
name?: string;
|
|
72
|
+
/** Creator of the content */
|
|
73
|
+
creator?: string;
|
|
74
|
+
/** Type of content */
|
|
75
|
+
type?: string;
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export interface InscriptionErrorResponse {
|
|
80
|
+
success: false;
|
|
81
|
+
type: 'error';
|
|
82
|
+
title: string;
|
|
83
|
+
message: string;
|
|
84
|
+
error: {
|
|
85
|
+
/** Error code for programmatic handling */
|
|
86
|
+
code: string;
|
|
87
|
+
/** Detailed error message */
|
|
88
|
+
details: string;
|
|
89
|
+
/** Suggestions for fixing the error */
|
|
90
|
+
suggestions?: string[];
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export type InscriptionResponse =
|
|
95
|
+
| InscriptionSuccessResponse
|
|
96
|
+
| InscriptionQuoteResponse
|
|
97
|
+
| InscriptionErrorResponse;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Helper function to create a successful inscription response
|
|
101
|
+
*/
|
|
102
|
+
export function createInscriptionSuccess(params: {
|
|
103
|
+
hrl: string;
|
|
104
|
+
topicId: string;
|
|
105
|
+
standard: 'Static' | 'Dynamic';
|
|
106
|
+
cdnUrl?: string;
|
|
107
|
+
transactionId?: string;
|
|
108
|
+
metadata: {
|
|
109
|
+
name?: string;
|
|
110
|
+
creator?: string;
|
|
111
|
+
description?: string;
|
|
112
|
+
type?: string;
|
|
113
|
+
attributes?: Array<{ trait_type: string; value: string | number }>;
|
|
114
|
+
};
|
|
115
|
+
}): InscriptionSuccessResponse {
|
|
116
|
+
const { hrl, topicId, standard, cdnUrl, transactionId, metadata } = params;
|
|
117
|
+
|
|
118
|
+
return {
|
|
119
|
+
success: true,
|
|
120
|
+
type: 'inscription',
|
|
121
|
+
title: `${standard} Hashinal Inscription Complete`,
|
|
122
|
+
message: `Successfully inscribed "${
|
|
123
|
+
metadata.name || 'your content'
|
|
124
|
+
}" as a ${standard} Hashinal. The content is now ready for NFT minting.`,
|
|
125
|
+
inscription: {
|
|
126
|
+
hrl,
|
|
127
|
+
topicId,
|
|
128
|
+
standard,
|
|
129
|
+
cdnUrl,
|
|
130
|
+
transactionId,
|
|
131
|
+
},
|
|
132
|
+
metadata,
|
|
133
|
+
nextSteps: {
|
|
134
|
+
primary: 'Use the HRL below as metadata when minting your NFT',
|
|
135
|
+
context:
|
|
136
|
+
'The HRL (Hedera Resource Locator) is the standardized way to reference your inscribed content in NFT metadata.',
|
|
137
|
+
mintingMetadata: hrl,
|
|
138
|
+
},
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Block attributes for HashLink rendering
|
|
144
|
+
*/
|
|
145
|
+
interface BlockAttributes {
|
|
146
|
+
/** Display name */
|
|
147
|
+
name?: string;
|
|
148
|
+
/** Description text */
|
|
149
|
+
description?: string;
|
|
150
|
+
/** Image URL */
|
|
151
|
+
image?: string;
|
|
152
|
+
/** Content type */
|
|
153
|
+
contentType?: string;
|
|
154
|
+
/** Size in bytes */
|
|
155
|
+
size?: number;
|
|
156
|
+
/** Custom metadata */
|
|
157
|
+
metadata?: Record<string, string | number | boolean>;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Transfer details in cost breakdown
|
|
162
|
+
*/
|
|
163
|
+
interface TransferDetails {
|
|
164
|
+
to: string;
|
|
165
|
+
amount: string;
|
|
166
|
+
description: string;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Cost breakdown details for inscription quote
|
|
171
|
+
*/
|
|
172
|
+
interface CostBreakdown {
|
|
173
|
+
transfers: TransferDetails[];
|
|
174
|
+
baseFee?: number;
|
|
175
|
+
sizeFee?: number;
|
|
176
|
+
networkFee?: number;
|
|
177
|
+
serviceFee?: number;
|
|
178
|
+
totalFee?: number;
|
|
179
|
+
currency?: string;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Helper function to create a quote response
|
|
184
|
+
*/
|
|
185
|
+
export function createInscriptionQuote(params: {
|
|
186
|
+
totalCostHbar: string;
|
|
187
|
+
validUntil: string;
|
|
188
|
+
breakdown?: CostBreakdown;
|
|
189
|
+
content: {
|
|
190
|
+
name?: string;
|
|
191
|
+
creator?: string;
|
|
192
|
+
type?: string;
|
|
193
|
+
};
|
|
194
|
+
}): InscriptionQuoteResponse {
|
|
195
|
+
const { totalCostHbar, validUntil, breakdown, content } = params;
|
|
196
|
+
|
|
197
|
+
return {
|
|
198
|
+
success: true,
|
|
199
|
+
type: 'quote',
|
|
200
|
+
title: 'Inscription Cost Quote',
|
|
201
|
+
message: `Estimated cost to inscribe "${
|
|
202
|
+
content.name || 'your content'
|
|
203
|
+
}" is ${totalCostHbar} HBAR.`,
|
|
204
|
+
quote: {
|
|
205
|
+
totalCostHbar,
|
|
206
|
+
validUntil,
|
|
207
|
+
breakdown,
|
|
208
|
+
},
|
|
209
|
+
content,
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Helper function to create an error response
|
|
215
|
+
*/
|
|
216
|
+
export function createInscriptionError(params: {
|
|
217
|
+
code: string;
|
|
218
|
+
details: string;
|
|
219
|
+
suggestions?: string[];
|
|
220
|
+
}): InscriptionErrorResponse {
|
|
221
|
+
const { code, details, suggestions } = params;
|
|
222
|
+
|
|
223
|
+
return {
|
|
224
|
+
success: false,
|
|
225
|
+
type: 'error',
|
|
226
|
+
title: 'Inscription Failed',
|
|
227
|
+
message: `Unable to complete inscription: ${details}`,
|
|
228
|
+
error: {
|
|
229
|
+
code,
|
|
230
|
+
details,
|
|
231
|
+
suggestions,
|
|
232
|
+
},
|
|
233
|
+
};
|
|
234
|
+
}
|
package/src/utils/Encryption.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
2
|
import { Client, AccountId, PrivateKey, TopicMessage, TopicMessageQuery } from '@hashgraph/sdk';
|
|
3
3
|
import * as dotenv from 'dotenv';
|
|
4
4
|
import { HCS10Message } from '../hcs10/types';
|
|
5
5
|
|
|
6
|
-
// Load environment variables from .env file
|
|
7
6
|
dotenv.config();
|
|
8
7
|
|
|
9
8
|
/**
|
|
@@ -9,11 +9,22 @@ export function generateDefaultMetadata(params: {
|
|
|
9
9
|
fileName?: string;
|
|
10
10
|
mimeType?: string;
|
|
11
11
|
operatorAccount: string;
|
|
12
|
-
}) {
|
|
12
|
+
}): {
|
|
13
|
+
name: string;
|
|
14
|
+
creator: string;
|
|
15
|
+
description: string;
|
|
16
|
+
type: string;
|
|
17
|
+
image: string;
|
|
18
|
+
} {
|
|
13
19
|
const defaultName = params.fileName?.replace(/\.[^/.]+$/, '') || 'Hashinal NFT';
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
20
|
+
let defaultType = 'media';
|
|
21
|
+
if (params.mimeType?.startsWith('image/')) {
|
|
22
|
+
defaultType = 'image';
|
|
23
|
+
} else if (params.mimeType?.startsWith('video/')) {
|
|
24
|
+
defaultType = 'video';
|
|
25
|
+
} else if (params.mimeType?.startsWith('audio/')) {
|
|
26
|
+
defaultType = 'audio';
|
|
27
|
+
}
|
|
17
28
|
|
|
18
29
|
return {
|
|
19
30
|
name: params.name || defaultName,
|
package/src/utils/state-tools.ts
CHANGED
|
@@ -125,8 +125,7 @@ export async function createAgent(
|
|
|
125
125
|
client,
|
|
126
126
|
};
|
|
127
127
|
} catch (error) {
|
|
128
|
-
|
|
129
|
-
logger.error(`Error creating ${agentName} agent:`, error);
|
|
128
|
+
logger.error(`Error creating ${agentName} agent:`, error, { baseClient });
|
|
130
129
|
return null;
|
|
131
130
|
}
|
|
132
131
|
}
|
|
@@ -5,7 +5,7 @@ import { z } from 'zod';
|
|
|
5
5
|
*/
|
|
6
6
|
export const contentRefSchema = z
|
|
7
7
|
.string()
|
|
8
|
-
.regex(/^content-ref:[a-
|
|
8
|
+
.regex(/^content-ref:[a-zA-Z0-9_-]+$/, 'Content reference must be in format "content-ref:[alphanumeric-id]"')
|
|
9
9
|
.describe('Content reference in format "content-ref:[id]"');
|
|
10
10
|
|
|
11
11
|
/**
|
|
@@ -15,6 +15,6 @@ export function validateContentRef(input: string): string {
|
|
|
15
15
|
try {
|
|
16
16
|
return contentRefSchema.parse(input);
|
|
17
17
|
} catch (error) {
|
|
18
|
-
throw new Error(`Invalid content reference format. Expected "content-ref:[
|
|
18
|
+
throw new Error(`Invalid content reference format. Expected "content-ref:[alphanumeric-id]" but got "${input}"`);
|
|
19
19
|
}
|
|
20
20
|
}
|
|
@@ -39,7 +39,7 @@ export const hip412MetadataSchema = z.object({
|
|
|
39
39
|
/**
|
|
40
40
|
* Validates metadata against HIP-412 standard
|
|
41
41
|
*/
|
|
42
|
-
export function validateHIP412Metadata(metadata:
|
|
42
|
+
export function validateHIP412Metadata(metadata: unknown): z.infer<typeof hip412MetadataSchema> {
|
|
43
43
|
try {
|
|
44
44
|
return hip412MetadataSchema.parse(metadata);
|
|
45
45
|
} catch (error) {
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { BaseHCS10TransactionTool } from "./standards-agent-kit.es8.js";
|
|
3
|
-
const SendMessageToConnectionZodSchema = z.object({
|
|
4
|
-
targetIdentifier: z.string().optional().describe(
|
|
5
|
-
"The request key (e.g., 'req-1:0.0.6155171@0.0.6154875'), account ID (e.g., 0.0.12345) of the target agent, OR the connection number (e.g., '1', '2') from the 'list_connections' tool. Request key is most deterministic."
|
|
6
|
-
),
|
|
7
|
-
connectionId: z.string().optional().describe(
|
|
8
|
-
"The connection number (e.g., '1', '2') from the 'list_connections' tool."
|
|
9
|
-
),
|
|
10
|
-
agentId: z.string().optional().describe("The account ID (e.g., 0.0.12345) of the target agent."),
|
|
11
|
-
message: z.string().describe("The text message content to send."),
|
|
12
|
-
disableMonitoring: z.boolean().optional().default(false)
|
|
13
|
-
});
|
|
14
|
-
class SendMessageToConnectionTool extends BaseHCS10TransactionTool {
|
|
15
|
-
constructor(params) {
|
|
16
|
-
super(params);
|
|
17
|
-
this.name = "send_message_to_connection";
|
|
18
|
-
this.description = "Use this to send a message to an agent you already have an active connection with. Provide the target agent's account ID (e.g., 0.0.12345) and your message. If no active connection exists, this will fail - use initiate_connection instead to create a new connection first.";
|
|
19
|
-
this.specificInputSchema = SendMessageToConnectionZodSchema;
|
|
20
|
-
this.requiresMultipleTransactions = true;
|
|
21
|
-
this.neverScheduleThisTool = true;
|
|
22
|
-
}
|
|
23
|
-
async callBuilderMethod(builder, specificArgs) {
|
|
24
|
-
const hcs10Builder = builder;
|
|
25
|
-
const targetIdentifier = specificArgs.targetIdentifier || specificArgs.agentId || specificArgs.connectionId;
|
|
26
|
-
if (!targetIdentifier) {
|
|
27
|
-
throw new Error(
|
|
28
|
-
"Either targetIdentifier, connectionId, or agentId must be provided"
|
|
29
|
-
);
|
|
30
|
-
}
|
|
31
|
-
const stateManager = hcs10Builder.getStateManager();
|
|
32
|
-
if (stateManager) {
|
|
33
|
-
const connectionsManager = stateManager.getConnectionsManager();
|
|
34
|
-
if (connectionsManager) {
|
|
35
|
-
try {
|
|
36
|
-
const currentAgent = stateManager.getCurrentAgent();
|
|
37
|
-
if (currentAgent && currentAgent.accountId) {
|
|
38
|
-
await connectionsManager.fetchConnectionData(
|
|
39
|
-
currentAgent.accountId
|
|
40
|
-
);
|
|
41
|
-
}
|
|
42
|
-
} catch (error) {
|
|
43
|
-
console.debug("Could not refresh connections:", error);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
if (targetIdentifier.match(/^\d+$/)) {
|
|
47
|
-
const connections = stateManager.listConnections();
|
|
48
|
-
const connectionIndex = parseInt(targetIdentifier) - 1;
|
|
49
|
-
const establishedConnections = connections.filter(
|
|
50
|
-
(conn) => conn.status === "established" && !conn.isPending && !conn.needsConfirmation
|
|
51
|
-
);
|
|
52
|
-
if (connectionIndex >= 0 && connectionIndex < establishedConnections.length) {
|
|
53
|
-
const selectedConnection = establishedConnections[connectionIndex];
|
|
54
|
-
if (selectedConnection && selectedConnection.connectionTopicId) {
|
|
55
|
-
await hcs10Builder.sendMessageToConnection({
|
|
56
|
-
targetIdentifier: selectedConnection.connectionTopicId,
|
|
57
|
-
message: specificArgs.message,
|
|
58
|
-
disableMonitoring: specificArgs.disableMonitoring
|
|
59
|
-
});
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
if (targetIdentifier.match(/^\d+\.\d+\.\d+$/)) {
|
|
65
|
-
const connections = stateManager.listConnections();
|
|
66
|
-
const establishedConnection = connections.find(
|
|
67
|
-
(conn) => (conn.targetAccountId === targetIdentifier || conn.targetAccountId === `0.0.${targetIdentifier}`) && conn.status === "established" && !conn.isPending && !conn.needsConfirmation
|
|
68
|
-
);
|
|
69
|
-
if (establishedConnection && establishedConnection.connectionTopicId) {
|
|
70
|
-
await hcs10Builder.sendMessageToConnection({
|
|
71
|
-
targetIdentifier: establishedConnection.connectionTopicId,
|
|
72
|
-
message: specificArgs.message,
|
|
73
|
-
disableMonitoring: specificArgs.disableMonitoring
|
|
74
|
-
});
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
await hcs10Builder.sendMessageToConnection({
|
|
80
|
-
targetIdentifier,
|
|
81
|
-
message: specificArgs.message,
|
|
82
|
-
disableMonitoring: specificArgs.disableMonitoring
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
export {
|
|
87
|
-
SendMessageToConnectionTool
|
|
88
|
-
};
|
|
89
|
-
//# sourceMappingURL=standards-agent-kit.es10.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"standards-agent-kit.es10.js","sources":["../../src/tools/hcs10/SendMessageToConnectionTool.ts"],"sourcesContent":["import { z } from 'zod';\nimport { BaseHCS10TransactionTool } from './base-hcs10-tools';\nimport { HCS10Builder } from '../../builders/hcs10/hcs10-builder';\nimport { HCS10TransactionToolParams } from './hcs10-tool-params';\nimport { BaseServiceBuilder } from 'hedera-agent-kit';\n\nconst SendMessageToConnectionZodSchema = z.object({\n targetIdentifier: z\n .string()\n .optional()\n .describe(\n \"The request key (e.g., 'req-1:0.0.6155171@0.0.6154875'), account ID (e.g., 0.0.12345) of the target agent, OR the connection number (e.g., '1', '2') from the 'list_connections' tool. Request key is most deterministic.\"\n ),\n connectionId: z\n .string()\n .optional()\n .describe(\n \"The connection number (e.g., '1', '2') from the 'list_connections' tool.\"\n ),\n agentId: z\n .string()\n .optional()\n .describe('The account ID (e.g., 0.0.12345) of the target agent.'),\n message: z.string().describe('The text message content to send.'),\n disableMonitoring: z.boolean().optional().default(false),\n});\n\n/**\n * A tool to send a message to an agent over an established HCS-10 connection.\n */\nexport class SendMessageToConnectionTool extends BaseHCS10TransactionTool<\n typeof SendMessageToConnectionZodSchema\n> {\n name = 'send_message_to_connection';\n description =\n \"Use this to send a message to an agent you already have an active connection with. Provide the target agent's account ID (e.g., 0.0.12345) and your message. If no active connection exists, this will fail - use initiate_connection instead to create a new connection first.\";\n specificInputSchema = SendMessageToConnectionZodSchema;\n constructor(params: HCS10TransactionToolParams) {\n super(params);\n this.requiresMultipleTransactions = true;\n this.neverScheduleThisTool = true;\n }\n\n protected async callBuilderMethod(\n builder: BaseServiceBuilder,\n specificArgs: z.infer<typeof SendMessageToConnectionZodSchema>\n ): Promise<void> {\n const hcs10Builder = builder as HCS10Builder;\n\n const targetIdentifier =\n specificArgs.targetIdentifier ||\n specificArgs.agentId ||\n specificArgs.connectionId;\n\n if (!targetIdentifier) {\n throw new Error(\n 'Either targetIdentifier, connectionId, or agentId must be provided'\n );\n }\n\n const stateManager = hcs10Builder.getStateManager();\n if (stateManager) {\n const connectionsManager = stateManager.getConnectionsManager();\n if (connectionsManager) {\n try {\n const currentAgent = stateManager.getCurrentAgent();\n if (currentAgent && currentAgent.accountId) {\n await connectionsManager.fetchConnectionData(\n currentAgent.accountId\n );\n }\n } catch (error) {\n console.debug('Could not refresh connections:', error);\n }\n }\n\n if (targetIdentifier.match(/^\\d+$/)) {\n const connections = stateManager.listConnections();\n const connectionIndex = parseInt(targetIdentifier) - 1; // Connection numbers are 1-based\n\n const establishedConnections = connections.filter(\n (conn) =>\n conn.status === 'established' &&\n !conn.isPending &&\n !conn.needsConfirmation\n );\n\n if (\n connectionIndex >= 0 &&\n connectionIndex < establishedConnections.length\n ) {\n const selectedConnection = establishedConnections[connectionIndex];\n if (selectedConnection && selectedConnection.connectionTopicId) {\n await hcs10Builder.sendMessageToConnection({\n targetIdentifier: selectedConnection.connectionTopicId,\n message: specificArgs.message,\n disableMonitoring: specificArgs.disableMonitoring,\n });\n return;\n }\n }\n }\n\n if (targetIdentifier.match(/^\\d+\\.\\d+\\.\\d+$/)) {\n const connections = stateManager.listConnections();\n const establishedConnection = connections.find(\n (conn) =>\n (conn.targetAccountId === targetIdentifier ||\n conn.targetAccountId === `0.0.${targetIdentifier}`) &&\n conn.status === 'established' &&\n !conn.isPending &&\n !conn.needsConfirmation\n );\n\n if (establishedConnection && establishedConnection.connectionTopicId) {\n await hcs10Builder.sendMessageToConnection({\n targetIdentifier: establishedConnection.connectionTopicId,\n message: specificArgs.message,\n disableMonitoring: specificArgs.disableMonitoring,\n });\n return;\n }\n }\n }\n\n await hcs10Builder.sendMessageToConnection({\n targetIdentifier: targetIdentifier,\n message: specificArgs.message,\n disableMonitoring: specificArgs.disableMonitoring,\n });\n }\n}\n"],"names":[],"mappings":";;AAMA,MAAM,mCAAmC,EAAE,OAAO;AAAA,EAChD,kBAAkB,EACf,SACA,WACA;AAAA,IACC;AAAA,EAAA;AAAA,EAEJ,cAAc,EACX,SACA,WACA;AAAA,IACC;AAAA,EAAA;AAAA,EAEJ,SAAS,EACN,OAAA,EACA,SAAA,EACA,SAAS,uDAAuD;AAAA,EACnE,SAAS,EAAE,SAAS,SAAS,mCAAmC;AAAA,EAChE,mBAAmB,EAAE,QAAA,EAAU,SAAA,EAAW,QAAQ,KAAK;AACzD,CAAC;AAKM,MAAM,oCAAoC,yBAE/C;AAAA,EAKA,YAAY,QAAoC;AAC9C,UAAM,MAAM;AALd,SAAA,OAAO;AACP,SAAA,cACE;AACF,SAAA,sBAAsB;AAGpB,SAAK,+BAA+B;AACpC,SAAK,wBAAwB;AAAA,EAC/B;AAAA,EAEA,MAAgB,kBACd,SACA,cACe;AACf,UAAM,eAAe;AAErB,UAAM,mBACJ,aAAa,oBACb,aAAa,WACb,aAAa;AAEf,QAAI,CAAC,kBAAkB;AACrB,YAAM,IAAI;AAAA,QACR;AAAA,MAAA;AAAA,IAEJ;AAEA,UAAM,eAAe,aAAa,gBAAA;AAClC,QAAI,cAAc;AAChB,YAAM,qBAAqB,aAAa,sBAAA;AACxC,UAAI,oBAAoB;AACtB,YAAI;AACF,gBAAM,eAAe,aAAa,gBAAA;AAClC,cAAI,gBAAgB,aAAa,WAAW;AAC1C,kBAAM,mBAAmB;AAAA,cACvB,aAAa;AAAA,YAAA;AAAA,UAEjB;AAAA,QACF,SAAS,OAAO;AACd,kBAAQ,MAAM,kCAAkC,KAAK;AAAA,QACvD;AAAA,MACF;AAEA,UAAI,iBAAiB,MAAM,OAAO,GAAG;AACnC,cAAM,cAAc,aAAa,gBAAA;AACjC,cAAM,kBAAkB,SAAS,gBAAgB,IAAI;AAErD,cAAM,yBAAyB,YAAY;AAAA,UACzC,CAAC,SACC,KAAK,WAAW,iBAChB,CAAC,KAAK,aACN,CAAC,KAAK;AAAA,QAAA;AAGV,YACE,mBAAmB,KACnB,kBAAkB,uBAAuB,QACzC;AACA,gBAAM,qBAAqB,uBAAuB,eAAe;AACjE,cAAI,sBAAsB,mBAAmB,mBAAmB;AAC9D,kBAAM,aAAa,wBAAwB;AAAA,cACzC,kBAAkB,mBAAmB;AAAA,cACrC,SAAS,aAAa;AAAA,cACtB,mBAAmB,aAAa;AAAA,YAAA,CACjC;AACD;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAEA,UAAI,iBAAiB,MAAM,iBAAiB,GAAG;AAC7C,cAAM,cAAc,aAAa,gBAAA;AACjC,cAAM,wBAAwB,YAAY;AAAA,UACxC,CAAC,UACE,KAAK,oBAAoB,oBACxB,KAAK,oBAAoB,OAAO,gBAAgB,OAClD,KAAK,WAAW,iBAChB,CAAC,KAAK,aACN,CAAC,KAAK;AAAA,QAAA;AAGV,YAAI,yBAAyB,sBAAsB,mBAAmB;AACpE,gBAAM,aAAa,wBAAwB;AAAA,YACzC,kBAAkB,sBAAsB;AAAA,YACxC,SAAS,aAAa;AAAA,YACtB,mBAAmB,aAAa;AAAA,UAAA,CACjC;AACD;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAEA,UAAM,aAAa,wBAAwB;AAAA,MACzC;AAAA,MACA,SAAS,aAAa;AAAA,MACtB,mBAAmB,aAAa;AAAA,IAAA,CACjC;AAAA,EACH;AACF;"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { BaseHCS10TransactionTool } from "./standards-agent-kit.es8.js";
|
|
3
|
-
const InitiateConnectionZodSchema = z.object({
|
|
4
|
-
targetAccountId: z.string().describe(
|
|
5
|
-
"The Hedera account ID (e.g., 0.0.12345) of the agent you want to connect with."
|
|
6
|
-
),
|
|
7
|
-
disableMonitor: z.boolean().optional().describe(
|
|
8
|
-
"If true, does not wait for connection confirmation. Returns immediately after sending the request."
|
|
9
|
-
),
|
|
10
|
-
memo: z.string().optional().describe(
|
|
11
|
-
'Optional memo to include with the connection request (e.g., "Hello from Alice"). If not provided, defaults to "true" or "false" based on monitoring preference.'
|
|
12
|
-
)
|
|
13
|
-
});
|
|
14
|
-
class InitiateConnectionTool extends BaseHCS10TransactionTool {
|
|
15
|
-
constructor(params) {
|
|
16
|
-
super(params);
|
|
17
|
-
this.name = "initiate_connection";
|
|
18
|
-
this.description = "ONLY use this to START a BRAND NEW connection to an agent you have NEVER connected to before. If you already have an active connection to this agent, use send_message_to_connection instead. This creates a new connection request and waits for acceptance.";
|
|
19
|
-
this.specificInputSchema = InitiateConnectionZodSchema;
|
|
20
|
-
this.neverScheduleThisTool = true;
|
|
21
|
-
this.requiresMultipleTransactions = true;
|
|
22
|
-
}
|
|
23
|
-
async callBuilderMethod(builder, specificArgs) {
|
|
24
|
-
const hcs10Builder = builder;
|
|
25
|
-
const params = {
|
|
26
|
-
targetAccountId: specificArgs.targetAccountId
|
|
27
|
-
};
|
|
28
|
-
if (specificArgs.disableMonitor !== void 0) {
|
|
29
|
-
params.disableMonitor = specificArgs.disableMonitor;
|
|
30
|
-
}
|
|
31
|
-
if (specificArgs.memo !== void 0) {
|
|
32
|
-
params.memo = specificArgs.memo;
|
|
33
|
-
}
|
|
34
|
-
await hcs10Builder.initiateConnection(params);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
export {
|
|
38
|
-
InitiateConnectionTool
|
|
39
|
-
};
|
|
40
|
-
//# sourceMappingURL=standards-agent-kit.es11.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"standards-agent-kit.es11.js","sources":["../../src/tools/hcs10/InitiateConnectionTool.ts"],"sourcesContent":["import { z } from 'zod';\nimport { BaseHCS10TransactionTool } from './base-hcs10-tools';\nimport { HCS10Builder } from '../../builders/hcs10/hcs10-builder';\nimport { HCS10TransactionToolParams } from './hcs10-tool-params';\nimport { BaseServiceBuilder } from 'hedera-agent-kit';\n\nconst InitiateConnectionZodSchema = z.object({\n targetAccountId: z\n .string()\n .describe(\n 'The Hedera account ID (e.g., 0.0.12345) of the agent you want to connect with.'\n ),\n disableMonitor: z\n .boolean()\n .optional()\n .describe(\n 'If true, does not wait for connection confirmation. Returns immediately after sending the request.'\n ),\n memo: z\n .string()\n .optional()\n .describe(\n 'Optional memo to include with the connection request (e.g., \"Hello from Alice\"). If not provided, defaults to \"true\" or \"false\" based on monitoring preference.'\n ),\n});\n\n/**\n * A tool to actively START a NEW HCS-10 connection TO a target agent.\n * Requires the target agent's account ID.\n * It retrieves their profile, sends a connection request, and optionally waits for confirmation.\n * Use this tool ONLY to actively INITIATE an OUTGOING connection.\n */\nexport class InitiateConnectionTool extends BaseHCS10TransactionTool<\n typeof InitiateConnectionZodSchema\n> {\n name = 'initiate_connection';\n description =\n 'ONLY use this to START a BRAND NEW connection to an agent you have NEVER connected to before. If you already have an active connection to this agent, use send_message_to_connection instead. This creates a new connection request and waits for acceptance.';\n specificInputSchema = InitiateConnectionZodSchema;\n constructor(params: HCS10TransactionToolParams) {\n super(params);\n this.neverScheduleThisTool = true;\n this.requiresMultipleTransactions = true;\n }\n\n protected async callBuilderMethod(\n builder: BaseServiceBuilder,\n specificArgs: z.infer<typeof InitiateConnectionZodSchema>\n ): Promise<void> {\n const hcs10Builder = builder as HCS10Builder;\n const params: {\n targetAccountId: string;\n disableMonitor?: boolean;\n memo?: string;\n } = {\n targetAccountId: specificArgs.targetAccountId,\n };\n if (specificArgs.disableMonitor !== undefined) {\n params.disableMonitor = specificArgs.disableMonitor;\n }\n if (specificArgs.memo !== undefined) {\n params.memo = specificArgs.memo;\n }\n await hcs10Builder.initiateConnection(params);\n }\n}"],"names":[],"mappings":";;AAMA,MAAM,8BAA8B,EAAE,OAAO;AAAA,EAC3C,iBAAiB,EACd,OAAA,EACA;AAAA,IACC;AAAA,EAAA;AAAA,EAEJ,gBAAgB,EACb,UACA,WACA;AAAA,IACC;AAAA,EAAA;AAAA,EAEJ,MAAM,EACH,SACA,WACA;AAAA,IACC;AAAA,EAAA;AAEN,CAAC;AAQM,MAAM,+BAA+B,yBAE1C;AAAA,EAKA,YAAY,QAAoC;AAC9C,UAAM,MAAM;AALd,SAAA,OAAO;AACP,SAAA,cACE;AACF,SAAA,sBAAsB;AAGpB,SAAK,wBAAwB;AAC7B,SAAK,+BAA+B;AAAA,EACtC;AAAA,EAEA,MAAgB,kBACd,SACA,cACe;AACf,UAAM,eAAe;AACrB,UAAM,SAIF;AAAA,MACF,iBAAiB,aAAa;AAAA,IAAA;AAEhC,QAAI,aAAa,mBAAmB,QAAW;AAC7C,aAAO,iBAAiB,aAAa;AAAA,IACvC;AACA,QAAI,aAAa,SAAS,QAAW;AACnC,aAAO,OAAO,aAAa;AAAA,IAC7B;AACA,UAAM,aAAa,mBAAmB,MAAM;AAAA,EAC9C;AACF;"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { BaseHCS10QueryTool } from "./standards-agent-kit.es8.js";
|
|
3
|
-
const ListConnectionsZodSchema = z.object({
|
|
4
|
-
includeDetails: z.boolean().optional().describe(
|
|
5
|
-
"Whether to include detailed information about each connection"
|
|
6
|
-
),
|
|
7
|
-
showPending: z.boolean().optional().describe("Whether to include pending connection requests")
|
|
8
|
-
});
|
|
9
|
-
class ListConnectionsTool extends BaseHCS10QueryTool {
|
|
10
|
-
constructor(params) {
|
|
11
|
-
super(params);
|
|
12
|
-
this.name = "list_connections";
|
|
13
|
-
this.description = "Lists all active HCS-10 connections. Use this FIRST before sending messages to check if you already have an active connection to a target agent. Shows connection details and agent information for each active connection.";
|
|
14
|
-
this.specificInputSchema = ListConnectionsZodSchema;
|
|
15
|
-
}
|
|
16
|
-
async executeQuery(args) {
|
|
17
|
-
const hcs10Builder = this.hcs10Builder;
|
|
18
|
-
const params = {};
|
|
19
|
-
if (args.includeDetails !== void 0) {
|
|
20
|
-
params.includeDetails = args.includeDetails;
|
|
21
|
-
}
|
|
22
|
-
if (args.showPending !== void 0) {
|
|
23
|
-
params.showPending = args.showPending;
|
|
24
|
-
}
|
|
25
|
-
await hcs10Builder.listConnections(params);
|
|
26
|
-
const result = await hcs10Builder.execute();
|
|
27
|
-
if (result.success && "rawResult" in result && result.rawResult) {
|
|
28
|
-
const raw = result.rawResult;
|
|
29
|
-
return {
|
|
30
|
-
success: true,
|
|
31
|
-
data: raw.formattedOutput || raw.message || "Connections listed"
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
return result;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
export {
|
|
38
|
-
ListConnectionsTool
|
|
39
|
-
};
|
|
40
|
-
//# sourceMappingURL=standards-agent-kit.es12.js.map
|