Create a lightweight Warp web server for serving the trace viewer.
This is a new module that will run alongside the Telegram bot. It serves HTML pages and JSON API for viewing tool traces. The server should be minimal - just enough to serve traces.
Create: Omni/Ava/Web.hs
Use existing dependencies from the project:
Check Omni/Bild.nix for available Haskell packages.
Returns full HTML page with trace data embedded. Use a simple HTML template (can be a Text string in Haskell, or load from file).
Response: HTML page (Content-Type: text/html)
Returns raw trace data as JSON for dynamic loading.
Response: { "id": "trace-abc123", "created_at": "2025-12-20T00:00:00Z", "tool_name": "python_exec", "input": {...}, "output": {...}, "duration_ms": 1234 }
Simple health check for monitoring.
Response: 200 OK, body: "ok"
Export a function: startWebServer :: Int -> FilePath -> IO () Call this from Omni/Ava.hs main, running in a separate thread (forkIO).
module Omni.Ava.Web where
import qualified Network.Wai as Wai import qualified Network.Wai.Handler.Warp as Warp import qualified Network.HTTP.Types as HTTP
startWebServer :: Int -> FilePath -> IO () startWebServer port dbPath = Warp.run port (app dbPath)
app :: FilePath -> Wai.Application app dbPath request respond = do case Wai.pathInfo request of ["trace", traceId] -> serveTracePage dbPath traceId respond ["api", "trace", traceId] -> serveTraceJson dbPath traceId respond ["health"] -> respond $ Wai.responseLBS HTTP.status200 [] "ok" _ -> respond $ Wai.responseLBS HTTP.status404 [] "Not found"
Add basic tests for routing and 404 handling. Can use wai-extra for testing.