@hashgraphonline/conversational-agent 0.2.104 → 0.2.106

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.
Files changed (117) hide show
  1. package/cli/readme.md +181 -0
  2. package/dist/cjs/conversational-agent.d.ts +11 -2
  3. package/dist/cjs/core/tool-registry.d.ts +3 -0
  4. package/dist/cjs/forms/field-guidance-registry.d.ts +33 -0
  5. package/dist/cjs/index.cjs +1 -1
  6. package/dist/cjs/index.cjs.map +1 -1
  7. package/dist/cjs/index.d.ts +1 -0
  8. package/dist/cjs/plugins/inscribe/InscribePlugin.d.ts +1 -0
  9. package/dist/cjs/runtime/wallet-bridge.d.ts +23 -0
  10. package/dist/cjs/signers/browser-signer.d.ts +32 -0
  11. package/dist/esm/index.js +3 -0
  12. package/dist/esm/index.js.map +1 -1
  13. package/dist/esm/index10.js +13 -5
  14. package/dist/esm/index10.js.map +1 -1
  15. package/dist/esm/index13.js +157 -179
  16. package/dist/esm/index13.js.map +1 -1
  17. package/dist/esm/index2.js +29 -25
  18. package/dist/esm/index2.js.map +1 -1
  19. package/dist/esm/index21.js +1 -1
  20. package/dist/esm/index23.js +3 -3
  21. package/dist/esm/index3.js.map +1 -1
  22. package/dist/esm/index33.js +5 -5
  23. package/dist/esm/index33.js.map +1 -1
  24. package/dist/esm/index36.js +8 -45
  25. package/dist/esm/index36.js.map +1 -1
  26. package/dist/esm/index37.js +41 -102
  27. package/dist/esm/index37.js.map +1 -1
  28. package/dist/esm/index38.js +107 -21
  29. package/dist/esm/index38.js.map +1 -1
  30. package/dist/esm/index39.js +63 -24
  31. package/dist/esm/index39.js.map +1 -1
  32. package/dist/esm/index4.js +43 -0
  33. package/dist/esm/index4.js.map +1 -1
  34. package/dist/esm/index40.js +21 -12
  35. package/dist/esm/index40.js.map +1 -1
  36. package/dist/esm/index41.js +11 -4
  37. package/dist/esm/index41.js.map +1 -1
  38. package/dist/esm/index42.js +7 -255
  39. package/dist/esm/index42.js.map +1 -1
  40. package/dist/esm/index43.js +5 -184
  41. package/dist/esm/index43.js.map +1 -1
  42. package/dist/esm/index44.js +271 -7
  43. package/dist/esm/index44.js.map +1 -1
  44. package/dist/esm/index45.js +174 -82
  45. package/dist/esm/index45.js.map +1 -1
  46. package/dist/esm/index46.js +30 -0
  47. package/dist/esm/index46.js.map +1 -0
  48. package/dist/esm/index47.js +95 -0
  49. package/dist/esm/index47.js.map +1 -0
  50. package/dist/esm/index5.js +2 -2
  51. package/dist/esm/index6.js +111 -23
  52. package/dist/esm/index6.js.map +1 -1
  53. package/dist/types/conversational-agent.d.ts +11 -2
  54. package/dist/types/core/tool-registry.d.ts +3 -0
  55. package/dist/types/forms/field-guidance-registry.d.ts +33 -0
  56. package/dist/types/index.d.ts +1 -0
  57. package/dist/types/plugins/inscribe/InscribePlugin.d.ts +1 -0
  58. package/dist/types/runtime/wallet-bridge.d.ts +23 -0
  59. package/dist/types/signers/browser-signer.d.ts +32 -0
  60. package/package.json +43 -32
  61. package/src/conversational-agent.ts +139 -39
  62. package/src/core/tool-registry.ts +25 -0
  63. package/src/forms/field-guidance-registry.ts +215 -188
  64. package/src/forms/form-generator.ts +28 -12
  65. package/src/index.ts +1 -0
  66. package/src/langchain/langchain-agent.ts +1 -1
  67. package/src/plugins/hcs-10/HCS10Plugin.ts +32 -28
  68. package/src/plugins/hcs-2/HCS2Plugin.ts +4 -2
  69. package/src/plugins/inscribe/InscribePlugin.ts +47 -2
  70. package/src/runtime/wallet-bridge.ts +41 -0
  71. package/src/signers/browser-signer.ts +112 -0
  72. package/cli/dist/CLIApp.d.ts +0 -9
  73. package/cli/dist/CLIApp.js +0 -127
  74. package/cli/dist/LocalConversationalAgent.d.ts +0 -37
  75. package/cli/dist/LocalConversationalAgent.js +0 -58
  76. package/cli/dist/app.d.ts +0 -16
  77. package/cli/dist/app.js +0 -13
  78. package/cli/dist/cli.d.ts +0 -2
  79. package/cli/dist/cli.js +0 -51
  80. package/cli/dist/components/AppContainer.d.ts +0 -16
  81. package/cli/dist/components/AppContainer.js +0 -24
  82. package/cli/dist/components/AppScreens.d.ts +0 -2
  83. package/cli/dist/components/AppScreens.js +0 -259
  84. package/cli/dist/components/ChatScreen.d.ts +0 -15
  85. package/cli/dist/components/ChatScreen.js +0 -39
  86. package/cli/dist/components/DebugLoadingScreen.d.ts +0 -5
  87. package/cli/dist/components/DebugLoadingScreen.js +0 -31
  88. package/cli/dist/components/LoadingScreen.d.ts +0 -2
  89. package/cli/dist/components/LoadingScreen.js +0 -16
  90. package/cli/dist/components/LoadingScreenDebug.d.ts +0 -5
  91. package/cli/dist/components/LoadingScreenDebug.js +0 -27
  92. package/cli/dist/components/MCPConfigScreen.d.ts +0 -28
  93. package/cli/dist/components/MCPConfigScreen.js +0 -168
  94. package/cli/dist/components/ScreenRouter.d.ts +0 -12
  95. package/cli/dist/components/ScreenRouter.js +0 -22
  96. package/cli/dist/components/SetupScreen.d.ts +0 -15
  97. package/cli/dist/components/SetupScreen.js +0 -65
  98. package/cli/dist/components/SingleLoadingScreen.d.ts +0 -5
  99. package/cli/dist/components/SingleLoadingScreen.js +0 -27
  100. package/cli/dist/components/StatusBadge.d.ts +0 -7
  101. package/cli/dist/components/StatusBadge.js +0 -28
  102. package/cli/dist/components/TerminalWindow.d.ts +0 -8
  103. package/cli/dist/components/TerminalWindow.js +0 -24
  104. package/cli/dist/components/WelcomeScreen.d.ts +0 -11
  105. package/cli/dist/components/WelcomeScreen.js +0 -47
  106. package/cli/dist/context/AppContext.d.ts +0 -68
  107. package/cli/dist/context/AppContext.js +0 -363
  108. package/cli/dist/hooks/useInitializeAgent.d.ts +0 -19
  109. package/cli/dist/hooks/useInitializeAgent.js +0 -28
  110. package/cli/dist/hooks/useStableState.d.ts +0 -38
  111. package/cli/dist/hooks/useStableState.js +0 -68
  112. package/cli/dist/managers/AgentManager.d.ts +0 -57
  113. package/cli/dist/managers/AgentManager.js +0 -119
  114. package/cli/dist/managers/ConfigManager.d.ts +0 -53
  115. package/cli/dist/managers/ConfigManager.js +0 -173
  116. package/cli/dist/types.d.ts +0 -31
  117. package/cli/dist/types.js +0 -19
