- Remove Verbose from Config struct (inherited from RestConf)
- Remove Verbose from yaml config to fix conflict
- Use raw JSON parsing in handlers for interface{} Content field
- Fix config tests
- Update etc/chat-api.yaml with all configuration options (no env vars)
- Add ToBridgeConfig method to Config for YAML-based config
- Implement complete AnthropicMessages streaming with SSE
- Add Tools field to AnthropicRequest
- Update ServiceContext with model tracking
- Add all CRUD handlers for health, models, chat, anthropic
Features restored:
- Health check endpoint
- Models list with caching
- ChatCompletions streaming (OpenAI format)
- AnthropicMessages streaming (Anthropic format)
- Tool calls support for both formats
- Thinking/reasoning content support
- Rate limit detection and handling
- Account pool integration
- Request/response logging
- Model resolution with strict mode
- Workspace and prompt truncation handling
- Full SSE streaming support with proper event format
- Tool calls handling with marker detection
- Rate limit detection and reporting
- Account pool integration (round-robin, stats tracking)
- Request/response logging and traffic tracking
- Thinking/reasoning content support
- Model resolution with strict mode
- Workspace and prompt truncation handling
- Added X-Accel-Buffering header for proper SSE
- Pass method/path for logging context
- HealthLogic: simple health check response
- ModelsLogic: list Cursor CLI models with caching and Anthropic aliases
- ChatCompletionsLogic: scaffold for OpenAI-format completions (streaming placeholder)
- AnthropicMessagesLogic: scaffold for Anthropic format (TODO)
- Update handler for SSE streaming support
- Add models.go with ListCursorCliModels and model mappings
- Removed old files from internal/* (migrated to pkg/*)
- Removed old CLI files from cmd/ (now in cmd/cli/)
- Updated import paths (internal/* -> pkg/*)
- Rewrote main.go to support CLI commands + go-zero HTTP server
- Fixed AccountStat type references (use entity.AccountStat)
- Fixed cmd/cli/* to use usecase package instead of agent
- Fixed logger to use entity.AccountStat
- Fixed geminiweb fmt.Println redundant newlines
- Fixed scripts/detect-gemini-dom.go pointer format issues
- Migrate agent runner from internal/agent
- Migrate sanitizer from internal/sanitize
- Migrate toolcall from internal/toolcall
- Update import paths to use pkg/usecase
- Fix handler to use PlaywrightProvider instead of old Provider
- Add model selection for Gemini Web (fast/thinking/pro)
- Improve response extraction to remove 'Gemini said' prefix
- Add progress logging for headless mode
- Fix navigation to use Domcontentloaded instead of Networkidle
- Add proper input field selectors (.ql-editor)
- Improve response completion detection with stability check
- Add saveDiagnostics method
- Use defer in Generate to catch all errors
- Simplify typeInput error handling
- Automatic screenshot and HTML dump on failure
Features:
- Wait for user ENTER in visible mode (GEMINI_BROWSER_VISIBLE=true)
- Save screenshot to /tmp/gemini-debug.png
- Save HTML to /tmp/gemini-debug.html
- JavaScript-based element detection
- Multi-strategy wait (A: selectors, B: time, C: JS, D: debug)
- Detailed logging of each strategy attempt
- Page structure dump in debug mode
This helps identify why input field is not found
Key improvements:
- Wait for page to fully load (SPA needs time)
- Wait for input field to be visible before typing
- Check login status only after page is ready
- Add fallback wait (3 seconds) if first attempt fails
- Properly handle error messages
Based on project-golem's PageInteractor.waitForReady()
Major refactor using Playwright (pure Go):
- Add playwright-go dependency (v0.5700.1)
- Create PlaywrightProvider with auto-wait for elements
- Use LaunchPersistentContext for session persistence
- Implement Locator-based element finding (auto-wait)
- Fill input using Playwright's built-in methods
- Add fallback selectors for input fields
- Better error messages with page URL and title
Key improvements over Rod:
- Auto-wait for elements (solves 'input field not found')
- More mature browser automation library
- Better documentation and examples
- Based on project-golem's proven strategies
Installation:
- Playwright driver and Chromium downloaded to ~/Library/Caches/ms-playwright/
- ~160MB download (one-time setup)
- Remove blocking 'Press Enter' prompt
- Continue without waiting when no session exists
- Save cookies asynchronously if user logs in during session
- Add debug output for finding input field and send button
- Try Enter key as fallback for sending message
- Remove requirement to login before using Gemini Web
- If logged in (cookies exist), use the account
- If not logged in, continue without login (browser opens)
- When browser is visible, prompt user they can login or continue without
- Save cookies only if user actually logs in
- Make model selector optional (skip if not found, use current model)
- Add multiple fallback selectors for input field and send button
- Add debug logging to trace execution flow
- Improve error messages to suggest running gemini-login
- Add HandleGeminiChatCompletions for Gemini Web provider requests
- Update router to route requests based on cfg.Provider
- Support both streaming and non-streaming modes for Gemini
- Map stream chunks to OpenAI-compatible SSE format
- Add provider name display in LogServerStart (cursor/gemini-web)
- Show gemini-dir and max-sess when using gemini-web provider
- Update Makefile to include gemini-web provider in opencode.json
- Update opencode-models to sync models for both cursor and gemini-web
- Add Gemini Web Provider examples in help text
- Add PROVIDER, GEMINI_ACCOUNT_DIR, GEMINI_BROWSER_VISIBLE, GEMINI_MAX_SESSIONS to Makefile
- Update gemini-login command to support --visible flag
- Add help text showing env vars and usage examples
- Display session save location and browser visibility on startup