Make the automation runtime its own subsystem, with MCP as one front end

Everything that drives OrcaSlicer by command (the dispatch of the command
catalog, jobs, the journal, replays, Python scripts, recordings) lived
inside the MCP server's service class. So Action Replay, the Run Script
panel, a plugin's tool call, a person's recording and a run from the
command line each had to start "the MCP service", with all of its GUI
hooks, although none of them needs a server or an agent.

The automation runtime is now a subsystem of its own. It starts the first
time a front end asks for it and knows none of them. The MCP endpoint
(HTTP, the protocol, the token, the discovery file, the takeover of a port
another window holds) is one front end beside the others, opened and
closed without stopping what the others run. The widget inspector, menu
capture and ImGui item recording are turned on only by a front end that
drives the GUI, so a person's recording or long command does not carry
them.

The part of the runtime that needs no GUI is the library
libslic3r_automation, built without wxWidgets and tested by its own suite,
automation_tests. A wx dependency in it fails to build, and its tests no
longer link the GUI library or the embedded Python.

The command line has one option set for this: --run FILE runs a replay or
a Python script once the GUI is ready, with --outputdir for its files, and
--unrestricted-scripts and --cad turn their settings on for one run
without saving them. --mcp-run, --mcp-run-out and --mcp-token are gone;
the scripts setting is python_scripts_unrestricted and a session's output
folder is <datadir>/automation/out. get_app_state reports ready and
version at the top level, and its mcp block describes the endpoint only.

No change to slicing output.
This commit is contained in:
SoftFever committed 2026-11-14 23:41:01 +08:00
1 parent b4be9d8374
commit fece418ae0
147 files changed
+7575 -5288

No files matched your search

+8 -9
View File
@@ -117,7 +117,7 @@
#include "../Utils/PrintHost.hpp"
#include "GUI_App.hpp"
#include "Mcp/McpService.hpp"
#include "Mcp/AutomationRuntime.hpp"
#include "ImGuiWrapper.hpp"
#include "OpenGLManager.hpp"
#include "Shortcuts.hpp"
@@ -1363,14 +1363,13 @@ void MainFrame::update_edge_panels()
void MainFrame::shutdown()
{
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << "MainFrame::shutdown enter";
// MCP calls must not reach panels that are about to go away. A language change rebuilds the
// frame, so the server only pauses until GUI_App::recreate_GUI() resumes it.
if (Mcp::McpService* mcp = wxGetApp().mcp_service()) {
if (wxGetApp().is_recreating_gui())
mcp->suspend();
else
wxGetApp().stop_mcp_service();
}
// Automation calls must not reach panels that are about to go away. A language change rebuilds the
// frame, so the runtime only pauses until GUI_App::recreate_GUI() resumes it, and the MCP endpoint stays open.
if (wxGetApp().is_recreating_gui()) {
if (Mcp::AutomationRuntime* runtime = wxGetApp().automation_if_started())
runtime->suspend();
} else
wxGetApp().stop_automation();
m_idle.stop();
if (ProjectPanel* project = ProjectPanel::if_built())
project->shutdown();