@hashgraphonline/conversational-agent 0.2.107 → 0.2.110
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 +64 -27
- package/dist/cjs/config/system-message.d.ts +1 -1
- package/dist/cjs/conversational-agent.d.ts +16 -0
- package/dist/cjs/core/tool-registry.d.ts +26 -0
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/mcp/types.d.ts +1 -1
- package/dist/cjs/services/attachment-processor.d.ts +1 -2
- package/dist/cjs/services/content-store-manager.d.ts +1 -1
- package/dist/cjs/services/formatters/types.d.ts +3 -1
- package/dist/cjs/services/index.d.ts +1 -1
- package/dist/esm/index15.js +2 -2
- package/dist/esm/index15.js.map +1 -1
- package/dist/esm/index2.js +33 -39
- package/dist/esm/index2.js.map +1 -1
- package/dist/esm/index21.js.map +1 -1
- package/dist/esm/index23.js +2 -2
- package/dist/esm/index24.js.map +1 -1
- package/dist/esm/index26.js.map +1 -1
- package/dist/esm/index30.js.map +1 -1
- package/dist/esm/index4.js +1 -1
- package/dist/esm/index4.js.map +1 -1
- package/dist/esm/index40.js +2 -2
- package/dist/esm/index40.js.map +1 -1
- package/dist/esm/index43.js +52 -1
- package/dist/esm/index43.js.map +1 -1
- package/dist/esm/index47.js +1 -1
- package/dist/esm/index47.js.map +1 -1
- package/dist/esm/index6.js +75 -17
- package/dist/esm/index6.js.map +1 -1
- package/dist/types/config/system-message.d.ts +1 -1
- package/dist/types/conversational-agent.d.ts +16 -0
- package/dist/types/core/tool-registry.d.ts +26 -0
- package/dist/types/mcp/types.d.ts +1 -1
- package/dist/types/services/attachment-processor.d.ts +1 -2
- package/dist/types/services/content-store-manager.d.ts +1 -1
- package/dist/types/services/formatters/types.d.ts +3 -1
- package/dist/types/services/index.d.ts +1 -1
- package/package.json +12 -10
- package/src/config/system-message.ts +3 -3
- package/src/conversational-agent.ts +164 -56
- package/src/core/tool-registry.ts +61 -0
- package/src/mcp/mcp-client-manager.ts +2 -2
- package/src/mcp/types.ts +1 -1
- package/src/memory/content-storage.ts +19 -6
- package/src/plugins/hbar/AccountBuilder.ts +1 -1
- package/src/plugins/hcs-10/HCS10Plugin.ts +50 -52
- package/src/plugins/inscribe/InscribePlugin.ts +1 -1
- package/src/services/attachment-processor.ts +1 -1
- package/src/services/content-store-manager.ts +1 -1
- package/src/services/formatters/types.ts +3 -1
- package/src/services/index.ts +1 -1
package/README.md
CHANGED
|
@@ -133,7 +133,7 @@ When using `returnBytes` mode:
|
|
|
133
133
|
|
|
134
134
|
- **Automatic Key Detection**: Smart detection of ED25519 and ECDSA key types via mirror node
|
|
135
135
|
- **Multiple HCS Standards**: Built-in support for HCS-10, HCS-2, and inscription standards
|
|
136
|
-
- **
|
|
136
|
+
- **Core Plugin Suite**: HCS10Plugin, HCS2Plugin, InscribePlugin, and HbarPlugin
|
|
137
137
|
- **TypeScript Support**: Full type definitions for all components
|
|
138
138
|
- **State Management**: Integrated state management for agent operations
|
|
139
139
|
- **CLI Interface**: Beautiful terminal interface for interactive agent communication
|
|
@@ -188,16 +188,19 @@ The Conversational Agent includes all tools from the `hedera-agent-kit` v2 packa
|
|
|
188
188
|
This package includes a beautiful terminal interface built with [Ink](https://github.com/vadimdemedes/ink) that follows Hashgraph Consensus Standards design patterns.
|
|
189
189
|
|
|
190
190
|
```bash
|
|
191
|
-
# Run the interactive CLI
|
|
191
|
+
# Run the interactive CLI from the source workspace
|
|
192
192
|
pnpm cli
|
|
193
193
|
|
|
194
|
-
# Or with
|
|
194
|
+
# Or invoke the published binary with npx (no local build required)
|
|
195
|
+
npx @hashgraphonline/conversational-agent
|
|
196
|
+
|
|
197
|
+
# Provide credentials via environment variables (works for pnpm cli and npx)
|
|
195
198
|
export HEDERA_ACCOUNT_ID=0.0.12345
|
|
196
199
|
export HEDERA_PRIVATE_KEY=your-private-key
|
|
197
200
|
export OPENAI_API_KEY=sk-your-openai-key
|
|
198
201
|
pnpm cli
|
|
199
202
|
|
|
200
|
-
#
|
|
203
|
+
# Supply configuration through CLI flags
|
|
201
204
|
pnpm cli -- --account-id=0.0.12345 --private-key=... --openai-api-key=sk-...
|
|
202
205
|
```
|
|
203
206
|
|
|
@@ -210,13 +213,34 @@ pnpm cli -- --account-id=0.0.12345 --private-key=... --openai-api-key=sk-...
|
|
|
210
213
|
- 🚀 **Fast & Responsive** - Built with React for smooth interactions
|
|
211
214
|
- 📊 **Transaction Details** - See transaction IDs and network responses
|
|
212
215
|
|
|
216
|
+
### Headless Mode
|
|
217
|
+
|
|
218
|
+
Use the same executable to run a single command without the interactive UI. Headless mode activates automatically when you pass a command argument or when the CLI receives non-interactive input.
|
|
219
|
+
|
|
220
|
+
```bash
|
|
221
|
+
# Pass the command immediately after the binary
|
|
222
|
+
npx @hashgraphonline/conversational-agent "Register me as an AI agent named TestBot"
|
|
223
|
+
|
|
224
|
+
# Or use the explicit flag (useful when the command contains leading dashes)
|
|
225
|
+
npx @hashgraphonline/conversational-agent \
|
|
226
|
+
--account-id=0.0.12345 \
|
|
227
|
+
--private-key=... \
|
|
228
|
+
--openai-api-key=sk-... \
|
|
229
|
+
--command "Transfer 1 HBAR to 0.0.800"
|
|
230
|
+
|
|
231
|
+
# From the workspace helper script
|
|
232
|
+
pnpm cli -- --command "Find my pending connection requests"
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
Headless execution prints structured output prefixed with the speaker (for example `[assistant]`, `[error]`, `[transaction]`) and returns a non-zero exit code when an error occurs. This makes it suitable for automation, CI tasks, or scripting flows that need machine-readable responses.
|
|
236
|
+
|
|
213
237
|
## Creating Custom Plugins
|
|
214
238
|
|
|
215
239
|
You can extend the conversational agent with custom plugins. Here's how to create one:
|
|
216
240
|
|
|
217
241
|
### Plugin Structure
|
|
218
242
|
|
|
219
|
-
See
|
|
243
|
+
See the [Conversational Agent documentation](https://hashgraphonline.com/docs/libraries/conversational-agent/) for detailed plugin development guidance.
|
|
220
244
|
|
|
221
245
|
```typescript
|
|
222
246
|
import {
|
|
@@ -320,28 +344,39 @@ const response = await agent.processMessage(
|
|
|
320
344
|
4. **State Management**: If your plugin needs state, consider implementing a custom state manager
|
|
321
345
|
5. **Documentation**: Provide clear descriptions for your plugin and tools
|
|
322
346
|
|
|
323
|
-
For more details, see
|
|
347
|
+
For more details, see the [Conversational Agent documentation](https://hashgraphonline.com/docs/libraries/conversational-agent/).
|
|
324
348
|
|
|
325
349
|
## Configuration Options
|
|
326
350
|
|
|
327
|
-
| Option
|
|
328
|
-
|
|
|
329
|
-
| `accountId`
|
|
330
|
-
| `privateKey`
|
|
331
|
-
| `network`
|
|
332
|
-
| `openAIApiKey`
|
|
333
|
-
| `openAIModelName`
|
|
334
|
-
| `
|
|
335
|
-
| `
|
|
336
|
-
| `
|
|
337
|
-
| `
|
|
338
|
-
| `
|
|
339
|
-
| `
|
|
340
|
-
| `
|
|
341
|
-
| `
|
|
342
|
-
| `
|
|
343
|
-
| `
|
|
344
|
-
| `
|
|
351
|
+
| Option | Type | Default | Description |
|
|
352
|
+
| --- | --- | --- | --- |
|
|
353
|
+
| `accountId` | string | **required** | Hedera account ID (e.g., `0.0.12345`) |
|
|
354
|
+
| `privateKey` | string | **required** | Private key for the account |
|
|
355
|
+
| `network` | `NetworkType` | `'testnet'` | Network to connect to (`'mainnet'`, `'testnet'`, or `'previewnet'`) |
|
|
356
|
+
| `openAIApiKey` | string | **required** | API key used for the default LLM provider and entity memory |
|
|
357
|
+
| `openAIModelName` | string | `'gpt-4o'` | Preferred OpenAI model when `llmProvider` is `openai` |
|
|
358
|
+
| `llmProvider` | `'openai' \| 'anthropic' \| 'openrouter'` | `'openai'` | Primary LLM provider for conversational responses |
|
|
359
|
+
| `verbose` | boolean | false | Enable verbose logging |
|
|
360
|
+
| `operationalMode` | `AgentOperationalMode` | `'autonomous'` | `'autonomous'` or `'returnBytes'` |
|
|
361
|
+
| `userAccountId` | string | undefined | Account ID applied to scheduled transactions in returnBytes mode |
|
|
362
|
+
| `customSystemMessagePreamble` | string | Hashgraph Online system prompt | Custom system message prefix |
|
|
363
|
+
| `customSystemMessagePostamble` | string | undefined | Custom system message suffix |
|
|
364
|
+
| `additionalPlugins` | `BasePlugin[]` | [] | Additional plugins to load |
|
|
365
|
+
| `stateManager` | `IStateManager` | `OpenConvaiState` | Custom state manager |
|
|
366
|
+
| `scheduleUserTransactionsInBytesMode` | boolean | false | Schedule transactions automatically in returnBytes mode |
|
|
367
|
+
| `mirrorNodeConfig` | `MirrorNodeConfig` | undefined | Custom mirror node configuration |
|
|
368
|
+
| `disableLogging` | boolean | false | Disable all logging |
|
|
369
|
+
| `enabledPlugins` | string[] | undefined | Filter which plugins to enable by ID |
|
|
370
|
+
| `toolFilter` | `(tool: { name: string; namespace?: string }) => boolean` | undefined | Predicate to include or exclude tools dynamically |
|
|
371
|
+
| `mcpServers` | `MCPServerConfig[]` | undefined | Configure MCP servers for Model Context Protocol support |
|
|
372
|
+
| `walletExecutor` | `(base64, network) => Promise<{ transactionId: string }>` | undefined | Custom executor for wallet-driven transaction submission |
|
|
373
|
+
| `customSignerFactory` | `(args) => AbstractSigner` | undefined | Override signer selection when initializing the agent |
|
|
374
|
+
| `entityMemoryEnabled` | boolean | true | Enable automatic entity extraction and storage |
|
|
375
|
+
| `entityMemoryConfig` | `SmartMemoryConfig` | undefined | Custom configuration for entity memory |
|
|
376
|
+
| `entityMemoryProvider` | `'openai' \| 'anthropic' \| 'openrouter'` | Matches `llmProvider` | Provider used for entity extraction and resolution |
|
|
377
|
+
| `entityMemoryModelName` | string | Provider-specific default | Override model used for entity memory operations |
|
|
378
|
+
| `openRouterApiKey` | string | undefined | API key when using OpenRouter (falls back to `openAIApiKey`) |
|
|
379
|
+
| `openRouterBaseURL` | string | `'https://openrouter.ai/api/v1'` | Base URL for OpenRouter requests |
|
|
345
380
|
|
|
346
381
|
## Environment Variables
|
|
347
382
|
|
|
@@ -369,6 +404,7 @@ await agent.initialize();
|
|
|
369
404
|
const hcs10Plugin = agent.hcs10Plugin;
|
|
370
405
|
const hcs2Plugin = agent.hcs2Plugin;
|
|
371
406
|
const inscribePlugin = agent.inscribePlugin;
|
|
407
|
+
const hbarPlugin = agent.hbarPlugin;
|
|
372
408
|
|
|
373
409
|
// Access the underlying Hedera agent
|
|
374
410
|
const hederaAgent = agent.getConversationalAgent();
|
|
@@ -421,6 +457,7 @@ const hcs2Agent = ConversationalAgent.withHCS2({
|
|
|
421
457
|
// ConversationalAgent.withSmartContract() - Only smart contract tools
|
|
422
458
|
// ConversationalAgent.withAllStandards() - All HCS standards plugins (HCS-10, HCS-2, Inscribe)
|
|
423
459
|
// ConversationalAgent.minimal() - Only basic account tools
|
|
460
|
+
// ConversationalAgent.withMCP(options, mcpServers) - Configure Model Context Protocol servers
|
|
424
461
|
```
|
|
425
462
|
|
|
426
463
|
### Plugin Filtering
|
|
@@ -441,7 +478,7 @@ const agent = new ConversationalAgent({
|
|
|
441
478
|
Available plugin IDs:
|
|
442
479
|
|
|
443
480
|
- Standard plugins: `hcs-10`, `hcs-2`, `inscribe`
|
|
444
|
-
- Core Hedera plugins: `hts-token`, `account`, `file-service`, `consensus-service`, `smart-contract`, `network`
|
|
481
|
+
- Core Hedera plugins: `hts-token`, `account`, `file-service`, `consensus-service`, `smart-contract`, `network`, `hbar`
|
|
445
482
|
|
|
446
483
|
### Legacy Plugin Usage (hedera-agent-kit 2.0.3 only)
|
|
447
484
|
|
|
@@ -490,7 +527,7 @@ If you've created a plugin that extends the Conversational Agent's capabilities,
|
|
|
490
527
|
|
|
491
528
|
2. **Create Your Plugin**
|
|
492
529
|
- Place your plugin in `src/plugins/community/[your-plugin-name]/`
|
|
493
|
-
- Follow the plugin structure outlined in the [
|
|
530
|
+
- Follow the plugin structure outlined in the [Conversational Agent documentation](https://hashgraphonline.com/docs/libraries/conversational-agent/)
|
|
494
531
|
- Include comprehensive tests in `src/plugins/community/[your-plugin-name]/__tests__/`
|
|
495
532
|
- Add documentation in `src/plugins/community/[your-plugin-name]/README.md`
|
|
496
533
|
|
|
@@ -545,7 +582,7 @@ src/plugins/community/your-plugin/
|
|
|
545
582
|
|
|
546
583
|
### Getting Help
|
|
547
584
|
|
|
548
|
-
- Join our [
|
|
585
|
+
- Join our [Telegram community](https://t.me/hashinals) for discussions
|
|
549
586
|
- Check existing issues and PRs before starting work
|
|
550
587
|
- Ask questions in the #development channel
|
|
551
588
|
- Review the [HCS Standards](https://hashgraphonline.com/docs/standards) for protocol details
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const getSystemMessage: (accountId
|
|
1
|
+
export declare const getSystemMessage: (accountId?: string) => string;
|
|
@@ -244,5 +244,21 @@ export declare class ConversationalAgent {
|
|
|
244
244
|
* Clean up resources
|
|
245
245
|
*/
|
|
246
246
|
cleanup(): Promise<void>;
|
|
247
|
+
/**
|
|
248
|
+
* Switch operational mode
|
|
249
|
+
*/
|
|
250
|
+
switchMode(mode?: AgentOperationalMode): void;
|
|
251
|
+
/**
|
|
252
|
+
* Get usage statistics
|
|
253
|
+
*/
|
|
254
|
+
getUsageStats(): unknown;
|
|
255
|
+
/**
|
|
256
|
+
* Clear usage statistics
|
|
257
|
+
*/
|
|
258
|
+
clearUsageStats(): void;
|
|
259
|
+
/**
|
|
260
|
+
* Shutdown the agent
|
|
261
|
+
*/
|
|
262
|
+
shutdown(): Promise<void>;
|
|
247
263
|
private extractResponseText;
|
|
248
264
|
}
|
|
@@ -45,6 +45,12 @@ export interface ToolRegistryEntry {
|
|
|
45
45
|
metadata: ToolMetadata;
|
|
46
46
|
wrapper?: FormValidatingToolWrapper<z.ZodObject<z.ZodRawShape>> | undefined;
|
|
47
47
|
originalTool: StructuredTool;
|
|
48
|
+
options?: {
|
|
49
|
+
priority?: ToolCapabilities['priority'];
|
|
50
|
+
capability?: string;
|
|
51
|
+
enabled?: boolean;
|
|
52
|
+
namespace?: string;
|
|
53
|
+
};
|
|
48
54
|
}
|
|
49
55
|
/**
|
|
50
56
|
* Options for tool registration
|
|
@@ -102,6 +108,26 @@ export declare class ToolRegistry {
|
|
|
102
108
|
* Get all tool names
|
|
103
109
|
*/
|
|
104
110
|
getToolNames(): string[];
|
|
111
|
+
/**
|
|
112
|
+
* Get tools by priority
|
|
113
|
+
*/
|
|
114
|
+
getToolsByPriority(priority: ToolCapabilities['priority']): ToolRegistryEntry[];
|
|
115
|
+
/**
|
|
116
|
+
* Get enabled tools (all tools are considered enabled by default)
|
|
117
|
+
*/
|
|
118
|
+
getEnabledTools(): ToolRegistryEntry[];
|
|
119
|
+
/**
|
|
120
|
+
* Get tools by namespace/category
|
|
121
|
+
*/
|
|
122
|
+
getToolsByNamespace(namespace?: string): ToolRegistryEntry[];
|
|
123
|
+
/**
|
|
124
|
+
* Check if registry has capability
|
|
125
|
+
*/
|
|
126
|
+
hasCapability(capability: keyof ToolCapabilities): boolean;
|
|
127
|
+
/**
|
|
128
|
+
* Update tool options (metadata)
|
|
129
|
+
*/
|
|
130
|
+
updateToolOptions(name: string, options: Partial<ToolMetadata>): boolean;
|
|
105
131
|
/**
|
|
106
132
|
* Check if a tool is registered
|
|
107
133
|
*/
|