@hashgraphonline/conversational-agent 0.1.214 → 0.1.217

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 (170) hide show
  1. package/cli/dist/CLIApp.d.ts +9 -0
  2. package/cli/dist/CLIApp.js +127 -0
  3. package/cli/dist/LocalConversationalAgent.d.ts +37 -0
  4. package/cli/dist/LocalConversationalAgent.js +58 -0
  5. package/cli/dist/app.d.ts +16 -0
  6. package/cli/dist/app.js +13 -0
  7. package/cli/dist/cli.d.ts +2 -0
  8. package/cli/dist/cli.js +51 -0
  9. package/cli/dist/components/AppContainer.d.ts +16 -0
  10. package/cli/dist/components/AppContainer.js +24 -0
  11. package/cli/dist/components/AppScreens.d.ts +2 -0
  12. package/cli/dist/components/AppScreens.js +259 -0
  13. package/cli/dist/components/ChatScreen.d.ts +15 -0
  14. package/cli/dist/components/ChatScreen.js +39 -0
  15. package/cli/dist/components/DebugLoadingScreen.d.ts +5 -0
  16. package/cli/dist/components/DebugLoadingScreen.js +31 -0
  17. package/cli/dist/components/LoadingScreen.d.ts +2 -0
  18. package/cli/dist/components/LoadingScreen.js +16 -0
  19. package/cli/dist/components/LoadingScreenDebug.d.ts +5 -0
  20. package/cli/dist/components/LoadingScreenDebug.js +27 -0
  21. package/cli/dist/components/MCPConfigScreen.d.ts +28 -0
  22. package/cli/dist/components/MCPConfigScreen.js +168 -0
  23. package/cli/dist/components/ScreenRouter.d.ts +12 -0
  24. package/cli/dist/components/ScreenRouter.js +22 -0
  25. package/cli/dist/components/SetupScreen.d.ts +15 -0
  26. package/cli/dist/components/SetupScreen.js +65 -0
  27. package/cli/dist/components/SingleLoadingScreen.d.ts +5 -0
  28. package/cli/dist/components/SingleLoadingScreen.js +27 -0
  29. package/cli/dist/components/StatusBadge.d.ts +7 -0
  30. package/cli/dist/components/StatusBadge.js +28 -0
  31. package/cli/dist/components/TerminalWindow.d.ts +8 -0
  32. package/cli/dist/components/TerminalWindow.js +24 -0
  33. package/cli/dist/components/WelcomeScreen.d.ts +11 -0
  34. package/cli/dist/components/WelcomeScreen.js +47 -0
  35. package/cli/dist/context/AppContext.d.ts +68 -0
  36. package/cli/dist/context/AppContext.js +363 -0
  37. package/cli/dist/hooks/useInitializeAgent.d.ts +19 -0
  38. package/cli/dist/hooks/useInitializeAgent.js +28 -0
  39. package/cli/dist/hooks/useStableState.d.ts +38 -0
  40. package/cli/dist/hooks/useStableState.js +68 -0
  41. package/cli/dist/managers/AgentManager.d.ts +57 -0
  42. package/cli/dist/managers/AgentManager.js +119 -0
  43. package/cli/dist/managers/ConfigManager.d.ts +53 -0
  44. package/cli/dist/managers/ConfigManager.js +173 -0
  45. package/cli/dist/types.d.ts +31 -0
  46. package/cli/dist/types.js +19 -0
  47. package/dist/cjs/base-agent.d.ts +2 -0
  48. package/dist/cjs/conversational-agent.d.ts +8 -0
  49. package/dist/cjs/core/ToolRegistry.d.ts +130 -0
  50. package/dist/cjs/execution/ExecutionPipeline.d.ts +81 -0
  51. package/dist/cjs/forms/FormEngine.d.ts +121 -0
  52. package/dist/cjs/forms/field-type-registry.d.ts +51 -0
  53. package/dist/cjs/forms/form-generator.d.ts +123 -0
  54. package/dist/cjs/forms/index.d.ts +2 -0
  55. package/dist/cjs/forms/types.d.ts +108 -0
  56. package/dist/cjs/index.cjs +1 -1
  57. package/dist/cjs/index.cjs.map +1 -1
  58. package/dist/cjs/index.d.ts +5 -0
  59. package/dist/cjs/langchain/FormAwareAgentExecutor.d.ts +108 -0
  60. package/dist/cjs/langchain/FormValidatingToolWrapper.d.ts +81 -0
  61. package/dist/cjs/langchain-agent.d.ts +65 -0
  62. package/dist/cjs/memory/ContentStorage.d.ts +7 -0
  63. package/dist/cjs/memory/SmartMemoryManager.d.ts +1 -0
  64. package/dist/cjs/services/ContentStoreManager.d.ts +11 -1
  65. package/dist/cjs/utils/ResponseFormatter.d.ts +26 -0
  66. package/dist/esm/index.js +8 -1
  67. package/dist/esm/index.js.map +1 -1
  68. package/dist/esm/index12.js +1 -1
  69. package/dist/esm/index12.js.map +1 -1
  70. package/dist/esm/index14.js +23 -5
  71. package/dist/esm/index14.js.map +1 -1
  72. package/dist/esm/index15.js +25 -4
  73. package/dist/esm/index15.js.map +1 -1
  74. package/dist/esm/index16.js +4 -2
  75. package/dist/esm/index16.js.map +1 -1
  76. package/dist/esm/index17.js +2 -7
  77. package/dist/esm/index17.js.map +1 -1
  78. package/dist/esm/index18.js +609 -36
  79. package/dist/esm/index18.js.map +1 -1
  80. package/dist/esm/index19.js +229 -84
  81. package/dist/esm/index19.js.map +1 -1
  82. package/dist/esm/index20.js +111 -17
  83. package/dist/esm/index20.js.map +1 -1
  84. package/dist/esm/index21.js +44 -7
  85. package/dist/esm/index21.js.map +1 -1
  86. package/dist/esm/index22.js +86 -157
  87. package/dist/esm/index22.js.map +1 -1
  88. package/dist/esm/index23.js +32 -150
  89. package/dist/esm/index23.js.map +1 -1
  90. package/dist/esm/index24.js +746 -80
  91. package/dist/esm/index24.js.map +1 -1
  92. package/dist/esm/index25.js +154 -45
  93. package/dist/esm/index25.js.map +1 -1
  94. package/dist/esm/index26.js +149 -24
  95. package/dist/esm/index26.js.map +1 -1
  96. package/dist/esm/index27.js +196 -217
  97. package/dist/esm/index27.js.map +1 -1
  98. package/dist/esm/index28.js +187 -0
  99. package/dist/esm/index28.js.map +1 -0
  100. package/dist/esm/index29.js +308 -0
  101. package/dist/esm/index29.js.map +1 -0
  102. package/dist/esm/index30.js +159 -0
  103. package/dist/esm/index30.js.map +1 -0
  104. package/dist/esm/index31.js +68 -0
  105. package/dist/esm/index31.js.map +1 -0
  106. package/dist/esm/index32.js +30 -0
  107. package/dist/esm/index32.js.map +1 -0
  108. package/dist/esm/index33.js +95 -0
  109. package/dist/esm/index33.js.map +1 -0
  110. package/dist/esm/index34.js +245 -0
  111. package/dist/esm/index34.js.map +1 -0
  112. package/dist/esm/index5.js +2 -2
  113. package/dist/esm/index5.js.map +1 -1
  114. package/dist/esm/index6.js +68 -25
  115. package/dist/esm/index6.js.map +1 -1
  116. package/dist/esm/index7.js.map +1 -1
  117. package/dist/esm/index8.js +744 -70
  118. package/dist/esm/index8.js.map +1 -1
  119. package/dist/types/base-agent.d.ts +2 -0
  120. package/dist/types/conversational-agent.d.ts +8 -0
  121. package/dist/types/core/ToolRegistry.d.ts +130 -0
  122. package/dist/types/execution/ExecutionPipeline.d.ts +81 -0
  123. package/dist/types/forms/FormEngine.d.ts +121 -0
  124. package/dist/types/forms/field-type-registry.d.ts +51 -0
  125. package/dist/types/forms/form-generator.d.ts +123 -0
  126. package/dist/types/forms/index.d.ts +2 -0
  127. package/dist/types/forms/types.d.ts +108 -0
  128. package/dist/types/index.d.ts +5 -0
  129. package/dist/types/langchain/FormAwareAgentExecutor.d.ts +108 -0
  130. package/dist/types/langchain/FormValidatingToolWrapper.d.ts +81 -0
  131. package/dist/types/langchain-agent.d.ts +65 -0
  132. package/dist/types/memory/ContentStorage.d.ts +7 -0
  133. package/dist/types/memory/SmartMemoryManager.d.ts +1 -0
  134. package/dist/types/services/ContentStoreManager.d.ts +11 -1
  135. package/dist/types/utils/ResponseFormatter.d.ts +26 -0
  136. package/package.json +35 -34
  137. package/src/base-agent.ts +2 -0
  138. package/src/config/system-message.ts +14 -0
  139. package/src/context/ReferenceContextManager.ts +1 -1
  140. package/src/conversational-agent.ts +95 -38
  141. package/src/core/ToolRegistry.ts +358 -0
  142. package/src/execution/ExecutionPipeline.ts +301 -0
  143. package/src/forms/FormEngine.ts +443 -0
  144. package/src/forms/field-type-registry.ts +203 -0
  145. package/src/forms/form-generator.ts +841 -0
  146. package/src/forms/index.ts +2 -0
  147. package/src/forms/types.ts +125 -0
  148. package/src/index.ts +9 -0
  149. package/src/langchain/FormAwareAgentExecutor.ts +971 -0
  150. package/src/langchain/FormValidatingToolWrapper.ts +355 -0
  151. package/src/langchain-agent.ts +1034 -87
  152. package/src/mcp/ContentProcessor.ts +20 -4
  153. package/src/mcp/MCPClientManager.ts +1 -1
  154. package/src/mcp/adapters/langchain.ts +1 -1
  155. package/src/memory/ContentStorage.ts +25 -5
  156. package/src/memory/SmartMemoryManager.ts +27 -4
  157. package/src/memory/TokenCounter.ts +1 -1
  158. package/src/plugins/hbar/HbarPlugin.ts +0 -1
  159. package/src/scripts/test-external-tool-wrapper.ts +103 -0
  160. package/src/scripts/test-hedera-kit-wrapper.ts +265 -0
  161. package/src/scripts/test-inscribe-form-generation.ts +494 -0
  162. package/src/scripts/test-inscribe-wrapper-verification.ts +220 -0
  163. package/src/services/ContentStoreManager.ts +23 -9
  164. package/src/services/EntityResolver.ts +2 -9
  165. package/src/tools/EntityResolverTool.ts +5 -8
  166. package/src/utils/ResponseFormatter.ts +146 -0
  167. package/cli/readme.md +0 -181
  168. package/dist/cjs/langchain/ContentAwareAgentExecutor.d.ts +0 -14
  169. package/dist/types/langchain/ContentAwareAgentExecutor.d.ts +0 -14
  170. package/src/langchain/ContentAwareAgentExecutor.ts +0 -19
