Rinomina: crate akode-*, cartelle akode-rs/ e akode-cli/, binario akode, ~/.akode, AKODE_* (A)
Riapplica la fase 5 di aKode (86e7c72e) sulla base ripulita:
- crate codex-* -> akode-*, codex-rs -> akode-rs, codex-cli -> akode-cli, binario e ausiliari akode;
- ~/.codex -> ~/.akode, CODEX_HOME -> AKODE_HOME, variabili CODEX_* -> AKODE_*, .codex/ -> .akode/ di progetto;
nessun fallback a ~/.codex o a CODEX_*;
- testi per l'utente "Codex" -> "aKode"; testi verso il modello e istruzioni di sistema invariati;
- snapshot insta rinominati (non ancora rigenerati).
I conflitti con la base ripulita sono stati risolti riapplicando la rinomina ai file senza le
funzioni di imeAI (script di mappa dei token per file).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
99
akode-rs/thread-store/src/local/thread_sections.rs
Normal file
99
akode-rs/thread-store/src/local/thread_sections.rs
Normal file
@@ -0,0 +1,99 @@
|
||||
use super::LocalThreadStore;
|
||||
use crate::CreateThreadSectionParams;
|
||||
use crate::DeleteThreadSectionParams;
|
||||
use crate::ListThreadSectionsParams;
|
||||
use crate::RenameThreadSectionParams;
|
||||
use crate::StoredThreadSection;
|
||||
use crate::StoredThreadSectionsPage;
|
||||
use crate::ThreadStoreError;
|
||||
use crate::ThreadStoreResult;
|
||||
use akode_rollout::StateDbHandle;
|
||||
|
||||
pub(super) async fn list_thread_sections(
|
||||
store: &LocalThreadStore,
|
||||
params: ListThreadSectionsParams,
|
||||
) -> ThreadStoreResult<StoredThreadSectionsPage> {
|
||||
let state_db = state_db(store, "threadSection/list")?;
|
||||
let page = state_db
|
||||
.list_thread_sections(params.cursor.as_deref(), params.limit)
|
||||
.await
|
||||
.map_err(|err| section_error("list", err))?;
|
||||
|
||||
Ok(StoredThreadSectionsPage {
|
||||
sections: page
|
||||
.sections
|
||||
.into_iter()
|
||||
.map(|section| StoredThreadSection {
|
||||
id: section.id,
|
||||
name: section.name,
|
||||
appearance: section.appearance,
|
||||
})
|
||||
.collect(),
|
||||
next_cursor: page.next_cursor,
|
||||
})
|
||||
}
|
||||
|
||||
pub(super) async fn create_thread_section(
|
||||
store: &LocalThreadStore,
|
||||
params: CreateThreadSectionParams,
|
||||
) -> ThreadStoreResult<StoredThreadSection> {
|
||||
let state_db = state_db(store, "threadSection/create")?;
|
||||
let section = state_db
|
||||
.create_thread_section(¶ms.name, params.appearance)
|
||||
.await
|
||||
.map_err(|err| section_error("create", err))?;
|
||||
|
||||
Ok(StoredThreadSection {
|
||||
id: section.id,
|
||||
name: section.name,
|
||||
appearance: section.appearance,
|
||||
})
|
||||
}
|
||||
|
||||
pub(super) async fn rename_thread_section(
|
||||
store: &LocalThreadStore,
|
||||
params: RenameThreadSectionParams,
|
||||
) -> ThreadStoreResult<Option<StoredThreadSection>> {
|
||||
let state_db = state_db(store, "threadSection/update")?;
|
||||
let section = state_db
|
||||
.rename_thread_section(¶ms.section_id, ¶ms.name, params.appearance)
|
||||
.await
|
||||
.map_err(|err| section_error("update", err))?;
|
||||
|
||||
Ok(section.map(|section| StoredThreadSection {
|
||||
id: section.id,
|
||||
name: section.name,
|
||||
appearance: section.appearance,
|
||||
}))
|
||||
}
|
||||
|
||||
pub(super) async fn delete_thread_section(
|
||||
store: &LocalThreadStore,
|
||||
params: DeleteThreadSectionParams,
|
||||
) -> ThreadStoreResult<bool> {
|
||||
let state_db = state_db(store, "threadSection/delete")?;
|
||||
state_db
|
||||
.delete_thread_section(¶ms.section_id)
|
||||
.await
|
||||
.map_err(|err| section_error("delete", err))
|
||||
}
|
||||
|
||||
fn state_db<'store>(
|
||||
store: &'store LocalThreadStore,
|
||||
operation: &'static str,
|
||||
) -> ThreadStoreResult<&'store StateDbHandle> {
|
||||
store
|
||||
.state_db
|
||||
.as_ref()
|
||||
.ok_or(ThreadStoreError::Unsupported { operation })
|
||||
}
|
||||
|
||||
fn section_error(operation: &str, error: impl std::fmt::Display) -> ThreadStoreError {
|
||||
ThreadStoreError::Internal {
|
||||
message: format!("failed to {operation} thread section: {error}"),
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[path = "thread_sections_tests.rs"]
|
||||
mod tests;
|
||||
Reference in New Issue
Block a user