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.
|
/// TODO: move to Session — it's session-level, not agent-level.
|
||||||
pub agent_cycles: crate::subconscious::subconscious::AgentCycleState,
|
pub agent_cycles: crate::subconscious::subconscious::AgentCycleState,
|
||||||
/// Shared active tools — Agent writes, TUI reads.
|
/// 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 {
|
fn render_journal(entries: &[context::JournalEntry]) -> String {
|
||||||
|
|
@ -326,7 +326,6 @@ impl Agent {
|
||||||
pub async fn turn(
|
pub async fn turn(
|
||||||
agent: Arc<tokio::sync::Mutex<Agent>>,
|
agent: Arc<tokio::sync::Mutex<Agent>>,
|
||||||
user_input: &str,
|
user_input: &str,
|
||||||
target: StreamTarget,
|
|
||||||
) -> Result<TurnResult> {
|
) -> Result<TurnResult> {
|
||||||
// --- Pre-loop setup (lock 1): agent cycle, memories, user input ---
|
// --- Pre-loop setup (lock 1): agent cycle, memories, user input ---
|
||||||
let active_tools = {
|
let active_tools = {
|
||||||
|
|
@ -567,7 +566,7 @@ impl Agent {
|
||||||
/// Used by `turn()` which manages its own locking.
|
/// Used by `turn()` which manages its own locking.
|
||||||
async fn dispatch_tool_call_unlocked(
|
async fn dispatch_tool_call_unlocked(
|
||||||
agent: &Arc<tokio::sync::Mutex<Agent>>,
|
agent: &Arc<tokio::sync::Mutex<Agent>>,
|
||||||
active_tools: &crate::agent::tools::SharedActiveTools,
|
active_tools: &tools::SharedActiveTools,
|
||||||
call: &ToolCall,
|
call: &ToolCall,
|
||||||
ds: &mut DispatchState,
|
ds: &mut DispatchState,
|
||||||
) {
|
) {
|
||||||
|
|
|
||||||
|
|
@ -310,7 +310,7 @@ impl Mind {
|
||||||
let agent = self.agent.clone();
|
let agent = self.agent.clone();
|
||||||
let result_tx = self.turn_tx.clone();
|
let result_tx = self.turn_tx.clone();
|
||||||
self.shared.lock().unwrap().turn_handle = Some(tokio::spawn(async move {
|
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;
|
let _ = result_tx.send((result, target)).await;
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -222,15 +222,6 @@ fn strip_ansi(text: &str) -> String {
|
||||||
out
|
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> {
|
fn new_textarea(lines: Vec<String>) -> tui_textarea::TextArea<'static> {
|
||||||
let mut ta = tui_textarea::TextArea::new(lines);
|
let mut ta = tui_textarea::TextArea::new(lines);
|
||||||
ta.set_cursor_line_style(Style::default());
|
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) {
|
fn flush_pending(&mut self) {
|
||||||
if self.use_markdown && !self.md_buffer.is_empty() {
|
if self.use_markdown && !self.md_buffer.is_empty() {
|
||||||
let parsed = parse_markdown(&self.md_buffer);
|
let parsed = parse_markdown(&self.md_buffer);
|
||||||
|
|
@ -385,7 +355,6 @@ pub(crate) struct InteractScreen {
|
||||||
history_index: Option<usize>,
|
history_index: Option<usize>,
|
||||||
active_pane: ActivePane,
|
active_pane: ActivePane,
|
||||||
pane_areas: [Rect; 3],
|
pane_areas: [Rect; 3],
|
||||||
needs_assistant_marker: bool,
|
|
||||||
turn_started: Option<std::time::Instant>,
|
turn_started: Option<std::time::Instant>,
|
||||||
call_started: Option<std::time::Instant>,
|
call_started: Option<std::time::Instant>,
|
||||||
call_timeout_secs: u64,
|
call_timeout_secs: u64,
|
||||||
|
|
@ -414,7 +383,6 @@ impl InteractScreen {
|
||||||
history_index: None,
|
history_index: None,
|
||||||
active_pane: ActivePane::Conversation,
|
active_pane: ActivePane::Conversation,
|
||||||
pane_areas: [Rect::default(); 3],
|
pane_areas: [Rect::default(); 3],
|
||||||
needs_assistant_marker: false,
|
|
||||||
turn_started: None,
|
turn_started: None,
|
||||||
call_started: None,
|
call_started: None,
|
||||||
call_timeout_secs: 60,
|
call_timeout_secs: 60,
|
||||||
|
|
|
||||||
|
|
@ -345,7 +345,6 @@ pub async fn run(
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let agent = &mind.agent;
|
let agent = &mind.agent;
|
||||||
let shared_mind = &mind.shared;
|
let shared_mind = &mind.shared;
|
||||||
let turn_watch = mind.turn_watch();
|
|
||||||
// UI-owned state
|
// UI-owned state
|
||||||
let mut idle_state = crate::thalamus::idle::State::new();
|
let mut idle_state = crate::thalamus::idle::State::new();
|
||||||
idle_state.load();
|
idle_state.load();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue