#[cfg(test)]
pub mod bench;
pub mod clock;
pub mod config;
pub mod context;
pub mod decay;
pub mod embedding;
pub mod error;
pub mod index;
pub mod judge;
pub mod profile;
pub mod retrieval;
pub mod salience;
pub mod store;
pub mod tokens;
#[allow(unused_imports)]
pub use error::{EmbeddingError, MemoryError};
#[allow(unused_imports)]
pub use retrieval::{recall, RankedMemory};
#[allow(unused_imports)]
pub use context::{assemble_selective, AssembledContext};
#[allow(dead_code)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum MemoryKind {
Episodic,
Preference,
}
impl MemoryKind {
#[allow(dead_code)]
pub fn as_str(&self) -> &'static str {
match self {
MemoryKind::Episodic => "episodic",
MemoryKind::Preference => "preference",
}
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_memory_kind_serializes_to_stable_strings() {
assert_eq!(MemoryKind::Episodic.as_str(), "episodic");
assert_eq!(MemoryKind::Preference.as_str(), "preference");
}
#[test]
fn test_embedding_error_converts_into_memory_error_and_formats() {
fn lift() -> Result<(), MemoryError> {
Err(EmbeddingError::Auth)?;
Ok(())
}
let e = lift().unwrap_err();
assert!(matches!(e, MemoryError::Embedding(EmbeddingError::Auth)));
assert_eq!(
e.to_string(),
"embedding error: embedding auth failed (401/403)"
);
}
#[test]
fn test_rate_limited_variant_formats() {
assert_eq!(
EmbeddingError::RateLimited.to_string(),
"embedding rate-limited (429)"
);
}
}