Expand description
Web search with reference-style URL preservation.
Results reuse the same reference-style URL preservation as the fetch path:
each hit’s title carries an inline [N] marker and the full URLs are
collected into a reference block, keeping the context window tight while
staying citable.
DuckDuckGo Lite is the default backend and needs no key, so the tool works
with zero configuration. Because it is scraped HTML it is also the least
reliable: types::SearchStatus reports a challenge or unparseable page as
a failure instead of an empty result, and providers::Provider offers
keyed alternatives for callers who need a real API contract.
Re-exports§
pub use providers::Provider;
Modules§
- compress
- extract
- Parse DuckDuckGo Lite’s table layout into structured results, and tell a real results page apart from a bot challenge.
- http
- HTTP primitives shared by the fetch and search paths: the user agent, the response-body cap, and the retry classification. Both paths previously carried their own copy of the last two and had drifted apart — search read bodies without any cap at all.
- providers
- Search backends.
- refs
- Shared reference-style URL preservation.
- tls
- Shared TLS trust configuration for the HTTP clients.
- types
- Types for the web-search layer.
Functions§
- build_
output - Assemble an output from parsed results.
- build_
output_ from_ ddg - Parse an already-fetched DuckDuckGo Lite page into a
SearchOutput(no network). Kept for tests and offline callers. - build_
refs - Build the reference block (index → URL) from parsed results.
- format_
results - Render the inline body: each result as
title [N]followed by its snippet. URLs are intentionally absent here — they live in the reference block. - render_
output - Render the human-readable form of a search: results, then the reference block, then a one-line note when the search did not actually answer.
- render_
references - Render the reference block appended to text output.
Thin wrapper over
crate::refs::render_block. - run_
search - Run a query against the configured provider, falling back to
options.fallbackwhen the primary errors or is blocked. - status_
note - A plain-language explanation of a non-
Okstatus.Nonewhen results came back normally.