Use memory graph for view lenses

This commit is contained in:
Meta Vens 2026-05-18 05:52:36 +01:00
commit 496b7efa65
6 changed files with 58 additions and 6 deletions

View file

@ -54,6 +54,26 @@ impl CodexMessageProcessor {
let loaded_thread = self.thread_manager.get_thread(thread_uuid).await.ok();
let loaded = loaded_thread.is_some();
let memory_graph_snapshot = if let Some(loaded_thread) = loaded_thread.as_ref() {
let config_snapshot = loaded_thread.config_snapshot().await;
let store_path = memory_graph_store_path(config_snapshot.cwd.as_path());
match load_memory_graph_snapshot(&store_path) {
Ok(snapshot) => snapshot,
Err(err) => {
self.send_internal_error(
request_id,
format!(
"failed to load Epiphany memory graph store {}: {err}",
store_path.display()
),
)
.await;
return;
}
}
} else {
None
};
let thread = match self.read_thread_view(thread_uuid, false).await {
Ok(thread) => thread,
Err(ThreadReadViewError::InvalidRequest(message)) => {
@ -127,6 +147,7 @@ impl CodexMessageProcessor {
lenses,
loaded,
state: thread.epiphany_state.as_ref(),
memory_graph_snapshot: memory_graph_snapshot.as_ref(),
retrieval_override: retrieval_override.as_ref(),
watcher_snapshot: watcher_snapshot
.as_ref()
@ -227,6 +248,26 @@ impl CodexMessageProcessor {
};
let loaded_thread = self.thread_manager.get_thread(thread_uuid).await.ok();
let memory_graph_snapshot = if let Some(loaded_thread) = loaded_thread.as_ref() {
let config_snapshot = loaded_thread.config_snapshot().await;
let store_path = memory_graph_store_path(config_snapshot.cwd.as_path());
match load_memory_graph_snapshot(&store_path) {
Ok(snapshot) => snapshot,
Err(err) => {
self.send_internal_error(
request_id,
format!(
"failed to load Epiphany memory graph store {}: {err}",
store_path.display()
),
)
.await;
return;
}
}
} else {
None
};
let thread = match self.read_thread_view(thread_uuid, false).await {
Ok(thread) => thread,
Err(ThreadReadViewError::InvalidRequest(message)) => {
@ -261,6 +302,7 @@ impl CodexMessageProcessor {
thread_id,
loaded: loaded_thread.is_some(),
state: thread.epiphany_state.as_ref(),
memory_graph_snapshot: memory_graph_snapshot.as_ref(),
retrieval_override: retrieval_override.as_ref(),
watcher_snapshot: watcher_snapshot
.as_ref()