From 5f2c72bfc75a22bc686d1f4291985fd3143629e9 Mon Sep 17 00:00:00 2001 From: scawful Date: Sat, 4 Oct 2025 17:02:13 -0400 Subject: [PATCH] feat: Enhance AgentChatWidget with multimodal capture modes and collaboration state management --- src/app/editor/editor_library.cmake | 11 +++++++++++ src/app/editor/system/agent_chat_widget.h | 18 +++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/app/editor/editor_library.cmake b/src/app/editor/editor_library.cmake index 4caed2d4..2a163327 100644 --- a/src/app/editor/editor_library.cmake +++ b/src/app/editor/editor_library.cmake @@ -92,6 +92,17 @@ target_link_libraries(yaze_editor PUBLIC ImGui ) +if(YAZE_WITH_JSON) + target_include_directories(yaze_editor PUBLIC + ${CMAKE_SOURCE_DIR}/third_party/json/include) + + if(TARGET nlohmann_json::nlohmann_json) + target_link_libraries(yaze_editor PUBLIC nlohmann_json::nlohmann_json) + endif() + + target_compile_definitions(yaze_editor PUBLIC YAZE_WITH_JSON) +endif() + # Conditionally link ImGui Test Engine if(YAZE_ENABLE_UI_TESTS AND TARGET ImGuiTestEngine) target_link_libraries(yaze_editor PUBLIC ImGuiTestEngine) diff --git a/src/app/editor/system/agent_chat_widget.h b/src/app/editor/system/agent_chat_widget.h index 3bbbc297..90895873 100644 --- a/src/app/editor/system/agent_chat_widget.h +++ b/src/app/editor/system/agent_chat_widget.h @@ -62,8 +62,13 @@ class AgentChatWidget { bool* active() { return &active_; } bool is_active() const { return active_; } void set_active(bool active) { active_ = active; } + + CaptureMode capture_mode() const { return multimodal_state_.capture_mode; } + const char* specific_window_name() const { + return multimodal_state_.specific_window_buffer; + } - private: +public: struct CollaborationState { bool active = false; std::string session_id; @@ -72,10 +77,18 @@ class AgentChatWidget { absl::Time last_synced = absl::InfinitePast(); }; + enum class CaptureMode { + kFullWindow = 0, + kActiveEditor = 1, + kSpecificWindow = 2 + }; + struct MultimodalState { std::optional last_capture_path; std::string status_message; absl::Time last_updated = absl::InfinitePast(); + CaptureMode capture_mode = CaptureMode::kActiveEditor; + char specific_window_buffer[128] = {}; }; void EnsureHistoryLoaded(); @@ -100,6 +113,7 @@ class AgentChatWidget { const CollaborationCallbacks::SessionContext& context, bool update_action_timestamp); void MarkHistoryDirty(); + void PollSharedHistory(); // For real-time collaboration sync cli::agent::ConversationalAgentService agent_service_; char input_buffer_[1024]; @@ -124,6 +138,8 @@ class AgentChatWidget { char join_code_buffer_[64] = {}; char multimodal_prompt_buffer_[256] = {}; absl::Time last_collaboration_action_ = absl::InfinitePast(); + absl::Time last_shared_history_poll_ = absl::InfinitePast(); + size_t last_known_history_size_ = 0; }; } // namespace editor