refactor: Remove app_main.cc as the application entry point

- Deleted app_main.cc to streamline the project structure, as it is no longer needed.
- Updated CMakeLists.txt to remove references to the deleted app_main.cc file, ensuring a clean build configuration.
This commit is contained in:
scawful
2025-10-05 14:54:19 -04:00
parent c6ba93fd33
commit c3f03472c1
5 changed files with 665 additions and 697 deletions

View File

@@ -482,11 +482,6 @@ if (YAZE_BUILD_LIB)
./yaze.cc ./yaze.cc
cli/service/gui/gui_automation_client.cc cli/service/gui/gui_automation_client.cc
) )
# Application main entry point (uses controller and full dependencies)
set(YAZE_APP_MAIN_SOURCES
./app_main.cc
)
if(YAZE_USE_MODULAR_BUILD) if(YAZE_USE_MODULAR_BUILD)
# Aggregate modular libraries into an interface target for backward compatibility # Aggregate modular libraries into an interface target for backward compatibility

View File

@@ -810,7 +810,7 @@ void AgentChatWidget::Draw() {
// Connection status bar at top (taller for better visibility) // Connection status bar at top (taller for better visibility)
ImDrawList* draw_list = ImGui::GetWindowDrawList(); ImDrawList* draw_list = ImGui::GetWindowDrawList();
ImVec2 bar_start = ImGui::GetCursorScreenPos(); ImVec2 bar_start = ImGui::GetCursorScreenPos();
ImVec2 bar_size(ImGui::GetContentRegionAvail().x, 90); // Increased from 55 ImVec2 bar_size(ImGui::GetContentRegionAvail().x, 60); // Increased from 55
// Gradient background // Gradient background
ImU32 color_top = ImGui::GetColorU32(ImVec4(0.18f, 0.22f, 0.28f, 1.0f)); ImU32 color_top = ImGui::GetColorU32(ImVec4(0.18f, 0.22f, 0.28f, 1.0f));
@@ -1046,8 +1046,17 @@ void AgentChatWidget::Draw() {
ImVec2(4, 3)); // Compact padding ImVec2(4, 3)); // Compact padding
// Removed RenderAgentConfigPanel - duplicates connection header // Removed RenderAgentConfigPanel - duplicates connection header
RenderZ3EDCommandPanel(); if (ImGui::BeginTable("##commands_and_multimodal", 2, ImGuiTableFlags_BordersInnerV)) {
RenderMultimodalPanel(); ImGui::TableSetupColumn("Commands", ImGuiTableColumnFlags_WidthFixed, 180);
ImGui::TableSetupColumn("Multimodal", ImGuiTableColumnFlags_WidthFixed, ImGui::GetContentRegionAvail().x - 180);
ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0);
RenderZ3EDCommandPanel();
ImGui::TableSetColumnIndex(1);
RenderMultimodalPanel();
ImGui::EndTable();
}
RenderCollaborationPanel(); RenderCollaborationPanel();
RenderRomSyncPanel(); RenderRomSyncPanel();
RenderProposalManagerPanel(); RenderProposalManagerPanel();
@@ -1068,6 +1077,10 @@ void AgentChatWidget::Draw() {
void AgentChatWidget::RenderCollaborationPanel() { void AgentChatWidget::RenderCollaborationPanel() {
ImGui::PushID("CollabPanel"); ImGui::PushID("CollabPanel");
// Tighter style for more content
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(4, 3));
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(3, 2));
// Update reactive status color // Update reactive status color
const bool connected = collaboration_state_.active; const bool connected = collaboration_state_.active;
collaboration_status_color_ = connected ? ImVec4(0.133f, 0.545f, 0.133f, 1.0f) collaboration_status_color_ = connected ? ImVec4(0.133f, 0.545f, 0.133f, 1.0f)
@@ -1075,13 +1088,10 @@ void AgentChatWidget::RenderCollaborationPanel() {
// Always visible (no collapsing header) // Always visible (no collapsing header)
ImGui::PushStyleColor(ImGuiCol_ChildBg, ImVec4(0.12f, 0.14f, 0.18f, 0.95f)); ImGui::PushStyleColor(ImGuiCol_ChildBg, ImVec4(0.12f, 0.14f, 0.18f, 0.95f));
ImGui::BeginChild("CollabPanel", ImVec2(0, 200), true); ImGui::BeginChild("CollabPanel", ImVec2(0, 140), true); // reduced height
ImGui::TextColored(ImVec4(1.0f, 0.843f, 0.0f, 1.0f), ICON_MD_PEOPLE " Collaboration"); ImGui::TextColored(ImVec4(1.0f, 0.843f, 0.0f, 1.0f), ICON_MD_PEOPLE " Collaboration");
ImGui::Separator(); ImGui::SameLine();
ImGui::TextColored(ImVec4(1.0f, 0.843f, 0.0f, 1.0f), ICON_MD_SETTINGS_ETHERNET " Mode:");
// Mode selector (compact inline)
ImGui::TextColored(ImVec4(1.0f, 0.843f, 0.0f, 1.0f),
ICON_MD_SETTINGS_ETHERNET " Mode:");
ImGui::SameLine(); ImGui::SameLine();
ImGui::RadioButton(ICON_MD_FOLDER " Local##collab_mode_local", ImGui::RadioButton(ICON_MD_FOLDER " Local##collab_mode_local",
reinterpret_cast<int*>(&collaboration_state_.mode), reinterpret_cast<int*>(&collaboration_state_.mode),
@@ -1091,13 +1101,11 @@ void AgentChatWidget::RenderCollaborationPanel() {
reinterpret_cast<int*>(&collaboration_state_.mode), reinterpret_cast<int*>(&collaboration_state_.mode),
static_cast<int>(CollaborationMode::kNetwork)); static_cast<int>(CollaborationMode::kNetwork));
ImGui::Spacing();
// Main content in table layout (fixed size to prevent auto-resize) // Main content in table layout (fixed size to prevent auto-resize)
if (ImGui::BeginTable("Collab_MainTable", 2, ImGuiTableFlags_BordersInnerV)) { if (ImGui::BeginTable("Collab_MainTable", 2, ImGuiTableFlags_BordersInnerV)) {
ImGui::TableSetupColumn("Status", ImGuiTableColumnFlags_WidthFixed, 180); ImGui::TableSetupColumn("Status", ImGuiTableColumnFlags_WidthFixed, 150);
ImGui::TableSetupColumn("Controls", ImGuiTableColumnFlags_WidthFixed, ImGui::TableSetupColumn("Controls", ImGuiTableColumnFlags_WidthFixed,
ImGui::GetContentRegionAvail().x - 180); ImGui::GetContentRegionAvail().x - 150);
ImGui::TableNextRow(); ImGui::TableNextRow();
// LEFT COLUMN: Session Details // LEFT COLUMN: Session Details
@@ -1106,10 +1114,9 @@ void AgentChatWidget::RenderCollaborationPanel() {
ImGui::PushID("StatusColumn"); ImGui::PushID("StatusColumn");
ImGui::PushStyleColor(ImGuiCol_ChildBg, ImVec4(0.15f, 0.2f, 0.18f, 0.4f)); ImGui::PushStyleColor(ImGuiCol_ChildBg, ImVec4(0.15f, 0.2f, 0.18f, 0.4f));
ImGui::BeginChild("Collab_SessionDetails", ImVec2(0, 80), true); ImGui::BeginChild("Collab_SessionDetails", ImVec2(0, 60), true); // reduced height
ImGui::TextColored(ImVec4(1.0f, 0.843f, 0.0f, 1.0f), ImGui::TextColored(ImVec4(1.0f, 0.843f, 0.0f, 1.0f),
ICON_MD_INFO " Session Status:"); ICON_MD_INFO " Session:");
ImGui::Spacing();
if (connected) { if (connected) {
ImGui::TextColored(collaboration_status_color_, ImGui::TextColored(collaboration_status_color_,
ICON_MD_CHECK_CIRCLE " Connected"); ICON_MD_CHECK_CIRCLE " Connected");
@@ -1118,70 +1125,53 @@ void AgentChatWidget::RenderCollaborationPanel() {
} }
if (collaboration_state_.mode == CollaborationMode::kNetwork) { if (collaboration_state_.mode == CollaborationMode::kNetwork) {
ImGui::Spacing();
ImGui::TextColored(ImVec4(0.196f, 0.6f, 0.8f, 1.0f), ImGui::TextColored(ImVec4(0.196f, 0.6f, 0.8f, 1.0f),
ICON_MD_CLOUD " Server:"); ICON_MD_CLOUD " Server:");
ImGui::TextWrapped("%s", collaboration_state_.server_url.c_str()); ImGui::TextUnformatted(collaboration_state_.server_url.c_str());
} }
if (!collaboration_state_.session_name.empty()) { if (!collaboration_state_.session_name.empty()) {
ImGui::Spacing();
ImGui::TextColored(collaboration_status_color_, ImGui::TextColored(collaboration_status_color_,
ICON_MD_LABEL " Session:"); ICON_MD_LABEL " %s", collaboration_state_.session_name.c_str());
ImGui::TextWrapped("%s", collaboration_state_.session_name.c_str());
} }
if (!collaboration_state_.session_id.empty()) { if (!collaboration_state_.session_id.empty()) {
ImGui::Spacing();
ImGui::TextColored(collaboration_status_color_, ImGui::TextColored(collaboration_status_color_,
ICON_MD_KEY " Session Code:"); ICON_MD_KEY " %s", collaboration_state_.session_id.c_str());
ImGui::TextWrapped("%s", collaboration_state_.session_id.c_str()); ImGui::SameLine();
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.4f, 0.4f, 0.6f, 0.6f)); ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.4f, 0.4f, 0.6f, 0.6f));
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImGui::PushStyleColor(ImGuiCol_ButtonHovered,
ImVec4(0.416f, 0.353f, 0.804f, 1.0f)); ImVec4(0.416f, 0.353f, 0.804f, 1.0f));
if (ImGui::Button(ICON_MD_CONTENT_COPY " Copy##copy_session_id")) { if (ImGui::SmallButton(ICON_MD_CONTENT_COPY "##copy_session_id")) {
ImGui::SetClipboardText(collaboration_state_.session_id.c_str()); ImGui::SetClipboardText(collaboration_state_.session_id.c_str());
if (toast_manager_) { if (toast_manager_) {
toast_manager_->Show("Session code copied!", ToastType::kSuccess, toast_manager_->Show("Session code copied!", ToastType::kSuccess, 2.0f);
2.0f);
} }
} }
ImGui::PopStyleColor(2); ImGui::PopStyleColor(2);
} }
if (collaboration_state_.last_synced != absl::InfinitePast()) { if (collaboration_state_.last_synced != absl::InfinitePast()) {
ImGui::Spacing();
ImGui::TextColored(ImVec4(0.6f, 0.6f, 0.6f, 1.0f), ImGui::TextColored(ImVec4(0.6f, 0.6f, 0.6f, 1.0f),
ICON_MD_ACCESS_TIME " Last sync:"); ICON_MD_ACCESS_TIME " %s",
ImGui::SameLine(); absl::FormatTime("%H:%M:%S", collaboration_state_.last_synced,
ImGui::TextColored( absl::LocalTimeZone()).c_str());
ImVec4(0.5f, 0.5f, 0.5f, 1.0f), "%s",
absl::FormatTime("%H:%M:%S", collaboration_state_.last_synced,
absl::LocalTimeZone())
.c_str());
} }
ImGui::EndChild(); ImGui::EndChild();
ImGui::PopStyleColor(); ImGui::PopStyleColor();
ImGui::Spacing();
// Participants list below session details // Participants list below session details
ImGui::PushStyleColor(ImGuiCol_ChildBg, ImVec4(0.12f, 0.16f, 0.14f, 0.4f)); ImGui::PushStyleColor(ImGuiCol_ChildBg, ImVec4(0.12f, 0.16f, 0.14f, 0.4f));
ImGui::BeginChild("Collab_ParticipantsList", ImVec2(0, 0), true); ImGui::BeginChild("Collab_ParticipantsList", ImVec2(0, 0), true);
{ if (collaboration_state_.participants.empty()) {
if (collaboration_state_.participants.empty()) { ImGui::TextDisabled(ICON_MD_PEOPLE " No participants");
ImGui::TextDisabled(ICON_MD_PEOPLE " No participants yet"); } else {
} else { ImGui::TextColored(collaboration_status_color_,
ImGui::TextColored(collaboration_status_color_, ICON_MD_PEOPLE " %zu", collaboration_state_.participants.size());
ICON_MD_PEOPLE " Participants (%zu):", for (size_t i = 0; i < collaboration_state_.participants.size(); ++i) {
collaboration_state_.participants.size()); ImGui::PushID(static_cast<int>(i));
ImGui::Separator(); ImGui::BulletText("%s", collaboration_state_.participants[i].c_str());
for (size_t i = 0; i < collaboration_state_.participants.size(); ++i) { ImGui::PopID();
ImGui::PushID(static_cast<int>(i));
ImGui::BulletText(ICON_MD_PERSON " %s",
collaboration_state_.participants[i].c_str());
ImGui::PopID();
}
} }
} }
ImGui::EndChild(); ImGui::EndChild();
@@ -1196,8 +1186,6 @@ void AgentChatWidget::RenderCollaborationPanel() {
ImGui::PushID("ControlsColumn"); ImGui::PushID("ControlsColumn");
ImGui::BeginChild("Collab_Controls", ImVec2(0, 0), false); ImGui::BeginChild("Collab_Controls", ImVec2(0, 0), false);
ImGui::Separator();
const bool can_host = const bool can_host =
static_cast<bool>(collaboration_callbacks_.host_session); static_cast<bool>(collaboration_callbacks_.host_session);
const bool can_join = const bool can_join =
@@ -1209,67 +1197,52 @@ void AgentChatWidget::RenderCollaborationPanel() {
// Network mode: Show server URL input with styling // Network mode: Show server URL input with styling
if (collaboration_state_.mode == CollaborationMode::kNetwork) { if (collaboration_state_.mode == CollaborationMode::kNetwork) {
ImGui::TextColored(ImVec4(0.196f, 0.6f, 0.8f, 1.0f), ImGui::TextColored(ImVec4(0.196f, 0.6f, 0.8f, 1.0f), ICON_MD_CLOUD);
ICON_MD_CLOUD " Server URL:"); ImGui::SameLine();
ImGui::SetNextItemWidth(-80); ImGui::SetNextItemWidth(100);
ImGui::InputText("##collab_server_url", server_url_buffer_, ImGui::InputText("##collab_server_url", server_url_buffer_, IM_ARRAYSIZE(server_url_buffer_));
IM_ARRAYSIZE(server_url_buffer_));
ImGui::SameLine(); ImGui::SameLine();
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.15f, 0.5f, 0.7f, 0.8f)); ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.15f, 0.5f, 0.7f, 0.8f));
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(0.196f, 0.6f, 0.8f, 1.0f));
ImVec4(0.196f, 0.6f, 0.8f, 1.0f)); if (ImGui::SmallButton(ICON_MD_LINK "##connect_server_btn")) {
if (ImGui::Button(ICON_MD_LINK "##connect_server_btn")) {
collaboration_state_.server_url = server_url_buffer_; collaboration_state_.server_url = server_url_buffer_;
if (toast_manager_) { if (toast_manager_) {
toast_manager_->Show("Connecting to server...", ToastType::kInfo, toast_manager_->Show("Connecting to server...", ToastType::kInfo, 3.0f);
3.0f);
} }
} }
ImGui::PopStyleColor(2); ImGui::PopStyleColor(2);
if (ImGui::IsItemHovered()) { if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("Connect to collaboration server"); ImGui::SetTooltip("Connect to collaboration server");
} }
ImGui::Separator();
} }
ImGui::TextColored(ImVec4(1.0f, 0.843f, 0.0f, 1.0f), // Host session
ICON_MD_ADD_CIRCLE " Host New Session:"); ImGui::TextColored(ImVec4(1.0f, 0.843f, 0.0f, 1.0f), ICON_MD_ADD_CIRCLE);
ImGui::SetNextItemWidth(-70);
ImGui::InputTextWithHint("##collab_session_name", "Enter session name...",
session_name_buffer_,
IM_ARRAYSIZE(session_name_buffer_));
ImGui::SameLine(); ImGui::SameLine();
if (!can_host) ImGui::SetNextItemWidth(100);
ImGui::BeginDisabled(); ImGui::InputTextWithHint("##collab_session_name", "Session name...", session_name_buffer_, IM_ARRAYSIZE(session_name_buffer_));
ImGui::SameLine();
if (!can_host) ImGui::BeginDisabled();
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.6f, 0.5f, 0.0f, 0.8f)); ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.6f, 0.5f, 0.0f, 0.8f));
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(1.0f, 0.843f, 0.0f, 1.0f));
ImVec4(1.0f, 0.843f, 0.0f, 1.0f)); if (ImGui::SmallButton(ICON_MD_ROCKET_LAUNCH "##host_session_btn")) {
if (ImGui::Button(ICON_MD_ROCKET_LAUNCH "##host_session_btn")) {
std::string name = session_name_buffer_; std::string name = session_name_buffer_;
if (name.empty()) { if (name.empty()) {
if (toast_manager_) { if (toast_manager_) {
toast_manager_->Show("Enter a session name first", toast_manager_->Show("Enter a session name first", ToastType::kWarning, 3.0f);
ToastType::kWarning, 3.0f);
} }
} else { } else {
auto session_or = collaboration_callbacks_.host_session(name); auto session_or = collaboration_callbacks_.host_session(name);
if (session_or.ok()) { if (session_or.ok()) {
ApplyCollaborationSession(session_or.value(), ApplyCollaborationSession(session_or.value(), /*update_action_timestamp=*/true);
/*update_action_timestamp=*/true); std::snprintf(join_code_buffer_, sizeof(join_code_buffer_), "%s", collaboration_state_.session_id.c_str());
std::snprintf(join_code_buffer_, sizeof(join_code_buffer_), "%s",
collaboration_state_.session_id.c_str());
session_name_buffer_[0] = '\0'; session_name_buffer_[0] = '\0';
if (toast_manager_) { if (toast_manager_) {
toast_manager_->Show( toast_manager_->Show(absl::StrFormat("Hosting session %s", collaboration_state_.session_id.c_str()), ToastType::kSuccess, 3.5f);
absl::StrFormat("Hosting session %s",
collaboration_state_.session_id.c_str()),
ToastType::kSuccess, 3.5f);
} }
MarkHistoryDirty(); MarkHistoryDirty();
} else if (toast_manager_) { } else if (toast_manager_) {
toast_manager_->Show(absl::StrFormat("Failed to host: %s", toast_manager_->Show(absl::StrFormat("Failed to host: %s", session_or.status().message()), ToastType::kError, 5.0f);
session_or.status().message()),
ToastType::kError, 5.0f);
} }
} }
} }
@@ -1283,44 +1256,32 @@ void AgentChatWidget::RenderCollaborationPanel() {
ImGui::SetTooltip("Host a new collaboration session"); ImGui::SetTooltip("Host a new collaboration session");
} }
ImGui::Spacing(); // Join session
ImGui::TextColored(ImVec4(0.133f, 0.545f, 0.133f, 1.0f), ImGui::TextColored(ImVec4(0.133f, 0.545f, 0.133f, 1.0f), ICON_MD_LOGIN);
ICON_MD_LOGIN " Join Existing Session:");
ImGui::SetNextItemWidth(-70);
ImGui::InputTextWithHint("##collab_join_code", "Enter session code...",
join_code_buffer_,
IM_ARRAYSIZE(join_code_buffer_));
ImGui::SameLine(); ImGui::SameLine();
if (!can_join) ImGui::SetNextItemWidth(100);
ImGui::BeginDisabled(); ImGui::InputTextWithHint("##collab_join_code", "Session code...", join_code_buffer_, IM_ARRAYSIZE(join_code_buffer_));
ImGui::SameLine();
if (!can_join) ImGui::BeginDisabled();
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.1f, 0.4f, 0.1f, 0.8f)); ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.1f, 0.4f, 0.1f, 0.8f));
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(0.133f, 0.545f, 0.133f, 1.0f));
ImVec4(0.133f, 0.545f, 0.133f, 1.0f)); if (ImGui::SmallButton(ICON_MD_MEETING_ROOM "##join_session_btn")) {
if (ImGui::Button(ICON_MD_MEETING_ROOM "##join_session_btn")) {
std::string code = join_code_buffer_; std::string code = join_code_buffer_;
if (code.empty()) { if (code.empty()) {
if (toast_manager_) { if (toast_manager_) {
toast_manager_->Show("Enter a session code first", toast_manager_->Show("Enter a session code first", ToastType::kWarning, 3.0f);
ToastType::kWarning, 3.0f);
} }
} else { } else {
auto session_or = collaboration_callbacks_.join_session(code); auto session_or = collaboration_callbacks_.join_session(code);
if (session_or.ok()) { if (session_or.ok()) {
ApplyCollaborationSession(session_or.value(), ApplyCollaborationSession(session_or.value(), /*update_action_timestamp=*/true);
/*update_action_timestamp=*/true); std::snprintf(join_code_buffer_, sizeof(join_code_buffer_), "%s", collaboration_state_.session_id.c_str());
std::snprintf(join_code_buffer_, sizeof(join_code_buffer_), "%s",
collaboration_state_.session_id.c_str());
if (toast_manager_) { if (toast_manager_) {
toast_manager_->Show( toast_manager_->Show(absl::StrFormat("Joined session %s", collaboration_state_.session_id.c_str()), ToastType::kSuccess, 3.5f);
absl::StrFormat("Joined session %s",
collaboration_state_.session_id.c_str()),
ToastType::kSuccess, 3.5f);
} }
MarkHistoryDirty(); MarkHistoryDirty();
} else if (toast_manager_) { } else if (toast_manager_) {
toast_manager_->Show(absl::StrFormat("Failed to join: %s", toast_manager_->Show(absl::StrFormat("Failed to join: %s", session_or.status().message()), ToastType::kError, 5.0f);
session_or.status().message()),
ToastType::kError, 5.0f);
} }
} }
} }
@@ -1334,17 +1295,12 @@ void AgentChatWidget::RenderCollaborationPanel() {
ImGui::SetTooltip("Join an existing collaboration session"); ImGui::SetTooltip("Join an existing collaboration session");
} }
// Leave/Refresh
if (collaboration_state_.active) { if (collaboration_state_.active) {
ImGui::Separator(); if (!can_leave) ImGui::BeginDisabled();
ImGui::Spacing();
if (!can_leave)
ImGui::BeginDisabled();
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.7f, 0.2f, 0.2f, 0.8f)); ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.7f, 0.2f, 0.2f, 0.8f));
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(0.863f, 0.078f, 0.235f, 1.0f));
ImVec4(0.863f, 0.078f, 0.235f, 1.0f)); if (ImGui::SmallButton(ICON_MD_LOGOUT "##leave_session_btn")) {
if (ImGui::Button(ICON_MD_LOGOUT " Leave Session##leave_session_btn",
ImVec2(-1, 0))) {
absl::Status status = collaboration_callbacks_.leave_session absl::Status status = collaboration_callbacks_.leave_session
? collaboration_callbacks_.leave_session() ? collaboration_callbacks_.leave_session()
: absl::OkStatus(); : absl::OkStatus();
@@ -1352,42 +1308,30 @@ void AgentChatWidget::RenderCollaborationPanel() {
collaboration_state_ = CollaborationState{}; collaboration_state_ = CollaborationState{};
join_code_buffer_[0] = '\0'; join_code_buffer_[0] = '\0';
if (toast_manager_) { if (toast_manager_) {
toast_manager_->Show("Left collaborative session", ToastType::kInfo, toast_manager_->Show("Left collaborative session", ToastType::kInfo, 3.0f);
3.0f);
} }
MarkHistoryDirty(); MarkHistoryDirty();
} else if (toast_manager_) { } else if (toast_manager_) {
toast_manager_->Show( toast_manager_->Show(absl::StrFormat("Failed to leave: %s", status.message()), ToastType::kError, 5.0f);
absl::StrFormat("Failed to leave: %s", status.message()),
ToastType::kError, 5.0f);
} }
} }
ImGui::PopStyleColor(2); ImGui::PopStyleColor(2);
if (!can_leave) if (!can_leave) ImGui::EndDisabled();
ImGui::EndDisabled();
ImGui::Spacing(); ImGui::SameLine();
ImGui::Separator(); if (!can_refresh) ImGui::BeginDisabled();
if (!can_refresh)
ImGui::BeginDisabled();
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.4f, 0.4f, 0.6f, 0.8f)); ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.4f, 0.4f, 0.6f, 0.8f));
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(0.416f, 0.353f, 0.804f, 1.0f));
ImVec4(0.416f, 0.353f, 0.804f, 1.0f)); if (ImGui::SmallButton(ICON_MD_REFRESH "##refresh_collab_btn")) {
if (ImGui::Button(ICON_MD_REFRESH " Refresh Session##refresh_collab_btn",
ImVec2(-1, 0))) {
RefreshCollaboration(); RefreshCollaboration();
} }
ImGui::PopStyleColor(2); ImGui::PopStyleColor(2);
if (!can_refresh && if (!can_refresh && ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled)) {
ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled)) {
ImGui::SetTooltip("Provide refresh_session callback to enable"); ImGui::SetTooltip("Provide refresh_session callback to enable");
} }
if (!can_refresh) if (!can_refresh) ImGui::EndDisabled();
ImGui::EndDisabled();
} else { } else {
ImGui::Spacing(); ImGui::TextDisabled(ICON_MD_INFO " Start or join a session to collaborate.");
ImGui::TextDisabled(ICON_MD_INFO
" Start or join a session to collaborate.");
} }
ImGui::EndChild(); // Collab_Controls ImGui::EndChild(); // Collab_Controls
@@ -1398,6 +1342,7 @@ void AgentChatWidget::RenderCollaborationPanel() {
ImGui::EndChild(); ImGui::EndChild();
ImGui::PopStyleColor(); ImGui::PopStyleColor();
ImGui::PopStyleVar(2);
ImGui::PopID(); // CollabPanel ImGui::PopID(); // CollabPanel
} }
@@ -1810,7 +1755,7 @@ void AgentChatWidget::RenderZ3EDCommandPanel() {
void AgentChatWidget::RenderRomSyncPanel() { void AgentChatWidget::RenderRomSyncPanel() {
ImGui::PushStyleColor(ImGuiCol_ChildBg, ImVec4(0.18f, 0.14f, 0.12f, 1.0f)); ImGui::PushStyleColor(ImGuiCol_ChildBg, ImVec4(0.18f, 0.14f, 0.12f, 1.0f));
ImGui::BeginChild("RomSync", ImVec2(0, 200), true); ImGui::BeginChild("RomSync", ImVec2(0, 100), true);
ImGui::Text(ICON_MD_STORAGE " ROM State"); ImGui::Text(ICON_MD_STORAGE " ROM State");
ImGui::Separator(); ImGui::Separator();

File diff suppressed because it is too large Load Diff

View File

@@ -1,89 +0,0 @@
// Application entry point - separated from C API implementation
#include "yaze.h"
#include <algorithm>
#include <iostream>
#include <memory>
#include <set>
#include <sstream>
#include <string>
#include "app/core/controller.h"
#include "app/core/platform/app_delegate.h"
#include "util/flag.h"
#include "util/log.h"
#include "yaze_config.h"
DEFINE_FLAG(std::string, rom_file, "",
"Path to the ROM file to load. "
"If not specified, the app will run without a ROM.");
DEFINE_FLAG(
std::string, log_level, "info",
"Minimum log level to output (e.g., debug, info, warn, error, fatal).");
DEFINE_FLAG(std::string, log_file, "",
"Path to the log file. If empty, logs to stderr.");
DEFINE_FLAG(std::string, log_categories, "",
"Comma-separated list of log categories to enable.");
int yaze_app_main(int argc, char** argv) {
yaze::util::FlagParser parser(yaze::util::global_flag_registry());
RETURN_IF_EXCEPTION(parser.Parse(argc, argv));
// --- Configure Logging System ---
auto string_to_log_level = [](const std::string& s) {
std::string upper_s;
std::transform(s.begin(), s.end(), std::back_inserter(upper_s),
::toupper);
if (upper_s == "YAZE_DEBUG") return yaze::util::LogLevel::YAZE_DEBUG;
if (upper_s == "INFO") return yaze::util::LogLevel::INFO;
if (upper_s == "WARN" || upper_s == "WARNING")
return yaze::util::LogLevel::WARNING;
if (upper_s == "ERROR") return yaze::util::LogLevel::ERROR;
if (upper_s == "FATAL") return yaze::util::LogLevel::FATAL;
return yaze::util::LogLevel::INFO; // Default
};
auto split_categories = [](const std::string& s) {
std::set<std::string> result;
std::stringstream ss(s);
std::string item;
while (std::getline(ss, item, ',')) {
if (!item.empty()) {
result.insert(item);
}
}
return result;
};
yaze::util::LogManager::instance().configure(
string_to_log_level(FLAGS_log_level->Get()), FLAGS_log_file->Get(),
split_categories(FLAGS_log_categories->Get()));
LOG_INFO("App", "Yaze starting up...");
LOG_INFO("App", "Version: %s", YAZE_VERSION_STRING);
std::string rom_filename = "";
if (!FLAGS_rom_file->Get().empty()) {
rom_filename = FLAGS_rom_file->Get();
LOG_INFO("App", "Loading ROM file: %s", rom_filename);
}
#ifdef __APPLE__
return yaze_run_cocoa_app_delegate(rom_filename.c_str());
#endif
auto controller = std::make_unique<yaze::core::Controller>();
EXIT_IF_ERROR(controller->OnEntry(rom_filename))
while (controller->IsActive()) {
controller->OnInput();
if (auto status = controller->OnLoad(); !status.ok()) {
LOG_ERROR("App", "Controller OnLoad failed: %s", status.message());
break;
}
controller->DoRender();
}
controller->OnExit();
LOG_INFO("App", "Yaze shutting down.");
return EXIT_SUCCESS;
}

View File

@@ -120,10 +120,22 @@ absl::StatusOr<std::string> PromptBuilder::ResolveCataloguePath(
for (const auto& candidate : search_paths) { for (const auto& candidate : search_paths) {
fs::path resolved = candidate; fs::path resolved = candidate;
if (resolved.is_relative()) { if (resolved.is_relative()) {
resolved = fs::absolute(resolved); try {
resolved = fs::absolute(resolved);
} catch (const std::exception& e) {
// If we can't resolve the absolute path (e.g., cwd doesn't exist),
// just try the relative path as-is
continue;
}
} }
if (fs::exists(resolved)) {
return resolved.string(); try {
if (fs::exists(resolved)) {
return resolved.string();
}
} catch (const std::exception& e) {
// If checking existence fails, just continue to next path
continue;
} }
} }