feat: LLM auto-titles — daemon names unnamed sessions from their first user message via one cheap ZAI completion (no agent-turn pollution); flows into sidebar + tab title

This commit is contained in:
Raphael Westphal
2026-08-20 11:44:05 +02:00
parent 9d369f410e
commit 1b6bd54a74
3 changed files with 286 additions and 0 deletions
+10
View File
@@ -614,6 +614,16 @@ func (h *Hub) handleEvent(f frame) {
log.Printf("hub: touch session %s: %v", f.sessionID, err)
}
}
// Auto-title: first persisted user message on an unnamed session asks
// the configured LLM for a short title (separate cheap completion; never
// touches the agent conversation).
if f.typ == evMessageEnd && h.needsAutoTitle(f) {
sid := f.sessionID
text := firstUserText(f.raw)
if text != "" {
go h.autoTitle(sid, text)
}
}
// Track mid-turn state for the session-list activity pulse.
if f.typ == evAgentStart || f.typ == evAgentSettled {
busy := f.typ == evAgentStart