Commit Graph

32 Commits (02e3fbef77a68c1cb91069caa35cdc3e121905ab)

Author SHA1 Message Date
Peter Steinberger 5eb72ab769 fix(security): harden browser SSRF defaults and migrate legacy key 9 months ago
AkosCz 3a3c2da916
[Feature]: Add Gemini (Google Search grounding) as web_search provider (#13075)
* feat: add Gemini (Google Search grounding) as web_search provider

Add Gemini as a fourth web search provider alongside Brave, Perplexity,
and Grok. Uses Gemini's built-in Google Search grounding tool to return
search results with citations.

- Add runGeminiSearch() with Google Search grounding via tools API
- Resolve Gemini's grounding redirect URLs to direct URLs via parallel
  HEAD requests (5s timeout, graceful fallback)
- Add Gemini config block (apiKey, model) with env var fallback
- Default model: gemini-2.5-flash (fast, cheap, grounding-capable)
- Strip API key from error messages for security
- Add config validation tests for Gemini provider
- Update docs/tools/web.md with Gemini provider documentation

Closes #13074

* feat: auto-detect search provider from available API keys

When no explicit provider is configured, resolveSearchProvider now
checks for available API keys in priority order (Brave → Gemini →
Perplexity → Grok) and selects the first provider with a valid key.

- Add auto-detection logic using existing resolve*ApiKey functions
- Export resolveSearchProvider via __testing_provider for tests
- Add 8 tests covering auto-detection, priority order, and explicit override
- Update docs/tools/web.md with auto-detection documentation

* fix: merge __testing exports, downgrade auto-detect log to debug

* fix: use defaultRuntime.log instead of .debug (not in RuntimeEnv type)

* fix: mark gemini apiKey as sensitive in zod schema

* fix: address Greptile review — add externalContent to Gemini payload, add Gemini/Grok entries to schema labels/help, remove dead schema-fields.ts

* fix(web-search): add JSON parse guard for Gemini API responses

Addresses Greptile review comment: add try/catch to handle non-JSON
responses from Gemini API gracefully, preventing runtime errors on
malformed responses.

Note: FIELD_HELP entries for gemini.apiKey and gemini.model were
already present in schema.help.ts, and gemini.apiKey was already
marked as sensitive in zod-schema.agent-runtime.ts (both fixed in
earlier commits).

* fix: use structured readResponseText result in Gemini error path

readResponseText returns { text, truncated, bytesRead }, not a string.
The Gemini error handler was using the result object directly, which
would always be truthy and never fall through to res.statusText.
Align with Perplexity/xAI/Brave error patterns.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* style: fix import order and formatting after rebase onto main

* Web search: send Gemini API key via header

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
9 months ago
Peter Steinberger 166cf6a3e0 fix(web_fetch): cap response body before parsing 9 months ago
青雲 89fa93ed75
feat: support freshness parameter for Perplexity web_search provider (#15343)
Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 01aba2bfba053c028f62970dcd153b19d00c5e3b
Co-authored-by: echoVic <16428813+echoVic@users.noreply.github.com>
Co-authored-by: sebslight <19554889+sebslight@users.noreply.github.com>
Reviewed-by: @sebslight
9 months ago
Seb Slight 578a6e27aa
Docs: enable markdownlint autofixables except list numbering (#10476)
* docs(markdownlint): enable autofixable rules except list numbering

* docs(zalo): fix malformed bot platform link
10 months ago
Sebastian 0a1f4f666a revert(docs): undo markdownlint autofix churn 10 months ago
Sebastian c7aec0660e docs(markdownlint): enable autofixable rules and normalize links 10 months ago
Sebastian 1bf9f237f7 docs: linting 10 months ago
Peter Steinberger d3ba57b7d7 feat: add configurable web_fetch maxChars cap 10 months ago
Seb Slight abcaa8c7a9
Docs: add nav titles across docs (#5689) 10 months ago
cpojer 8cab78abbc
chore: Run `pnpm format:fix`. 10 months ago
Peter Steinberger 9a7160786a refactor: rename to openclaw 10 months ago
Peter Steinberger 6d16a658e5 refactor: rename clawdbot to moltbot with legacy compat 10 months ago
Peter Steinberger 9afde64e26 fix: validate web_search freshness (#1688) (thanks @JonUleis) 10 months ago
Peter Steinberger cfdd5a8c2e docs: consolidate faq under help 10 months ago
Peter Steinberger c129f0bbaa docs: align gateway service naming 10 months ago
Peter Steinberger 5bd55037e4 fix: harden web fetch SSRF and redirects
Co-authored-by: Eli <fogboots@users.noreply.github.com>
10 months ago
Peter Steinberger 3e546e691d fix: infer perplexity baseUrl from api key 10 months ago
Peter Steinberger 568b8ee96c refactor: split web tools and docs 10 months ago
Kevin Lin ff9d069a33 feat(web): add Perplexity Sonar as alternative search provider 10 months ago
Peter Steinberger c54c665f97 feat: enhance web_fetch fallbacks 10 months ago
Peter Steinberger 37fa4f7eef feat: improve web_fetch readability extraction 10 months ago
Peter Steinberger 6b8db36a15 docs: clarify Brave web_search defaults (#1046) (thanks @YuriNachos) 10 months ago
Yurii Chukhlib 171060541a docs(web-search): document country and language parameters
Co-Authored-By: Claude <noreply@anthropic.com>
10 months ago
Peter Steinberger 2d1ae0916f chore: start 2026.1.15 (unreleased) 10 months ago
Peter Steinberger 95735c3978 chore: bump version to 2026.1.14-1 10 months ago
Peter Steinberger aac5b4673f docs: clarify Brave Search API key plan 10 months ago
Peter Steinberger 081e5ef572 fix(tools): enable web_fetch by default 10 months ago
Peter Steinberger 2e70c3ceab fix: return setup hint when web_search lacks key 10 months ago
Peter Steinberger 042b65dfcc feat: add web tools config to configure 10 months ago
Peter Steinberger 2e0325e3bf feat: add web search hint to onboarding 10 months ago
Peter Steinberger f275cc180b feat: add web tools 10 months ago