#pragma once #include "runtime/Gallery_Runtime.hpp" #include #include #include #include #include #include namespace aethera::mcp { struct Gallery_Output { std::uint32_t width{720}; std::uint32_t height{420}; web::Gallery_Frame_Publisher publish{}; }; enum struct Tool_Call_Result : std::uint8_t { ok, unknown_tool, invalid_arguments, unknown_plot, rejected }; struct Tool_Call_Output { Tool_Call_Result result{Tool_Call_Result::ok}; /* 调用的已知业务结果。 */ nlohmann::json content{}; /* 成功值或结构化错误细节。 */ std::string message{}; /* 供协议适配器显示的简短说明。 */ }; struct Control_Service final { static std::shared_ptr create( Gallery_Output output = {}); ~Control_Service(); Control_Service(const Control_Service&) = delete; Control_Service& operator=(const Control_Service&) = delete; [[nodiscard]] bool contains_plot(std::string_view id) const noexcept; void submit_input(std::string_view id, Scene::Event_Pointer event); void request_frame(std::string_view id, Frame_Request request); void submit_publication_feedback( std::string_view id, Frame_Publication_Feedback feedback) noexcept; [[nodiscard]] nlohmann::json plot_schema(std::string_view id) const; [[nodiscard]] nlohmann::json write_plot_property( std::string_view id, std::string_view component, std::string_view key, const nlohmann::json& value); [[nodiscard]] nlohmann::json plot_component_state( std::string_view id, std::string_view component) const; [[nodiscard]] nlohmann::json generate_plot_data( std::string_view id, const nlohmann::json& input); [[nodiscard]] nlohmann::json plot_diagnostics(std::string_view id) const; void reset_plot_diagnostics(std::string_view id); void request_plot_taskflow_trace( std::string_view id, std::size_t frame_count); [[nodiscard]] nlohmann::json plot_taskflow_trace( std::string_view id) const; [[nodiscard]] nlohmann::json plot_catalog() const; [[nodiscard]] nlohmann::json tool_catalog() const; [[nodiscard]] Tool_Call_Output call_tool( std::string_view name, const nlohmann::json& arguments); private: explicit Control_Service(Gallery_Output output); struct Private; std::unique_ptr d; }; }