feat(tools): add web_search and web_fetch tools - #78
Merged
Merged
Conversation
compute_use (modules/browser) already covered browser automation and capture; there was no way to search the web or fetch a single URL without a browser session. Add web_search (Brave, Tavily, or Ollama Search, whichever backend is selected) and web_fetch (a direct, SSRF-guarded GET, or Tavily's extract endpoint when Tavily is selected). Backend configuration lives in a new web_providers table, managed by `mininaru webprovider`. It follows agents.selected's single-selection shape (one row selected at a time via a unique partial index) rather than the active-column shape providers once had and later dropped, and reuses the existing at-rest encryption for api_key. modules/web_search and modules/web_fetch take a WebBackendLookup closure from core/tools.go instead of importing core directly, since core already imports them and a direct import would cycle. Also rename a batch of existing multi-word filenames to snake_case (core/agentspawn.go -> agent_spawn.go, util/apikey.go -> api_key.go, and others) for consistency with the new files, and fix the stale filenames that referenced in docs/ARCHITECTURE.md.
6 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
compute_use (
modules/browser) already covers browser automation + screenshot capture. This adds two more read-only tools:web_search(Brave, Tavily, or Ollama Search — whichever backend is selected) andweb_fetch(a direct, SSRF-guarded GET, or Tavily's extract endpoint when Tavily is the selected backend).Backend configuration is a new
web_providerstable managed viamininaru webprovider add/list/show/set/primary/remove. It follows the single-selection shapeagents.selecteduses (one row selected at a time via a unique partial index), not theactive-column shapeprovidersonce had and later dropped in0007_agent_selected_provider_active_removal.sql— reusing the pattern the project kept, not the one it abandoned.api_keyis encrypted at rest the same wayproviders.api_keyalready is.modules/web_search/modules/web_fetchtake aWebBackendLookupclosure fromcore/tools.gorather than importingcoredirectly, sincecorealready imports them and a direct import would cycle.Also renames a batch of pre-existing multi-word filenames to snake_case for consistency with the new files (
core/agentspawn.go→agent_spawn.go,util/apikey.go→api_key.go, and others), and fixes the stale filenamesdocs/ARCHITECTURE.mdreferenced.How it was verified
make test-racepassesAdded
core/web_provider_test.go(CRUD + auto-select-first +WebProviderSelect/WebProviderSelected, mirroringcore/agent_test.go's style),modules/web_fetch/web_fetch_test.go(the bogon/SSRF guard actually rejects loopback/private/link-local addresses, including against a realhttptest.Serveron 127.0.0.1), andmodules/web_search/web_search_test.go(arg validation, backend dispatch, result formatting).Checklist
:=, onevarblock per function in first-use order witherrlast, callees before callers, andmainunconditionally last.gofiles carry the two-line SPDX headerdocs/ARCHITECTURE.md)GPL-3.0-only, matching the project