panel_auto_layout β one-shot canvas auto-arrange
Status: implemented (this PR) Β· Implementation branch: spec/panel-auto-layout Β· Pairs with: comfyui-mcp-panel PR #75 (docs/design/auto-layout-engine.md β the engine + graph_auto_layout bridge command)
Prior art: filliptm/ComfyUI_FL-MCP modify_layout. The engine, algorithm, and improvements over FL-MCP (groups, reroutes, barycenter, overlap resolution) are specified in the paired panel RFC; this doc covers only the orchestrator tool surface.
Motivation
Agents can make targeted layout adjustments withpanel_edit_node; auto-layout avoids dozens of individual round-trips. The panel gains a graph_auto_layout bridge command (see paired RFC); this tool exposes it to the agent.
Tool API
Added tobuildPanelToolDefs() in src/orchestrator/panel-tools.ts β both transports (Claude in-process SDK server + Codex HTTP MCP) pick it up automatically:
align/anchor; those stay panel-side defaults for now (not exposed to the agent until needed β the frame contract already carries them for a later tool rev or panel UI use).
Result/error shapes are defined by the paired RFC ({applied, columns, moved[], groups[], skipped[]}; agent-readable error strings). The result JSON is passed through as text like every other panel_* tool.
Gating
Ships ungated, exactly like the other mutating panel tools today (panel_edit_node, panel_add_node, β¦). Safety gates were closed as wonβt-do (issue #168; spec PR #172 closed, design archived under ROADMAP Theme G).
Implementation plan
src/orchestrator/panel-tools.tsβ the def above (15 s timeout: layout is O(n) but big graphs + redraw need headroom).docs/panel.mdxβ add the tool row (the only doc enumeratingpanel_*tools).- No
ui-bridge.tschanges β the bridge is command-agnostic (ctx.callforwards any{cmd, ...}frame with rid correlation).
Test plan
No runtime logic beyond the def: extend the existing panel-tools def-shape coverage (or snapshotbuildPanelToolDefs().map(d => d.name)). Behavior is covered by the paired repoβs unit + Playwright suites.
Rollout / compat
Panel PR ships first. New orchestrator + old panel: the tool errors withUnknown command "graph_auto_layout" β agent-readable; the description must not promise availability. Changelog note in both repos.