<?php

return [

    'agents' => [
        'codex' => [
            'name' => 'OpenAI Codex',
            'binary' => 'codex',
            'description' => 'AI coding agent by OpenAI',
            'detect_command' => 'codex --version',
            'requires_env' => 'OPENAI_API_KEY',
            'capabilities' => ['code_generation', 'file_editing', 'shell_execution', 'git', 'mcp'],
            'supported_modes' => ['sync', 'streaming'],
            'execute_flags' => ['exec', '--json', '--full-auto'],
            'stream_flags' => ['exec', '--json', '--full-auto'],
            'output_format' => 'stream-json',
            'requires_pty' => false,
        ],
        'claude-code' => [
            'name' => 'Claude Code',
            'binary' => 'claude',
            'description' => 'AI coding agent by Anthropic',
            'detect_command' => 'claude --version',
            'requires_env' => 'ANTHROPIC_API_KEY',
            'capabilities' => ['code_generation', 'file_editing', 'shell_execution', 'git', 'mcp'],
            'supported_modes' => ['sync', 'streaming'],
            'execute_flags' => ['-p', '--output-format', 'stream-json', '--verbose', '--dangerously-skip-permissions'],
            'stream_flags' => ['-p', '--output-format', 'stream-json', '--verbose', '--dangerously-skip-permissions'],
            'output_format' => 'stream-json',
            'requires_pty' => false,
        ],
        'gemini-cli' => [
            'name' => 'Gemini CLI',
            'binary' => 'gemini',
            'description' => 'Open-source AI coding agent by Google',
            'detect_command' => 'gemini --version',
            'requires_env' => 'GOOGLE_API_KEY',
            'capabilities' => ['code_generation', 'file_editing', 'shell_execution', 'web_search', 'mcp'],
            'supported_modes' => ['sync', 'streaming'],
            'execute_flags' => ['-p', '--output-format', 'json', '--yolo'],
            'stream_flags' => ['-p', '--output-format', 'stream-json', '--yolo'],
            'output_format' => 'stream-json',
            'requires_pty' => false,
        ],
        'kiro' => [
            'name' => 'Kiro CLI',
            'binary' => 'kiro-cli',
            'description' => 'AI coding agent by AWS',
            'detect_command' => 'kiro-cli --version',
            'requires_env' => null,
            'capabilities' => ['code_generation', 'file_editing', 'shell_execution', 'git'],
            'supported_modes' => ['sync'],
            'execute_flags' => ['chat', '--no-interactive', '--trust-all-tools'],
            'stream_flags' => ['chat', '--no-interactive', '--trust-all-tools'],
            'output_format' => 'text',
            'requires_pty' => false,
        ],
        'cursor' => [
            'name' => 'Cursor CLI',
            'binary' => 'agent',
            'description' => 'AI coding agent by Cursor',
            'detect_command' => 'agent --version',
            'requires_env' => null,
            'capabilities' => ['code_generation', 'file_editing', 'shell_execution', 'git'],
            'supported_modes' => ['sync', 'streaming'],
            'execute_flags' => ['-p', '--output-format', 'stream-json', '--force'],
            'stream_flags' => ['-p', '--output-format', 'stream-json', '--force', '--stream-partial-output'],
            'output_format' => 'stream-json',
            'requires_pty' => true,
        ],
        'cline' => [
            'name' => 'Cline CLI',
            'binary' => 'cline',
            'description' => 'Open-source AI coding agent for the terminal',
            'detect_command' => 'cline --version',
            'requires_env' => null,
            'capabilities' => ['code_generation', 'file_editing', 'shell_execution', 'git', 'mcp'],
            'supported_modes' => ['sync', 'streaming'],
            'execute_flags' => ['--json', '--yolo'],
            'stream_flags' => ['--json', '--yolo'],
            'output_format' => 'json',
            'requires_pty' => false,
        ],
        'aider' => [
            'name' => 'Aider',
            'binary' => 'aider',
            'description' => 'Open-source AI pair programming in your terminal',
            'detect_command' => 'aider --version',
            'requires_env' => null,
            'capabilities' => ['code_generation', 'file_editing', 'git'],
            'supported_modes' => ['sync'],
            'execute_flags' => ['--yes', '--no-git'],
            'stream_flags' => ['--yes', '--no-git'],
            'output_format' => 'text',
            'requires_pty' => false,
        ],
        'amp' => [
            'name' => 'Amp',
            'binary' => 'amp',
            'description' => 'AI coding agent by Sourcegraph',
            'detect_command' => 'amp --version',
            'requires_env' => 'AMP_API_KEY',
            'capabilities' => ['code_generation', 'file_editing', 'shell_execution', 'git', 'web_search'],
            'supported_modes' => ['sync', 'streaming'],
            'execute_flags' => ['--json'],
            'stream_flags' => ['--json', '--stream'],
            'output_format' => 'stream-json',
            'requires_pty' => false,
        ],
        'opencode' => [
            'name' => 'OpenCode',
            'binary' => 'opencode',
            'description' => 'Open-source AI coding agent for the terminal',
            'detect_command' => 'opencode --version',
            'requires_env' => null,
            'capabilities' => ['code_generation', 'file_editing', 'shell_execution', 'git'],
            'supported_modes' => ['sync'],
            'execute_flags' => ['acp'],
            'stream_flags' => ['acp'],
            'output_format' => 'acp',
            'requires_pty' => false,
        ],
        'claude-code-vps' => [
            'name' => 'Claude Code (VPS)',
            'binary' => 'claude',
            'description' => 'Claude Code running on the VPS with a pre-provisioned Max OAuth token (super-admin gated)',
            'detect_command' => 'claude --version',
            'requires_env' => null,
            'capabilities' => ['code_generation', 'file_editing', 'shell_execution', 'git', 'mcp'],
            'supported_modes' => ['sync'],
            'execute_flags' => ['-p', '--output-format', 'stream-json', '--verbose', '--dangerously-skip-permissions'],
            'stream_flags' => ['-p', '--output-format', 'stream-json', '--verbose', '--dangerously-skip-permissions'],
            'output_format' => 'stream-json',
            'requires_pty' => false,
            'vps_only' => true,
        ],
    ],

    // VPS-installed Claude Code — super-admin gated
    'vps' => [
        'oauth_token' => env('CLAUDE_CODE_OAUTH_TOKEN'),
        'binary_path' => env('CLAUDE_CODE_VPS_BINARY', '/usr/local/bin/claude'),
        'max_concurrency_per_team' => (int) env('CLAUDE_CODE_VPS_MAX_CONCURRENCY', 2),
        'timeout_seconds' => (int) env('CLAUDE_CODE_VPS_TIMEOUT', 300),
    ],

    // Host bridge — allows Docker containers to reach host-installed agents
    'bridge' => [
        'auto_detect' => (bool) env('LOCAL_AGENT_BRIDGE_AUTO', true),
        'url' => env('LOCAL_AGENT_BRIDGE_URL', 'http://host.docker.internal:8065'),
        'secret' => env('LOCAL_AGENT_BRIDGE_SECRET', ''),
        'connect_timeout' => (int) env('LOCAL_AGENT_BRIDGE_CONNECT_TIMEOUT', 5),
    ],

    // Working directory for local agent execution (defaults to project root)
    'working_directory' => env('LOCAL_AGENT_WORKDIR', null),

    // Maximum execution time in seconds
    'timeout' => (int) env('LOCAL_AGENT_TIMEOUT', 900),

    // Enable/disable local agent support
    'enabled' => (bool) env('LOCAL_AGENTS_ENABLED', false),

    // Whether running inside Docker container
    'running_in_docker' => (bool) env('RUNNING_IN_DOCKER', false),

    // MCP server discovery from host IDE configs
    'mcp_discovery' => [
        'enabled' => (bool) env('MCP_DISCOVERY_ENABLED', false),
        'additional_paths' => array_filter(explode(',', env('MCP_DISCOVERY_EXTRA_PATHS', ''))),
    ],

];
