Commit Graph

9 Commits

Author SHA1 Message Date
egutierrez 9205567d5f feat(monitor): WS client live stream + apply snapshot/delta to UI
Hand-rolled minimal RFC6455 WebSocket client (~330 LOC) tailored to the
Monitor tab's needs. Single endpoint, text frames, masked client→server,
exponential reconnect backoff (0.5s → 8s cap), thread-safe in/out queues.
TLS is intentionally out of scope (localhost-only). Sec-WebSocket-Accept
verification is skipped — the server is controlled, 101 status is enough.

Files:
- ws_client.{h,cpp}: WsClient with start(host,port,path), drain(), send_text(),
  is_connected(), last_event_ts(). Worker thread does connect + handshake +
  read_loop + reconnect.
- CMakeLists.txt: pulls ws_client.cpp into the dashboard target. ws2_32 was
  already linked for http_client.cpp.
- main.cpp: parses host:port from --api URL, spawns a global WsClient, and
  drains its queue once per render frame via poll_ws(). apply_ws_message()
  routes JSON to g_data.claude:
    snapshot → replace KPIs + recent_executions
    delta    → append rows, increment total_calls / total_errors
  monitor_set_ws_state() forwards connection state + last_event_ts to the
  Monitor toolbar LED.

End-to-end smoke test passed against sqlite_api on localhost:8484:
- Snapshot received with KPIs + 100 recent rows.
- After INSERT INTO calls, delta arrives within ~250ms (server ticker).
- Errors (success=0) propagate correctly and bump the Errors KPI.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-14 00:34:03 +02:00
egutierrez 87b7ef45ff feat(monitor): Monitor tab as primary landing + errors KPI + recent executions + date filter
Rebrand "Claude Usage" tab to "Monitor" and promote it to first/default tab in
the main TabBar. Monitor is the landing for the reactive loop (construir →
ejecutar → recopilar → analizar → mejorar).

UI additions:
- Local toolbar inside Monitor with date preset combo (1h / 24h / 7d / 30d /
  All), manual Refresh button, and live LED + last-event-ts indicator.
- 5 KPI cards (was 4): added "Errors" derived from COUNT(*) FROM calls WHERE
  success = 0 filtered by the active window.
- New sub-tab "Recent Executions" (first sub-tab) with columns: When,
  Function, Tool, ms, OK (check/X colored), Error class. Backed by calls
  table, sorted by ts DESC, limit 100, filtered by window.
- Violations sub-tab gains "When" column with formatted ts.

Data layer:
- data.h: RecentExecutionRow + window_secs + ws_connected/last_event_ts /
  last_seen_call_id watermark on ClaudeUsageData.
- data_http.{h,cpp}: load_claude_usage_http now takes window_secs and embeds
  ts_filter() in calls/errors/violations queries. total_errors populated.
  recent_executions populated up to 100 rows. New standalone
  load_recent_executions_http() for future WS-driven partial refetch.
- main.cpp: reload_data preserves window_secs across reloads; new
  reload_monitor() does a Monitor-only refetch when the user changes the
  window or clicks Refresh, without re-querying the full registry.

Wiring:
- views.h: draw_monitor + monitor_consume_reload_request() +
  monitor_set_ws_state() exported. draw_claude_usage removed.
- views.cpp: render() consumes monitor_consume_reload_request each frame
  and dispatches reload_monitor().

This is the UI half of issue 0086. The server-side WebSocket endpoint in
sqlite_api and the C++ WS client are next; the LED is wired to
monitor_set_ws_state but stays gray until those land.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-14 00:26:29 +02:00
egutierrez 33d50aacdd feat(kotlin-compose): design system + 33 components + gallery_kt + e2e android emulator + scaffolder fixes
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-11 16:29:05 +02:00
egutierrez 00a19d8632 feat(dashboard): v0.3.0 — Status panel, dashboard_panel/grid, AppConfig pattern
- main.cpp: bump 0.2.0 → 0.3.0; añadir Status section en Settings via
  settings_window_add_section (fuente API/SQLite, URL, DB path, Reload).
- views.cpp: chart_panel manual + BeginChild custom → dashboard_panel/grid
  del registry. KPI cards con sparkline a la derecha, altura responsive.
- views.h: signature de draw_kpi_row pasa RegistryData (para sparkline).
- CMakeLists.txt: añadir process_state_machine.cpp (dependencia de
  process_runner tras issue 0045).
2026-04-29 00:58:17 +02:00
egutierrez a466fff71a feat: Settings submenu (Settings.../About...), git column, projects tab
- main.cpp: registrar info About via fn_ui::about_window_set_info
- views.cpp: nueva columna "Git" en la tabla Apps (remote/local/-)
- data.h/cpp + data_http.cpp: AppRow gana repo_url + dir_path
- views.cpp: actions bar (Reindex / + Add / Reload / inbox) y modal Add
- views.cpp: tab Projects con tree + detalle anidado
- data_http.cpp: load_projects_http, load_project_detail_http, http_post_*
- http_client.cpp: SO_RCVTIMEO en Windows como DWORD ms (timeout 5 ms bug)
- CMakeLists: limpieza de srcs duplicados con fn_framework
- app.md: notas operativas y estado actual

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-28 22:06:31 +02:00
egutierrez 5b7001ebfb refactor: reemplazar cpp-httplib por HTTP client minimalista
cpp-httplib requiere std::mutex que no compila con MinGW win32
thread model. Se reemplaza por http_client.cpp: sockets crudos,
sin threading, sin SSL, funciona en ambos thread models.
Elimina vendor/httplib.h (10K lineas). nlohmann/json se mantiene.

main.cpp: doble clic sin argumentos intenta la API en localhost:8484
automaticamente. Si falla muestra pantalla de error con boton Retry.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 01:45:30 +02:00
egutierrez 3de6b05357 feat: main.cpp intenta HTTP API primero, fallback a SQLite
Nuevo flujo: por defecto conecta a sqlite_api en localhost:8484.
Si la API no responde, cae a SQLite directo. Flag --api para URL
custom. Launcher PowerShell actualizado con --api. app.md refleja
la nueva arquitectura dual HTTP/SQLite y dir_path del proyecto.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 01:37:09 +02:00
egutierrez 615fd03e51 fix: printf format, paths WSL actualizados y repo_url en app.md
Corrige fprintf que usaba %s con std::string sin .c_str().
Actualiza path WSL en el launcher PowerShell a Ubuntu-22.04.
Añade repo_url en app.md apuntando al repo en Gitea.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 01:31:41 +02:00
Egutierrez 303b6d476d Initial commit: registry_dashboard — Dashboard ImGui para fn_registry 2026-04-08 00:42:29 +02:00