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

+18 -20
View File
@@ -13153,38 +13153,36 @@ CLIMiscConfigDef::CLIMiscConfigDef()
def = this->add("mcp_port", coInt);
def->label = L("MCP server port");
def->tooltip = L("Port of the MCP server. Defaults to the preference, or 13619.");
def->tooltip = L("Start the MCP server for this run on this port, as --mcp does. 0 takes the port from the preference, or 13619.");
def->cli_params = "port";
def->min = 0;
def->max = 65535;
def->set_default_value(new ConfigOptionInt(0));
def = this->add("mcp_token", coString);
def->label = L("MCP server token");
def->tooltip = L("Bearer token the MCP server requires for this run. The ORCA_MCP_TOKEN environment variable takes precedence and does not show up in the process list.");
def->cli_params = "token";
def->set_default_value(new ConfigOptionString());
def = this->add("mcp_run", coString);
def->label = L("Run a replay or script");
def->tooltip = L("Run a replay (.json) or a Python script (.py) once the GUI is ready, then exit: 0 when it passed or finished, 1 when a step failed or the script did not finish, 2 when the file is invalid or cannot be read.");
def->cli_params = "file";
def->set_default_value(new ConfigOptionString());
def = this->add("mcp_run_out", coString);
def->label = L("Replay output directory");
def->tooltip = L("Where --mcp-run writes a replay's result.json and screenshots. Defaults to <replay name>.out next to the replay.");
def->cli_params = "dir";
def->set_default_value(new ConfigOptionString());
def = this->add("mcp_stdio", coBool);
def->label = L("MCP stdio bridge");
def->tooltip = L("Act as an MCP server on standard input and output for clients that cannot use HTTP, forwarding to the running OrcaSlicer (started with --mcp when none answers).");
def->set_default_value(new ConfigOptionBool(false));
def = this->add("run", coString);
def->label = L("Run a replay or script");
def->tooltip = L("Run a replay (.json) or a Python script (.py) once the GUI is ready, then exit: 0 when it passed or finished, 1 when a step failed or the script did not finish, 2 when the file is invalid or cannot be read.");
def->cli_params = "file";
def->set_default_value(new ConfigOptionString());
def = this->add("unrestricted_scripts", coBool);
def->label = L("Unrestricted Python scripts");
def->tooltip = L("Let Python scripts bypass the permission checks for this run, whatever the preference says.");
def->set_default_value(new ConfigOptionBool(false));
def = this->add("cad", coBool);
def->label = L("Design tab");
def->tooltip = L("Show the Design tab and offer its commands for this run, whatever the CAD feature preference says.");
def->set_default_value(new ConfigOptionBool(false));
def = this->add("outputdir", coString);
def->label = L("Output directory");
def->tooltip = L("This is the output directory for exported files.");
def->tooltip = L("This is the output directory for exported files. With --run, it is where the run's files go: a replay's result.json and screenshots, and the files saved without a path.");
def->cli_params = "dir";
def->set_default_value(new ConfigOptionString());