Class: AgentHarness::Providers::Aider

Inherits:
Base
  • Object
show all
Defined in:
lib/agent_harness/providers/aider.rb

Overview

Aider AI coding assistant provider

Provides integration with the Aider CLI tool.

Constant Summary

Constants inherited from Base

Base::COMMON_ERROR_PATTERNS

Instance Attribute Summary

Attributes inherited from Base

#config, #executor, #logger

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#configure, #initialize, #sandboxed_environment?, #send_message

Methods included from Adapter

#auth_type, #build_mcp_flags, #dangerous_mode_flags, #fetch_mcp_servers, #health_status, included, #parse_rate_limit_reset, #send_message, #supported_mcp_transports, #supports_dangerous_mode?, #supports_mcp?, #validate_config, #validate_mcp_servers!

Constructor Details

This class inherits a constructor from AgentHarness::Providers::Base

Class Method Details

.available?Boolean

Returns:

  • (Boolean)


18
19
20
21
# File 'lib/agent_harness/providers/aider.rb', line 18

def available?
  executor = AgentHarness.configuration.command_executor
  !!executor.which(binary_name)
end

.binary_nameObject



14
15
16
# File 'lib/agent_harness/providers/aider.rb', line 14

def binary_name
  "aider"
end

.discover_modelsObject



43
44
45
46
47
48
49
50
51
# File 'lib/agent_harness/providers/aider.rb', line 43

def discover_models
  return [] unless available?

  # Aider supports multiple model providers
  [
    {name: "gpt-4o", family: "gpt-4o", tier: "standard", provider: "aider"},
    {name: "claude-3-5-sonnet", family: "claude-3-5-sonnet", tier: "standard", provider: "aider"}
  ]
end

.firewall_requirementsObject



23
24
25
26
27
28
29
30
31
# File 'lib/agent_harness/providers/aider.rb', line 23

def firewall_requirements
  {
    domains: [
      "api.openai.com",
      "api.anthropic.com"
    ],
    ip_ranges: []
  }
end

.instruction_file_pathsObject



33
34
35
36
37
38
39
40
41
# File 'lib/agent_harness/providers/aider.rb', line 33

def instruction_file_paths
  [
    {
      path: ".aider.conf.yml",
      description: "Aider configuration file",
      symlink: false
    }
  ]
end

.provider_nameObject



10
11
12
# File 'lib/agent_harness/providers/aider.rb', line 10

def provider_name
  :aider
end

Instance Method Details

#capabilitiesObject



79
80
81
82
83
84
85
86
87
88
89
# File 'lib/agent_harness/providers/aider.rb', line 79

def capabilities
  {
    streaming: true,
    file_upload: true,
    vision: false,
    tool_use: true,
    json_mode: false,
    mcp: false,
    dangerous_mode: false
  }
end

#configuration_schemaObject



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/agent_harness/providers/aider.rb', line 62

def configuration_schema
  {
    fields: [
      {
        name: :model,
        type: :string,
        label: "Model",
        required: false,
        hint: "Model identifier (supports OpenAI, Anthropic, and other model names)",
        accepts_arbitrary: true
      }
    ],
    auth_modes: [:api_key],
    openai_compatible: false
  }
end

#display_nameObject



58
59
60
# File 'lib/agent_harness/providers/aider.rb', line 58

def display_name
  "Aider"
end

#error_patternsObject



91
92
93
94
95
96
# File 'lib/agent_harness/providers/aider.rb', line 91

def error_patterns
  COMMON_ERROR_PATTERNS.merge(
    auth_expired: COMMON_ERROR_PATTERNS[:auth_expired] + [/incorrect.*api.*key/i],
    transient: COMMON_ERROR_PATTERNS[:transient] + [/connection.*reset/i]
  )
end

#execution_semanticsObject



98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/agent_harness/providers/aider.rb', line 98

def execution_semantics
  {
    prompt_delivery: :flag,
    output_format: :text,
    sandbox_aware: false,
    uses_subcommand: false,
    non_interactive_flag: "--yes",
    legitimate_exit_codes: [0],
    stderr_is_diagnostic: true,
    parses_rate_limit_reset: false
  }
end

#nameObject



54
55
56
# File 'lib/agent_harness/providers/aider.rb', line 54

def name
  "aider"
end

#session_flags(session_id) ⇒ Object



115
116
117
118
# File 'lib/agent_harness/providers/aider.rb', line 115

def session_flags(session_id)
  return [] unless session_id && !session_id.empty?
  ["--restore-chat-history", session_id]
end

#supports_sessions?Boolean

Returns:

  • (Boolean)


111
112
113
# File 'lib/agent_harness/providers/aider.rb', line 111

def supports_sessions?
  true
end