/** * Dependency-free contract for image optimization engines. * * Core owns filesystem access, publication, request/result validation, and * resource limits. Extensions own decoding, resizing, and encoding. * * @module extensions/image/image-optimization-engine */ /** Registry name used for the image optimization extension contract. */ export declare const ImageOptimizationEngineName: "ImageOptimizationEngine"; /** Maximum stable implementation identity accepted across the boundary. */ export declare const MAX_IMAGE_OPTIMIZATION_ENGINE_IDENTITY_CHARACTERS: 256; /** Formats core can request from an image optimization engine. */ export type ImageOptimizationFormat = "webp" | "avif" | "jpeg" | "png"; /** Immutable byte-oriented request supplied by core. */ export interface ImageOptimizationRequest { readonly input: Uint8Array; /** * Configured target widths. The engine returns each distinct width that does * not exceed the decoded source width, plus the source width itself. */ readonly targetWidths: readonly number[]; /** Every format to produce for each resulting width. */ readonly formats: readonly ImageOptimizationFormat[]; /** Encoding quality applied consistently across requested formats. */ readonly quality: number; /** Aborted when the caller cancels or the core operation deadline expires. */ readonly signal: AbortSignal; } /** One encoded output returned by an image optimization engine. */ export interface ImageOptimizationVariantResult { readonly format: ImageOptimizationFormat; readonly width: number; readonly height: number; readonly data: Uint8Array; } /** Portable result returned by an image optimization engine. */ export interface ImageOptimizationResult { readonly sourceWidth: number; readonly sourceHeight: number; readonly variants: readonly ImageOptimizationVariantResult[]; } /** * Image decoder, resizer, and encoder implemented by an explicit extension. * * Implementations are long-lived, concurrency-safe services. They must not * require caller-managed lifecycle cleanup and must release operation-scoped * resources when the Promise returned by `optimize()` settles. Core may stop * awaiting an operation after aborting its signal, so a late result must not * rely on caller publication or cleanup behavior. */ export interface ImageOptimizationEngine { /** * Includes every implementation/version input capable of changing output. * Represented state must remain immutable for the captured engine lifetime. */ readonly cacheIdentity: string; optimize(request: ImageOptimizationRequest): Promise; } /** Validate an implementation received through the dynamic contract registry. */ export declare function assertImageOptimizationEngine(value: unknown): asserts value is ImageOptimizationEngine; /** Capture dynamic properties once so one run cannot split across mutations. */ export declare function captureImageOptimizationEngine(value: unknown): ImageOptimizationEngine; //# sourceMappingURL=image-optimization-engine.d.ts.map