Skip to content

Commit 6d79891

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 09d6cc1 commit 6d79891

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
@@ -107,6 +107,26 @@ ws-auth: false
107107
# # long-running agent interactions and helps prevent hitting standard rate limits.
108108
# agent-initiator-persist: true
109109

110+
# GitHub Copilot account configuration
111+
# Note: Copilot uses OAuth device code authentication, NOT API keys or tokens.
112+
# Do NOT paste your GitHub access token or Copilot bearer token here.
113+
# Tokens are stored only in auth-dir JSON files, never in config.yaml.
114+
#
115+
# To authenticate:
116+
# - CLI: run with -copilot-login flag
117+
# - Web: use the /copilot-auth-url management endpoint
118+
#
119+
# After OAuth login, tokens are managed automatically and stored in auth-dir.
120+
# The entries below only configure account type and optional proxy settings.
121+
#copilot-api-key:
122+
# - account-type: "individual" # Options: individual, business, enterprise
123+
# proxy-url: "socks5://proxy.example.com:1080" # optional: proxy for Copilot requests
124+
125+
# # When set to true, this flag forces subsequent requests in a session (sharing the same prompt_cache_key)
126+
# # to send the header "X-Initiator: agent" instead of "vscode". This mirrors VS Code's behavior for
127+
# # long-running agent interactions and helps prevent hitting standard rate limits.
128+
# agent-initiator-persist: true
129+
110130
# Claude API keys
111131
#claude-api-key:
112132
# - 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
@@ -216,6 +216,21 @@ type CopilotKey struct {
216216
AgentInitiatorPersist bool `yaml:"agent-initiator-persist" json:"agent-initiator-persist"`
217217
}
218218

219+
// CopilotKey represents the configuration for GitHub Copilot API access.
220+
// Authentication is handled via device code OAuth flow, not API keys.
221+
type CopilotKey struct {
222+
// AccountType is the Copilot subscription type (individual, business, enterprise).
223+
// Defaults to "individual" if not specified.
224+
AccountType string `yaml:"account-type" json:"account-type"`
225+
226+
// ProxyURL overrides the global proxy setting for Copilot requests if provided.
227+
ProxyURL string `yaml:"proxy-url,omitempty" json:"proxy-url,omitempty"`
228+
229+
// AgentInitiatorPersist, when true, forces subsequent Copilot requests sharing the
230+
// same prompt_cache_key to send X-Initiator=agent after the first call. Default false.
231+
AgentInitiatorPersist bool `yaml:"agent-initiator-persist" json:"agent-initiator-persist"`
232+
}
233+
219234
// GeminiKey represents the configuration for a Gemini API key,
220235
// including optional overrides for upstream base URL, proxy routing, and headers.
221236
type GeminiKey struct {

0 commit comments

Comments
 (0)