feat(cpp/core): sse_client_cpp_core — SSE client con reconnect + Last-Event-ID

Cliente Server-Sent Events C++ reusable (fn_sse::Client) con background
thread, exponential backoff, Last-Event-ID y stop() que no bloquea.

Implementacion clave: fork+execvp curl directamente (sin /bin/sh wrapper)
para tener el PID real del proceso curl en curl_pid_, lo que permite que
stop() → kill(SIGTERM) → fgets NULL → join() funcione sin bloqueo.

4 tests (Catch2): connect_and_receive_3_events, parse_event_field,
reconnect_on_disconnect, stop_kills_thread. Fixture Python SSE con
/health probe via http_request_cpp_core.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-18 19:59:50 +02:00
parent 741c86c042
commit eb57e83392
5 changed files with 888 additions and 0 deletions
+8
View File
@@ -308,3 +308,11 @@ add_fn_test(test_dod_evidence_panel test_dod_evidence_panel.cpp
# --- Issue 0118 — agent_runs_timeline: helpers puros ----------
add_fn_test(test_agent_runs_timeline test_agent_runs_timeline.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../functions/viz/agent_runs_timeline_helpers.cpp)
# --- sse_client: SSE client C++ (registry function) ----
# Integration test: forks a minimal Python SSE server fixture.
# Uses http_request for the /health readiness probe.
# Skips gracefully if python3 is not available.
add_fn_test(test_sse_client test_sse_client.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../functions/core/sse_client.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../functions/core/http_request.cpp)