Merge agent and mode into one (#1689)
The concept of mode has been deprecated, there is now only the agent field in the config. An agent can be cycled through as your primary agent with <tab> or you can spawn a subagent by @ mentioning it. if you include a description of when to use it, the primary agent will try to automatically use it Full docs here: https://opencode.ai/docs/agents/
This commit is contained in:
@@ -209,6 +209,7 @@ func renderText(
|
||||
width int,
|
||||
extra string,
|
||||
fileParts []opencode.FilePart,
|
||||
agentParts []opencode.AgentPart,
|
||||
toolCalls ...opencode.ToolPart,
|
||||
) string {
|
||||
t := theme.CurrentTheme()
|
||||
@@ -229,9 +230,47 @@ func renderText(
|
||||
|
||||
// Apply highlighting to filenames and base style to rest of text BEFORE wrapping
|
||||
textLen := int64(len(text))
|
||||
|
||||
// Collect all parts to highlight (both file and agent parts)
|
||||
type highlightPart struct {
|
||||
start int64
|
||||
end int64
|
||||
color compat.AdaptiveColor
|
||||
}
|
||||
var highlights []highlightPart
|
||||
|
||||
// Add file parts with secondary color
|
||||
for _, filePart := range fileParts {
|
||||
highlight := base.Foreground(t.Secondary())
|
||||
start, end := filePart.Source.Text.Start, filePart.Source.Text.End
|
||||
highlights = append(highlights, highlightPart{
|
||||
start: filePart.Source.Text.Start,
|
||||
end: filePart.Source.Text.End,
|
||||
color: t.Secondary(),
|
||||
})
|
||||
}
|
||||
|
||||
// Add agent parts with secondary color (same as file parts)
|
||||
for _, agentPart := range agentParts {
|
||||
highlights = append(highlights, highlightPart{
|
||||
start: agentPart.Source.Start,
|
||||
end: agentPart.Source.End,
|
||||
color: t.Secondary(),
|
||||
})
|
||||
}
|
||||
|
||||
// Sort highlights by start position
|
||||
slices.SortFunc(highlights, func(a, b highlightPart) int {
|
||||
if a.start < b.start {
|
||||
return -1
|
||||
}
|
||||
if a.start > b.start {
|
||||
return 1
|
||||
}
|
||||
return 0
|
||||
})
|
||||
|
||||
for _, part := range highlights {
|
||||
highlight := base.Foreground(part.color)
|
||||
start, end := part.start, part.end
|
||||
|
||||
if end > textLen {
|
||||
end = textLen
|
||||
|
||||
Reference in New Issue
Block a user