@nodetool-ai/integration-nodes 0.8.10 → 0.8.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -6
- package/dist/.nodetool-build-stamp +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/nodes/comfy-graph-cloud.d.ts +113 -0
- package/dist/nodes/comfy-graph-cloud.d.ts.map +1 -0
- package/dist/nodes/comfy-graph-cloud.js +578 -0
- package/dist/nodes/comfy-graph-cloud.js.map +1 -0
- package/dist/nodes/comfy-sdk.d.ts +30 -1
- package/dist/nodes/comfy-sdk.d.ts.map +1 -1
- package/dist/nodes/comfy-sdk.js +143 -32
- package/dist/nodes/comfy-sdk.js.map +1 -1
- package/dist/nodes/comfy-server-status.d.ts +31 -0
- package/dist/nodes/comfy-server-status.d.ts.map +1 -0
- package/dist/nodes/comfy-server-status.js +65 -0
- package/dist/nodes/comfy-server-status.js.map +1 -0
- package/dist/nodes/comfy-server-transport.d.ts +32 -0
- package/dist/nodes/comfy-server-transport.d.ts.map +1 -0
- package/dist/nodes/comfy-server-transport.js +177 -0
- package/dist/nodes/comfy-server-transport.js.map +1 -0
- package/dist/nodes/comfy-target.d.ts +26 -0
- package/dist/nodes/comfy-target.d.ts.map +1 -0
- package/dist/nodes/comfy-target.js +61 -0
- package/dist/nodes/comfy-target.js.map +1 -0
- package/dist/nodes/comfy-worker-transport.d.ts +16 -0
- package/dist/nodes/comfy-worker-transport.d.ts.map +1 -0
- package/dist/nodes/comfy-worker-transport.js +153 -0
- package/dist/nodes/comfy-worker-transport.js.map +1 -0
- package/dist/nodes/comfy.d.ts +3 -8
- package/dist/nodes/comfy.d.ts.map +1 -1
- package/dist/nodes/comfy.js +5 -72
- package/dist/nodes/comfy.js.map +1 -1
- package/dist/nodes/kie-dynamic.d.ts.map +1 -1
- package/dist/nodes/kie-dynamic.js +13 -10
- package/dist/nodes/kie-dynamic.js.map +1 -1
- package/dist/nodes/wan2gp.d.ts +141 -0
- package/dist/nodes/wan2gp.d.ts.map +1 -0
- package/dist/nodes/wan2gp.js +505 -0
- package/dist/nodes/wan2gp.js.map +1 -0
- package/package.json +6 -6
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Run a Comfy workflow on a self-hosted ComfyUI through its native API
|
|
3
|
+
* (`/prompt`, `/ws`, `/history`, `/view`, `/upload/image`).
|
|
4
|
+
*
|
|
5
|
+
* This gives the native executor the same {@link ComfyTransport} shape as the
|
|
6
|
+
* Comfy API v2, so the workflow runner does not depend on where a job runs.
|
|
7
|
+
*/
|
|
8
|
+
import { Buffer } from "node:buffer";
|
|
9
|
+
import { randomUUID } from "node:crypto";
|
|
10
|
+
import { executeComfy, uploadComfyFile } from "@nodetool-ai/runtime";
|
|
11
|
+
const KINDS = [
|
|
12
|
+
["images", "image"],
|
|
13
|
+
["audio", "audio"],
|
|
14
|
+
["video", "video"]
|
|
15
|
+
];
|
|
16
|
+
function toOutput(nodeId, type, file) {
|
|
17
|
+
const bytes = Buffer.from(file.data, "base64");
|
|
18
|
+
return {
|
|
19
|
+
nodeId,
|
|
20
|
+
name: file.filename,
|
|
21
|
+
id: `${nodeId}:${type}:${file.filename}`,
|
|
22
|
+
type,
|
|
23
|
+
contentType: file.mimeType,
|
|
24
|
+
sizeBytes: bytes.byteLength,
|
|
25
|
+
toBytes: async () => bytes
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* A job whose events arrive through callbacks. Subclasses push events, and
|
|
30
|
+
* {@link events} drains them until the subclass calls {@link settle}.
|
|
31
|
+
*/
|
|
32
|
+
export class QueuedComfyJob {
|
|
33
|
+
id = randomUUID();
|
|
34
|
+
status = "queued";
|
|
35
|
+
outputs = [];
|
|
36
|
+
error = null;
|
|
37
|
+
queue = [];
|
|
38
|
+
wake = () => { };
|
|
39
|
+
settled = false;
|
|
40
|
+
push(event) {
|
|
41
|
+
this.queue.push(event);
|
|
42
|
+
this.wake();
|
|
43
|
+
}
|
|
44
|
+
setStatus(status) {
|
|
45
|
+
if (this.status === status)
|
|
46
|
+
return;
|
|
47
|
+
this.status = status;
|
|
48
|
+
this.push({ kind: "statusChange", status, queuePosition: null });
|
|
49
|
+
}
|
|
50
|
+
fail(message) {
|
|
51
|
+
this.error = { code: "comfy_server_error", message };
|
|
52
|
+
this.setStatus("failed");
|
|
53
|
+
}
|
|
54
|
+
settle() {
|
|
55
|
+
this.settled = true;
|
|
56
|
+
this.wake();
|
|
57
|
+
}
|
|
58
|
+
progressEvent(currentNode, step, steps) {
|
|
59
|
+
return {
|
|
60
|
+
kind: "progress",
|
|
61
|
+
value: step !== null && steps ? step / steps : 0,
|
|
62
|
+
message: null,
|
|
63
|
+
nodesDone: null,
|
|
64
|
+
nodesTotal: null,
|
|
65
|
+
currentNode,
|
|
66
|
+
step,
|
|
67
|
+
steps
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
async *events(signal) {
|
|
71
|
+
const onAbort = () => this.wake();
|
|
72
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
73
|
+
try {
|
|
74
|
+
for (;;) {
|
|
75
|
+
const event = this.queue.shift();
|
|
76
|
+
if (event) {
|
|
77
|
+
yield event;
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
if (signal?.aborted) {
|
|
81
|
+
const error = new Error("Comfy job was canceled");
|
|
82
|
+
error.name = "AbortError";
|
|
83
|
+
throw error;
|
|
84
|
+
}
|
|
85
|
+
if (this.settled)
|
|
86
|
+
return;
|
|
87
|
+
await new Promise((resolve) => {
|
|
88
|
+
this.wake = resolve;
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
finally {
|
|
93
|
+
signal?.removeEventListener("abort", onAbort);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
async refresh() {
|
|
97
|
+
return this;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
class ComfyServerJob extends QueuedComfyJob {
|
|
101
|
+
cancelRun = () => { };
|
|
102
|
+
constructor(prompt, url, timeoutMs) {
|
|
103
|
+
super();
|
|
104
|
+
const { result, cancel } = executeComfy(prompt, url, (event) => this.onProgress(event), timeoutMs, (nodeId, outputs) => this.onOutputs(nodeId, outputs));
|
|
105
|
+
this.cancelRun = cancel;
|
|
106
|
+
void result
|
|
107
|
+
.then((outcome) => {
|
|
108
|
+
if (outcome.status === "completed") {
|
|
109
|
+
this.setStatus("succeeded");
|
|
110
|
+
}
|
|
111
|
+
else if (this.status !== "canceled") {
|
|
112
|
+
this.fail(outcome.error ?? "ComfyUI reported a failure");
|
|
113
|
+
}
|
|
114
|
+
})
|
|
115
|
+
.catch((err) => {
|
|
116
|
+
this.fail(err instanceof Error ? err.message : String(err));
|
|
117
|
+
})
|
|
118
|
+
.finally(() => {
|
|
119
|
+
this.settle();
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
onProgress(event) {
|
|
123
|
+
if (event.type === "execution_start") {
|
|
124
|
+
this.setStatus("running");
|
|
125
|
+
}
|
|
126
|
+
else if (event.type === "execution_interrupted") {
|
|
127
|
+
this.setStatus("canceled");
|
|
128
|
+
}
|
|
129
|
+
else if (event.type === "executing" && event.node) {
|
|
130
|
+
this.setStatus("running");
|
|
131
|
+
this.push(this.progressEvent(event.node, null, null));
|
|
132
|
+
}
|
|
133
|
+
else if (event.type === "progress" &&
|
|
134
|
+
typeof event.progress === "number" &&
|
|
135
|
+
typeof event.total === "number" &&
|
|
136
|
+
event.total > 0) {
|
|
137
|
+
this.push(this.progressEvent(event.node ?? null, event.progress, event.total));
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
onOutputs(nodeId, outputs) {
|
|
141
|
+
for (const [group, type] of KINDS) {
|
|
142
|
+
for (const file of outputs[group] ?? []) {
|
|
143
|
+
const output = toOutput(nodeId, type, file);
|
|
144
|
+
this.outputs.push(output);
|
|
145
|
+
this.push({ kind: "outputReady", output });
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
async cancel() {
|
|
150
|
+
this.cancelRun();
|
|
151
|
+
this.status = "canceled";
|
|
152
|
+
return this;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
/** A ComfyUI server at `url`, with no authentication. */
|
|
156
|
+
export function serverTransport(url, timeoutMs) {
|
|
157
|
+
const uploads = new WeakMap();
|
|
158
|
+
return {
|
|
159
|
+
async submit(graph) {
|
|
160
|
+
for (const node of Object.values(graph)) {
|
|
161
|
+
for (const [field, value] of Object.entries(node.inputs)) {
|
|
162
|
+
const upload = typeof value === "object" && value !== null ? uploads.get(value) : undefined;
|
|
163
|
+
if (upload) {
|
|
164
|
+
node.inputs[field] = await uploadComfyFile(url, upload.bytes, upload.filename, upload.contentType);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
return new ComfyServerJob(graph, url, timeoutMs);
|
|
169
|
+
},
|
|
170
|
+
assetFromBytes(bytes, filename, contentType) {
|
|
171
|
+
const handle = {};
|
|
172
|
+
uploads.set(handle, { bytes, filename, contentType });
|
|
173
|
+
return handle;
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
//# sourceMappingURL=comfy-server-transport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comfy-server-transport.js","sourceRoot":"","sources":["../../src/nodes/comfy-server-transport.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EACL,YAAY,EACZ,eAAe,EAIhB,MAAM,sBAAsB,CAAC;AAgB9B,MAAM,KAAK,GAAG;IACZ,CAAC,QAAQ,EAAE,OAAO,CAAC;IACnB,CAAC,OAAO,EAAE,OAAO,CA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EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC,CAAC;YACtD,OAAO,MAAM,CAAC;QAChB,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where a Comfy workflow (`run_mode: "comfy"`) runs. The run, the node catalog
|
|
3
|
+
* and the graph import all resolve the target here, so they cannot disagree.
|
|
4
|
+
*
|
|
5
|
+
* An explicit `COMFY_TARGET` never falls back: a target that is not configured
|
|
6
|
+
* is an error, because a silent move to Comfy Cloud spends credits.
|
|
7
|
+
*/
|
|
8
|
+
export type ComfyTarget = {
|
|
9
|
+
kind: "cloud";
|
|
10
|
+
apiKey: string;
|
|
11
|
+
} | {
|
|
12
|
+
kind: "server";
|
|
13
|
+
url: string;
|
|
14
|
+
} | {
|
|
15
|
+
kind: "worker";
|
|
16
|
+
url: string;
|
|
17
|
+
token?: string;
|
|
18
|
+
};
|
|
19
|
+
type SecretLookup = (key: string) => Promise<string | null | undefined>;
|
|
20
|
+
/** The URL of a self-hosted ComfyUI, with a bare host:port given `http://`. */
|
|
21
|
+
export declare function normalizeComfyServerUrl(value: string): string;
|
|
22
|
+
export declare function resolveComfyTarget(getSecret: SecretLookup): Promise<ComfyTarget>;
|
|
23
|
+
/** The target's name for logs and errors. It never includes a credential. */
|
|
24
|
+
export declare function describeComfyTarget(target: ComfyTarget): string;
|
|
25
|
+
export {};
|
|
26
|
+
//# sourceMappingURL=comfy-target.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comfy-target.d.ts","sourceRoot":"","sources":["../../src/nodes/comfy-target.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,MAAM,MAAM,WAAW,GACnB;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACjC;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAC/B;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEpD,KAAK,YAAY,GAAG,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC;AAExE,+EAA+E;AAC/E,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAG7D;AAED,wBAAsB,kBAAkB,CACtC,SAAS,EAAE,YAAY,GACtB,OAAO,CAAC,WAAW,CAAC,CA8CtB;AAED,6EAA6E;AAC7E,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAS/D"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where a Comfy workflow (`run_mode: "comfy"`) runs. The run, the node catalog
|
|
3
|
+
* and the graph import all resolve the target here, so they cannot disagree.
|
|
4
|
+
*
|
|
5
|
+
* An explicit `COMFY_TARGET` never falls back: a target that is not configured
|
|
6
|
+
* is an error, because a silent move to Comfy Cloud spends credits.
|
|
7
|
+
*/
|
|
8
|
+
import { stripTrailingSlashes } from "./comfy-sdk.js";
|
|
9
|
+
/** The URL of a self-hosted ComfyUI, with a bare host:port given `http://`. */
|
|
10
|
+
export function normalizeComfyServerUrl(value) {
|
|
11
|
+
const trimmed = stripTrailingSlashes(value.trim());
|
|
12
|
+
return /^https?:\/\//i.test(trimmed) ? trimmed : `http://${trimmed}`;
|
|
13
|
+
}
|
|
14
|
+
export async function resolveComfyTarget(getSecret) {
|
|
15
|
+
const read = async (key) => (await getSecret(key))?.trim() ?? "";
|
|
16
|
+
const selected = await read("COMFY_TARGET");
|
|
17
|
+
const serverUrl = await read("COMFY_SERVER_URL");
|
|
18
|
+
const apiKey = await read("COMFY_API_KEY");
|
|
19
|
+
switch (selected) {
|
|
20
|
+
case "cloud":
|
|
21
|
+
if (!apiKey) {
|
|
22
|
+
throw new Error("The Comfy target is Comfy Cloud, but COMFY_API_KEY is not set. Add the key in Settings, or select another target.");
|
|
23
|
+
}
|
|
24
|
+
return { kind: "cloud", apiKey };
|
|
25
|
+
case "server":
|
|
26
|
+
if (!serverUrl) {
|
|
27
|
+
throw new Error("The Comfy target is a ComfyUI server, but COMFY_SERVER_URL is not set. Set the URL, or select another target.");
|
|
28
|
+
}
|
|
29
|
+
return { kind: "server", url: normalizeComfyServerUrl(serverUrl) };
|
|
30
|
+
case "worker": {
|
|
31
|
+
const url = await read("COMFY_WORKER_URL");
|
|
32
|
+
if (!url) {
|
|
33
|
+
throw new Error("The Comfy target is a worker, but COMFY_WORKER_URL is not set. Select a running worker, or select another target.");
|
|
34
|
+
}
|
|
35
|
+
const token = await read("COMFY_WORKER_TOKEN");
|
|
36
|
+
return { kind: "worker", url, token: token || undefined };
|
|
37
|
+
}
|
|
38
|
+
case "":
|
|
39
|
+
break;
|
|
40
|
+
default:
|
|
41
|
+
throw new Error(`COMFY_TARGET is "${selected}". Use cloud, server or worker.`);
|
|
42
|
+
}
|
|
43
|
+
// No selection yet: keep the behavior that existed before COMFY_TARGET.
|
|
44
|
+
if (serverUrl)
|
|
45
|
+
return { kind: "server", url: normalizeComfyServerUrl(serverUrl) };
|
|
46
|
+
if (apiKey)
|
|
47
|
+
return { kind: "cloud", apiKey };
|
|
48
|
+
throw new Error("A Comfy workflow needs a place to run. Set COMFY_SERVER_URL for your own ComfyUI server, or add COMFY_API_KEY for Comfy Cloud, in Settings.");
|
|
49
|
+
}
|
|
50
|
+
/** The target's name for logs and errors. It never includes a credential. */
|
|
51
|
+
export function describeComfyTarget(target) {
|
|
52
|
+
switch (target.kind) {
|
|
53
|
+
case "cloud":
|
|
54
|
+
return "Comfy Cloud";
|
|
55
|
+
case "server":
|
|
56
|
+
return `the ComfyUI server at ${target.url}`;
|
|
57
|
+
case "worker":
|
|
58
|
+
return `the ComfyUI worker at ${target.url}`;
|
|
59
|
+
}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every other worker
|
|
4
|
+
* uses the `comfy.execute` bridge call, which returns all files at the end.
|
|
5
|
+
*/
|
|
6
|
+
import { type PythonBridge } from "@nodetool-ai/runtime";
|
|
7
|
+
import { type ComfyTransport } from "./comfy-sdk.js";
|
|
8
|
+
/** Open a one-shot bridge. A closed run must never reconnect. */
|
|
9
|
+
export declare function connectComfyWorker(url: string, token?: string): Promise<PythonBridge>;
|
|
10
|
+
/** The worker's node catalog, read over the bridge. */
|
|
11
|
+
export declare function fetchComfyWorkerObjectInfo(url: string, token?: string): Promise<Record<string, unknown>>;
|
|
12
|
+
/** Send a prompt over an open bridge. The job closes the bridge when it ends. */
|
|
13
|
+
export declare function bridgeTransport(bridge: PythonBridge, timeoutSeconds: number): ComfyTransport;
|
|
14
|
+
/** The transport this worker supports, chosen from its reported status. */
|
|
15
|
+
export declare function workerTransport(url: string, token: string | undefined, timeoutSeconds: number): Promise<ComfyTransport>;
|
|
16
|
+
//# sourceMappingURL=comfy-worker-transport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comfy-worker-transport.d.ts","sourceRoot":"","sources":["../../src/nodes/comfy-worker-transport.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAGL,KAAK,YAAY,EAClB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAML,KAAK,cAAc,EACpB,MAAM,gBAAgB,CAAC;AAGxB,iEAAiE;AACjE,wBAAsB,kBAAkB,CACtC,GAAG,EAAE,MAAM,EACX,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,YAAY,CAAC,CAQvB;AAUD,uDAAuD;AACvD,wBAAsB,0BAA0B,CAC9C,GAAG,EAAE,MAAM,EACX,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAQlC;AAgGD,iFAAiF;AACjF,wBAAgB,eAAe,CAC7B,MAAM,EAAE,YAAY,EACpB,cAAc,EAAE,MAAM,GACrB,cAAc,CAwBhB;AAED,2EAA2E;AAC3E,wBAAsB,eAAe,CACnC,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,cAAc,CAAC,CAazB"}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Run a Comfy workflow on a NodeTool worker that fronts ComfyUI. A worker that
|
|
3
|
+
* reports `comfy.api_v2` is driven over the Comfy API v2. Every other worker
|
|
4
|
+
* uses the `comfy.execute` bridge call, which returns all files at the end.
|
|
5
|
+
*/
|
|
6
|
+
import { Buffer } from "node:buffer";
|
|
7
|
+
import { randomUUID } from "node:crypto";
|
|
8
|
+
import { WebsocketPythonBridge } from "@nodetool-ai/runtime";
|
|
9
|
+
import { sniffMedia, v2Transport, workerHttpOrigin } from "./comfy-sdk.js";
|
|
10
|
+
import { QueuedComfyJob } from "./comfy-server-transport.js";
|
|
11
|
+
/** Open a one-shot bridge. A closed run must never reconnect. */
|
|
12
|
+
export async function connectComfyWorker(url, token) {
|
|
13
|
+
const bridge = new WebsocketPythonBridge({
|
|
14
|
+
wsUrl: url,
|
|
15
|
+
workerToken: token,
|
|
16
|
+
autoRestart: false
|
|
17
|
+
});
|
|
18
|
+
await bridge.connect();
|
|
19
|
+
return bridge;
|
|
20
|
+
}
|
|
21
|
+
function requireComfy(bridge, url) {
|
|
22
|
+
if (!bridge.supportsComfy()) {
|
|
23
|
+
throw new Error(`The worker at ${url} does not front a ComfyUI server. Deploy the nodetool-worker-comfy image.`);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
/** The worker's node catalog, read over the bridge. */
|
|
27
|
+
export async function fetchComfyWorkerObjectInfo(url, token) {
|
|
28
|
+
const bridge = await connectComfyWorker(url, token);
|
|
29
|
+
try {
|
|
30
|
+
requireComfy(bridge, url);
|
|
31
|
+
return await bridge.comfyObjectInfo();
|
|
32
|
+
}
|
|
33
|
+
finally {
|
|
34
|
+
bridge.close();
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/** The prompt node that made a blob. The worker keys blobs `<nodeId>_<name>`. */
|
|
38
|
+
function ownerOf(key, prompt) {
|
|
39
|
+
return (Object.keys(prompt)
|
|
40
|
+
.filter((id) => key === id || key.startsWith(`${id}_`))
|
|
41
|
+
.sort((a, b) => b.length - a.length)[0] ?? key);
|
|
42
|
+
}
|
|
43
|
+
function blobOutput(key, bytes, prompt) {
|
|
44
|
+
const { kind, mime } = sniffMedia(bytes);
|
|
45
|
+
const copy = Buffer.from(bytes);
|
|
46
|
+
return {
|
|
47
|
+
nodeId: ownerOf(key, prompt),
|
|
48
|
+
name: `${key}.${mime.split("/")[1]}`,
|
|
49
|
+
id: key,
|
|
50
|
+
type: kind,
|
|
51
|
+
contentType: mime,
|
|
52
|
+
sizeBytes: copy.byteLength,
|
|
53
|
+
toBytes: async () => copy
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
class ComfyBridgeJob extends QueuedComfyJob {
|
|
57
|
+
bridge;
|
|
58
|
+
requestId = randomUUID();
|
|
59
|
+
constructor(bridge, prompt, blobs, timeoutSeconds) {
|
|
60
|
+
super();
|
|
61
|
+
this.bridge = bridge;
|
|
62
|
+
void bridge
|
|
63
|
+
.comfyExecute(prompt, {
|
|
64
|
+
blobs: Object.keys(blobs).length > 0 ? blobs : undefined,
|
|
65
|
+
timeout: timeoutSeconds
|
|
66
|
+
}, (event) => this.onEvent(event), this.requestId)
|
|
67
|
+
.then((result) => {
|
|
68
|
+
if (result.status === "cancelled") {
|
|
69
|
+
this.setStatus("canceled");
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
for (const [key, bytes] of Object.entries(result.blobs ?? {})) {
|
|
73
|
+
if (!(bytes instanceof Uint8Array))
|
|
74
|
+
continue;
|
|
75
|
+
const output = blobOutput(key, bytes, prompt);
|
|
76
|
+
this.outputs.push(output);
|
|
77
|
+
this.push({ kind: "outputReady", output });
|
|
78
|
+
}
|
|
79
|
+
this.setStatus("succeeded");
|
|
80
|
+
})
|
|
81
|
+
.catch((err) => {
|
|
82
|
+
if (this.status !== "canceled") {
|
|
83
|
+
this.fail(err instanceof Error ? err.message : String(err));
|
|
84
|
+
}
|
|
85
|
+
})
|
|
86
|
+
.finally(() => {
|
|
87
|
+
bridge.close();
|
|
88
|
+
this.settle();
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
onEvent(event) {
|
|
92
|
+
if (event.event === "started") {
|
|
93
|
+
this.setStatus("running");
|
|
94
|
+
}
|
|
95
|
+
else if (event.event === "executing" && event.node) {
|
|
96
|
+
this.setStatus("running");
|
|
97
|
+
this.push(this.progressEvent(event.node, null, null));
|
|
98
|
+
}
|
|
99
|
+
else if (event.event === "progress" &&
|
|
100
|
+
typeof event.value === "number" &&
|
|
101
|
+
typeof event.max === "number" &&
|
|
102
|
+
event.max > 0) {
|
|
103
|
+
this.push(this.progressEvent(event.node ?? null, event.value, event.max));
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
async cancel() {
|
|
107
|
+
this.status = "canceled";
|
|
108
|
+
this.bridge.cancelComfyExecute(this.requestId);
|
|
109
|
+
return this;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
/** Send a prompt over an open bridge. The job closes the bridge when it ends. */
|
|
113
|
+
export function bridgeTransport(bridge, timeoutSeconds) {
|
|
114
|
+
const uploads = new WeakMap();
|
|
115
|
+
return {
|
|
116
|
+
async submit(graph) {
|
|
117
|
+
const blobs = {};
|
|
118
|
+
for (const [nodeId, node] of Object.entries(graph)) {
|
|
119
|
+
for (const [field, value] of Object.entries(node.inputs)) {
|
|
120
|
+
const bytes = typeof value === "object" && value !== null ? uploads.get(value) : undefined;
|
|
121
|
+
if (bytes) {
|
|
122
|
+
const key = `${nodeId}_${field}`;
|
|
123
|
+
blobs[key] = bytes;
|
|
124
|
+
node.inputs[field] = `blob:${key}`;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return new ComfyBridgeJob(bridge, graph, blobs, timeoutSeconds);
|
|
129
|
+
},
|
|
130
|
+
assetFromBytes(bytes) {
|
|
131
|
+
const handle = {};
|
|
132
|
+
uploads.set(handle, bytes);
|
|
133
|
+
return handle;
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
/** The transport this worker supports, chosen from its reported status. */
|
|
138
|
+
export async function workerTransport(url, token, timeoutSeconds) {
|
|
139
|
+
const bridge = await connectComfyWorker(url, token);
|
|
140
|
+
if (bridge.getComfyStatus()?.api_v2 === true) {
|
|
141
|
+
bridge.close();
|
|
142
|
+
return v2Transport(workerHttpOrigin(url), token);
|
|
143
|
+
}
|
|
144
|
+
try {
|
|
145
|
+
requireComfy(bridge, url);
|
|
146
|
+
}
|
|
147
|
+
catch (err) {
|
|
148
|
+
bridge.close();
|
|
149
|
+
throw err;
|
|
150
|
+
}
|
|
151
|
+
return bridgeTransport(bridge, timeoutSeconds);
|
|
152
|
+
}
|
|
153
|
+
//# sourceMappingURL=comfy-worker-transport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comfy-worker-transport.js","sourceRoot":"","sources":["../../src/nodes/comfy-worker-transport.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EACL,qBAAqB,EAGtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,UAAU,EACV,WAAW,EACX,gBAAgB,EAIjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAE7D,iEAAiE;AACjE,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,GAAW,EACX,KAAc;IAEd,MAAM,MAAM,GAAG,IAAI,qBAAqB,CAAC;QACvC,KAAK,E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;YACD,OAAO,IAAI,cAAc,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,cAAc,CAAC,CAAC;QAClE,CAAC;QACD,cAAc,CAAC,KAAK;YAClB,MAAM,MAAM,GAAG,EAAE,CAAC;YAClB,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;YAC3B,OAAO,MAAM,CAAC;QAChB,CAAC;KACF,CAAC;AACJ,CAAC;AAED,2EAA2E;AAC3E,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,GAAW,EACX,KAAyB,EACzB,cAAsB;IAEtB,MAAM,MAAM,GAAG,MAAM,kBAAkB,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IACpD,IAAI,MAAM,CAAC,cAAc,EAAE,EAAE,MAAM,KAAK,IAAI,EAAE,CAAC;QAC7C,MAAM,CAAC,KAAK,EAAE,CAAC;QACf,OAAO,WAAW,CAAC,gBAAgB,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC;IACnD,CAAC;IACD,IAAI,CAAC;QACH,YAAY,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC5B,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,CAAC,KAAK,EAAE,CAAC;QACf,MAAM,GAAG,CAAC;IACZ,CAAC;IACD,OAAO,eAAe,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;AACjD,CAAC"}
|
package/dist/nodes/comfy.d.ts
CHANGED
|
@@ -2,14 +2,9 @@ import { BaseNode } from "@nodetool-ai/node-sdk";
|
|
|
2
2
|
import { comfyDynamicSlots } from "./comfy-schema.js";
|
|
3
3
|
import { type PythonBridge, type ProcessingContext } from "@nodetool-ai/runtime";
|
|
4
4
|
import { ComfyCloudWorkflowNode } from "./comfy-cloud.js";
|
|
5
|
+
import { ComfyCloudGraphNode } from "./comfy-graph-cloud.js";
|
|
5
6
|
import { type ComfyPrompt, type ComfyTransport } from "./comfy-sdk.js";
|
|
6
|
-
|
|
7
|
-
* Turn a worker WebSocket URL into the HTTP origin its API v2 routes live on:
|
|
8
|
-
* `ws:` becomes `http:`, `wss:` becomes `https:`, and path and query are
|
|
9
|
-
* dropped (`wss://abc-7777.proxy.runpod.net/ws` →
|
|
10
|
-
* `https://abc-7777.proxy.runpod.net`).
|
|
11
|
-
*/
|
|
12
|
-
export declare function workerHttpOrigin(workerUrl: string): string;
|
|
7
|
+
export { workerHttpOrigin } from "./comfy-sdk.js";
|
|
13
8
|
/**
|
|
14
9
|
* Run a ComfyUI workflow on any ComfyUI server, with typed inputs/outputs
|
|
15
10
|
* derived from the workflow.
|
|
@@ -144,5 +139,5 @@ export declare class ComfyWorkerWorkflowNode extends BaseNode {
|
|
|
144
139
|
*/
|
|
145
140
|
private runOverBridge;
|
|
146
141
|
}
|
|
147
|
-
export declare const COMFY_NODES: (typeof ComfyCloudWorkflowNode | typeof ComfyWorkflowNode | typeof ComfyWorkerWorkflowNode)[];
|
|
142
|
+
export declare const COMFY_NODES: (typeof ComfyCloudWorkflowNode | typeof ComfyCloudGraphNode | typeof ComfyWorkflowNode | typeof ComfyWorkerWorkflowNode)[];
|
|
148
143
|
//# sourceMappingURL=comfy.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"comfy.d.ts","sourceRoot":"","sources":["../../src/nodes/comfy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAQ,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,OAAO,EAKL,KAAK,YAAY,EAGjB,KAAK,iBAAiB,EAIvB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,
|
|
1
|
+
{"version":3,"file":"comfy.d.ts","sourceRoot":"","sources":["../../src/nodes/comfy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAQ,MAAM,uBAAuB,C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,EAAE,OAAO,CAAC,CAAC,CAa3E;IAEM,UAAU,CACf,OAAO,CAAC,EAAE,iBAAiB,GAC1B,cAAc,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAmCzC;IAED;;;;OAIG;YACW,aAAa;CAiI5B;AAED,eAAO,MAAM,WAAW,4HAKtB,CAAC"}
|
package/dist/nodes/comfy.js
CHANGED
|
@@ -9,7 +9,8 @@ import { comfyDynamicSlots } from "./comfy-schema.js";
|
|
|
9
9
|
import { tagAsServer } from "@nodetool-ai/nodes-utils";
|
|
10
10
|
import { executeComfy, uploadComfyFile, loadMediaRefBytes, WebsocketPythonBridge } from "@nodetool-ai/runtime";
|
|
11
11
|
import { ComfyCloudWorkflowNode } from "./comfy-cloud.js";
|
|
12
|
-
import {
|
|
12
|
+
import { ComfyCloudGraphNode } from "./comfy-graph-cloud.js";
|
|
13
|
+
import { extFromUri, isMediaRef, runComfyWorkflow, sniffMedia, stripTrailingSlashes, workerHttpOrigin, UPLOAD_DEFAULTS, v2Transport } from "./comfy-sdk.js";
|
|
13
14
|
/**
|
|
14
15
|
* Turn a user-supplied server address into an http(s) base URL: a bare
|
|
15
16
|
* `host:port` gets `http://`, and trailing slashes are dropped. Mirrors
|
|
@@ -22,30 +23,7 @@ function httpBaseUrl(address) {
|
|
|
22
23
|
: `http://${address}`;
|
|
23
24
|
return stripTrailingSlashes(withScheme);
|
|
24
25
|
}
|
|
25
|
-
|
|
26
|
-
* Turn a worker WebSocket URL into the HTTP origin its API v2 routes live on:
|
|
27
|
-
* `ws:` becomes `http:`, `wss:` becomes `https:`, and path and query are
|
|
28
|
-
* dropped (`wss://abc-7777.proxy.runpod.net/ws` →
|
|
29
|
-
* `https://abc-7777.proxy.runpod.net`).
|
|
30
|
-
*/
|
|
31
|
-
export function workerHttpOrigin(workerUrl) {
|
|
32
|
-
const address = workerUrl.trim();
|
|
33
|
-
const withScheme = /^[a-z][a-z0-9+.-]*:\/\//i.test(address)
|
|
34
|
-
? address
|
|
35
|
-
: `ws://${address}`;
|
|
36
|
-
let url;
|
|
37
|
-
try {
|
|
38
|
-
url = new URL(withScheme);
|
|
39
|
-
}
|
|
40
|
-
catch {
|
|
41
|
-
throw new Error(`Worker URL is not a valid URL: ${workerUrl}`);
|
|
42
|
-
}
|
|
43
|
-
if (url.protocol === "ws:")
|
|
44
|
-
url.protocol = "http:";
|
|
45
|
-
else if (url.protocol === "wss:")
|
|
46
|
-
url.protocol = "https:";
|
|
47
|
-
return url.origin;
|
|
48
|
-
}
|
|
26
|
+
export { workerHttpOrigin } from "./comfy-sdk.js";
|
|
49
27
|
/**
|
|
50
28
|
* Run one prompt over a Comfy API v2 transport, enforcing the node's `timeout`
|
|
51
29
|
* prop with a signal the way the Comfy Cloud node does, and reporting a
|
|
@@ -395,52 +373,6 @@ __decorate([
|
|
|
395
373
|
min: 1
|
|
396
374
|
})
|
|
397
375
|
], ComfyWorkflowNode.prototype, "timeout", void 0);
|
|
398
|
-
/** Sniff a media kind + mime from the leading bytes of a ComfyUI output blob. */
|
|
399
|
-
function sniffMedia(bytes) {
|
|
400
|
-
const b = bytes;
|
|
401
|
-
// PNG
|
|
402
|
-
if (b[0] === 0x89 && b[1] === 0x50 && b[2] === 0x4e && b[3] === 0x47) {
|
|
403
|
-
return { kind: "image", mime: "image/png" };
|
|
404
|
-
}
|
|
405
|
-
// JPEG
|
|
406
|
-
if (b[0] === 0xff && b[1] === 0xd8 && b[2] === 0xff) {
|
|
407
|
-
return { kind: "image", mime: "image/jpeg" };
|
|
408
|
-
}
|
|
409
|
-
// GIF
|
|
410
|
-
if (b[0] === 0x47 && b[1] === 0x49 && b[2] === 0x46) {
|
|
411
|
-
return { kind: "image", mime: "image/gif" };
|
|
412
|
-
}
|
|
413
|
-
// RIFF container — disambiguate by the form type in bytes 8-11. RIFF is
|
|
414
|
-
// generic (WEBP, WAVE, AVI, …), so only classify on an exact form match and
|
|
415
|
-
// fall through otherwise rather than assuming WebP.
|
|
416
|
-
if (b[0] === 0x52 && b[1] === 0x49 && b[2] === 0x46 && b[3] === 0x46) {
|
|
417
|
-
// "WEBP"
|
|
418
|
-
if (b[8] === 0x57 && b[9] === 0x45 && b[10] === 0x42 && b[11] === 0x50) {
|
|
419
|
-
return { kind: "image", mime: "image/webp" };
|
|
420
|
-
}
|
|
421
|
-
// "WAVE"
|
|
422
|
-
if (b[8] === 0x57 && b[9] === 0x41 && b[10] === 0x56 && b[11] === 0x45) {
|
|
423
|
-
return { kind: "audio", mime: "audio/wav" };
|
|
424
|
-
}
|
|
425
|
-
// "AVI "
|
|
426
|
-
if (b[8] === 0x41 && b[9] === 0x56 && b[10] === 0x49 && b[11] === 0x20) {
|
|
427
|
-
return { kind: "video", mime: "video/x-msvideo" };
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
// ftyp box → MP4/MOV
|
|
431
|
-
if (b[4] === 0x66 && b[5] === 0x74 && b[6] === 0x79 && b[7] === 0x70) {
|
|
432
|
-
return { kind: "video", mime: "video/mp4" };
|
|
433
|
-
}
|
|
434
|
-
// OGG
|
|
435
|
-
if (b[0] === 0x4f && b[1] === 0x67 && b[2] === 0x67 && b[3] === 0x53) {
|
|
436
|
-
return { kind: "audio", mime: "audio/ogg" };
|
|
437
|
-
}
|
|
438
|
-
// ID3 / MPEG audio
|
|
439
|
-
if (b[0] === 0x49 && b[1] === 0x44 && b[2] === 0x33) {
|
|
440
|
-
return { kind: "audio", mime: "audio/mpeg" };
|
|
441
|
-
}
|
|
442
|
-
return { kind: "image", mime: "image/png" };
|
|
443
|
-
}
|
|
444
376
|
/**
|
|
445
377
|
* Run a ComfyUI workflow on a NodeTool worker that fronts a co-located,
|
|
446
378
|
* loopback-only ComfyUI server (the `nodetool-worker-comfy` image). ComfyUI
|
|
@@ -726,6 +658,7 @@ __decorate([
|
|
|
726
658
|
export const COMFY_NODES = tagAsServer([
|
|
727
659
|
ComfyWorkflowNode,
|
|
728
660
|
ComfyWorkerWorkflowNode,
|
|
729
|
-
ComfyCloudWorkflowNode
|
|
661
|
+
ComfyCloudWorkflowNode,
|
|
662
|
+
ComfyCloudGraphNode
|
|
730
663
|
]);
|
|
731
664
|
//# sourceMappingURL=comfy.js.map
|