package/cli/readme.md ADDED
@@ -0,0 +1,181 @@
1
+ # Hedera Conversational Agent CLI
2
+
3
+ A beautiful command-line interface for the Hedera Conversational Agent, built with [Ink](https://github.com/vadimdemedes/ink) and styled following Hashgraph Online design patterns.
4
+
5
+ ## Features
6
+
7
+ - 🎨 **Beautiful Terminal UI** - Styled with HCS improvement proposals design patterns
8
+ - 💬 **Interactive Chat** - Chat with your Hedera agent in a clean terminal interface
9
+ - 🔐 **Secure Configuration** - Masked input for sensitive credentials
10
+ - 🌈 **Gradient Text & Colors** - Brand-consistent color scheme
11
+ - 🚀 **Fast & Responsive** - Built with React for smooth interactions
12
+ - 📊 **Transaction Details** - See transaction IDs and network responses
13
+ - 🎯 **HCS-10 Support** - Full support for agent connections and messaging
14
+ - 🔧 **MCP Integration** - Configure Model Context Protocol servers for extended capabilities
15
+ - 📁 **File Operations** - Built-in filesystem MCP server for file management
16
+ - ⚙️ **Custom MCP Servers** - Add your own MCP servers for specialized tools
17
+
18
+ ## Installation
19
+
20
+ For local development, the CLI uses the actual ConversationalAgent from the parent package:
21
+
22
+ ```bash
23
+ # 1. Build the parent package first
24
+ cd /path/to/conversational-agent
25
+ pnpm install
26
+ pnpm build
27
+
28
+ # 2. The CLI will be built automatically via postinstall hook
29
+ # Or build manually:
30
+ cd cli
31
+ pnpm install
32
+ pnpm build
33
+ ```
34
+
35
+ ## Usage
36
+
37
+ ### Interactive Mode (Recommended)
38
+
39
+ ```bash
40
+ # From the parent conversational-agent directory
41
+ pnpm cli
42
+
43
+ # This automatically builds if needed and runs the CLI
44
+ ```
45
+
46
+ ### With Command Line Arguments
47
+
48
+ ```bash
49
+ conversational-agent \
50
+ --account-id=0.0.12345 \
51
+ --private-key=your-private-key \
52
+ --network=testnet \
53
+ --openai-api-key=sk-...
54
+ ```
55
+
56
+ ### Using Environment Variables
57
+
58
+ The CLI automatically loads configuration from `.env` in the conversational-agent root:
59
+
60
+ ```bash
61
+ # .env file in conversational-agent directory
62
+ HEDERA_ACCOUNT_ID=0.0.12345
63
+ HEDERA_PRIVATE_KEY=your-private-key
64
+ HEDERA_NETWORK=testnet
65
+ OPENAI_API_KEY=sk-...
66
+ MCP_SERVERS=[{"name":"filesystem","command":"npx","args":["-y","@modelcontextprotocol/server-filesystem","/tmp"]}]
67
+ ```
68
+
69
+ Then simply run: `pnpm cli`
70
+
71
+ ## Interface Overview
72
+
73
+ ### Welcome Screen
74
+ - Beautiful ASCII art logo with gradient colors
75
+ - Simple menu navigation with arrow keys
76
+ - Options: Start Chat, Configure, MCP Servers, Exit
77
+
78
+ ### Configuration Screen
79
+ - Terminal-style window with macOS-like controls
80
+ - Secure input masking for sensitive data
81
+ - Tab navigation between fields
82
+ - Real-time validation
83
+
84
+ ### MCP Servers Screen
85
+ - Configure Model Context Protocol servers
86
+ - Enable/disable filesystem server with custom path
87
+ - Add custom MCP servers with command and arguments
88
+ - Live preview of available tools
89
+ - Save configuration to environment
90
+
91
+ ### Chat Interface
92
+ - Clean terminal aesthetic with prompt symbols
93
+ - Color-coded messages (user, assistant, system)
94
+ - Loading indicators with spinners
95
+ - Transaction ID display
96
+ - MCP server status and available tools
97
+ - Escape key to return to menu
98
+
99
+ ## Design Features
100
+
101
+ The CLI follows Hashgraph Online's design system:
102
+
103
+ - **Brand Colors**: Primary blue (#5599fe), Green (#48df7b), Purple (#b56cff)
104
+ - **Hedera Colors**: Purple (#8259ef), Blue (#2d84eb), Green (#3ec878)
105
+ - **Terminal Window**: Rounded borders with window control dots
106
+ - **Status Badges**: Color-coded status indicators
107
+ - **Typography**: Monospace throughout with clear hierarchy
108
+
109
+ ## Keyboard Shortcuts
110
+
111
+ - `↑/↓` - Navigate menus
112
+ - `Enter` - Select/Submit
113
+ - `Tab` - Next field (in configuration)
114
+ - `Escape` - Return to main menu (from chat)
115
+ - `Ctrl+C` - Exit application
116
+
117
+ ## Development
118
+
119
+ ```bash
120
+ # Watch mode for development
121
+ pnpm dev
122
+
123
+ # Run tests
124
+ pnpm test
125
+
126
+ # Build for production
127
+ pnpm build
128
+ ```
129
+
130
+ ## Examples
131
+
132
+ ### Basic Chat Interaction
133
+
134
+ ```
135
+ $ Find all AI agents on the network
136
+ → I'll search for AI agents registered on the Hedera network...
137
+
138
+ [INFO] Found 5 agents with AI capabilities
139
+ → Here are the AI agents I found:
140
+ 1. Agent: 0.0.12345 - "GPT Assistant"
141
+ 2. Agent: 0.0.23456 - "Code Helper"
142
+ ...
143
+
144
+ $ Connect to agent 0.0.12345
145
+ → Initiating connection to agent 0.0.12345...
146
+ [INFO] Transaction ID: 0.0.98765@1234567890.123
147
+ → Successfully connected! You can now send messages to this agent.
148
+ ```
149
+
150
+ ### MCP File Operations
151
+
152
+ With filesystem MCP server enabled:
153
+
154
+ ```
155
+ $ Create a new file called notes.txt with my meeting notes
156
+ → I'll create a notes.txt file for you with meeting notes...
157
+
158
+ [INFO] MCP servers enabled: filesystem
159
+ → I've created notes.txt in your configured directory with the meeting notes.
160
+
161
+ $ List all files in the current directory
162
+ → Here are the files in /tmp:
163
+ - notes.txt (created just now)
164
+ - data.json
165
+ - config.yaml
166
+ ```
167
+
168
+ ### Custom MCP Server
169
+
170
+ ```
171
+ $ Add GitHub repository operations
172
+ → I can help you interact with GitHub repositories...
173
+
174
+ [INFO] MCP servers enabled: filesystem, github
175
+ → I now have access to GitHub operations. I can help you create issues,
176
+ manage repositories, and work with pull requests.
177
+ ```
178
+
179
+ ## License
180
+
181
+ Apache-2.0
@@ -1,4 +1,4 @@
1
- import { BasePlugin, AgentOperationalMode, MirrorNodeConfig } from 'hedera-agent-kit';
1
+ import { BasePlugin, AbstractSigner, AgentOperationalMode, MirrorNodeConfig } from 'hedera-agent-kit';
2
2
  import { Logger, NetworkType } from '@hashgraphonline/standards-sdk';
3
3
  import { createAgent } from './agent-factory';
4
4
  import { ChatResponse } from './base-agent';
@@ -45,6 +45,15 @@ export interface ConversationalAgentOptions {
45
45
  namespace?: string;
46
46
  }) => boolean;
47
47
  mcpServers?: MCPServerConfig[];
48
+ walletExecutor?: (base64: string, network: 'mainnet' | 'testnet') => Promise<{
49
+ transactionId: string;
50
+ }>;
51
+ /** Optional: provide a signer factory to override default signer selection */
52
+ customSignerFactory?: (args: {
53
+ operationalMode: AgentOperationalMode;
54
+ accountId: string;
55
+ network: NetworkType;
56
+ }) => AbstractSigner;
48
57
  /** Enable automatic entity memory functionality (default: true) */
49
58
  entityMemoryEnabled?: boolean;
50
59
  /** Configuration for entity memory system */
@@ -143,7 +152,7 @@ export declare class ConversationalAgent {
143
152
  /**
144
153
  * Creates the agent configuration object.
145
154
  *
146
- * @param serverSigner - The server signer instance
155
+ * @param signer - The signer instance
147
156
  * @param llm - The language model instance
148
157
  * @param allPlugins - Array of plugins to use
149
158
  * @returns Configuration object for creating the agent
@@ -2,6 +2,7 @@ import { StructuredTool } from '@langchain/core/tools';
2
2
  import { z } from 'zod';
3
3
  import { Logger } from '@hashgraphonline/standards-sdk';
4
4
  import { FormValidatingToolWrapper } from '../langchain/form-validating-tool-wrapper';
5
+ import { ToolFieldConfiguration as FG_ToolFieldConfiguration, FieldGuidanceProvider as FG_FieldGuidanceProvider } from '../forms/field-guidance-registry';
5
6
 
6
7
  /**
7
8
  * Tool capabilities configuration for registry entries
@@ -33,6 +34,8 @@ export interface ToolMetadata {
33
34
  dependencies: string[];
34
35
  schema: unknown;
35
36
  entityResolutionPreferences?: EntityResolutionPreferences;
37
+ fieldGuidance?: FG_ToolFieldConfiguration;
38
+ fieldGuidanceProvider?: FG_FieldGuidanceProvider;
36
39
  }
37
40
  /**
38
41
  * Registry entry containing tool instance and metadata
@@ -79,10 +79,29 @@ export interface ToolFieldConfiguration {
79
79
  */
80
80
  declare class FieldGuidanceRegistry {
81
81
  private configurations;
82
+ private providers;
83
+ private registerOrderCounter;
84
+ private logger;
85
+ constructor();
82
86
  /**
83
87
  * Register field guidance for a specific tool
84
88
  */
85
89
  registerToolConfiguration(config: ToolFieldConfiguration): void;
90
+ /**
91
+ * Register a provider for dynamic field/global guidance
92
+ */
93
+ registerToolProvider(toolPattern: string | RegExp, provider: FieldGuidanceProvider, options?: {
94
+ id?: string;
95
+ priority?: number;
96
+ }): string;
97
+ /** Unregister a provider by id */
98
+ unregisterProvider(id: string): void;
99
+ /** List registered providers */
100
+ listProviders(): Array<{
101
+ id: string;
102
+ priority: number;
103
+ pattern: string | RegExp;
104
+ }>;
86
105
  /**
87
106
  * Get field guidance for a specific tool and field
88
107
  */
@@ -103,6 +122,20 @@ declare class FieldGuidanceRegistry {
103
122
  * Clear all configurations (useful for testing)
104
123
  */
105
124
  clear(): void;
125
+ /** Choose matching provider by priority then last-in wins */
126
+ private pickMatchingProviders;
127
+ private safeGetFieldGuidance;
128
+ private safeGetGlobalGuidance;
129
+ private mergeGuidance;
106
130
  }
107
131
  export declare const fieldGuidanceRegistry: FieldGuidanceRegistry;
132
+ /**
133
+ * Provider interface (optional, for dynamic guidance)
134
+ */
135
+ export interface FieldGuidanceProvider {
136
+ getFieldGuidance(fieldName: string, ctx: {
137
+ toolName: string;
138
+ }): FieldGuidance | null;
139
+ getGlobalGuidance?(toolName: string): ToolFieldConfiguration['globalGuidance'] | null;
140
+ }
108
141
  export {};