/** * Scenario artwork through a local ComfyUI server running FLUX.2 [klein] 4B. * The workflow is ComfyUI's API format; the settings are the ones the distilled * model is built for (4 steps, CFG 1, euler), which take ~25 s per image on an M1 Pro * once the model is loaded (the first image also loads ~15 GB of weights). */ export declare const DEFAULT_COMFYUI_URL: string; /** Image sizes per use in a scenario (width x height, multiples of 16) */ export declare const ARTWORK_PRESETS: { /** Scenario list picture (quest.ini image=) and the intro cutscene's left panel */ readonly cover: { readonly width: 896; readonly height: 896; }; readonly intro: { readonly width: 896; readonly height: 896; }; /** Letters, parchments, photographs, journal pages: portrait handouts shown during play */ readonly handout: { readonly width: 768; readonly height: 1024; }; /** Landscape pictures shown during play (a room, a revelation, the ending) */ readonly scene: { readonly width: 1024; readonly height: 768; }; /** Custom monster portrait (CustomMonster image=) */ readonly monster: { readonly width: 768; readonly height: 768; }; /** Board token artwork (Token customImage=) */ readonly token: { readonly width: 512; readonly height: 512; }; }; export type ArtworkPreset = keyof typeof ARTWORK_PRESETS; /** Appended to every prompt unless a style is given, so a scenario's pictures look like one set */ export declare const DEFAULT_STYLE: string; /** The three files of the FLUX.2 [klein] 4B setup and where to get them */ export declare const FLUX2_KLEIN_MODELS: { readonly diffusion: { readonly folder: "diffusion_models"; readonly match: RegExp; readonly downloads: readonly [{ readonly file: "flux-2-klein-4b.safetensors"; readonly note: "bf16, 7.2 GB; use this on Apple Silicon (MPS has no fp8)"; readonly url: "https://huggingface.co/Comfy-Org/flux2-klein-4B/resolve/main/split_files/diffusion_models/flux-2-klein-4b.safetensors"; }, { readonly file: "flux-2-klein-4b-fp8.safetensors"; readonly note: "fp8, ~4 GB; for NVIDIA GPUs with less VRAM"; readonly url: "https://huggingface.co/black-forest-labs/FLUX.2-klein-4b-fp8/resolve/main/flux-2-klein-4b-fp8.safetensors"; }]; }; readonly textEncoder: { readonly folder: "text_encoders"; readonly match: RegExp; readonly downloads: readonly [{ readonly file: "qwen_3_4b.safetensors"; readonly note: "7.5 GB"; readonly url: "https://huggingface.co/Comfy-Org/flux2-klein-4B/resolve/main/split_files/text_encoders/qwen_3_4b.safetensors"; }]; }; readonly vae: { readonly folder: "vae"; readonly match: RegExp; readonly downloads: readonly [{ readonly file: "flux2-vae.safetensors"; readonly note: "321 MB; FLUX.1 and SDXL VAEs give distorted colours"; readonly url: "https://huggingface.co/Comfy-Org/flux2-dev/resolve/main/split_files/vae/flux2-vae.safetensors"; }]; }; }; export interface Flux2KleinSettings { diffusionModel: string; textEncoder: string; vae: string; prompt: string; width: number; height: number; seed: number; steps: number; cfg: number; filenamePrefix: string; } /** Recommended sampling for the distilled model; the undistilled "base" model needs more steps and real CFG */ export declare function recommendedSampling(diffusionModel: string): { steps: number; cfg: number; }; /** ComfyUI API-format workflow: FLUX.2 [klein] text-to-image */ export declare function buildFlux2KleinWorkflow(s: Flux2KleinSettings): Record; export type Fetch = typeof fetch; export declare function getJson(fetchFn: Fetch, url: string): Promise; /** Picks the preferred file: the distilled model over "base", then the first match */ export declare function pickModel(files: string[], match: RegExp): string | undefined; export interface ArtworkStatus { reachable: boolean; url: string; error?: string; comfyuiVersion?: string; device?: string; models: { diffusion?: string; textEncoder?: string; vae?: string; }; missing: Array; } /** Checks the ComfyUI server and which of the FLUX.2 [klein] files it can load */ export declare function getArtworkStatus(url?: string, fetchFn?: Fetch): Promise; /** Human-readable setup instructions for what getArtworkStatus found missing */ export declare function setupInstructions(status: ArtworkStatus): string; /** A file a ComfyUI save node wrote, as listed in /history */ export interface ComfyOutputFile { filename: string; subfolder: string; type: string; } /** One node's outputs in /history: SaveImage lists images, the SaveAudio nodes list audio */ export interface ComfyNodeOutput { images?: ComfyOutputFile[]; audio?: ComfyOutputFile[]; } /** * Queues an API-format workflow and waits until ComfyUI has run it. The first job of a * session also loads the models, which can take minutes, hence the long default timeout. */ export declare function runWorkflow(url: string, workflow: Record, opts?: { fetchFn?: Fetch; timeoutMs?: number; pollMs?: number; }): Promise; /** Fetches a file a save node wrote; extra adds query options such as &preview=jpeg;80 */ export declare function downloadOutput(url: string, file: ComfyOutputFile, fetchFn?: Fetch, extra?: string): Promise; export interface GenerateArtworkOptions { prompt: string; /** Where to save the image; .jpg/.jpeg saves a JPEG (much smaller in the package), otherwise PNG */ outputFile: string; preset?: ArtworkPreset; width?: number; height?: number; seed?: number; steps?: number; cfg?: number; /** Replaces DEFAULT_STYLE; pass '' for no style suffix */ style?: string; url?: string; timeoutMs?: number; pollMs?: number; fetchFn?: Fetch; } export interface GenerateArtworkResult { file: string; width: number; height: number; seed: number; steps: number; cfg: number; diffusionModel: string; seconds: number; /** Compact JPEG of the result, for showing the image back to the caller */ preview: Buffer; } /** Generates one image with FLUX.2 [klein] on a running ComfyUI and saves it to outputFile */ export declare function generateArtwork(opts: GenerateArtworkOptions): Promise; //# sourceMappingURL=comfyui.d.ts.map