import type { AgentTool } from "../internal/harness.js"; import type { ToolSpec } from "../core/types.js"; export interface WebFetchConfig { /** If set, ONLY these hostnames may be fetched (exact host match) — and the allowlist is enforced on * **every redirect hop**, not just the initial URL (a redirect to a non-allowlisted host is refused * before the request is made). Omitted ⇒ no host restriction (the deployment's tool-policy gate is then * the only control — wire one for a multi-tenant deployment). */ allowHosts?: string[]; /** Injectable fetch (tests / a proxy). Defaults to the global `fetch`. */ fetchImpl?: typeof fetch; /** Max response bytes to read (default 2 MB). */ maxBytes?: number; /** Wall-clock budget for the whole fetch (connect + redirects + body read), in ms. Default 30 000. * Without a local timeout, an unreachable host in a no-egress environment hangs until the OS-level * TCP timeout (60-120 s+) — an agent that retries then burns wall-clock on nothing. On expiry the * tool returns a routable error string, so the model can move on. */ timeoutMs?: number; /** Optional sub-model extraction: given the (markdown) content + the caller's prompt, return a focused * answer. Its output is still derived from untrusted content, so it too is returned fenced. */ summarize?: (content: string, prompt: string, signal?: AbortSignal) => Promise; /** User-Agent header sent with every hop (批② P2-3). Default {@link DEFAULT_WEBFETCH_USER_AGENT}; * a deployment can brand it (CC sends `Claude-User (; +https://support.anthropic.com/)`). */ userAgent?: string; } export declare function htmlToText(html: string): string; export declare function webFetchToolSpec(config?: WebFetchConfig): ToolSpec; /** Defined (harness) form of web_fetch — back-compat for direct execution / tests. For `spec.tools`, use the raw * {@link webFetchToolSpec} (prepare-task defineTool-wraps spec.tools entries). */ export declare function createWebFetchTool(config?: WebFetchConfig): AgentTool; /** * design/102 (K-8 CC full-body) — WebSearch (BRAIN / model-service leg). The search BACKEND is deployment-injected * (provider-native search / a search API / an MCP-backed service); core ships NONE — the same boundary as * {@link WebFetchConfig.summarize} and the model gateway. Absent backend ⇒ the tool is not assembled * ({@link assembleFullBodyTools} only pushes it when `search` is wired). Results are UNTRUSTED external data — * {@link delimitUntrusted}-fenced like web_fetch. 🔴 `effect:"read"`, NO `egress` field: a search is * idempotent/retryable; declaring `egress:true` would throw at prep (`config.egress_requires_write_effect`) AND * break resume-safety (a read reconciles as safe-to-retry, a write/egress one does not). */ export interface WebSearchConfig { /** * Deployment-injected search backend. core ships none. The optional `opts` carries the model's per-call * `allowed_domains`/`blocked_domains` HINTS so a backend that supports native domain filtering (e.g. a * `site:` query) can apply them up front. A backend MAY ignore `opts` — core re-enforces the domain * constraint on the returned results as a floor (see `createWebSearchTool`), so honoring it is an * optimization, not a correctness requirement. Back-compat: existing 2-arg backends keep working. */ search: (query: string, signal?: AbortSignal, opts?: { allowedDomains?: string[]; blockedDomains?: string[]; }) => Promise>; /** Max results returned to the model (default 10). */ maxResults?: number; } export declare function createWebSearchTool(config: WebSearchConfig): ToolSpec; //# sourceMappingURL=web.d.ts.map