{"modulePath":"github.com/memcode-ai/memcode","version":"v0.56.16","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package copilot\n\nPackage copilot turns a GitHub Copilot subscription into a memcode backend: it finds the GitHub token the machine already has (an env var or \\`gh auth token\\`), exchanges it for a short-lived Copilot API token, and returns the endpoint + identity headers the Copilot API requires. No vendor SDK — raw HTTP and one subprocess — so it composes into provider selection without a dependency cycle (it returns a plain Backend; the provider package adapts it to an Endpoint).\n\nThis is consent-gated upstream: it activates only when the user explicitly selects the copilot source (the first-run wizard, or MEMCODE\\_CREDENTIAL\\_SOURCE =copilot). It never reads \\`gh\\` behind the user's back.\n\n## Functions\n\n```go\nfunc Available() bool\n```\nAvailable reports whether a GitHub token the exchange could use is present — an env var or a gh install — without exchanging. For the wizard's menu.\n\n## Types\n\n```go\ntype Backend struct {\n\tBaseURL string\n\tToken   string\n\tHeaders map[string]string\n}\n```\nBackend is the resolved Copilot endpoint: a Bearer token plus the identity headers every turn must carry. Consumed by the provider package.\n\n```go\nfunc Resolve(ctx context.Context) (Backend, error)\n```\nResolve finds the GitHub token, exchanges it (using a cached Copilot token while fresh), and returns the backend. An error explains the fix (sign in with gh, or the token type Copilot won't accept).\n\n","path":"github.com/memcode-ai/memcode/internal/subscription/copilot","name":"copilot","synopsis":"Package copilot turns a GitHub Copilot subscription into a memcode backend: it finds the GitHub token the machine already has (an env var or `gh auth token`), exchanges it for a short-lived Copilot API token, and returns the endpoint + identity headers the Copilot API requires.","isRedistributable":true}
