Files
plugins/packages/agy-cli/package.json
T
yetone 44bfefb7a7 agy-cli 0.1.84: an ended access token is renewed by the plugin for usage, so agy never opens a sign-in (#1234)
qiankun229 traced it in agy's own logs (#1234): at Windows startup the
background usage read ran `agy -p /usage` with an ended access token and
a refresh token. agy's silent renewal failed for a moment (a 10s keyring
timeout, or "no such host" for oauth2.googleapis.com before the network
was up) and agy fell back to an interactive Google sign-in, which opens
the browser through ShellExecuteW past the BROWSER/PATH shims. The next
read renewed the same token fine. The stored-sign-in precheck passes such
a token, since it can be renewed.

- createUsageReader: when the stored access token has ended or ends
  within two minutes and has a refresh token, fetchUsage reads with
  `direct`: it runs `agy --version` only (no sign-in) and reads the quota
  the way agy does (readQuotaDirect, loadCodeAssist then
  retrieveUserQuotaSummary, with agy's User-Agent), renewing the token in
  memory. agy's stored sign-in is never written. `agy -p` isn't run.
- A failed renewal is a failed read: it backs off as before and keeps
  the sign-in. A network error says to check the network or proxy.
- Google answering the refresh with invalid_grant (400/401) is
  kind "auth": the account reads as signed out ("Sign in again") and
  nothing runs for that sign-in again until another is stored.
- A token with time left still goes through agy -p, as before.

Tests: three tests that leaned on an ended token only to get agy to run
now use a token whose end isn't said (as the existing "refreshing" test
does); what they check is unchanged.

Run (mote, HOME=$(mktemp -d)):
- test/usage.mjs (AGY_BRIDGE_STORED_SIGNIN=skip node --test): 41 pass.
- bun test agy-cli.test.mjs: 20 pass, 0 fail.
- bun scripts/check.mjs agy-cli: ok.

Broken by hand: origin/main's usage.mjs with the new tests: the three
new tests fail (agy -p ran for an ended token; no backoff/network
message; invalid_grant not auth), 38 pass.

Not tried: Windows with a real ended token and the network down at
startup (no agy account here: the local one answers 403); the requests
are the ones the region-refusal path has made since 0.1.7x.
2026-11-17 02:50:13 +08:00

60 lines
1.2 KiB
JSON

{
"name": "@magpie-community/opencode-agy-cli-auth",
"version": "0.1.84",
"description": "Magpie/OpenCode model provider that connects your local agy CLI through the Agent Client Protocol (agy acp), so Antigravity subscription models run through the real CLI",
"type": "module",
"main": "./opencode.mjs",
"exports": {
".": "./opencode2.mjs"
},
"files": [
"proc.mjs",
"index.mjs",
"documents.mjs",
"opencode.mjs",
"opencode2.mjs",
"platform.mjs",
"install.mjs",
"login.mjs",
"mcp-server.mjs",
"step-usage.mjs",
"tool-schema.mjs", "tool-budget.mjs",
"usage.mjs",
"model-ids.mjs",
"signin.mjs",
"account.mjs",
"import.mjs",
"README.md",
"README.en.md",
"LICENSE",
"NOTICE.md",
"re2-pattern.mjs",
"array-items.mjs",
"cloak.mjs"
],
"keywords": [
"magpie",
"magpie-plugin",
"opencode",
"opencode-plugin",
"antigravity",
"agy",
"acp"
],
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/magpie-community/plugins.git",
"directory": "packages/agy-cli"
},
"scripts": {
"test": "bun test"
},
"engines": {
"magpie": ">=0.1.4246"
},
"magpie": {
"maxConcurrency": 16
}
}