/** * Generic image utilities for the QoL tools: fetching arbitrary image URLs * (for inline preview), downloading them to disk, HEAD-checking them, and * opening them in a browser when a display is available. * * These never send the MyArchitectAI API key — the URLs they touch are public * (generation outputs) or user-supplied inputs. A light SSRF guard blocks * loopback/private addresses (which the remote API couldn't fetch anyway). */ import type { FetchLike } from './client.js'; export interface UrlCheck { ok: boolean; status: number; contentType: string | null; contentLength: number | null; isImage: boolean; reason?: string | undefined; } export type PreviewFetch = { tooLarge: false; mimeType: string; bytes: number; base64: string; } | { tooLarge: true; bytes: number; mimeType: string | null; }; export interface SavedImage { path: string; bytes: number; mimeType: string; } export declare class MediaService { #private; constructor(opts: { timeoutMs: number; maxBytes: number; fetchImpl?: FetchLike; }); /** HEAD-check a URL for reachability and image content-type. */ check(rawUrl: string): Promise; /** Fetch an image for inline preview, falling back to "too large" if it exceeds the embed limit. */ fetchForPreview(rawUrl: string): Promise; /** Download an image URL to disk under `dir`, returning the saved path. */ save(rawUrl: string, opts: { dir: string; filename?: string; }): Promise; } /** True on macOS/Windows, or on Linux when an X11/Wayland display is present. */ export declare function detectDisplay(): boolean; /** Best-effort: open a URL/path in the default browser. Returns false if no display or on error. */ export declare function openInBrowser(target: string): boolean; /** Validate a URL is http(s) and not a loopback/private address. */ export declare function assertSafeUrl(raw: string): URL; //# sourceMappingURL=media.d.ts.map