|
import type { LGraphGroup as TLGraphGroup, LGraphNode as TLGraphNode, IWidget, SerializedLGraphNode, LGraph as TLGraph, LGraphCanvas as TLGraphCanvas, LiteGraph as TLiteGraph } from "./litegraph.js"; |
|
import type {Constructor, SerializedGraph} from './index.js'; |
|
|
|
declare global { |
|
const LiteGraph: typeof TLiteGraph; |
|
const LGraph: typeof TLGraph; |
|
const LGraphNode: typeof TLGraphNode; |
|
const LGraphCanvas: typeof TLGraphCanvas; |
|
const LGraphGroup: typeof TLGraphGroup; |
|
} |
|
|
|
|
|
export interface ComfyApp { |
|
extensions: ComfyExtension[]; |
|
async queuePrompt(number?: number, batchCount = 1): Promise<void>; |
|
graph: TLGraph; |
|
canvas: TLGraphCanvas; |
|
clean() : void; |
|
registerExtension(extension: ComfyExtension): void; |
|
getPreviewFormatParam(): string; |
|
getRandParam(): string; |
|
loadApiJson(apiData: {}, fileName: string): void; |
|
async graphToPrompt(graph?: TLGraph, clean?: boolean): Promise<void>; |
|
|
|
async loadGraphData(graphData: {}, clean?: boolean, restore_view?: boolean, workflow?: any|null): Promise<void> |
|
ui: { |
|
settings: { |
|
addSetting(config: {id: string, name: string, type: () => HTMLElement}) : void; |
|
} |
|
} |
|
|
|
menu?: any; |
|
} |
|
|
|
export interface ComfyWidget extends IWidget { |
|
|
|
|
|
serializeValue(nodeType: TLGraphNode, index: number): Promise<TValue>; |
|
afterQueued(): void; |
|
inputEl?: HTMLTextAreaElement; |
|
width: number; |
|
} |
|
|
|
export interface ComfyGraphNode extends TLGraphNode { |
|
getExtraMenuOptions: (node: TLGraphNode, options: ContextMenuItem[]) => void; |
|
onExecuted(message: any): void; |
|
} |
|
|
|
export interface ComfyNode extends TLGraphNode { |
|
comfyClass: string; |
|
} |
|
|
|
|
|
export interface ComfyNodeConstructor extends Constructor<ComfyNode> { |
|
static title: string; |
|
static type?: string; |
|
static comfyClass: string; |
|
} |
|
|
|
export type NodeMode = 0|1|2|3|4|undefined; |
|
|
|
|
|
export interface ComfyExtension { |
|
|
|
|
|
|
|
name: string; |
|
|
|
|
|
|
|
|
|
init?(app: ComfyApp): Promise<void>; |
|
|
|
|
|
|
|
|
|
setup?(app: ComfyApp): Promise<void>; |
|
|
|
|
|
|
|
|
|
|
|
addCustomNodeDefs?(defs: Record<string, ComfyObjectInfo>, app: ComfyApp): Promise<void>; |
|
|
|
|
|
|
|
|
|
|
|
getCustomWidgets?( |
|
app: ComfyApp |
|
): Promise< |
|
Record<string, (node, inputName, inputData, app) => { widget?: IWidget; minWidth?: number; minHeight?: number }> |
|
>; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
beforeRegisterNodeDef?(nodeType: ComfyNodeConstructor, nodeData: ComfyObjectInfo, app: ComfyApp): Promise<void>; |
|
|
|
|
|
|
|
|
|
|
|
registerCustomNodes?(app: ComfyApp): void|Promise<void>; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
loadedGraphNode?(node: TLGraphNode, app: ComfyApp); |
|
|
|
|
|
|
|
|
|
|
|
nodeCreated?(node: TLGraphNode, app: ComfyApp); |
|
} |
|
|
|
export type ComfyObjectInfo = { |
|
name: string; |
|
display_name?: string; |
|
description?: string; |
|
category: string; |
|
input?: { |
|
required?: Record<string, ComfyObjectInfoConfig>; |
|
optional?: Record<string, ComfyObjectInfoConfig>; |
|
hidden?: Record<string, ComfyObjectInfoConfig>; |
|
}; |
|
output?: string[]; |
|
output_name: string[]; |
|
|
|
output_node?: boolean; |
|
}; |
|
|
|
export type ComfyObjectInfoConfig = [string | any[]] | [string | any[], any]; |
|
|
|
|
|
type ComfyApiInputLink = [ |
|
|
|
string, |
|
|
|
number, |
|
] |
|
|
|
|
|
export type ComfyApiFormatNode = { |
|
"inputs": { |
|
[input_name: string]: string|number|boolean|ComfyApiInputLink, |
|
}, |
|
"class_type": string, |
|
"_meta": { |
|
"title": string, |
|
} |
|
} |
|
|
|
|
|
export type ComfyApiFormat = { |
|
[node_id: string]: ComfyApiFormatNode |
|
} |
|
|
|
|
|
export type ComfyApiPrompt = { |
|
workflow: SerializedGraph, |
|
output: ComfyApiFormat, |
|
} |
|
|
|
|
|
export type ComfyApiEventDetailStatus = { |
|
exec_info: { |
|
queue_remaining: number; |
|
}; |
|
}; |
|
|
|
|
|
export type ComfyApiEventDetailExecutionStart = { |
|
prompt_id: string; |
|
}; |
|
|
|
|
|
export type ComfyApiEventDetailExecuting = null | string; |
|
|
|
|
|
export type ComfyApiEventDetailProgress = { |
|
node: string; |
|
prompt_id: string; |
|
max: number; |
|
value: number; |
|
}; |
|
|
|
|
|
export type ComfyApiEventDetailExecuted = { |
|
node: string; |
|
prompt_id: string; |
|
output: any; |
|
}; |
|
|
|
|
|
export type ComfyApiEventDetailCached = { |
|
nodes: string[]; |
|
prompt_id: string; |
|
}; |
|
|
|
|
|
export type ComfyApiEventDetailExecuted = { |
|
prompt_id: string; |
|
node: string; |
|
output: any; |
|
}; |
|
|
|
|
|
export type ComfyApiEventDetailError = { |
|
prompt_id: string; |
|
exception_type: string; |
|
exception_message: string; |
|
node_id: string; |
|
node_type: string; |
|
node_id: string; |
|
traceback: string; |
|
executed: any[]; |
|
current_inputs: {[key: string]: (number[]|string[])}; |
|
current_outputs: {[key: string]: (number[]|string[])}; |
|
} |
|
|