# WebSearch

## 1. Scope {#scope}

This spec defines the `WebSearch` tool that the pi-dent-web-search extension registers: its
parameters, the search backends and how each is called, how a backend is chosen and when the next
one is tried, how results are cleaned, the configuration, the tool result, and the dependency rules the
published package installs under. The tool returns
ranked links and snippets only: it never returns an answer a model wrote, and it never fetches a
result page.

Host API relied on: an extension registers a tool with a `name`, `label`, `description`, a
parameter schema and an `execute` function. `execute` receives the validated parameters, an abort
signal and a context that says whether the session has a UI (`hasUI`) and gives the `notify` API,
which shows a message at a level in the UI. `execute` returns `content` (text parts for the model)
and `details` (structured data). An error thrown by `execute` reaches the model as a tool error
carrying the error's message. Optional `renderCall` and `renderResult` functions draw the call and
its result in the UI. The host fires `session_start` when a session starts.

A backend is one of the search services of [backends](#backends), named by its backend name: `exa`,
`perplexity`, `brave`, `google` or `duckduckgo`.

## 2. Tool {#tool}

### 2.1 Registration {#registration}

The extension MUST register exactly one tool, with `name` `WebSearch` and `label` `Web Search`.

| Parameter | Type    | Required | Default                                                            | Meaning                                                           |
| --------- | ------- | -------- | ------------------------------------------------------------------ | ----------------------------------------------------------------- |
| `query`   | string  | yes      |                                                                    | What to search for                                                |
| `count`   | integer | no       | `5`                                                                | The most results to return, 1 to 20 inclusive                     |
| `backend` | string  | no       | `webSearch.backend` ([configuration](#configuration)), else `auto` | A backend name, or `auto` ([routing](#routing))                   |
| `site`    | string  | no       |                                                                    | Restrict results to one domain ([site](#site))                    |
| `recency` | string  | no       |                                                                    | `day`, `week`, `month` or `year` ([keys and capabilities](#keys)) |

The schema MUST declare `count` as an integer with `minimum: 1` and `maximum: 20`, and `backend`
and `recency` as string enumerations of the values above.

### 2.2 Validation {#validation}

The tool MUST check the parameters before any request, in the order of the table, and the first
failing check is the tool error:

| Check                                             | Tool error                                                                           |
| ------------------------------------------------- | ------------------------------------------------------------------------------------ |
| `query` is empty after trimming white space       | `WebSearch: query must not be empty`                                                 |
| `count` is not an integer from 1 to 20 inclusive  | `WebSearch: count must be an integer from 1 to 20`                                   |
| `backend` is not `auto` or a backend name         | `WebSearch: backend must be one of auto, exa, perplexity, brave, google, duckduckgo` |
| `site` is not a domain name (below)               | `WebSearch: site must be a domain name, such as example.com`                         |
| `recency` is not `day`, `week`, `month` or `year` | `WebSearch: recency must be one of day, week, month, year`                           |

The query sent to a backend is `query` trimmed. `site`, trimmed and lowercased, is a domain name
when it contains none of `/`, `:`, `@`, `?`, `#` or white space, parses as the host of
`http://<site>/` [WHATWG URL], is not an IP address, and its host contains a `.`; the domain used
from then on is that host (an internationalised name in its ASCII form). An empty `site` after
trimming counts as absent.

### 2.3 Test seam {#test-seam}

The library MUST provide a factory that builds the tool from these options:

| Option  | Type                                                | Default                                    |
| ------- | --------------------------------------------------- | ------------------------------------------ |
| `fetch` | a function with the signature of the global `fetch` | the global `fetch`                         |
| `env`   | a map of environment variable names to values       | the process environment, read at each call |
| `now`   | `() => number`, milliseconds since the Unix epoch   | `Date.now`                                 |

Every request of [backends](#backends) MUST go through `fetch`; `env` is the environment of [keys and capabilities](#keys); `now`
is the clock of [Exa](#exa). `index.ts` MUST call the factory with no option, and the extension
MUST NOT set any option from a tool parameter, an environment variable or a configuration key.

## 3. Backends {#backends}

### 3.1 Keys and capabilities {#keys}

| Backend      | Key setting ([configuration](#configuration)) | Environment fallback, in order     | `site`                   | `recency` |
| ------------ | --------------------------------------------- | ---------------------------------- | ------------------------ | --------- |
| `exa`        | `webSearch.exa.apiKey`                        | `EXA_API_KEY`                      | native                   | native    |
| `perplexity` | `webSearch.perplexity.apiKey`                 | `PERPLEXITY_API_KEY`               | native                   | native    |
| `brave`      | `webSearch.brave.apiKey`                      | `BRAVE_API_KEY`                    | native                   | native    |
| `google`     | `webSearch.google.apiKey`                     | `GEMINI_API_KEY`, `GOOGLE_API_KEY` | filtered ([site](#site)) | ignored   |
| `duckduckgo` | none                                          | none                               | native                   | ignored   |

A backend's key is its key setting when set, else the first of its environment variables whose
value is not empty after trimming, trimmed. A backend has a key when this yields one;
`duckduckgo` needs none and is always usable. A key MUST NOT appear in the tool result's text or
details, in a tool error, in a diagnostic or in a notification: wherever a backend's reply text is
copied into a failure reason ([requests and failures](#requests)), each occurrence of the key in it MUST be replaced by
`[redacted]` first.

Native means the backend's request carries the restriction as its section states. For `recency`
the windows are `day` 1 day, `week` 7 days, `month` 30 days and `year` 365 days, each day
86400000 ms. A `recency` a backend ignores is not sent, and the tool result carries the notice
`Recency: <backend> has no recency filter; "<recency>" was ignored.`

### 3.2 Requests and failures {#requests}

Every backend request of [Exa](#exa), [Perplexity](#perplexity), [Brave](#brave), [Google](#google) and [DuckDuckGo](#duckduckgo) MUST carry the header
`User-Agent: pi-dent-web-search/<version> (+<homepage>)`, both from `package.json`, and `Accept`
with the media type its section names; [Google](#google) states the headers of a link resolution. The key travels
only in the header its section names, never in a URL.

A backend call MUST end within 15000 ms, counted from its first request to the last byte of its
last response body; Google's link resolution ([Google](#google)) has its own limit. A response body MUST NOT
exceed 2097152 bytes, counted after content decoding as received; on the first byte past the cap
the tool stops reading. An aborted signal stops the call at once; the tool error is
`WebSearch: cancelled`, whichever backend was running, and no further backend is tried.

A backend call fails, with the reason in this table, when:

| Cause                                                    | Reason                                                          |
| -------------------------------------------------------- | --------------------------------------------------------------- |
| The request fails without a response (DNS, refused, TLS) | `network error: <description of the error>`                     |
| The limit of 15000 ms passes                             | `timed out after 15 s`                                          |
| The status is 429                                        | `HTTP 429 (rate limited)`, then `: <message>` when there is one |
| Any other status outside 200–299                         | `HTTP <status>`, then `: <message>` when there is one           |
| The body passes the cap                                  | `response exceeds 2097152 bytes`                                |
| The body does not have the shape its section requires    | `unparsable response: <what is missing>`                        |
| A section's own cause                                    | as that section states                                          |

In a body of the required shape, a result field a section names that is not a string counts as
the empty string, and an array element that is not an object gives no result.

`<message>` is the error message the backend's section names, read from a JSON body, then cleaned
as a title is ([result cleaning](#cleaning)), keys redacted ([keys and capabilities](#keys)), and cut to its first 200 characters followed by `…` when
longer. The reason's numbers are derived from the limits above.

### 3.3 Exa {#exa}

`POST https://api.exa.ai/search`, header `x-api-key: <key>`, `Content-Type: application/json`,
`Accept: application/json`, and the JSON body:

| Field                | Value                                                                                                     |
| -------------------- | --------------------------------------------------------------------------------------------------------- |
| `query`              | the query                                                                                                 |
| `type`               | `"auto"`                                                                                                  |
| `numResults`         | `count`                                                                                                   |
| `contents`           | `{"highlights": true}`                                                                                    |
| `includeDomains`     | `[<site>]`, only when `site` is given                                                                     |
| `startPublishedDate` | `now()` minus the recency window, as `Date.prototype.toISOString` writes it; only when `recency` is given |

The body MUST be a JSON object whose `results` is an array; each element that is an object gives
a result with `title`, `url`, and as snippet the string elements of its `highlights` array
joined by one space (empty when it is not an array). The error message is the body's
`error` string.

### 3.4 Perplexity {#perplexity}

`POST https://api.perplexity.ai/search`, header `Authorization: Bearer <key>`,
`Content-Type: application/json`, `Accept: application/json`, and the JSON body:

| Field                   | Value                                   |
| ----------------------- | --------------------------------------- |
| `query`                 | the query                               |
| `max_results`           | `count`                                 |
| `search_domain_filter`  | `[<site>]`, only when `site` is given   |
| `search_recency_filter` | `recency`, only when `recency` is given |

The body MUST be a JSON object whose `results` is an array; each element that is an object gives
a result with `title`, `url` and `snippet`. The error message is the body's `error.message`.

### 3.5 Brave {#brave}

`GET https://api.search.brave.com/res/v1/web/search` with the query parameters `q`, `count`
(`count`), `text_decorations=false`, and, when `recency` is given, `freshness` (`pd`, `pw`, `pm` or
`py` for `day`, `week`, `month`, `year`); header `X-Subscription-Token: <key>`,
`Accept: application/json`. `q` is the query, followed, when `site` is given, by a space and
`site:<site>`.

The body MUST be a JSON object. When it has no `web` member there are no results; otherwise
`web.results` MUST be an array, each element that is an object giving a result with `title`,
`url` and as snippet `description`. The error message is the body's `error.detail`.

### 3.6 Google {#google}

Google results come from the Gemini API's grounding with Google Search; the Custom Search JSON API
is not used (it is closed to new customers, [Google CSE]).

`POST https://generativelanguage.googleapis.com/v1beta/models/<model>:generateContent`, `<model>`
being `webSearch.google.model` ([configuration](#configuration)), else `gemini-3.5-flash-lite`, percent-encoded as a
path segment; header `x-goog-api-key: <key>`, `Content-Type: application/json`,
`Accept: application/json`, and the body
`{"contents":[{"parts":[{"text":"Search the web for: <query>"}]}],"tools":[{"google_search":{}}]}`,
`<query>` being the query, followed, when `site` is given, by a space and `site:<site>`.

The body MUST be a JSON object whose `candidates` is an array. The first candidate's
`groundingMetadata.groundingChunks`, when it is an array, gives a result for each element whose
`web` is an object: `title` from `web.title`, `url` from `web.uri`, and an empty snippet; when it
is absent there are no results. The answer text and `groundingSupports` MUST NOT be used. The error
message is the body's `error.message`.

A `web.uri` whose host is `vertexaisearch.cloud.google.com` is a redirect link to the source. The
tool MUST resolve each such link, all at once after the backend call, by a `HEAD` request that
does not follow redirects, carries the `User-Agent` of [requests and failures](#requests) and no key, and ends within
5000 ms. When the status is 300–399 and `Location` is an absolute `http` or `https` URL, that URL
replaces the link. Otherwise the link is kept, and the tool result carries the notice
`Google: <n> result links could not be resolved and point to Google's redirect service.`, `<n>`
being the number kept. An unresolved link does not fail the call.

### 3.7 DuckDuckGo {#duckduckgo}

`POST https://html.duckduckgo.com/html/`, `Content-Type: application/x-www-form-urlencoded`,
`Accept: text/html`, and the form body `q=<query>`, `<query>` being the query, followed, when
`site` is given, by a space and `site:<site>`. No key is sent.

> Note (non-normative): DuckDuckGo has no search API; this page is undocumented, can change
> without notice, and answers bursts of requests with a bot check. The backend is a fallback that
> works when it works.

The body is parsed as an HTML document [HTML]. When the status is 202, or the document has an
element matching `#challenge-form` or `.anomaly-modal__box`, the call fails with the reason
`bot check (rate limited)`. Otherwise each element matching `.result` and not `.result--ad`, in
document order, that has a descendant `a.result__a` gives a result: `title` its text,
`snippet` the text of its first `.result__snippet` descendant (empty when none), and `url` the
`uddg` query parameter of the anchor's `href` resolved against `https://html.duckduckgo.com/html/`,
or that resolved `href` when it has no `uddg`. A document with no such result and no element whose
class contains `no-results` fails with the reason `unparsable response: no result list`.

## 4. Routing {#routing}

The backend setting of a call is its `backend` parameter, else `webSearch.backend`, else `auto`.

A backend name chooses that backend, without fallback. When it has no key, the tool error is
`WebSearch: <backend> has no API key; set <key setting> or <variables>`, `<variables>` being its
environment variables joined by `or`. When its call fails, the tool error is
`WebSearch: <backend> failed: <reason>`. When it answers with no result after [results](#results), the
tool result has no results.

`auto` goes through `webSearch.order` ([configuration](#configuration)) in order. A backend without a key is skipped. The
others are called one at a time: a call that fails is recorded as failed with its reason, a call
that answers with no result after [results](#results) is recorded as having no results, and the first call
that answers with at least one result ends the search; its backend is the backend used. When the
order ends:

- with no backend called, the tool error is
  `WebSearch: no search backend is usable; configure one of: <entries>`, each entry being
  `<backend> (<key setting> or <variables>)` for each skipped backend, in order, joined by `, `;
- with every called backend failed, the tool error is `WebSearch: every backend failed: <entries>`,
  each entry `<backend>: <reason>`, in call order, joined by `; `;
- otherwise the tool result has no results, and the backend used is the last one that answered.

## 5. Results {#results}

<!-- terms-ignore P001: #cleaning is the section's permanent id -->

### 5.1 Result cleaning {#cleaning}

Every title and snippet is untrusted text. Each MUST be, in order:

1. parsed as the children of an HTML `body` element [HTML], `script`, `style`, `template` and
   `noscript` elements removed, and replaced by the text content left, which removes tags and
   decodes character references once;
2. stripped of every character of general category Cc except U+0009 and U+000A, every character
   of general category Cf (which includes U+200B–U+200F, U+202A–U+202E, U+2060–U+2064,
   U+2066–U+2069, U+FEFF, U+00AD and the tag characters U+E0000–U+E007F), and the variation
   selectors U+FE00–U+FE0F and U+E0100–U+E01EF [Unicode];
3. collapsed: each run of White_Space characters [Unicode] becomes one U+0020, and the text is
   trimmed.

DuckDuckGo's titles and snippets, already text of a parsed document ([DuckDuckGo](#duckduckgo)), skip step 1.

An empty title becomes `(untitled)`. A snippet longer than 300 characters is cut: to its first 300
characters, shortened by one when the cut would split a surrogate pair, then to the last U+0020 in
it when that space is at index 150 or later, trailing white space removed, then `…` (U+2026) is
appended.

### 5.2 URLs {#urls}

A result's URL MUST be a string that parses as an absolute URL [WHATWG URL] with scheme `http` or
`https`; the URL kept is its serialisation. A result whose URL does not is dropped. Results are
then deduplicated: a result whose URL, with its fragment removed, equals that of an earlier result
is dropped. When results are dropped by this section, the tool result carries the notice
`Dropped <n> results without an http or https URL.` and the notice
`Dropped <n> duplicate results.`, each only when its `<n>` is above 0.

### 5.3 Site {#site}

When `site` is given, a result whose URL's host is not the domain and does not end with `.` and
the domain is dropped, after [URLs](#urls), for every backend. For a backend marked filtered in
[keys and capabilities](#keys) the tool result carries the notice
`Site: <backend> cannot restrict a search to <site>; its results were filtered afterwards, <n> dropped.`;
for the others, when `<n>` is above 0, the notice `Site: dropped <n> results outside <site>.`

### 5.4 Order and count {#order-and-count}

Results keep the backend's order, and only the first `count` are kept. A backend can return fewer.

## 6. Tool result {#result}

### 6.1 Text {#result-text}

The tool result's one text part is, line by line, the optional lines included only when they apply:

```text
WebSearch: <n> results from <backend> for <query>
Tried: <attempt>; <attempt>
Skipped (no API key): <backend>, <backend>
<each notice, one per line, in the order raised>

<results>

To read a page, call the WebFetch tool with its URL.
```

`<n>` is the number of results, and `results` is `result` when it is 1. `<query>` is the query as
a JSON string. `<backend>` is the backend used ([routing](#routing)). The `Tried:` line lists, in call order,
each backend called other than the backend used, as `<backend> failed (<reason>)` or
`<backend> (no results)`. The `Skipped` line lists the backends `auto` skipped, in order. Notices
come from [keys and capabilities](#keys), [Google](#google), [URLs](#urls) and [site](#site), for the backend used only.

`<results>` is `No results.` when there are none; otherwise each result is three lines, the third
omitted when its snippet is empty, and results are separated by one empty line:

```text
<i>. <title>
   <url>
   <snippet>
```

`<i>` counts from 1.

### 6.2 Details {#result-details}

`details` is an object with `query` (the query), `backend` (the backend used), `count`, `site`
(the domain or null), `recency` (or null), `tried` (array of `{ backend, outcome, reason }`,
`outcome` `failed` or `no results`, `reason` a string or null), `skipped` (array of backend names),
`notices` (array of the notice strings) and `results` (array of `{ title, url, snippet }`), each as
the text shows it.

### 6.3 Rendering {#rendering}

`renderCall` shows `WebSearch` and the query; `renderResult` shows the backend used and the
number of results, or the error message.

## 7. Configuration {#configuration}

This specification contributes the root key `webSearch` to pi-dent's configuration file
(pi-dent-agent `specs/config-file.md`, Section 2):

| Key                          | Type                       | Contract                                                                                 |
| ---------------------------- | -------------------------- | ---------------------------------------------------------------------------------------- |
| `webSearch`                  | object, optional           | The settings of this extension                                                           |
| `webSearch.backend`          | string, optional           | The default of the `backend` parameter: `auto` or a backend name                         |
| `webSearch.order`            | array of strings, optional | The order `auto` tries; default `["exa", "perplexity", "brave", "google", "duckduckgo"]` |
| `webSearch.exa`              | object, optional           | Holds `apiKey`                                                                           |
| `webSearch.perplexity`       | object, optional           | Holds `apiKey`                                                                           |
| `webSearch.brave`            | object, optional           | Holds `apiKey`                                                                           |
| `webSearch.google`           | object, optional           | Holds `apiKey` and `model`                                                               |
| `webSearch.<backend>.apiKey` | string, optional           | The backend's key ([keys and capabilities](#keys))                                       |
| `webSearch.google.model`     | string, optional           | The Gemini model of [Google](#google)                                                    |

A key setting can name an environment variable through substitution, for example
`"apiKey": "${env.MY_EXA_KEY}"` (pi-dent-agent `specs/config-file.md`, Section 7).

The extension MUST read the configuration as pi-dent-agent `specs/config-file.md`, Sections 1, 2,
3 and 7, specify it, once per extension instance, at its first `session_start`, or at its first
call when no `session_start` came before; a layer those sections drop is dropped without a
diagnostic from this extension. Each value below that is invalid MUST produce its one diagnostic
and be ignored, the rest of `webSearch` still loading:

| Invalid value                                                                                  | Diagnostic                                                                                  |
| ---------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- |
| `webSearch` not an object                                                                      | `<file>: webSearch must be an object`                                                       |
| `webSearch.backend` not `auto` or a backend name                                               | `<file>: webSearch.backend must be one of auto, exa, perplexity, brave, google, duckduckgo` |
| `webSearch.order` not a non-empty array of distinct backend names                              | `<file>: webSearch.order must be a non-empty array of distinct backend names`               |
| `webSearch.<backend>` (of the four with settings) not an object                                | `<file>: webSearch.<backend> must be an object`                                             |
| `webSearch.<backend>.apiKey` or `webSearch.google.model` not a non-empty string after trimming | `<file>: webSearch.<backend>.<key> must be a non-empty string`                              |
| unknown keys in `webSearch` or in a backend object                                             | `<file>: <object> has unknown keys <keys>`                                                  |

`<keys>` are the unknown keys in ascending order joined by `, `, and `<object>` is `webSearch` or
`webSearch.<backend>`. `<file>` is the file of the value's owning layer (pi-dent-agent
`specs/config-file.md`, Section 4); unknown keys owned by two files give one diagnostic for each
file, the global layer's first. A diagnostic MUST NOT contain the value. Each MUST be reported once per extension
instance, at that `session_start` when the session has a UI, through `notify` at level `warning`
as `pi-dent-web-search: <message>`. A string value is used trimmed.

## 8. Tests {#tests}

The repository's tests MUST NOT reach the internet: every backend call goes to a fake `fetch`
through the [test seam](#test-seam), with `env` set. For each backend they MUST cover the request
(method, URL, headers, body; the key in its header and absent from the URL, the tool result's text and
details), the parsing of a realistic response fixture, a body of the wrong shape failing with
`unparsable response`, and an HTTP 429 failing with `HTTP 429 (rate limited)`. Routing tests MUST
cover the `auto` order, skipping backends without a key, a failure followed by the next backend and
reported in `Tried:`, a backend named explicitly failing as a tool error, and no usable backend.
Parameter tests MUST cover each check of [validation](#validation), and `site` and `recency` sent natively,
filtered and ignored with their notices. Result cleaning tests MUST hide the string `INJECTION` with
zero-width and bidi characters in a title and a snippet and assert that the tool result holds the
plain text and none of those characters, and MUST cover an HTML tag in a snippet, a non-http URL
dropped and a duplicate URL dropped. Configuration tests MUST cover the two layers, the
environment fallback, a key given by `${env.X}` substitution, and each diagnostic. The package
tests MUST load the entry through the host's extension loader from a staging directory that holds
the published files with only the `dependencies` symlinked into `node_modules`, and MUST assert
that the loader reports no errors and one extension. They MUST also scan every runtime import of
the entry module and the modules it loads and assert that each bare import — any specifier that
is not a `node:` builtin or a relative path — names a package in `dependencies` or
`peerDependencies`.

## 9. Package {#package}

The extension is published to npm as `pi-dent-web-search` and loads through the entry
`./index.ts` declared under `pi.extensions` in its `package.json`. The host installs a package's
`dependencies`; its `devDependencies` and `peerDependencies` are not installed, and the packages
`@earendil-works/pi-ai`, `@earendil-works/pi-agent-core`, `@earendil-works/pi-coding-agent`,
`@earendil-works/pi-tui` and `typebox` are host-provided: the host supplies them itself
[Pi packages]. Every module the entry loads MUST import, besides relative modules and Node
builtins, only a package in `dependencies` or a host-provided package through its root or a
subpath the host provides. A host-provided package MUST be declared in `peerDependencies`, with
the range `*`, and MUST NOT be declared in `dependencies`. Installing the package with only its `dependencies` present in `node_modules`
and loading the entry through the host's extension loader MUST register the extension with no
load error.

## 10. Normative references {#normative-references}

- [Pi packages] Pi packages documentation: which packages the host provides, and that it installs
  a package's `dependencies` but not its `devDependencies` or `peerDependencies`,
  https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/packages.md,
  read 2026-11-28.
- [WHATWG URL] URL Living Standard: URL parsing, the host parser and serialisation.
- [HTML] HTML Living Standard: parsing a document and a fragment, and `textContent`.
- [Unicode] The Unicode Standard: general categories Cc and Cf, and the White_Space property.
- [Exa] Exa API reference, Search (`POST /search`), OpenAPI version 2.0.0,
  https://docs.exa.ai/reference/search, read 2026-11-26.
- [Perplexity] Perplexity API reference, Search the web (`POST /search`),
  https://docs.perplexity.ai/api-reference/search-post, read 2026-11-26.
- [Brave] Brave Search API reference, Web search (`GET /v1/web/search`),
  https://api-dashboard.search.brave.com/api-reference/web/search/get, read 2026-11-26.
- [Gemini grounding] Gemini API, Grounding with Google Search, Generate Content API,
  https://ai.google.dev/gemini-api/docs/google-search, read 2026-11-26.
- [Google CSE] Custom Search JSON API overview, https://developers.google.com/custom-search/v1/overview,
  read 2026-11-26: closed to new customers, discontinued on 2027-01-01.
- [DuckDuckGo syntax] DuckDuckGo help, Search syntax (`site:`),
  https://duckduckgo.com/duckduckgo-help-pages/results/syntax, read 2026-11-26.

## 11. Specification gaps {#gaps}

- DuckDuckGo's results page is undocumented: the markup of [DuckDuckGo](#duckduckgo), its `no-results` marker
  and the bot check's signals are observed from other clients, not specified by DuckDuckGo.
- That Google's redirect links answer a `HEAD` with a redirect to the source is observed, not
  documented by Google.
- Google's model decides whether to search and how many sources to cite, so `count` is an upper
  bound only, and a grounded call can cite no source.
- After a DuckDuckGo bot check, later calls still try DuckDuckGo; nothing waits or backs off.
- Character references are decoded once, so a doubly encoded tag stays as text.
- Two calls at once run independently; backends' rate limits are shared between them.
- Brave's `site:` operator and DuckDuckGo's can be ignored by the service; [site](#site) drops what
  they let through.
