import type { HostNetwork } from "../host/host.js"; import type { ImageGenResult } from "../runtime/llmClient.js"; import { type LocalRequestOptions } from "./localRequest.js"; /** The most steps any family accepts: Chroma's and Qwen-Image's * max_steps in diffusersImageRules.py, which a test checks. A request that leaves steps * to the model is budgeted as if it asked for this many. */ export declare const MAX_STEPS = 80; /** How long one request may take: room for the slowest family at the steps * and size asked for, plus one request queued ahead of it. Each reference * picture adds about as much work to every step as one more megapixel of * output, so it adds one megapixel to the budget. The server caps every * input, so this is bounded; at the caps with no reference it is about * 107 minutes. It guards against a server that has stopped answering, not * a slow one. */ export declare function localImageTimeoutMs(steps: unknown, size: string | undefined, references?: unknown): number; /** An image from the local server, with the seed that made it. */ export type LocalGeneratedImage = ImageGenResult["images"][number] & { seed?: number; }; /** The formats the local image server writes, in the order messages list * them. */ export declare const LOCAL_IMAGE_FORMATS: string[]; /** One request to the image server, before it is a request body. The * stdlib builds it from an `ImageConfig`, and `generateImage` in * `agency-lang/local` from its options. * * size "WxH", or "" to let the server choose. Absent: not sent * format "png", "jpeg", or "webp". Absent: not sent * settings the other request fields. Only the names in `SETTINGS` are * sent */ export type LocalImageRequest = { model: string; prompt: string; size: string | undefined; format: string | undefined; settings: Record; }; /** The body of a request to the image server. The one place a body is * built, so the stdlib and `agency-lang/local` cannot send different * ones. */ export declare function localImageBody(request: LocalImageRequest): Record; /** Posts one request body to the image server and returns the images it * made: one, since every body asks for one. `options` carries the * server's address and the caller's signal; the stdlib passes neither. */ export declare function postLocalImage(network: HostNetwork, body: Record, timeoutMs: number, options?: LocalRequestOptions): Promise<{ images: LocalGeneratedImage[]; } | { error: string; }>; /** The checks `generateImageLocal` makes before any request: a prompt, a * format the server writes, and a model that is an image model. Returns * the name to send the server, or a failure message. */ export declare function checkLocalImageArgs(prompt: string, model: string, format: string): { servedName: string; } | { error: string; }; /** The settings a call gives, as the request fields the server takes. A * null setting, or an empty negative prompt, is left out so the server * uses the model card's value. */ export declare function localImageSettings(steps: number | null, guidance: number | null, seed: number | null, negativePrompt: string, lora: string, loraScale: number | null): Record; /** Registers the provider with smoltalk, once per process. Called when the * runtime loads provider modules, so `provider: "mlx"` works for every * image function from the first call. */ export declare function registerMlxImageProvider(): void;