@@ -0,0 +1,119 @@
1
+ import { ConversationalAgent, MCPServers, } from '@hashgraphonline/conversational-agent';
2
+ export class AgentManager {
3
+ static instance;
4
+ agent = null;
5
+ initializing = false;
6
+ initialized = false;
7
+ constructor() { }
8
+ static getInstance() {
9
+ if (!AgentManager.instance) {
10
+ AgentManager.instance = new AgentManager();
11
+ }
12
+ return AgentManager.instance;
13
+ }
14
+ /**
15
+ * Initialize the conversational agent
16
+ */
17
+ async initialize(config, mcpConfig) {
18
+ if (this.agent && this.initialized) {
19
+ return {
20
+ agent: this.agent,
21
+ welcomeMessages: this.getWelcomeMessages(config, []),
22
+ };
23
+ }
24
+ if (this.initializing) {
25
+ throw new Error('Agent is already initializing');
26
+ }
27
+ this.initializing = true;
28
+ try {
29
+ const mcpServers = [];
30
+ if (mcpConfig.enableFilesystem && mcpConfig.filesystemPath) {
31
+ mcpServers.push(MCPServers.filesystem(mcpConfig.filesystemPath));
32
+ }
33
+ mcpServers.push(...mcpConfig.customServers);
34
+ const agentConfig = {
35
+ accountId: config.accountId,
36
+ privateKey: config.privateKey,
37
+ network: config.network,
38
+ openAIApiKey: config.openAIApiKey,
39
+ openAIModelName: 'gpt-4o-mini',
40
+ verbose: false,
41
+ disableLogging: true,
42
+ ...(mcpServers.length > 0 && { mcpServers }),
43
+ };
44
+ const conversationalAgent = new ConversationalAgent(agentConfig);
45
+ await conversationalAgent.initialize();
46
+ this.agent = conversationalAgent;
47
+ this.initialized = true;
48
+ const welcomeMessages = this.getWelcomeMessages(config, mcpServers);
49
+ return { agent: conversationalAgent, welcomeMessages };
50
+ }
51
+ finally {
52
+ this.initializing = false;
53
+ }
54
+ }
55
+ /**
56
+ * Get welcome messages
57
+ */
58
+ getWelcomeMessages(config, mcpServers) {
59
+ const welcomeMessages = [
60
+ {
61
+ role: 'system',
62
+ content: `Connected to Hedera ${config.network}`,
63
+ timestamp: new Date(),
64
+ },
65
+ ];
66
+ if (mcpServers.length > 0) {
67
+ welcomeMessages.push({
68
+ role: 'system',
69
+ content: `MCP servers enabled: ${mcpServers
70
+ .map(s => s.name)
71
+ .join(', ')}`,
72
+ timestamp: new Date(),
73
+ });
74
+ }
75
+ welcomeMessages.push({
76
+ role: 'assistant',
77
+ content: mcpServers.length > 0
78
+ ? "Hello! I'm your Conversational Agent powered by Hashgraph Online, with extended MCP capabilities. I can help you with:\n\n• HCS-10 agent registrations and HCS-11 profiles\n• Sending messages through HCS standards\n• Creating accounts, transferring HBAR, and managing tokens\n• Deploying smart contracts and interacting with them\n• Managing NFTs, token swaps, and staking operations\n• Scheduling transactions and consensus submissions\n• File operations and external tool integration\n\nHow can I assist you today?"
79
+ : "Hello! I'm your Conversational Agent powered by Hashgraph Online. I can help you with:\n\n• HCS-10 agent registrations and HCS-11 profiles\n• Sending messages through HCS standards\n• Creating accounts, transferring HBAR, and managing tokens\n• Deploying smart contracts and interacting with them\n• Managing NFTs, token swaps, and staking operations\n• Scheduling transactions and consensus submissions\n\nHow can I assist you today?",
80
+ timestamp: new Date(),
81
+ });
82
+ return welcomeMessages;
83
+ }
84
+ /**
85
+ * Send message to agent
86
+ */
87
+ async sendMessage(message, chatHistory) {
88
+ if (!this.agent) {
89
+ throw new Error('Agent not initialized');
90
+ }
91
+ return this.agent.processMessage(message, chatHistory);
92
+ }
93
+ /**
94
+ * Get current agent
95
+ */
96
+ getAgent() {
97
+ return this.agent;
98
+ }
99
+ /**
100
+ * Check if agent is initialized
101
+ */
102
+ isInitialized() {
103
+ return this.initialized;
104
+ }
105
+ /**
106
+ * Check if agent is initializing
107
+ */
108
+ isInitializing() {
109
+ return this.initializing;
110
+ }
111
+ /**
112
+ * Reset agent (for testing)
113
+ */
114
+ reset() {
115
+ this.agent = null;
116
+ this.initialized = false;
117
+ this.initializing = false;
118
+ }
119
+ }
@@ -0,0 +1,53 @@
1
+ import { type MCPServerConfig } from '@hashgraphonline/conversational-agent';
2
+ import { type Config } from '../types';
3
+ export declare class ConfigManager {
4
+ private static instance;
5
+ private _config;
6
+ private _mcpServers;
7
+ private constructor();
8
+ static getInstance(): ConfigManager;
9
+ /**
10
+ * Get MCP config file path
11
+ */
12
+ private getMCPConfigPath;
13
+ /**
14
+ * Load MCP configuration from file
15
+ */
16
+ private loadMCPConfig;
17
+ /**
18
+ * Save MCP configuration to file
19
+ */
20
+ saveMCPConfig(servers: MCPServerConfig[]): void;
21
+ /**
22
+ * Load config from .env file
23
+ */
24
+ private loadConfigFromEnv;
25
+ /**
26
+ * Save config to .env file
27
+ */
28
+ saveConfig(configToSave: Config): void;
29
+ /**
30
+ * Get complete config (cached)
31
+ */
32
+ getConfig(props?: Partial<Config>): Config & {
33
+ mcpServers: MCPServerConfig[];
34
+ };
35
+ /**
36
+ * Update config and save
37
+ */
38
+ updateConfig(updates: Partial<Config>): Config & {
39
+ mcpServers: MCPServerConfig[];
40
+ };
41
+ /**
42
+ * Get MCP servers
43
+ */
44
+ getMCPServers(): MCPServerConfig[];
45
+ /**
46
+ * Get MCP config path for display
47
+ */
48
+ getMCPConfigPathForDisplay(): string;
49
+ /**
50
+ * Reset cache (for testing)
51
+ */
52
+ resetCache(): void;
53
+ }
@@ -0,0 +1,173 @@
1
+ import fs from 'fs';
2
+ import path from 'path';
3
+ import { MCPServers } from '@hashgraphonline/conversational-agent';
4
+ export class ConfigManager {
5
+ static instance;
6
+ _config = null;
7
+ _mcpServers = null;
8
+ constructor() { }
9
+ static getInstance() {
10
+ if (!ConfigManager.instance) {
11
+ ConfigManager.instance = new ConfigManager();
12
+ }
13
+ return ConfigManager.instance;
14
+ }
15
+ /**
16
+ * Get MCP config file path
17
+ */
18
+ getMCPConfigPath() {
19
+ const projectRoot = process.env['CONVERSATIONAL_AGENT_ROOT'] || path.resolve('./../../');
20
+ return path.join(projectRoot, 'mcp-config.json');
21
+ }
22
+ /**
23
+ * Load MCP configuration from file
24
+ */
25
+ loadMCPConfig() {
26
+ if (this._mcpServers)
27
+ return this._mcpServers;
28
+ const configPath = this.getMCPConfigPath();
29
+ try {
30
+ if (fs.existsSync(configPath)) {
31
+ const configContent = fs.readFileSync(configPath, 'utf-8');
32
+ const config = JSON.parse(configContent);
33
+ this._mcpServers = Object.values(config.mcpServers || {});
34
+ return this._mcpServers;
35
+ }
36
+ }
37
+ catch (err) {
38
+ console.error('Failed to load MCP config:', err);
39
+ }
40
+ const defaultServers = [MCPServers.filesystem(process.cwd())];
41
+ this.saveMCPConfig(defaultServers);
42
+ this._mcpServers = defaultServers;
43
+ return defaultServers;
44
+ }
45
+ /**
46
+ * Save MCP configuration to file
47
+ */
48
+ saveMCPConfig(servers) {
49
+ const configPath = this.getMCPConfigPath();
50
+ try {
51
+ const mcpServers = {};
52
+ servers.forEach(server => {
53
+ mcpServers[server.name] = server;
54
+ });
55
+ const config = { mcpServers };
56
+ fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
57
+ this._mcpServers = servers;
58
+ }
59
+ catch (err) {
60
+ console.error('Failed to save MCP config:', err);
61
+ }
62
+ }
63
+ /**
64
+ * Load config from .env file
65
+ */
66
+ loadConfigFromEnv() {
67
+ const projectRoot = process.env['CONVERSATIONAL_AGENT_ROOT'] || path.resolve('./../../');
68
+ const envPath = path.join(projectRoot, '.env');
69
+ try {
70
+ if (fs.existsSync(envPath)) {
71
+ const envContent = fs.readFileSync(envPath, 'utf-8');
72
+ const envVars = {};
73
+ envContent.split('\n').forEach(line => {
74
+ const trimmedLine = line.trim();
75
+ if (trimmedLine && !trimmedLine.startsWith('#')) {
76
+ const [key, ...valueParts] = trimmedLine.split('=');
77
+ if (key && valueParts.length > 0) {
78
+ envVars[key] = valueParts.join('=');
79
+ }
80
+ }
81
+ });
82
+ return {
83
+ accountId: envVars['HEDERA_ACCOUNT_ID'] || '',
84
+ privateKey: envVars['HEDERA_PRIVATE_KEY'] || '',
85
+ network: envVars['HEDERA_NETWORK'] || 'testnet',
86
+ openAIApiKey: envVars['OPENAI_API_KEY'] || '',
87
+ };
88
+ }
89
+ }
90
+ catch (err) { }
91
+ return {
92
+ accountId: '',
93
+ privateKey: '',
94
+ network: 'testnet',
95
+ openAIApiKey: '',
96
+ };
97
+ }
98
+ /**
99
+ * Save config to .env file
100
+ */
101
+ saveConfig(configToSave) {
102
+ const projectRoot = process.env['CONVERSATIONAL_AGENT_ROOT'] || path.resolve('./../../');
103
+ const envPath = path.join(projectRoot, '.env');
104
+ try {
105
+ let envContent = '';
106
+ if (fs.existsSync(envPath)) {
107
+ envContent = fs.readFileSync(envPath, 'utf-8');
108
+ }
109
+ const updateEnvVar = (key, value) => {
110
+ const regex = new RegExp(`^${key}=.*$`, 'gm');
111
+ if (regex.test(envContent)) {
112
+ envContent = envContent.replace(regex, `${key}=${value}`);
113
+ }
114
+ else {
115
+ envContent += `${envContent ? '\n' : ''}${key}=${value}`;
116
+ }
117
+ };
118
+ updateEnvVar('HEDERA_ACCOUNT_ID', configToSave.accountId);
119
+ updateEnvVar('HEDERA_PRIVATE_KEY', configToSave.privateKey);
120
+ updateEnvVar('HEDERA_NETWORK', configToSave.network);
121
+ updateEnvVar('OPENAI_API_KEY', configToSave.openAIApiKey);
122
+ fs.writeFileSync(envPath, envContent);
123
+ this._config = null;
124
+ }
125
+ catch (err) { }
126
+ }
127
+ /**
128
+ * Get complete config (cached)
129
+ */
130
+ getConfig(props = {}) {
131
+ if (!this._config) {
132
+ const envConfig = this.loadConfigFromEnv();
133
+ const mcpServers = this.loadMCPConfig();
134
+ this._config = {
135
+ accountId: props.accountId || envConfig.accountId,
136
+ privateKey: props.privateKey || envConfig.privateKey,
137
+ network: props.network || envConfig.network,
138
+ openAIApiKey: props.openAIApiKey || envConfig.openAIApiKey,
139
+ mcpServers,
140
+ };
141
+ }
142
+ return this._config;
143
+ }
144
+ /**
145
+ * Update config and save
146
+ */
147
+ updateConfig(updates) {
148
+ const current = this.getConfig();
149
+ const updated = { ...current, ...updates };
150
+ this.saveConfig(updated);
151
+ this._config = updated;
152
+ return updated;
153
+ }
154
+ /**
155
+ * Get MCP servers
156
+ */
157
+ getMCPServers() {
158
+ return this.loadMCPConfig();
159
+ }
160
+ /**
161
+ * Get MCP config path for display
162
+ */
163
+ getMCPConfigPathForDisplay() {
164
+ return this.getMCPConfigPath();
165
+ }
166
+ /**
167
+ * Reset cache (for testing)
168
+ */
169
+ resetCache() {
170
+ this._config = null;
171
+ this._mcpServers = null;
172
+ }
173
+ }
@@ -0,0 +1,31 @@
1
+ export type Screen = 'welcome' | 'setup' | 'mcp-config' | 'chat' | 'loading';
2
+ export interface Message {
3
+ role: 'user' | 'assistant' | 'system';
4
+ content: string;
5
+ timestamp: Date;
6
+ }
7
+ export interface Config {
8
+ accountId: string;
9
+ privateKey: string;
10
+ network: string;
11
+ openAIApiKey: string;
12
+ }
13
+ export declare const BRAND_COLORS: {
14
+ blue: string;
15
+ green: string;
16
+ purple: string;
17
+ dark: string;
18
+ white: string;
19
+ hedera: {
20
+ purple: string;
21
+ blue: string;
22
+ green: string;
23
+ charcoal: string;
24
+ smoke: string;
25
+ };
26
+ keywords: string;
27
+ functions: string;
28
+ strings: string;
29
+ variables: string;
30
+ comments: string;
31
+ };
@@ -0,0 +1,19 @@
1
+ export const BRAND_COLORS = {
2
+ blue: '#5599fe',
3
+ green: '#48df7b',
4
+ purple: '#b56cff',
5
+ dark: '#3f4174',
6
+ white: '#ffffff',
7
+ hedera: {
8
+ purple: '#8259ef',
9
+ blue: '#2d84eb',
10
+ green: '#3ec878',
11
+ charcoal: '#464646',
12
+ smoke: '#8c8c8c',
13
+ },
14
+ keywords: '#3f4174',
15
+ functions: '#5599fe',
16
+ strings: '#48df7b',
17
+ variables: '#b56cff',
18
+ comments: '#6b7280',
19
+ };
@@ -73,6 +73,8 @@ export interface ChatResponse {
73
73
  args: Record<string, unknown>;
74
74
  output?: string;
75
75
  }>;
76
+ formMessage?: unknown;
77
+ requiresForm?: boolean;
76
78
  [key: string]: unknown;
77
79
  }
78
80
  export interface UsageStats extends TokenUsage {
@@ -10,6 +10,7 @@ import { IStateManager } from '@hashgraphonline/standards-agent-kit';
10
10
  import { MCPServerConfig, MCPConnectionStatus } from './mcp/types';
11
11
  import { ContentStoreManager } from './services/ContentStoreManager';
12
12
  import { SmartMemoryManager, SmartMemoryConfig } from './memory';
13
+ import { FormSubmission } from './forms/types';
13
14
 
14
15
  export type ToolDescriptor = {
15
16
  name: string;
@@ -107,6 +108,13 @@ export declare class ConversationalAgent {
107
108
  * @throws {Error} If agent is not initialized
108
109
  */
109
110
  processMessage(message: string, chatHistory?: ChatHistoryItem[]): Promise<ChatResponse>;
111
+ /**
112
+ * Process form submission through the conversational agent
113
+ * @param {FormSubmission} submission - The form submission data
114
+ * @returns {Promise<ChatResponse>} The agent's response after processing the form
115
+ * @throws {Error} If agent is not initialized or doesn't support form processing
116
+ */
117
+ processFormSubmission(submission: FormSubmission): Promise<ChatResponse>;
110
118
  /**
111
119
  * Validates initialization options and throws if required fields are missing.
112
120
  *
@@ -0,0 +1,130 @@
1
+ import { StructuredTool } from '@langchain/core/tools';
2
+ import { z } from 'zod';
3
+ import { Logger } from '@hashgraphonline/standards-sdk';
4
+ import { FormValidatingToolWrapper } from '../langchain/FormValidatingToolWrapper';
5
+
6
+ /**
7
+ * Tool capabilities configuration for registry entries
8
+ */
9
+ export interface ToolCapabilities {
10
+ supportsFormValidation: boolean;
11
+ requiresWrapper: boolean;
12
+ priority: 'low' | 'medium' | 'high' | 'critical';
13
+ category: 'core' | 'extension' | 'mcp';
14
+ }
15
+ /**
16
+ * Tool metadata for comprehensive tool information
17
+ */
18
+ export interface ToolMetadata {
19
+ name: string;
20
+ version: string;
21
+ category: ToolCapabilities['category'];
22
+ description: string;
23
+ capabilities: ToolCapabilities;
24
+ dependencies: string[];
25
+ schema: unknown;
26
+ }
27
+ /**
28
+ * Registry entry containing tool instance and metadata
29
+ */
30
+ export interface ToolRegistryEntry {
31
+ tool: StructuredTool;
32
+ metadata: ToolMetadata;
33
+ wrapper?: FormValidatingToolWrapper<z.ZodObject<z.ZodRawShape>> | undefined;
34
+ originalTool: StructuredTool;
35
+ }
36
+ /**
37
+ * Options for tool registration
38
+ */
39
+ export interface ToolRegistrationOptions {
40
+ forceWrapper?: boolean;
41
+ skipWrapper?: boolean;
42
+ wrapperConfig?: {
43
+ requireAllFields?: boolean;
44
+ skipFields?: string[];
45
+ };
46
+ metadata?: Partial<ToolMetadata>;
47
+ }
48
+ /**
49
+ * Query interface for finding tools
50
+ */
51
+ export interface ToolQuery {
52
+ name?: string;
53
+ category?: ToolMetadata['category'];
54
+ capabilities?: Partial<ToolCapabilities>;
55
+ }
56
+ /**
57
+ * Centralized tool registry for managing tool lifecycle
58
+ */
59
+ export declare class ToolRegistry {
60
+ private tools;
61
+ private formGenerator;
62
+ private logger;
63
+ constructor(logger?: Logger);
64
+ /**
65
+ * Register a tool with the registry
66
+ */
67
+ registerTool(tool: StructuredTool, options?: ToolRegistrationOptions): void;
68
+ /**
69
+ * Get a tool by name
70
+ */
71
+ getTool(name: string): ToolRegistryEntry | null;
72
+ /**
73
+ * Get tools by capability
74
+ */
75
+ getToolsByCapability(capability: keyof ToolCapabilities, value?: unknown): ToolRegistryEntry[];
76
+ /**
77
+ * Get tools by query
78
+ */
79
+ getToolsByQuery(query: ToolQuery): ToolRegistryEntry[];
80
+ /**
81
+ * Get all registered tools
82
+ */
83
+ getAllTools(): StructuredTool[];
84
+ /**
85
+ * Get all registry entries
86
+ */
87
+ getAllRegistryEntries(): ToolRegistryEntry[];
88
+ /**
89
+ * Get all tool names
90
+ */
91
+ getToolNames(): string[];
92
+ /**
93
+ * Check if a tool is registered
94
+ */
95
+ hasTool(name: string): boolean;
96
+ /**
97
+ * Unregister a tool
98
+ */
99
+ unregisterTool(name: string): boolean;
100
+ /**
101
+ * Clear all tools
102
+ */
103
+ clear(): void;
104
+ /**
105
+ * Analyze tool capabilities
106
+ */
107
+ private analyzeToolCapabilities;
108
+ /**
109
+ * Check if tool has render configuration
110
+ */
111
+ private hasRenderConfig;
112
+ /**
113
+ * Determine if tool should be wrapped
114
+ */
115
+ private shouldWrapTool;
116
+ /**
117
+ * Check if schema is ZodObject-like
118
+ */
119
+ private isZodObjectLike;
120
+ /**
121
+ * Get statistics about the registry
122
+ */
123
+ getStatistics(): {
124
+ totalTools: number;
125
+ wrappedTools: number;
126
+ unwrappedTools: number;
127
+ categoryCounts: Record<ToolCapabilities['category'], number>;
128
+ priorityCounts: Record<ToolCapabilities['priority'], number>;
129
+ };
130
+ }
@@ -0,0 +1,81 @@
1
+ import { Logger } from '@hashgraphonline/standards-sdk';
2
+ import { SmartMemoryManager } from '../memory/SmartMemoryManager';
3
+ import { FormEngine, ToolExecutionResult } from '../forms/FormEngine';
4
+ import { ToolRegistry, ToolRegistryEntry } from '../core/ToolRegistry';
5
+
6
+ /**
7
+ * Session context for tool execution
8
+ */
9
+ export interface SessionContext {
10
+ sessionId: string;
11
+ userId?: string;
12
+ timestamp: number;
13
+ conversationId?: string;
14
+ }
15
+ /**
16
+ * Context passed through execution pipeline
17
+ */
18
+ export interface ExecutionContext {
19
+ toolName: string;
20
+ input: unknown;
21
+ session: SessionContext;
22
+ memory: SmartMemoryManager;
23
+ traceId: string;
24
+ toolEntry: ToolRegistryEntry;
25
+ }
26
+ /**
27
+ * Result of tool execution with metadata
28
+ */
29
+ export interface ExecutionResult extends ToolExecutionResult {
30
+ traceId: string;
31
+ executionTime: number;
32
+ }
33
+ /**
34
+ * ExecutionPipeline handles tool execution coordination
35
+ */
36
+ export declare class ExecutionPipeline {
37
+ private logger;
38
+ private toolRegistry;
39
+ private formEngine;
40
+ private memory;
41
+ constructor(toolRegistry: ToolRegistry, formEngine: FormEngine, memory: SmartMemoryManager, logger?: Logger);
42
+ /**
43
+ * Execute a tool through the pipeline
44
+ */
45
+ execute(toolName: string, input: unknown, sessionContext?: SessionContext): Promise<ExecutionResult>;
46
+ /**
47
+ * Execute tool with validation
48
+ */
49
+ executeWithValidation(toolName: string, input: unknown, sessionContext?: SessionContext): Promise<ExecutionResult>;
50
+ /**
51
+ * Process form submission
52
+ */
53
+ processFormSubmission(toolName: string, formId: string, parameters: Record<string, unknown>, sessionContext?: SessionContext): Promise<ExecutionResult>;
54
+ /**
55
+ * Check if form generation is required
56
+ */
57
+ private checkFormGeneration;
58
+ /**
59
+ * Execute tool directly
60
+ */
61
+ private executeToolDirect;
62
+ /**
63
+ * Execute wrapped tool
64
+ */
65
+ private executeWrappedTool;
66
+ /**
67
+ * Handle execution error
68
+ */
69
+ private handleExecutionError;
70
+ /**
71
+ * Build default session context
72
+ */
73
+ private buildDefaultSession;
74
+ /**
75
+ * Get statistics about the pipeline
76
+ */
77
+ getStatistics(): {
78
+ totalMiddleware: number;
79
+ registeredMiddleware: string[];
80
+ };
81
+ }