delete ProcessTracker — replaced by ActiveToolCall + KillOnDrop
All process management now goes through active_tools: - TUI reads metadata (name, elapsed time) - Ctrl+K aborts handles (KillOnDrop sends SIGTERM) - Running count from active_tools.len() No more separate PID tracking, register/unregister, or ProcessInfo. One data structure for everything. Co-Developed-By: Kent Overstreet <kent.overstreet@linux.dev> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
310bbe9fce
commit
021eafe6da
5 changed files with 37 additions and 109 deletions
|
|
@ -24,7 +24,7 @@ use crate::user::api::ApiClient;
|
|||
use crate::agent::context as journal;
|
||||
use crate::user::log::ConversationLog;
|
||||
use crate::user::api::StreamEvent;
|
||||
use crate::agent::tools::{ProcessTracker, ToolCall, ToolDef, FunctionCall, summarize_args};
|
||||
use crate::agent::tools::{ToolCall, ToolDef, FunctionCall, summarize_args};
|
||||
use crate::user::types::*;
|
||||
use crate::user::ui_channel::{ContextSection, SharedContextState, StatusInfo, StreamTarget, UiMessage, UiSender};
|
||||
|
||||
|
|
@ -59,8 +59,6 @@ pub struct Agent {
|
|||
tool_defs: Vec<ToolDef>,
|
||||
/// Last known prompt token count from the API (tracks context size).
|
||||
last_prompt_tokens: u32,
|
||||
/// Shared process tracker for bash tool — lets TUI show/kill running commands.
|
||||
pub process_tracker: ProcessTracker,
|
||||
/// Current reasoning effort level ("none", "low", "high").
|
||||
pub reasoning_effort: String,
|
||||
/// Persistent conversation log — append-only record of all messages.
|
||||
|
|
@ -125,7 +123,6 @@ impl Agent {
|
|||
client,
|
||||
tool_defs,
|
||||
last_prompt_tokens: 0,
|
||||
process_tracker: ProcessTracker::new(),
|
||||
reasoning_effort: "none".to_string(),
|
||||
conversation_log,
|
||||
tokenizer,
|
||||
|
|
@ -259,7 +256,7 @@ impl Agent {
|
|||
}
|
||||
done
|
||||
};
|
||||
for mut entry in finished {
|
||||
for entry in finished {
|
||||
if let Ok((call, output)) = entry.handle.await {
|
||||
self.apply_tool_result(&call, output, ui_tx, &mut bg_ds);
|
||||
}
|
||||
|
|
@ -334,9 +331,8 @@ impl Agent {
|
|||
.unwrap_or(false);
|
||||
let call_id = call.id.clone();
|
||||
let call_name = call.function.name.clone();
|
||||
let tracker = self.process_tracker.clone();
|
||||
let handle = tokio::spawn(async move {
|
||||
let output = tools::dispatch(&call.function.name, &args, &tracker).await;
|
||||
let output = tools::dispatch(&call.function.name, &args).await;
|
||||
(call, output)
|
||||
});
|
||||
self.active_tools.lock().unwrap().push(
|
||||
|
|
@ -510,7 +506,7 @@ impl Agent {
|
|||
};
|
||||
if !pending.is_empty() {
|
||||
self.push_message(msg.clone());
|
||||
for mut entry in pending {
|
||||
for entry in pending {
|
||||
if let Ok((call, output)) = entry.handle.await {
|
||||
self.apply_tool_result(&call, output, ui_tx, &mut ds);
|
||||
}
|
||||
|
|
@ -586,9 +582,8 @@ impl Agent {
|
|||
let call_id = call.id.clone();
|
||||
let call_name = call.function.name.clone();
|
||||
let call = call.clone();
|
||||
let tracker = self.process_tracker.clone();
|
||||
let handle = tokio::spawn(async move {
|
||||
let output = tools::dispatch(&call.function.name, &args, &tracker).await;
|
||||
let output = tools::dispatch(&call.function.name, &args).await;
|
||||
(call, output)
|
||||
});
|
||||
self.active_tools.lock().unwrap().push(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue