diff --git a/src/app/editor/agent/agent_chat_widget.cc b/src/app/editor/agent/agent_chat_widget.cc index c6be280f..63cd2c98 100644 --- a/src/app/editor/agent/agent_chat_widget.cc +++ b/src/app/editor/agent/agent_chat_widget.cc @@ -1058,6 +1058,7 @@ void AgentChatWidget::Draw() { ImGui::EndTable(); } + RenderAutomationPanel(); RenderCollaborationPanel(); RenderRomSyncPanel(); RenderProposalManagerPanel(); @@ -1485,6 +1486,122 @@ void AgentChatWidget::RenderMultimodalPanel() { } } +void AgentChatWidget::RenderAutomationPanel() { + const auto& theme = AgentUI::GetTheme(); + ImGui::PushID("AutomationPanel"); + + AgentUI::PushPanelStyle(); + if (ImGui::BeginChild("Automation_Panel", ImVec2(0, 180), true)) { + AgentUI::RenderSectionHeader(ICON_MD_SMART_TOY, "GUI Automation", + theme.provider_ollama); + + // Connection status + bool connected = automation_state_.harness_connected; + ImVec4 status_color = connected ? theme.status_success : theme.status_warning; + const char* status_text = connected ? "Connected" : "Disconnected"; + + ImGui::TextColored(status_color, "%s %s", + connected ? ICON_MD_CHECK_CIRCLE : ICON_MD_WARNING, + status_text); + ImGui::SameLine(); + + if (ImGui::SmallButton(ICON_MD_REFRESH " Refresh")) { + if (automation_callbacks_.show_active_tests) { + automation_callbacks_.show_active_tests(); + } + } + + if (ImGui::IsItemHovered()) { + ImGui::SetTooltip("Refresh automation status"); + } + + // Quick action buttons + ImGui::SameLine(); + if (ImGui::SmallButton(ICON_MD_DASHBOARD " Dashboard")) { + if (automation_callbacks_.open_harness_dashboard) { + automation_callbacks_.open_harness_dashboard(); + } + } + + ImGui::SameLine(); + if (ImGui::SmallButton(ICON_MD_REPLAY " Replay")) { + if (automation_callbacks_.replay_last_plan) { + automation_callbacks_.replay_last_plan(); + } + } + + if (ImGui::IsItemHovered()) { + ImGui::SetTooltip("Replay last automation plan"); + } + + // Recent automation actions + ImGui::Spacing(); + ImGui::Separator(); + ImGui::Text(ICON_MD_LIST " Recent Actions:"); + + if (automation_state_.recent_tests.empty()) { + ImGui::TextDisabled(" No recent actions"); + } else { + ImGui::BeginChild("ActionQueue", ImVec2(0, 80), false); + + for (const auto& test : automation_state_.recent_tests) { + ImGui::PushID(test.test_id.c_str()); + + // Status icon + ImVec4 action_color; + const char* status_icon; + + if (test.status == "success" || test.status == "completed") { + action_color = theme.status_success; + status_icon = ICON_MD_CHECK_CIRCLE; + } else if (test.status == "running" || test.status == "in_progress") { + action_color = theme.provider_ollama; + status_icon = ICON_MD_PENDING; + } else if (test.status == "failed" || test.status == "error") { + action_color = theme.status_error; + status_icon = ICON_MD_ERROR; + } else { + action_color = theme.text_secondary; + status_icon = ICON_MD_HELP; + } + + ImGui::TextColored(action_color, "%s", status_icon); + ImGui::SameLine(); + + // Action name + ImGui::Text("%s", test.name.c_str()); + + // Timestamp + if (test.updated_at != absl::InfinitePast()) { + ImGui::SameLine(); + auto elapsed = absl::Now() - test.updated_at; + if (elapsed < absl::Seconds(60)) { + ImGui::TextDisabled("(%ds ago)", static_cast(absl::ToInt64Seconds(elapsed))); + } else if (elapsed < absl::Minutes(60)) { + ImGui::TextDisabled("(%dm ago)", static_cast(absl::ToInt64Minutes(elapsed))); + } else { + ImGui::TextDisabled("(%dh ago)", static_cast(absl::ToInt64Hours(elapsed))); + } + } + + // Message (if any) + if (!test.message.empty()) { + ImGui::Indent(20.0f); + ImGui::TextWrapped(ICON_MD_MESSAGE " %s", test.message.c_str()); + ImGui::Unindent(20.0f); + } + + ImGui::PopID(); + } + + ImGui::EndChild(); + } + } + ImGui::EndChild(); + AgentUI::PopPanelStyle(); + ImGui::PopID(); +} + void AgentChatWidget::RefreshCollaboration() { if (!collaboration_callbacks_.refresh_session) { return; diff --git a/src/app/editor/agent/agent_chat_widget.h b/src/app/editor/agent/agent_chat_widget.h index 974fec07..60d16470 100644 --- a/src/app/editor/agent/agent_chat_widget.h +++ b/src/app/editor/agent/agent_chat_widget.h @@ -270,6 +270,7 @@ public: int new_total_proposals); void RenderCollaborationPanel(); void RenderMultimodalPanel(); + void RenderAutomationPanel(); void RenderAgentConfigPanel(); void RenderZ3EDCommandPanel(); void RenderRomSyncPanel(); diff --git a/src/cli/z3ed.cmake b/src/cli/z3ed.cmake index 01fa2cd9..b7c5de28 100644 --- a/src/cli/z3ed.cmake +++ b/src/cli/z3ed.cmake @@ -69,6 +69,10 @@ add_executable( cli/handlers/agent/test_commands.cc cli/handlers/agent/gui_commands.cc cli/handlers/agent/tool_commands.cc + cli/handlers/agent/gui_tool_commands.cc + cli/handlers/agent/dialogue_tool_commands.cc + cli/handlers/agent/music_tool_commands.cc + cli/handlers/agent/sprite_tool_commands.cc cli/flags.cc cli/tui/asar_patch.cc cli/tui/palette_editor.cc