refactor: consolidate nvim crates, extract server library, and update workspace dependencies

This commit is contained in:
Riz Ashraf committed 2026-10-04 01:42:59 +01:00
1 parent a083719cf1
commit 533adfd41b
53 files changed
+5967 -1230

No files matched your search

+31 -5
View File
@@ -29,6 +29,7 @@ pub struct CodeStores {
pub error_fixes: Store<Vec<ErrorFix>>,
pub tech_debts: Store<Vec<TechDebt>>,
pub sticky: Store<Vec<StickyNote>>,
pub hypotheses: Store<Vec<Hypothesis>>,
}
pub struct EnvironmentStores {
@@ -44,6 +45,7 @@ pub struct TelemetryStores {
pub handoff_memos: Store<Vec<HandoffMemo>>,
pub recent_activities: Store<std::collections::VecDeque<serde_json::Value>>,
pub terminal_history: Store<std::collections::VecDeque<TerminalHistory>>,
pub agent_signals: Store<Vec<AgentSignal>>,
}
pub struct MemoryState {
@@ -70,7 +72,7 @@ impl MemoryState {
let db = crate::db::init_redb(&base);
Self {
let state = Self {
ollama: Arc::new(crate::ollama::OllamaClient::new_from_env()),
clipboard_watch_mode: tokio::sync::RwLock::new(false),
graph: Store::new("knowledge_graph_master", db.clone()),
@@ -103,6 +105,7 @@ impl MemoryState {
error_fixes: Store::new("error_fixes", db.clone()),
tech_debts: Store::new("tech_debts", db.clone()),
sticky: Store::new("sticky_notes", db.clone()),
hypotheses: Store::new("hypotheses", db.clone()),
},
env: EnvironmentStores {
env_fingerprints: Store::new("env_fingerprints", db.clone()),
@@ -116,14 +119,27 @@ impl MemoryState {
handoff_memos: Store::new("handoff_memos", db.clone()),
recent_activities: Store::new("recent_activities", db.clone()),
terminal_history: Store::new("terminal_history", db.clone()),
agent_signals: Store::new("agent_signals", db.clone()),
},
activity_tx: tokio::sync::broadcast::channel(100).0,
event_bus_tx: tokio::sync::broadcast::channel(1000).0,
}
};
// Normalize pre-existing graph entity and relation types
state.graph.modify(|g| {
for entity in g.entities.values_mut() {
entity.entity_type = crate::models::normalize_entity_type(&entity.entity_type);
}
for relation in g.relations.iter_mut() {
relation.relation_type = crate::models::normalize_relation_type(&relation.relation_type);
}
});
state
}
pub fn broadcast_activity(&self, message: &str) {
pub fn broadcast_activity(&self, category: &str, message: &str) {
let time = std::time::SystemTime::now()
.duration_since(std::time::UNIX_EPOCH)
.unwrap_or_default()
@@ -131,13 +147,14 @@ impl MemoryState {
let item = serde_json::json!({
"time": time,
"category": category,
"message": message
});
self.telemetry.recent_activities.modify(|activities| {
activities.push_back(item.clone());
activities.push_front(item.clone());
if activities.len() > 100 {
activities.pop_front();
activities.pop_back();
}
});
@@ -240,6 +257,15 @@ impl MemoryState {
let _ = self.activity_tx.send(record.to_string());
}
pub fn record_terminal_history(&self, payload: TerminalHistory) {
self.telemetry.terminal_history.modify(|history| {
history.push_front(payload);
if history.len() > 100 {
history.pop_back();
}
});
}
}
#[cfg(test)]