Skip to content

Commit d167e17

Browse files
committed
feat(config): add Copilot configuration options
- Add Copilot section with agent-initiator-persist flag - Add scanner buffer size configuration - Add account type configuration option - Document configuration options in example config
1 parent 9e7a1a4 commit d167e17

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

config.example.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,26 @@ ws-auth: false
127127
# # long-running agent interactions and helps prevent hitting standard rate limits.
128128
# agent-initiator-persist: true
129129

130+
# GitHub Copilot account configuration
131+
# Note: Copilot uses OAuth device code authentication, NOT API keys or tokens.
132+
# Do NOT paste your GitHub access token or Copilot bearer token here.
133+
# Tokens are stored only in auth-dir JSON files, never in config.yaml.
134+
#
135+
# To authenticate:
136+
# - CLI: run with -copilot-login flag
137+
# - Web: use the /copilot-auth-url management endpoint
138+
#
139+
# After OAuth login, tokens are managed automatically and stored in auth-dir.
140+
# The entries below only configure account type and optional proxy settings.
141+
#copilot-api-key:
142+
# - account-type: "individual" # Options: individual, business, enterprise
143+
# proxy-url: "socks5://proxy.example.com:1080" # optional: proxy for Copilot requests
144+
145+
# # When set to true, this flag forces subsequent requests in a session (sharing the same prompt_cache_key)
146+
# # to send the header "X-Initiator: agent" instead of "vscode". This mirrors VS Code's behavior for
147+
# # long-running agent interactions and helps prevent hitting standard rate limits.
148+
# agent-initiator-persist: true
149+
130150
# Claude API keys
131151
#claude-api-key:
132152
# - api-key: "sk-atSM..." # use the official claude API key, no need to set the base url

internal/config/config.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,21 @@ type CopilotKey struct {
231231
AgentInitiatorPersist bool `yaml:"agent-initiator-persist" json:"agent-initiator-persist"`
232232
}
233233

234+
// CopilotKey represents the configuration for GitHub Copilot API access.
235+
// Authentication is handled via device code OAuth flow, not API keys.
236+
type CopilotKey struct {
237+
// AccountType is the Copilot subscription type (individual, business, enterprise).
238+
// Defaults to "individual" if not specified.
239+
AccountType string `yaml:"account-type" json:"account-type"`
240+
241+
// ProxyURL overrides the global proxy setting for Copilot requests if provided.
242+
ProxyURL string `yaml:"proxy-url,omitempty" json:"proxy-url,omitempty"`
243+
244+
// AgentInitiatorPersist, when true, forces subsequent Copilot requests sharing the
245+
// same prompt_cache_key to send X-Initiator=agent after the first call. Default false.
246+
AgentInitiatorPersist bool `yaml:"agent-initiator-persist" json:"agent-initiator-persist"`
247+
}
248+
234249
// GeminiKey represents the configuration for a Gemini API key,
235250
// including optional overrides for upstream base URL, proxy routing, and headers.
236251
type GeminiKey struct {

0 commit comments

Comments
 (0)