INNER CODE UNIT · TypeScript
createSwarmAgents
ZaxbyHub/opencode-swarm · src/agents/index.ts:443
function createSwarmAgents(
swarmId: string,
swarmConfig: SwarmConfig,
isDefault: boolean,
pluginConfig?: PluginConfig,
projectContext: ProjectContext = emptyProjectContext(),
): AgentDefinition[] {
const agents: AgentDefinition[] = [];
const swarmAgents = swarmConfig.agents;
_swarmAgentsMap.set(swarmId, swarmAgents ?? {});
// Prefix for non-default swarms (e.g., "local" for swarmId "local")
// We pass swarmId as the prefix identifier, but only prepend to names if not default
const prefix = isDefault ? '' : `${swarmId}_`;
const swarmPrefix = isDefault ? undefined : swarmId;
// Get qa_retry_limit from config (default: 3)
const qaRetryLimit = pluginConfig?.qa_retry_limit ?? 3;