Delete ui_channel.rs — relocate types, remove all UiMessage/UiSender plumbing

Types relocated:
- StreamTarget → mind/mod.rs (Mind decides Conversation vs Autonomous)
- SharedActiveTools + shared_active_tools() → agent/tools/mod.rs
- ContextSection + SharedContextState → agent/context.rs (already there)
- StatusInfo + ContextInfo → user/mod.rs (UI display state)

Removed UiSender from: Agent::turn, Mind, learn.rs, all function signatures.
The entire message-passing layer is gone. All state flows through
Agent fields (activities, entries, streaming) read by the UI via try_lock.

Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
ProofOfConcept 2026-04-05 22:34:48 -04:00
parent cfddb55ed9
commit f390fa1617
11 changed files with 72 additions and 165 deletions

View file

@ -17,7 +17,6 @@
use crate::agent::api::ApiClient;
use crate::agent::api::types::*;
use crate::agent::context::{ConversationEntry, ContextState};
use crate::user::ui_channel::UiSender;
const SCORE_TIMEOUT: std::time::Duration = std::time::Duration::from_secs(120);
@ -181,7 +180,6 @@ impl MemoryScore {
pub async fn score_memories(
context: &ContextState,
client: &ApiClient,
ui_tx: &UiSender,
) -> anyhow::Result<MemoryScore> {
let mut memory_keys: Vec<String> = context.entries.iter()
.filter_map(|e| match e {
@ -272,7 +270,6 @@ pub async fn score_memory(
context: &ContextState,
key: &str,
client: &ApiClient,
ui_tx: &UiSender,
) -> anyhow::Result<f64> {
const RESPONSE_WINDOW: usize = 50;
@ -309,7 +306,6 @@ pub async fn score_memories_incremental(
max_age_secs: i64,
response_window: usize,
client: &ApiClient,
ui_tx: &UiSender,
agent: &std::sync::Arc<tokio::sync::Mutex<crate::agent::Agent>>,
) -> anyhow::Result<Vec<(String, f64)>> {
let now = chrono::Utc::now().timestamp();
@ -387,7 +383,6 @@ pub async fn score_finetune(
context: &ContextState,
count: usize,
client: &ApiClient,
ui_tx: &UiSender,
) -> anyhow::Result<Vec<(usize, f64)>> {
let range = context.entries.len().saturating_sub(count)..context.entries.len();