Commit Graph
405 Commits
Author SHA1 Message Date
SoftFever f4e6ed6ac9 Run the MCP sweep on GNOME Shell and fix its Linux failures (#17956)
* Run the MCP sweep on GNOME Shell and fix its Linux failures

On a GNOME machine without KWin, orca_mcp.py launch --headless and the sweep now start a private GNOME Shell, so the tests run on the GPU instead of falling back to Xvfb. Picking an item far down a long ImGui list, such as a font near the end of the Text tool's list, no longer fails as out of view, and an item only half shown is scrolled into view before it is clicked. window_set restores a minimized window under GNOME Shell on X11, and the sweep's checks no longer depend on a desktop's top bar or on the fonts installed.

* Fix the window_set note unit test failing on every platform
2026-11-28 00:55:05 +08:00
HanifKoh 6a055745ad Start the Person's Job Only After the Call's Change in the MCP Worker-Claim Test (#17952)
The test slept 60 ms before starting the worker job and expected the call to have found the worker idle by then. On a loaded runner the call's thread could start later, so the job was already running, the call was refused as busy and its reply had no status. The test now waits until the call's change has run, and the call settles until the job starts, so the order holds on any machine.
2026-11-27 22:45:08 +08:00
Ian Chua bd9f5261ab feat: allow filament slots independent of toolhead count (#17847)
* feat: make filament slots independent from extruders

* test: fix filament slot fixtures

* fix: warn when filament slots exceed tool count

* test: fix filament slot warning fixture

* fix: update preset sweep for independent filament slots

* fix: Warn about filament slots that may address the wrong tool

* fix: align MCP filament slot operations with the sidebar

* test: fix filament slot schema and preset sweep

* fix: limit object filament settings by slot count
2026-11-27 19:38:12 +08:00
HanifKoh a0663e6eb5 Hold the GIL in the Python Tests That Segfault on Main (#17941)
#17871 made the slic3rutils tests start the production PythonInterpreter, which releases the GIL once Python is up, and gave the existing Python tests ensure_python_initialized() and py::gil_scoped_acquire. Four tests that #17819 added touch Python without the GIL and segfault on every platform. Give them the same two lines; the MCP tests hold the GIL only around the import, since python_api_reference() takes it itself.
2026-11-27 17:12:17 +08:00
Kris Austin f829169077 Let slic3rutils tests pass when they all run in one process (#17871) 2026-11-26 21:01:05 -06:00
SoftFever d42123d2f1 Fix hang when MCP clicks an open printer selector (#17913)
# Description

When an MCP client clicked the printer selector on the Device or
Calibration tab while its printer list was already open, OrcaSlicer
froze at full CPU on macOS and Linux and had to be force-quit. A
person's mouse can't trigger it, because the open list takes the click
and closes before the selector sees it, but an MCP click goes straight
to the selector. That click now closes the list, as a person's click
does, and Orca's popups no longer hang on macOS and Linux when they are
asked to open while already open. The hung call's reply was misleading
as well: it said the call had not run and was safe to retry, although
its click had run. A call that has already acted now says it may have
done some or all of what was asked, and to check with `app_state` before
calling it again.

**Included:**
- **GUI:** the Device and Calibration printer selectors close their open
list on a click; `PopupWindow` ignores a second open on macOS and Linux.
- **MCP:** "not run, safe to retry" is reported only while no step of
the call has run.
- **Tests:** an automation test for the MCP reply and a slic3rutils test
for the popup.
- **Docs:** the MCP server design doc and the orca-wxwidgets skill's
popup pages.

A person's clicks behave as before on every platform, and Windows popup
behaviour is unchanged.

# Screenshots/Recordings/Graphs

<!--
> UI changes need before and after screenshots, on each platform you
tested.
> See what each kind of PR needs:
https://github.com/OrcaSlicer/OrcaSlicer/blob/main/CONTRIBUTING.md#what-each-kind-of-pr-needs
> For other changes, please attach images that can help explain them.
-->

## Tests

- Reproduced the hang on macOS over MCP with two `widget_click
{target:{class:"SideToolsPanel"}}` calls on the Device tab. With the
fix, repeated clicks open and close the list, each reply comes back in
under 100 ms, and the app stays idle and answers `app_state` afterwards.
- New tests: "a call says it was not run only until a step of it has
run" (automation) and "a popup never links its event handlers to
themselves and a second click on its control closes it" (slic3rutils).
With the popup guard disabled, the popup test fails and still runs to
the end instead of hanging.
- On this branch, macOS arm64 Release: the build passes, the automation
suite passes (186 test cases) and the slic3rutils `[Mcp]` tests pass
(508 test cases).
- Windows and Linux were not built or run; their code paths were checked
against wxWidgets' source.

<!--
> A guide for users on how to download the artifacts from this PR.
-->

[How to Download Pull Requests Artifacts for
Testing](https://www.orcaslicer.com/wiki/how_to_download_pr_artifacts)
2026-11-26 20:51:59 +08:00
SoftFever 7ae3d228b3 Fix the camera view teardown test crashing
The Web media controller teardown test crashed because running a page script read the app's
settings before checking for a page. Running a script on a web view with no page now does
nothing on every platform.
2026-11-26 03:46:50 +08:00
SoftFever 4723f694ca Merge branch 'main' into feature/mcp 2026-11-26 03:39:47 +08:00
SoftFever b3dcf0ac7d Ask before a plugin calls OrcaSlicer's tools
Any plugin could call OrcaSlicer's tools through orca.host.tools without a permission, so it could change your project, run post-processing scripts and answer permission prompts. It now needs the OrcaSlicer tools permission or full access, which it can declare as it loads or is asked for the first time it calls, like its other permissions. The Plugins dialog's Permissions tab has a switch for it, and turning it off ends what the plugin's calls left in force.
2026-11-26 02:56:29 +08:00
Ian Chua 188782518d fix: bind printer agent printers using the entered address (#17857)
- Moonraker's `bind_detect` now builds the device ID from the entered address instead of the connected printer's cached identity, so binding a second printer by IP no longer reselects and reconnects the first one.
- The C11 model fallback for a device bound without a model now applies only to Bambu printers.
2026-11-25 10:03:22 -06:00
SoftFever f047c606d9 List long widget labels whole and keep each MCP fact in one place
widget_list cut a widget's label at 120 bytes, so a long path or tooltip came back truncated, and a test that
read it back failed on a machine with a longer folder; labels now come back whole. Adding or renaming a command
or a sweep test no longer means updating hand-kept lists, copied test helpers or the same text in several docs,
and the runner's own test now fails when a sweep test has no entry in the index.
2026-11-25 19:10:57 +08:00
SoftFever e4538b5262 Name the Design commands by their place, like the other MCP tools
Thirty-four Design commands were bare verbs (extrude, fillet, measure), so an
agent could not tell from a name where a command acts or find a place's
commands together. Every Design command now starts with its place: design_,
sketch_, solid_, surface_, construct_, body_ or feature_. Replacing objects when
committing a design to the plate deletes them as Prepare's Delete does, and the
guide to making a feature reachable covers Design commands.
2026-11-25 13:38:40 +08:00
Ilia Kuzmin 58fc8a7c1f Fix AMS sync for Happy Hare printers with an unpopulated lane_data skeleton (#14798)
Happy Hare can write a lane_data entry for every gate with only the lane number set. Orca took that as the answer and showed every slot empty without asking Happy Hare's mmu object. When every lane is empty, sync now tries Happy Hare and then Creality CFS, and keeps the empty lane layout if neither reports filament. Lane data with filament in it keeps its priority.
2026-11-24 16:01:28 -06:00
Hanan V e56fd1ed44 Fix a crash deleting or merging a multi-part object on macOS (#17825)
The object list deletes an object's ModelObject before its row, and removes the
row's part rows one by one. On macOS each removal makes the outline reload the
object row at once, and GetChildren's import order read the freed ModelObject.
Deleting a multi-part object, or merging its parts with Mesh boolean, crashed
when that memory had been reused.

GetChildren now reads the row's object only while the model still holds it
(ObjectDataViewModel::live_model_object, a pointer comparison). The import order
read came in with #17050, so no release carries the crash.
2026-11-24 15:48:45 -06:00
Kris Austin 79d5833e28 Count the feature filaments a part sets as filaments the plate uses (#17778)
A part, a modifier or a layer range can set its own outer wall, inner
wall, sparse infill, internal solid infill, top surface or bottom
surface filament. The slicer prints with them, but
PartPlate::get_extruders() and get_extruders_under_cli() read these
settings only from the print and object configs. A filament that only a
part's feature used was missing from the plate's filament list, so on a
dual-nozzle printer the custom grouping dialog left it out and Prepare
hid the prime tower.

Both walks now share a helper that also reads the feature filaments of
each part, modifier and layer range. A mixed filament still expands to
its components as it does for object settings.

A printer switch or a filament delete can leave filament ids past the
last slot. The plate now resolves them as the slicer does. An object's,
part's or layer range's id counts as filament 1, including a part's own
filament. A print-wide id follows PresetBundle::full_config() in the
GUI, which resets a feature or brim id to the default and caps a
support id at the last slot. From the CLI it follows the slicer, which
prints a feature or support id with filament 1.

Fixes #17728
2026-11-24 12:25:53 -06:00
SoftFever 18eb4f8459 Organize the MCP tool code by place and the Design commands by heading
Each place an agent finds commands under (Objects, Plates, View and windows and so on) now has one source file
under Mcp/Tools/, and the Design tab's commands have one file per Design heading, so a developer finds a command
where tool_list lists it and adds a new one beside its neighbours. A unit test fails when a command is added in
another place's file. No change to what agents or people see: the command catalog is byte-identical.
2026-11-24 23:50:10 +08:00
SoftFever 3d4782e7d6 Fix the clang-tidy check failing on the Agent Activity test 2026-11-24 16:42:59 +08:00
SoftFever 5eefef82fc Add the Agent Activity pane
A new pane, opened from View > Agent Activity or the Speed Dial, lists live what an AI agent and other
automation (Action Replay, Run Script, the command line, plugins) do in OrcaSlicer while it is open: each
call with its source, what it changed, failures with their reason, the steps of a run and the dialogs a
rule answered. Opening a call shows its request and response with passwords, keys and typed text masked,
so a person can watch and check what an agent is doing to their project.
2026-11-24 16:38:50 +08:00
SoftFever a0db07311b Fix two unit tests that failed at random on CI
The plugin-unload test of the automation suite and the in-flight tool call
test of the Python script runner each failed now and then on a busy runner,
macOS arm64 and Linux aarch64 in the last run, with nothing wrong in the app.
Both pass however the runner schedules their threads.
2026-11-23 21:38:37 +08:00
SoftFever efc29fdb80 Give a polygon drawn on the axes the same constraints on every platform
A square drawn on the axes through sketch_draw was locked level on x64 but could be
left free to rotate on arm64, so its constraints and degrees of freedom depended on
the CPU, and the test of them failed on macOS arm64 and Windows arm64. A polygon's
side that lies on an axis is now pinned Horizontal or Vertical on every platform, as
the Polygon tool pins it, so such a square has all four sides pinned.
2026-11-23 20:02:09 +08:00
SoftFever 82d1f6adfa Fix the CI failures from the first build and test run of the MCP branch
The Flatpak build failed to compile the MCP bridge, clang-tidy flagged four missing
includes, and several new tests failed only on CI: plugin and script tests on Windows
runners with a non-UTF-8 code page, and two tests that raced on slower machines.
2026-11-23 19:10:16 +08:00
SoftFever df459143cc Merge branch 'main' into feature/mcp 2026-11-23 13:29:29 +08:00
SoftFever e6250eca57 Let MCP commands name objects, parts and instances by id
An agent that read an object's id in object_list could only pass it as a guard beside the index, and the index moves
whenever objects are deleted, split or reordered; an id passed as an index was refused without saying what it was.
Every command that names an object, a part or an instance now takes its index or its id, both together still a
guard, and object_list gives each instance's id too. An id given as an index is refused with what that id names, and
recorded replays keep naming targets by index, so they still run in a new session.
2026-11-23 00:06:23 +08:00
SoftFever 6122352058 Shorten the longest MCP tool descriptions
The ten largest definitions in the tool list repeated much of what their parameters already say. They now
say it once, taking about 4.9 KB off the tool list an agent reads at the start of every session, with
nothing they described left out.
2026-11-22 22:36:37 +08:00
SoftFever 3283fa0016 Mark names as code in the MCP tool descriptions
Agents can tell an argument or a reply field from an English word in every tool description. The
server instructions say what the Speed Dial is, a call held by a dialog says how to run it without
asking next time, and object_add_text and object_add_svg say what they reply.
2026-11-22 22:01:16 +08:00
SoftFever f9c0411c0c Keep MCP replies short and free of float noise
Agents now read an object's position as 60.001 rather than 60.001007080078125, and a Design
command's zero as 0 rather than 4.4e-16, without the wrapper and ok flag that said nothing; a
client that computes with the numbers can still ask for them whole. object_list gives a short row
per object unless asked for detail, so a plate of a hundred objects fits a client's reply limit,
and app_log returns 50 lines by default.
2026-11-22 21:57:47 +08:00
SoftFever 37e136acac Keep tool_describe from calling an object open when a plugin schema may close it
A plugin schema can close an object through a keyword the manual keeps raw, such as allOf. The manual
then no longer says the object, or the call, takes other keys, and leaves the attached schema to say
what it accepts.
2026-11-22 19:33:47 +08:00
SoftFever b1500e4aae Say in tool_describe's manuals which objects take keys they don't list
Every object in a manual now says whether it takes keys besides its properties, at any depth, as the top
level already did. A plugin schema whose properties can't be read now comes with the raw schema instead of
looking like one that takes no arguments.
2026-11-22 19:25:15 +08:00
SoftFever 5026ada896 Point tool_describe's manuals to more values' sources, and keep plugin rules
An agent reading a manual now learns where a filament's purge mode, a calibration's shaper type, a
hole's point, printer_install's models and dialog_answer's dialog come from, and sees that a plugin
operation can reach outside the app. What a plugin's schema says that the manual can't show, such as a
required argument with no property, now comes with the raw schema, and a schema that takes any argument
says so instead of looking like one that takes none.
2026-11-22 19:14:39 +08:00
SoftFever 7f8af3beeb Browse settings by page with settings_list_pages, and read them by key
settings_get and preferences_get matched an agent's words, so a goal such as "add a brim" found the wrong
settings. Agents now list a settings tab's pages and groups with settings_list_pages, read a page's settings
and what each does with settings_list, and read named settings with settings_get and preferences by tab
with preferences_get.
2026-11-22 18:19:51 +08:00
SoftFever 3c6752abf9 Browse the Python API a module at a time with script_list_api and script_describe_api
script_search_api ranked the API by an agent's words, so a goal phrased in other words found the wrong entries.
Agents now list what a module or class holds with script_list_api and read one entry's whole documentation
with script_describe_api.
2026-11-22 18:08:23 +08:00
SoftFever ee42f3922c List the Speed Dial's actions with action_list, in place of action_search
action_search ranked actions by matching an agent's words, so an action named differently from the request
was missed. action_list lists them by section and title for the agent to choose from, as tool_list does
for commands.
2026-11-22 18:03:47 +08:00
SoftFever b85dbded55 List the commands tools/list leaves out with tool_list, in place of tool_search
tool_search matched words, so an agent that asked for a goal such as "add a brim" or "round the edges"
got unrelated commands. Agents now read tool_list, which lists the Design tab's commands, the menu items
that take no arguments and the plugins' operations with what each does, and a call refused for its
arguments names the tool_describe call that gives that command's parameters.
2026-11-22 17:56:09 +08:00
SoftFever 56d7f9e815 Give agents a manual for any MCP command with tool_describe
An agent could read a command's arguments only as raw JSON Schema, with its conditional rules left to decode and
no word on where an object index or a face id comes from. tool_describe now gives any command's manual, listed or
not: every parameter at every depth with its allowed values, ranges and defaults, the schema's rules as sentences,
the Speed Dial items that run it with their arguments, its examples, and which tool lists a value the schema can't.
2026-11-22 17:35:15 +08:00
SoftFever d51fb9f4ed Show what each command does when tool_search lists a group
Agents listing the Design tab's commands, or any other group, got bare names and had to look each one up to
choose. tool_search {group} now gives each command's first sentence and, in Design, its heading, in the order
the description's index uses. action_search names the Speed Dial's sections section rather than group, so they
are no longer mistaken for tool_search's groups, and a wrong section is refused with the sections there are
instead of returning nothing.
2026-11-22 14:50:46 +08:00
SoftFever 7db95f5c1e Say in a word why an MCP call was refused, and how to get past it
Design commands were refused with numbers such as -32002 or with no code at all; they now say design_busy,
precondition, invalid_argument, rebuild_failed and the like, so an agent can tell a wrong argument from a design
that is not ready, on every route that takes arguments. Refusals worded for a person, such as an open gizmo or a
selected object, carry a hint naming the call that gets past them, and an index too large for the app or written
as 2.0 is no longer misread as another object, plate or instance.
2026-11-22 13:36:38 +08:00
Kris Austin 1478735b58 Give the PartPlate test the Windows headers it needs on clang-cl (#17773)
tests/slic3rutils/test_part_plate.cpp includes slic3r/GUI/PartPlate.hpp,
which reaches wx/wxprec.h and so needs the Windows headers first. Without
them clang-cl stops in wx/msw/private.h on WNDPROC, RGB, VK_SHIFT and
GetWindowRect, and the Windows arm64 build fails.

The slicer target has a precompiled header that supplies those headers and
the test target does not, and MSVC accepts the file anyway, so only the
arm64 build breaks. Windows arm64 is skipped on a pull request that has no
build-windows-arm64 label, so the test merged in #17664 without that leg
ever compiling it.

tests/slic3rutils/test_scene_raycaster.cpp is the only other test in this
target that pulls in the GUI headers, and it opens with the same prelude.
2026-11-21 13:42:02 -06:00
Alexander Vander Kelen a8a597c6d5 Fix LAN Bambu printer losing its connection when the cloud server connects (#17769)
The server-connected handler selects the agent's current machine again every time the cloud
server connects. For a LAN printer this makes the Bambu network plug-in unsubscribe the device,
which drops the LAN session that selecting the printer opened. A connect still in flight fails
with "called UnSubscribeDevice". One that already succeeded stays down with no connect result, so
the printer shows as connected while every command fails with -4 and Print fails with -4030.

Since #17086, OrcaSlicer connects the last LAN Bambu printer at startup, so a LAN user hits this
on most starts. A cloud reconnect later in a session drops the session the same way.

The selection is a cloud subscription, so a LAN printer does not need it. Move the re-select into
DeviceManager::reselect_cloud_machine(), which skips a LAN-mode printer and behaves as before for
any other machine.

Fixes #17766
2026-11-21 13:01:33 -06:00
SoftFever 15bb082ce2 Refuse misspelt Design arguments and tell agents how to fix refused calls
A misspelt argument to most Design commands was ignored, so the command ran with
its default, such as a helix built with the default pitch. Every Design command now
refuses it and names the arguments it takes. Refusals of a missing object or part,
an unknown setting key, an invalid setting value or a preset that is not installed
now say the valid range, the similar keys, what the setting takes or the command
to use, and plate_add and object_add_handy_model say what they added.
2026-11-22 01:28:26 +08:00
Arthur Porto 4a45621b57 Start a Creality print from the path the printer lists the upload at (#17633)
Upload and Print picked the start command's folder from the model that /info reports, and every
unlisted model got /mnt/UDISK. A Nebula Pad reports the printer it is fitted to, such as
"Ender-3 V2 Neo", and keeps its G-code under /usr/data, so its firmware ignored the start.

Before the start, the host now asks the printer for its G-code file list (reqGcodeFile), as
Creality Print does, and starts the upload from the path listed for it. K1-family firmware answers
retGcodeFileInfo and K2-family firmware retGcodeFileInfo2. A list without the upload is asked for
again until files_reply passes. When the printer doesn't list the upload, the model table decides
as before, and it now includes "Ender-3 V2 Neo".
2026-11-21 09:31:18 -06:00
HanifKoh 65a350a0ce Stop Print Plate Aborting When a Multi-Nozzle Printer Has No Physical Extruder Map (#17664)
A multi-nozzle printer whose profile never sets physical_extruder_map, such as the Snapmaker U1, carries the single-entry default {0}. PartPlate::get_physical_extruder_by_filament_id indexed it by logical extruder, so Print plate read past its end for any plate that used filament 2 or later, and the Flatpak aborted there.

PartPlate's lookup, the printer sync in Plater and the three calibration setups in CalibUtils now read the map through effective_physical_extruder_map. It returns the profile's map when its length matches the nozzle count and the identity otherwise, so printers that ship a full map get the same values as before. The helper moves unchanged from IMEXHelpers to PrintConfig and PresetBundle, and its tests move to test_config.cpp. The G-code paths are unchanged.
2026-11-21 09:21:15 -06:00
SoftFever 7e4b791589 Let MCP calibration tests print with any physical filament
calibration_generate_test always printed with filament slot 1, so an agent could not calibrate another filament of
the project or, on a multi-extruder printer, the nozzle that prints it. It now takes filament_slot, as the
Calibration dialogs' filament list offers, prints on the extruder the filament map gives that filament, and says in
its reply which extruder that is.
2026-11-21 20:45:39 +08:00
Ian Chua 5a1ffc6a63 fix: correct windows process audit test expectation (#17757) 2026-11-21 19:30:47 +08:00
SoftFever 867ba9b005 Merge branch 'main' into feature/mcp 2026-11-21 18:57:39 +08:00
Ian Chua 84f199cb04 fix: correct windows python audit format (#17697) 2026-11-21 17:25:55 +08:00
SoftFever 97809fe274 Let MCP path rules answer folder pickers on Linux
A dialog_auto_answer rule with a path cancelled every folder picker on Linux, such as the Preferences
download folder's Browse and the recording dialog's Change..., so a script couldn't pick a folder there and
the sweep's Preferences and Speed Dial tests failed. Folder pickers now take the path as on Windows and
macOS; file pickers still cancel on Linux.
2026-11-21 17:24:34 +08:00
HanifKoh 0d7bea5763 List and Load Resource Textures Whose Paths Pass MAX_PATH on Windows (#17730)
* Test Resource Textures Whose Paths Pass MAX_PATH

* List and Load Resource Textures Whose Paths Pass MAX_PATH on Windows
2026-11-21 05:44:04 +08:00
HanifKoh 1e1543f006 Read the CFS Lite Slots a SPARKX i7 Sends After Reporting No CFS (#17702)
A SPARKX i7 with a CFS Lite reports "cfsConnect": 0 and then answers the slot query. The query stopped at that status, so filament sync found no slots. It now keeps reading for a short no-CFS deadline and treats the printer as having no CFS only when no slots arrive.
2026-11-21 05:41:42 +08:00
HanifKoh ea4927b601 Trim Trailing Zeros at the Decimal Separator wxWidgets Wrote (#17704)
* Trim Trailing Zeros at the Decimal Separator wxWidgets Wrote

double_to_string formats with wxNumberFormatter, which writes the UI locale's decimal separator, but trimmed after the C locale's separator. When the two differ, as reported on macOS in Czech and Russian, nothing was trimmed and fields showed 0.2000. Trim at wxNumberFormatter::GetDecimalSeparator() instead.

* Parse Point Fields Whichever Decimal Separator They Show

Point fields write X and Y with the UI locale's decimal separator but read them back with ToDouble, which uses the C locale's. When the two differ, any value with decimals fails with Invalid numeric and resets. Read them with string_to_double_any_separator, which converts the other separator to the C locale's before ToDouble, so every input ToDouble accepted before still parses.
2026-11-21 05:41:23 +08:00
SoftFever 190d6848b0 Edit mixed filaments and their gradients over MCP as the sidebar does
Agents can now read the whole filament list with filament_list, change a mixed filament with filament_edit_mixed,
and set a gradient by driving the Add or Edit Mixed Filament dialog. The slot colours and the flushing settings move
from the project tools to filament_set_colour and filament_set_flushing, beside the rest of the filament list.
Deleting or merging a filament that a mix uses now behaves as it does in the sidebar, and the settings tools no
longer edit a physical filament's preset through a mixed slot.
2026-11-20 17:15:05 +08:00