diff --git a/docs/HLSD/mcp-server.md b/docs/HLSD/mcp-server.md index dd96565293..1a203eca3a 100644 --- a/docs/HLSD/mcp-server.md +++ b/docs/HLSD/mcp-server.md @@ -3560,7 +3560,7 @@ thread's progress and error events go to, so the row exists before any of them i ## Replays and the journal ```jsonc -{ "orca_replay": 1, "name": "repro #12345", +{ "orca_replay_version": "0.1.0", "name": "repro #12345", "vars": {"model": "${replay_dir}/part.stl"}, "steps": [ {"tool": "open_files", "args": {"paths": ["${vars.model}"]}}, @@ -3572,6 +3572,13 @@ thread's progress and error events go to, so the row exists before any of them i ]} ``` +`orca_replay_version` is the semver of the replay format (`REPLAY_VERSION` in `McpReplay.hpp`), which +an exported replay is stamped with. A minor version adds tools or fields, so a build reads replays of +its own major version up to its own minor version; a major version renames or removes them. While the +major version is 0 any change may break a replay, so a build reads only its own minor version. A +replay a build can't read is refused before any step runs, saying whether it needs a newer +OrcaSlicer. + A replay is JSON with comments allowed. `run_replay` runs a file or an inline replay as a job whose steps call tools as its children (`ToolContext::call_child()`), so steps are not journaled and a replay's `wait {for: "idle"}` doesn't wait for the replay. An inline replay is the replay object or diff --git a/resources/web/dialog/ActionReplay/action_replay.js b/resources/web/dialog/ActionReplay/action_replay.js index 792bc79b6c..a8ea284c02 100644 --- a/resources/web/dialog/ActionReplay/action_replay.js +++ b/resources/web/dialog/ActionReplay/action_replay.js @@ -79,7 +79,7 @@ function draftReplay() { "// " + T("draft_out_dir", "%s is this run's output folder.", "${out_dir}"), "// " + T("draft_keys", "%s shows suggestions, %s replays the file.", T("key_suggest", "Ctrl+Space"), T("key_run", "Ctrl+Enter")), "{", - ' "orca_replay": 1,', + ' "orca_replay_version": ' + JSON.stringify(REPLAY_VERSION) + ",", ' "name": ' + JSON.stringify(T("untitled_replay", "Untitled replay")) + ",", ' "steps": [', ' {"tool": "wait", "args": {"for": "ready"}},', diff --git a/resources/web/dialog/ActionReplay/replay_editor.js b/resources/web/dialog/ActionReplay/replay_editor.js index 810e39b9b8..138012108e 100644 --- a/resources/web/dialog/ActionReplay/replay_editor.js +++ b/resources/web/dialog/ActionReplay/replay_editor.js @@ -2,11 +2,15 @@ // names, a tool's args and their allowed values, and ${…} placeholders, with what accepting one and Return write. The // editor is Ace, set up by ../js/code_editor.js; the pure functions here are also loaded by replay_editor.test.js. +// The replay format version the draft and the version key's suggestion write: the host's REPLAY_VERSION +// (src/slic3r/GUI/Mcp/McpReplay.hpp), which says which versions it reads. +const REPLAY_VERSION = "0.1.0"; + // The keys of a replay and of a step, with the JSON type of their values. Accepting a key writes a // value of that type after its colon (an empty string, object or array with the caret inside, or true), // or the item's own `then`; for a number the caret waits after the colon. const ROOT_KEYS = [ - { label: "orca_replay", detail: "integer", then: "1" }, + { label: "orca_replay_version", detail: "string", then: JSON.stringify(REPLAY_VERSION) }, { label: "name", detail: "string" }, { label: "vars", detail: "object" }, { label: "steps", detail: "array" }, diff --git a/resources/web/dialog/ActionReplay/replay_editor.test.js b/resources/web/dialog/ActionReplay/replay_editor.test.js index 2f5498a593..8f1bfcd1d1 100644 --- a/resources/web/dialog/ActionReplay/replay_editor.test.js +++ b/resources/web/dialog/ActionReplay/replay_editor.test.js @@ -18,7 +18,7 @@ test("a replay's root keys are suggested in a key's string", () => { assert.equal(found.kind, "key"); assert.equal(found.from, 5); assert.equal(found.to, 5); - assert.deepEqual(labels(found), ["orca_replay", "name", "vars", "steps"]); + assert.deepEqual(labels(found), ["orca_replay_version", "name", "vars", "steps"]); }); test("a step's keys are suggested inside steps[], leaving out the ones it has", () => { @@ -79,9 +79,9 @@ test("an accepted key gets its colon and an empty value with the caret inside", // A string's value opens the suggestions again inside its quotes. const name = found.items.find((item) => item.label === "name"); assert.deepEqual(editor.acceptEdit(text, found, name), { from: 2, to: 2, insert: 'name": ""', back: 1, reopen: true }); - // A number waits after the colon. - const version = found.items.find((item) => item.label === "orca_replay"); - assert.deepEqual(editor.acceptEdit(text, found, version), { from: 2, to: 2, insert: 'orca_replay": 1', back: 0, reopen: false }); + // The format version is written whole, with the caret after it. + const version = found.items.find((item) => item.label === "orca_replay_version"); + assert.deepEqual(editor.acceptEdit(text, found, version), { from: 2, to: 2, insert: 'orca_replay_version": "0.1.0"', back: 0, reopen: false }); }); test("a key accepted before an existing colon replaces only the key", () => { diff --git a/src/slic3r/GUI/ActionReplayDialog.hpp b/src/slic3r/GUI/ActionReplayDialog.hpp index af6a5d45ab..b702c96617 100644 --- a/src/slic3r/GUI/ActionReplayDialog.hpp +++ b/src/slic3r/GUI/ActionReplayDialog.hpp @@ -38,7 +38,7 @@ struct ReplayContext; // call that is one of its tiles (`what`'s `tile`) as that tile. std::pair replay_what_text(const nlohmann::json& what, const CommandCatalog& catalog); -// The Action Replay window: a person opens or writes a replay file (an orca_replay, the JSON list of tool calls an +// The Action Replay window: a person opens or writes a replay file (the JSON list of tool calls an // agent session exports), saves it, reads its steps and replays it, whole or one step at a time, watching each step's // outcome. The page (resources/web/dialog/ActionReplay) shows; this host parses, describes, words and runs, through the // automation runtime's replay runner without opening the MCP endpoint. A Python script opened or dropped here is diff --git a/src/slic3r/GUI/Mcp/McpJournal.cpp b/src/slic3r/GUI/Mcp/McpJournal.cpp index 0624b7f490..b9449575cd 100644 --- a/src/slic3r/GUI/Mcp/McpJournal.cpp +++ b/src/slic3r/GUI/Mcp/McpJournal.cpp @@ -1,5 +1,6 @@ #include "McpJournal.hpp" #include "McpPaths.hpp" +#include "McpReplay.hpp" #include "slic3r/GUI/ActionIds.hpp" #include "slic3r/GUI/CommandCatalog.hpp" @@ -256,7 +257,7 @@ nlohmann::json Journal::to_replay(const std::string& name, nlohmann::json* left_ steps.push_back({{"tool", "wait"}, {"args", {{"for", "dialog"}, {"timeout_s", 50}}}, {"expect", {{"/satisfied", {{"eq", true}}}}}}); steps.push_back(std::move(step)); } - return {{"orca_replay", 1}, {"name", name}, {"steps", std::move(steps)}}; + return {{"orca_replay_version", REPLAY_VERSION}, {"name", name}, {"steps", std::move(steps)}}; } }}} // namespace Slic3r::GUI::Mcp diff --git a/src/slic3r/GUI/Mcp/McpJournal.hpp b/src/slic3r/GUI/Mcp/McpJournal.hpp index 8af577d002..df3eaf4dd9 100644 --- a/src/slic3r/GUI/Mcp/McpJournal.hpp +++ b/src/slic3r/GUI/Mcp/McpJournal.hpp @@ -51,7 +51,7 @@ public: void job_ended(uint64_t seq, const ToolResult& result); void clear(); - // {"orca_replay":1, "name":..., "steps":[...]} with job names substituted and screenshot paths + // {"orca_replay_version": REPLAY_VERSION, "name":..., "steps":[...]} with job names substituted and screenshot paths // rewritten to ${out_dir}/. The calls left out because their outcome is still open go // to `left_out_running` as [{tool, job}] (no job for a call that is not one). nlohmann::json to_replay(const std::string& name, nlohmann::json* left_out_running = nullptr) const; diff --git a/src/slic3r/GUI/Mcp/McpReplay.cpp b/src/slic3r/GUI/Mcp/McpReplay.cpp index 1921c108c3..3c6d1005a8 100644 --- a/src/slic3r/GUI/Mcp/McpReplay.cpp +++ b/src/slic3r/GUI/Mcp/McpReplay.cpp @@ -2,6 +2,10 @@ #include "McpPaths.hpp" #include "slic3r/GUI/CommandTypes.hpp" +#include "libslic3r/Semver.hpp" + +#include + #include #include #include @@ -19,6 +23,23 @@ using nlohmann::json; namespace { +// Why this build can't read a replay whose "orca_replay_version" is `field`, or nullopt when it can, by the rule +// REPLAY_VERSION describes. +std::optional version_error(const json& field) +{ + boost::optional theirs; + if (field.is_string()) + theirs = Semver::parse(field.get()); + if (!theirs) + return std::string("\"orca_replay_version\" must be a version such as \"") + REPLAY_VERSION + "\""; + static const Semver ours(REPLAY_VERSION); + if (theirs->maj() == ours.maj() && (ours.maj() == 0 ? theirs->min() == ours.min() : theirs->min() <= ours.min())) + return std::nullopt; + return "the replay is format " + field.get() + + (*theirs > ours ? ", written for a newer OrcaSlicer" : ", which this OrcaSlicer no longer reads") + + "; this one reads format " + REPLAY_VERSION; +} + bool is_job_envelope(const ToolResult& r) { if (r.is_error || !r.data.is_object() || !r.data.contains("job") || !r.data.contains("status")) @@ -211,8 +232,12 @@ std::optional parse_replay(const std::string& text, std::string& err) err = "the replay is not valid JSON: " + text_position(text, e.byte) + ": " + (sep == std::string::npos ? what : what.substr(sep + 2)); return std::nullopt; } - if (!doc.is_object() || !doc.contains("orca_replay") || doc["orca_replay"] != 1) { - err = "the replay must be an object with \"orca_replay\": 1"; + if (!doc.is_object() || !doc.contains("orca_replay_version")) { + err = std::string("the replay must be an object with \"orca_replay_version\": \"") + REPLAY_VERSION + "\""; + return std::nullopt; + } + if (auto bad = version_error(doc["orca_replay_version"])) { + err = std::move(*bad); return std::nullopt; } if (!doc.contains("steps") || !doc["steps"].is_array()) { diff --git a/src/slic3r/GUI/Mcp/McpReplay.hpp b/src/slic3r/GUI/Mcp/McpReplay.hpp index c3dae66887..a4a62c5f6a 100644 --- a/src/slic3r/GUI/Mcp/McpReplay.hpp +++ b/src/slic3r/GUI/Mcp/McpReplay.hpp @@ -40,6 +40,12 @@ struct ReplayContext nlohmann::json jobs = nlohmann::json::object(); // save_as name -> job id }; +// The version of the replay format this build writes, the semver string a replay gives as "orca_replay_version". +// A replay is read when it has this major version and a minor version no newer than this one; while the major +// version is 0, every minor version may break, so only this minor version is read. The editor's draft and key +// suggestions write the same version (REPLAY_VERSION in resources/web/dialog/ActionReplay/replay_editor.js). +inline constexpr const char* REPLAY_VERSION = "0.1.0"; + // Parses a replay (JSON with // and /* */ comments). nullopt with `err` set when invalid. std::optional parse_replay(const std::string& text, std::string& err); diff --git a/src/slic3r/GUI/Mcp/McpToolsReplay.cpp b/src/slic3r/GUI/Mcp/McpToolsReplay.cpp index 5ab5a6b94f..bf654f0508 100644 --- a/src/slic3r/GUI/Mcp/McpToolsReplay.cpp +++ b/src/slic3r/GUI/Mcp/McpToolsReplay.cpp @@ -112,7 +112,8 @@ void register_replay_tools(CommandCatalog& catalog) { NativeCommand run = mutate_tool( "core", "run_replay", L("Run a replay"), - "Replay a list of tool calls in order and report each step: {orca_replay:1, name, vars, steps:[{tool, args, expect, " + std::string("Replay a list of tool calls in order and report each step: {orca_replay_version:\"") + REPLAY_VERSION + + "\", name, vars, steps:[{tool, args, expect, " "optional, await, save_as, timeout_s}]}, JSON with comments. Strings may use ${replay_dir}, ${out_dir}, ${env:NAME}, " "${vars.NAME} and ${jobs.NAME}. A step that returns a job is awaited unless await:false, which stores the job under " "save_as so later steps can answer the dialog it opened. expect maps a JSON pointer into the step's result to " diff --git a/src/slic3r/GUI/NativeCommands.cpp b/src/slic3r/GUI/NativeCommands.cpp index 46f9b2dbd0..c65877695c 100644 --- a/src/slic3r/GUI/NativeCommands.cpp +++ b/src/slic3r/GUI/NativeCommands.cpp @@ -616,7 +616,7 @@ void describe_commands(std::vector& commands) "features, bodies and generation; entities in a sketch."}, {"redo", "Put back what undo took back, until the next change, as Edit > Redo does, in the history undo takes. Reply " "as undo's."}, - {"open_action_replay", "Open the Action Replay window, where a person opens a replay file (an orca_replay), reads its steps " + {"open_action_replay", "Open the Action Replay window, where a person opens a replay file, reads its steps " "and replays them. Agents run replays with the run_replay tool instead."}, {"toggle_run_script_panel", "Show or hide the Run Script panel, where a person writes and runs Python scripts cell by cell. " "Agents run Python with the run_script tool instead."}, diff --git a/src/slic3r/plugin/host/PluginHostTools.cpp b/src/slic3r/plugin/host/PluginHostTools.cpp index 6f11d37f1c..610d8d78e3 100644 --- a/src/slic3r/plugin/host/PluginHostTools.cpp +++ b/src/slic3r/plugin/host/PluginHostTools.cpp @@ -3,6 +3,7 @@ #include "PluginHostBindings.hpp" #include +#include #include #include #include @@ -162,6 +163,12 @@ void register_tools(py::module_& host) "hold the result's data. A person's or an agent's script calls tools from its own code and from the threads and " "pool tasks it starts, while its run lasts, but not from its window callbacks; a plugin calls from a " "Script worker, never the UI thread."); + // Static, as pybind keeps a docstring by its pointer; it names the format version this build reads. + static const std::string run_replay_doc = + std::string("Run a replay ({\"orca_replay_version\": \"") + GUI::Mcp::REPLAY_VERSION + + "\", \"steps\": [...]}) as the run_replay tool does, and return its result. " + "`replay` is the replay as a dict or as its JSON text, which may hold comments as a replay file does; " + "`vars` override the replay's vars. For a replay file, call(\"run_replay\", {\"path\": ...})."; tools.def( "run_replay", [tools](const py::object& replay, const py::object& vars) mutable { @@ -172,9 +179,7 @@ void register_tools(py::module_& host) return json_to_py(call_tool(tools, "run_replay", args)); }, py::arg("replay"), py::arg("vars") = py::none(), - "Run a replay ({orca_replay: 1, steps: [...]}) as the run_replay tool does, and return its result. " - "`replay` is the replay as a dict or as its JSON text, which may hold comments as a replay file does; " - "`vars` override the replay's vars. For a replay file, call(\"run_replay\", {\"path\": ...})."); + run_replay_doc.c_str()); // Both only read the catalog, which is sealed and read on any thread, so neither needs a run or a plugin. They read // it without the GIL, as call() waits without it; no thread holds the plugin operations' lock while it waits for the GIL. tools.def( diff --git a/tests/automation/test_mcp_replay.cpp b/tests/automation/test_mcp_replay.cpp index f99ccae91c..e0589b1e41 100644 --- a/tests/automation/test_mcp_replay.cpp +++ b/tests/automation/test_mcp_replay.cpp @@ -71,7 +71,7 @@ TEST_CASE("replays allow comments and read their fields", "[Mcp]") { const Replay s = parse_ok(R"({ // a comment - "orca_replay": 1, "name": "repro", /* block */ "vars": {"n": 3}, + "orca_replay_version": "0.1.0", "name": "repro", /* block */ "vars": {"n": 3}, "steps": [{"tool": "slice", "expect": {"/ok": {"eq": true}}, "optional": true, "timeout_s": 5}, {"tool": "run_action", "await": false, "save_as": "prefs"}] })"); @@ -87,21 +87,40 @@ TEST_CASE("invalid replays are rejected with a reason", "[Mcp]") { const auto [text, reason] = GENERATE(table({ {"{", "not valid JSON"}, - {R"({"steps": []})", "orca_replay"}, - {R"({"orca_replay": 2, "steps": []})", "orca_replay"}, - {R"({"orca_replay": 1})", "steps"}, - {R"({"orca_replay": 1, "steps": [{"args": {}}]})", "step 1"}, - {R"({"orca_replay": 1, "steps": [{"tool": "x", "await": false}]})", "save_as"}, - {R"({"orca_replay": 1, "steps": [{"tool": "x", "args": []}]})", "args"}, + {R"({"steps": []})", "orca_replay_version"}, + {R"({"orca_replay_version": "0.1.0"})", "steps"}, + {R"({"orca_replay_version": "0.1.0", "steps": [{"args": {}}]})", "step 1"}, + {R"({"orca_replay_version": "0.1.0", "steps": [{"tool": "x", "await": false}]})", "save_as"}, + {R"({"orca_replay_version": "0.1.0", "steps": [{"tool": "x", "args": []}]})", "args"}, })); std::string err; CHECK_FALSE(parse_replay(text, err).has_value()); CHECK(err.find(reason) != std::string::npos); } +TEST_CASE("a replay is read only in a format version this build reads", "[Mcp]") +{ + // This build reads format 0.1.0 (REPLAY_VERSION): while the major version is 0, only its own minor version. + const auto [version, reason] = GENERATE(table({ + {"0.1.0", ""}, + {"0.1.7", ""}, + {"0.1.0-beta", ""}, + {"0.2.0", "written for a newer OrcaSlicer"}, + {"1.0.0", "written for a newer OrcaSlicer"}, + {"0.0.9", "no longer reads"}, + {"v0.1.0", "must be a version"}, + {"0.x.0", "must be a version"}, + })); + CAPTURE(version); + std::string err; + const auto replay = parse_replay(R"({"orca_replay_version": ")" + version + R"(", "steps": []})", err); + CHECK(replay.has_value() == reason.empty()); + CHECK(err.find(reason) != std::string::npos); +} + TEST_CASE("vars, env and jobs substitute recursively", "[Mcp]") { - const Replay s = parse_ok(R"({"orca_replay": 1, "vars": {"model": "${replay_dir}/part.stl", "count": 3}, "steps": []})"); + const Replay s = parse_ok(R"({"orca_replay_version": "0.1.0", "vars": {"model": "${replay_dir}/part.stl", "count": 3}, "steps": []})"); ReplayContext ctx; ctx.replay_dir = "/replays"; ctx.out_dir = "/out"; @@ -160,7 +179,7 @@ TEST_CASE("a job-returning step is awaited before its expect is checked", "[Mcp] FakeHost f; f.tools["slice"] = [](const json&) { return ToolResult::ok({{"status", "running"}, {"job", "j3"}}); }; f.job_results["j3"] = ToolResult::ok({{"plates", {{{"outcome", "ok"}}}}}); - const Replay s = parse_ok(R"({"orca_replay": 1, "steps": [{"tool": "slice", "expect": {"/plates/0/outcome": {"eq": "ok"}}}]})"); + const Replay s = parse_ok(R"({"orca_replay_version": "0.1.0", "steps": [{"tool": "slice", "expect": {"/plates/0/outcome": {"eq": "ok"}}}]})"); ReplayContext ctx; const json out = run_replay(s, ctx, f.host()); CHECK(out["passed"] == true); @@ -173,7 +192,7 @@ TEST_CASE("await false stores the job under save_as for later steps", "[Mcp]") f.tools["run_action"] = [](const json&) { return ToolResult::ok({{"status", "blocked_by_dialog"}, {"job", "j5"}}); }; f.tools["answer_dialog"] = [](const json&) { return ToolResult::ok(); }; f.tools["wait"] = [](const json& a) { return ToolResult::ok({{"job", a["job"]}}); }; - const Replay s = parse_ok(R"({"orca_replay": 1, "steps": [ + const Replay s = parse_ok(R"({"orca_replay_version": "0.1.0", "steps": [ {"tool": "run_action", "await": false, "save_as": "prefs"}, {"tool": "answer_dialog", "args": {"button": "close"}}, {"tool": "wait", "args": {"for": "job", "job": "${jobs.prefs}"}, "expect": {"/job": {"eq": "j5"}}}]})"); @@ -189,7 +208,7 @@ TEST_CASE("a run stops at the first failed step unless it is optional", "[Mcp]") FakeHost f; f.tools["ok"] = [](const json&) { return ToolResult::ok({{"v", 1}}); }; f.tools["fail"] = [](const json&) { return ToolResult::error("nope"); }; - const Replay s = parse_ok(R"({"orca_replay": 1, "steps": [ + const Replay s = parse_ok(R"({"orca_replay_version": "0.1.0", "steps": [ {"tool": "fail", "optional": true}, {"tool": "ok", "expect": {"/v": {"eq": 2}}}, {"tool": "ok"}]})"); ReplayContext ctx; const json out = run_replay(s, ctx, f.host()); @@ -205,7 +224,7 @@ TEST_CASE("a run reports each step as it starts and ends", "[Mcp]") FakeHost f; f.tools["a"] = [](const json&) { return ToolResult::ok(); }; f.tools["b"] = [](const json&) { return ToolResult::ok(); }; - const Replay s = parse_ok(R"({"orca_replay": 1, "steps": [{"tool": "a"}, {"tool": "b"}]})"); + const Replay s = parse_ok(R"({"orca_replay_version": "0.1.0", "steps": [{"tool": "a"}, {"tool": "b"}]})"); std::vector events; ReplayHost h = f.host(); h.step_started = [&](std::size_t index) { events.push_back("started " + std::to_string(index)); }; @@ -224,7 +243,7 @@ TEST_CASE("only_step runs one step and reports its own index", "[Mcp]") FakeHost f; for (const char* name : {"a", "b", "c"}) f.tools[name] = [](const json&) { return ToolResult::ok(); }; - const Replay s = parse_ok(R"({"orca_replay": 1, "steps": [{"tool": "a"}, {"tool": "b"}, {"tool": "c"}]})"); + const Replay s = parse_ok(R"({"orca_replay_version": "0.1.0", "steps": [{"tool": "a"}, {"tool": "b"}, {"tool": "c"}]})"); ReplayContext ctx; const json out = run_replay(s, ctx, f.host(), 2); REQUIRE(f.calls.size() == 1); @@ -240,7 +259,7 @@ TEST_CASE("jobs saved by an earlier run resolve in a later single step", "[Mcp]" FakeHost f; f.tools["x"] = [](const json&) { return ToolResult::ok({{"status", "running"}, {"job", "j7"}}); }; f.tools["wait"] = [](const json& a) { return ToolResult::ok({{"job", a["job"]}}); }; - const Replay s = parse_ok(R"({"orca_replay": 1, "steps": [ + const Replay s = parse_ok(R"({"orca_replay_version": "0.1.0", "steps": [ {"tool": "x", "await": false, "save_as": "prefs"}, {"tool": "wait", "args": {"job": "${jobs.prefs}"}}, {"tool": "wait", "args": {"job": "${jobs.none}"}}]})"); @@ -263,8 +282,8 @@ TEST_CASE("jobs saved by an earlier run resolve in a later single step", "[Mcp]" TEST_CASE("a stop during a step marks that step, even the last one", "[Mcp]") { - const std::string text = GENERATE(as{}, R"({"orca_replay": 1, "steps": [{"tool": "stopper"}]})", - R"({"orca_replay": 1, "steps": [{"tool": "stopper", "optional": true}]})"); + const std::string text = GENERATE(as{}, R"({"orca_replay_version": "0.1.0", "steps": [{"tool": "stopper"}]})", + R"({"orca_replay_version": "0.1.0", "steps": [{"tool": "stopper", "optional": true}]})"); const bool single = GENERATE(false, true); FakeHost f; f.tools["stopper"] = [&f](const json&) { @@ -290,7 +309,7 @@ TEST_CASE("a stop during a job wait is a cancel, not a timeout", "[Mcp]") { FakeHost f; f.tools["slow"] = [](const json&) { return ToolResult::ok({{"status", "running"}, {"job", "j1"}}); }; - const Replay s = parse_ok(R"({"orca_replay": 1, "steps": [{"tool": "slow"}]})"); + const Replay s = parse_ok(R"({"orca_replay_version": "0.1.0", "steps": [{"tool": "slow"}]})"); ReplayHost stopping = f.host(); stopping.wait_job = [&f](const std::string&, int) -> std::optional { @@ -312,7 +331,7 @@ TEST_CASE("a job wait that times out names the dialog left open", "[Mcp]") { FakeHost f; f.tools["opens"] = [](const json&) { return ToolResult::ok({{"status", "blocked_by_dialog"}, {"job", "j1"}}); }; - const Replay s = parse_ok(R"({"orca_replay": 1, "steps": [{"tool": "opens"}]})"); + const Replay s = parse_ok(R"({"orca_replay_version": "0.1.0", "steps": [{"tool": "opens"}]})"); const json dialogs = json::array({{{"title", "Uniform scale"}, {"native", false}}, {{"title", "Preferences"}, {"native", false}}}); ReplayHost host = f.host(); @@ -332,7 +351,7 @@ TEST_CASE("a failed expectation carries its parts", "[Mcp]") { FakeHost f; f.tools["slice"] = [](const json&) { return ToolResult::ok({{"plates", {{{"outcome", "error"}}}}}); }; - const Replay s = parse_ok(R"({"orca_replay": 1, "steps": [{"tool": "slice", "expect": {"/plates/0/outcome": {"eq": "ok"}}}]})"); + const Replay s = parse_ok(R"({"orca_replay_version": "0.1.0", "steps": [{"tool": "slice", "expect": {"/plates/0/outcome": {"eq": "ok"}}}]})"); ReplayContext ctx; const json entry = run_replay(s, ctx, f.host())["steps"][0]; CHECK(entry["reason"] == json{{"kind", "expect"}, {"pointer", "/plates/0/outcome"}, {"op", "eq"}, @@ -344,7 +363,7 @@ TEST_CASE("a matcher that is not an object is a malformed expectation", "[Mcp]") { FakeHost f; f.tools["slice"] = [](const json&) { return ToolResult::ok({{"outcome", "ok"}}); }; - const Replay s = parse_ok(R"({"orca_replay": 1, "steps": [{"tool": "slice", "expect": {"/outcome": "ok"}}]})"); + const Replay s = parse_ok(R"({"orca_replay_version": "0.1.0", "steps": [{"tool": "slice", "expect": {"/outcome": "ok"}}]})"); ReplayContext ctx; const json entry = run_replay(s, ctx, f.host())["steps"][0]; CHECK(entry["ok"] == false); @@ -358,16 +377,16 @@ TEST_CASE("an inline nested replay's placeholders are the outer replay's", "[Mcp { FakeHost f; f.tools["run_replay"] = [](const json&) { return ToolResult::ok({{"passed", true}}); }; - const Replay with_outer = parse_ok(R"({"orca_replay": 1, "vars": {"p": "outer.stl"}, "steps": [{"tool": "run_replay", - "args": {"vars": {"p": "step.stl"}, "replay": {"orca_replay": 1, "steps": [{"tool": "open_files", "args": {"paths": ["${vars.p}"]}}]}}}]})"); + const Replay with_outer = parse_ok(R"({"orca_replay_version": "0.1.0", "vars": {"p": "outer.stl"}, "steps": [{"tool": "run_replay", + "args": {"vars": {"p": "step.stl"}, "replay": {"orca_replay_version": "0.1.0", "steps": [{"tool": "open_files", "args": {"paths": ["${vars.p}"]}}]}}}]})"); ReplayContext ctx; CHECK(run_replay(with_outer, ctx, f.host())["passed"] == true); REQUIRE(f.calls.size() == 1); CHECK(f.calls[0].second["replay"]["steps"][0]["args"]["paths"][0] == "outer.stl"); FakeHost g; - const Replay step_only = parse_ok(R"({"orca_replay": 1, "steps": [{"tool": "run_replay", - "args": {"vars": {"p": "step.stl"}, "replay": {"orca_replay": 1, "steps": [{"tool": "open_files", "args": {"paths": ["${vars.p}"]}}]}}}]})"); + const Replay step_only = parse_ok(R"({"orca_replay_version": "0.1.0", "steps": [{"tool": "run_replay", + "args": {"vars": {"p": "step.stl"}, "replay": {"orca_replay_version": "0.1.0", "steps": [{"tool": "open_files", "args": {"paths": ["${vars.p}"]}}]}}}]})"); const json out = run_replay(step_only, ctx, g.host()); CHECK(out["passed"] == false); CHECK(out["steps"][0]["reason"] == json{{"kind", "placeholder"}, {"text", "${vars.p}"}}); @@ -376,7 +395,7 @@ TEST_CASE("an inline nested replay's placeholders are the outer replay's", "[Mcp TEST_CASE("lenient substitution keeps what it cannot resolve", "[Mcp]") { - const Replay s = parse_ok(R"({"orca_replay": 1, "vars": {"model": "C:/m/part.stl"}, "steps": []})"); + const Replay s = parse_ok(R"({"orca_replay_version": "0.1.0", "vars": {"model": "C:/m/part.stl"}, "steps": []})"); ReplayContext ctx; CHECK(substitute_lenient("${vars.model}", s, ctx) == "C:/m/part.stl"); CHECK(substitute_lenient("${jobs.none}/x", s, ctx) == "${jobs.none}/x"); @@ -386,13 +405,13 @@ TEST_CASE("lenient substitution keeps what it cannot resolve", "[Mcp]") TEST_CASE("malformed replays are errors, not exceptions", "[Mcp]") { const auto [text, field] = GENERATE(table({ - {R"({"orca_replay": "1", "steps": []})", "orca_replay"}, - {R"({"orca_replay": 1, "name": 5, "steps": []})", "name"}, - {R"({"orca_replay": 1, "steps": [{"tool": 3}]})", "step 1: \"tool\""}, - {R"({"orca_replay": 1, "steps": [{"tool": "a", "timeout_s": "9"}]})", "step 1: \"timeout_s\""}, - {R"({"orca_replay": 1, "steps": [{"tool": "a", "optional": "yes"}]})", "step 1: \"optional\""}, - {R"([])", "orca_replay"}, - {R"({})", "orca_replay"}, + {R"({"orca_replay_version": 1, "steps": []})", "orca_replay_version"}, + {R"({"orca_replay_version": "0.1.0", "name": 5, "steps": []})", "name"}, + {R"({"orca_replay_version": "0.1.0", "steps": [{"tool": 3}]})", "step 1: \"tool\""}, + {R"({"orca_replay_version": "0.1.0", "steps": [{"tool": "a", "timeout_s": "9"}]})", "step 1: \"timeout_s\""}, + {R"({"orca_replay_version": "0.1.0", "steps": [{"tool": "a", "optional": "yes"}]})", "step 1: \"optional\""}, + {R"([])", "orca_replay_version"}, + {R"({})", "orca_replay_version"}, })); std::string err; std::optional s; @@ -404,13 +423,13 @@ TEST_CASE("malformed replays are errors, not exceptions", "[Mcp]") TEST_CASE("broken JSON says where", "[Mcp]") { std::string err; - CHECK_FALSE(parse_replay("{\n \"orca_replay\": 1,\n \"steps\": [ {\"tool\": \"a\",, } ]\n}", err).has_value()); + CHECK_FALSE(parse_replay("{\n \"orca_replay_version\": \"0.1.0\",\n \"steps\": [ {\"tool\": \"a\",, } ]\n}", err).has_value()); CHECK(err.find("line 3, column") != std::string::npos); } TEST_CASE("a Python step's code runs as written while its other arguments substitute", "[Mcp]") { - const Replay s = parse_ok(R"({"orca_replay": 1, "vars": {"a": "seven"}, "steps": [ + const Replay s = parse_ok(R"({"orca_replay_version": "0.1.0", "vars": {"a": "seven"}, "steps": [ {"tool": "run_script", "args": {"code": "label = '${vars.a}'", "args": {"label": "${vars.a}"}}}]})"); FakeHost fake; fake.tools["run_script"] = [](const json&) { return ToolResult::ok({{"status", "finished"}, {"result", nullptr}, {"output", ""}}); }; @@ -424,7 +443,7 @@ TEST_CASE("a Python step's code runs as written while its other arguments substi TEST_CASE("a Python step that did not finish fails its replay", "[Mcp]") { - const Replay s = parse_ok(R"S({"orca_replay": 1, "steps": [ + const Replay s = parse_ok(R"S({"orca_replay_version": "0.1.0", "steps": [ {"tool": "run_script", "args": {"code": "raise ValueError('x')"}}, {"tool": "get_app_state"}]})S"); FakeHost fake; @@ -444,7 +463,7 @@ TEST_CASE("a Python step that did not finish fails its replay", "[Mcp]") TEST_CASE("a Python step left running with await false keeps its job for later steps", "[Mcp]") { - const Replay s = parse_ok(R"({"orca_replay": 1, "steps": [ + const Replay s = parse_ok(R"({"orca_replay_version": "0.1.0", "steps": [ {"tool": "run_script", "args": {"code": "x = 1"}, "await": false, "save_as": "py"}, {"tool": "get_app_state"}]})"); FakeHost fake; @@ -459,9 +478,9 @@ TEST_CASE("a Python step left running with await false keeps its job for later s TEST_CASE("Python reached through call_tool or a nested replay follows the Python step rules", "[Mcp]") { // Its code runs as written however the step reaches it. - const Replay s = parse_ok(R"S({"orca_replay": 1, "vars": {"a": "seven"}, "steps": [ + const Replay s = parse_ok(R"S({"orca_replay_version": "0.1.0", "vars": {"a": "seven"}, "steps": [ {"tool": "call_tool", "args": {"tool": "run_script", "args": {"code": "x = '${vars.a}'", "args": {"v": "${vars.a}"}}}}, - {"tool": "run_replay", "args": {"replay": {"orca_replay": 1, "steps": [ + {"tool": "run_replay", "args": {"replay": {"orca_replay_version": "0.1.0", "steps": [ {"tool": "run_script", "args": {"code": "y = '${vars.a}'"}}, {"tool": "set_settings", "args": {"note": "${vars.a}"}}]}}}]})S"); FakeHost fake; @@ -478,7 +497,7 @@ TEST_CASE("Python reached through call_tool or a nested replay follows the Pytho CHECK(nested[1]["args"]["note"] == "seven"); // A run that raised through call_tool fails its step. - const Replay failing = parse_ok(R"({"orca_replay": 1, "steps": [ + const Replay failing = parse_ok(R"({"orca_replay_version": "0.1.0", "steps": [ {"tool": "call_tool", "args": {"tool": "run_script", "args": {"code": "x"}}}]})"); FakeHost raising; raising.tools["call_tool"] = [](const json&) { return ToolResult::ok({{"status", "raised"}, {"message", "NameError: x"}}); }; diff --git a/tests/automation/test_mcp_replay_summary.cpp b/tests/automation/test_mcp_replay_summary.cpp index 83f1463bc9..43934517aa 100644 --- a/tests/automation/test_mcp_replay_summary.cpp +++ b/tests/automation/test_mcp_replay_summary.cpp @@ -58,7 +58,7 @@ CommandCatalog tile_catalog() StepDescription describe(const std::string& step, const std::string& vars = "{}") { std::string err; - const auto replay = parse_replay(R"({"orca_replay": 1, "vars": )" + vars + R"(, "steps": [)" + step + "]}", err); + const auto replay = parse_replay(R"({"orca_replay_version": "0.1.0", "vars": )" + vars + R"(, "steps": [)" + step + "]}", err); INFO(err); REQUIRE(replay.has_value()); ReplayContext ctx; @@ -190,7 +190,7 @@ TEST_CASE("a call with other arguments than a tile's is described by its argumen TEST_CASE("a step that calls a tile's command by its key is described from the catalog it is given", "[Mcp]") { std::string err; - const auto replay = parse_replay(R"({"orca_replay": 1, "steps": [{"tool": "export_stl", "args": {"path": "C:/a.stl"}}]})", err); + const auto replay = parse_replay(R"({"orca_replay_version": "0.1.0", "steps": [{"tool": "export_stl", "args": {"path": "C:/a.stl"}}]})", err); INFO(err); REQUIRE(replay.has_value()); ReplayContext ctx; @@ -325,62 +325,62 @@ TEST_CASE("steps that can answer a dialog are told apart", "[Mcp]") TEST_CASE("nested replays join their steps' descriptions", "[Mcp]") { const StepDescription replacing = describe( - R"({"tool": "run_replay", "args": {"replay": {"orca_replay": 1, "steps": [{"tool": "new_project", "args": {"discard_changes": true}}]}}})"); + R"({"tool": "run_replay", "args": {"replay": {"orca_replay_version": "0.1.0", "steps": [{"tool": "new_project", "args": {"discard_changes": true}}]}}})"); CHECK(flags_of(replacing) == Flags{"replaces_project"}); CHECK(replacing.replace == "checked"); CHECK(replacing.what == json{{"kind", "replay"}, {"steps", 1}}); // An inline replay given as JSON text, comments included, reads as its object does. - const std::string text = "// starts over\n" R"({"orca_replay": 1, "steps": [{"tool": "new_project", "args": {"discard_changes": true}}]})"; + const std::string text = "// starts over\n" R"({"orca_replay_version": "0.1.0", "steps": [{"tool": "new_project", "args": {"discard_changes": true}}]})"; const StepDescription as_text = describe(json{{"tool", "run_replay"}, {"args", {{"replay", text}}}}.dump()); CHECK(flags_of(as_text) == Flags{"replaces_project"}); CHECK(as_text.what == json{{"kind", "replay"}, {"steps", 1}}); const StepDescription own_output = describe( - R"({"tool": "run_replay", "args": {"replay": {"orca_replay": 1, "steps": [{"tool": "screenshot", "args": {"save_path": "${out_dir}/n.png"}}]}}})"); + R"({"tool": "run_replay", "args": {"replay": {"orca_replay_version": "0.1.0", "steps": [{"tool": "screenshot", "args": {"save_path": "${out_dir}/n.png"}}]}}})"); CHECK(flags_of(own_output).empty()); // The outer replay substitutes an inline replay's placeholders before the nested run starts, as // run_replay does: the step's own vars come too late, and its out_dir doesn't move ${out_dir}. const StepDescription outer_vars = describe( - R"({"tool": "run_replay", "args": {"replay": {"orca_replay": 1, "steps": [{"tool": "open_files", "args": {"paths": ["${vars.p}"]}}]}}})", + R"({"tool": "run_replay", "args": {"replay": {"orca_replay_version": "0.1.0", "steps": [{"tool": "open_files", "args": {"paths": ["${vars.p}"]}}]}}})", R"({"p": "C:/a/p.3mf"})"); CHECK(flags_of(outer_vars) == Flags{"replaces_project"}); CHECK(outer_vars.replace == "checked"); const StepDescription step_vars = describe( - R"({"tool": "run_replay", "args": {"vars": {"p": "C:/a/p.3mf"}, "replay": {"orca_replay": 1, "vars": {"p": "C:/a/q.3mf"}, "steps": [{"tool": "open_files", "args": {"paths": ["${vars.p}"]}}]}}})"); + R"({"tool": "run_replay", "args": {"vars": {"p": "C:/a/p.3mf"}, "replay": {"orca_replay_version": "0.1.0", "vars": {"p": "C:/a/q.3mf"}, "steps": [{"tool": "open_files", "args": {"paths": ["${vars.p}"]}}]}}})"); CHECK(flags_of(step_vars).empty()); CHECK(step_vars.replace == ""); const StepDescription own_folder = describe( - R"({"tool": "run_replay", "args": {"out_dir": "C:/elsewhere", "replay": {"orca_replay": 1, "steps": [{"tool": "screenshot", "args": {"save_path": "${out_dir}/n.png"}}]}}})"); + R"({"tool": "run_replay", "args": {"out_dir": "C:/elsewhere", "replay": {"orca_replay_version": "0.1.0", "steps": [{"tool": "screenshot", "args": {"save_path": "${out_dir}/n.png"}}]}}})"); CHECK(flags_of(own_folder).empty()); const StepDescription mixed = describe( - R"({"tool": "run_replay", "args": {"replay": {"orca_replay": 1, "steps": [{"tool": "run_action", "args": {"id": "orca_command:new_project:orca"}}, {"tool": "new_project", "args": {"silent": true}}]}}})"); + R"({"tool": "run_replay", "args": {"replay": {"orca_replay_version": "0.1.0", "steps": [{"tool": "run_action", "args": {"id": "orca_command:new_project:orca"}}, {"tool": "new_project", "args": {"silent": true}}]}}})"); CHECK(mixed.replace == "checked"); const StepDescription clicking = describe( - R"({"tool": "run_replay", "args": {"replay": {"orca_replay": 1, "steps": [{"tool": "click", "args": {"target": {"label": "No"}}}]}}})"); + R"({"tool": "run_replay", "args": {"replay": {"orca_replay_version": "0.1.0", "steps": [{"tool": "click", "args": {"target": {"label": "No"}}}]}}})"); CHECK(clicking.answers_dialogs); // Five levels of nesting: past the inspection depth, so the effect can't be read. - std::string deep = R"({"orca_replay": 1, "steps": [{"tool": "new_project"}]})"; + std::string deep = R"({"orca_replay_version": "0.1.0", "steps": [{"tool": "new_project"}]})"; for (int i = 0; i < 5; ++i) - deep = R"({"orca_replay": 1, "steps": [{"tool": "run_replay", "args": {"replay": )" + deep + "}}]}"; + deep = R"({"orca_replay_version": "0.1.0", "steps": [{"tool": "run_replay", "args": {"replay": )" + deep + "}}]}"; const StepDescription too_deep = describe(R"({"tool": "run_replay", "args": {"replay": )" + deep + "}}"); CHECK(flags_of(too_deep) == kEveryFlag); CHECK(too_deep.replace == "checked"); CHECK(too_deep.answers_dialogs); CHECK(too_deep.what == json{{"kind", "replay"}, {"steps", 1}}); - const StepDescription invalid = describe(R"({"tool": "run_replay", "args": {"replay": {"orca_replay": 1, "steps": [{"tool": 3}]}}})"); + const StepDescription invalid = describe(R"({"tool": "run_replay", "args": {"replay": {"orca_replay_version": "0.1.0", "steps": [{"tool": 3}]}}})"); CHECK(flags_of(invalid) == kEveryFlag); REQUIRE(invalid.what.value("kind", "") == "value"); CHECK(invalid.what.value("text", "").find("step 1") != std::string::npos); - const StepDescription broken_text = describe(json{{"tool", "run_replay"}, {"args", {{"replay", "{\"orca_replay\": 1,\n \"steps\": ["}}}}.dump()); + const StepDescription broken_text = describe(json{{"tool", "run_replay"}, {"args", {{"replay", "{\"orca_replay_version\": \"0.1.0\",\n \"steps\": ["}}}}.dump()); CHECK(flags_of(broken_text) == kEveryFlag); REQUIRE(broken_text.what.value("kind", "") == "value"); CHECK(broken_text.what.value("text", "").find("line 2") != std::string::npos); @@ -401,7 +401,7 @@ TEST_CASE("saved jobs don't change a step's flags", "[Mcp]") R"({"tool": "run_action", "args": {"id": "orca_command:import_file:orca", "args": {"path": "${jobs.p}"}}})"); INFO(step); std::string err; - const auto replay = parse_replay(R"({"orca_replay": 1, "steps": [)" + step + "]}", err); + const auto replay = parse_replay(R"({"orca_replay_version": "0.1.0", "steps": [)" + step + "]}", err); REQUIRE(replay.has_value()); ReplayContext without; without.out_dir = "C:/out"; diff --git a/tests/data/command_catalog.json b/tests/data/command_catalog.json index 6d9f547789..bf7350dd9f 100644 --- a/tests/data/command_catalog.json +++ b/tests/data/command_catalog.json @@ -386,7 +386,7 @@ }, { "completion": "immediate", - "description": "Open the Action Replay window, where a person opens a replay file (an orca_replay), reads its steps and replays them. Agents run replays with the run_replay tool instead.", + "description": "Open the Action Replay window, where a person opens a replay file, reads its steps and replays them. Agents run replays with the run_replay tool instead.", "destructive": false, "group": "Commands", "guard": "mutate", @@ -4755,7 +4755,7 @@ }, { "completion": "immediate", - "description": "Replay a list of tool calls in order and report each step: {orca_replay:1, name, vars, steps:[{tool, args, expect, optional, await, save_as, timeout_s}]}, JSON with comments. Strings may use ${replay_dir}, ${out_dir}, ${env:NAME}, ${vars.NAME} and ${jobs.NAME}. A step that returns a job is awaited unless await:false, which stores the job under save_as so later steps can answer the dialog it opened. expect maps a JSON pointer into the step's result to matchers (eq ne gt ge lt le contains regex exists empty); the first failed step or expectation stops the run unless the step is optional. Writes result.json to out_dir (default: the replay file's name with .out, beside it; for an inline replay, replay- in the session's output folder). Reply: passed, steps, failed_step, out_dir and result_file. auto_answer_dialogs rules a replay registers end with it. export_replay turns this session into one.", + "description": "Replay a list of tool calls in order and report each step: {orca_replay_version:\"0.1.0\", name, vars, steps:[{tool, args, expect, optional, await, save_as, timeout_s}]}, JSON with comments. Strings may use ${replay_dir}, ${out_dir}, ${env:NAME}, ${vars.NAME} and ${jobs.NAME}. A step that returns a job is awaited unless await:false, which stores the job under save_as so later steps can answer the dialog it opened. expect maps a JSON pointer into the step's result to matchers (eq ne gt ge lt le contains regex exists empty); the first failed step or expectation stops the run unless the step is optional. Writes result.json to out_dir (default: the replay file's name with .out, beside it; for an inline replay, replay- in the session's output folder). Reply: passed, steps, failed_step, out_dir and result_file. auto_answer_dialogs rules a replay registers end with it. export_replay turns this session into one.", "destructive": false, "group": "core", "guard": "mutate", diff --git a/tests/slic3rutils/test_mcp_recording.cpp b/tests/slic3rutils/test_mcp_recording.cpp index efb6801bf4..4a287a912c 100644 --- a/tests/slic3rutils/test_mcp_recording.cpp +++ b/tests/slic3rutils/test_mcp_recording.cpp @@ -1105,7 +1105,7 @@ TEST_CASE("a failure's caption hides what the call's caption hides", "[Mcp][Reco "0.33 is out of range"); CHECK(caption_error("press_keys", {{"text", "pa55word"}}, "typed pa55word into nothing") == "typed " + dots + " into nothing"); // A secret in a step of an inline replay is found under its key. - const json replay = {{"replay", {{"orca_replay", 1}, {"steps", json::array({{{"tool", "set_settings"}, {"args", {{"values", {{"printhost_password", "letmein9"}}}}}}})}}}}; + const json replay = {{"replay", {{"orca_replay_version", "0.1.0"}, {"steps", json::array({{{"tool", "set_settings"}, {"args", {{"values", {{"printhost_password", "letmein9"}}}}}}})}}}}; CHECK(caption_error("run_replay", replay, "step 1 failed: letmein9 rejected") == "step 1 failed: " + dots + " rejected"); // Too short to take out safely: the error is left out. CHECK(caption_error("press_keys", {{"text", "ab"}}, "typed ab").empty()); diff --git a/tests/slic3rutils/test_mcp_tools.cpp b/tests/slic3rutils/test_mcp_tools.cpp index 6fbf93a219..f4f7d9fc00 100644 --- a/tests/slic3rutils/test_mcp_tools.cpp +++ b/tests/slic3rutils/test_mcp_tools.cpp @@ -590,7 +590,7 @@ TEST_CASE("the journal records indices without expected ids, except a Python ste CHECK(without_expected_ids(catalog, "set_settings", json{{"object", 0}, {"object_id", 7}, {"part_id", 8}}) == json{{"object", 0}}); CHECK(without_expected_ids(catalog, "set_height_ranges", json{{"object", 0}, {"object_id", 7}}) == json{{"object", 0}}); CHECK(without_expected_ids(catalog, "set_variable_layer_height", json{{"object", 0}, {"object_id", 7}}) == json{{"object", 0}}); - const json replay{{"replay", {{"orca_replay", 1}, + const json replay{{"replay", {{"orca_replay_version", "0.1.0"}, {"steps", {{{"tool", "transform"}, {"args", {{"object", 1}, {"object_id", 9}}}}, {{"tool", "run_script"}, {"args", {{"code", "x"}, {"args", {{"object_id", 9}}}}}}}}}}}; const json recorded = without_expected_ids(catalog, "run_replay", replay); @@ -603,12 +603,12 @@ TEST_CASE("the journal records an inline replay given as JSON text as its object { const CommandCatalog& catalog = Slic3r::GUI::NativeCommands::instance(); const json as_text{{"replay", "// moves the lid\n" - R"({"orca_replay": 1, "steps": [{"tool": "transform", "args": {"object": 1, "object_id": 9}}]})"}}; + R"({"orca_replay_version": "0.1.0", "steps": [{"tool": "transform", "args": {"object": 1, "object_id": 9}}]})"}}; const json recorded = without_expected_ids(catalog, "run_replay", as_text); REQUIRE(recorded["replay"].is_object()); CHECK(recorded["replay"]["steps"][0]["args"] == json{{"object", 1}}); // Text that doesn't parse is the call's error; it is recorded as given. - CHECK(without_expected_ids(catalog, "run_replay", json{{"replay", "{\"orca_replay\": 1,"}}) == json{{"replay", "{\"orca_replay\": 1,"}}); + CHECK(without_expected_ids(catalog, "run_replay", json{{"replay", "{\"orca_replay_version\": \"0.1.0\","}}) == json{{"replay", "{\"orca_replay_version\": \"0.1.0\","}}); } TEST_CASE("the journal strips a command's id arguments", "[Mcp]") @@ -618,7 +618,7 @@ TEST_CASE("the journal strips a command's id arguments", "[Mcp]") // Inside the call_tool and run_replay wrappers too. CHECK(without_expected_ids(catalog, "call_tool", json{{"tool", "transform"}, {"args", {{"object", 1}, {"object_id", 9}}}}) == json{{"tool", "transform"}, {"args", {{"object", 1}}}}); - const json replay{{"replay", {{"orca_replay", 1}, + const json replay{{"replay", {{"orca_replay_version", "0.1.0"}, {"steps", {{{"tool", "call_tool"}, {"args", {{"tool", "transform"}, {"args", {{"object", 1}, {"object_id", 9}}}}}}}}}}}; CHECK(without_expected_ids(catalog, "run_replay", replay)["replay"]["steps"][0]["args"]["args"] == json{{"object", 1}}); // A plugin operation's own fields of the same names are its arguments, recorded as given. diff --git a/tests/slic3rutils/test_python_script_runner.cpp b/tests/slic3rutils/test_python_script_runner.cpp index 2f611b5c79..7e83f7ac19 100644 --- a/tests/slic3rutils/test_python_script_runner.cpp +++ b/tests/slic3rutils/test_python_script_runner.cpp @@ -802,13 +802,13 @@ TEST_CASE("a script hands run_replay a script given as JSON text as it is, with ScopedToolBridge bound(bridge); const PythonRunOutcome out = run(R"PY( import orca -text = '{"orca_replay": 1, "steps": []} // replayed' +text = '{"orca_replay_version": "0.1.0", "steps": []} // replayed' result = orca.host.tools.run_replay(text, {"part": "lid"}) )PY"); REQUIRE(out.status == "finished"); CHECK(out.result == json{{"passed", true}}); CHECK(bridge.calls == std::vector{"run_replay"}); - CHECK(bridge.last_args == json{{"replay", R"({"orca_replay": 1, "steps": []} // replayed)"}, {"vars", {{"part", "lid"}}}}); + CHECK(bridge.last_args == json{{"replay", R"({"orca_replay_version": "0.1.0", "steps": []} // replayed)"}, {"vars", {{"part", "lid"}}}}); } TEST_CASE("a run waits for the non-daemon threads it starts, which call tools through it", "[PythonScript][Python]") diff --git a/tools/mcp/smoke_test.json b/tools/mcp/smoke_test.json index b3aad819e9..a1a7393c29 100644 --- a/tools/mcp/smoke_test.json +++ b/tools/mcp/smoke_test.json @@ -5,7 +5,7 @@ // or headless with // orca-slicer --run tools/mcp/smoke_test.json --outputdir /tmp/smoke { - "orca_replay": 1, + "orca_replay_version": "0.1.0", "name": "smoke", "vars": {"model": "${replay_dir}/../../resources/handy_models/3DBenchy.drc"}, "steps": [ diff --git a/tools/mcp/test_action_replay_hidden.py b/tools/mcp/test_action_replay_hidden.py index 18b81155b7..670417b73a 100755 --- a/tools/mcp/test_action_replay_hidden.py +++ b/tools/mcp/test_action_replay_hidden.py @@ -83,9 +83,9 @@ def main(): check("run_replay still runs the smoke test", smoke.get("passed") is True, smoke.get("failed_step")) nested = { - "orca_replay": 1, + "orca_replay_version": "0.1.0", "name": "nested", - "steps": [{"tool": "run_replay", "args": {"replay": {"orca_replay": 1, "steps": [{"tool": "get_app_state"}]}}, + "steps": [{"tool": "run_replay", "args": {"replay": {"orca_replay_version": "0.1.0", "steps": [{"tool": "get_app_state"}]}}, "expect": {"/passed": {"eq": True}}}], } result = client.await_job(client.call("run_replay", replay=nested, out_dir=os.path.join(out, "nested"))) diff --git a/tools/mcp/test_command_line.py b/tools/mcp/test_command_line.py index 6dbe5c920a..395c7b882f 100644 --- a/tools/mcp/test_command_line.py +++ b/tools/mcp/test_command_line.py @@ -68,7 +68,7 @@ HANDED_OVER = (-1, 255) # a start that handed its command line to a window, MODEL = os.path.join(HERE, "..", "..", "resources", "handy_models", "OrcaCube_v2.drc") DROPPED = (McpError, OSError, http.client.HTTPException) -REPLAY = {"orca_replay": 1, "name": "the app's state", "steps": [{"tool": "get_app_state"}]} +REPLAY = {"orca_replay_version": "0.1.0", "name": "the app's state", "steps": [{"tool": "get_app_state"}]} SCREENSHOT_SCRIPT = """ import orca orca.host.tools.call("screenshot", {"include_image": False}) diff --git a/tools/mcp/test_export_running_job.py b/tools/mcp/test_export_running_job.py index 17478b0ab3..dfd3cd2da9 100755 --- a/tools/mcp/test_export_running_job.py +++ b/tools/mcp/test_export_running_job.py @@ -40,7 +40,7 @@ def main(): # ---- A job past the reply budget, exported while it runs and after it ends ---- start = time.time() - slow = {"orca_replay": 1, "name": "slow", + slow = {"orca_replay_version": "0.1.0", "name": "slow", "steps": [{"tool": "wait", "args": {"for": "dialog", "timeout_s": orca_mcp.reply_budget_s() + 3}}]} started = client.call("run_replay", _timeout=120, replay=slow, out_dir=os.path.join(work, "slow")) check("the slow replay replies with its running job", started.get("status") == "running", diff --git a/tools/mcp/test_plugin_tools.py b/tools/mcp/test_plugin_tools.py index 8c11f263d4..5ef2f855b3 100644 --- a/tools/mcp/test_plugin_tools.py +++ b/tools/mcp/test_plugin_tools.py @@ -228,7 +228,7 @@ def main(): install(datadir) # enabled again: unticking it saved it disabled steps = os.path.join(datadir, "plugin_rule.json") with open(steps, "w", encoding="utf-8") as f: - json.dump({"orca_replay": 1, "name": "a plugin's rule without MCP", "steps": [ + json.dump({"orca_replay_version": "0.1.0", "name": "a plugin's rule without MCP", "steps": [ {"tool": "run_action", "args": {"id": f"plugin_script_action:{CAPABILITIES[2]}:{PLUGIN}"}}, {"tool": "wait", "args": {"for": "dialog", "timeout_s": 10}}]}, f) out = os.path.join(plugin_dir, "out_rule.json") diff --git a/tools/mcp/test_runtime_lifecycle.py b/tools/mcp/test_runtime_lifecycle.py index 5506a0472b..128c62c170 100644 --- a/tools/mcp/test_runtime_lifecycle.py +++ b/tools/mcp/test_runtime_lifecycle.py @@ -381,7 +381,7 @@ def exit_without_endpoint(binary): os.makedirs(out) with open(replay, "w", encoding="utf-8") as f: # The expect makes a run that opened the endpoint fail the replay, and with it the check. - json.dump({"orca_replay": 1, "name": "the app's state without the server", + json.dump({"orca_replay_version": "0.1.0", "name": "the app's state without the server", "steps": [{"tool": "get_app_state", "expect": {"/mcp/serving": {"eq": False}}}]}, f) try: with Instance(binary, "--run", replay, "--outputdir", out, serve=False) as app: diff --git a/tools/mcp/test_set_view_preview.py b/tools/mcp/test_set_view_preview.py index 6b6d5a45b9..945860e41a 100755 --- a/tools/mcp/test_set_view_preview.py +++ b/tools/mcp/test_set_view_preview.py @@ -91,7 +91,7 @@ def main(): steps += [{"tool": "screenshot", "args": {"target": "canvas", "save_path": f"${{out_dir}}/{i}{shot}.png", "overwrite": True, "include_image": False}} for shot in "ab"] - ran = client.await_job(client.call("run_replay", replay={"orca_replay": 1, "name": "captures after view changes", "steps": steps}, + ran = client.await_job(client.call("run_replay", replay={"orca_replay_version": "0.1.0", "name": "captures after view changes", "steps": steps}, out_dir=out_dir)) check("the capture replay runs", ran.get("passed") is True, ran) if ran.get("passed") is True: diff --git a/tools/mcp/test_web_ui.py b/tools/mcp/test_web_ui.py index 0f4808c53b..1ff49acd0f 100755 --- a/tools/mcp/test_web_ui.py +++ b/tools/mcp/test_web_ui.py @@ -650,7 +650,7 @@ def main(): check("an up the page takes too late leaves its press for the next gesture", "error" in r and missed == ups + 5 and page_log(window_log).count("pad up") == ups + 6, lambda: [r, missed, page_log(window_log)]) # A replay's press on a page ends with the replay, as a widget's does. - pressing = {"orca_replay": 1, "name": "press", "steps": [ + pressing = {"orca_replay_version": "0.1.0", "name": "press", "steps": [ {"tool": "mouse_gesture", "args": {"target": {"web": "Pad", "within": "MCP web fixture window"}, "action": "down", "x": 5, "y": 5}}]} res = client.await_job(client.call("run_replay", replay=pressing, out_dir=os.path.join(session["datadir"], "press_replay"))) check("a replay's press on a page ends with the replay", diff --git a/tools/mcp/tests/agent_forms.json b/tools/mcp/tests/agent_forms.json index 34dd09e70b..5c5de58243 100644 --- a/tools/mcp/tests/agent_forms.json +++ b/tools/mcp/tests/agent_forms.json @@ -6,7 +6,7 @@ // without meta. Run on a live app: // python3 tools/mcp/orca_mcp.py run-replay tools/mcp/tests/agent_forms.json --out { - "orca_replay": 1, + "orca_replay_version": "0.1.0", "name": "agent argument forms", "vars": {"cube": "${replay_dir}/../../../resources/handy_models/OrcaCube_v2.drc"}, "steps": [ diff --git a/tools/mcp/tests/cad_canvas.json b/tools/mcp/tests/cad_canvas.json index 59c1b881de..3d39970499 100644 --- a/tools/mcp/tests/cad_canvas.json +++ b/tools/mcp/tests/cad_canvas.json @@ -9,7 +9,7 @@ // tools/mcp/orca_mcp.py launch --cad // tools/mcp/orca_mcp.py run-replay tools/mcp/tests/cad_canvas.json --out /tmp/out { - "orca_replay": 1, + "orca_replay_version": "0.1.0", "name": "cad canvas", "steps": [ {"tool": "wait", "args": {"for": "ready"}}, diff --git a/tools/mcp/tests/cad_doc.json b/tools/mcp/tests/cad_doc.json index 114d368381..0da0387c04 100644 --- a/tools/mcp/tests/cad_doc.json +++ b/tools/mcp/tests/cad_doc.json @@ -10,7 +10,7 @@ // tools/mcp/orca_mcp.py launch --cad // tools/mcp/orca_mcp.py run-replay tools/mcp/tests/cad_doc.json --out /tmp/out { - "orca_replay": 1, + "orca_replay_version": "0.1.0", "name": "cad document", "steps": [ {"tool": "wait", "args": {"for": "ready"}}, diff --git a/tools/mcp/tests/cad_features.json b/tools/mcp/tests/cad_features.json index 9ef85b615d..73ed7fe7f0 100644 --- a/tools/mcp/tests/cad_features.json +++ b/tools/mcp/tests/cad_features.json @@ -7,7 +7,7 @@ // tools/mcp/orca_mcp.py launch --cad // tools/mcp/orca_mcp.py run-replay tools/mcp/tests/cad_features.json --out /tmp/out { - "orca_replay": 1, + "orca_replay_version": "0.1.0", "name": "cad thread sweep loft split", "steps": [ {"tool": "wait", "args": {"for": "ready"}}, diff --git a/tools/mcp/tests/cad_sketch_edit.json b/tools/mcp/tests/cad_sketch_edit.json index b8a2e7af63..ec085d9877 100644 --- a/tools/mcp/tests/cad_sketch_edit.json +++ b/tools/mcp/tests/cad_sketch_edit.json @@ -7,7 +7,7 @@ // tools/mcp/orca_mcp.py launch --cad // tools/mcp/orca_mcp.py run-replay tools/mcp/tests/cad_sketch_edit.json --out /tmp/out { - "orca_replay": 1, + "orca_replay_version": "0.1.0", "name": "cad sketch edit", "steps": [ {"tool": "wait", "args": {"for": "ready"}}, diff --git a/tools/mcp/tests/cad_sketch_to_solid.json b/tools/mcp/tests/cad_sketch_to_solid.json index 6c2074523e..aec6668066 100644 --- a/tools/mcp/tests/cad_sketch_to_solid.json +++ b/tools/mcp/tests/cad_sketch_to_solid.json @@ -6,7 +6,7 @@ // tools/mcp/orca_mcp.py launch --cad // tools/mcp/orca_mcp.py run-replay tools/mcp/tests/cad_sketch_to_solid.json --out /tmp/out { - "orca_replay": 1, + "orca_replay_version": "0.1.0", "name": "cad sketch to solid", "steps": [ {"tool": "wait", "args": {"for": "ready"}}, diff --git a/tools/mcp/tests/cad_topology_targets.json b/tools/mcp/tests/cad_topology_targets.json index e73a82df22..a3d6007ae1 100644 --- a/tools/mcp/tests/cad_topology_targets.json +++ b/tools/mcp/tests/cad_topology_targets.json @@ -8,7 +8,7 @@ // tools/mcp/orca_mcp.py launch --cad // tools/mcp/orca_mcp.py run-replay tools/mcp/tests/cad_topology_targets.json --out /tmp/out { - "orca_replay": 1, + "orca_replay_version": "0.1.0", "name": "cad topology and targets", "steps": [ {"tool": "wait", "args": {"for": "ready"}}, diff --git a/tools/mcp/tests/calibration.json b/tools/mcp/tests/calibration.json index 1808c52f19..c529ee6954 100644 --- a/tools/mcp/tests/calibration.json +++ b/tools/mcp/tests/calibration.json @@ -8,7 +8,7 @@ // printer (Bambu Lab X1 Carbon) and reruns on the same datadir. Run it with // tools/mcp/orca_mcp.py run-replay tools/mcp/tests/calibration.json --out /tmp/calibration { - "orca_replay": 1, + "orca_replay_version": "0.1.0", "name": "calibration tests", "steps": [ {"tool": "wait", "args": {"for": "ready"}}, diff --git a/tools/mcp/tests/context_menus.json b/tools/mcp/tests/context_menus.json index c6d4ff280e..76a58d0b59 100644 --- a/tools/mcp/tests/context_menus.json +++ b/tools/mcp/tests/context_menus.json @@ -5,7 +5,7 @@ // Refusals (no such item, a submenu, a disabled item, a click that opened no menu) are unit tests in // tests/slic3rutils/test_mcp_results.cpp, since a replay step cannot expect an error. { - "orca_replay": 1, + "orca_replay_version": "0.1.0", "name": "context menus", "steps": [ {"tool": "wait", "args": {"for": "ready"}}, diff --git a/tools/mcp/tests/dialogs_canvas_input.json b/tools/mcp/tests/dialogs_canvas_input.json index d45bd01cf4..182698002b 100644 --- a/tools/mcp/tests/dialogs_canvas_input.json +++ b/tools/mcp/tests/dialogs_canvas_input.json @@ -5,7 +5,7 @@ // Refusals (a point or an ImGui item under a panel or notification) are unit tests in // tests/slic3rutils/test_mcp_results.cpp, since a replay step cannot expect an error. { - "orca_replay": 1, + "orca_replay_version": "0.1.0", "name": "auto-answers and canvas input", "vars": {"standard": "0.20mm Standard @BBL X1C", "fine": "0.16mm High Quality @BBL X1C"}, "steps": [ diff --git a/tools/mcp/tests/gizmos.json b/tools/mcp/tests/gizmos.json index 1da10d3c6c..1197dcb2bd 100644 --- a/tools/mcp/tests/gizmos.json +++ b/tools/mcp/tests/gizmos.json @@ -6,7 +6,7 @@ // tools/mcp/orca_mcp.py call run_replay '{"path": "/abs/tools/mcp/tests/gizmos.json", // "out_dir": "/tmp/gizmos-small", "vars": {"window_size": [1100, 760]}}' --wait { - "orca_replay": 1, + "orca_replay_version": "0.1.0", "name": "every gizmo", "vars": { "window_size": [1600, 900], diff --git a/tools/mcp/tests/layers.json b/tools/mcp/tests/layers.json index 638ad37f4b..f0799ba409 100644 --- a/tools/mcp/tests/layers.json +++ b/tools/mcp/tests/layers.json @@ -6,7 +6,7 @@ // A refusal can't be asserted directly (a failed step stops the run), so each one is an optional // step followed by a check that nothing changed. { - "orca_replay": 1, + "orca_replay_version": "0.1.0", "name": "layer-based edits", "vars": {"cube": "${replay_dir}/../../../resources/handy_models/OrcaCube_v2.drc", "benchy": "${replay_dir}/../../../resources/handy_models/3DBenchy.drc"}, diff --git a/tools/mcp/tests/multicolor.json b/tools/mcp/tests/multicolor.json index 7c30c8b3b3..7d7aa583b9 100644 --- a/tools/mcp/tests/multicolor.json +++ b/tools/mcp/tests/multicolor.json @@ -3,7 +3,7 @@ // flushing volumes, plate type and prime tower position through the project scope. Run it with // tools/mcp/orca_mcp.py run-replay tools/mcp/tests/multicolor.json --out /tmp/multicolor { - "orca_replay": 1, + "orca_replay_version": "0.1.0", "name": "object and part filaments", "steps": [ {"tool": "wait", "args": {"for": "ready"}}, diff --git a/tools/mcp/tests/new_project_keeps_layer_gcode.json b/tools/mcp/tests/new_project_keeps_layer_gcode.json index bfa9931b52..3b7ff2dcb4 100644 --- a/tools/mcp/tests/new_project_keeps_layer_gcode.json +++ b/tools/mcp/tests/new_project_keeps_layer_gcode.json @@ -3,7 +3,7 @@ // a live app: // python3 tools/mcp/orca_mcp.py run-replay tools/mcp/tests/new_project_keeps_layer_gcode.json --out { - "orca_replay": 1, + "orca_replay_version": "0.1.0", "name": "new project keeps layer G-code", "vars": {"cube": "${replay_dir}/../../../resources/handy_models/OrcaCube_v2.drc"}, "steps": [ diff --git a/tools/mcp/tests/ops_assign_filament_preset_multi_slot.json b/tools/mcp/tests/ops_assign_filament_preset_multi_slot.json index d69de9f302..ce49b7b2c7 100644 --- a/tools/mcp/tests/ops_assign_filament_preset_multi_slot.json +++ b/tools/mcp/tests/ops_assign_filament_preset_multi_slot.json @@ -12,7 +12,7 @@ // with // tools/mcp/orca_mcp.py run-replay tools/mcp/tests/ops_assign_filament_preset_multi_slot.json --out { - "orca_replay": 1, + "orca_replay_version": "0.1.0", "name": "ops assign_filament_preset, several slots", "steps": [ {"tool": "wait", "args": {"for": "ready"}}, diff --git a/tools/mcp/tests/ops_assign_filament_preset_one_slot.json b/tools/mcp/tests/ops_assign_filament_preset_one_slot.json index e08b800c97..4bb36c20f8 100644 --- a/tools/mcp/tests/ops_assign_filament_preset_one_slot.json +++ b/tools/mcp/tests/ops_assign_filament_preset_one_slot.json @@ -9,7 +9,7 @@ // with one slot the flushing volumes matrix has no entry to recalculate. Run it on a freshly launched app with // tools/mcp/orca_mcp.py run-replay tools/mcp/tests/ops_assign_filament_preset_one_slot.json --out { - "orca_replay": 1, + "orca_replay_version": "0.1.0", "name": "ops assign_filament_preset, one slot", "steps": [ {"tool": "wait", "args": {"for": "ready"}}, diff --git a/tools/mcp/tests/ops_export_gcode.json b/tools/mcp/tests/ops_export_gcode.json index 59f79aa6f6..5a30d0c30c 100644 --- a/tools/mcp/tests/ops_export_gcode.json +++ b/tools/mcp/tests/ops_export_gcode.json @@ -12,7 +12,7 @@ // (the commands write without overwrite, so they refuse the files of an earlier run): // tools/mcp/orca_mcp.py run-replay tools/mcp/tests/ops_export_gcode.json --out { - "orca_replay": 1, + "orca_replay_version": "0.1.0", "name": "ops export_gcode", "vars": { "benchy": "${replay_dir}/../../../resources/handy_models/3DBenchy.drc", diff --git a/tools/mcp/tests/ops_export_model_3mf.json b/tools/mcp/tests/ops_export_model_3mf.json index f56012d9ff..92d0a90f7d 100644 --- a/tools/mcp/tests/ops_export_model_3mf.json +++ b/tools/mcp/tests/ops_export_model_3mf.json @@ -7,7 +7,7 @@ // write without overwrite, so they refuse the files of an earlier run): // tools/mcp/orca_mcp.py run-replay tools/mcp/tests/ops_export_model_3mf.json --out { - "orca_replay": 1, + "orca_replay_version": "0.1.0", "name": "ops export_model_3mf", "vars": {"undo": "${replay_dir}/fixtures/ops_undo.py"}, "steps": [ diff --git a/tools/mcp/tests/ops_export_sliced_3mf.json b/tools/mcp/tests/ops_export_sliced_3mf.json index b9cb3a7432..ae5575b253 100644 --- a/tools/mcp/tests/ops_export_sliced_3mf.json +++ b/tools/mcp/tests/ops_export_sliced_3mf.json @@ -7,7 +7,7 @@ // fresh --out directory (the commands write without overwrite, so they refuse the files of an earlier run): // tools/mcp/orca_mcp.py run-replay tools/mcp/tests/ops_export_sliced_3mf.json --out { - "orca_replay": 1, + "orca_replay_version": "0.1.0", "name": "ops export_sliced_3mf", "vars": {"undo": "${replay_dir}/fixtures/ops_undo.py"}, "steps": [ diff --git a/tools/mcp/tests/ops_export_stl.json b/tools/mcp/tests/ops_export_stl.json index 1b2e212419..5010d9c144 100644 --- a/tools/mcp/tests/ops_export_stl.json +++ b/tools/mcp/tests/ops_export_stl.json @@ -7,7 +7,7 @@ // without overwrite, so they refuse the files of an earlier run): // tools/mcp/orca_mcp.py run-replay tools/mcp/tests/ops_export_stl.json --out { - "orca_replay": 1, + "orca_replay_version": "0.1.0", "name": "ops export_stl", "vars": {"undo": "${replay_dir}/fixtures/ops_undo.py"}, "steps": [ diff --git a/tools/mcp/tests/ops_import_models.json b/tools/mcp/tests/ops_import_models.json index 2fdf57b40e..2990b5aee9 100644 --- a/tools/mcp/tests/ops_import_models.json +++ b/tools/mcp/tests/ops_import_models.json @@ -11,7 +11,7 @@ // with // tools/mcp/orca_mcp.py run-replay tools/mcp/tests/ops_import_models.json --out { - "orca_replay": 1, + "orca_replay_version": "0.1.0", "name": "ops import_models", "vars": { "stl": "${replay_dir}/../../../tests/data/test_stl/ASCII/20mmbox-LF.stl", diff --git a/tools/mcp/tests/ops_import_presets.json b/tools/mcp/tests/ops_import_presets.json index ad9e780d15..1b19e1e10b 100644 --- a/tools/mcp/tests/ops_import_presets.json +++ b/tools/mcp/tests/ops_import_presets.json @@ -8,7 +8,7 @@ // call it records is optional. Run it with // tools/mcp/orca_mcp.py run-replay tools/mcp/tests/ops_import_presets.json --out { - "orca_replay": 1, + "orca_replay_version": "0.1.0", "name": "ops import_presets", "vars": {"undo": "${replay_dir}/fixtures/ops_undo.py", "pla": "${replay_dir}/fixtures/mcp_import_pla.json", diff --git a/tools/mcp/tests/ops_new_project.json b/tools/mcp/tests/ops_new_project.json index 31ab74467f..045dc321eb 100644 --- a/tools/mcp/tests/ops_new_project.json +++ b/tools/mcp/tests/ops_new_project.json @@ -9,7 +9,7 @@ // optional. Run it with // tools/mcp/orca_mcp.py run-replay tools/mcp/tests/ops_new_project.json --out { - "orca_replay": 1, + "orca_replay_version": "0.1.0", "name": "ops new_project", "vars": {"undo": "${replay_dir}/fixtures/ops_undo.py"}, "steps": [ diff --git a/tools/mcp/tests/ops_open_project.json b/tools/mcp/tests/ops_open_project.json index 19ac92adcc..a2c7dfe119 100644 --- a/tools/mcp/tests/ops_open_project.json +++ b/tools/mcp/tests/ops_open_project.json @@ -8,7 +8,7 @@ // read (fixtures/ops_undo.py). Every call it records is optional. Run it with // tools/mcp/orca_mcp.py run-replay tools/mcp/tests/ops_open_project.json --out { - "orca_replay": 1, + "orca_replay_version": "0.1.0", "name": "ops open_project", "vars": {"undo": "${replay_dir}/fixtures/ops_undo.py"}, "steps": [ diff --git a/tools/mcp/tests/ops_save_project_as.json b/tools/mcp/tests/ops_save_project_as.json index e45053c06a..fe6b5089a7 100644 --- a/tools/mcp/tests/ops_save_project_as.json +++ b/tools/mcp/tests/ops_save_project_as.json @@ -8,7 +8,7 @@ // run): // tools/mcp/orca_mcp.py run-replay tools/mcp/tests/ops_save_project_as.json --out { - "orca_replay": 1, + "orca_replay_version": "0.1.0", "name": "ops save_project_as", "vars": {"undo": "${replay_dir}/fixtures/ops_undo.py"}, "steps": [ diff --git a/tools/mcp/tests/ops_select_plate.json b/tools/mcp/tests/ops_select_plate.json index 8b0bfbdc40..1287534bf3 100644 --- a/tools/mcp/tests/ops_select_plate.json +++ b/tools/mcp/tests/ops_select_plate.json @@ -6,7 +6,7 @@ // The project has three plates with a cube on the first. Every call it records is optional. Run it with // tools/mcp/orca_mcp.py run-replay tools/mcp/tests/ops_select_plate.json --out { - "orca_replay": 1, + "orca_replay_version": "0.1.0", "name": "ops select_plate", "vars": {"undo": "${replay_dir}/fixtures/ops_undo.py"}, "steps": [ diff --git a/tools/mcp/tests/ops_select_preset.json b/tools/mcp/tests/ops_select_preset.json index ca632c6da7..ef1b140af9 100644 --- a/tools/mcp/tests/ops_select_preset.json +++ b/tools/mcp/tests/ops_select_preset.json @@ -8,7 +8,7 @@ // restart) with // tools/mcp/orca_mcp.py run-replay tools/mcp/tests/ops_select_preset.json --out { - "orca_replay": 1, + "orca_replay_version": "0.1.0", "name": "ops select_preset", "steps": [ {"tool": "wait", "args": {"for": "ready"}}, diff --git a/tools/mcp/tests/ops_send_gcode_to_host.json b/tools/mcp/tests/ops_send_gcode_to_host.json index f6494e43bd..5b5145f2d7 100644 --- a/tools/mcp/tests/ops_send_gcode_to_host.json +++ b/tools/mcp/tests/ops_send_gcode_to_host.json @@ -7,7 +7,7 @@ // optional. Run it with // tools/mcp/orca_mcp.py run-replay tools/mcp/tests/ops_send_gcode_to_host.json --out { - "orca_replay": 1, + "orca_replay_version": "0.1.0", "name": "ops send_gcode_to_host", "vars": {"undo": "${replay_dir}/fixtures/ops_undo.py"}, "steps": [ diff --git a/tools/mcp/tests/ops_set_instance_count.json b/tools/mcp/tests/ops_set_instance_count.json index 4094c2f69a..6b2b0b4567 100644 --- a/tools/mcp/tests/ops_set_instance_count.json +++ b/tools/mcp/tests/ops_set_instance_count.json @@ -6,7 +6,7 @@ // step. Every call it records is optional. Run it with // tools/mcp/orca_mcp.py run-replay tools/mcp/tests/ops_set_instance_count.json --out { - "orca_replay": 1, + "orca_replay_version": "0.1.0", "name": "ops set_instance_count", "vars": {"undo": "${replay_dir}/fixtures/ops_undo.py"}, "steps": [ diff --git a/tools/mcp/tests/ops_set_plate_locked.json b/tools/mcp/tests/ops_set_plate_locked.json index 4c4c67b424..2da465ebb8 100644 --- a/tools/mcp/tests/ops_set_plate_locked.json +++ b/tools/mcp/tests/ops_set_plate_locked.json @@ -6,7 +6,7 @@ // once, to show that the lock is one undo step. Every call it records is optional. Run it with // tools/mcp/orca_mcp.py run-replay tools/mcp/tests/ops_set_plate_locked.json --out { - "orca_replay": 1, + "orca_replay_version": "0.1.0", "name": "ops set_plate_locked", "vars": {"undo": "${replay_dir}/fixtures/ops_undo.py"}, "steps": [ diff --git a/tools/mcp/tests/ops_show_layer_range.json b/tools/mcp/tests/ops_show_layer_range.json index f4c6893e33..2d964f20bc 100644 --- a/tools/mcp/tests/ops_show_layer_range.json +++ b/tools/mcp/tests/ops_show_layer_range.json @@ -8,7 +8,7 @@ // (fixtures/ops_undo.py). Every call it records is optional. Run it with // tools/mcp/orca_mcp.py run-replay tools/mcp/tests/ops_show_layer_range.json --out { - "orca_replay": 1, + "orca_replay_version": "0.1.0", "name": "ops show_layer_range", "vars": {"undo": "${replay_dir}/fixtures/ops_undo.py"}, "steps": [ diff --git a/tools/mcp/tests/ops_start_arrange.json b/tools/mcp/tests/ops_start_arrange.json index 72275d8f49..9524c67a29 100644 --- a/tools/mcp/tests/ops_start_arrange.json +++ b/tools/mcp/tests/ops_start_arrange.json @@ -6,7 +6,7 @@ // clients. Every call it records is optional. Run it with // tools/mcp/orca_mcp.py run-replay tools/mcp/tests/ops_start_arrange.json --out { - "orca_replay": 1, + "orca_replay_version": "0.1.0", "name": "ops start_arrange", "vars": {"undo": "${replay_dir}/fixtures/ops_undo.py"}, "steps": [ diff --git a/tools/mcp/tests/ops_start_slice.json b/tools/mcp/tests/ops_start_slice.json index aec65826ef..6a1e4f32ad 100644 --- a/tools/mcp/tests/ops_start_slice.json +++ b/tools/mcp/tests/ops_start_slice.json @@ -6,7 +6,7 @@ // it records is optional. Run it with // tools/mcp/orca_mcp.py run-replay tools/mcp/tests/ops_start_slice.json --out { - "orca_replay": 1, + "orca_replay_version": "0.1.0", "name": "ops start_slice", "vars": {"undo": "${replay_dir}/fixtures/ops_undo.py"}, "steps": [ diff --git a/tools/mcp/tests/plate_icons.json b/tools/mcp/tests/plate_icons.json index bf06ff986d..f8c6de3084 100644 --- a/tools/mcp/tests/plate_icons.json +++ b/tools/mcp/tests/plate_icons.json @@ -7,7 +7,7 @@ // refusals (an icon the plate does not show, a plate that does not exist, an open gizmo, the Preview) // can't be expected in a replay. { - "orca_replay": 1, + "orca_replay_version": "0.1.0", "name": "plate icons", "steps": [ {"tool": "wait", "args": {"for": "ready"}}, diff --git a/tools/mcp/tests/plates.json b/tools/mcp/tests/plates.json index 1951d8b1cb..0a1fbfae19 100644 --- a/tools/mcp/tests/plates.json +++ b/tools/mcp/tests/plates.json @@ -8,7 +8,7 @@ // default printer (Bambu Lab X1 Carbon) and reruns on the same datadir. Run it with // tools/mcp/orca_mcp.py run-replay tools/mcp/tests/plates.json --out /tmp/plates { - "orca_replay": 1, + "orca_replay_version": "0.1.0", "name": "plate settings and filament slots", "steps": [ {"tool": "wait", "args": {"for": "ready"}}, diff --git a/tools/mcp/tests/presets.json b/tools/mcp/tests/presets.json index 0a1df2ec53..54175d226e 100644 --- a/tools/mcp/tests/presets.json +++ b/tools/mcp/tests/presets.json @@ -13,7 +13,7 @@ // stay in the datadir, so the first save of each name passes overwrite and the replay reruns. Run it with // tools/mcp/orca_mcp.py run-replay tools/mcp/tests/presets.json --out /tmp/presets { - "orca_replay": 1, + "orca_replay_version": "0.1.0", "name": "save presets and drop edits", "steps": [ {"tool": "wait", "args": {"for": "ready"}}, diff --git a/tools/mcp/tests/preview.json b/tools/mcp/tests/preview.json index bf0c2f4565..59cf0d63b3 100644 --- a/tools/mcp/tests/preview.json +++ b/tools/mcp/tests/preview.json @@ -8,7 +8,7 @@ // tested in tests/slic3rutils/test_mcp_results.cpp, since a replay step cannot add values up, and a // refusal cannot be expected in a replay; tools/mcp/test_set_view_preview.py checks set_view's. { - "orca_replay": 1, + "orca_replay_version": "0.1.0", "name": "preview data", "steps": [ {"tool": "wait", "args": {"for": "ready"}}, diff --git a/tools/mcp/tests/recording.json b/tools/mcp/tests/recording.json index 44eeada239..7467aebdc0 100644 --- a/tools/mcp/tests/recording.json +++ b/tools/mcp/tests/recording.json @@ -4,7 +4,7 @@ // tools/mcp/orca_mcp.py run-replay tools/mcp/tests/recording.json --out /tmp/recording // The encode steps need an ffmpeg with libx265 (ORCA_FFMPEG or on PATH), so they are optional. { - "orca_replay": 1, + "orca_replay_version": "0.1.0", "name": "recording", "vars": {"model": "${replay_dir}/../../../resources/handy_models/OrcaCube_v2.drc"}, "steps": [ @@ -43,7 +43,7 @@ "expect": {"/codec": {"eq": "h265"}, "/encoder": {"eq": "libx265"}, "/seconds": {"gt": 1}, "/raw_video_file_deleted": {"eq": false}}}, // A recording a replay starts ends with that replay, its file closed when the replay's call returns. - {"tool": "run_replay", "args": {"replay": {"orca_replay": 1, "name": "inner", "steps": [ + {"tool": "run_replay", "args": {"replay": {"orca_replay_version": "0.1.0", "name": "inner", "steps": [ {"tool": "start_recording", "args": {"target": "canvas", "fps": 5, "save_path": "${out_dir}/inner.mkv", "overwrite": true}}, {"tool": "set_view", "args": {"camera": "iso"}}, {"tool": "mouse_gesture", "args": {"action": "drag", "x": 400, "y": 300, "to": [500, 340]}}]}}, diff --git a/tools/mcp/tests/rows.json b/tools/mcp/tests/rows.json index 9c8e40d90c..ed48e93c74 100644 --- a/tools/mcp/tests/rows.json +++ b/tools/mcp/tests/rows.json @@ -6,7 +6,7 @@ // Refusals (a bad column, a row without a checkbox, two rows a locator names) and checklist rows (the // Add Settings checklist is on no FFF menu) are unit tests in tests/slic3rutils/test_mcp_results.cpp. { - "orca_replay": 1, + "orca_replay_version": "0.1.0", "name": "rows and popups", "steps": [ {"tool": "wait", "args": {"for": "ready"}}, diff --git a/tools/mcp/tests/scene.json b/tools/mcp/tests/scene.json index 558a57c98b..2a3d5df222 100644 --- a/tools/mcp/tests/scene.json +++ b/tools/mcp/tests/scene.json @@ -6,7 +6,7 @@ // A refusal can't be asserted directly (a failed step stops the run), so each one is an optional // step followed by a check that nothing changed. { - "orca_replay": 1, + "orca_replay_version": "0.1.0", "name": "object structure and scene", "vars": {"cube": "${replay_dir}/../../../resources/handy_models/OrcaCube_v2.drc", "svg": "${replay_dir}/fixtures/star.svg"}, diff --git a/tools/mcp/tests/slice_stats.json b/tools/mcp/tests/slice_stats.json index 11c2b0fdcf..d928d200a1 100644 --- a/tools/mcp/tests/slice_stats.json +++ b/tools/mcp/tests/slice_stats.json @@ -6,7 +6,7 @@ // The sums (filament_g as the slots' g, a slot's g as its four uses) are unit tests in // tests/slic3rutils/test_mcp_results.cpp, since a replay step cannot add values up. { - "orca_replay": 1, + "orca_replay_version": "0.1.0", "name": "slice statistics", "steps": [ {"tool": "wait", "args": {"for": "ready"}}, diff --git a/tools/mcp/tests/web_dialogs.json b/tools/mcp/tests/web_dialogs.json index 221fa013c8..c5b519c2bc 100644 --- a/tools/mcp/tests/web_dialogs.json +++ b/tools/mcp/tests/web_dialogs.json @@ -6,7 +6,7 @@ // printer: // tools/mcp/orca_mcp.py run-replay tools/mcp/tests/web_dialogs.json --out /tmp/web_dialogs { - "orca_replay": 1, + "orca_replay_version": "0.1.0", "name": "web dialogs through the GUI tools", "steps": [ {"tool": "wait", "args": {"for": "ready"}},