comfyui-mcp 0.52.59 → 0.52.60

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.
@@ -41,7 +41,7 @@ import { isPanelAnsweredError } from "../services/panel-answered.js";
41
41
  import { isPreExecutorRefusal } from "../services/panel-refusal.js";
42
42
  import { createSdkMcpServer, tool } from "@anthropic-ai/claude-agent-sdk";
43
43
  import { parse as parseYaml } from "yaml";
44
- import { requiredPanelVersion, SEMVER_RE, LATE_ASK_TTL_MS, tabIncarnationSlot, } from "../services/ui-bridge.js";
44
+ import { requiredPanelVersion, SEMVER_RE, LATE_ASK_TTL_MS, tabIncarnationSlot, SHOW_MEDIA_KIND_MIN_PANEL_VERSION, showMediaItemsPanelCannotPaint, } from "../services/ui-bridge.js";
45
45
  import { compareSemver } from "../services/self-update.js";
46
46
  import { describeInstallPanelAction } from "../services/panel-recovery.js";
47
47
  import { peekResolvedPanelBase, primePanelBase, verifiedPanelDiskVersion, } from "../services/panel-workspace.js";
@@ -3770,6 +3770,56 @@ function tabAdvertisedPanelVersion(ctx) {
3770
3770
  const v = reading?.version;
3771
3771
  return typeof v === "string" && SEMVER_RE.test(v.trim()) ? v.trim() : undefined;
3772
3772
  }
3773
+ function tabPanelVersionReading(ctx) {
3774
+ const fn = ctx.bridge.advertisedPanelVersion;
3775
+ if (typeof fn !== "function")
3776
+ return {};
3777
+ try {
3778
+ return fn.call(ctx.bridge, ctx.tabId) ?? {};
3779
+ }
3780
+ catch {
3781
+ return {};
3782
+ }
3783
+ }
3784
+ function tabAdvertisedShowMediaKinds(ctx) {
3785
+ const fn = ctx.bridge.tabShowMediaKinds;
3786
+ if (typeof fn !== "function")
3787
+ return undefined;
3788
+ try {
3789
+ return fn.call(ctx.bridge, ctx.tabId);
3790
+ }
3791
+ catch {
3792
+ return undefined;
3793
+ }
3794
+ }
3795
+ /**
3796
+ * #2017 — refuse a kind this panel is proven unable to paint, rather than send
3797
+ * an item that becomes a broken-image card and reports success.
3798
+ *
3799
+ * Names the advertised version (when we have one) and the upgrade; a restart
3800
+ * alone leaves cached JS running, so the hard-refresh is part of the remedy.
3801
+ */
3802
+ function formatShowMediaKindUnsupported(blocked) {
3803
+ const kinds = [...new Set(blocked.map((b) => b.kind))];
3804
+ const kindList = kinds.map((k) => `"${k}"`).join(", ");
3805
+ const needed = blocked.find((b) => b.needed)?.needed ??
3806
+ kinds.map((k) => SHOW_MEDIA_KIND_MIN_PANEL_VERSION[k]).find((v) => typeof v === "string");
3807
+ const version = blocked.find((b) => b.version)?.version;
3808
+ const items = blocked.map((b) => ` - ${b.filename} (${b.kind})`).join("\n");
3809
+ const update = describeInstallPanelAction("update", "update the ComfyUI-MCP panel via ComfyUI Manager");
3810
+ const floor = needed ? ` to ≥${needed}` : " to a build that can paint it";
3811
+ const detected = version ? ` This tab announced panel ${version}.` : "";
3812
+ const why = blocked.some((b) => b.reason === "not_in_hello")
3813
+ ? `The panel advertised the kinds it can paint and ${kindList} ${kinds.length === 1 ? "is" : "are"} not among them.`
3814
+ : `kind ${kindList} ${kinds.length === 1 ? "is" : "are"} only understood by panels from #710 onward` +
3815
+ (needed ? ` (first shipped in ${needed})` : "") +
3816
+ ".";
3817
+ return (`This panel cannot paint ${kindList}.${detected} ${why} ` +
3818
+ `Sending ${blocked.length === 1 ? "it" : "them"} would show a broken-image card and report success.\n` +
3819
+ `Items not sent:\n${items}\n` +
3820
+ `${update}${floor}, then HARD-REFRESH the browser tab (Ctrl+Shift+R, or Cmd+Shift+R on macOS); ` +
3821
+ `a restart alone leaves the tab running cached old JS.`);
3822
+ }
3773
3823
  /**
3774
3824
  * #1828 — an allowlisted frontend-only type refused as "backend does not
3775
3825
  * provide it" is version skew when the tab's advertised panel is below this
@@ -16525,6 +16575,20 @@ CHECKED FOR YOU: the graph read this message prescribes was just run, and it ` +
16525
16575
  }
16526
16576
  }
16527
16577
  }
16578
+ // #2017 — do not send a painter kind this panel is proven unable to
16579
+ // render. A pre-#710 panel paints `audio` as `<img>` and reports
16580
+ // success; refusing with the version and the upgrade is strictly better
16581
+ // than a broken-image card. Fail-OPEN when the version is unknown or
16582
+ // inherited (same tri-state as the #392 command gate) so a current
16583
+ // panel that omitted the field is never told to update. Image/video
16584
+ // skip the check entirely.
16585
+ const blocked = showMediaItemsPanelCannotPaint(resolved, {
16586
+ reading: tabPanelVersionReading(ctx),
16587
+ advertisedKinds: tabAdvertisedShowMediaKinds(ctx),
16588
+ });
16589
+ if (blocked.length > 0) {
16590
+ return fail(formatShowMediaKindUnsupported(blocked));
16591
+ }
16528
16592
  // #2010 — the reply below is the CLIENT's, and one of the two clients
16529
16593
  // that answer show_media says `{shown:true}` without reading the items.
16530
16594
  // Correct the claim against what the reply actually accounted for BEFORE