aKode fase 5: rinomina interna (crate akode-*, akode-rs/, akode-cli/, binario akode, AKODE_*, ~/.akode, snapshot)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
andrea.difonzo
2026-11-11 11:06:46 +01:00
parent df99318392
commit 86e7c72e5f
10383 changed files with 749164 additions and 749170 deletions

View File

@@ -0,0 +1,59 @@
//! Reports v2 readiness without exposing memory contents or persistence details to clients.
use super::*;
use akode_app_server_protocol::MemoryStatusParams;
use akode_app_server_protocol::MemoryStatusResponse;
use akode_protocol::MemoryVersion;
impl ThreadRequestProcessor {
pub(crate) async fn memory_status(
&self,
params: MemoryStatusParams,
) -> Result<Option<ClientResponsePayload>, JSONRPCErrorError> {
let minimum = params.min_consolidated_threads.unwrap_or(20);
if !(1..=4096).contains(&minimum) {
return Err(invalid_params(
"minConsolidatedThreads must be between 1 and 4096",
));
}
let db = self
.state_db
.as_ref()
.ok_or_else(|| internal_error("sqlite state db unavailable for memory status"))?;
let store = db
.memories_for_version(MemoryVersion::V2)
.await
.map_err(|error| internal_error(format!("failed to open v2 memory state: {error}")))?;
let count = store
.max_consolidated_thread_count()
.await
.map_err(|error| internal_error(format!("failed to read memory progress: {error}")))?;
let root = self
.config
.codex_home
.join(MemoryVersion::V2.directory_name());
let summary = tokio::fs::read_to_string(root.join("memory_summary.md"))
.await
.ok();
let has_v1_workspace = tokio::fs::try_exists(
self.config
.codex_home
.join(MemoryVersion::V1.directory_name()),
)
.await
.map_err(|error| internal_error(format!("failed to check v1 memory workspace: {error}")))?;
// Fresh profiles can start on V2 without consolidating any V1 history first.
let ready = !has_v1_workspace
|| count >= minimum
&& summary
.as_deref()
.is_some_and(akode_memories_write::workspace::is_valid_v2_summary);
Ok(Some(
MemoryStatusResponse {
v2_consolidated_threads: count,
v2_ready: ready,
}
.into(),
))
}
}