Clean up unused imports, dead code, and compiler warnings
Remove unused StoreView imports, unused store imports, dead install_default_file, dead make_report_slug, dead fact-mine/ experience-mine spawning loops in daemon. Fix mut warnings. Zero compiler warnings now.
This commit is contained in:
parent
6932e05b38
commit
7a24d84ce3
11 changed files with 11 additions and 82 deletions
|
|
@ -626,7 +626,7 @@ pub fn run_daemon() -> Result<(), String> {
|
|||
// already mined, check task registry for what's in-flight, spawn the diff.
|
||||
// No persistent tracking state — the store is the source of truth.
|
||||
let choir_sw = Arc::clone(&choir);
|
||||
let llm_sw = Arc::clone(&llm);
|
||||
let _llm_sw = Arc::clone(&llm); // kept for future use
|
||||
let last_daily_sw = Arc::clone(&last_daily);
|
||||
let graph_health_sw = Arc::clone(&graph_health);
|
||||
choir.spawn("session-watcher").init(move |ctx| {
|
||||
|
|
@ -703,9 +703,9 @@ pub fn run_daemon() -> Result<(), String> {
|
|||
}).unwrap_or_default()
|
||||
};
|
||||
|
||||
let mut extract_queued = 0;
|
||||
let mut extract_remaining = 0;
|
||||
let mut fact_remaining = 0;
|
||||
let _extract_queued = 0usize;
|
||||
let mut _extract_remaining = 0usize;
|
||||
let mut _fact_remaining = 0usize;
|
||||
let mut already_mined = 0;
|
||||
let mut still_open = 0;
|
||||
let mut backed_off = 0;
|
||||
|
|
@ -856,44 +856,12 @@ pub fn run_daemon() -> Result<(), String> {
|
|||
}
|
||||
}
|
||||
|
||||
// Spawn experience-mine jobs (priority)
|
||||
for (task_label, path_str, segment) in &needs_extract {
|
||||
if extract_queued >= MAX_NEW_PER_TICK {
|
||||
extract_remaining += 1;
|
||||
continue;
|
||||
}
|
||||
let task_name = format!("extract:{}", task_label);
|
||||
log_event("extract", "queued", &task_name);
|
||||
let path = path_str.clone();
|
||||
let seg = *segment;
|
||||
// experience_mine killed — observation.agent handles transcript mining
|
||||
extract_queued += 1;
|
||||
}
|
||||
// experience_mine and fact_mine killed — observation.agent handles transcript mining
|
||||
_extract_remaining = needs_extract.len();
|
||||
_fact_remaining = needs_fact.len();
|
||||
|
||||
// Only queue fact-mine when experience backlog is clear
|
||||
needs_fact.sort_by_key(|(_, path_str)| {
|
||||
fs::metadata(path_str).map(|m| m.len()).unwrap_or(u64::MAX)
|
||||
});
|
||||
let mut fact_queued = 0;
|
||||
if needs_extract.len() == extract_queued {
|
||||
let fact_budget = MAX_NEW_PER_TICK.saturating_sub(extract_queued);
|
||||
for (filename, path_str) in &needs_fact {
|
||||
if fact_queued >= fact_budget {
|
||||
fact_remaining += 1;
|
||||
continue;
|
||||
}
|
||||
let task_name = format!("fact-mine:{}", filename);
|
||||
log_event("fact-mine", "queued", path_str);
|
||||
let path = path_str.clone();
|
||||
// fact_mine killed — observation.agent handles transcript mining
|
||||
fact_queued += 1;
|
||||
}
|
||||
} else {
|
||||
fact_remaining = needs_fact.len();
|
||||
}
|
||||
|
||||
let extract_pending = extract_queued + extract_remaining;
|
||||
let fact_pending = fact_queued + fact_remaining;
|
||||
let extract_pending = _extract_queued + _extract_remaining;
|
||||
let fact_pending = _fact_remaining;
|
||||
if extract_pending > 0 || fact_pending > 0 || still_open > 0 || backed_off > 0 {
|
||||
log_event("session-watcher", "tick",
|
||||
&format!("{} stale, {} mined, {} extract, {} fact, {} open, {} backoff",
|
||||
|
|
|
|||
|
|
@ -18,24 +18,6 @@ use std::path::PathBuf;
|
|||
// Agent execution
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// Extract a short slug from agent output for human-readable report keys.
|
||||
fn make_report_slug(output: &str) -> String {
|
||||
let line = output.lines()
|
||||
.map(|l| l.trim())
|
||||
.find(|l| !l.is_empty() && !l.starts_with('#') && !l.starts_with("```") && !l.starts_with("---"))
|
||||
.unwrap_or("");
|
||||
let clean: String = line.replace("**", "").replace('*', "");
|
||||
let filtered: String = clean.chars()
|
||||
.map(|c| if c.is_alphanumeric() || c == ' ' || c == '-' { c } else { ' ' })
|
||||
.collect();
|
||||
let slug: String = filtered.split_whitespace()
|
||||
.take(6)
|
||||
.collect::<Vec<_>>()
|
||||
.join("-")
|
||||
.to_lowercase();
|
||||
if slug.len() > 60 { slug[..60].to_string() } else { slug }
|
||||
}
|
||||
|
||||
/// Result of running a single agent.
|
||||
pub struct AgentResult {
|
||||
pub output: String,
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ fn call_model_with_tools(agent: &str, model: &str, prompt: &str,
|
|||
|
||||
let start = std::time::Instant::now();
|
||||
|
||||
let mut child = unsafe {
|
||||
let child = unsafe {
|
||||
cmd.pre_exec(|| {
|
||||
libc::prctl(libc::PR_SET_PDEATHSIG, libc::SIGTERM);
|
||||
Ok(())
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ fn install_default_file(data_dir: &std::path::Path, name: &str, content: &str) -
|
|||
Ok(())
|
||||
}
|
||||
|
||||
use crate::store::StoreView;
|
||||
|
||||
pub fn cmd_init() -> Result<(), String> {
|
||||
let cfg = crate::config::get();
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
// cli/agent.rs — agent subcommand handlers
|
||||
|
||||
use crate::store;
|
||||
use crate::store::StoreView;
|
||||
use crate::agents::llm;
|
||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
|
||||
pub fn cmd_run_agent(agent: &str, count: usize, target: &[String], dry_run: bool, debug: bool) -> Result<(), String> {
|
||||
if dry_run {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@
|
|||
// trace, spectral-*, organize, interference.
|
||||
|
||||
use crate::{store, graph, neuro, spectral};
|
||||
use crate::store::StoreView;
|
||||
|
||||
pub fn cmd_graph() -> Result<(), String> {
|
||||
let store = store::Store::load()?;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
// cli/journal.rs — journal subcommand handlers
|
||||
|
||||
use crate::store;
|
||||
use crate::store::StoreView;
|
||||
|
||||
pub fn cmd_tail(n: usize, full: bool) -> Result<(), String> {
|
||||
let path = crate::store::nodes_path();
|
||||
|
|
|
|||
|
|
@ -1,10 +1,7 @@
|
|||
// cli/misc.rs — misc subcommand handlers
|
||||
|
||||
use crate::store;
|
||||
use crate::store::StoreView;
|
||||
|
||||
pub fn cmd_search(terms: &[String], pipeline_args: &[String], expand: bool, full: bool, debug: bool, fuzzy: bool, content: bool) -> Result<(), String> {
|
||||
use crate::store::StoreView;
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
// Parse pipeline stages (unified: algorithms, filters, transforms, generators)
|
||||
|
|
@ -71,6 +68,7 @@ pub fn cmd_search(terms: &[String], pipeline_args: &[String], expand: bool, full
|
|||
}
|
||||
} else {
|
||||
// Fast MmapView path — algorithm-only pipeline
|
||||
use crate::store::StoreView;
|
||||
let view = crate::store::AnyView::load()?;
|
||||
let graph = crate::graph::build_graph_fast(&view);
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
// dump-json, lookup-bump, lookups.
|
||||
|
||||
use crate::store;
|
||||
use crate::store::StoreView;
|
||||
|
||||
pub fn cmd_used(key: &[String]) -> Result<(), String> {
|
||||
if key.is_empty() {
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@
|
|||
// This is the beginning of place cells — the hippocampus doesn't just
|
||||
// store, it maintains a map. The cursor is the map's current position.
|
||||
|
||||
use crate::graph::Graph;
|
||||
use crate::store::{self, Node, Store};
|
||||
|
||||
use std::path::PathBuf;
|
||||
|
|
@ -47,7 +46,6 @@ pub fn clear() -> Result<(), String> {
|
|||
pub fn temporal_neighbors(store: &Store, key: &str) -> (Option<String>, Option<String>) {
|
||||
let Some(node) = store.nodes.get(key) else { return (None, None) };
|
||||
let node_type = node.node_type;
|
||||
let ts = node.timestamp;
|
||||
|
||||
let mut same_type: Vec<(&str, i64)> = store.nodes.iter()
|
||||
.filter(|(_, n)| !n.deleted && n.node_type == node_type && n.timestamp > 0)
|
||||
|
|
|
|||
|
|
@ -856,16 +856,6 @@ fn main() {
|
|||
|
||||
// ── Command implementations ─────────────────────────────────────────
|
||||
|
||||
fn install_default_file(data_dir: &std::path::Path, name: &str, content: &str) -> Result<(), String> {
|
||||
let path = data_dir.join(name);
|
||||
if !path.exists() {
|
||||
std::fs::write(&path, content)
|
||||
.map_err(|e| format!("write {}: {}", name, e))?;
|
||||
println!("Created {}", path.display());
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Apply links from a single agent result JSON file.
|
||||
/// Returns (links_applied, errors).
|
||||
fn apply_agent_file(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue