/** * `@web ` inline context — fetch a web page and attach its text * content to the prompt, the same way `@file` attaches a file. * * Supported forms (anywhere in the message, like file mentions): * @web https://example.com/docs → full URL * @web example.com/docs → https:// is auto-prepended * @web http://localhost:3000/api → dev servers work too * * The fetch is best-effort: * - HTML is stripped to readable text (tags, scripts, styles removed). * - Output is capped at `MAX_WEB_BYTES` (default 32 KB) so a single * page can't blow the context window. * - Markdown conversion is lightweight (headings, links, lists) — we * don't run a full HTML→Markdown pipeline; the goal is "agent can * read the page", not "pretty render". * - Failures (network, non-2xx, non-text content type) surface as * inline notifications, same as missing files. * * The fetcher is async, so `expandWebMentions` is async — unlike the * sync `expandMentions` for files. Callers await it. */ /** Max bytes of text we'll inline from a fetched page (32 KB). */ export declare const MAX_WEB_BYTES: number; /** Result of expanding `@web` mentions in a prompt. */ export interface WebExpansionResult { /** The prompt with fetched page text prepended. */ enrichedPrompt: string; /** Successfully fetched pages. */ loaded: Array<{ url: string; title: string; content: string; }>; /** Mentions that couldn't be fetched, with a human-readable reason. */ failures: Array<{ mention: string; reason: string; }>; } /** One `@web` mention match. */ interface WebToken { /** Full match including `@web `, for display. */ raw: string; /** The URL (normalized: `https://` prepended if missing a scheme). */ url: string; /** Start index of `raw` in the source. */ start: number; /** End index (exclusive). */ end: number; } /** * Extract all `@web` mentions from `text`. Pure (no network). * Returns them in document order. */ export declare function extractWebMentions(text: string): WebToken[]; export interface WebFetchOptions { /** * The fetch implementation. Defaults to the global `fetch` (Node 18+). * Injected so tests can mock without hitting the network. */ fetchImpl?: typeof fetch; } /** * Expand all `@web` mentions in `prompt`: fetch each URL, convert the * HTML to readable text, and prepend it as a `[Web pages]` block. * Failures are collected, not thrown. */ export declare function expandWebMentions(prompt: string, opts?: WebFetchOptions): Promise; /** * Reset the session web cache. Public so callers (e.g. `/web-cache clear` * command, or tests) can force a fresh fetch. */ export declare function clearWebCache(): void; /** * Stats about the session web cache — for `/web-cache status`. */ export declare function webCacheStats(): { entries: number; maxEntries: number; ttlMinutes: number; }; /** * Convert HTML to readable plain text + a title. * * Lightweight — no full parser dependency. Strips `