add sessions tool and subagents steer control

This commit is contained in:
DBT
2026-02-23 13:13:06 +00:00
parent 89847f5672
commit 5f8678f091
5 changed files with 185 additions and 5 deletions

View File

@@ -250,6 +250,29 @@ func (sm *SessionManager) Keys() []string {
return keys
}
func (sm *SessionManager) List(limit int) []Session {
sm.mu.RLock()
defer sm.mu.RUnlock()
items := make([]Session, 0, len(sm.sessions))
for _, s := range sm.sessions {
s.mu.RLock()
items = append(items, Session{
Key: s.Key,
Kind: s.Kind,
Summary: s.Summary,
LastLanguage: s.LastLanguage,
PreferredLanguage: s.PreferredLanguage,
Created: s.Created,
Updated: s.Updated,
})
s.mu.RUnlock()
}
if limit > 0 && len(items) > limit {
return items[:limit]
}
return items
}
func detectSessionKind(key string) string {
k := strings.TrimSpace(strings.ToLower(key))
switch {