import { b as ToolDef } from "../agent-BHkvYIH9.js";

//#region src/tools/fetch-url.d.ts
declare function isBlockedAddress(ip: string): boolean;
/**
 * Host-suffix allowlist check. An empty / undefined list means "no allowlist"
 * → every host passes (the SSRF blocklist is the only gate). Otherwise the
 * host must equal, or be a subdomain of, one of the entries. Subdomain match
 * is on a dot boundary so `example.com` matches `docs.example.com` but not
 * `notexample.com`.
 */
declare function isHostAllowed(hostname: string, allowHosts: readonly string[] | undefined): boolean;
/**
 * Pinned HTTP/HTTPS request. Connects to `pinnedIp` directly (bypassing
 * Node/Bun's own DNS resolution) while preserving the `Host:` header and
 * (for HTTPS) TLS SNI on the URL's original hostname. This is the
 * concrete defense against DNS rebinding — see the file-level docstring.
 *
 * Reads up to `maxBufferBytes` of body and then forcibly closes the
 * connection. The body is decoded as UTF-8; binary responses degrade to
 * mojibake but the tool's contract is text payloads anyway.
 */
interface PinnedResponse {
  status: number;
  url: string;
  contentType: string;
  body: string;
  location: string | null;
  /**
   * True when the body was cut at `maxBufferBytes` before the server
   * finished sending. Optional so test seams that stub `requestImpl`
   * don't have to populate it; absent means "not truncated".
   */
  truncated?: boolean;
}
declare function pinnedRequest(url: URL, pinnedIp: string, family: 4 | 6, headers: Record<string, string>, signal: AbortSignal, maxBufferBytes: number): Promise<PinnedResponse>;
/**
 * Walk up to {@link MAX_REDIRECTS} hops, validating the target host of each
 * 3xx response against the SSRF blocklist before following.
 *
 * `deps` is an internal seam for tests — production callers use the
 * defaults. Both knobs are intentionally opaque: hosts that want to
 * customize the blocklist should use a higher-level mechanism (a future
 * `behavior.fetchUrlAllowHosts` setting) rather than reaching into this.
 */
interface FetchSsrfDeps {
  /** Resolve + validate a hostname. Defaults to {@link resolveAndCheck}. */
  resolver?: (hostname: string) => Promise<{
    address: string;
    family: 4 | 6;
  }>;
  /** Execute a single pinned HTTP request. Defaults to {@link pinnedRequest}. */
  requestImpl?: typeof pinnedRequest;
}
declare function fetchWithSsrfGuard(startUrl: URL, headers: Record<string, string>, signal: AbortSignal, maxBufferBytes: number, deps?: FetchSsrfDeps, allowHosts?: readonly string[]): Promise<PinnedResponse>;
declare function cacheKey(url: string, cap: number, allowHosts?: readonly string[]): string;
declare function cacheGet(key: string): string | null;
declare function cacheSet(key: string, output: string, ttlMs: number): void;
/** Test seam — drop all cached entries. */
declare function clearFetchUrlCache(): void;
/**
 * Test seam — exercise the cache get/set/eviction in isolation without
 * standing up the full SSRF + HTTP path. Not part of the public tool surface;
 * `execute` uses the module-private functions directly.
 */
declare const __fetchCacheTestApi: {
  key: typeof cacheKey;
  get: typeof cacheGet;
  set: typeof cacheSet;
  size: () => number;
  bytes: () => number;
};
declare const fetchUrl: ToolDef;
//#endregion
export { FetchSsrfDeps, __fetchCacheTestApi, clearFetchUrlCache, fetchUrl, fetchWithSsrfGuard, isBlockedAddress, isHostAllowed, pinnedRequest };
//# sourceMappingURL=fetch-url.d.ts.map