Commit Graph

15 Commits

Author SHA1 Message Date
王性驊 104e55d613 fix: Add proper page ready check before finding input
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()
2026-04-03 01:26:43 +08:00
王性驊 3d5f2d91c0 feat: Switch to playwright-go for better DOM automation
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)
2026-04-03 01:20:42 +08:00
王性驊 17b001d8c2 fix: Add debug output and fallback selectors for input field detection 2026-04-03 01:11:02 +08:00
王性驊 32673c028e refactor: Complete rewrite of GeminiWeb provider
Based on project-golem implementation:

Phase 1: Browser Persistence
- Add BrowserManager singleton to manage browser lifecycle
- Use launchPersistentContext with UserDataDir
- Auto-save cookies and session state
- Clean Chrome lock files on startup
- Single browser instance reused across requests

Phase 2: Improved DOM Interaction
- Use correct input selectors (ProseMirror first)
- Implement 'Physical Enter' send method
- Trigger input/change/keyup events properly
- Check for 'Stop' button to detect busy state

Phase 3: Session Management
- No manual cookie saving/loading needed
- Session pool just manages userDataDir paths
- Default session directory structure

Breaking changes:
- Remove manual cookie management
- Browser stays open between requests
- Simpler session management
2026-04-03 01:05:54 +08:00
王性驊 24459ffcfe fix: Don't wait for user input during login flow
- 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
2026-04-03 00:51:55 +08:00
王性驊 9f41d3b5b5 feat: Allow using Gemini Web without login
- 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
2026-04-03 00:45:59 +08:00
王性驊 69df57555d fix: Improve Gemini Web DOM selectors and add debug output
- 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
2026-04-03 00:40:57 +08:00
王性驊 19985dd476 feat: Route chat completions to Gemini Web provider when configured
- 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
2026-04-03 00:36:48 +08:00
王性驊 f33353897c feat: Add provider display in startup logs and OpenCode gemini-web config
- 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
2026-04-03 00:29:22 +08:00
王性驊 33a0e53709 feat: Add GeminiWeb provider foundation
- Add Provider interface and factory pattern
- Create apitypes package for shared types
- Implement GeminiWeb provider with:
  - Browser automation using Rod
  - Session pool management
  - Cookie persistence
  - DOM interaction for Gemini web interface
- Add gemini-login command for session setup
- Add CURSOR_BRIDGE_PROVIDER env variable

Remaining: Integration with chat.go handlers
2026-04-02 22:45:41 +08:00
王性驊 670c1b37c1 fix output 2026-04-02 21:54:28 +08:00
王性驊 663b2f4c63 add docker file and claude flow output 2026-04-01 04:32:17 +00:00
王性驊 9919fc7bb9 fix 2026-04-01 00:53:34 +00:00
王性驊 974f2f2bb5 fix logs 2026-03-31 03:02:11 +00:00
王性驊 a2f1d05391 first commit 2026-03-30 14:09:15 +00:00