Class: AgentHarness::Providers::GithubCopilot
- Inherits:
-
Base
- Object
- Base
- AgentHarness::Providers::GithubCopilot
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
- SMOKE_TEST_CONTRACT =
Copilot-specific smoke test contract. The ‘what-the-shell` subcommand translates natural language into shell commands, so the generic “Reply with exactly OK.” prompt would produce something like `echo “OK”` rather than the literal text “OK”. We use a prompt that is meaningful for the shell-translation path and only require non-empty output (no exact match).
{
prompt: "list files in the current directory",
expected_output: nil,
timeout: 30,
require_output: true,
success_message: "Smoke test passed"
}.freeze
Constants inherited
from Base
Base::COMMON_ERROR_PATTERNS, Base::DEFAULT_SMOKE_TEST_CONTRACT
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
#build_mcp_flags, #fetch_mcp_servers, #health_status, included, metadata_package_name, normalize_metadata_installation, normalize_metadata_source_type, normalize_metadata_version_requirement, #parse_rate_limit_reset, #send_message, #smoke_test, #smoke_test_contract, #supported_mcp_transports, #supports_dangerous_mode?, #supports_mcp?, #validate_config, #validate_mcp_servers!
Class Method Details
.binary_name ⇒ Object
31
32
33
|
# File 'lib/agent_harness/providers/github_copilot.rb', line 31
def binary_name
"github-copilot-cli"
end
|
.discover_models ⇒ Object
75
76
77
78
79
80
81
82
83
|
# File 'lib/agent_harness/providers/github_copilot.rb', line 75
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_requirements ⇒ Object
52
53
54
55
56
57
58
59
60
61
62
63
|
# File 'lib/agent_harness/providers/github_copilot.rb', line 52
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_paths ⇒ Object
65
66
67
68
69
70
71
72
73
|
# File 'lib/agent_harness/providers/github_copilot.rb', line 65
def instruction_file_paths
[
{
path: ".github/copilot-instructions.md",
description: "GitHub Copilot agent instructions",
symlink: true
}
]
end
|
.model_family(provider_model_name) ⇒ Object
89
90
91
|
# File 'lib/agent_harness/providers/github_copilot.rb', line 89
def model_family(provider_model_name)
provider_model_name
end
|
40
41
42
43
44
45
46
47
48
49
50
|
# File 'lib/agent_harness/providers/github_copilot.rb', line 40
def provider_metadata_overrides
{
auth: {
service: :github,
api_family: :github_copilot
},
identity: {
bot_usernames: ["github-copilot[bot]"]
}
}
end
|
.provider_model_name(family_name) ⇒ Object
93
94
95
|
# File 'lib/agent_harness/providers/github_copilot.rb', line 93
def provider_model_name(family_name)
family_name
end
|
.provider_name ⇒ Object
27
28
29
|
# File 'lib/agent_harness/providers/github_copilot.rb', line 27
def provider_name
:github_copilot
end
|
.smoke_test_contract ⇒ Object
85
86
87
|
# File 'lib/agent_harness/providers/github_copilot.rb', line 85
def smoke_test_contract
SMOKE_TEST_CONTRACT
end
|
.supports_model_family?(family_name) ⇒ Boolean
97
98
99
|
# File 'lib/agent_harness/providers/github_copilot.rb', line 97
def supports_model_family?(family_name)
MODEL_PATTERN.match?(family_name)
end
|
Instance Method Details
#auth_type ⇒ Object
143
144
145
|
# File 'lib/agent_harness/providers/github_copilot.rb', line 143
def auth_type
:oauth
end
|
#capabilities ⇒ Object
118
119
120
121
122
123
124
125
126
127
128
|
# File 'lib/agent_harness/providers/github_copilot.rb', line 118
def capabilities
{
streaming: false,
file_upload: false,
vision: false,
tool_use: true,
json_mode: false,
mcp: false,
dangerous_mode: true
}
end
|
#configuration_schema ⇒ Object
110
111
112
113
114
115
116
|
# File 'lib/agent_harness/providers/github_copilot.rb', line 110
def configuration_schema
{
fields: [],
auth_modes: [:oauth],
openai_compatible: false
}
end
|
#dangerous_mode_flags ⇒ Object
130
131
132
|
# File 'lib/agent_harness/providers/github_copilot.rb', line 130
def dangerous_mode_flags
["--allow-all-tools"]
end
|
#display_name ⇒ Object
106
107
108
|
# File 'lib/agent_harness/providers/github_copilot.rb', line 106
def display_name
"GitHub Copilot CLI"
end
|
#error_patterns ⇒ Object
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
|
# File 'lib/agent_harness/providers/github_copilot.rb', line 160
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
|
#execution_semantics ⇒ Object
147
148
149
150
151
152
153
154
155
156
157
158
|
# File 'lib/agent_harness/providers/github_copilot.rb', line 147
def execution_semantics
{
prompt_delivery: :arg,
output_format: :text,
sandbox_aware: false,
uses_subcommand: true,
non_interactive_flag: nil,
legitimate_exit_codes: [0],
stderr_is_diagnostic: true,
parses_rate_limit_reset: false
}
end
|
#name ⇒ Object
102
103
104
|
# File 'lib/agent_harness/providers/github_copilot.rb', line 102
def name
"github_copilot"
end
|
#session_flags(session_id) ⇒ Object
138
139
140
141
|
# File 'lib/agent_harness/providers/github_copilot.rb', line 138
def session_flags(session_id)
return [] unless session_id && !session_id.empty?
["--resume", session_id]
end
|
#supports_sessions? ⇒ Boolean
134
135
136
|
# File 'lib/agent_harness/providers/github_copilot.rb', line 134
def supports_sessions?
true
end
|