panel_connect auto_match + slot-diagnostic errors; visualize_workflow (action:"from_dsl") wiring warnings
Status: implemented (this PR) · Implementation branch: spec/panel-connect-auto-match · Pairs with: comfyui-mcp-panel PR #76 (docs/design/connect-auto-match.md — the resolver + diagnostics)
Prior art: filliptm/ComfyUI_FL-MCPfl_api.jsconnect resolver. Matching rules, ambiguity guard, and diagnostic format are specified in the paired panel RFC; this doc covers the orchestrator tool surface and an optional server-side sibling: advisory wiring warnings invisualize_workflow (action:"from_dsl").
Part 1: panel_connect schema update (backward compatible)
src/orchestrator/panel-tools.ts (~line 584) — params stay identical except:
-
from_output/to_input.describe()updated: “…omit to auto-match by type (prefers an unconnected, exact-type input;*wildcards match last)”. -
New optional param:
forwarded in the
ctx.call({ cmd: "graph_connect", ... })frame. - Tool description gains: “If both slot args are omitted the panel picks the first type-compatible pairing. On failure the error lists every slot with its type and [connected] flag.”
auto_matched / replaced_link — passes through as text). docs/panel.mdx row updated.
Part 2 (optional commit): advisory wiring warnings in visualize_workflow (action:"from_dsl")
dslToWorkflow (src/services/workflow-dsl.ts:59) is a pure parser and stays pure. Instead, in the tool handler (src/tools/workflow-dsl.ts:25), after parsing and only when ComfyUI is reachable:
- Fetch
getObjectInfo()(already imported by panel-tools; from../comfyui/client.js). - For every
[srcId, idx]connection, compareobject_info[srcClass].output[idx]against the declared input type; append awarnings: []array to the tool result:unknown class_type "X",output index 2 out of range for CheckpointLoaderSimple (3 outputs: MODEL, CLIP, VAE),type mismatch: 4.1 (CLIP) → 3.model (MODEL).
- Never fail the conversion — offline ComfyUI ⇒ no warnings, identical output otherwise.
Shared rule set: src/services/slot-compat.ts
~40 lines implementing the same compatibility rules as the panel (exact match; * wildcard compatible-but-lowest-rank; COMBO array types identical-only; comma multi-types match any segment), so server warnings and panel behavior state one rule set. The panel keeps its own JS copy (the live-served bundle can’t import TS) — both sides carry a cross-referencing comment.
Gating
panel_connect is a panel-write; DSL warnings are read-only advisory output — ungated. There is no runtime gating in this PR: safety gates were closed as won’t-do (issue #168; spec PR #172 closed, design archived under ROADMAP Theme G).
Test plan
- Vitest for
slot-compat.ts: wildcard, COMBO arrays, comma lists, rank ordering. - Vitest for DSL warnings against a canned
object_infofixture (no live ComfyUI): mismatch, out-of-range, unknown class, offline ⇒ no warnings. - Panel behavior (auto-match, ambiguity guard, diagnostics) is covered by the paired repo’s Playwright suite.
Rollout / compat
- Panel PR ships first. Old panel + new orchestrator: the unknown
auto_matchkey is ignored by the old executor → exact legacy behavior, no error. - Changelog callout (both repos): with a new panel, an omitted slot auto-matches by type instead of meaning index 0;
auto_match:falserestores legacy semantics. - DSL
warningsis an additive field on an experimental tool — no compat risk.