feat: web_fetch and web_search tools #163

Merged
hermes merged 1 commits from feat/web-tools into main 2026-10-16 19:31:28 +00:00
Collaborator

Adds two tools.

  • web_fetch(url, max_chars?): http(s) GET, HTML to text (html2text), 2 MB body cap, 20k char output cap, 5 redirects each re-checked. SSRF guard blocks non-http schemes and loopback/private/link-local/CGNAT/ULA addresses (also IPv4-mapped). Output wrapped in <web_content url=...>. Asks permission once per domain ("allow always" stores web:<host> in .hx/allow.json).
  • web_search(query, limit?): Brave (default, $BRAVE_API_KEY) or SearXNG ([web] searxng_url). Brave without key falls back to SearXNG if a URL is set; neither = tool not registered. SearXNG 403 gives a hint about search.formats: json.

Config: [web] search = "brave"|"searxng", searxng_url. Documented in config.sample.toml.

Not done: stats counters per web tool, caching, JS rendering, DNS pinning (ponytail comment in web.rs).

Tests: 4 web unit tests (fake server: redirect, html, binary, truncation, SSRF, searxng, 403 hint, backend pick) + permit test. clippy/fmt clean; e2e scripts pass. tests/tui_smoke.py has 2-3 FAILs that also occur on main.

Adds two tools. - `web_fetch(url, max_chars?)`: http(s) GET, HTML to text (html2text), 2 MB body cap, 20k char output cap, 5 redirects each re-checked. SSRF guard blocks non-http schemes and loopback/private/link-local/CGNAT/ULA addresses (also IPv4-mapped). Output wrapped in `<web_content url=...>`. Asks permission once per domain ("allow always" stores `web:<host>` in .hx/allow.json). - `web_search(query, limit?)`: Brave (default, `$BRAVE_API_KEY`) or SearXNG (`[web] searxng_url`). Brave without key falls back to SearXNG if a URL is set; neither = tool not registered. SearXNG 403 gives a hint about `search.formats: json`. Config: `[web] search = "brave"|"searxng"`, `searxng_url`. Documented in config.sample.toml. Not done: stats counters per web tool, caching, JS rendering, DNS pinning (ponytail comment in web.rs). Tests: 4 web unit tests (fake server: redirect, html, binary, truncation, SSRF, searxng, 403 hint, backend pick) + permit test. clippy/fmt clean; e2e scripts pass. tests/tui_smoke.py has 2-3 FAILs that also occur on main.
hermes added 1 commit 2026-10-16 19:30:36 +00:00
hermes merged commit bd9671804b into main 2026-10-16 19:31:28 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: johannes/hx#163