( allAgents: AgentDefinition[], )
| 191 | } |
| 192 | |
| 193 | export function getActiveAgentsFromList( |
| 194 | allAgents: AgentDefinition[], |
| 195 | ): AgentDefinition[] { |
| 196 | const builtInAgents = allAgents.filter(a => a.source === 'built-in') |
| 197 | const pluginAgents = allAgents.filter(a => a.source === 'plugin') |
| 198 | const userAgents = allAgents.filter(a => a.source === 'userSettings') |
| 199 | const projectAgents = allAgents.filter(a => a.source === 'projectSettings') |
| 200 | const managedAgents = allAgents.filter(a => a.source === 'policySettings') |
| 201 | const flagAgents = allAgents.filter(a => a.source === 'flagSettings') |
| 202 | |
| 203 | const agentGroups = [ |
| 204 | builtInAgents, |
| 205 | pluginAgents, |
| 206 | userAgents, |
| 207 | projectAgents, |
| 208 | flagAgents, |
| 209 | managedAgents, |
| 210 | ] |
| 211 | |
| 212 | const agentMap = new Map<string, AgentDefinition>() |
| 213 | |
| 214 | for (const agents of agentGroups) { |
| 215 | for (const agent of agents) { |
| 216 | agentMap.set(agent.agentType, agent) |
| 217 | } |
| 218 | } |
| 219 | |
| 220 | return Array.from(agentMap.values()) |
| 221 | } |
| 222 | |
| 223 | /** |
| 224 | * Checks if an agent's required MCP servers are available. |
no test coverage detected