comfyui-mcp 0.52.206-beta.5 → 0.52.206

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.
@@ -109,7 +109,7 @@ import { AntigravityBackend } from "./antigravity-backend.js";
109
109
  import { PiBackend } from "./pi-backend.js";
110
110
  import { GrokBackend, GROK_DEFAULT_MODEL } from "./grok-backend.js";
111
111
  import { QwenBackend, QWEN_DEFAULT_MODEL } from "./qwen-backend.js";
112
- import { OllamaBackend, OLLAMA_SYSTEM_PROMPT } from "./ollama-backend.js";
112
+ import { OllamaBackend, OLLAMA_SYSTEM_PROMPT, parseOllamaContextSetting, } from "./ollama-backend.js";
113
113
  import { ChatGptOAuthBackend, CHATGPT_DEFAULT_MODEL, resolveChatGptDefaultModel } from "./chatgpt-oauth-backend.js";
114
114
  import { pickTopClaudeModel } from "./model-defaults.js";
115
115
  import { KimiBackend } from "./kimi-backend.js";
@@ -126,7 +126,7 @@ import { handleOAuthBegin, handleOAuthStatus, handleOAuthSignout } from "./oauth
126
126
  // prompts, ack `message` fields, log lines — is read by a machine and stays English.
127
127
  import { trFor } from "../i18n/index.js";
128
128
  import { buildStartFailureNotice, startFailureSay } from "./start-failure-notice.js";
129
- import { readyBannerText, bannerCorrection } from "./ready-banner.js";
129
+ import { readyBannerText, bannerCorrection, greetingLabel } from "./ready-banner.js";
130
130
  import { OAUTH_PROVIDERS } from "../services/oauth-flow.js";
131
131
  import { startPanelMcpHttpServer } from "./panel-mcp-http.js";
132
132
  import { resolveHttpLaneComfyToolMode } from "./http-backend-tools.js";
@@ -1380,9 +1380,15 @@ export async function runPanelOrchestrator() {
1380
1380
  ? "openai"
1381
1381
  : "ollama";
1382
1382
  let ollamaBaseUrl = process.env.COMFYUI_MCP_OLLAMA_BASE_URL ?? persistedAgent.ollama?.baseUrl;
1383
+ // Panel Settings › Ollama › Context window. Unlike the fields above, an
1384
+ // explicit panel choice beats COMFYUI_MCP_OLLAMA_NUM_CTX: the env var is the
1385
+ // fallback for "auto", so a stale .env line can't lock the panel control.
1386
+ // Read through a getter so a change applies to live sessions on the next turn.
1387
+ let ollamaNumCtx = parseOllamaContextSetting(persistedAgent.ollama?.numCtx) ?? "auto";
1383
1388
  const ollamaApiKey = process.env.COMFYUI_MCP_OLLAMA_API_KEY || process.env.OPENROUTER_API_KEY;
1384
1389
  const ollamaDeps = () => ({
1385
1390
  api: ollamaApi,
1391
+ contextSetting: () => ollamaNumCtx,
1386
1392
  ...(ollamaBaseUrl ? { host: ollamaBaseUrl } : {}),
1387
1393
  ...(ollamaApi === "openai" && ollamaApiKey ? { apiKey: ollamaApiKey } : {}),
1388
1394
  });
@@ -1486,6 +1492,7 @@ export async function runPanelOrchestrator() {
1486
1492
  // The SDK-resolved model per tab, learned from the session/init event. Kept so a
1487
1493
  // greeting emitted AFTER the model is already known (the onSession-before-greeting
1488
1494
  // race) can label itself correctly instead of showing the pre-init default.
1495
+ // Tagged with the backend that resolved it: the entry survives a backend switch.
1489
1496
  const resolvedModelByTab = new Map();
1490
1497
  const headlessTabs = new Set(); // tabs with no ComfyUI canvas (mobile/remote) — deliver renders in-turn
1491
1498
  // The UUID stamped on the NEXT panel command for a tab — the per-workflow
@@ -2497,7 +2504,7 @@ export async function runPanelOrchestrator() {
2497
2504
  // Banner corrections are "say" frames (mirror-safe) — viewers via mirror.
2498
2505
  for (const panelTab of conversationDeliveryTabs(key, "say")) {
2499
2506
  if (typeof model === "string" && model.trim())
2500
- resolvedModelByTab.set(panelTab, model);
2507
+ resolvedModelByTab.set(panelTab, { backend: backendForTab(panelTab), model });
2501
2508
  const corrected = bannerCorrection({
2502
2509
  backend: backendForTab(panelTab),
2503
2510
  advertisedLabel: advertisedBannerModel.get(panelTab),
@@ -4277,7 +4284,7 @@ export async function runPanelOrchestrator() {
4277
4284
  // greeting (#376) — otherwise the pre-init label. Remember what we
4278
4285
  // advertised so the onSession correction re-sends only on a real
4279
4286
  // mismatch.
4280
- const bannerLabel = resolvedModelByTab.get(panelTab) ?? agentLabel;
4287
+ const bannerLabel = greetingLabel(resolvedModelByTab.get(panelTab), backend, agentLabel);
4281
4288
  advertisedBannerModel.set(panelTab, bannerLabel);
4282
4289
  bridge.push({ type: "say", text: readyBannerText(backend, bannerLabel, customBaseUrl) }, panelTab);
4283
4290
  }
@@ -4560,6 +4567,14 @@ export async function runPanelOrchestrator() {
4560
4567
  ollamaBaseUrl = nb;
4561
4568
  }
4562
4569
  }
4570
+ const nc = parseOllamaContextSetting(o.num_ctx);
4571
+ if (nc !== undefined) {
4572
+ patch.numCtx = nc;
4573
+ if (nc !== ollamaNumCtx) {
4574
+ changed = true;
4575
+ ollamaNumCtx = nc;
4576
+ }
4577
+ }
4563
4578
  if (Object.keys(patch).length && changed) {
4564
4579
  setAgentSettings({ ollama: patch });
4565
4580
  ollamaChanged = true;
@@ -4569,7 +4584,7 @@ export async function runPanelOrchestrator() {
4569
4584
  if (pb?.close)
4570
4585
  void pb.close().catch(() => { });
4571
4586
  probeBackends.delete("ollama");
4572
- logger.info(`[panel-orchestrator] ollama config → model=${ollamaModel} api=${ollamaApi} host=${ollamaBaseUrl ?? "(default)"}`);
4587
+ logger.info(`[panel-orchestrator] ollama config → model=${ollamaModel} api=${ollamaApi} host=${ollamaBaseUrl ?? "(default)"} num_ctx=${ollamaNumCtx}`);
4573
4588
  }
4574
4589
  }
4575
4590
  const lccfg = event.llamacpp;