- 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.
41 lines
857 B
Rust
41 lines
857 B
Rust
use serde::{Deserialize, Serialize};
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct StateDiff {
|
|
changes: Vec<Change>,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct Change {
|
|
pub path: String,
|
|
pub kind: String,
|
|
}
|
|
|
|
impl StateDiff {
|
|
pub fn new() -> Self {
|
|
StateDiff { changes: Vec::new() }
|
|
}
|
|
|
|
pub fn add_change(&mut self, path: String, kind: String) {
|
|
self.changes.push(Change { path, kind });
|
|
}
|
|
|
|
pub fn is_empty(&self) -> bool {
|
|
self.changes.is_empty()
|
|
}
|
|
|
|
pub fn clear(&mut self) {
|
|
self.changes.clear();
|
|
}
|
|
}
|
|
|
|
pub fn compute_diff(before: &serde_json::Value, after: &serde_json::Value) -> Vec<Change> {
|
|
if before == after {
|
|
return Vec::new();
|
|
}
|
|
vec![Change {
|
|
path: ".".to_string(),
|
|
kind: "modified".to_string(),
|
|
}]
|
|
}
|