comfyui-mcp 0.52.201 → 0.52.202

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.
@@ -281,6 +281,39 @@ function classifyConsentReply(reply) {
281
281
  return "decline";
282
282
  return "unclear";
283
283
  }
284
+ /**
285
+ * Recover only the command this process can prove it was launched with. The
286
+ * self-restart path uses this same `execPath` + `argv.slice(1)` pair; a panel
287
+ * route's package-manager suggestion is not evidence about this process.
288
+ */
289
+ function currentOrchestratorRestartEvidence() {
290
+ const executable = process.execPath;
291
+ const argv = process.argv;
292
+ if (!executable || !Array.isArray(argv) || argv.length < 2)
293
+ return undefined;
294
+ const launchArgs = argv.slice(1);
295
+ if ([executable, ...launchArgs].some((token) => typeof token !== "string" || /[\u0000\r\n]/.test(token))) {
296
+ return undefined;
297
+ }
298
+ // Never copy a shared secret from a launch command into an MCP reply.
299
+ if (launchArgs.some((token) => token === "--token" || token.startsWith("--token="))) {
300
+ return undefined;
301
+ }
302
+ return {
303
+ command: [executable, ...launchArgs].map(quoteRestartArg).join(" "),
304
+ evidence: "current_process_argv",
305
+ };
306
+ }
307
+ /** Quote one observed argv token without inventing or dropping its boundaries. */
308
+ function quoteRestartArg(token) {
309
+ if (/^[A-Za-z0-9_./:@%+=,-]+$/.test(token))
310
+ return token;
311
+ if (process.platform === "win32") {
312
+ // CommandLineToArgvW-compatible escaping for quotes and trailing slashes.
313
+ return `"${token.replace(/(\\*)"/g, "$1$1\\\"").replace(/(\\+)$/g, "$1$1")}"`;
314
+ }
315
+ return `'${token.replace(/'/g, "'\\''")}'`;
316
+ }
284
317
  function ok(value) {
285
318
  return {
286
319
  content: [
@@ -19893,7 +19926,7 @@ export function buildPanelToolDefs() {
19893
19926
  markPanelSchemaReady(panelSchemaKey(ctx));
19894
19927
  return res;
19895
19928
  }),
19896
- def("panel_reload", "Soft-reload yourself to pick up code changes WITHOUT restarting ComfyUI — your chat session resumes automatically and you'll be nudged to continue. This ENDS the current turn. What each scope actually reloads: 'orchestrator' (default) respawns your agent and its comfyui tool server, so agent config, MCP servers (panel_add_mcp/panel_remove_mcp), the system prompt, and the code behind the comfyui server's tools all reload from the comfyui-mcp build on disk; 'frontend' re-fetches the panel UI (web JS/CSS). What it does NOT reload: the long-lived orchestrator process that serves every panel_* tool (including this one) and the services those tools use — that process keeps the code it started with, and only the user can restart it (the panel prints the exact restart command when this runs). So after editing orchestrator/panel-tool code, do NOT claim the change is live after this call — say the orchestrator process must be restarted. For custom-node or model changes that need a full ComfyUI restart, use panel_restart_comfyui instead. Only call this when code has actually changed and needs to take effect now.", {
19929
+ def("panel_reload", "Soft-reload yourself to pick up code changes WITHOUT restarting ComfyUI — your chat session resumes automatically and you'll be nudged to continue. This ENDS the current turn. What each scope actually reloads: 'orchestrator' (default) respawns your agent and its comfyui tool server, so agent config, MCP servers (panel_add_mcp/panel_remove_mcp), the system prompt, and the code behind the comfyui server's tools all reload from the comfyui-mcp build on disk; 'frontend' re-fetches the panel UI (web JS/CSS). What it does NOT reload: the long-lived orchestrator process that serves every panel_* tool (including this one) and the services those tools use — that process keeps the code it started with, and only the user can restart it. The result includes this process's exact launch command when it can be recovered, otherwise it gives launcher-specific fallback guidance. So after editing orchestrator/panel-tool code, do NOT claim the change is live after this call — say the orchestrator process must be restarted. For custom-node or model changes that need a full ComfyUI restart, use panel_restart_comfyui instead. Only call this when code has actually changed and needs to take effect now.", {
19897
19930
  scope: z
19898
19931
  .enum(["orchestrator", "frontend"])
19899
19932
  .optional()
@@ -19977,8 +20010,27 @@ export function buildPanelToolDefs() {
19977
20010
  "started with. If the change you were picking up touched " +
19978
20011
  "orchestrator/panel-tool code (e.g. a service a panel_* tool " +
19979
20012
  "imports), it is NOT in effect: tell the user the orchestrator " +
19980
- "process must be restarted (the panel shows the exact restart " +
19981
- "command).";
20013
+ "process must be restarted. ";
20014
+ const restart = currentOrchestratorRestartEvidence();
20015
+ if (restart) {
20016
+ text.text +=
20017
+ "The exact restart command observed from this process's launch " +
20018
+ `argv is: ${restart.command}.`;
20019
+ res.structuredContent = {
20020
+ ...(res.structuredContent ?? {}),
20021
+ manual_restart: {
20022
+ command: restart.command,
20023
+ evidence: restart.evidence,
20024
+ },
20025
+ };
20026
+ }
20027
+ else {
20028
+ text.text +=
20029
+ "The exact restart command could not be recovered from this " +
20030
+ "process's launch argv. Stop and restart the terminal or launcher " +
20031
+ "that owns this orchestrator using its existing command; do not " +
20032
+ "substitute a package-manager command.";
20033
+ }
19982
20034
  }
19983
20035
  }
19984
20036
  return res;