Implement chat and markdown views, enhance status bar, and add workflow panel

- Added `chat.rs` for rendering chat messages with timestamps and roles.
- Introduced `markdown.rs` for rendering markdown content with styling.
- Created `status.rs` to display the application status bar with session and message counts.
- Developed `workflow.rs` to show the current workflow status, including tool calls and active jobs.
- Established a `theme.rs` for centralized color management across the UI.
- Updated `mod.rs` to include new modules and manage rendering logic.
This commit is contained in:
asepharyana
2026-07-11 13:16:10 +07:00
parent 7cb4ae6708
commit cc03bd79b6
131 changed files with 10994 additions and 0 deletions
+57
View File
@@ -0,0 +1,57 @@
use std::net::TcpStream;
use std::os::unix::net::UnixStream;
use anyhow::Result;
use super::frame;
pub enum Connection {
Tcp(TcpStream),
Unix(UnixStream),
}
impl Connection {
pub fn connect_tcp(addr: &str) -> Result<Self> {
let stream = TcpStream::connect(addr)?;
stream.set_nodelay(true)?;
Ok(Connection::Tcp(stream))
}
pub fn connect_unix(path: &str) -> Result<Self> {
let stream = UnixStream::connect(path)?;
Ok(Connection::Unix(stream))
}
pub fn send<T: serde::Serialize>(&mut self, value: &T) -> Result<()> {
let data = frame::serialize_frame(value)?;
match self {
Connection::Tcp(ref mut s) => frame::write_frame(s, &data),
Connection::Unix(ref mut s) => frame::write_frame(s, &data),
}
}
pub fn receive<T: serde::de::DeserializeOwned>(&mut self) -> Result<Option<T>> {
let data = match self {
Connection::Tcp(ref mut s) => frame::read_frame(s)?,
Connection::Unix(ref mut s) => frame::read_frame(s)?,
};
match data {
Some(bytes) => {
let value: T = frame::deserialize_frame(&bytes)?;
Ok(Some(value))
}
None => Ok(None),
}
}
pub fn try_clone(&self) -> Result<Self> {
match self {
Connection::Tcp(s) => {
let cloned = s.try_clone()?;
Ok(Connection::Tcp(cloned))
}
Connection::Unix(s) => {
let cloned = s.try_clone()?;
Ok(Connection::Unix(cloned))
}
}
}
}