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

@ -290,7 +290,9 @@ impl Agent {
if !jnl.is_empty() {
msgs.push(Message::user(jnl));
}
msgs.extend(self.context.entries.iter().map(|e| e.api_message().clone()));
msgs.extend(self.context.entries.iter()
.filter(|e| !e.is_log())
.map(|e| e.api_message().clone()));
msgs
}
@ -743,7 +745,7 @@ impl Agent {
// Conversation — non-memory entries only (memories counted above)
let conv_children: Vec<ContextSection> = self.context.entries.iter().enumerate()
.filter(|(_, e)| !e.is_memory())
.filter(|(_, e)| !e.is_memory() && !e.is_log())
.map(|(i, entry)| {
let m = entry.message();
let text = m.content.as_ref()
@ -1032,7 +1034,7 @@ impl Agent {
// Load extra — compact() will dedup, trim, reload identity + journal
let all: Vec<_> = entries.into_iter()
.filter(|e| e.message().role != Role::System)
.filter(|e| !e.is_log() && e.message().role != Role::System)
.collect();
let mem_count = all.iter().filter(|e| e.is_memory()).count();
let conv_count = all.len() - mem_count;