Restore entry labels in context tree: role, tool calls, memory keys

ConversationEntry::label() provides descriptive labels matching the
old entry_sections format:
- "Kent: what about..." / "Aria: [tool_call: memory_search, ...]"
- "mem: [memory: key-name score:0.73]"
- "dmn: [heartbeat]" / "system: [system prompt]"

Uses config names (assistant_name, user_name) not generic "asst"/"user".
Widget renderer uses label() instead of raw content preview.

Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
Kent Overstreet 2026-04-07 21:04:41 -04:00
parent 5523752a15
commit a20f3e3642
2 changed files with 44 additions and 8 deletions

View file

@ -220,18 +220,16 @@ impl SectionTree {
for ce in section.entries() {
let entry_selected = self.selected == Some(*idx);
let entry_expanded = self.expanded.contains(idx);
let text = ce.entry.message().content_text();
let preview: String = text.chars().take(60).collect();
let preview = preview.replace('\n', " ");
let label = if preview.len() < text.len() {
format!(" {}...", preview)
let text = if ce.entry.is_log() {
String::new()
} else {
format!(" {}", preview)
ce.entry.message().content_text().to_string()
};
let entry_marker = if text.len() > 60 {
let has_content = text.len() > 0;
let entry_marker = if has_content {
if entry_expanded { "" } else { "" }
} else { " " };
let entry_label = format!(" {} {:>6} {}", entry_marker, ce.tokens, label);
let entry_label = format!(" {} {:>6} {}", entry_marker, ce.tokens, ce.entry.label());
let style = if entry_selected {
Style::default().fg(Color::Yellow).add_modifier(Modifier::BOLD)
} else {