feat: Add collaboration features to AgentChatWidget and AgentCollaborationCoordinator

This commit is contained in:
scawful
2025-10-04 15:14:53 -04:00
parent 28dc394a7c
commit d699d1133d
12 changed files with 642 additions and 66 deletions

View File

@@ -4,8 +4,11 @@
#include <cstring>
#include <iostream>
#include <memory>
#include <set>
#include <sstream>
#include <stdexcept>
#include <string>
#include <vector>
#include "app/core/controller.h"
#include "app/core/platform/app_delegate.h"
@@ -13,21 +16,65 @@
#include "app/rom.h"
#include "app/zelda3/overworld/overworld.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.");
// Static variables for library state
static bool g_library_initialized = false;
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 == "DEBUG") return yaze::util::LogLevel::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__
@@ -39,12 +86,13 @@ int yaze_app_main(int argc, char** argv) {
while (controller->IsActive()) {
controller->OnInput();
if (auto status = controller->OnLoad(); !status.ok()) {
std::cerr << status.message() << std::endl;
LOG_ERROR("App", "Controller OnLoad failed: %s", status.message());
break;
}
controller->DoRender();
}
controller->OnExit();
LOG_INFO("App", "Yaze shutting down.");
return EXIT_SUCCESS;
}