@openclaw/comfy-provider 2026.9.3 → 2026.9.5

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.
@@ -0,0 +1,32 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
2
+ <!--
3
+ Adapted from OpenClaw ui/public/provider-icons/ProviderIcon-comfy.svg.
4
+ Source: @lobehub/icons-static-svg@1.94.0, comfyui.svg
5
+ https://www.npmjs.com/package/@lobehub/icons-static-svg/v/1.94.0
6
+ https://github.com/lobehub/lobe-icons
7
+
8
+ MIT License
9
+ Copyright (c) 2023 LobeHub
10
+
11
+ Permission is hereby granted, free of charge, to any person obtaining a copy
12
+ of this software and associated documentation files (the "Software"), to deal
13
+ in the Software without restriction, including without limitation the rights
14
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
+ copies of the Software, and to permit persons to whom the Software is
16
+ furnished to do so, subject to the following conditions:
17
+
18
+ The above copyright notice and this permission notice shall be included in all
19
+ copies or substantial portions of the Software.
20
+
21
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
+ SOFTWARE.
28
+
29
+ Names and marks remain the property of their respective owners.
30
+ -->
31
+ <path fill="currentColor" fill-rule="evenodd" stroke="none" d="M5.485 23.76c-.568 0-1.026-.207-1.325-.598-.307-.402-.387-.964-.22-1.54l.672-2.315a.605.605 0 00-.1-.536.622.622 0 00-.494-.243H2.085c-.568 0-1.026-.207-1.325-.598-.307-.403-.387-.964-.22-1.54l2.31-7.917.255-.87c.343-1.18 1.592-2.14 2.786-2.14h2.313c.276 0 .519-.18.595-.442l.764-2.633C9.906 1.208 11.155.249 12.35.249l4.945-.008h3.62c.568 0 1.027.206 1.325.597.307.402.387.964.22 1.54l-1.035 3.566c-.343 1.178-1.593 2.137-2.787 2.137l-4.956.01H11.37a.618.618 0 00-.594.441l-1.928 6.604a.605.605 0 00.1.537c.118.153.3.243.495.243l3.275-.006h3.61c.568 0 1.026.206 1.325.598.307.402.387.964.22 1.54l-1.036 3.565c-.342 1.179-1.592 2.138-2.786 2.138l-4.957.01h-3.61z" />
32
+ </svg>
Binary file
@@ -28,9 +28,15 @@ function readConfigInteger(config, key) {
28
28
  }
29
29
  function getComfyConfig(cfg) {
30
30
  const pluginConfig = cfg?.plugins?.entries?.comfy?.config;
31
- if (isRecord(pluginConfig)) return pluginConfig;
31
+ if (isRecord(pluginConfig)) return {
32
+ config: pluginConfig,
33
+ path: "plugins.entries.comfy.config"
34
+ };
32
35
  const legacyConfig = cfg?.models?.providers?.comfy;
33
- return isRecord(legacyConfig) ? legacyConfig : {};
36
+ return {
37
+ config: isRecord(legacyConfig) ? legacyConfig : {},
38
+ path: "models.providers.comfy"
39
+ };
34
40
  }
35
41
  function stripNestedCapabilityConfig(config) {
36
42
  const next = { ...config };
@@ -110,22 +116,11 @@ function setWorkflowInput(params) {
110
116
  if (!isRecord(inputs)) throw new Error(`Comfy workflow node "${params.nodeId}" is missing an inputs object`);
111
117
  inputs[params.inputName] = params.value;
112
118
  }
113
- async function resolveComfyHeadersConfig(value, cfg) {
119
+ async function resolveComfyHeadersConfig(value, cfg, configPath) {
114
120
  const headers = new Headers();
115
121
  if (!isRecord(value)) return headers;
116
122
  for (const [name, headerValue] of Object.entries(value)) {
117
- const path = `plugins.entries.comfy.config.headers.${name}`;
118
- const inspected = resolveSecretInputString({
119
- value: headerValue,
120
- path,
121
- defaults: cfg.secrets?.defaults,
122
- mode: "inspect"
123
- });
124
- if (inspected.status === "available") {
125
- headers.set(name, inspected.value);
126
- continue;
127
- }
128
- if (inspected.status === "missing") continue;
123
+ const path = `${configPath}.headers[${JSON.stringify(name)}]`;
129
124
  const resolved = await resolveConfiguredSecretInputString({
130
125
  config: cfg,
131
126
  env: process.env,
@@ -217,49 +212,32 @@ function extractHistoryEntry(history, promptId) {
217
212
  if (isRecord(nested)) return nested;
218
213
  return null;
219
214
  }
220
- async function waitForLocalHistory(params) {
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) {
215
+ async function waitForComfyHistory(params) {
244
216
  const deadline = Date.now() + params.timeoutMs;
217
+ const read = (path, kind, timeoutMs) => readJsonResponse({
218
+ url: `${params.baseUrl}${path}`,
219
+ init: {
220
+ method: "GET",
221
+ headers: params.headers
222
+ },
223
+ timeoutMs,
224
+ policy: params.policy,
225
+ dispatcherPolicy: params.dispatcherPolicy,
226
+ auditContext: `comfy-${kind}`,
227
+ errorPrefix: `Comfy ${kind} lookup failed`
228
+ });
245
229
  for (;;) {
246
230
  const requestTimeoutMs = resolveComfyRemainingMs(deadline, params.timeoutMs);
247
- const status = await readJsonResponse({
248
- url: `${params.baseUrl}/api/job/${params.promptId}/status`,
249
- init: {
250
- method: "GET",
251
- headers: params.headers
252
- },
253
- timeoutMs: requestTimeoutMs,
254
- policy: params.policy,
255
- dispatcherPolicy: params.dispatcherPolicy,
256
- auditContext: "comfy-status",
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}`);
231
+ if (params.mode === "cloud") {
232
+ const status = await read(`/api/job/${params.promptId}/status`, "status", requestTimeoutMs);
233
+ if (status.status === "completed") return await read(`/api/history_v2/${params.promptId}`, "history", params.timeoutMs);
234
+ if (status.status === "failed" || status.status === "cancelled") {
235
+ const detail = redactProviderResponseErrorText(status.error ?? status.message ?? params.promptId, params.headers);
236
+ throw new Error(`Comfy workflow ${status.status}: ${detail}`);
237
+ }
238
+ } else {
239
+ const entry = extractHistoryEntry(await read(`/history/${params.promptId}`, "history", requestTimeoutMs), params.promptId);
240
+ if (entry?.outputs && Object.keys(entry.outputs).length > 0) return entry;
263
241
  }
264
242
  const pollDelayMs = resolveComfyRemainingMs(deadline, params.timeoutMs, params.pollIntervalMs);
265
243
  await new Promise((resolve) => {
@@ -355,7 +333,8 @@ function hasUnavailableComfyHeaderSecret(value, cfg) {
355
333
  });
356
334
  }
357
335
  function isComfyCapabilityConfigured(params) {
358
- const capabilityConfig = getComfyCapabilityConfig(getComfyConfig(params.cfg), params.capability);
336
+ const { config } = getComfyConfig(params.cfg);
337
+ const capabilityConfig = getComfyCapabilityConfig(config, params.capability);
359
338
  const hasWorkflow = Boolean(resolveComfyWorkflowSource(capabilityConfig).workflow || normalizeOptionalString(capabilityConfig.workflowPath));
360
339
  const hasPromptNode = Boolean(normalizeOptionalString(capabilityConfig.promptNodeId));
361
340
  if (!hasWorkflow || !hasPromptNode) return false;
@@ -371,7 +350,8 @@ function isComfyCapabilityConfigured(params) {
371
350
  });
372
351
  }
373
352
  async function runComfyWorkflow(params) {
374
- const capabilityConfig = getComfyCapabilityConfig(getComfyConfig(params.cfg), params.capability);
353
+ const { config, path: configPath } = getComfyConfig(params.cfg);
354
+ const capabilityConfig = getComfyCapabilityConfig(config, params.capability);
375
355
  const mode = resolveComfyMode(capabilityConfig);
376
356
  const workflow = await loadComfyWorkflow(capabilityConfig);
377
357
  const promptNodeId = getRequiredConfigString(capabilityConfig, "promptNodeId");
@@ -413,7 +393,7 @@ async function runComfyWorkflow(params) {
413
393
  baseUrl: normalizeOptionalString(capabilityConfig.baseUrl),
414
394
  defaultBaseUrl: mode === "cloud" ? DEFAULT_COMFY_CLOUD_BASE_URL : DEFAULT_COMFY_LOCAL_BASE_URL,
415
395
  allowPrivateNetwork: mode === "local" || explicitAllowPrivateNetwork,
416
- headers: await resolveComfyHeadersConfig(capabilityConfig.headers, params.cfg),
396
+ headers: await resolveComfyHeadersConfig(capabilityConfig.headers, params.cfg, configPath),
417
397
  defaultHeaders: mode === "cloud" ? {
418
398
  "X-API-Key": resolvedAuth?.apiKey ?? "",
419
399
  "Content-Type": "application/json"
@@ -466,36 +446,15 @@ async function runComfyWorkflow(params) {
466
446
  });
467
447
  const promptId = normalizeOptionalString(promptResponse.prompt_id);
468
448
  if (!promptId) throw new Error("Comfy workflow submit response missing prompt_id");
469
- const historyEntry = extractHistoryEntry(mode === "cloud" ? await (async () => {
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({
449
+ const historyEntry = extractHistoryEntry(await waitForComfyHistory({
492
450
  baseUrl: normalizedBaseUrl,
493
451
  promptId,
494
452
  headers: new Headers(headers),
495
453
  timeoutMs,
496
454
  pollIntervalMs,
497
455
  policy: networkPolicy.apiPolicy,
498
- dispatcherPolicy
456
+ dispatcherPolicy,
457
+ mode
499
458
  }), promptId);
500
459
  if (!historyEntry) throw new Error(`Comfy history response missing outputs for prompt ${promptId}`);
501
460
  const outputFiles = collectOutputFiles({
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "id": "comfy",
3
+ "categories": ["media"],
3
4
  "activation": {
4
5
  "onStartup": false
5
6
  },
@@ -184,6 +185,54 @@
184
185
  ]
185
186
  }
186
187
  },
188
+ "configGroups": [
189
+ {
190
+ "id": "comfy-connection",
191
+ "title": "Comfy connection",
192
+ "order": 10,
193
+ "properties": ["mode", "baseUrl", "apiKey", "allowPrivateNetwork", "headers"]
194
+ },
195
+ {
196
+ "id": "shared-workflow",
197
+ "title": "Shared workflow",
198
+ "order": 20,
199
+ "properties": [
200
+ "workflowPath",
201
+ "workflow",
202
+ "promptNodeId",
203
+ "promptInputName",
204
+ "seedNodeId",
205
+ "seedInputName",
206
+ "inputImageNodeId",
207
+ "inputImageInputName",
208
+ "outputNodeId"
209
+ ]
210
+ },
211
+ {
212
+ "id": "image-workflow",
213
+ "title": "Image workflow",
214
+ "order": 30,
215
+ "properties": ["image"]
216
+ },
217
+ {
218
+ "id": "video-workflow",
219
+ "title": "Video workflow",
220
+ "order": 40,
221
+ "properties": ["video"]
222
+ },
223
+ {
224
+ "id": "music-workflow",
225
+ "title": "Music workflow",
226
+ "order": 50,
227
+ "properties": ["music"]
228
+ },
229
+ {
230
+ "id": "execution-limits",
231
+ "title": "Execution limits",
232
+ "order": 60,
233
+ "properties": ["pollIntervalMs", "timeoutMs"]
234
+ }
235
+ ],
187
236
  "configSchema": {
188
237
  "type": "object",
189
238
  "additionalProperties": false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openclaw/comfy-provider",
3
- "version": "2026.9.3",
3
+ "version": "2026.9.5",
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.3"
21
+ "pluginApi": ">=2026.9.5"
22
22
  },
23
23
  "build": {
24
- "openclawVersion": "2026.9.3",
24
+ "openclawVersion": "2026.9.5",
25
25
  "bundledDist": false
26
26
  },
27
27
  "release": {
@@ -35,10 +35,12 @@
35
35
  "files": [
36
36
  "dist/**",
37
37
  "openclaw.plugin.json",
38
- "README.md"
38
+ "README.md",
39
+ "assets/icon.png",
40
+ "assets/activity.svg"
39
41
  ],
40
42
  "peerDependencies": {
41
- "openclaw": ">=2026.9.3"
43
+ "openclaw": ">=2026.9.5"
42
44
  },
43
45
  "peerDependenciesMeta": {
44
46
  "openclaw": {