On Windows 11, a signed-out agy opened Google's sign-in page 235 times in one day. The usage refresh ran `agy` about every 3 minutes, and agy opens the browser through ShellExecuteW, so the BROWSER=open.cmd guard can't stop it. New signin.mjs reads agy's stored sign-in without running agy. agy keeps it through go-keyring, service "gemini" and user "antigravity": - macOS: `security find-generic-password`; - Windows: CredReadW from PowerShell, on the credential "gemini:antigravity". It reads only whether a sign-in is stored, whether it has a refresh token, and when the access token ends. The token itself never leaves the function; a hash tells one sign-in from the next. Setting GEMINI_API_KEY, GOOGLE_API_KEY, AGY_ADC_AUTH or GOOGLE_GENAI_USE_VERTEXAI means agy signs in some other way, so nothing is concluded from the keyring. AGY_BRIDGE_STORED_SIGNIN=skip turns the read off. An access token that has ended is not "needs sign-in". The owner's working agy has one that ended 11 hours ago and is renewed from its refresh token. agy counts as unable to sign in when: - no sign-in is stored; - the access token has ended and there is no refresh token; - or agy already failed on this stored sign-in: it said it needs a sign-in, or it hung with an ended token and printed nothing or sign-in talk, the way an agy waiting on its browser does. This holds until another sign-in is stored. What changes: - Usage: in those cases agy isn't run. The read says signIn "expired", and magpie shows the account's sign-in as expired. After the next good read it says "renewed", and magpie clears that. - Other usage failures wait 10 minutes before the next run, doubling up to 6 hours. Before, they ran again on every refresh. - The model listing (`agy models`) isn't run in the background in those cases either. The catalog it has stays. - Signing in from magpie skips the `agy models` probe and goes straight to magpie's own sign-in link. A finished sign-in clears what was marked dead. - A request answers 401 with X-Magpie-Sign-In: expired when no sign-in is stored. This uses the last read, so a request never waits for PowerShell. - `agy --version` hanging is never read as a sign-in wait. Run: - mote, rebased ona02d5912: `bun scripts/check.mjs` ok and `bun test` in packages/agy-cli (20 pass, 0 fail). - mote, root `HOME=<temp> bun test` at the pre-rebase head (e90d6f01base): 7588 pass, 427 fail, none in agy-cli. The reds named in the kept tail are OAuth callback-port and loopback page-service tests (mote at load ~35-40); main's own CI test job passes them, so this push's CI test job is the record for the whole suite. - win-run on xiaomi-gpu: test/signin.mjs and test/usage.mjs (21 pass, 3 skip on Windows), plus the PowerShell script for real. Over SSH, CredReadW answers 1312 (no logon session), which the script turns into "unknown". So the struct read was tried on a CREDENTIALW built in memory with a UTF-8 blob: the bytes round-trip and the sign-in parses. Broken by hand: - with the usage gate, the backoff hold and the dead mark removed, 5 usage tests go red; - with listAgyModels' gate and the request gate removed, the new catalog test goes red; - with the request gate alone removed, it goes red too. Not tried: - a real signed-out agy, by the rule against running a real agy sign-in or a browser; - CredReadW in an interactive Windows session (none was logged on); - agy on Windows at all (xiaomi-gpu has no agy). On Linux the keyring isn't read ("unknown"): agy runs as before, with the backoff, and the xdg-open shim already stops the browser there.
51 lines
1.1 KiB
JSON
51 lines
1.1 KiB
JSON
{
|
|
"name": "@magpie-community/opencode-agy-cli-auth",
|
|
"version": "0.1.34",
|
|
"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": [
|
|
"index.mjs",
|
|
"opencode.mjs",
|
|
"opencode2.mjs",
|
|
"platform.mjs",
|
|
"login.mjs",
|
|
"mcp-server.mjs",
|
|
"step-usage.mjs",
|
|
"tool-schema.mjs",
|
|
"usage.mjs",
|
|
"signin.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"
|
|
},
|
|
"magpie": {
|
|
"maxConcurrency": 16
|
|
}
|
|
}
|