Rework Gemini Web integration for current website protocol

PE
1d ago
+5554-296

Summary

Modernize the signed-in Google Gemini web text integration for the current website protocol, replacing the obsolete Bard transport and client paths.

  • Parse Google's observed UTF-16 length-framed RPC responses structurally, require confirmed completion, and reject malformed, mismatched, or incomplete continuation data.
  • Scope provider-status handling to Gemini generation records and preserve fail-closed behavior for uncertain remote turns.
  • Use browser-managed credentials, bounded reads, cancellation, timeout handling, and stale-response protection without automatically retrying uncertain prompt POSTs.
  • Discover account-specific model routing for Flash-Lite, Flash, Pro, and standalone Thinking. Provide API Mode presets with Extended thinking, Flash as the default, and explicit Auto/account-default compatibility.
  • Pin model routing, Google account route, and turn index to continuation state. Reject incompatible model switches and unsafe retries before submitting a follow-up.
  • Apply the existing Disable web mode history setting to Gemini Temporary Chat and localize extension-authored errors.

Compatibility and scope

Existing persisted bardWebFree, bardWebModelKeys, and bard_conversationObj identifiers remain compatible. The active implementation uses Gemini-named modules and does not manually read or inject Google session cookies.

This integration is text-only and adds no dependencies or manifest permissions. It does not add attachments, Deep Research, Gems, or Google account selection. A stored /app or /u/N route is not a stable Google account identity; start a new conversation when changing Google accounts.

The Gemini website protocol is undocumented and can change independently of this extension.

Fix #723

Summary by CodeRabbit

  • New Features

    • Added Google Gemini Web mode with Auto, Flash-Lite, Flash, Thinking, and Pro model options, plus optional Extended thinking for eligible models.
    • Added preset configuration, clearer model labels, and conversation continuity with retry support.
    • Added localized Gemini Web settings and error messages across supported languages.
  • Bug Fixes

    • Improved handling of sign-in and account issues, model availability, timeouts, interrupted or malformed responses, and request failures.
    • Bard Web mode is no longer available; Google web conversations now use Gemini Web.