Sycophant.Auth.GithubCopilot.TokenCache
(sycophant v0.4.2)
Copy Markdown
Supervised GenServer that caches Copilot tokens per {github_host, sha256(gh_token)}.
- Lazily refreshes on
fetch/2when within 30s ofexpires_at. - Serializes concurrent refreshes per cache key (no thundering herd).
- 32-entry LRU keeps memory bounded.
- State has a custom
Inspectimpl that redactscopilot_token.
Public API: fetch/2. All other functions are GenServer internals.
Summary
Functions
Returns a specification to start this module under a supervisor.
Returns a valid Copilot token entry for the given GitHub credential.
Starts the token cache. Called by Sycophant.Application.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec fetch(String.t(), String.t()) :: {:ok, Sycophant.Auth.GithubCopilot.TokenCache.Entry.t()} | {:error, Splode.Error.t()}
Returns a valid Copilot token entry for the given GitHub credential.
Blocks until either a cached entry is available or a fresh exchange completes.
@spec start_link(keyword()) :: GenServer.on_start()
Starts the token cache. Called by Sycophant.Application.