Skip to content

feat: migrate address-bar web search to support Tavily - #4

Open
manisrinivasan2k1 wants to merge 2 commits into
alexvilelabah:mainfrom
Tavily-FDE:feat/tavily-migration/address-bar-web-search
Open

feat: migrate address-bar web search to support Tavily#4
manisrinivasan2k1 wants to merge 2 commits into
alexvilelabah:mainfrom
Tavily-FDE:feat/tavily-migration/address-bar-web-search

Conversation

@manisrinivasan2k1

Copy link
Copy Markdown

Summary

Adds Tavily as a configurable alternative to Google for address-bar web searches (ADDITIVE migration — Google remains the default).

When the user sets localStorage.defaultSearchEngine to 'tavily', search queries typed in the address bar are routed through the Tavily API via IPC. Results are displayed in the chat panel as formatted markdown. If Tavily returns no results or fails, the search falls back to Google navigation automatically.

Files Changed

  • package.json — Added @tavily/core dependency
  • src/main/main.ts — Added tavily:search IPC handler that calls the Tavily search API using TAVILY_API_KEY env var
  • src/preload/preload.ts — Exposed tavilySearch bridge method to the renderer
  • src/renderer/App.tsx — Updated navigate() to check defaultSearchEngine setting and route to Tavily when selected; added tavilySearch to the Window.electronAPI type declaration
  • src/renderer/site-knowledge.ts — Added Tavily entry to SITE_SHORTCUTS array

Dependency Changes

  • Added @tavily/core: ^0.0.7 to dependencies in package.json

Environment Variable Changes

  • Added TAVILY_API_KEY — read by the main process in the tavily:search IPC handler; required for Tavily search to function

Notes for Reviewers

  • Google search remains the default — Tavily only activates when explicitly configured via localStorage.setItem('defaultSearchEngine', 'tavily')
  • The Tavily IPC handler uses dynamic import() so the module is only loaded when actually needed
  • Both renderer and main type checks pass cleanly
  • No existing behavior is changed for users who don't configure Tavily

Automated Review

  • Passed after 2 attempt(s)
  • Final review: The address-bar-web-search Tavily migration is correct and well-implemented. All three items from the implementation summary are present: @tavily/core@^0.7.6 in package.json (matching prior units), a top-level static import in main.ts, and tab ID captured before the async Tavily call in App.tsx to prevent race conditions. The IPC handler is properly guarded against missing API keys and query strings, loading state is correctly managed in both success and error paths, and fallback to Google works in both the empty-results and error cases. The preload bridge exposure and site-knowledge.ts entry are clean. Only minor issues found.

@alexvilelabah

Copy link
Copy Markdown
Owner

Thanks for the PRs, and for the detail in the write-ups.

I'm going to pass on these, and I want to be straight about why. Bah's main constraint is that it has to work for someone who just downloads the installer and opens it — no signup, no API key. These PRs read TAVILY_API_KEY from an environment variable, which none of my users will ever set, so in practice the Tavily path would never run for them: it would fall back to Google every time, while still adding a dependency and extra code to the agent's hot path.

As they stand, the three PRs also each register the same tavily:search IPC handler, so they can't all be merged as-is.

If Tavily ever has a keyless tier that works with no signup, I'd genuinely be interested — that's the bar for anything that ships in the default experience here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants