/** Media types a reference may be; ComfyUI's LoadImage reads exactly these. */ export type ReferenceMediaType = 'image/png' | 'image/jpeg' | 'image/webp'; /** Largest accepted download. References are inputs, not outputs. */ export declare const MAX_REFERENCE_BYTES: number; /** What the tool reports back. */ export interface ImportedReference { /** Absolute path inside the session workspace. */ path: string; mediaType: ReferenceMediaType; bytes: number; width?: number; height?: number; sourceUrl: string; /** Short content digest, useful when comparing two downloads of one photo. */ digest: string; } /** Options for one import. */ export interface ImportReferenceOptions { url: string; /** Desired file stem; the extension always comes from the sniffed type. */ name?: string | undefined; workspaceRoot: string; /** Configured image folder; references land in `/references`. */ folder?: string | undefined; signal?: AbortSignal | undefined; maxBytes?: number | undefined; timeoutMs?: number | undefined; /** Injected in tests; defaults to the global fetch. */ fetchImpl?: typeof fetch | undefined; } /** * Identify an image by its first bytes. * * @param data - the downloaded bytes. * @returns the media type, or undefined when this is not a supported image. */ export declare function sniffImageMediaType(data: Uint8Array): ReferenceMediaType | undefined; /** * Pixel size from the file header, without decoding pixels. * * @param data - the downloaded bytes. * @param mediaType - what `sniffImageMediaType` decided. * @returns width and height, or undefined when the header is unfamiliar. */ export declare function referenceImageSize(data: Uint8Array, mediaType: ReferenceMediaType): { width: number; height: number; } | undefined; /** True for IPv4/IPv6 addresses that must never be fetched from the host. */ export declare function isPrivateAddress(address: string): boolean; /** * Validate one hop: http(s) only, and every resolved address public. * * @param raw - the URL to check. * @returns the parsed URL, ready to fetch. */ export declare function assertPublicHttpUrl(raw: string): Promise; /** * Download one reference image and write it under the workspace. * * @param options - URL, workspace facts and limits. * @returns the imported reference, with the path `edit_image` accepts. * @throws when the URL is not public, the payload is not a supported image, or * it is larger than the cap. */ export declare function importReferenceImage(options: ImportReferenceOptions): Promise;