import { type ResultFailure } from "../runtime/result.js"; import type { RuntimeContext } from "../runtime/state/context.js"; import type { StateStack } from "../runtime/state/stateStack.js"; import type { ThreadStore } from "../runtime/state/threadStore.js"; /** * Run an HTTP request, translating any abort-shaped error into the * runtime's `AgencyCancelledError`. Node's `fetch` surfaces an * aborted request as a `DOMException` with `name === "AbortError"`, * which `isAbortError` matches. Translating to `AgencyCancelledError` * lets `__tryCall` re-throw it (alongside `GuardExceededError`) so * the agency-side `try` wrapper doesn't silently convert it into a * `Failure` value — the cancellation propagates to the runner the * same way an aborted LLM call does. * * Exported so other stdlib JS modules that do their own `fetch` * (oauth.ts token exchange, speech.ts whisper upload, browserUse.ts * session creation/polling) can share the same abort-error translation * without each one re-implementing it. Each caller still has to thread * the `AbortSignal` from `ctx.getAbortSignal(stack)` into its `fetch` * call — this helper only handles the catch side. */ export declare function runHttp(fn: () => Promise, url: string): Promise; /** Deprecated context-injected wrapper kept during the ALS migration; * see `_fetch`. */ export declare function __internal_fetch(ctx: RuntimeContext, stack: StateStack, _threads: ThreadStore, baseUrl: string, urlPath: string, headers: Record, allowedDomains: string[], method?: string, body?: any): Promise; /** ALS-reading replacement for `__internal_fetch`. */ export declare function _fetch(baseUrl: string, urlPath: string, headers: Record, allowedDomains: string[], method: string, body: any): Promise; /** Deprecated; see `_fetchJSON`. */ export declare function __internal_fetchJSON(ctx: RuntimeContext, stack: StateStack, _threads: ThreadStore, baseUrl: string, urlPath: string, headers: Record, allowedDomains: string[], method?: string, body?: any): Promise; /** ALS-reading replacement for `__internal_fetchJSON`. */ export declare function _fetchJSON(baseUrl: string, urlPath: string, headers: Record, allowedDomains: string[], method: string, body: any): Promise; /** Deprecated; see `_fetchMarkdown`. */ export declare function __internal_fetchMarkdown(ctx: RuntimeContext, stack: StateStack, _threads: ThreadStore, baseUrl: string, urlPath: string, headers: Record, allowedDomains: string[], method?: string, body?: any): Promise; /** ALS-reading replacement for `__internal_fetchMarkdown`. */ export declare function _fetchMarkdown(baseUrl: string, urlPath: string, headers: Record, allowedDomains: string[], method: string, body: any): Promise; export declare function resolveUrl(baseUrl: string, path: string): string; export declare function checkAllowedDomains(url: string, allowedDomains: string[]): string | null;