#include "agent/manus.h" #include "logger.h" #include "prompt.h" #include "flow/flow_factory.h" #if defined (__unix__) || (defined (__APPLE__) && defined (__MACH__)) #include #include #elif defined (_WIN32) #define WIN32_LEAN_AND_MEAN #ifndef NOMINMAX #define NOMINMAX #endif #include #include #endif using namespace humanus; #if defined (__unix__) || (defined (__APPLE__) && defined (__MACH__)) || defined (_WIN32) static void sigint_handler(int signo) { if (signo == SIGINT) { logger->info("Received SIGINT, exiting..."); exit(0); } } #endif int main() { // ctrl+C handling { #if defined (__unix__) || (defined (__APPLE__) && defined (__MACH__)) struct sigaction sigint_action; sigint_action.sa_handler = sigint_handler; sigemptyset (&sigint_action.sa_mask); sigint_action.sa_flags = 0; sigaction(SIGINT, &sigint_action, NULL); #elif defined (_WIN32) auto console_ctrl_handler = +[](DWORD ctrl_type) -> BOOL { return (ctrl_type == CTRL_C_EVENT) ? (sigint_handler(SIGINT), true) : false; }; SetConsoleCtrlHandler(reinterpret_cast(console_ctrl_handler), true); #endif } // Manus agent = Manus(); // while (true) { // std::string prompt; // std::cout << "Enter your prompt (or 'exit' to quit): "; // std::getline(std::cin, prompt); // if (prompt == "exit") { // logger->info("Goodbye!"); // break; // } // logger->info("Processing your request..."); // agent.run(prompt); // } std::shared_ptr agent_ptr = std::make_shared(); std::map> agents; agents["default"] = agent_ptr; auto flow = FlowFactory::create_flow( FlowType::PLANNING, nullptr, // llm nullptr, // planning_tool std::vector{}, // executor_keys "", // active_plan_id agents, // agents std::vector>{}, // tools "default" // primary_agent_key ); while (true) { if (agent_ptr->current_step == agent_ptr->max_steps) { std::cout << "Program automatically paused after " << agent_ptr->current_step << " steps." << std::endl; std::cout << "Enter your prompt (like 'continue' to continue or 'exit' to quit): "; agent_ptr->current_step = 0; } else { std::cout << "Enter your prompt (or 'exit' to quit): "; } std::string prompt; std::getline(std::cin, prompt); if (prompt == "exit") { logger->info("Goodbye!"); break; } std::cout << "Processing your request..." << std::endl; auto result = flow->execute(prompt); std::cout << result << std::endl; } }