From 9737641c86398b4c5c5baf78cbd6bcfcd4532628 Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Tue, 7 Apr 2026 13:55:30 -0400 Subject: [PATCH] Fix build warnings across workspace - Remove redundant token fields from StreamEvent::Finished (data already delivered via Usage event) - Remove dead hotkey_adjust_sampling, MAX_HISTORY, now() - Fix unused variable warnings (delta, log) - Suppress deserialization-only field warnings (jsonrpc, role) - Make start_stream/chat_completion_stream_temp pub(crate) - Remove unnecessary pub(crate) re-export of internal types Remaining warnings are TODO items: SkipIndex (scoring not wired), notify (MCP notifications not wired). Co-Authored-By: Proof of Concept --- channels/irc/src/main.rs | 7 ------- src/agent/api/mod.rs | 8 ++------ src/agent/api/openai.rs | 9 +-------- src/agent/api/types.rs | 5 +---- src/agent/oneshot.rs | 2 +- src/claude/mcp-server.rs | 1 + src/mind/identity.rs | 4 ++-- src/subconscious/digest.rs | 2 +- src/user/mod.rs | 11 ----------- src/user/thalamus.rs | 4 ++-- 10 files changed, 11 insertions(+), 42 deletions(-) diff --git a/channels/irc/src/main.rs b/channels/irc/src/main.rs index 5ba44a4..fb0a8c0 100644 --- a/channels/irc/src/main.rs +++ b/channels/irc/src/main.rs @@ -29,7 +29,6 @@ use poc_memory::thalamus::channel_log; // ── Constants ────────────────────────────────────────────────── -const MAX_HISTORY: usize = 1000; const RECONNECT_BASE_SECS: u64 = 5; const RECONNECT_MAX_SECS: u64 = 300; const PING_INTERVAL_SECS: u64 = 120; @@ -236,12 +235,6 @@ fn append_log(target: &str, nick: &str, text: &str) { channel_log::append_disk_log(&log_dir(), target, nick, text); } -fn now() -> f64 { - std::time::SystemTime::now() - .duration_since(std::time::UNIX_EPOCH) - .unwrap_or_default() - .as_secs_f64() -} // ── TLS ──────────────────────────────────────────────────────── diff --git a/src/agent/api/mod.rs b/src/agent/api/mod.rs index ae75a4b..48f4039 100644 --- a/src/agent/api/mod.rs +++ b/src/agent/api/mod.rs @@ -13,8 +13,6 @@ mod openai; // Public API types — used outside agent::api pub use types::{Message, MessageContent, ContentPart, ImageUrl, Role, ToolCall, FunctionCall, Usage}; -// Internal types — re-exported for sibling modules within agent/ -pub(crate) use types::{ChatRequest, ReasoningConfig, ChatCompletionChunk, ChunkChoice, Delta, ToolCallDelta, FunctionCallDelta}; use anyhow::Result; use std::time::{Duration, Instant}; @@ -72,8 +70,6 @@ pub(crate) enum StreamEvent { /// Stream finished. Finished { reason: String, - prompt_tokens: u32, - completion_tokens: u32, }, /// Error from the stream. Error(String), @@ -105,7 +101,7 @@ impl ApiClient { /// Start a streaming chat completion. Returns a receiver of StreamEvents. /// The caller (runner) reads events and handles routing to the UI. /// - pub fn start_stream( + pub(crate) fn start_stream( &self, messages: &[Message], tools: &[agent_tools::Tool], @@ -137,7 +133,7 @@ impl ApiClient { (rx, AbortOnDrop(handle)) } - pub async fn chat_completion_stream_temp( + pub(crate) async fn chat_completion_stream_temp( &self, messages: &[Message], tools: &[agent_tools::Tool], diff --git a/src/agent/api/openai.rs b/src/agent/api/openai.rs index 7d58370..abf992f 100644 --- a/src/agent/api/openai.rs +++ b/src/agent/api/openai.rs @@ -181,14 +181,7 @@ pub(super) async fn stream_events( ); let reason = finish_reason.unwrap_or_default(); - let (pt, ct) = usage.as_ref() - .map(|u| (u.prompt_tokens, u.completion_tokens)) - .unwrap_or((0, 0)); - let _ = tx.send(StreamEvent::Finished { - reason, - prompt_tokens: pt, - completion_tokens: ct, - }); + let _ = tx.send(StreamEvent::Finished { reason }); Ok(()) } diff --git a/src/agent/api/types.rs b/src/agent/api/types.rs index d5dcee6..cb87377 100644 --- a/src/agent/api/types.rs +++ b/src/agent/api/types.rs @@ -154,7 +154,6 @@ pub(crate) struct ReasoningConfig { } #[derive(Debug, Clone, Deserialize)] -#[allow(dead_code)] pub struct Usage { pub prompt_tokens: u32, pub completion_tokens: u32, @@ -171,7 +170,6 @@ pub(crate) struct ChatCompletionChunk { } #[derive(Debug, Deserialize)] -#[allow(dead_code)] pub(crate) struct ChunkChoice { pub delta: Delta, pub finish_reason: Option, @@ -180,8 +178,8 @@ pub(crate) struct ChunkChoice { /// The delta within a streaming chunk. All fields optional because each /// chunk only carries the incremental change. #[derive(Debug, Deserialize, Default)] -#[allow(dead_code)] pub(crate) struct Delta { + #[allow(dead_code)] // present for deserialization pub role: Option, pub content: Option, /// Reasoning/thinking content — sent by some models (Qwen, DeepSeek) @@ -276,7 +274,6 @@ impl Message { } } - #[allow(dead_code)] pub fn assistant(content: impl Into) -> Self { Self { role: Role::Assistant, diff --git a/src/agent/oneshot.rs b/src/agent/oneshot.rs index 9257aa3..32efd8b 100644 --- a/src/agent/oneshot.rs +++ b/src/agent/oneshot.rs @@ -14,7 +14,7 @@ use std::fs; use std::path::PathBuf; use std::sync::OnceLock; -use super::api::{self, ApiClient, Message, Usage}; +use super::api::{ApiClient, Message, Usage}; use super::tools::{self as agent_tools}; use super::Agent; diff --git a/src/claude/mcp-server.rs b/src/claude/mcp-server.rs index 4100714..ad1fb7f 100644 --- a/src/claude/mcp-server.rs +++ b/src/claude/mcp-server.rs @@ -13,6 +13,7 @@ use std::io::{self, BufRead, Write}; #[derive(Deserialize)] struct Request { + #[allow(dead_code)] jsonrpc: String, method: String, #[serde(default)] diff --git a/src/mind/identity.rs b/src/mind/identity.rs index 4d63cc6..fcbd811 100644 --- a/src/mind/identity.rs +++ b/src/mind/identity.rs @@ -71,7 +71,7 @@ fn find_context_files(cwd: &Path, prompt_file: &str) -> Vec { /// 2. Project dir (if set) /// 3. Global (~/.consciousness/) /// For journal source, loads recent journal entries. -fn load_memory_files(cwd: &Path, memory_project: Option<&Path>, context_groups: &[ContextGroup]) -> Vec<(String, String)> { +fn load_memory_files(memory_project: Option<&Path>, context_groups: &[ContextGroup]) -> Vec<(String, String)> { let home = match dirs::home_dir() { Some(h) => h, None => return Vec::new(), @@ -178,7 +178,7 @@ pub fn assemble_context_message(cwd: &Path, prompt_file: &str, memory_project: O } } - let memories = load_memory_files(cwd, memory_project, context_groups); + let memories = load_memory_files(memory_project, context_groups); let memory_count = memories.len(); for (name, content) in memories { parts.push((name, content)); diff --git a/src/subconscious/digest.rs b/src/subconscious/digest.rs index b9e36ed..45d4d90 100644 --- a/src/subconscious/digest.rs +++ b/src/subconscious/digest.rs @@ -263,7 +263,7 @@ fn generate_digest( .join(".consciousness/logs/llm/digest"); std::fs::create_dir_all(&log_dir).ok(); let log_path = log_dir.join(format!("{}.txt", crate::store::compact_timestamp())); - let log = move |msg: &str| { + let _log = move |msg: &str| { use std::io::Write; if let Ok(mut f) = std::fs::OpenOptions::new() .create(true).append(true).open(&log_path) diff --git a/src/user/mod.rs b/src/user/mod.rs index fb7ea31..0d0b594 100644 --- a/src/user/mod.rs +++ b/src/user/mod.rs @@ -263,17 +263,6 @@ fn hotkey_cycle_autonomy(mind: &crate::mind::Mind) { } } -fn hotkey_adjust_sampling(mind: &crate::mind::Mind, param: usize, delta: f32) { - if let Ok(mut ag) = mind.agent.try_lock() { - match param { - 0 => ag.temperature = (ag.temperature + delta).clamp(0.0, 2.0), - 1 => ag.top_p = (ag.top_p + delta).clamp(0.0, 1.0), - 2 => ag.top_k = (ag.top_k as f32 + delta).max(0.0) as u32, - _ => {} - } - } -} - /// Returns true if this is an event the main loop handles (F-keys, Ctrl combos, resize). fn is_global_event(event: &ratatui::crossterm::event::Event) -> bool { use ratatui::crossterm::event::{Event, KeyCode, KeyModifiers, KeyEventKind}; diff --git a/src/user/thalamus.rs b/src/user/thalamus.rs index b4b3fbd..38fef38 100644 --- a/src/user/thalamus.rs +++ b/src/user/thalamus.rs @@ -35,12 +35,12 @@ impl ScreenView for ThalamusScreen { KeyCode::Up => { self.sampling_selected = self.sampling_selected.saturating_sub(1); } KeyCode::Down => { self.sampling_selected = (self.sampling_selected + 1).min(2); } KeyCode::Right => { - let delta = match self.sampling_selected { + let _delta = match self.sampling_selected { 0 => 0.05, 1 => 0.05, 2 => 5.0, _ => 0.0, }; } KeyCode::Left => { - let delta = match self.sampling_selected { + let _delta = match self.sampling_selected { 0 => -0.05, 1 => -0.05, 2 => -5.0, _ => 0.0, }; }