Kill log callback — use ConversationEntry::Log for debug traces

Add Log variant to ConversationEntry that serializes to the
conversation log but is filtered out on read-back and API calls.
AutoAgent writes debug/status info (turns, tokens, tool calls)
through the conversation log instead of a callback parameter.

Removes the log callback from run_one_agent, call_api_with_tools,
and all callers.

Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
Kent Overstreet 2026-04-07 01:23:22 -04:00
parent 7c0d8b79d9
commit b37b6d7495
8 changed files with 74 additions and 73 deletions

View file

@ -31,7 +31,6 @@ pub fn cmd_run_agent(agent: &str, count: usize, target: &[String], query: Option
// Slow path: need the store for local execution or target resolution
let mut store = store::Store::load()?;
let log = |msg: &str| println!("{}", msg);
// Resolve targets: explicit --target, --query, or agent's default query
let resolved_targets: Vec<String> = if !target.is_empty() {
@ -60,7 +59,7 @@ pub fn cmd_run_agent(agent: &str, count: usize, target: &[String], query: Option
println!("[{}] [{}/{}] {}", agent, i + 1, resolved_targets.len(), key);
if i > 0 { store = store::Store::load()?; }
if let Err(e) = crate::agent::oneshot::run_one_agent(
&mut store, agent, count, Some(&[key.clone()]), &log,
&mut store, agent, count, Some(&[key.clone()]),
) {
println!("[{}] ERROR on {}: {}", agent, key, e);
}
@ -80,7 +79,7 @@ pub fn cmd_run_agent(agent: &str, count: usize, target: &[String], query: Option
} else {
// Local execution (--local, --debug, dry-run, or daemon unavailable)
crate::agent::oneshot::run_one_agent(
&mut store, agent, count, None, &log,
&mut store, agent, count, None,
)?;
}
Ok(())
@ -400,7 +399,7 @@ fn llm_compare(
let _ = model; // model selection handled by API backend config
let response = crate::agent::oneshot::call_api_with_tools_sync(
"compare", &[prompt], &[], None, 10, &[], None, &|_| {})?;
"compare", &[prompt], &[], None, 10, &[], None)?;
let response = response.trim().to_uppercase();
if response.contains("BETTER: B") {