@hashgraphonline/conversational-agent 0.2.211 → 0.2.212
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/cli/dist/CLIApp.d.ts +11 -0
- package/cli/dist/CLIApp.d.ts.map +1 -0
- package/cli/dist/CLIApp.js +128 -0
- package/cli/dist/CLIApp.js.map +1 -0
- package/cli/dist/LocalConversationalAgent.d.ts +37 -0
- package/cli/dist/LocalConversationalAgent.js +58 -0
- package/cli/dist/app.d.ts +18 -0
- package/cli/dist/app.d.ts.map +1 -0
- package/cli/dist/app.js +14 -0
- package/cli/dist/app.js.map +1 -0
- package/cli/dist/cli.d.ts +3 -0
- package/cli/dist/cli.d.ts.map +1 -0
- package/cli/dist/cli.js +87 -0
- package/cli/dist/cli.js.map +1 -0
- package/cli/dist/components/AppContainer.d.ts +16 -0
- package/cli/dist/components/AppContainer.js +24 -0
- package/cli/dist/components/AppScreens.d.ts +2 -0
- package/cli/dist/components/AppScreens.js +259 -0
- package/cli/dist/components/ChatScreen.d.ts +21 -0
- package/cli/dist/components/ChatScreen.d.ts.map +1 -0
- package/cli/dist/components/ChatScreen.js +40 -0
- package/cli/dist/components/ChatScreen.js.map +1 -0
- package/cli/dist/components/DebugLoadingScreen.d.ts +5 -0
- package/cli/dist/components/DebugLoadingScreen.js +31 -0
- package/cli/dist/components/LoadingScreen.d.ts +3 -0
- package/cli/dist/components/LoadingScreen.d.ts.map +1 -0
- package/cli/dist/components/LoadingScreen.js +17 -0
- package/cli/dist/components/LoadingScreen.js.map +1 -0
- package/cli/dist/components/LoadingScreenDebug.d.ts +5 -0
- package/cli/dist/components/LoadingScreenDebug.js +27 -0
- package/cli/dist/components/MCPConfigScreen.d.ts +28 -0
- package/cli/dist/components/MCPConfigScreen.d.ts.map +1 -0
- package/cli/dist/components/MCPConfigScreen.js +186 -0
- package/cli/dist/components/MCPConfigScreen.js.map +1 -0
- package/cli/dist/components/ScreenRouter.d.ts +13 -0
- package/cli/dist/components/ScreenRouter.d.ts.map +1 -0
- package/cli/dist/components/ScreenRouter.js +23 -0
- package/cli/dist/components/ScreenRouter.js.map +1 -0
- package/cli/dist/components/SetupScreen.d.ts +16 -0
- package/cli/dist/components/SetupScreen.d.ts.map +1 -0
- package/cli/dist/components/SetupScreen.js +67 -0
- package/cli/dist/components/SetupScreen.js.map +1 -0
- package/cli/dist/components/SingleLoadingScreen.d.ts +5 -0
- package/cli/dist/components/SingleLoadingScreen.js +27 -0
- package/cli/dist/components/StatusBadge.d.ts +10 -0
- package/cli/dist/components/StatusBadge.d.ts.map +1 -0
- package/cli/dist/components/StatusBadge.js +24 -0
- package/cli/dist/components/StatusBadge.js.map +1 -0
- package/cli/dist/components/TerminalWindow.d.ts +9 -0
- package/cli/dist/components/TerminalWindow.d.ts.map +1 -0
- package/cli/dist/components/TerminalWindow.js +19 -0
- package/cli/dist/components/TerminalWindow.js.map +1 -0
- package/cli/dist/components/WelcomeScreen.d.ts +12 -0
- package/cli/dist/components/WelcomeScreen.d.ts.map +1 -0
- package/cli/dist/components/WelcomeScreen.js +47 -0
- package/cli/dist/components/WelcomeScreen.js.map +1 -0
- package/cli/dist/context/AppContext.d.ts +68 -0
- package/cli/dist/context/AppContext.js +363 -0
- package/cli/dist/headless-runner.d.ts +17 -0
- package/cli/dist/headless-runner.d.ts.map +1 -0
- package/cli/dist/headless-runner.js +128 -0
- package/cli/dist/headless-runner.js.map +1 -0
- package/cli/dist/hooks/useInitializeAgent.d.ts +19 -0
- package/cli/dist/hooks/useInitializeAgent.d.ts.map +1 -0
- package/cli/dist/hooks/useInitializeAgent.js +29 -0
- package/cli/dist/hooks/useInitializeAgent.js.map +1 -0
- package/cli/dist/hooks/useStableState.d.ts +38 -0
- package/cli/dist/hooks/useStableState.d.ts.map +1 -0
- package/cli/dist/hooks/useStableState.js +69 -0
- package/cli/dist/hooks/useStableState.js.map +1 -0
- package/cli/dist/managers/AgentManager.d.ts +58 -0
- package/cli/dist/managers/AgentManager.d.ts.map +1 -0
- package/cli/dist/managers/AgentManager.js +121 -0
- package/cli/dist/managers/AgentManager.js.map +1 -0
- package/cli/dist/managers/ConfigManager.d.ts +54 -0
- package/cli/dist/managers/ConfigManager.d.ts.map +1 -0
- package/cli/dist/managers/ConfigManager.js +188 -0
- package/cli/dist/managers/ConfigManager.js.map +1 -0
- package/cli/dist/types.d.ts +52 -0
- package/cli/dist/types.d.ts.map +1 -0
- package/cli/dist/types.js +34 -0
- package/cli/dist/types.js.map +1 -0
- package/dist/esm/index10.js +1 -1
- package/dist/esm/index21.js +1 -1
- package/dist/esm/index46.js +6 -26
- package/dist/esm/index46.js.map +1 -1
- package/dist/esm/index47.js +26 -6
- package/dist/esm/index47.js.map +1 -1
- package/package.json +25 -33
- package/cli/readme.md +0 -181
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { Box, Text, useApp, useInput } from 'ink';
|
|
3
|
+
import TextInput from 'ink-text-input';
|
|
4
|
+
import SelectInput from 'ink-select-input';
|
|
5
|
+
import { WelcomeScreen } from './WelcomeScreen.js';
|
|
6
|
+
import { ChatScreen } from './ChatScreen.js';
|
|
7
|
+
import { LoadingScreen } from './LoadingScreen.js';
|
|
8
|
+
import { TerminalWindow } from './TerminalWindow.js';
|
|
9
|
+
import { StatusBadge } from './StatusBadge.js';
|
|
10
|
+
import { BRAND_COLORS } from '../types.js';
|
|
11
|
+
import { useAppContext } from '../context/AppContext.js';
|
|
12
|
+
import { saveMCPConfig, getMCPConfigPath } from '../context/AppContext.js';
|
|
13
|
+
import { MCPServers } from '@hashgraphonline/conversational-agent';
|
|
14
|
+
export const AppScreens = () => {
|
|
15
|
+
const { state, actions } = useAppContext();
|
|
16
|
+
const { exit } = useApp();
|
|
17
|
+
const [showLogs] = useState(false);
|
|
18
|
+
const fields = ['accountId', 'privateKey', 'network', 'openAIApiKey'];
|
|
19
|
+
useInput((_, key) => {
|
|
20
|
+
if (state.screen === 'mcp-config' && key.escape) {
|
|
21
|
+
if (state.mcpConfig.addingCustom) {
|
|
22
|
+
actions.setMcpConfig({
|
|
23
|
+
addingCustom: false,
|
|
24
|
+
newServerName: '',
|
|
25
|
+
newServerCommand: '',
|
|
26
|
+
newServerArgs: '',
|
|
27
|
+
newServerEnv: '',
|
|
28
|
+
currentField: 0,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
else if (state.editingFilesystemPath) {
|
|
32
|
+
actions.setEditingFilesystemPath(false);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
if (state.screen === 'loading') {
|
|
37
|
+
return React.createElement(LoadingScreen, null);
|
|
38
|
+
}
|
|
39
|
+
if (state.screen === 'setup') {
|
|
40
|
+
return (React.createElement(TerminalWindow, { title: "Configuration" },
|
|
41
|
+
React.createElement(Box, { flexDirection: "column" },
|
|
42
|
+
React.createElement(Box, { marginBottom: 1 },
|
|
43
|
+
React.createElement(StatusBadge, { status: "info" }),
|
|
44
|
+
React.createElement(Text, null, "Configure your Hedera account credentials")),
|
|
45
|
+
fields.map((field, index) => (React.createElement(Box, { key: field, marginY: 1 },
|
|
46
|
+
React.createElement(Box, { width: 20 },
|
|
47
|
+
React.createElement(Text, { color: state.currentField === index
|
|
48
|
+
? BRAND_COLORS.blue
|
|
49
|
+
: BRAND_COLORS.hedera.smoke },
|
|
50
|
+
field === 'accountId' && 'Account ID:',
|
|
51
|
+
field === 'privateKey' && 'Private Key:',
|
|
52
|
+
field === 'network' && 'Network:',
|
|
53
|
+
field === 'openAIApiKey' && 'OpenAI Key:')),
|
|
54
|
+
state.currentField === index ? (field === 'network' ? (React.createElement(SelectInput, { items: [
|
|
55
|
+
{ label: 'Testnet', value: 'testnet' },
|
|
56
|
+
{ label: 'Mainnet', value: 'mainnet' },
|
|
57
|
+
], initialIndex: state.config.network === 'testnet' ? 0 : 1, onSelect: item => {
|
|
58
|
+
actions.updateConfigField('network', item.value);
|
|
59
|
+
if (state.currentField < fields.length - 1) {
|
|
60
|
+
actions.setCurrentField(state.currentField + 1);
|
|
61
|
+
}
|
|
62
|
+
} })) : (React.createElement(TextInput, { value: state.config[field], onChange: value => actions.updateConfigField(field, value), onSubmit: () => {
|
|
63
|
+
if (state.currentField < fields.length - 1) {
|
|
64
|
+
actions.setCurrentField(state.currentField + 1);
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
actions.initializeAgent();
|
|
68
|
+
}
|
|
69
|
+
}, mask: field === 'privateKey' || field === 'openAIApiKey'
|
|
70
|
+
? '*'
|
|
71
|
+
: undefined }))) : (React.createElement(Text, { color: BRAND_COLORS.hedera.smoke }, field === 'network'
|
|
72
|
+
? state.config[field]
|
|
73
|
+
: state.config[field]
|
|
74
|
+
? '••••••••'
|
|
75
|
+
: '(not set)'))))),
|
|
76
|
+
state.error && (React.createElement(Box, { marginTop: 2 },
|
|
77
|
+
React.createElement(StatusBadge, { status: "error" }),
|
|
78
|
+
React.createElement(Text, { color: "red" }, state.error))),
|
|
79
|
+
React.createElement(Box, { marginTop: 2 },
|
|
80
|
+
React.createElement(Text, { dimColor: true }, "Press Tab to navigate fields, Enter to submit"),
|
|
81
|
+
React.createElement(Text, { dimColor: true }, "Complete all fields and press Enter on the last field to save and start")))));
|
|
82
|
+
}
|
|
83
|
+
if (state.screen === 'mcp-config') {
|
|
84
|
+
if (state.editingFilesystemPath) {
|
|
85
|
+
return (React.createElement(TerminalWindow, { title: "Edit Filesystem Path" },
|
|
86
|
+
React.createElement(Box, { flexDirection: "column" },
|
|
87
|
+
React.createElement(Box, { marginBottom: 2 },
|
|
88
|
+
React.createElement(Text, null, "Enter the directory path for the filesystem server:")),
|
|
89
|
+
React.createElement(TextInput, { value: state.mcpConfig.filesystemPath, onChange: value => actions.setMcpConfig({ filesystemPath: value }), onSubmit: () => {
|
|
90
|
+
actions.setEditingFilesystemPath(false);
|
|
91
|
+
const servers = [];
|
|
92
|
+
if (state.mcpConfig.enableFilesystem) {
|
|
93
|
+
servers.push(MCPServers.filesystem(state.mcpConfig.filesystemPath));
|
|
94
|
+
}
|
|
95
|
+
servers.push(...state.mcpConfig.customServers);
|
|
96
|
+
saveMCPConfig(servers);
|
|
97
|
+
}, placeholder: process.cwd() }),
|
|
98
|
+
React.createElement(Box, { marginTop: 2 },
|
|
99
|
+
React.createElement(Text, { dimColor: true }, "Press Enter to save, Escape to cancel")))));
|
|
100
|
+
}
|
|
101
|
+
if (state.mcpConfig.addingCustom) {
|
|
102
|
+
const customFields = [
|
|
103
|
+
'newServerName',
|
|
104
|
+
'newServerCommand',
|
|
105
|
+
'newServerArgs',
|
|
106
|
+
'newServerEnv',
|
|
107
|
+
];
|
|
108
|
+
const fieldLabels = [
|
|
109
|
+
'Server Name:',
|
|
110
|
+
'Command:',
|
|
111
|
+
'Arguments (comma-separated):',
|
|
112
|
+
'Environment Variables (KEY=value, comma-separated):',
|
|
113
|
+
];
|
|
114
|
+
const placeholders = [
|
|
115
|
+
'my-server',
|
|
116
|
+
'npx',
|
|
117
|
+
'-y, @modelcontextprotocol/server-github',
|
|
118
|
+
'MCP_LOG_LEVEL=info, GIT_SIGN_COMMITS=false',
|
|
119
|
+
];
|
|
120
|
+
return (React.createElement(TerminalWindow, { title: "Add Custom MCP Server" },
|
|
121
|
+
React.createElement(Box, { flexDirection: "column" },
|
|
122
|
+
customFields.map((field, index) => (React.createElement(Box, { key: field, marginY: 1 },
|
|
123
|
+
React.createElement(Text, { color: state.mcpConfig.currentField === index
|
|
124
|
+
? BRAND_COLORS.blue
|
|
125
|
+
: BRAND_COLORS.hedera.smoke }, fieldLabels[index]),
|
|
126
|
+
state.mcpConfig.currentField === index ? (React.createElement(TextInput, { value: state.mcpConfig[field], onChange: value => actions.setMcpConfig({ [field]: value }), onSubmit: () => {
|
|
127
|
+
if (index < customFields.length - 1) {
|
|
128
|
+
actions.setMcpConfig({ currentField: index + 1 });
|
|
129
|
+
}
|
|
130
|
+
else if (state.mcpConfig.newServerName &&
|
|
131
|
+
state.mcpConfig.newServerCommand) {
|
|
132
|
+
const env = {};
|
|
133
|
+
if (state.mcpConfig.newServerEnv) {
|
|
134
|
+
state.mcpConfig.newServerEnv.split(',').forEach(envVar => {
|
|
135
|
+
const [key, value] = envVar.trim().split('=');
|
|
136
|
+
if (key && value) {
|
|
137
|
+
env[key] = value;
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
const newServer = {
|
|
142
|
+
name: state.mcpConfig.newServerName,
|
|
143
|
+
command: state.mcpConfig.newServerCommand,
|
|
144
|
+
args: state.mcpConfig.newServerArgs
|
|
145
|
+
.split(',')
|
|
146
|
+
.map(arg => arg.trim())
|
|
147
|
+
.filter(Boolean),
|
|
148
|
+
transport: 'stdio',
|
|
149
|
+
autoConnect: true,
|
|
150
|
+
...(Object.keys(env).length > 0 && { env }),
|
|
151
|
+
};
|
|
152
|
+
const newCustomServers = [...state.mcpConfig.customServers, newServer];
|
|
153
|
+
actions.setMcpConfig({
|
|
154
|
+
customServers: newCustomServers,
|
|
155
|
+
addingCustom: false,
|
|
156
|
+
newServerName: '',
|
|
157
|
+
newServerCommand: '',
|
|
158
|
+
newServerArgs: '',
|
|
159
|
+
newServerEnv: '',
|
|
160
|
+
currentField: 0,
|
|
161
|
+
});
|
|
162
|
+
const servers = [];
|
|
163
|
+
if (state.mcpConfig.enableFilesystem) {
|
|
164
|
+
servers.push(MCPServers.filesystem(state.mcpConfig.filesystemPath));
|
|
165
|
+
}
|
|
166
|
+
servers.push(...newCustomServers);
|
|
167
|
+
saveMCPConfig(servers);
|
|
168
|
+
}
|
|
169
|
+
}, placeholder: placeholders[index] })) : (React.createElement(Text, { color: BRAND_COLORS.hedera.smoke }, state.mcpConfig[field] ||
|
|
170
|
+
`(${placeholders[index]})`))))),
|
|
171
|
+
React.createElement(Box, { marginTop: 2 },
|
|
172
|
+
React.createElement(Text, { dimColor: true }, "Press Tab or Enter to move between fields"),
|
|
173
|
+
React.createElement(Text, { dimColor: true }, "Press Enter on the last field to add the server"),
|
|
174
|
+
React.createElement(Text, { dimColor: true }, "Press Escape to cancel")))));
|
|
175
|
+
}
|
|
176
|
+
const menuItems = [
|
|
177
|
+
{
|
|
178
|
+
label: `Filesystem Server: ${state.mcpConfig.enableFilesystem ? 'Enabled' : 'Disabled'}`,
|
|
179
|
+
value: 'filesystem',
|
|
180
|
+
},
|
|
181
|
+
];
|
|
182
|
+
if (state.mcpConfig.enableFilesystem) {
|
|
183
|
+
menuItems.push({
|
|
184
|
+
label: `Filesystem Path: ${state.mcpConfig.filesystemPath}`,
|
|
185
|
+
value: 'filesystem-path',
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
state.mcpConfig.customServers.forEach((server, index) => {
|
|
189
|
+
menuItems.push({
|
|
190
|
+
label: `${server.name} (${server.command})`,
|
|
191
|
+
value: `custom-${index}`,
|
|
192
|
+
});
|
|
193
|
+
});
|
|
194
|
+
menuItems.push({ label: 'Add Custom Server', value: 'add-custom' }, { label: 'Done (changes auto-saved)', value: 'save' }, { label: 'Back to Menu', value: 'back' });
|
|
195
|
+
return (React.createElement(TerminalWindow, { title: "MCP Server Configuration" },
|
|
196
|
+
React.createElement(Box, { flexDirection: "column" },
|
|
197
|
+
React.createElement(Box, { marginBottom: 2 },
|
|
198
|
+
React.createElement(StatusBadge, { status: "info" }),
|
|
199
|
+
React.createElement(Text, null, "Configure Model Context Protocol servers")),
|
|
200
|
+
React.createElement(SelectInput, { items: menuItems, onSelect: item => {
|
|
201
|
+
if (item.value === 'filesystem') {
|
|
202
|
+
const enableFilesystem = !state.mcpConfig.enableFilesystem;
|
|
203
|
+
actions.setMcpConfig({ enableFilesystem });
|
|
204
|
+
const servers = [];
|
|
205
|
+
if (enableFilesystem) {
|
|
206
|
+
servers.push(MCPServers.filesystem(state.mcpConfig.filesystemPath));
|
|
207
|
+
}
|
|
208
|
+
servers.push(...state.mcpConfig.customServers);
|
|
209
|
+
saveMCPConfig(servers);
|
|
210
|
+
}
|
|
211
|
+
else if (item.value === 'filesystem-path') {
|
|
212
|
+
actions.setEditingFilesystemPath(true);
|
|
213
|
+
}
|
|
214
|
+
else if (item.value === 'add-custom') {
|
|
215
|
+
actions.setMcpConfig({ addingCustom: true });
|
|
216
|
+
}
|
|
217
|
+
else if (item.value === 'save') {
|
|
218
|
+
const servers = [];
|
|
219
|
+
if (state.mcpConfig.enableFilesystem) {
|
|
220
|
+
servers.push(MCPServers.filesystem(state.mcpConfig.filesystemPath));
|
|
221
|
+
}
|
|
222
|
+
servers.push(...state.mcpConfig.customServers);
|
|
223
|
+
saveMCPConfig(servers);
|
|
224
|
+
const updatedConfig = {
|
|
225
|
+
...state.config,
|
|
226
|
+
mcpServers: servers,
|
|
227
|
+
};
|
|
228
|
+
actions.setConfig(updatedConfig);
|
|
229
|
+
actions.setScreen('welcome');
|
|
230
|
+
}
|
|
231
|
+
else if (item.value === 'back') {
|
|
232
|
+
actions.setScreen('welcome');
|
|
233
|
+
}
|
|
234
|
+
else if (item.value.startsWith('custom-')) {
|
|
235
|
+
const index = parseInt(item.value.replace('custom-', ''));
|
|
236
|
+
const newCustomServers = state.mcpConfig.customServers.filter((_, i) => i !== index);
|
|
237
|
+
actions.setMcpConfig({ customServers: newCustomServers });
|
|
238
|
+
const servers = [];
|
|
239
|
+
if (state.mcpConfig.enableFilesystem) {
|
|
240
|
+
servers.push(MCPServers.filesystem(state.mcpConfig.filesystemPath));
|
|
241
|
+
}
|
|
242
|
+
servers.push(...newCustomServers);
|
|
243
|
+
saveMCPConfig(servers);
|
|
244
|
+
}
|
|
245
|
+
} }),
|
|
246
|
+
React.createElement(Box, { marginY: 2 },
|
|
247
|
+
React.createElement(Text, { dimColor: true }, "Press Enter to toggle/edit servers, or select actions"),
|
|
248
|
+
state.mcpConfig.enableFilesystem && (React.createElement(Text, { dimColor: true },
|
|
249
|
+
"Filesystem path: ",
|
|
250
|
+
state.mcpConfig.filesystemPath)),
|
|
251
|
+
React.createElement(Text, { dimColor: true },
|
|
252
|
+
"Config saved to: ",
|
|
253
|
+
getMCPConfigPath())))));
|
|
254
|
+
}
|
|
255
|
+
if (state.screen === 'chat') {
|
|
256
|
+
return (React.createElement(ChatScreen, { config: state.config, messages: state.messages, input: state.input, isLoading: state.isLoading, setInput: actions.setInput, sendMessage: actions.sendMessage, showLogs: showLogs, logs: state.logs }));
|
|
257
|
+
}
|
|
258
|
+
return (React.createElement(WelcomeScreen, { config: state.config, onExit: exit, onInitializeAgent: actions.initializeAgent, onSetScreen: actions.setScreen, isLoading: state.isLoading, agent: state.agent }));
|
|
259
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type Config, type Message } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Props for the ChatScreen component
|
|
5
|
+
*/
|
|
6
|
+
interface ChatScreenProps {
|
|
7
|
+
config: Config;
|
|
8
|
+
messages: Message[];
|
|
9
|
+
input: string;
|
|
10
|
+
isLoading: boolean;
|
|
11
|
+
setInput: (value: string) => void;
|
|
12
|
+
sendMessage: (message: string) => void;
|
|
13
|
+
showLogs: boolean;
|
|
14
|
+
logs: string[];
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Chat screen component
|
|
18
|
+
*/
|
|
19
|
+
export declare const ChatScreen: React.FC<ChatScreenProps>;
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=ChatScreen.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChatScreen.d.ts","sourceRoot":"","sources":["../../src/components/ChatScreen.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,EAAe,KAAK,MAAM,EAAE,KAAK,OAAO,EAAC,MAAM,UAAU,CAAC;AAEjE;;GAEG;AACH,UAAU,eAAe;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,WAAW,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,MAAM,EAAE,CAAC;CACf;AAED;;GAEG;AACH,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAsHhD,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Box, Text } from 'ink';
|
|
3
|
+
import TextInput from 'ink-text-input';
|
|
4
|
+
import Spinner from 'ink-spinner';
|
|
5
|
+
import { TerminalWindow } from './TerminalWindow';
|
|
6
|
+
import { StatusBadge } from './StatusBadge';
|
|
7
|
+
import { BRAND_COLORS } from '../types';
|
|
8
|
+
/**
|
|
9
|
+
* Chat screen component
|
|
10
|
+
*/
|
|
11
|
+
export const ChatScreen = React.memo(({ config, messages, input, isLoading, setInput, sendMessage, showLogs, logs, }) => {
|
|
12
|
+
return (React.createElement(TerminalWindow, { title: `Conversational Agent Chat (${config.network})` },
|
|
13
|
+
React.createElement(Box, { flexDirection: "column", minHeight: 25 },
|
|
14
|
+
showLogs && (React.createElement(Box, { borderStyle: "single", borderColor: BRAND_COLORS.dark, marginBottom: 1, padding: 1, height: 10, flexDirection: "column", overflow: "hidden" },
|
|
15
|
+
React.createElement(Box, { marginBottom: 1 },
|
|
16
|
+
React.createElement(Text, { color: BRAND_COLORS.hedera.smoke, bold: true }, "\uD83D\uDCCB Logs")),
|
|
17
|
+
React.createElement(Box, { flexDirection: "column", overflow: "hidden" }, logs.slice(-8).map((log, i) => (React.createElement(Text, { key: i, color: BRAND_COLORS.comments, dimColor: true, wrap: "truncate" }, log)))))),
|
|
18
|
+
React.createElement(Box, { flexDirection: "column", flexGrow: 1, marginBottom: 1, overflow: "hidden" }, messages.slice(-15).map((msg, index) => (React.createElement(Box, { key: `${msg.timestamp.getTime()}-${index}`, marginBottom: 1 },
|
|
19
|
+
msg.role === 'user' && (React.createElement(Box, { flexDirection: "column" },
|
|
20
|
+
React.createElement(Box, null,
|
|
21
|
+
React.createElement(Text, { color: BRAND_COLORS.green }, "$ "),
|
|
22
|
+
React.createElement(Text, { wrap: "wrap" }, msg.content)))),
|
|
23
|
+
msg.role === 'assistant' && (React.createElement(Box, { flexDirection: "column" },
|
|
24
|
+
React.createElement(Box, null,
|
|
25
|
+
React.createElement(Text, { color: BRAND_COLORS.blue }, "\u2192 "),
|
|
26
|
+
React.createElement(Text, { wrap: "wrap" }, msg.content)))),
|
|
27
|
+
msg.role === 'system' && (React.createElement(Box, { flexDirection: "column" },
|
|
28
|
+
React.createElement(Box, null,
|
|
29
|
+
React.createElement(StatusBadge, { status: "info" }),
|
|
30
|
+
React.createElement(Text, { color: BRAND_COLORS.hedera.smoke, wrap: "wrap" }, msg.content)))))))),
|
|
31
|
+
React.createElement(Box, { borderStyle: "single", borderTop: true, borderColor: BRAND_COLORS.dark, paddingTop: 1, paddingX: 1 }, isLoading ? (React.createElement(Box, null,
|
|
32
|
+
React.createElement(Spinner, { type: "dots" }),
|
|
33
|
+
React.createElement(Text, { color: BRAND_COLORS.hedera.smoke }, " Processing..."))) : (React.createElement(Box, { flexDirection: "row", width: "100%" },
|
|
34
|
+
React.createElement(Text, { color: BRAND_COLORS.green }, "$ "),
|
|
35
|
+
React.createElement(Box, { flexGrow: 1 },
|
|
36
|
+
React.createElement(TextInput, { value: input, onChange: setInput, onSubmit: sendMessage, placeholder: "Type your message..." }))))),
|
|
37
|
+
React.createElement(Box, { marginTop: 1, paddingX: 1 },
|
|
38
|
+
React.createElement(Text, { dimColor: true }, "Ctrl+C to exit, ESC to return to menu, L to toggle logs")))));
|
|
39
|
+
});
|
|
40
|
+
//# sourceMappingURL=ChatScreen.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChatScreen.js","sourceRoot":"","sources":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EAAE,YAAY,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,EAAC,MAAM,IACjD,GAAG,CAAC,OAAO,CACN,CACF,CACD,CACN,CACI,CACN,CAAC,CACG;YACN,oBAAC,GAAG,IACH,WAAW,EAAC,QAAQ,EACpB,SAAS,QACT,WAAW,EAAE,YAAY,CAAC,IAAI,EAC9B,UAAU,EAAE,CAAC,EACb,QAAQ,EAAE,CAAC,IAEV,SAAS,CAAC,CAAC,CAAC,CACZ,oBAAC,GAAG;gBACH,oBAAC,OAAO,IAAC,IAAI,EAAC,MAAM,GAAG;gBACvB,oBAAC,IAAI,IAAC,KAAK,EAAE,YAAY,CAAC,MAAM,CAAC,KAAK,qBAAuB,CACxD,CACN,CAAC,CAAC,CAAC,CACH,oBAAC,GAAG,IAAC,aAAa,EAAC,KAAK,EAAC,KAAK,EAAC,MAAM;gBACpC,oBAAC,IAAI,IAAC,KAAK,EAAE,YAAY,CAAC,KAAK,SAAW;gBAC1C,oBAAC,GAAG,IAAC,QAAQ,EAAE,CAAC;oBACf,oBAAC,SAAS,IACT,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,WAAW,EACrB,WAAW,EAAC,sBAAsB,GACjC,CACG,CACD,CACN,CACI;YACN,oBAAC,GAAG,IAAC,SAAS,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC;gBAC7B,oBAAC,IAAI,IAAC,QAAQ,oEAEP,CACF,CACD,CACU,CACjB,CAAC;AACH,CAAC,CACD,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React, { useEffect, useRef } from 'react';
|
|
2
|
+
import { Box, Text } from 'ink';
|
|
3
|
+
import Spinner from 'ink-spinner';
|
|
4
|
+
import { BRAND_COLORS } from '../types.js';
|
|
5
|
+
let globalRenderCount = 0;
|
|
6
|
+
let globalInstanceCount = 0;
|
|
7
|
+
/**
|
|
8
|
+
* Debug loading screen to trace double rendering issue
|
|
9
|
+
*/
|
|
10
|
+
export const DebugLoadingScreen = () => {
|
|
11
|
+
const instanceId = useRef(++globalInstanceCount);
|
|
12
|
+
const renderCount = useRef(0);
|
|
13
|
+
const mountTime = useRef(Date.now());
|
|
14
|
+
renderCount.current++;
|
|
15
|
+
globalRenderCount++;
|
|
16
|
+
console.error(`[LOADING-${instanceId.current}] Render #${renderCount.current} (Global: ${globalRenderCount}) at ${Date.now() - mountTime.current}ms`);
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
console.error(`[LOADING-${instanceId.current}] MOUNTED`);
|
|
19
|
+
console.error(new Error('Mount Stack Trace').stack);
|
|
20
|
+
return () => {
|
|
21
|
+
console.error(`[LOADING-${instanceId.current}] UNMOUNTED after ${renderCount.current} renders`);
|
|
22
|
+
};
|
|
23
|
+
}, []);
|
|
24
|
+
return (React.createElement(Box, { flexDirection: "column", alignItems: "center", paddingY: 4 },
|
|
25
|
+
React.createElement(Box, { marginBottom: 2 },
|
|
26
|
+
React.createElement(Text, { color: BRAND_COLORS.blue }, "Initializing "),
|
|
27
|
+
React.createElement(Text, { color: BRAND_COLORS.purple }, "Hashgraph "),
|
|
28
|
+
React.createElement(Text, { color: BRAND_COLORS.green }, "Online "),
|
|
29
|
+
React.createElement(Text, { color: BRAND_COLORS.blue }, "Agent...")),
|
|
30
|
+
React.createElement(Spinner, { type: "dots" })));
|
|
31
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LoadingScreen.d.ts","sourceRoot":"","sources":["../../src/components/LoadingScreen.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAKvC,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAiBjC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import { Box, Text, useStdout } from 'ink';
|
|
3
|
+
import Spinner from 'ink-spinner';
|
|
4
|
+
import { BRAND_COLORS } from '../types';
|
|
5
|
+
export const LoadingScreen = () => {
|
|
6
|
+
const { write } = useStdout();
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
write('\x1Bc');
|
|
9
|
+
}, [write]);
|
|
10
|
+
return (React.createElement(Box, { flexDirection: "column", alignItems: "center", paddingY: 4 },
|
|
11
|
+
React.createElement(Box, { marginBottom: 2 },
|
|
12
|
+
React.createElement(Text, { color: BRAND_COLORS.blue }, "Initializing "),
|
|
13
|
+
React.createElement(Text, { color: BRAND_COLORS.purple }, "Conversational "),
|
|
14
|
+
React.createElement(Text, { color: BRAND_COLORS.green }, "Agent...")),
|
|
15
|
+
React.createElement(Spinner, { type: "dots" })));
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=LoadingScreen.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LoadingScreen.js","sourceRoot":"","sources":["../../src/components/LoadingScreen.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AACvC,OAAO,EAAC,GAAG,EAAE,IAAI,EAAE,SAAS,EAAC,MAAM,KAAK,CAAC;AACzC,OAAO,OAAO,MAAM,aAAa,CAAC;AAClC,OAAO,EAAC,YAAY,EAAC,MAAM,UAAU,CAAC;AAEtC,MAAM,CAAC,MAAM,aAAa,GAAa,GAAG,EAAE;IAC3C,MAAM,EAAC,KAAK,EAAC,GAAG,SAAS,EAAE,CAAC;IAE5B,SAAS,CAAC,GAAG,EAAE;QACd,KAAK,CAAC,OAAO,CAAC,CAAC;IAChB,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEZ,OAAO,CACN,oBAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,EAAC,UAAU,EAAC,QAAQ,EAAC,QAAQ,EAAE,CAAC;QAC1D,oBAAC,GAAG,IAAC,YAAY,EAAE,CAAC;YACnB,oBAAC,IAAI,IAAC,KAAK,EAAE,YAAY,CAAC,IAAI,oBAAsB;YACpD,oBAAC,IAAI,IAAC,KAAK,EAAE,YAAY,CAAC,MAAM,sBAAwB;YACxD,oBAAC,IAAI,IAAC,KAAK,EAAE,YAAY,CAAC,KAAK,eAAiB,CAC3C;QACN,oBAAC,OAAO,IAAC,IAAI,EAAC,MAAM,GAAG,CAClB,CACN,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import { Box, Text, Static } from 'ink';
|
|
3
|
+
import Spinner from 'ink-spinner';
|
|
4
|
+
import { BRAND_COLORS } from '../types.js';
|
|
5
|
+
let renderCount = 0;
|
|
6
|
+
/**
|
|
7
|
+
* Loading screen component with debug logging
|
|
8
|
+
*/
|
|
9
|
+
export const LoadingScreenDebug = () => {
|
|
10
|
+
renderCount++;
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
console.error(`[LOADING] Mounted - render #${renderCount}`);
|
|
13
|
+
return () => {
|
|
14
|
+
console.error(`[LOADING] Unmounted - after ${renderCount} renders`);
|
|
15
|
+
};
|
|
16
|
+
}, []);
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
console.error(`[LOADING] Render #${renderCount}`);
|
|
19
|
+
});
|
|
20
|
+
return (React.createElement(Box, { flexDirection: "column", alignItems: "center", paddingY: 4 },
|
|
21
|
+
React.createElement(Static, { items: [{ id: '1' }] }, () => (React.createElement(Box, { marginBottom: 2 },
|
|
22
|
+
React.createElement(Text, { color: BRAND_COLORS.blue }, "Initializing "),
|
|
23
|
+
React.createElement(Text, { color: BRAND_COLORS.purple }, "Hashgraph "),
|
|
24
|
+
React.createElement(Text, { color: BRAND_COLORS.green }, "Online "),
|
|
25
|
+
React.createElement(Text, { color: BRAND_COLORS.blue }, "Agent...")))),
|
|
26
|
+
React.createElement(Spinner, { type: "dots" })));
|
|
27
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type Screen, type MCPServerConfig } from '../types';
|
|
3
|
+
interface MCPConfig {
|
|
4
|
+
enableFilesystem: boolean;
|
|
5
|
+
filesystemPath: string;
|
|
6
|
+
customServers: MCPServerConfig[];
|
|
7
|
+
addingCustom: boolean;
|
|
8
|
+
newServerName: string;
|
|
9
|
+
newServerCommand: string;
|
|
10
|
+
newServerArgs: string;
|
|
11
|
+
newServerEnv: string;
|
|
12
|
+
currentField: number;
|
|
13
|
+
}
|
|
14
|
+
interface Props {
|
|
15
|
+
mcpConfig: MCPConfig;
|
|
16
|
+
editingFilesystemPath: boolean;
|
|
17
|
+
onSetMcpConfig: (config: Partial<MCPConfig>) => void;
|
|
18
|
+
onSetEditingFilesystemPath: (editing: boolean) => void;
|
|
19
|
+
onSetScreen: (screen: Screen) => void;
|
|
20
|
+
onSaveMCPConfig: () => void;
|
|
21
|
+
getMCPConfigPath: () => string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* MCP Configuration screen
|
|
25
|
+
*/
|
|
26
|
+
export declare const MCPConfigScreen: React.FC<Props>;
|
|
27
|
+
export {};
|
|
28
|
+
//# sourceMappingURL=MCPConfigScreen.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MCPConfigScreen.d.ts","sourceRoot":"","sources":["../../src/components/MCPConfigScreen.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,EAEL,KAAK,MAAM,EACX,KAAK,eAAe,EAErB,MAAM,UAAU,CAAC;AAElB,UAAU,SAAS;IACjB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,eAAe,EAAE,CAAC;IACjC,YAAY,EAAE,OAAO,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;CACtB;AAuCD,UAAU,KAAK;IACb,SAAS,EAAE,SAAS,CAAC;IACrB,qBAAqB,EAAE,OAAO,CAAC;IAC/B,cAAc,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,SAAS,CAAC,KAAK,IAAI,CAAC;IACrD,0BAA0B,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACvD,WAAW,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,eAAe,EAAE,MAAM,IAAI,CAAC;IAC5B,gBAAgB,EAAE,MAAM,MAAM,CAAC;CAChC;AAED;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAsO3C,CAAC"}
|