Commit Graph

34 Commits

Author SHA1 Message Date
Mario Zechner 3029836894 fix(ai): stop Codex OAuth stderr writes
closes #4141
2026-05-06 00:14:40 +02:00
Armin Ronacher b5755fd27d feat(oauth): support interactive login selection (#4190) 2026-05-05 13:16:56 +02:00
Mario Zechner fe66edd943 remove gemini cli and antigravity support 2026-04-30 21:24:36 +02:00
Michael ebc60aa825 feat(ai): allow overriding oauth callback bind host closes #3396 (#3409) 2026-04-20 13:43:08 +02:00
Mario Zechner 94ba13ccef fix(ai): align oauth callback flows closes #2316 2026-03-17 23:13:44 +01:00
Mario Zechner 3563cc4df6 fix(ai): resolve codex oauth callback immediately closes #2316 2026-03-17 22:47:51 +01:00
Mario Zechner e645995a4a fix(ai): fix anthropic oauth manual callback and refresh flow closes #2169 2026-03-15 15:40:50 +01:00
Mario Zechner c7309aedac fix(ai): replace curl with fetch in Anthropic OAuth token exchange 2026-03-14 03:21:08 +01:00
Mario Zechner 92882dc4cc fix(ai): improve anthropic oauth flow fixes #2119 2026-03-13 22:38:34 +01:00
Ben Hayden fd0c7c3bdb fix(ai): improve GitHub Copilot OAuth polling (#1994) 2026-03-09 20:15:17 +01:00
Mario Zechner e0754fdbb3 fix(ai,coding-agent): make pi-ai browser-safe and move OAuth runtime exports
- add browser smoke bundling check to root check + pre-commit

- lazy-load Bedrock provider registration to avoid browser graph traversal

- remove top-level OAuth runtime exports from @mariozechner/pi-ai

- add @mariozechner/pi-ai/oauth subpath export and update coding-agent imports

- move proxy dispatcher init to coding-agent CLI (Node-only)

- document Bedrock/OAuth browser limitations

closes #1814
2026-03-04 20:21:25 +01:00
Mario Zechner 2f55890452 fix(coding-agent,ai): finalize provider unregister lifecycle and dependency security updates fixes #1669 2026-02-27 21:00:25 +01:00
Mario Zechner b0a8d79844 fix(ai): guard google oauth node http imports for browser bundlers closes #1330 2026-02-06 18:44:57 +01:00
Mario Zechner 469fb5d27c fix(ai): OAuth login/refresh now respects HTTP proxy env vars
Extracted HTTP proxy setup to shared module and imported it from both
stream.ts and oauth/index.ts. This ensures fetch() calls during OAuth
flows (token exchange, refresh, project discovery) go through the proxy.

fixes #1132
2026-02-01 19:08:13 +01:00
Mario Zechner 3256d3c083 refactor(oauth): add provider registry 2026-01-24 23:15:11 +01:00
Danila Poyarkov 6d0c544e18 fix: Bun compatibility for build scripts and runtime detection 2026-01-23 19:31:16 +03:00
Mario Zechner b712d1ca43 fix(ai, web-ui): browser compatibility for pi-ai, update tsgo for decorator support
- Update @typescript/native-preview to 7.0.0-dev.20260120.1 (supports experimentalDecorators)
- Replace top-level node:fs, node:os, node:path imports with dynamic imports in stream.ts
- Replace top-level node:os import with dynamic import in openai-codex-responses.ts
- Replace top-level node:crypto, node:http imports with dynamic imports in openai-codex.ts
- Replace Buffer.from with atob for browser-compatible base64 decoding

fixes #873
2026-01-22 01:33:46 +01:00
Mario Zechner 693112e395 feat(ai): add originator option to loginOpenAICodex 2026-01-20 01:28:51 +01:00
Mario Zechner 6dcb64565a Prepare for alternative Codex harness certification 2026-01-10 13:22:10 +01:00
Mario Zechner c84f2f25de Fix lint warnings: use literal keys instead of bracket notation 2026-01-09 23:54:50 +01:00
cmf c7bac7583c Fix OAuth using Google Cloud Code Assist. 2026-01-09 23:31:11 +01:00
Mario Zechner 19b5663340 Revert "Remove Anthropic OAuth support"
This reverts commit f5e6bcac1b.
2026-01-09 06:00:20 +01:00
Mario Zechner f5e6bcac1b Remove Anthropic OAuth support 2026-01-09 05:10:33 +01:00
Mario Zechner 9b12719ab1 Improve OAuth login UI with consistent dialog component
- Add LoginDialogComponent with proper borders (top/bottom DynamicBorder)
- Refactor all OAuth providers to use racing approach (browser callback vs manual paste)
- Add onEscape handler to Input component for cancellation
- Add abortable sleep for GitHub Copilot polling (instant cancel on Escape)
- Show OS-specific click hint (Cmd+click on macOS, Ctrl+click elsewhere)
- Clear content between login phases (fixes GitHub Copilot two-phase flow)
- Use InteractiveMode's showStatus/showError for result messages
- Reorder providers: Anthropic, ChatGPT, GitHub Copilot, Gemini CLI, Antigravity
2026-01-05 19:58:44 +01:00
Christian Catalan 05b9d55656 feat(oauth): show paste input immediately during OpenAI Codex login (#468)
Previously, users had to wait up to 60 seconds for the browser callback
to timeout before being prompted to paste the authorization code. This
was problematic for SSH/VPS sessions where the callback cannot work.

Now the paste input is shown immediately alongside the browser flow:
- Browser callback and manual paste race - whichever completes first wins
- Desktop users: browser callback succeeds, input is cleaned up
- SSH/VPS users: paste code immediately without waiting

Changes:
- Add cancelWait() to OAuth server for early termination of polling loop
- Add onManualCodeInput callback that races with browser callback
- Show paste input immediately in TUI for openai-codex provider
- Clean up input on success, error, or when browser callback wins

Co-authored-by: cc-vps <crcatala+vps@gmail.com>
2026-01-05 18:47:58 +01:00
Ahmed Kamal 1650041a63 feat(ai): add OpenAI Codex OAuth + responses provider 2026-01-04 21:11:19 +02:00
Mario Zechner 3bf168615a Use dynamic import for http module in OAuth files
Prevents browser bundles from failing on import.
The http module is only loaded when login functions are actually called.
2025-12-30 22:42:21 +01:00
Mario Zechner 481bc79f83 Fix Buffer usage in github-copilot.ts - use atob() 2025-12-30 22:42:21 +01:00
Mario Zechner c10fc1e081 Use Web Crypto API for OAuth PKCE, remove Node.js crypto dependency
- Add pkce.ts with generatePKCE() using Web Crypto API
- Update anthropic.ts, google-gemini-cli.ts, google-antigravity.ts
- Replace Buffer.from() with atob() for base64 decoding
- Works in both Node.js 20+ and browsers

The OAuth modules still use Node.js http.createServer for callbacks,
so they only work in CLI environments, but they no longer crash on
import in browser bundles.
2025-12-30 22:42:21 +01:00
Mario Zechner 030788140a WIP: Remove global state from pi-ai OAuth/API key handling
- Remove setApiKey, resolveApiKey, and global apiKeys Map from stream.ts
- Rename getApiKey to getApiKeyFromEnv (only checks env vars)
- Remove OAuth storage layer (storage.ts deleted)
- OAuth login/refresh functions now return credentials instead of saving
- getOAuthApiKey/refreshOAuthToken now take credentials as params
- Add test/oauth.ts helper for ai package tests
- Simplify root npm run check (single biome + tsgo pass)
- Remove redundant check scripts from most packages
- Add web-ui and coding-agent examples to biome/tsgo includes

coding-agent still has compile errors - needs refactoring for new API
2025-12-25 01:01:03 +01:00
Mario Zechner d5fd685901 Enable more biome lints and fix things 2025-12-21 22:56:20 +01:00
Mario Zechner ce950ae96e Clean-up 2025-12-20 22:15:30 +01:00
Mario Zechner a81dc5eaca Add configurable OAuth storage backend and respect --models in model selector
- Add setOAuthStorage() and resetOAuthStorage() to pi-ai for custom storage backends
- Configure coding-agent to use its own configurable OAuth path via getOAuthPath()
- Model selector (/model command) now only shows models from --models scope when set
- Rewrite OAuth documentation in pi-ai README with examples

Fixes #255
2025-12-20 22:00:53 +01:00
Mario Zechner c359023c3f Add Google Gemini CLI and Antigravity OAuth providers
- Add google-gemini-cli provider: free Gemini 2.0/2.5 via Cloud Code Assist
- Add google-antigravity provider: free Gemini 3, Claude, GPT-OSS via sandbox
- Move OAuth infrastructure from coding-agent to ai package
- Fix thinking signature handling for cross-model handoff
- Fix OpenAI message ID length limit (max 64 chars)
- Add GitHub Copilot overflow pattern detection
- Add OAuth provider tests for context overflow and streaming
2025-12-20 21:34:18 +01:00