comfyui-mcp 0.51.35 → 0.51.37

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.
@@ -65,7 +65,7 @@ function journalTabFor(ctx) {
65
65
  function journalConversationFor(ctx) {
66
66
  return conversationOfScopeAddress(ctx.tabId);
67
67
  }
68
- import { BRIDGE_DEFAULT_TIMEOUT_MS, dispatchOutcomeOf, isCapabilityRefusal, isPanelCmdUnsupportedError, isReplyTimeoutTagged, isRoutingAmbiguity, } from "../services/ui-bridge.js";
68
+ import { BRIDGE_DEFAULT_TIMEOUT_MS, BRIDGE_READ_DEFAULT_TIMEOUT_MS, dispatchOutcomeOf, isCapabilityRefusal, isPanelCmdUnsupportedError, isReplyTimeoutTagged, isRoutingAmbiguity, } from "../services/ui-bridge.js";
69
69
  import { withWorkflowTarget, } from "../services/workflow-target-store.js";
70
70
  import { addUserMcpServer, readUserMcpServers, removeUserMcpServer, setUserMcpServerSecret, } from "../services/user-mcp-config.js";
71
71
  import { setComfyuiSecret, setAgentSecret, isAllowedAgentSecretKey, receiptDisclosures, shadowedNote, storeDamageNote, } from "../services/panel-secrets.js";
@@ -2578,6 +2578,39 @@ function fitQueryGraphReply(res, requested) {
2578
2578
  const CIVITAI_SAMPLE_MAX_BYTES = 4 * 1024 * 1024; // per-thumbnail cap (450px jpeg ≈ tens of KB)
2579
2579
  const CIVITAI_SAMPLE_DEFAULT = 4; // thumbnails delivered by default — bounds context
2580
2580
  const CIVITAI_SAMPLE_MAX = 8; // hard ceiling even if the agent asks for more
2581
+ /**
2582
+ * The `civitai_*` commands whose reply time is bounded by CivitAI rather than by
2583
+ * the tab (#1520). Of the six in the family, exactly these two await the
2584
+ * in-flight fetch panel-side (`state.activeReloadPromise`): `civitai_results`
2585
+ * and `civitai_highlight`. `clear_highlight`, `switch_tab` and `open_lightbox`
2586
+ * do not, and keep the tighter bound.
2587
+ *
2588
+ * `civitai_search` is the sixth and is not on either path: it dispatches through
2589
+ * `ctx.bridge.send` so the handler can inspect the reply, and already takes
2590
+ * `BRIDGE_DEFAULT_TIMEOUT_MS` — #1468 raised it because `driveSearch` returns
2591
+ * without awaiting at all. The family is not uniform; do not assume a single
2592
+ * bound describes it.
2593
+ *
2594
+ * That await is deliberate (panel#793): without it an agent that opened the
2595
+ * browser and immediately asked for results got `{count:0, total:0}`, which
2596
+ * reads as "this search found nothing" while a concurrent `civitai_highlight`
2597
+ * *did* wait and *did* see cards — two commands disagreeing about whether
2598
+ * results existed. So the fix is not to remove the wait but to stop charging it
2599
+ * against a bound sized for a local read.
2600
+ *
2601
+ * Timing out here is not harmless in either case:
2602
+ * - `civitai_results` is a pure read; the caller simply loses the answer.
2603
+ * - `civitai_highlight` *lands* — the panel installs the glow once the reload
2604
+ * resolves — so the caller is told the command failed while its effect
2605
+ * arrives anyway. That is the #1468 false-failure shape. Re-issuing is safe
2606
+ * (`driveHighlight` clears before installing), but the report was wrong.
2607
+ *
2608
+ * 20 s is not a cure — no bound covers a CivitAI 503-and-retry. It is the
2609
+ * tolerant bound every other read already gets (#357: a busy-but-alive tab
2610
+ * fails a tight one), and it is the window the panel's own bounded wait has to
2611
+ * fit inside to be able to answer at all.
2612
+ */
2613
+ const CIVITAI_COUPLED_READ_TIMEOUT_MS = BRIDGE_READ_DEFAULT_TIMEOUT_MS;
2581
2614
  const CIVITAI_SAMPLE_FETCH_TIMEOUT_MS = 8000;
2582
2615
  // Extra fetch ATTEMPTS allowed beyond the requested image count, so a few
2583
2616
  // 404/non-image/oversize URLs don't starve the result — but a malformed reply
@@ -8954,7 +8987,7 @@ export function buildPanelToolDefs() {
8954
8987
  .optional()
8955
8988
  .describe(`How many top NON-GATED sample thumbnails to fetch and return as inline IMAGE blocks (0–${CIVITAI_SAMPLE_MAX}, default ${CIVITAI_SAMPLE_DEFAULT}). Set 0 for metadata only (e.g. a quick scan where you don't need pixels). Gated/blurred results are always skipped regardless of this count.`),
8956
8989
  }, async (args, ctx) => {
8957
- const res = await ctx.call({ cmd: "civitai_results", limit: args.limit }, 10000);
8990
+ const res = await ctx.call({ cmd: "civitai_results", limit: args.limit }, CIVITAI_COUPLED_READ_TIMEOUT_MS);
8958
8991
  // Enrich with inline sample pixels (#623). Best-effort + additive: on any
8959
8992
  // problem we return the untouched text results, so the read path can never
8960
8993
  // regress to an error just because a thumbnail fetch failed.
@@ -8999,7 +9032,7 @@ export function buildPanelToolDefs() {
8999
9032
  .enum(["media", "model"])
9000
9033
  .optional()
9001
9034
  .describe("Which result kind these ids refer to (media = images/videos, model = checkpoints/loras/workflows). Match the active tab if omitted."),
9002
- }, async (args, ctx) => ctx.call({ cmd: "civitai_highlight", ids: args.ids, kind: args.kind }, 10000)),
9035
+ }, async (args, ctx) => ctx.call({ cmd: "civitai_highlight", ids: args.ids, kind: args.kind }, CIVITAI_COUPLED_READ_TIMEOUT_MS)),
9003
9036
  def("panel_civitai_clear_highlight", "Remove any green highlight glow from the CivitAI results — clears what panel_civitai_highlight set. The browser must be open — otherwise the panel replies with an honest error.", {}, async (_args, ctx) => ctx.call({ cmd: "civitai_clear_highlight" }, 10000)),
9004
9037
  def("panel_civitai_switch_tab", "Switch the OPEN CivitAI browser to a different tab (crossfades and re-fetches that tab's results). Use to move between images, videos, checkpoints, loras, workflows, or the user's favorites while driving the browse. Follow with panel_civitai_results to read what loaded. The browser must be open — otherwise the panel replies with an honest error.", {
9005
9038
  tab: z