@hashgraphonline/standards-agent-kit 0.2.162 → 0.2.165
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/README.md +68 -0
- package/dist/cjs/builders/inscriber/inscriber-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/inscriber/inscriber-builder.d.ts +2 -2
- 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 +1 -1
- package/dist/es/standards-agent-kit.es7.js +1 -1
- package/dist/es/standards-agent-kit.es8.js +26 -47
- 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 +2 -2
- package/dist/umd/standards-agent-kit.umd.js +1 -220
- package/dist/umd/standards-agent-kit.umd.js.map +1 -1
- package/package.json +36 -28
- package/src/builders/inscriber/inscriber-builder.ts +34 -59
- package/src/plugins/index.ts +1 -0
- package/src/plugins/registry-broker/RegistryBrokerClientProvider.ts +116 -0
- package/src/plugins/registry-broker/RegistryBrokerConversationStore.ts +46 -0
- package/src/plugins/registry-broker/RegistryBrokerOperationTool.ts +630 -0
- package/src/plugins/registry-broker/RegistryBrokerPlugin.ts +63 -0
package/README.md
CHANGED
|
@@ -162,6 +162,74 @@ The SDK provides a comprehensive set of tools for HCS-10 agent operations:
|
|
|
162
162
|
- **AcceptConnectionRequestTool**: Accept incoming connections
|
|
163
163
|
- **ListUnapprovedConnectionRequestsTool**: View pending requests
|
|
164
164
|
|
|
165
|
+
## Registry Broker Plugin
|
|
166
|
+
|
|
167
|
+
The `RegistryBrokerPlugin` bridges the [`RegistryBrokerClient`](https://hashgraphonline.com/docs/registry-broker/api/client) inside every Hedera Agent Kit integration. Once registered, agents can call *any* broker endpoint (search, chat, registration, UAID utilities, ledger auth, credits, encryption) through a single tool. The plugin automatically reuses shared credentials and keeps encrypted chat handles alive via `conversation.*` operations.
|
|
168
|
+
|
|
169
|
+
```ts
|
|
170
|
+
import { PluginRegistry } from 'hedera-agent-kit';
|
|
171
|
+
import { RegistryBrokerPlugin } from '@hashgraphonline/standards-agent-kit';
|
|
172
|
+
|
|
173
|
+
const pluginRegistry = new PluginRegistry();
|
|
174
|
+
pluginRegistry.register(
|
|
175
|
+
new RegistryBrokerPlugin(),
|
|
176
|
+
);
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
Configure credentials via `registryBroker` plugin config or environment variables:
|
|
180
|
+
|
|
181
|
+
```ts
|
|
182
|
+
const plugin = new RegistryBrokerPlugin();
|
|
183
|
+
await plugin.initialize({
|
|
184
|
+
config: {
|
|
185
|
+
hederaKit,
|
|
186
|
+
registryBroker: {
|
|
187
|
+
client: {
|
|
188
|
+
baseUrl: process.env.REGISTRY_BROKER_BASE_URL,
|
|
189
|
+
apiKey: process.env.REGISTRY_BROKER_API_KEY,
|
|
190
|
+
},
|
|
191
|
+
},
|
|
192
|
+
},
|
|
193
|
+
logger,
|
|
194
|
+
});
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
> **Env Fallbacks**
|
|
198
|
+
>
|
|
199
|
+
> - `REGISTRY_BROKER_API_KEY` / `RB_API_KEY`
|
|
200
|
+
> - `REGISTRY_BROKER_BASE_URL`
|
|
201
|
+
> - `REGISTRY_BROKER_LEDGER_ACCOUNT_ID`, `REGISTRY_BROKER_LEDGER_NETWORK`, `REGISTRY_BROKER_LEDGER_PRIVATE_KEY` (or `HEDERA_ACCOUNT_ID` / `HEDERA_PRIVATE_KEY`) – enables automatic ledger authentication if no API key is supplied.
|
|
202
|
+
|
|
203
|
+
Every operation is invoked through `registry_broker_operation`:
|
|
204
|
+
|
|
205
|
+
```ts
|
|
206
|
+
const [registryTool] = plugin.getTools();
|
|
207
|
+
|
|
208
|
+
// Discovery
|
|
209
|
+
await registryTool._call({
|
|
210
|
+
operation: 'search',
|
|
211
|
+
payload: { q: 'openrouter', limit: 5 },
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
// Chat with broker-managed UAIDs
|
|
215
|
+
const session = await registryTool._call({
|
|
216
|
+
operation: 'chat.createSession',
|
|
217
|
+
payload: {
|
|
218
|
+
uaid: 'uaid:aid:2bnewJwP95isoCUkT5mee5gm212WS76tphHwBQvbWoquRa9kt89UanrBqHXpaSh4AN;uid=anthropic/claude-3.5-sonnet;registry=openrouter;proto=openrouter;nativeId=anthropic/claude-3.5-sonnet',
|
|
219
|
+
historyTtlSeconds: 900,
|
|
220
|
+
},
|
|
221
|
+
});
|
|
222
|
+
await registryTool._call({
|
|
223
|
+
operation: 'chat.sendMessage',
|
|
224
|
+
payload: {
|
|
225
|
+
sessionId: JSON.parse(session).result.sessionId,
|
|
226
|
+
message: 'Hello from the Hedera Agent Kit plugin!',
|
|
227
|
+
},
|
|
228
|
+
});
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
For encrypted chat flows, call `chat.start`, `chat.createEncryptedSession`, or `chat.acceptEncryptedSession`. The plugin returns a `handleId`; subsequent `conversation.send`, `conversation.decryptHistoryEntry`, and `conversation.release` operations reuse that state without exposing the raw `ChatConversationHandle`.
|
|
232
|
+
|
|
165
233
|
## Plugin Development
|
|
166
234
|
|
|
167
235
|
Create custom plugins by extending the base plugin interface:
|
|
@@ -27,7 +27,7 @@ export interface CompletedInscriptionResponse {
|
|
|
27
27
|
/**
|
|
28
28
|
* Builder for Inscription operations
|
|
29
29
|
*/
|
|
30
|
-
type InscriptionSDKInstance =
|
|
30
|
+
type InscriptionSDKInstance = InscriptionSDK;
|
|
31
31
|
export declare const toDashedTransactionId: (transactionId: string) => string;
|
|
32
32
|
export declare class InscriberBuilder extends BaseServiceBuilder {
|
|
33
33
|
protected inscriptionSDK?: InscriptionSDKInstance;
|
|
@@ -59,7 +59,7 @@ export declare class InscriberBuilder extends BaseServiceBuilder {
|
|
|
59
59
|
/**
|
|
60
60
|
* Get or create Inscription SDK
|
|
61
61
|
*/
|
|
62
|
-
protected getInscriptionSDK(
|
|
62
|
+
protected getInscriptionSDK(options: InscriptionOptions): Promise<InscriptionSDKInstance | null>;
|
|
63
63
|
/**
|
|
64
64
|
* Inscribe content using server-side authentication
|
|
65
65
|
*/
|