Fix compilation errors in Layer 4 caching

- Remove unused RelationshipInference import from base.rs
- Add Parse error variant to MemoryError enum
- Replace num_minutes() with num_seconds() / 60 (chrono compatibility)

Fixes compatibility with different chrono versions.
This commit is contained in:
Claude
2025-11-06 10:02:27 +00:00
parent 2579312029
commit 49f41c1b44
3 changed files with 6 additions and 3 deletions

View File

@@ -19,6 +19,9 @@ pub enum MemoryError {
#[error("Configuration error: {0}")] #[error("Configuration error: {0}")]
Config(String), Config(String),
#[error("Parse error: {0}")]
Parse(String),
} }
pub type Result<T> = std::result::Result<T, MemoryError>; pub type Result<T> = std::result::Result<T, MemoryError>;

View File

@@ -530,7 +530,7 @@ impl MemoryStore {
.map_err(|e| MemoryError::Parse(e.to_string()))? .map_err(|e| MemoryError::Parse(e.to_string()))?
.with_timezone(&Utc); .with_timezone(&Utc);
let age_minutes = (Utc::now() - cached_at).num_minutes(); let age_minutes = (Utc::now() - cached_at).num_seconds() / 60;
if age_minutes < Self::RELATIONSHIP_CACHE_DURATION_MINUTES { if age_minutes < Self::RELATIONSHIP_CACHE_DURATION_MINUTES {
let relationship: super::relationship::RelationshipInference = let relationship: super::relationship::RelationshipInference =
@@ -582,7 +582,7 @@ impl MemoryStore {
.map_err(|e| MemoryError::Parse(e.to_string()))? .map_err(|e| MemoryError::Parse(e.to_string()))?
.with_timezone(&Utc); .with_timezone(&Utc);
let age_minutes = (Utc::now() - cached_at).num_minutes(); let age_minutes = (Utc::now() - cached_at).num_seconds() / 60;
if age_minutes < Self::RELATIONSHIP_CACHE_DURATION_MINUTES { if age_minutes < Self::RELATIONSHIP_CACHE_DURATION_MINUTES {
let relationships: Vec<super::relationship::RelationshipInference> = let relationships: Vec<super::relationship::RelationshipInference> =

View File

@@ -2,7 +2,7 @@ use anyhow::Result;
use serde_json::{json, Value}; use serde_json::{json, Value};
use std::io::{self, BufRead, Write}; use std::io::{self, BufRead, Write};
use crate::core::{Memory, MemoryStore, UserAnalysis, RelationshipInference, infer_all_relationships, get_relationship}; use crate::core::{Memory, MemoryStore, UserAnalysis, infer_all_relationships, get_relationship};
pub struct BaseMCPServer { pub struct BaseMCPServer {
store: MemoryStore, store: MemoryStore,