Files
plugins/packages/copilot/package.json
T
yetone 53d4813743 copilot 0.1.1: a refused token exchange marks the sign-in, a quota read GitHub answers clears it (#618)
jinpy666 found idle Copilot slots saying "sign-in has expired — sign in
again" while their OAuth token still traded at
/copilot_internal/v2/token. Two things in the plugin kept the mark wrong:

- The loader's token exchange threw a plain "Token refresh failed: N"
  for every failure, so a refresh GitHub really refused (401) never told
  magpie the sign-in was gone. It now carries signIn "expired" on a 401
  only; 403, 429 and 5xx carry nothing, as before.
- Every quota read said signIn "kept", so a read GitHub answered with
  the OAuth token never cleared a mark. It now says "renewed" on any 200
  with a JSON object (readable quota or not). A 401 still says
  "expired"; every other failure still "kept". Accounts marked before
  this are cleared on their next quota read.

magpie's side (a bare 401 on a stored access token with a refresh token
makes the token due instead of marking the account) ships in magpie
itself.

Run (mote, bun 1.4.2, at this commit): `bun test` in packages/copilot,
42 pass; `bun scripts/check.mjs copilot` ok.
Broken by hand: with index.mjs and usage.mjs back at 0.1.0 the two new
tests fail (the exchange's 401 has no signIn; the 200 read says kept).
Not tried: a real Copilot account, a real 401 from the exchange.
2026-11-02 11:46:50 +08:00

17 lines
596 B
JSON

{
"name": "@magpie-community/opencode-copilot-auth",
"version": "0.1.1",
"description": "GitHub Copilot on GitHub.com and GitHub Enterprise, with account quota and credit balances for magpie",
"type": "module",
"main": "./index.mjs",
"files": ["index.mjs", "endpoints.mjs", "usage.mjs", "README.md", "LICENSE"],
"keywords": ["opencode", "opencode-plugin", "github", "copilot", "magpie"],
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/magpie-community/plugins",
"directory": "packages/copilot"
},
"scripts": { "test": "bun test" }
}