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:
parent
cfddb55ed9
commit
f390fa1617
11 changed files with 72 additions and 165 deletions
|
|
@ -8,7 +8,6 @@ pub mod context;
|
|||
pub mod subconscious;
|
||||
pub mod unconscious;
|
||||
pub mod thalamus;
|
||||
pub mod ui_channel;
|
||||
|
||||
use anyhow::Result;
|
||||
use ratatui::crossterm::event::{Event, EventStream, KeyEventKind};
|
||||
|
|
@ -30,7 +29,33 @@ use ratatui::{
|
|||
};
|
||||
use std::io;
|
||||
|
||||
use crate::user::ui_channel::{ContextInfo, SharedContextState, StatusInfo};
|
||||
use crate::agent::context::SharedContextState;
|
||||
|
||||
/// Status info for the bottom status bar.
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct StatusInfo {
|
||||
pub dmn_state: String,
|
||||
pub dmn_turns: u32,
|
||||
pub dmn_max_turns: u32,
|
||||
pub prompt_tokens: u32,
|
||||
pub completion_tokens: u32,
|
||||
pub model: String,
|
||||
pub turn_tools: u32,
|
||||
pub context_budget: String,
|
||||
}
|
||||
|
||||
/// Context loading details for the debug screen.
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct ContextInfo {
|
||||
pub model: String,
|
||||
pub available_models: Vec<String>,
|
||||
pub prompt_file: String,
|
||||
pub backend: String,
|
||||
pub instruction_files: Vec<(String, usize)>,
|
||||
pub memory_files: Vec<(String, usize)>,
|
||||
pub system_prompt_chars: usize,
|
||||
pub context_message_chars: usize,
|
||||
}
|
||||
|
||||
/// Build the screen legend from screen labels.
|
||||
pub(crate) fn screen_legend_from(interact: &dyn ScreenView, screens: &[Box<dyn ScreenView>]) -> String {
|
||||
|
|
@ -100,7 +125,7 @@ pub struct App {
|
|||
pub temperature: f32,
|
||||
pub top_p: f32,
|
||||
pub top_k: u32,
|
||||
pub(crate) active_tools: crate::user::ui_channel::SharedActiveTools,
|
||||
pub(crate) active_tools: crate::agent::tools::SharedActiveTools,
|
||||
pub should_quit: bool,
|
||||
pub submitted: Vec<String>,
|
||||
pub hotkey_actions: Vec<HotkeyAction>,
|
||||
|
|
@ -112,7 +137,7 @@ pub struct App {
|
|||
}
|
||||
|
||||
impl App {
|
||||
pub fn new(model: String, shared_context: SharedContextState, active_tools: crate::user::ui_channel::SharedActiveTools) -> Self {
|
||||
pub fn new(model: String, shared_context: SharedContextState, active_tools: crate::agent::tools::SharedActiveTools) -> Self {
|
||||
Self {
|
||||
status: StatusInfo {
|
||||
dmn_state: "resting".into(), dmn_turns: 0, dmn_max_turns: 20,
|
||||
|
|
@ -189,11 +214,10 @@ pub async fn start(cli: crate::user::CliArgs) -> Result<()> {
|
|||
unsafe { std::env::set_var("POC_DEBUG", "1") };
|
||||
}
|
||||
|
||||
let (ui_tx, ui_rx) = ui_channel::channel();
|
||||
let (turn_tx, turn_rx) = tokio::sync::mpsc::channel(1);
|
||||
let (mind_tx, mind_rx) = tokio::sync::mpsc::unbounded_channel();
|
||||
|
||||
let mind = crate::mind::Mind::new(config, ui_tx.clone(), turn_tx);
|
||||
let mind = crate::mind::Mind::new(config, turn_tx);
|
||||
|
||||
let shared_context = mind.agent.lock().await.shared_context.clone();
|
||||
let shared_active_tools = mind.agent.lock().await.active_tools.clone();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue