feat(provider): github copilot provider#201
Conversation
|
Heads up: main now has the shared managed-proxy foundation from the Codex work in The Copilot implementation can reuse the Managed Accounts entry, auth-binding/provider metadata flow, request-time managed-token path, daemon-owned proxy workers, and TUI restart state capture instead of adding a parallel lifecycle/auth surface. Copilot-specific OAuth/JWT/optimizer behavior still needs its own review. |
5345a38 to
510cebd
Compare
|
Thanks @watermarkhu for the detailed Copilot provider work and the upstream references. GitHub Copilot provider/proxy support has now landed in main and shipped in v5.8.0 through the maintained implementation path. It includes managed Copilot auth, model normalization, request routing, and the request optimizer. I am closing this PR as superseded by the merged mainline implementation, not because the feature request was rejected. Thanks again for pushing this forward. |
|
Good to see it landed |
Brings GitHub Copilot provider support to
cc-switch-cliwith full parity to the farion1231/cc-switch desktop app. Adds device-code OAuth login,per-request JWT injection in the proxy, the optimizer that keeps premium-quota usage sane, and live model-ID normalization.
Mirrors upstream commits
8ccfbd36(initial Copilot proxy),25136871(optimizer),
87635e7f(GHES),63aa3105(strip thinking),fcd83ee3(live/modelsresolution).What's new
Plus a "GitHub Copilot" template in the TUI / interactive
provider addflow.Request flow
copilot login→ device-code OAuth →~/.cc-switch/copilot_auth.json(v3 multi-account,0o600).provider switch <copilot-id>→~/.claude/settings.jsongetsPROXY_MANAGEDplaceholder + local proxy URL. Real JWT never hits disk.meta.providerType == "github_copilot", normalizes model IDs, runs optimizer pipeline (classify → sanitize → merge → strip-thinking → warmup-downgrade), swapsPROXY_MANAGEDfor a real JWT viaCopilotService::get_valid_token_for_account, injects fingerprint + optimizer headers (Editor-Version,x-initiator,x-request-id, etc.), forwards toapi.githubcopilot.comor the GHES endpoint.reject_proxy_placeholder_for_managed_account_upstreamblocksBearer PROXY_MANAGEDfrom ever reaching Copilot.Ports from upstream
proxy/copilot_optimizer.rs(new, 1543 lines)proxy/providers/copilot_model_map.rs(new, 374 lines)services/copilot.rs(new)services/codex_oauth.rsandcommands/copilot.rsproxy/types.rs—CopilotOptimizerConfigtypes.rs#L278-L327proxy/forwarder/request_builder.rsrewriteforwarder.rs#L960-L1084, placeholder guard from#L2184Resolves #91