Repository navigation
Closed
Labels
enhancementNew feature or request
Description
What problem does this solve?
Today web_search exists only when the owner points tole at an external backend (TOLE_WEB_SEARCH_URL, method, headers, fields), and web_fetch is a plain direct GET that returns text. Out of the box tole has no search, and its fetch has no markdown or link extraction. nginjen (the owner's web tool service) does search with several engines and scrape with several output formats, but tole can only reach it as a remote backend.
The owner wants a core version of nginjen built into tole: nginjen-lite, so search and scrape work without running or configuring a separate service.
Decisions (owner, 2026-11-12)
- Default without an nginjen backend: built-in keyless engines (DuckDuckGo first, then the others nginjen already supports). SearXNG needs its own service or container, so it stays an optional lane, unless its aggregation can be adopted as a built-in feature later.
- With a backend: the nginjen backend is configured by just two variables, a base URL and an API key. When both are set, tole uses the full nginjen backend for search and scrape; otherwise the built-in lite implementation. The generic
TOLE_WEB_*backend settings keep working. - Unattended (cron) runs use the web tools without a per-job domain allowlist.
- Code:
nginjen-liteis extracted from the nginjen repository with as little code as possible (search and scrape, no other dependencies) and published to crates.io; tole depends on it as a normal crates.io dependency. tole-core, tole-cli and tole-tui stay published. The extraction is tracked in the private nginjen tracker (primary: Gitea issue 137; GitHub mirrorcodecoradev/nginjen#190). - Jina Reader fallback: off by default, opt-in only.
Findings from the nginjen repository (Apache-2.0, a single Rust binary)
- Search (
nginjen-core/src/search.rs, about 2,000 lines): DuckDuckGo Lite (default), Bing and Brave HTML scrapers, a meta-search (concurrent, interleaved, de-duplicated) and SearXNG lanes with failover, all keyless. The parsers are pure functions from HTML to results and usescraper. - Scrape:
content_converter::convert_html(html, format)is pure over HTML (usesscraper; PDF text useslopdfand readability usesdom_smoothie, both avoidable). - Backend API:
POST /searchandPOST /scrape, bearerNGINJEN_API_KEY. - Why not
nginjen-core: it also carries Chromium/CDP, stealth, zip/tar/flate2 and an asynctokio+reqweststack. - The crate names
nginjen-lite,nginjenandnginjen-coreare free on crates.io.
Proposed solution (tole side)
- Depend on
nginjen-lite(default features only:scraper,url, no async runtime). Implement its small blockingHttpClienttrait over tole's existing HTTP client so tole keeps one client and one TLS stack. web_search/web_fetchuse nginjen-lite when no external backend is configured; with no search lane available,web_searchis not registered (as today).- With
NGINJEN_BASE_URL+NGINJEN_API_KEYset, use the nginjen backend for both tools. - Guards stay as they are in tole: http(s) only, content-type allowlist, size cap, SSRF vetting (
web.rs), refusal of URLs that carry a known secret, queries redacted through the processSecretSetbefore leaving, results fenced like every tool result. - Report binary-size and dependency delta against
docs/perf.mdbefore this lands.
Alternatives considered
- Keep only the generic HTTP backend (status quo): needs a running service and configuration for every user.
- Embed a headless browser for JS pages: far too heavy for tole; out of scope (nginjen full covers it).
- Depend on
nginjen-core: pulls the browser stack. - Vendored, CI-synced copy of the code: unnecessary once
nginjen-liteis a published crate. - Domain allowlist for
web_fetchin unattended runs: proposed and rejected by the owner.
Blocked by
nginjen Gitea issue 137, mirrored as codecoradev/nginjen#190 (extract and publish nginjen-lite).
Open questions
- Politeness defaults for the built-in fetch: User-Agent string, robots.txt (nginjen has a
robots.rsto carry over), per-host rate limit. - Order of keyless engines when the first one blocks or returns nothing (nginjen's fallback order is configurable; which default list?).
Are you willing to contribute the implementation?
Yes, I can do it
Before submitting
- I searched existing issues and didn't find a duplicate
Metadata
Metadata
Assignees
Labels
enhancementNew feature or request
Activity
docs(perf): note the re-measured crate counts after develop moved (#625)
feat(cli): built-in web_search and web_fetch on nginjen-lite (#625 pa…
wip: docs for the nginjen backend and the doctor web lines (#625)