import { GlitchMcpConfig } from "./config.js"; export interface RequestOptions { readonly method?: "GET" | "POST" | "PATCH" | "PUT" | "DELETE"; readonly query?: Record | undefined; readonly body?: unknown; /** Optional per-request timeout for long-running public generation tools. */ readonly timeoutMs?: number; } export interface GlitchEnvelope { readonly data: T; } export type FetchLike = (input: URL | RequestInfo, init?: RequestInit) => Promise; /** * Small, documented HTTP client for the hosted Glitch MCP facade. * * This client deliberately knows nothing about internal planner code. It only * handles transport concerns: auth headers, query strings, timeouts, response * envelopes, and sanitized error mapping. */ export declare class GlitchHttpClient { private readonly config; private readonly fetchFn; constructor(config: GlitchMcpConfig, fetchFn?: FetchLike); get(path: string, query?: Record): Promise; post(path: string, body?: unknown, query?: Record): Promise; postWithTimeout(path: string, body: unknown, timeoutMs: number): Promise; put(path: string, body?: unknown, query?: Record): Promise; delete(path: string, query?: Record): Promise; deleteWithBody(path: string, body: unknown): Promise; /** * PUT raw bytes to an absolute URL (e.g. an S3 pre-signed part URL). * * Unlike request(), this does NOT prepend the API base URL and does NOT attach * the Glitch Authorization header — pre-signed URLs carry their own auth and * must be sent without it. Returns the raw Response so callers can read the * ETag header. The per-call timeout is applied via AbortController. */ putBinary(absoluteUrl: string, body: Uint8Array, contentType?: string): Promise; /** * POST multipart/form-data (file uploads). * * The FormData body is passed straight to fetch so the runtime sets the * multipart boundary; we never set Content-Type ourselves for these requests. */ postMultipart(path: string, form: FormData, query?: Record): Promise; /** * Open a long-lived stream (Server-Sent Events) and return the raw Response. * * Unlike request(), this does not impose the per-call timeout (streams are * meant to stay open) and does not parse the body; the caller reads it. Aborting * is the caller's responsibility via the provided signal. Non-2xx responses are * mapped to a sanitized GlitchMcpError so callers can fall back to polling. */ openStream(path: string, query?: Record, signal?: AbortSignal): Promise; request(path: string, options?: RequestOptions): Promise; private urlFor; private headers; private parseResponse; }