Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors
Rust
fix(web): hide TTL-expired pages from the page listings
Vinícius DS Andrade6beb9b5c0d71
diff --git a/crates/ai-memory-web/src/routes/api.rs b/crates/ai-memory-web/src/routes/api.rsindex 3734a981..bf2987cc 100644--- a/crates/ai-memory-web/src/routes/api.rs+++ b/crates/ai-memory-web/src/routes/api.rs@@ -175,7 +175,7 @@ async fn pages_handler(let _ = lookup_project(&state, &workspace, &project, viewer_of(viewer)).await?;let pages = state.reader- .list_pages(&workspace, &project)+ .list_unexpired_pages(&workspace, &project).await.map_err(internal_error)?;Ok(with_cache(@@ -584,7 +584,7 @@ async fn recent_handler(if query.updated_since.is_none() && query.cursor.is_none() {let mut pages = state.reader- .list_pages(&workspace, &project)+ .list_unexpired_pages(&workspace, &project).await.map_err(internal_error)?;pages.sort_by(|a, b| b.updated_at.cmp(&a.updated_at));diff --git a/crates/ai-memory-web/src/routes/page.rs b/crates/ai-memory-web/src/routes/page.rsindex 7a0bcf68..737dfbd9 100644--- a/crates/ai-memory-web/src/routes/page.rs+++ b/crates/ai-memory-web/src/routes/page.rs@@ -203,7 +203,7 @@ async fn namespace_or_not_found(return not_found_response();}let prefix = format!("{namespace}/");- let all = match state.reader.list_pages(workspace, project).await {+ let all = match state.reader.list_unexpired_pages(workspace, project).await {Ok(p) => p,Err(_) => return StatusCode::INTERNAL_SERVER_ERROR.into_response(),};diff --git a/crates/ai-memory-web/src/routes/project.rs b/crates/ai-memory-web/src/routes/project.rsindex 263110b9..2fbf8ab3 100644--- a/crates/ai-memory-web/src/routes/project.rs+++ b/crates/ai-memory-web/src/routes/project.rs@@ -61,7 +61,7 @@ async fn render(async {state.reader- .list_pages(&workspace, &project)+ .list_unexpired_pages(&workspace, &project).await.map_err(|_| StatusCode::INTERNAL_SERVER_ERROR)},@@ -277,9 +277,10 @@ async fn sessions(/// The project whose pages this page lists, or `None` when there is none.///-/// Matches the exact name, as `list_pages` does, so an alias that resolves to-/// another project cannot put that project's mail beside these pages. A URL-/// that names no project renders an empty mailbox, as it renders no pages.+/// Matches the exact name, as `list_unexpired_pages` does, so an alias that+/// resolves to another project cannot put that project's mail beside these+/// pages. A URL that names no project renders an empty mailbox, as it renders+/// no pages.async fn mailbox_scope(state: &WebState,workspace: &str,