Class: AgentHarness::Providers::GithubCopilot

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

Overview

GitHub Copilot CLI provider

Provides integration with the GitHub Copilot CLI tool.

Constant Summary collapse

MODEL_PATTERN =

Model name pattern for GitHub Copilot (uses OpenAI models)

/^gpt-[\d.o-]+(?:-turbo)?(?:-mini)?$/i

Instance Attribute Summary

Attributes inherited from Base

#config, #executor, #logger

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#configure, #initialize, #send_message

Methods included from Adapter

#fetch_mcp_servers, #health_status, included, #send_message, #supports_mcp?, #validate_config

Constructor Details

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

Class Method Details

.available?Boolean

Returns:

  • (Boolean)


21
22
23
24
# File 'lib/agent_harness/providers/github_copilot.rb', line 21

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

.binary_nameObject



17
18
19
# File 'lib/agent_harness/providers/github_copilot.rb', line 17

def binary_name
  "copilot"
end

.discover_modelsObject



49
50
51
52
53
54
55
56
57
# File 'lib/agent_harness/providers/github_copilot.rb', line 49

def discover_models
  return [] unless available?

  [
    {name: "gpt-4o", family: "gpt-4o", tier: "standard", provider: "github_copilot"},
    {name: "gpt-4o-mini", family: "gpt-4o-mini", tier: "mini", provider: "github_copilot"},
    {name: "gpt-4-turbo", family: "gpt-4-turbo", tier: "advanced", provider: "github_copilot"}
  ]
end

.firewall_requirementsObject



26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/agent_harness/providers/github_copilot.rb', line 26

def firewall_requirements
  {
    domains: [
      "copilot-proxy.githubusercontent.com",
      "api.githubcopilot.com",
      "copilot-telemetry.githubusercontent.com",
      "default.exp-tas.com",
      "copilot-completions.githubusercontent.com"
    ],
    ip_ranges: []
  }
end

.instruction_file_pathsObject



39
40
41
42
43
44
45
46
47
# File 'lib/agent_harness/providers/github_copilot.rb', line 39

def instruction_file_paths
  [
    {
      path: ".github/copilot-instructions.md",
      description: "GitHub Copilot agent instructions",
      symlink: true
    }
  ]
end

.model_family(provider_model_name) ⇒ Object



59
60
61
# File 'lib/agent_harness/providers/github_copilot.rb', line 59

def model_family(provider_model_name)
  provider_model_name
end

.provider_model_name(family_name) ⇒ Object



63
64
65
# File 'lib/agent_harness/providers/github_copilot.rb', line 63

def provider_model_name(family_name)
  family_name
end

.provider_nameObject



13
14
15
# File 'lib/agent_harness/providers/github_copilot.rb', line 13

def provider_name
  :github_copilot
end

.supports_model_family?(family_name) ⇒ Boolean

Returns:

  • (Boolean)


67
68
69
# File 'lib/agent_harness/providers/github_copilot.rb', line 67

def supports_model_family?(family_name)
  MODEL_PATTERN.match?(family_name)
end

Instance Method Details

#capabilitiesObject



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

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

#dangerous_mode_flagsObject



96
97
98
# File 'lib/agent_harness/providers/github_copilot.rb', line 96

def dangerous_mode_flags
  ["--allow-all-tools"]
end

#display_nameObject



76
77
78
# File 'lib/agent_harness/providers/github_copilot.rb', line 76

def display_name
  "GitHub Copilot CLI"
end

#error_patternsObject



109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'lib/agent_harness/providers/github_copilot.rb', line 109

def error_patterns
  {
    auth_expired: [
      /not.?authorized/i,
      /access.?denied/i,
      /permission.?denied/i,
      /not.?enabled/i,
      /subscription.?required/i
    ],
    rate_limited: [
      /usage.?limit/i,
      /rate.?limit/i
    ],
    transient: [
      /connection.?error/i,
      /timeout/i,
      /try.?again/i
    ],
    permanent: [
      /invalid.?command/i,
      /unknown.?flag/i
    ]
  }
end

#nameObject



72
73
74
# File 'lib/agent_harness/providers/github_copilot.rb', line 72

def name
  "github_copilot"
end

#session_flags(session_id) ⇒ Object



104
105
106
107
# File 'lib/agent_harness/providers/github_copilot.rb', line 104

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

#supports_dangerous_mode?Boolean

Returns:

  • (Boolean)


92
93
94
# File 'lib/agent_harness/providers/github_copilot.rb', line 92

def supports_dangerous_mode?
  true
end

#supports_sessions?Boolean

Returns:

  • (Boolean)


100
101
102
# File 'lib/agent_harness/providers/github_copilot.rb', line 100

def supports_sessions?
  true
end