fix(TUI): unsurfacing subagent from agents modal (#1873)
This commit is contained in:
committed by
GitHub
parent
5785ded6e2
commit
dedaa34dc1
@@ -240,6 +240,9 @@ func (a *agentDialog) setupAllAgents() {
|
|||||||
// Build agent items from app.Agents (no API call needed) - their pattern
|
// Build agent items from app.Agents (no API call needed) - their pattern
|
||||||
a.allAgents = make([]agentSelectItem, 0, len(a.app.Agents))
|
a.allAgents = make([]agentSelectItem, 0, len(a.app.Agents))
|
||||||
for i, agent := range a.app.Agents {
|
for i, agent := range a.app.Agents {
|
||||||
|
if agent.Mode == "subagent" {
|
||||||
|
continue // Skip subagents entirely
|
||||||
|
}
|
||||||
isCurrent := agent.Name == currentAgentName
|
isCurrent := agent.Name == currentAgentName
|
||||||
|
|
||||||
// Create display name (capitalize first letter)
|
// Create display name (capitalize first letter)
|
||||||
@@ -307,7 +310,10 @@ func (a *agentDialog) buildSearchResults(query string) []list.Item {
|
|||||||
agentMap := make(map[string]agentSelectItem)
|
agentMap := make(map[string]agentSelectItem)
|
||||||
|
|
||||||
for _, agent := range a.allAgents {
|
for _, agent := range a.allAgents {
|
||||||
// Search by name only
|
// Only include non-subagents in search
|
||||||
|
if agent.mode == "subagent" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
searchStr := agent.name
|
searchStr := agent.name
|
||||||
agentNames = append(agentNames, searchStr)
|
agentNames = append(agentNames, searchStr)
|
||||||
agentMap[searchStr] = agent
|
agentMap[searchStr] = agent
|
||||||
@@ -352,42 +358,23 @@ func (a *agentDialog) buildGroupedResults() []list.Item {
|
|||||||
recentAgentNames[recent.name] = true
|
recentAgentNames[recent.name] = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// Separate agents by type (excluding recent ones)
|
// Only show non-subagents (primary/user) in the main section
|
||||||
primaryAndUserAgents := make([]agentSelectItem, 0)
|
mainAgents := make([]agentSelectItem, 0)
|
||||||
subAgents := make([]agentSelectItem, 0)
|
|
||||||
|
|
||||||
for _, agent := range a.allAgents {
|
for _, agent := range a.allAgents {
|
||||||
if !recentAgentNames[agent.name] {
|
if !recentAgentNames[agent.name] {
|
||||||
switch agent.mode {
|
mainAgents = append(mainAgents, agent)
|
||||||
case "subagent":
|
|
||||||
subAgents = append(subAgents, agent)
|
|
||||||
default:
|
|
||||||
// primary, all, and any other types go in main "Agents" section
|
|
||||||
primaryAndUserAgents = append(primaryAndUserAgents, agent)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sort each category alphabetically
|
// Sort main agents alphabetically
|
||||||
sort.Slice(primaryAndUserAgents, func(i, j int) bool {
|
sort.Slice(mainAgents, func(i, j int) bool {
|
||||||
return primaryAndUserAgents[i].name < primaryAndUserAgents[j].name
|
return mainAgents[i].name < mainAgents[j].name
|
||||||
})
|
|
||||||
sort.Slice(subAgents, func(i, j int) bool {
|
|
||||||
return subAgents[i].name < subAgents[j].name
|
|
||||||
})
|
})
|
||||||
|
|
||||||
// Add main agents section
|
// Add main agents section
|
||||||
if len(primaryAndUserAgents) > 0 {
|
if len(mainAgents) > 0 {
|
||||||
items = append(items, list.HeaderItem("Agents"))
|
items = append(items, list.HeaderItem("Agents"))
|
||||||
for _, agent := range primaryAndUserAgents {
|
for _, agent := range mainAgents {
|
||||||
items = append(items, agent)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add subagents section
|
|
||||||
if len(subAgents) > 0 {
|
|
||||||
items = append(items, list.HeaderItem("Subagents"))
|
|
||||||
for _, agent := range subAgents {
|
|
||||||
items = append(items, agent)
|
items = append(items, agent)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user