feat(tui): add usage overlay and sidebar for displaying usage statistics and tasks

feat(tui): implement status bar with connection and turn state indicators
feat(tui): create workflow panel for agent status and progress visualization
feat(web): introduce web frontend interface with static file serving
feat(ws): add WebSocket interface for real-time communication and session management
This commit is contained in:
asepharyana
2026-07-20 09:04:57 +07:00
parent bceba665c0
commit da2ed6da25
454 changed files with 13979 additions and 29539 deletions
+51
View File
@@ -0,0 +1,51 @@
//! Manages MCP server connections — start, stop, list, and dispatch
//! tool calls to remote MCP servers.
use std::collections::HashMap;
/// Metadata for a connected MCP server.
#[derive(Debug, Clone)]
pub struct McpServerHandle {
pub name: String,
pub transport: String,
}
/// Manages MCP server connections.
#[derive(Clone)]
pub struct McpManager {
servers: HashMap<String, McpServerHandle>,
}
impl McpManager {
pub fn new() -> Self {
McpManager {
servers: HashMap::new(),
}
}
pub fn register(&mut self, name: &str, transport: &str) {
self.servers.insert(
name.to_string(),
McpServerHandle {
name: name.to_string(),
transport: transport.to_string(),
},
);
}
pub fn unregister(&mut self, name: &str) {
self.servers.remove(name);
}
pub fn list(&self) -> Vec<McpServerHandle> {
self.servers.values().cloned().collect()
}
pub fn get(&self, name: &str) -> Option<&McpServerHandle> {
self.servers.get(name)
}
pub fn is_empty(&self) -> bool {
self.servers.is_empty()
}
}
+5
View File
@@ -0,0 +1,5 @@
//! Model Context Protocol (MCP) — bridge between agent tools and external MCP
//! servers using the rmcp crate.
pub mod manager;
pub mod transport;
+40
View File
@@ -0,0 +1,40 @@
//! MCP transport layer — manages child-process and HTTP-based transport
//! for connecting to MCP servers.
use std::process::{Child, Command, Stdio};
/// A running MCP server process connected via stdio.
pub struct McpTransport {
process: Option<Child>,
}
impl McpTransport {
pub fn start_child_process(command: &str, args: &[String]) -> anyhow::Result<Self> {
let child = Command::new(command)
.args(args)
.stdin(Stdio::piped())
.stdout(Stdio::piped())
.stderr(Stdio::inherit())
.spawn()?;
Ok(McpTransport {
process: Some(child),
})
}
pub fn stop(&mut self) -> anyhow::Result<()> {
if let Some(mut child) = self.process.take() {
let _ = child.kill();
let _ = child.wait();
}
Ok(())
}
}
impl Drop for McpTransport {
fn drop(&mut self) {
if let Some(mut child) = self.process.take() {
let _ = child.kill();
let _ = child.wait();
}
}
}