UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

54 lines (53 loc) 2.93 kB
import { i as GuardedFetchResult, r as GuardedFetchOptions } from "./fetch-guard-BKvfwdRa.js"; //#region src/agents/tools/web-guarded-fetch.d.ts type WebToolGuardedFetchOptions = Omit<GuardedFetchOptions, "mode" | "proxy" | "dangerouslyAllowEnvProxyWithoutPinnedDns"> & { timeoutSeconds?: number; useEnvProxy?: boolean; }; type WebToolEndpointFetchOptions = Omit<WebToolGuardedFetchOptions, "policy" | "useEnvProxy">; /** Runs a guarded fetch with strict or trusted-env-proxy web tool policy. */ declare function fetchWithWebToolsNetworkGuard(params: WebToolGuardedFetchOptions): Promise<GuardedFetchResult>; /** Runs a fetch for trusted endpoints, allowing env proxy with pinned-host policy. */ declare function withTrustedWebToolsEndpoint<T>(params: WebToolEndpointFetchOptions, run: (result: { response: Response; finalUrl: string; }) => Promise<T>): Promise<T>; /** Runs a fetch for configured self-hosted endpoints with private-network access allowed. */ declare function withSelfHostedWebToolsEndpoint<T>(params: WebToolEndpointFetchOptions, run: (result: { response: Response; finalUrl: string; }) => Promise<T>): Promise<T>; /** Runs a fetch under strict SSRF protection without env proxy trust. */ declare function withStrictWebToolsEndpoint<T>(params: WebToolEndpointFetchOptions, run: (result: { response: Response; finalUrl: string; }) => Promise<T>): Promise<T>; //#endregion //#region src/agents/tools/web-shared.d.ts type CacheEntry<T> = { value: T; expiresAt: number; insertedAt: number; }; declare const DEFAULT_TIMEOUT_SECONDS = 30; declare const DEFAULT_CACHE_TTL_MINUTES = 15; declare function resolveTimeoutSeconds(value: unknown, fallback: number): number; declare function resolvePositiveTimeoutSeconds(value: unknown, fallback: number): number; declare function resolveCacheTtlMs(value: unknown, fallbackMinutes: number): number; declare function normalizeCacheKey(value: string): string; declare function readCache<T>(cache: Map<string, CacheEntry<T>>, key: string): { value: T; cached: boolean; } | null; declare function writeCache<T>(cache: Map<string, CacheEntry<T>>, key: string, value: T, ttlMs: number): void; declare function withTimeout(signal: AbortSignal | undefined, timeoutMs: number): AbortSignal; type ReadResponseTextResult = { text: string; truncated: boolean; bytesRead: number; }; declare function readResponseText(res: Response, options?: { maxBytes?: number; }): Promise<ReadResponseTextResult>; //#endregion export { normalizeCacheKey as a, resolveCacheTtlMs as c, withTimeout as d, writeCache as f, withTrustedWebToolsEndpoint as g, withStrictWebToolsEndpoint as h, ReadResponseTextResult as i, resolvePositiveTimeoutSeconds as l, withSelfHostedWebToolsEndpoint as m, DEFAULT_CACHE_TTL_MINUTES as n, readCache as o, fetchWithWebToolsNetworkGuard as p, DEFAULT_TIMEOUT_SECONDS as r, readResponseText as s, CacheEntry as t, resolveTimeoutSeconds as u };