tighten module interfaces: explicit re-exports, private helpers, inline dedup

- Replace `pub use types::*` in store/mod.rs with explicit re-export list
- Make transcript_dedup_key private in agents/enrich.rs (only used internally)
- Inline duplicated projects_dir() helper in agents/knowledge.rs and daemon.rs
This commit is contained in:
ProofOfConcept 2026-03-08 21:36:47 -04:00
parent cee9b76a7b
commit 7c491e92eb
4 changed files with 10 additions and 12 deletions

View file

@ -34,10 +34,6 @@ fn log_path() -> PathBuf {
crate::config::get().data_dir.join(log_file()) crate::config::get().data_dir.join(log_file())
} }
fn projects_dir() -> PathBuf {
crate::config::get().projects_dir.clone()
}
// --- Logging --- // --- Logging ---
const LOG_MAX_BYTES: u64 = 1_000_000; // 1MB, then truncate to last half const LOG_MAX_BYTES: u64 = 1_000_000; // 1MB, then truncate to last half
@ -181,7 +177,7 @@ fn job_daily_check(ctx: &ExecutionContext) -> Result<(), TaskError> {
const MIN_SESSION_BYTES: u64 = 100_000; const MIN_SESSION_BYTES: u64 = 100_000;
fn find_stale_sessions() -> Vec<PathBuf> { fn find_stale_sessions() -> Vec<PathBuf> {
let projects = projects_dir(); let projects = crate::config::get().projects_dir.clone();
if !projects.exists() { if !projects.exists() {
return Vec::new(); return Vec::new();
} }

View file

@ -22,7 +22,7 @@ use crate::util::parse_timestamp_to_epoch;
/// Compute the store dedup key for a transcript file. /// Compute the store dedup key for a transcript file.
/// This is the same key experience_mine uses to mark a transcript as mined. /// This is the same key experience_mine uses to mark a transcript as mined.
pub fn transcript_dedup_key(path: &str) -> Result<String, String> { fn transcript_dedup_key(path: &str) -> Result<String, String> {
let bytes = fs::read(path).map_err(|e| format!("read {}: {}", path, e))?; let bytes = fs::read(path).map_err(|e| format!("read {}: {}", path, e))?;
let mut hasher = DefaultHasher::new(); let mut hasher = DefaultHasher::new();
bytes.hash(&mut hasher); bytes.hash(&mut hasher);

View file

@ -21,10 +21,6 @@ use std::collections::{HashMap, HashSet};
use std::fs; use std::fs;
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
fn projects_dir() -> PathBuf {
crate::config::get().projects_dir.clone()
}
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// Action types // Action types
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@ -420,7 +416,7 @@ fn count_dialogue_turns(path: &Path) -> usize {
/// Select conversation fragments for the observation extractor /// Select conversation fragments for the observation extractor
fn select_conversation_fragments(n: usize) -> Vec<(String, String)> { fn select_conversation_fragments(n: usize) -> Vec<(String, String)> {
let projects = projects_dir(); let projects = crate::config::get().projects_dir.clone();
if !projects.exists() { return Vec::new(); } if !projects.exists() { return Vec::new(); }
let mut jsonl_files: Vec<PathBuf> = Vec::new(); let mut jsonl_files: Vec<PathBuf> = Vec::new();

View file

@ -26,7 +26,13 @@ mod persist;
mod ops; mod ops;
// Re-export everything callers need // Re-export everything callers need
pub use types::*; pub use types::{
memory_dir, nodes_path,
now_epoch, epoch_to_local, format_date, format_datetime, format_datetime_space, today,
Node, Relation, NodeType, Provenance, RelationType,
RetrievalEvent, Params, GapRecord, Store,
new_node, new_relation,
};
pub use parse::{MemoryUnit, parse_units}; pub use parse::{MemoryUnit, parse_units};
pub use view::{StoreView, AnyView}; pub use view::{StoreView, AnyView};
pub use persist::fsck; pub use persist::fsck;