import { type ComfyUILaunchMode, type ComfyUIServerStatus } from './shared.js'; export interface ComfyUIServerConfig { baseURL: string; pythonExe: string; serverDir: string; extraArgs: string; headers: Record; launchMode: ComfyUILaunchMode; taskName: string; } export declare function comfyUIServerConfigOf(config: { comfyuiBaseURL?: string; comfyuiPythonExe?: string; comfyuiServerDir?: string; comfyuiExtraArgs?: string; comfyuiHeadersJson?: string; comfyuiLaunchMode?: string; comfyuiScheduledTaskName?: string; }): ComfyUIServerConfig; export declare class ComfyUIServerManager { private deps; private warn; private childPid; private busy; private readonly logDir; constructor(deps: () => ComfyUIServerConfig, warn: (message: string) => void); private portOf; start(): Promise; stop(): Promise; restart(): Promise; status(): Promise; /** Poll /system_stats until the server answers, or fail with the log tail. */ private waitUntilUp; /** Wait (bounded) for the scheduled task to stop reporting Running. */ private waitForTaskIdle; /** * Kill ComfyUI processes that hold the port without answering. * * Called only after the probe said the server is down, so anything matching * is a leftover of a killed launcher: it would block the next instance's bind * and turn a clean start into a timeout. */ private clearStaleProcesses; /** * Decide how Start and Stop should reach this machine's ComfyUI. * * With `auto`, a scheduled task by the configured name wins (that is how a * tray/service install starts it), then the process path. `scheduled-task` * and `process` force one. State is read on every call so the card can show * "via scheduled task ComfyUI (Ready)" without the user configuring a script. */ private launchPlan; private assertNotBusy; private readLogTail; /** GET /system_stats: the ground truth for "is ComfyUI answering". */ private probe; /** Python processes whose command line runs ComfyUI main.py on this port. * The command-line match is deliberate: it never returns the Tailscale * daemon that also holds the port, matching comfyui.ps1's Get-ComfyProcess. */ private findComfyPids; }