Provider & subscription

panto-copilot

rock 0.2.0-1Source

GitHub Copilot defaults for panto. Mark named tables; the extension fills the boilerplate.

Setup

Requires panto's configure(config) extension hook (before auth/provider validation).

TOML
[extensions]
rocks = ["panto-copilot"]

[auth.copilot]
panto_copilot_extension = true

[providers.copilot]
auth = "copilot"
panto_copilot_extension = true
SH
panto auth login copilot
panto models sync
panto models list copilot:

Defaults

SettingValue
AuthGitHub device OAuth, then Copilot token exchange; panto owns credentials/refresh
APIsResponses (default), Chat Completions, Anthropic Messages
Endpointhttps://api.individual.githubcopilot.com; exchange may supply the account endpoint
Cataloggithub-copilot
IdentityCopilot Chat 0.35.0, VS Code 1.107.0; all headers are overridable

Rules

  • Only panto_copilot_extension = true opts in; auth/provider names are arbitrary.
  • Keep providers.<name>.auth explicit; the extension never guesses linkage.
  • Explicit values win, including nested endpoints and case-insensitive headers.
  • Defaults are independent per table and per load; no config files are rewritten.
  • Credentials stay native; env and session placeholders stay raw for panto.
  • Rigs inherit user connection settings after this hook runs, so they need not include this extension unless their own config uses its markers. --no-extensions skips the hook.

Existing flat base_url configurations stay flat; otherwise all three endpoints are filled. Overrides must remain valid panto configuration.

Quota polling requires panto's http_request API and the render_footer event. It runs only when this extension is permitted and at least one marked auth or provider subscription is configured.

  • It queries every distinct named auth, not only the current model.
  • Polls start at session_ready, repeat about every 60 seconds when luv is available, and are throttled after turns.
  • Failed snapshots are retained and marked stale, with bounded retry backoff.
  • Session end cancels the timer and any in-flight request.
  • One shared logical usage row wraps to the terminal width.

Quota comes from GitHub's internal https://api.github.com/copilot_internal/user endpoint, which is undocumented and subject to change. It uses the original named GitHub OAuth access token, never the exchanged inference token, and never logs in interactively or reads token files.

The footer uses lowercase provider and window labels, highlighted headings, and green/yellow/red percentages at 33% and 66%, with reset countdowns such as reset in 2d 3h 12m. A shared, unreferenced minute timer keeps countdowns current while idle; it does not fetch usage. Claude stays absent until its model is first used.

Packaging / checks

SH
panto lua _selfcheck.lua
panto lua _footer-selfcheck.lua
luarocks lint panto-copilot-0.1.1-1.rockspec

The rockspec maps require("panto-copilot") to init.lua, the quota poller and shared footer helper to their modules; no dependencies beyond Lua.

References