@openclaw/comfy-provider 2026.9.3 → 2026.9.4
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/dist/workflow-runtime.js +26 -64
- package/openclaw.plugin.json +1 -0
- package/package.json +4 -4
package/dist/workflow-runtime.js
CHANGED
|
@@ -217,49 +217,32 @@ function extractHistoryEntry(history, promptId) {
|
|
|
217
217
|
if (isRecord(nested)) return nested;
|
|
218
218
|
return null;
|
|
219
219
|
}
|
|
220
|
-
async function
|
|
221
|
-
const deadline = Date.now() + params.timeoutMs;
|
|
222
|
-
for (;;) {
|
|
223
|
-
const requestTimeoutMs = resolveComfyRemainingMs(deadline, params.timeoutMs);
|
|
224
|
-
const entry = extractHistoryEntry(await readJsonResponse({
|
|
225
|
-
url: `${params.baseUrl}/history/${params.promptId}`,
|
|
226
|
-
init: {
|
|
227
|
-
method: "GET",
|
|
228
|
-
headers: params.headers
|
|
229
|
-
},
|
|
230
|
-
timeoutMs: requestTimeoutMs,
|
|
231
|
-
policy: params.policy,
|
|
232
|
-
dispatcherPolicy: params.dispatcherPolicy,
|
|
233
|
-
auditContext: "comfy-history",
|
|
234
|
-
errorPrefix: "Comfy history lookup failed"
|
|
235
|
-
}), params.promptId);
|
|
236
|
-
if (entry?.outputs && Object.keys(entry.outputs).length > 0) return entry;
|
|
237
|
-
const pollDelayMs = resolveComfyRemainingMs(deadline, params.timeoutMs, params.pollIntervalMs);
|
|
238
|
-
await new Promise((resolve) => {
|
|
239
|
-
setTimeout(resolve, pollDelayMs);
|
|
240
|
-
});
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
async function waitForCloudCompletion(params) {
|
|
220
|
+
async function waitForComfyHistory(params) {
|
|
244
221
|
const deadline = Date.now() + params.timeoutMs;
|
|
222
|
+
const read = (path, kind, timeoutMs) => readJsonResponse({
|
|
223
|
+
url: `${params.baseUrl}${path}`,
|
|
224
|
+
init: {
|
|
225
|
+
method: "GET",
|
|
226
|
+
headers: params.headers
|
|
227
|
+
},
|
|
228
|
+
timeoutMs,
|
|
229
|
+
policy: params.policy,
|
|
230
|
+
dispatcherPolicy: params.dispatcherPolicy,
|
|
231
|
+
auditContext: `comfy-${kind}`,
|
|
232
|
+
errorPrefix: `Comfy ${kind} lookup failed`
|
|
233
|
+
});
|
|
245
234
|
for (;;) {
|
|
246
235
|
const requestTimeoutMs = resolveComfyRemainingMs(deadline, params.timeoutMs);
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
errorPrefix: "Comfy status lookup failed"
|
|
258
|
-
});
|
|
259
|
-
if (status.status === "completed") return;
|
|
260
|
-
if (status.status === "failed" || status.status === "cancelled") {
|
|
261
|
-
const detail = redactProviderResponseErrorText(status.error ?? status.message ?? params.promptId, params.headers);
|
|
262
|
-
throw new Error(`Comfy workflow ${status.status}: ${detail}`);
|
|
236
|
+
if (params.mode === "cloud") {
|
|
237
|
+
const status = await read(`/api/job/${params.promptId}/status`, "status", requestTimeoutMs);
|
|
238
|
+
if (status.status === "completed") return await read(`/api/history_v2/${params.promptId}`, "history", params.timeoutMs);
|
|
239
|
+
if (status.status === "failed" || status.status === "cancelled") {
|
|
240
|
+
const detail = redactProviderResponseErrorText(status.error ?? status.message ?? params.promptId, params.headers);
|
|
241
|
+
throw new Error(`Comfy workflow ${status.status}: ${detail}`);
|
|
242
|
+
}
|
|
243
|
+
} else {
|
|
244
|
+
const entry = extractHistoryEntry(await read(`/history/${params.promptId}`, "history", requestTimeoutMs), params.promptId);
|
|
245
|
+
if (entry?.outputs && Object.keys(entry.outputs).length > 0) return entry;
|
|
263
246
|
}
|
|
264
247
|
const pollDelayMs = resolveComfyRemainingMs(deadline, params.timeoutMs, params.pollIntervalMs);
|
|
265
248
|
await new Promise((resolve) => {
|
|
@@ -466,36 +449,15 @@ async function runComfyWorkflow(params) {
|
|
|
466
449
|
});
|
|
467
450
|
const promptId = normalizeOptionalString(promptResponse.prompt_id);
|
|
468
451
|
if (!promptId) throw new Error("Comfy workflow submit response missing prompt_id");
|
|
469
|
-
const historyEntry = extractHistoryEntry(
|
|
470
|
-
await waitForCloudCompletion({
|
|
471
|
-
baseUrl: normalizedBaseUrl,
|
|
472
|
-
promptId,
|
|
473
|
-
headers: new Headers(headers),
|
|
474
|
-
timeoutMs,
|
|
475
|
-
pollIntervalMs,
|
|
476
|
-
policy: networkPolicy.apiPolicy,
|
|
477
|
-
dispatcherPolicy
|
|
478
|
-
});
|
|
479
|
-
return await readJsonResponse({
|
|
480
|
-
url: `${normalizedBaseUrl}/api/history_v2/${promptId}`,
|
|
481
|
-
init: {
|
|
482
|
-
method: "GET",
|
|
483
|
-
headers: new Headers(headers)
|
|
484
|
-
},
|
|
485
|
-
timeoutMs,
|
|
486
|
-
policy: networkPolicy.apiPolicy,
|
|
487
|
-
dispatcherPolicy,
|
|
488
|
-
auditContext: "comfy-history",
|
|
489
|
-
errorPrefix: "Comfy history lookup failed"
|
|
490
|
-
});
|
|
491
|
-
})() : await waitForLocalHistory({
|
|
452
|
+
const historyEntry = extractHistoryEntry(await waitForComfyHistory({
|
|
492
453
|
baseUrl: normalizedBaseUrl,
|
|
493
454
|
promptId,
|
|
494
455
|
headers: new Headers(headers),
|
|
495
456
|
timeoutMs,
|
|
496
457
|
pollIntervalMs,
|
|
497
458
|
policy: networkPolicy.apiPolicy,
|
|
498
|
-
dispatcherPolicy
|
|
459
|
+
dispatcherPolicy,
|
|
460
|
+
mode
|
|
499
461
|
}), promptId);
|
|
500
462
|
if (!historyEntry) throw new Error(`Comfy history response missing outputs for prompt ${promptId}`);
|
|
501
463
|
const outputFiles = collectOutputFiles({
|
package/openclaw.plugin.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/comfy-provider",
|
|
3
|
-
"version": "2026.9.
|
|
3
|
+
"version": "2026.9.4",
|
|
4
4
|
"description": "OpenClaw ComfyUI provider plugin.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
"minHostVersion": ">=2026.7.2"
|
|
19
19
|
},
|
|
20
20
|
"compat": {
|
|
21
|
-
"pluginApi": ">=2026.9.
|
|
21
|
+
"pluginApi": ">=2026.9.4"
|
|
22
22
|
},
|
|
23
23
|
"build": {
|
|
24
|
-
"openclawVersion": "2026.9.
|
|
24
|
+
"openclawVersion": "2026.9.4",
|
|
25
25
|
"bundledDist": false
|
|
26
26
|
},
|
|
27
27
|
"release": {
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"README.md"
|
|
39
39
|
],
|
|
40
40
|
"peerDependencies": {
|
|
41
|
-
"openclaw": ">=2026.9.
|
|
41
|
+
"openclaw": ">=2026.9.4"
|
|
42
42
|
},
|
|
43
43
|
"peerDependenciesMeta": {
|
|
44
44
|
"openclaw": {
|