feat (auth): CLI OAuth supports pasting callback URLs to complete login

- Added callback URL resolution and terminal prompt logic
  - Codex/Claude/iFlow/Antigravity/Gemini login supports callback URL or local callback completion
  - Update Gemini login option signature and manager call
  - CLI default prompt function is compatible with null input to continue waiting
This commit is contained in:
Supra4E8C
2025-12-20 18:25:55 +08:00
parent 10f8c795ac
commit 93414f1baa
14 changed files with 302 additions and 33 deletions

View File

@@ -99,9 +99,18 @@ func (AntigravityAuthenticator) Login(ctx context.Context, cfg *config.Config, o
fmt.Println("Waiting for antigravity authentication callback...")
var cbRes callbackResult
manualCh, manualErrCh := promptForOAuthCallback(opts.Prompt, "antigravity")
select {
case res := <-cbChan:
cbRes = res
case manual := <-manualCh:
cbRes = callbackResult{
Code: manual.Code,
State: manual.State,
Error: manual.Error,
}
case err = <-manualErrCh:
return nil, err
case <-time.After(5 * time.Minute):
return nil, fmt.Errorf("antigravity: authentication timed out")
}