Remove dead code: append_text, needs_assistant_marker, target param
append_text was the TextDelta streaming handler — replaced by append_streaming on Agent entries. needs_assistant_marker tracked turn boundaries for the old message path. target removed from Agent::turn — routing now determined by entry content. Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
parent
f390fa1617
commit
36d698a3e1
4 changed files with 3 additions and 37 deletions
|
|
@ -178,7 +178,7 @@ pub struct Agent {
|
|||
/// TODO: move to Session — it's session-level, not agent-level.
|
||||
pub agent_cycles: crate::subconscious::subconscious::AgentCycleState,
|
||||
/// Shared active tools — Agent writes, TUI reads.
|
||||
pub active_tools: crate::agent::tools::SharedActiveTools,
|
||||
pub active_tools: tools::SharedActiveTools,
|
||||
}
|
||||
|
||||
fn render_journal(entries: &[context::JournalEntry]) -> String {
|
||||
|
|
@ -326,7 +326,6 @@ impl Agent {
|
|||
pub async fn turn(
|
||||
agent: Arc<tokio::sync::Mutex<Agent>>,
|
||||
user_input: &str,
|
||||
target: StreamTarget,
|
||||
) -> Result<TurnResult> {
|
||||
// --- Pre-loop setup (lock 1): agent cycle, memories, user input ---
|
||||
let active_tools = {
|
||||
|
|
@ -567,7 +566,7 @@ impl Agent {
|
|||
/// Used by `turn()` which manages its own locking.
|
||||
async fn dispatch_tool_call_unlocked(
|
||||
agent: &Arc<tokio::sync::Mutex<Agent>>,
|
||||
active_tools: &crate::agent::tools::SharedActiveTools,
|
||||
active_tools: &tools::SharedActiveTools,
|
||||
call: &ToolCall,
|
||||
ds: &mut DispatchState,
|
||||
) {
|
||||
|
|
|
|||
|
|
@ -310,7 +310,7 @@ impl Mind {
|
|||
let agent = self.agent.clone();
|
||||
let result_tx = self.turn_tx.clone();
|
||||
self.shared.lock().unwrap().turn_handle = Some(tokio::spawn(async move {
|
||||
let result = Agent::turn(agent, &input, target).await;
|
||||
let result = Agent::turn(agent, &input).await;
|
||||
let _ = result_tx.send((result, target)).await;
|
||||
}));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -222,15 +222,6 @@ fn strip_ansi(text: &str) -> String {
|
|||
out
|
||||
}
|
||||
|
||||
fn is_zero_width(ch: char) -> bool {
|
||||
matches!(ch,
|
||||
'\u{200B}'..='\u{200F}' |
|
||||
'\u{2028}'..='\u{202F}' |
|
||||
'\u{2060}'..='\u{2069}' |
|
||||
'\u{FEFF}'
|
||||
)
|
||||
}
|
||||
|
||||
fn new_textarea(lines: Vec<String>) -> tui_textarea::TextArea<'static> {
|
||||
let mut ta = tui_textarea::TextArea::new(lines);
|
||||
ta.set_cursor_line_style(Style::default());
|
||||
|
|
@ -287,27 +278,6 @@ impl PaneState {
|
|||
}
|
||||
}
|
||||
|
||||
fn append_text(&mut self, text: &str) {
|
||||
let clean = strip_ansi(text);
|
||||
if self.use_markdown {
|
||||
self.md_buffer.push_str(&clean);
|
||||
} else {
|
||||
for ch in clean.chars() {
|
||||
if ch == '\n' {
|
||||
let line = std::mem::take(&mut self.current_line);
|
||||
self.lines.push(Line::styled(line, Style::default().fg(self.current_color)));
|
||||
self.markers.push(Marker::None);
|
||||
} else if ch == '\t' {
|
||||
self.current_line.push_str(" ");
|
||||
} else if ch.is_control() || is_zero_width(ch) {
|
||||
} else {
|
||||
self.current_line.push(ch);
|
||||
}
|
||||
}
|
||||
}
|
||||
self.evict();
|
||||
}
|
||||
|
||||
fn flush_pending(&mut self) {
|
||||
if self.use_markdown && !self.md_buffer.is_empty() {
|
||||
let parsed = parse_markdown(&self.md_buffer);
|
||||
|
|
@ -385,7 +355,6 @@ pub(crate) struct InteractScreen {
|
|||
history_index: Option<usize>,
|
||||
active_pane: ActivePane,
|
||||
pane_areas: [Rect; 3],
|
||||
needs_assistant_marker: bool,
|
||||
turn_started: Option<std::time::Instant>,
|
||||
call_started: Option<std::time::Instant>,
|
||||
call_timeout_secs: u64,
|
||||
|
|
@ -414,7 +383,6 @@ impl InteractScreen {
|
|||
history_index: None,
|
||||
active_pane: ActivePane::Conversation,
|
||||
pane_areas: [Rect::default(); 3],
|
||||
needs_assistant_marker: false,
|
||||
turn_started: None,
|
||||
call_started: None,
|
||||
call_timeout_secs: 60,
|
||||
|
|
|
|||
|
|
@ -345,7 +345,6 @@ pub async fn run(
|
|||
) -> Result<()> {
|
||||
let agent = &mind.agent;
|
||||
let shared_mind = &mind.shared;
|
||||
let turn_watch = mind.turn_watch();
|
||||
// UI-owned state
|
||||
let mut idle_state = crate::thalamus::idle::State::new();
|
||||
idle_state.load();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue