mcp-subagents
Version:
Multi-Agent AI Orchestration via Model Context Protocol - Access specialized CLI AI agents (Aider, Qwen, Gemini, Goose, etc.) with intelligent fallback and configuration
37 lines • 1.56 kB
JavaScript
import { BaseAgent } from './base.js';
export class GeminiAgent extends BaseAgent {
buildCommand(_task, taskConfig) {
const cmd = ['gemini', '-y'];
// Get custom flags to check for duplicates
const customFlags = taskConfig.flags || [];
// Only add internal model if no model flags are in custom flags
const hasModelFlag = customFlags.some(flag => flag === '--model' || flag === '-m' || flag.startsWith('--model=') || flag.startsWith('-m='));
if (!hasModelFlag) {
// Model selection with proper priority:
// 1. Task config model (highest priority)
// 2. GEMINI_MODEL from task env (config file/MCP config)
// 3. GEMINI_MODEL from process env (system environment)
// 4. Config file model (from this.config.defaults)
// 5. Built-in default (lowest priority, handled in registry)
const model = taskConfig.model ||
taskConfig.env?.['GEMINI_MODEL'] ||
process.env['GEMINI_MODEL'] ||
this.config.defaults['model'];
if (model) {
cmd.push('-m', String(model));
}
}
if (taskConfig.sandbox) {
cmd.push('-s');
}
// Add custom flags (overrides defaults)
if (taskConfig.flags && taskConfig.flags.length > 0) {
cmd.push(...taskConfig.flags);
}
return this.validateCommand(cmd);
}
getInputMethod() {
return 'stdin';
}
}
//# sourceMappingURL=gemini.js.map