@hashgraphonline/standards-agent-kit 0.2.155 → 0.2.158
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 +1 -1
- package/dist/cjs/standards-agent-kit.cjs +1 -1
- package/dist/cjs/standards-agent-kit.cjs.map +1 -1
- package/dist/es/builders/inscriber/inscriber-builder.d.ts +1 -1
- package/dist/es/standards-agent-kit.es24.js +1 -1
- package/dist/es/standards-agent-kit.es25.js +1 -1
- package/dist/es/standards-agent-kit.es26.js +1 -1
- package/dist/es/standards-agent-kit.es27.js +1 -1
- package/dist/es/standards-agent-kit.es28.js +1 -1
- package/dist/es/standards-agent-kit.es31.js +1 -1
- package/dist/es/standards-agent-kit.es32.js +1 -1
- package/dist/es/standards-agent-kit.es33.js +1 -1
- package/dist/es/standards-agent-kit.es36.js +1 -1
- package/dist/es/standards-agent-kit.es37.js +1 -1
- package/dist/es/standards-agent-kit.es38.js +3 -3
- package/dist/es/standards-agent-kit.es39.js +5 -5
- 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.es50.js +3 -20
- package/dist/es/standards-agent-kit.es50.js.map +1 -1
- package/dist/es/standards-agent-kit.es51.js +17 -50
- package/dist/es/standards-agent-kit.es51.js.map +1 -1
- package/dist/es/standards-agent-kit.es52.js +54 -3
- package/dist/es/standards-agent-kit.es52.js.map +1 -1
- package/dist/es/standards-agent-kit.es53.js +2 -39
- package/dist/es/standards-agent-kit.es53.js.map +1 -1
- package/dist/es/standards-agent-kit.es54.js +38 -17
- package/dist/es/standards-agent-kit.es54.js.map +1 -1
- package/dist/es/standards-agent-kit.es55.js +16 -71
- package/dist/es/standards-agent-kit.es55.js.map +1 -1
- package/dist/es/standards-agent-kit.es56.js +73 -3
- package/dist/es/standards-agent-kit.es56.js.map +1 -1
- package/dist/es/standards-agent-kit.es6.js +1 -1
- package/dist/es/standards-agent-kit.es7.js +1 -1
- package/dist/es/standards-agent-kit.es8.js +53 -63
- package/dist/es/standards-agent-kit.es8.js.map +1 -1
- package/dist/es/standards-agent-kit.es9.js +1 -1
- package/dist/umd/builders/inscriber/inscriber-builder.d.ts +1 -1
- package/dist/umd/standards-agent-kit.umd.js +220 -1
- package/dist/umd/standards-agent-kit.umd.js.map +1 -1
- package/package.json +26 -34
- package/src/builders/inscriber/inscriber-builder.ts +60 -68
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.158",
|
|
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,33 +21,6 @@
|
|
|
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
|
-
},
|
|
51
24
|
"keywords": [
|
|
52
25
|
"hedera",
|
|
53
26
|
"hcs10",
|
|
@@ -129,10 +102,29 @@
|
|
|
129
102
|
"vite-plugin-node-polyfills": "^0.23.0",
|
|
130
103
|
"vite-plugin-string-replace": "^1.1.3"
|
|
131
104
|
},
|
|
132
|
-
"
|
|
133
|
-
|
|
134
|
-
"
|
|
135
|
-
|
|
136
|
-
|
|
105
|
+
"scripts": {
|
|
106
|
+
"clean": "rimraf dist",
|
|
107
|
+
"build:es": "BUILD_FORMAT=es vite build",
|
|
108
|
+
"build:cjs": "BUILD_FORMAT=cjs vite build",
|
|
109
|
+
"build:umd": "BUILD_FORMAT=umd vite build",
|
|
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"
|
|
137
129
|
}
|
|
138
|
-
}
|
|
130
|
+
}
|
|
@@ -125,12 +125,47 @@ export class InscriberBuilder extends BaseServiceBuilder {
|
|
|
125
125
|
}
|
|
126
126
|
|
|
127
127
|
/**
|
|
128
|
-
* Get or create Inscription SDK
|
|
128
|
+
* Get or create Inscription SDK
|
|
129
129
|
*/
|
|
130
130
|
protected async getInscriptionSDK(
|
|
131
131
|
_options: InscriptionOptions
|
|
132
132
|
): Promise<InscriptionSDK | null> {
|
|
133
|
-
|
|
133
|
+
if (this.inscriptionSDK) {
|
|
134
|
+
return this.inscriptionSDK;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
try {
|
|
138
|
+
const network = this.hederaKit.client.network;
|
|
139
|
+
const networkType: 'mainnet' | 'testnet' = network.toString().includes('mainnet')
|
|
140
|
+
? 'mainnet'
|
|
141
|
+
: 'testnet';
|
|
142
|
+
|
|
143
|
+
const signer = await this.getSigner();
|
|
144
|
+
const accountId = this.hederaKit.signer.getAccountId().toString();
|
|
145
|
+
|
|
146
|
+
if (signer) {
|
|
147
|
+
this.inscriptionSDK = await InscriptionSDK.createWithAuth({
|
|
148
|
+
type: 'client',
|
|
149
|
+
accountId,
|
|
150
|
+
signer: signer as Parameters<typeof InscriptionSDK.createWithAuth>[0] extends { type: 'client'; signer: infer S } ? S : never,
|
|
151
|
+
network: networkType,
|
|
152
|
+
});
|
|
153
|
+
} else {
|
|
154
|
+
const privateKey = this.hederaKit.signer?.getOperatorPrivateKey();
|
|
155
|
+
if (privateKey) {
|
|
156
|
+
this.inscriptionSDK = await InscriptionSDK.createWithAuth({
|
|
157
|
+
type: 'server',
|
|
158
|
+
accountId,
|
|
159
|
+
privateKey: privateKey.toStringRaw(),
|
|
160
|
+
network: networkType,
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
} catch (error) {
|
|
165
|
+
this.logger.warn('Failed to create InscriptionSDK with auth', error);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
return this.inscriptionSDK || null;
|
|
134
169
|
}
|
|
135
170
|
|
|
136
171
|
/**
|
|
@@ -325,73 +360,30 @@ export class InscriberBuilder extends BaseServiceBuilder {
|
|
|
325
360
|
|
|
326
361
|
const sdk = await this.getInscriptionSDK(options);
|
|
327
362
|
if (sdk) {
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
true
|
|
335
|
-
);
|
|
336
|
-
const topicIdFromInscription: string | undefined = getTopicId(
|
|
337
|
-
retrieved as unknown
|
|
363
|
+
const retrieved: RetrievedInscriptionResult =
|
|
364
|
+
await sdk.waitForInscription(
|
|
365
|
+
transactionId,
|
|
366
|
+
maxAttempts,
|
|
367
|
+
intervalMs,
|
|
368
|
+
true
|
|
338
369
|
);
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
return resultConfirmed;
|
|
357
|
-
} catch (error) {
|
|
358
|
-
this.logger.error('Failed to wait for inscription', error);
|
|
359
|
-
}
|
|
360
|
-
} else {
|
|
361
|
-
for (let attempt = 0; attempt < maxAttempts; attempt++) {
|
|
362
|
-
try {
|
|
363
|
-
const retrieved: RetrievedInscriptionResult =
|
|
364
|
-
await this.retrieveInscription(transactionId, options);
|
|
365
|
-
const topicIdFromInscription: string | undefined = getTopicId(
|
|
366
|
-
retrieved as unknown
|
|
367
|
-
);
|
|
368
|
-
const topicId: string | undefined =
|
|
369
|
-
topicIdFromInscription ?? startResponse.topic_id;
|
|
370
|
-
const status: string | undefined = (
|
|
371
|
-
retrieved as { status?: string }
|
|
372
|
-
).status;
|
|
373
|
-
const isDone = status === 'completed' || !!topicId;
|
|
374
|
-
if (isDone) {
|
|
375
|
-
const resultConfirmed: InscriptionResponse = {
|
|
376
|
-
quote: false,
|
|
377
|
-
confirmed: true,
|
|
378
|
-
result: {
|
|
379
|
-
jobId: startResponse.tx_id || '',
|
|
380
|
-
transactionId,
|
|
381
|
-
topicId,
|
|
382
|
-
},
|
|
383
|
-
inscription: retrieved,
|
|
384
|
-
} as unknown as InscriptionResponse;
|
|
385
|
-
this.logger.debug(
|
|
386
|
-
'retrieved inscription',
|
|
387
|
-
resultConfirmed,
|
|
388
|
-
retrieved
|
|
389
|
-
);
|
|
390
|
-
return resultConfirmed;
|
|
391
|
-
}
|
|
392
|
-
} catch {}
|
|
393
|
-
await new Promise((resolve) => setTimeout(resolve, intervalMs));
|
|
394
|
-
}
|
|
370
|
+
const topicIdFromInscription: string | undefined = getTopicId(
|
|
371
|
+
retrieved as unknown
|
|
372
|
+
);
|
|
373
|
+
const topicId: string | undefined =
|
|
374
|
+
topicIdFromInscription ?? startResponse.topic_id;
|
|
375
|
+
const resultConfirmed: InscriptionResponse = {
|
|
376
|
+
quote: false,
|
|
377
|
+
confirmed: true,
|
|
378
|
+
result: {
|
|
379
|
+
jobId: startResponse.tx_id || '',
|
|
380
|
+
transactionId,
|
|
381
|
+
topicId,
|
|
382
|
+
},
|
|
383
|
+
inscription: retrieved,
|
|
384
|
+
} as unknown as InscriptionResponse;
|
|
385
|
+
this.logger.debug('retrieved inscription', resultConfirmed, retrieved);
|
|
386
|
+
return resultConfirmed;
|
|
395
387
|
}
|
|
396
388
|
}
|
|
397
389
|
|