From 0bab5c97c74f2d4651a8b72c3da092f12c65389b Mon Sep 17 00:00:00 2001 From: Egutierrez Date: Sun, 10 May 2026 13:30:27 +0200 Subject: [PATCH] chore: auto-commit (5 archivos) - CMakeLists.txt - agent.cpp - agent.h - gx-cli - main.cpp Co-Authored-By: Claude Opus 4.7 (1M context) --- CMakeLists.txt | 2 +- chat.cpp => agent.cpp | 16 ++++++++-------- chat.h => agent.h | 4 ++-- gx-cli | 4 ++-- main.cpp | 14 +++++++------- 5 files changed, 20 insertions(+), 20 deletions(-) rename chat.cpp => agent.cpp (99%) rename chat.h => agent.h (98%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 26d27fe..f7f6c0b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,7 +26,7 @@ add_imgui_app(graph_explorer node_groups.cpp jobs.cpp enrichers.cpp - chat.cpp + agent.cpp extract_panel.cpp # --- viz --- ${FN_CPP_ROOT_DIR}/functions/viz/graph_renderer.cpp diff --git a/chat.cpp b/agent.cpp similarity index 99% rename from chat.cpp rename to agent.cpp index 1e6cac3..3ef4d1c 100644 --- a/chat.cpp +++ b/agent.cpp @@ -1,4 +1,4 @@ -#include "chat.h" +#include "agent.h" #include "app_base.h" #include "imgui.h" @@ -40,7 +40,7 @@ #include #endif -namespace ge { +namespace app_agent { // ---------------------------------------------------------------------------- // Logger con tags @@ -697,7 +697,7 @@ void on_stream_line(const std::string& line) { std::string build_system_prompt() { return - "Eres Echo — copiloto OSINT del usuario sobre la operations.db\n" + "Eres el Agente — copiloto OSINT del usuario sobre la operations.db\n" "abierta en graph_explorer. Tu trabajo es explorar, investigar y\n" "conectar piezas. El usuario VE el grafo en pantalla; tu lo\n" "modificas y razonas sobre el.\n\n" @@ -730,7 +730,7 @@ std::string build_system_prompt() { " que sugerencias de proximo paso, hallazgos no obvios.\n\n" "Tu objetivo: ser un copiloto util para investigacion OSINT, no un\n" "ejecutor mecanico. Propon, conecta, descubre patrones. Firmas\n" - "como Echo cuando tenga sentido marcar identidad."; + "como Agente cuando tenga sentido marcar identidad."; } // Convierte un path Windows (UNC \\wsl.localhost\\... o C:\...) al @@ -1018,7 +1018,7 @@ bool chat_init(const char* ops_db_path, const char* app_db_path, // strip ".db" / sustituir extension size_t slash = p.find_last_of("/\\"); size_t dir_end = (slash == std::string::npos) ? 0 : slash + 1; - g_log_path = p.substr(0, dir_end) + "chat.log"; + g_log_path = p.substr(0, dir_end) + "agent.log"; // arranca con un separador para distinguir sesiones FILE* f = std::fopen(g_log_path.c_str(), "ab"); if (f) { @@ -1126,7 +1126,7 @@ void chat_render(bool* panel_open) { if (!g_st) return; if (panel_open && !*panel_open) return; - if (!ImGui::Begin(TI_MESSAGE_CIRCLE " Echo", panel_open)) { + if (!ImGui::Begin(TI_MESSAGE_CIRCLE " Agent", panel_open)) { ImGui::End(); return; } @@ -1157,7 +1157,7 @@ void chat_render(bool* panel_open) { break; case ChatMessage::ASSISTANT: ImGui::TextColored(ImVec4(0.7f, 0.9f, 0.7f, 1.0f), - TI_ROBOT " Echo"); + TI_ROBOT " Agent"); fn_ui::selectable_text_wrapped_force(m.text.c_str()); break; case ChatMessage::TOOL_USE: @@ -1238,4 +1238,4 @@ void chat_shutdown() { g_st = nullptr; } -} // namespace ge +} // namespace app_agent diff --git a/chat.h b/agent.h similarity index 98% rename from chat.h rename to agent.h index a759c0d..aef1a1f 100644 --- a/chat.h +++ b/agent.h @@ -9,7 +9,7 @@ // fragmentos al historial. gx-cli muta operations.db; el contador // agent_mutations en graph_explorer.db dispara reload del viewport. -namespace ge { +namespace app_agent { // Inicia el subprocess claude -p (lazy: hasta el primer mensaje no se // arranca). Setea env vars GX_OPS_DB / GX_APP_DB / GX_APP_DIR. Devuelve @@ -62,4 +62,4 @@ void chat_log(const char* tag, const char* fmt, ...); // Devuelve el path absoluto del fichero de log (vacio si no inicializado). const char* chat_log_path(); -} // namespace ge +} // namespace app_agent diff --git a/gx-cli b/gx-cli index 6855f12..f3ecb29 100755 --- a/gx-cli +++ b/gx-cli @@ -62,7 +62,7 @@ def _app_db() -> str: def _log(tag: str, msg: str) -> None: """Log a stderr y al fichero gx-cli.log junto a app_db (mismo dir que chat.log y .mutations.marker). El fichero permite auditar lo - que el agente Echo hace cuando algo va mal — `_emit` solo va al + que el agente hace cuando algo va mal — `_emit` solo va al stdout de la herramienta y se pierde en pipelines MCP.""" line = f"[gx-cli {tag}] {msg}\n" sys.stderr.write(line) @@ -609,7 +609,7 @@ def cmd_group_page(args) -> None: Espejea exactamente la query del loader C++ `node_groups_page_for_group` para que los tests pytest verifiquen el contrato SQL (mismo orden de filas, mismas columnas) sin depender - del binario. Util tambien como tool MCP para que el agente Echo + del binario. Util tambien como tool MCP para que el agente inspeccione el contenido de un Group sin abrir la app. """ cn = _connect(_ops_db(), readonly=True) diff --git a/main.cpp b/main.cpp index 9cc8c11..402920d 100644 --- a/main.cpp +++ b/main.cpp @@ -29,7 +29,7 @@ #include "project_manager.h" #include "jobs.h" #include "enrichers.h" -#include "chat.h" +#include "agent.h" #include "extract_panel.h" #include "../../../../cpp/vendor/sqlite3/sqlite3.h" @@ -725,7 +725,7 @@ static bool load_input(bool first_load) { // issue 0026 — apunta el JobRunner a la nueva operations.db. if (g_input.uri) ge::jobs_set_ops_db(g_input.uri); // Chat agent — refrescar contexto de la nueva operations.db. - if (g_input.uri) ge::chat_set_ops_db(g_input.uri); + if (g_input.uri) app_agent::chat_set_ops_db(g_input.uri); // Cargar posiciones guardadas para este graph_hash. Ahora ANTES del // bootstrap circular: si tenemos posiciones guardadas las respetamos; @@ -1351,12 +1351,12 @@ static void render() { static int s_throttle = 0; if (++s_throttle >= 8) { s_throttle = 0; - int m = ge::chat_mutations_counter(); + int m = app_agent::chat_mutations_counter(); if (s_last_mut == -1) { // Primera lectura: solo memorizar, sin disparar reload. s_last_mut = m; } else if (m != s_last_mut) { - ge::chat_log("mut", + app_agent::chat_log("mut", "marker mtime cambio %d -> %d, disparando reload", s_last_mut, m); s_last_mut = m; @@ -2178,7 +2178,7 @@ static void render() { ImGui::SetNextWindowPos (ImVec2(vp->WorkPos.x + W * 0.55f, top + 40.0f), ImGuiCond_FirstUseEver); ImGui::SetNextWindowSize(ImVec2(520.0f, 720.0f), ImGuiCond_FirstUseEver); - ge::chat_render(&g_app.panel_chat); + app_agent::chat_render(&g_app.panel_chat); // Extract panel (issue 0013) — flotante, dockeable. ImGui::SetNextWindowPos (ImVec2(vp->WorkPos.x + W * 0.30f, top + 50.0f), @@ -2501,7 +2501,7 @@ int main(int argc, char** argv) { // Chat panel (claude -p) — el agente invoca gx-cli para mutar // operations.db. agent_mutations counter en graph_explorer.db dispara // reload del viewport en cada cambio. - if (!ge::chat_init(g_input.uri ? g_input.uri : "", + if (!app_agent::chat_init(g_input.uri ? g_input.uri : "", app_db, app_dir.c_str())) { std::fprintf(stderr, "[graph_explorer] chat_init: claude no detectado " @@ -2586,7 +2586,7 @@ int main(int argc, char** argv) { sizeof(g_panels) / sizeof(g_panels[0])); // Cleanup - ge::chat_shutdown(); + app_agent::chat_shutdown(); ge::extract_panel_shutdown(); ge::jobs_shutdown(); if (g_layout_storage) {