Feat: Add Agent Name in the LLM Response Footer (and re-order it) (#1770)

This commit is contained in:
spoons-and-mirrors
2025-08-10 03:22:16 +02:00
committed by GitHub
parent 696ab1a752
commit bd4319f2bc
4 changed files with 81 additions and 31 deletions

View File

@@ -3,6 +3,9 @@ package util
import (
"regexp"
"strings"
"github.com/charmbracelet/lipgloss/v2/compat"
"github.com/sst/opencode/internal/theme"
)
var csiRE *regexp.Regexp
@@ -89,5 +92,24 @@ func ConvertRGBToAnsi16Colors(s string) string {
// func looksLikeByte(tok string) bool {
// v, err := strconv.Atoi(tok)
// return err == nil && v >= 0 && v <= 255
// return err == nil && v >= 0 && v <= 255
// }
// GetAgentColor returns the color for a given agent index, matching the status bar colors
func GetAgentColor(agentIndex int) compat.AdaptiveColor {
t := theme.CurrentTheme()
agentColors := []compat.AdaptiveColor{
t.TextMuted(),
t.Secondary(),
t.Accent(),
t.Success(),
t.Warning(),
t.Primary(),
t.Error(),
}
if agentIndex >= 0 && agentIndex < len(agentColors) {
return agentColors[agentIndex]
}
return t.Secondary() // default fallback
}