/** Pure ComfyUI API-workflow validation and placeholder injection. */ import { type ComfyUIWorkflowCapabilities, type ComfyUIGenerationParams } from './shared.js'; export declare const COMFYUI_PROMPT_PLACEHOLDER = "{{prompt}}"; export declare const COMFYUI_SEED_PLACEHOLDER = "{{seed}}"; export declare const COMFYUI_IMAGE_PLACEHOLDER = "{{image}}"; /** * Dynamic reference list: a link whose node id is this token expands into one * LoadImage node per supplied reference, in order. * * Declared as `"images.image_1": ["{{images}}", 0]`, it lets one workflow take * as many references as a call supplies (up to the encoder's slot count) * instead of hard-coding a slot per photo. */ export declare const COMFYUI_IMAGES_PLACEHOLDER = "{{images}}"; /** Slots this plugin will fill for one call; ComfyUI's Qwen encoder tops out here. */ export declare const MAX_COMFYUI_REFERENCE_IMAGES = 16; export declare const COMFYUI_WIDTH_PLACEHOLDER = "{{width}}"; export declare const COMFYUI_HEIGHT_PLACEHOLDER = "{{height}}"; export declare const COMFYUI_STEPS_PLACEHOLDER = "{{steps}}"; export declare const COMFYUI_CFG_PLACEHOLDER = "{{cfg}}"; /** Canvas edge used when a workflow declares width/height but a call omits them. */ export declare const DEFAULT_CANVAS_SIDE = 1024; /** * Derived placeholder: the canvas' long side, rounded to the 32-pixel step * Qwen-Image conditioning expects. * * Qwen Image 2.1 conditions the text encoder on a `resolution` value; leaving it * at its 1024 default while rendering 1344x768 tells the model the wrong canvas, * which shows up as weaker composition at non-square sizes. It is derived from * width/height rather than passed by the caller, so a call cannot set it wrong. */ export declare const COMFYUI_RESOLUTION_PLACEHOLDER = "{{resolution}}"; type JsonRecord = Record; /** Options accepted by the placeholder injector. */ export interface PrepareWorkflowOptions extends ComfyUIGenerationParams { prompt: string; seed?: number; image?: string; /** Ordered reference image names for a workflow that declares `{{images}}`. */ images?: readonly string[]; } /** Validate imported JSON without exposing workflow graph details to callers. */ export declare function validateComfyUIWorkflowJson(workflowJson: string): void; /** * Read what a workflow can do: its role, which parameters it exposes, and the * size it bakes when it has no size placeholders. * * @param workflowJson - API-format workflow JSON. * @returns detected capabilities. */ export declare function detectWorkflowCapabilities(workflowJson: string): ComfyUIWorkflowCapabilities; /** * Parse, clone, and inject the prompt plus whatever generation parameters the * caller supplied. * * Two call shapes are accepted: the object form used by new code, and the * historical positional form `(json, prompt, seed?, image?)` still used by * older call sites and tests. * * Prompt and seed placeholders are replaced inside any string so existing * workflows that embed them in longer text keep working. Numeric placeholders * are stricter: they must be the whole value of a field, so the result stays * valid JSON with real numbers. The image placeholder is stricter still: it * only matches a dedicated `inputs.image` field whose value is exactly the * placeholder, and at most one may exist. * * @param workflowJson - API-format workflow JSON. * @param optionsOrPrompt - parameter object, or the prompt string in the legacy form. * @param legacySeed - seed for the legacy form. * @param legacyImage - image name for the legacy form. * @returns a prepared workflow ready to POST to ComfyUI. */ export declare function prepareComfyUIWorkflow(workflowJson: string, optionsOrPrompt: PrepareWorkflowOptions | string, legacySeed?: number, legacyImage?: string): JsonRecord; /** Random seed in the 32-bit range ComfyUI samplers accept. */ export declare function randomSeed(): number; /** True when the workflow JSON declares an image input, so it can run edits. */ export declare function hasComfyUIImagePlaceholder(workflowJson: string): boolean; /** True when the workflow takes a variable number of references. */ export declare function hasDynamicImagePlaceholder(workflowJson: string): boolean; export {};