Documentation
¶
Overview ¶
Package web holds Scribe's web tools: web_search (SearXNG or DuckDuckGo HTML) and fetch_page (a readable-text fetch with an SSRF guard).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func UserDeclined ¶
UserDeclined is the tool result for an approval the user denied. The file, web, MCP and symbol-edit tools all use it, so the model reads the same decision whichever tool was refused. It follows the shell's wording (tools/exec userDeclined): the decision is the user's, not a sandbox rule, it stands for this request, and it covers only this call. Without that last clause a model takes a refusal as a reason to stop for good. The reason the user gave, if any, is appended last.
what names the action in the user's terms, e.g. "edit sensitive file: .github/workflows/ci.yml".
Types ¶
type Options ¶
type Options struct {
// SearchURL is a SearXNG base URL (for example http://searx.internal:8888).
// Empty selects the DuckDuckGo HTML backend. SearXNG is usually a local
// service the user configured on purpose, so its address is not guarded.
SearchURL string
// BraveAPIKey, when set, makes web_search try the Brave Search API first
// and fall back to the other backends when Brave fails or returns
// nothing. Empty skips Brave.
BraveAPIKey string
// HTTPClient is optional. Search always uses it when set. fetch_page
// uses a copy of it when set (with its redirect policy replaced by the
// guard), so pass a client with a custom Transport only if you accept
// that the dial-time address check is then the caller's responsibility.
HTTPClient *http.Client
// UserAgent is sent on every request. Empty uses a Scribe default.
UserAgent string
// AllowPrivate lets fetch_page reach loopback, private, link-local and
// CGNAT addresses. Off by default. Tests use it with httptest.
AllowPrivate bool
// JinaAPIKey is sent as a bearer token to the Jina Reader. It is never
// logged, never shown to the model and never placed in an error message.
// Empty uses the Jina Reader's free tier.
JinaAPIKey string
// JinaReader, when true, reads pages through the Jina Reader
// (r.jina.ai) before a local fetch. It sends each URL to a third party,
// so it is off unless the user turned it on in settings.
JinaReader bool
}
Options configures the web tools.
type Source ¶
type Source struct {
URL string // final URL after redirects
Title string
Text string // readable text, Markdown for HTML
Truncated bool
}
Source is a web page fetched for the read tool.
func FetchSource ¶
FetchSource fetches raw for the read tool. It runs the same checks as fetch_page: http or https only, the private-address guard before the request and at dial time, the per-session web approval, and the download cap. The Jina Reader is never used, so the URL is not sent to a third party. Each call asks again, because the read tool has no web state of its own.